diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2007-02-14 14:24:36 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2007-02-14 14:24:36 +0000 |
commit | 404013f30e23b12ab477650846eb0e65b58a1394 (patch) | |
tree | 68d16c7870a4a6beb3ea5c07f02a4bf46c5f8610 /src/java/org/apache/fop/render | |
parent | dfb9bf9c3a9d1300d1575a9151580208f1ed994f (diff) | |
download | xmlgraphics-fop-404013f30e23b12ab477650846eb0e65b58a1394.tar.gz xmlgraphics-fop-404013f30e23b12ab477650846eb0e65b58a1394.zip |
Stricter user config file validation.
Add a configuration parameter (strict-configuration), enabled by default, which makes FOP throw an exception instead of logging an error when a problem occurs.
Invalid resource paths should be catched now. Fixes bug #40120.
Submitted by: Adrian Cumiskey (fop-dev AT cumiskey DOT com)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@507539 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render')
6 files changed, 30 insertions, 10 deletions
diff --git a/src/java/org/apache/fop/render/AbstractRenderer.java b/src/java/org/apache/fop/render/AbstractRenderer.java index 562666bdc..91cfe7bfa 100644 --- a/src/java/org/apache/fop/render/AbstractRenderer.java +++ b/src/java/org/apache/fop/render/AbstractRenderer.java @@ -88,7 +88,7 @@ public abstract class AbstractRenderer /** * user agent */ - protected FOUserAgent userAgent; + protected FOUserAgent userAgent = null; /** * block progression position @@ -135,6 +135,13 @@ public abstract class AbstractRenderer userAgent = agent; } + /** + * @see org.apache.fop.render.Renderer#getUserAgent() + */ + public FOUserAgent getUserAgent() { + return userAgent; + } + /** @see org.apache.fop.render.Renderer#startRenderer(OutputStream) */ public void startRenderer(OutputStream outputStream) throws IOException { } @@ -845,7 +852,7 @@ public abstract class AbstractRenderer if (handler != null) { try { //Optional XML handler configuration - Configuration cfg = userAgent.getUserRendererConfig(getMimeType()); + Configuration cfg = userAgent.getFactory().getUserRendererConfig(getMimeType()); if (cfg != null) { cfg = getHandlerConfig(cfg, namespace); if (cfg != null) { diff --git a/src/java/org/apache/fop/render/PrintRenderer.java b/src/java/org/apache/fop/render/PrintRenderer.java index ddb335564..6a3cdf2c6 100644 --- a/src/java/org/apache/fop/render/PrintRenderer.java +++ b/src/java/org/apache/fop/render/PrintRenderer.java @@ -41,9 +41,12 @@ public abstract class PrintRenderer extends AbstractRenderer { /** Font configuration */ protected FontInfo fontInfo; + /** Font resolver */ + protected FontResolver fontResolver = null; + /** list of fonts */ protected List fontList = null; - + /** * Set up the font info * @@ -51,8 +54,7 @@ public abstract class PrintRenderer extends AbstractRenderer { */ public void setupFontInfo(FontInfo inFontInfo) { this.fontInfo = inFontInfo; - FontResolver resolver = new DefaultFontResolver(userAgent); - FontSetup.setup(fontInfo, fontList, resolver, + FontSetup.setup(fontInfo, fontList, fontResolver, userAgent.getFactory().isBase14KerningEnabled()); } @@ -147,5 +149,16 @@ public abstract class PrintRenderer extends AbstractRenderer { renderXML(context, doc, ns); } - + + /** + * Get FontResolver + * + * @return FontResolver + */ + public FontResolver getFontResolver() { + if (this.fontResolver == null) { + this.fontResolver = new DefaultFontResolver(super.userAgent); + } + return this.fontResolver; + } } diff --git a/src/java/org/apache/fop/render/RendererFactory.java b/src/java/org/apache/fop/render/RendererFactory.java index 8c35ec65a..4d3f3a12c 100644 --- a/src/java/org/apache/fop/render/RendererFactory.java +++ b/src/java/org/apache/fop/render/RendererFactory.java @@ -189,7 +189,7 @@ public class RendererFactory { Configuration userRendererConfig = null; if (mimeType != null) { userRendererConfig - = userAgent.getUserRendererConfig(mimeType); + = userAgent.getFactory().getUserRendererConfig(mimeType); } if (userRendererConfig != null) { try { diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java index 966aef2e5..481ce844c 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java @@ -243,7 +243,7 @@ public class PDFRenderer extends AbstractPathOrientedRenderer { this.filterMap = PDFFilterList.buildFilterMapFromConfiguration(cfg); //Font configuration - List cfgFonts = FontSetup.buildFontListFromConfiguration(cfg); + List cfgFonts = FontSetup.buildFontListFromConfiguration(cfg, this); if (this.fontList == null) { this.fontList = cfgFonts; } else { diff --git a/src/java/org/apache/fop/render/ps/PSRenderer.java b/src/java/org/apache/fop/render/ps/PSRenderer.java index 75c3817f1..6553f06b6 100644 --- a/src/java/org/apache/fop/render/ps/PSRenderer.java +++ b/src/java/org/apache/fop/render/ps/PSRenderer.java @@ -129,7 +129,7 @@ public class PSRenderer extends AbstractPathOrientedRenderer implements ImageAda this.autoRotateLandscape = cfg.getChild("auto-rotate-landscape").getValueAsBoolean(false); //Font configuration - List cfgFonts = FontSetup.buildFontListFromConfiguration(cfg); + List cfgFonts = FontSetup.buildFontListFromConfiguration(cfg, this); if (this.fontList == null) { this.fontList = cfgFonts; } else { diff --git a/src/java/org/apache/fop/render/xml/XMLRenderer.java b/src/java/org/apache/fop/render/xml/XMLRenderer.java index c1f85be87..857847e10 100644 --- a/src/java/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/java/org/apache/fop/render/xml/XMLRenderer.java @@ -145,7 +145,7 @@ public class XMLRenderer extends PrintRenderer { public void configure(Configuration cfg) throws ConfigurationException { super.configure(cfg); //Font configuration - List cfgFonts = FontSetup.buildFontListFromConfiguration(cfg); + List cfgFonts = FontSetup.buildFontListFromConfiguration(cfg, this); if (this.fontList == null) { this.fontList = cfgFonts; } else { |