git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1681435 13f79535-47bb-0310-9956-ffa450edef68tags/fop-2_1
@@ -47,6 +47,42 @@ | |||
--> | |||
<!-- START - APPROVED EXCLUSIONS --> | |||
<Match> | |||
<Bug pattern="BC_BAD_CAST_TO_CONCRETE_COLLECTION"/> | |||
<!-- TODO - Not sure what to do with those two... Seems messy/hacky --> | |||
<And> | |||
<Class name="org.apache.fop.area.AreaTreeObject"/> | |||
<Method name="clone"/> | |||
</And> | |||
</Match> | |||
<Match> | |||
<Bug pattern="BC_UNCONFIRMED_CAST_OF_RETURN_VALUE"/> | |||
<!-- TODO - See if these can be solved in a better way --> | |||
<Or> | |||
<And> | |||
<Class name="org.apache.fop.layoutmgr.PageBreakingAlgorithm"/> | |||
<Or> | |||
<Method name="createFootnotePages"/> | |||
<Method name="finish"/> | |||
</Or> | |||
</And> | |||
<And> | |||
<Class name="org.apache.fop.render.rtf.RTFHandler"/> | |||
<Or> | |||
<Method name="endCell"/> | |||
<Method name="endFootnoteBody"/> | |||
<Method name="endPart"/> | |||
<Method name="endRow"/> | |||
<Method name="startCell"/> | |||
<Method name="startFootnoteBody"/> | |||
<Method name="startListItem"/> | |||
<Method name="startListLabel"/> | |||
<Method name="startPart"/> | |||
<Method name="startRow"/> | |||
</Or> | |||
</And> | |||
</Or> | |||
</Match> | |||
<Match> | |||
<Bug pattern="CN_IDIOM_NO_SUPER_CALL"/> | |||
<Or> |
@@ -133,7 +133,6 @@ public class GraphicsSetProcessColor extends AbstractGraphicsDrawingOrder { | |||
dout.writeByte(a); | |||
dout.writeByte(b); | |||
} else { | |||
IOUtils.closeQuietly(dout); | |||
IOUtils.closeQuietly(baout); | |||
throw new IllegalStateException(); | |||
} |
@@ -41,13 +41,18 @@ public abstract class AreaTreeObject implements Cloneable { | |||
protected List<ExtensionAttachment> extensionAttachments; | |||
/** {@inheritDoc} */ | |||
@SuppressWarnings("unchecked") | |||
public Object clone() throws CloneNotSupportedException { | |||
AreaTreeObject ato = (AreaTreeObject) super.clone(); | |||
if (foreignAttributes != null) { | |||
ato.foreignAttributes = (Map) ((HashMap) foreignAttributes).clone(); | |||
// @SuppressFBWarnings("BC_BAD_CAST_TO_CONCRETE_COLLECTION") | |||
ato.foreignAttributes = (Map<QName, String>) | |||
((HashMap<QName, String>)foreignAttributes).clone(); | |||
} | |||
if (extensionAttachments != null) { | |||
ato.extensionAttachments = (List) ((ArrayList) extensionAttachments).clone(); | |||
// @SuppressFBWarnings("BC_BAD_CAST_TO_CONCRETE_COLLECTION") | |||
ato.extensionAttachments = (List<ExtensionAttachment>) | |||
((ArrayList<ExtensionAttachment>) extensionAttachments).clone(); | |||
} | |||
return ato; | |||
} |
@@ -941,6 +941,7 @@ class PageBreakingAlgorithm extends BreakingAlgorithm { | |||
@Override | |||
protected void finish() { | |||
for (int i = startLine; i < endLine; i++) { | |||
// @SuppressFBWarnings("BC_UNCONFIRMED_CAST_OF_RETURN_VALUE") | |||
for (KnuthPageNode node = (KnuthPageNode) getNode(i); | |||
node != null; | |||
node = (KnuthPageNode) node.next) { | |||
@@ -978,6 +979,7 @@ class PageBreakingAlgorithm extends BreakingAlgorithm { | |||
// footnoteElementIndex has already been set in getFootnoteSplit() | |||
} else { | |||
// cannot add any content: create a new node and start again | |||
// @SuppressFBWarnings("BC_UNCONFIRMED_CAST_OF_RETURN_VALUE") | |||
KnuthPageNode node = (KnuthPageNode) | |||
createNode(lastNode.position, prevNode.line + 1, 1, | |||
insertedFootnotesLength - prevNode.insertedFootnotes, | |||
@@ -992,6 +994,7 @@ class PageBreakingAlgorithm extends BreakingAlgorithm { | |||
} | |||
} | |||
// create the last node | |||
// @SuppressFBWarnings("BC_UNCONFIRMED_CAST_OF_RETURN_VALUE") | |||
KnuthPageNode node = (KnuthPageNode) | |||
createNode(lastNode.position, prevNode.line + 1, 1, | |||
totalFootnotesLength - prevNode.insertedFootnotes, 0, 0, |
@@ -26,6 +26,7 @@ import java.util.List; | |||
import org.apache.commons.logging.Log; | |||
import org.apache.commons.logging.LogFactory; | |||
import org.apache.fop.area.Area; | |||
import org.apache.fop.area.AreaTreeHandler; | |||
import org.apache.fop.area.AreaTreeModel; | |||
import org.apache.fop.area.LineArea; | |||
@@ -112,7 +113,9 @@ public class PageSequenceLayoutManager extends AbstractPageSequenceLayoutManager | |||
try { | |||
ContentLayoutManager clm = getLayoutManagerMaker() | |||
.makeContentLayoutManager(this, getPageSequence().getTitleFO()); | |||
title = (LineArea) clm.getParentArea(null); | |||
Area parentArea = clm.getParentArea(null); | |||
assert (parentArea instanceof LineArea); | |||
title = (LineArea) parentArea; | |||
} catch (IllegalStateException e) { | |||
// empty title; do nothing | |||
} |
@@ -108,7 +108,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager | |||
* Each value holds the start and end indexes into a List of | |||
* inline break positions. | |||
*/ | |||
private static class LineBreakPosition extends LeafPosition { | |||
static class LineBreakPosition extends LeafPosition { | |||
private final int parIndex; // index of the Paragraph this Position refers to | |||
private final int startIndex; //index of the first element this Position refers to | |||
private final int availableShrink; | |||
@@ -986,7 +986,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager | |||
keep.getContext(), | |||
context)); | |||
} | |||
endIndex = ((LineBreakPosition) llPoss.getChosenPosition(i)).getLeafPos(); | |||
endIndex = llPoss.getChosenPosition(i).getLeafPos(); | |||
// create a list of the FootnoteBodyLM handling footnotes | |||
// whose citations are in this line | |||
List<FootnoteBodyLayoutManager> footnoteList = FootenoteUtil.getFootnotes( | |||
@@ -994,7 +994,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager | |||
List<FloatContentLayoutManager> floats = FloatContentLayoutManager.checkForFloats(seq, | |||
startIndex, endIndex); | |||
startIndex = endIndex + 1; | |||
LineBreakPosition lbp = (LineBreakPosition) llPoss.getChosenPosition(i); | |||
LineBreakPosition lbp = llPoss.getChosenPosition(i); | |||
if (baselineOffset < 0) { | |||
baselineOffset = lbp.spaceBefore + lbp.baseline; | |||
} | |||
@@ -1186,7 +1186,9 @@ public class LineLayoutManager extends InlineStackingLayoutManager | |||
/** {@inheritDoc} */ | |||
public int negotiateBPDAdjustment(int adj, KnuthElement lastElement) { | |||
LeafPosition pos = (LeafPosition)lastElement.getPosition(); | |||
Position lastPos = lastElement.getPosition(); | |||
assert (lastPos instanceof LeafPosition); | |||
LeafPosition pos = (LeafPosition) lastPos; | |||
//if (lastElement.isPenalty()) { | |||
// totalAdj += lastElement.getWidth(); | |||
//} | |||
@@ -1230,7 +1232,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager | |||
// null penalty allowing a page break between lines | |||
returnList.add(new KnuthPenalty(0, 0, false, new Position(this), false)); | |||
} | |||
LineBreakPosition lbp = (LineBreakPosition) llPoss.getChosenPosition(i); | |||
LineBreakPosition lbp = llPoss.getChosenPosition(i); | |||
//log.debug("LLM.getChangedKnuthElements> lineWidth= " | |||
// + lbp.lineWidth + " difference= " + lbp.difference); | |||
//log.debug(" shrink= " |
@@ -24,8 +24,6 @@ import java.util.List; | |||
import org.apache.commons.logging.Log; | |||
import org.apache.commons.logging.LogFactory; | |||
import org.apache.fop.layoutmgr.Position; | |||
/** | |||
* Line layout possibilities. | |||
*/ | |||
@@ -37,12 +35,12 @@ public class LineLayoutPossibilities { | |||
private final class Possibility { | |||
private int lineCount; | |||
private double demerits; | |||
private List breakPositions; | |||
private List<LineLayoutManager.LineBreakPosition> breakPositions; | |||
private Possibility(int lc, double dem) { | |||
lineCount = lc; | |||
demerits = dem; | |||
breakPositions = new java.util.ArrayList(lc); | |||
breakPositions = new java.util.ArrayList<LineLayoutManager.LineBreakPosition>(lc); | |||
} | |||
private int getLineCount() { | |||
@@ -53,15 +51,15 @@ public class LineLayoutPossibilities { | |||
return demerits; | |||
} | |||
private void addBreakPosition(Position pos) { | |||
private void addBreakPosition(LineLayoutManager.LineBreakPosition pos) { | |||
// Positions are always added with index 0 because | |||
// they are created backward, from the last one to | |||
// the first one | |||
breakPositions.add(0, pos); | |||
} | |||
private Position getBreakPosition(int i) { | |||
return (Position)breakPositions.get(i); | |||
private LineLayoutManager.LineBreakPosition getBreakPosition(int i) { | |||
return breakPositions.get(i); | |||
} | |||
} | |||
@@ -181,7 +179,7 @@ public class LineLayoutPossibilities { | |||
* @param pos a position | |||
* @param i an index into posibilities list | |||
*/ | |||
public void addBreakPosition(Position pos, int i) { | |||
public void addBreakPosition(LineLayoutManager.LineBreakPosition pos, int i) { | |||
((Possibility)possibilitiesList.get(i)).addBreakPosition(pos); | |||
} | |||
@@ -245,7 +243,7 @@ public class LineLayoutPossibilities { | |||
* @param i the break position index | |||
* @return the chosen position | |||
*/ | |||
public Position getChosenPosition(int i) { | |||
public LineLayoutManager.LineBreakPosition getChosenPosition(int i) { | |||
return ((Possibility)possibilitiesList.get(chosenIndex)).getBreakPosition(i); | |||
} | |||
@@ -209,7 +209,9 @@ public class TextLayoutManager extends LeafNodeLayoutManager { | |||
*/ | |||
GlyphMapping lastMapping = null; | |||
while (posIter.hasNext()) { | |||
final LeafPosition tbpNext = (LeafPosition) posIter.next(); | |||
Position nextPos = posIter.next(); | |||
assert (nextPos instanceof LeafPosition); | |||
final LeafPosition tbpNext = (LeafPosition) nextPos; | |||
if (tbpNext == null) { | |||
continue; //Ignore elements without Positions | |||
} | |||
@@ -961,7 +963,9 @@ public class TextLayoutManager extends LeafNodeLayoutManager { | |||
ListIterator oldListIterator = oldList.listIterator(); | |||
KnuthElement knuthElement = (KnuthElement) oldListIterator.next(); | |||
Position pos = knuthElement.getPosition(); | |||
LeafPosition leafPos = (LeafPosition) pos.getPosition(depth); | |||
Position innerPosition = pos.getPosition(depth); | |||
assert (innerPosition instanceof LeafPosition); | |||
LeafPosition leafPos = (LeafPosition) innerPosition; | |||
int index = leafPos.getLeafPos(); | |||
//element could refer to '-1' position, for non-collapsed spaces (?) | |||
if (index > -1) { | |||
@@ -1082,14 +1086,18 @@ public class TextLayoutManager extends LeafNodeLayoutManager { | |||
ListIterator oldListIter; | |||
for (oldListIter = oldList.listIterator(); oldListIter.hasNext();) { | |||
Position pos = ((KnuthElement) oldListIter.next()).getPosition(); | |||
startPos = (LeafPosition) pos.getPosition(depth); | |||
Position innerPosition = pos.getPosition(depth); | |||
assert (innerPosition == null || innerPosition instanceof LeafPosition); | |||
startPos = (LeafPosition) innerPosition; | |||
if (startPos != null && startPos.getLeafPos() != -1) { | |||
break; | |||
} | |||
} | |||
for (oldListIter = oldList.listIterator(oldList.size()); oldListIter.hasPrevious();) { | |||
Position pos = ((KnuthElement) oldListIter.previous()).getPosition(); | |||
endPos = (LeafPosition) pos.getPosition(depth); | |||
Position innerPosition = pos.getPosition(depth); | |||
assert (innerPosition instanceof LeafPosition); | |||
endPos = (LeafPosition) innerPosition; | |||
if (endPos != null && endPos.getLeafPos() != -1) { | |||
break; | |||
} |
@@ -269,6 +269,7 @@ class RowPainter { | |||
} else { | |||
borderAfterWhich = ConditionalBorder.REST; | |||
} | |||
assert (currentGU instanceof EmptyGridUnit); | |||
addAreaForEmptyGridUnit((EmptyGridUnit)currentGU, | |||
currentRow.getIndex(), i, | |||
actualRowHeight, |
@@ -158,6 +158,7 @@ public class TableStepper { | |||
for (int i = 0; i < columnCount; i++) { | |||
GridUnit gu = row.getGridUnit(i); | |||
if (!gu.isEmpty() && gu.isPrimary()) { | |||
assert (gu instanceof PrimaryGridUnit); | |||
activeCellList.add(new ActiveCell((PrimaryGridUnit) gu, row, rowIndex, | |||
previousRowsLength, getTableLM())); | |||
} |
@@ -301,6 +301,7 @@ public abstract class AbstractRenderer | |||
startVParea(regionReference.getCTM(), port.getClipRectangle()); | |||
// do after starting viewport area | |||
if (regionReference.getRegionClass() == FO_REGION_BODY) { | |||
assert (regionReference instanceof BodyRegion); | |||
renderBodyRegion((BodyRegion) regionReference); | |||
} else { | |||
renderRegion(regionReference); |
@@ -31,6 +31,7 @@ import org.apache.fop.afp.AFPPaintingState; | |||
import org.apache.fop.afp.AFPResourceInfo; | |||
import org.apache.fop.afp.AFPUnitConverter; | |||
import org.apache.fop.render.ImageHandlerBase; | |||
import org.apache.fop.render.RendererContext; | |||
/** | |||
* A base abstract AFP image handler | |||
@@ -71,8 +72,9 @@ public abstract class AFPImageHandler implements ImageHandlerBase { | |||
(int)Math.round(position.getWidth()), | |||
(int)Math.round(position.getHeight())); | |||
AFPRendererContext rendererContext | |||
= (AFPRendererContext)rendererImageInfo.getRendererContext(); | |||
RendererContext context = rendererImageInfo.getRendererContext(); | |||
assert (context instanceof AFPRendererContext); | |||
AFPRendererContext rendererContext = (AFPRendererContext) context; | |||
AFPInfo afpInfo = rendererContext.getInfo(); | |||
AFPPaintingState paintingState = afpInfo.getPaintingState(); | |||
@@ -82,7 +82,9 @@ public class AFPImageHandlerGraphics2D extends AFPImageHandler implements ImageH | |||
throws IOException { | |||
AFPRenderingContext afpContext = (AFPRenderingContext)context; | |||
AFPGraphicsObjectInfo graphicsObjectInfo = (AFPGraphicsObjectInfo)createDataObjectInfo(); | |||
AFPDataObjectInfo info = createDataObjectInfo(); | |||
assert (info instanceof AFPGraphicsObjectInfo); | |||
AFPGraphicsObjectInfo graphicsObjectInfo = (AFPGraphicsObjectInfo) info; | |||
// set resource information | |||
@@ -90,7 +90,9 @@ public class AFPImageHandlerRawJPEG extends AFPImageHandler implements ImageHand | |||
throws IOException { | |||
AFPRenderingContext afpContext = (AFPRenderingContext)context; | |||
AFPImageObjectInfo imageObjectInfo = (AFPImageObjectInfo)createDataObjectInfo(); | |||
AFPDataObjectInfo info = createDataObjectInfo(); | |||
assert (info instanceof AFPImageObjectInfo); | |||
AFPImageObjectInfo imageObjectInfo = (AFPImageObjectInfo) info; | |||
AFPPaintingState paintingState = afpContext.getPaintingState(); | |||
// set resource information |
@@ -107,7 +107,9 @@ public class AFPImageHandlerRenderedImage extends AFPImageHandler implements Ima | |||
throws IOException { | |||
AFPRenderingContext afpContext = (AFPRenderingContext)context; | |||
AFPImageObjectInfo imageObjectInfo = (AFPImageObjectInfo)createDataObjectInfo(); | |||
AFPDataObjectInfo info = createDataObjectInfo(); | |||
assert (info instanceof AFPImageObjectInfo); | |||
AFPImageObjectInfo imageObjectInfo = (AFPImageObjectInfo) info; | |||
AFPPaintingState paintingState = afpContext.getPaintingState(); | |||
// set resource information |
@@ -78,7 +78,9 @@ public class AFPImageHandlerSVG implements ImageHandler { | |||
ImageXMLDOM imageSVG = (ImageXMLDOM)image; | |||
FOUserAgent userAgent = afpContext.getUserAgent(); | |||
AFPGraphicsObjectInfo graphicsObjectInfo = (AFPGraphicsObjectInfo)createDataObjectInfo(); | |||
AFPDataObjectInfo info = createDataObjectInfo(); | |||
assert (info instanceof AFPGraphicsObjectInfo); | |||
AFPGraphicsObjectInfo graphicsObjectInfo = (AFPGraphicsObjectInfo) info; | |||
AFPResourceInfo resourceInfo = graphicsObjectInfo.getResourceInfo(); | |||
setDefaultToInlineResourceLevel(graphicsObjectInfo); | |||
@@ -43,7 +43,7 @@ import org.apache.fop.render.awt.AWTRenderer; | |||
public class ImageProxyPanel extends JPanel { | |||
/** The reference to the BufferedImage storing the page data */ | |||
private Reference imageRef; | |||
private transient Reference imageRef; | |||
/** The maximum and preferred size of the panel */ | |||
private Dimension size; |
@@ -107,14 +107,16 @@ public class IFParser implements IFConstants { | |||
transformer.transform(src, res); | |||
} catch (TransformerException te) { | |||
Throwable cause = te.getCause(); | |||
//Unpack original IFException if applicable | |||
if (te.getCause() instanceof SAXException) { | |||
SAXException se = (SAXException)te.getCause(); | |||
if (se.getCause() instanceof IFException) { | |||
throw (IFException)se.getCause(); | |||
if (cause instanceof SAXException) { | |||
SAXException se = (SAXException) cause; | |||
cause = se.getCause(); | |||
if (cause instanceof IFException) { | |||
throw (IFException) cause; | |||
} | |||
} else if (te.getCause() instanceof IFException) { | |||
throw (IFException)te.getCause(); | |||
} else if (cause instanceof IFException) { | |||
throw (IFException) cause; | |||
} | |||
throw te; | |||
} | |||
@@ -375,9 +377,10 @@ public class IFParser implements IFConstants { | |||
} | |||
private void handleIFException(IFException ife) throws SAXException { | |||
if (ife.getCause() instanceof SAXException) { | |||
Throwable cause = ife.getCause(); | |||
if (cause instanceof SAXException) { | |||
//unwrap | |||
throw (SAXException)ife.getCause(); | |||
throw (SAXException) cause; | |||
} else { | |||
//wrap | |||
throw new SAXException(ife); |
@@ -197,8 +197,9 @@ public class IFRenderer extends AbstractPathOrientedRenderer { | |||
} | |||
private void handleIFExceptionWithIOException(IFException ife) throws IOException { | |||
if (ife.getCause() instanceof IOException) { | |||
throw (IOException)ife.getCause(); | |||
Throwable cause = ife.getCause(); | |||
if (cause instanceof IOException) { | |||
throw (IOException) cause; | |||
} else { | |||
handleIFException(ife); | |||
} | |||
@@ -1072,15 +1073,17 @@ public class IFRenderer extends AbstractPathOrientedRenderer { | |||
String s = word.getWord(); | |||
int[][] dp = word.getGlyphPositionAdjustments(); | |||
Area parentArea = word.getParentArea(); | |||
assert (parentArea instanceof AbstractTextArea); | |||
if (dp == null) { | |||
renderTextWithAdjustments(s, word.getLetterAdjustArray(), word.isReversed(), | |||
font, (AbstractTextArea)word.getParentArea()); | |||
font, (AbstractTextArea) parentArea); | |||
} else if (IFUtil.isDPOnlyDX(dp)) { | |||
renderTextWithAdjustments(s, IFUtil.convertDPToDX(dp), word.isReversed(), | |||
font, (AbstractTextArea)word.getParentArea()); | |||
font, (AbstractTextArea) parentArea); | |||
} else { | |||
renderTextWithAdjustments(s, dp, word.isReversed(), | |||
font, (AbstractTextArea)word.getParentArea()); | |||
font, (AbstractTextArea) parentArea); | |||
} | |||
super.renderWord(word); | |||
@@ -1091,7 +1094,9 @@ public class IFRenderer extends AbstractPathOrientedRenderer { | |||
Font font = getFontFromArea(space.getParentArea()); | |||
String s = space.getSpace(); | |||
AbstractTextArea textArea = (AbstractTextArea)space.getParentArea(); | |||
Area parentArea = space.getParentArea(); | |||
assert (parentArea instanceof AbstractTextArea); | |||
AbstractTextArea textArea = (AbstractTextArea) parentArea; | |||
renderTextWithAdjustments(s, (int[]) null, false, font, textArea); | |||
/* COMBINED is always false |
@@ -388,6 +388,7 @@ class PDFRenderingUtil { | |||
} else if (type == PDFObjectType.Number) { | |||
array.add(new PDFNumber(entry.getValueAsNumber())); | |||
} else if (type == PDFObjectType.Reference) { | |||
assert (entry instanceof PDFReferenceExtension); | |||
array.add(resolveReference((PDFReferenceExtension) entry)); | |||
} else if (type == PDFObjectType.String) { | |||
array.add(entry.getValue()); | |||
@@ -423,6 +424,7 @@ class PDFRenderingUtil { | |||
} else if (type == PDFObjectType.Number) { | |||
dictionary.put(key, new PDFNumber(entry.getValueAsNumber())); | |||
} else if (type == PDFObjectType.Reference) { | |||
assert (entry instanceof PDFReferenceExtension); | |||
dictionary.put(key, resolveReference((PDFReferenceExtension) entry)); | |||
} else if (type == PDFObjectType.String) { | |||
dictionary.put(key, entry.getValue()); |
@@ -44,8 +44,9 @@ public class PDFArrayElement extends PDFCollectionEntryElement { | |||
} | |||
public PDFArrayExtension getArrayExtension() { | |||
assert getExtension() instanceof PDFArrayExtension; | |||
return (PDFArrayExtension) getExtension(); | |||
PDFCollectionEntryExtension extension = getExtension(); | |||
assert (extension instanceof PDFArrayExtension); | |||
return (PDFArrayExtension) extension; | |||
} | |||
@Override |
@@ -64,8 +64,9 @@ public class PDFDictionaryElement extends PDFCollectionEntryElement { | |||
} | |||
public PDFDictionaryExtension getDictionaryExtension() { | |||
assert getExtension() instanceof PDFDictionaryExtension; | |||
return (PDFDictionaryExtension) getExtension(); | |||
PDFCollectionEntryExtension extension = getExtension(); | |||
assert extension instanceof PDFDictionaryExtension; | |||
return (PDFDictionaryExtension) extension; | |||
} | |||
@Override |
@@ -52,7 +52,9 @@ public class PDFReferenceElement extends PDFCollectionEntryElement { | |||
} else if (refid.length() == 0) { | |||
invalidPropertyValueError(ATT_REFID, refid, null); | |||
} else { | |||
((PDFReferenceExtension) getExtension()).setReferenceId(refid); | |||
PDFCollectionEntryExtension extension = getExtension(); | |||
assert (extension instanceof PDFReferenceExtension); | |||
((PDFReferenceExtension) extension).setReferenceId(refid); | |||
} | |||
} | |||
} |
@@ -514,7 +514,8 @@ public class XMLRenderer extends AbstractXMLRenderer { | |||
renderRegion(region); | |||
endElement("regionStart"); | |||
} else if (region.getRegionClass() == FO_REGION_BODY) { | |||
BodyRegion body = (BodyRegion)region; | |||
assert (region instanceof BodyRegion); | |||
BodyRegion body = (BodyRegion) region; | |||
if (body.getColumnCount() != 1) { | |||
addAttribute("columnGap", body.getColumnGap()); | |||
addAttribute("columnCount", body.getColumnCount()); |
@@ -1029,7 +1029,8 @@ public class PDFGraphics2D extends AbstractGraphics2D implements NativeImageHand | |||
resourceContext.addXObject(imageInfo); | |||
} else { | |||
Raster r = pctx.getRaster(devX, devY, devW, devH); | |||
WritableRaster wr = (WritableRaster)r; | |||
assert (r instanceof WritableRaster); | |||
WritableRaster wr = (WritableRaster) r; | |||
wr = wr.createWritableTranslatedChild(0, 0); | |||
ColorModel pcm = pctx.getColorModel(); |