<!-- 27 warnings -->
<Bug pattern="DLS_DEAD_LOCAL_STORE"/>
</Match>
- <Match>
- <!-- 3 warnings -->
- <Bug pattern="DLS_DEAD_LOCAL_STORE_OF_NULL"/>
- </Match>
<Match>
<!-- 4 warnings -->
<Bug pattern="DM_BOOLEAN_CTOR"/>
</And>
</Or>
</Match>
- <Match>
- <!-- 3 warnings -->
- <Bug pattern="ES_COMPARING_PARAMETER_STRING_WITH_EQ"/>
- </Match>
- <Match>
- <!-- 3 warnings -->
- <Bug pattern="ES_COMPARING_STRINGS_WITH_EQ"/>
- </Match>
<Match>
<!-- 12 warnings -->
<Bug pattern="FE_FLOATING_POINT_EQUALITY"/>
</Match>
- <Match>
- <!-- 3 warnings -->
- <Bug pattern="IS2_INCONSISTENT_SYNC"/>
- </Match>
<Match>
<!-- 6 warnings -->
<Bug pattern="ITA_INEFFICIENT_TO_ARRAY"/>
<Bug pattern="NM_CONFUSING"/>
</Match>
<Match>
- <!-- 3 warnings -->
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_INTERFACE"/>
+ <Or>
+ <Class name="org.apache.fop.apps.MimeConstants"/>
+ <Class name="org.apache.fop.events.EventListener"/>
+ <Class name="org.apache.fop.render.Graphics2DImagePainter"/>
+ </Or>
</Match>
<Match>
<!-- 5 warnings -->
<!-- 4 warnings -->
<Bug pattern="NP_NULL_ON_SOME_PATH"/>
</Match>
- <Match>
- <!-- 3 warnings -->
- <Bug pattern="NS_DANGEROUS_NON_SHORT_CIRCUIT"/>
- </Match>
<Match>
<!-- 4 warnings -->
<Bug pattern="OS_OPEN_STREAM"/>
<!-- 10 warnings -->
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
</Match>
- <Match>
- <!-- 3 warnings -->
- <Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE"/>
- </Match>
<Match>
<!-- 23 warnings -->
<Bug pattern="REC_CATCH_EXCEPTION"/>
<Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED"/>
</Match>
<Match>
- <!-- 3 warnings -->
<Bug pattern="SF_SWITCH_FALLTHROUGH"/>
+ <Or>
+ <And>
+ <Class name="org.apache.fop.render.awt.viewer.PreviewPanel$Reloader"/>
+ <Method name="run"/>
+ </And>
+ </Or>
</Match>
<Match>
<!-- 21 warnings -->
<!-- 8 warnings -->
<Bug pattern="UCF_USELESS_CONTROL_FLOW"/>
</Match>
- <Match>
- <!-- 3 warnings -->
- <Bug pattern="UI_INHERITANCE_UNSAFE_GETRESOURCE"/>
- </Match>
<Match>
<!-- 6 warnings -->
<Bug pattern="UPM_UNCALLED_PRIVATE_METHOD"/>
<!-- 12 warnings -->
<Bug pattern="URF_UNREAD_FIELD"/>
</Match>
- <Match>
- <!-- 3 warnings -->
- <Bug pattern="UUF_UNUSED_FIELD"/>
- </Match>
<Match>
<!-- 58 warnings -->
<Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"/>
}
AFPResourceInfo ri = (AFPResourceInfo)obj;
- return (uri == ri.uri || uri != null && uri.equals(ri.uri))
- && (imageDimension == ri.imageDimension
- || (imageDimension != null && imageDimension.equals(ri.imageDimension)))
- && (name == ri.name || name != null && name.equals(ri.name))
- && (level == ri.level || level != null && level.equals(ri.level));
+ return (uri != null && uri.equals(ri.uri))
+ && (imageDimension != null && imageDimension.equals(ri.imageDimension))
+ && (name != null && name.equals(ri.name))
+ && (level != null && level.equals(ri.level));
}
/** {@inheritDoc} */
/**
* Frequently used MIME types for various file formats used when working with Apache FOP.
*/
+// @SuppressFBWarnings("NM_SAME_SIMPLE_NAME_AS_INTERFACE")
public interface MimeConstants extends org.apache.xmlgraphics.util.MimeConstants {
/** Apache FOP's AWT preview (non-standard MIME type) */
protected Source createXSLTSource() {
Source src = super.createXSLTSource();
if (src == null) {
- src = new StreamSource(getClass().getResource("image2fo.xsl").toExternalForm());
+ src = new StreamSource(ImageInputHandler.class.getResource("image2fo.xsl").toExternalForm());
}
return src;
}
/**
* This interface is implemented by clients who want to listen for events.
*/
+// @SuppressFBWarnings("NM_SAME_SIMPLE_NAME_AS_INTERFACE")
public interface EventListener extends java.util.EventListener {
/**
addSubpropMakerName("precedence", CP_PRECEDENCE);
}
- // SuppressFBWarnings("MS_EXPOSE_REP")
+ // @SuppressFBWarnings("MS_EXPOSE_REP")
return generics;
}
if (o instanceof MarkerAttribute) {
MarkerAttribute attr = (MarkerAttribute) o;
- return ((attr.namespace == this.namespace)
- || (attr.namespace != null
- && attr.namespace.equals(this.namespace)))
- && ((attr.qname == this.qname)
- || (attr.qname != null
- && attr.qname.equals(this.qname)))
- && ((attr.name == this.name)
- || (attr.name != null
- && attr.name.equals(this.name)))
- && ((attr.value == this.value)
- || (attr.value != null
- && attr.value.equals(this.value)));
+ return (attr.namespace != null
+ && attr.namespace.equals(this.namespace))
+ && (attr.qname != null
+ && attr.qname.equals(this.qname))
+ && (attr.name != null
+ && attr.name.equals(this.name))
+ && (attr.value != null
+ && attr.value.equals(this.value));
} else {
return false;
}
* Since a PropertyCache is not used here, returning true helps the PropertyCache when a non
* implemented property is part of an implemented one.
*/
- // FBOFF: EQ_ALWAYS_TRUE
+ // @SuppressFBWarnings("EQ_ALWAYS_TRUE")
return true;
}
}
// only if the font may be substituted
// fallback 1: try the same font-family and weight with default style
- if (internalFontKey == null && style != Font.STYLE_NORMAL) {
+ if (internalFontKey == null && !style.equals(Font.STYLE_NORMAL)) {
key = createFontKey(family, Font.STYLE_NORMAL, weight);
internalFontKey = getInternalFontKey(key);
}
// fallback 2: try the same font-family with default style and try to adjust weight
- if (internalFontKey == null && style != Font.STYLE_NORMAL) {
+ if (internalFontKey == null && !style.equals(Font.STYLE_NORMAL)) {
key = findAdjustWeight(family, Font.STYLE_NORMAL, weight);
if (key != null) {
internalFontKey = getInternalFontKey(key);
parser = createParser();
parser.setContentHandler(this);
parser.setErrorHandler(this);
- InputStream stream = this.getClass().getResourceAsStream("classes.xml");
+ InputStream stream = PatternParser.class.getResourceAsStream("classes.xml");
InputSource source = new InputSource(stream);
try {
parser.parse(source);
for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
ActiveCell activeCell = (ActiveCell) iter.next();
if (activeCell.endsOnRow(activeRowIndex)) {
- rowFinished &= activeCell.finishes(step);
+ if (!activeCell.finishes(step)) {
+ rowFinished = false;
+ }
}
}
if (rowFinished) {
* a Graphics2D instance can implement this interface to paint themselves.
* @deprecated use {@link org.apache.xmlgraphics.java2d.Graphics2DImagePainter} directly!
*/
+// @SuppressFBWarnings("NM_SAME_SIMPLE_NAME_AS_INTERFACE")
public interface Graphics2DImagePainter
extends org.apache.xmlgraphics.java2d.Graphics2DImagePainter {
public ImageProxyPanel(AWTRenderer renderer, int page) {
this.renderer = renderer;
this.page = page;
+ try {
+ Dimension size = renderer.getPageImageSize(page);
+ Insets insets = getInsets();
+ size.width += insets.left + insets.right;
+ size.height += insets.top + insets.bottom;
+ this.size = size;
+ } catch (Exception e) {
+ this.size = new Dimension(10, 10);
+ }
// Allows single panel to appear behind page display.
// Important for textured L&Fs.
setOpaque(false);
* @return the size of the page plus the border.
*/
public Dimension getPreferredSize() {
- if (size == null) {
- try {
- Insets insets = getInsets();
- size = renderer.getPageImageSize(page);
- size = new Dimension(size.width + insets.left + insets.right,
- size.height + insets.top + insets.bottom);
- } catch (FOPException fopEx) {
- // Arbitary size. Doesn't really matter what's returned here.
- return new Dimension(10, 10);
- }
- }
return size;
}
* Sets the number of the page to be displayed and refreshes the display.
* @param pg the page number
*/
- public void setPage(int pg) {
+ public synchronized void setPage(int pg) {
if (page != pg) {
page = pg;
imageRef = null;
JPanel insetsPanel3 = new JPanel();
okButton = new JButton();
JLabel imageControl1 = new JLabel();
- imageControl1.setIcon(new ImageIcon(getClass().getResource("images/fop.gif")));
+ imageControl1.setIcon(new ImageIcon(PreviewDialogAboutBox.class.getResource("images/fop.gif")));
JLabel label1 = new JLabel(translator.getString("About.Product"));
JLabel label2 = new JLabel(translator.getString("About.Version")
+ " " + Version.getVersion());
// ***** MouseListener *****
- public void mousePressed(MouseEvent e) {
+ public synchronized void mousePressed(MouseEvent e) {
startPosX = e.getX();
startPosY = e.getY();
}
// This page intentionally left blank
// Makes 0th/1st page on rhs
gridPanel.add(new JLabel(""));
+ // @SuppressFBWarnings("SF_SWITCH_FALLTHROUGH")
case CONTINUOUS:
currentPage = 0;
firstPage = 0;
/**
* {@inheritDoc}
*/
+ // @SuppressFBWarnings("CN_IDIOM_NO_SUPER_CALL")
public Object clone() {
- // FBOFF: CN_IDIOM_NO_SUPER_CALL
return new IFGraphicContext(this);
}
closePath();
getG2D().fill(currentPath);
currentPath = null;
+ break;
case Constants.EN_NONE:
// No rule is drawn
break;
default:
+ break;
} // end switch
restoreGraphicsState();
}
closePath();
state.getGraph().fill(currentPath);
currentPath = null;
+ break;
case EN_NONE:
// No rule is drawn
break;
default:
+ break;
} // end switch
super.renderLeader(area);
boolean monochrome = isMonochromeImage(img);
if (!monochrome) {
//Transparency mask disabled. Doesn't work reliably
+ /*
final boolean transparencyDisabled = true;
RenderedImage mask = (transparencyDisabled ? null : getMask(img, effDim));
if (mask != null) {
paintMonochromeBitmap(mask, effResolution);
popCursorPos();
}
+ */
RenderedImage red = BitmapImageUtil.convertToMonochrome(
img, effDim, this.ditheringQuality);
selectCurrentPattern(0, 0); //Solid black
- setTransparencyMode(sourceTransparency || mask != null, true);
+ setTransparencyMode(sourceTransparency /*|| mask != null*/, true);
paintMonochromeBitmap(red, effResolution);
} else {
RenderedImage effImg = img;
GraphicsNode root;
try {
root = builder.build(ctx, clonedDoc);
- builder = null;
} catch (Exception e) {
SVGEventProducer eventProducer = SVGEventProducer.Provider.get(
context.getUserAgent().getEventBroadcaster());
final int l = text.length();
for (int i = 0; i < l; i++) {
final char ch = text.charAt(i);
- final char mch = this.font.mapChar(ch);
+ final char mch = font.mapChar(ch);
PSGenerator.escapeChar(mch, target);
}
}
}
private void establishCurrentFont() throws IOException {
- if ((currentFontName != this.font.getFontName())
- || (currentFontSize != this.font.getFontSize())) {
+ if (!currentFontName.equals(font.getFontName())
+ || (currentFontSize != font.getFontSize())) {
PSGenerator gen = getPSGenerator();
- gen.writeln("/" + this.font.getFontTriplet().getName() + " "
+ gen.writeln("/" + font.getFontTriplet().getName() + " "
+ gen.formatDouble(font.getFontSize() / 1000f) + " F");
- currentFontName = this.font.getFontName();
- currentFontSize = this.font.getFontSize();
+ currentFontName = font.getFontName();
+ currentFontSize = font.getFontSize();
}
}
float sx = pos.width / w;
float sy = pos.height / h;
- ctx = null;
-
gen.commentln("%FOPBeginSVG");
gen.saveGraphicsState();
final boolean clip = false;
float sx = psInfo.getWidth() / w;
float sy = psInfo.getHeight() / h;
- ctx = null;
-
try {
gen.commentln("%FOPBeginSVG");
gen.saveGraphicsState();
} catch (ImageException ie) {
ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get(
getUserAgent().getEventBroadcaster());
- eventProducer.imageError(this, (info != null ? info.toString() : uri), ie, null);
+ eventProducer.imageError(this, uri, ie, null);
} catch (FileNotFoundException fe) {
ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get(
getUserAgent().getEventBroadcaster());
public class RtfPageArea
extends RtfContainer {
private RtfPage currentPage;
- private RtfNull nullChild;
- private RtfAttributes childAttributes;
/** Create an RTF element as a child of given container */
RtfPageArea(RtfFile f, Writer w) throws IOException {
* @throws IOException for I/O problems
*/
public void addBookmark(String id) throws IOException {
- if (id != "") {
- // if id is not empty, add boormark
+ if (id.length() > 0) {
+ // if id is not empty, add bookmark
new RtfBookmark(this, writer, id);
}
}
private String referenceDirectory;
private String testDirectory;
private String[] filenameList;
- private String filenames;
/**
* Sets directory for test files.
* @param testDirectory the test directory
*/
public void setTestDirectory(String testDirectory) {
- if (!(testDirectory.endsWith("/") | testDirectory.endsWith("\\"))) {
+ if (!(testDirectory.endsWith("/") || testDirectory.endsWith("\\"))) {
testDirectory += File.separator;
}
this.testDirectory = testDirectory;
*/
public void setReferenceDirectory(String referenceDirectory) {
if (!(referenceDirectory.endsWith("/")
- | referenceDirectory.endsWith("\\"))) {
+ || referenceDirectory.endsWith("\\"))) {
referenceDirectory += File.separator;
}
this.referenceDirectory = referenceDirectory;
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry)iter.next();
String familyName = (String)entry.getKey();
- if (singleFamily != null && familyName != singleFamily) {
+ if (singleFamily != null && !singleFamily.equals(familyName)) {
continue;
}
atts.clear();