You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried running the CompareDocs functionality on the standard SPDX 2.3 example and got the following error:
java -jar tools-java-1.1.6-SNAPSHOT-jar-with-dependencies.jar CompareDocs output.xlsx SPDXJSONExample-v2.3.spdx.json SPDXJSONExample-v2.3.spdx.json
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
Error opening SPDX document SPDXJSONExample-v2.3.spdx.json: Duplicate document namespace http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301. Document namespaces must be unique per specification and for a valid comparison.
That specific namespace is indeed duplicated in the referenceType of acmecorp/acmenator/4.1.3-alpha, something which we might need to adapt in the spec examples?
But the error above persists if I change the namespace so that it does not equal the other one anymore.
@armintaenzertng This error is referring to both documents having the same namespace - if you change the documentNamespace value in one of the to comparison documents to be different it will work.
Just FYI - The message is correct in stating the document namespaces must be unique per the spec, but the real reason for the error is due to a check before the compare takes place. Before that check, the compare documents acted more like merge documents and gave unexpected results.
Now that I think about it, we could change this from an error to a warning.
Instead of failing, we could, for the purpose of comparison, change the document namespace for one of the documents to be unique (e.g. add a random millisecond timestamp) and print the a warning like:
Warning - More than one document in the comparison has the same document namespace. The specification requires
documents to each have a unique namespace. XXXX was renamed to YYYY for the this compare.
@armintaenzertng - what do you think? It would actually help me when using the utility for Docfests where we tend to get multiple documents submitted with the same namespace.
For context: My intended use case was to compare two documents for actual equality. That is, I actually expect them to have the same namespace because they are the same. There would still be the issue that the output xlsx format would not be very well suited for an automated testing approach. Do you think we could add an stdout line stating whether the documents were equal or not?
My intended use case was to compare two documents for actual equality. That is, I actually expect them to have the same namespace because they are the same.
A different use case than what I've been using it for, but it makes sense. Changing the namespace for the compare would fix it. I would choose a slightly different message - more informational than warning.
Do you think we could add an stdout line stating whether the documents were equal or not?
Activity
goneall commentedon Apr 14, 2023
@armintaenzertng This error is referring to both documents having the same namespace - if you change the
documentNamespacevalue in one of the to comparison documents to be different it will work.Just FYI - The message is correct in stating the document namespaces must be unique per the spec, but the real reason for the error is due to a check before the compare takes place. Before that check, the compare documents acted more like merge documents and gave unexpected results.
goneall commentedon Apr 14, 2023
Now that I think about it, we could change this from an error to a warning.
Instead of failing, we could, for the purpose of comparison, change the document namespace for one of the documents to be unique (e.g. add a random millisecond timestamp) and print the a warning like:
@armintaenzertng - what do you think? It would actually help me when using the utility for Docfests where we tend to get multiple documents submitted with the same namespace.
armintaenzertng commentedon Apr 17, 2023
Sounds like a good idea, Gary! :)
For context: My intended use case was to compare two documents for actual equality. That is, I actually expect them to have the same namespace because they are the same. There would still be the issue that the output xlsx format would not be very well suited for an automated testing approach. Do you think we could add an stdout line stating whether the documents were equal or not?
goneall commentedon Apr 17, 2023
A different use case than what I've been using it for, but it makes sense. Changing the namespace for the compare would fix it. I would choose a slightly different message - more informational than warning.
Sounds like a good idea.
Check for duplicate document URI in compare
Sync with original repository (#1)