Просмотр исходного кода

catches exception when building svg


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194486 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-0_20_3
Keiron Liddle 23 лет назад
Родитель
Сommit
692a69774d

+ 7
- 1
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;


+ 7
- 1
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;

+ 10
- 2
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;

+ 7
- 7
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);
}


Загрузка…
Отмена
Сохранить