aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeiron Liddle <keiron@apache.org>2001-09-26 12:00:43 +0000
committerKeiron Liddle <keiron@apache.org>2001-09-26 12:00:43 +0000
commit692a69774d19362a7c39f7df56bd60b88aef9b4d (patch)
tree1f9ce1a69c332c3ccc98bbae614575b9eb07220b
parent9416d7db57fdf8fe79cc48f082568e60e3e41381 (diff)
downloadxmlgraphics-fop-692a69774d19362a7c39f7df56bd60b88aef9b4d.tar.gz
xmlgraphics-fop-692a69774d19362a7c39f7df56bd60b88aef9b4d.zip
catches exception when building svg
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194486 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/org/apache/fop/render/awt/AWTRenderer.java8
-rw-r--r--src/org/apache/fop/render/pdf/PDFRenderer.java8
-rw-r--r--src/org/apache/fop/render/ps/PSRenderer.java12
-rw-r--r--src/org/apache/fop/svg/SVGElement.java14
4 files changed, 31 insertions, 11 deletions
diff --git a/src/org/apache/fop/render/awt/AWTRenderer.java b/src/org/apache/fop/render/awt/AWTRenderer.java
index b623a9b64..98118ed36 100644
--- a/src/org/apache/fop/render/awt/AWTRenderer.java
+++ b/src/org/apache/fop/render/awt/AWTRenderer.java
@@ -699,7 +699,13 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable
GVTBuilder builder = new GVTBuilder();
BridgeContext ctx = new BridgeContext(userAgent);
GraphicsNode root;
- root = builder.build(ctx, doc);
+ try {
+ root = builder.build(ctx, doc);
+ } catch (Exception e) {
+ log.error("svg graphic could not be built: "
+ + e.getMessage(), e);
+ return;
+ }
float w = (float)ctx.getDocumentSize().getWidth() * 1000f;
float h = (float)ctx.getDocumentSize().getHeight() * 1000f;
diff --git a/src/org/apache/fop/render/pdf/PDFRenderer.java b/src/org/apache/fop/render/pdf/PDFRenderer.java
index b7bdc61f5..ec9da0725 100644
--- a/src/org/apache/fop/render/pdf/PDFRenderer.java
+++ b/src/org/apache/fop/render/pdf/PDFRenderer.java
@@ -409,7 +409,13 @@ public class PDFRenderer extends PrintRenderer {
GraphicsNode root;
- root = builder.build(ctx, doc);
+ try {
+ root = builder.build(ctx, doc);
+ } catch (Exception e) {
+ log.error("svg graphic could not be built: "
+ + e.getMessage(), e);
+ return;
+ }
// get the 'width' and 'height' attributes of the SVG document
float w = (float)ctx.getDocumentSize().getWidth() * 1000f;
float h = (float)ctx.getDocumentSize().getHeight() * 1000f;
diff --git a/src/org/apache/fop/render/ps/PSRenderer.java b/src/org/apache/fop/render/ps/PSRenderer.java
index 1bcf315d9..d380f54ef 100644
--- a/src/org/apache/fop/render/ps/PSRenderer.java
+++ b/src/org/apache/fop/render/ps/PSRenderer.java
@@ -295,13 +295,21 @@ public class PSRenderer extends AbstractRenderer {
int y = this.currentYPosition;
Document doc = area.getSVGDocument();
- UserAgent userAgent = new org.apache.fop.svg.SVGUserAgent(new AffineTransform());
+ org.apache.fop.svg.SVGUserAgent userAgent
+ = new org.apache.fop.svg.SVGUserAgent(new AffineTransform());
+ userAgent.setLogger(log);
GVTBuilder builder = new GVTBuilder();
BridgeContext ctx = new BridgeContext(userAgent);
GraphicsNode root;
- root = builder.build(ctx, doc);
+ try {
+ root = builder.build(ctx, doc);
+ } catch (Exception e) {
+ log.error("svg graphic could not be built: "
+ + e.getMessage(), e);
+ return;
+ }
// get the 'width' and 'height' attributes of the SVG document
float w = (float)ctx.getDocumentSize().getWidth() * 1000f;
float h = (float)ctx.getDocumentSize().getHeight() * 1000f;
diff --git a/src/org/apache/fop/svg/SVGElement.java b/src/org/apache/fop/svg/SVGElement.java
index 730a984e4..65ba2effe 100644
--- a/src/org/apache/fop/svg/SVGElement.java
+++ b/src/org/apache/fop/svg/SVGElement.java
@@ -138,6 +138,13 @@ public class SVGElement extends SVGObj {
};
((SVGOMDocument)doc).setSVGContext(dc);
+ try {
+ String baseDir = Configuration.getStringValue("baseDir");
+ ((SVGOMDocument)doc).setURLObject(new URL(baseDir));
+ } catch (Exception e) {
+ log.error("Could not set base URL for svg", e);
+ }
+
Element e = ((SVGDocument)doc).getRootElement();
String s;
SVGUserAgent userAgent = new SVGUserAgent(new AffineTransform());
@@ -185,13 +192,6 @@ public class SVGElement extends SVGObj {
element = doc.getDocumentElement();
- try {
- String baseDir = Configuration.getStringValue("baseDir");
- ((SVGOMDocument)doc).setURLObject(new URL(baseDir));
- } catch (Exception e) {
- // cannot use log yet
- //log.error("Could not set base URL for svg", e);
- }
buildTopLevel(doc, element);
}