Browse Source

Fix or suppress 1-instance findbug warnings.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1616312 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-2_0
Glenn Adams 9 years ago
parent
commit
c7d7ed1ee6
24 changed files with 148 additions and 149 deletions
  1. 11
    9
      conf/fop.xconf
  2. 18
    79
      findbugs-exclude.xml
  3. 1
    1
      src/java/org/apache/fop/cli/CommandLineOptions.java
  4. 1
    0
      src/java/org/apache/fop/fo/FOPropertyMapping.java
  5. 10
    12
      src/java/org/apache/fop/fo/PropertyList.java
  6. 0
    3
      src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
  7. 2
    3
      src/java/org/apache/fop/fo/properties/CommonTextDecoration.java
  8. 2
    1
      src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java
  9. 3
    1
      src/java/org/apache/fop/fonts/AbstractCodePointMapping.java
  10. 7
    7
      src/java/org/apache/fop/fonts/truetype/OpenFont.java
  11. 1
    2
      src/java/org/apache/fop/fonts/type1/PFMFile.java
  12. 40
    8
      src/java/org/apache/fop/hyphenation/HyphenationTree.java
  13. 5
    1
      src/java/org/apache/fop/hyphenation/Hyphenator.java
  14. 1
    1
      src/java/org/apache/fop/hyphenation/TernaryTree.java
  15. 4
    4
      src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java
  16. 3
    1
      src/java/org/apache/fop/pdf/DestinationComparator.java
  17. 1
    0
      src/java/org/apache/fop/render/intermediate/IFGraphicContext.java
  18. 0
    3
      src/java/org/apache/fop/render/java2d/Java2DRenderer.java
  19. 1
    1
      src/java/org/apache/fop/render/print/PageableRenderer.java
  20. 4
    6
      src/java/org/apache/fop/render/ps/PSSVGHandler.java
  21. 6
    1
      src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExtraRowSet.java
  22. 1
    1
      src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfLeader.java
  23. 22
    3
      src/java/org/apache/fop/tools/fontlist/FontSpec.java
  24. 4
    1
      src/java/org/apache/fop/util/text/AdvancedMessageFormat.java

+ 11
- 9
conf/fop.xconf View File

@@ -23,9 +23,8 @@ the location of this file.
<!-- Target resolution in dpi (dots/pixels per inch) for specifying the target resolution for generated bitmaps, default: 72dpi -->
<target-resolution>72</target-resolution>
<!-- Default page-height and page-width, in case
value is specified as auto -->
<default-page-settings height="11in" width="8.26in"/>
<!-- Default page-height and page-width, in case value is specified as auto -->
<default-page-settings height="11.00in" width="8.50in"/>
<!-- Information for specific renderers -->
<!-- Uses renderer mime type for renderers -->
@@ -78,6 +77,10 @@ the location of this file.
<font-triplet name="ArialMT" style="normal" weight="bold"/>
</font>
-->

<!-- auto-detect fonts -->
<auto-detect/>

</fonts>

<!-- This option lets you specify additional options on an XML handler -->
@@ -403,11 +406,11 @@ the location of this file.
example:
<font>
<afp-font type="CIDKeyed" encoding="UnicodeBigUnmarked"
codepage="T1120000" characterset="CZJHMNU"
base-uri="fonts" />
<font-triplet name="J-Heisei Mincho" style="normal" weight="normal" />
</font>
<afp-font type="CIDKeyed" encoding="UnicodeBigUnmarked"
codepage="T1120000" characterset="CZJHMNU"
base-uri="fonts" />
<font-triplet name="J-Heisei Mincho" style="normal" weight="normal" />
</font>
-->
@@ -461,4 +464,3 @@ the location of this file.
</renderers>

</fop>


+ 18
- 79
findbugs-exclude.xml View File

@@ -9,17 +9,18 @@
<Bug pattern="CI_CONFUSED_INHERITANCE"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="CN_IDIOM_NO_SUPER_CALL"/>
<Or>
<And>
<Class name="org.apache.fop.render.intermediate.IFGraphicContext"/>
<Method name="clone"/>
</And>
</Or>
</Match>
<Match>
<!-- 15 warnings -->
<Bug pattern="DB_DUPLICATE_SWITCH_CLAUSES"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="DE_MIGHT_IGNORE"/>
</Match>
<Match>
<!-- 27 warnings -->
<Bug pattern="DLS_DEAD_LOCAL_STORE"/>
@@ -52,10 +53,6 @@
<!-- 88 warnings -->
<Bug pattern="DM_NUMBER_CTOR"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="DM_STRING_CTOR"/>
</Match>
<Match>
<!-- 2 warnings -->
<Bug pattern="DM_STRING_TOSTRING"/>
@@ -81,21 +78,18 @@
<Bug pattern="EI_EXPOSE_REP2"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="EQ_ALWAYS_TRUE"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS"/>
<Or>
<And>
<Class name="org.apache.fop.fo.properties.ToBeImplementedProperty"/>
<Method name="equals"/>
</And>
</Or>
</Match>
<Match>
<!-- 2 warnings -->
<Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="EQ_UNUSUAL"/>
</Match>
<Match>
<!-- 3 warnings -->
<Bug pattern="ES_COMPARING_PARAMETER_STRING_WITH_EQ"/>
@@ -108,18 +102,6 @@
<!-- 12 warnings -->
<Bug pattern="FE_FLOATING_POINT_EQUALITY"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="ICAST_IDIV_CAST_TO_DOUBLE"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="ICAST_INT_CAST_TO_FLOAT_PASSED_TO_ROUND"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="IM_AVERAGE_COMPUTATION_COULD_OVERFLOW"/>
</Match>
<Match>
<!-- 2 warnings -->
<Bug pattern="IM_BAD_CHECK_FOR_ODD"/>
@@ -136,17 +118,18 @@
<!-- 9 warnings -->
<Bug pattern="LI_LAZY_INIT_STATIC"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="LI_LAZY_INIT_UPDATE_STATIC"/>
</Match>
<Match>
<!-- 2 warnings -->
<Bug pattern="MF_CLASS_MASKS_FIELD"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="MS_EXPOSE_REP"/>
<Or>
<And>
<Class name="org.apache.fop.fo.FOPropertyMapping"/>
<Method name="getGenericMappings"/>
</And>
</Or>
</Match>
<Match>
<!-- 12 warnings -->
@@ -168,14 +151,6 @@
<!-- 5 warnings -->
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="NP_GUARANTEED_DEREF"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="NP_IMMEDIATE_DEREFERENCE_OF_READLINE"/>
</Match>
<Match>
<!-- 4 warnings -->
<Bug pattern="NP_LOAD_OF_KNOWN_NULL_VALUE"/>
@@ -204,10 +179,6 @@
<!-- 46 warnings -->
<Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN"/>
</Match>
<Match>
<!-- 10 warnings -->
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
@@ -216,10 +187,6 @@
<!-- 3 warnings -->
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE"/>
</Match>
<Match>
<!-- 23 warnings -->
<Bug pattern="REC_CATCH_EXCEPTION"/>
@@ -228,22 +195,10 @@
<!-- 8 warnings -->
<Bug pattern="RI_REDUNDANT_INTERFACES"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="RR_NOT_CHECKED"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="RV_EXCEPTION_NOT_THROWN"/>
</Match>
<Match>
<!-- 11 warnings -->
<Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="SA_FIELD_SELF_COMPARISON"/>
</Match>
<Match>
<!-- 2 warnings -->
<Bug pattern="SBSC_USE_STRINGBUFFER_CONCATENATION"/>
@@ -260,10 +215,6 @@
<!-- 2 warnings -->
<Bug pattern="SE_BAD_FIELD_STORE"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="SE_COMPARATOR_SHOULD_BE_SERIALIZABLE"/>
</Match>
<Match>
<!-- 6 warnings -->
<Bug pattern="SE_INNER_CLASS"/>
@@ -276,10 +227,6 @@
<!-- 3 warnings -->
<Bug pattern="SF_SWITCH_FALLTHROUGH"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="SF_SWITCH_NO_DEFAULT"/>
</Match>
<Match>
<!-- 21 warnings -->
<Bug pattern="SIC_INNER_SHOULD_BE_STATIC"/>
@@ -288,10 +235,6 @@
<!-- 20 warnings -->
<Bug pattern="SIC_INNER_SHOULD_BE_STATIC_ANON"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="SIC_INNER_SHOULD_BE_STATIC_NEEDS_THIS"/>
</Match>
<Match>
<!-- 5 warnings -->
<Bug pattern="SR_NOT_CHECKED"/>
@@ -308,10 +251,6 @@
<!-- 3 warnings -->
<Bug pattern="UI_INHERITANCE_UNSAFE_GETRESOURCE"/>
</Match>
<Match>
<!-- 1 warning -->
<Bug pattern="UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS"/>
</Match>
<Match>
<!-- 6 warnings -->
<Bug pattern="UPM_UNCALLED_PRIVATE_METHOD"/>

+ 1
- 1
src/java/org/apache/fop/cli/CommandLineOptions.java View File

@@ -164,7 +164,7 @@ public class CommandLineOptions {
try {
optionsParsed = parseOptions(args);
if (optionsParsed) {
if (showConfiguration == Boolean.TRUE) {
if (showConfiguration.equals(Boolean.TRUE)) {
dumpConfiguration();
}
checkSettings();

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

@@ -343,6 +343,7 @@ public final class FOPropertyMapping implements Constants {
addSubpropMakerName("precedence", CP_PRECEDENCE);
}

// SuppressFBWarnings("MS_EXPOSE_REP")
return generics;
}


+ 10
- 12
src/java/org/apache/fop/fo/PropertyList.java View File

@@ -52,9 +52,17 @@ import org.apache.fop.fo.properties.PropertyMaker;
*/
public abstract class PropertyList {


private static boolean[] inheritableProperty;

static {
inheritableProperty = new boolean[Constants.PROPERTY_COUNT + 1];
PropertyMaker maker = null;
for (int prop = 1; prop <= Constants.PROPERTY_COUNT; prop++) {
maker = findMaker(prop);
inheritableProperty[prop] = (maker != null && maker.isInherited());
}
}

/** reference to the parent FO's propertyList **/
protected PropertyList parentPropertyList;
private FObj fobj;
@@ -620,15 +628,6 @@ public abstract class PropertyList {
* @return isInherited value from the requested Property.Maker
*/
private boolean isInherited(int propId) {
if (inheritableProperty == null) {
inheritableProperty = new boolean[Constants.PROPERTY_COUNT + 1];
PropertyMaker maker = null;
for (int prop = 1; prop <= Constants.PROPERTY_COUNT; prop++) {
maker = findMaker(prop);
inheritableProperty[prop] = (maker != null && maker.isInherited());
}
}

return inheritableProperty[propId];
}

@@ -636,8 +635,7 @@ public abstract class PropertyList {
* @param propId Id of property
* @return the Property.Maker for this property
*/
private PropertyMaker findMaker(int propId) {

private static PropertyMaker findMaker(int propId) {
if (propId < 1 || propId > Constants.PROPERTY_COUNT) {
return null;
} else {

+ 0
- 3
src/java/org/apache/fop/fo/extensions/svg/SVGElement.java View File

@@ -130,9 +130,6 @@ public class SVGElement extends SVGObj {
public float getFontSize() {
return 12;
}

public void deselectAll() {
}
};
SVGOMElement e = (SVGOMElement)svgRoot;
e.setSVGContext(dc);

+ 2
- 3
src/java/org/apache/fop/fo/properties/CommonTextDecoration.java View File

@@ -64,6 +64,7 @@ public class CommonTextDecoration {

private static CommonTextDecoration calcTextDecoration(PropertyList pList)
throws PropertyException {
assert pList != null;
CommonTextDecoration deco = null;
PropertyList parentList = pList.getParentPropertyList();
if (parentList != null) {
@@ -78,9 +79,7 @@ public class CommonTextDecoration {
while (i.hasNext()) {
Property prop = (Property)i.next();
int propEnum = prop.getEnum();
FOUserAgent ua = (pList == null)
? null
: (pList.getFObj() == null ? null : pList.getFObj().getUserAgent());
FOUserAgent ua = pList.getFObj() == null ? null : pList.getFObj().getUserAgent();
if (propEnum == Constants.EN_NONE) {
if (deco != null) {
deco.decoration = 0;

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

@@ -74,11 +74,12 @@ public class ToBeImplementedProperty extends Property {

@Override
public boolean equals(Object obj) {
return true;
/*
* Since a PropertyCache is not used here, returning true helps the PropertyCache when a non
* implemented property is part of an implemented one.
*/
// FBOFF: EQ_ALWAYS_TRUE
return true;
}
}


+ 3
- 1
src/java/org/apache/fop/fonts/AbstractCodePointMapping.java View File

@@ -128,7 +128,9 @@ public class AbstractCodePointMapping implements SingleByteEncoding {
int bot = 0;
int top = characters.length - 1;
while (top >= bot) {
int mid = (bot + top) / 2;
assert bot < 65536;
assert top < 65536;
int mid = (bot + top) >>> 1;
char mc = characters[mid];

if (c == mc) {

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

@@ -266,16 +266,16 @@ public abstract class OpenFont {
/**
* Key-value helper class.
*/
final class UnicodeMapping implements Comparable {
final static class UnicodeMapping implements Comparable {

private final int unicodeIndex;
private final int glyphIndex;

UnicodeMapping(int glyphIndex, int unicodeIndex) {
UnicodeMapping(OpenFont font, int glyphIndex, int unicodeIndex) {
this.unicodeIndex = unicodeIndex;
this.glyphIndex = glyphIndex;
glyphToUnicodeMap.put(new Integer(glyphIndex), new Integer(unicodeIndex));
unicodeToGlyphMap.put(new Integer(unicodeIndex), new Integer(glyphIndex));
font.glyphToUnicodeMap.put(new Integer(glyphIndex), new Integer(unicodeIndex));
font.unicodeToGlyphMap.put(new Integer(unicodeIndex), new Integer(glyphIndex));
}

/**
@@ -533,7 +533,7 @@ public abstract class OpenFont {
glyphIdx = (fontFile.readTTFUShort() + cmapDeltas[i])
& 0xffff;
//mtxTab[glyphIdx].setName(mtxTab[glyphIdx].getName() + " - "+(char)j);
unicodeMappings.add(new UnicodeMapping(glyphIdx, j));
unicodeMappings.add(new UnicodeMapping(this, glyphIdx, j));
mtxTab[glyphIdx].getUnicodeIndex().add(new Integer(j));

if (encodingID == 0 && j >= 0xF020 && j <= 0xF0FF) {
@@ -543,7 +543,7 @@ public abstract class OpenFont {
int mapped = j - 0xF000;
if (!eightBitGlyphs.get(mapped)) {
//Only map if Unicode code point hasn't been mapped before
unicodeMappings.add(new UnicodeMapping(glyphIdx, mapped));
unicodeMappings.add(new UnicodeMapping(this, glyphIdx, mapped));
mtxTab[glyphIdx].getUnicodeIndex().add(new Integer(mapped));
}
}
@@ -582,7 +582,7 @@ public abstract class OpenFont {
+ mtxTab.length);
}

unicodeMappings.add(new UnicodeMapping(glyphIdx, j));
unicodeMappings.add(new UnicodeMapping(this, glyphIdx, j));
if (glyphIdx < mtxTab.length) {
mtxTab[glyphIdx].getUnicodeIndex().add(new Integer(j));
} else {

+ 1
- 2
src/java/org/apache/fop/fonts/type1/PFMFile.java View File

@@ -91,8 +91,7 @@ public class PFMFile {
}
bufin.reset();
byte[] b = new byte[16];
bufin.read(b);
if (new String(b, "US-ASCII").equalsIgnoreCase("StartFontMetrics")) {
if ((bufin.read(b) == b.length) && new String(b, "US-ASCII").equalsIgnoreCase("StartFontMetrics")) {
//Found the header of a AFM file!
IOUtils.closeQuietly(in);
throw new IOException("Cannot parse PFM file. You probably specified the AFM file"

+ 40
- 8
src/java/org/apache/fop/hyphenation/HyphenationTree.java View File

@@ -641,24 +641,44 @@ public class HyphenationTree extends TernaryTree
+ "b:\tbenchmark\n"
+ "q:\tquit\n\n"
+ "Command:");
String token = in.readLine().trim();
String token = in.readLine();
if (token == null) {
break;
}
token = token.trim();
if (token.equals("f")) {
System.out.print("Pattern: ");
token = in.readLine().trim();
token = in.readLine();
if (token == null) {
break;
}
token = token.trim();
System.out.println("Values: " + ht.findPattern(token));
} else if (token.equals("s")) {
System.out.print("Minimun value: ");
token = in.readLine().trim();
token = in.readLine();
if (token == null) {
break;
}
token = token.trim();
minCharCount = Integer.parseInt(token);
} else if (token.equals("l")) {
ht = new HyphenationTree();
System.out.print("XML file name: ");
token = in.readLine().trim();
token = in.readLine();
if (token == null) {
break;
}
token = token.trim();
ht.loadPatterns(token);
} else if (token.equals("L")) {
ObjectInputStream ois = null;
System.out.print("Object file name: ");
token = in.readLine().trim();
token = in.readLine();
if (token == null) {
break;
}
token = token.trim();
try {
ois = new ObjectInputStream(new FileInputStream(token));
ht = (HyphenationTree)ois.readObject();
@@ -675,7 +695,11 @@ public class HyphenationTree extends TernaryTree
}
} else if (token.equals("w")) {
System.out.print("Object file name: ");
token = in.readLine().trim();
token = in.readLine();
if (token == null) {
break;
}
token = token.trim();
ObjectOutputStream oos = null;
try {
oos = new ObjectOutputStream(new FileOutputStream(token));
@@ -698,7 +722,11 @@ public class HyphenationTree extends TernaryTree
}
} else if (token.equals("h")) {
System.out.print("Word: ");
token = in.readLine().trim();
token = in.readLine();
if (token == null) {
break;
}
token = token.trim();
System.out.print("Hyphenation points: ");
System.out.println(ht.hyphenate(token, minCharCount,
minCharCount));
@@ -708,7 +736,11 @@ public class HyphenationTree extends TernaryTree
break;
}
System.out.print("Word list filename: ");
token = in.readLine().trim();
token = in.readLine();
if (token == null) {
break;
}
token = token.trim();
long starttime = 0;
int counter = 0;
BufferedReader reader = null;

+ 5
- 1
src/java/org/apache/fop/hyphenation/Hyphenator.java View File

@@ -174,7 +174,11 @@ public final class Hyphenator {
is = contextClassLoader.getResourceAsStream("hyph/" + key
+ ".hyp");
}
} catch (Exception e) {
} catch (NoSuchMethodException e) {
//ignore, fallback further down
} catch (IllegalAccessException e) {
//ignore, fallback further down
} catch (java.lang.reflect.InvocationTargetException e) {
//ignore, fallback further down
}


+ 1
- 1
src/java/org/apache/fop/hyphenation/TernaryTree.java View File

@@ -589,7 +589,7 @@ public class TernaryTree implements Cloneable, Serializable {

/** @return next element */
public Object nextElement() {
String res = new String(curkey);
String res = curkey;
cur = up();
run();
return res;

+ 4
- 4
src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java View File

@@ -318,13 +318,13 @@ public class AlignmentContext implements Constants {
case EN_BASELINE: //Nothing to do
break;
case EN_SUB:
baselineShiftValue = Math.round(-(xHeight / 2)
+ parentAlignmentContext.getActualBaselineOffset(EN_ALPHABETIC)
baselineShiftValue = Math.round(-((float)xHeight / 2)
+ (float)parentAlignmentContext.getActualBaselineOffset(EN_ALPHABETIC)
);
break;
case EN_SUPER:
baselineShiftValue = Math.round(parentAlignmentContext.getXHeight()
+ parentAlignmentContext.getActualBaselineOffset(EN_ALPHABETIC)
baselineShiftValue = Math.round((float)parentAlignmentContext.getXHeight()
+ (float)parentAlignmentContext.getActualBaselineOffset(EN_ALPHABETIC)
);
break;
case 0: // A <length> or <percentage> value

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

@@ -23,11 +23,13 @@ package org.apache.fop.pdf;
* Comparator class to enable comparing (and
* hence sorting) of PDFDestination objects.
*/
public class DestinationComparator implements java.util.Comparator {
public class DestinationComparator implements java.util.Comparator, java.io.Serializable {
/* public int compare (PDFDestination dest1, PDFDestination dest2) {
return dest1.getIDRef().compareTo(dest2.getIDRef());
}*/

static final long serialVersionUID = 0L;

/** {@inheritDoc} */
public int compare(Object obj1, Object obj2) {
if (obj1 instanceof PDFDestination && obj2 instanceof PDFDestination) {

+ 1
- 0
src/java/org/apache/fop/render/intermediate/IFGraphicContext.java View File

@@ -57,6 +57,7 @@ public class IFGraphicContext extends GraphicContext {
* {@inheritDoc}
*/
public Object clone() {
// FBOFF: CN_IDIOM_NO_SUPER_CALL
return new IFGraphicContext(this);
}


+ 0
- 3
src/java/org/apache/fop/render/java2d/Java2DRenderer.java View File

@@ -216,9 +216,6 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
renderingDone = true;
int numberOfPages = currentPageNumber;
// TODO set all vars to null for gc
if (numberOfPages == 0) {
new FOPException("No page could be rendered");
}
}

/** @return true if the renderer is not currently processing */

+ 1
- 1
src/java/org/apache/fop/render/print/PageableRenderer.java View File

@@ -109,7 +109,7 @@ public class PageableRenderer extends Java2DRenderer implements Pageable {
if (o != null) {
this.endNumber = getPositiveInteger(o);
}
if (this.endNumber >= 0 && this.endNumber < this.endNumber) {
if (this.endNumber >= 0 && this.endNumber < this.startNumber) {
this.endNumber = this.startNumber;
}
}

+ 4
- 6
src/java/org/apache/fop/render/ps/PSSVGHandler.java View File

@@ -219,18 +219,16 @@ public class PSSVGHandler extends AbstractGenericSVGHandler
* @param context the renderer context
* @param doc the svg document
*/
protected void renderSVGDocument(RendererContext context,
Document doc) {
protected void renderSVGDocument(RendererContext context, Document doc) {
assert context != null;
PSInfo psInfo = getPSInfo(context);
int xOffset = psInfo.currentXPosition;
int yOffset = psInfo.currentYPosition;
PSGenerator gen = psInfo.psGenerator;

boolean paintAsBitmap = false;
if (context != null) {
Map foreign = (Map)context.getProperty(RendererContextConstants.FOREIGN_ATTRIBUTES);
paintAsBitmap = ImageHandlerUtil.isConversionModeBitmap(foreign);
}
Map foreign = (Map)context.getProperty(RendererContextConstants.FOREIGN_ATTRIBUTES);
paintAsBitmap = ImageHandlerUtil.isConversionModeBitmap(foreign);
if (paintAsBitmap) {
try {
super.renderSVGDocument(context, doc);

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

@@ -113,7 +113,12 @@ public class RtfExtraRowSet extends RtfContainer {
}

public boolean equals(Object o) {
return o != null && this.compareTo(o) == 0;
if (o instanceof PositionedCell) {
PositionedCell pc = (PositionedCell) o;
return (pc.rowIndex == rowIndex) && (pc.xOffset == xOffset);
} else {
return false;
}
}
}


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

@@ -200,7 +200,7 @@ public class RtfLeader extends RtfContainer {
// Depending on font-size 15 -> 1cm = 7,5 spaces
// TODO for rule-thickness this has to be done better

for (double d = (Integer.parseInt(tabwidth) / 560) * 7.5; d >= 1; d--) {
for (double d = (Integer.parseInt(tabwidth) / 560.0) * 7.5; d >= 1; d--) {
RtfStringConverter.getInstance().writeRtfString(writer, " ");
}


+ 22
- 3
src/java/org/apache/fop/tools/fontlist/FontSpec.java View File

@@ -95,10 +95,29 @@ public class FontSpec implements Comparable {
return this.metrics;
}

/** {@inheritDoc} */
@Override
public int hashCode() {
return metrics.getFullName().hashCode();
}

@Override
public boolean equals(Object o) {
if (o instanceof FontSpec) {
FontSpec other = (FontSpec)o;
return metrics.getFullName().equals(other.metrics.getFullName());
} else {
return false;
}
}

@Override
public int compareTo(Object o) {
FontSpec other = (FontSpec)o;
return metrics.getFullName().compareTo(other.metrics.getFullName());
if (o instanceof FontSpec) {
FontSpec other = (FontSpec)o;
return metrics.getFullName().compareTo(other.metrics.getFullName());
} else {
return 1;
}
}

}

+ 4
- 1
src/java/org/apache/fop/util/text/AdvancedMessageFormat.java View File

@@ -146,10 +146,13 @@ public class AdvancedMessageFormat {
i++;
ch = pattern.charAt(i);
}
//no break here! Must be right before "default" section
sb.append(ch);
i++;
break;
default:
sb.append(ch);
i++;
break;
}
}
if (sb.length() > 0) {

Loading…
Cancel
Save