Browse Source

Address high and medium priority findbugs warnings

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1681384 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-2_1
Andreas L. Delmelle 9 years ago
parent
commit
68203d133a
32 changed files with 150 additions and 75 deletions
  1. 54
    0
      findbugs-exclude.xml
  2. 4
    4
      src/java/org/apache/fop/afp/AFPStreamer.java
  3. 1
    2
      src/java/org/apache/fop/area/Page.java
  4. 6
    5
      src/java/org/apache/fop/area/PageViewport.java
  5. 9
    0
      src/java/org/apache/fop/area/RegionReference.java
  6. 6
    5
      src/java/org/apache/fop/area/inline/InlineArea.java
  7. 2
    1
      src/java/org/apache/fop/area/inline/TextArea.java
  8. 2
    1
      src/java/org/apache/fop/complexscripts/fonts/GlyphProcessingState.java
  9. 1
    0
      src/java/org/apache/fop/fo/flow/MultiProperties.java
  10. 1
    0
      src/java/org/apache/fop/fo/flow/MultiPropertySet.java
  11. 3
    2
      src/java/org/apache/fop/fo/flow/MultiToggle.java
  12. 1
    0
      src/java/org/apache/fop/fo/flow/table/TableAndCaption.java
  13. 1
    0
      src/java/org/apache/fop/fo/flow/table/TableCaption.java
  14. 1
    0
      src/java/org/apache/fop/fo/properties/CommonAural.java
  15. 1
    1
      src/java/org/apache/fop/fo/properties/CommonMarginInline.java
  16. 1
    0
      src/java/org/apache/fop/fo/properties/CommonRelativePosition.java
  17. 6
    3
      src/java/org/apache/fop/fonts/truetype/OpenFont.java
  18. 9
    6
      src/java/org/apache/fop/hyphenation/SerializeHyphPattern.java
  19. 8
    4
      src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
  20. 1
    1
      src/java/org/apache/fop/layoutmgr/FloatContentLayoutManager.java
  21. 6
    4
      src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
  22. 1
    1
      src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
  23. 0
    4
      src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java
  24. 3
    3
      src/java/org/apache/fop/pdf/PDFCMap.java
  25. 3
    1
      src/java/org/apache/fop/pdf/PDFFactory.java
  26. 1
    1
      src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfElement.java
  27. 0
    10
      src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExternalGraphic.java
  28. 4
    3
      src/java/org/apache/fop/render/xml/XMLRenderer.java
  29. 2
    2
      src/java/org/apache/fop/svg/NativeTextPainter.java
  30. 1
    1
      src/java/org/apache/fop/svg/PDFGraphics2D.java
  31. 8
    5
      src/java/org/apache/fop/tools/anttasks/RunTest.java
  32. 3
    5
      test/layoutengine/standard-testcases/footnote_id.xml

+ 54
- 0
findbugs-exclude.xml View File

@@ -85,6 +85,14 @@
</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>
@@ -121,6 +129,14 @@
<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>
@@ -141,6 +157,40 @@
</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 -->
@@ -160,6 +210,10 @@
<!-- 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"/>

+ 4
- 4
src/java/org/apache/fop/afp/AFPStreamer.java View File

@@ -160,10 +160,10 @@ public class AFPStreamer implements Streamable {
*/
// 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) {

+ 1
- 2
src/java/org/apache/fop/area/Page.java View File

@@ -252,8 +252,7 @@ public class Page extends AreaTreeObject implements Serializable {
} else if (regionBody == null) {
return true;
} else {
BodyRegion body = (BodyRegion)regionBody.getRegionReference();
return body.isEmpty();
return regionBody.getRegionReference().isEmpty();
}
}


+ 6
- 5
src/java/org/apache/fop/area/PageViewport.java View File

@@ -364,8 +364,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable {
* 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) {
@@ -409,8 +408,8 @@ public class PageViewport extends AreaTreeObject implements Resolvable {
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;
}
@@ -457,7 +456,9 @@ public class PageViewport extends AreaTreeObject implements Resolvable {
* @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;
}

/**

+ 9
- 0
src/java/org/apache/fop/area/RegionReference.java View File

@@ -134,6 +134,15 @@ public class RegionReference extends Area {
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();

+ 6
- 5
src/java/org/apache/fop/area/inline/InlineArea.java View File

@@ -272,11 +272,12 @@ public class InlineArea extends Area {
* @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;
}

+ 2
- 1
src/java/org/apache/fop/area/inline/TextArea.java View File

@@ -144,12 +144,13 @@ public class TextArea extends AbstractTextArea {
* @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());
}
}

+ 2
- 1
src/java/org/apache/fop/complexscripts/fonts/GlyphProcessingState.java View File

@@ -119,6 +119,7 @@ public class GlyphProcessingState {
* @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;
@@ -130,7 +131,7 @@ public class GlyphProcessingState {
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); } };

+ 1
- 0
src/java/org/apache/fop/fo/flow/MultiProperties.java View File

@@ -54,6 +54,7 @@ public class MultiProperties extends FObj {
if (!notImplementedWarningGiven) {
getFOValidationEventProducer().unimplementedFeature(this, getName(),
getName(), getLocator());
// @SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
notImplementedWarningGiven = true;
}
}

+ 1
- 0
src/java/org/apache/fop/fo/flow/MultiPropertySet.java View File

@@ -50,6 +50,7 @@ public class MultiPropertySet extends FObj {
if (!notImplementedWarningGiven) {
getFOValidationEventProducer().unimplementedFeature(this, getName(),
getName(), getLocator());
// @SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
notImplementedWarningGiven = true;
}
}

+ 3
- 2
src/java/org/apache/fop/fo/flow/MultiToggle.java View File

@@ -31,12 +31,12 @@ import org.apache.fop.fo.properties.StringProperty;

/**
* 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;
@@ -52,6 +52,7 @@ public class MultiToggle extends FObj {
if (!notImplementedWarningGiven) {
getFOValidationEventProducer().unimplementedFeature(this, getName(),
getName(), getLocator());
// @SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
notImplementedWarningGiven = true;
}
}

+ 1
- 0
src/java/org/apache/fop/fo/flow/table/TableAndCaption.java View File

@@ -72,6 +72,7 @@ public class TableAndCaption extends FObj implements CommonAccessibilityHolder {
if (!notImplementedWarningGiven) {
getFOValidationEventProducer().unimplementedFeature(this, getName(),
"fo:table-and-caption", getLocator());
// @SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
notImplementedWarningGiven = true;
}
}

+ 1
- 0
src/java/org/apache/fop/fo/flow/table/TableCaption.java View File

@@ -67,6 +67,7 @@ public class TableCaption extends FObj implements CommonAccessibilityHolder {
if (!notImplementedWarningGiven) {
getFOValidationEventProducer().unimplementedFeature(this, getName(),
"fo:table-caption", getLocator());
// @SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
notImplementedWarningGiven = true;
}
}

+ 1
- 0
src/java/org/apache/fop/fo/properties/CommonAural.java View File

@@ -27,6 +27,7 @@ import org.apache.fop.fo.PropertyList;
* Public "structure" allows direct member access.
*/
public class CommonAural {
// @SuppressFBWarnings("UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD")
/**
* The "azimuth" property.
*/

+ 1
- 1
src/java/org/apache/fop/fo/properties/CommonMarginInline.java View File

@@ -30,7 +30,7 @@ import org.apache.fop.fo.expr.PropertyException;
* Public "structure" allows direct member access.
*/
public class CommonMarginInline {
// @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
/**
* The "margin-top" property.
*/

+ 1
- 0
src/java/org/apache/fop/fo/properties/CommonRelativePosition.java View File

@@ -30,6 +30,7 @@ import org.apache.fop.fo.expr.PropertyException;
* Public "structure" allows direct member access.
*/
public class CommonRelativePosition {
// @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
/**
* The "relative-position" property.
*/

+ 6
- 3
src/java/org/apache/fop/fonts/truetype/OpenFont.java View File

@@ -1603,10 +1603,12 @@ public abstract class OpenFont {
// 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();
@@ -1693,6 +1695,7 @@ public abstract class OpenFont {
return (int) (o1.getValue().getOffset() - o2.getValue().getOffset());
}
});
// @SuppressFBWarnings("DMI_ENTRY_SETS_MAY_REUSE_ENTRY_OBJECTS")
sortedSet.addAll(directoryTabs.entrySet());
return sortedSet;
}

+ 9
- 6
src/java/org/apache/fop/hyphenation/SerializeHyphPattern.java View File

@@ -53,12 +53,14 @@ public class SerializeHyphPattern {
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);
}
}
}

@@ -73,6 +75,7 @@ public class SerializeHyphPattern {
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)));

+ 8
- 4
src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java View File

@@ -618,10 +618,12 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
}
}
} 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;
@@ -635,7 +637,8 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
/** {@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
@@ -652,8 +655,9 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
//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);

+ 1
- 1
src/java/org/apache/fop/layoutmgr/FloatContentLayoutManager.java View File

@@ -133,7 +133,7 @@ public class FloatContentLayoutManager extends SpacedBorderedPaddedBlockLayoutMa
while (!(lm instanceof BlockLayoutManager)) {
lm = lm.getParent();
}
if (lm instanceof BlockLayoutManager) {
if (lm != null) {
startIndent = ((BlockLayoutManager) lm).startIndent;
}
return startIndent;

+ 6
- 4
src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java View File

@@ -239,9 +239,10 @@ public class FlowLayoutManager extends BlockStackingLayoutManager {
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);
@@ -258,9 +259,10 @@ public class FlowLayoutManager extends BlockStackingLayoutManager {
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);

+ 1
- 1
src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java View File

@@ -63,7 +63,7 @@ public abstract class InlineStackingLayoutManager extends AbstractLayoutManager
*/
protected InlineStackingLayoutManager(FObj node) {
super(node);
extraBPD = MinOptMax.ZERO;
extraBPD = MinOptMax.ZERO; // @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
}

/**

+ 0
- 4
src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java View File

@@ -43,9 +43,6 @@ public class TableRowIterator {
/** 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;

@@ -59,7 +56,6 @@ public class TableRowIterator {
* @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:

+ 3
- 3
src/java/org/apache/fop/pdf/PDFCMap.java View File

@@ -365,7 +365,7 @@ public class PDFCMap extends PDFStream {
/**
* 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)
@@ -381,8 +381,8 @@ public class PDFCMap extends 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")
}

/**

+ 3
- 1
src/java/org/apache/fop/pdf/PDFFactory.java View File

@@ -1265,7 +1265,9 @@ public class PDFFactory {
log.error("Failed to embed font [" + desc + "] " + desc.getEmbedFontName(), ioe);
return null;
} finally {
IOUtils.closeQuietly(in);
if (in != null) {
IOUtils.closeQuietly(in);
}
}
}


+ 1
- 1
src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfElement.java View File

@@ -55,7 +55,7 @@ public abstract class RtfElement {

/** 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());

+ 0
- 10
src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExternalGraphic.java View File

@@ -233,11 +233,6 @@ public class RtfExternalGraphic extends RtfElement {
*/
protected int height = -1;

/**
* The desired percent value of the height
*/
protected int heightPercent = -1;

/**
* The desired height (in twips)
*/
@@ -253,11 +248,6 @@ public class RtfExternalGraphic extends RtfElement {
*/
protected int width = -1;

/**
* The desired percent value of the width
*/
protected int widthPercent = -1;

/**
* The desired width (in twips)
*/

+ 4
- 3
src/java/org/apache/fop/render/xml/XMLRenderer.java View File

@@ -202,7 +202,7 @@ public class XMLRenderer extends AbstractXMLRenderer {
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());
@@ -245,8 +245,9 @@ public class XMLRenderer extends AbstractXMLRenderer {
} 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 {

+ 2
- 2
src/java/org/apache/fop/svg/NativeTextPainter.java View File

@@ -216,11 +216,11 @@ public abstract class NativeTextPainter extends StrokingTextPainter {
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.

+ 1
- 1
src/java/org/apache/fop/svg/PDFGraphics2D.java View File

@@ -295,7 +295,7 @@ public class PDFGraphics2D extends AbstractGraphics2D implements NativeImageHand
*/
public void setPaintingState(PDFPaintingState state) {
paintingState = state;
baseLevel = paintingState.getStackLevel();
baseLevel = paintingState.getStackLevel(); // @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
}

/**

+ 8
- 5
src/java/org/apache/fop/tools/anttasks/RunTest.java View File

@@ -28,6 +28,7 @@ import java.net.URLClassLoader;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

@@ -226,14 +227,16 @@ public class RunTest extends Task {
* @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()]);
}
}

+ 3
- 5
test/layoutengine/standard-testcases/footnote_id.xml View File

@@ -38,9 +38,7 @@
<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>
@@ -65,6 +63,6 @@
<!-- 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>
</testcase>

Loading…
Cancel
Save