git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1616416 13f79535-47bb-0310-9956-ffa450edef68pull/28/head
@@ -33,10 +33,6 @@ | |||
<!-- 4 warnings --> | |||
<Bug pattern="DM_BOOLEAN_CTOR"/> | |||
</Match> | |||
<Match> | |||
<!-- 2 warnings --> | |||
<Bug pattern="DM_BOXED_PRIMITIVE_TOSTRING"/> | |||
</Match> | |||
<Match> | |||
<!-- 29 warnings --> | |||
<Bug pattern="DM_CONVERT_CASE"/> | |||
@@ -53,22 +49,10 @@ | |||
<!-- 88 warnings --> | |||
<Bug pattern="DM_NUMBER_CTOR"/> | |||
</Match> | |||
<Match> | |||
<!-- 2 warnings --> | |||
<Bug pattern="DM_STRING_TOSTRING"/> | |||
</Match> | |||
<Match> | |||
<!-- 4 warnings --> | |||
<Bug pattern="DM_STRING_VOID_CTOR"/> | |||
</Match> | |||
<Match> | |||
<!-- 2 warnings --> | |||
<Bug pattern="DMI_INVOKING_TOSTRING_ON_ARRAY"/> | |||
</Match> | |||
<Match> | |||
<!-- 2 warnings --> | |||
<Bug pattern="DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED"/> | |||
</Match> | |||
<Match> | |||
<!-- 84 warnings --> | |||
<Bug pattern="EI_EXPOSE_REP"/> | |||
@@ -86,10 +70,6 @@ | |||
</And> | |||
</Or> | |||
</Match> | |||
<Match> | |||
<!-- 2 warnings --> | |||
<Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/> | |||
</Match> | |||
<Match> | |||
<!-- 3 warnings --> | |||
<Bug pattern="ES_COMPARING_PARAMETER_STRING_WITH_EQ"/> | |||
@@ -102,10 +82,6 @@ | |||
<!-- 12 warnings --> | |||
<Bug pattern="FE_FLOATING_POINT_EQUALITY"/> | |||
</Match> | |||
<Match> | |||
<!-- 2 warnings --> | |||
<Bug pattern="IM_BAD_CHECK_FOR_ODD"/> | |||
</Match> | |||
<Match> | |||
<!-- 3 warnings --> | |||
<Bug pattern="IS2_INCONSISTENT_SYNC"/> | |||
@@ -118,10 +94,6 @@ | |||
<!-- 9 warnings --> | |||
<Bug pattern="LI_LAZY_INIT_STATIC"/> | |||
</Match> | |||
<Match> | |||
<!-- 2 warnings --> | |||
<Bug pattern="MF_CLASS_MASKS_FIELD"/> | |||
</Match> | |||
<Match> | |||
<Bug pattern="MS_EXPOSE_REP"/> | |||
<Or> | |||
@@ -159,10 +131,6 @@ | |||
<!-- 4 warnings --> | |||
<Bug pattern="NP_NULL_ON_SOME_PATH"/> | |||
</Match> | |||
<Match> | |||
<!-- 2 warnings --> | |||
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/> | |||
</Match> | |||
<Match> | |||
<!-- 3 warnings --> | |||
<Bug pattern="NS_DANGEROUS_NON_SHORT_CIRCUIT"/> | |||
@@ -171,10 +139,6 @@ | |||
<!-- 4 warnings --> | |||
<Bug pattern="OS_OPEN_STREAM"/> | |||
</Match> | |||
<Match> | |||
<!-- 2 warnings --> | |||
<Bug pattern="OS_OPEN_STREAM_EXCEPTION_PATH"/> | |||
</Match> | |||
<Match> | |||
<!-- 46 warnings --> | |||
<Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/> | |||
@@ -199,22 +163,10 @@ | |||
<!-- 11 warnings --> | |||
<Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE"/> | |||
</Match> | |||
<Match> | |||
<!-- 2 warnings --> | |||
<Bug pattern="SBSC_USE_STRINGBUFFER_CONCATENATION"/> | |||
</Match> | |||
<Match> | |||
<!-- 33 warnings --> | |||
<Bug pattern="SE_BAD_FIELD"/> | |||
</Match> | |||
<Match> | |||
<!-- 2 warnings --> | |||
<Bug pattern="SE_BAD_FIELD_INNER_CLASS"/> | |||
</Match> | |||
<Match> | |||
<!-- 2 warnings --> | |||
<Bug pattern="SE_BAD_FIELD_STORE"/> | |||
</Match> | |||
<Match> | |||
<!-- 6 warnings --> | |||
<Bug pattern="SE_INNER_CLASS"/> |
@@ -57,7 +57,7 @@ public class AFPPaintingState extends org.apache.fop.util.AbstractPaintingState | |||
private float bitmapEncodingQuality; | |||
/** color image handler */ | |||
private ColorConverter colorConverter = GrayScaleColorConverter.getInstance(); | |||
private transient ColorConverter colorConverter = GrayScaleColorConverter.getInstance(); | |||
/** | |||
* true if certain image formats may be embedded unchanged in their native |
@@ -130,13 +130,17 @@ public abstract class AbstractGraphicsCoord extends AbstractGraphicsDrawingOrder | |||
/** {@inheritDoc} */ | |||
public String toString() { | |||
String coordsStr = ""; | |||
StringBuffer sb = new StringBuffer(); | |||
for (int i = 0; i < coords.length; i++) { | |||
coordsStr += (i % 2 == 0) ? "x" : "y"; | |||
coordsStr += (i / 2) + "=" + coords[i] + ","; | |||
if (sb.length() > 0) { | |||
sb.append(','); | |||
} | |||
sb.append((i % 2 == 0) ? 'x' : 'y'); | |||
sb.append(i / 2); | |||
sb.append('='); | |||
sb.append(coords[i]); | |||
} | |||
coordsStr = coordsStr.substring(0, coordsStr.length() - 1); | |||
return getName() + "{" + coordsStr + "}"; | |||
return getName() + "{" + sb.toString() + "}"; | |||
} | |||
/** |
@@ -25,6 +25,8 @@ import java.io.OutputStream; | |||
import java.lang.reflect.Method; | |||
import java.net.MalformedURLException; | |||
import java.net.URL; | |||
import java.security.AccessController; | |||
import java.security.PrivilegedAction; | |||
import java.util.List; | |||
import org.apache.commons.io.IOUtils; | |||
@@ -125,10 +127,15 @@ public final class Main { | |||
*/ | |||
public static void startFOPWithDynamicClasspath(String[] args) { | |||
try { | |||
URL[] urls = getJARList(); | |||
final URL[] urls = getJARList(); | |||
//System.out.println("CCL: " | |||
// + Thread.currentThread().getContextClassLoader().toString()); | |||
ClassLoader loader = new java.net.URLClassLoader(urls, null); | |||
ClassLoader loader = (ClassLoader) | |||
AccessController.doPrivileged(new PrivilegedAction() { | |||
public Object run() { | |||
return new java.net.URLClassLoader(urls, null); | |||
} | |||
}); | |||
Thread.currentThread().setContextClassLoader(loader); | |||
Class clazz = Class.forName("org.apache.fop.cli.Main", true, loader); | |||
//System.out.println("CL: " + clazz.getClassLoader().toString()); |
@@ -104,7 +104,7 @@ public abstract class AbstractPageSequence extends FObj implements CommonAccessi | |||
startingPageNumber++; | |||
} | |||
} else if (pageNumberType == EN_AUTO_EVEN) { | |||
if (startingPageNumber % 2 == 1) { | |||
if (startingPageNumber % 2 != 0) { | |||
startingPageNumber++; | |||
} | |||
} |
@@ -36,7 +36,7 @@ public class PageProductionException extends RuntimeException { | |||
private static final long serialVersionUID = -5126033718398975158L; | |||
private String localizedMessage; | |||
private Locator locator; | |||
private transient Locator locator; | |||
/** |
@@ -271,7 +271,7 @@ public class PageSequence extends AbstractPageSequence implements WritingModeTra | |||
if (pageSequenceMaster == null) { | |||
return simplePageMaster; | |||
} | |||
boolean isOddPage = ((page % 2) == 1); | |||
boolean isOddPage = ((page % 2) != 0); | |||
if (log.isDebugEnabled()) { | |||
log.debug("getNextSimplePageMaster(page=" + page | |||
+ " isOdd=" + isOddPage |
@@ -90,7 +90,7 @@ public final class CharacterProperty extends Property { | |||
* @return this.character cast as a String | |||
*/ | |||
public String getString() { | |||
return new Character(character).toString(); | |||
return Character.toString(character); | |||
} | |||
@Override |
@@ -83,17 +83,20 @@ public class GenericShorthandParser implements ShorthandParser { | |||
PropertyList propertyList) | |||
throws PropertyException { | |||
Property prop = null; | |||
String vProperty = ""; | |||
StringBuffer vProperty = new StringBuffer(); | |||
// Try each of the stored values in turn | |||
Iterator iprop = property.getList().iterator(); | |||
while (iprop.hasNext() && prop == null) { | |||
Property p = (Property)iprop.next(); | |||
if (p.getNCname() != null) { | |||
vProperty += p.getNCname() + " "; | |||
if (vProperty.length() > 0) { | |||
vProperty.append(' '); | |||
} | |||
vProperty.append(p.getNCname()); | |||
} | |||
prop = maker.convertShorthandProperty(propertyList, p, null); | |||
} | |||
propertyList.validatePropertyValue(vProperty.trim(), prop, property); | |||
propertyList.validatePropertyValue(vProperty.toString(), prop, property); | |||
return prop; | |||
} | |||
@@ -1277,7 +1277,7 @@ public final class Glyphs { | |||
* @return the name of the glyph | |||
*/ | |||
public static String charToGlyphName(char ch) { | |||
return stringToGlyph(new Character(ch).toString()); | |||
return stringToGlyph(Character.toString(ch)); | |||
} | |||
/** |
@@ -21,6 +21,7 @@ package org.apache.fop.fonts.truetype; | |||
import java.io.IOException; | |||
import java.io.UnsupportedEncodingException; | |||
import java.util.Arrays; | |||
/** | |||
@@ -57,19 +58,17 @@ public class OFDirTabEntry { | |||
offset = in.readTTFULong(); | |||
length = in.readTTFULong(); | |||
String tagStr = new String(tag, "ISO-8859-1"); | |||
return tagStr; | |||
return getTagString(); | |||
} | |||
@Override | |||
public String toString() { | |||
return "Read dir tab [" | |||
+ tag[0] + " " + tag[1] + " " + tag[2] + " " + tag[3] + "]" | |||
return "Read dir tab [" + Arrays.toString(tag) + "]" | |||
+ " offset: " + offset | |||
+ " length: " + length | |||
+ " name: " + tag; | |||
+ " name: " + getTagString(); | |||
} | |||
/** |
@@ -266,7 +266,7 @@ public abstract class OpenFont { | |||
/** | |||
* Key-value helper class. | |||
*/ | |||
final static class UnicodeMapping implements Comparable { | |||
static final class UnicodeMapping implements Comparable { | |||
private final int unicodeIndex; | |||
private final int glyphIndex; |
@@ -91,7 +91,7 @@ public abstract class AbstractBreaker { | |||
* Helper class, extending the functionality of the | |||
* basic {@link BlockKnuthSequence}. | |||
*/ | |||
public class BlockSequence extends BlockKnuthSequence { | |||
public static class BlockSequence extends BlockKnuthSequence { | |||
private static final long serialVersionUID = -5348831120146774118L; | |||
@@ -38,7 +38,8 @@ import org.apache.fop.traits.MinOptMax; | |||
public abstract class AbstractPageNumberCitationLayoutManager extends LeafNodeLayoutManager { | |||
/** The page number citation object */ | |||
protected AbstractPageNumberCitation fobj; | |||
protected AbstractPageNumberCitation citation; | |||
/** Font for the page-number-citation */ | |||
protected Font font; | |||
@@ -55,15 +56,15 @@ public abstract class AbstractPageNumberCitationLayoutManager extends LeafNodeLa | |||
*/ | |||
public AbstractPageNumberCitationLayoutManager(AbstractPageNumberCitation node) { | |||
super(node); | |||
fobj = node; | |||
citation = node; | |||
} | |||
/** {@inheritDoc} */ | |||
public void initialize() { | |||
FontInfo fi = fobj.getFOEventHandler().getFontInfo(); | |||
FontTriplet[] fontkeys = fobj.getCommonFont().getFontState(fi); | |||
font = fi.getFontInstance(fontkeys[0], fobj.getCommonFont().fontSize.getValue(this)); | |||
setCommonBorderPaddingBackground(fobj.getCommonBorderPaddingBackground()); | |||
FontInfo fi = citation.getFOEventHandler().getFontInfo(); | |||
FontTriplet[] fontkeys = citation.getCommonFont().getFontState(fi); | |||
font = fi.getFontInstance(fontkeys[0], citation.getCommonFont().fontSize.getValue(this)); | |||
setCommonBorderPaddingBackground(citation.getCommonBorderPaddingBackground()); | |||
} | |||
/** | |||
@@ -72,11 +73,11 @@ public abstract class AbstractPageNumberCitationLayoutManager extends LeafNodeLa | |||
protected AlignmentContext makeAlignmentContext(LayoutContext context) { | |||
return new AlignmentContext( | |||
font | |||
, fobj.getLineHeight().getOptimum(this).getLength().getValue(this) | |||
, fobj.getAlignmentAdjust() | |||
, fobj.getAlignmentBaseline() | |||
, fobj.getBaselineShift() | |||
, fobj.getDominantBaseline() | |||
, citation.getLineHeight().getOptimum(this).getLength().getValue(this) | |||
, citation.getAlignmentAdjust() | |||
, citation.getAlignmentBaseline() | |||
, citation.getBaselineShift() | |||
, citation.getDominantBaseline() | |||
, context.getAlignmentContext() | |||
); | |||
} | |||
@@ -114,7 +115,7 @@ public abstract class AbstractPageNumberCitationLayoutManager extends LeafNodeLa | |||
protected InlineArea getEffectiveArea(LayoutContext layoutContext) { | |||
InlineArea area = getPageNumberCitationArea(); | |||
if (!layoutContext.treatAsArtifact()) { | |||
TraitSetter.addStructureTreeElement(area, fobj.getStructureTreeElement()); | |||
TraitSetter.addStructureTreeElement(area, citation.getStructureTreeElement()); | |||
} | |||
return area; | |||
} | |||
@@ -125,9 +126,9 @@ public abstract class AbstractPageNumberCitationLayoutManager extends LeafNodeLa | |||
text = new TextArea(); | |||
text.addWord(citationString, 0); | |||
} else { | |||
UnresolvedPageNumber unresolved = new UnresolvedPageNumber(fobj.getRefId(), font, | |||
UnresolvedPageNumber unresolved = new UnresolvedPageNumber(citation.getRefId(), font, | |||
getReferenceType()); | |||
getPSLM().addUnresolvedArea(fobj.getRefId(), unresolved); | |||
getPSLM().addUnresolvedArea(citation.getRefId(), unresolved); | |||
text = unresolved; | |||
} | |||
setTraits(text); | |||
@@ -141,7 +142,7 @@ public abstract class AbstractPageNumberCitationLayoutManager extends LeafNodeLa | |||
protected abstract boolean getReferenceType(); | |||
private void setTraits(TextArea text) { | |||
TraitSetter.setProducerID(text, fobj.getId()); | |||
TraitSetter.setProducerID(text, citation.getId()); | |||
int bidiLevel = getBidiLevel(); | |||
text.setBidiLevel(bidiLevel); | |||
int width = getStringWidth(citationString); // TODO: [GA] !I18N! | |||
@@ -149,15 +150,15 @@ public abstract class AbstractPageNumberCitationLayoutManager extends LeafNodeLa | |||
text.setBPD(font.getAscender() - font.getDescender()); | |||
text.setBaselineOffset(font.getAscender()); | |||
TraitSetter.addFontTraits(text, font); | |||
text.addTrait(Trait.COLOR, fobj.getColor()); | |||
TraitSetter.addTextDecoration(text, fobj.getTextDecoration()); | |||
text.addTrait(Trait.COLOR, citation.getColor()); | |||
TraitSetter.addTextDecoration(text, citation.getTextDecoration()); | |||
} | |||
/** | |||
* @return bidi level governing abstract page number citation | |||
*/ | |||
protected int getBidiLevel() { | |||
return fobj.getBidiLevel(); | |||
return citation.getBidiLevel(); | |||
} | |||
} |
@@ -191,7 +191,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager | |||
} | |||
// this class represents a paragraph | |||
private class Paragraph extends InlineKnuthSequence { | |||
private static class Paragraph extends InlineKnuthSequence { | |||
private static final long serialVersionUID = 5862072380375189105L; | |||
@@ -239,7 +239,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager | |||
// add the element representing text indentation | |||
// at the beginning of the first paragraph | |||
if (isFirstInBlock && knuthParagraphs.size() == 0 | |||
if (layoutManager.isFirstInBlock && layoutManager.knuthParagraphs.size() == 0 | |||
&& textIndent != 0) { | |||
this.add(new KnuthInlineBox(textIndent, null, | |||
null, false)); | |||
@@ -250,7 +250,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager | |||
public void endParagraph() { | |||
KnuthSequence finishedPar = this.endSequence(); | |||
if (finishedPar != null) { | |||
knuthParagraphs.add(finishedPar); | |||
layoutManager.knuthParagraphs.add(finishedPar); | |||
} | |||
} | |||
@@ -40,8 +40,8 @@ public class PageNumberCitationLastLayoutManager extends AbstractPageNumberCitat | |||
@Override | |||
protected PageViewport getCitedPage() { | |||
if (getPSLM().associateLayoutManagerID(fobj.getRefId())) { | |||
return getPSLM().getLastPVWithID(fobj.getRefId()); | |||
if (getPSLM().associateLayoutManagerID(citation.getRefId())) { | |||
return getPSLM().getLastPVWithID(citation.getRefId()); | |||
} else { | |||
return null; | |||
} |
@@ -40,7 +40,7 @@ public class PageNumberCitationLayoutManager extends AbstractPageNumberCitationL | |||
@Override | |||
protected PageViewport getCitedPage() { | |||
return getPSLM().getFirstPVWithID(fobj.getRefId()); | |||
return getPSLM().getFirstPVWithID(citation.getRefId()); | |||
} | |||
@Override |
@@ -61,7 +61,7 @@ public class PDFJavaScriptLaunchAction extends PDFAction { | |||
PDFJavaScriptLaunchAction launch = (PDFJavaScriptLaunchAction) obj; | |||
if (!launch.script.toString().equals(script.toString())) { | |||
if (!launch.script.equals(script)) { | |||
return false; | |||
} | |||
@@ -128,10 +128,11 @@ public class ImageProxyPanel extends JPanel { | |||
image = (BufferedImage)imageRef.get(); | |||
} | |||
int x = (getWidth() - image.getWidth()) / 2; | |||
int y = (getHeight() - image.getHeight()) / 2; | |||
graphics.drawImage(image, x, y, image.getWidth(), image.getHeight(), null); | |||
if (image != null) { | |||
int x = (getWidth() - image.getWidth()) / 2; | |||
int y = (getHeight() - image.getHeight()) / 2; | |||
graphics.drawImage(image, x, y, image.getWidth(), image.getHeight(), null); | |||
} | |||
} catch (FOPException fopEx) { | |||
fopEx.printStackTrace(); | |||
} |
@@ -626,7 +626,7 @@ public class PreviewDialog extends JFrame implements StatusListener { | |||
} | |||
public void run() { | |||
processStatus.setText(message.toString()); | |||
processStatus.setText(message); | |||
} | |||
} | |||
@@ -116,52 +116,59 @@ public class ImageRawPNGAdapter extends AbstractImageAdapter { | |||
// TODO: Implement code to combine image with background color if transparency is not allowed | |||
// here we need to inflate the PNG pixel data, which includes alpha, separate the alpha channel | |||
// and then deflate it back again | |||
ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |||
DeflaterOutputStream dos = new DeflaterOutputStream(baos, new Deflater()); | |||
InputStream in = ((ImageRawStream) image).createInputStream(); | |||
ByteArrayOutputStream baos = null; | |||
DeflaterOutputStream dos = null; | |||
InputStream in = null; | |||
try { | |||
InflaterInputStream infStream = new InflaterInputStream(in, new Inflater()); | |||
DataInputStream dataStream = new DataInputStream(infStream); | |||
// offset is the byte offset of the alpha component | |||
int offset = numberOfInterleavedComponents - 1; // 1 for GA, 3 for RGBA | |||
int numColumns = image.getSize().getWidthPx(); | |||
int bytesPerRow = numberOfInterleavedComponents * numColumns; | |||
int filter; | |||
// read line by line; the first byte holds the filter | |||
while ((filter = dataStream.read()) != -1) { | |||
byte[] bytes = new byte[bytesPerRow]; | |||
dataStream.readFully(bytes, 0, bytesPerRow); | |||
dos.write((byte) filter); | |||
for (int j = 0; j < numColumns; j++) { | |||
dos.write(bytes, offset, 1); | |||
offset += numberOfInterleavedComponents; | |||
baos = new ByteArrayOutputStream(); | |||
dos = new DeflaterOutputStream(baos, new Deflater()); | |||
in = ((ImageRawStream) image).createInputStream(); | |||
try { | |||
InflaterInputStream infStream = new InflaterInputStream(in, new Inflater()); | |||
DataInputStream dataStream = new DataInputStream(infStream); | |||
// offset is the byte offset of the alpha component | |||
int offset = numberOfInterleavedComponents - 1; // 1 for GA, 3 for RGBA | |||
int numColumns = image.getSize().getWidthPx(); | |||
int bytesPerRow = numberOfInterleavedComponents * numColumns; | |||
int filter; | |||
// read line by line; the first byte holds the filter | |||
while ((filter = dataStream.read()) != -1) { | |||
byte[] bytes = new byte[bytesPerRow]; | |||
dataStream.readFully(bytes, 0, bytesPerRow); | |||
dos.write((byte) filter); | |||
for (int j = 0; j < numColumns; j++) { | |||
dos.write(bytes, offset, 1); | |||
offset += numberOfInterleavedComponents; | |||
} | |||
offset = numberOfInterleavedComponents - 1; | |||
} | |||
offset = numberOfInterleavedComponents - 1; | |||
} catch (IOException e) { | |||
throw new RuntimeException("Error processing transparency channel:", e); | |||
} | |||
dos.close(); | |||
} catch (IOException e) { | |||
throw new RuntimeException("Error processing transparency channel:", e); | |||
// set up alpha channel compression | |||
FlateFilter transFlate; | |||
try { | |||
transFlate = new FlateFilter(); | |||
transFlate.setApplied(true); | |||
transFlate.setPredictor(FlateFilter.PREDICTION_PNG_OPT); | |||
transFlate.setColors(1); | |||
transFlate.setColumns(image.getSize().getWidthPx()); | |||
transFlate.setBitsPerComponent(this.getBitsPerComponent()); | |||
} catch (PDFFilterException e) { | |||
throw new RuntimeException("FlateFilter configuration error", e); | |||
} | |||
BitmapImage alphaMask = new BitmapImage("Mask:" + this.getKey(), image.getSize().getWidthPx(), | |||
image.getSize().getHeightPx(), baos.toByteArray(), null); | |||
IOUtils.closeQuietly(baos); | |||
alphaMask.setPDFFilter(transFlate); | |||
alphaMask.disallowMultipleFilters(); | |||
alphaMask.setColorSpace(new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_GRAY)); | |||
softMask = doc.addImage(null, alphaMask).makeReference(); | |||
} finally { | |||
IOUtils.closeQuietly(in); | |||
IOUtils.closeQuietly(dos); | |||
IOUtils.closeQuietly(baos); | |||
} | |||
// set up alpha channel compression | |||
FlateFilter transFlate; | |||
try { | |||
transFlate = new FlateFilter(); | |||
transFlate.setApplied(true); | |||
transFlate.setPredictor(FlateFilter.PREDICTION_PNG_OPT); | |||
transFlate.setColors(1); | |||
transFlate.setColumns(image.getSize().getWidthPx()); | |||
transFlate.setBitsPerComponent(this.getBitsPerComponent()); | |||
} catch (PDFFilterException e) { | |||
throw new RuntimeException("FlateFilter configuration error", e); | |||
} | |||
BitmapImage alphaMask = new BitmapImage("Mask:" + this.getKey(), image.getSize().getWidthPx(), | |||
image.getSize().getHeightPx(), baos.toByteArray(), null); | |||
alphaMask.setPDFFilter(transFlate); | |||
alphaMask.disallowMultipleFilters(); | |||
alphaMask.setColorSpace(new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_GRAY)); | |||
softMask = doc.addImage(null, alphaMask).makeReference(); | |||
} | |||
} | |||
@@ -57,4 +57,14 @@ public class PSImageFormResource extends PSResource { | |||
return this.uri; | |||
} | |||
@Override | |||
public int hashCode() { | |||
return super.hashCode(); | |||
} | |||
@Override | |||
public boolean equals(Object obj) { | |||
return super.equals(obj); | |||
} | |||
} |
@@ -41,14 +41,12 @@ abstract class RtfAfterBeforeBase | |||
extends RtfContainer | |||
implements IRtfParagraphContainer, IRtfExternalGraphicContainer, IRtfTableContainer, | |||
IRtfTextrunContainer { | |||
protected RtfAttributes attrib; | |||
private RtfParagraph para; | |||
private RtfExternalGraphic externalGraphic; | |||
private RtfTable table; | |||
RtfAfterBeforeBase(RtfSection parent, Writer w, RtfAttributes attrs) throws IOException { | |||
super((RtfContainer)parent, w, attrs); | |||
attrib = attrs; | |||
} | |||
public RtfParagraph newParagraph() throws IOException { |
@@ -88,7 +88,7 @@ public class FopServlet extends HttpServlet { | |||
/** The FopFactory used to create Fop instances */ | |||
protected FopFactory fopFactory; | |||
/** URIResolver for use by this servlet */ | |||
protected URIResolver uriResolver; | |||
protected transient URIResolver uriResolver; | |||
/** | |||
* {@inheritDoc} |
@@ -31,6 +31,7 @@ import org.w3c.dom.Document; | |||
import org.w3c.dom.Node; | |||
import org.w3c.dom.NodeList; | |||
import org.apache.commons.io.IOUtils; | |||
import org.apache.commons.logging.impl.SimpleLog; | |||
import org.apache.fop.apps.FOUserAgent; | |||
@@ -295,11 +296,15 @@ public class TestConverter { | |||
outname + makeResultExtension()); | |||
outputFile.getParentFile().mkdirs(); | |||
OutputStream outStream = new java.io.BufferedOutputStream( | |||
new java.io.FileOutputStream(outputFile)); | |||
logger.debug("ddir:" + destdir + " on:" + outputFile.getName()); | |||
inputHandler.renderTo(userAgent, outputFormat, outStream); | |||
outStream.close(); | |||
OutputStream outStream = null; | |||
try { | |||
outStream = new java.io.BufferedOutputStream( | |||
new java.io.FileOutputStream(outputFile)); | |||
logger.debug("ddir:" + destdir + " on:" + outputFile.getName()); | |||
inputHandler.renderTo(userAgent, outputFormat, outStream); | |||
} finally { | |||
IOUtils.closeQuietly(outStream); | |||
} | |||
// check difference | |||
if (compare != null) { |
@@ -25,6 +25,8 @@ import java.lang.reflect.Method; | |||
import java.net.MalformedURLException; | |||
import java.net.URL; | |||
import java.net.URLClassLoader; | |||
import java.security.AccessController; | |||
import java.security.PrivilegedAction; | |||
import java.util.ArrayList; | |||
import java.util.Iterator; | |||
import java.util.Map; | |||
@@ -138,9 +140,14 @@ public class RunTest extends Task { | |||
// return; | |||
// } else { | |||
try { | |||
ClassLoader loader = new URLClassLoader(createUrls(referenceJar)); | |||
final URL[] urls = createUrls(referenceJar); | |||
ClassLoader loader = (ClassLoader) | |||
AccessController.doPrivileged(new PrivilegedAction() { | |||
public Object run() { | |||
return new URLClassLoader(urls); | |||
} | |||
}); | |||
boolean failed = false; | |||
try { | |||
Class cla = Class.forName("org.apache.fop.apps.Fop", true, | |||
loader); |
@@ -548,7 +548,7 @@ public abstract class AbstractPaintingState implements Cloneable, Serializable { | |||
+ ", fontName=" + fontName | |||
+ ", fontSize=" + fontSize | |||
+ ", lineWidth=" + lineWidth | |||
+ ", dashArray=" + dashArray | |||
+ ", dashArray=" + Arrays.toString(dashArray) | |||
+ ", transform=" + transform | |||
+ ", layer=" + layer; | |||
} |
@@ -82,4 +82,23 @@ public class ColorWithFallback extends ColorWithAlternatives { | |||
return this.fallback; | |||
} | |||
@Override | |||
public int hashCode() { | |||
return super.hashCode() ^ fallback.hashCode(); | |||
} | |||
@Override | |||
public boolean equals(Object obj) { | |||
if (obj == this) { | |||
return true; | |||
} else if (!super.equals(obj)) { | |||
return false; | |||
} else if (obj instanceof ColorWithFallback) { | |||
ColorWithFallback other = (ColorWithFallback) obj; | |||
return other.fallback.equals(fallback); | |||
} else { | |||
return false; | |||
} | |||
} | |||
} |