Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
10.5.1.1
-
None
-
OS: Windows XP
-
Normal
Description
I found some synchronized setter methods and unsynchronized similarly-named getter methods in class ClientBaseDataSource as follow:
public abstract class ClientBaseDataSource implements Serializable, Referenceable {
...
synchronized public void setTraceLevel(int traceLevel)
public int getTraceLevel()
{ return this.traceLevel; }..
}
Consequence:
traceLevel is not declared volatile, the Java Memory Model doesn't guarantee up-to-date field value visible to threads in the absent of synchronization. So if the getTraceLevel() method is called, it could read stale or inconsistent values, which could cause serious problems.
Quick-fix solution:
synchronize getTraceLevel() method