Browse Source

Fix checkstyle and findbugs issues

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1135995 13f79535-47bb-0310-9956-ffa450edef68
pull/21/head
Simon Pepping 13 years ago
parent
commit
b8984bb862

+ 23
- 0
findbugs-exclude.xml View File

@@ -132,6 +132,29 @@
<Bug pattern="NM_CONFUSING"/>
</Match>
<!-- /The names of public methods will not be modified -->
<!-- These casts are checked in the code -->
<Match>
<Class name="org.apache.fop.render.afp.AFPImageHandlerGraphics2D"/>
<Method name="isCompatible"/>
<Bug pattern="BC_UNCONFIRMED_CAST"/>
</Match>
<Match>
<Class name="org.apache.fop.render.afp.AFPImageHandlerSVG"/>
<Method name="isCompatible"/>
<Bug pattern="BC_UNCONFIRMED_CAST"/>
</Match>
<Match>
<Class name="org.apache.fop.render.afp.AbstractPDFImageHandler"/>
<Method name="handleImage"/>
<Bug pattern="BC_UNCONFIRMED_CAST"/>
</Match>
<!-- /These casts are checked in the code -->
<!-- return null is OK -->
<Match>
<Class name="org.apache.fop.svg.ACIUtils"/>
<Method name="findFontsForBatikACI"/>
<Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
</Match>
<!-- Automatically generated list of exclusions -->
<Match>
<Class name="org.apache.fop.area.BodyRegion"/>

+ 2
- 3
src/documentation/skinconf.xml View File

@@ -103,9 +103,8 @@ which will be used to configure the chosen Forrest skin.
For some skins just set the attributes to blank.
-->
<trail location="alt">
<link1 name="apache.org" href="http://www.apache.org/"/>
<link2 name="XML Federation" href="http://xml.apache.org/"/>
<link3 name="xmlgraphics.apache.org" href="http://xmlgraphics.apache.org/"/>
<link1 name="The Apache Software Foundation" href="http://www.apache.org/"/>
<link2 name="Apache XML Graphics Project" href="http://xmlgraphics.apache.org/"/>
</trail>

<!-- Configure the TOC, i.e. the Table of Contents.

+ 2
- 2
src/java/org/apache/fop/afp/parser/UnparsedStructuredField.java View File

@@ -219,7 +219,7 @@ public final class UnparsedStructuredField {
*/
byte[] getExtData() {
if (this.extData == null) {
return null;
return new byte[0];
}
byte[] rtn = new byte[this.extData.length];
System.arraycopy(this.extData, 0, rtn, 0, rtn.length);
@@ -232,7 +232,7 @@ public final class UnparsedStructuredField {
*/
public byte[] getData() {
if (this.data == null) {
return null;
return new byte[0];
}
byte[] rtn = new byte[this.data.length];
System.arraycopy(this.data, 0, rtn, 0, rtn.length);

+ 1
- 0
src/java/org/apache/fop/afp/svg/AFPTextHandler.java View File

@@ -60,6 +60,7 @@ public class AFPTextHandler extends FOPTextHandlerAdapter {
* Main constructor.
*
* @param fontInfo the AFPGraphics2D instance
* @param resourceManager the AFPResourceManager instance
*/
public AFPTextHandler(FontInfo fontInfo, AFPResourceManager resourceManager) {
this.fontInfo = fontInfo;

+ 4
- 2
src/java/org/apache/fop/render/afp/extensions/ExtensionPlacement.java View File

@@ -19,6 +19,8 @@

package org.apache.fop.render.afp.extensions;

import java.util.Locale;

/**
* An enumeration for placement instruction for AFP extensions.
*/
@@ -34,7 +36,7 @@ public enum ExtensionPlacement {
* @return the XML value
*/
public String getXMLValue() {
String xmlName = name().toLowerCase();
String xmlName = name().toLowerCase(Locale.ENGLISH);
xmlName = xmlName.replace('_', '-');
return xmlName;
}
@@ -45,7 +47,7 @@ public enum ExtensionPlacement {
* @return the enum value
*/
public static ExtensionPlacement fromXMLValue(String value) {
String name = value.toUpperCase();
String name = value.toUpperCase(Locale.ENGLISH);
name = name.replace('-', '_');
return ExtensionPlacement.valueOf(name);
}

+ 1
- 0
src/java/org/apache/fop/render/pdf/AbstractPDFImageHandler.java View File

@@ -39,6 +39,7 @@ abstract class AbstractPDFImageHandler implements ImageHandler {
/** {@inheritDoc} */
public void handleImage(RenderingContext context, Image image, Rectangle pos)
throws IOException {
assert context instanceof PDFRenderingContext;
PDFRenderingContext pdfContext = (PDFRenderingContext)context;
PDFContentGenerator generator = pdfContext.getGenerator();
PDFImage pdfimage = createPDFImage(image, image.getInfo().getOriginalURI());

+ 4
- 1
src/java/org/apache/fop/render/ps/PSRendererConfigurator.java View File

@@ -19,6 +19,8 @@

package org.apache.fop.render.ps;

import java.util.Locale;

import org.apache.avalon.framework.configuration.Configuration;

import org.apache.xmlgraphics.ps.PSGenerator;
@@ -69,7 +71,8 @@ public class PSRendererConfigurator extends PrintRendererConfigurator
child = cfg.getChild("rendering");
if (child != null) {
psUtil.setRenderingMode(PSRenderingMode.valueOf(
child.getValue(psUtil.getRenderingMode().toString()).toUpperCase()));
child.getValue(psUtil.getRenderingMode().toString())
.toUpperCase(Locale.ENGLISH)));
}
psUtil.setSafeSetPageDevice(
cfg.getChild("safe-set-page-device").getValueAsBoolean(false));

+ 6
- 2
src/java/org/apache/fop/render/rtf/RTFHandler.java View File

@@ -100,6 +100,7 @@ import org.apache.fop.layoutmgr.inline.ImageLayout;
import org.apache.fop.layoutmgr.table.ColumnSetup;
import org.apache.fop.render.DefaultFontResolver;
import org.apache.fop.render.RendererEventProducer;
import org.apache.fop.render.rtf.rtflib.exceptions.RtfException;
import org.apache.fop.render.rtf.rtflib.rtfdoc.IRtfAfterContainer;
import org.apache.fop.render.rtf.rtflib.rtfdoc.IRtfBeforeContainer;
import org.apache.fop.render.rtf.rtflib.rtfdoc.IRtfListContainer;
@@ -1448,7 +1449,7 @@ public class RTFHandler extends FOEventHandler {
throw new RuntimeException(e.getMessage());
}
}
/** {@inheritDoc} */
public void startPageNumberCitationLast(PageNumberCitationLast l) {
if (bDefer) {
@@ -1463,7 +1464,10 @@ public class RTFHandler extends FOEventHandler {

textrun.addPageNumberCitation(l.getRefId());

} catch (Exception e) {
} catch (RtfException e) {
log.error("startPageNumberCitationLast: " + e.getMessage());
throw new RuntimeException(e.getMessage());
} catch (IOException e) {
log.error("startPageNumberCitationLast: " + e.getMessage());
throw new RuntimeException(e.getMessage());
}

+ 11
- 16
src/java/org/apache/fop/svg/ACIUtils.java View File

@@ -79,24 +79,19 @@ public final class ACIUtils {
GVTFont gvtFont = (GVTFont)aci.getAttribute(
GVTAttributedCharacterIterator.TextAttribute.GVT_FONT);
if (gvtFont != null) {
try {
String gvtFontFamily = gvtFont.getFamilyName(); //Not available in Batik 1.6!
if (fontInfo.hasFont(gvtFontFamily, style, weight)) {
FontTriplet triplet = fontInfo.fontLookup(gvtFontFamily, style,
weight);
Font f = fontInfo.getFontInstance(triplet, fsize);
if (LOG.isDebugEnabled()) {
LOG.debug("Found a font that matches the GVT font: "
+ gvtFontFamily + ", " + weight + ", " + style
+ " -> " + f);
}
fonts.add(f);
String gvtFontFamily = gvtFont.getFamilyName();
if (fontInfo.hasFont(gvtFontFamily, style, weight)) {
FontTriplet triplet = fontInfo.fontLookup(gvtFontFamily, style,
weight);
Font f = fontInfo.getFontInstance(triplet, fsize);
if (LOG.isDebugEnabled()) {
LOG.debug("Found a font that matches the GVT font: "
+ gvtFontFamily + ", " + weight + ", " + style
+ " -> " + f);
}
firstFontFamily = gvtFontFamily;
} catch (Exception e) {
//Most likely NoSuchMethodError here when using Batik 1.6
//Just skip this section in this case
fonts.add(f);
}
firstFontFamily = gvtFontFamily;
}

if (gvtFonts != null) {

Loading…
Cancel
Save