Skip to content

Commit

Permalink
Merge pull request #33 from spdx/issue32
Browse files Browse the repository at this point in the history
Always pass copymanager to parse license
  • Loading branch information
goneall authored Dec 13, 2024
2 parents b1a6298 + c76ab4e commit 3043eae
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
14 changes: 7 additions & 7 deletions src/main/java/org/spdx/spreadsheetstore/AbstractSheet.java
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,10 @@ private int getNumWrappedLines(Cell cell) {
}

/**
* Create a string from an array of checksums
* @param checksums
* @return
* @throws InvalidSPDXAnalysisException
* Create a string from a collection of checksums
* @param checksumCollection collection of checksums
* @return string representation of the checksum
* @throws InvalidSPDXAnalysisException on SPDX parsing errors
*/
public String checksumsToString(Collection<Checksum> checksumCollection) throws InvalidSPDXAnalysisException {
if (checksumCollection == null || checksumCollection.size() == 0) {
Expand Down Expand Up @@ -381,9 +381,9 @@ public Collection<Checksum> strToChecksums(String checksumsString) throws Spread

/**
* Creates a Checksum from the parameters specified in the tag value
* @param value
* @return
* @throws InvalidSpdxTagFileException
* @param value checksum string formatted with the algorithm
* @return Checksum
* @throws SpreadsheetException on errors parsing the checksum
*/
public Checksum parseChecksum(String value) throws SpreadsheetException {
Matcher matcher = CHECKSUM_PATTERN.matcher(value.trim());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private String validateRow(Row row, IModelStore verifyModelStore) {
} else {
if (i == DECLARED_LICENSE_COL || i == CONCLUDED_LICENSE_COL) {
try {
LicenseInfoFactory.parseSPDXLicenseStringCompatV2(cell.getStringCellValue(), verifyModelStore, documentUri, null);
LicenseInfoFactory.parseSPDXLicenseStringCompatV2(cell.getStringCellValue(), verifyModelStore, documentUri, copyManager);
} catch(InvalidSPDXAnalysisException ex) {
if (i == DECLARED_LICENSE_COL) {
return "Invalid declared license in row "+String.valueOf(row.getRowNum())+" detail: "+ex.getMessage() + " in PackageInfo sheet.";
Expand All @@ -182,7 +182,7 @@ private String validateRow(Row row, IModelStore verifyModelStore) {
}
for (int j = 0; j < licenses.length; j++) {
try {
LicenseInfoFactory.parseSPDXLicenseStringCompatV2(licenses[j], verifyModelStore, documentUri, null);
LicenseInfoFactory.parseSPDXLicenseStringCompatV2(licenses[j], verifyModelStore, documentUri, copyManager);
} catch(InvalidSPDXAnalysisException ex) {
return "Invalid license information in in files for license "+licenses[j]+ " row "+String.valueOf(row.getRowNum())+" detail: "+ex.getMessage() + " in PackageInfo sheet.";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ private String validateRow(Row row, IModelStore verifyModelStore) {
} else {
if (i == DECLARED_LICENSE_COL || i == CONCLUDED_LICENSE_COL) {
try {
LicenseInfoFactory.parseSPDXLicenseStringCompatV2(cell.getStringCellValue(), verifyModelStore, documentUri, null);
LicenseInfoFactory.parseSPDXLicenseStringCompatV2(cell.getStringCellValue(), verifyModelStore, documentUri, copyManager);
} catch(InvalidSPDXAnalysisException ex) {
if (i == DECLARED_LICENSE_COL) {
return "Invalid declared license in row "+String.valueOf(row.getRowNum())+" detail: "+ex.getMessage() + " in PackageInfo sheet.";
Expand All @@ -198,7 +198,8 @@ private String validateRow(Row row, IModelStore verifyModelStore) {
}
for (int j = 0; j < licenses.length; j++) {
try {
LicenseInfoFactory.parseSPDXLicenseStringCompatV2(licenses[j], verifyModelStore, documentUri, null);
LicenseInfoFactory.parseSPDXLicenseStringCompatV2(licenses[j], verifyModelStore, documentUri, copyManager
);
} catch(InvalidSPDXAnalysisException ex) {
return "Invalid license information in in files for license "+licenses[j]+ " row "+String.valueOf(row.getRowNum())+" detail: "+ex.getMessage() + " in PackageInfo sheet.";
}
Expand Down Expand Up @@ -451,7 +452,8 @@ private SpdxPackage getPackage(int rowNum) throws SpreadsheetException, DefaultS
Cell concludedLicensesCell = row.getCell(CONCLUDED_LICENSE_COL);
if (concludedLicensesCell != null && !concludedLicensesCell.getStringCellValue().isEmpty()) {
try {
concludedLicense = LicenseInfoFactory.parseSPDXLicenseStringCompatV2(concludedLicensesCell.getStringCellValue(), modelStore, documentUri, copyManager);
concludedLicense = LicenseInfoFactory.parseSPDXLicenseStringCompatV2(concludedLicensesCell.getStringCellValue(),
modelStore, documentUri, copyManager);
} catch (InvalidLicenseStringException e) {
throw new SpreadsheetException("Invalid concluded license file for package "+declaredName, e);
}
Expand All @@ -467,7 +469,8 @@ private SpdxPackage getPackage(int rowNum) throws SpreadsheetException, DefaultS
Cell declaredLicensesCell = row.getCell(DECLARED_LICENSE_COL);
if (declaredLicensesCell != null && !declaredLicensesCell.getStringCellValue().isEmpty()) {
try {
declaredLicenses = LicenseInfoFactory.parseSPDXLicenseStringCompatV2(declaredLicensesCell.getStringCellValue(), modelStore, documentUri, copyManager);
declaredLicenses = LicenseInfoFactory.parseSPDXLicenseStringCompatV2(declaredLicensesCell.getStringCellValue(),
modelStore, documentUri, copyManager);
} catch (InvalidLicenseStringException e1) {
throw new SpreadsheetException("Invalid declared license for package "+declaredName, e1);
}
Expand Down

0 comments on commit 3043eae

Please sign in to comment.