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 lb...@apache.org on 2013/11/24 01:57:26 UTC
svn commit: r1544897 -
/xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/SimpleSVGUserAgent.java
Author: lbernardo
Date: Sun Nov 24 00:57:26 2013
New Revision: 1544897
URL: http://svn.apache.org/r1544897
Log:
FOP-2314: Caching xmlParserClassName in org.apache.fop.svg.SimpleSVGUserAgent; patch submitted by Gonzalo Vasquez
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/SimpleSVGUserAgent.java
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/SimpleSVGUserAgent.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/SimpleSVGUserAgent.java?rev=1544897&r1=1544896&r2=1544897&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/SimpleSVGUserAgent.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/SimpleSVGUserAgent.java Sun Nov 24 00:57:26 2013
@@ -23,8 +23,11 @@ import java.awt.Dimension;
import java.awt.geom.AffineTransform;
import java.awt.geom.Dimension2D;
+import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
+import org.xml.sax.SAXException;
+
import org.apache.batik.bridge.UserAgentAdapter;
/**
@@ -79,17 +82,28 @@ public class SimpleSVGUserAgent extends
return null; // userStyleSheetURI;
}
+
+ private static final String XML_PARSER_CLASS_NAME;
+
+ static {
+ String result;
+ try {
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ result = factory.newSAXParser().getXMLReader().getClass().getName();
+ } catch (SAXException e) {
+ result = null;
+ } catch (ParserConfigurationException e) {
+ result = null;
+ }
+ XML_PARSER_CLASS_NAME = result;
+ }
+
/**
* Returns the class name of the XML parser.
* @return the XML parser class name
*/
public String getXMLParserClassName() {
- try {
- SAXParserFactory factory = SAXParserFactory.newInstance();
- return factory.newSAXParser().getXMLReader().getClass().getName();
- } catch (Exception e) {
- return null;
- }
+ return XML_PARSER_CLASS_NAME;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org