I refer to this JIRA issue:
http://java.net/jira/browse/JMS_SPEC-98
Whilst testing the JMS 2.0 RI the Oracle code police detected that the JMS 2.0 API classes cause a number of findbugs
warnings in some Java classes defined in JMS.
(Findbugs is an excellent Java static analysis tool, at
http://findbugs.sourceforge.net).
Three of these relate to JMS 1.1 code, one to JMS 2.0 code.
----------------------------------------------------------------------------------------------------------------------
javax/jms/JMSException.java:86: UG_SYNC_SET_UNSYNC_GET:
javax.jms.JMSException.getLinkedException() is unsynchronized,
javax.jms.JMSException.setLinkedException(Exception) is synchronized
javax/jms/JMSRuntimeException.java:118: UG_SYNC_SET_UNSYNC_GET:
javax.jms.JMSRuntimeException.getLinkedException() is unsynchronized,
javax.jms.JMSRuntimeException.setLinkedException(Exception) is synchronized
This is because of following setter method is synchronized, whereas the corresponding getter method is not.
public synchronized void setLinkedException(Exception ex) {
linkedException = ex;
}
public Exception getLinkedException() {
return (linkedException);
}
To avoid this warning we would need to either remove the synchronized keyword or add it to both. Since
setLinkedException(Exception ex) will be called before the method is thrown I don't think this method normally needs to
be threadsafe (and I've taken advice from the JDK team to confirm this is a reasonable assumption) so I propose to
simply remove synchronized from setLinkedException.
----------------------------------------------------------------------------------------------------------------------
javax/jms/QueueRequestor.java:62: URF_UNREAD_FIELD:
Unread field: javax.jms.QueueRequestor.queue
java/javax/jms/TopicRequestor.java:61: URF_UNREAD_FIELD: Unread field:
javax.jms.TopicRequestor.topic
This is because a method sets a field but never uses it.
To avoid this warning I propose we simply remove the field.
----------------------------------------------------------------------------------------------------------------------
I trust this is non-controversial, so I am going to go ahead with this change, but let me know if you have questions,
comments, or objections.
Nigel