aboutsummaryrefslogtreecommitdiffstats
path: root/fop-sandbox
diff options
context:
space:
mode:
authorGlenn Adams <gadams@apache.org>2016-03-13 01:32:45 +0000
committerGlenn Adams <gadams@apache.org>2016-03-13 01:32:45 +0000
commit56a5fe00c829a616178a2b95f371577fa4ff6db1 (patch)
treed39218e04ccfc20e66ddf7a52dee82c96233f997 /fop-sandbox
parent6a719897d6f98ba89aa08e2f97b2b801be066cbf (diff)
downloadxmlgraphics-fop-56a5fe00c829a616178a2b95f371577fa4ff6db1.tar.gz
xmlgraphics-fop-56a5fe00c829a616178a2b95f371577fa4ff6db1.zip
Fixups for ant targets, checkstyle, findbugs.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/maven@1734752 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'fop-sandbox')
-rw-r--r--fop-sandbox/pom.xml4
-rw-r--r--fop-sandbox/src/main/java/org/apache/fop/render/mif/MIFElement.java5
-rw-r--r--fop-sandbox/src/main/java/org/apache/fop/render/mif/MIFFile.java22
-rw-r--r--fop-sandbox/src/main/java/org/apache/fop/render/mif/MIFHandler.java6
-rw-r--r--fop-sandbox/src/main/java/org/apache/fop/render/svg/EmbeddedSVGImageHandler.java8
-rw-r--r--fop-sandbox/src/main/java/org/apache/fop/render/svg/SVGDataUrlImageHandler.java3
-rw-r--r--fop-sandbox/src/main/java/org/apache/fop/render/svg/SVGDocumentHandler.java11
-rw-r--r--fop-sandbox/src/main/java/org/apache/fop/render/svg/SVGPainter.java4
-rw-r--r--fop-sandbox/src/tools/resources/findbugs/exclusions.xml126
9 files changed, 160 insertions, 29 deletions
diff --git a/fop-sandbox/pom.xml b/fop-sandbox/pom.xml
index 8d44f1443..d0eb9847a 100644
--- a/fop-sandbox/pom.xml
+++ b/fop-sandbox/pom.xml
@@ -90,9 +90,7 @@
</plugin>
<!-- code analysis - checkstyle -->
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle.plugin.version}</version>
<configuration>
<configLocation>${project.baseUri}../fop-core/src/tools/resources/checkstyle/checkstyle.xml</configLocation>
<headerLocation>${project.baseUri}../fop-core/src/tools/resources/checkstyle/LICENSE.txt</headerLocation>
@@ -110,7 +108,7 @@
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugs.plugin.version}</version>
<configuration>
- <excludeFilterFile>../fop-core/src/tools/resources/findbugs/exclusions.xml</excludeFilterFile>
+ <excludeFilterFile>src/tools/resources/findbugs/exclusions.xml</excludeFilterFile>
<effort>Max</effort>
<threshold>Low</threshold>
</configuration>
diff --git a/fop-sandbox/src/main/java/org/apache/fop/render/mif/MIFElement.java b/fop-sandbox/src/main/java/org/apache/fop/render/mif/MIFElement.java
index 098eab470..93f7c1d8d 100644
--- a/fop-sandbox/src/main/java/org/apache/fop/render/mif/MIFElement.java
+++ b/fop-sandbox/src/main/java/org/apache/fop/render/mif/MIFElement.java
@@ -83,10 +83,11 @@ public class MIFElement {
return false;
}
- String indentStr = "";
+ StringBuffer sb = new StringBuffer();
for (int c = 0; c < indent; c++) {
- indentStr += " ";
+ sb.append(' ');
}
+ String indentStr = sb.toString();
if (!started) {
os.write((indentStr + "<" + name).getBytes());
if (valueElements != null) {
diff --git a/fop-sandbox/src/main/java/org/apache/fop/render/mif/MIFFile.java b/fop-sandbox/src/main/java/org/apache/fop/render/mif/MIFFile.java
index 9ee8a8a5f..c727b2998 100644
--- a/fop-sandbox/src/main/java/org/apache/fop/render/mif/MIFFile.java
+++ b/fop-sandbox/src/main/java/org/apache/fop/render/mif/MIFFile.java
@@ -38,31 +38,31 @@ public class MIFFile extends MIFElement {
/** pgfCatalog */
protected PGFElement pgfCatalog;
/** fontCatalog */
- protected MIFElement fontCatalog;
+ // protected MIFElement fontCatalog;
/** rulingCatalog */
protected RulingElement rulingCatalog;
/** tblCatalog */
- protected MIFElement tblCatalog;
+ // protected MIFElement tblCatalog;
/** views */
- protected MIFElement views;
+ // protected MIFElement views;
/** variableFormats */
- protected MIFElement variableFormats;
+ // protected MIFElement variableFormats;
/** xRefFormats */
- protected MIFElement xRefFormats;
+ // protected MIFElement xRefFormats;
/** document */
- protected MIFElement document;
+ // protected MIFElement document;
/** bookComponent */
- protected MIFElement bookComponent;
+ // protected MIFElement bookComponent;
/** initialAutoNums */
- protected MIFElement initialAutoNums;
+ // protected MIFElement initialAutoNums;
/** aFrames */
- protected MIFElement aFrames;
+ // protected MIFElement aFrames;
/** tbls */
- protected MIFElement tbls;
+ // protected MIFElement tbls;
/** pages */
protected List pages = new java.util.ArrayList();
/** textFlows */
- protected List textFlows;
+ // protected List textFlows;
/** default constructor */
diff --git a/fop-sandbox/src/main/java/org/apache/fop/render/mif/MIFHandler.java b/fop-sandbox/src/main/java/org/apache/fop/render/mif/MIFHandler.java
index 00b9dfbfe..32f6a5f49 100644
--- a/fop-sandbox/src/main/java/org/apache/fop/render/mif/MIFHandler.java
+++ b/fop-sandbox/src/main/java/org/apache/fop/render/mif/MIFHandler.java
@@ -53,7 +53,6 @@ import org.apache.fop.fo.flow.table.TableHeader;
import org.apache.fop.fo.flow.table.TableRow;
import org.apache.fop.fo.pagination.Flow;
import org.apache.fop.fo.pagination.PageSequence;
-import org.apache.fop.fo.pagination.PageSequenceMaster;
import org.apache.fop.fo.pagination.SimplePageMaster;
import org.apache.fop.fo.pagination.StaticContent;
import org.apache.fop.fonts.FontSetup;
@@ -122,10 +121,7 @@ public class MIFHandler extends FOEventHandler {
// setup the pages for this sequence
String name = pageSeq.getMasterReference();
SimplePageMaster spm = pageSeq.getRoot().getLayoutMasterSet().getSimplePageMaster(name);
- if (spm == null) {
- PageSequenceMaster psm
- = pageSeq.getRoot().getLayoutMasterSet().getPageSequenceMaster(name);
- } else {
+ if (spm != null) {
// create simple master with regions
MIFElement prop = new MIFElement("PageType");
prop.setValue("BodyPage");
diff --git a/fop-sandbox/src/main/java/org/apache/fop/render/svg/EmbeddedSVGImageHandler.java b/fop-sandbox/src/main/java/org/apache/fop/render/svg/EmbeddedSVGImageHandler.java
index 371f5a768..856ee370c 100644
--- a/fop-sandbox/src/main/java/org/apache/fop/render/svg/EmbeddedSVGImageHandler.java
+++ b/fop-sandbox/src/main/java/org/apache/fop/render/svg/EmbeddedSVGImageHandler.java
@@ -42,7 +42,6 @@ import org.apache.xmlgraphics.image.loader.Image;
import org.apache.xmlgraphics.image.loader.ImageFlavor;
import org.apache.xmlgraphics.image.loader.impl.ImageRawStream;
import org.apache.xmlgraphics.image.loader.impl.ImageXMLDOM;
-import org.apache.xmlgraphics.util.QName;
import org.apache.fop.image.loader.batik.BatikImageFlavors;
import org.apache.fop.render.ImageHandler;
@@ -77,16 +76,21 @@ public class EmbeddedSVGImageHandler implements ImageHandler, SVGConstants {
};
}
+ /*
private void addAttribute(AttributesImpl atts, QName attribute, String value) {
atts.addAttribute(attribute.getNamespaceURI(),
attribute.getLocalName(), attribute.getQName(), CDATA, value);
}
+ */
/** {@inheritDoc} */
public void handleImage(RenderingContext context, Image image, final Rectangle pos)
throws IOException {
SVGRenderingContext svgContext = (SVGRenderingContext)context;
- ImageXMLDOM svg = (ImageXMLDOM)image;
+ if (!(image instanceof ImageXMLDOM)) {
+ throw new IllegalStateException();
+ }
+ ImageXMLDOM svg = (ImageXMLDOM) image;
ContentHandler handler = svgContext.getContentHandler();
AttributesImpl atts = new AttributesImpl();
atts.addAttribute("", "x", "x", CDATA, SVGUtil.formatMptToPt(pos.x));
diff --git a/fop-sandbox/src/main/java/org/apache/fop/render/svg/SVGDataUrlImageHandler.java b/fop-sandbox/src/main/java/org/apache/fop/render/svg/SVGDataUrlImageHandler.java
index fbe29e8d5..7363a7c72 100644
--- a/fop-sandbox/src/main/java/org/apache/fop/render/svg/SVGDataUrlImageHandler.java
+++ b/fop-sandbox/src/main/java/org/apache/fop/render/svg/SVGDataUrlImageHandler.java
@@ -75,6 +75,9 @@ public class SVGDataUrlImageHandler implements ImageHandler, SVGConstants {
public void handleImage(RenderingContext context, Image image, Rectangle pos)
throws IOException {
SVGRenderingContext svgContext = (SVGRenderingContext)context;
+ if (!(image instanceof ImageRawStream)) {
+ throw new IllegalStateException();
+ }
ImageRawStream raw = (ImageRawStream)image;
InputStream in = raw.createInputStream();
try {
diff --git a/fop-sandbox/src/main/java/org/apache/fop/render/svg/SVGDocumentHandler.java b/fop-sandbox/src/main/java/org/apache/fop/render/svg/SVGDocumentHandler.java
index f7bfbb38e..e5aa2af07 100644
--- a/fop-sandbox/src/main/java/org/apache/fop/render/svg/SVGDocumentHandler.java
+++ b/fop-sandbox/src/main/java/org/apache/fop/render/svg/SVGDocumentHandler.java
@@ -75,6 +75,8 @@ public class SVGDocumentHandler extends AbstractSVGDocumentHandler {
*/
public SVGDocumentHandler(IFContext context) {
super(context);
+ this.multiFileUtil = null;
+ this.reusedParts = null;
}
/** {@inheritDoc} */
@@ -192,10 +194,13 @@ public class SVGDocumentHandler extends AbstractSVGDocumentHandler {
} catch (TransformerConfigurationException tce) {
throw new IFException("Error setting up a Transformer", tce);
} catch (TransformerException te) {
- if (te.getCause() instanceof SAXException) {
- throw (SAXException)te.getCause();
+ Throwable t = te.getCause();
+ if (t instanceof SAXException) {
+ throw (SAXException) t;
+ } else if (t instanceof Exception) {
+ throw new IFException("Error while serializing reused parts", (Exception) t);
} else {
- throw new IFException("Error while serializing reused parts", te);
+ throw new RuntimeException(t);
}
}
} catch (SAXException e) {
diff --git a/fop-sandbox/src/main/java/org/apache/fop/render/svg/SVGPainter.java b/fop-sandbox/src/main/java/org/apache/fop/render/svg/SVGPainter.java
index fb7ce2677..8c85353d5 100644
--- a/fop-sandbox/src/main/java/org/apache/fop/render/svg/SVGPainter.java
+++ b/fop-sandbox/src/main/java/org/apache/fop/render/svg/SVGPainter.java
@@ -278,9 +278,7 @@ public class SVGPainter extends AbstractIFPainter<AbstractSVGDocumentHandler>
XMLUtil.addAttribute(atts, "y", SVGUtil.formatMptToPt(rect.y));
XMLUtil.addAttribute(atts, "width", SVGUtil.formatMptToPt(rect.width));
XMLUtil.addAttribute(atts, "height", SVGUtil.formatMptToPt(rect.height));
- if (fill != null) {
- XMLUtil.addAttribute(atts, "fill", toString(fill));
- }
+ XMLUtil.addAttribute(atts, "fill", toString(fill));
/* disabled
if (stroke != null) {
XMLUtil.addAttribute(atts, "stroke", toString(stroke));
diff --git a/fop-sandbox/src/tools/resources/findbugs/exclusions.xml b/fop-sandbox/src/tools/resources/findbugs/exclusions.xml
new file mode 100644
index 000000000..9be08f1a7
--- /dev/null
+++ b/fop-sandbox/src/tools/resources/findbugs/exclusions.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FindBugsFilter>
+
+ <!--
+ !
+ ! This file is divided into two parts:
+ ! 1. APPROVED EXCLUSIONS
+ ! 2. TEMPORARY (UNAPPROVED) EXCLUSIONS
+ !
+ ! Approved exclusions come in two sub-types:
+ ! 1. general exclusion of a named bug pattern, meaning that all instances that matches the bug
+ ! pattern identifier are excluded;
+ ! 2. specific exclusions for a named bug pattern, meaning that all instance exclusions are
+ ! explicitly enumerated;
+ !
+ ! All specific exclusions must be accompanied inline (i.e., in the affected source code) by
+ ! a commented out annotation of the form:
+ !
+ ! // @SuppressFBWarnings("pattern identifier")
+ !
+ ! where pattern identifier is one of findbugs' named patterns. At an appropriate point in the
+ ! future, these commented out annotations will be uncommented and exclusion patterns removed
+ ! from this file.
+ !
+ ! Temporary (unapproved) exclusions are short-term work arounds that should be removed as
+ ! soon as possible by either (1) fixing (eliminating) cause of warning, or (2) conversion to
+ ! approved exclusion.
+ !
+ ! The organization of pattern matches employs the following levels (from top down):
+ ! 1. bug pattern
+ ! 2. or clause matching instances
+ ! 3. class name, if applies to class/interface
+ ! 4. and clause matching class/instance and single or or clause of multiple {method,field} members
+ !
+ ! for example,
+ !
+ ! <Match>
+ ! <Bug pattern="pattern identifier"/>
+ ! <Or>
+ ! <And>
+ ! <Class name="dotted class name"/>
+ ! <Member name="unqualified member name"/>
+ ! </And>
+ ! </Or>
+ ! </Match>
+ !
+ -->
+
+ <!-- START - APPROVED EXCLUSIONS -->
+ <!-- END - APPROVED EXCLUSIONS -->
+
+ <!-- START - TEMPORARY (UNAPPROVED) EXCLUSIONS -->
+ <Match>
+ <Bug pattern="DM_DEFAULT_ENCODING"/>
+ </Match>
+ <Match>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Bug pattern="SIC_INNER_SHOULD_BE_STATIC_ANON"/>
+ </Match>
+ <!--
+ <Match>
+ <Bug pattern="BC_UNCONFIRMED_CAST"/>
+ </Match>
+ <Match>
+ <Bug pattern="DB_DUPLICATE_SWITCH_CLAUSES"/>
+ </Match>
+ <Match>
+ <Bug pattern="DLS_DEAD_LOCAL_STORE"/>
+ </Match>
+ <Match>
+ <Bug pattern="DM_CONVERT_CASE"/>
+ </Match>
+ <Match>
+ <Bug pattern="DM_FP_NUMBER_CTOR"/>
+ </Match>
+ <Match>
+ <Bug pattern="DM_NUMBER_CTOR"/>
+ </Match>
+ <Match>
+ <Bug pattern="EI_EXPOSE_REP2"/>
+ </Match>
+ <Match>
+ <Bug pattern="FE_FLOATING_POINT_EQUALITY"/>
+ </Match>
+ <Match>
+ <Bug pattern="MS_OOI_PKGPROTECT"/>
+ </Match>
+ <Match>
+ <Bug pattern="MS_PKGPROTECT"/>
+ </Match>
+ <Match>
+ <Bug pattern="NM_CONFUSING"/>
+ </Match>
+ <Match>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
+ </Match>
+ <Match>
+ <Bug pattern="REC_CATCH_EXCEPTION"/>
+ </Match>
+ <Match>
+ <Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE"/>
+ </Match>
+ <Match>
+ <Bug pattern="SE_BAD_FIELD"/>
+ </Match>
+ <Match>
+ <Bug pattern="SIC_INNER_SHOULD_BE_STATIC"/>
+ </Match>
+ <Match>
+ <Bug pattern="UI_INHERITANCE_UNSAFE_GETRESOURCE"/>
+ </Match>
+ <Match>
+ <Bug pattern="URF_UNREAD_FIELD"/>
+ </Match>
+ <Match>
+ <Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"/>
+ </Match>
+ -->
+ <!-- END - TEMPORARY (UNAPPROVED) EXCLUSIONS -->
+
+</FindBugsFilter>