pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1630215 - in /pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight: ValidationResult.java font/container/FontContainer.java font/descriptor/Type1DescriptorHelper.java
Date Wed, 08 Oct 2014 19:51:04 GMT
Author: tilman
Date: Wed Oct  8 19:51:04 2014
New Revision: 1630215

URL: http://svn.apache.org/r1630215
Log:
PDFBOX-2405: improve error messages, as suggested by Ralf Hauser; fix javadoc

Modified:
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/ValidationResult.java
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/container/FontContainer.java
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/Type1DescriptorHelper.java

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/ValidationResult.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/ValidationResult.java?rev=1630215&r1=1630214&r2=1630215&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/ValidationResult.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/ValidationResult.java
Wed Oct  8 19:51:04 2014
@@ -369,6 +369,7 @@ public class ValidationResult
             return errorCode.hashCode();
         }
 
+        @Override
         public boolean equals (Object o) {
             if (o instanceof ValidationError) {
                 ValidationError ve = (ValidationError)o;

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/container/FontContainer.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/container/FontContainer.java?rev=1630215&r1=1630214&r2=1630215&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/container/FontContainer.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/container/FontContainer.java
Wed Oct  8 19:51:04 2014
@@ -159,13 +159,14 @@ public abstract class FontContainer
     protected abstract float getFontProgramWidth(int cid) throws GlyphException;
 
     /**
-     * Test if both width are consistent. At the end of this method, the CID is marked as
valid or invalid.
-     * 
+     * Test if both widths are consistent. At the end of this method, the CID is
+     * marked as valid or invalid.
+     *
      * @param cid
      * @param expectedWidth
-     * @param foundWidth
-     *            the glyph width found in the font program, a negative value if the CID
is missing from the font.
-     * @throws GlyphException
+     * @param foundWidth the glyph width found in the font program, a negative
+     * value if the CID is missing from the font.
+     * @throws GlyphException the appropriate exception if the CID is invalid.
      */
     protected void checkWidthsConsistency(int cid, float expectedWidth, float foundWidth)
throws GlyphException
     {
@@ -182,8 +183,8 @@ public abstract class FontContainer
         if (Math.abs(foundWidth - expectedWidth) > 1)
         {
             GlyphException e = new GlyphException(PreflightConstants.ERROR_FONTS_METRICS,
cid,
-                    "Width of the character \"" + cid + "\" in the font program \"" + this.font.getBaseFont()
-                            + "\" is inconsistent with the width in the PDF dictionary.");
+                    "Width (" + foundWidth + ") of the character \"" + cid + "\" in the font
program \"" + this.font.getBaseFont()
+                            + "\" is inconsistent with the width (" + expectedWidth + ")
in the PDF dictionary.");
             markCIDAsInvalid(cid, e);
             throw e;
         }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/Type1DescriptorHelper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/Type1DescriptorHelper.java?rev=1630215&r1=1630214&r2=1630215&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/Type1DescriptorHelper.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/Type1DescriptorHelper.java
Wed Oct  8 19:51:04 2014
@@ -47,7 +47,6 @@ import org.apache.pdfbox.pdmodel.font.PD
 import org.apache.pdfbox.pdmodel.font.PDSimpleFont;
 import org.apache.pdfbox.preflight.PreflightContext;
 import org.apache.pdfbox.preflight.ValidationResult.ValidationError;
-import org.apache.pdfbox.preflight.exception.ValidationException;
 import org.apache.pdfbox.preflight.font.container.Type1Container;
 import org.apache.pdfbox.preflight.font.util.Type1;
 import org.apache.pdfbox.preflight.font.util.Type1Parser;
@@ -132,7 +131,7 @@ public class Type1DescriptorHelper exten
     }
 
     /**
-     * Try to load the font using the java.awt.font object. if the font is
+     * Try to load the font using the java.awt.font object. If the font is
      * invalid, an exception will be pushed in the font container
      *
      * @param fontDescriptor
@@ -175,10 +174,10 @@ public class Type1DescriptorHelper exten
     }
 
     /**
-     * Type1C is a CFF font format, extract all CFFFont object from the stream
+     * Type1C is a CFF font format, extract all CFFFont objects from the stream
      *
-     * @return
-     * @throws ValidationException
+     * @param fontDescriptor The font descriptor
+     * @param fontFile The font file
      */
     protected void processFontFile3(PDFontDescriptor fontDescriptor, PDStream fontFile)
     {
@@ -194,7 +193,7 @@ public class Type1DescriptorHelper exten
         }
         catch (IOException e)
         {
-            this.fContainer.push(new ValidationError(ERROR_FONTS_CID_DAMAGED, "The FontFile
can't be read"));
+            this.fContainer.push(new ValidationError(ERROR_FONTS_CID_DAMAGED, "The FontFile
can't be read", e));
         }
     }
 }



Mime
View raw message