From: Peter Hancock Date: Mon, 6 Feb 2012 10:18:09 +0000 (+0000) Subject: Addressed findbugs and checkstyle regressions X-Git-Tag: fop-1_1rc1old~133^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=65e12053cb81114db964534f7e974c338a8a467b;p=xmlgraphics-fop.git Addressed findbugs and checkstyle regressions Findbugs report generated with version 1.3.9. Checkstyle report generated with version 5.5. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_ImproveAccessibility@1240963 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/findbugs-exclude.xml b/findbugs-exclude.xml index 67220fc1e..ba6b3abc0 100644 --- a/findbugs-exclude.xml +++ b/findbugs-exclude.xml @@ -1,6 +1,38 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -5089,4 +5121,4 @@ - \ No newline at end of file + diff --git a/src/java/org/apache/fop/accessibility/DummyStructureTreeEventHandler.java b/src/java/org/apache/fop/accessibility/DummyStructureTreeEventHandler.java index f8507a64f..66eaece89 100644 --- a/src/java/org/apache/fop/accessibility/DummyStructureTreeEventHandler.java +++ b/src/java/org/apache/fop/accessibility/DummyStructureTreeEventHandler.java @@ -33,23 +33,29 @@ public final class DummyStructureTreeEventHandler implements StructureTreeEventH private DummyStructureTreeEventHandler() { } + /** {@inheritDoc} */ public void startPageSequence(Locale locale) { } + /** {@inheritDoc} */ public void endPageSequence() { } + /** {@inheritDoc} */ public StructureTreeElement startNode(String name, Attributes attributes) { return null; } + /** {@inheritDoc} */ public void endNode(String name) { } + /** {@inheritDoc} */ public StructureTreeElement startImageNode(String name, Attributes attributes) { return null; } + /** {@inheritDoc} */ public StructureTreeElement startReferencedNode(String name, Attributes attributes) { return null; } diff --git a/src/java/org/apache/fop/accessibility/StructureTree2SAXEventAdapter.java b/src/java/org/apache/fop/accessibility/StructureTree2SAXEventAdapter.java index 6578b452e..79c589f9b 100644 --- a/src/java/org/apache/fop/accessibility/StructureTree2SAXEventAdapter.java +++ b/src/java/org/apache/fop/accessibility/StructureTree2SAXEventAdapter.java @@ -45,11 +45,13 @@ public final class StructureTree2SAXEventAdapter implements StructureTreeEventHa /** * Factory method that creates a new instance. * @param contentHandler The handler that receives SAX events + * @return - */ public static StructureTreeEventHandler newInstance(ContentHandler contentHandler) { return new StructureTree2SAXEventAdapter(contentHandler); } + /** {@inheritDoc} */ public void startPageSequence(Locale locale) { try { @@ -65,6 +67,7 @@ public final class StructureTree2SAXEventAdapter implements StructureTreeEventHa } } + /** {@inheritDoc} */ public void endPageSequence() { try { contentHandler.endElement(IFConstants.NAMESPACE, IFConstants.EL_STRUCTURE_TREE, @@ -79,6 +82,7 @@ public final class StructureTree2SAXEventAdapter implements StructureTreeEventHa } } + /** {@inheritDoc} */ public StructureTreeElement startNode(String name, Attributes attributes) { try { if (name.equals("#PCDATA")) { @@ -96,6 +100,7 @@ public final class StructureTree2SAXEventAdapter implements StructureTreeEventHa } } + /** {@inheritDoc} */ public void endNode(String name) { try { contentHandler.endElement(FOElementMapping.URI, name, @@ -105,10 +110,12 @@ public final class StructureTree2SAXEventAdapter implements StructureTreeEventHa } } + /** {@inheritDoc} */ public StructureTreeElement startImageNode(String name, Attributes attributes) { return startNode(name, attributes); } + /** {@inheritDoc} */ public StructureTreeElement startReferencedNode(String name, Attributes attributes) { return startNode(name, attributes); } diff --git a/src/java/org/apache/fop/accessibility/StructureTreeElement.java b/src/java/org/apache/fop/accessibility/StructureTreeElement.java index 3a691c42c..ebed2c8ff 100644 --- a/src/java/org/apache/fop/accessibility/StructureTreeElement.java +++ b/src/java/org/apache/fop/accessibility/StructureTreeElement.java @@ -17,9 +17,6 @@ /* $Id$ */ -/** - * - */ package org.apache.fop.accessibility; /** diff --git a/src/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java b/src/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java index b5cd0a5a4..957f40870 100644 --- a/src/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java +++ b/src/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java @@ -362,7 +362,8 @@ class StructureTreeEventTrigger extends FOEventHandler { if (node instanceof CommonAccessibilityHolder) { addRole((CommonAccessibilityHolder) node, attributes); } - node.setStructureTreeElement(structureTreeEventHandler.startReferencedNode(localName, attributes)); + node.setStructureTreeElement( + structureTreeEventHandler.startReferencedNode(localName, attributes)); } private void startElementWithIDAndAltText(AbstractGraphics node) { @@ -371,7 +372,8 @@ class StructureTreeEventTrigger extends FOEventHandler { addRole(node, attributes); addAttribute(attributes, ExtensionElementMapping.URI, "alt-text", ExtensionElementMapping.STANDARD_PREFIX, node.getAltText()); - node.setStructureTreeElement(structureTreeEventHandler.startImageNode(localName, attributes)); + node.setStructureTreeElement( + structureTreeEventHandler.startImageNode(localName, attributes)); } private StructureTreeElement startElement(FONode node, AttributesImpl attributes) { diff --git a/src/java/org/apache/fop/apps/FOUserAgent.java b/src/java/org/apache/fop/apps/FOUserAgent.java index d5cc695c8..7d1736586 100644 --- a/src/java/org/apache/fop/apps/FOUserAgent.java +++ b/src/java/org/apache/fop/apps/FOUserAgent.java @@ -102,7 +102,8 @@ public class FOUserAgent { private boolean locatorEnabled = true; // true by default (for error messages). private boolean conserveMemoryPolicy = false; private EventBroadcaster eventBroadcaster = new FOPEventBroadcaster(); - private StructureTreeEventHandler structureTreeEventHandler = DummyStructureTreeEventHandler.INSTANCE; + private StructureTreeEventHandler structureTreeEventHandler + = DummyStructureTreeEventHandler.INSTANCE; /** Producer: Metadata element for the system/software that produces * the document. (Some renderers can store this in the document.) diff --git a/src/java/org/apache/fop/area/AreaTreeParser.java b/src/java/org/apache/fop/area/AreaTreeParser.java index 29a363495..d8c22f2e8 100644 --- a/src/java/org/apache/fop/area/AreaTreeParser.java +++ b/src/java/org/apache/fop/area/AreaTreeParser.java @@ -163,8 +163,6 @@ public class AreaTreeParser { private DOMImplementation domImplementation; private Locator locator; - private Attributes pageSequenceAttributes; - public Handler(AreaTreeModel treeModel, FOUserAgent userAgent, ElementMappingRegistry elementMappingRegistry) { this.treeModel = treeModel; diff --git a/src/java/org/apache/fop/fo/FOEventHandler.java b/src/java/org/apache/fop/fo/FOEventHandler.java index bed1f3677..b7bcd4215 100644 --- a/src/java/org/apache/fop/fo/FOEventHandler.java +++ b/src/java/org/apache/fop/fo/FOEventHandler.java @@ -122,9 +122,11 @@ public abstract class FOEventHandler { public void endDocument() throws SAXException { } + /** {@inheritDoc} */ public void startRoot(Root root) { } + /** {@inheritDoc} */ public void endRoot(Root root) { } diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java index 622ff86d4..b63c49ae2 100644 --- a/src/java/org/apache/fop/fo/FONode.java +++ b/src/java/org/apache/fop/fo/FONode.java @@ -913,6 +913,11 @@ public abstract class FONode implements Cloneable { } + /** + * Sets the structure tree element. + * + * @param structureTreeElement set. + */ public void setStructureTreeElement(StructureTreeElement structureTreeElement) { throw new UnsupportedOperationException(); } diff --git a/src/java/org/apache/fop/fo/FOText.java b/src/java/org/apache/fop/fo/FOText.java index 3858cdea9..43b58685f 100644 --- a/src/java/org/apache/fop/fo/FOText.java +++ b/src/java/org/apache/fop/fo/FOText.java @@ -667,6 +667,7 @@ public class FOText extends FONode implements CharSequence { this.structureTreeElement = structureTreeElement; } + /** @return the structure tree element. */ public StructureTreeElement getStructureTreeElement() { return structureTreeElement; } diff --git a/src/java/org/apache/fop/fo/flow/AbstractGraphics.java b/src/java/org/apache/fop/fo/flow/AbstractGraphics.java index 2b8fa8a0b..d5fe2b500 100644 --- a/src/java/org/apache/fop/fo/flow/AbstractGraphics.java +++ b/src/java/org/apache/fop/fo/flow/AbstractGraphics.java @@ -119,6 +119,7 @@ public abstract class AbstractGraphics extends FObj } } + /** {@inheritDoc} */ public CommonAccessibility getCommonAccessibility() { return commonAccessibility; } @@ -236,6 +237,7 @@ public abstract class AbstractGraphics extends FObj return structureTreeElement; } + /** @return the alternative text property. */ public String getAltText() { return altText; } diff --git a/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java b/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java index 3ee44ac4f..0e99bfe96 100644 --- a/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java +++ b/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java @@ -91,6 +91,7 @@ public abstract class AbstractListItemPart extends FObj implements CommonAccessi } } + /** {@inheritDoc} */ public CommonAccessibility getCommonAccessibility() { return commonAccessibility; } diff --git a/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java b/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java index 108896d91..5a6893b55 100644 --- a/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java +++ b/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java @@ -132,6 +132,7 @@ public abstract class AbstractPageNumberCitation extends FObj } } + /** {@inheritDoc} */ public CommonAccessibility getCommonAccessibility() { return commonAccessibility; } diff --git a/src/java/org/apache/fop/fo/flow/Block.java b/src/java/org/apache/fop/fo/flow/Block.java index 4e5b6f15f..84f1abc1b 100644 --- a/src/java/org/apache/fop/fo/flow/Block.java +++ b/src/java/org/apache/fop/fo/flow/Block.java @@ -151,6 +151,7 @@ public class Block extends FObjMixed implements BreakPropertySet, getFOEventHandler().endBlock(this); } + /** {@inheritDoc} */ public CommonAccessibility getCommonAccessibility() { return commonAccessibility; } diff --git a/src/java/org/apache/fop/fo/flow/Footnote.java b/src/java/org/apache/fop/fo/flow/Footnote.java index 61149b034..5953363ed 100644 --- a/src/java/org/apache/fop/fo/flow/Footnote.java +++ b/src/java/org/apache/fop/fo/flow/Footnote.java @@ -111,6 +111,7 @@ public class Footnote extends FObj implements CommonAccessibilityHolder { } } + /** {@inheritDoc} */ public CommonAccessibility getCommonAccessibility() { return commonAccessibility; } diff --git a/src/java/org/apache/fop/fo/flow/FootnoteBody.java b/src/java/org/apache/fop/fo/flow/FootnoteBody.java index 24edaf5d2..1c103b6b5 100644 --- a/src/java/org/apache/fop/fo/flow/FootnoteBody.java +++ b/src/java/org/apache/fop/fo/flow/FootnoteBody.java @@ -36,6 +36,7 @@ import org.apache.fop.fo.properties.CommonAccessibilityHolder; */ public class FootnoteBody extends FObj implements CommonAccessibilityHolder { + /** {@inheritDoc} */ private CommonAccessibility commonAccessibility; /** @@ -96,6 +97,7 @@ public class FootnoteBody extends FObj implements CommonAccessibilityHolder { return FO_FOOTNOTE_BODY; } + /** {@inheritDoc} */ public CommonAccessibility getCommonAccessibility() { return commonAccessibility; } diff --git a/src/java/org/apache/fop/fo/flow/InitialPropertySet.java b/src/java/org/apache/fop/fo/flow/InitialPropertySet.java index 47ce749fe..b41021b75 100644 --- a/src/java/org/apache/fop/fo/flow/InitialPropertySet.java +++ b/src/java/org/apache/fop/fo/flow/InitialPropertySet.java @@ -101,6 +101,7 @@ public class InitialPropertySet extends FObj implements CommonAccessibilityHolde return FO_INITIAL_PROPERTY_SET; } + /** {@inheritDoc} */ public CommonAccessibility getCommonAccessibility() { return commonAccessibility; } diff --git a/src/java/org/apache/fop/fo/flow/InlineLevel.java b/src/java/org/apache/fop/fo/flow/InlineLevel.java index d23b775f0..0da769080 100644 --- a/src/java/org/apache/fop/fo/flow/InlineLevel.java +++ b/src/java/org/apache/fop/fo/flow/InlineLevel.java @@ -72,6 +72,7 @@ public abstract class InlineLevel extends FObjMixed implements CommonAccessibili lineHeight = pList.get(PR_LINE_HEIGHT).getSpace(); } + /** {@inheritDoc} */ public CommonAccessibility getCommonAccessibility() { return commonAccessibility; } diff --git a/src/java/org/apache/fop/fo/flow/ListBlock.java b/src/java/org/apache/fop/fo/flow/ListBlock.java index 390978c19..35288ec80 100644 --- a/src/java/org/apache/fop/fo/flow/ListBlock.java +++ b/src/java/org/apache/fop/fo/flow/ListBlock.java @@ -126,6 +126,7 @@ public class ListBlock extends FObj implements BreakPropertySet, CommonAccessibi } } + /** {@inheritDoc} */ public CommonAccessibility getCommonAccessibility() { return commonAccessibility; } diff --git a/src/java/org/apache/fop/fo/flow/ListItem.java b/src/java/org/apache/fop/fo/flow/ListItem.java index dfd74f9d1..aa177777c 100644 --- a/src/java/org/apache/fop/fo/flow/ListItem.java +++ b/src/java/org/apache/fop/fo/flow/ListItem.java @@ -137,6 +137,7 @@ public class ListItem extends FObj implements BreakPropertySet, CommonAccessibil } } + /** {@inheritDoc} */ public CommonAccessibility getCommonAccessibility() { return commonAccessibility; } diff --git a/src/java/org/apache/fop/fo/flow/PageNumber.java b/src/java/org/apache/fop/fo/flow/PageNumber.java index 0e5ce5071..59169c2d3 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumber.java +++ b/src/java/org/apache/fop/fo/flow/PageNumber.java @@ -127,6 +127,7 @@ public class PageNumber extends FObj } } + /** {@inheritDoc} */ public CommonAccessibility getCommonAccessibility() { return commonAccessibility; } diff --git a/src/java/org/apache/fop/fo/flow/table/Table.java b/src/java/org/apache/fop/fo/flow/table/Table.java index ae7b8e4a1..c78f9f959 100644 --- a/src/java/org/apache/fop/fo/flow/table/Table.java +++ b/src/java/org/apache/fop/fo/flow/table/Table.java @@ -305,6 +305,7 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder, Break } } + /** {@inheritDoc} */ public CommonAccessibility getCommonAccessibility() { return commonAccessibility; } diff --git a/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java b/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java index 62acc579c..51db27e4e 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java +++ b/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java @@ -140,6 +140,7 @@ public class TableAndCaption extends FObj implements CommonAccessibilityHolder { return FO_TABLE_AND_CAPTION; } + /** {@inheritDoc} */ public CommonAccessibility getCommonAccessibility() { return commonAccessibility; } diff --git a/src/java/org/apache/fop/fo/flow/table/TableCaption.java b/src/java/org/apache/fop/fo/flow/table/TableCaption.java index 127c09802..380b27f34 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableCaption.java +++ b/src/java/org/apache/fop/fo/flow/table/TableCaption.java @@ -116,6 +116,7 @@ public class TableCaption extends FObj implements CommonAccessibilityHolder { return FO_TABLE_CAPTION; } + /** {@inheritDoc} */ public CommonAccessibility getCommonAccessibility() { return commonAccessibility; } diff --git a/src/java/org/apache/fop/fo/flow/table/TableCell.java b/src/java/org/apache/fop/fo/flow/table/TableCell.java index 549377ffd..c4f9c2aa6 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableCell.java +++ b/src/java/org/apache/fop/fo/flow/table/TableCell.java @@ -148,6 +148,7 @@ public class TableCell extends TableFObj implements CommonAccessibilityHolder { return true; } + /** {@inheritDoc} */ public CommonAccessibility getCommonAccessibility() { return commonAccessibility; } diff --git a/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java b/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java index 4b2a5101f..89ecd159a 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java +++ b/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java @@ -128,6 +128,7 @@ public abstract class TableCellContainer extends TableFObj return columnNumberManager; } + /** {@inheritDoc} */ public CommonAccessibility getCommonAccessibility() { return commonAccessibility; } diff --git a/src/java/org/apache/fop/fo/pagination/Root.java b/src/java/org/apache/fop/fo/pagination/Root.java index 6df6e9537..1a2ce718b 100644 --- a/src/java/org/apache/fop/fo/pagination/Root.java +++ b/src/java/org/apache/fop/fo/pagination/Root.java @@ -181,6 +181,7 @@ public class Root extends FObj implements CommonAccessibilityHolder { } } + /** {@inheritDoc} */ public CommonAccessibility getCommonAccessibility() { return commonAccessibility; } @@ -365,6 +366,7 @@ public class Root extends FObj implements CommonAccessibilityHolder { } + /** @return locale proprty. */ public Locale getLocale() { return locale; } diff --git a/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java b/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java index 5348e88e3..9e7d80cea 100644 --- a/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java +++ b/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java @@ -117,6 +117,7 @@ public class Bookmark extends FObj implements CommonAccessibilityHolder { } } + /** {@inheritDoc} */ public CommonAccessibility getCommonAccessibility() { return commonAccessibility; } diff --git a/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java b/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java index f4441934d..1db7d84ca 100644 --- a/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java +++ b/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java @@ -84,6 +84,7 @@ public class BookmarkTitle extends FObj implements CommonAccessibilityHolder { } } + /** {@inheritDoc} */ public CommonAccessibility getCommonAccessibility() { return commonAccessibility; } diff --git a/src/java/org/apache/fop/layoutmgr/TraitSetter.java b/src/java/org/apache/fop/layoutmgr/TraitSetter.java index da548c23c..0ae499478 100644 --- a/src/java/org/apache/fop/layoutmgr/TraitSetter.java +++ b/src/java/org/apache/fop/layoutmgr/TraitSetter.java @@ -597,7 +597,8 @@ public final class TraitSetter { * @param area the area to set the traits on * @param structureTreeElement the element the area is associated to in the document structure */ - public static void addStructureTreeElement(Area area, StructureTreeElement structureTreeElement) { + public static void addStructureTreeElement(Area area, + StructureTreeElement structureTreeElement) { if (structureTreeElement != null) { area.addTrait(Trait.STRUCTURE_TREE_ELEMENT, structureTreeElement); } diff --git a/src/java/org/apache/fop/pdf/PDFRoot.java b/src/java/org/apache/fop/pdf/PDFRoot.java index 177ca4b2d..76f2587de 100644 --- a/src/java/org/apache/fop/pdf/PDFRoot.java +++ b/src/java/org/apache/fop/pdf/PDFRoot.java @@ -255,8 +255,8 @@ public class PDFRoot extends PDFDictionary { } /** - * Sets the language identifier of the document. - * @param lang the language identifier of the document. + * Sets the locale of the document. + * @param locale the locale of the document. */ public void setLanguage(Locale locale) { if (locale == null) { diff --git a/src/java/org/apache/fop/pdf/PDFStructElem.java b/src/java/org/apache/fop/pdf/PDFStructElem.java index 44622638d..d2b3be6aa 100644 --- a/src/java/org/apache/fop/pdf/PDFStructElem.java +++ b/src/java/org/apache/fop/pdf/PDFStructElem.java @@ -179,6 +179,9 @@ public class PDFStructElem extends PDFDictionary implements StructureTreeElement return kidsAttached; } + /** + * Class representing a placeholder for a PDF Structure Element. + */ public static class Placeholder extends PDFStructElem { @Override @@ -195,6 +198,11 @@ public class PDFStructElem extends PDFDictionary implements StructureTreeElement } } + /** + * Constructor + * @param parent - + * @param name - + */ public Placeholder(PDFObject parent, String name) { super(parent, new PDFName(name)); } diff --git a/src/java/org/apache/fop/render/intermediate/IFConstants.java b/src/java/org/apache/fop/render/intermediate/IFConstants.java index dba39bec0..c7bf13e31 100644 --- a/src/java/org/apache/fop/render/intermediate/IFConstants.java +++ b/src/java/org/apache/fop/render/intermediate/IFConstants.java @@ -39,6 +39,7 @@ public interface IFConstants extends XMLConstants { String EL_HEADER = "header"; /** element name trailer */ String EL_TRAILER = "trailer"; + /** element name locale */ String EL_LOCALE = "locale"; /** element name page-sequence */ String EL_PAGE_SEQUENCE = "page-sequence"; diff --git a/src/java/org/apache/fop/render/intermediate/IFParser.java b/src/java/org/apache/fop/render/intermediate/IFParser.java index 1a384c6e9..36f1fd841 100644 --- a/src/java/org/apache/fop/render/intermediate/IFParser.java +++ b/src/java/org/apache/fop/render/intermediate/IFParser.java @@ -160,8 +160,8 @@ public class IFParser implements IFConstants { private Attributes pageSequenceAttributes; - private Map structureTreeElements = - new HashMap(); + private Map structureTreeElements + = new HashMap(); private final class StructureTreeHandler extends DefaultHandler { @@ -191,12 +191,12 @@ public class IFParser implements IFConstants { structureTreeEventHandler.startNode(localName, attributes); } else if (localName.equals("external-graphic") || localName.equals("instream-foreign-object")) { - StructureTreeElement structureTreeElement = - structureTreeEventHandler.startImageNode(localName, attributes); + StructureTreeElement structureTreeElement + = structureTreeEventHandler.startImageNode(localName, attributes); structureTreeElements.put(structID, structureTreeElement); } else { - StructureTreeElement structureTreeElement = - structureTreeEventHandler.startReferencedNode(localName, attributes); + StructureTreeElement structureTreeElement = structureTreeEventHandler + .startReferencedNode(localName, attributes); structureTreeElements.put(structID, structureTreeElement); } } @@ -289,7 +289,8 @@ public class IFParser implements IFConstants { } else if (DocumentNavigationExtensionConstants.NAMESPACE.equals(uri)) { if (this.navParser == null) { this.navParser = new DocumentNavigationHandler( - this.documentHandler.getDocumentNavigationHandler(), structureTreeElements); + this.documentHandler.getDocumentNavigationHandler(), + structureTreeElements); } delegate = this.navParser; delegateDepth++; diff --git a/src/java/org/apache/fop/render/intermediate/IFRenderer.java b/src/java/org/apache/fop/render/intermediate/IFRenderer.java index a2d8a0bea..4657c8856 100644 --- a/src/java/org/apache/fop/render/intermediate/IFRenderer.java +++ b/src/java/org/apache/fop/render/intermediate/IFRenderer.java @@ -852,8 +852,8 @@ public class IFRenderer extends AbstractPathOrientedRenderer { /** {@inheritDoc} */ public void renderInlineViewport(InlineViewport viewport) { - StructureTreeElement structElem = - (StructureTreeElement) viewport.getTrait(Trait.STRUCTURE_TREE_ELEMENT); + StructureTreeElement structElem + = (StructureTreeElement) viewport.getTrait(Trait.STRUCTURE_TREE_ELEMENT); establishStructureTreeElement(structElem); pushdID(viewport); Dimension dim = new Dimension(viewport.getIPD(), viewport.getBPD()); @@ -957,8 +957,8 @@ public class IFRenderer extends AbstractPathOrientedRenderer { // warn if link trait found but not allowed, else create link if (linkTraitFound) { - StructureTreeElement structElem = - (StructureTreeElement) ip.getTrait(Trait.STRUCTURE_TREE_ELEMENT); + StructureTreeElement structElem + = (StructureTreeElement) ip.getTrait(Trait.STRUCTURE_TREE_ELEMENT); action.setStructureTreeElement(structElem); Link link = new Link(action, ipRect); this.deferredLinks.add(link); @@ -1012,7 +1012,8 @@ public class IFRenderer extends AbstractPathOrientedRenderer { String fontName = getInternalFontNameForArea(text); int size = ((Integer) text.getTrait(Trait.FONT_SIZE)).intValue(); - StructureTreeElement structElem = (StructureTreeElement) text.getTrait(Trait.STRUCTURE_TREE_ELEMENT); + StructureTreeElement structElem + = (StructureTreeElement) text.getTrait(Trait.STRUCTURE_TREE_ELEMENT); establishStructureTreeElement(structElem); // This assumes that *all* CIDFonts use a /ToUnicode mapping diff --git a/src/java/org/apache/fop/render/intermediate/IFSerializer.java b/src/java/org/apache/fop/render/intermediate/IFSerializer.java index c6bf9af9e..7b9d95849 100644 --- a/src/java/org/apache/fop/render/intermediate/IFSerializer.java +++ b/src/java/org/apache/fop/render/intermediate/IFSerializer.java @@ -165,7 +165,8 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler handler.startPrefixMapping(XLINK_PREFIX, XLINK_NAMESPACE); handler.startPrefixMapping(DocumentNavigationExtensionConstants.PREFIX, DocumentNavigationExtensionConstants.NAMESPACE); - handler.startPrefixMapping(InternalElementMapping.STANDARD_PREFIX, InternalElementMapping.URI); + handler.startPrefixMapping(InternalElementMapping.STANDARD_PREFIX, + InternalElementMapping.URI); handler.startElement(EL_DOCUMENT); } catch (SAXException e) { throw new IFException("SAX error in startDocument()", e); @@ -686,10 +687,10 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler } private void addStructureReference(AttributesImpl atts) { - IFStructureTreeElement structureTreeElement = - (IFStructureTreeElement) getContext().getStructureTreeElement(); + IFStructureTreeElement structureTreeElement + = (IFStructureTreeElement) getContext().getStructureTreeElement(); if (structureTreeElement != null) { - addStructRefAttribute(atts, structureTreeElement.id); + addStructRefAttribute(atts, structureTreeElement.getId()); } } @@ -786,7 +787,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler XMLConstants.CDATA, IFUtil.toString(link.getTargetRect())); if (getUserAgent().isAccessibilityEnabled()) { addStructRefAttribute(atts, - ((IFStructureTreeElement) link.getAction().getStructureTreeElement()).id); + ((IFStructureTreeElement) link.getAction().getStructureTreeElement()).getId()); } try { handler.startElement(DocumentNavigationExtensionConstants.LINK, atts); diff --git a/src/java/org/apache/fop/render/intermediate/IFStructureTreeBuilder.java b/src/java/org/apache/fop/render/intermediate/IFStructureTreeBuilder.java index b78ae35bc..3d9885914 100644 --- a/src/java/org/apache/fop/render/intermediate/IFStructureTreeBuilder.java +++ b/src/java/org/apache/fop/render/intermediate/IFStructureTreeBuilder.java @@ -43,7 +43,7 @@ final class IFStructureTreeBuilder implements StructureTreeEventHandler { static final class IFStructureTreeElement implements StructureTreeElement { - final String id; + private final String id; IFStructureTreeElement() { this.id = null; @@ -52,6 +52,10 @@ final class IFStructureTreeBuilder implements StructureTreeEventHandler { IFStructureTreeElement(String id) { this.id = id; } + + public String getId() { + return id; + } } /** A SAX handler that records events to replay them later. */ @@ -106,8 +110,8 @@ final class IFStructureTreeBuilder implements StructureTreeEventHandler { private static final class StartPrefixMapping extends SAXEventRecorder.Event { - protected final String prefix; - protected final String uri; + private final String prefix; + private final String uri; private StartPrefixMapping(String prefix, String uri) { this.prefix = prefix; @@ -122,7 +126,7 @@ final class IFStructureTreeBuilder implements StructureTreeEventHandler { private static final class EndPrefixMapping extends SAXEventRecorder.Event { - protected final String prefix; + private final String prefix; private EndPrefixMapping(String prefix) { this.prefix = prefix; @@ -169,7 +173,8 @@ final class IFStructureTreeBuilder implements StructureTreeEventHandler { private StructureTreeEventHandler delegate; - private final List pageSequenceEventRecorders = new ArrayList(); + private final List pageSequenceEventRecorders + = new ArrayList(); private int idCounter; diff --git a/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationHandler.java b/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationHandler.java index 693497b73..c174a74a9 100644 --- a/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationHandler.java +++ b/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationHandler.java @@ -107,8 +107,8 @@ public class DocumentNavigationHandler extends DefaultHandler throw new SAXException(localName + " must be the root element!"); } Rectangle targetRect = XMLUtil.getAttributeAsRectangle(attributes, "rect"); - structureTreeElement = structureTreeElements.get( - attributes.getValue(InternalElementMapping.URI, InternalElementMapping.STRUCT_REF)); + structureTreeElement = structureTreeElements.get(attributes.getValue( + InternalElementMapping.URI, InternalElementMapping.STRUCT_REF)); Link link = new Link(null, targetRect); objectStack.push(link); } else if (GOTO_XY.getLocalName().equals(localName)) { diff --git a/src/java/org/apache/fop/render/pdf/FOToPDFRoleMap.java b/src/java/org/apache/fop/render/pdf/FOToPDFRoleMap.java index c773b1339..9b76d0620 100644 --- a/src/java/org/apache/fop/render/pdf/FOToPDFRoleMap.java +++ b/src/java/org/apache/fop/render/pdf/FOToPDFRoleMap.java @@ -35,9 +35,11 @@ final class FOToPDFRoleMap { /** * Standard structure types defined by the PDF Reference, Fourth Edition (PDF 1.5). */ - private static final Map STANDARD_STRUCTURE_TYPES = new HashMap(); + private static final Map STANDARD_STRUCTURE_TYPES + = new HashMap(); - private static final Map DEFAULT_MAPPINGS = new java.util.HashMap(); + private static final Map DEFAULT_MAPPINGS + = new java.util.HashMap(); private static final PDFName THEAD; private static final PDFName NON_STRUCT; diff --git a/src/java/org/apache/fop/render/rtf/RTFHandler.java b/src/java/org/apache/fop/render/rtf/RTFHandler.java index a3e3db461..dea5dcbec 100644 --- a/src/java/org/apache/fop/render/rtf/RTFHandler.java +++ b/src/java/org/apache/fop/render/rtf/RTFHandler.java @@ -1353,8 +1353,10 @@ public class RTFHandler extends FOEventHandler { RtfTextrun textrun = container.getTextrun(); textrun.addLeader(rtfAttr); - - } catch (Exception e) { + } catch (IOException e) { + log.error("startLeader: " + e.getMessage()); + throw new RuntimeException(e.getMessage()); + } catch (FOPException e) { log.error("startLeader: " + e.getMessage()); throw new RuntimeException(e.getMessage()); } diff --git a/src/java/org/apache/fop/render/xml/XMLRenderer.java b/src/java/org/apache/fop/render/xml/XMLRenderer.java index 2a62d2cea..5029346c0 100644 --- a/src/java/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/java/org/apache/fop/render/xml/XMLRenderer.java @@ -105,8 +105,6 @@ public class XMLRenderer extends AbstractXMLRenderer { /** If not null, the XMLRenderer will mimic another renderer by using its font setup. */ protected Renderer mimic; - private int pageSequenceIndex; - /** * Creates a new XML renderer. */ diff --git a/src/java/org/apache/fop/util/LanguageTags.java b/src/java/org/apache/fop/util/LanguageTags.java index 070fa15db..662fab908 100644 --- a/src/java/org/apache/fop/util/LanguageTags.java +++ b/src/java/org/apache/fop/util/LanguageTags.java @@ -37,7 +37,6 @@ public final class LanguageTags { * * @param locale a locale * @return the corresponding language tag - * @throws NullPointerException if the specified locale is null */ public static String toLanguageTag(Locale locale) { StringBuffer sb = new StringBuffer(5); @@ -53,7 +52,8 @@ public final class LanguageTags { /** * Converts an RFC 3066 compliant language tag to a locale. * - * @throws NullPointerException if the specified language tag is null + * @param languageTag language tag to convert + * @return the corresponding locale */ public static Locale toLocale(String languageTag) { String[] parts = languageTag.split("-");