You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by me...@apache.org on 2012/07/06 13:18:05 UTC

svn commit: r1358130 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: cli/CommandLineOptions.java render/PrintRendererConfigurator.java

Author: mehdi
Date: Fri Jul  6 11:18:04 2012
New Revision: 1358130

URL: http://svn.apache.org/viewvc?rev=1358130&view=rev
Log:
Fixed NPE with when outputting AreaTree also improved base URI handling for CLI

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/PrintRendererConfigurator.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java?rev=1358130&r1=1358129&r2=1358130&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java Fri Jul  6 11:18:04 2012
@@ -24,6 +24,7 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.PrintStream;
+import java.net.URI;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Vector;
@@ -137,6 +138,8 @@ public class CommandLineOptions {
 
     private boolean flushCache = false;
 
+    private URI baseURI = new File(".").toURI();
+
     /**
      * Construct a command line option object.
      */
@@ -465,6 +468,7 @@ public class CommandLineOptions {
                 this.useStdIn = true;
             } else {
                 fofile = new File(filename);
+                baseURI = fofile.toURI();
             }
             return 1;
         }
@@ -494,6 +498,7 @@ public class CommandLineOptions {
                 this.useStdIn = true;
             } else {
                 xmlfile = new File(filename);
+                baseURI = xmlfile.toURI();
             }
             return 1;
         }
@@ -783,6 +788,7 @@ public class CommandLineOptions {
                 this.useStdIn = true;
             } else {
                 areatreefile = new File(filename);
+                baseURI = areatreefile.toURI();
             }
             return 1;
         }
@@ -799,6 +805,7 @@ public class CommandLineOptions {
                 this.useStdIn = true;
             } else {
                 iffile = new File(filename);
+                baseURI = iffile.toURI();
             }
             return 1;
         }
@@ -815,6 +822,7 @@ public class CommandLineOptions {
                 this.useStdIn = true;
             } else {
                 imagefile = new File(filename);
+                baseURI = imagefile.toURI();
             }
             return 1;
         }
@@ -1030,7 +1038,7 @@ public class CommandLineOptions {
     private void setUserConfig() throws FOPException, IOException {
         FopFactoryBuilder fopFactoryBuilder;
         if (userConfigFile == null) {
-            fopFactoryBuilder = new FopFactoryBuilder(fofile.toURI());
+            fopFactoryBuilder = new FopFactoryBuilder(baseURI);
             fopFactoryBuilder.setStrictFOValidation(strictValidation);
             fopFactoryBuilder.setTargetResolution(targetResolution);
             fopFactoryBuilder.setComplexScriptFeatures(useComplexScriptFeatures);

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/PrintRendererConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/PrintRendererConfigurator.java?rev=1358130&r1=1358129&r2=1358130&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/PrintRendererConfigurator.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/PrintRendererConfigurator.java Fri Jul  6 11:18:04 2012
@@ -36,6 +36,7 @@ import org.apache.fop.fonts.FontManager;
 import org.apache.fop.render.RendererConfig.RendererConfigParser;
 import org.apache.fop.render.intermediate.IFDocumentHandler;
 import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator;
+import org.apache.fop.render.pdf.PDFRendererConfig.PDFRendererConfigParser;
 
 /**
  * Base Print renderer configurator (mostly handles font configuration)
@@ -166,7 +167,9 @@ public abstract class PrintRendererConfi
     }
 
     public static PrintRendererConfigurator createDefaultInstance(FOUserAgent userAgent) {
-        return new PrintRendererConfigurator(userAgent, null) {
+        // Since PDF is the default output is PDF, it makes sense for the default config parser
+        // to also be the PDF flavour
+        return new PrintRendererConfigurator(userAgent, new PDFRendererConfigParser()) {
             @Override
             protected List<FontCollection> getDefaultFontCollection() {
                 throw new UnsupportedOperationException();



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org