You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by gb...@apache.org on 2013/03/06 17:46:37 UTC

svn commit: r1453416 [6/16] - in /pdfbox/trunk/preflight: ./ src/main/java/org/apache/pdfbox/preflight/ src/main/java/org/apache/pdfbox/preflight/action/ src/main/java/org/apache/pdfbox/preflight/annotation/ src/main/java/org/apache/pdfbox/preflight/an...

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/CrossRefParseException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/CrossRefParseException.java?rev=1453416&r1=1453415&r2=1453416&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/CrossRefParseException.java (original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/CrossRefParseException.java Wed Mar  6 16:46:35 2013
@@ -25,57 +25,56 @@ import org.apache.pdfbox.preflight.Prefl
 import org.apache.pdfbox.preflight.javacc.ParseException;
 
 /**
- * This Exception is thrown if an validation error occurs during the javacc
- * validation in the PDF Cross Ref table.
+ * This Exception is thrown if an validation error occurs during the javacc validation in the PDF Cross Ref table.
  * 
  * Error codes provided by this exception should start by 1.3 or 1.0.
  */
-public class CrossRefParseException extends PdfParseException {
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(net.awl
-   * .edoc.pdfa.validation.ParseException)
-   */
-  public CrossRefParseException(ParseException e) {
-    super(e);
-  }
+public class CrossRefParseException extends PdfParseException
+{
+    /*
+     * (non-Javadoc)
+     * 
+     * @see net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(net.awl
+     * .edoc.pdfa.validation.ParseException)
+     */
+    public CrossRefParseException(ParseException e)
+    {
+        super(e);
+    }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang
-   * .String,java.lang.String)
-   */
-  public CrossRefParseException(String message, String code) {
-    super(message, code);
-  }
+    /*
+     * (non-Javadoc)
+     * 
+     * @see net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang .String,java.lang.String)
+     */
+    public CrossRefParseException(String message, String code)
+    {
+        super(message, code);
+    }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang
-   * .String)
-   */
-  public CrossRefParseException(String message) {
-    super(message);
-  }
+    /*
+     * (non-Javadoc)
+     * 
+     * @see net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang .String)
+     */
+    public CrossRefParseException(String message)
+    {
+        super(message);
+    }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see net.awl.edoc.pdfa.validation.PdfParseException#getErrorCode()
-   */
-  @Override
-  public String getErrorCode() {
-    // if (!isTokenMgrError) {
-    // // use token information to know the cause
-    // }
-    // else Token Management Error or Unknown Error during the CrossRefTable
-    // Validation
-    return PreflightConstants.ERROR_SYNTAX_CROSS_REF;
-  }
+    /*
+     * (non-Javadoc)
+     * 
+     * @see net.awl.edoc.pdfa.validation.PdfParseException#getErrorCode()
+     */
+    @Override
+    public String getErrorCode()
+    {
+        // if (!isTokenMgrError) {
+        // // use token information to know the cause
+        // }
+        // else Token Management Error or Unknown Error during the CrossRefTable
+        // Validation
+        return PreflightConstants.ERROR_SYNTAX_CROSS_REF;
+    }
 }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/HeaderParseException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/HeaderParseException.java?rev=1453416&r1=1453415&r2=1453416&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/HeaderParseException.java (original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/HeaderParseException.java Wed Mar  6 16:46:35 2013
@@ -24,59 +24,58 @@ package org.apache.pdfbox.preflight.exce
 import org.apache.pdfbox.preflight.PreflightConstants;
 import org.apache.pdfbox.preflight.javacc.ParseException;
 
-
 /**
- * This Exception is thrown if an validation error occurs during the javacc
- * validation in the PDF Header.
+ * This Exception is thrown if an validation error occurs during the javacc validation in the PDF Header.
  * 
  * Error codes provided by this exception should start by 1.1.
  */
-public class HeaderParseException extends PdfParseException {
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(net.awl
-   * .edoc.pdfa.validation.ParseException)
-   */
-  public HeaderParseException(ParseException e) {
-    super(e);
-  }
-
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang
-   * .String,java.lang.String)
-   */
-  public HeaderParseException(String message, String code) {
-    super(message, code);
-  }
+public class HeaderParseException extends PdfParseException
+{
+    /*
+     * (non-Javadoc)
+     * 
+     * @see net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(net.awl
+     * .edoc.pdfa.validation.ParseException)
+     */
+    public HeaderParseException(ParseException e)
+    {
+        super(e);
+    }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang
-   * .String)
-   */
-  public HeaderParseException(String message) {
-    super(message);
-  }
+    /*
+     * (non-Javadoc)
+     * 
+     * @see net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang .String,java.lang.String)
+     */
+    public HeaderParseException(String message, String code)
+    {
+        super(message, code);
+    }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see net.awl.edoc.pdfa.validation.PdfParseException#getErrorCode()
-   */
-  @Override
-  public String getErrorCode() {
-    if (!isTokenMgrError) {
-      System.out.println("## Header ParseError");
+    /*
+     * (non-Javadoc)
+     * 
+     * @see net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang .String)
+     */
+    public HeaderParseException(String message)
+    {
+        super(message);
     }
 
-    // else Token Management Error or Unknown Error during the Header Validation
-    return PreflightConstants.ERROR_SYNTAX_HEADER;
-  }
+    /*
+     * (non-Javadoc)
+     * 
+     * @see net.awl.edoc.pdfa.validation.PdfParseException#getErrorCode()
+     */
+    @Override
+    public String getErrorCode()
+    {
+        if (!isTokenMgrError)
+        {
+            System.out.println("## Header ParseError");
+        }
+
+        // else Token Management Error or Unknown Error during the Header Validation
+        return PreflightConstants.ERROR_SYNTAX_HEADER;
+    }
 }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/MissingValidationProcessException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/MissingValidationProcessException.java?rev=1453416&r1=1453415&r2=1453416&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/MissingValidationProcessException.java (original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/MissingValidationProcessException.java Wed Mar  6 16:46:35 2013
@@ -21,21 +21,23 @@
 
 package org.apache.pdfbox.preflight.exception;
 
+public class MissingValidationProcessException extends ValidationException
+{
 
-public class MissingValidationProcessException extends ValidationException {
-
-	/**
-	 * Name of the Missing process
-	 */
-	private String processName;
-
-	public MissingValidationProcessException(String process) {
-		super(process + " is missing, validation can't be done");
-		this.processName = process;
-	}
-
-	public String getProcessName() {
-		return processName;
-	}
+    /**
+     * Name of the Missing process
+     */
+    private String processName;
+
+    public MissingValidationProcessException(String process)
+    {
+        super(process + " is missing, validation can't be done");
+        this.processName = process;
+    }
+
+    public String getProcessName()
+    {
+        return processName;
+    }
 
 }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/PdfParseException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/PdfParseException.java?rev=1453416&r1=1453415&r2=1453416&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/PdfParseException.java (original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/PdfParseException.java Wed Mar  6 16:46:35 2013
@@ -24,76 +24,77 @@ package org.apache.pdfbox.preflight.exce
 import org.apache.pdfbox.preflight.javacc.ParseException;
 
 /**
- * A PdfParseException is thrown when the JavaCC Parser can't validate the pdf
- * file. In this case a PdfParseException (or an inherited class) is thrown.
+ * A PdfParseException is thrown when the JavaCC Parser can't validate the pdf file. In this case a PdfParseException
+ * (or an inherited class) is thrown.
  * 
- * A PdfParseException inherits from ParseException to avoid compilation errors
- * in the classes generated by JavaCC.
+ * A PdfParseException inherits from ParseException to avoid compilation errors in the classes generated by JavaCC.
  */
-public class PdfParseException extends ParseException {
-  protected boolean isTokenMgrError = false;
-  protected String errorCode = null;
-  protected int line = 0;
+public class PdfParseException extends ParseException
+{
+    protected boolean isTokenMgrError = false;
+    protected String errorCode = null;
+    protected int line = 0;
 
-  /**
-   * This constructor clones the given ParseException and initialize the
-   * errorCode if it is possible. (e is an instance of PdfParseException)
-   * 
-   * @param e
-   */
-  public PdfParseException(ParseException e) {
-    super();
-    this.currentToken = e.currentToken;
-    this.expectedTokenSequences = e.expectedTokenSequences;
-    this.tokenImage = e.tokenImage;
-    this.initCause(e);
-    if (e instanceof PdfParseException) {
-      this.errorCode = ((PdfParseException) e).errorCode;
+    /**
+     * This constructor clones the given ParseException and initialize the errorCode if it is possible. (e is an
+     * instance of PdfParseException)
+     * 
+     * @param e
+     */
+    public PdfParseException(ParseException e)
+    {
+        super();
+        this.currentToken = e.currentToken;
+        this.expectedTokenSequences = e.expectedTokenSequences;
+        this.tokenImage = e.tokenImage;
+        this.initCause(e);
+        if (e instanceof PdfParseException)
+        {
+            this.errorCode = ((PdfParseException) e).errorCode;
+        }
     }
-  }
 
-  /**
-   * This constructor calls the PdfParseException(String message, String code)
-   * constructor with a code set to null.
-   * 
-   * @param message
-   *          the explanation message (The message of TokenMngError). This field
-   *          is mandatory.
-   */
-  public PdfParseException(String message) {
-    this(message, null);
-  }
+    /**
+     * This constructor calls the PdfParseException(String message, String code) constructor with a code set to null.
+     * 
+     * @param message
+     *            the explanation message (The message of TokenMngError). This field is mandatory.
+     */
+    public PdfParseException(String message)
+    {
+        this(message, null);
+    }
 
-  /**
-   * This constructor is generally used when the PDF validation fails due to a
-   * TokenMngError. In this case, the message should be the message of the
-   * TokenMngError.
-   * 
-   * @param message
-   *          the explanation message (The message of TokenMngError). This field
-   *          is mandatory.
-   * @param code
-   *          the error code if it can be determined by the creator of this
-   *          exception (Can be null)
-   */
-  public PdfParseException(String message, String code) {
-    super(message);
-    this.isTokenMgrError = true;
-    int lineIndex = message.indexOf("Lexical error at line ");
-    if (lineIndex > -1) {
-      String truncMsg = message.replace("Lexical error at line ", "");
-      String nbLine = truncMsg.substring(0, truncMsg.indexOf(","));
-      line = Integer.parseInt(nbLine);
+    /**
+     * This constructor is generally used when the PDF validation fails due to a TokenMngError. In this case, the
+     * message should be the message of the TokenMngError.
+     * 
+     * @param message
+     *            the explanation message (The message of TokenMngError). This field is mandatory.
+     * @param code
+     *            the error code if it can be determined by the creator of this exception (Can be null)
+     */
+    public PdfParseException(String message, String code)
+    {
+        super(message);
+        this.isTokenMgrError = true;
+        int lineIndex = message.indexOf("Lexical error at line ");
+        if (lineIndex > -1)
+        {
+            String truncMsg = message.replace("Lexical error at line ", "");
+            String nbLine = truncMsg.substring(0, truncMsg.indexOf(","));
+            line = Integer.parseInt(nbLine);
+        }
+        this.errorCode = code;
     }
-    this.errorCode = code;
-  }
 
-  /**
-   * Get the validation error code
-   * 
-   * @return
-   */
-  public String getErrorCode() {
-    return this.errorCode;
-  }
+    /**
+     * Get the validation error code
+     * 
+     * @return
+     */
+    public String getErrorCode()
+    {
+        return this.errorCode;
+    }
 }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/SyntaxValidationException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/SyntaxValidationException.java?rev=1453416&r1=1453415&r2=1453416&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/SyntaxValidationException.java (original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/SyntaxValidationException.java Wed Mar  6 16:46:35 2013
@@ -23,27 +23,32 @@ package org.apache.pdfbox.preflight.exce
 
 import org.apache.pdfbox.preflight.ValidationResult;
 
-public class SyntaxValidationException extends ValidationException {
+public class SyntaxValidationException extends ValidationException
+{
 
-	private final ValidationResult result;
-	
-	public SyntaxValidationException(String message, Throwable cause, ValidationResult result) {
-	  super(message, cause);
-	  this.result = result;
-  }
-
-	public SyntaxValidationException(String message, ValidationResult result) {
-	  super(message);
-	  this.result = result;
-  }
-
-	public SyntaxValidationException(Throwable cause, ValidationResult result) {
-	  super(cause);
-	  this.result = result;
-  }
-
-	public ValidationResult getResult() {
-  	return result;
-  }
+    private final ValidationResult result;
+
+    public SyntaxValidationException(String message, Throwable cause, ValidationResult result)
+    {
+        super(message, cause);
+        this.result = result;
+    }
+
+    public SyntaxValidationException(String message, ValidationResult result)
+    {
+        super(message);
+        this.result = result;
+    }
+
+    public SyntaxValidationException(Throwable cause, ValidationResult result)
+    {
+        super(cause);
+        this.result = result;
+    }
+
+    public ValidationResult getResult()
+    {
+        return result;
+    }
 
 }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/TrailerParseException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/TrailerParseException.java?rev=1453416&r1=1453415&r2=1453416&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/TrailerParseException.java (original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/TrailerParseException.java Wed Mar  6 16:46:35 2013
@@ -25,58 +25,58 @@ import org.apache.pdfbox.preflight.Prefl
 import org.apache.pdfbox.preflight.javacc.ParseException;
 
 /**
- * This Exception is thrown if an validation error occurs during the javacc
- * validation in the PDF Trailer.
+ * This Exception is thrown if an validation error occurs during the javacc validation in the PDF Trailer.
  * 
  * Error codes provided by this exception should start by 1.4 or 1.0.
  */
-public class TrailerParseException extends PdfParseException {
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(net.awl
-   * .edoc.pdfa.validation.ParseException)
-   */
-  public TrailerParseException(ParseException e) {
-    super(e);
-  }
+public class TrailerParseException extends PdfParseException
+{
+    /*
+     * (non-Javadoc)
+     * 
+     * @see net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(net.awl
+     * .edoc.pdfa.validation.ParseException)
+     */
+    public TrailerParseException(ParseException e)
+    {
+        super(e);
+    }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang
-   * .String,java.lang.String)
-   */
-  public TrailerParseException(String message, String code) {
-    super(message, code);
-  }
+    /*
+     * (non-Javadoc)
+     * 
+     * @see net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang .String,java.lang.String)
+     */
+    public TrailerParseException(String message, String code)
+    {
+        super(message, code);
+    }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang
-   * .String)
-   */
-  public TrailerParseException(String message) {
-    super(message);
-  }
+    /*
+     * (non-Javadoc)
+     * 
+     * @see net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang .String)
+     */
+    public TrailerParseException(String message)
+    {
+        super(message);
+    }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see net.awl.edoc.pdfa.validation.PdfParseException#getErrorCode()
-   */
-  @Override
-  public String getErrorCode() {
-    if (!isTokenMgrError) {
-      // use token information to know the cause
-      System.out.println("## Trailer ParseError");
+    /*
+     * (non-Javadoc)
+     * 
+     * @see net.awl.edoc.pdfa.validation.PdfParseException#getErrorCode()
+     */
+    @Override
+    public String getErrorCode()
+    {
+        if (!isTokenMgrError)
+        {
+            // use token information to know the cause
+            System.out.println("## Trailer ParseError");
+        }
+        // else Token Management Error or Unknown Error during the Trailer
+        // Validation
+        return PreflightConstants.ERROR_SYNTAX_TRAILER;
     }
-    // else Token Management Error or Unknown Error during the Trailer
-    // Validation
-    return PreflightConstants.ERROR_SYNTAX_TRAILER;
-  }
 }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/ValidationException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/ValidationException.java?rev=1453416&r1=1453415&r2=1453416&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/ValidationException.java (original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/ValidationException.java Wed Mar  6 16:46:35 2013
@@ -23,25 +23,29 @@ package org.apache.pdfbox.preflight.exce
 
 import java.io.IOException;
 
-public class ValidationException extends IOException {
+public class ValidationException extends IOException
+{
 
-  /**
-   * serial version number
-   */
-  private static final long serialVersionUID = -1616141241190424669L;
-
-  public ValidationException(String message, Throwable cause) {
-    super(message);
-    initCause(cause);
-  }
-
-  public ValidationException(String message) {
-    super(message);
-  }
-
-  public ValidationException(Throwable cause) {
-    super();
-    initCause(cause);
-  }
+    /**
+     * serial version number
+     */
+    private static final long serialVersionUID = -1616141241190424669L;
+
+    public ValidationException(String message, Throwable cause)
+    {
+        super(message);
+        initCause(cause);
+    }
+
+    public ValidationException(String message)
+    {
+        super(message);
+    }
+
+    public ValidationException(Throwable cause)
+    {
+        super();
+        initCause(cause);
+    }
 
 }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/CIDType0FontValidator.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/CIDType0FontValidator.java?rev=1453416&r1=1453415&r2=1453416&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/CIDType0FontValidator.java (original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/CIDType0FontValidator.java Wed Mar  6 16:46:35 2013
@@ -27,19 +27,23 @@ import org.apache.pdfbox.preflight.Prefl
 import org.apache.pdfbox.preflight.font.container.CIDType0Container;
 import org.apache.pdfbox.preflight.font.descriptor.CIDType0DescriptorHelper;
 
-public class CIDType0FontValidator extends DescendantFontValidator<CIDType0Container> {
+public class CIDType0FontValidator extends DescendantFontValidator<CIDType0Container>
+{
 
-	public CIDType0FontValidator(PreflightContext context, PDFont font) {
-		super(context, font, new CIDType0Container(font));
-	}
+    public CIDType0FontValidator(PreflightContext context, PDFont font)
+    {
+        super(context, font, new CIDType0Container(font));
+    }
 
-	@Override
-	protected void checkCIDToGIDMap(COSBase ctog) {
-		checkCIDToGIDMap(ctog, false);
-	}
+    @Override
+    protected void checkCIDToGIDMap(COSBase ctog)
+    {
+        checkCIDToGIDMap(ctog, false);
+    }
 
-	@Override
-	protected void createFontDescriptorHelper() {
-		this.descriptorHelper = new CIDType0DescriptorHelper(context, font, fontContainer);
-	}
+    @Override
+    protected void createFontDescriptorHelper()
+    {
+        this.descriptorHelper = new CIDType0DescriptorHelper(context, font, fontContainer);
+    }
 }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/CIDType2FontValidator.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/CIDType2FontValidator.java?rev=1453416&r1=1453415&r2=1453416&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/CIDType2FontValidator.java (original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/CIDType2FontValidator.java Wed Mar  6 16:46:35 2013
@@ -28,21 +28,25 @@ import org.apache.pdfbox.preflight.font.
 import org.apache.pdfbox.preflight.font.descriptor.CIDType2DescriptorHelper;
 import org.apache.pdfbox.preflight.font.util.CIDToGIDMap;
 
-public class CIDType2FontValidator extends DescendantFontValidator<CIDType2Container> {
+public class CIDType2FontValidator extends DescendantFontValidator<CIDType2Container>
+{
 
-	public CIDType2FontValidator(PreflightContext context, PDFont font) {
-		super(context, font, new CIDType2Container(font));
-	}
+    public CIDType2FontValidator(PreflightContext context, PDFont font)
+    {
+        super(context, font, new CIDType2Container(font));
+    }
 
-	@Override
-	protected void checkCIDToGIDMap(COSBase ctog) {
-		CIDToGIDMap cidToGid = checkCIDToGIDMap(ctog, true);
-		this.fontContainer.setCidToGid(cidToGid);
-	}
+    @Override
+    protected void checkCIDToGIDMap(COSBase ctog)
+    {
+        CIDToGIDMap cidToGid = checkCIDToGIDMap(ctog, true);
+        this.fontContainer.setCidToGid(cidToGid);
+    }
 
-	@Override
-	protected void createFontDescriptorHelper() {
-		this.descriptorHelper = new CIDType2DescriptorHelper(context, font, fontContainer);
-	}
+    @Override
+    protected void createFontDescriptorHelper()
+    {
+        this.descriptorHelper = new CIDType2DescriptorHelper(context, font, fontContainer);
+    }
 
 }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/DescendantFontValidator.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/DescendantFontValidator.java?rev=1453416&r1=1453415&r2=1453416&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/DescendantFontValidator.java (original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/DescendantFontValidator.java Wed Mar  6 16:46:35 2013
@@ -40,102 +40,124 @@ import org.apache.pdfbox.preflight.font.
 import org.apache.pdfbox.preflight.font.util.CIDToGIDMap;
 import org.apache.pdfbox.preflight.utils.COSUtils;
 
-public abstract class DescendantFontValidator <T extends FontContainer> extends SimpleFontValidator<T> {
+public abstract class DescendantFontValidator<T extends FontContainer> extends SimpleFontValidator<T>
+{
 
-	protected COSDocument cosDocument = null;
-	
-	public DescendantFontValidator(PreflightContext context, PDFont font,	T fContainer) {
-		super(context, font, fContainer);
-		cosDocument = context.getDocument().getDocument();
-	}
-
-	@Override
-	protected void checkMandatoryField() {
-		COSDictionary fontDictionary = (COSDictionary)font.getCOSObject();
-
-		boolean arePresent =fontDictionary.containsKey(COSName.TYPE);
-		arePresent &= fontDictionary.containsKey(COSName.SUBTYPE);
-		arePresent &= fontDictionary.containsKey(COSName.BASE_FONT);
-		arePresent &= fontDictionary.containsKey(COSName.CIDSYSTEMINFO);
-		arePresent &= fontDictionary.containsKey(COSName.FONT_DESC);
-
-		if (!arePresent) {
-			this.fontContainer.push(new ValidationError(ERROR_FONTS_DICTIONARY_INVALID,	"Required keys are missing"));
-		}
-
-		checkCIDSystemInfo(fontDictionary.getItem(COSName.CIDSYSTEMINFO));
-		checkCIDToGIDMap(fontDictionary.getItem(COSName.CID_TO_GID_MAP));
-	}
-
-	/**
-	 * Check the content of the CIDSystemInfo dictionary. A CIDSystemInfo dictionary must contain :
-	 * <UL>
-	 * <li>a Name - Registry
-	 * <li>a Name - Ordering
-	 * <li>a Integer - Supplement
-	 * </UL>
-	 * 
-	 * @param sysinfo
-	 * @return
-	 */
-	protected void checkCIDSystemInfo(COSBase sysinfo) {
-		COSDictionary cidSysInfo = COSUtils.getAsDictionary(sysinfo, cosDocument);
-		if (cidSysInfo != null) {
-			COSBase reg = cidSysInfo.getItem(COSName.REGISTRY);
-			COSBase ord = cidSysInfo.getItem(COSName.ORDERING);
-			COSBase sup = cidSysInfo.getItem(COSName.SUPPLEMENT);
-
-			if (!(COSUtils.isString(reg, cosDocument) && COSUtils.isString(ord, cosDocument) && COSUtils.isInteger(sup, cosDocument))) {
-				this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_SYSINFO));
-			}
-
-		} else {
-			this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_SYSINFO));
-		}
-	}
-
-	/**
-	 * This method checks the CIDtoGIDMap entry of the Font dictionary.
-	 * call the {@linkplain #checkCIDToGIDMap(COSBase, boolean)} with right parameters
-	 * according to the instance of DescendantFontValidator
-	 *  
-	 * @param ctog
-	 */
-	protected abstract void checkCIDToGIDMap(COSBase ctog);
-
-	/**
-	 * This method checks the CIDtoGIDMap entry of the Font dictionary. This
-	 * element must be a Stream or a Name. If it is a name, it must be "Identity"
-	 * otherwise, the PDF file isn't a PDF/A-1b.
-	 * 
-	 * If the validation fails the list of errors in the FontContainer is updated.
-	 * 
-	 * If the CIDtoGIDMap is a Stream, it is parsed as a CMap and the result is returned.
-	 * @param ctog
-	 * @param mandatory true for CIDType2 , false for CIDType0
-	 * @return
-	 */
-	protected CIDToGIDMap checkCIDToGIDMap(COSBase ctog,boolean mandatory) {
-		CIDToGIDMap cidToGidMap = null;
-		
-		if (COSUtils.isString(ctog, cosDocument)) {
-			// ---- valid only if the string is Identity
-			String ctogStr = COSUtils.getAsString(ctog, cosDocument);
-			if (!FONT_DICTIONARY_VALUE_CMAP_IDENTITY.equals(ctogStr)) {
-				this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_CIDTOGID,"The CIDToGID entry is invalid"));
-			}
-		} else if (COSUtils.isStream(ctog, cosDocument)) {
-			try {
-				COSStream ctogMap = COSUtils.getAsStream(ctog, cosDocument);
-				cidToGidMap = new CIDToGIDMap();
-				cidToGidMap.parseStream(ctogMap);
-			} catch (IOException e) {
-				// map can be invalid, return a Validation Error
-				this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_CIDTOGID));
-			}
-		} else if (mandatory) {
-			this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_CIDTOGID));
-		}
-		return cidToGidMap;
-	}
+    protected COSDocument cosDocument = null;
+
+    public DescendantFontValidator(PreflightContext context, PDFont font, T fContainer)
+    {
+        super(context, font, fContainer);
+        cosDocument = context.getDocument().getDocument();
+    }
+
+    @Override
+    protected void checkMandatoryField()
+    {
+        COSDictionary fontDictionary = (COSDictionary) font.getCOSObject();
+
+        boolean arePresent = fontDictionary.containsKey(COSName.TYPE);
+        arePresent &= fontDictionary.containsKey(COSName.SUBTYPE);
+        arePresent &= fontDictionary.containsKey(COSName.BASE_FONT);
+        arePresent &= fontDictionary.containsKey(COSName.CIDSYSTEMINFO);
+        arePresent &= fontDictionary.containsKey(COSName.FONT_DESC);
+
+        if (!arePresent)
+        {
+            this.fontContainer.push(new ValidationError(ERROR_FONTS_DICTIONARY_INVALID, "Required keys are missing"));
+        }
+
+        checkCIDSystemInfo(fontDictionary.getItem(COSName.CIDSYSTEMINFO));
+        checkCIDToGIDMap(fontDictionary.getItem(COSName.CID_TO_GID_MAP));
+    }
+
+    /**
+     * Check the content of the CIDSystemInfo dictionary. A CIDSystemInfo dictionary must contain :
+     * <UL>
+     * <li>a Name - Registry
+     * <li>a Name - Ordering
+     * <li>a Integer - Supplement
+     * </UL>
+     * 
+     * @param sysinfo
+     * @return
+     */
+    protected void checkCIDSystemInfo(COSBase sysinfo)
+    {
+        COSDictionary cidSysInfo = COSUtils.getAsDictionary(sysinfo, cosDocument);
+        if (cidSysInfo != null)
+        {
+            COSBase reg = cidSysInfo.getItem(COSName.REGISTRY);
+            COSBase ord = cidSysInfo.getItem(COSName.ORDERING);
+            COSBase sup = cidSysInfo.getItem(COSName.SUPPLEMENT);
+
+            if (!(COSUtils.isString(reg, cosDocument) && COSUtils.isString(ord, cosDocument) && COSUtils.isInteger(sup,
+                    cosDocument)))
+            {
+                this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_SYSINFO));
+            }
+
+        }
+        else
+        {
+            this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_SYSINFO));
+        }
+    }
+
+    /**
+     * This method checks the CIDtoGIDMap entry of the Font dictionary. call the
+     * {@linkplain #checkCIDToGIDMap(COSBase, boolean)} with right parameters according to the instance of
+     * DescendantFontValidator
+     * 
+     * @param ctog
+     */
+    protected abstract void checkCIDToGIDMap(COSBase ctog);
+
+    /**
+     * This method checks the CIDtoGIDMap entry of the Font dictionary. This element must be a Stream or a Name. If it
+     * is a name, it must be "Identity" otherwise, the PDF file isn't a PDF/A-1b.
+     * 
+     * If the validation fails the list of errors in the FontContainer is updated.
+     * 
+     * If the CIDtoGIDMap is a Stream, it is parsed as a CMap and the result is returned.
+     * 
+     * @param ctog
+     * @param mandatory
+     *            true for CIDType2 , false for CIDType0
+     * @return
+     */
+    protected CIDToGIDMap checkCIDToGIDMap(COSBase ctog, boolean mandatory)
+    {
+        CIDToGIDMap cidToGidMap = null;
+
+        if (COSUtils.isString(ctog, cosDocument))
+        {
+            // ---- valid only if the string is Identity
+            String ctogStr = COSUtils.getAsString(ctog, cosDocument);
+            if (!FONT_DICTIONARY_VALUE_CMAP_IDENTITY.equals(ctogStr))
+            {
+                this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_CIDTOGID,
+                        "The CIDToGID entry is invalid"));
+            }
+        }
+        else if (COSUtils.isStream(ctog, cosDocument))
+        {
+            try
+            {
+                COSStream ctogMap = COSUtils.getAsStream(ctog, cosDocument);
+                cidToGidMap = new CIDToGIDMap();
+                cidToGidMap.parseStream(ctogMap);
+            }
+            catch (IOException e)
+            {
+                // map can be invalid, return a Validation Error
+                this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_CIDTOGID));
+            }
+        }
+        else if (mandatory)
+        {
+            this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_CIDTOGID));
+        }
+        return cidToGidMap;
+    }
 }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/FontValidator.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/FontValidator.java?rev=1453416&r1=1453415&r2=1453416&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/FontValidator.java (original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/FontValidator.java Wed Mar  6 16:46:35 2013
@@ -27,43 +27,50 @@ import org.apache.pdfbox.preflight.excep
 import org.apache.pdfbox.preflight.font.container.FontContainer;
 import org.apache.pdfbox.preflight.font.descriptor.FontDescriptorHelper;
 
-public abstract class FontValidator <T extends FontContainer> {
-	
-	protected T fontContainer;
-	protected PreflightContext context;
-	protected PDFont font;
-	protected FontDescriptorHelper<T> descriptorHelper;
-
-	private static final String SUB_SET_PATTERN = "^[A-Z]{6}\\+.*";
-
-	public FontValidator(PreflightContext context, PDFont font, T fContainer) {
-		super();
-		this.context = context;
-		this.font = font;
-		this.fontContainer = fContainer;
-		this.context.addFontContainer(font.getCOSObject(), fContainer);
-	}
-
-  public static boolean isSubSet(String fontName) {
-    return fontName.matches(SUB_SET_PATTERN);
-  }
-
-  public static String getSubSetPatternDelimiter() {
-    return "\\+";
-  }
- 	
-	public abstract void validate() throws ValidationException;
-	
-	protected void checkEncoding() {
-		// nothing to check for PDF/A-1b
-	}
-
-	protected void checkToUnicode() {
-		// nothing to check for PDF/A-1b
-	}
-
-	public T getFontContainer() {
-		return fontContainer;
-	}
-	
+public abstract class FontValidator<T extends FontContainer>
+{
+
+    protected T fontContainer;
+    protected PreflightContext context;
+    protected PDFont font;
+    protected FontDescriptorHelper<T> descriptorHelper;
+
+    private static final String SUB_SET_PATTERN = "^[A-Z]{6}\\+.*";
+
+    public FontValidator(PreflightContext context, PDFont font, T fContainer)
+    {
+        super();
+        this.context = context;
+        this.font = font;
+        this.fontContainer = fContainer;
+        this.context.addFontContainer(font.getCOSObject(), fContainer);
+    }
+
+    public static boolean isSubSet(String fontName)
+    {
+        return fontName.matches(SUB_SET_PATTERN);
+    }
+
+    public static String getSubSetPatternDelimiter()
+    {
+        return "\\+";
+    }
+
+    public abstract void validate() throws ValidationException;
+
+    protected void checkEncoding()
+    {
+        // nothing to check for PDF/A-1b
+    }
+
+    protected void checkToUnicode()
+    {
+        // nothing to check for PDF/A-1b
+    }
+
+    public T getFontContainer()
+    {
+        return fontContainer;
+    }
+
 }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/SimpleFontValidator.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/SimpleFontValidator.java?rev=1453416&r1=1453415&r2=1453416&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/SimpleFontValidator.java (original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/SimpleFontValidator.java Wed Mar  6 16:46:35 2013
@@ -31,48 +31,54 @@ import org.apache.pdfbox.preflight.Valid
 import org.apache.pdfbox.preflight.exception.ValidationException;
 import org.apache.pdfbox.preflight.font.container.FontContainer;
 
-public abstract class SimpleFontValidator <T extends FontContainer> extends FontValidator<T> {
-	
-	public SimpleFontValidator(PreflightContext context, PDFont font,	T fContainer) {
-		super(context, font, fContainer);
-	}
-
-	/**
-   * Call this method to validate the font wrapped by this object.
-   * If the validation failed, the error is updated in the FontContainer 
-   * with the right error code.
-   * 
-   * Errors that are saved in the container will be added on the PreflightContext if the font is used later.
-   * 
-   * @return
-   */
-	public void validate() throws ValidationException {
-		checkMandatoryField();
-
-		createFontDescriptorHelper();
-		processFontDescriptorValidation();
-		
-		checkEncoding();
-		checkToUnicode();
-	}
-
-	protected void checkMandatoryField() {
-		COSDictionary fontDictionary = (COSDictionary)font.getCOSObject();
-		boolean areFieldsPResent = fontDictionary.containsKey(COSName.TYPE);
-		areFieldsPResent &= fontDictionary.containsKey(COSName.SUBTYPE);
-		areFieldsPResent &= fontDictionary.containsKey(COSName.BASE_FONT);
-		areFieldsPResent &= fontDictionary.containsKey(COSName.FIRST_CHAR);
-		areFieldsPResent &= fontDictionary.containsKey(COSName.LAST_CHAR);
-		areFieldsPResent &= fontDictionary.containsKey(COSName.WIDTHS);
-		
-		if (!areFieldsPResent) {
-			this.fontContainer.push(new ValidationError(ERROR_FONTS_DICTIONARY_INVALID, "Some required fields are missing from the Font dictionary."));
-		}
-	}
-
-	protected abstract void createFontDescriptorHelper();
-	
-	protected void processFontDescriptorValidation() {
-		this.descriptorHelper.validate();
-	}
+public abstract class SimpleFontValidator<T extends FontContainer> extends FontValidator<T>
+{
+
+    public SimpleFontValidator(PreflightContext context, PDFont font, T fContainer)
+    {
+        super(context, font, fContainer);
+    }
+
+    /**
+     * Call this method to validate the font wrapped by this object. If the validation failed, the error is updated in
+     * the FontContainer with the right error code.
+     * 
+     * Errors that are saved in the container will be added on the PreflightContext if the font is used later.
+     * 
+     * @return
+     */
+    public void validate() throws ValidationException
+    {
+        checkMandatoryField();
+
+        createFontDescriptorHelper();
+        processFontDescriptorValidation();
+
+        checkEncoding();
+        checkToUnicode();
+    }
+
+    protected void checkMandatoryField()
+    {
+        COSDictionary fontDictionary = (COSDictionary) font.getCOSObject();
+        boolean areFieldsPResent = fontDictionary.containsKey(COSName.TYPE);
+        areFieldsPResent &= fontDictionary.containsKey(COSName.SUBTYPE);
+        areFieldsPResent &= fontDictionary.containsKey(COSName.BASE_FONT);
+        areFieldsPResent &= fontDictionary.containsKey(COSName.FIRST_CHAR);
+        areFieldsPResent &= fontDictionary.containsKey(COSName.LAST_CHAR);
+        areFieldsPResent &= fontDictionary.containsKey(COSName.WIDTHS);
+
+        if (!areFieldsPResent)
+        {
+            this.fontContainer.push(new ValidationError(ERROR_FONTS_DICTIONARY_INVALID,
+                    "Some required fields are missing from the Font dictionary."));
+        }
+    }
+
+    protected abstract void createFontDescriptorHelper();
+
+    protected void processFontDescriptorValidation()
+    {
+        this.descriptorHelper.validate();
+    }
 }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/TrueTypeFontValidator.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/TrueTypeFontValidator.java?rev=1453416&r1=1453415&r2=1453416&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/TrueTypeFontValidator.java (original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/TrueTypeFontValidator.java Wed Mar  6 16:46:35 2013
@@ -35,38 +35,47 @@ import org.apache.pdfbox.preflight.Valid
 import org.apache.pdfbox.preflight.font.container.TrueTypeContainer;
 import org.apache.pdfbox.preflight.font.descriptor.TrueTypeDescriptorHelper;
 
-public class TrueTypeFontValidator extends SimpleFontValidator<TrueTypeContainer> {
+public class TrueTypeFontValidator extends SimpleFontValidator<TrueTypeContainer>
+{
 
-	public TrueTypeFontValidator(PreflightContext context, PDFont font) {
-		super(context, font, new TrueTypeContainer(font));
-	}
-	
-	protected void createFontDescriptorHelper() {
-		this.descriptorHelper = new TrueTypeDescriptorHelper(context, font, fontContainer);
-	}
-	
-	protected void checkEncoding() {		
-		PDFontDescriptor fd = this.font.getFontDescriptor();
-		if(fd != null) {
-			/* 
-			 * only MacRomanEncoding or WinAnsiEncoding are allowed for a non symbolic font.
-			 */
-			if (fd.isNonSymbolic()) {
-				Encoding encodingValue = this.font.getFontEncoding();
-				if (encodingValue == null	|| !(encodingValue instanceof MacRomanEncoding || encodingValue instanceof WinAnsiEncoding)) {
-					this.fontContainer.push(new ValidationError(ERROR_FONTS_ENCODING, "The Encoding is invalid for the NonSymbolic TTF"));
-				}
-			} 
+    public TrueTypeFontValidator(PreflightContext context, PDFont font)
+    {
+        super(context, font, new TrueTypeContainer(font));
+    }
 
-			/*
-			 * For symbolic font, no encoding entry is allowed and only one
-			 * encoding entry is expected into the FontFile CMap (Check latter when 
-			 * the FontFile stream will be checked)
-			 */
-			if (fd.isSymbolic() && 
-					((COSDictionary)this.font.getCOSObject()).getItem(COSName.ENCODING) != null) {
-				this.fontContainer.push(new ValidationError(ERROR_FONTS_ENCODING, "The Encoding should be missing for the Symbolic TTF"));
-			} 
-		}
-	}
+    protected void createFontDescriptorHelper()
+    {
+        this.descriptorHelper = new TrueTypeDescriptorHelper(context, font, fontContainer);
+    }
+
+    protected void checkEncoding()
+    {
+        PDFontDescriptor fd = this.font.getFontDescriptor();
+        if (fd != null)
+        {
+            /*
+             * only MacRomanEncoding or WinAnsiEncoding are allowed for a non symbolic font.
+             */
+            if (fd.isNonSymbolic())
+            {
+                Encoding encodingValue = this.font.getFontEncoding();
+                if (encodingValue == null
+                        || !(encodingValue instanceof MacRomanEncoding || encodingValue instanceof WinAnsiEncoding))
+                {
+                    this.fontContainer.push(new ValidationError(ERROR_FONTS_ENCODING,
+                            "The Encoding is invalid for the NonSymbolic TTF"));
+                }
+            }
+
+            /*
+             * For symbolic font, no encoding entry is allowed and only one encoding entry is expected into the FontFile
+             * CMap (Check latter when the FontFile stream will be checked)
+             */
+            if (fd.isSymbolic() && ((COSDictionary) this.font.getCOSObject()).getItem(COSName.ENCODING) != null)
+            {
+                this.fontContainer.push(new ValidationError(ERROR_FONTS_ENCODING,
+                        "The Encoding should be missing for the Symbolic TTF"));
+            }
+        }
+    }
 }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/Type0FontValidator.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/Type0FontValidator.java?rev=1453416&r1=1453415&r2=1453416&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/Type0FontValidator.java (original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/Type0FontValidator.java Wed Mar  6 16:46:35 2013
@@ -56,240 +56,295 @@ import org.apache.pdfbox.preflight.font.
 import org.apache.pdfbox.preflight.font.container.Type0Container;
 import org.apache.pdfbox.preflight.utils.COSUtils;
 
-public class Type0FontValidator extends FontValidator<Type0Container> {
+public class Type0FontValidator extends FontValidator<Type0Container>
+{
 
-	protected COSDocument cosDocument = null;
+    protected COSDocument cosDocument = null;
 
-	public Type0FontValidator(PreflightContext context, PDFont font) {
-		super(context, font, new Type0Container(font));
-		cosDocument = this.context.getDocument().getDocument();
-	}
-
-	@Override
-	public void validate() throws ValidationException {
-		checkMandatoryFields();
-		
-		processDescendantFont();
-
-		checkEncoding();
-		checkToUnicode();
-	}
-
-	/**
-	 * This methods extracts from the Font dictionary all mandatory fields. If a
-	 * mandatory field is missing, the list of ValidationError in the
-	 * FontContainer is updated. 
-	 */
-	protected void checkMandatoryFields() {
-		COSDictionary fontDictionary = (COSDictionary)font.getCOSObject();
-		boolean areFieldsPResent = fontDictionary.containsKey(COSName.TYPE);
-		areFieldsPResent &= fontDictionary.containsKey(COSName.SUBTYPE);
-		areFieldsPResent &= fontDictionary.containsKey(COSName.BASE_FONT);
-		areFieldsPResent &= fontDictionary.containsKey(COSName.DESCENDANT_FONTS);
-		areFieldsPResent &= fontDictionary.containsKey(COSName.ENCODING);
-
-		if (!areFieldsPResent) {
-			this.fontContainer.push(new ValidationError(ERROR_FONTS_DICTIONARY_INVALID,	"Some keys are missing from composite font dictionary"));
-		}
-	}
-
-	/**
-	 * Extract the single CIDFont from the Descendant array.
-	 * Create a FontValidator for this CODFont and launch its validation.
-	 */
-	protected void processDescendantFont() throws ValidationException {
-		COSDictionary fontDictionary = (COSDictionary)font.getCOSObject();
-		// a CIDFont is contained in the DescendantFonts array
-		COSArray array = COSUtils.getAsArray(fontDictionary.getItem(COSName.DESCENDANT_FONTS), cosDocument);
-		if (array == null || array.size() != 1) {
-			/*
-			 * in PDF 1.4, this array must contain only one element,
-			 * because of a PDF/A should be a PDF 1.4, this method 
-			 * returns an error if the array has more than one element.
-			 */
-			this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_INVALID, "CIDFont is missing from the DescendantFonts array or the size of array is greater than 1"));
-			return;
-		}
-
-		COSDictionary cidFont = COSUtils.getAsDictionary(array.get(0), cosDocument);
-		if (cidFont == null) {
-			this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_INVALID,	"The DescendantFonts array should have one element with is a dictionary."));
-			return;
-		}
-
-		FontValidator<? extends FontContainer> cidFontValidator = createDescendantValidator(cidFont);
-		if (cidFontValidator != null) {
-			this.fontContainer.setDelegateFontContainer(cidFontValidator.getFontContainer());
-			cidFontValidator.validate();
-		}
-	}
-
-	protected FontValidator<? extends FontContainer> createDescendantValidator(COSDictionary cidFont) {
-		String subtype = cidFont.getNameAsString(COSName.SUBTYPE);
-		FontValidator<? extends FontContainer> cidFontValidator = null;
-		if (FONT_DICTIONARY_VALUE_TYPE0.equals(subtype)) {
-			cidFontValidator = createCIDType0FontValidator(cidFont);
-		} else if (FONT_DICTIONARY_VALUE_TYPE2.equals(subtype)) {
-			cidFontValidator = createCIDType2FontValidator(cidFont);
-		} else {
-			this.fontContainer.push(new ValidationError(ERROR_FONTS_DICTIONARY_INVALID, "Type and/or Subtype keys are missing"));
-		}
-		return cidFontValidator;
-	}
-	
-	/**
-	 * Create the validation object for CIDType0 Font
-	 * @return
-	 */
-	protected FontValidator<? extends FontContainer> createCIDType0FontValidator(COSDictionary fDict) {
-		return new CIDType0FontValidator(context, new PDCIDFontType0Font(fDict));
-	}
-	
-	/**
-	 * Create the validation object for CIDType2 Font
-	 * @return
-	 */
-	protected FontValidator<? extends FontContainer> createCIDType2FontValidator(COSDictionary fDict) {
-		return new CIDType2FontValidator(context, new PDCIDFontType2Font(fDict));
-	}
-	
-	/**
-	 * Check the CMap entry.
-	 * 
-	 * The CMap entry must be a dictionary in a PDF/A. This entry can be a String
-	 * only if the String value is Identity-H or Identity-V
-	 * 
-	 * @param encoding
-	 */
-	protected void checkEncoding() {
-		COSBase encoding = ((COSDictionary)font.getCOSObject()).getItem(COSName.ENCODING);
-		checkCMapEncoding(encoding);
-	}
-
-	protected void checkCMapEncoding(COSBase encoding) {
-		if (COSUtils.isString(encoding, cosDocument)) {
-			// if encoding is a string, only 2 values are allowed
-			String str = COSUtils.getAsString(encoding, cosDocument);
-			if (!(FONT_DICTIONARY_VALUE_CMAP_IDENTITY_V.equals(str) || FONT_DICTIONARY_VALUE_CMAP_IDENTITY_H.equals(str))) {
-				this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_INVALID,	"The CMap is a string but it isn't an Identity-H/V"));
-				return;
-			} 
-		} else if (COSUtils.isStream(encoding, cosDocument)) {
-			/*
-			 * If the CMap is a stream, some fields are mandatory
-			 * and the CIDSytemInfo must be compared with the CIDSystemInfo
-			 * entry of the CIDFont.
-			 */
-			processCMapAsStream(COSUtils.getAsStream(encoding, cosDocument));
-		} else {
-			// CMap type is invalid
-			this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_CMAP_INVALID_OR_MISSING,	"The CMap type is invalid"));
-		}
-	}
-
-	/**
-	 * Standard information of a stream element will be checked by the StreamValidationProcess.
-	 * 
-	 * This method checks mandatory fields of the CMap stream. This method checks
-	 * too if the CMap stream is damaged using the CMapParser of the fontbox api.
-	 * 
-	 * @param aCMap
-	 * @return
-	 */
-	private void processCMapAsStream(COSStream aCMap) {
-
-		COSBase sysinfo = aCMap.getItem(COSName.CIDSYSTEMINFO);
-		checkCIDSystemInfo(sysinfo);
-
-		try {
-			// extract information from the CMap stream
-			CMap fontboxCMap = new CMapParser().parse(null, aCMap.getUnfilteredStream());
-			int wmValue = fontboxCMap.getWMode();
-			String cmnValue = fontboxCMap.getName();
-
-			/*
-			 * According to the getInt javadoc, -1 is returned if there are no result.
-			 * In the PDF Reference v1.7 p449, we can read that Default value is 0.
-			 */
-			int wmode = aCMap.getInt(COSName.getPDFName(FONT_DICTIONARY_KEY_CMAP_WMODE), FONT_DICTIONARY_DEFAULT_CMAP_WMODE);
-			String type = aCMap.getNameAsString(COSName.TYPE);
-			String cmapName = aCMap.getNameAsString(COSName.getPDFName(FONT_DICTIONARY_KEY_CMAP_NAME));
-
-			if (cmapName == null || "".equals(cmapName) || wmode > 1) {
-				this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_CMAP_INVALID_OR_MISSING,	"Some elements in the CMap dictionary are missing or invalid"));
-			} else if (!(wmValue == wmode && cmnValue.equals(cmapName))) {
-				this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_CMAP_INVALID_OR_MISSING, "CMapName or WMode is inconsistent"));
-			} else if (!FONT_DICTIONARY_VALUE_TYPE_CMAP.equals(type)) {
-				this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_CMAP_INVALID_OR_MISSING,	"The CMap type is invalid"));
-			}
-		} catch (IOException e) {
-			this.fontContainer.push(new ValidationError(ERROR_FONTS_CID_CMAP_DAMAGED, "The CMap type is damaged"));
-		}
-
-		COSDictionary cmapUsed = (COSDictionary)aCMap.getDictionaryObject(COSName.getPDFName(FONT_DICTIONARY_KEY_CMAP_USECMAP));
-		if (cmapUsed != null) {
-			checkCMapEncoding(cmapUsed);
-		}
-		compareCIDSystemInfo(aCMap);
-	}
-
-	/**
-	 * Check the content of the CIDSystemInfo dictionary. A CIDSystemInfo dictionary must contain :
-	 * <UL>
-	 * <li>a Name - Registry
-	 * <li>a Name - Ordering
-	 * <li>a Integer - Supplement
-	 * </UL>
-	 * 
-	 * @param sysinfo
-	 * @return
-	 */
-	protected boolean checkCIDSystemInfo(COSBase sysinfo) {
-		boolean result = true;
-		COSDictionary cidSysInfo = COSUtils.getAsDictionary(sysinfo, cosDocument);
-
-		if (cidSysInfo != null) {
-			COSBase reg = cidSysInfo.getItem(COSName.REGISTRY);
-			COSBase ord = cidSysInfo.getItem(COSName.ORDERING);
-			COSBase sup = cidSysInfo.getItem(COSName.SUPPLEMENT);
-
-			if (!(COSUtils.isString(reg, cosDocument) && COSUtils.isString(ord, cosDocument) && COSUtils.isInteger(sup, cosDocument))) {
-				this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_SYSINFO));
-				result = false;
-			}
-
-		} else {
-			this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_SYSINFO));
-			result = false;
-		}
-		return result;
-	}
-
-	/**
-	 * The CIDSystemInfo must have the same Registry and Ordering for CMap and
-	 * CIDFont. This control is useless if CMap is Identity-H or Identity-V so
-	 * this method is called by the checkCMap method.
-	 * 
-	 * @param cmap
-	 * @return
-	 */
-	private void compareCIDSystemInfo(COSDictionary cmap) {
-		COSDictionary fontDictionary = (COSDictionary)font.getCOSObject();
-		COSArray array = COSUtils.getAsArray(fontDictionary.getItem(COSName.DESCENDANT_FONTS), cosDocument);
-
-		if (array != null && array.size() > 0) {
-			COSDictionary cidFont = COSUtils.getAsDictionary(array.get(0), cosDocument);
-			COSDictionary cmsi = COSUtils.getAsDictionary(cmap.getItem(COSName.CIDSYSTEMINFO), cosDocument);
-			COSDictionary cfsi = COSUtils.getAsDictionary(cidFont.getItem(COSName.CIDSYSTEMINFO), cosDocument);
-
-			String regCM = COSUtils.getAsString(cmsi.getItem(COSName.REGISTRY), cosDocument);
-			String ordCM = COSUtils.getAsString(cmsi.getItem(COSName.ORDERING), cosDocument);
-			String regCF = COSUtils.getAsString(cfsi.getItem(COSName.REGISTRY), cosDocument);
-			String ordCF = COSUtils.getAsString(cfsi.getItem(COSName.ORDERING), cosDocument);
-
-			if (!regCF.equals(regCM) || !ordCF.equals(ordCM)) {
-				this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_SYSINFO, "The CIDSystemInfo is inconsistent"));
-			}
-		}
-	}
+    public Type0FontValidator(PreflightContext context, PDFont font)
+    {
+        super(context, font, new Type0Container(font));
+        cosDocument = this.context.getDocument().getDocument();
+    }
+
+    @Override
+    public void validate() throws ValidationException
+    {
+        checkMandatoryFields();
+
+        processDescendantFont();
+
+        checkEncoding();
+        checkToUnicode();
+    }
+
+    /**
+     * This methods extracts from the Font dictionary all mandatory fields. If a mandatory field is missing, the list of
+     * ValidationError in the FontContainer is updated.
+     */
+    protected void checkMandatoryFields()
+    {
+        COSDictionary fontDictionary = (COSDictionary) font.getCOSObject();
+        boolean areFieldsPResent = fontDictionary.containsKey(COSName.TYPE);
+        areFieldsPResent &= fontDictionary.containsKey(COSName.SUBTYPE);
+        areFieldsPResent &= fontDictionary.containsKey(COSName.BASE_FONT);
+        areFieldsPResent &= fontDictionary.containsKey(COSName.DESCENDANT_FONTS);
+        areFieldsPResent &= fontDictionary.containsKey(COSName.ENCODING);
+
+        if (!areFieldsPResent)
+        {
+            this.fontContainer.push(new ValidationError(ERROR_FONTS_DICTIONARY_INVALID,
+                    "Some keys are missing from composite font dictionary"));
+        }
+    }
+
+    /**
+     * Extract the single CIDFont from the Descendant array. Create a FontValidator for this CODFont and launch its
+     * validation.
+     */
+    protected void processDescendantFont() throws ValidationException
+    {
+        COSDictionary fontDictionary = (COSDictionary) font.getCOSObject();
+        // a CIDFont is contained in the DescendantFonts array
+        COSArray array = COSUtils.getAsArray(fontDictionary.getItem(COSName.DESCENDANT_FONTS), cosDocument);
+        if (array == null || array.size() != 1)
+        {
+            /*
+             * in PDF 1.4, this array must contain only one element, because of a PDF/A should be a PDF 1.4, this method
+             * returns an error if the array has more than one element.
+             */
+            this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_INVALID,
+                    "CIDFont is missing from the DescendantFonts array or the size of array is greater than 1"));
+            return;
+        }
+
+        COSDictionary cidFont = COSUtils.getAsDictionary(array.get(0), cosDocument);
+        if (cidFont == null)
+        {
+            this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_INVALID,
+                    "The DescendantFonts array should have one element with is a dictionary."));
+            return;
+        }
+
+        FontValidator<? extends FontContainer> cidFontValidator = createDescendantValidator(cidFont);
+        if (cidFontValidator != null)
+        {
+            this.fontContainer.setDelegateFontContainer(cidFontValidator.getFontContainer());
+            cidFontValidator.validate();
+        }
+    }
+
+    protected FontValidator<? extends FontContainer> createDescendantValidator(COSDictionary cidFont)
+    {
+        String subtype = cidFont.getNameAsString(COSName.SUBTYPE);
+        FontValidator<? extends FontContainer> cidFontValidator = null;
+        if (FONT_DICTIONARY_VALUE_TYPE0.equals(subtype))
+        {
+            cidFontValidator = createCIDType0FontValidator(cidFont);
+        }
+        else if (FONT_DICTIONARY_VALUE_TYPE2.equals(subtype))
+        {
+            cidFontValidator = createCIDType2FontValidator(cidFont);
+        }
+        else
+        {
+            this.fontContainer.push(new ValidationError(ERROR_FONTS_DICTIONARY_INVALID,
+                    "Type and/or Subtype keys are missing"));
+        }
+        return cidFontValidator;
+    }
+
+    /**
+     * Create the validation object for CIDType0 Font
+     * 
+     * @return
+     */
+    protected FontValidator<? extends FontContainer> createCIDType0FontValidator(COSDictionary fDict)
+    {
+        return new CIDType0FontValidator(context, new PDCIDFontType0Font(fDict));
+    }
+
+    /**
+     * Create the validation object for CIDType2 Font
+     * 
+     * @return
+     */
+    protected FontValidator<? extends FontContainer> createCIDType2FontValidator(COSDictionary fDict)
+    {
+        return new CIDType2FontValidator(context, new PDCIDFontType2Font(fDict));
+    }
+
+    /**
+     * Check the CMap entry.
+     * 
+     * The CMap entry must be a dictionary in a PDF/A. This entry can be a String only if the String value is Identity-H
+     * or Identity-V
+     * 
+     * @param encoding
+     */
+    protected void checkEncoding()
+    {
+        COSBase encoding = ((COSDictionary) font.getCOSObject()).getItem(COSName.ENCODING);
+        checkCMapEncoding(encoding);
+    }
+
+    protected void checkCMapEncoding(COSBase encoding)
+    {
+        if (COSUtils.isString(encoding, cosDocument))
+        {
+            // if encoding is a string, only 2 values are allowed
+            String str = COSUtils.getAsString(encoding, cosDocument);
+            if (!(FONT_DICTIONARY_VALUE_CMAP_IDENTITY_V.equals(str) || FONT_DICTIONARY_VALUE_CMAP_IDENTITY_H
+                    .equals(str)))
+            {
+                this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_INVALID,
+                        "The CMap is a string but it isn't an Identity-H/V"));
+                return;
+            }
+        }
+        else if (COSUtils.isStream(encoding, cosDocument))
+        {
+            /*
+             * If the CMap is a stream, some fields are mandatory and the CIDSytemInfo must be compared with the
+             * CIDSystemInfo entry of the CIDFont.
+             */
+            processCMapAsStream(COSUtils.getAsStream(encoding, cosDocument));
+        }
+        else
+        {
+            // CMap type is invalid
+            this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_CMAP_INVALID_OR_MISSING,
+                    "The CMap type is invalid"));
+        }
+    }
+
+    /**
+     * Standard information of a stream element will be checked by the StreamValidationProcess.
+     * 
+     * This method checks mandatory fields of the CMap stream. This method checks too if the CMap stream is damaged
+     * using the CMapParser of the fontbox api.
+     * 
+     * @param aCMap
+     * @return
+     */
+    private void processCMapAsStream(COSStream aCMap)
+    {
+
+        COSBase sysinfo = aCMap.getItem(COSName.CIDSYSTEMINFO);
+        checkCIDSystemInfo(sysinfo);
+
+        try
+        {
+            // extract information from the CMap stream
+            CMap fontboxCMap = new CMapParser().parse(null, aCMap.getUnfilteredStream());
+            int wmValue = fontboxCMap.getWMode();
+            String cmnValue = fontboxCMap.getName();
+
+            /*
+             * According to the getInt javadoc, -1 is returned if there are no result. In the PDF Reference v1.7 p449,
+             * we can read that Default value is 0.
+             */
+            int wmode = aCMap.getInt(COSName.getPDFName(FONT_DICTIONARY_KEY_CMAP_WMODE),
+                    FONT_DICTIONARY_DEFAULT_CMAP_WMODE);
+            String type = aCMap.getNameAsString(COSName.TYPE);
+            String cmapName = aCMap.getNameAsString(COSName.getPDFName(FONT_DICTIONARY_KEY_CMAP_NAME));
+
+            if (cmapName == null || "".equals(cmapName) || wmode > 1)
+            {
+                this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_CMAP_INVALID_OR_MISSING,
+                        "Some elements in the CMap dictionary are missing or invalid"));
+            }
+            else if (!(wmValue == wmode && cmnValue.equals(cmapName)))
+            {
+                this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_CMAP_INVALID_OR_MISSING,
+                        "CMapName or WMode is inconsistent"));
+            }
+            else if (!FONT_DICTIONARY_VALUE_TYPE_CMAP.equals(type))
+            {
+                this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_CMAP_INVALID_OR_MISSING,
+                        "The CMap type is invalid"));
+            }
+        }
+        catch (IOException e)
+        {
+            this.fontContainer.push(new ValidationError(ERROR_FONTS_CID_CMAP_DAMAGED, "The CMap type is damaged"));
+        }
+
+        COSDictionary cmapUsed = (COSDictionary) aCMap.getDictionaryObject(COSName
+                .getPDFName(FONT_DICTIONARY_KEY_CMAP_USECMAP));
+        if (cmapUsed != null)
+        {
+            checkCMapEncoding(cmapUsed);
+        }
+        compareCIDSystemInfo(aCMap);
+    }
+
+    /**
+     * Check the content of the CIDSystemInfo dictionary. A CIDSystemInfo dictionary must contain :
+     * <UL>
+     * <li>a Name - Registry
+     * <li>a Name - Ordering
+     * <li>a Integer - Supplement
+     * </UL>
+     * 
+     * @param sysinfo
+     * @return
+     */
+    protected boolean checkCIDSystemInfo(COSBase sysinfo)
+    {
+        boolean result = true;
+        COSDictionary cidSysInfo = COSUtils.getAsDictionary(sysinfo, cosDocument);
+
+        if (cidSysInfo != null)
+        {
+            COSBase reg = cidSysInfo.getItem(COSName.REGISTRY);
+            COSBase ord = cidSysInfo.getItem(COSName.ORDERING);
+            COSBase sup = cidSysInfo.getItem(COSName.SUPPLEMENT);
+
+            if (!(COSUtils.isString(reg, cosDocument) && COSUtils.isString(ord, cosDocument) && COSUtils.isInteger(sup,
+                    cosDocument)))
+            {
+                this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_SYSINFO));
+                result = false;
+            }
+
+        }
+        else
+        {
+            this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_SYSINFO));
+            result = false;
+        }
+        return result;
+    }
+
+    /**
+     * The CIDSystemInfo must have the same Registry and Ordering for CMap and CIDFont. This control is useless if CMap
+     * is Identity-H or Identity-V so this method is called by the checkCMap method.
+     * 
+     * @param cmap
+     * @return
+     */
+    private void compareCIDSystemInfo(COSDictionary cmap)
+    {
+        COSDictionary fontDictionary = (COSDictionary) font.getCOSObject();
+        COSArray array = COSUtils.getAsArray(fontDictionary.getItem(COSName.DESCENDANT_FONTS), cosDocument);
+
+        if (array != null && array.size() > 0)
+        {
+            COSDictionary cidFont = COSUtils.getAsDictionary(array.get(0), cosDocument);
+            COSDictionary cmsi = COSUtils.getAsDictionary(cmap.getItem(COSName.CIDSYSTEMINFO), cosDocument);
+            COSDictionary cfsi = COSUtils.getAsDictionary(cidFont.getItem(COSName.CIDSYSTEMINFO), cosDocument);
+
+            String regCM = COSUtils.getAsString(cmsi.getItem(COSName.REGISTRY), cosDocument);
+            String ordCM = COSUtils.getAsString(cmsi.getItem(COSName.ORDERING), cosDocument);
+            String regCF = COSUtils.getAsString(cfsi.getItem(COSName.REGISTRY), cosDocument);
+            String ordCF = COSUtils.getAsString(cfsi.getItem(COSName.ORDERING), cosDocument);
+
+            if (!regCF.equals(regCM) || !ordCF.equals(ordCM))
+            {
+                this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_SYSINFO,
+                        "The CIDSystemInfo is inconsistent"));
+            }
+        }
+    }
 }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/Type1FontValidator.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/Type1FontValidator.java?rev=1453416&r1=1453415&r2=1453416&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/Type1FontValidator.java (original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/Type1FontValidator.java Wed Mar  6 16:46:35 2013
@@ -39,34 +39,43 @@ import org.apache.pdfbox.preflight.font.
 import org.apache.pdfbox.preflight.font.descriptor.Type1DescriptorHelper;
 import org.apache.pdfbox.preflight.utils.COSUtils;
 
-public class Type1FontValidator extends SimpleFontValidator<Type1Container> {
-	
-	public Type1FontValidator(PreflightContext context, PDFont font) {
-		super(context, font, new Type1Container(font));
-	}
+public class Type1FontValidator extends SimpleFontValidator<Type1Container>
+{
 
-	@Override
-	protected void createFontDescriptorHelper() {
-		this.descriptorHelper = new Type1DescriptorHelper(context, font, fontContainer);
-	}
+    public Type1FontValidator(PreflightContext context, PDFont font)
+    {
+        super(context, font, new Type1Container(font));
+    }
+
+    @Override
+    protected void createFontDescriptorHelper()
+    {
+        this.descriptorHelper = new Type1DescriptorHelper(context, font, fontContainer);
+    }
+
+    protected void checkEncoding()
+    {
+        COSBase encoding = ((COSDictionary) font.getCOSObject()).getItem(COSName.ENCODING);
+        if (encoding != null)
+        {
+            COSDocument cosDocument = context.getDocument().getDocument();
+            if (COSUtils.isString(encoding, cosDocument))
+            {
+                String encodingName = COSUtils.getAsString(encoding, cosDocument);
+                if (!(encodingName.equals(FONT_DICTIONARY_VALUE_ENCODING_MAC)
+                        || encodingName.equals(FONT_DICTIONARY_VALUE_ENCODING_MAC_EXP)
+                        || encodingName.equals(FONT_DICTIONARY_VALUE_ENCODING_WIN)
+                        || encodingName.equals(FONT_DICTIONARY_VALUE_ENCODING_PDFDOC) || encodingName
+                            .equals(FONT_DICTIONARY_VALUE_ENCODING_STD)))
+                {
+                    this.fontContainer.push(new ValidationError(ERROR_FONTS_ENCODING));
+                }
+            }
+            else if (!COSUtils.isDictionary(encoding, cosDocument))
+            {
+                this.fontContainer.push(new ValidationError(ERROR_FONTS_ENCODING));
+            }
+        }
+    }
 
-	protected void checkEncoding() {	
-		COSBase encoding = ((COSDictionary)font.getCOSObject()).getItem(COSName.ENCODING);
-		if (encoding != null) {
-			COSDocument cosDocument = context.getDocument().getDocument();
-			if (COSUtils.isString(encoding, cosDocument)) {
-				String encodingName = COSUtils.getAsString(encoding, cosDocument);
-				if (!(encodingName.equals(FONT_DICTIONARY_VALUE_ENCODING_MAC)
-						|| encodingName.equals(FONT_DICTIONARY_VALUE_ENCODING_MAC_EXP)
-						|| encodingName.equals(FONT_DICTIONARY_VALUE_ENCODING_WIN)
-						|| encodingName.equals(FONT_DICTIONARY_VALUE_ENCODING_PDFDOC) 
-						|| encodingName.equals(FONT_DICTIONARY_VALUE_ENCODING_STD))) {
-					this.fontContainer.push(new ValidationError(ERROR_FONTS_ENCODING));
-				}
-			} else if (!COSUtils.isDictionary(encoding, cosDocument)) {
-				this.fontContainer.push(new ValidationError(ERROR_FONTS_ENCODING));
-			} 
-		}	
-	}
-	
 }