Browse Source

Fixed NPE with when outputting AreaTree also improved base URI handling for CLI


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1358130 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-2_0
Mehdi Houshmand 12 years ago
parent
commit
d54c3555e0

+ 9
- 1
src/java/org/apache/fop/cli/CommandLineOptions.java View File

import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.net.URI;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Vector; import java.util.Vector;


private boolean flushCache = false; private boolean flushCache = false;


private URI baseURI = new File(".").toURI();

/** /**
* Construct a command line option object. * Construct a command line option object.
*/ */
this.useStdIn = true; this.useStdIn = true;
} else { } else {
fofile = new File(filename); fofile = new File(filename);
baseURI = fofile.toURI();
} }
return 1; return 1;
} }
this.useStdIn = true; this.useStdIn = true;
} else { } else {
xmlfile = new File(filename); xmlfile = new File(filename);
baseURI = xmlfile.toURI();
} }
return 1; return 1;
} }
this.useStdIn = true; this.useStdIn = true;
} else { } else {
areatreefile = new File(filename); areatreefile = new File(filename);
baseURI = areatreefile.toURI();
} }
return 1; return 1;
} }
this.useStdIn = true; this.useStdIn = true;
} else { } else {
iffile = new File(filename); iffile = new File(filename);
baseURI = iffile.toURI();
} }
return 1; return 1;
} }
this.useStdIn = true; this.useStdIn = true;
} else { } else {
imagefile = new File(filename); imagefile = new File(filename);
baseURI = imagefile.toURI();
} }
return 1; return 1;
} }
private void setUserConfig() throws FOPException, IOException { private void setUserConfig() throws FOPException, IOException {
FopFactoryBuilder fopFactoryBuilder; FopFactoryBuilder fopFactoryBuilder;
if (userConfigFile == null) { if (userConfigFile == null) {
fopFactoryBuilder = new FopFactoryBuilder(fofile.toURI());
fopFactoryBuilder = new FopFactoryBuilder(baseURI);
fopFactoryBuilder.setStrictFOValidation(strictValidation); fopFactoryBuilder.setStrictFOValidation(strictValidation);
fopFactoryBuilder.setTargetResolution(targetResolution); fopFactoryBuilder.setTargetResolution(targetResolution);
fopFactoryBuilder.setComplexScriptFeatures(useComplexScriptFeatures); fopFactoryBuilder.setComplexScriptFeatures(useComplexScriptFeatures);

+ 4
- 1
src/java/org/apache/fop/render/PrintRendererConfigurator.java View File

import org.apache.fop.render.RendererConfig.RendererConfigParser; import org.apache.fop.render.RendererConfig.RendererConfigParser;
import org.apache.fop.render.intermediate.IFDocumentHandler; import org.apache.fop.render.intermediate.IFDocumentHandler;
import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator; import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator;
import org.apache.fop.render.pdf.PDFRendererConfig.PDFRendererConfigParser;


/** /**
* Base Print renderer configurator (mostly handles font configuration) * Base Print renderer configurator (mostly handles font configuration)
} }


public static PrintRendererConfigurator createDefaultInstance(FOUserAgent userAgent) { 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 @Override
protected List<FontCollection> getDefaultFontCollection() { protected List<FontCollection> getDefaultFontCollection() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();

Loading…
Cancel
Save