]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Check style and find bugs now pass without errors
authorMehdi Houshmand <mehdi@apache.org>
Tue, 3 Jul 2012 14:32:03 +0000 (14:32 +0000)
committerMehdi Houshmand <mehdi@apache.org>
Tue, 3 Jul 2012 14:32:03 +0000 (14:32 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1356755 13f79535-47bb-0310-9956-ffa450edef68

31 files changed:
src/java/org/apache/fop/afp/modca/IncludedResourceObject.java
src/java/org/apache/fop/afp/util/AFPResourceAccessor.java
src/java/org/apache/fop/apps/FopConfParser.java
src/java/org/apache/fop/apps/FopFactoryBuilder.java
src/java/org/apache/fop/apps/io/ResourceResolverFactory.java
src/java/org/apache/fop/cli/CommandLineOptions.java
src/java/org/apache/fop/fonts/DefaultFontConfig.java
src/java/org/apache/fop/fonts/DefaultFontConfigurator.java
src/java/org/apache/fop/fonts/FontCache.java
src/java/org/apache/fop/fonts/FontLoader.java
src/java/org/apache/fop/render/PrintRenderer.java
src/java/org/apache/fop/render/PrintRendererConfigurator.java
src/java/org/apache/fop/render/afp/AFPFontConfig.java
src/java/org/apache/fop/render/afp/AFPRendererConfig.java
src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java
src/java/org/apache/fop/render/afp/AFPShadingMode.java
src/java/org/apache/fop/render/bitmap/PNGDocumentHandler.java
src/java/org/apache/fop/render/bitmap/TIFFDocumentHandler.java
src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java
src/java/org/apache/fop/render/pcl/PCLDocumentHandler.java
src/java/org/apache/fop/render/pcl/PCLRenderingMode.java
src/java/org/apache/fop/render/pdf/PDFEncryptionOption.java
src/java/org/apache/fop/render/pdf/PDFRendererOption.java
src/java/org/apache/fop/render/pdf/PDFRendererOptionsConfig.java
src/java/org/apache/fop/render/print/PrintRendererMaker.java
src/java/org/apache/fop/render/ps/PSDocumentHandler.java
src/java/org/apache/fop/render/xml/XMLRendererMaker.java
src/java/org/apache/fop/servlet/FopServlet.java
src/java/org/apache/fop/util/ColorSpaceCache.java
src/sandbox/org/apache/fop/render/svg/SVGDocumentHandler.java
src/sandbox/org/apache/fop/render/svg/SVGPrintDocumentHandler.java

index 0d6e0bc09229851b3139d0e001245d92554c7752..9ab84a64018cf32f503e43db9a2dfaa303eaafc5 100644 (file)
@@ -26,9 +26,8 @@ import java.net.URI;
 
 import org.apache.commons.io.IOUtils;
 
-import org.apache.fop.afp.util.AFPResourceUtil;
 import org.apache.fop.afp.util.AFPResourceAccessor;
-
+import org.apache.fop.afp.util.AFPResourceUtil;
 
 /**
  * Encapsulates an included resource object that is loaded from an external file.
index ddcfa001bcce3e65968461c44240fcdcb144bf4a..02691527edc7a044706560dbef9fb4c22b4ef3d8 100644 (file)
@@ -24,8 +24,6 @@ import java.io.InputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
 
-import org.apache.fop.apps.FOUserAgent;
-import org.apache.fop.apps.FopFactory;
 import org.apache.fop.apps.io.InternalResourceResolver;
 
 /**
@@ -37,9 +35,10 @@ public final class AFPResourceAccessor {
     private final String baseURI;
 
     /**
-     * Constructor for resource to be accessed via the {@link FOUserAgent}. This contructor
-     * takes a base URI for resolving font resource URIs. So, if fonts need to be accessed, you can
-     * set the {@link FontManager}'s base URI instead of the one on the {@link FopFactory}.
+     * Constructor for resource to be accessed via the {@link org.apache.fop.apps.FOUserAgent}. This
+     * contructor takes a base URI for resolving font resource URIs. So, if fonts need to be
+     * accessed, you can set the {@link FontManager}'s base URI instead of the one on the
+     * {@link org.apache.fop.apps.FopFactory}.
      *
      * @param InternalResourceResolver resource resolver
      * @param baseURI the custom base URI to resolve relative URIs against (may be null)
@@ -50,7 +49,7 @@ public final class AFPResourceAccessor {
     }
 
     /**
-     * Constructor for resource to be accessed via the {@link FOUserAgent}.
+     * Constructor for resource to be accessed via the {@link org.apache.fop.apps.FOUserAgent}.
      *
      * @param InternalResourceResolver resource resolver
      */
@@ -74,5 +73,4 @@ public final class AFPResourceAccessor {
     public InputStream createInputStream(URI uri) throws IOException {
         return resourceResolver.getResource(getResourceURI(uri));
     }
-
 }
index 4c9a7bcae9da01e602388af6e80389b126679309..bf39a53f0a48a78679e957e2fb96f32c8cd0e42d 100644 (file)
@@ -26,6 +26,7 @@ import java.io.InputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.HashMap;
+import java.util.Locale;
 import java.util.Map;
 
 import org.xml.sax.SAXException;
@@ -39,9 +40,9 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.xmlgraphics.image.loader.spi.ImageImplRegistry;
 import org.apache.xmlgraphics.image.loader.util.Penalty;
 
+import org.apache.fop.apps.io.InternalResourceResolver;
 import org.apache.fop.apps.io.ResourceResolver;
 import org.apache.fop.apps.io.ResourceResolverFactory;
-import org.apache.fop.apps.io.InternalResourceResolver;
 import org.apache.fop.fonts.FontManagerConfigurator;
 import org.apache.fop.hyphenation.HyphenationTreeCache;
 import org.apache.fop.util.LogUtil;
@@ -233,7 +234,7 @@ public class FopConfParser {
         }
 
         // configure font manager
-        new FontManagerConfigurator(cfg, fopFactoryBuilder.getBaseUri(), resourceResolver).configure(
+        new FontManagerConfigurator(cfg, fopFactoryBuilder.getBaseURI(), resourceResolver).configure(
                 fopFactoryBuilder.getFontManager(), strict);
 
         // configure image loader framework
@@ -261,7 +262,7 @@ public class FopConfParser {
                             + " element must consist of exactly two letters ("
                             + location + ")", error);
                 }
-                lang = lang.toLowerCase();
+                lang = lang.toLowerCase(Locale.getDefault());
 
                 country = hyphPatConfig[i].getAttribute("country", null);
                 if ("".equals(country)) {
@@ -273,7 +274,7 @@ public class FopConfParser {
                                 + " element must consist of exactly two letters ("
                                 + location + ")", error);
                     }
-                    country = country.toUpperCase();
+                    country = country.toUpperCase(Locale.getDefault());
                 }
 
                 filename = hyphPatConfig[i].getValue(null);
@@ -318,7 +319,7 @@ public class FopConfParser {
                 String className = penaltyCfg.getAttribute("class");
                 String value = penaltyCfg.getAttribute("value");
                 Penalty p = null;
-                if (value.toUpperCase().startsWith("INF")) {
+                if (value.toUpperCase(Locale.getDefault()).startsWith("INF")) {
                     p = Penalty.INFINITE_PENALTY;
                 } else {
                     try {
index fa3a2722ebfa55feeb037ef9368e8af11f8ae071..44c44c119e7ed00ee222c1a12fdb99a04d56c021 100644 (file)
@@ -115,7 +115,7 @@ public final class FopFactoryBuilder {
      *
      * @return the base URI
      */
-    URI getBaseUri() {
+    URI getBaseURI() {
         return config.getBaseURI();
     }
 
index 881db20f71b701af37bbfdbe2d9278e030b992a7..2c8300fb93f80470fcbc4128711635432d27530e 100644 (file)
@@ -156,8 +156,11 @@ public final class ResourceResolverFactory {
 
         public OutputStream getOutputStream(String id) throws IOException {
             File file = getTempFile(id);
-            file.createNewFile();
-            return new FileOutputStream(file);
+            if (file.createNewFile()) {
+                return new FileOutputStream(file);
+            } else {
+                throw new IOException("Filed to create temporary file: " + id);
+            }
         }
     }
 
index 6dda84cb49a099cc2f4e049cb6c890a57f86d148..aa402aa6a80687b10e0bf8be5ac6c154b0796435 100644 (file)
@@ -1038,6 +1038,7 @@ public class CommandLineOptions {
                 throw new FOPException(e);
             }
             fopFactoryBuilder.setStrictFOValidation(strictValidation);
+            fopFactoryBuilder.setComplexScriptFeatures(useComplexScriptFeatures);
         }
         factory = fopFactoryBuilder.build();
      }
index 923e68fdc8c894394bcf0794b291c8e517bda4b2..6c5cebb422880edfbc63699fce8dbe7ca49dd405 100644 (file)
@@ -38,7 +38,7 @@ import org.apache.fop.util.LogUtil;
  */
 public final class DefaultFontConfig implements FontConfig {
 
-    protected static Log log = LogFactory.getLog(DefaultFontConfig.class);
+    private static final Log log = LogFactory.getLog(DefaultFontConfig.class);
 
     private final List<Directory> directories = new ArrayList<Directory>();
 
index 043f0f14e11bb0693a593e1b45d6a9023e7ddfff..2c60cf4bf2e851b91dcac72e723b38acf6fafb8d 100644 (file)
@@ -43,7 +43,7 @@ import org.apache.fop.util.LogUtil;
  */
 public class DefaultFontConfigurator implements FontConfigurator<EmbedFontInfo> {
     /** logger instance */
-    protected static Log log = LogFactory.getLog(DefaultFontConfigurator.class);
+    protected static final Log log = LogFactory.getLog(DefaultFontConfigurator.class);
 
     private final FontManager fontManager;
     private final InternalResourceResolver resourceResolver;
@@ -68,11 +68,11 @@ public class DefaultFontConfigurator implements FontConfigurator<EmbedFontInfo>
      * Initializes font info settings from the user configuration
      * @throws FOPException if an exception occurs while processing the configuration
      */
-    public List<EmbedFontInfo> configure(FontConfig fontInfoConfig)
-            throws FOPException {
+    public List<EmbedFontInfo> configure(FontConfig fontInfoConfig) throws FOPException {
         List<EmbedFontInfo> fontInfoList = new ArrayList<EmbedFontInfo>();
-        DefaultFontConfig adobeFontInfoConfig = (DefaultFontConfig) fontInfoConfig;
-        if (adobeFontInfoConfig != null) {
+        if (fontInfoConfig != null) {
+            assert fontInfoConfig instanceof DefaultFontConfig;
+            DefaultFontConfig adobeFontInfoConfig = (DefaultFontConfig) fontInfoConfig;
             long start = 0;
             if (log.isDebugEnabled()) {
                 log.debug("Starting font configuration...");
@@ -154,14 +154,10 @@ public class DefaultFontConfigurator implements FontConfigurator<EmbedFontInfo>
         // no font triplet info
         if (tripletList.size() == 0) {
             URI fontUri = resourceResolver.resolveFromBase(embedUri);
-            if (fontUri != null) {
-                FontInfoFinder finder = new FontInfoFinder();
-                finder.setEventListener(listener);
-                EmbedFontInfo[] infos = finder.find(fontUri, resourceResolver, fontCache);
-                return infos[0]; //When subFont is set, only one font is returned
-            } else {
-                return null;
-            }
+            FontInfoFinder finder = new FontInfoFinder();
+            finder.setEventListener(listener);
+            EmbedFontInfo[] infos = finder.find(fontUri, resourceResolver, fontCache);
+            return infos[0]; //When subFont is set, only one font is returned
         }
         EncodingMode encodingMode = EncodingMode.getValue(font.getEncodingMode());
         EmbeddingMode embeddingMode = EmbeddingMode.getValue(font.getEmbeddingMode());
index 47c0f95e24f792b89148a969b645f743749bb7dd..35997f3d705c322585184dec19ace2ee0168f043 100644 (file)
@@ -333,7 +333,7 @@ public final class FontCache implements Serializable {
                 // try and determine modified date
                 URI fontUri = resourceResolver.resolveFromBase(fontInfo.getEmbedURI());
                 File fontFile = new File(fontUri);
-                long lastModified = (fontFile != null ? fontFile.lastModified() : -1);
+                long lastModified = fontFile.lastModified();
                 cachedFontFile = new CachedFontFile(lastModified);
                 if (log.isTraceEnabled()) {
                     log.trace("Font added to cache: " + cacheKey);
index 96915e097eb914b0dfcb1bc5bf712e28cc73da76..f7ee24cbca536a4e5060a2e69441ab67849f9dfb 100644 (file)
@@ -106,7 +106,7 @@ public abstract class FontLoader {
             loader = new Type1FontLoader(fontFileURI, embedded, useKerning, resourceResolver);
         } else {
             loader = new TTFFontLoader(fontFileURI, subFontName, embedded, embeddingMode,
-                               encodingMode, useKerning, useAdvanced, resourceResolver);
+                    encodingMode, useKerning, useAdvanced, resourceResolver);
         }
         return loader.getFont();
     }
index 5302975f6813e1cd0e7e73281531ec8f5c502f46..b1ff59c842eb9a500c558dd81c665251038330b5 100644 (file)
@@ -39,8 +39,6 @@ import org.apache.fop.fonts.FontManager;
 import org.apache.fop.fonts.FontTriplet;
 import org.apache.fop.fonts.base14.Base14FontCollection;
 
-import sun.font.FontResolver;
-
 /** Abstract base class of "Print" type renderers.  */
 public abstract class PrintRenderer extends AbstractRenderer {
 
@@ -54,9 +52,6 @@ public abstract class PrintRenderer extends AbstractRenderer {
     /** Font configuration */
     protected FontInfo fontInfo;
 
-    /** Font resolver */
-    protected FontResolver fontResolver = null;
-
     /** list of fonts */
     protected List<EmbedFontInfo> embedFontInfoList = null;
 
index f36bd4c7fcecc42be7fbb4fef1bd2d9e8a7d1bd2..8de2d1a92d263919cd3659ded98be9ceea184b8f 100644 (file)
@@ -22,9 +22,6 @@ package org.apache.fop.render;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.io.InternalResourceResolver;
@@ -46,9 +43,6 @@ import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator;
 public abstract class PrintRendererConfigurator extends AbstractRendererConfigurator
         implements IFDocumentHandlerConfigurator {
 
-    /** logger instance */
-    private static Log LOG = LogFactory.getLog(PrintRendererConfigurator.class);
-
     private final RendererConfigParser rendererConfigParser;
 
     private final FontConfigurator<EmbedFontInfo> fontInfoConfigurator;
@@ -170,4 +164,13 @@ public abstract class PrintRendererConfigurator extends AbstractRendererConfigur
     private List<EmbedFontInfo> buildFontList(String mimeType) throws FOPException {
         return fontInfoConfigurator.configure(getRendererConfig(mimeType).getFontInfoConfig());
     }
+
+    public static PrintRendererConfigurator createDefaultInstance(FOUserAgent userAgent) {
+        return new PrintRendererConfigurator(userAgent, null) {
+            @Override
+            protected List<FontCollection> getDefaultFontCollection() {
+                throw new UnsupportedOperationException();
+            }
+        };
+    }
 }
index 4b2ece440e92e6587003022680d8b360dfffb278..eca76078f0831543a552781bbc6dd57d95ab492d 100644 (file)
@@ -351,19 +351,10 @@ public final class AFPFontConfig implements FontConfig {
             CharacterSet characterSet = null;
             if (base14 != null) {
                 try {
-                    Class<? extends Typeface> clazz = Class.forName(
-                            "org.apache.fop.fonts.base14." + base14).asSubclass(Typeface.class);
-                    try {
-                        Typeface tf = clazz.newInstance();
-                        characterSet = CharacterSetBuilder.getSingleByteInstance()
-                                                          .build(characterset, super.codePage,
-                                                                  super.encoding,
-                                                                  tf, eventProducer);
-                    } catch (Exception ie) {
-                        String msg = "The base 14 font class " + clazz.getName()
-                                + " could not be instantiated";
-                        LOG.error(msg);
-                    }
+                    Typeface tf = getTypeFace(base14);
+                    characterSet = CharacterSetBuilder.getSingleByteInstance()
+                                                      .build(characterset, super.codePage,
+                                                              super.encoding, tf, eventProducer);
                 } catch (ClassNotFoundException cnfe) {
                     String msg = "The base 14 font class for " + characterset
                             + " could not be found";
@@ -378,6 +369,22 @@ public final class AFPFontConfig implements FontConfig {
         }
     }
 
+    private static Typeface getTypeFace(String base14Name) throws ClassNotFoundException {
+        try {
+            Class<? extends Typeface> clazz = Class.forName("org.apache.fop.fonts.base14."
+                    + base14Name).asSubclass(Typeface.class);
+            return clazz.newInstance();
+        } catch (IllegalAccessException iae) {
+            LOG.error(iae.getMessage());
+        } catch (ClassNotFoundException cnfe) {
+            LOG.error(cnfe.getMessage());
+        } catch (InstantiationException ie) {
+            LOG.error(ie.getMessage());
+        }
+        throw new ClassNotFoundException("Couldn't load file for AFP font with base14 name: "
+                + base14Name);
+    }
+
     static final class RasterFontConfig extends AFPFontConfigData {
         private final List<RasterCharactersetData> charsets;
 
@@ -395,24 +402,20 @@ public final class AFPFontConfig implements FontConfig {
             for (RasterCharactersetData charset : charsets) {
                 if (charset.base14 != null) {
                     try {
-                        Class<? extends Typeface> clazz = Class.forName(
-                                "org.apache.fop.fonts.base14." + charset.base14).asSubclass(
-                                Typeface.class);
-                        try {
-                            Typeface tf = clazz.newInstance();
-                            rasterFont.addCharacterSet(charset.size,
-                                    CharacterSetBuilder.getSingleByteInstance().build(
-                                            charset.characterset, super.codePage, super.encoding,
-                                            tf, eventProducer));
-                        } catch (Exception ie) {
-                            String msg = "The base 14 font class " + clazz.getName()
-                                    + " could not be instantiated";
-                            LOG.error(msg);
-                        }
+                        Typeface tf = getTypeFace(charset.base14);
+                        rasterFont.addCharacterSet(charset.size,
+                                CharacterSetBuilder.getSingleByteInstance().build(
+                                        charset.characterset, super.codePage, super.encoding,
+                                        tf, eventProducer));
+
                     } catch (ClassNotFoundException cnfe) {
                         String msg = "The base 14 font class for " + charset.characterset
                                 + " could not be found";
                         LOG.error(msg);
+                    } catch (IOException ie) {
+                        String msg = "The base 14 font class " + charset.characterset
+                                + " could not be instantiated";
+                        LOG.error(msg);
                     }
                 } else {
                     AFPResourceAccessor accessor = getAccessor(resourceResolver);
index 6d210c0d0e5beb1d099c5d5088f9de26ed2332f6..90cc6e767a34c0a7719e62bfddb54d1dc59b90b1 100644 (file)
@@ -208,7 +208,7 @@ public final class AFPRendererConfig implements RendererConfig {
 
         /** {@inheritDoc} */
         public AFPRendererConfig build(FOUserAgent userAgent, Configuration cfg) throws FOPException {
-            boolean strict = userAgent != null ? userAgent.validateUserConfigStrictly() : false;
+            boolean strict = userAgent.validateUserConfigStrictly();
             AFPRendererConfig config = null;
             AFPEventProducer eventProducer = AFPEventProducer.Provider.get(userAgent.getEventBroadcaster());
             try {
index 92115bc921af0e0b896db08e27e80cda2872e990..3412c3d679ed50d6ef7d7dbc845599ba8bf0ee64 100644 (file)
@@ -46,7 +46,7 @@ import org.apache.fop.util.LogUtil;
  */
 public class AFPRendererConfigurator extends PrintRendererConfigurator implements
         IFDocumentHandlerConfigurator {
-    private static Log LOG = LogFactory.getLog(AFPRendererConfigurator.class);
+    private static Log log = LogFactory.getLog(AFPRendererConfigurator.class);
 
     private final AFPEventProducer eventProducer;
 
@@ -137,10 +137,10 @@ public class AFPRendererConfigurator extends PrintRendererConfigurator implement
                         config.getFontInfoConfig(), mimeType));
             } catch (IOException e) {
                 eventProducer.invalidConfiguration(this, e);
-                LogUtil.handleException(LOG, e, userAgent.validateUserConfigStrictly());
+                LogUtil.handleException(log, e, userAgent.validateUserConfigStrictly());
             } catch (IllegalArgumentException iae) {
                 eventProducer.invalidConfiguration(this, iae);
-                LogUtil.handleException(LOG, iae, userAgent.validateUserConfigStrictly());
+                LogUtil.handleException(log, iae, userAgent.validateUserConfigStrictly());
             }
         }
         return new AFPFontCollection(userAgent.getEventBroadcaster(), null);
index c2ae21f740671605d151012a01c9c0d4190ba779..7e963148af109599bb8870a6fd0c24d4b7ba3cd1 100644 (file)
 package org.apache.fop.render.afp;
 
 import java.io.ObjectStreamException;
-import java.io.Serializable;
 
 /** Enumeration of the AFP shading modes. */
-public enum AFPShadingMode implements Serializable {
+public enum AFPShadingMode {
     /** the color mode (the default) */
     COLOR("COLOR"),
     /** the dithered mode */
index 68f6bac05500a44998f7a871cb4f7950da2d5bfb..c63cd3a4d668665f181079db6b81ff85cfd11ad8 100644 (file)
@@ -22,7 +22,6 @@ package org.apache.fop.render.bitmap;
 import org.apache.fop.apps.MimeConstants;
 import org.apache.fop.render.bitmap.PNGRendererConfig.PNGRendererConfigParser;
 import org.apache.fop.render.intermediate.IFContext;
-import org.apache.fop.render.intermediate.IFDocumentHandler;
 import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator;
 
 /**
index b147f497bd0b892ab9f940159142e6877c0890de..48e79520fec8b574bc6935a9dc5b04d03c53f77a 100644 (file)
@@ -22,7 +22,6 @@ package org.apache.fop.render.bitmap;
 import org.apache.fop.apps.MimeConstants;
 import org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererConfigParser;
 import org.apache.fop.render.intermediate.IFContext;
-import org.apache.fop.render.intermediate.IFDocumentHandler;
 import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator;
 
 /**
index 72ff9a1acdebbdadf4deedad20d636c622cd6baa..0a949e777922068f8d80afb085ee01a4489e1564 100644 (file)
@@ -21,9 +21,6 @@ package org.apache.fop.render.intermediate;
 
 import java.util.Locale;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 import org.apache.fop.accessibility.DummyStructureTreeEventHandler;
 import org.apache.fop.accessibility.StructureTreeEventHandler;
 import org.apache.fop.apps.FOUserAgent;
@@ -33,9 +30,6 @@ import org.apache.fop.apps.FOUserAgent;
  */
 public abstract class AbstractIFDocumentHandler implements IFDocumentHandler {
 
-    /** logging instance */
-    private static Log log = LogFactory.getLog(AbstractIFDocumentHandler.class);
-
     private final IFContext ifContext;
 
     /**
index d2e06d76fbf8dce9266ddd67c8d11db3ffa46219..a44205d067b552e328f35e773c5632880789b78d 100644 (file)
@@ -37,7 +37,6 @@ import org.apache.fop.apps.MimeConstants;
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.render.intermediate.AbstractBinaryWritingIFDocumentHandler;
 import org.apache.fop.render.intermediate.IFContext;
-import org.apache.fop.render.intermediate.IFDocumentHandler;
 import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator;
 import org.apache.fop.render.intermediate.IFException;
 import org.apache.fop.render.intermediate.IFPainter;
@@ -46,7 +45,6 @@ import org.apache.fop.render.java2d.Java2DUtil;
 import org.apache.fop.render.pcl.PCLRendererConfig.PCLRendererConfigParser;
 import org.apache.fop.render.pcl.extensions.PCLElementMapping;
 
-
 /**
  * {@link org.apache.fop.render.intermediate.IFDocumentHandler} implementation
  * that produces PCL 5.
index 9b821394896ccb83ddcb3324b5ab66b1ae749714..afea5a7fe306b0b7eaf8329881c31f743794f8f5 100644 (file)
 package org.apache.fop.render.pcl;
 
 import java.io.ObjectStreamException;
-import java.io.Serializable;
 
 /**
  * Enumeration class for PCL rendering modes.
  */
-public enum PCLRenderingMode implements Serializable {
+public enum PCLRenderingMode {
     /** "Quality" rendering (mixed native and bitmap for improved quality) */
     QUALITY("quality", 1.0f),
     /** "Speed" rendering (maximum speed with native rendering, reduced visual quality) */
index 3d94e236bdbf5ab5e4c83edb3b6701f635867812..f3e51e34a495ef7b66e1329151dcfdb0a96e931e 100644 (file)
@@ -19,8 +19,6 @@
 
 package org.apache.fop.render.pdf;
 
-import org.apache.fop.pdf.PDFAMode;
-import org.apache.fop.pdf.PDFXMode;
 import org.apache.fop.render.RendererConfigOption;
 
 public enum PDFEncryptionOption implements RendererConfigOption {
index 7305b964609244c7133214ccd7098a78da1b0858..2ebd691feeb1166df544ec52b666f78d9ff86f66 100644 (file)
@@ -36,14 +36,14 @@ public enum PDFRendererOption implements RendererConfigOption {
         }
     },
     /** Rendering Options key for the PDF/A mode, default: {@link PDFAMode#DISABLED} */
-    PDF_A_MODE("pdf-a-mode", PDFAMode.DISABLED){
+    PDF_A_MODE("pdf-a-mode", PDFAMode.DISABLED) {
         @Override
         PDFAMode deserialize(String value) {
             return PDFAMode.getValueOf(value);
         }
     },
     /** Rendering Options key for the PDF/X mode, default: {@link PDFXMode#DISABLED} */
-    PDF_X_MODE("pdf-x-mode", PDFXMode.DISABLED){
+    PDF_X_MODE("pdf-x-mode", PDFXMode.DISABLED) {
         @Override
         PDFXMode deserialize(String value) {
             return PDFXMode.getValueOf(value);
index e8b068647e6ccae46a55a91ef2589e0f68362906..71102ecf01a6784bd673cfa274a18355617f61a9 100644 (file)
@@ -46,7 +46,7 @@ public final class PDFRendererOptionsConfig {
     static {
         final EnumMap<PDFRendererOption, Object> props
         = new EnumMap<PDFRendererOption, Object>(PDFRendererOption.class);
-        for(PDFRendererOption option : PDFRendererOption.values()) {
+        for (PDFRendererOption option : PDFRendererOption.values()) {
             props.put(option, option.getDefaultValue());
         }
         DEFAULT = new PDFRendererOptionsConfig(props, null);
index 66eb4b1086eb9155ec6634fce4705effc9996ec6..e5673c1f4c4ac47f134c56e89c207240a6ae0e05 100644 (file)
 
 package org.apache.fop.render.print;
 
-import java.util.List;
-
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.MimeConstants;
-import org.apache.fop.fonts.FontCollection;
 import org.apache.fop.render.AbstractRendererMaker;
 import org.apache.fop.render.PrintRendererConfigurator;
 import org.apache.fop.render.Renderer;
@@ -43,13 +40,7 @@ public class PrintRendererMaker extends AbstractRendererMaker {
 
     @Override
     public void configureRenderer(FOUserAgent userAgent, Renderer renderer) throws FOPException {
-        // TODO what constructor params?
-        new PrintRendererConfigurator(userAgent, null) {
-            @Override
-            protected List<FontCollection> getDefaultFontCollection() {
-                throw new UnsupportedOperationException();
-            }
-        } .configure(renderer);
+        PrintRendererConfigurator.createDefaultInstance(userAgent).configure(renderer);
     }
 
     @Override
@@ -61,5 +52,4 @@ public class PrintRendererMaker extends AbstractRendererMaker {
     public String[] getSupportedMimeTypes() {
         return MIMES;
     }
-
 }
index d73beb759953067443ade91831a6e5b53025d490..0ec5fdda67ee33d378da5f19b1131a6159acf998 100644 (file)
@@ -56,7 +56,6 @@ import org.apache.fop.apps.MimeConstants;
 import org.apache.fop.apps.io.TempResourceURIGenerator;
 import org.apache.fop.render.intermediate.AbstractBinaryWritingIFDocumentHandler;
 import org.apache.fop.render.intermediate.IFContext;
-import org.apache.fop.render.intermediate.IFDocumentHandler;
 import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator;
 import org.apache.fop.render.intermediate.IFException;
 import org.apache.fop.render.intermediate.IFPainter;
@@ -67,7 +66,6 @@ import org.apache.fop.render.ps.extensions.PSPageTrailerCodeBefore;
 import org.apache.fop.render.ps.extensions.PSSetPageDevice;
 import org.apache.fop.render.ps.extensions.PSSetupCode;
 
-
 /**
  * {@link org.apache.fop.render.intermediate.IFDocumentHandler} implementation
  * that produces PostScript.
index f0cd3a85014dfa533f427f250684a04aa67f710c..3110ed0ef29493352b565ea72031092fad27ead2 100644 (file)
 
 package org.apache.fop.render.xml;
 
-import java.util.List;
-
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.MimeConstants;
-import org.apache.fop.fonts.FontCollection;
 import org.apache.fop.render.AbstractRendererMaker;
 import org.apache.fop.render.PrintRendererConfigurator;
 import org.apache.fop.render.Renderer;
@@ -43,13 +40,7 @@ public class XMLRendererMaker extends AbstractRendererMaker {
 
     @Override
     public void configureRenderer(FOUserAgent userAgent, Renderer renderer) throws FOPException {
-        // TODO what constructor params?
-        new PrintRendererConfigurator(userAgent, null) {
-            @Override
-            protected List<FontCollection> getDefaultFontCollection() {
-                throw new UnsupportedOperationException();
-            }
-        } .configure(renderer);
+        PrintRendererConfigurator.createDefaultInstance(userAgent).configure(renderer);
     }
 
     @Override
index 57c5a295b7dd1336f0454555d77066efbfe89a01..9dcf10a2becd018cd2330309213eb1d281a771cb 100644 (file)
@@ -21,7 +21,6 @@ package org.apache.fop.servlet;
 
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PrintWriter;
 import java.net.URI;
index af7b267360340b3f519852a0e24c42108898d989..a249fe47beda36f9ddc3a655f24107014bf15697 100644 (file)
@@ -98,6 +98,7 @@ public class ColorSpaceCache {
             } catch (Exception e) {
                 // Ignore exception - will be logged a bit further down
                 // (colorSpace == null case)
+                log.warn("Exception thrown resolving the color space: " + e.getMessage());
             }
 
             if (colorSpace != null) {
index 378bd879c68a4bec660f6c37674719b29fe3c277..12dd948e573808599e9d5cc876d47e6b33840027 100644 (file)
@@ -48,7 +48,6 @@ import org.apache.fop.render.bitmap.BitmapRendererEventProducer;
 import org.apache.fop.render.bitmap.MultiFileRenderingUtil;
 import org.apache.fop.render.intermediate.DelegatingFragmentContentHandler;
 import org.apache.fop.render.intermediate.IFContext;
-import org.apache.fop.render.intermediate.IFDocumentHandler;
 import org.apache.fop.render.intermediate.IFException;
 import org.apache.fop.render.intermediate.IFPainter;
 import org.apache.fop.util.GenerationHelperContentHandler;
index 4810ba9959415e8b3489d3370014689656d58972..b97d3d261803034584470f822f681d310426e376 100644 (file)
@@ -26,7 +26,6 @@ import org.xml.sax.helpers.AttributesImpl;
 
 import org.apache.fop.render.intermediate.IFConstants;
 import org.apache.fop.render.intermediate.IFContext;
-import org.apache.fop.render.intermediate.IFDocumentHandler;
 import org.apache.fop.render.intermediate.IFException;
 import org.apache.fop.render.intermediate.IFPainter;
 import org.apache.fop.util.XMLUtil;