StephenOTT / STIX-Java

STIX 2.x Java Library
MIT License
27 stars 13 forks source link

created TLP classes as defined in spec #97

Open anlklsim opened 5 years ago

anlklsim commented 5 years ago

The STIX spec defines the exact ID and created date for the 4 TLP markings. I defined them in a class as static values and created a test Spec. It's interesting that the markings do not need to be within the bundle.

Note that the Stix Mocking for TLP Marking defs makes up custom properties, but they are not really allowed for the TLP markings.

StephenOTT commented 5 years ago

Great stuff.

I am waiting for a response on this: https://github.com/oasis-tcs/cti-stix2/issues/152 before merging.

The extreme limitation on the TLPs is very weird, and would like to document its usage before we implement the rest of the TLPs

Further tasks:

StephenOTT commented 5 years ago

@anlklsim what scenario causes the NPE that you fixed for the getCause() ?

anlklsim commented 5 years ago

I had mistakenly called STIXParsers.parseObject on my bundle in my test, which threw an IOExeption in the method (since it was not a BundleableObject), and the if statement threw an NPE on ex.getClause() and therefore only the NPE was logged in the Junit as the error (hiding the true exception message). Stepping thru the debugger, I saw the error, added the null check, and then the true error printed out. Only then, did I notice that I was calling the wrong method. I added the same check to parseBundle to be complete.