|
This declares a volatile reference to an array, which might not be what
you want. With a volatile reference to an array, reads and writes of
the reference to the array are treated as volatile, but the array elements
are non-volatile. To get volatile array elements, you will need to use
one of the atomic array classes in java.util.concurrent (provided
in Java 5.0).
Repository: findbugs
Key: VO_VOLATILE_REFERENCE_TO_ARRAY
Available since 07 Jan 2014
|
|
Even though the JavaDoc does not contain a hint about it, Calendars are inherently unsafe for multihtreaded use.
The detector has found a call to an instance of Calendar that has been obtained via a static
field. This looks suspicous.
For more information on this see Sun Bug #6231579
and Sun Bug #6178997.
Repository: findbugs
Key: STCAL_INVOKE_ON_STATIC_CALENDAR_INSTANCE
Available since 07 Jan 2014
|
|
As the JavaDoc states, DateFormats are inherently unsafe for multithreaded use.
The detector has found a call to an instance of DateFormat that has been obtained via a static
field. This looks suspicous.
For more information on this see Sun Bug #6231579
and Sun Bug #6178997.
Repository: findbugs
Key: STCAL_INVOKE_ON_STATIC_DATE_FORMAT_INSTANCE
Available since 07 Jan 2014
|
|
This serializable class defines a readObject() which is
synchronized. By definition, an object created by deserialization
is only reachable by one thread, and thus there is no need for
readObject() to be synchronized. If the readObject()
method itself is causing the object to become visible to another thread,
that is an example of very dubious coding style.
Repository: findbugs
Key: RS_READOBJECT_SYNC
Available since 07 Jan 2014
|
|
This class has a writeObject() method which is synchronized;
however, no other method of the class is synchronized.
Repository: findbugs
Key: WS_WRITEOBJECT_SYNC
Available since 07 Jan 2014
|
|
This method contains a call to java.util.concurrent.await()
(or variants)
which is not in a loop. If the object is used for multiple conditions,
the condition the caller intended to wait for might not be the one
that actually occurred.
Repository: findbugs
Key: WA_AWAIT_NOT_IN_LOOP
Available since 07 Jan 2014
|
|
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.
Repository: findbugs
Key: SC_START_IN_CTOR
Available since 07 Jan 2014
|
|
The code contains an empty synchronized block:
synchronized() {}
Empty synchronized blocks are far more subtle and hard to use correctly
than most people recognize, and empty synchronized blocks
are almost never a better solution
than less contrived solutions.
Repository: findbugs
Key: ESync_EMPTY_SYNC
Available since 07 Jan 2014
|
|
This field is annotated with net.jcip.annotations.GuardedBy,
but can be accessed in a way that seems to violate the annotation.
Repository: findbugs
Key: IS_FIELD_NOT_GUARDED
Available since 07 Jan 2014
|
|
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
- The class contains a mix of locked and unlocked accesses,
- At least one locked access was performed by one of the class's own methods, and
- 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.
Repository: findbugs
Key: IS2_INCONSISTENT_SYNC
Available since 07 Jan 2014
|
|
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
- The class contains a mix of locked and unlocked accesses,
- At least one locked access was performed by one of the class's own methods, and
- 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.
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.
Repository: findbugs
Key: IS_INCONSISTENT_SYNC
Available since 07 Jan 2014
|
|
This method contains an unsynchronized lazy initialization of a static field.
After the field is set, the object stored into that location is further accessed.
The setting of the field is visible to other threads as soon as it is set. If the
futher accesses in the method that set the field serve to initialize the object, then
you have a very serious multithreading bug, unless something else prevents
any other thread from accessing the stored object until it is fully initialized.
Repository: findbugs
Key: LI_LAZY_INIT_UPDATE_STATIC
Available since 07 Jan 2014
|
|
This method contains an unsynchronized lazy initialization of a non-volatile static field.
Because the compiler or processor may reorder instructions,
threads are not guaranteed to see a completely initialized object,
if the method can be called by multiple threads.
You can make the field volatile to correct the problem.
For more information, see the
Java Memory Model web site.
Repository: findbugs
Key: LI_LAZY_INIT_STATIC
Available since 07 Jan 2014
|
|
Deprecated
This method explicitly invokes run() on an object.
In general, classes implement the Runnable interface because
they are going to have their run() method invoked in a new thread,
in which case Thread.start() is the right method to call.
This rule is deprecated, use squid:S1217 instead.
Repository: findbugs
Key: RU_INVOKE_RUN
Available since 07 Jan 2014
|
|
This method calls Thread.sleep() with a lock held. This may result
in very poor performance and scalability, or a deadlock, since other threads may
be waiting to acquire the lock. It is a much better idea to call
wait() on the lock, which releases the lock and allows other threads
to run.
Repository: findbugs
Key: SWL_SLEEP_WITH_LOCK_HELD
Available since 07 Jan 2014
|
|
This method acquires a JSR-166 (java.util.concurrent ) lock,
but does not release it on all exception paths out of the method. In general, the correct idiom
for using a JSR-166 lock is:
Lock l = ...;
l.lock();
try {
// do something
} finally {
l.unlock();
}
Repository: findbugs
Key: UL_UNRELEASED_LOCK_EXCEPTION_PATH
Available since 07 Jan 2014
|
|
This method acquires a JSR-166 (java.util.concurrent ) lock,
but does not release it on all paths out of the method. In general, the correct idiom
for using a JSR-166 lock is:
Lock l = ...;
l.lock();
try {
// do something
} finally {
l.unlock();
}
Repository: findbugs
Key: UL_UNRELEASED_LOCK
Available since 07 Jan 2014
|
|
This method spins in a loop which reads a field. The compiler
may legally hoist the read out of the loop, turning the code into an
infinite loop. The class should be changed so it uses proper
synchronization (including wait and notify calls).
Repository: findbugs
Key: SP_SPIN_ON_FIELD
Available since 07 Jan 2014
|
|
This method synchronizes on an object
referenced from a mutable field.
This is unlikely to have useful semantics, since different
threads may be synchronizing on different objects.
Repository: findbugs
Key: ML_SYNC_ON_UPDATED_FIELD
Available since 07 Jan 2014
|
|
This method calls Object.notify() or Object.notifyAll() without obviously holding a lock
on the object. Calling notify() or notifyAll() without a lock held will result in
an IllegalMonitorStateException being thrown.
Repository: findbugs
Key: MWN_MISMATCHED_NOTIFY
Available since 07 Jan 2014
|
|
This method calls Object.wait() without obviously holding a lock
on the object. Calling wait() without a lock held will result in
an IllegalMonitorStateException being thrown.
Repository: findbugs
Key: MWN_MISMATCHED_WAIT
Available since 07 Jan 2014
|
|
This method calls wait() on a
java.util.concurrent.locks.Condition object.
Waiting for a Condition should be done using one of the await()
methods defined by the Condition interface.
Repository: findbugs
Key: DM_MONITOR_WAIT_ON_CONDITION
Available since 07 Jan 2014
|
|
A web server generally only creates one instance of servlet or jsp class (i.e., treats
the class as a Singleton),
and will
have multiple threads invoke methods on that instance to service multiple
simultaneous requests.
Thus, having a mutable instance field generally creates race conditions.
Repository: findbugs
Key: MSF_MUTABLE_SERVLET_FIELD
Available since 07 Jan 2014
|
|
A call to notify() or notifyAll()
was made without any (apparent) accompanying
modification to mutable object state. In general, calling a notify
method on a monitor is done because some condition another thread is
waiting for has become true. However, for the condition to be meaningful,
it must involve a heap object that is visible to both threads.
This bug does not necessarily indicate an error, since the change to
mutable object state may have taken place in a method which then called
the method containing the notification.
Repository: findbugs
Key: NN_NAKED_NOTIFY
Available since 07 Jan 2014
|
|
Repository: findbugs
Key: DC_DOUBLECHECK
Available since 07 Jan 2014
|