Java Code Examples for org.spdx.rdfparser.InvalidSPDXAnalysisException#getMessage()
The following examples show how to use
org.spdx.rdfparser.InvalidSPDXAnalysisException#getMessage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpdxComparer.java From tools with Apache License 2.0 | 6 votes |
private void compareDocumentContents() throws SpdxCompareException { documentContentsEquals = true; try { for (int i = 0; i < spdxDocs.length; i++) { SpdxItem[] itemsA = spdxDocs[i].getDocumentDescribes(); for (int j = i; j < spdxDocs.length; j++) { SpdxItem[] itemsB = spdxDocs[j].getDocumentDescribes(); if (!spdxDocs[i].arraysEquivalent(itemsA, itemsB)) { this.documentContentsEquals = false; this.differenceFound = true; return; } } } } catch(InvalidSPDXAnalysisException ex) { throw(new SpdxCompareException("Error getting SPDX document items: "+ex.getMessage())); } }
Example 2
Source File: PackageContext.java From tools with Apache License 2.0 | 6 votes |
public String licenseDeclared() { if (pkg != null) { try { AnyLicenseInfo info = pkg.getLicenseDeclared(); if (info != null) { return info.toString(); } else { return null; } } catch (InvalidSPDXAnalysisException e) { return "Error getting SPDX Package copyright: "+e.getMessage(); } } else { return null; } }
Example 3
Source File: ExternalRefContext.java From tools with Apache License 2.0 | 6 votes |
public ExternalRefContext(ExternalRef externalRef) { if (externalRef != null) { if (externalRef.getReferenceCategory() != null) { category = externalRef.getReferenceCategory().getTag(); } try { if (externalRef.getReferenceType() != null) { type = externalRef.getReferenceType().toString(); } } catch (InvalidSPDXAnalysisException e) { type = "[ERROR: "+e.getMessage()+"]"; } if (externalRef.getReferenceLocator() != null) { locator = externalRef.getReferenceLocator(); } } }
Example 4
Source File: ExternalRefsSheet.java From tools with Apache License 2.0 | 6 votes |
/** * @param packageId Package ID for the package that contains this external ref * @param externalRef * @param container * @throws SpreadsheetException */ public void add(String packageId, ExternalRef externalRef, SpdxDocumentContainer container) throws SpreadsheetException { Row row = addRow(); if (packageId != null) { row.createCell(PKG_ID_COL).setCellValue(packageId); } if (externalRef != null) { if (externalRef.getReferenceCategory() != null) { row.createCell(REF_CATEGORY_COL).setCellValue(externalRef.getReferenceCategory().getTag()); } try { if (externalRef.getReferenceType() != null) { row.createCell(REF_TYPE_COL).setCellValue(refTypeToString(externalRef.getReferenceType(), container)); } } catch (InvalidSPDXAnalysisException e) { throw(new SpreadsheetException("Error getting external reference type: "+e.getMessage())); } if (externalRef.getReferenceLocator() != null) { row.createCell(REF_LOCATOR_COL).setCellValue(externalRef.getReferenceLocator()); } if (externalRef.getComment() != null) { row.createCell(COMMENT_COL).setCellValue(externalRef.getComment()); } } }
Example 5
Source File: SpdxComparer.java From tools with Apache License 2.0 | 5 votes |
/** * @throws SpdxCompareException * */ private void compareDataLicense() throws SpdxCompareException { try { AnyLicenseInfo lic1 = this.spdxDocs[0].getDataLicense(); this.dataLicenseEqual = true; for (int i = 1; i < spdxDocs.length; i++) { if (!lic1.equals(spdxDocs[i].getDataLicense())) { this.dataLicenseEqual = false; break; } } } catch (InvalidSPDXAnalysisException e) { throw(new SpdxCompareException("SPDX analysis error during compare data license: "+e.getMessage(),e)); } }
Example 6
Source File: CreatorInfoContext.java From tools with Apache License 2.0 | 5 votes |
public String created() { try { return doc.getCreationInfo().getCreated(); } catch (InvalidSPDXAnalysisException e) { return "Error getting creator created date: "+e.getMessage(); } }
Example 7
Source File: CreatorInfoContext.java From tools with Apache License 2.0 | 5 votes |
public String licenseListVersion() { String retval; try { retval = this.doc.getCreationInfo().getLicenseListVersion(); } catch (InvalidSPDXAnalysisException e) { return "Error getting license list version: "+e.getMessage(); }; if (retval == null) { retval = ""; } return retval; }
Example 8
Source File: CreatorInfoContext.java From tools with Apache License 2.0 | 5 votes |
public String comment() { try { if (doc.getCreationInfo() != null) { return doc.getCreationInfo().getComment(); } else { return null; } } catch (InvalidSPDXAnalysisException e) { return "Error getting creator comment: "+e.getMessage(); } }
Example 9
Source File: SnippetContext.java From tools with Apache License 2.0 | 5 votes |
public String snippetFromFile() { if (snippet == null) { return "Error getting SPDX snippet information: "+ (error != null ? error.getMessage() : "null"); } try { SpdxFile fromFile = this.snippet.getSnippetFromFile(); if (fromFile.getId() != null && fromFile.getName() != null) { return fromFile.getName() + " (" + fromFile.getId() + ")"; } else { return "[UNKNOWN]"; } } catch (InvalidSPDXAnalysisException e) { return "Error getting SPDX snippet from file: " + e.getMessage(); } }
Example 10
Source File: SpdxFileComparer.java From tools with Apache License 2.0 | 4 votes |
/** * Return a file difference for the file contained in two different documents * @param docA * @param docB * @return * @throws SpdxCompareException */ public SpdxFileDifference getFileDifference(SpdxDocument docA, SpdxDocument docB) throws SpdxCompareException { checkInProgress(); checkCompareMade(); try { SpdxItem itemA = this.documentItem.get(docA); if (itemA == null || !(itemA instanceof SpdxFile)) { throw(new SpdxCompareException("No SPDX File associated with "+docA.getName())); } SpdxFile fileA = (SpdxFile)itemA; SpdxItem itemB = this.documentItem.get(docB); if (itemB == null || !(itemB instanceof SpdxFile)) { throw(new SpdxCompareException("No SPDX File associated with "+docB.getName())); } SpdxFile fileB = (SpdxFile)itemB; AnyLicenseInfo[] uniqueLicenseInfoInFilesA = this.getUniqueSeenLicenses(docA, docB); AnyLicenseInfo[] uniqueLicenseInfoInFilesB = this.getUniqueSeenLicenses(docB, docA); boolean licenseInfoInFilesEquals = uniqueLicenseInfoInFilesA.length == 0 && uniqueLicenseInfoInFilesB.length == 0; DoapProject[] uniqueArtifactOfA = this.getUniqueArtifactOf(docA, docB); DoapProject[] uniqueArtifactOfB = this.getUniqueArtifactOf(docB, docA); boolean artifactOfEquals = uniqueArtifactOfA.length == 0 && uniqueArtifactOfB.length == 0; Checksum[] uniqueChecksumsA = this.getUniqueChecksums(docA, docB); Checksum[] uniqueChecksumsB = this.getUniqueChecksums(docB, docA); boolean checksumsEquals = uniqueChecksumsA.length == 0 && uniqueChecksumsB.length == 0; Relationship[] uniqueRelationshipA = this.getUniqueRelationship(docA, docB); Relationship[] uniqueRelationshipB = this.getUniqueRelationship(docB, docA); boolean relationshipsEquals = uniqueRelationshipA.length == 0 && uniqueRelationshipB.length == 0; Annotation[] uniqueAnnotationsA = this.getUniqueAnnotations(docA, docB); Annotation[] uniqueAnnotationsB = this.getUniqueAnnotations(docB, docA); boolean annotationsEquals = uniqueAnnotationsA.length == 0 && uniqueAnnotationsB.length == 0; return new SpdxFileDifference(fileA, fileB, fileA.getLicenseConcluded().equals(fileB.getLicenseConcluded()), licenseInfoInFilesEquals, uniqueLicenseInfoInFilesA, uniqueLicenseInfoInFilesB, artifactOfEquals, uniqueArtifactOfA, uniqueArtifactOfB, checksumsEquals, uniqueChecksumsA, uniqueChecksumsB, relationshipsEquals, uniqueRelationshipB, uniqueRelationshipB, annotationsEquals, uniqueAnnotationsA, uniqueAnnotationsB); } catch (InvalidSPDXAnalysisException e) { throw (new SpdxCompareException("Error reading SPDX file propoerties: "+e.getMessage(),e)); } }
Example 11
Source File: ElementContext.java From tools with Apache License 2.0 | 4 votes |
public ElementContext(InvalidSPDXAnalysisException e) { this.error = e.getMessage(); }