aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2004-05-12 23:19:53 +0000
committerGlen Mazza <gmazza@apache.org>2004-05-12 23:19:53 +0000
commitf6064f69f4c9c001d9ab0db3d82f00e92a4359b0 (patch)
treef3729a95932f2a42c07bba8bd380a63a6a354578
parent240bcc0c6d3af5ce0e8f9d2c2ca40f0d546f5b9f (diff)
downloadxmlgraphics-fop-f6064f69f4c9c001d9ab0db3d82f00e92a4359b0.tar.gz
xmlgraphics-fop-f6064f69f4c9c001d9ab0db3d82f00e92a4359b0.zip
Removed the getLogger() and setLogger() from FOUserAgent; replaced with Commons Logging
equivalents in places where previously used. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197591 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/apps/Driver.java1
-rw-r--r--src/java/org/apache/fop/apps/FOUserAgent.java19
-rw-r--r--src/java/org/apache/fop/fo/FOTreeBuilder.java8
-rw-r--r--src/java/org/apache/fop/fo/flow/ExternalGraphic.java2
-rw-r--r--src/java/org/apache/fop/image/AbstractFopImage.java21
-rw-r--r--src/java/org/apache/fop/image/FopImage.java3
-rw-r--r--src/java/org/apache/fop/image/GifImage.java6
-rw-r--r--src/java/org/apache/fop/image/ImageFactory.java9
-rw-r--r--src/java/org/apache/fop/image/analyser/ImageReaderFactory.java11
-rw-r--r--src/java/org/apache/fop/image/analyser/SVGReader.java6
-rw-r--r--src/java/org/apache/fop/image/analyser/XMLReader.java13
-rw-r--r--src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java10
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java2
-rw-r--r--src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java4
-rw-r--r--src/java/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java2
-rw-r--r--src/java/org/apache/fop/layoutmgr/LineLayoutManager.java4
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageLayoutManager.java6
-rw-r--r--src/java/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java4
-rw-r--r--src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java4
-rw-r--r--src/java/org/apache/fop/layoutmgr/TextLayoutManager.java2
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/Body.java2
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/Cell.java2
-rw-r--r--src/java/org/apache/fop/render/awt/AWTRenderer.java2
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFRenderer.java14
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFXMLHandler.java20
-rw-r--r--src/java/org/apache/fop/render/ps/PSGraphics2D.java2
-rw-r--r--src/java/org/apache/fop/render/ps/PSRenderer.java2
-rw-r--r--src/java/org/apache/fop/render/ps/PSXMLHandler.java22
-rw-r--r--src/java/org/apache/fop/svg/PDFImageElementBridge.java2
-rw-r--r--src/java/org/apache/fop/svg/SVGUserAgent.java13
-rw-r--r--src/java/org/apache/fop/tools/AreaTreeBuilder.java1
-rw-r--r--src/java/org/apache/fop/tools/TestConverter.java1
-rw-r--r--src/java/org/apache/fop/tools/anttasks/Fop.java1
33 files changed, 129 insertions, 92 deletions
diff --git a/src/java/org/apache/fop/apps/Driver.java b/src/java/org/apache/fop/apps/Driver.java
index 4cee9c3e1..51f7e7249 100644
--- a/src/java/org/apache/fop/apps/Driver.java
+++ b/src/java/org/apache/fop/apps/Driver.java
@@ -245,7 +245,6 @@ public class Driver {
public FOUserAgent getUserAgent() {
if (userAgent == null) {
userAgent = new FOUserAgent();
- userAgent.setLogger(getLogger());
}
return userAgent;
}
diff --git a/src/java/org/apache/fop/apps/FOUserAgent.java b/src/java/org/apache/fop/apps/FOUserAgent.java
index 445c6bdbd..cd862c7cd 100644
--- a/src/java/org/apache/fop/apps/FOUserAgent.java
+++ b/src/java/org/apache/fop/apps/FOUserAgent.java
@@ -23,8 +23,6 @@ import java.util.Map;
import java.io.IOException;
import java.io.InputStream;
-import org.apache.commons.logging.Log;
-
// FOP
import org.apache.fop.pdf.PDFEncryptionParams;
@@ -50,7 +48,6 @@ import org.apache.fop.pdf.PDFEncryptionParams;
*/
public class FOUserAgent {
- private Log log;
/** Map containing various default values */
public Map defaults = new java.util.HashMap();
/** Map containing XML handlers for various document types */
@@ -60,22 +57,6 @@ public class FOUserAgent {
private float px2mm = 0.35277777777777777778f; //72dpi (=25.4/dpi)
/**
- * Sets the logger.
- * @param log Logger to use
- */
- public void setLogger(Log log) {
- this.log = log;
- }
-
- /**
- * Returns the logger to use.
- * (todo) This breaks IoC/SoC. Should be improved.
- */
- public Log getLogger() {
- return this.log;
- }
-
- /**
* Sets the base URL.
* @param baseURL base URL
*/
diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java
index e1e59f354..43c92452d 100644
--- a/src/java/org/apache/fop/fo/FOTreeBuilder.java
+++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java
@@ -30,6 +30,7 @@ import java.util.Map;
import java.util.Set;
import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.fo.ElementMapping.Maker;
@@ -54,6 +55,11 @@ public class FOTreeBuilder extends DefaultHandler {
protected Map fobjTable = new java.util.HashMap();
/**
+ * logging instance
+ */
+ protected Log log = LogFactory.getLog(FOTreeBuilder.class);
+
+ /**
* Set of mapped namespaces.
*/
protected Set namespaces = new java.util.HashSet();
@@ -90,7 +96,7 @@ public class FOTreeBuilder extends DefaultHandler {
}
private Log getLogger() {
- return userAgent.getLogger();
+ return log;
}
/**
diff --git a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java
index a4394f2d5..9ff80787e 100644
--- a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java
+++ b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java
@@ -124,7 +124,7 @@ public class ExternalGraphic extends FObj {
return;
}
// load dimensions
- if (!fopimage.load(FopImage.DIMENSIONS, getUserAgent().getLogger())) {
+ if (!fopimage.load(FopImage.DIMENSIONS)) {
// error
url = null;
return;
diff --git a/src/java/org/apache/fop/image/AbstractFopImage.java b/src/java/org/apache/fop/image/AbstractFopImage.java
index 818768226..57a4098cd 100644
--- a/src/java/org/apache/fop/image/AbstractFopImage.java
+++ b/src/java/org/apache/fop/image/AbstractFopImage.java
@@ -26,6 +26,7 @@ import java.awt.Color;
// FOP
import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* Base class to implement the FopImage interface.
@@ -34,6 +35,12 @@ import org.apache.commons.logging.Log;
* @see FopImage
*/
public abstract class AbstractFopImage implements FopImage {
+
+ /**
+ * logging instance
+ */
+ protected static Log log = LogFactory.getLog(AbstractFopImage.class);
+
/**
* Keeps track of what has been loaded.
*/
@@ -125,13 +132,13 @@ public abstract class AbstractFopImage implements FopImage {
* @param ua the user agent for handling logging etc.
* @return true if the loading was successful
*/
- public synchronized boolean load(int type, Log logger) {
+ public synchronized boolean load(int type) {
if ((loaded & type) != 0) {
return true;
}
boolean success = true;
if (((type & DIMENSIONS) != 0) && ((loaded & DIMENSIONS) == 0)) {
- success = success && loadDimensions(logger);
+ success = success && loadDimensions();
if (!success) {
return false;
@@ -139,13 +146,13 @@ public abstract class AbstractFopImage implements FopImage {
loaded = loaded | DIMENSIONS;
}
if (((type & BITMAP) != 0) && ((loaded & BITMAP) == 0)) {
- success = success && loadBitmap(logger);
+ success = success && loadBitmap();
if (success) {
loaded = loaded | BITMAP;
}
}
if (((type & ORIGINAL_DATA) != 0) && ((loaded & ORIGINAL_DATA) == 0)) {
- success = success && loadOriginalData(logger);
+ success = success && loadOriginalData();
if (success) {
loaded = loaded | ORIGINAL_DATA;
}
@@ -161,7 +168,7 @@ public abstract class AbstractFopImage implements FopImage {
* @param ua the user agent
* @return true if the loading was successful
*/
- protected boolean loadDimensions(Log logger) {
+ protected boolean loadDimensions() {
return false;
}
@@ -173,7 +180,7 @@ public abstract class AbstractFopImage implements FopImage {
* @param ua the user agent
* @return true if the loading was successful
*/
- protected boolean loadBitmap(Log logger) {
+ protected boolean loadBitmap() {
return false;
}
@@ -185,7 +192,7 @@ public abstract class AbstractFopImage implements FopImage {
* @param ua the user agent
* @return true if the loading was successful
*/
- protected boolean loadOriginalData(Log logger) {
+ protected boolean loadOriginalData() {
return false;
}
diff --git a/src/java/org/apache/fop/image/FopImage.java b/src/java/org/apache/fop/image/FopImage.java
index c1b4aaa86..f72f97c90 100644
--- a/src/java/org/apache/fop/image/FopImage.java
+++ b/src/java/org/apache/fop/image/FopImage.java
@@ -61,10 +61,9 @@ public interface FopImage {
* the information.
*
* @param type the type of loading required
- * @param logger the Commons-logging component
* @return boolean true if the information could be loaded
*/
- boolean load(int type, Log logger);
+ boolean load(int type);
/**
* Returns the image width.
diff --git a/src/java/org/apache/fop/image/GifImage.java b/src/java/org/apache/fop/image/GifImage.java
index 8a23a7d0c..26ca23323 100644
--- a/src/java/org/apache/fop/image/GifImage.java
+++ b/src/java/org/apache/fop/image/GifImage.java
@@ -58,7 +58,7 @@ public class GifImage extends AbstractFopImage {
* @param ua the user agent for loading
* @return True if the load process succeeded
*/
- protected boolean loadBitmap(Log logger) {
+ protected boolean loadBitmap() {
int[] tmpMap = null;
try {
URLConnection con = new DummyConnection(inputStream);
@@ -81,7 +81,7 @@ public class GifImage extends AbstractFopImage {
try {
tmpMap = consumer.getImage();
} catch (Exception ex) {
- logger.error("Image grabbing interrupted : "
+ log.error("Image grabbing interrupted : "
+ ex.getMessage(), ex);
return false;
}
@@ -146,7 +146,7 @@ public class GifImage extends AbstractFopImage {
this.isTransparent = false;
}
} catch (Exception ex) {
- logger.error("Error while loading image "
+ log.error("Error while loading image "
+ "" + " : "
+ ex.getClass() + " - "
+ ex.getMessage(), ex);
diff --git a/src/java/org/apache/fop/image/ImageFactory.java b/src/java/org/apache/fop/image/ImageFactory.java
index 93253240a..75ffff95b 100644
--- a/src/java/org/apache/fop/image/ImageFactory.java
+++ b/src/java/org/apache/fop/image/ImageFactory.java
@@ -30,6 +30,7 @@ import java.util.Collections;
import java.util.Iterator;
import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
// FOP
import org.apache.fop.image.analyser.ImageReaderFactory;
@@ -42,6 +43,11 @@ import org.apache.fop.apps.FOUserAgent;
*/
public class ImageFactory {
+ /**
+ * logging instance
+ */
+ protected static Log log = LogFactory.getLog(FopImage.class);
+
private static ImageFactory factory = new ImageFactory();
private ImageCache cache = new ContextImageCache(true);
@@ -129,7 +135,6 @@ public class ImageFactory {
* @return the fop image instance
*/
public static FopImage loadImage(String href, FOUserAgent ua) {
- Log log = ua.getLogger();
InputStream in = openStream(href, ua);
@@ -214,7 +219,7 @@ public class ImageFactory {
* @return a new FopImage object
*/
protected static InputStream openStream(String href, FOUserAgent ua) {
- Log log = ua.getLogger();
+
// Get the absolute URL
URL absoluteURL = null;
InputStream in = null;
diff --git a/src/java/org/apache/fop/image/analyser/ImageReaderFactory.java b/src/java/org/apache/fop/image/analyser/ImageReaderFactory.java
index 8d6ce8929..826f4b60f 100644
--- a/src/java/org/apache/fop/image/analyser/ImageReaderFactory.java
+++ b/src/java/org/apache/fop/image/analyser/ImageReaderFactory.java
@@ -27,6 +27,10 @@ import java.util.ArrayList;
import org.apache.fop.image.FopImage;
import org.apache.fop.apps.FOUserAgent;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
/**
* Factory for ImageReader objects.
*
@@ -37,6 +41,8 @@ public class ImageReaderFactory {
private static ArrayList formats = new ArrayList();
+ protected static Log log = LogFactory.getLog(ImageReaderFactory.class);
+
static {
registerFormat(new JPEGReader());
registerFormat(new BMPReader());
@@ -80,9 +86,8 @@ public class ImageReaderFactory {
}
}
} catch (IOException ex) {
- ua.getLogger().error(
- "Error while recovering Image Informations ("
- + uri + ")", ex);
+ log.error("Error while recovering Image Informations ("
+ + uri + ")", ex);
}
return null;
}
diff --git a/src/java/org/apache/fop/image/analyser/SVGReader.java b/src/java/org/apache/fop/image/analyser/SVGReader.java
index 2a3bade9d..3ac9a4c75 100644
--- a/src/java/org/apache/fop/image/analyser/SVGReader.java
+++ b/src/java/org/apache/fop/image/analyser/SVGReader.java
@@ -89,7 +89,7 @@ public class SVGReader implements ImageReader {
if (batik) {
try {
Loader loader = new Loader();
- return loader.getImage(uri, bis, ua.getLogger(),
+ return loader.getImage(uri, bis,
ua.getPixelUnitToMillimeter());
} catch (NoClassDefFoundError e) {
batik = false;
@@ -107,7 +107,7 @@ public class SVGReader implements ImageReader {
*/
class Loader {
private FopImage.ImageInfo getImage(String uri, InputStream fis,
- Log logger, float pixelUnitToMM) {
+ float pixelUnitToMM) {
// parse document and get the size attributes of the svg element
try {
@@ -177,7 +177,7 @@ public class SVGReader implements ImageReader {
Element e = doc.getRootElement();
String s;
- SVGUserAgent userAg = new SVGUserAgent(logger, pixelUnitToMM,
+ SVGUserAgent userAg = new SVGUserAgent(pixelUnitToMM,
new AffineTransform());
BridgeContext ctx = new BridgeContext(userAg);
UnitProcessor.Context uctx =
diff --git a/src/java/org/apache/fop/image/analyser/XMLReader.java b/src/java/org/apache/fop/image/analyser/XMLReader.java
index 9c13067ec..bb85980c6 100644
--- a/src/java/org/apache/fop/image/analyser/XMLReader.java
+++ b/src/java/org/apache/fop/image/analyser/XMLReader.java
@@ -32,9 +32,18 @@ import org.w3c.dom.Element;
import org.apache.fop.image.FopImage;
import org.apache.fop.apps.FOUserAgent;
+// Commons-Logging
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/** ImageReader object for XML document image type. */
public class XMLReader implements ImageReader {
+ /**
+ * logging instance
+ */
+ private Log log = LogFactory.getLog(XMLReader.class);
+
private static Map converters = new java.util.HashMap();
/**
@@ -108,7 +117,7 @@ public class XMLReader implements ImageReader {
info.data = doc;
Element root = doc.getDocumentElement();
- ua.getLogger().debug("XML image namespace: " + root.getAttribute("xmlns"));
+ log.debug("XML image namespace: " + root.getAttribute("xmlns"));
String ns = root.getAttribute("xmlns");
info.str = ns;
@@ -120,7 +129,7 @@ public class XMLReader implements ImageReader {
}
}
} catch (Exception e) {
- ua.getLogger().warn("Error while constructing image from XML", e);
+ log.warn("Error while constructing image from XML", e);
try {
is.reset();
} catch (IOException ioe) {
diff --git a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
index 1a11396ba..0f5d51542 100644
--- a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
@@ -28,6 +28,7 @@ import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyManager;
import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import java.util.ListIterator;
import java.util.Map;
@@ -49,6 +50,11 @@ public abstract class AbstractLayoutManager implements LayoutManager, Constants
protected boolean bInited = false;
/**
+ * logging instance
+ */
+ protected static Log log = LogFactory.getLog(AbstractLayoutManager.class);
+
+ /**
* Abstract layout manager.
*/
public AbstractLayoutManager() {
@@ -93,10 +99,6 @@ public abstract class AbstractLayoutManager implements LayoutManager, Constants
return userAgent;
}
- protected Log getLogger() {
- return userAgent.getLogger();
- }
-
public void setParent(LayoutManager lm) {
this.parentLM = lm;
}
diff --git a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
index ac0fa3414..156d6efee 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
@@ -245,7 +245,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
if (overflow == Overflow.HIDDEN) {
clip = true;
} else if (overflow == Overflow.ERROR_IF_OVERFLOW) {
- getLogger().error("contents overflows block-container viewport: clipping");
+ log.error("contents overflows block-container viewport: clipping");
clip = true;
}
}
diff --git a/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java b/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
index 0e27e8c59..ae47270a7 100644
--- a/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
@@ -60,7 +60,7 @@ public class FlowLayoutManager extends BlockStackingLayoutManager {
while ((curLM = getChildLM()) != null) {
if (curLM.generatesInlineAreas()) {
- getLogger().error("inline area not allowed under flow - ignoring");
+ log.error("inline area not allowed under flow - ignoring");
curLM.setFinished(true);
continue;
}
@@ -169,7 +169,7 @@ public class FlowLayoutManager extends BlockStackingLayoutManager {
*/
public Marker retrieveMarker(String name, int pos, int boundary) {
// error cannot retrieve markers in flow
- getLogger().error("Cannot retrieve a marker from the flow");
+ log.error("Cannot retrieve a marker from the flow");
return null;
}
}
diff --git a/src/java/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java b/src/java/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
index 6f1e90a1f..a05261828 100644
--- a/src/java/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
@@ -267,7 +267,7 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
// ignore nested blocks for now
if (!curLM.generatesInlineAreas()) {
- getLogger().warn("ignoring block inside inline fo");
+ log.warn("ignoring block inside inline fo");
curLM.setFinished(true);
continue;
}
diff --git a/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java
index 3c456ee00..a511c2cb3 100644
--- a/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java
@@ -448,7 +448,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager {
while (bpIter.hasPrevious() && bpIter.previous() != prev) {
}
if (prev != null && bpIter.next() != prev) {
- getLogger().error("findHyphenPoss: problem!");
+ log.error("findHyphenPoss: problem!");
return null;
}
StringBuffer sbChars = new StringBuffer(30);
@@ -465,7 +465,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager {
prev = bp;
}
vecInlineBreaks.remove(vecInlineBreaks.size() - 1); // remove last
- getLogger().debug("Word to hyphenate: " + sbChars.toString());
+ log.debug("Word to hyphenate: " + sbChars.toString());
// Now find all hyphenation points in this word (get in an array of offsets)
// hyphProps are from the block level?. Note that according to the spec,
diff --git a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
index 958834654..b5711cb14 100644
--- a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
@@ -458,7 +458,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
}
RegionViewport reg = curPage.getPage().getRegionViewport(regionClass);
if (reg == null) {
- getLogger().error("no region viewport: shouldn't happen");
+ log.error("no region viewport: shouldn't happen");
}
StaticContentLayoutManager lm = getStaticContentLayoutManager(flow);
lm.setUserAgent(getUserAgent());
@@ -476,7 +476,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
lm.addAreas(new BreakPossPosIter(vecBreakPoss, 0,
vecBreakPoss.size()), null);
} else {
- getLogger().error("bp==null cls=" + regionClass);
+ log.error("bp==null cls=" + regionClass);
}
}
//lm.flush();
@@ -836,7 +836,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
if ((columnCount > 1) && (r.overflow == Overflow.SCROLL)) {
// recover by setting 'column-count' to 1. This is allowed but
// not required by the spec.
- getLogger().error("Setting 'column-count' to 1 because "
+ log.error("Setting 'column-count' to 1 because "
+ "'overflow' is set to 'scroll'");
columnCount = 1;
}
diff --git a/src/java/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java
index b5fd4d502..1675d875f 100644
--- a/src/java/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java
@@ -97,9 +97,9 @@ public class RetrieveMarkerLayoutManager extends AbstractLayoutManager {
replaceLM = (LayoutManager)list.get(0);
replaceLM.setParent(this);
replaceLM.initialize();
- getLogger().debug("retrieved: " + replaceLM + ":" + list.size());
+ log.debug("retrieved: " + replaceLM + ":" + list.size());
} else {
- getLogger().debug("found no marker with name: " + name);
+ log.debug("found no marker with name: " + name);
}
}
}
diff --git a/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
index bbab0ca74..424231276 100644
--- a/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
@@ -62,7 +62,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
blockBreaks.add(bp);
if (bp.isForcedBreak()) {
- getLogger().error("Forced breaks are not allowed in "
+ log.error("Forced breaks are not allowed in "
+ "static content - ignoring");
return null;
}
@@ -128,7 +128,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
*/
public void addMarker(Map marks, boolean start, boolean isfirst) {
// error markers not allowed in static
- getLogger().error("Cannot add marker to static areas");
+ log.error("Cannot add marker to static areas");
}
}
diff --git a/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java b/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java
index f7badde2f..a56233b8a 100644
--- a/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java
@@ -172,7 +172,7 @@ public class TextLayoutManager extends AbstractLayoutManager {
if (prevPos != null) {
// ASSERT (prevPos.getLM() == this)
if (prevPos.getLM() != this) {
- getLogger().error(
+ log.error(
"TextLayoutManager.resetPosition: " + "LM mismatch!!!");
}
LeafPosition tbp = (LeafPosition) prevPos;
diff --git a/src/java/org/apache/fop/layoutmgr/table/Body.java b/src/java/org/apache/fop/layoutmgr/table/Body.java
index ac44124f5..4ba9a7062 100644
--- a/src/java/org/apache/fop/layoutmgr/table/Body.java
+++ b/src/java/org/apache/fop/layoutmgr/table/Body.java
@@ -96,7 +96,7 @@ public class Body extends BlockStackingLayoutManager {
if (columns == null) {
setFinished(true);
- getLogger().warn("ignoring fo:table-body with undefined fo:table-columns");
+ log.warn("ignoring fo:table-body with undefined fo:table-columns");
return null;
}
diff --git a/src/java/org/apache/fop/layoutmgr/table/Cell.java b/src/java/org/apache/fop/layoutmgr/table/Cell.java
index 0819d0c94..9d39d058a 100644
--- a/src/java/org/apache/fop/layoutmgr/table/Cell.java
+++ b/src/java/org/apache/fop/layoutmgr/table/Cell.java
@@ -89,7 +89,7 @@ public class Cell extends BlockStackingLayoutManager {
while ((curLM = getChildLM()) != null) {
if (curLM.generatesInlineAreas()) {
- getLogger().error("table-cell must contain block areas - ignoring");
+ log.error("table-cell must contain block areas - ignoring");
curLM.setFinished(true);
continue;
}
diff --git a/src/java/org/apache/fop/render/awt/AWTRenderer.java b/src/java/org/apache/fop/render/awt/AWTRenderer.java
index 552e59bcf..4f049a407 100644
--- a/src/java/org/apache/fop/render/awt/AWTRenderer.java
+++ b/src/java/org/apache/fop/render/awt/AWTRenderer.java
@@ -377,7 +377,7 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable
if (back.getURL() != null) { // TODO: implement
ImageFactory fact = ImageFactory.getInstance();
FopImage fopimage = fact.getImage(back.getURL(), userAgent);
- if (fopimage != null && fopimage.load(FopImage.DIMENSIONS, userAgent.getLogger())) {
+ if (fopimage != null && fopimage.load(FopImage.DIMENSIONS)) {
if (back.getRepeat() == BackgroundRepeat.REPEAT) {
// create a pattern for the image
} else {
diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java
index ed35a16fe..5debef993 100644
--- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java
+++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java
@@ -594,7 +594,7 @@ public class PDFRenderer extends PrintRenderer {
if (back.getURL() != null) {
ImageFactory fact = ImageFactory.getInstance();
FopImage fopimage = fact.getImage(back.getURL(), userAgent);
- if (fopimage != null && fopimage.load(FopImage.DIMENSIONS, userAgent.getLogger())) {
+ if (fopimage != null && fopimage.load(FopImage.DIMENSIONS)) {
if (back.getRepeat() == BackgroundRepeat.REPEAT) {
// create a pattern for the image
} else {
@@ -1118,12 +1118,12 @@ public class PDFRenderer extends PrintRenderer {
if (fopimage == null) {
return;
}
- if (!fopimage.load(FopImage.DIMENSIONS, userAgent.getLogger())) {
+ if (!fopimage.load(FopImage.DIMENSIONS)) {
return;
}
String mime = fopimage.getMimeType();
if ("text/xml".equals(mime)) {
- if (!fopimage.load(FopImage.ORIGINAL_DATA, userAgent.getLogger())) {
+ if (!fopimage.load(FopImage.ORIGINAL_DATA)) {
return;
}
Document doc = ((XMLImage) fopimage).getDocument();
@@ -1131,7 +1131,7 @@ public class PDFRenderer extends PrintRenderer {
renderDocument(doc, ns, pos);
} else if ("image/svg+xml".equals(mime)) {
- if (!fopimage.load(FopImage.ORIGINAL_DATA, userAgent.getLogger())) {
+ if (!fopimage.load(FopImage.ORIGINAL_DATA)) {
return;
}
Document doc = ((XMLImage) fopimage).getDocument();
@@ -1139,14 +1139,14 @@ public class PDFRenderer extends PrintRenderer {
renderDocument(doc, ns, pos);
} else if ("image/eps".equals(mime)) {
- if (!fopimage.load(FopImage.ORIGINAL_DATA, userAgent.getLogger())) {
+ if (!fopimage.load(FopImage.ORIGINAL_DATA)) {
return;
}
FopPDFImage pdfimage = new FopPDFImage(fopimage, url);
int xobj = pdfDoc.addImage(currentContext, pdfimage).getXNumber();
fact.releaseImage(url, userAgent);
} else if ("image/jpeg".equals(mime)) {
- if (!fopimage.load(FopImage.ORIGINAL_DATA, userAgent.getLogger())) {
+ if (!fopimage.load(FopImage.ORIGINAL_DATA)) {
return;
}
FopPDFImage pdfimage = new FopPDFImage(fopimage, url);
@@ -1158,7 +1158,7 @@ public class PDFRenderer extends PrintRenderer {
placeImage((int) pos.getX() / 1000,
(int) pos.getY() / 1000, w, h, xobj);
} else {
- if (!fopimage.load(FopImage.BITMAP, userAgent.getLogger())) {
+ if (!fopimage.load(FopImage.BITMAP)) {
return;
}
FopPDFImage pdfimage = new FopPDFImage(fopimage, url);
diff --git a/src/java/org/apache/fop/render/pdf/PDFXMLHandler.java b/src/java/org/apache/fop/render/pdf/PDFXMLHandler.java
index 38d28e90b..a1debb513 100644
--- a/src/java/org/apache/fop/render/pdf/PDFXMLHandler.java
+++ b/src/java/org/apache/fop/render/pdf/PDFXMLHandler.java
@@ -32,8 +32,13 @@ import org.apache.fop.svg.PDFGraphics2D;
import org.apache.fop.svg.SVGUserAgent;
import org.apache.fop.fonts.FontInfo;
+// Commons-Logging
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
/* org.w3c.dom.Document is not imported to avoid conflict with
- org.apache.fop.control.Document */
+ org.apache.fop.apps.Document */
import java.io.OutputStream;
@@ -55,6 +60,12 @@ import java.awt.geom.AffineTransform;
* The properties from the PDF renderer are subject to change.
*/
public class PDFXMLHandler implements XMLHandler {
+
+ /**
+ * logging instance
+ */
+ private Log log = LogFactory.getLog(PDFXMLHandler.class);
+
/**
* The PDF document that is being drawn into.
*/
@@ -220,8 +231,7 @@ public class PDFXMLHandler implements XMLHandler {
int yOffset = pdfInfo.currentYPosition;
SVGUserAgent ua
- = new SVGUserAgent(context.getUserAgent().getLogger(),
- context.getUserAgent().getPixelUnitToMillimeter(),
+ = new SVGUserAgent(context.getUserAgent().getPixelUnitToMillimeter(),
new AffineTransform());
GVTBuilder builder = new GVTBuilder();
@@ -240,7 +250,7 @@ public class PDFXMLHandler implements XMLHandler {
try {
root = builder.build(ctx, doc);
} catch (Exception e) {
- context.getUserAgent().getLogger().error("svg graphic could not be built: "
+ log.error("svg graphic could not be built: "
+ e.getMessage(), e);
return;
}
@@ -298,7 +308,7 @@ public class PDFXMLHandler implements XMLHandler {
root.paint(graphics);
pdfInfo.currentStream.add(graphics.getString());
} catch (Exception e) {
- context.getUserAgent().getLogger().error("svg graphic could not be rendered: "
+ log.error("svg graphic could not be rendered: "
+ e.getMessage(), e);
}
diff --git a/src/java/org/apache/fop/render/ps/PSGraphics2D.java b/src/java/org/apache/fop/render/ps/PSGraphics2D.java
index 039f3d483..4da7cc5c3 100644
--- a/src/java/org/apache/fop/render/ps/PSGraphics2D.java
+++ b/src/java/org/apache/fop/render/ps/PSGraphics2D.java
@@ -320,7 +320,7 @@ public class PSGraphics2D extends AbstractGraphics2D {
/**
* @see org.apache.fop.image.FopImage#load(int, org.apache.commons.logging.Log)
*/
- public boolean load(int type, Log logger) {
+ public boolean load(int type) {
switch (type) {
case FopImage.DIMENSIONS: break;
case FopImage.BITMAP: break;
diff --git a/src/java/org/apache/fop/render/ps/PSRenderer.java b/src/java/org/apache/fop/render/ps/PSRenderer.java
index caf6654ea..68708a2eb 100644
--- a/src/java/org/apache/fop/render/ps/PSRenderer.java
+++ b/src/java/org/apache/fop/render/ps/PSRenderer.java
@@ -698,7 +698,7 @@ public class PSRenderer extends AbstractRenderer {
if (back.getURL() != null) {
ImageFactory fact = ImageFactory.getInstance();
FopImage fopimage = fact.getImage(back.getURL(), userAgent);
- if (fopimage != null && fopimage.load(FopImage.DIMENSIONS, userAgent.getLogger())) {
+ if (fopimage != null && fopimage.load(FopImage.DIMENSIONS)) {
if (back.getRepeat() == BackgroundRepeat.REPEAT) {
// create a pattern for the image
} else {
diff --git a/src/java/org/apache/fop/render/ps/PSXMLHandler.java b/src/java/org/apache/fop/render/ps/PSXMLHandler.java
index 671a78dab..3f5020bf9 100644
--- a/src/java/org/apache/fop/render/ps/PSXMLHandler.java
+++ b/src/java/org/apache/fop/render/ps/PSXMLHandler.java
@@ -33,12 +33,17 @@ import org.apache.batik.bridge.GVTBuilder;
import org.apache.batik.bridge.BridgeContext;
import org.apache.batik.bridge.ViewBox;
import org.apache.batik.gvt.GraphicsNode;
+
// FOP
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.render.XMLHandler;
import org.apache.fop.render.RendererContext;
import org.apache.fop.svg.SVGUserAgent;
+// Commons-Logging
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* PostScript XML handler.
* This handler handles XML for foreign objects when rendering to PostScript.
@@ -51,6 +56,11 @@ import org.apache.fop.svg.SVGUserAgent;
public class PSXMLHandler implements XMLHandler {
/**
+ * logging instance
+ */
+ private Log log = LogFactory.getLog(PSXMLHandler.class);
+
+ /**
* The PostScript generator that is being used to drawn into.
*/
public static final String PS_GENERATOR = "psGenerator";
@@ -258,9 +268,9 @@ public class PSXMLHandler implements XMLHandler {
PSGenerator gen = psInfo.psGenerator;
SVGUserAgent ua
- = new SVGUserAgent(context.getUserAgent().getLogger(),
- context.getUserAgent().getPixelUnitToMillimeter(),
- new AffineTransform());
+ = new SVGUserAgent(
+ context.getUserAgent().getPixelUnitToMillimeter(),
+ new AffineTransform());
GVTBuilder builder = new GVTBuilder();
BridgeContext ctx = new BridgeContext(ua);
@@ -280,7 +290,7 @@ public class PSXMLHandler implements XMLHandler {
try {
root = builder.build(ctx, doc);
} catch (Exception e) {
- context.getUserAgent().getLogger().error("SVG graphic could not be built: "
+ log.error("SVG graphic could not be built: "
+ e.getMessage(), e);
return;
}
@@ -337,7 +347,7 @@ public class PSXMLHandler implements XMLHandler {
root.paint(graphics);
//psInfo.currentStream.add(graphics.getString());
} catch (Exception e) {
- context.getUserAgent().getLogger().error("SVG graphic could not be rendered: "
+ log.error("SVG graphic could not be rendered: "
+ e.getMessage(), e);
}
@@ -345,7 +355,7 @@ public class PSXMLHandler implements XMLHandler {
//psInfo.pdfState.pop();
gen.writeln("%SVG graphic end ---");
} catch (IOException ioe) {
- context.getUserAgent().getLogger().error("SVG graphic could not be rendered: "
+ log.error("SVG graphic could not be rendered: "
+ ioe.getMessage(), ioe);
}
}
diff --git a/src/java/org/apache/fop/svg/PDFImageElementBridge.java b/src/java/org/apache/fop/svg/PDFImageElementBridge.java
index b3eebb5ef..567e0c46d 100644
--- a/src/java/org/apache/fop/svg/PDFImageElementBridge.java
+++ b/src/java/org/apache/fop/svg/PDFImageElementBridge.java
@@ -68,7 +68,7 @@ public class PDFImageElementBridge extends SVGImageElementBridge {
JpegImage jpeg = new JpegImage(ii);
SimpleLog logger = new SimpleLog("FOP/SVG");
logger.setLevel(SimpleLog.LOG_LEVEL_INFO);
- jpeg.load(FopImage.ORIGINAL_DATA, logger);
+ jpeg.load(FopImage.ORIGINAL_DATA);
PDFJpegNode node = new PDFJpegNode(jpeg, origGN);
Rectangle2D imgBounds = getImageBounds(ctx, e);
diff --git a/src/java/org/apache/fop/svg/SVGUserAgent.java b/src/java/org/apache/fop/svg/SVGUserAgent.java
index aefdd1169..bd66517d4 100644
--- a/src/java/org/apache/fop/svg/SVGUserAgent.java
+++ b/src/java/org/apache/fop/svg/SVGUserAgent.java
@@ -27,6 +27,10 @@ import java.awt.geom.AffineTransform;
import java.awt.geom.Dimension2D;
import java.awt.Dimension;
+// Commons-Logging
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* The SVG user agent.
* This is an implementation of the batik svg user agent
@@ -34,18 +38,21 @@ import java.awt.Dimension;
*/
public class SVGUserAgent extends UserAgentAdapter {
private AffineTransform currentTransform = null;
- private Log logger;
private float pixelUnitToMillimeter = 0.0f;
/**
+ * logging instance
+ */
+ private Log logger = LogFactory.getLog(SVGUserAgent.class);
+
+ /**
* Creates a new SVGUserAgent.
* @param log an Commons logging instance
* @param pixelUnitToMM The pixel to millimeter conversion factor
* currently in effect
* @param at the current transform
*/
- public SVGUserAgent(Log log, float pixelUnitToMM, AffineTransform at) {
- logger = log;
+ public SVGUserAgent(float pixelUnitToMM, AffineTransform at) {
pixelUnitToMillimeter = pixelUnitToMM;
currentTransform = at;
}
diff --git a/src/java/org/apache/fop/tools/AreaTreeBuilder.java b/src/java/org/apache/fop/tools/AreaTreeBuilder.java
index 74ab65ecd..109a28e59 100644
--- a/src/java/org/apache/fop/tools/AreaTreeBuilder.java
+++ b/src/java/org/apache/fop/tools/AreaTreeBuilder.java
@@ -163,7 +163,6 @@ public class AreaTreeBuilder {
org.apache.fop.apps.Document doc = new org.apache.fop.apps.Document(null);
rend.setupFontInfo(doc.getFontInfo());
FOUserAgent ua = new FOUserAgent();
- ua.setLogger(logger);
rend.setUserAgent(ua);
StorePagesModel sm = AreaTree.createStorePagesModel();
diff --git a/src/java/org/apache/fop/tools/TestConverter.java b/src/java/org/apache/fop/tools/TestConverter.java
index a569a934d..71b6e764a 100644
--- a/src/java/org/apache/fop/tools/TestConverter.java
+++ b/src/java/org/apache/fop/tools/TestConverter.java
@@ -307,7 +307,6 @@ public class TestConverter {
Driver driver = new Driver();
FOUserAgent userAgent = new FOUserAgent();
- userAgent.setLogger(getLogger());
userAgent.setBaseURL(baseURL);
driver.setUserAgent(userAgent);
if (outputPDF) {
diff --git a/src/java/org/apache/fop/tools/anttasks/Fop.java b/src/java/org/apache/fop/tools/anttasks/Fop.java
index 0e37400f9..d82b922ed 100644
--- a/src/java/org/apache/fop/tools/anttasks/Fop.java
+++ b/src/java/org/apache/fop/tools/anttasks/Fop.java
@@ -535,7 +535,6 @@ class FOPTaskStarter {
driver.setLogger(getLogger());
FOUserAgent userAgent = new FOUserAgent();
userAgent.setBaseURL(this.baseURL);
- userAgent.setLogger(getLogger());
driver.setUserAgent(userAgent);
driver.setRenderer(renderer);
driver.setOutputStream(out);