<?xml version="1.0" encoding="utf-8"?>
<FindBugsFilter>
+
+ <!--
+ !
+ ! This file is divided into two parts:
+ ! 1. APPROVED EXCLUSIONS
+ ! 2. TEMPORARY (UNAPPROVED) EXCLUSIONS
+ !
+ ! Approved exclusions come in two sub-types:
+ ! 1. general exclusion of a named bug pattern, meaning that all instances that matches the bug
+ ! pattern identifier are excluded;
+ ! 2. specific exclusions for a named bug pattern, meaning that all instance exclusions are
+ ! explicitly enumerated;
+ !
+ ! All specific exclusions must be accompanied inline (i.e., in the affected source code) by
+ ! a commented out annotation of the form:
+ !
+ ! // @SuppressFBWarnings("pattern identifier")
+ !
+ ! where pattern identifier is one of findbugs' named patterns. At an appropriate point in the
+ ! future, these commented out annotations will be uncommented and exclusion patterns removed
+ ! from this file.
+ !
+ ! Temporary (unapproved) exclusions are short-term work arounds that should be removed as
+ ! soon as possible by either (1) fixing (eliminating) cause of warning, or (2) conversion to
+ ! approved exclusion.
+ !
+ ! The organization of pattern matches employs the following levels (from top down):
+ ! 1. bug pattern
+ ! 2. or clause matching instances
+ ! 3. class name, if applies to class/interface
+ ! 4. and clause matching class/instance and single or or clause of multiple {method,field} members
+ !
+ ! for example,
+ !
+ ! <Match>
+ ! <Bug pattern="pattern identifier"/>
+ ! <Or>
+ ! <And>
+ ! <Class name="dotted class name"/>
+ ! <Member name="unqualified member name"/>
+ ! </And>
+ ! </Or>
+ ! </Match>
+ !
+ -->
+
+ <!-- START - APPROVED EXCLUSIONS -->
<Match>
- <!-- 131 warnings -->
- <Bug pattern="BC_UNCONFIRMED_CAST"/>
+ <Bug pattern="CN_IDIOM_NO_SUPER_CALL"/>
+ <Or>
+ <And>
+ <Class name="org.apache.fop.render.intermediate.IFGraphicContext"/>
+ <Method name="clone"/>
+ </And>
+ </Or>
+ </Match>
+ <Match>
+ <Bug pattern="DM_EXIT"/>
+ <Or>
+ <And>
+ <Class name="org.apache.fop.cli.CommandLineOptions"/>
+ <Or>
+ <Method name="parseCustomOutputOption"/>
+ <Method name="parseOptions"/>
+ </Or>
+ </And>
+ <And>
+ <Class name="org.apache.fop.cli.Main"/>
+ <Or>
+ <Method name="startFOP"/>
+ <Method name="startFOPWithDynamicClasspath"/>
+ </Or>
+ </And>
+ <And>
+ <Class name="org.apache.fop.tools.fontlist.FontListMain"/>
+ <Or>
+ <Method name="parseArguments"/>
+ </Or>
+ </And>
+ </Or>
</Match>
<Match>
- <!-- 8 warnings -->
- <Bug pattern="CI_CONFUSED_INHERITANCE"/>
+ <Bug pattern="EQ_ALWAYS_TRUE"/>
+ <Or>
+ <And>
+ <Class name="org.apache.fop.fo.properties.ToBeImplementedProperty"/>
+ <Method name="equals"/>
+ </And>
+ </Or>
</Match>
<Match>
- <Bug pattern="CN_IDIOM_NO_SUPER_CALL"/>
+ <Bug pattern="MS_EXPOSE_REP"/>
<Or>
<And>
- <Class name="org.apache.fop.render.intermediate.IFGraphicContext"/>
- <Method name="clone"/>
+ <Class name="org.apache.fop.fo.FOPropertyMapping"/>
+ <Method name="getGenericMappings"/>
+ </And>
+ </Or>
+ </Match>
+ <Match>
+ <Bug pattern="NM_SAME_SIMPLE_NAME_AS_INTERFACE"/>
+ <Or>
+ <Class name="org.apache.fop.apps.MimeConstants"/>
+ <Class name="org.apache.fop.events.EventListener"/>
+ <Class name="org.apache.fop.render.Graphics2DImagePainter"/>
+ </Or>
+ </Match>
+ <Match>
+ <Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS"/>
+ <Or>
+ <Class name="org.apache.fop.render.ps.PSFontUtils"/>
+ <Class name="org.apache.fop.render.ps.PSImageUtils"/>
+ <Class name="org.apache.fop.svg.GraphicsConfiguration"/>
+ <Class name="org.apache.fop.svg.PDFTextUtil"/>
+ <Class name="org.apache.fop.util.QName"/>
+ </Or>
+ </Match>
+ <Match>
+ <Bug pattern="SE_INNER_CLASS"/>
+ <Or>
+ <Class name="org.apache.fop.afp.AFPPaintingState$AFPData"/>
+ <Class name="org.apache.fop.area.inline.AbstractTextArea$TextAdjustingInfo"/>
+ <Class name="org.apache.fop.area.inline.InlineArea$InlineAdjustingInfo"/>
+ <Class name="org.apache.fop.area.LineArea$LineAdjustingInfo"/>
+ <Class name="org.apache.fop.pdf.PDFPaintingState$PDFData"/>
+ <Class name="org.apache.fop.util.AbstractPaintingState$StateStack"/>
+ </Or>
+ </Match>
+ <Match>
+ <Bug pattern="SF_SWITCH_FALLTHROUGH"/>
+ <Or>
+ <And>
+ <Class name="org.apache.fop.render.awt.viewer.PreviewPanel$Reloader"/>
+ <Method name="run"/>
</And>
</Or>
</Match>
+ <!-- END - APPROVED EXCLUSIONS -->
+
+ <!-- START - TEMPORARY (UNAPPROVED) EXCLUSIONS -->
+ <Match>
+ <!-- 131 warnings -->
+ <Bug pattern="BC_UNCONFIRMED_CAST"/>
+ </Match>
<Match>
<!-- 15 warnings -->
<Bug pattern="DB_DUPLICATE_SWITCH_CLAUSES"/>
<!-- 29 warnings -->
<Bug pattern="DM_CONVERT_CASE"/>
</Match>
- <Match>
- <!-- 5 warnings -->
- <Bug pattern="DM_EXIT"/>
- </Match>
<Match>
<!-- 20 warnings -->
<Bug pattern="DM_FP_NUMBER_CTOR"/>
<!-- 55 warnings -->
<Bug pattern="EI_EXPOSE_REP2"/>
</Match>
- <Match>
- <Bug pattern="EQ_ALWAYS_TRUE"/>
- <Or>
- <And>
- <Class name="org.apache.fop.fo.properties.ToBeImplementedProperty"/>
- <Method name="equals"/>
- </And>
- </Or>
- </Match>
<Match>
<!-- 12 warnings -->
<Bug pattern="FE_FLOATING_POINT_EQUALITY"/>
</Match>
- <Match>
- <!-- 6 warnings -->
- <Bug pattern="ITA_INEFFICIENT_TO_ARRAY"/>
- </Match>
- <Match>
- <!-- 9 warnings -->
- <Bug pattern="LI_LAZY_INIT_STATIC"/>
- </Match>
- <Match>
- <Bug pattern="MS_EXPOSE_REP"/>
- <Or>
- <And>
- <Class name="org.apache.fop.fo.FOPropertyMapping"/>
- <Method name="getGenericMappings"/>
- </And>
- </Or>
- </Match>
<Match>
<!-- 12 warnings -->
<Bug pattern="MS_OOI_PKGPROTECT"/>
<!-- 11 warnings -->
<Bug pattern="NM_CONFUSING"/>
</Match>
- <Match>
- <Bug pattern="NM_SAME_SIMPLE_NAME_AS_INTERFACE"/>
- <Or>
- <Class name="org.apache.fop.apps.MimeConstants"/>
- <Class name="org.apache.fop.events.EventListener"/>
- <Class name="org.apache.fop.render.Graphics2DImagePainter"/>
- </Or>
- </Match>
- <Match>
- <!-- 5 warnings -->
- <Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS"/>
- </Match>
<Match>
<!-- 46 warnings -->
<Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
<!-- 23 warnings -->
<Bug pattern="REC_CATCH_EXCEPTION"/>
</Match>
- <Match>
- <!-- 8 warnings -->
- <Bug pattern="RI_REDUNDANT_INTERFACES"/>
- </Match>
<Match>
<!-- 11 warnings -->
<Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE"/>
<!-- 33 warnings -->
<Bug pattern="SE_BAD_FIELD"/>
</Match>
- <Match>
- <!-- 6 warnings -->
- <Bug pattern="SE_INNER_CLASS"/>
- </Match>
- <Match>
- <!-- 9 warnings -->
- <Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED"/>
- </Match>
- <Match>
- <Bug pattern="SF_SWITCH_FALLTHROUGH"/>
- <Or>
- <And>
- <Class name="org.apache.fop.render.awt.viewer.PreviewPanel$Reloader"/>
- <Method name="run"/>
- </And>
- </Or>
- </Match>
<Match>
<!-- 21 warnings -->
<Bug pattern="SIC_INNER_SHOULD_BE_STATIC"/>
<!-- 20 warnings -->
<Bug pattern="SIC_INNER_SHOULD_BE_STATIC_ANON"/>
</Match>
- <Match>
- <!-- 5 warnings -->
- <Bug pattern="SR_NOT_CHECKED"/>
- </Match>
- <Match>
- <!-- 6 warnings -->
- <Bug pattern="SS_SHOULD_BE_STATIC"/>
- </Match>
- <Match>
- <!-- 8 warnings -->
- <Bug pattern="UCF_USELESS_CONTROL_FLOW"/>
- </Match>
- <Match>
- <!-- 6 warnings -->
- <Bug pattern="UPM_UNCALLED_PRIVATE_METHOD"/>
- </Match>
<Match>
<!-- 12 warnings -->
<Bug pattern="URF_UNREAD_FIELD"/>
<!-- 58 warnings -->
<Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"/>
</Match>
- <Match>
- <!-- 5 warnings -->
- <Bug pattern="UWF_UNWRITTEN_FIELD"/>
- </Match>
- <Match>
- <!-- 6 warnings -->
- <Bug pattern="WMI_WRONG_MAP_ITERATOR"/>
- </Match>
+ <!-- END - TEMPORARY (UNAPPROVED) EXCLUSIONS -->
+
</FindBugsFilter>
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.Stroke;
-import java.awt.TexturePaint;
import java.awt.geom.AffineTransform;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Line2D;
return true;
}
LOG.debug("NYI: applyPaint() " + paint + " fill=" + fill);
- if (paint instanceof TexturePaint) {
+// if (paint instanceof TexturePaint) {
// TexturePaint texturePaint = (TexturePaint)paint;
// BufferedImage bufferedImage = texturePaint.getImage();
// AffineTransform at = paintingState.getTransform();
// int x = (int)Math.round(at.getTranslateX());
// int y = (int)Math.round(at.getTranslateY());
// drawImage(bufferedImage, x, y, null);
- }
+// }
return false;
}
package org.apache.fop.afp;
import java.awt.Point;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
* This keeps information about the current painting state when writing to an
* AFP datastream.
*/
-public class AFPPaintingState extends org.apache.fop.util.AbstractPaintingState implements
- Cloneable {
+public class AFPPaintingState extends org.apache.fop.util.AbstractPaintingState {
private static final long serialVersionUID = 8206711712452344473L;
private float bitmapEncodingQuality;
/** color image handler */
- private transient ColorConverter colorConverter = GrayScaleColorConverter.getInstance();
+ private transient ColorConverter colorConverter;
/**
* true if certain image formats may be embedded unchanged in their native
private boolean fs45;
/** the current page */
- private transient AFPPagePaintingState pagePaintingState = new AFPPagePaintingState();
+ private transient AFPPagePaintingState pagePaintingState;
// /** reference orientation */
// private int orientation = 0;
/** a unit converter */
- private final transient AFPUnitConverter unitConv = new AFPUnitConverter(this);
+ private final transient AFPUnitConverter unitConv;
+
+ public AFPPaintingState() {
+ colorConverter = GrayScaleColorConverter.getInstance();
+ pagePaintingState = new AFPPagePaintingState();
+ unitConv = new AFPUnitConverter(this);
+ }
+
+ private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
+ ois.defaultReadObject();
+ }
/**
* Sets the rotation to be used for portrait pages, valid values are 0
/**
* Block level state data
*/
+ // @SuppressFBWarnings("SE_INNER_CLASS")
private class AFPData extends org.apache.fop.util.AbstractPaintingState.AbstractData {
private static final long serialVersionUID = -1789481244175275686L;
DataInputStream din = new DataInputStream(bin);
long len = din.readInt() & 0xFFFFFFFFL;
println("Length: " + len);
- din.skip(4); //checksum
+ if (din.skip(4) != 4) { //checksum
+ throw new IOException("premature EOF when skipping checksum");
+ }
int tidLen = din.readUnsignedShort() - 2;
byte[] tid = new byte[tidLen];
din.readFully(tid);
public final class GraphicsChainedSegment extends AbstractGraphicsDrawingOrderContainer {
/** The maximum segment data length */
- protected static final int MAX_DATA_LEN = 8192;
+ public static final int MAX_DATA_LEN = 8192;
private byte[] predecessorNameBytes;
private boolean appended;
private boolean subtractive;
/** setting for GRAYCODE flag */
- private boolean grayCoding;
+ // private boolean grayCoding; // never written
/** the image color model */
private byte colorModel = COLOR_MODEL_RGB;
if (subtractive) {
flags |= 1 << 7;
}
+ /* graCoding is never written
if (grayCoding) {
flags |= 1 << 6;
}
+ */
DataOutputStream dout = new DataOutputStream(os);
dout.writeByte(0x9B); //ID
import org.apache.fop.afp.Completable;
import org.apache.fop.afp.Factory;
-import org.apache.fop.afp.Streamable;
/**
* An abstract container of resource objects
*/
-public abstract class AbstractResourceGroupContainer extends AbstractPageObject
-implements Streamable {
+public abstract class AbstractResourceGroupContainer extends AbstractPageObject {
/** The container started state */
protected boolean started;
private final int x;
private final int y;
private final int rotation;
- private int xOffset;
- private int yOffset;
+ // private int xOffset; // never written
+ // private int yOffset; // never written
private byte refCSys = 0x01; //Page or overlay coordinate system
/**
byte yorient = (byte)(rotation / 2 + 45);
data[19] = yorient; // YoaOrent
- byte[] xoffset = BinaryUtils.convert(xOffset, 3);
+ byte[] xoffset = BinaryUtils.convert(/*xOffset*/ 0, 3);
data[22] = xoffset[0]; // XocaOSet
data[23] = xoffset[1];
data[24] = xoffset[2];
- byte[] yoffset = BinaryUtils.convert(yOffset, 3);
+ byte[] yoffset = BinaryUtils.convert(/*yOffset*/ 0, 3);
data[25] = yoffset[0]; // YocaOSet
data[26] = yoffset[1];
data[27] = yoffset[2];
+ ", y=" + y
+ ", rotation=" + rotation
+ ", rotation=" + rotation
- + ", xOffset=" + xOffset
- + ", yOffset=" + yOffset;
+ + ", xOffset=" + /*xOffset*/ 0
+ + ", yOffset=" + /*yOffset*/ 0;
}
}
import java.io.IOException;
import java.io.OutputStream;
-import java.util.List;
import org.apache.fop.afp.Completable;
private static final String DEFAULT_NAME = "REG00001";
/** the pre-process presentation objects contained in this resource environment group */
- private List/*<PreprocessPresentationObject>*/ preProcessPresentationObjects;
+ // never written
+ // private List/*<PreprocessPresentationObject>*/ preProcessPresentationObjects;
/** the resource environment group state */
private boolean complete;
this(DEFAULT_NAME);
}
- private List/*<PreprocessPresentationObject>*/ getPreprocessPresentationObjects() {
+ /* not used
+ private List getPreprocessPresentationObjects() {
if (preProcessPresentationObjects == null) {
this.preProcessPresentationObjects
- = new java.util.ArrayList/*<PreprocessPresentationObject>*/();
+ = new java.util.ArrayList();
}
return this.preProcessPresentationObjects;
}
+ */
/**
* Constructor for the ResourceEnvironmentGroup, this takes a
protected void writeContent(OutputStream os) throws IOException {
writeObjects(mapDataResources, os);
writeObjects(mapPageOverlays, os);
- writeObjects(preProcessPresentationObjects, os);
+ // writeObjects(preProcessPresentationObjects, os); always empty list
}
/** {@inheritDoc} */
package org.apache.fop.area;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.util.Locale;
-
// block areas hold either more block areas or line
// areas can also be used as a block spacer
// a block area may have children positioned by stacking
private int positioning = STACK;
/** if true, allow BPD update */
- protected transient boolean allowBPDUpdate = true;
+ protected transient boolean allowBPDUpdate;
private Locale locale;
private String location;
+ public Block() {
+ allowBPDUpdate = true;
+ }
+
+ private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
+ ois.defaultReadObject();
+ }
+
/**
* Add the block to this block area.
*
* that can be used in order to re-compute adjustement and / or indents when a
* page-number or a page-number-citation is resolved
*/
+ // @SuppressFBWarnings("SE_INNER_CLASS")
private final class LineAdjustingInfo implements Serializable {
private static final long serialVersionUID = -6103629976229458273L;
package org.apache.fop.area;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
private Area area;
private transient List<Resolvable> dependents;
+ public LinkResolver() {
+ this(null, null);
+ }
+
/**
* Create a new link resolver.
*
area = a;
}
+ private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
+ ois.defaultReadObject();
+ }
+
/**
* @return true if this link is resolved
*/
* that can be used in order to re-compute adjustments when a
* page-number or a page-number-citation is resolved
*/
+ // @SuppressFBWarnings("SE_INNER_CLASS")
protected class TextAdjustingInfo extends InlineAdjustingInfo {
private static final long serialVersionUID = -2412095162983479947L;
* that can be used in order to re-compute adjustments when a
* page-number or a page-number-citation is resolved
*/
+ // @SuppressFBWarnings("SE_INNER_CLASS")
protected class InlineAdjustingInfo implements Serializable {
private static final long serialVersionUID = -5601387735459712149L;
package org.apache.fop.area.inline;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
*/
private int maxAfterEdge;
+ private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
+ ois.defaultReadObject();
+ }
+
@Override
public void addChildArea(Area c) {
assert c instanceof InlineArea;
package org.apache.fop.area.inline;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.util.List;
import org.apache.fop.area.PageViewport;
//Transient fields
private transient Font font;
+ public UnresolvedPageNumber() {
+ this(null, null, FIRST);
+ }
+
/**
* Create a new unresolved page number.
*
pageType = type;
}
+ private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
+ ois.defaultReadObject();
+ }
+
/**
* Get the id references for this area.
*
i = i + parseUnknownOption(args, i);
} else {
printUsage(System.err);
+ // @SuppressFBWarnings("DM_EXIT")
System.exit(1);
}
}
for (int j = 0; j < mimes.length; j++) {
System.out.println(" " + mimes[j]);
}
+ // @SuppressFBWarnings("DM_EXIT")
System.exit(0);
}
}
} catch (Exception e) {
System.err.println("Unable to start FOP:");
e.printStackTrace();
+ // @SuppressFBWarnings("DM_EXIT")
System.exit(-1);
}
}
try {
options = new CommandLineOptions();
if (!options.parse(args)) {
+ // @SuppressFBWarnings("DM_EXIT")
System.exit(0);
}
private static final String PUNCT = ",;:$&+=";
private static final String RESERVED = PUNCT + "?/[]@";
+ /* not used
private static boolean isValidURIChar(char ch) {
return true;
}
+ */
private static boolean isDigit(char ch) {
return (ch >= '0' && ch <= '9');
return 100000;
}
- private static PercentBaseContext pseudoContextForValidation;
+ private static PercentBaseContext pseudoContextForValidation = new ValidationPercentBaseContext();
/** @return a base context for validation purposes. See class description. */
public static PercentBaseContext getPseudoContext() {
- if (pseudoContextForValidation == null) {
- pseudoContextForValidation = new ValidationPercentBaseContext();
- }
return pseudoContextForValidation;
}
return enums[enumValue];
}
+ static {
+ /* this method was never called before */
+ generics = new PropertyMaker[PROPERTY_COUNT + 1];
+ FOPropertyMapping gp = new FOPropertyMapping();
+
+ /* Create the shorthand first. They are
+ * referenced by the real properties.
+ */
+ gp.createShorthandProperties();
+ gp.createGenerics();
+ gp.createAccessibilityProperties();
+ gp.createAbsolutePositionProperties();
+ gp.createAuralProperties();
+ gp.createBorderPaddingBackgroundProperties();
+ gp.createFontProperties();
+ gp.createHyphenationProperties();
+ gp.createMarginBlockProperties();
+ gp.createMarginInlineProperties();
+ gp.createRelativePosProperties();
+ gp.createAreaAlignmentProperties();
+ gp.createAreaDimensionProperties();
+ gp.createBlockAndLineProperties();
+ gp.createCharacterProperties();
+ gp.createColorProperties();
+ gp.createFloatProperties();
+ gp.createKeepsAndBreaksProperties();
+ gp.createLayoutProperties();
+ gp.createLeaderAndRuleProperties();
+ gp.createDynamicProperties();
+ gp.createMarkersProperties();
+ gp.createNumberToStringProperties();
+ gp.createPaginationAndLayoutProperties();
+ gp.createTableProperties();
+ gp.createWritingModeProperties();
+ gp.createMiscProperties();
+
+ // Hardcode the subproperties.
+ addSubpropMakerName("length", CP_LENGTH);
+ addSubpropMakerName("conditionality", CP_CONDITIONALITY);
+ addSubpropMakerName("block-progression-direction", CP_BLOCK_PROGRESSION_DIRECTION);
+ addSubpropMakerName("inline-progression-direction", CP_INLINE_PROGRESSION_DIRECTION);
+ addSubpropMakerName("within-line", CP_WITHIN_LINE);
+ addSubpropMakerName("within-column", CP_WITHIN_COLUMN);
+ addSubpropMakerName("within-page", CP_WITHIN_PAGE);
+ addSubpropMakerName("minimum", CP_MINIMUM);
+ addSubpropMakerName("maximum", CP_MAXIMUM);
+ addSubpropMakerName("optimum", CP_OPTIMUM);
+ addSubpropMakerName("precedence", CP_PRECEDENCE);
+ }
+
/**
* Return the array of Makers.
* @return the maker array.
*/
public static PropertyMaker[] getGenericMappings() {
-
- if (generics == null) {
- /* this method was never called before */
- generics = new PropertyMaker[PROPERTY_COUNT + 1];
- FOPropertyMapping gp = new FOPropertyMapping();
-
- /* Create the shorthand first. They are
- * referenced by the real properties.
- */
- gp.createShorthandProperties();
- gp.createGenerics();
- gp.createAccessibilityProperties();
- gp.createAbsolutePositionProperties();
- gp.createAuralProperties();
- gp.createBorderPaddingBackgroundProperties();
- gp.createFontProperties();
- gp.createHyphenationProperties();
- gp.createMarginBlockProperties();
- gp.createMarginInlineProperties();
- gp.createRelativePosProperties();
- gp.createAreaAlignmentProperties();
- gp.createAreaDimensionProperties();
- gp.createBlockAndLineProperties();
- gp.createCharacterProperties();
- gp.createColorProperties();
- gp.createFloatProperties();
- gp.createKeepsAndBreaksProperties();
- gp.createLayoutProperties();
- gp.createLeaderAndRuleProperties();
- gp.createDynamicProperties();
- gp.createMarkersProperties();
- gp.createNumberToStringProperties();
- gp.createPaginationAndLayoutProperties();
- gp.createTableProperties();
- gp.createWritingModeProperties();
- gp.createMiscProperties();
-
- // Hardcode the subproperties.
- addSubpropMakerName("length", CP_LENGTH);
- addSubpropMakerName("conditionality", CP_CONDITIONALITY);
- addSubpropMakerName("block-progression-direction", CP_BLOCK_PROGRESSION_DIRECTION);
- addSubpropMakerName("inline-progression-direction", CP_INLINE_PROGRESSION_DIRECTION);
- addSubpropMakerName("within-line", CP_WITHIN_LINE);
- addSubpropMakerName("within-column", CP_WITHIN_COLUMN);
- addSubpropMakerName("within-page", CP_WITHIN_PAGE);
- addSubpropMakerName("minimum", CP_MINIMUM);
- addSubpropMakerName("maximum", CP_MAXIMUM);
- addSubpropMakerName("optimum", CP_OPTIMUM);
- addSubpropMakerName("precedence", CP_PRECEDENCE);
- }
-
// @SuppressFBWarnings("MS_EXPOSE_REP")
return generics;
}
*/
public class NullCharIterator extends CharIterator {
- private static CharIterator instance;
+ private static CharIterator instance = new NullCharIterator();
/**
* Obtain the singleton instance of the null character iterator.
* @return the char iterator
*/
public static CharIterator getInstance() {
- if (instance == null) {
- instance = new NullCharIterator();
- }
return instance;
}
* as defined by XSL (space, newline, CR, tab).
* @param c The character to check
*/
+ /* not used
private static boolean isSpace(char c) {
switch (c) {
case ' ':
return false;
}
}
+ */
/**
* Return a boolean value indicating whether the argument is a valid name
= new PropertyCache<MarkerAttribute>();
/** namespace */
- protected String namespace;
+ private String namespace;
/** qualfied name */
- protected String qname;
+ private String qname;
/** local name */
- protected String name;
+ private String name;
/** value */
- protected String value;
+ private String value;
/**
* Main constructor
/**
* The color represented by this property.
*/
- protected final Color color;
+ private final Color color;
/**
}
}
}
- if (pret != null) {
- /*
- * log.debug("Return shorthand value " + pret.getString() +
- * " for " + getPropName());
- */
- }
return pret;
}
*/
private Map<String, Long> failedFontMap;
- /**
- * Default constructor
- */
- public FontCache() {
- //nop
+ private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
+ ois.defaultReadObject();
}
private static File getUserHome() {
multiFont.setWidthArray(wds);
} else if ("bfranges".equals(localName)) {
- multiFont.setCMap(bfranges.toArray(new CMapSegment[0]));
+ multiFont.setCMap(bfranges.toArray(new CMapSegment[bfranges.size()]));
}
text.setLength(0); //Reset text buffer (see characters())
}
package org.apache.fop.fonts;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.io.Serializable;
//This is only a cache
private transient String key;
+ public FontTriplet() {
+ this(null, null, 0);
+ }
+
/**
* Creates a new font triplet.
* @param name font name
this.priority = priority;
}
+ private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
+ ois.defaultReadObject();
+ }
+
/** @return the font name */
public String getName() {
return name;
public abstract class AbstractFontReader {
/** Logger instance */
- protected static Log log;
+ protected static final Log log = LogFactory.getLog(AbstractFontReader.class);
/**
* Main constructor.
*/
protected AbstractFontReader() {
- // Create logger if necessary here to allow embedding of TTFReader in
- // other applications. There is a possible but harmless synchronization
- // issue.
- if (log == null) {
- log = LogFactory.getLog(AbstractFontReader.class);
- }
}
/**
arguments.add(args[i]);
}
}
- return (String[])arguments.toArray(new String[0]);
+ return (String[])arguments.toArray(new String[arguments.size()]);
}
/**
h2 = ttf.getAnsiKerning().get(kpx1);
}
- for (Integer kpx2 : h2.keySet()) {
+ for (Map.Entry<Integer, Integer> e : h2.entrySet()) {
+ Integer kpx2 = e.getKey();
if (isCid || kpx2.intValue() < 256) {
el2 = doc.createElement("pair");
el2.setAttribute("kpx2", kpx2.toString());
- Integer val = h2.get(kpx2);
+ Integer val = e.getValue();
el2.setAttribute("kern", val.toString());
el.appendChild(el2);
}
tag[2] = in.readTTFByte();
tag[3] = in.readTTFByte();
- in.skip(4); // Skip checksum
-
+ checksum = in.readTTFLong();
offset = in.readTTFULong();
length = in.readTTFULong();
protected void updateBBoxAndOffset() throws IOException {
List<Mapping> gidMappings = getGIDMappings(fileFont);
Map<Integer, String> sidNames = constructNameMap(gidMappings);
- UnicodeMapping[] mappings = unicodeMappings.toArray(new UnicodeMapping[0]);
+ UnicodeMapping[] mappings = unicodeMappings.toArray(new UnicodeMapping[unicodeMappings.size()]);
for (int i = 0; i < mappings.length; i++) {
int glyphIdx = mappings[i].getGlyphIndex();
Mapping m = gidMappings.get(glyphIdx);
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Set;
import org.apache.fontbox.cff.CFFStandardString;
import org.apache.fontbox.cff.encoding.CFFEncoding;
List<Integer> uniqueGroups = new ArrayList<Integer>();
for (int gid : subsetGlyphs.keySet()) {
- Integer[] ranges = fdSelect.getRanges().keySet().toArray(new Integer[0]);
+ Set<Integer> rangeKeys = fdSelect.getRanges().keySet();
+ Integer[] ranges = rangeKeys.toArray(new Integer[rangeKeys.size()]);
for (int i = 0; i < ranges.length; i++) {
int nextRange = -1;
if (i < ranges.length - 1) {
/**
* Print first char/last char
*/
+ /* not used
private void printMaxMin() {
int min = 255;
int max = 0;
log.info("Min: " + min);
log.info("Max: " + max);
}
+ */
/**
Map<Integer, Integer> akpx = new HashMap<Integer, Integer>();
Map<Integer, Integer> ckpx = kerningTab.get(unicodeKey1);
- for (Integer unicodeKey2 : ckpx.keySet()) {
+ for (Map.Entry<Integer, Integer> e : ckpx.entrySet()) {
+ Integer unicodeKey2 = e.getKey();
Integer cidKey2 = unicodeToGlyph(unicodeKey2.intValue());
- Integer kern = ckpx.get(unicodeKey2);
+ Integer kern = e.getValue();
Iterator uniMap = mtxTab[cidKey2.intValue()].getUnicodeIndex().listIterator();
while (uniMap.hasNext()) {
ret.add(new Integer(i));
}
}
- return ret.toArray(new Integer[0]);
+ return ret.toArray(new Integer[ret.size()]);
}
/**
* @throws IOException In case of an I/O problem
*/
private void loadHeader(PFMInputStream inStream) throws IOException {
- inStream.skip(80);
+ if (inStream.skip(80) != 80) {
+ throw new IOException("premature EOF when skipping 80 bytes");
+ }
dfItalic = inStream.readByte();
- inStream.skip(2);
+ if (inStream.skip(2) != 2) {
+ throw new IOException("premature EOF when skipping 2 bytes");
+ }
inStream.readShort(); // dfWeight =
dfCharSet = inStream.readByte();
- inStream.skip(4);
+ if (inStream.skip(4) != 4) {
+ throw new IOException("premature EOF when skipping 4 bytes");
+ }
dfPitchAndFamily = inStream.readByte();
dfAvgWidth = inStream.readShort();
dfMaxWidth = inStream.readShort();
dfFirstChar = inStream.readByte();
dfLastChar = inStream.readByte();
- inStream.skip(8);
+ if (inStream.skip(8) != 8) {
+ throw new IOException("premature EOF when skipping 8 bytes");
+ }
long faceOffset = inStream.readInt();
inStream.reset();
- inStream.skip(faceOffset);
+ if (inStream.skip(faceOffset) != faceOffset) {
+ throw new IOException("premature EOF when skipping faceOffset bytes");
+ }
windowsName = inStream.readString();
inStream.reset();
- inStream.skip(117);
+ if (inStream.skip(117) != 117) {
+ throw new IOException("premature EOF when skipping 117 bytes");
+ }
}
/**
}
final long extMetricsOffset = inStream.readInt();
final long extentTableOffset = inStream.readInt();
- inStream.skip(4); //Skip dfOriginTable
+ if (inStream.skip(4) != 4) { //Skip dfOriginTable
+ throw new IOException("premature EOF when skipping dfOriginTable bytes");
+ }
final long kernPairOffset = inStream.readInt();
- inStream.skip(4); //Skip dfTrackKernTable
+ if (inStream.skip(4) != 4) { //Skip dfTrackKernTable
+ throw new IOException("premature EOF when skipping dfTrackKernTable bytes");
+ }
long driverInfoOffset = inStream.readInt();
if (kernPairOffset > 0) {
inStream.reset();
- inStream.skip(kernPairOffset);
+ if (inStream.skip(kernPairOffset) != kernPairOffset) {
+ throw new IOException("premature EOF when skipping kernPairOffset bytes");
+ }
loadKernPairs(inStream);
}
inStream.reset();
- inStream.skip(driverInfoOffset);
+ if (inStream.skip(driverInfoOffset) != driverInfoOffset) {
+ throw new IOException("premature EOF when skipping driverInfoOffset bytes");
+ }
postscriptName = inStream.readString();
if (extMetricsOffset != 0) {
inStream.reset();
- inStream.skip(extMetricsOffset);
+ if (inStream.skip(extMetricsOffset) != extMetricsOffset) {
+ throw new IOException("premature EOF when skipping extMetricsOffset bytes");
+ }
loadExtMetrics(inStream);
}
if (extentTableOffset != 0) {
inStream.reset();
- inStream.skip(extentTableOffset);
+ if (inStream.skip(extentTableOffset) != extentTableOffset) {
+ throw new IOException("premature EOF when skipping extentTableOffset bytes");
+ }
loadExtentTable(inStream);
}
log.warn("Size of extension block was expected to be "
+ "52 bytes, but was " + size + " bytes.");
}
- inStream.skip(12); //Skip etmPointSize, etmOrientation, etmMasterHeight,
- //etmMinScale, etmMaxScale, emtMasterUnits
+ if (inStream.skip(12) != 12) { //Skip etmPointSize, etmOrientation, etmMasterHeight,
+ //etmMinScale, etmMaxScale, emtMasterUnits
+ throw new IOException("premature EOF when skipping etmPointSize, ... bytes");
+ }
etmCapHeight = inStream.readShort();
etmXHeight = inStream.readShort();
etmLowerCaseAscent = inStream.readShort();
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import java.io.Serializable;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Collections;
*
* <p>This work was authored by Carlos Villegas (cav@uniscope.co.jp).</p>
*/
-public class HyphenationTree extends TernaryTree
- implements PatternConsumer, Serializable {
+public class HyphenationTree extends TernaryTree implements PatternConsumer {
private static final long serialVersionUID = -7842107987915665573L;
vspace.alloc(1); // this reserves index 0, which we don't use
}
+ private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
+ ois.defaultReadObject();
+ }
+
/**
* Packs the values by storing them in 4 bits, two values into a byte
* Values range is from 0 to 9. We use zero as terminator,
public final class Hyphenator {
/** logging instance */
- protected static final Log log = LogFactory.getLog(Hyphenator.class);
+ private static final Log log = LogFactory.getLog(Hyphenator.class);
private static HyphenationTreeCache hTreeCache;
if (currentPageNum % 2 == 0) { // we are now on an even page
curPage = makeNewPage(true);
}
- } else if (forcePageCount == Constants.EN_NO_FORCE) {
+ } /* else if (forcePageCount == Constants.EN_NO_FORCE) {
// i hope: nothing special at all
- }
+ } */
if (curPage != null) {
finishPage();
protected void addChildToArea(Area childArea,
BlockParent parentArea) {
// This should be a block-level Area (Block in the generic sense)
- if (!(childArea instanceof Block)) {
+ /* if (!(childArea instanceof Block)) {
//log.error("Child not a Block in BlockStackingLM!");
- }
+ } */
parentArea.addBlock((Block) childArea);
flush(); // hand off current area to parent
* and filling them with block-level areas generated by its children.
* TODO Reintroduce emergency counter (generate error to avoid endless loop)
*/
-public class FlowLayoutManager extends BlockStackingLayoutManager
- implements BlockLevelLayoutManager {
+public class FlowLayoutManager extends BlockStackingLayoutManager {
/**
* logging instance
private Block curBlockArea;
private int xOffset;
- private int itemIPD;
+ // private int itemIPD; // FIXME: never written!
/**
* Create a new Cell layout manager.
curBlockArea.setPositioning(Block.ABSOLUTE);
// set position
curBlockArea.setXOffset(xOffset);
- //TODO: Check - itemIPD never set?
- curBlockArea.setIPD(itemIPD);
+ // FIXME - itemIPD is never written!
+ curBlockArea.setIPD(/*itemIPD*/0);
//curBlockArea.setHeight();
curBlockArea.setBidiLevel(getPartFO().getBidiLevel());
/** Indicates that the cell is/end in the last row of a body/table-header/table-footer */
//public static final int LAST_ROW_IN_GROUP = 8;
- //These statics are used singleton-style. No MT issues here.
- private static CollapsingBorderModel collapse;
+ private static CollapsingBorderModel collapse = new CollapsingBorderModelEyeCatching();
// private static CollapsingBorderModel collapseWithPrecedence = null;
/**
public static CollapsingBorderModel getBorderModelFor(int borderCollapse) {
switch (borderCollapse) {
case Constants.EN_COLLAPSE:
- if (collapse == null) {
- collapse = new CollapsingBorderModelEyeCatching();
- }
return collapse;
case Constants.EN_COLLAPSE_WITH_PRECEDENCE:
throw new UnsupportedOperationException("collapse-with-precedence not yet supported");
import org.apache.fop.fo.properties.CommonBorderPaddingBackground.BorderInfo;
import org.apache.fop.layoutmgr.AbstractLayoutManager;
import org.apache.fop.layoutmgr.AreaAdditionUtil;
-import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
import org.apache.fop.layoutmgr.ElementListObserver;
import org.apache.fop.layoutmgr.ElementListUtils;
* LayoutManager for a table-cell FO.
* A cell contains blocks. These blocks fill the cell.
*/
-public class TableCellLayoutManager extends BlockStackingLayoutManager
- implements BlockLevelLayoutManager {
+public class TableCellLayoutManager extends BlockStackingLayoutManager {
/**
* logging instance
package org.apache.fop.pdf;
-import java.util.Iterator;
import java.util.Map;
+import java.util.Set;
/**
* Class representing a /ExtGState object.
if (vals1.size() != vals2.size()) {
return false;
}
- for (Iterator iter = vals1.keySet().iterator(); iter.hasNext();) {
- Object str = iter.next();
+ for (Map.Entry<Object, Object> e : (Set<Map.Entry<Object, Object>>) vals2.entrySet()) {
+ Object str = e.getKey();
Object obj1 = vals1.get(str);
- if (!obj1.equals(vals2.get(str))) {
+ if (!obj1.equals(e.getValue())) {
return false;
}
}
return (PDFData)getData();
}
+ // @SuppressFBWarnings("SE_INNER_CLASS")
private class PDFData extends org.apache.fop.util.AbstractPaintingState.AbstractData {
private static final long serialVersionUID = 3527950647293177764L;
*/
public void addFonts(PDFDocument doc, FontInfo fontInfo) {
Map<String, Typeface> usedFonts = fontInfo.getUsedFonts();
- for (String f : usedFonts.keySet()) {
- Typeface font = usedFonts.get(f);
+ for (Map.Entry<String, Typeface> e : usedFonts.entrySet()) {
+ String f = e.getKey();
+ Typeface font = e.getValue();
//Check if the font actually had any mapping operations. If not, it is an indication
//that it has never actually been used and therefore doesn't have to be embedded.
import org.apache.fop.render.RendererConfig.RendererConfigParser;
import org.apache.fop.render.afp.AFPFontConfig.AFPFontConfigData;
import org.apache.fop.render.intermediate.IFDocumentHandler;
-import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator;
import org.apache.fop.util.LogUtil;
/**
* AFP Renderer configurator
*/
-public class AFPRendererConfigurator extends PrintRendererConfigurator implements
- IFDocumentHandlerConfigurator {
+public class AFPRendererConfigurator extends PrintRendererConfigurator {
private static Log log = LogFactory.getLog(AFPRendererConfigurator.class);
private final AFPEventProducer eventProducer;
GoToXYAction action = (GoToXYAction)actionSet.get(targetID);
//GoToXYAction action = (GoToXYAction)idGoTos.get(targetID);
if (action == null) {
- if (pageIndex < 0) {
+ /* if (pageIndex < 0) {
//pageIndex = page
- }
+ } */
Point position = (Point)idPositions.get(targetID);
// can the GoTo already be fully filled in?
if (pageIndex >= 0 && position != null) {
AbstractTextArea textArea = (AbstractTextArea)space.getParentArea();
renderTextWithAdjustments(s, (int[]) null, false, font, textArea);
- if (textUtil.combined && space.isAdjustable()) {
+ /* COMBINED is always false
+ if (textUtil.COMBINED && space.isAdjustable()) {
//Used for justified text, for example
int tws = textArea.getTextWordSpaceAdjust()
+ 2 * textArea.getTextLetterSpaceAdjust();
textUtil.adjust(tws);
}
}
+ */
super.renderSpace(space);
}
char ch = s.charAt(i);
textUtil.addChar(ch);
int glyphAdjust = 0;
- if (textUtil.combined && font.hasChar(ch)) {
+ /* COMBINED is always false
+ if (textUtil.COMBINED && font.hasChar(ch)) {
int tls = (i < l - 1 ? parentArea.getTextLetterSpaceAdjust() : 0);
glyphAdjust += tls;
}
+ */
if (dx != null && i < l) {
glyphAdjust += dx[i];
}
private void renderTextWithAdjustments(String s,
int[][] dp, boolean reversed,
Font font, AbstractTextArea parentArea) {
- assert !textUtil.combined;
+ // assert !textUtil.COMBINED;
for (int i = 0, n = s.length(); i < n; i++) {
textUtil.addChar(s.charAt(i));
if (dp != null) {
private int starty;
private int tls;
private int tws;
- private final boolean combined = false;
+ // private final static boolean COMBINED = false; // no longer referenced
void addChar(char ch) {
text.append(ch);
void flush() {
if (text.length() > 0) {
try {
- if (combined) {
+ /* if (COMBINED) { // COMBINED is always false
painter.drawText(startx, starty, 0, 0,
trimAdjustments(dp, text.length()), text.toString());
- } else {
+ } else { */
painter.drawText(startx, starty, tls, tws,
trimAdjustments(dp, text.length()), text.toString());
- }
+ /* } */
} catch (IFException e) {
handleIFException(e);
}
import java.awt.Color;
import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.geom.AffineTransform;
-import java.awt.image.BufferedImage;
-import java.awt.image.BufferedImageOp;
-import java.awt.image.ByteLookupTable;
-import java.awt.image.ColorModel;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferByte;
import java.awt.image.IndexColorModel;
-import java.awt.image.LookupOp;
import java.awt.image.MultiPixelPackedSampleModel;
import java.awt.image.Raster;
import java.awt.image.RenderedImage;
-import java.awt.image.WritableRaster;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.output.ByteArrayOutputStream;
-import org.apache.xmlgraphics.image.GraphicsUtil;
import org.apache.xmlgraphics.util.UnitConv;
import org.apache.fop.util.bitmap.BitmapImageUtil;
* true: Standard PCL shades are used (poor quality). false: user-defined pattern are used
* to create custom dither patterns for better grayscale quality.
*/
- private final boolean usePCLShades = false;
+ private static final boolean USE_PCL_SHADES = false;
/**
* Main constructor.
//y += h;
}
setPatternTransparencyMode(false);
- if (usePCLShades
+ if (USE_PCL_SHADES
|| Color.black.equals(col)
|| Color.white.equals(col)) {
writeCommand("*c" + formatDouble4(w / 100.0) + "h"
} else if (Color.white.equals(col)) {
selectCurrentPattern(0, 1); //white
} else {
- if (usePCLShades) {
+ if (USE_PCL_SHADES) {
selectCurrentPattern(convertToPCLShade(col), 2);
} else {
defineGrayscalePattern(col, 32, DitherUtil.DITHER_MATRIX_4X4);
}
}
+ /* not used
private RenderedImage getMask(RenderedImage img, Dimension targetDim) {
ColorModel cm = img.getColorModel();
if (cm.hasAlpha()) {
return null;
}
}
+ */
/**
* Paint a bitmap at the current cursor position. The bitmap is converted to a monochrome
/** The PCL generator */
protected PCLGenerator gen;
- private final boolean failOnUnsupportedFeature = true;
+ private static final boolean FAIL_ON_UNSUPPORTED_FEATURE = true;
private boolean clippingDisabled;
/**
* @param msg the error message to be displayed
*/
protected void handleUnsupportedFeature(String msg) {
- if (this.failOnUnsupportedFeature) {
+ if (this.FAIL_ON_UNSUPPORTED_FEATURE) {
throw new UnsupportedOperationException(msg);
}
}
import org.apache.fop.render.PrintRendererConfigurator;
import org.apache.fop.render.RendererConfig.RendererConfigParser;
import org.apache.fop.render.intermediate.IFDocumentHandler;
-import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator;
import org.apache.fop.render.java2d.Base14FontCollection;
import org.apache.fop.render.java2d.ConfiguredFontCollection;
import org.apache.fop.render.java2d.InstalledFontCollection;
/**
* PCL Renderer configurator
*/
-public class PCLRendererConfigurator extends PrintRendererConfigurator
- implements IFDocumentHandlerConfigurator {
+public class PCLRendererConfigurator extends PrintRendererConfigurator {
/**
* Default constructor
// Check for ICC profile
byte[] iccString = new byte[11];
din.readFully(iccString);
- din.skipBytes(1); //string terminator (null byte)
-
+ if (din.skipBytes(1) != 1) { //string terminator (null byte)
+ throw new IOException("premature EOF when skipping terminator byte");
+ }
if ("ICC_PROFILE".equals(new String(iccString, "US-ASCII"))) {
skipICCProfile = (this.image.getICCProfile() != null);
}
public void startPage(int index, String name, String pageMasterName, Dimension size)
throws IFException {
try {
- if (this.currentPageNumber == 0) {
+ /* if (this.currentPageNumber == 0) {
//writeHeader();
- }
+ } */
this.currentPageNumber++;
/**
* Utility code for font handling in PostScript.
*/
+// @SuppressFBWarnings("NM_SAME_SIMPLE_NAME_AS_SUPERCLASS")
public class PSFontUtils extends org.apache.xmlgraphics.ps.PSFontUtils {
/** logging instance */
gen.commentln("%FOPBeginFontReencode");
//Rewrite font encodings
- for (String key : fonts.keySet()) {
- Typeface tf = fonts.get(key);
+ for (Map.Entry<String, Typeface> e : fonts.entrySet()) {
+ String key = e.getKey();
+ Typeface tf = e.getValue();
if (tf instanceof LazyFont) {
tf = ((LazyFont)tf).getRealFont();
if (tf == null) {
/**
* Utility code for rendering images in PostScript.
*/
+// @SuppressFBWarnings("NM_SAME_SIMPLE_NAME_AS_SUPERCLASS")
public class PSImageUtils extends org.apache.xmlgraphics.ps.PSImageUtils {
/**
import org.apache.fop.render.DefaultRendererConfigurator;
import org.apache.fop.render.RendererConfig.RendererConfigParser;
import org.apache.fop.render.intermediate.IFDocumentHandler;
-import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator;
/**
* Postscript renderer config
*/
-public class PSRendererConfigurator extends DefaultRendererConfigurator
- implements IFDocumentHandlerConfigurator {
+public class PSRendererConfigurator extends DefaultRendererConfigurator {
/**
* Default constructor
package org.apache.fop.render.ps;
-import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import java.io.InputStream;
import org.apache.xmlgraphics.image.loader.ImageSessionContext;
import org.apache.xmlgraphics.image.loader.util.ImageUtil;
import org.apache.xmlgraphics.ps.DSCConstants;
-import org.apache.xmlgraphics.ps.FormGenerator;
import org.apache.xmlgraphics.ps.PSGenerator;
import org.apache.xmlgraphics.ps.PSResource;
import org.apache.xmlgraphics.ps.dsc.DSCException;
}
}
+ /* not used
private static FormGenerator createMissingForm(String formName, final Dimension2D dimensions) {
FormGenerator formGen = new FormGenerator(formName, null, dimensions) {
};
return formGen;
}
+ */
private class IncludeResourceListener implements DSCListener {
attrFontColor(fobj.getColor(), attrib);
- if (fobj.getLeaderPatternWidth() != null) {
+ /* if (fobj.getLeaderPatternWidth() != null) {
//TODO calculate pattern width not possible for white spaces, because its using
//underlines for tab it would work with LEADER_PATTERN_WIDTH (expndtw)
- }
+ } */
switch(fobj.getLeaderPattern()) {
case Constants.EN_DOTS:
//////////////////////////////////////////////////
/** Singelton instance */
- private static RtfColorTable instance;
+ private static RtfColorTable instance = new RtfColorTable();
/** Index table for the colors */
private Hashtable colorIndex;
/** Used colors to this vector */
private Vector colorTable;
- /** Map of color names to color numbers */
- private Hashtable namedColors;
+ /** Map of color names to color numbers */
+ private Hashtable namedColors;
//////////////////////////////////////////////////
private RtfColorTable() {
colorTable = new Vector();
colorIndex = new Hashtable();
- namedColors = new Hashtable();
+ namedColors = new Hashtable();
init();
}
* @return The instance of RTFColorTable
*/
public static RtfColorTable getInstance() {
- if (instance == null) {
- instance = new RtfColorTable();
- }
-
return instance;
}
getColorNumber(192, 192, 192);
}
- /** define a named color for getColorNumber(String) */
- private void addNamedColor(String name, int colorNumber) {
- namedColors.put(name.toLowerCase(), new Integer(colorNumber));
- }
+ /** define a named color for getColorNumber(String) */
+ private void addNamedColor(String name, int colorNumber) {
+ namedColors.put(name.toLowerCase(), new Integer(colorNumber));
+ }
//////////////////////////////////////////////////
// @@ Public methods
//////////////////////////////////////////////////
- /**
- * @param name a named color
- * @return the RTF number of a named color, or null if name not found
- */
+ /**
+ * @param name a named color
+ * @return the RTF number of a named color, or null if name not found
+ */
public Integer getColorNumber(String name) {
return ((Integer)namedColors.get(name.toLowerCase()));
}
//////////////////////////////////////////////////
/** Singelton instance */
- private static RtfFontManager instance;
+ private static RtfFontManager instance = new RtfFontManager();
/** Index table for the fonts */
private Hashtable fontIndex;
* @return The instance of RtfFontManager
*/
public static RtfFontManager getInstance() {
- if (instance == null) {
- instance = new RtfFontManager();
- }
-
return instance;
}
*/
class RtfHeader extends RtfContainer {
- private final String charset = "ansi";
+ private static final String CHARSET = "ansi";
private final Map userProperties = new HashMap();
/** Create an RTF header */
/** Overridden to write our own data before our children's data */
protected void writeRtfContent() throws IOException {
- writeControlWord(charset);
+ writeControlWord(CHARSET);
writeUserProperties();
RtfColorTable.getInstance().writeColors(this);
super.writeRtfContent();
//////////////////////////////////////////////////
/** Singelton instance */
- private static RtfStyleSheetTable instance;
+ private static RtfStyleSheetTable instance = new RtfStyleSheetTable();
//////////////////////////////////////////////////
* @return The instance of RtfStyleSheetTable
*/
public static RtfStyleSheetTable getInstance() {
- if (instance == null) {
- instance = new RtfStyleSheetTable();
- }
-
return instance;
}
public final class RtfTemplate {
/** Singelton instance */
- private static RtfTemplate instance;
+ private static RtfTemplate instance = new RtfTemplate();
private String templateFilePath;
* @return The instance of RtfTemplate
*/
public static RtfTemplate getInstance() {
- if (instance == null) {
- instance = new RtfTemplate();
- }
-
return instance;
}
* Every line except the last line on a page (which will end with
* pageEnding) will be terminated with this string.
*/
- private final String lineEnding = "\r\n";
+ private static final String LINE_ENDING = "\r\n";
/** Every page except the last one will end with this string. */
- private final String pageEnding = "\f";
+ private static final String PAGE_ENDING = "\f";
/** Equals true, if current page is first. */
private boolean firstPage;
if (firstPage) {
firstPage = false;
} else {
- currentStream.add(pageEnding);
+ currentStream.add(PAGE_ENDING);
}
Rectangle2D bounds = page.getViewArea();
currentStream.add(outr.toString());
}
if (row < pageHeight) {
- currentStream.add(lineEnding);
+ currentStream.add(LINE_ENDING);
}
}
}
* for JDK 1.3 because there is no VolatileImage there.
*
*/
+// @SuppressFBWarnings("NM_SAME_SIMPLE_NAME_AS_SUPERCLASS")
public abstract class GraphicsConfiguration extends java.awt.GraphicsConfiguration {
/**
* Utility class for generating PDF text objects. It needs to be subclassed to add writing
* functionality (see {@link #write(String)}).
*/
+// @SuppressFBWarnings("NM_SAME_SIMPLE_NAME_AS_SUPERCLASS")
public abstract class PDFTextUtil extends org.apache.fop.pdf.PDFTextUtil {
private FontInfo fontInfo;
runTestCase(node);
} else if (nodename.equals("test")) {
runTest(tcase, node);
- } else if (nodename.equals("result")) {
+ } /* else if (nodename.equals("result")) {
//nop
- }
+ } */
}
filenameListTmp.add(tokens.nextToken());
}
filenameList = new String[filenameListTmp.size()];
- filenameList = (String[])filenameListTmp.toArray(new String[0]);
+ filenameList = (String[])filenameListTmp.toArray(new String[filenameListTmp.size()]);
}
/**
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.Map;
+import java.util.Set;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
System.out.println("====================================");
System.out.println("The following files differ:");
boolean broke = false;
- for (Iterator keys = diff.keySet().iterator();
- keys.hasNext();) {
- Object fname = keys.next();
- Boolean pass = (Boolean)diff.get(fname);
+ for (Map.Entry<Object, Object> e : (Set<Map.Entry<Object, Object>>) diff.entrySet()) {
+ Object fname = e.getKey();
+ Boolean pass = (Boolean)e.getValue();
System.out.println("file: " + fname
+ " - reference success: " + pass);
if (pass.booleanValue()) {
int idx = 0;
if ("--help".equals(args[idx]) || "-?".equals(args[idx]) || "-h".equals(args[idx])) {
printHelp();
+ // @SuppressFBWarnings("DM_EXIT")
System.exit(0);
}
if (idx < args.length - 1 && "-c".equals(args[idx])) {
/**
* A stack implementation which holds state objects
*/
+ // @SuppressFBWarnings("SE_INNER_CLASS")
public class StateStack<E> extends java.util.Stack<E> {
private static final long serialVersionUID = 4897178211223823041L;
private static Map<String, Color> colorMap;
/** Logger instance */
- protected static final Log log = LogFactory.getLog(ColorUtil.class);
+ private static final Log log = LogFactory.getLog(ColorUtil.class);
static {
initializeColorMap();
* hashCode() methods.
* @deprecated Use the XML Graphics Commons variant instead!
*/
+// @SuppressFBWarnings("NM_SAME_SIMPLE_NAME_AS_SUPERCLASS")
public class QName extends org.apache.xmlgraphics.util.QName {
private static final long serialVersionUID = -5225376740044770690L;