aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2011-12-05 14:38:34 +0000
committerVincent Hennebert <vhennebert@apache.org>2011-12-05 14:38:34 +0000
commitf8c8032b120d9c1617b560a0e8a72597aa21ddc2 (patch)
tree210f5347456d5f3f7a2b14129ebdff8efa5d7dcd /src/java/org/apache/fop
parent89b7968a9219df13a1c03869be8d3e3c1b4eb096 (diff)
downloadxmlgraphics-fop-f8c8032b120d9c1617b560a0e8a72597aa21ddc2.tar.gz
xmlgraphics-fop-f8c8032b120d9c1617b560a0e8a72597aa21ddc2.zip
Bugzilla #52206: small performance improvements by declaring some class members as static
Patch by Alexis Giotis, applied with minor modifications git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1210477 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop')
-rw-r--r--src/java/org/apache/fop/fo/ElementMappingRegistry.java5
-rw-r--r--src/java/org/apache/fop/fo/FOTreeBuilder.java18
-rw-r--r--src/java/org/apache/fop/fo/FObj.java2
-rw-r--r--src/java/org/apache/fop/fo/properties/PropertyMaker.java20
4 files changed, 23 insertions, 22 deletions
diff --git a/src/java/org/apache/fop/fo/ElementMappingRegistry.java b/src/java/org/apache/fop/fo/ElementMappingRegistry.java
index cf14fa281..b6baeca2b 100644
--- a/src/java/org/apache/fop/fo/ElementMappingRegistry.java
+++ b/src/java/org/apache/fop/fo/ElementMappingRegistry.java
@@ -23,7 +23,6 @@ import java.util.Iterator;
import java.util.Map;
import org.w3c.dom.DOMImplementation;
-
import org.xml.sax.Locator;
import org.apache.commons.logging.Log;
@@ -42,7 +41,7 @@ import org.apache.fop.fo.ElementMapping.Maker;
public class ElementMappingRegistry {
/** logging instance */
- protected Log log = LogFactory.getLog(ElementMappingRegistry.class);
+ private static final Log LOG = LogFactory.getLog(ElementMappingRegistry.class);
/**
* Table mapping element names to the makers of objects
@@ -79,7 +78,7 @@ public class ElementMappingRegistry {
try {
addElementMapping(mapping);
} catch (IllegalArgumentException e) {
- log.warn("Error while adding element mapping", e);
+ LOG.warn("Error while adding element mapping", e);
}
}
diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java
index 451481eb8..629e87e6b 100644
--- a/src/java/org/apache/fop/fo/FOTreeBuilder.java
+++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java
@@ -53,7 +53,7 @@ import org.apache.fop.util.ContentHandlerFactory.ObjectSource;
public class FOTreeBuilder extends DefaultHandler {
/** logging instance */
- protected Log log = LogFactory.getLog(FOTreeBuilder.class);
+ private static final Log LOG = LogFactory.getLog(FOTreeBuilder.class);
/** The registry for ElementMapping instances */
protected ElementMappingRegistry elementMappingRegistry;
@@ -140,8 +140,8 @@ public class FOTreeBuilder extends DefaultHandler {
used = true;
empty = true;
rootFObj = null; // allows FOTreeBuilder to be reused
- if (log.isDebugEnabled()) {
- log.debug("Building formatting object tree");
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Building formatting object tree");
}
foEventHandler.startDocument();
this.mainFOHandler = new MainFOHandler();
@@ -158,8 +158,8 @@ public class FOTreeBuilder extends DefaultHandler {
eventProducer.emptyDocument(this);
}
rootFObj = null;
- if (log.isDebugEnabled()) {
- log.debug("Parsing of document complete");
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Parsing of document complete");
}
foEventHandler.endDocument();
}
@@ -188,17 +188,17 @@ public class FOTreeBuilder extends DefaultHandler {
/** {@inheritDoc} */
public void warning(SAXParseException e) {
- log.warn(e.getLocalizedMessage());
+ LOG.warn(e.getLocalizedMessage());
}
/** {@inheritDoc} */
public void error(SAXParseException e) {
- log.error(e.toString());
+ LOG.error(e.toString());
}
/** {@inheritDoc} */
public void fatalError(SAXParseException e) throws SAXException {
- log.error(e.toString());
+ LOG.error(e.toString());
throw e;
}
@@ -364,7 +364,7 @@ public class FOTreeBuilder extends DefaultHandler {
}
if (currentFObj.getParent() == null) {
- log.debug("endElement for top-level " + currentFObj.getName());
+ LOG.debug("endElement for top-level " + currentFObj.getName());
}
currentFObj = currentFObj.getParent();
diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java
index 98661b8b6..27d0711f2 100644
--- a/src/java/org/apache/fop/fo/FObj.java
+++ b/src/java/org/apache/fop/fo/FObj.java
@@ -627,7 +627,7 @@ public abstract class FObj extends FONode implements Constants {
}
/** Basic {@link FONode.FONodeIterator} implementation */
- public class FObjIterator implements FONodeIterator {
+ public static class FObjIterator implements FONodeIterator {
private static final int F_NONE_ALLOWED = 0;
private static final int F_SET_ALLOWED = 1;
diff --git a/src/java/org/apache/fop/fo/properties/PropertyMaker.java b/src/java/org/apache/fop/fo/properties/PropertyMaker.java
index ba17b1850..795db56e7 100644
--- a/src/java/org/apache/fop/fo/properties/PropertyMaker.java
+++ b/src/java/org/apache/fop/fo/properties/PropertyMaker.java
@@ -43,7 +43,9 @@ import org.apache.fop.fo.expr.PropertyParser;
public class PropertyMaker implements Cloneable {
/** Logger instance */
- private static Log log = LogFactory.getLog(PropertyMaker.class);
+ private static final Log LOG = LogFactory.getLog(PropertyMaker.class);
+
+ private static final boolean IS_LOG_TRACE_ENABLED = LOG.isTraceEnabled();
/** the property ID */
protected int propId;
@@ -250,8 +252,8 @@ public class PropertyMaker implements Cloneable {
throws PropertyException {
Property p = null;
- if (log.isTraceEnabled()) {
- log.trace("PropertyMaker.findProperty: "
+ if (IS_LOG_TRACE_ENABLED) {
+ LOG.trace("PropertyMaker.findProperty: "
+ FOPropertyMapping.getPropertyName(propId)
+ ", " + propertyList.getFObj().getName());
}
@@ -377,14 +379,14 @@ public class PropertyMaker implements Cloneable {
*/
public Property make(PropertyList propertyList) throws PropertyException {
if (defaultProperty != null) {
- if (log.isTraceEnabled()) {
- log.trace("PropertyMaker.make: reusing defaultProperty, "
+ if (IS_LOG_TRACE_ENABLED) {
+ LOG.trace("PropertyMaker.make: reusing defaultProperty, "
+ FOPropertyMapping.getPropertyName(propId));
}
return defaultProperty;
}
- if (log.isTraceEnabled()) {
- log.trace("PropertyMaker.make: making default property value, "
+ if (IS_LOG_TRACE_ENABLED) {
+ LOG.trace("PropertyMaker.make: making default property value, "
+ FOPropertyMapping.getPropertyName(propId)
+ ", " + propertyList.getFObj().getName());
}
@@ -413,7 +415,7 @@ public class PropertyMaker implements Cloneable {
if ((propId & Constants.COMPOUND_MASK) != 0) {
newProp = getSubprop(newProp, propId & Constants.COMPOUND_MASK);
}
- if (!isInherited() && log.isWarnEnabled()) {
+ if (!isInherited() && LOG.isWarnEnabled()) {
/* check whether explicit value is available on the parent
* (for inherited properties, an inherited value will always
* be available)
@@ -421,7 +423,7 @@ public class PropertyMaker implements Cloneable {
Property parentExplicit = propertyList.getParentPropertyList()
.getExplicit(getPropId());
if (parentExplicit == null) {
- log.warn(FOPropertyMapping.getPropertyName(getPropId())
+ LOG.warn(FOPropertyMapping.getPropertyName(getPropId())
+ "=\"inherit\" on " + propertyList.getFObj().getName()
+ ", but no explicit value found on the parent FO.");
}