Skip to content

CompareDocs error #117

Closed
Closed

Description

@armintaenzertng

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.

Activity

  1. goneall commented on Apr 14, 2023

    @goneall
    Member

    @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.

  2. goneall commented on Apr 14, 2023

    @goneall
    Member

    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.

  3. armintaenzertng commented on Apr 17, 2023

    @armintaenzertng
    Author

    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?

  4. goneall commented on Apr 17, 2023

    @goneall
    Member

    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?

    Sounds like a good idea.

  5. added a commit that references this issue on May 11, 2023
    6f70f97
  6. added a commit that references this issue on Jun 25, 2025
    b6ec62f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions