</And>
</Or>
</Match>
+ <Match>
+ <!-- Only OK as long as the type of the base map remains plain HashMap... -->
+ <Bug pattern="DMI_ENTRY_SETS_MAY_REUSE_ENTRY_OBJECTS"/>
+ <And>
+ <Class name="org.apache.fop.fonts.truetype.OpenFont"/>
+ <Method name="sortDirTabMap"/>
+ </And>
+ </Match>
<Match>
<Bug pattern="EQ_ALWAYS_TRUE"/>
<Or>
<Class name="org.apache.fop.util.QName"/>
</Or>
</Match>
+ <Match>
+ <Bug pattern="OS_OPEN_STREAM_EXCEPTION_PATH"/>
+ <!-- TODO - fix potential file descriptor leak -->
+ <And>
+ <Class name="org.apache.fop.hyphenation.SerializeHyphPattern"/>
+ <Method name="serializeFile"/>
+ </And>
+ </Match>
<Match>
<Bug pattern="SE_INNER_CLASS"/>
<Or>
</And>
</Or>
</Match>
+ <Match>
+ <Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"/>
+ <Or>
+ <!-- TODO - fix later -->
+ <Class name="org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement"/>
+ <!-- FOs not yet implemented -->
+ <Class name="org.apache.fop.fo.flow.MultiProperties"/>
+ <Class name="org.apache.fop.fo.flow.MultiPropertySet"/>
+ <Class name="org.apache.fop.fo.flow.MultiToggle"/>
+ <Class name="org.apache.fop.fo.flow.table.TableAndCaption"/>
+ <Class name="org.apache.fop.fo.flow.table.TableCaption"/>
+ </Or>
+ </Match>
+ <Match>
+ <Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"/>
+ <Or>
+ <!-- TODO - Implementation incomplete?
+ If not, remove unused field(s) and unused accessors -->
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphProcessingState"/>
+ <Class name="org.apache.fop.layoutmgr.inline.InlineStackingLayoutManager"/>
+ <Class name="org.apache.fop.pdf.PDFCMap"/>
+ <Class name="org.apache.fop.render.pdf.PDFSVGHandler$PDFInfo"/>
+ <Class name="org.apache.fop.svg.PDFGraphics2D"/>
+ <!-- Properties not yet implemented -->
+ <Class name="org.apache.fop.fo.flow.MultiToggle"/>
+ <Class name="org.apache.fop.fo.properties.CommonMarginInline"/>
+ <Class name="org.apache.fop.fo.properties.CommonRelativePosition"/>
+ </Or>
+ </Match>
+ <Match>
+ <Bug pattern="UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD"/>
+ <!-- Properties not yet implemented -->
+ <Class name="org.apache.fop.fo.properties.CommonAural"/>
+ </Match>
<!-- END - APPROVED EXCLUSIONS -->
<!-- START - TEMPORARY (UNAPPROVED) EXCLUSIONS -->
<!-- 29 warnings -->
<Bug pattern="DM_CONVERT_CASE"/>
</Match>
+ <Match>
+ <!-- 17 warnings -->
+ <Bug pattern="DM_DEFAULT_ENCODING"/>
+ </Match>
<Match>
<!-- 20 warnings -->
<Bug pattern="DM_FP_NUMBER_CTOR"/>
*/
// write out any external resource groups
public void close() throws IOException {
- Iterator it = pathResourceGroupMap.values().iterator();
- while (it.hasNext()) {
- StreamedResourceGroup resourceGroup = (StreamedResourceGroup)it.next();
- resourceGroup.close();
+ for (ResourceGroup resourceGroup : pathResourceGroupMap.values()) {
+ // TODO - Why not a Map<URI, StreamedResourceGroup>, if all the elements are expected to be of that type?
+ assert (resourceGroup instanceof StreamedResourceGroup);
+ ((StreamedResourceGroup) resourceGroup).close();
}
// close any open print-file resource group
if (printFileResourceGroup != null) {
} else if (regionBody == null) {
return true;
} else {
- BodyRegion body = (BodyRegion)regionBody.getRegionReference();
- return body.isEmpty();
+ return regionBody.getRegionReference().isEmpty();
}
}
* This will retrieve a marker with the class name
* and position.
*
- * @param name The class name of the marker to retrieve
- * @param pos the position to retrieve
+ * @param rm the retrieve-marker instance
* @return Object the marker found or null
*/
public Marker resolveMarker(AbstractRetrieveMarker rm) {
page = (Page) in.readObject();
unresolvedIDRefs = page.getUnresolvedReferences();
if (unresolvedIDRefs != null && pendingResolved != null) {
- for (String id : pendingResolved.keySet()) {
- resolveIDRef(id, pendingResolved.get(id));
+ for (Map.Entry<String, List<PageViewport>> e : pendingResolved.entrySet()) {
+ resolveIDRef(e.getKey(), e.getValue());
}
pendingResolved = null;
}
* @return BodyRegion object
*/
public BodyRegion getBodyRegion() {
- return (BodyRegion) getPage().getRegionViewport(FO_REGION_BODY).getRegionReference();
+ RegionReference regionReference = getPage().getRegionViewport(FO_REGION_BODY).getRegionReference();
+ assert (regionReference instanceof BodyRegion);
+ return (BodyRegion) regionReference;
}
/**
addChildArea(block);
}
+ /**
+ * indicates whether the main reference area has any child areas added to it
+ *
+ * @return whether the main reference area has any child areas added to it
+ */
+ public boolean isEmpty() {
+ return true;
+ }
+
/** {@inheritDoc} */
public Object clone() throws CloneNotSupportedException {
RegionReference rr = (RegionReference) super.clone();
* @param ipdVariation the difference between new and old ipd
*/
protected void notifyIPDVariation(int ipdVariation) {
- if (getParentArea() instanceof InlineArea) {
- ((InlineArea) getParentArea()).handleIPDVariation(ipdVariation);
- } else if (getParentArea() instanceof LineArea) {
- ((LineArea) getParentArea()).handleIPDVariation(ipdVariation);
- } else if (getParentArea() == null) {
+ Area parentArea = getParentArea();
+ if (parentArea instanceof InlineArea) {
+ ((InlineArea) parentArea).handleIPDVariation(ipdVariation);
+ } else if (parentArea instanceof LineArea) {
+ ((LineArea) parentArea).handleIPDVariation(ipdVariation);
+ } else if (parentArea == null) {
// parent area not yet set: store the variations
storedIPDVariation += ipdVariation;
}
* @return the text string
*/
public String getText() {
- StringBuffer text = new StringBuffer();
+ StringBuilder text = new StringBuilder();
// assemble the text
for (InlineArea inline : inlines) {
if (inline instanceof WordArea) {
text.append(((WordArea) inline).getWord());
} else {
+ assert (inline instanceof SpaceArea);
text.append(((SpaceArea) inline).getSpace());
}
}
* @param language language identifier
* @param feature feature identifier
* @param sct script context tester (or null)
+ * @return this instance
*/
protected GlyphProcessingState reset(GlyphSequence gs, String script, String language, String feature, ScriptContextTester sct) {
this.gdef = null;
this.indexLast = gs.getGlyphCount();
this.consumed = 0;
this.lookupFlags = 0;
- this.classMatchSet = 0;
+ this.classMatchSet = 0; // @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
this.sct = sct;
this.gct = (sct != null) ? sct.getTester(feature) : null;
this.ignoreBase = new GlyphTester() { public boolean test(int gi, int flags) { return isIgnoredBase(gi, flags); } };
if (!notImplementedWarningGiven) {
getFOValidationEventProducer().unimplementedFeature(this, getName(),
getName(), getLocator());
+ // @SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
notImplementedWarningGiven = true;
}
}
if (!notImplementedWarningGiven) {
getFOValidationEventProducer().unimplementedFeature(this, getName(),
getName(), getLocator());
+ // @SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
notImplementedWarningGiven = true;
}
}
/**
* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_multi-toggle">
- * <code>fo:multi-toggle<code></a> property.
+ * <code>fo:multi-toggle</code></a> property.
*/
public class MultiToggle extends FObj {
// The value of properties relevant for fo:multi-toggle (commented out for performance).
// private CommonAccessibility commonAccessibility;
- public StringProperty prSwitchTo;
+ public StringProperty prSwitchTo; // @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
// End of property values
private static boolean notImplementedWarningGiven;
if (!notImplementedWarningGiven) {
getFOValidationEventProducer().unimplementedFeature(this, getName(),
getName(), getLocator());
+ // @SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
notImplementedWarningGiven = true;
}
}
if (!notImplementedWarningGiven) {
getFOValidationEventProducer().unimplementedFeature(this, getName(),
"fo:table-and-caption", getLocator());
+ // @SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
notImplementedWarningGiven = true;
}
}
if (!notImplementedWarningGiven) {
getFOValidationEventProducer().unimplementedFeature(this, getName(),
"fo:table-caption", getLocator());
+ // @SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
notImplementedWarningGiven = true;
}
}
* Public "structure" allows direct member access.
*/
public class CommonAural {
+ // @SuppressFBWarnings("UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD")
/**
* The "azimuth" property.
*/
* Public "structure" allows direct member access.
*/
public class CommonMarginInline {
-
+ // @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
/**
* The "margin-top" property.
*/
* Public "structure" allows direct member access.
*/
public class CommonRelativePosition {
+ // @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
/**
* The "relative-position" property.
*/
// Create winAnsiEncoded kerning table from kerningTab
// (could probably be simplified, for now we remap back to CID indexes and
// then to winAnsi)
- for (Integer unicodeKey1 : kerningTab.keySet()) {
- Integer cidKey1 = unicodeToGlyph(unicodeKey1.intValue());
+
+ for (Map.Entry<Integer, Map<Integer, Integer>> e1 : kerningTab.entrySet()) {
+ Integer unicodeKey1 = e1.getKey();
+ Integer cidKey1 = unicodeToGlyph(unicodeKey1);
Map<Integer, Integer> akpx = new HashMap<Integer, Integer>();
- Map<Integer, Integer> ckpx = kerningTab.get(unicodeKey1);
+ Map<Integer, Integer> ckpx = e1.getValue();
for (Map.Entry<Integer, Integer> e : ckpx.entrySet()) {
Integer unicodeKey2 = e.getKey();
return (int) (o1.getValue().getOffset() - o2.getValue().getOffset());
}
});
+ // @SuppressFBWarnings("DMI_ENTRY_SETS_MAY_REUSE_ENTRY_OBJECTS")
sortedSet.addAll(directoryTabs.entrySet());
return sortedSet;
}
return name.endsWith(extension);
}
});
- for (int j = 0; j < sourceFiles.length; j++) {
- File infile = new File(sourceDir, sourceFiles[j]);
- String outfilename = sourceFiles[j].substring(0, sourceFiles[j].length()
- - extension.length()) + ".hyp";
- File outfile = new File(targetDir, outfilename);
- serializeFile(infile, outfile);
+ if (sourceFiles != null) {
+ for (String sourceFile : sourceFiles) {
+ File infile = new File(sourceDir, sourceFile);
+ String outfilename = sourceFile.substring(0, sourceFile.length()
+ - extension.length()) + ".hyp";
+ File outfile = new File(targetDir, outfilename);
+ serializeFile(infile, outfile);
+ }
}
}
HyphenationTree hTree = buildPatternFile(infile);
// serialize class
try {
+ // @SuppressFBWarnings("OS_OPEN_STREAM_EXCEPTION_PATH")
ObjectOutputStream out = new ObjectOutputStream(
new java.io.BufferedOutputStream(
new java.io.FileOutputStream(outfile)));
}
}
} else if (innerPosition != null && innerPosition.getLM() != this) {
+ Position lastPosition = lastElement.getPosition();
+ assert (lastPosition instanceof NonLeafPosition);
// this adjustment concerns another LM
- NonLeafPosition savedPos = (NonLeafPosition) lastElement.getPosition();
+ NonLeafPosition savedPos = (NonLeafPosition) lastPosition;
lastElement.setPosition(innerPosition);
- int returnValue = ((BlockLevelLayoutManager)lastElement.getLayoutManager())
+ int returnValue = ((BlockLevelLayoutManager) lastElement.getLayoutManager())
.negotiateBPDAdjustment(adj, lastElement);
lastElement.setPosition(savedPos);
return returnValue;
/** {@inheritDoc} */
public void discardSpace(KnuthGlue spaceGlue) {
assert (spaceGlue != null && spaceGlue.getPosition() != null);
- Position innerPosition = spaceGlue.getPosition().getPosition();
+ Position mainPosition = spaceGlue.getPosition();
+ Position innerPosition = mainPosition.getPosition();
if (innerPosition == null || innerPosition.getLM() == this) {
// if this block has block-progression-unit > 0, innerPosition can be
//TODO Why are both cases handled in the same way?
}
} else {
+ assert (mainPosition instanceof NonLeafPosition);
// this element was not created by this BlockLM
- NonLeafPosition savedPos = (NonLeafPosition)spaceGlue.getPosition();
+ NonLeafPosition savedPos = (NonLeafPosition) mainPosition;
spaceGlue.setPosition(innerPosition);
((BlockLevelLayoutManager) spaceGlue.getLayoutManager()).discardSpace(spaceGlue);
spaceGlue.setPosition(savedPos);
while (!(lm instanceof BlockLayoutManager)) {
lm = lm.getParent();
}
- if (lm instanceof BlockLayoutManager) {
+ if (lm != null) {
startIndent = ((BlockLayoutManager) lm).startIndent;
}
return startIndent;
public int negotiateBPDAdjustment(int adj, KnuthElement lastElement) {
log.debug(" FLM.negotiateBPDAdjustment> " + adj);
- if (lastElement.getPosition() instanceof NonLeafPosition) {
+ Position lastPosition = lastElement.getPosition();
+ if (lastPosition instanceof NonLeafPosition) {
// this element was not created by this FlowLM
- NonLeafPosition savedPos = (NonLeafPosition)lastElement.getPosition();
+ NonLeafPosition savedPos = (NonLeafPosition) lastPosition;
lastElement.setPosition(savedPos.getPosition());
int returnValue = ((BlockLevelLayoutManager)lastElement.getLayoutManager())
.negotiateBPDAdjustment(adj, lastElement);
public void discardSpace(KnuthGlue spaceGlue) {
log.debug(" FLM.discardSpace> ");
- if (spaceGlue.getPosition() instanceof NonLeafPosition) {
+ Position gluePosition = spaceGlue.getPosition();
+ if (gluePosition instanceof NonLeafPosition) {
// this element was not created by this FlowLM
- NonLeafPosition savedPos = (NonLeafPosition)spaceGlue.getPosition();
+ NonLeafPosition savedPos = (NonLeafPosition) gluePosition;
spaceGlue.setPosition(savedPos.getPosition());
((BlockLevelLayoutManager) spaceGlue.getLayoutManager()).discardSpace(spaceGlue);
spaceGlue.setPosition(savedPos);
*/
protected InlineStackingLayoutManager(FObj node) {
super(node);
- extraBPD = MinOptMax.ZERO;
+ extraBPD = MinOptMax.ZERO; // @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
}
/**
/** Selects the table-footer elements for iteration. */
public static final int FOOTER = 2;
- /** The table on which this instance operates. */
- protected Table table;
-
/** Part of the table over which to iterate. One of BODY, HEADER or FOOTER. */
private int tablePart;
* @param tablePart indicates what part of the table to iterate over (HEADER, FOOTER, BODY)
*/
public TableRowIterator(Table table, int tablePart) {
- this.table = table;
this.tablePart = tablePart;
switch(tablePart) {
case HEADER:
/**
* font's writing direction
*/
- protected byte wMode = WMODE_HORIZONTAL;
+ protected byte wMode = WMODE_HORIZONTAL; // @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
/**
* base CMap (String or PDFStream)
public PDFCMap(String name, PDFCIDSystemInfo sysInfo) {
super();
this.name = name;
- this.sysInfo = sysInfo;
- this.base = null;
+ this.sysInfo = sysInfo; // @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
+ this.base = null; // @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
}
/**
log.error("Failed to embed font [" + desc + "] " + desc.getEmbedFontName(), ioe);
return null;
} finally {
- IOUtils.closeQuietly(in);
+ if (in != null) {
+ IOUtils.closeQuietly(in);
+ }
}
}
/** Create an RTF element as a child of given container with given attributes */
RtfElement(RtfContainer parent, Writer w, RtfAttributes attr) throws IOException {
-
+ // @SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
id = idCounter++;
this.parent = parent;
attrib = (attr != null ? attr : new RtfAttributes());
*/
protected int height = -1;
- /**
- * The desired percent value of the height
- */
- protected int heightPercent = -1;
-
/**
* The desired height (in twips)
*/
*/
protected int width = -1;
- /**
- * The desired percent value of the width
- */
- protected int widthPercent = -1;
-
/**
* The desired width (in twips)
*/
continue;
}
Object value = traitEntry.getValue();
- if (key == Trait.FONT) {
+ if (((Integer) key).intValue() == Trait.FONT) {
FontTriplet triplet = (FontTriplet)value;
addAttribute("font-name", triplet.getName());
addAttribute("font-style", triplet.getStyle());
} else if (clazz.equals(Color.class)) {
Color c = (Color)value;
addAttribute(name, ColorUtil.colorToString(c));
- } else if (key == Trait.START_INDENT || key == Trait.END_INDENT) {
- if (((Integer)value).intValue() != 0) {
+ } else if (((Integer) key).intValue() == Trait.START_INDENT
+ || ((Integer) key).intValue() == Trait.END_INDENT) {
+ if ((Integer) value != 0) {
addAttribute(name, value.toString());
}
} else {
public List computeTextRuns(TextNode node, AttributedCharacterIterator nodeACI,
AttributedCharacterIterator [] chunkACIs) {
nodeACI.first();
- int defaultBidiLevel = (nodeACI.getAttribute(WRITING_MODE) == WRITING_MODE_RTL) ? 1 : 0;
+ int defaultBidiLevel = (((Integer) nodeACI.getAttribute(WRITING_MODE)).intValue() == WRITING_MODE_RTL) ? 1 : 0;
for (int i = 0, n = chunkACIs.length; i < n; ++i) {
chunkACIs[i] = new BidiAttributedCharacterIterator(chunkACIs[i], defaultBidiLevel);
}
- return super.computeTextRuns(node, nodeACI, chunkACIs, (int[][]) null);
+ return super.computeTextRuns(node, nodeACI, chunkACIs, null);
}
// We want to sub-divide text chunks into distinct runs at bidi level boundaries.
*/
public void setPaintingState(PDFPaintingState state) {
paintingState = state;
- baseLevel = paintingState.getStackLevel();
+ baseLevel = paintingState.getStackLevel(); // @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
}
/**
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
import java.util.Set;
* @return a list of urls to the runtime jar files.
*/
private URL[] createUrls(String mainJar) throws MalformedURLException {
- ArrayList urls = new ArrayList();
+ List<URL> urls = new ArrayList<URL>();
urls.add(new File(mainJar).toURI().toURL());
File[] libFiles = new File("lib").listFiles();
- for (int i = 0; i < libFiles.length; i++) {
- if (libFiles[i].getPath().endsWith(".jar")) {
- urls.add(libFiles[i].toURI().toURL());
+ if (libFiles != null) {
+ for (File libFile : libFiles) {
+ if (libFile.getPath().endsWith(".jar")) {
+ urls.add(libFile.toURI().toURL());
+ }
}
}
- return (URL[]) urls.toArray(new URL[urls.size()]);
+ return urls.toArray(new URL[urls.size()]);
}
}
<fo:inline font-size="6.95pt" vertical-align="super">1) </fo:inline>
<fo:footnote-body id="fnb1">
<fo:block text-align="left">
- <fo:inline font-size="6.95pt" vertical-align="super">1) </fo:inline>
- http://xmlgrapics.apache.org/fop/
- </fo:block>
+ <fo:inline font-size="6.95pt" vertical-align="super">1) </fo:inline>http://xmlgrapics.apache.org/fop/</fo:block>
</fo:footnote-body>
</fo:footnote>
</fo:block>
<!-- Check fo:footnote-body @id -->
<!-- TODO - figure out where @prod-id should go -->
<true xpath="((//page)[2]//block)[2]/lineArea[1]/inlineparent[1]/@internal-link" />
- <eval expected="(P1,fnb1)" xpath="((//page)[2]//block)[2]/lineArea[1]/inlineparent[1]/@internal-link"/>
+ <eval expected="(P1,fnb1)" xpath="((//page)[2]//block)[1]/lineArea[1]/inlineparent[2]/@internal-link"/>
</checks>
-</testcase>
\ No newline at end of file
+</testcase>