aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeter Hancock <phancock@apache.org>2012-10-09 15:33:24 +0000
committerPeter Hancock <phancock@apache.org>2012-10-09 15:33:24 +0000
commitb9e74f1261ea539f5f2a95fe0bc6e1dc61a1eb93 (patch)
treead6d80a5931200ae09e57e059db14831c129ec97 /src
parente079e8eb1900e3287f28a34a6053b62ae4b241be (diff)
downloadxmlgraphics-fop-b9e74f1261ea539f5f2a95fe0bc6e1dc61a1eb93.tar.gz
xmlgraphics-fop-b9e74f1261ea539f5f2a95fe0bc6e1dc61a1eb93.zip
Addressed Findbug and Checkstyle issues
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_RoundedCorners@1396073 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/afp/AFPResourceManager.java1
-rw-r--r--src/java/org/apache/fop/fo/Constants.java2
-rw-r--r--src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java1
-rw-r--r--src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java2
-rw-r--r--src/java/org/apache/fop/render/afp/AFPDocumentHandler.java5
-rw-r--r--src/java/org/apache/fop/render/afp/AFPPainter.java26
-rw-r--r--src/java/org/apache/fop/render/intermediate/BezierCurvePainter.java2
-rw-r--r--src/java/org/apache/fop/render/intermediate/BorderPainter.java43
-rw-r--r--src/java/org/apache/fop/render/intermediate/IFRenderer.java3
-rw-r--r--src/java/org/apache/fop/render/java2d/Java2DGraphicsPainter.java3
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFGraphicsPainter.java10
-rw-r--r--src/java/org/apache/fop/render/ps/PSGraphicsPainter.java9
-rw-r--r--src/java/org/apache/fop/traits/BorderProps.java8
13 files changed, 56 insertions, 59 deletions
diff --git a/src/java/org/apache/fop/afp/AFPResourceManager.java b/src/java/org/apache/fop/afp/AFPResourceManager.java
index 59dab55c3..99b28cafd 100644
--- a/src/java/org/apache/fop/afp/AFPResourceManager.java
+++ b/src/java/org/apache/fop/afp/AFPResourceManager.java
@@ -242,7 +242,6 @@ public class AFPResourceManager {
private void includeObject(AbstractNamedAFPObject namedObj, AFPDataObjectInfo dataObjectInfo) {
// create the include object
- AFPResourceInfo resourceInfo = dataObjectInfo.getResourceInfo();
String objectName = namedObj.getName();
AbstractCachedObject cachedObject;
diff --git a/src/java/org/apache/fop/fo/Constants.java b/src/java/org/apache/fop/fo/Constants.java
index 722a4ca94..1a2425af5 100644
--- a/src/java/org/apache/fop/fo/Constants.java
+++ b/src/java/org/apache/fop/fo/Constants.java
@@ -806,7 +806,7 @@ public interface Constants {
* numbers.
*/
int PR_X_NUMBER_CONVERSION_FEATURES = 285;
-
+
/** Scope for table header */
int PR_X_HEADER_COLUMN = 286;
diff --git a/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java b/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java
index 70e74f6d6..eaf678790 100644
--- a/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java
+++ b/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java
@@ -38,7 +38,6 @@ import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.expr.PropertyException;
-import org.apache.fop.util.CompareUtil;
/**
* Stores all common border and padding properties.
diff --git a/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java b/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java
index c16113de3..b87f5c2ca 100644
--- a/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java
+++ b/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java
@@ -344,7 +344,7 @@ public abstract class AbstractPathOrientedRenderer extends PrintRenderer {
* @param bpsStart the border traits associated with start edge
* @param bpsEnd the border traits associated with end edge
* @param level of bidirectional embedding
- * @param innerBackgroundColor the background color of the block
+ * @param innerBackgroundColor the background color of the block
*/
protected void drawBorders( // CSOK: ParameterNumber
float startx, float starty, float width, float height,
diff --git a/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java b/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java
index 5a0732c84..cd8304b4b 100644
--- a/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java
+++ b/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java
@@ -27,6 +27,7 @@ import java.net.URI;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import org.apache.fop.afp.AFPDitheredRectanglePainter;
@@ -93,8 +94,6 @@ public class AFPDocumentHandler extends AbstractBinaryWritingIFDocumentHandler
private int roundedCornerCount = 0;
- /** Medium Map referenced on previous page **/
- private String lastMediumMap;
private static enum Location {
ELSEWHERE, IN_DOCUMENT_HEADER, FOLLOWING_PAGE_SEQUENCE, IN_PAGE_HEADER
}
@@ -419,7 +418,7 @@ public class AFPDocumentHandler extends AbstractBinaryWritingIFDocumentHandler
// Make a unique id
StringBuffer idBuilder = new StringBuffer("RC");
- String tmp = Integer.toHexString(roundedCornerCount).toUpperCase();
+ String tmp = Integer.toHexString(roundedCornerCount).toUpperCase(Locale.ENGLISH);
if (tmp.length() > 6) {
//Will never happen
//log.error("Rounded corners cache capacity exceeded");
diff --git a/src/java/org/apache/fop/render/afp/AFPPainter.java b/src/java/org/apache/fop/render/afp/AFPPainter.java
index 36afbb9e0..3a41e5feb 100644
--- a/src/java/org/apache/fop/render/afp/AFPPainter.java
+++ b/src/java/org/apache/fop/render/afp/AFPPainter.java
@@ -736,16 +736,8 @@ public class AFPPainter extends AbstractIFPainter<AFPDocumentHandler> {
GeneralPath cut = new GeneralPath();
cut.moveTo(0, 0);
- float borderWidthRatio = ((float) beforeWidth) / startWidth;
- if (beforeWidth * startRadius > startWidth * beforeRadius) {
- cut.lineTo(startRadius, borderWidthRatio * startRadius);
- cut.lineTo(startRadius, 0);
-
- } else {
- cut.lineTo(startRadius, borderWidthRatio * startRadius);
- cut.lineTo(startRadius, 0);
- }
-
+ cut.lineTo(startRadius, ((float) startRadius * beforeWidth) / startWidth);
+ cut.lineTo(startRadius, 0);
clip.intersect(new Area(cut));
clip.transform(transform);
return clip;
@@ -776,16 +768,8 @@ public class AFPPainter extends AbstractIFPainter<AFPDocumentHandler> {
GeneralPath cut = new GeneralPath();
cut.moveTo(0, 0);
- float borderWidthRatio = ((float) beforeWidth) / startWidth;
- if (beforeWidth * startRadius > startWidth * beforeRadius) {
- cut.lineTo(startRadius, borderWidthRatio * startRadius);
- cut.lineTo(startRadius, 0);
-
- } else {
- cut.lineTo(startRadius, borderWidthRatio * startRadius);
- cut.lineTo(startRadius, 0);
- }
-
+ cut.lineTo(startRadius, ((float) startRadius * beforeWidth) / startWidth);
+ cut.lineTo(startRadius, 0);
clip.subtract(new Area(cut));
clip.transform(transform);
return clip;
@@ -860,7 +844,7 @@ public class AFPPainter extends AbstractIFPainter<AFPDocumentHandler> {
hints.put(ImageHandlerUtil.CONVERSION_MODE, ImageHandlerUtil.CONVERSION_MODE_BITMAP);
hints.put("TARGET_RESOLUTION",
- new Integer(context.getPaintingState().getResolution()));
+ Integer.valueOf(context.getPaintingState().getResolution()));
try {
diff --git a/src/java/org/apache/fop/render/intermediate/BezierCurvePainter.java b/src/java/org/apache/fop/render/intermediate/BezierCurvePainter.java
index 92eb334e0..dd28dd5c8 100644
--- a/src/java/org/apache/fop/render/intermediate/BezierCurvePainter.java
+++ b/src/java/org/apache/fop/render/intermediate/BezierCurvePainter.java
@@ -34,4 +34,4 @@ public interface BezierCurvePainter {
* @throws IOException if an I/O error occurs
*/
void cubicBezierTo(int p1x, int p1y, int p2x, int p2y, int p3x, int p3y) throws IOException;
-} \ No newline at end of file
+}
diff --git a/src/java/org/apache/fop/render/intermediate/BorderPainter.java b/src/java/org/apache/fop/render/intermediate/BorderPainter.java
index 51dcf5905..e286590ca 100644
--- a/src/java/org/apache/fop/render/intermediate/BorderPainter.java
+++ b/src/java/org/apache/fop/render/intermediate/BorderPainter.java
@@ -33,12 +33,31 @@ public class BorderPainter {
/** TODO remove before integration*/
public static final String ROUNDED_CORNERS = "fop.round-corners";
- /** TODO Use a class to model border instead of an array
- * convention index of top, bottom, right and left borders */
- protected static final int TOP = 0, RIGHT = 1, BOTTOM = 2, LEFT = 3;
- /** TODO Use a class to model border corners instead of an array
- convention index of top-left, top-right, bottom-right and bottom-left border corners*/
- protected static final int TOP_LEFT = 0, TOP_RIGHT = 1, BOTTOM_RIGHT = 2, BOTTOM_LEFT = 3;
+ // TODO Use a class to model border instead of an array
+ /** Convention index of before top */
+ protected static final int TOP = 0;
+
+ /** Convention index of right border */
+ protected static final int RIGHT = 1;
+
+ /** Convention index of bottom border */
+ protected static final int BOTTOM = 2;
+
+ /** Convention index of left border */
+ protected static final int LEFT = 3;
+
+ // TODO Use a class to model border corners instead of an array
+ /** Convention index of top-left border corners */
+ protected static final int TOP_LEFT = 0;
+
+ /** Convention index of top-right-end border corners */
+ protected static final int TOP_RIGHT = 1;
+
+ /** Convention index of bottom-right border corners */
+ protected static final int BOTTOM_RIGHT = 2;
+
+ /** Convention index of bottom-left border corners */
+ protected static final int BOTTOM_LEFT = 3;
private final GraphicsPainter graphicsPainter;
@@ -227,7 +246,7 @@ public class BorderPainter {
int outerx = startx - clipw[LEFT];
int clipx = outerx + clipw[LEFT];
int innerx = outerx + bw[LEFT];
-
+
saveGraphicsState();
moveTo(clipx, ey1);
@@ -281,10 +300,12 @@ public class BorderPainter {
final int width = borderRect.width - start.getClippedWidth() - end.getClippedWidth();
final int height = borderRect.height - before.getClippedWidth() - after.getClippedWidth();
//Determine scale factor if any adjacent elliptic corners overlap
- double cornerCorrectionFactor = calculateCornerScaleCorrection(width, height, before, after, start, end);
+ double cornerCorrectionFactor = calculateCornerScaleCorrection(width, height, before, after, start,
+ end);
drawBorderSegment(start, before, end, 0, width, startx, starty, cornerCorrectionFactor);
drawBorderSegment(before, end, after, 1, height, startx + width, starty, cornerCorrectionFactor);
- drawBorderSegment(end, after, start, 2, width, startx + width, starty + height, cornerCorrectionFactor);
+ drawBorderSegment(end, after, start, 2, width, startx + width, starty + height,
+ cornerCorrectionFactor);
drawBorderSegment(after, start, before, 3, height, startx, starty + height, cornerCorrectionFactor);
}
@@ -637,10 +658,10 @@ public class BorderPainter {
private static final Corner SQUARE = new Corner(0, 0, null, 0, 0, 0, 0);
/** The radius of the elliptic corner in the x direction */
- protected final int radiusX;
+ private final int radiusX;
/** The radius of the elliptic corner in the y direction */
- protected final int radiusY;
+ private final int radiusY;
/** The start and end angles of the corner ellipse */
private final CornerAngles angles;
diff --git a/src/java/org/apache/fop/render/intermediate/IFRenderer.java b/src/java/org/apache/fop/render/intermediate/IFRenderer.java
index 47a53deca..3a22e83aa 100644
--- a/src/java/org/apache/fop/render/intermediate/IFRenderer.java
+++ b/src/java/org/apache/fop/render/intermediate/IFRenderer.java
@@ -39,10 +39,11 @@ import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
-import org.apache.batik.parser.AWTTransformProducer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.batik.parser.AWTTransformProducer;
+
import org.apache.xmlgraphics.xmp.Metadata;
import org.apache.xmlgraphics.xmp.schemas.DublinCoreAdapter;
import org.apache.xmlgraphics.xmp.schemas.DublinCoreSchema;
diff --git a/src/java/org/apache/fop/render/java2d/Java2DGraphicsPainter.java b/src/java/org/apache/fop/render/java2d/Java2DGraphicsPainter.java
index b485daf3d..588d417fa 100644
--- a/src/java/org/apache/fop/render/java2d/Java2DGraphicsPainter.java
+++ b/src/java/org/apache/fop/render/java2d/Java2DGraphicsPainter.java
@@ -329,5 +329,4 @@ class Java2DGraphicsPainter implements GraphicsPainter {
this.painter.restoreGraphicsState();
this.currentPath = null;
}
-
-} \ No newline at end of file
+}
diff --git a/src/java/org/apache/fop/render/pdf/PDFGraphicsPainter.java b/src/java/org/apache/fop/render/pdf/PDFGraphicsPainter.java
index ec3073e6f..ff1ffb5ff 100644
--- a/src/java/org/apache/fop/render/pdf/PDFGraphicsPainter.java
+++ b/src/java/org/apache/fop/render/pdf/PDFGraphicsPainter.java
@@ -59,6 +59,7 @@ public class PDFGraphicsPainter implements GraphicsPainter, BezierCurvePainter {
boolean startOrBefore, int style, Color col) {
float w = x2 - x1;
float h = y2 - y1;
+ float colFactor;
switch (style) {
case Constants.EN_DASHED:
generator.setColor(col);
@@ -133,8 +134,7 @@ public class PDFGraphicsPainter implements GraphicsPainter, BezierCurvePainter {
break;
case Constants.EN_GROOVE:
case Constants.EN_RIDGE:
- {
- float colFactor = (style == Constants.EN_GROOVE ? 0.4f : -0.4f);
+ colFactor = (style == Constants.EN_GROOVE ? 0.4f : -0.4f);
generator.setSolidLine();
if (horz) {
Color uppercol = ColorUtil.lightenColor(col, -colFactor);
@@ -162,11 +162,9 @@ public class PDFGraphicsPainter implements GraphicsPainter, BezierCurvePainter {
.strokeLine(xm1 + w3 + w3, y1, xm1 + w3 + w3, y2);
}
break;
- }
case Constants.EN_INSET:
case Constants.EN_OUTSET:
- {
- float colFactor = (style == Constants.EN_OUTSET ? 0.4f : -0.4f);
+ colFactor = (style == Constants.EN_OUTSET ? 0.4f : -0.4f);
generator.setSolidLine();
Color c = col;
if (horz) {
@@ -183,7 +181,6 @@ public class PDFGraphicsPainter implements GraphicsPainter, BezierCurvePainter {
.strokeLine(xm1, y1, xm1, y2);
}
break;
- }
case Constants.EN_HIDDEN:
break;
default:
@@ -382,7 +379,6 @@ public class PDFGraphicsPainter implements GraphicsPainter, BezierCurvePainter {
String xS = format(xStart);
String xE = format(xEnd);
String yS = format(yStart);
- String yE = format(yEnd);
if (style == RuleStyle.GROOVE) {
addLine("m", xS, yS)
.addLine("l", xE, yS)
diff --git a/src/java/org/apache/fop/render/ps/PSGraphicsPainter.java b/src/java/org/apache/fop/render/ps/PSGraphicsPainter.java
index e9b4b4ff5..ab766f701 100644
--- a/src/java/org/apache/fop/render/ps/PSGraphicsPainter.java
+++ b/src/java/org/apache/fop/render/ps/PSGraphicsPainter.java
@@ -31,7 +31,6 @@ import org.apache.xmlgraphics.ps.PSGenerator;
import org.apache.fop.fo.Constants;
import org.apache.fop.render.intermediate.ArcToBezierCurveTransformer;
import org.apache.fop.render.intermediate.BezierCurvePainter;
-import org.apache.fop.render.intermediate.BorderPainter;
import org.apache.fop.render.intermediate.GraphicsPainter;
import org.apache.fop.traits.RuleStyle;
import org.apache.fop.util.ColorUtil;
@@ -89,7 +88,7 @@ public class PSGraphicsPainter implements GraphicsPainter, BezierCurvePainter {
gen.useColor(col);
if (horz) {
float unit = Math.abs(2 * h);
- int rep = (int)(w / unit);
+ int rep = (int) (w / unit);
if (rep % 2 == 0) {
rep++;
}
@@ -101,7 +100,7 @@ public class PSGraphicsPainter implements GraphicsPainter, BezierCurvePainter {
drawLine(gen, x1, ym, x2, ym);
} else {
float unit = Math.abs(2 * w);
- int rep = (int)(h / unit);
+ int rep = (int) (h / unit);
if (rep % 2 == 0) {
rep++;
}
@@ -118,7 +117,7 @@ public class PSGraphicsPainter implements GraphicsPainter, BezierCurvePainter {
gen.useLineCap(1); //Rounded!
if (horz) {
float unit = Math.abs(2 * h);
- int rep = (int)(w / unit);
+ int rep = (int) (w / unit);
if (rep % 2 == 0) {
rep++;
}
@@ -129,7 +128,7 @@ public class PSGraphicsPainter implements GraphicsPainter, BezierCurvePainter {
drawLine(gen, x1, ym, x2, ym);
} else {
float unit = Math.abs(2 * w);
- int rep = (int)(h / unit);
+ int rep = (int) (h / unit);
if (rep % 2 == 0) {
rep++;
}
diff --git a/src/java/org/apache/fop/traits/BorderProps.java b/src/java/org/apache/fop/traits/BorderProps.java
index 61a7d86b6..e274517d9 100644
--- a/src/java/org/apache/fop/traits/BorderProps.java
+++ b/src/java/org/apache/fop/traits/BorderProps.java
@@ -34,7 +34,7 @@ import org.apache.fop.util.ColorUtil;
*/
public class BorderProps implements Serializable {
- private static final long serialVersionUID = 7053576586478548795L;
+ private static final long serialVersionUID = 8022237892391068187L;
public enum Mode {
SEPARATE("separate") {
@@ -155,7 +155,7 @@ public class BorderProps implements Serializable {
return true;
} else {
if (obj instanceof BorderProps) {
- BorderProps other = (BorderProps)obj;
+ BorderProps other = (BorderProps) obj;
return (style == other.style)
&& org.apache.xmlgraphics.java2d.color.ColorUtil.isSameColor(
color, other.color)
@@ -203,7 +203,7 @@ public class BorderProps implements Serializable {
return sbuf.toString();
}
- private static class BorderPropsDeserializer {
+ private static final class BorderPropsDeserializer {
private static final BorderPropsDeserializer INSTANCE = new BorderPropsDeserializer();
@@ -223,7 +223,7 @@ public class BorderProps implements Serializable {
m.find();
int width = Integer.parseInt(m.group());
Mode mode = Mode.SEPARATE;
- if ( m.find()) {
+ if (m.find()) {
String ms = m.group();
if (Mode.COLLAPSE_INNER.value.equalsIgnoreCase(ms)) {
mode = Mode.COLLAPSE_INNER;