diff options
author | Simon Pepping <spepping@apache.org> | 2011-06-15 11:04:33 +0000 |
---|---|---|
committer | Simon Pepping <spepping@apache.org> | 2011-06-15 11:04:33 +0000 |
commit | 82163b6a159d14c838f9c3a3b8d40137f93fc11b (patch) | |
tree | b593f05e98912672e0116f4528cd263c38a68e8d /src/java | |
parent | 860ebd14107d5288d95360b04cb8e3a375922f7b (diff) | |
download | xmlgraphics-fop-82163b6a159d14c838f9c3a3b8d40137f93fc11b.tar.gz xmlgraphics-fop-82163b6a159d14c838f9c3a3b8d40137f93fc11b.zip |
Fix checkstyle and findbugs issues
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1135995 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
7 files changed, 29 insertions, 23 deletions
diff --git a/src/java/org/apache/fop/afp/parser/UnparsedStructuredField.java b/src/java/org/apache/fop/afp/parser/UnparsedStructuredField.java index 4f782c5b1..0e2eeeb0c 100644 --- a/src/java/org/apache/fop/afp/parser/UnparsedStructuredField.java +++ b/src/java/org/apache/fop/afp/parser/UnparsedStructuredField.java @@ -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); diff --git a/src/java/org/apache/fop/afp/svg/AFPTextHandler.java b/src/java/org/apache/fop/afp/svg/AFPTextHandler.java index 4f340c151..eb75e33ff 100644 --- a/src/java/org/apache/fop/afp/svg/AFPTextHandler.java +++ b/src/java/org/apache/fop/afp/svg/AFPTextHandler.java @@ -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; diff --git a/src/java/org/apache/fop/render/afp/extensions/ExtensionPlacement.java b/src/java/org/apache/fop/render/afp/extensions/ExtensionPlacement.java index 7d3120333..9c593d52f 100644 --- a/src/java/org/apache/fop/render/afp/extensions/ExtensionPlacement.java +++ b/src/java/org/apache/fop/render/afp/extensions/ExtensionPlacement.java @@ -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); } diff --git a/src/java/org/apache/fop/render/pdf/AbstractPDFImageHandler.java b/src/java/org/apache/fop/render/pdf/AbstractPDFImageHandler.java index c03d4593c..5bc83fee3 100644 --- a/src/java/org/apache/fop/render/pdf/AbstractPDFImageHandler.java +++ b/src/java/org/apache/fop/render/pdf/AbstractPDFImageHandler.java @@ -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()); diff --git a/src/java/org/apache/fop/render/ps/PSRendererConfigurator.java b/src/java/org/apache/fop/render/ps/PSRendererConfigurator.java index 68f7e9d62..00f3fc154 100644 --- a/src/java/org/apache/fop/render/ps/PSRendererConfigurator.java +++ b/src/java/org/apache/fop/render/ps/PSRendererConfigurator.java @@ -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)); diff --git a/src/java/org/apache/fop/render/rtf/RTFHandler.java b/src/java/org/apache/fop/render/rtf/RTFHandler.java index 9597c1532..ac060caff 100644 --- a/src/java/org/apache/fop/render/rtf/RTFHandler.java +++ b/src/java/org/apache/fop/render/rtf/RTFHandler.java @@ -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()); } diff --git a/src/java/org/apache/fop/svg/ACIUtils.java b/src/java/org/apache/fop/svg/ACIUtils.java index 92dd3f16f..91361432a 100644 --- a/src/java/org/apache/fop/svg/ACIUtils.java +++ b/src/java/org/apache/fop/svg/ACIUtils.java @@ -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) { |