2626import org .apache .poi .ss .usermodel .Sheet ;
2727import org .apache .poi .ss .usermodel .Workbook ;
2828import org .spdx .core .InvalidSPDXAnalysisException ;
29+ import org .spdx .library .model .v2 .SpdxCreatorInformation ;
2930import org .spdx .utility .compare .SpdxCompareException ;
3031import org .spdx .utility .compare .SpdxComparer ;
3132
3233/**
33- * Sheet to hold compare information at the docment level:
34+ * Sheet to hold compare information at the document level:
3435 * Created, Data License, Document Comment
3536 * The first row summarizes which fields are different, the subsequent rows are the
3637 * specific date from each result
@@ -254,9 +255,12 @@ private void importLicenseListVersions(SpdxComparer comparer) throws SpdxCompare
254255 // data rows
255256 for (int i = 0 ; i < comparer .getNumSpdxDocs (); i ++) {
256257 cell = sheet .getRow (getFirstDataRow ()+i +1 ).createCell (LICENSE_LIST_VERSION_COL );
257- Optional <String > licenseListVersion = comparer .getSpdxDoc (i ).getCreationInfo ().getLicenseListVersion ();
258- if (licenseListVersion .isPresent ()) {
259- cell .setCellValue (licenseListVersion .get ());
258+ SpdxCreatorInformation creationInfo = comparer .getSpdxDoc (i ).getCreationInfo ();
259+ if (creationInfo != null ) {
260+ Optional <String > licenseListVersion = creationInfo .getLicenseListVersion ();
261+ if (licenseListVersion .isPresent ()) {
262+ cell .setCellValue (licenseListVersion .get ());
263+ }
260264 }
261265 }
262266 }
@@ -340,11 +344,13 @@ private void importCreatorComment(SpdxComparer comparer) throws InvalidSPDXAnaly
340344 // data rows
341345 for (int i = 0 ; i < comparer .getNumSpdxDocs (); i ++) {
342346 cell = sheet .getRow (getFirstDataRow ()+i +1 ).createCell (CREATOR_COMMENT_COL );
343- Optional <String > creatorComment = comparer .getSpdxDoc (i ).getCreationInfo ().getComment ();
344- if (creatorComment .isPresent ()) {
345- cell .setCellValue (creatorComment .get ());
347+ SpdxCreatorInformation creationInfo = comparer .getSpdxDoc (i ).getCreationInfo ();
348+ if (creationInfo != null ) {
349+ Optional <String > creatorComment = creationInfo .getComment ();
350+ if (creatorComment .isPresent ()) {
351+ cell .setCellValue (creatorComment .get ());
352+ }
346353 }
347-
348354 }
349355 }
350356
@@ -364,7 +370,10 @@ private void importCreationDate(SpdxComparer comparer) throws InvalidSPDXAnalysi
364370 // data rows
365371 for (int i = 0 ; i < comparer .getNumSpdxDocs (); i ++) {
366372 cell = sheet .getRow (getFirstDataRow ()+i +1 ).createCell (CREATION_DATE_COL );
367- cell .setCellValue (comparer .getSpdxDoc (i ).getCreationInfo ().getCreated ());
373+ SpdxCreatorInformation creationInfo = comparer .getSpdxDoc (i ).getCreationInfo ();
374+ if (creationInfo != null ) {
375+ cell .setCellValue (creationInfo .getCreated ());
376+ }
368377 }
369378 }
370379
0 commit comments