@@ -111,7 +111,7 @@ public void testVerify() throws InvalidSPDXAnalysisException {
111111 List <String > contributors = Arrays .asList (new String [] {"Contrib1" , "Contrib2" });
112112
113113 SpdxFile fileDep1 = gmo .createSpdxFile (gmo .getModelStore ().getNextId (IdType .SpdxId , gmo .getDocumentUri ()),
114- "fileDep1" , COMPLEX_LICENSE , seenLic , "Copyright1" , SHA1 )
114+ "./ fileDep1" , COMPLEX_LICENSE , seenLic , "Copyright1" , SHA1 )
115115 .setLicenseComments ("License Comments1" )
116116 .setComment ("Comment1" )
117117 .setNoticeText ("Notice Text" )
@@ -123,15 +123,15 @@ public void testVerify() throws InvalidSPDXAnalysisException {
123123 assertEquals (0 , verify .size ());
124124
125125 SpdxFile fileDep2 =gmo .createSpdxFile (gmo .getModelStore ().getNextId (IdType .SpdxId , gmo .getDocumentUri ()),
126- "fileDep2" , COMPLEX_LICENSE , seenLic , "Copyright2" , SHA1 )
126+ "./ fileDep2" , COMPLEX_LICENSE , seenLic , "Copyright2" , SHA1 )
127127 .setComment ("Comment2" )
128128 .addAnnotation (ANNOTATION3 )
129129 .setLicenseComments ("License Comments2" )
130130 .addFileType (FileType .BINARY )
131131 .build ();
132132
133133 String fileNotice = "File Notice" ;
134- String name = "fileName" ;
134+ String name = "./ fileName" ;
135135 String comment = "file comments" ;
136136 String copyright = "Copyrights" ;
137137 String licenseComment = "License comments" ;
@@ -155,7 +155,7 @@ public void testVerify23Fields() throws InvalidSPDXAnalysisException {
155155
156156
157157 SpdxFile file = gmo .createSpdxFile (gmo .getModelStore ().getNextId (IdType .SpdxId , gmo .getDocumentUri ()),
158- "name" , null , Arrays .asList (new AnyLicenseInfo [] {}), null , SHA1 )
158+ "./ name" , null , Arrays .asList (new AnyLicenseInfo [] {}), null , SHA1 )
159159 .build ();
160160 assertEquals (0 , file .verify ().size ());
161161 assertTrue (file .verify (Version .TWO_POINT_ZERO_VERSION ).size () > 0 );
@@ -489,4 +489,22 @@ public void testDependency() throws InvalidSPDXAnalysisException {
489489 assertEquals (1 , result .size ());
490490 assertTrue (result .contains (dep ));
491491 }
492+
493+ public void testVerifyNonLocalFileName () throws InvalidSPDXAnalysisException {
494+ SpdxFile file = gmo .createSpdxFile (gmo .getModelStore ().getNextId (IdType .SpdxId , gmo .getDocumentUri ()),
495+ "/filename" , COMPLEX_LICENSE , Arrays .asList (CONJUNCTIVE_LICENSES ), SpdxConstants .NOASSERTION_VALUE , SHA1 )
496+ .build ();
497+ List <String > result = file .verify ();
498+ assertEquals (1 , result .size ());
499+ SpdxFile file2 = gmo .createSpdxFile (gmo .getModelStore ().getNextId (IdType .SpdxId , gmo .getDocumentUri ()),
500+ "./filename" , COMPLEX_LICENSE , Arrays .asList (CONJUNCTIVE_LICENSES ), SpdxConstants .NOASSERTION_VALUE , SHA1 )
501+ .build ();
502+ result = file2 .verify ();
503+ assertTrue (result .isEmpty ());
504+ SpdxFile file3 = gmo .createSpdxFile (gmo .getModelStore ().getNextId (IdType .SpdxId , gmo .getDocumentUri ()),
505+ "filename" , COMPLEX_LICENSE , Arrays .asList (CONJUNCTIVE_LICENSES ), SpdxConstants .NOASSERTION_VALUE , SHA1 )
506+ .build ();
507+ result = file3 .verify ();
508+ assertTrue (result .isEmpty ());
509+ }
492510}
0 commit comments