# FindBugs Report

## Project Information

Project: /export/home/daveho/commons-modeler-1.1/commons-modeler.fb

FindBugs version: 0.8.7

Code analyzed:

- /export/home/daveho/commons-modeler-1.1/commons-modeler.jar

## Contents

- Correctness Warnings
- Internationalization Warnings
- Multithreaded Correctness Warnings
- Malicious Code Vulnerability Warnings
- Performance Warnings
- Style Warnings
- Details

# Warnings

Click on a warning row to see full context information.

## Correctness Warnings

Code | Warning
--- | ---
IL | There is an apparent infinite recursive loop in org.apache.commons.modeler.Registry.setServer(javax.management.MBeanServer).
| Bug type IL_INFINITE_RECURSIVE_LOOP (click for details) In class org.apache.commons.modeler.Registry In method org.apache.commons.modeler.Registry.setServer(javax.management.MBeanServer) At Registry.java:[line 551]
NP | Read of unwritten field in org.apache.commons.modeler.JndiJmx.handleNotification(javax.management.Notification,Object)
| Bug type NP_UNWRITTEN_FIELD (click for details) In class org.apache.commons.modeler.JndiJmx In method org.apache.commons.modeler.JndiJmx.handleNotification(javax.management.Notification,Object) At JndiJmx.java:[line 173]
NP | Read of unwritten field in org.apache.commons.modeler.mbeans.SimpleRemoteConnector.refreshAttributes()
| Bug type NP_UNWRITTEN_FIELD (click for details) In class org.apache.commons.modeler.mbeans.SimpleRemoteConnector In method org.apache.commons.modeler.mbeans.SimpleRemoteConnector.refreshAttributes() At SimpleRemoteConnector.java:[line 312]
NP | Possible null pointer dereference in org.apache.commons.modeler.Registry.findManagedBeans(String)
| Bug type NP_NULL_ON_SOME_PATH (click for details) In class org.apache.commons.modeler.Registry In method org.apache.commons.modeler.Registry.findManagedBeans(String) At Registry.java:[line 507]
NP | Possible null pointer dereference in org.apache.commons.modeler.util.IntrospectionUtils.findMethod(Class,String,Class[])
| Bug type NP_NULL_ON_SOME_PATH (click for details) In class org.apache.commons.modeler.util.IntrospectionUtils In method org.apache.commons.modeler.util.IntrospectionUtils.findMethod(Class,String,Class[]) At IntrospectionUtils.java:[line 858]
UCF | Useless control flow in org.apache.commons.modeler.BaseNotificationBroadcaster.registerNotifications(FixedNotificationFilter)
| Bug type UCF_USELESS_CONTROL_FLOW (click for details) In class org.apache.commons.modeler.BaseNotificationBroadcaster In method org.apache.commons.modeler.BaseNotificationBroadcaster.registerNotifications(FixedNotificationFilter) At BaseNotificationBroadcaster.java:[line 280]
UwF | Unwritten field: org.apache.commons.modeler.JndiJmx.mserver
| Bug type UWF_UNWRITTEN_FIELD (click for details) In class org.apache.commons.modeler.JndiJmx Field org.apache.commons.modeler.JndiJmx.mserver
UwF | Unwritten field: org.apache.commons.modeler.mbeans.SimpleRemoteConnector.mserver
| Bug type UWF_UNWRITTEN_FIELD (click for details) In class org.apache.commons.modeler.mbeans.SimpleRemoteConnector Field org.apache.commons.modeler.mbeans.SimpleRemoteConnector.mserver

## Internationalization Warnings

Code | Warning
--- | ---

## Multithreaded Correctness Warnings

Code | Warning
--- | ---
IS2 | Inconsistent synchronization of org.apache.commons.modeler.Registry.server; locked 66% of time
| Bug type IS2_INCONSISTENT_SYNC (click for details) In class org.apache.commons.modeler.Registry Field org.apache.commons.modeler.Registry.server Synchronized 66% of the time Unsynchronized access at Registry.java:[line 1057] Unsynchronized access at Registry.java:[line 1016] Synchronized access at Registry.java:[line 658] Synchronized access at Registry.java:[line 671] Synchronized access at Registry.java:[line 665] Synchronized access at Registry.java:[line 660]

## Malicious Code Vulnerability Warnings

Code | Warning
--- | ---
EI | org.apache.commons.modeler.ConstructorInfo.getSignature() may expose internal representation by returning org.apache.commons.modeler.ConstructorInfo.parameters
| Bug type EI_EXPOSE_REP (click for details) In class org.apache.commons.modeler.ConstructorInfo In method org.apache.commons.modeler.ConstructorInfo.getSignature() Field org.apache.commons.modeler.ConstructorInfo.parameters At ConstructorInfo.java:[line 139]
EI | org.apache.commons.modeler.ManagedBean.getAttributes() may expose internal representation by returning org.apache.commons.modeler.ManagedBean.attributes
| Bug type EI_EXPOSE_REP (click for details) In class org.apache.commons.modeler.ManagedBean In method org.apache.commons.modeler.ManagedBean.getAttributes() Field org.apache.commons.modeler.ManagedBean.attributes At ManagedBean.java:[line 136]
EI | org.apache.commons.modeler.ManagedBean.getConstructors() may expose internal representation by returning org.apache.commons.modeler.ManagedBean.constructors
| Bug type EI_EXPOSE_REP (click for details) In class org.apache.commons.modeler.ManagedBean In method org.apache.commons.modeler.ManagedBean.getConstructors() Field org.apache.commons.modeler.ManagedBean.constructors At ManagedBean.java:[line 160]
EI | org.apache.commons.modeler.ManagedBean.getNotifications() may expose internal representation by returning org.apache.commons.modeler.ManagedBean.notifications
| Bug type EI_EXPOSE_REP (click for details) In class org.apache.commons.modeler.ManagedBean In method org.apache.commons.modeler.ManagedBean.getNotifications() Field org.apache.commons.modeler.ManagedBean.notifications At ManagedBean.java:[line 230]
EI | org.apache.commons.modeler.ManagedBean.getOperations() may expose internal representation by returning org.apache.commons.modeler.ManagedBean.operations
| Bug type EI_EXPOSE_REP (click for details) In class org.apache.commons.modeler.ManagedBean In method org.apache.commons.modeler.ManagedBean.getOperations() Field org.apache.commons.modeler.ManagedBean.operations At ManagedBean.java:[line 238]
EI | org.apache.commons.modeler.NotificationInfo.getNotifTypes() may expose internal representation by returning org.apache.commons.modeler.NotificationInfo.notifTypes
| Bug type EI_EXPOSE_REP (click for details) In class org.apache.commons.modeler.NotificationInfo In method org.apache.commons.modeler.NotificationInfo.getNotifTypes() Field org.apache.commons.modeler.NotificationInfo.notifTypes At NotificationInfo.java:[line 124]
EI | org.apache.commons.modeler.OperationInfo.getSignature() may expose internal representation by returning org.apache.commons.modeler.OperationInfo.parameters
| Bug type EI_EXPOSE_REP (click for details) In class org.apache.commons.modeler.OperationInfo In method org.apache.commons.modeler.OperationInfo.getSignature() Field org.apache.commons.modeler.OperationInfo.parameters At OperationInfo.java:[line 212]
MS | org.apache.commons.modeler.Registry.MODELER_MANIFEST isn't final but should be
| Bug type MS_SHOULD_BE_FINAL (click for details) In class org.apache.commons.modeler.Registry Field org.apache.commons.modeler.Registry.MODELER_MANIFEST
MS | org.apache.commons.modeler.util.IntrospectionUtils.PATH_SEPARATOR isn't final but should be
| Bug type MS_SHOULD_BE_FINAL (click for details) In class org.apache.commons.modeler.util.IntrospectionUtils Field org.apache.commons.modeler.util.IntrospectionUtils.PATH_SEPARATOR

## Performance Warnings

Code | Warning
--- | ---
Dm | org.apache.commons.modeler.Registry.convertValue(String,String) invokes dubious Boolean constructor; use Boolean.valueOf(...) instead
| Bug type DM_BOOLEAN_CTOR (click for details) In class org.apache.commons.modeler.Registry In method org.apache.commons.modeler.Registry.convertValue(String,String) At Registry.java:[line 761]
Dm | org.apache.commons.modeler.util.IntrospectionUtils.setProperty(Object,String,String) invokes dubious Boolean constructor; use Boolean.valueOf(...) instead
| Bug type DM_BOOLEAN_CTOR (click for details) In class org.apache.commons.modeler.util.IntrospectionUtils In method org.apache.commons.modeler.util.IntrospectionUtils.setProperty(Object,String,String) At IntrospectionUtils.java:[line 347]
UrF | Unread field: org.apache.commons.modeler.ant.MLETTask.archive
| Bug type URF_UNREAD_FIELD (click for details) In class org.apache.commons.modeler.ant.MLETTask Field org.apache.commons.modeler.ant.MLETTask.archive
UrF | Unread field: org.apache.commons.modeler.ant.MLETTask.codebase
| Bug type URF_UNREAD_FIELD (click for details) In class org.apache.commons.modeler.ant.MLETTask Field org.apache.commons.modeler.ant.MLETTask.codebase
UrF | Unread field: org.apache.commons.modeler.ant.ModelerTask.log
| Bug type URF_UNREAD_FIELD (click for details) In class org.apache.commons.modeler.ant.ModelerTask Field org.apache.commons.modeler.ant.ModelerTask.log
UrF | Unread field: org.apache.commons.modeler.ant.RegistryTask.log
| Bug type URF_UNREAD_FIELD (click for details) In class org.apache.commons.modeler.ant.RegistryTask Field org.apache.commons.modeler.ant.RegistryTask.log
UrF | Unread field: org.apache.commons.modeler.BaseNotificationBroadcaster.hookCount
| Bug type URF_UNREAD_FIELD (click for details) In class org.apache.commons.modeler.BaseNotificationBroadcaster Field org.apache.commons.modeler.BaseNotificationBroadcaster.hookCount
UrF | Unread field: org.apache.commons.modeler.mbeans.SimpleRemoteConnector.prefix
| Bug type URF_UNREAD_FIELD (click for details) In class org.apache.commons.modeler.mbeans.SimpleRemoteConnector Field org.apache.commons.modeler.mbeans.SimpleRemoteConnector.prefix
UrF | Unread field: org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource.type
| Bug type URF_UNREAD_FIELD (click for details) In class org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource Field org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource.type
UrF | Unread field: org.apache.commons.modeler.modules.MbeansDescriptorsSerSource.type
| Bug type URF_UNREAD_FIELD (click for details) In class org.apache.commons.modeler.modules.MbeansDescriptorsSerSource Field org.apache.commons.modeler.modules.MbeansDescriptorsSerSource.type
UrF | Unread field: org.apache.commons.modeler.modules.MbeansSource.type
| Bug type URF_UNREAD_FIELD (click for details) In class org.apache.commons.modeler.modules.MbeansSource Field org.apache.commons.modeler.modules.MbeansSource.type
UrF | Unread field: org.apache.commons.modeler.Registry.key
| Bug type URF_UNREAD_FIELD (click for details) In class org.apache.commons.modeler.Registry Field org.apache.commons.modeler.Registry.key
UuF | Unused field: org.apache.commons.modeler.ant.MLETTask.loaderRef
| Bug type UUF_UNUSED_FIELD (click for details) In class org.apache.commons.modeler.ant.MLETTask Field org.apache.commons.modeler.ant.MLETTask.loaderRef
UuF | Unused field: org.apache.commons.modeler.mbeans.SimpleRemoteConnector.localDomain
| Bug type UUF_UNUSED_FIELD (click for details) In class org.apache.commons.modeler.mbeans.SimpleRemoteConnector Field org.apache.commons.modeler.mbeans.SimpleRemoteConnector.localDomain
WMI | Method org.apache.commons.modeler.mbeans.SimpleRemoteConnector.refreshAttributes() makes inefficient use of keySet iterator instead of entrySet iterator
| Bug type WMI_WRONG_MAP_ITERATOR (click for details) In class org.apache.commons.modeler.mbeans.SimpleRemoteConnector In method org.apache.commons.modeler.mbeans.SimpleRemoteConnector.refreshAttributes() At SimpleRemoteConnector.java:[line 272]

## Style Warnings

Code | Warning
--- | ---
CD | Class org.apache.commons.modeler.mbeans.SimpleRemoteConnector has a circular dependency with other classes.
| Bug type CD_CIRCULAR_DEPENDENCY (click for details) In class org.apache.commons.modeler.mbeans.SimpleRemoteConnector In class org.apache.commons.modeler.mbeans.MBeanProxy
DLS | Dead store to local variable in method org.apache.commons.modeler.BaseModelMBean.setAttributes(javax.management.AttributeList)
| Bug type DLS_DEAD_LOCAL_STORE (click for details) In class org.apache.commons.modeler.BaseModelMBean In method org.apache.commons.modeler.BaseModelMBean.setAttributes(javax.management.AttributeList) At BaseModelMBean.java:[line 723]
REC | Method org.apache.commons.modeler.modules.MbeansSource.execute() catches Exception, but Exception is not thrown in the try block and RuntimeException is not explicitly caught
| Bug type REC_CATCH_EXCEPTION (click for details) In class org.apache.commons.modeler.modules.MbeansSource In method org.apache.commons.modeler.modules.MbeansSource.execute() At MbeansSource.java:[line 226]
REC | Method org.apache.commons.modeler.modules.MbeansSource.execute() catches Exception, but Exception is not thrown in the try block and RuntimeException is not explicitly caught
| Bug type REC_CATCH_EXCEPTION (click for details) In class org.apache.commons.modeler.modules.MbeansSource In method org.apache.commons.modeler.modules.MbeansSource.execute() At MbeansSource.java:[line 250]
REC | Method org.apache.commons.modeler.util.IntrospectionUtils.setProperty(Object,String) catches Exception, but Exception is not thrown in the try block and RuntimeException is not explicitly caught
| Bug type REC_CATCH_EXCEPTION (click for details) In class org.apache.commons.modeler.util.IntrospectionUtils In method org.apache.commons.modeler.util.IntrospectionUtils.setProperty(Object,String) At IntrospectionUtils.java:[line 479]

# Details

## 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.

## DLS_DEAD_LOCAL_STORE: Dead store to local variable

This instruction assigns a value to a local variable, but the value is not read by any subsequent instruction. Often, this indicates an error, because the value computed is never used.

## DM_BOOLEAN_CTOR: Method invokes dubious Boolean constructor; use Boolean.valueOf(...) instead

Creating new instances of `java.lang.Boolean` wastes memory, since `Boolean` objects are immutable and there are only two useful values of this type. Use the `Boolean.valueOf()` method to create `Boolean` objects instead.

## 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.

## IL_INFINITE_RECURSIVE_LOOP: An apparent infinite recursive loop.

This method unconditionally invokes itself. This would seem to indicate an infinite recursive loop that will result in a stack overflow.

## 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.

## MS_SHOULD_BE_FINAL: Field isn't final but should be

A mutable static field could be changed by malicious code or by accident from another package. The field could be made final to avoid this vulnerability.

## 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.

## NP_UNWRITTEN_FIELD: Read of unwritten field

The program is deferencing a field that does not seem to ever be written to. Deferencing this value will generate a null pointer exception.

## 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.

## 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.

## UUF_UNUSED_FIELD: Unused field

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

## UWF_UNWRITTEN_FIELD: Unwritten field

This field is never written. All reads of it will return the default value. Check for errors (should it have been initialized?), or remove it if it is useless.

## WMI_WRONG_MAP_ITERATOR: Inefficient use of keySet iterator instead of entrySet iterator

This method accesses the value of a Map entry, using a key that was retrieved from a keySet iterator. It is more efficient to use an iterator on the entrySet of the map, to avoid the Map.get(key) lookup.