mx4j 2.0 beta 1 - bugs

Carsten Heyl <[email protected]>
Newsgroups gmane.comp.java.mx4j.devel
Organization Pixelboxx GmbH
Message-ID <[email protected]>
Hi!

To start with: I'm deeply impressed by mx4j, really great work!

I'm playing with mx4j 2.0 beta 1 now and with findbugs 
(http://www.cs.umd.edu/~pugh/java/bugs/).

 From the web page:


  FindBugs - A Bug Pattern Detector for Java

This is the web page for FindBugs, a program which looks for bugs in 
Java code.  It is free software, distributed under the terms of the 
Lesser GNU Public License <http://www.gnu.org/licenses/lgpl.html>.

FindBugs requires JRE (or JDK) 1.4.0 or later to run.  However, it can 
analyze programs compiled for any version of Java.


So I checked mx4j using findbugs and found some bug patterns in the 
code, here some of them:

Dm: javax.management.ObjectName.computeHashCode() invokes dubious 
Boolean constructor; use Boolean.valueOf(...) instead
(15 other Dm found)
EI: javax.management.MBeanInfo.getAttributes() may expose internal 
representation by returning javax.management.MBeanInfo.attributes
EI: javax.management.MBeanServerDelegate.getNotificationInfo() may 
expose internal representation by returning 
javax.management.MBeanServerDelegate.notifications(19 other El)
Could that be used the change the MBean-Servers view of 
attributes/methods/etc. and cause a security problem?

IS2: Inconsistent synchronization of mx4j.timer.TimeQueue.thread; locked 
80% of time
Unsynchronized access at TimeQueue.java:[line 146]
(3 more IS2)

MS: javax.management.openmbean.OpenType.ALLOWED_CLASSNAMES is a mutable 
array
MS: javax.management.relation.RoleInfo.ROLE_CARDINALITY_INFINITY isn't 
final but should be
MS: mx4j.MX4JSystemKeys.MX4J_UNCHECKED_IDENTIFIERS isn't final but should be
MS: mx4j.tools.stats.TimedStatisticsRecorder.timer isn't final but should be

OS: javax.management.loading.MLet.createMBean(mx4j.loading.MLetTag) may 
fail to close stream
OS: mx4j.tools.config.DefaultConfigurationBuilder$Configuration.run() 
may fail to close stream
OS: mx4j.tools.jython.JythonRunner.loadStream(java.io.InputStream) may 
fail to close stream

I love this one (found similar cases in our sources :-):
RV: mx4j.loading.MLetTag.parseArchive() ignores return value of 
java.lang.String.replace(char,char)

SC: 
mx4j.server.MX4JMBeanServer.<init>(String,javax.management.MBeanServer,javax.management.MBeanServerDelegate) 
invokes mx4j.server.interceptor.MBeanServerInterceptorConfigurator.start()

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.

SIC: Should javax.management.monitor.CounterMonitor$CounterInfo be a 
_static_ inner class?
( 3 more)

EXP: Se: Class mx4j.tools.jython.JythonRunner$MessageFilter defines 
non-transient non-serializable instance field 
mx4j.tools.jython.JythonRunner.this$0
EXP: Se: Class mx4j.tools.mail.SMTP$MessageFilter defines non-transient 
non-serializable instance field mx4j.tools.mail.SMTP.this$0

UG: javax.management.monitor.CounterMonitor.getInitThreshold() is 
unsynchronized, 
javax.management.monitor.CounterMonitor.setInitThreshold(Number) is 
synchronized
(4 more)

UW: Unconditional wait in 
mx4j.remote.DefaultRemoteNotificationServerHandler.waitForNotifications(Object,long)
UW: Unconditional wait in mx4j.timer.TimeQueue$Loop.run()

UrF: Unread field: javax.management.BadAttributeValueExpException.val
(16 more)

UuF: Unused field: javax.management.ClassAttributeValueExp.attr

Wa: Wait not in loop in 
mx4j.remote.DefaultRemoteNotificationServerHandler.waitForNotifications(Object,long)


I guess some bug patterns will be false hits but that should be judged 
by a developer!

Thanks for listening and keep on going!

Ciao,
    Carsten Heyl

-- 
  Carsten Heyl				cal (AT) pixelboxx.de




-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.