Comments (4)
Good to hear it works.
Thanks @jkrae-metaeffekt for taking this on. I'll assign it to you.
BTW - I'm going to be traveling for 2-3 weeks without my laptop, so it may take me a while to respond.
@pmonks - Feel free to review / merge and PR's while I'm out if your comfortable, otherwise I'll catch up once I'm back.
from spdx-java-library.
Seems Github refuses .java. I'll upload the example code as a txt, i guess.
SpdxExtractedLicenseInfoBehaviour.txt
from spdx-java-library.
Wow - @jkrae-metaeffekt sorry to hear about the challenges in what should be a straight-forward task.
Example 1 should work.
My guess is that the stores are getting confused.
There is a default store, but you can pass in store to override it. When using the parsing, it uses the default store which is probably causing some of the issues.
Calling new ExtractedLicenseInfo(licenseRef, text)
will also use the default license store.
There is a lower level API for every SPDX Element / object that takes the store a parameters.
I would suggest trying the following:
ExtractedLicenseInfo eli = new ExtractedLicenseInfo(document.getModelStore(), document.getDocumentUri(), licenseRef, document.getCopyManager(), true);
eli.setExtractedText(text);
document.addExtractedLicenseInfos(eli);
There are a number of "helper methods" in the ModelObject
which is superclass of all SPDX elements to create new objects copying the same store / etc. Unfortunately, it looks like one doesn't exist for ExtractedLicenseInfo.
If one did exist, you could just call document.addExtractedLicenseInfos(document.createExtractedLicense(licenseRef, text))
Having the above mentioned method would be a consisted API to solve this problem.
Let me know if the above low level API works. If so, we should create a PR to add the additional helper method.
Thanks for you patience.
from spdx-java-library.
Thank you for your help!
Also: Yay! Your suggestion works correctly when dropped into my test class.
Please consider assigning this issue to me, I'll go work on a PR to add the (very much necessary, i think) helper method. I'll try to dress up the documentation (ExtractedLicenseInfo constructors, perhaps?), also. Hopefully it will prevent someone from running into the same issue.
from spdx-java-library.
Related Issues (20)
- LicenseCompareHelper: GPL-2.0 license text not recognised HOT 2
- Question HOT 2
- Refactor nonOptionalTextToPatterns HOT 2
- Verify error when license exceptions are used in an expression in LicenseConcluded but not in LicenseInfoInFile HOT 2
- Official Apache-1.1 license text is not being matched correctly by LicenseCompareHelper.matchingStandardLicenseIdsWithinText() HOT 1
- Official GPL-1.0 license text is not being matched correctly by LicenseCompareHelper.isTextStandardLicense() HOT 1
- Potential enhancement: LicenseCompareHelper.isTextStandardLicense().getDifferenceMessage() should sort by line then column
- Official CC-BY-4.0 license text is not being matched correctly by LicenseCompareHelper.isTextStandardLicense() HOT 3
- Inconsistent behaviour between LicenseCompareHelper methods when called with official MIT license text HOT 1
- How to normalize the text for regex matching in src/main/java/org/spdx/utility/compare/TemplateRegexMatcher.java
- Add API to return licenses as a map in addition to list HOT 1
- Method `LicenseInfoFactory::getListedLicenseById` never returns `null` HOT 1
- Official MIT license text is not recognized as MIT by LicenseCompareHelper.isStandardLicenseWithinText HOT 4
- StringIndexOutOfBoundsException exception from org.spdx.utility.compare.TemplateRegexMatcher.findTemplateWithinText() HOT 1
- Column in DifferenceDescription returned by LicenseCompareHelper.isTextMatchingTemplate is not correct HOT 1
- TemplateRegexMatcher.getStartRegex sometimes returns a regex that matches with an index before the license start HOT 1
- Official GPL-2.0 license text not recognized HOT 3
- Warning message for License list version HOT 9
- Deadlock in ListedLicenseWebStore HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spdx-java-library.