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 je...@apache.org on 2005/08/08 08:06:08 UTC
svn commit: r230759 -
/xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/SVGReader.java
Author: jeremias
Date: Sun Aug 7 23:06:04 2005
New Revision: 230759
URL: http://svn.apache.org/viewcvs?rev=230759&view=rev
Log:
Committing a hack I've started earlier. The analyzer did not always recognize an SVG file as such, especially XML encoded in a two-byte charset. This will still need some attention.
Logging reenabled.
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/SVGReader.java
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/SVGReader.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/SVGReader.java?rev=230759&r1=230758&r2=230759&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/SVGReader.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/SVGReader.java Sun Aug 7 23:06:04 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,6 +33,8 @@
import org.apache.batik.bridge.BridgeContext;
import org.apache.batik.bridge.UnitProcessor;
import org.apache.batik.dom.svg.SVGDOMImplementation;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
// FOP
import org.apache.fop.image.XMLImage;
@@ -45,6 +47,9 @@
*/
public class SVGReader implements ImageReader {
+ /** Logger instance */
+ protected static Log log = LogFactory.getLog(SVGReader.class);
+
/** SVG's MIME type */
public static final String SVG_MIME_TYPE = "image/svg+xml";
@@ -91,7 +96,7 @@
ua.getPixelUnitToMillimeter());
} catch (NoClassDefFoundError e) {
batik = false;
- //ua.getLogger().error("Batik not in class path", e);
+ log.warn("Batik not in class path", e);
return null;
}
}
@@ -116,7 +121,8 @@
String start = new String(b);
fis.reset();
- if (start.equals("<?xml")) {
+ //TODO "true ||" here is a hack to improve SVG detection rate. Please improve.
+ if (true || start.equals("<?xml")) {
// we have xml, might be another doc
// so stop batik from closing the stream
final InputStream input = fis;
@@ -207,14 +213,14 @@
// we're more interested in the original exception
}
batik = false;
- //ua.getLogger().error("Batik not in class path", ncdfe);
+ log.warn("Batik not in class path", ncdfe);
return null;
} catch (Exception e) {
// If the svg is invalid then it throws an IOException
// so there is no way of knowing if it is an svg document
- // ua.getLogger().error("Could not load external SVG: " +
- // e.getMessage(), e);
+ log.debug("Error while trying to load stream as an SVG file: "
+ + e.getMessage());
// assuming any exception means this document is not svg
// or could not be loaded for some reason
try {
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org