File tree Expand file tree Collapse file tree
main/java/com/adobe/epubcheck/ocf Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -250,16 +250,6 @@ private boolean checkContainerFile(OCFCheckerState state)
250250 }
251251 return false ;
252252 }
253- // FIXME 2022 - report container info
254- // long l = container.getTimeEntry(OCFData.containerEntry);
255- // if (l > 0)
256- // {
257- // Date d = new Date(l);
258- // String formattedDate = new
259- // SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(d);
260- // report.info(OCFData.containerEntry, FeatureEnum.CREATION_DATE,
261- // formattedDate);
262- // }
263253
264254 ValidationContext containerFileContext = state .context ()
265255 .url (OCFMetaFile .CONTAINER .asURL (container )).mimetype ("application/xml" ).build ();
@@ -559,9 +549,14 @@ private void reportFeatures(OCFResource resource)
559549 {
560550 for (FeatureEnum feature : resource .getProperties ().keySet ())
561551 {
562- // report.info(context.path, feature,
563- // resource.getProperties().get(feature));
564- report .info (resource .getPath (), feature , resource .getProperties ().get (feature ));
552+ if (feature == FeatureEnum .CREATION_DATE
553+ && !OCFMetaFile .CONTAINER .asPath ().equals (resource .getPath ()))
554+ {
555+ // we only report the creation date once
556+ continue ;
557+ }
558+ report .info (resource .getPath (), feature ,
559+ resource .getProperties ().get (feature ));
565560 }
566561 }
567562
Original file line number Diff line number Diff line change 55import java .io .InputStream ;
66import java .nio .charset .StandardCharsets ;
77import java .security .MessageDigest ;
8+ import java .text .SimpleDateFormat ;
9+ import java .util .Date ;
810import java .util .Enumeration ;
911import java .util .Iterator ;
1012import java .util .Map ;
@@ -48,11 +50,14 @@ public OCFResource next()
4850 throws NoSuchElementException
4951 {
5052 final ZipEntry entry = entries .nextElement ();
53+
5154 final Map <FeatureEnum , String > properties = ImmutableMap .<FeatureEnum , String > builder ()
5255 .put (FeatureEnum .SIZE , String .valueOf (entry .getSize ()))
5356 .put (FeatureEnum .COMPRESSED_SIZE , String .valueOf (entry .getCompressedSize ()))
5457 .put (FeatureEnum .COMPRESSION_METHOD , getCompressionMethod (entry ))
5558 .put (FeatureEnum .SHA_256 , getSHAHash (entry , zip ))
59+ .put (FeatureEnum .CREATION_DATE ,
60+ new SimpleDateFormat ("yyyy-MM-dd'T'HH:mm:ss'Z'" ).format (new Date (entry .getTime ())))
5661 .build ();
5762
5863 return new OCFResource ()
@@ -87,7 +92,7 @@ public String getPath()
8792 {
8893 return entry .getName ();
8994 }
90-
95+
9196 @ Override
9297 public String toString ()
9398 {
Original file line number Diff line number Diff line change 1414 Then the XML report is well-formed
1515 And XPath '//repInfo' exists
1616
17+ Scenario : Creation date is set
18+ When checking EPUB 'minimal'
19+ And XPath '//repInfo/created' exists
20+
21+
You can’t perform that action at this time.
0 commit comments