https://bugs.linuxfoundation.org/show_bug.cgi?id=1305

             Bug #: 1305
           Summary: VerificationCodeGenerator.java sorts data twice.
           Product: SPDX
           Version: 2.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Pretty Printer
        AssignedTo: spdx-t...@fossbazaar.org
        ReportedBy: sce...@icloud.com
    Classification: Unclassified


In rc/org/spdx/rdfparser/VerificationCodeGenerator.java:

The methods with the following signatures:

        public SpdxPackageVerificationCode
generatePackageVerificationCode(SPDXFile[] spdxFiles, String[]
skippedFilePaths)

        public SpdxPackageVerificationCode
generatePackageVerificationCode(SpdxFile[] spdxFiles, String[]
skippedFilePaths) throws NoSuchAlgorithmException {

Contain as the final statements:

                Collections.sort(fileChecksums);
                return generatePackageVerificationCode(fileChecksums,
skippedFilePaths);

The sort here is unnecessary and could be removed because the first statement
of the method called on the next line is to sort the same data again:

        protected SpdxPackageVerificationCode
generatePackageVerificationCode(ArrayList<String> fileChecksums,
                        String[] skippedFilePaths) throws
NoSuchAlgorithmException {
                Collections.sort(fileChecksums);
                MessageDigest verificationCodeDigest =
MessageDigest.getInstance("SHA-1");

-- 
Configure bugmail: https://bugs.linuxfoundation.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Spdx-tech mailing list
Spdx-tech@lists.spdx.org
https://lists.spdx.org/mailman/listinfo/spdx-tech

Reply via email to