Details
-
Sub-task
-
Status: Closed
-
Minor
-
Resolution: Implemented
-
Trunk
-
None
Description
DBCPConnectionFactory.java:169, SIO_SUPERFLUOUS_INSTANCEOF
- SIO: org.apache.ofbiz.entity.connection.DBCPConnectionFactory.getDataSourceInfo(String) does an unnecessary type check using instanceof operator when it can be determined statically
Type check performed using the instanceof operator where it can be statically determined whether the object is of the type requested.
DBCPConnectionFactory.java:169, BC_VACUOUS_INSTANCEOF
- BC: instanceof will always return true for all nonnull values in org.apache.ofbiz.entity.connection.DBCPConnectionFactory.getDataSourceInfo(String), since all org.apache.ofbiz.entity.connection.DebugManagedDataSource are instances of org.apache.ofbiz.entity.connection.DebugManagedDataSource
This instanceof test will always return true (unless the value being tested is null). Although this is safe, make sure it isn't an indication of some misunderstanding or some other logic error. If you really want to test the value for being null, perhaps it would be clearer to do better to do a null test rather than an instanceof test.