From 2b8f2a4278987841c7b4a0d9059697936d0e7193 Mon Sep 17 00:00:00 2001 From: Luis Bernardo Date: Sat, 13 Jul 2013 22:26:09 +0000 Subject: [PATCH] FOP-2265: Enable xlint cast; patch submitted by Simon Steiner git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1502902 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/afp/AFPResourceManager.java | 27 +++++++++---------- .../apache/fop/afp/modca/MapPageOverlay.java | 4 +-- src/java/org/apache/fop/area/BodyRegion.java | 2 +- src/java/org/apache/fop/area/LineArea.java | 2 +- .../fop/events/EventExceptionManager.java | 2 +- .../apache/fop/fo/ElementMappingRegistry.java | 4 +-- .../apache/fop/fo/expr/PropertyParser.java | 2 +- .../apache/fop/fo/properties/CommonFont.java | 2 +- .../fop/fo/properties/FontFamilyProperty.java | 2 +- src/java/org/apache/fop/fonts/FontUtil.java | 2 +- .../apache/fop/fonts/truetype/TTFFile.java | 2 +- .../apache/fop/hyphenation/CharVector.java | 2 +- .../apache/fop/hyphenation/TernaryTree.java | 10 +++---- .../apache/fop/layoutmgr/AbstractBreaker.java | 2 +- .../AbstractPageSequenceLayoutManager.java | 2 +- .../fop/layoutmgr/BlockKnuthSequence.java | 2 +- .../apache/fop/layoutmgr/LocalBreaker.java | 2 +- .../org/apache/fop/layoutmgr/PageBreaker.java | 3 +-- .../table/TableCellLayoutManager.java | 2 +- .../table/TableContentLayoutManager.java | 2 +- .../org/apache/fop/pdf/PDFFilterList.java | 4 +-- .../fop/render/afp/AFPDocumentHandler.java | 2 +- .../fop/render/intermediate/IFRenderer.java | 2 +- .../java2d/Java2DGraphics2DAdapter.java | 4 +-- .../apache/fop/render/ps/ImageEncoderPNG.java | 2 +- .../fop/render/ps/PSGraphics2DAdapter.java | 6 ++--- .../render/ps/PSImageHandlerGraphics2D.java | 4 +-- .../render/rtf/rtflib/rtfdoc/RtfJforCmd.java | 2 +- .../fop/render/rtf/rtflib/rtfdoc/RtfList.java | 2 +- src/java/org/apache/fop/svg/PDFTextUtil.java | 2 +- .../fop/util/text/AdvancedMessageFormat.java | 4 +-- 31 files changed, 55 insertions(+), 57 deletions(-) diff --git a/src/java/org/apache/fop/afp/AFPResourceManager.java b/src/java/org/apache/fop/afp/AFPResourceManager.java index 99b28cafd..2eb0b5596 100644 --- a/src/java/org/apache/fop/afp/AFPResourceManager.java +++ b/src/java/org/apache/fop/afp/AFPResourceManager.java @@ -279,20 +279,20 @@ public class AFPResourceManager { */ public boolean includeCachedObject(AFPResourceInfo resourceInfo, AFPObjectAreaInfo areaInfo) { - String objectName; + String objectName; - AbstractCachedObject cachedObject = (AbstractCachedObject)includeObjectCache.get(resourceInfo); + AbstractCachedObject cachedObject = includeObjectCache.get(resourceInfo); - if (cachedObject != null) { - if (areaInfo != null) { - cachedObject.dataObjectInfo.setObjectAreaInfo(areaInfo); - } - cachedObject.includeObject(); - - return true; - } else { - return false; + if (cachedObject != null) { + if (areaInfo != null) { + cachedObject.dataObjectInfo.setObjectAreaInfo(areaInfo); } + cachedObject.includeObject(); + + return true; + } else { + return false; + } } @@ -382,8 +382,7 @@ public class AFPResourceManager { resourceInfo.setName(resourceName); resourceInfo.setUri(uri.toASCIIString()); - AbstractCachedObject cachedObject = (AbstractCachedObject) - includeObjectCache.get(resourceInfo); + AbstractCachedObject cachedObject = includeObjectCache.get(resourceInfo); if (cachedObject == null) { if (log.isDebugEnabled()) { log.debug("Adding included resource: " + resourceName); @@ -425,7 +424,7 @@ public class AFPResourceManager { resourceInfo.setName(resourceName); resourceInfo.setUri(uri.toASCIIString()); - AbstractCachedObject cachedObject = (AbstractCachedObject) includeObjectCache.get(resourceInfo); + AbstractCachedObject cachedObject = includeObjectCache.get(resourceInfo); if (cachedObject == null) { ResourceGroup resourceGroup = streamer.getResourceGroup(resourceLevel); diff --git a/src/java/org/apache/fop/afp/modca/MapPageOverlay.java b/src/java/org/apache/fop/afp/modca/MapPageOverlay.java index 508a3299b..8b689de71 100644 --- a/src/java/org/apache/fop/afp/modca/MapPageOverlay.java +++ b/src/java/org/apache/fop/afp/modca/MapPageOverlay.java @@ -99,8 +99,8 @@ public class MapPageOverlay extends AbstractAFPObject { // Structured field ID for a MPO data[3] = (byte) 0xD3; - data[4] = (byte) Type.MAP; - data[5] = (byte) Category.PAGE_OVERLAY; + data[4] = Type.MAP; + data[5] = Category.PAGE_OVERLAY; data[6] = 0x00; // Reserved data[7] = 0x00; // Reserved diff --git a/src/java/org/apache/fop/area/BodyRegion.java b/src/java/org/apache/fop/area/BodyRegion.java index b71f689a1..89bb206f2 100644 --- a/src/java/org/apache/fop/area/BodyRegion.java +++ b/src/java/org/apache/fop/area/BodyRegion.java @@ -135,7 +135,7 @@ public class BodyRegion extends RegionReference { List spans = getMainReference().getSpans(); int previousSpanCount = spans.size() - 1; for (int i = 0; i < previousSpanCount; i++) { - usedBPD += ((Span)spans.get(i)).getHeight(); + usedBPD += spans.get(i).getHeight(); } return getBPD() - usedBPD; } diff --git a/src/java/org/apache/fop/area/LineArea.java b/src/java/org/apache/fop/area/LineArea.java index 169c3728f..b7a580cb0 100644 --- a/src/java/org/apache/fop/area/LineArea.java +++ b/src/java/org/apache/fop/area/LineArea.java @@ -258,7 +258,7 @@ public class LineArea extends Area { boolean bUnresolvedAreasPresent = false; // recursively apply variation factor to descendant areas for (int i = 0, len = inlineAreas.size(); i < len; i++) { - bUnresolvedAreasPresent |= ((InlineArea) inlineAreas.get(i)) + bUnresolvedAreasPresent |= inlineAreas.get(i) .applyVariationFactor(adjustingInfo.variationFactor, adjustingInfo.availableStretch, adjustingInfo.availableShrink); diff --git a/src/java/org/apache/fop/events/EventExceptionManager.java b/src/java/org/apache/fop/events/EventExceptionManager.java index 3494dc560..e9208fbc6 100644 --- a/src/java/org/apache/fop/events/EventExceptionManager.java +++ b/src/java/org/apache/fop/events/EventExceptionManager.java @@ -53,7 +53,7 @@ public final class EventExceptionManager { */ public static void throwException(Event event, String exceptionClass) throws Throwable { if (exceptionClass != null) { - ExceptionFactory factory = (ExceptionFactory)EXCEPTION_FACTORIES.get(exceptionClass); + ExceptionFactory factory = EXCEPTION_FACTORIES.get(exceptionClass); if (factory != null) { throw factory.createException(event); } else { diff --git a/src/java/org/apache/fop/fo/ElementMappingRegistry.java b/src/java/org/apache/fop/fo/ElementMappingRegistry.java index b6baeca2b..08e960b1d 100644 --- a/src/java/org/apache/fop/fo/ElementMappingRegistry.java +++ b/src/java/org/apache/fop/fo/ElementMappingRegistry.java @@ -160,7 +160,7 @@ public class ElementMappingRegistry { * @return the handling DOMImplementation, or null if not applicable */ public DOMImplementation getDOMImplementationForNamespace(String namespaceURI) { - ElementMapping mapping = (ElementMapping)this.namespaces.get(namespaceURI); + ElementMapping mapping = this.namespaces.get(namespaceURI); if (mapping == null) { return null; } else { @@ -175,7 +175,7 @@ public class ElementMappingRegistry { * available. */ public ElementMapping getElementMapping(String namespaceURI) { - return (ElementMapping)this.namespaces.get(namespaceURI); + return this.namespaces.get(namespaceURI); } /** diff --git a/src/java/org/apache/fop/fo/expr/PropertyParser.java b/src/java/org/apache/fop/fo/expr/PropertyParser.java index 574fc0e12..cac115d6e 100644 --- a/src/java/org/apache/fop/fo/expr/PropertyParser.java +++ b/src/java/org/apache/fop/fo/expr/PropertyParser.java @@ -393,7 +393,7 @@ public final class PropertyParser extends PropertyTokenizer { } } } - return (Property[]) args.toArray(new Property [ args.size() ]); + return args.toArray(new Property [ args.size() ]); } /** diff --git a/src/java/org/apache/fop/fo/properties/CommonFont.java b/src/java/org/apache/fop/fo/properties/CommonFont.java index 63f037724..a22fc4d04 100644 --- a/src/java/org/apache/fop/fo/properties/CommonFont.java +++ b/src/java/org/apache/fop/fo/properties/CommonFont.java @@ -144,7 +144,7 @@ public final class CommonFont { /** @return the first font-family name in the list */ public String getFirstFontFamily() { - return ((Property) fontFamily.list.get(0)).getString(); + return fontFamily.list.get(0).getString(); } /** @return the "font-selection-strategy" property */ diff --git a/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java b/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java index b59c22de6..2c22fc17e 100644 --- a/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java +++ b/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java @@ -140,7 +140,7 @@ public final class FontFamilyProperty extends ListProperty { /** {@inheritDoc} */ public String getString() { if (list.size() > 0) { - Property first = (Property)list.get(0); + Property first = list.get(0); return first.getString(); } else { return super.getString(); diff --git a/src/java/org/apache/fop/fonts/FontUtil.java b/src/java/org/apache/fop/fonts/FontUtil.java index b97e3a407..1966d9fca 100644 --- a/src/java/org/apache/fop/fonts/FontUtil.java +++ b/src/java/org/apache/fop/fonts/FontUtil.java @@ -40,7 +40,7 @@ public final class FontUtil { int weight = 400; try { weight = Integer.parseInt(text); - weight = ((int)weight / 100) * 100; + weight = (weight / 100) * 100; weight = Math.max(weight, 100); weight = Math.min(weight, 900); } catch (NumberFormatException nfe) { diff --git a/src/java/org/apache/fop/fonts/truetype/TTFFile.java b/src/java/org/apache/fop/fonts/truetype/TTFFile.java index 3c234e0a3..2e78ef7f0 100644 --- a/src/java/org/apache/fop/fonts/truetype/TTFFile.java +++ b/src/java/org/apache/fop/fonts/truetype/TTFFile.java @@ -990,7 +990,7 @@ public class TTFFile { int[] bboxInTTFUnits = mtxTab[glyphIndex].getBoundingBox(); int[] bbox = new int[4]; for (int i = 0; i < 4; i++) { - bbox[i] = (int) convertTTFUnit2PDFUnit(bboxInTTFUnits[i]); + bbox[i] = convertTTFUnit2PDFUnit(bboxInTTFUnits[i]); } return bbox; } diff --git a/src/java/org/apache/fop/hyphenation/CharVector.java b/src/java/org/apache/fop/hyphenation/CharVector.java index de95a7699..de1dea533 100644 --- a/src/java/org/apache/fop/hyphenation/CharVector.java +++ b/src/java/org/apache/fop/hyphenation/CharVector.java @@ -103,7 +103,7 @@ public class CharVector implements Cloneable, Serializable { /** {@inheritDoc} */ public Object clone() throws CloneNotSupportedException { CharVector cv = (CharVector) super.clone(); - cv.array = (char[])array.clone(); + cv.array = array.clone(); return cv; } diff --git a/src/java/org/apache/fop/hyphenation/TernaryTree.java b/src/java/org/apache/fop/hyphenation/TernaryTree.java index 92f7a8449..e9798fa9c 100644 --- a/src/java/org/apache/fop/hyphenation/TernaryTree.java +++ b/src/java/org/apache/fop/hyphenation/TernaryTree.java @@ -284,7 +284,7 @@ public class TernaryTree implements Cloneable, Serializable { } } if (a[start + i] != 0) { - return (int)-a[start + i]; + return -a[start + i]; } return 0; @@ -408,10 +408,10 @@ public class TernaryTree implements Cloneable, Serializable { /** {@inheritDoc} */ public Object clone() throws CloneNotSupportedException { TernaryTree t = (TernaryTree) super.clone(); - t.lo = (char[])this.lo.clone(); - t.hi = (char[])this.hi.clone(); - t.eq = (char[])this.eq.clone(); - t.sc = (char[])this.sc.clone(); + t.lo = this.lo.clone(); + t.hi = this.hi.clone(); + t.eq = this.eq.clone(); + t.sc = this.sc.clone(); t.kv = (CharVector)this.kv.clone(); return t; diff --git a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java index 9ba4a0b14..51e80e8d4 100644 --- a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java +++ b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java @@ -861,7 +861,7 @@ public abstract class AbstractBreaker { } int averageLineLength = 0; if (accumulatedLineLength > 0 && boxCount > 0) { - averageLineLength = (int) (accumulatedLineLength / boxCount); + averageLineLength = accumulatedLineLength / boxCount; log.debug("Average line length = " + averageLineLength); if (averageLineLength < greatestMinimumLength) { averageLineLength = greatestMinimumLength; diff --git a/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java index edfb389ed..53de9e1ed 100644 --- a/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java @@ -244,7 +244,7 @@ public abstract class AbstractPageSequenceLayoutManager extends AbstractLayoutMa PageViewport pv = areaTreeModel.getPage(seq, page); int originalPosition = rm.getPosition(); rm.changePositionTo(Constants.EN_LEWP); - mark = (Marker) pv.resolveMarker(rm); + mark = pv.resolveMarker(rm); // this is probably not necessary since the RM will not be used again, but to be safe... rm.changePositionTo(originalPosition); if (mark != null) { diff --git a/src/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java b/src/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java index 0be0c9437..68d64199a 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java +++ b/src/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java @@ -71,7 +71,7 @@ public class BlockKnuthSequence extends KnuthSequence { if (keepTogether) { breakElement.setPenaltyValue(KnuthElement.INFINITE); add(breakElement); - } else if (!((ListElement) getLast()).isGlue()) { + } else if (!getLast().isGlue()) { breakElement.setPenaltyValue(0); add(breakElement); } diff --git a/src/java/org/apache/fop/layoutmgr/LocalBreaker.java b/src/java/org/apache/fop/layoutmgr/LocalBreaker.java index bb08446cc..bcb86e501 100644 --- a/src/java/org/apache/fop/layoutmgr/LocalBreaker.java +++ b/src/java/org/apache/fop/layoutmgr/LocalBreaker.java @@ -115,7 +115,7 @@ public abstract class LocalBreaker extends AbstractBreaker { protected void doPhase3(PageBreakingAlgorithm alg, int partCount, BlockSequence originalList, BlockSequence effectiveList) { if (partCount > 1) { - PageBreakPosition pos = (PageBreakPosition) alg.getPageBreaks().getFirst(); + PageBreakPosition pos = alg.getPageBreaks().getFirst(); int firstPartLength = ElementListUtils.calcContentLength(effectiveList, effectiveList.ignoreAtStart, pos.getLeafPos()); overflow += alg.totalWidth - firstPartLength; diff --git a/src/java/org/apache/fop/layoutmgr/PageBreaker.java b/src/java/org/apache/fop/layoutmgr/PageBreaker.java index 6a10fa22f..d9ca096c3 100644 --- a/src/java/org/apache/fop/layoutmgr/PageBreaker.java +++ b/src/java/org/apache/fop/layoutmgr/PageBreaker.java @@ -328,8 +328,7 @@ public class PageBreaker extends AbstractBreaker { //restarting point addAreas(alg, restartPoint, originalList, effectiveList); //Get page break from which we restart - PageBreakPosition pbp = (PageBreakPosition) - alg.getPageBreaks().get(restartPoint - 1); + PageBreakPosition pbp = alg.getPageBreaks().get(restartPoint - 1); newStartPos = alg.par.getFirstBoxIndex(pbp.getLeafPos() + 1); //Handle page break right here to avoid any side-effects if (newStartPos > 0) { diff --git a/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java index 878a1285a..c8f2cea85 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java @@ -289,7 +289,7 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager } int n = childrenLMs.size(); for (int j = 0; j < n; j++) { - LayoutManager lm = (LayoutManager) childrenLMs.get(j); + LayoutManager lm = childrenLMs.get(j); if (lm == null) { return; } else if (lm instanceof RetrieveTableMarkerLayoutManager) { diff --git a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java index d423b339d..4f17c2d0c 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java @@ -350,7 +350,7 @@ public class TableContentLayoutManager implements PercentBaseContext { Position lastPos = null; Position lastCheckPos = null; while (parentIter.hasNext()) { - Position pos = (Position)parentIter.next(); + Position pos = parentIter.next(); if (pos instanceof SpaceHandlingBreakPosition) { //This position has only been needed before addAreas was called, now we need the //original one created by the layout manager. diff --git a/src/java/org/apache/fop/pdf/PDFFilterList.java b/src/java/org/apache/fop/pdf/PDFFilterList.java index 3f26f454c..bfb940c51 100644 --- a/src/java/org/apache/fop/pdf/PDFFilterList.java +++ b/src/java/org/apache/fop/pdf/PDFFilterList.java @@ -250,7 +250,7 @@ public class PDFFilterList { // run the filters int nonNullParams = 0; for (int count = 0; count < filters.size(); count++) { - PDFFilter filter = (PDFFilter)filters.get(count); + PDFFilter filter = filters.get(count); // place the names in our local vector in reverse order if (filter.getName().length() > 0) { names.add(0, filter.getName()); @@ -365,7 +365,7 @@ public class PDFFilterList { OutputStream out = stream; if (!isDisableAllFilters()) { for (int count = filters.size() - 1; count >= 0; count--) { - PDFFilter filter = (PDFFilter)filters.get(count); + PDFFilter filter = filters.get(count); out = filter.applyFilter(out); } } diff --git a/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java b/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java index cd8304b4b..8962da304 100644 --- a/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java +++ b/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java @@ -446,7 +446,7 @@ public class AFPDocumentHandler extends AbstractBinaryWritingIFDocumentHandler * @return document id of the corner image */ public String getCachedRoundedCorner(String cornerKey) { - return (String)roundedCornerNameCache.get(cornerKey); + return roundedCornerNameCache.get(cornerKey); } diff --git a/src/java/org/apache/fop/render/intermediate/IFRenderer.java b/src/java/org/apache/fop/render/intermediate/IFRenderer.java index f0d25a84d..9e6aae700 100644 --- a/src/java/org/apache/fop/render/intermediate/IFRenderer.java +++ b/src/java/org/apache/fop/render/intermediate/IFRenderer.java @@ -992,7 +992,7 @@ public class IFRenderer extends AbstractPathOrientedRenderer { } private Typeface getTypeface(String fontName) { - Typeface tf = (Typeface) fontInfo.getFonts().get(fontName); + Typeface tf = fontInfo.getFonts().get(fontName); if (tf instanceof LazyFont) { tf = ((LazyFont)tf).getRealFont(); } diff --git a/src/java/org/apache/fop/render/java2d/Java2DGraphics2DAdapter.java b/src/java/org/apache/fop/render/java2d/Java2DGraphics2DAdapter.java index 8fe93d051..f136a046f 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DGraphics2DAdapter.java +++ b/src/java/org/apache/fop/render/java2d/Java2DGraphics2DAdapter.java @@ -51,8 +51,8 @@ public class Java2DGraphics2DAdapter extends AbstractGraphics2DAdapter { float imw = (float)dim.getWidth() / 1000f; float imh = (float)dim.getHeight() / 1000f; - float sx = fwidth / (float)imw; - float sy = fheight / (float)imh; + float sx = fwidth / imw; + float sy = fheight / imh; Java2DRenderer renderer = (Java2DRenderer)context.getRenderer(); Java2DGraphicsState state = renderer.state; diff --git a/src/java/org/apache/fop/render/ps/ImageEncoderPNG.java b/src/java/org/apache/fop/render/ps/ImageEncoderPNG.java index bcda90bda..5746a3fbe 100644 --- a/src/java/org/apache/fop/render/ps/ImageEncoderPNG.java +++ b/src/java/org/apache/fop/render/ps/ImageEncoderPNG.java @@ -51,7 +51,7 @@ public class ImageEncoderPNG implements ImageEncoder { */ public ImageEncoderPNG(ImageRawPNG image) { this.image = image; - ColorModel cm = ((ImageRawPNG) this.image).getColorModel(); + ColorModel cm = this.image.getColorModel(); if (cm instanceof IndexColorModel) { numberOfInterleavedComponents = 1; } else { diff --git a/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java b/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java index d55e0960a..7bbe9bd8b 100644 --- a/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java +++ b/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java @@ -76,8 +76,8 @@ public class PSGraphics2DAdapter extends AbstractGraphics2DAdapter { && ImageHandlerUtil.isConversionModeBitmap(foreign)); } - float sx = paintAsBitmap ? 1.0f : (fwidth / (float)imw); - float sy = paintAsBitmap ? 1.0f : (fheight / (float)imh); + float sx = paintAsBitmap ? 1.0f : (fwidth / imw); + float sy = paintAsBitmap ? 1.0f : (fheight / imh); gen.commentln("%FOPBeginGraphics2D"); gen.saveGraphicsState(); @@ -102,7 +102,7 @@ public class PSGraphics2DAdapter extends AbstractGraphics2DAdapter { gen.getCurrentState().concatMatrix(transform); if (paintAsBitmap) { //Fallback solution: Paint to a BufferedImage - int resolution = (int)Math.round(context.getUserAgent().getTargetResolution()); + int resolution = Math.round(context.getUserAgent().getTargetResolution()); RendererContextWrapper ctx = RendererContext.wrapRendererContext(context); BufferedImage bi = paintToBufferedImage(painter, ctx, resolution, false, false); diff --git a/src/java/org/apache/fop/render/ps/PSImageHandlerGraphics2D.java b/src/java/org/apache/fop/render/ps/PSImageHandlerGraphics2D.java index 3293840e5..ed0b4e24a 100644 --- a/src/java/org/apache/fop/render/ps/PSImageHandlerGraphics2D.java +++ b/src/java/org/apache/fop/render/ps/PSImageHandlerGraphics2D.java @@ -65,8 +65,8 @@ public class PSImageHandlerGraphics2D implements PSImageHandler { float imw = (float)dim.getWidth() / 1000f; float imh = (float)dim.getHeight() / 1000f; - float sx = fwidth / (float)imw; - float sy = fheight / (float)imh; + float sx = fwidth / imw; + float sy = fheight / imh; gen.commentln("%FOPBeginGraphics2D"); gen.saveGraphicsState(); diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfJforCmd.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfJforCmd.java index c52ccb959..dd007f774 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfJforCmd.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfJforCmd.java @@ -43,7 +43,7 @@ public class RtfJforCmd extends RtfContainer { RtfJforCmd(RtfContainer parent, Writer w, RtfAttributes attrs) throws IOException { - super((RtfContainer)parent, w); + super(parent, w); attrib = attrs; } diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java index 19e3e7188..b7d01db00 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java @@ -48,7 +48,7 @@ public class RtfList extends RtfContainer { /** Create an RTF list as a child of given container with given attributes */ RtfList(RtfContainer parent, Writer w, RtfAttributes attr) throws IOException { - super((RtfContainer)parent, w, attr); + super(parent, w, attr); //random number generator for ids listId = new Integer(listIdGenerator.nextInt()); diff --git a/src/java/org/apache/fop/svg/PDFTextUtil.java b/src/java/org/apache/fop/svg/PDFTextUtil.java index 32aed4a39..8325dce1f 100644 --- a/src/java/org/apache/fop/svg/PDFTextUtil.java +++ b/src/java/org/apache/fop/svg/PDFTextUtil.java @@ -104,7 +104,7 @@ public abstract class PDFTextUtil extends org.apache.fop.pdf.PDFTextUtil { * @return true if it's a multi-byte font */ protected boolean isMultiByteFont(String name) { - Typeface f = (Typeface)fontInfo.getFonts().get(name); + Typeface f = fontInfo.getFonts().get(name); return f.isMultiByte(); } diff --git a/src/java/org/apache/fop/util/text/AdvancedMessageFormat.java b/src/java/org/apache/fop/util/text/AdvancedMessageFormat.java index 41b70046c..b34d87b27 100644 --- a/src/java/org/apache/fop/util/text/AdvancedMessageFormat.java +++ b/src/java/org/apache/fop/util/text/AdvancedMessageFormat.java @@ -170,7 +170,7 @@ public class AdvancedMessageFormat { } } else { String format = parts[1]; - PartFactory factory = (PartFactory)PART_FACTORIES.get(format); + PartFactory factory = PART_FACTORIES.get(format); if (factory == null) { throw new IllegalArgumentException( "No PartFactory available under the name: " + format); @@ -184,7 +184,7 @@ public class AdvancedMessageFormat { } private static Function getFunction(String functionName) { - return (Function)FUNCTIONS.get(functionName); + return FUNCTIONS.get(functionName); } /** -- 2.39.5