pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1708467 - /pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/content/PreflightStreamEngine.java
Date Tue, 13 Oct 2015 16:52:49 GMT
Author: tilman
Date: Tue Oct 13 16:52:49 2015
New Revision: 1708467

URL: http://svn.apache.org/viewvc?rev=1708467&view=rev
Log:
PDFBOX-3003: refactor double code

Modified:
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/content/PreflightStreamEngine.java

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/content/PreflightStreamEngine.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/content/PreflightStreamEngine.java?rev=1708467&r1=1708466&r2=1708467&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/content/PreflightStreamEngine.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/content/PreflightStreamEngine.java
Tue Oct 13 16:52:49 2015
@@ -283,7 +283,7 @@ public abstract class PreflightStreamEng
      * the color space defined in OutputIntent dictionaries.
      * 
      * @param operator the InlinedImage object (BI to EI)
-     * @throws ContentStreamException
+     * @throws IOException
      */
     protected void validateInlineImageColorSpace(Operator operator) throws IOException
     {
@@ -312,9 +312,7 @@ public abstract class PreflightStreamEng
                     if (pdCS != null)
                     {
                         cs = ColorSpaces.valueOf(pdCS.getName());
-                        PreflightConfiguration cfg = context.getConfig();
-                        ColorSpaceHelperFactory csFact = cfg.getColorSpaceHelperFact();
-                        csHelper = csFact.getColorSpaceHelper(context, pdCS, ColorSpaceRestriction.ONLY_DEVICE);
+                        csHelper = getColorSpaceHelper(pdCS);
                     }
                 }
 
@@ -343,13 +341,18 @@ public abstract class PreflightStreamEng
                     }
                 }                
                 PDColorSpace pdCS = PDColorSpace.create(csInlinedBase);
-                PreflightConfiguration cfg = context.getConfig();
-                ColorSpaceHelperFactory csFact = cfg.getColorSpaceHelperFact();
-                csHelper = csFact.getColorSpaceHelper(context, pdCS, ColorSpaceRestriction.ONLY_DEVICE);
+                csHelper = getColorSpaceHelper(pdCS);
             }
             csHelper.validate();
         }
     }
+
+    private ColorSpaceHelper getColorSpaceHelper(PDColorSpace pdCS)
+    {
+        PreflightConfiguration cfg = context.getConfig();
+        ColorSpaceHelperFactory csFact = cfg.getColorSpaceHelperFact();
+        return csFact.getColorSpaceHelper(context, pdCS, ColorSpaceRestriction.ONLY_DEVICE);
+    }
     
     // deliver the long name of a device colorspace, or the parameter
     private COSBase toLongName(COSBase cs)



Mime
View raw message