pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1659996 - /pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/metadata/SynchronizedMetaDataValidation.java
Date Sun, 15 Feb 2015 20:58:34 GMT
Author: tilman
Date: Sun Feb 15 20:58:34 2015
New Revision: 1659996

URL: http://svn.apache.org/r1659996
Log:
PDFBOX-2664: remove catch of exception that is never thrown

Modified:
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/metadata/SynchronizedMetaDataValidation.java

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/metadata/SynchronizedMetaDataValidation.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/metadata/SynchronizedMetaDataValidation.java?rev=1659996&r1=1659995&r2=1659996&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/metadata/SynchronizedMetaDataValidation.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/metadata/SynchronizedMetaDataValidation.java
Sun Feb 15 20:58:34 2015
@@ -21,7 +21,6 @@
 
 package org.apache.pdfbox.preflight.metadata;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Iterator;
@@ -350,15 +349,7 @@ public class SynchronizedMetaDataValidat
             throws ValidationException
     {
         Calendar creationDate = null;
-        try
-        {
-            creationDate = dico.getCreationDate();
-        }
-        catch (IOException e)
-        {
-            // If there is an error while converting this property to a date
-            ve.add(new ValidationError(PreflightConstants.ERROR_METADATA_DICT_INFO_CORRUPT,
"Document Information 'CreationDate' can't be read : " + e.getMessage()));
-        }
+        creationDate = dico.getCreationDate();
         if (creationDate != null)
         {
             if (xmp != null)
@@ -405,46 +396,37 @@ public class SynchronizedMetaDataValidat
             throws ValidationException
     {
         Calendar modifyDate;
-        try
+        modifyDate = dico.getModificationDate();
+        if (modifyDate != null)
         {
-            modifyDate = dico.getModificationDate();
-            if (modifyDate != null)
+            if (xmp != null)
             {
-                if (xmp != null)
-                {
 
-                    Calendar xmpModifyDate = xmp.getModifyDate();
-                    if (xmpModifyDate == null)
+                Calendar xmpModifyDate = xmp.getModifyDate();
+                if (xmpModifyDate == null)
+                {
+                    ve.add(absentXMPPropertyError("ModifyDate", "Property is not defined"));
+                }
+                else
+                {
+                    if (!DateConverter.toISO8601(xmpModifyDate).equals(DateConverter.toISO8601(modifyDate)))
                     {
-                        ve.add(absentXMPPropertyError("ModifyDate", "Property is not defined"));
+
+                        ve.add(unsynchronizedMetaDataError("ModificationDate"));
                     }
-                    else
+                    else if (hasTimeZone(xmp.getModifyDateProperty().getRawValue())
+                            != hasTimeZone(dico.getPropertyStringValue("ModDate")))
                     {
-                        if (!DateConverter.toISO8601(xmpModifyDate).equals(DateConverter.toISO8601(modifyDate)))
-                        {
-
-                            ve.add(unsynchronizedMetaDataError("ModificationDate"));
-                        }
-                        else if (hasTimeZone(xmp.getModifyDateProperty().getRawValue()) !=

-                                hasTimeZone(dico.getPropertyStringValue("ModDate")))
-                        {
-                            ve.add(unsynchronizedMetaDataError("ModificationDate"));
-                        }
+                        ve.add(unsynchronizedMetaDataError("ModificationDate"));
                     }
-
-                }
-                else
-                {
-                    ve.add(absentSchemaMetaDataError("ModifyDate", "Basic XMP"));
                 }
+
+            }
+            else
+            {
+                ve.add(absentSchemaMetaDataError("ModifyDate", "Basic XMP"));
             }
         }
-        catch (IOException e)
-        {
-            // If there is an error while converting this property to a date
-            ve.add(new ValidationError(PreflightConstants.ERROR_METADATA_DICT_INFO_CORRUPT,
"Document Information 'ModifyDate' can't be read : " + e.getMessage()));
-        }
-
     }
 
     /**



Mime
View raw message