Conversation
Checks simple license tokens to make sure they are either a listed license or a LicenseRef- Fixes #227
|
@goneall this is probably a separate issue, unrelated to this PR, but I'm not seeing any parsing of |
src/main/java/org/spdx/utility/license/LicenseExpressionParser.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Arthit Suriyawongkul <arthit@gmail.com> Signed-off-by: Gary O'Neall <gary@sourceauditor.com>
Good catch @pmonks - In looking at the license addition code, I realized I'm not taking into account external license refs which is yet another issue. I'll add a check for the |
|
@goneall if it's helpful, here are the regexes I use in my own parser for LicenseRefs & AdditionRefs (the values inside the ; LicenseRefs:
#"(DocumentRef-(?<DocumentRef>[\p{Alnum}-\.]+):)?LicenseRef-(?<LicenseRef>[\p{Alnum}-\.]+)"
; AdditionRefs:
#"(DocumentRef-(?<AdditionDocumentRef>[\p{Alnum}-\.]+):)?AdditionRef-(?<AdditionRef>[\p{Alnum}-\.]+)"Clojure is hosted on the JVM, so these regexes will also work in Spdx-Java-Library (albeit with escaping as needed for a Java string literal that then gets compiled to a Oh and note that these regexes make use of named capturing groups for extracting the custom sections of the |
Turns out I was checking for external license refs (first line of the method), so I only need to add the additional check for the additionref syntax. @pmonks - let me know if I missed anything |
bact
left a comment
There was a problem hiding this comment.
Minor changes, adding 'a'.
src/main/java/org/spdx/utility/license/LicenseExpressionParser.java
Outdated
Show resolved
Hide resolved
src/main/java/org/spdx/utility/license/LicenseExpressionParser.java
Outdated
Show resolved
Hide resolved
src/main/java/org/spdx/utility/license/LicenseExpressionParser.java
Outdated
Show resolved
Hide resolved
src/test/java/org/spdx/utility/license/LicenseExpressionParserTest.java
Outdated
Show resolved
Hide resolved
….java Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
….java Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
….java Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
…Test.java Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Checks simple license tokens to make sure they are either a listed license or a LicenseRef-
Fixes #227