From: Jeremias Maerki Date: Sat, 14 Aug 2010 19:28:26 +0000 (+0000) Subject: Removed many "// CSOK: ConstantName" instances for constants, by converting them... X-Git-Tag: fop-1_1rc1old~471 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=aba436311c935f145aa984c855f88bfd3a9cb1c1;p=xmlgraphics-fop.git Removed many "// CSOK: ConstantName" instances for constants, by converting them to uppercase as they should really be. Fixed some other non-Checkstyle issues on the way, imports mainly. Removed some "log" instances that were not used. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@985571 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/examples/plan/src/org/apache/fop/plan/PlanHints.java b/examples/plan/src/org/apache/fop/plan/PlanHints.java index 2a2c1333a..a50d91139 100644 --- a/examples/plan/src/org/apache/fop/plan/PlanHints.java +++ b/examples/plan/src/org/apache/fop/plan/PlanHints.java @@ -25,22 +25,22 @@ package org.apache.fop.plan; public interface PlanHints { /** Border attribute */ - public static final String PLAN_BORDER = "border"; + String PLAN_BORDER = "border"; /** Legend attribute */ - public static final String PLAN_LEGEND = "legend"; + String PLAN_LEGEND = "legend"; /** Font family attribute */ - public static final String FONT_FAMILY = "font-family"; + String FONT_FAMILY = "font-family"; /** Font size attribute */ - public static final String FONT_SIZE = "font-size"; + String FONT_SIZE = "font-size"; /** Legent type attribute */ - public static final String LEGEND_TYPE = "legendType"; + String LEGEND_TYPE = "legendType"; /** Locale attribute */ - public static final String LOCALE = "locale"; + String LOCALE = "locale"; /** Label type attribute */ - public static final String LABEL_TYPE = "labelType"; + String LABEL_TYPE = "labelType"; /** Label font size attribute */ - public static final String LABEL_FONT_SIZE = "labelFontSize"; + String LABEL_FONT_SIZE = "labelFontSize"; /** Label font attribute */ - public static final String LABEL_FONT = "labelFont"; + String LABEL_FONT = "labelFont"; } diff --git a/examples/plan/src/org/apache/fop/plan/PlanRenderer.java b/examples/plan/src/org/apache/fop/plan/PlanRenderer.java index 8b7978259..7d41962fb 100644 --- a/examples/plan/src/org/apache/fop/plan/PlanRenderer.java +++ b/examples/plan/src/org/apache/fop/plan/PlanRenderer.java @@ -109,8 +109,8 @@ public class PlanRenderer { hints.put(PlanHints.FONT_FAMILY, fontFamily); hints.put(PlanHints.FONT_SIZE, new Float(fontSize)); hints.put(PlanHints.LOCALE, locale); - Document doc = - planDrawer.createDocument(data, width, height, hints); + Document doc + = planDrawer.createDocument(data, width, height, hints); return doc; } @@ -152,6 +152,7 @@ public class PlanRenderer { } else if (t.equals("grouping")) { data.setType(ActionInfo.GROUPING); } else { + throw new IllegalArgumentException("Unknown action type: " + t); } for (int i = 0; i < childs.getLength(); i++) { diff --git a/examples/plan/src/org/apache/fop/plan/SimplePlanDrawer.java b/examples/plan/src/org/apache/fop/plan/SimplePlanDrawer.java index 46b07601a..a8ba062ed 100644 --- a/examples/plan/src/org/apache/fop/plan/SimplePlanDrawer.java +++ b/examples/plan/src/org/apache/fop/plan/SimplePlanDrawer.java @@ -243,8 +243,8 @@ public class SimplePlanDrawer implements PlanDrawer { - lastWeek.getTime() + 43200000) / 86400000); int days = (int)((end.getTime() - start.getTime() + 43200000) / 86400000); - int daysFromEnd = - (int)((future.getTime() - end.getTime() + int daysFromEnd + = (int)((future.getTime() - end.getTime() + 43200000) / 86400000); Element taskGraphic; switch (type) { @@ -299,8 +299,8 @@ public class SimplePlanDrawer implements PlanDrawer { topEdge = lastTop; } } - int currentDays = - (int)((currentDate.getTime() - lastWeek.getTime() + int currentDays + = (int)((currentDate.getTime() - lastWeek.getTime() + 43200000) / 86400000); text = SVGUtilities.createText(doc, diff --git a/src/java/org/apache/fop/afp/AFPDataObjectInfo.java b/src/java/org/apache/fop/afp/AFPDataObjectInfo.java index 66ef8e595..7589ef4fe 100644 --- a/src/java/org/apache/fop/afp/AFPDataObjectInfo.java +++ b/src/java/org/apache/fop/afp/AFPDataObjectInfo.java @@ -19,9 +19,6 @@ package org.apache.fop.afp; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import org.apache.fop.afp.modca.Registry; import org.apache.fop.afp.modca.triplets.MappingOptionTriplet; @@ -29,8 +26,6 @@ import org.apache.fop.afp.modca.triplets.MappingOptionTriplet; * A list of parameters associated with an AFP data objects */ public class AFPDataObjectInfo { - private static final Log log // CSOK: ConstantName - = LogFactory.getLog("org.apache.xmlgraphics.afp"); /** the object area info */ private AFPObjectAreaInfo objectAreaInfo; diff --git a/src/java/org/apache/fop/afp/AFPGraphics2D.java b/src/java/org/apache/fop/afp/AFPGraphics2D.java index 5fa6bae2d..af58b5471 100644 --- a/src/java/org/apache/fop/afp/AFPGraphics2D.java +++ b/src/java/org/apache/fop/afp/AFPGraphics2D.java @@ -75,7 +75,7 @@ import org.apache.fop.svg.NativeImageHandler; */ public class AFPGraphics2D extends AbstractGraphics2D implements NativeImageHandler { - private static final Log log = LogFactory.getLog(AFPGraphics2D.class); // CSOK: ConstantName + private static final Log LOG = LogFactory.getLog(AFPGraphics2D.class); private static final int X = 0; @@ -321,7 +321,7 @@ public class AFPGraphics2D extends AbstractGraphics2D implements NativeImageHand graphicsObj.setLineType(type); } } else { - log.warn("Unsupported Stroke: " + stroke.getClass().getName()); + LOG.warn("Unsupported Stroke: " + stroke.getClass().getName()); } } @@ -339,7 +339,7 @@ public class AFPGraphics2D extends AbstractGraphics2D implements NativeImageHand if (paint instanceof Color) { return true; } - log.debug("NYI: applyPaint() " + paint + " fill=" + fill); + LOG.debug("NYI: applyPaint() " + paint + " fill=" + fill); if (paint instanceof TexturePaint) { // TexturePaint texturePaint = (TexturePaint)paint; // BufferedImage bufferedImage = texturePaint.getImage(); @@ -490,7 +490,7 @@ public class AFPGraphics2D extends AbstractGraphics2D implements NativeImageHand currentPosition = new double[]{openingCoords[0], openingCoords[1]}; break; default: - log.debug("Unrecognised path iterator type"); + LOG.debug("Unrecognised path iterator type"); break; } } @@ -498,13 +498,13 @@ public class AFPGraphics2D extends AbstractGraphics2D implements NativeImageHand /** {@inheritDoc} */ public void draw(Shape shape) { - log.debug("draw() shape=" + shape); + LOG.debug("draw() shape=" + shape); doDrawing(shape, false); } /** {@inheritDoc} */ public void fill(Shape shape) { - log.debug("fill() shape=" + shape); + LOG.debug("fill() shape=" + shape); doDrawing(shape, true); } @@ -516,7 +516,7 @@ public class AFPGraphics2D extends AbstractGraphics2D implements NativeImageHand */ public void handleIOException(IOException ioe) { // TODO Surely, there's a better way to do this. - log.error(ioe.getMessage()); + LOG.error(ioe.getMessage()); ioe.printStackTrace(); } @@ -659,29 +659,29 @@ public class AFPGraphics2D extends AbstractGraphics2D implements NativeImageHand /** {@inheritDoc} */ public void drawRenderableImage(RenderableImage img, AffineTransform xform) { - log.debug("drawRenderableImage() NYI: img=" + img + ", xform=" + xform); + LOG.debug("drawRenderableImage() NYI: img=" + img + ", xform=" + xform); } /** {@inheritDoc} */ public FontMetrics getFontMetrics(Font f) { - log.debug("getFontMetrics() NYI: f=" + f); + LOG.debug("getFontMetrics() NYI: f=" + f); return null; } /** {@inheritDoc} */ public void setXORMode(Color col) { - log.debug("setXORMode() NYI: col=" + col); + LOG.debug("setXORMode() NYI: col=" + col); } /** {@inheritDoc} */ public void addNativeImage(org.apache.xmlgraphics.image.loader.Image image, float x, float y, float width, float height) { - log.debug("NYI: addNativeImage() " + "image=" + image + LOG.debug("NYI: addNativeImage() " + "image=" + image + ",x=" + x + ",y=" + y + ",width=" + width + ",height=" + height); } /** {@inheritDoc} */ public void copyArea(int x, int y, int width, int height, int dx, int dy) { - log.debug("copyArea() NYI: "); + LOG.debug("copyArea() NYI: "); } } diff --git a/src/java/org/apache/fop/afp/AFPStreamer.java b/src/java/org/apache/fop/afp/AFPStreamer.java index a24e90cbf..33d1dbf90 100644 --- a/src/java/org/apache/fop/afp/AFPStreamer.java +++ b/src/java/org/apache/fop/afp/AFPStreamer.java @@ -31,6 +31,7 @@ import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.apache.fop.afp.modca.ResourceGroup; import org.apache.fop.afp.modca.StreamedResourceGroup; @@ -39,7 +40,7 @@ import org.apache.fop.afp.modca.StreamedResourceGroup; */ public class AFPStreamer implements Streamable { /** Static logging instance */ - private static final Log log = LogFactory.getLog(AFPStreamer.class); // CSOK: ConstantName + private static final Log LOG = LogFactory.getLog(AFPStreamer.class); private static final String AFPDATASTREAM_TEMP_FILE_PREFIX = "AFPDataStream_"; @@ -119,7 +120,7 @@ public class AFPStreamer implements Streamable { if (level.isExternal()) { String filePath = level.getExternalFilePath(); if (filePath == null) { - log.warn("No file path provided for external resource, using default."); + LOG.warn("No file path provided for external resource, using default."); filePath = defaultResourceGroupFilePath; } resourceGroup = (ResourceGroup)pathResourceGroupMap.get(filePath); @@ -128,7 +129,7 @@ public class AFPStreamer implements Streamable { try { os = new BufferedOutputStream(new FileOutputStream(filePath)); } catch (FileNotFoundException fnfe) { - log.error("Failed to create/open external resource group file '" + LOG.error("Failed to create/open external resource group file '" + filePath + "'"); } finally { if (os != null) { diff --git a/src/java/org/apache/fop/afp/DataStream.java b/src/java/org/apache/fop/afp/DataStream.java index 096c2e60e..843e3fa65 100644 --- a/src/java/org/apache/fop/afp/DataStream.java +++ b/src/java/org/apache/fop/afp/DataStream.java @@ -30,8 +30,8 @@ import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.fop.afp.fonts.AFPFontAttributes; import org.apache.fop.afp.fonts.AFPFont; +import org.apache.fop.afp.fonts.AFPFontAttributes; import org.apache.fop.afp.fonts.CharacterSet; import org.apache.fop.afp.modca.AbstractPageObject; import org.apache.fop.afp.modca.Document; @@ -42,10 +42,10 @@ import org.apache.fop.afp.modca.PageObject; import org.apache.fop.afp.modca.ResourceGroup; import org.apache.fop.afp.modca.TagLogicalElementBean; import org.apache.fop.afp.modca.triplets.FullyQualifiedNameTriplet; -import org.apache.fop.afp.ptoca.PtocaProducer; import org.apache.fop.afp.ptoca.PtocaBuilder; -import org.apache.fop.util.CharUtilities; +import org.apache.fop.afp.ptoca.PtocaProducer; import org.apache.fop.fonts.Font; +import org.apache.fop.util.CharUtilities; /** * A data stream is a continuous ordered stream of data elements and objects @@ -65,8 +65,7 @@ import org.apache.fop.fonts.Font; public class DataStream { /** Static logging instance */ - protected static final Log log // CSOK: ConstantName - = LogFactory.getLog("org.apache.xmlgraphics.afp"); + protected static final Log LOG = LogFactory.getLog("org.apache.xmlgraphics.afp"); /** Boolean completion indicator */ private boolean complete = false; @@ -163,7 +162,7 @@ public class DataStream { public void endDocument() throws IOException { if (complete) { String msg = "Invalid state - document already ended."; - log.warn("endDocument():: " + msg); + LOG.warn("endDocument():: " + msg); throw new IllegalStateException(msg); } @@ -357,7 +356,7 @@ public class DataStream { * @param letterSpacing letter spacing to draw text with * @param wordSpacing word Spacing to draw text with * @param font is the font to draw text with - * @param charSet is the AFP Character Set to use with the text + * @param charSet is the AFP Character Set to use with the text * @throws UnsupportedEncodingException thrown if character encoding is not supported */ public void createText diff --git a/src/java/org/apache/fop/afp/Factory.java b/src/java/org/apache/fop/afp/Factory.java index f29453cf5..ef68a22fb 100644 --- a/src/java/org/apache/fop/afp/Factory.java +++ b/src/java/org/apache/fop/afp/Factory.java @@ -21,8 +21,6 @@ package org.apache.fop.afp; import java.io.OutputStream; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.apache.fop.afp.goca.GraphicsData; import org.apache.fop.afp.ioca.ImageContent; import org.apache.fop.afp.ioca.ImageRasterData; @@ -65,9 +63,6 @@ import org.apache.fop.afp.util.StringUtils; */ public class Factory { - /** Static logging instance */ - private static final Log log = LogFactory.getLog(Factory.class); // CSOK: ConstantName - private static final String OBJECT_ENVIRONMENT_GROUP_NAME_PREFIX = "OEG"; private static final String ACTIVE_ENVIRONMENT_GROUP_NAME_PREFIX = "AEG"; diff --git a/src/java/org/apache/fop/afp/fonts/CharacterSet.java b/src/java/org/apache/fop/afp/fonts/CharacterSet.java index 22cb52d4d..7123d4138 100644 --- a/src/java/org/apache/fop/afp/fonts/CharacterSet.java +++ b/src/java/org/apache/fop/afp/fonts/CharacterSet.java @@ -21,7 +21,6 @@ package org.apache.fop.afp.fonts; import java.io.File; import java.io.UnsupportedEncodingException; -import java.net.URI; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharacterCodingException; diff --git a/src/java/org/apache/fop/afp/fonts/RasterFont.java b/src/java/org/apache/fop/afp/fonts/RasterFont.java index 6ad5375bf..2a4d5d270 100644 --- a/src/java/org/apache/fop/afp/fonts/RasterFont.java +++ b/src/java/org/apache/fop/afp/fonts/RasterFont.java @@ -37,8 +37,7 @@ import org.apache.commons.logging.LogFactory; public class RasterFont extends AFPFont { /** Static logging instance */ - protected static final Log log // CSOK: ConstantName - = LogFactory.getLog("org.apache.fop.afp.fonts"); + protected static final Log LOG = LogFactory.getLog("org.apache.fop.afp.fonts"); private final SortedMap/**/ charSets = new java.util.TreeMap/**/(); @@ -118,7 +117,7 @@ public class RasterFont extends AFPFont { substitutionCharSets.put(requestedSize, csm); String msg = "No " + (size / 1000f) + "pt font " + getFontName() + " found, substituted with " + fontSize.intValue() / 1000f + "pt font"; - log.warn(msg); + LOG.warn(msg); } } @@ -126,7 +125,7 @@ public class RasterFont extends AFPFont { // Still no match -> error String msg = "No font found for font " + getFontName() + " with point size " + size / 1000f; - log.error(msg); + LOG.error(msg); throw new FontRuntimeException(msg); } @@ -145,7 +144,7 @@ public class RasterFont extends AFPFont { return csm.getFirstChar(); } else { String msg = "getFirstChar() - No character set found for font:" + getFontName(); - log.error(msg); + LOG.error(msg); throw new FontRuntimeException(msg); } } @@ -162,7 +161,7 @@ public class RasterFont extends AFPFont { return csm.getLastChar(); } else { String msg = "getLastChar() - No character set found for font:" + getFontName(); - log.error(msg); + LOG.error(msg); throw new FontRuntimeException(msg); } diff --git a/src/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java b/src/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java index 4d45b22cb..aba02f76c 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java +++ b/src/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java @@ -75,7 +75,7 @@ public class GraphicsSetProcessColor extends AbstractGraphicsDrawingOrder { } else if (colSpaceType == ColorSpace.TYPE_RGB) { colspace = RGB; } else { - log.error("unsupported colorspace " + colSpaceType); + LOG.error("unsupported colorspace " + colSpaceType); colspace = RGB; } diff --git a/src/java/org/apache/fop/afp/modca/AbstractAFPObject.java b/src/java/org/apache/fop/afp/modca/AbstractAFPObject.java index be92ce0b6..4b1439da0 100644 --- a/src/java/org/apache/fop/afp/modca/AbstractAFPObject.java +++ b/src/java/org/apache/fop/afp/modca/AbstractAFPObject.java @@ -27,6 +27,7 @@ import java.util.Iterator; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.apache.fop.afp.Streamable; import org.apache.fop.afp.util.BinaryUtils; @@ -38,8 +39,7 @@ import org.apache.fop.afp.util.BinaryUtils; public abstract class AbstractAFPObject implements Streamable { /** Static logging instance */ - protected static final Log log // CSOK: ConstantName - = LogFactory.getLog("org.apache.xmlgraphics.afp.modca"); + protected static final Log LOG = LogFactory.getLog("org.apache.xmlgraphics.afp.modca"); /** the structured field class id */ protected static final byte SF_CLASS = (byte)0xD3; @@ -189,7 +189,7 @@ public abstract class AbstractAFPObject implements Streamable { protected String truncate(String str, int maxLength) { if (str.length() > maxLength) { str = str.substring(0, maxLength); - log.warn("truncated character string '" + LOG.warn("truncated character string '" + str + "', longer than " + maxLength + " chars"); } return str; diff --git a/src/java/org/apache/fop/afp/modca/AbstractEnvironmentGroup.java b/src/java/org/apache/fop/afp/modca/AbstractEnvironmentGroup.java index 19f2c94a3..d06311a47 100644 --- a/src/java/org/apache/fop/afp/modca/AbstractEnvironmentGroup.java +++ b/src/java/org/apache/fop/afp/modca/AbstractEnvironmentGroup.java @@ -73,7 +73,7 @@ public abstract class AbstractEnvironmentGroup extends AbstractNamedAFPObject { mpo.addOverlay(name); } catch (MaximumSizeExceededException ex) { // Should never happen (but log just in case) - log.error("createOverlay():: resulted in a MaximumSizeExceededException"); + LOG.error("createOverlay():: resulted in a MaximumSizeExceededException"); } } } diff --git a/src/java/org/apache/fop/afp/modca/AbstractNamedAFPObject.java b/src/java/org/apache/fop/afp/modca/AbstractNamedAFPObject.java index 4e0dbc349..b349e1f7d 100644 --- a/src/java/org/apache/fop/afp/modca/AbstractNamedAFPObject.java +++ b/src/java/org/apache/fop/afp/modca/AbstractNamedAFPObject.java @@ -73,7 +73,7 @@ public abstract class AbstractNamedAFPObject extends AbstractTripletStructuredOb name = (name + " ").substring(0, afpNameLen); } else if (name.length() > afpNameLen) { String truncatedName = name.substring(nameLen - afpNameLen, nameLen); - log.warn("Constructor:: name '" + name + "'" + LOG.warn("Constructor:: name '" + name + "'" + " truncated to " + afpNameLen + " chars" + " ('" + truncatedName + "')"); name = truncatedName; @@ -83,7 +83,7 @@ public abstract class AbstractNamedAFPObject extends AbstractTripletStructuredOb nameBytes = name.getBytes(AFPConstants.EBCIDIC_ENCODING); } catch (UnsupportedEncodingException usee) { nameBytes = name.getBytes(); - log.warn( + LOG.warn( "Constructor:: UnsupportedEncodingException translating the name " + name); } diff --git a/src/java/org/apache/fop/afp/modca/AbstractTripletStructuredObject.java b/src/java/org/apache/fop/afp/modca/AbstractTripletStructuredObject.java index efc38f3b8..4b269086e 100644 --- a/src/java/org/apache/fop/afp/modca/AbstractTripletStructuredObject.java +++ b/src/java/org/apache/fop/afp/modca/AbstractTripletStructuredObject.java @@ -27,8 +27,6 @@ import java.util.List; import org.apache.fop.afp.modca.Registry.ObjectType; import org.apache.fop.afp.modca.triplets.AbstractTriplet; -import org.apache.fop.afp.modca.triplets.AttributeQualifierTriplet; -import org.apache.fop.afp.modca.triplets.AttributeValueTriplet; import org.apache.fop.afp.modca.triplets.CommentTriplet; import org.apache.fop.afp.modca.triplets.FullyQualifiedNameTriplet; import org.apache.fop.afp.modca.triplets.ObjectClassificationTriplet; @@ -150,7 +148,7 @@ public class AbstractTripletStructuredObject extends AbstractStructuredObject { if (fqNameTriplet != null) { return fqNameTriplet.getFullyQualifiedName(); } - log.warn(this + " has no fully qualified name"); + LOG.warn(this + " has no fully qualified name"); return null; } diff --git a/src/java/org/apache/fop/afp/modca/ActiveEnvironmentGroup.java b/src/java/org/apache/fop/afp/modca/ActiveEnvironmentGroup.java index 4af687a92..696787bc4 100644 --- a/src/java/org/apache/fop/afp/modca/ActiveEnvironmentGroup.java +++ b/src/java/org/apache/fop/afp/modca/ActiveEnvironmentGroup.java @@ -185,7 +185,7 @@ public final class ActiveEnvironmentGroup extends AbstractEnvironmentGroup { mapCodedFont.addFont(fontRef, font, size, orientation); } catch (MaximumSizeExceededException ex) { // Should never happen (but log just in case) - log.error("createFont():: resulted in a MaximumSizeExceededException"); + LOG.error("createFont():: resulted in a MaximumSizeExceededException"); } } } diff --git a/src/java/org/apache/fop/afp/modca/MapCodedFont.java b/src/java/org/apache/fop/afp/modca/MapCodedFont.java index 8d99d8eaa..69d8ccf31 100644 --- a/src/java/org/apache/fop/afp/modca/MapCodedFont.java +++ b/src/java/org/apache/fop/afp/modca/MapCodedFont.java @@ -180,7 +180,7 @@ public class MapCodedFont extends AbstractStructuredObject { if (cs == null) { String msg = "Character set not found for font " + font.getFontName() + " with point size " + size; - log.error(msg); + LOG.error(msg); throw new FontRuntimeException(msg); } @@ -243,7 +243,7 @@ public class MapCodedFont extends AbstractStructuredObject { } else { String msg = "Font of type " + font.getClass().getName() + " not recognized."; - log.error(msg); + LOG.error(msg); throw new FontRuntimeException(msg); } diff --git a/src/java/org/apache/fop/afp/modca/MapPageOverlay.java b/src/java/org/apache/fop/afp/modca/MapPageOverlay.java index 9fd3c7059..6f5855c93 100644 --- a/src/java/org/apache/fop/afp/modca/MapPageOverlay.java +++ b/src/java/org/apache/fop/afp/modca/MapPageOverlay.java @@ -69,14 +69,14 @@ public class MapPageOverlay extends AbstractAFPObject { throw new IllegalArgumentException("The name of overlay " + name + " must be 8 characters"); } - if (log.isDebugEnabled()) { - log.debug("addOverlay():: adding overlay " + name); + if (LOG.isDebugEnabled()) { + LOG.debug("addOverlay():: adding overlay " + name); } try { byte[] data = name.getBytes(AFPConstants.EBCIDIC_ENCODING); getOverlays().add(data); } catch (UnsupportedEncodingException usee) { - log.error("addOverlay():: UnsupportedEncodingException translating the name " + LOG.error("addOverlay():: UnsupportedEncodingException translating the name " + name); } } diff --git a/src/java/org/apache/fop/afp/modca/MapPageSegment.java b/src/java/org/apache/fop/afp/modca/MapPageSegment.java index e2afd0257..8bb7afe46 100644 --- a/src/java/org/apache/fop/afp/modca/MapPageSegment.java +++ b/src/java/org/apache/fop/afp/modca/MapPageSegment.java @@ -67,8 +67,8 @@ public class MapPageSegment extends AbstractAFPObject { throw new IllegalArgumentException("The name of page segment " + name + " must not be longer than 8 characters"); } - if (log.isDebugEnabled()) { - log.debug("addPageSegment():: adding page segment " + name); + if (LOG.isDebugEnabled()) { + LOG.debug("addPageSegment():: adding page segment " + name); } getPageSegments().add(name); } @@ -124,7 +124,7 @@ public class MapPageSegment extends AbstractAFPObject { byte[] nameBytes = name.getBytes(AFPConstants.EBCIDIC_ENCODING); System.arraycopy(nameBytes, 0, data, pos, nameBytes.length); } catch (UnsupportedEncodingException usee) { - log.error("UnsupportedEncodingException translating the name " + LOG.error("UnsupportedEncodingException translating the name " + name); } pos += 8; diff --git a/src/java/org/apache/fop/afp/ptoca/LineDataInfoProducer.java b/src/java/org/apache/fop/afp/ptoca/LineDataInfoProducer.java index ad2a5d716..cf00674fb 100644 --- a/src/java/org/apache/fop/afp/ptoca/LineDataInfoProducer.java +++ b/src/java/org/apache/fop/afp/ptoca/LineDataInfoProducer.java @@ -32,8 +32,7 @@ import org.apache.fop.afp.AFPLineDataInfo; public class LineDataInfoProducer implements PtocaProducer, PtocaConstants { /** Static logging instance */ - private static final Log log // CSOK: ConstantName - = LogFactory.getLog(LineDataInfoProducer.class); + private static final Log LOG = LogFactory.getLog(LineDataInfoProducer.class); private AFPLineDataInfo lineDataInfo; @@ -62,7 +61,7 @@ public class LineDataInfoProducer implements PtocaProducer, PtocaConstants { } else if (x1 == x2) { builder.drawBaxisRule(y2 - y1, thickness); } else { - log.error("Invalid axis rule: unable to draw line"); + LOG.error("Invalid axis rule: unable to draw line"); return; } } diff --git a/src/java/org/apache/fop/afp/svg/AFPGraphicsConfiguration.java b/src/java/org/apache/fop/afp/svg/AFPGraphicsConfiguration.java index b8ed5159a..0a051e675 100644 --- a/src/java/org/apache/fop/afp/svg/AFPGraphicsConfiguration.java +++ b/src/java/org/apache/fop/afp/svg/AFPGraphicsConfiguration.java @@ -109,7 +109,7 @@ public class AFPGraphicsConfiguration extends GraphicsConfiguration { } } - private static final Log log // CSOK: ConstantName + private static final Log LOG = LogFactory.getLog(AFPGraphicsConfiguration.class); private AffineTransform defaultTransform = null; @@ -122,7 +122,7 @@ public class AFPGraphicsConfiguration extends GraphicsConfiguration { * @return the default transform for the configuration */ public AffineTransform getDefaultTransform() { - log.debug("getDefaultTransform()"); + LOG.debug("getDefaultTransform()"); if (defaultTransform == null) { defaultTransform = new AffineTransform(); } @@ -137,7 +137,7 @@ public class AFPGraphicsConfiguration extends GraphicsConfiguration { * @return the normalizing transform for the configuration */ public AffineTransform getNormalizingTransform() { - log.debug("getNormalizingTransform()"); + LOG.debug("getNormalizingTransform()"); if (normalizingTransform == null) { normalizingTransform = new AffineTransform(2, 0, 0, 2, 0, 0); } @@ -146,7 +146,7 @@ public class AFPGraphicsConfiguration extends GraphicsConfiguration { /** {@inheritDoc} */ public GraphicsDevice getDevice() { - log.debug("getDevice()"); + LOG.debug("getDevice()"); return graphicsDevice; } } diff --git a/src/java/org/apache/fop/area/IDTracker.java b/src/java/org/apache/fop/area/IDTracker.java index c0607d1bd..829c8c58d 100644 --- a/src/java/org/apache/fop/area/IDTracker.java +++ b/src/java/org/apache/fop/area/IDTracker.java @@ -34,8 +34,7 @@ import org.apache.commons.logging.LogFactory; */ public class IDTracker { - private static final Log log // CSOK: ConstantName - = LogFactory.getLog(IDTracker.class); + private static final Log LOG = LogFactory.getLog(IDTracker.class); // HashMap of ID's whose area is located on one or more consecutive // PageViewports. Each ID has an arraylist of PageViewports that @@ -59,8 +58,8 @@ public class IDTracker { * @param pv a page viewport that contains the area with this ID */ public void associateIDWithPageViewport(String id, PageViewport pv) { - if (log.isDebugEnabled()) { - log.debug("associateIDWithPageViewport(" + id + ", " + pv + ")"); + if (LOG.isDebugEnabled()) { + LOG.debug("associateIDWithPageViewport(" + id + ", " + pv + ")"); } List pvList = (List) idLocations.get(id); if (pvList == null) { // first time ID located @@ -93,8 +92,8 @@ public class IDTracker { * @param id the id of the object being processed */ public void signalPendingID(String id) { - if (log.isDebugEnabled()) { - log.debug("signalPendingID(" + id + ")"); + if (LOG.isDebugEnabled()) { + LOG.debug("signalPendingID(" + id + ")"); } unfinishedIDs.add(id); } @@ -107,8 +106,8 @@ public class IDTracker { * @param id the id of the formatting object which was just finished */ public void signalIDProcessed(String id) { - if (log.isDebugEnabled()) { - log.debug("signalIDProcessed(" + id + ")"); + if (LOG.isDebugEnabled()) { + LOG.debug("signalIDProcessed(" + id + ")"); } alreadyResolvedIDs.add(id); diff --git a/src/java/org/apache/fop/events/model/EventModelParser.java b/src/java/org/apache/fop/events/model/EventModelParser.java index be7c61790..5441d1c4f 100644 --- a/src/java/org/apache/fop/events/model/EventModelParser.java +++ b/src/java/org/apache/fop/events/model/EventModelParser.java @@ -46,8 +46,7 @@ public final class EventModelParser { } /** Logger instance */ - private static final Log log // CSOK: ConstantName - = LogFactory.getLog(EventModelParser.class); + private static final Log LOG = LogFactory.getLog(EventModelParser.class); private static SAXTransformerFactory tFactory = (SAXTransformerFactory)SAXTransformerFactory.newInstance(); @@ -61,7 +60,7 @@ public final class EventModelParser { public static EventModel parse(Source src) throws TransformerException { Transformer transformer = tFactory.newTransformer(); - transformer.setErrorListener(new DefaultErrorListener(log)); + transformer.setErrorListener(new DefaultErrorListener(LOG)); EventModel model = new EventModel(); SAXResult res = new SAXResult(getContentHandler(model)); diff --git a/src/java/org/apache/fop/fo/FOEventHandler.java b/src/java/org/apache/fop/fo/FOEventHandler.java index 238a4ced6..e280af2d7 100644 --- a/src/java/org/apache/fop/fo/FOEventHandler.java +++ b/src/java/org/apache/fop/fo/FOEventHandler.java @@ -40,11 +40,10 @@ import org.apache.fop.fo.flow.PageNumberCitation; import org.apache.fop.fo.flow.PageNumberCitationLast; import org.apache.fop.fo.flow.table.Table; import org.apache.fop.fo.flow.table.TableBody; -import org.apache.fop.fo.flow.table.TableFooter; -import org.apache.fop.fo.flow.table.TableHeader; -import org.apache.fop.fo.flow.table.TablePart; import org.apache.fop.fo.flow.table.TableCell; import org.apache.fop.fo.flow.table.TableColumn; +import org.apache.fop.fo.flow.table.TableFooter; +import org.apache.fop.fo.flow.table.TableHeader; import org.apache.fop.fo.flow.table.TableRow; import org.apache.fop.fo.pagination.Flow; import org.apache.fop.fo.pagination.PageSequence; diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index 244013c4d..cb265b008 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -44,7 +44,7 @@ import org.apache.fop.fo.properties.PropertyMaker; public abstract class FObj extends FONode implements Constants { /** the list of property makers */ - private static final PropertyMaker[] propertyListTable // CSOK: ConstantName + private static final PropertyMaker[] PROPERTY_LIST_TABLE = FOPropertyMapping.getGenericMappings(); /** @@ -108,7 +108,7 @@ public abstract class FObj extends FONode implements Constants { * @return the requested Property Maker */ public static PropertyMaker getPropertyMakerFor(int propId) { - return propertyListTable[propId]; + return PROPERTY_LIST_TABLE[propId]; } /** {@inheritDoc} */ diff --git a/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java b/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java index 32d0d745c..a12bed0fa 100644 --- a/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java @@ -37,18 +37,18 @@ public class ExtensionElementMapping extends ElementMapping { /** The FOP extension namespace URI */ public static final String URI = "http://xmlgraphics.apache.org/fop/extensions"; - private static final Set propertyAttributes // CSOK: ConstantName + private static final Set PROPERTY_ATTRIBUTES = new java.util.HashSet(); static { //These are FOP's standard extension properties (fox:*) - propertyAttributes.add("block-progression-unit"); - propertyAttributes.add("widow-content-limit"); - propertyAttributes.add("orphan-content-limit"); - propertyAttributes.add("internal-destination"); - propertyAttributes.add("disable-column-balancing"); + PROPERTY_ATTRIBUTES.add("block-progression-unit"); + PROPERTY_ATTRIBUTES.add("widow-content-limit"); + PROPERTY_ATTRIBUTES.add("orphan-content-limit"); + PROPERTY_ATTRIBUTES.add("internal-destination"); + PROPERTY_ATTRIBUTES.add("disable-column-balancing"); //These are FOP's extension properties for accessibility - propertyAttributes.add("alt-text"); + PROPERTY_ATTRIBUTES.add("alt-text"); } /** @@ -93,7 +93,7 @@ public class ExtensionElementMapping extends ElementMapping { if (!URI.equals(attributeName.getNamespaceURI())) { throw new IllegalArgumentException("The namespace URIs don't match"); } - return propertyAttributes.contains(attributeName.getLocalName()); + return PROPERTY_ATTRIBUTES.contains(attributeName.getLocalName()); } } diff --git a/src/java/org/apache/fop/fo/flow/Marker.java b/src/java/org/apache/fop/fo/flow/Marker.java index e23a13f33..d8f69af28 100644 --- a/src/java/org/apache/fop/fo/flow/Marker.java +++ b/src/java/org/apache/fop/fo/flow/Marker.java @@ -19,7 +19,6 @@ package org.apache.fop.fo.flow; -import java.util.Collections; import java.util.Map; import org.xml.sax.Attributes; diff --git a/src/java/org/apache/fop/fo/pagination/Region.java b/src/java/org/apache/fop/fo/pagination/Region.java index 6f94418be..ea449cdff 100644 --- a/src/java/org/apache/fop/fo/pagination/Region.java +++ b/src/java/org/apache/fop/fo/pagination/Region.java @@ -31,7 +31,6 @@ import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.ValidationException; -import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.properties.CommonBorderPaddingBackground; /** diff --git a/src/java/org/apache/fop/fo/properties/CharacterProperty.java b/src/java/org/apache/fop/fo/properties/CharacterProperty.java index 71b70ebee..5fef57a8b 100644 --- a/src/java/org/apache/fop/fo/properties/CharacterProperty.java +++ b/src/java/org/apache/fop/fo/properties/CharacterProperty.java @@ -51,7 +51,7 @@ public final class CharacterProperty extends Property { } /** cache containing all canonical CharacterProperty instances */ - private static final PropertyCache cache // CSOK: ConstantName + private static final PropertyCache CACHE = new PropertyCache(CharacterProperty.class); private final char character; @@ -69,7 +69,7 @@ public final class CharacterProperty extends Property { * @return the character property instance */ public static CharacterProperty getInstance(char character) { - return (CharacterProperty) cache.fetch( + return (CharacterProperty) CACHE.fetch( new CharacterProperty(character)); } diff --git a/src/java/org/apache/fop/fo/properties/ColorProperty.java b/src/java/org/apache/fop/fo/properties/ColorProperty.java index 95725f3e8..e7b8d5931 100644 --- a/src/java/org/apache/fop/fo/properties/ColorProperty.java +++ b/src/java/org/apache/fop/fo/properties/ColorProperty.java @@ -33,7 +33,7 @@ import org.apache.fop.util.ColorUtil; public final class ColorProperty extends Property { /** cache holding canonical ColorProperty instances */ - private static final PropertyCache cache // CSOK: ConstantName + private static final PropertyCache CACHE = new PropertyCache(ColorProperty.class); /** @@ -103,7 +103,7 @@ public final class ColorProperty extends Property { ColorProperty instance = new ColorProperty( ColorUtil.parseColorString( foUserAgent, value)); - return (ColorProperty)cache.fetch(instance); + return (ColorProperty)CACHE.fetch(instance); } /** diff --git a/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java b/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java index b3ae7d8cd..d39dc24f0 100644 --- a/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java +++ b/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java @@ -48,7 +48,7 @@ public class CommonBorderPaddingBackground { // CSOK: FinalCl * cache holding all canonical instances * (w/ absolute background-position-* and padding-*) */ - private static final PropertyCache cache // CSOK: ConstantName + private static final PropertyCache CACHE = new PropertyCache(CommonBorderPaddingBackground.class); private int hash = -1; @@ -102,7 +102,7 @@ public class CommonBorderPaddingBackground { // CSOK: FinalCl public static final class BorderInfo { /** cache holding all canonical instances */ - private static final PropertyCache cache // CSOK: ConstantName + private static final PropertyCache CACHE = new PropertyCache(BorderInfo.class); private int mStyle; // Enum for border style @@ -129,7 +129,7 @@ public class CommonBorderPaddingBackground { // CSOK: FinalCl * @return a cached BorderInfo instance */ public static BorderInfo getInstance(int style, CondLengthProperty width, Color color) { - return cache.fetch(new BorderInfo(style, width, color)); + return CACHE.fetch(new BorderInfo(style, width, color)); } /** @@ -214,7 +214,7 @@ public class CommonBorderPaddingBackground { // CSOK: FinalCl * A border info with style "none". Used as a singleton, in the collapsing-border model, * for elements which don't specify any border on some of their sides. */ - private static final BorderInfo defaultBorderInfo // CSOK: ConstantName + private static final BorderInfo DEFAULT_BORDER_INFO = BorderInfo.getInstance(Constants.EN_NONE, new ConditionalNullLength(), null); /** @@ -276,7 +276,7 @@ public class CommonBorderPaddingBackground { // CSOK: FinalCl * @return a BorderInfo instance with style set to {@link Constants#EN_NONE} */ public static BorderInfo getDefaultBorderInfo() { - return defaultBorderInfo; + return DEFAULT_BORDER_INFO; } private BorderInfo[] borderInfo = new BorderInfo[4]; @@ -366,7 +366,7 @@ public class CommonBorderPaddingBackground { // CSOK: FinalCl || newInstance.backgroundPositionHorizontal.isAbsolute()) && (newInstance.backgroundPositionVertical == null || newInstance.backgroundPositionVertical.isAbsolute())) { - cachedInstance = cache.fetch(newInstance); + cachedInstance = CACHE.fetch(newInstance); } /* for non-cached, or not-yet-cached instances, preload the image */ diff --git a/src/java/org/apache/fop/fo/properties/CommonFont.java b/src/java/org/apache/fop/fo/properties/CommonFont.java index f3f7d3f69..b12f84ad2 100644 --- a/src/java/org/apache/fop/fo/properties/CommonFont.java +++ b/src/java/org/apache/fop/fo/properties/CommonFont.java @@ -37,7 +37,7 @@ public final class CommonFont { /** cache holding canonical CommonFont instances (only those with * absolute font-size and font-size-adjust) */ - private static final PropertyCache cache // CSOK: ConstantName + private static final PropertyCache CACHE = new PropertyCache(CommonFont.class); /** hashcode of this instance */ @@ -129,7 +129,7 @@ public final class CommonFont { fontSize, fontSizeAdjust); - return cache.fetch(commonFont); + return CACHE.fetch(commonFont); } /** @return an array with the font-family names */ diff --git a/src/java/org/apache/fop/fo/properties/CommonHyphenation.java b/src/java/org/apache/fop/fo/properties/CommonHyphenation.java index c65b5b616..65b2cebbd 100644 --- a/src/java/org/apache/fop/fo/properties/CommonHyphenation.java +++ b/src/java/org/apache/fop/fo/properties/CommonHyphenation.java @@ -36,11 +36,9 @@ import org.apache.fop.fonts.Typeface; public final class CommonHyphenation { /** Logger */ - private static final Log log // CSOK: ConstantName - = LogFactory.getLog(CommonHyphenation.class); + private static final Log LOG = LogFactory.getLog(CommonHyphenation.class); - private static final PropertyCache cache // CSOK: ConstantName - = new PropertyCache(CommonHyphenation.class); + private static final PropertyCache CACHE = new PropertyCache(CommonHyphenation.class); private int hash = 0; @@ -119,7 +117,7 @@ public final class CommonHyphenation { hyphenationPushCharacterCount, hyphenationRemainCharacterCount); - return cache.fetch(instance); + return CACHE.fetch(instance); } @@ -168,7 +166,7 @@ public final class CommonHyphenation { } } if (warn) { - log.warn("Substituted specified hyphenation character (0x" + LOG.warn("Substituted specified hyphenation character (0x" + Integer.toHexString(hyphChar) + ") with 0x" + Integer.toHexString(effHyphChar) + " because the font doesn't have the specified hyphenation character: " diff --git a/src/java/org/apache/fop/fo/properties/CondLengthProperty.java b/src/java/org/apache/fop/fo/properties/CondLengthProperty.java index dc7d80c39..1ab7ec3ad 100644 --- a/src/java/org/apache/fop/fo/properties/CondLengthProperty.java +++ b/src/java/org/apache/fop/fo/properties/CondLengthProperty.java @@ -33,7 +33,7 @@ import org.apache.fop.fo.expr.PropertyException; public class CondLengthProperty extends Property implements CompoundDatatype { /** cache holding canonical instances (for absolute conditional lengths) */ - private static final PropertyCache cache // CSOK: ConstantName + private static final PropertyCache CACHE = new PropertyCache(CondLengthProperty.class); /** components */ @@ -159,7 +159,7 @@ public class CondLengthProperty extends Property implements CompoundDatatype { */ public CondLengthProperty getCondLength() { if (this.length.getLength().isAbsolute()) { - CondLengthProperty clp = (CondLengthProperty) cache.fetch(this); + CondLengthProperty clp = (CondLengthProperty) CACHE.fetch(this); if (clp == this) { isCached = true; } diff --git a/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java b/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java index 18c6f09a6..6183b9e56 100644 --- a/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java @@ -19,12 +19,12 @@ package org.apache.fop.fo.properties; -import org.apache.fop.apps.FOPException; import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.expr.PropertyException; /** + * Maker class for handling corresponding properties. */ public class CorrespondingPropertyMaker { /** base property maker */ diff --git a/src/java/org/apache/fop/fo/properties/EnumNumber.java b/src/java/org/apache/fop/fo/properties/EnumNumber.java index 6a2879479..153a716df 100644 --- a/src/java/org/apache/fop/fo/properties/EnumNumber.java +++ b/src/java/org/apache/fop/fo/properties/EnumNumber.java @@ -29,7 +29,7 @@ import org.apache.fop.fo.expr.PropertyException; public final class EnumNumber extends Property implements Numeric { /** cache holding all canonical EnumNumber instances */ - private static final PropertyCache cache // CSOK: ConstantName + private static final PropertyCache CACHE = new PropertyCache(EnumNumber.class); private final EnumProperty enumProperty; @@ -50,7 +50,7 @@ public final class EnumNumber extends Property implements Numeric { * @return the canonical instance */ public static EnumNumber getInstance(Property enumProperty) { - return (EnumNumber)cache.fetch( + return (EnumNumber)CACHE.fetch( new EnumNumber((EnumProperty) enumProperty)); } diff --git a/src/java/org/apache/fop/fo/properties/EnumProperty.java b/src/java/org/apache/fop/fo/properties/EnumProperty.java index db26cfdc6..ae704f1c9 100644 --- a/src/java/org/apache/fop/fo/properties/EnumProperty.java +++ b/src/java/org/apache/fop/fo/properties/EnumProperty.java @@ -29,7 +29,7 @@ import org.apache.fop.fo.expr.PropertyException; public final class EnumProperty extends Property { /** cache holding all canonical EnumProperty instances */ - private static final PropertyCache cache // CSOK: ConstantName + private static final PropertyCache CACHE = new PropertyCache(EnumProperty.class); /** @@ -93,7 +93,7 @@ public final class EnumProperty extends Property { * @return an enumeration property */ public static EnumProperty getInstance(int explicitValue, String text) { - return (EnumProperty) cache.fetch( + return (EnumProperty) CACHE.fetch( new EnumProperty(explicitValue, text)); } diff --git a/src/java/org/apache/fop/fo/properties/FixedLength.java b/src/java/org/apache/fop/fo/properties/FixedLength.java index cc4d04c69..c35c6f6c9 100644 --- a/src/java/org/apache/fop/fo/properties/FixedLength.java +++ b/src/java/org/apache/fop/fo/properties/FixedLength.java @@ -45,7 +45,7 @@ public final class FixedLength extends LengthProperty { public static final String MPT = "mpt"; /** cache holding all canonical FixedLength instances */ - private static final PropertyCache cache // CSOK: ConstantName + private static final PropertyCache CACHE = new PropertyCache(FixedLength.class); /** canonical zero-length instance */ @@ -82,7 +82,7 @@ public final class FixedLength extends LengthProperty { if (numUnits == 0.0) { return ZERO_FIXED_LENGTH; } else { - return (FixedLength)cache.fetch( + return (FixedLength)CACHE.fetch( new FixedLength(numUnits, units, sourceResolution)); } diff --git a/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java b/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java index 5b05aa959..330101ee7 100644 --- a/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java +++ b/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java @@ -31,7 +31,7 @@ import org.apache.fop.fo.expr.PropertyException; public final class FontFamilyProperty extends ListProperty { /** cache holding all canonical FontFamilyProperty instances */ - private static final PropertyCache cache // CSOK: ConstantName + private static final PropertyCache CACHE = new PropertyCache(FontFamilyProperty.class); private int hash = 0; @@ -95,7 +95,7 @@ public final class FontFamilyProperty extends ListProperty { prop.addProperty(StringProperty.getInstance(tmpVal)); } } - return cache.fetch(prop); + return CACHE.fetch(prop); } } diff --git a/src/java/org/apache/fop/fo/properties/KeepProperty.java b/src/java/org/apache/fop/fo/properties/KeepProperty.java index 7c5b6124f..0bc44e459 100644 --- a/src/java/org/apache/fop/fo/properties/KeepProperty.java +++ b/src/java/org/apache/fop/fo/properties/KeepProperty.java @@ -30,7 +30,7 @@ import org.apache.fop.fo.expr.PropertyException; public final class KeepProperty extends Property implements CompoundDatatype { /** class holding all canonical KeepProperty instances*/ - private static final PropertyCache cache // CSOK: ConstantName + private static final PropertyCache CACHE = new PropertyCache(KeepProperty.class); private boolean isCachedValue = false; @@ -165,7 +165,7 @@ public final class KeepProperty extends Property implements CompoundDatatype { * this property */ public KeepProperty getKeep() { - KeepProperty keep = (KeepProperty) cache.fetch(this); + KeepProperty keep = (KeepProperty) CACHE.fetch(this); /* make sure setComponent() can never alter cached values */ keep.isCachedValue = true; return keep; diff --git a/src/java/org/apache/fop/fo/properties/NumberProperty.java b/src/java/org/apache/fop/fo/properties/NumberProperty.java index d54161b8d..97844d723 100644 --- a/src/java/org/apache/fop/fo/properties/NumberProperty.java +++ b/src/java/org/apache/fop/fo/properties/NumberProperty.java @@ -106,7 +106,7 @@ public final class NumberProperty extends Property implements Numeric { } /** cache holding all canonical NumberProperty instances */ - private static final PropertyCache cache // CSOK: ConstantName + private static final PropertyCache CACHE = new PropertyCache(NumberProperty.class); private final Number number; @@ -144,7 +144,7 @@ public final class NumberProperty extends Property implements Numeric { * @return the canonical NumberProperty */ public static NumberProperty getInstance(Double num) { - return (NumberProperty)cache.fetch( + return (NumberProperty)CACHE.fetch( new NumberProperty(num.doubleValue())); } @@ -155,7 +155,7 @@ public final class NumberProperty extends Property implements Numeric { * @return the canonical NumberProperty */ public static NumberProperty getInstance(Integer num) { - return (NumberProperty)cache.fetch( + return (NumberProperty)CACHE.fetch( new NumberProperty(num.intValue())); } @@ -166,7 +166,7 @@ public final class NumberProperty extends Property implements Numeric { * @return the canonical NumberProperty */ public static NumberProperty getInstance(double num) { - return (NumberProperty)cache.fetch( + return (NumberProperty)CACHE.fetch( new NumberProperty(num)); } @@ -177,7 +177,7 @@ public final class NumberProperty extends Property implements Numeric { * @return the canonical NumberProperty */ public static NumberProperty getInstance(int num) { - return (NumberProperty)cache.fetch( + return (NumberProperty)CACHE.fetch( new NumberProperty(num)); } diff --git a/src/java/org/apache/fop/fo/properties/StringProperty.java b/src/java/org/apache/fop/fo/properties/StringProperty.java index ab4544c0a..9bbe33070 100644 --- a/src/java/org/apache/fop/fo/properties/StringProperty.java +++ b/src/java/org/apache/fop/fo/properties/StringProperty.java @@ -21,11 +21,6 @@ package org.apache.fop.fo.properties; import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; -import org.apache.fop.fo.FOValidationEventProducer; -import org.apache.fop.fo.ValidationException; -import org.apache.fop.fo.expr.PropertyException; - -import java.util.Set; /** * Exists primarily as a container for its Maker inner class, which is @@ -83,7 +78,7 @@ public final class StringProperty extends Property { } /** cache containing all canonical StringProperty instances */ - private static final PropertyCache cache // CSOK: ConstantName + private static final PropertyCache CACHE = new PropertyCache(StringProperty.class); /** canonical instance for empty strings */ @@ -109,7 +104,7 @@ public final class StringProperty extends Property { if ("".equals(str) || str == null) { return EMPTY_STRING_PROPERTY; } else { - return (StringProperty)cache.fetch( + return (StringProperty)CACHE.fetch( new StringProperty(str)); } } diff --git a/src/java/org/apache/fop/fonts/FontSetup.java b/src/java/org/apache/fop/fonts/FontSetup.java index 7ceef5a9c..1f49f7bb5 100644 --- a/src/java/org/apache/fop/fonts/FontSetup.java +++ b/src/java/org/apache/fop/fonts/FontSetup.java @@ -25,8 +25,6 @@ import java.util.List; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.apache.fop.fonts.base14.Courier; import org.apache.fop.fonts.base14.CourierBold; import org.apache.fop.fonts.base14.CourierBoldOblique; @@ -56,12 +54,6 @@ public final class FontSetup { private FontSetup() { } - /** - * logging instance - */ - private static Log log // CSOK: ConstantName - = LogFactory.getLog(FontSetup.class); - /** * Sets up a font info * @param fontInfo font info diff --git a/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java index a6fbdd49c..b8bbc0c6c 100644 --- a/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java +++ b/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java @@ -21,6 +21,7 @@ package org.apache.fop.layoutmgr; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.apache.fop.fo.Constants; import org.apache.fop.traits.MinOptMax; @@ -30,8 +31,7 @@ import org.apache.fop.traits.MinOptMax; */ public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm { - private static final Log log // CSOK: ConstantName - = LogFactory.getLog(BalancingColumnBreakingAlgorithm.class); + private static final Log LOG = LogFactory.getLog(BalancingColumnBreakingAlgorithm.class); private int columnCount; private int fullLen; @@ -74,8 +74,8 @@ public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm { protected double computeDemerits(KnuthNode activeNode, KnuthElement element, int fitnessClass, double r) { double dem = super.computeDemerits(activeNode, element, fitnessClass, r); - if (log.isTraceEnabled()) { - log.trace("original demerit=" + dem + " " + totalWidth + if (LOG.isTraceEnabled()) { + LOG.trace("original demerit=" + dem + " " + totalWidth + " line=" + activeNode.line + "/" + columnCount + " pos=" + activeNode.position + "/" + (par.size() - 1)); } @@ -91,13 +91,13 @@ public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm { if (remParts > 0) { avgRestLen = restLen / remParts; } - if (log.isTraceEnabled()) { - log.trace("remaining parts: " + remParts + " rest len: " + restLen + if (LOG.isTraceEnabled()) { + LOG.trace("remaining parts: " + remParts + " rest len: " + restLen + " avg=" + avgRestLen); } double balance = (idealPartLen - partLen) / 1000f; - if (log.isTraceEnabled()) { - log.trace("balance=" + balance); + if (LOG.isTraceEnabled()) { + LOG.trace("balance=" + balance); } double absBalance = Math.abs(balance); dem = absBalance; @@ -120,8 +120,8 @@ public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm { //We don't want more columns than available dem = Double.MAX_VALUE; } - if (log.isTraceEnabled()) { - log.trace("effective dem=" + dem + " " + totalWidth); + if (LOG.isTraceEnabled()) { + LOG.trace("effective dem=" + dem + " " + totalWidth); } return dem; } diff --git a/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java b/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java index 1a31f8d49..2acf67c1f 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java +++ b/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java @@ -67,14 +67,12 @@ import org.apache.fop.fo.pagination.SideRegion; import org.apache.fop.fo.pagination.StaticContent; import org.apache.fop.fo.pagination.Title; import org.apache.fop.layoutmgr.inline.BasicLinkLayoutManager; -import org.apache.fop.layoutmgr.inline.BidiLayoutManager; import org.apache.fop.layoutmgr.inline.CharacterLayoutManager; import org.apache.fop.layoutmgr.inline.ContentLayoutManager; import org.apache.fop.layoutmgr.inline.ExternalGraphicLayoutManager; import org.apache.fop.layoutmgr.inline.FootnoteLayoutManager; import org.apache.fop.layoutmgr.inline.ICLayoutManager; import org.apache.fop.layoutmgr.inline.InlineLayoutManager; -import org.apache.fop.layoutmgr.inline.InlineLevelLayoutManager; import org.apache.fop.layoutmgr.inline.InstreamForeignObjectLM; import org.apache.fop.layoutmgr.inline.LeaderLayoutManager; import org.apache.fop.layoutmgr.inline.PageNumberCitationLastLayoutManager; @@ -93,8 +91,7 @@ import org.apache.fop.util.CharUtilities; public class LayoutManagerMapping implements LayoutManagerMaker { /** logging instance */ - private static final Log log // CSOK: ConstantName - = LogFactory.getLog(LayoutManagerMapping.class); + private static final Log LOG = LogFactory.getLog(LayoutManagerMapping.class); /** The map of LayoutManagerMakers */ private Map makers = new HashMap(); @@ -159,10 +156,10 @@ public class LayoutManagerMapping implements LayoutManagerMaker { Maker maker = (Maker) makers.get(node.getClass()); if (maker == null) { if (FOElementMapping.URI.equals(node.getNamespaceURI())) { - log.error("No LayoutManager maker for class " + node.getClass()); + LOG.error("No LayoutManager maker for class " + node.getClass()); } else { - if (log.isDebugEnabled()) { - log.debug("Skipping the creation of a layout manager for " + node.getClass()); + if (LOG.isDebugEnabled()) { + LOG.debug("Skipping the creation of a layout manager for " + node.getClass()); } } } else { diff --git a/src/java/org/apache/fop/layoutmgr/SpaceResolver.java b/src/java/org/apache/fop/layoutmgr/SpaceResolver.java index c49bb2d9a..6890d4ebc 100644 --- a/src/java/org/apache/fop/layoutmgr/SpaceResolver.java +++ b/src/java/org/apache/fop/layoutmgr/SpaceResolver.java @@ -35,8 +35,7 @@ import org.apache.fop.traits.MinOptMax; public final class SpaceResolver { /** Logger instance */ - private static final Log log // CSOK: ConstantName - = LogFactory.getLog(SpaceResolver.class); + private static final Log LOG = LogFactory.getLog(SpaceResolver.class); private UnresolvedListElementWithLength[] firstPart; private BreakElement breakPoss; @@ -94,25 +93,25 @@ public final class SpaceResolver { //Add pending elements from higher level FOs if (breakPoss != null) { if (breakPoss.getPendingAfterMarks() != null) { - if (log.isTraceEnabled()) { - log.trace(" adding pending before break: " + if (LOG.isTraceEnabled()) { + LOG.trace(" adding pending before break: " + breakPoss.getPendingAfterMarks()); } first.addAll(0, breakPoss.getPendingAfterMarks()); } if (breakPoss.getPendingBeforeMarks() != null) { - if (log.isTraceEnabled()) { - log.trace(" adding pending after break: " + if (LOG.isTraceEnabled()) { + LOG.trace(" adding pending after break: " + breakPoss.getPendingBeforeMarks()); } second.addAll(0, breakPoss.getPendingBeforeMarks()); } } - if (log.isTraceEnabled()) { - log.trace("before: " + first); - log.trace(" break: " + breakPoss); - log.trace("after: " + second); - log.trace("NO-BREAK: " + toString(noBreak, noBreakLengths)); + if (LOG.isTraceEnabled()) { + LOG.trace("before: " + first); + LOG.trace(" break: " + breakPoss); + LOG.trace("after: " + second); + LOG.trace("NO-BREAK: " + toString(noBreak, noBreakLengths)); } if (first != null) { @@ -164,15 +163,15 @@ public final class SpaceResolver { if (elems[effIndex] instanceof BorderOrPaddingElement) { BorderOrPaddingElement bop = (BorderOrPaddingElement)elems[effIndex]; if (bop.isConditional() && !(bop.isFirst() || bop.isLast())) { - if (log.isDebugEnabled()) { - log.debug("Nulling conditional element: " + bop); + if (LOG.isDebugEnabled()) { + LOG.debug("Nulling conditional element: " + bop); } lengths[effIndex] = null; } } } - if (log.isTraceEnabled() && elems.length > 0) { - log.trace("-->Resulting list: " + toString(elems, lengths)); + if (LOG.isTraceEnabled() && elems.length > 0) { + LOG.trace("-->Resulting list: " + toString(elems, lengths)); } } @@ -194,20 +193,20 @@ public final class SpaceResolver { } else if (!elems[effIndex].isConditional()) { break; } - if (log.isDebugEnabled()) { - log.debug("Nulling conditional element using 4.3.1, rule 1: " + elems[effIndex]); + if (LOG.isDebugEnabled()) { + LOG.debug("Nulling conditional element using 4.3.1, rule 1: " + elems[effIndex]); } lengths[effIndex] = null; } - if (log.isTraceEnabled() && elems.length > 0) { - log.trace("-->Resulting list: " + toString(elems, lengths)); + if (LOG.isTraceEnabled() && elems.length > 0) { + LOG.trace("-->Resulting list: " + toString(elems, lengths)); } } private void performSpaceResolutionRules2to3(UnresolvedListElement[] elems, MinOptMax[] lengths, int start, int end) { - if (log.isTraceEnabled()) { - log.trace("rule 2-3: " + start + "-" + end); + if (LOG.isTraceEnabled()) { + LOG.trace("rule 2-3: " + start + "-" + end); } SpaceElement space; int remaining; @@ -236,8 +235,8 @@ public final class SpaceResolver { } space = (SpaceElement)elems[i]; if (!space.isForcing()) { - if (log.isDebugEnabled()) { - log.debug("Nulling non-forcing space-specifier using 4.3.1, rule 2: " + if (LOG.isDebugEnabled()) { + LOG.debug("Nulling non-forcing space-specifier using 4.3.1, rule 2: " + elems[i]); } lengths[i] = null; @@ -256,8 +255,8 @@ public final class SpaceResolver { space = (SpaceElement)elems[i]; highestPrecedence = Math.max(highestPrecedence, space.getPrecedence()); } - if (highestPrecedence != 0 && log.isDebugEnabled()) { - log.debug("Highest precedence is " + highestPrecedence); + if (highestPrecedence != 0 && LOG.isDebugEnabled()) { + LOG.debug("Highest precedence is " + highestPrecedence); } //Suppress space-specifiers with lower precedence remaining = 0; @@ -268,8 +267,8 @@ public final class SpaceResolver { } space = (SpaceElement)elems[i]; if (space.getPrecedence() != highestPrecedence) { - if (log.isDebugEnabled()) { - log.debug("Nulling space-specifier with precedence " + if (LOG.isDebugEnabled()) { + LOG.debug("Nulling space-specifier with precedence " + space.getPrecedence() + " using 4.3.1, rule 3: " + elems[i]); } @@ -279,8 +278,8 @@ public final class SpaceResolver { remaining++; } } - if (log.isDebugEnabled()) { - log.debug("Greatest optimum: " + greatestOptimum); + if (LOG.isDebugEnabled()) { + LOG.debug("Greatest optimum: " + greatestOptimum); } if (remaining <= 1) { return; @@ -293,8 +292,8 @@ public final class SpaceResolver { } space = (SpaceElement)elems[i]; if (space.getLength().getOpt() < greatestOptimum) { - if (log.isDebugEnabled()) { - log.debug("Nulling space-specifier with smaller optimum length " + if (LOG.isDebugEnabled()) { + LOG.debug("Nulling space-specifier with smaller optimum length " + "using 4.3.1, rule 3: " + elems[i]); } @@ -317,8 +316,8 @@ public final class SpaceResolver { min = Math.max(min, space.getLength().getMin()); max = Math.min(max, space.getLength().getMax()); if (remaining > 1) { - if (log.isDebugEnabled()) { - log.debug("Nulling non-last space-specifier using 4.3.1, rule 3, second part: " + if (LOG.isDebugEnabled()) { + LOG.debug("Nulling non-last space-specifier using 4.3.1, rule 3, second part: " + elems[i]); } lengths[i] = null; @@ -328,9 +327,9 @@ public final class SpaceResolver { } } - if (log.isTraceEnabled() && elems.length > 0) { - log.trace("Remaining spaces: " + remaining); - log.trace("-->Resulting list: " + toString(elems, lengths)); + if (LOG.isTraceEnabled() && elems.length > 0) { + LOG.trace("Remaining spaces: " + remaining); + LOG.trace("-->Resulting list: " + toString(elems, lengths)); } } @@ -390,7 +389,7 @@ public final class SpaceResolver { if (hasFirstPart()) { //Now that we've handled isFirst/isLast conditions, we need to look at the //active part in its normal order so swap it back. - log.trace("Swapping first and second parts."); + LOG.trace("Swapping first and second parts."); UnresolvedListElementWithLength[] tempList; MinOptMax[] tempLengths; tempList = secondPart; @@ -598,8 +597,8 @@ public final class SpaceResolver { * @param elems the element list */ public static void resolveElementList(List elems) { - if (log.isTraceEnabled()) { - log.trace(elems); + if (LOG.isTraceEnabled()) { + LOG.trace(elems); } boolean first = true; boolean last = false; @@ -611,8 +610,8 @@ public final class SpaceResolver { while (iter.hasNext()) { ListElement el = (ListElement)iter.next(); if (el.isUnresolvedElement()) { - if (log.isTraceEnabled()) { - log.trace("unresolved found: " + el + " " + first + "/" + last); + if (LOG.isTraceEnabled()) { + LOG.trace("unresolved found: " + el + " " + first + "/" + last); } BreakElement breakPoss = null; //Clear temp lists @@ -649,7 +648,7 @@ public final class SpaceResolver { } //last = !iter.hasNext(); if (breakPoss == null && unresolvedSecond.size() == 0 && !last) { - log.trace("Swap first and second parts in no-break condition," + LOG.trace("Swap first and second parts in no-break condition," + " second part is empty."); //The first list is reversed, so swap if this shouldn't happen List swapList = unresolvedSecond; @@ -657,7 +656,7 @@ public final class SpaceResolver { unresolvedFirst = swapList; } - log.debug("----start space resolution (first=" + first + ", last=" + last + ")..."); + LOG.debug("----start space resolution (first=" + first + ", last=" + last + ")..."); SpaceResolver resolver = new SpaceResolver( unresolvedFirst, breakPoss, unresolvedSecond, first, last); if (!last) { @@ -667,7 +666,7 @@ public final class SpaceResolver { if (!last && skipNextElement) { iter.next(); } - log.debug("----end space resolution."); + LOG.debug("----end space resolution."); } first = false; } diff --git a/src/java/org/apache/fop/layoutmgr/TraitSetter.java b/src/java/org/apache/fop/layoutmgr/TraitSetter.java index 800850177..6039ad941 100644 --- a/src/java/org/apache/fop/layoutmgr/TraitSetter.java +++ b/src/java/org/apache/fop/layoutmgr/TraitSetter.java @@ -45,8 +45,7 @@ public final class TraitSetter { } /** logger */ - private static final Log log // CSOK: ConstantName - = LogFactory.getLog(TraitSetter.class); + private static final Log LOG = LogFactory.getLog(TraitSetter.class); /** * Sets border and padding traits on areas. @@ -343,7 +342,7 @@ public final class TraitSetter { + backProps.backgroundPositionHorizontal.getValue(refContext)); } else { // TODO Area IPD has to be set for this to work - log.warn("Horizontal background image positioning ignored" + LOG.warn("Horizontal background image positioning ignored" + " because the IPD was not set on the area." + " (Yes, it's a bug in FOP)"); } @@ -360,7 +359,7 @@ public final class TraitSetter { + backProps.backgroundPositionVertical.getValue(refContext)); } else { // TODO Area BPD has to be set for this to work - log.warn("Vertical background image positioning ignored" + LOG.warn("Vertical background image positioning ignored" + " because the BPD was not set on the area." + " (Yes, it's a bug in FOP)"); } @@ -411,7 +410,7 @@ public final class TraitSetter { back.setHoriz(horizontal); } else { //TODO Area IPD has to be set for this to work - log.warn("Horizontal background image positioning ignored" + LOG.warn("Horizontal background image positioning ignored" + " because the IPD was not set on the area." + " (Yes, it's a bug in FOP)"); } @@ -435,7 +434,7 @@ public final class TraitSetter { back.setVertical(vertical); } else { //TODO Area BPD has to be set for this to work - log.warn("Vertical background image positioning ignored" + LOG.warn("Vertical background image positioning ignored" + " because the BPD was not set on the area." + " (Yes, it's a bug in FOP)"); } diff --git a/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java index c2dde9f9e..e090fbae6 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java @@ -30,7 +30,6 @@ import org.apache.fop.fonts.Font; import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.FontTriplet; import org.apache.fop.layoutmgr.LayoutContext; -import org.apache.fop.layoutmgr.LayoutManager; import org.apache.fop.layoutmgr.PositionIterator; import org.apache.fop.layoutmgr.TraitSetter; diff --git a/src/java/org/apache/fop/layoutmgr/inline/BasicScaledBaselineTable.java b/src/java/org/apache/fop/layoutmgr/inline/BasicScaledBaselineTable.java index f2664ed1c..467f2e154 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/BasicScaledBaselineTable.java +++ b/src/java/org/apache/fop/layoutmgr/inline/BasicScaledBaselineTable.java @@ -21,9 +21,7 @@ package org.apache.fop.layoutmgr.inline; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.fop.datatypes.Length; -import org.apache.fop.datatypes.LengthBase; -import org.apache.fop.datatypes.SimplePercentBaseContext; + import org.apache.fop.fo.Constants; diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java index 3eed124b2..49c97b7b6 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java +++ b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java @@ -23,6 +23,7 @@ import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.apache.fop.layoutmgr.Position; /** @@ -31,8 +32,7 @@ import org.apache.fop.layoutmgr.Position; public class LineLayoutPossibilities { /** logger instance */ - private static final Log log // CSOK: ConstantName - = LogFactory.getLog(LineLayoutPossibilities.class); + private static final Log LOG = LogFactory.getLog(LineLayoutPossibilities.class); private final class Possibility { private int lineCount; @@ -157,7 +157,7 @@ public class LineLayoutPossibilities { possibilitiesList.set(index, restoredPossibility); } else { // this should not happen - log.error("LineLayoutPossibilities restorePossibilities()," + LOG.error("LineLayoutPossibilities restorePossibilities()," + " min= " + getMinLineCount() + " max= " + getMaxLineCount() + " restored= " + restoredPossibility.getLineCount()); @@ -258,12 +258,12 @@ public class LineLayoutPossibilities { && adj <= (getMaxLineCount() - getChosenLineCount()) && getLineCount(chosenIndex + adj) == getChosenLineCount() + adj) { chosenIndex += adj; - log.debug("chosenLineCount= " + (getChosenLineCount() - adj) + " adjustment= " + adj + LOG.debug("chosenLineCount= " + (getChosenLineCount() - adj) + " adjustment= " + adj + " => chosenLineCount= " + getLineCount(chosenIndex)); return adj; } else { // this should not happen! - log.warn("Cannot apply the desired line count adjustment."); + LOG.warn("Cannot apply the desired line count adjustment."); return 0; } } diff --git a/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java index 62041e888..b9f786c97 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java @@ -25,7 +25,6 @@ import org.apache.fop.area.inline.TextArea; import org.apache.fop.area.inline.UnresolvedPageNumber; import org.apache.fop.fo.flow.PageNumberCitation; import org.apache.fop.layoutmgr.LayoutContext; -import org.apache.fop.layoutmgr.LayoutManager; /** * LayoutManager for the fo:page-number-citation formatting object diff --git a/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTable.java b/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTable.java index a2a1dce27..19a1a1f8a 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTable.java +++ b/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTable.java @@ -19,8 +19,6 @@ package org.apache.fop.layoutmgr.inline; -import org.apache.fop.datatypes.Length; - /** * The FOP specific incarnation of the XSL-FO scaled baseline table. * All baseline tables are scaled to the font size of the font they diff --git a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java index 1a3297ad5..db5b4736c 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java @@ -55,8 +55,7 @@ import org.apache.fop.util.BreakUtil; public class TableContentLayoutManager implements PercentBaseContext { /** Logger **/ - private static final Log log // CSOK: ConstantName - = LogFactory.getLog(TableContentLayoutManager.class); + private static final Log LOG = LogFactory.getLog(TableContentLayoutManager.class); private TableLayoutManager tableLM; private TableRowIterator bodyIter; @@ -138,8 +137,8 @@ public class TableContentLayoutManager implements PercentBaseContext { * @see org.apache.fop.layoutmgr.LayoutManager#getNextKnuthElements(LayoutContext, int) */ public List getNextKnuthElements(LayoutContext context, int alignment) { - if (log.isDebugEnabled()) { - log.debug("==> Columns: " + getTableLM().getColumns()); + if (LOG.isDebugEnabled()) { + LOG.debug("==> Columns: " + getTableLM().getColumns()); } KnuthBox headerAsFirst = null; KnuthBox headerAsSecondToLast = null; @@ -149,8 +148,8 @@ public class TableContentLayoutManager implements PercentBaseContext { headerIter, context, alignment, TableRowIterator.HEADER); this.headerNetHeight = ElementListUtils.calcContentLength(this.headerList); - if (log.isDebugEnabled()) { - log.debug("==> Header: " + if (LOG.isDebugEnabled()) { + LOG.debug("==> Header: " + headerNetHeight + " - " + this.headerList); } TableHeaderFooterPosition pos = new TableHeaderFooterPosition( @@ -169,8 +168,8 @@ public class TableContentLayoutManager implements PercentBaseContext { footerIter, context, alignment, TableRowIterator.FOOTER); this.footerNetHeight = ElementListUtils.calcContentLength(this.footerList); - if (log.isDebugEnabled()) { - log.debug("==> Footer: " + if (LOG.isDebugEnabled()) { + LOG.debug("==> Footer: " + footerNetHeight + " - " + this.footerList); } //We can simply add the table footer at the end of the whole list @@ -378,14 +377,14 @@ public class TableContentLayoutManager implements PercentBaseContext { } else if (pos instanceof TableContentPosition) { tablePositions.add(pos); } else { - if (log.isDebugEnabled()) { - log.debug("Ignoring position: " + pos); + if (LOG.isDebugEnabled()) { + LOG.debug("Ignoring position: " + pos); } } } if (lastPos instanceof TableHFPenaltyPosition) { TableHFPenaltyPosition penaltyPos = (TableHFPenaltyPosition)lastPos; - log.debug("Break at penalty!"); + LOG.debug("Break at penalty!"); if (penaltyPos.headerElements != null) { //Header positions for the penalty position are in the last element and need to //be handled first before all other TableContentPositions @@ -411,7 +410,7 @@ public class TableContentLayoutManager implements PercentBaseContext { if (tablePositions.isEmpty()) { // TODO make sure this actually never happens - log.error("tablePositions empty." + LOG.error("tablePositions empty." + " Please send your FO file to fop-users@xmlgraphics.apache.org"); } else { // Here we are sure that posIter iterates only over TableContentPosition instances diff --git a/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java b/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java index 282cd0fd5..35cba6da6 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java @@ -28,8 +28,6 @@ import org.apache.fop.fo.FONode.FONodeIterator; import org.apache.fop.fo.flow.table.EffRow; import org.apache.fop.fo.flow.table.Table; import org.apache.fop.fo.flow.table.TableBody; -import org.apache.fop.fo.flow.table.TablePart; - /** * Iterator that lets the table layout manager step over all the rows of a part of the diff --git a/src/java/org/apache/fop/pdf/PDFEmbeddedFile.java b/src/java/org/apache/fop/pdf/PDFEmbeddedFile.java index db9a49271..24a471e1e 100644 --- a/src/java/org/apache/fop/pdf/PDFEmbeddedFile.java +++ b/src/java/org/apache/fop/pdf/PDFEmbeddedFile.java @@ -21,17 +21,11 @@ package org.apache.fop.pdf; import java.util.Date; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - /** * This class represents an embedded file stream. */ public class PDFEmbeddedFile extends PDFStream { - private static final Log log // CSOK: ConstantName - = LogFactory.getLog(PDFEmbeddedFile.class.getName()); - /** * Creates a new embedded file stream. */ diff --git a/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java b/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java index 90b530774..269f0639d 100644 --- a/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java +++ b/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java @@ -21,7 +21,6 @@ package org.apache.fop.pdf; // Java import java.io.IOException; -import java.io.InputStream; import java.io.OutputStream; import java.security.InvalidKeyException; import java.security.MessageDigest; diff --git a/src/java/org/apache/fop/pdf/PDFEncryptionManager.java b/src/java/org/apache/fop/pdf/PDFEncryptionManager.java index 60844c588..3f5ae2a3d 100644 --- a/src/java/org/apache/fop/pdf/PDFEncryptionManager.java +++ b/src/java/org/apache/fop/pdf/PDFEncryptionManager.java @@ -37,8 +37,7 @@ public final class PDFEncryptionManager { } /** logging instance */ - private static final Log log // CSOK: ConstantName - = LogFactory.getLog(PDFEncryptionManager.class); + private static final Log LOG = LogFactory.getLog(PDFEncryptionManager.class); /** * Indicates whether JCE is available. @@ -64,12 +63,12 @@ public final class PDFEncryptionManager { Provider[] providers; providers = Security.getProviders("Cipher.RC4"); if (providers == null) { - log.warn("Cipher provider for RC4 not available."); + LOG.warn("Cipher provider for RC4 not available."); return false; } providers = Security.getProviders("MessageDigest.MD5"); if (providers == null) { - log.warn("MessageDigest provider for MD5 not available."); + LOG.warn("MessageDigest provider for MD5 not available."); return false; } return true; @@ -92,13 +91,13 @@ public final class PDFEncryptionManager { if (params != null) { if (!checkAvailableAlgorithms()) { if (isJCEAvailable()) { - log.warn("PDF encryption has been requested, JCE is " + LOG.warn("PDF encryption has been requested, JCE is " + "available but there's no " + "JCE provider available that provides the " + "necessary algorithms. The PDF won't be " + "encrypted."); } else { - log.warn("PDF encryption has been requested but JCE is " + LOG.warn("PDF encryption has been requested but JCE is " + "unavailable! The PDF won't be encrypted."); } } @@ -123,19 +122,19 @@ public final class PDFEncryptionManager { return (PDFEncryption)obj; } catch (ClassNotFoundException e) { if (checkAvailableAlgorithms()) { - log.warn("JCE and algorithms available, but the " + LOG.warn("JCE and algorithms available, but the " + "implementation class unavailable. Please do a full " + "rebuild."); } return null; } catch (NoSuchMethodException e) { - log.error(e); + LOG.error(e); return null; } catch (IllegalAccessException e) { - log.error(e); + LOG.error(e); return null; } catch (InvocationTargetException e) { - log.error(e); + LOG.error(e); return null; } } diff --git a/src/java/org/apache/fop/render/afp/AFPForeignAttributeReader.java b/src/java/org/apache/fop/render/afp/AFPForeignAttributeReader.java index aad31f18e..a03aaf816 100644 --- a/src/java/org/apache/fop/render/afp/AFPForeignAttributeReader.java +++ b/src/java/org/apache/fop/render/afp/AFPForeignAttributeReader.java @@ -35,8 +35,7 @@ import org.apache.fop.render.afp.extensions.AFPElementMapping; * Parses any AFP foreign attributes */ public class AFPForeignAttributeReader { - private static final Log log // CSOK: ConstantName - = LogFactory.getLog("org.apache.xmlgraphics.afp"); + private static final Log LOG = LogFactory.getLog("org.apache.xmlgraphics.afp"); /** the resource-name attribute */ public static final QName RESOURCE_NAME = new QName( @@ -95,7 +94,7 @@ public class AFPForeignAttributeReader { = (String)foreignAttributes.get(RESOURCE_GROUP_FILE); if (resourceGroupFile == null) { String msg = RESOURCE_GROUP_FILE + " not specified"; - log.error(msg); + LOG.error(msg); throw new UnsupportedOperationException(msg); } File resourceExternalGroupFile = new File(resourceGroupFile); @@ -107,20 +106,20 @@ public class AFPForeignAttributeReader { } catch (SecurityException ex) { String msg = "unable to gain write access to external resource file: " + resourceGroupFile; - log.error(msg); + LOG.error(msg); } try { boolean exists = resourceExternalGroupFile.exists(); if (exists) { - log.warn("overwriting external resource file: " + LOG.warn("overwriting external resource file: " + resourceGroupFile); } resourceLevel.setExternalFilePath(resourceGroupFile); } catch (SecurityException ex) { String msg = "unable to gain read access to external resource file: " + resourceGroupFile; - log.error(msg); + LOG.error(msg); } } } diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPPageOverlay.java b/src/java/org/apache/fop/render/afp/extensions/AFPPageOverlay.java index b14a4eb9d..a82fe3457 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPPageOverlay.java +++ b/src/java/org/apache/fop/render/afp/extensions/AFPPageOverlay.java @@ -19,8 +19,6 @@ package org.apache.fop.render.afp.extensions; -import java.net.URI; - import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; diff --git a/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java b/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java index cd15a9d72..b156b6c3a 100644 --- a/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java +++ b/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java @@ -19,9 +19,6 @@ package org.apache.fop.render.intermediate; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import org.apache.fop.apps.FOUserAgent; /** @@ -29,9 +26,6 @@ import org.apache.fop.apps.FOUserAgent; */ public abstract class AbstractIFDocumentHandler implements IFDocumentHandler { - /** logging instance */ - private static Log log = LogFactory.getLog(AbstractIFDocumentHandler.class); - private IFContext ifContext; /** diff --git a/src/java/org/apache/fop/render/java2d/Java2DPainter.java b/src/java/org/apache/fop/render/java2d/Java2DPainter.java index a2b9c9613..396645768 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DPainter.java +++ b/src/java/org/apache/fop/render/java2d/Java2DPainter.java @@ -33,9 +33,6 @@ import java.util.Stack; import org.w3c.dom.Document; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import org.apache.fop.fonts.Font; import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.FontTriplet; @@ -54,9 +51,6 @@ import org.apache.fop.util.CharUtilities; */ public class Java2DPainter extends AbstractIFPainter { - /** logging instance */ - private static Log log = LogFactory.getLog(Java2DPainter.class); - /** the IF context */ protected IFContext ifContext; diff --git a/src/java/org/apache/fop/render/pcl/HardcodedFonts.java b/src/java/org/apache/fop/render/pcl/HardcodedFonts.java index 429d36167..185e1ece5 100644 --- a/src/java/org/apache/fop/render/pcl/HardcodedFonts.java +++ b/src/java/org/apache/fop/render/pcl/HardcodedFonts.java @@ -34,8 +34,7 @@ final class HardcodedFonts { } /** logging instance */ - private static final Log log // CSOK: ConstantName - = LogFactory.getLog(HardcodedFonts.class); + private static final Log LOG = LogFactory.getLog(HardcodedFonts.class); /** * Sets the current font (NOTE: Hard-coded font mappings ATM!) @@ -62,7 +61,7 @@ final class HardcodedFonts { try { fontcode = Integer.parseInt(name.substring(1)); } catch (Exception e) { - log.error(e); + LOG.error(e); } } //Note "(ON" selects ISO 8859-1 symbol set as used by PCLGenerator diff --git a/src/java/org/apache/fop/render/pcl/PCLPainter.java b/src/java/org/apache/fop/render/pcl/PCLPainter.java index d0e82ed7d..00b25a5e3 100644 --- a/src/java/org/apache/fop/render/pcl/PCLPainter.java +++ b/src/java/org/apache/fop/render/pcl/PCLPainter.java @@ -34,9 +34,6 @@ import java.util.Stack; import org.w3c.dom.Document; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import org.apache.xmlgraphics.image.loader.ImageException; import org.apache.xmlgraphics.image.loader.ImageInfo; import org.apache.xmlgraphics.image.loader.ImageProcessingHints; @@ -65,9 +62,6 @@ import org.apache.fop.util.CharUtilities; */ public class PCLPainter extends AbstractIFPainter implements PCLConstants { - /** logging instance */ - private static Log log = LogFactory.getLog(PCLPainter.class); - private static final boolean DEBUG = false; private PCLDocumentHandler parent; diff --git a/src/java/org/apache/fop/render/pcl/PCLRendererContext.java b/src/java/org/apache/fop/render/pcl/PCLRendererContext.java index 6c2c592b1..d54973ac8 100644 --- a/src/java/org/apache/fop/render/pcl/PCLRendererContext.java +++ b/src/java/org/apache/fop/render/pcl/PCLRendererContext.java @@ -19,9 +19,6 @@ package org.apache.fop.render.pcl; -import org.apache.xmlgraphics.util.QName; - -import org.apache.fop.fo.extensions.ExtensionElementMapping; import org.apache.fop.render.ImageHandlerUtil; import org.apache.fop.render.RendererContext; diff --git a/src/java/org/apache/fop/render/pdf/PDFBorderPainter.java b/src/java/org/apache/fop/render/pdf/PDFBorderPainter.java index 10db33b0f..287f89607 100644 --- a/src/java/org/apache/fop/render/pdf/PDFBorderPainter.java +++ b/src/java/org/apache/fop/render/pdf/PDFBorderPainter.java @@ -37,8 +37,7 @@ import org.apache.fop.util.ColorUtil; public class PDFBorderPainter extends BorderPainter { /** logging instance */ - private static final Log log // CSOK: ConstantName - = LogFactory.getLog(PDFBorderPainter.class); + private static final Log LOG = LogFactory.getLog(PDFBorderPainter.class); private PDFContentGenerator generator; @@ -70,7 +69,7 @@ public class PDFBorderPainter extends BorderPainter { float w = x2 - x1; float h = y2 - y1; if ((w < 0) || (h < 0)) { - log.error("Negative extent received (w=" + w + ", h=" + h + LOG.error("Negative extent received (w=" + w + ", h=" + h + "). Border won't be painted."); return; } diff --git a/src/java/org/apache/fop/render/ps/PSSVGHandler.java b/src/java/org/apache/fop/render/ps/PSSVGHandler.java index 5cc1a1b01..66b26fb33 100644 --- a/src/java/org/apache/fop/render/ps/PSSVGHandler.java +++ b/src/java/org/apache/fop/render/ps/PSSVGHandler.java @@ -30,8 +30,6 @@ import org.apache.avalon.framework.configuration.Configuration; import org.apache.batik.bridge.BridgeContext; import org.apache.batik.bridge.GVTBuilder; import org.apache.batik.gvt.GraphicsNode; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.apache.xmlgraphics.java2d.ps.PSGraphics2D; import org.apache.xmlgraphics.ps.PSGenerator; @@ -57,9 +55,6 @@ import org.apache.fop.svg.SVGUserAgent; public class PSSVGHandler extends AbstractGenericSVGHandler implements PSRendererContextConstants { - /** logging instance */ - private static Log log = LogFactory.getLog(PSSVGHandler.class); - /** * Create a new PostScript XML handler for use by the PostScript renderer. */ diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java index f44199bee..13748a3bf 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java @@ -26,9 +26,8 @@ package org.apache.fop.render.rtf.rtflib.rtfdoc; * the FOP project. */ -import java.io.Writer; import java.io.IOException; -import java.util.Date; +import java.io.Writer; import java.util.Random; /** diff --git a/src/sandbox/org/apache/fop/render/svg/SVGPainter.java b/src/sandbox/org/apache/fop/render/svg/SVGPainter.java index 2477099a4..bcc3a6913 100644 --- a/src/sandbox/org/apache/fop/render/svg/SVGPainter.java +++ b/src/sandbox/org/apache/fop/render/svg/SVGPainter.java @@ -34,17 +34,14 @@ import org.w3c.dom.Document; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import org.apache.xmlgraphics.image.loader.ImageException; import org.apache.xmlgraphics.image.loader.ImageInfo; import org.apache.xmlgraphics.image.loader.ImageManager; import org.apache.xmlgraphics.image.loader.ImageSessionContext; import org.apache.xmlgraphics.xmp.Metadata; -import org.apache.fop.apps.MimeConstants; import org.apache.fop.ResourceEventProducer; +import org.apache.fop.apps.MimeConstants; import org.apache.fop.render.ImageHandlerUtil; import org.apache.fop.render.RenderingContext; import org.apache.fop.render.intermediate.AbstractIFPainter; @@ -64,9 +61,6 @@ import org.apache.fop.util.XMLUtil; */ public class SVGPainter extends AbstractIFPainter implements SVGConstants { - /** logging instance */ - private static Log log = LogFactory.getLog(SVGPainter.class); - private AbstractSVGDocumentHandler parent; /** The SAX content handler that receives the generated XML events. */ diff --git a/test/java/org/apache/fop/GenericFOPTestCase.java b/test/java/org/apache/fop/GenericFOPTestCase.java index 26053cdad..5b51a34e1 100644 --- a/test/java/org/apache/fop/GenericFOPTestCase.java +++ b/test/java/org/apache/fop/GenericFOPTestCase.java @@ -31,12 +31,13 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; -import org.apache.fop.apps.Fop; +import org.xml.sax.InputSource; + import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.MimeConstants; import org.apache.fop.util.DigestFilter; -import org.xml.sax.InputSource; /** * Framework for simple regression testing. @@ -76,8 +77,8 @@ public final class GenericFOPTestCase extends TestCase { public void testSimple() throws Exception { final String digestIn = "17bf13298796065f7775db8707133aeb"; final String digestOut = "e2761f51152f6663911e567901596707"; - final String fo = - "" + final String fo + = "" + " " + " " @@ -118,8 +119,8 @@ public final class GenericFOPTestCase extends TestCase { FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); foUserAgent.setCreationDate(new Date(10000)); MessageDigest outDigest = MessageDigest.getInstance("MD5"); - DigestOutputStream out = - new DigestOutputStream(new ByteArrayOutputStream(), outDigest); + DigestOutputStream out + = new DigestOutputStream(new ByteArrayOutputStream(), outDigest); Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out); InputSource source = new InputSource(new StringReader(fo)); DigestFilter filter = new DigestFilter("MD5"); diff --git a/test/java/org/apache/fop/config/BaseUserConfigTestCase.java b/test/java/org/apache/fop/config/BaseUserConfigTestCase.java index 5c803317e..6ce833312 100644 --- a/test/java/org/apache/fop/config/BaseUserConfigTestCase.java +++ b/test/java/org/apache/fop/config/BaseUserConfigTestCase.java @@ -100,7 +100,7 @@ public abstract class BaseUserConfigTestCase extends BasePDFTestCase { /** * @return user config File */ - abstract protected String getUserConfigFilename(); + protected abstract String getUserConfigFilename(); /* * @see junit.framework.TestCase#getName() diff --git a/test/java/org/apache/fop/events/EventChecker.java b/test/java/org/apache/fop/events/EventChecker.java index 767c590ed..afef11d87 100644 --- a/test/java/org/apache/fop/events/EventChecker.java +++ b/test/java/org/apache/fop/events/EventChecker.java @@ -40,7 +40,7 @@ class EventChecker extends Assert implements EventListener { if (event.getEventID().equals(expectedEventID)) { eventReceived = true; } else { - fail("Unexpected event: id = " + event.getEventID() + ": "+ msg); + fail("Unexpected event: id = " + event.getEventID() + ": " + msg); } } diff --git a/test/java/org/apache/fop/memory/Stats.java b/test/java/org/apache/fop/memory/Stats.java index 9e371251d..354952347 100644 --- a/test/java/org/apache/fop/memory/Stats.java +++ b/test/java/org/apache/fop/memory/Stats.java @@ -71,7 +71,7 @@ class Stats { public void dumpFinalStats() { long duration = System.currentTimeMillis() - startTime; System.out.println("Final statistics"); - System.out.println("Pages produced: " +totalPagesProduced); + System.out.println("Pages produced: " + totalPagesProduced); long ppm = 60000 * totalPagesProduced / duration; System.out.println("Average speed: " + ppm + "ppm"); } diff --git a/test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java b/test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java index f5d2f84cf..bd5c8ade1 100644 --- a/test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java +++ b/test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java @@ -27,38 +27,38 @@ import org.apache.fop.pdf.CMapBuilder; /** Simple sanity test of the PDFCmap class */ public class PDFCMapTestCase extends TestCase { + private static final String EOL = "\n"; public void testPDFCMapFillInPDF() throws Exception { - final String EOL = "\n"; - final String expected = - "%!PS-Adobe-3.0 Resource-CMap" + EOL - +"%%DocumentNeededResources: ProcSet (CIDInit)" + EOL - +"%%IncludeResource: ProcSet (CIDInit)" + EOL - +"%%BeginResource: CMap (test)" + EOL - +"%%EndComments" + EOL - +"/CIDInit /ProcSet findresource begin" + EOL - +"12 dict begin" + EOL - +"begincmap" + EOL - +"/CIDSystemInfo 3 dict dup begin" + EOL - +" /Registry (Adobe) def" + EOL - +" /Ordering (Identity) def" + EOL - +" /Supplement 0 def" + EOL - +"end def" + EOL - +"/CMapVersion 1 def" + EOL - +"/CMapType 1 def" + EOL - +"/CMapName /test def" + EOL - +"1 begincodespacerange" + EOL - +"<0000> " + EOL - +"endcodespacerange" + EOL - +"1 begincidrange" + EOL - +"<0000> 0" + EOL - +"endcidrange" + EOL - +"endcmap" + EOL - +"CMapName currentdict /CMap defineresource pop" + EOL - +"end" + EOL - +"end" + EOL - +"%%EndResource" + EOL - +"%%EOF" + EOL + final String expected + = "%!PS-Adobe-3.0 Resource-CMap" + EOL + + "%%DocumentNeededResources: ProcSet (CIDInit)" + EOL + + "%%IncludeResource: ProcSet (CIDInit)" + EOL + + "%%BeginResource: CMap (test)" + EOL + + "%%EndComments" + EOL + + "/CIDInit /ProcSet findresource begin" + EOL + + "12 dict begin" + EOL + + "begincmap" + EOL + + "/CIDSystemInfo 3 dict dup begin" + EOL + + " /Registry (Adobe) def" + EOL + + " /Ordering (Identity) def" + EOL + + " /Supplement 0 def" + EOL + + "end def" + EOL + + "/CMapVersion 1 def" + EOL + + "/CMapType 1 def" + EOL + + "/CMapName /test def" + EOL + + "1 begincodespacerange" + EOL + + "<0000> " + EOL + + "endcodespacerange" + EOL + + "1 begincidrange" + EOL + + "<0000> 0" + EOL + + "endcidrange" + EOL + + "endcmap" + EOL + + "CMapName currentdict /CMap defineresource pop" + EOL + + "end" + EOL + + "end" + EOL + + "%%EndResource" + EOL + + "%%EOF" + EOL ; final StringWriter w = new StringWriter(); diff --git a/test/java/org/apache/fop/util/DigestFilter.java b/test/java/org/apache/fop/util/DigestFilter.java index 0384b42df..94e8d67d2 100644 --- a/test/java/org/apache/fop/util/DigestFilter.java +++ b/test/java/org/apache/fop/util/DigestFilter.java @@ -43,7 +43,7 @@ import org.xml.sax.helpers.XMLFilterImpl; public class DigestFilter extends XMLFilterImpl { private MessageDigest digest; - private byte value[]; + private byte[] value; private boolean isNamespaceAware; public DigestFilter(String algorithm) throws NoSuchAlgorithmException { @@ -133,7 +133,7 @@ public class DigestFilter extends XMLFilterImpl { */ public void setFeature(String feature, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { - if(feature.equals("http://xml.org/sax/features/namespaces")) { + if (feature.equals("http://xml.org/sax/features/namespaces")) { isNamespaceAware = value; } super.setFeature(feature, value);