FindBugs Report

Project Information

Project: /Users/agi/workspace/jomic/settings/jomic.fb

FindBugs version: 0.8.8

Code analyzed:

Contents

Warnings

Click on a warning row to see full context information.

Correctness Warnings

Code  Warning
ICAST Integer division result cast to double in net.sf.jomic.tools.ImageTools.getRotatedImage(java.awt.image.RenderedImage,double)
NP Possible null pointer dereference in net.sf.jomic.ui.JomicMenuBar.createViewMenu()
RR net.sf.jomic.tools.FileTools.obtainComicFormat(java.io.File) ignores result of java.io.InputStream.read(byte[],int,int)
Se Class net.sf.jomic.comic.ComicInfoTableModel defines non-transient non-serializable instance field net.sf.jomic.comic.ComicInfoTableModel.comicModel
Se Class net.sf.jomic.comic.ComicInfoTableModel defines non-transient non-serializable instance field net.sf.jomic.comic.ComicInfoTableModel.stringTools
Se Class net.sf.jomic.comic.Conversion defines non-transient non-serializable instance field net.sf.jomic.comic.Conversion.imageTools
Se Class net.sf.jomic.comic.Conversion defines non-transient non-serializable instance field net.sf.jomic.comic.Conversion.stringTools
Se Class net.sf.jomic.tools.BasicSettings defines non-transient non-serializable instance field net.sf.jomic.tools.BasicSettings.logger
Se Class net.sf.jomic.tools.BasicSettings defines non-transient non-serializable instance field net.sf.jomic.tools.BasicSettings.stringTools
Se Class net.sf.jomic.tools.ImageRenderSettings defines non-transient non-serializable instance field net.sf.jomic.tools.ImageRenderSettings.imageTools
Se Class net.sf.jomic.tools.ImageRenderSettings defines non-transient non-serializable instance field net.sf.jomic.tools.ImageRenderSettings.logger
Se Class net.sf.jomic.tools.ImageRenderSettings defines non-transient non-serializable instance field net.sf.jomic.tools.ImageRenderSettings.stringTools
Se Class net.sf.jomic.ui.ImageFormatTableModel defines non-transient non-serializable instance field net.sf.jomic.ui.ImageFormatTableModel.imageTools
SnVI net.sf.jomic.comic.ComicInfoTableModel is Serializable; consider declaring a serialVersionUID
SnVI net.sf.jomic.comic.ComicViewTransferHandler is Serializable; consider declaring a serialVersionUID
SnVI net.sf.jomic.comic.Conversion is Serializable; consider declaring a serialVersionUID
SnVI net.sf.jomic.tools.BasicSettings is Serializable; consider declaring a serialVersionUID
SnVI net.sf.jomic.tools.ImageRenderSettings is Serializable; consider declaring a serialVersionUID
SnVI net.sf.jomic.ui.ImageFormatTableModel is Serializable; consider declaring a serialVersionUID
SnVI net.sf.jomic.ui.OpenRecentFileEvent is Serializable; consider declaring a serialVersionUID
UCF Useless control flow in net.sf.jomic.comic.ComicView.getRenderedImage(int,int)

Internationalization Warnings

Code  Warning

Multithreaded Correctness Warnings

Code  Warning
IS2 Inconsistent synchronization of net.sf.jomic.common.Settings.baseCacheDir; locked 80% of time
SC net.sf.jomic.tools.ImageCache.(String,long) invokes net.sf.jomic.tools.ImageCacheRenderThread.start()

Malicious Code Vulnerability Warnings

Code  Warning
EI net.sf.jomic.comic.ComicMustContainImagesException.getFileNames() may expose internal representation by returning net.sf.jomic.comic.ComicMustContainImagesException.otherFileNames
EI net.sf.jomic.tools.ConsoleIOException.getArguments() may expose internal representation by returning net.sf.jomic.tools.ConsoleIOException.arguments
EI net.sf.jomic.tools.ImageTools.getPossibleBlurModes() may expose internal representation by returning net.sf.jomic.tools.ImageTools.possibleBlurModes
EI net.sf.jomic.ui.OpenFromArchiveDialog.getFileNames() may expose internal representation by returning net.sf.jomic.ui.OpenFromArchiveDialog.fileNames
EI2 net.sf.jomic.comic.AbstractCreateComicTask.(java.io.File,String[],java.util.Map,java.io.File,Conversion) may expose internal representation by storing an externally mutable object into net.sf.jomic.comic.AbstractCreateComicTask.sourceFileNames
EI2 net.sf.jomic.comic.CreateZipArchiveTask.(java.io.File,java.io.File,String[]) may expose internal representation by storing an externally mutable object into net.sf.jomic.comic.CreateZipArchiveTask.sourceFileNames
EI2 net.sf.jomic.tools.CreateImagInfoMapTask.(java.io.File[]) may expose internal representation by storing an externally mutable object into net.sf.jomic.tools.CreateImagInfoMapTask.imageFiles
EI2 net.sf.jomic.ui.ConvertWorker.(java.io.File,java.io.File[],net.sf.jomic.comic.Conversion) may expose internal representation by storing an externally mutable object into net.sf.jomic.ui.ConvertWorker.filesToConvert

Performance Warnings

Code  Warning
SBSC Method net.sf.jomic.comic.AbstractCreateComicTask.start() concatenates strings using + in a loop
SBSC Method net.sf.jomic.tools.ConsoleIOException.getFullCommand() concatenates strings using + in a loop
SBSC Method net.sf.jomic.tools.ErrorTools.getDetailedExceptionMessage(Throwable) concatenates strings using + in a loop
SBSC Method net.sf.jomic.tools.ImageTools.() concatenates strings using + in a loop
SBSC Method net.sf.jomic.tools.StringTools.arrayToString(double[]) concatenates strings using + in a loop
SBSC Method net.sf.jomic.tools.StringTools.arrayToString(float[]) concatenates strings using + in a loop
SBSC Method net.sf.jomic.tools.StringTools.arrayToString(int[]) concatenates strings using + in a loop
SBSC Method net.sf.jomic.tools.StringTools.arrayToString(java.io.File[]) concatenates strings using + in a loop
SBSC Method net.sf.jomic.tools.StringTools.arrayToString(String[]) concatenates strings using + in a loop
SBSC Method net.sf.jomic.ui.AboutFrame.getLinks(String,String[]) concatenates strings using + in a loop
SIC Should net.sf.jomic.tools.ImageCacheRenderThread$ImageRenderTask be a _static_ inner class?
SIC Should net.sf.jomic.tools.ProgressFrame$CancelAction be a _static_ inner class?
UrF Unread field: net.sf.jomic.tools.ImageCache.unrenderableImageFiles

Style Warnings

Code  Warning
BC Unchecked/unconfirmed cast from java.awt.event.ActionEvent to class net.roydesign.event.ApplicationEvent in net.sf.jomic.JomicMacOSX.actionPerformed(java.awt.event.ActionEvent)
BC Unchecked/unconfirmed cast from java.awt.event.ActionEvent to class net.roydesign.event.ApplicationEvent in net.sf.jomic.ui.JomicApplication.actionPerformed(java.awt.event.ActionEvent)
CD Class net.sf.jomic.common.Settings has a circular dependency with other classes.
CD Class net.sf.jomic.tools.FileTools has a circular dependency with other classes.
CD Class net.sf.jomic.tools.FileTools has a circular dependency with other classes.
CD Class net.sf.jomic.tools.ImageCacheRenderThread has a circular dependency with other classes.
CD Class net.sf.jomic.ui.GoToPageDialog has a circular dependency with other classes.
CD Class net.sf.jomic.ui.JomicApplication has a circular dependency with other classes.
CD Class net.sf.jomic.ui.JomicApplication has a circular dependency with other classes.
CD Class net.sf.jomic.ui.JomicMenuBar has a circular dependency with other classes.
REC Method com.centerkey.utils.BareBonesBrowserLaunch.openURL(String) catches Exception, but Exception is not thrown in the try block and RuntimeException is not explicitly caught
REC Method net.sf.jomic.ui.CreateComicWorker.construct() catches Exception, but Exception is not thrown in the try block and RuntimeException is not explicitly caught

Details

BC_UNCONFIRMED_CAST: Unchecked/unconfirmed cast

This cast is unchecked, and not all instances of the type casted from can be cast to the type it is being cast to. Ensure that your program logic ensures that this cast will not fail.

CD_CIRCULAR_DEPENDENCY: Test for circular dependencies among classes.

This class has a circular dependency with other classes. This makes building these classes difficult, as each is dependent on the other to build correctly. Consider using interfaces to break the hard dependency.

EI_EXPOSE_REP: Method may expose internal representation by returning reference to mutable object

Returning a reference to a mutable object value stored in one of the object's fields exposes the internal representation of the object.  If instances are accessed by untrusted code, and unchecked changes to the mutable object would compromise security or other important properties, you will need to do something different. Returning a new copy of the object is better approach in many situations.

EI_EXPOSE_REP2: Method may expose internal representation by incorporating reference to mutable object

This code stores a reference to an externally mutable object into the internal representation of the object.  If instances are accessed by untrusted code, and unchecked changes to the mutable object would compromise security or other important properties, you will need to do something different. Storing a copy of the object is better approach in many situations.

ICAST_IDIV_CAST_TO_DOUBLE: Integer division result cast to double

This code casts the result of an integer division operation to double. Doing division on integers loses precision. The fact that the result was cast to double suggests that this precision should have been retained. What was probably meant was to cast one or both of the operands to double before performing the division. Here is an example:

int x = 2;
int y = 5;
// Wrong: yields result 0.0
double value1 =  x / y;

// Right: yields result 0.4
double value2 =  x / (double) y;

IS2_INCONSISTENT_SYNC: Inconsistent synchronization

The fields of this class appear to be accessed inconsistently with respect to synchronization.  This bug report indicates that the bug pattern detector judged that

  1. The class contains a mix of locked and unlocked accesses,
  2. At least one locked access was performed by one of the class's own methods, and
  3. The number of unsynchronized field accesses (reads and writes) was no more than one third of all accesses, with writes being weighed twice as high as reads

A typical bug matching this bug pattern is forgetting to synchronize one of the methods in a class that is intended to be thread-safe.

You can select the nodes labeled "Unsynchronized access" to show the code locations where the detector believed that a field was accessed without synchronization.

Note that there are various sources of inaccuracy in this detector; for example, the detector cannot statically detect all situations in which a lock is held.  Also, even when the detector is accurate in distinguishing locked vs. unlocked accesses, the code in question may still be correct.

This description refers to the "IS2" version of the pattern detector, which has more accurate ways of detecting locked vs. unlocked accesses than the older "IS" detector.

NP_NULL_ON_SOME_PATH: Possible null pointer dereference in method

A reference value dereferenced here might be null at runtime.  This may lead to a NullPointerException when the code is executed.

REC_CATCH_EXCEPTION: java.lang.Exception is caught when Exception is not thrown

This method uses a try-catch block that catches Exception objects, but Exception is not thrown within the try block, and RuntimeException is not explicitly caught. It is a common bug pattern to say try { ... } catch (Exception e) { something } as a shorthand for catching a number of types of exception each of whose catch blocks is identical, but this construct also accidentally catches RuntimeException as well, masking potential bugs.

RR_NOT_CHECKED: Method ignores results of InputStream.read()

This method ignores the return value of one of the variants of java.io.InputStream.read() which can return multiple bytes.  If the return value is not checked, the caller will not be able to correctly handle the case where fewer bytes were read than the caller requested.  This is a particularly insidious kind of bug, because in many programs, reads from input streams usually do read the full amount of data requested, causing the program to fail only sporadically.

SBSC_USE_STRINGBUFFER_CONCATENATION: Method concatenates strings using + in a loop

The method seems to be building a String using concatenation in a loop. In each iteration, the String is converted to a StringBuffer/StringBuilder, appended to, and converted back to a String. This can lead to a cost quadratic in the number of iterations, as the growing string is recopied in each iteration.

Better performance can be obtained by using a StringBuffer (or StringBuilder in Java 1.5) explicitly.

For example:

  // This is bad
  String s = "";
  for (int i = 0; i < field.length; ++i) {
    s = s + field[i];
  }

  // This is better
  StringBuffer buf = new StringBuffer();
  for (int i = 0; i < field.length; ++i) {
    buf.append(field[i]);
  }
  String s = buf.toString();

SC_START_IN_CTOR: Constructor invokes Thread.start()

The constructor starts a thread. This is likely to be wrong if the class is ever extended/subclassed, since the thread will be started before the subclass constructor is started.

SE_BAD_FIELD: Non-transient non-serializable instance field in serializable class

This Serializable class defines a non-primitive instance field which is neither transient, Serializable, or java.lang.Object, and does not appear to implement the Externalizable interface or the readObject() and writeObject() methods.  Objects of this class will not be deserialized correctly if a non-Serializable object is stored in this field.

SIC_INNER_SHOULD_BE_STATIC: Should be a static inner class

This class is an inner class, but does not use its embedded reference to the object which created it.  This reference makes the instances of the class larger, and may keep the reference to the creator object alive longer than necessary.  If possible, the class should be be made static.

SE_NO_SERIALVERSIONID: Class is Serializable, but doesn't define serialVersionUID

This class implements the Serializable interface, but does not define a serialVersionUID field.  A change as simple as adding a reference to a .class object will add synthetic fields to the class, which will unfortunately change the implicit serialVersionUID (e.g., adding a reference to String.class will generate a static field class$java$lang$String). Also, different source code to bytecode compilers may use different naming conventions for synthetic variables generated for references to class objects or inner classes. To ensure interoperability of Serializable across versions, consider adding an explicit serialVersionUID.

UCF_USELESS_CONTROL_FLOW: Useless control flow in method

This method contains a useless control flow statement.  Often, this is caused by inadvertently using an empty statement as the body of an if statement, e.g.:

    if (argv.length == 1);
        System.out.println("Hello, " + argv[0]);

URF_UNREAD_FIELD: Unread field

This field is never read.  Consider removing it from the class.