Project Information
Project:
ActiveMQ :: Performance Test Plugin
SpotBugs version: 4.8.3
Code analyzed:
- /home/ubuntu/HW4/activemq-parent-5.15.0/activemq-tooling/activemq-perf-maven-plugin/target/classes
Metrics
2513 lines of code analyzed,
in 46 classes,
in 8 packages.
High Priority Warnings |
6 |
2.39 |
Medium Priority Warnings |
52 |
20.69 |
Total Warnings
|
58
|
23.08
|
(* Defects per Thousand lines of non-commenting source statements)
Contents
Summary
Warnings
Click on a warning row to see full context information.
RV
|
Exceptional return value of java.io.File.mkdirs() ignored in org.apache.activemq.maven.ServerMojo.execute() |
|
Bug type RV_RETURN_VALUE_IGNORED_BAD_PRACTICE (click for details)
In class org.apache.activemq.maven.ServerMojo In method org.apache.activemq.maven.ServerMojo.execute() Called method java.io.File.mkdirs() At ServerMojo.java:[line 83]
|
Dm
|
Found reliance on default encoding in org.apache.activemq.tool.JmsProducerClient.buildText(String, int): new String(byte[]) |
|
Bug type DM_DEFAULT_ENCODING (click for details)
In class org.apache.activemq.tool.JmsProducerClient In method org.apache.activemq.tool.JmsProducerClient.buildText(String, int) Called method new String(byte[]) At JmsProducerClient.java:[line 347]
|
Dm
|
Found reliance on default encoding in org.apache.activemq.tool.JmsProducerClient.loadJmsMessage(): new java.io.FileReader(File) |
|
Bug type DM_DEFAULT_ENCODING (click for details)
In class org.apache.activemq.tool.JmsProducerClient In method org.apache.activemq.tool.JmsProducerClient.loadJmsMessage() Called method new java.io.FileReader(File) At JmsProducerClient.java:[line 380]
|
Dm
|
Found reliance on default encoding in org.apache.activemq.tool.reports.XmlFilePerfReportWriter.openReportWriter(): new java.io.PrintWriter(OutputStream, boolean) |
|
Bug type DM_DEFAULT_ENCODING (click for details)
In class org.apache.activemq.tool.reports.XmlFilePerfReportWriter In method org.apache.activemq.tool.reports.XmlFilePerfReportWriter.openReportWriter() Called method new java.io.PrintWriter(OutputStream, boolean) At XmlFilePerfReportWriter.java:[line 75]
|
Dm
|
Found reliance on default encoding in org.apache.activemq.tool.reports.XmlFilePerfReportWriter.writeToXml(): new java.io.PrintWriter(OutputStream) |
|
Bug type DM_DEFAULT_ENCODING (click for details)
In class org.apache.activemq.tool.reports.XmlFilePerfReportWriter In method org.apache.activemq.tool.reports.XmlFilePerfReportWriter.writeToXml() Called method new java.io.PrintWriter(OutputStream) At XmlFilePerfReportWriter.java:[line 154]
|
Dm
|
Found reliance on default encoding in org.apache.activemq.tool.reports.XmlFilePerfReportWriter.writeXmlLogFile(): new java.io.InputStreamReader(InputStream) |
|
Bug type DM_DEFAULT_ENCODING (click for details)
In class org.apache.activemq.tool.reports.XmlFilePerfReportWriter In method org.apache.activemq.tool.reports.XmlFilePerfReportWriter.writeXmlLogFile() Called method new java.io.InputStreamReader(InputStream) At XmlFilePerfReportWriter.java:[line 199]
|
Dm
|
Found reliance on default encoding in org.apache.activemq.tool.sampler.plugins.LinuxCpuSamplerPlugin.run(): new java.io.InputStreamReader(InputStream) |
|
Bug type DM_DEFAULT_ENCODING (click for details)
In class org.apache.activemq.tool.sampler.plugins.LinuxCpuSamplerPlugin In method org.apache.activemq.tool.sampler.plugins.LinuxCpuSamplerPlugin.run() Called method new java.io.InputStreamReader(InputStream) At LinuxCpuSamplerPlugin.java:[line 56]
|
DP
|
org.apache.activemq.tool.spi.ClassLoaderSPIConnectionFactory.getContextClassLoader(Properties) creates a java.net.URLClassLoader classloader, which should be performed within a doPrivileged block |
|
Bug type DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED (click for details)
In class org.apache.activemq.tool.spi.ClassLoaderSPIConnectionFactory In method org.apache.activemq.tool.spi.ClassLoaderSPIConnectionFactory.getContextClassLoader(Properties) In class java.net.URLClassLoader At ClassLoaderSPIConnectionFactory.java:[line 79]
|
EI
|
org.apache.activemq.tool.AbstractJmsClient.getConnection() may expose internal representation by returning AbstractJmsClient.jmsConnection |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.AbstractJmsClient In method org.apache.activemq.tool.AbstractJmsClient.getConnection() Field org.apache.activemq.tool.AbstractJmsClient.jmsConnection At AbstractJmsClient.java:[line 95]
|
EI
|
org.apache.activemq.tool.AbstractJmsClient.getSession() may expose internal representation by returning AbstractJmsClient.jmsSession |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.AbstractJmsClient In method org.apache.activemq.tool.AbstractJmsClient.getSession() Field org.apache.activemq.tool.AbstractJmsClient.jmsSession At AbstractJmsClient.java:[line 114]
|
EI
|
org.apache.activemq.tool.AbstractJmsClientSystem.getTpSampler() may expose internal representation by returning AbstractJmsClientSystem.tpSampler |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.AbstractJmsClientSystem In method org.apache.activemq.tool.AbstractJmsClientSystem.getTpSampler() Field org.apache.activemq.tool.AbstractJmsClientSystem.tpSampler At AbstractJmsClientSystem.java:[line 157]
|
EI
|
org.apache.activemq.tool.JmsConsumerClient.createJmsConsumer(Destination) may expose internal representation by returning JmsConsumerClient.jmsConsumer |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.JmsConsumerClient In method org.apache.activemq.tool.JmsConsumerClient.createJmsConsumer(Destination) Field org.apache.activemq.tool.JmsConsumerClient.jmsConsumer At JmsConsumerClient.java:[line 242]
|
EI
|
org.apache.activemq.tool.JmsConsumerClient.createJmsConsumer(Destination, String, boolean) may expose internal representation by returning JmsConsumerClient.jmsConsumer |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.JmsConsumerClient In method org.apache.activemq.tool.JmsConsumerClient.createJmsConsumer(Destination, String, boolean) Field org.apache.activemq.tool.JmsConsumerClient.jmsConsumer At JmsConsumerClient.java:[line 258]
|
EI
|
org.apache.activemq.tool.JmsConsumerClient.getClient() may expose internal representation by returning JmsConsumerClient.client |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.JmsConsumerClient In method org.apache.activemq.tool.JmsConsumerClient.getClient() Field org.apache.activemq.tool.JmsConsumerClient.client At JmsConsumerClient.java:[line 267]
|
EI
|
org.apache.activemq.tool.JmsConsumerClient.getJmsConsumer() may expose internal representation by returning JmsConsumerClient.jmsConsumer |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.JmsConsumerClient In method org.apache.activemq.tool.JmsConsumerClient.getJmsConsumer() Field org.apache.activemq.tool.JmsConsumerClient.jmsConsumer At JmsConsumerClient.java:[line 262]
|
EI
|
org.apache.activemq.tool.JmsConsumerSystem.getConsumer() may expose internal representation by returning JmsConsumerSystem.consumer |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.JmsConsumerSystem In method org.apache.activemq.tool.JmsConsumerSystem.getConsumer() Field org.apache.activemq.tool.JmsConsumerSystem.consumer At JmsConsumerSystem.java:[line 44]
|
EI
|
org.apache.activemq.tool.JmsConsumerSystem.getSysTest() may expose internal representation by returning JmsConsumerSystem.sysTest |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.JmsConsumerSystem In method org.apache.activemq.tool.JmsConsumerSystem.getSysTest() Field org.apache.activemq.tool.JmsConsumerSystem.sysTest At JmsConsumerSystem.java:[line 32]
|
EI
|
org.apache.activemq.tool.JmsProducerClient.createJmsProducer() may expose internal representation by returning JmsProducerClient.jmsProducer |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.JmsProducerClient In method org.apache.activemq.tool.JmsProducerClient.createJmsProducer() Field org.apache.activemq.tool.JmsProducerClient.jmsProducer At JmsProducerClient.java:[line 265]
|
EI
|
org.apache.activemq.tool.JmsProducerClient.createJmsProducer(Destination) may expose internal representation by returning JmsProducerClient.jmsProducer |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.JmsProducerClient In method org.apache.activemq.tool.JmsProducerClient.createJmsProducer(Destination) Field org.apache.activemq.tool.JmsProducerClient.jmsProducer At JmsProducerClient.java:[line 280]
|
EI
|
org.apache.activemq.tool.JmsProducerClient.createJmsTextMessage(int) may expose internal representation by returning JmsProducerClient.jmsTextMessage |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.JmsProducerClient In method org.apache.activemq.tool.JmsProducerClient.createJmsTextMessage(int) Field org.apache.activemq.tool.JmsProducerClient.jmsTextMessage At JmsProducerClient.java:[line 304]
|
EI
|
org.apache.activemq.tool.JmsProducerClient.createJmsTextMessage(String) may expose internal representation by returning JmsProducerClient.jmsTextMessage |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.JmsProducerClient In method org.apache.activemq.tool.JmsProducerClient.createJmsTextMessage(String) Field org.apache.activemq.tool.JmsProducerClient.jmsTextMessage At JmsProducerClient.java:[line 309]
|
EI
|
org.apache.activemq.tool.JmsProducerClient.getClient() may expose internal representation by returning JmsProducerClient.client |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.JmsProducerClient In method org.apache.activemq.tool.JmsProducerClient.getClient() Field org.apache.activemq.tool.JmsProducerClient.client At JmsProducerClient.java:[line 318]
|
EI
|
org.apache.activemq.tool.JmsProducerClient.getJmsProducer() may expose internal representation by returning JmsProducerClient.jmsProducer |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.JmsProducerClient In method org.apache.activemq.tool.JmsProducerClient.getJmsProducer() Field org.apache.activemq.tool.JmsProducerClient.jmsProducer At JmsProducerClient.java:[line 284]
|
EI
|
org.apache.activemq.tool.JmsProducerClient.getJmsTextMessage() may expose internal representation by returning JmsProducerClient.jmsTextMessage |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.JmsProducerClient In method org.apache.activemq.tool.JmsProducerClient.getJmsTextMessage() Field org.apache.activemq.tool.JmsProducerClient.jmsTextMessage At JmsProducerClient.java:[line 313]
|
EI
|
org.apache.activemq.tool.JmsProducerSystem.getProducer() may expose internal representation by returning JmsProducerSystem.producer |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.JmsProducerSystem In method org.apache.activemq.tool.JmsProducerSystem.getProducer() Field org.apache.activemq.tool.JmsProducerSystem.producer At JmsProducerSystem.java:[line 47]
|
EI
|
org.apache.activemq.tool.JmsProducerSystem.getSysTest() may expose internal representation by returning JmsProducerSystem.sysTest |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.JmsProducerSystem In method org.apache.activemq.tool.JmsProducerSystem.getSysTest() Field org.apache.activemq.tool.JmsProducerSystem.sysTest At JmsProducerSystem.java:[line 33]
|
EI
|
org.apache.activemq.tool.properties.JmsFactoryProperties.getFactorySettings() may expose internal representation by returning JmsFactoryProperties.factorySettings |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.properties.JmsFactoryProperties In method org.apache.activemq.tool.properties.JmsFactoryProperties.getFactorySettings() Field org.apache.activemq.tool.properties.JmsFactoryProperties.factorySettings At JmsFactoryProperties.java:[line 32]
|
EI
|
org.apache.activemq.tool.sampler.AbstractPerformanceSampler.getPerfReportWriter() may expose internal representation by returning AbstractPerformanceSampler.perfReportWriter |
|
Bug type EI_EXPOSE_REP (click for details)
In class org.apache.activemq.tool.sampler.AbstractPerformanceSampler In method org.apache.activemq.tool.sampler.AbstractPerformanceSampler.getPerfReportWriter() Field org.apache.activemq.tool.sampler.AbstractPerformanceSampler.perfReportWriter At AbstractPerformanceSampler.java:[line 112]
|
EI2
|
new org.apache.activemq.tool.JmsConsumerClient(JmsConsumerProperties, ConnectionFactory) may expose internal representation by storing an externally mutable object into JmsConsumerClient.client |
|
Bug type EI_EXPOSE_REP2 (click for details)
In class org.apache.activemq.tool.JmsConsumerClient In method new org.apache.activemq.tool.JmsConsumerClient(JmsConsumerProperties, ConnectionFactory) Field org.apache.activemq.tool.JmsConsumerClient.client Local variable named clientProps At JmsConsumerClient.java:[line 47]
|
EI2
|
org.apache.activemq.tool.JmsConsumerClient.setClient(JmsClientProperties) may expose internal representation by storing an externally mutable object into JmsConsumerClient.client |
|
Bug type EI_EXPOSE_REP2 (click for details)
In class org.apache.activemq.tool.JmsConsumerClient In method org.apache.activemq.tool.JmsConsumerClient.setClient(JmsClientProperties) Field org.apache.activemq.tool.JmsConsumerClient.client Local variable named clientProps At JmsConsumerClient.java:[line 272]
|
EI2
|
org.apache.activemq.tool.JmsConsumerSystem.setConsumer(JmsConsumerProperties) may expose internal representation by storing an externally mutable object into JmsConsumerSystem.consumer |
|
Bug type EI_EXPOSE_REP2 (click for details)
In class org.apache.activemq.tool.JmsConsumerSystem In method org.apache.activemq.tool.JmsConsumerSystem.setConsumer(JmsConsumerProperties) Field org.apache.activemq.tool.JmsConsumerSystem.consumer Local variable named consumer At JmsConsumerSystem.java:[line 48]
|
EI2
|
org.apache.activemq.tool.JmsConsumerSystem.setSysTest(JmsClientSystemProperties) may expose internal representation by storing an externally mutable object into JmsConsumerSystem.sysTest |
|
Bug type EI_EXPOSE_REP2 (click for details)
In class org.apache.activemq.tool.JmsConsumerSystem In method org.apache.activemq.tool.JmsConsumerSystem.setSysTest(JmsClientSystemProperties) Field org.apache.activemq.tool.JmsConsumerSystem.sysTest Local variable named sysTestProps At JmsConsumerSystem.java:[line 36]
|
EI2
|
new org.apache.activemq.tool.JmsProducerClient(JmsProducerProperties, ConnectionFactory) may expose internal representation by storing an externally mutable object into JmsProducerClient.client |
|
Bug type EI_EXPOSE_REP2 (click for details)
In class org.apache.activemq.tool.JmsProducerClient In method new org.apache.activemq.tool.JmsProducerClient(JmsProducerProperties, ConnectionFactory) Field org.apache.activemq.tool.JmsProducerClient.client Local variable named clientProps At JmsProducerClient.java:[line 53]
|
EI2
|
org.apache.activemq.tool.JmsProducerClient.setClient(JmsClientProperties) may expose internal representation by storing an externally mutable object into JmsProducerClient.client |
|
Bug type EI_EXPOSE_REP2 (click for details)
In class org.apache.activemq.tool.JmsProducerClient In method org.apache.activemq.tool.JmsProducerClient.setClient(JmsClientProperties) Field org.apache.activemq.tool.JmsProducerClient.client Local variable named clientProps At JmsProducerClient.java:[line 323]
|
EI2
|
org.apache.activemq.tool.JmsProducerSystem.setProducer(JmsProducerProperties) may expose internal representation by storing an externally mutable object into JmsProducerSystem.producer |
|
Bug type EI_EXPOSE_REP2 (click for details)
In class org.apache.activemq.tool.JmsProducerSystem In method org.apache.activemq.tool.JmsProducerSystem.setProducer(JmsProducerProperties) Field org.apache.activemq.tool.JmsProducerSystem.producer Local variable named producer At JmsProducerSystem.java:[line 51]
|
EI2
|
org.apache.activemq.tool.JmsProducerSystem.setSysTest(JmsClientSystemProperties) may expose internal representation by storing an externally mutable object into JmsProducerSystem.sysTest |
|
Bug type EI_EXPOSE_REP2 (click for details)
In class org.apache.activemq.tool.JmsProducerSystem In method org.apache.activemq.tool.JmsProducerSystem.setSysTest(JmsClientSystemProperties) Field org.apache.activemq.tool.JmsProducerSystem.sysTest Local variable named sysTestProps At JmsProducerSystem.java:[line 38]
|
EI2
|
org.apache.activemq.tool.sampler.AbstractPerformanceSampler.setPerfReportWriter(PerformanceReportWriter) may expose internal representation by storing an externally mutable object into AbstractPerformanceSampler.perfReportWriter |
|
Bug type EI_EXPOSE_REP2 (click for details)
In class org.apache.activemq.tool.sampler.AbstractPerformanceSampler In method org.apache.activemq.tool.sampler.AbstractPerformanceSampler.setPerfReportWriter(PerformanceReportWriter) Field org.apache.activemq.tool.sampler.AbstractPerformanceSampler.perfReportWriter Local variable named perfReportWriter At AbstractPerformanceSampler.java:[line 117]
|
EI2
|
new org.apache.activemq.tool.sampler.RampDownNotifier(PerformanceSampler) may expose internal representation by storing an externally mutable object into RampDownNotifier.sampler |
|
Bug type EI_EXPOSE_REP2 (click for details)
In class org.apache.activemq.tool.sampler.RampDownNotifier In method new org.apache.activemq.tool.sampler.RampDownNotifier(PerformanceSampler) Field org.apache.activemq.tool.sampler.RampDownNotifier.sampler Local variable named sampler At RampDownNotifier.java:[line 27]
|
JLM
|
Synchronization performed on java.util.concurrent.atomic.AtomicInteger in org.apache.activemq.tool.JmsConsumerClient.receiveAsyncCountBasedMessages(long) |
|
Bug type JLM_JSR166_UTILCONCURRENT_MONITORENTER (click for details)
In class org.apache.activemq.tool.JmsConsumerClient In method org.apache.activemq.tool.JmsConsumerClient.receiveAsyncCountBasedMessages(long) Type java.util.concurrent.atomic.AtomicInteger Value loaded from recvCount At JmsConsumerClient.java:[line 196]
|
JLM
|
Synchronization performed on java.util.concurrent.atomic.AtomicInteger in org.apache.activemq.tool.JmsConsumerClient$2.onMessage(Message) |
|
Bug type JLM_JSR166_UTILCONCURRENT_MONITORENTER (click for details)
In class org.apache.activemq.tool.JmsConsumerClient$2 In method org.apache.activemq.tool.JmsConsumerClient$2.onMessage(Message) Type java.util.concurrent.atomic.AtomicInteger Value loaded from field org.apache.activemq.tool.JmsConsumerClient$2.val$recvCount At JmsConsumerClient.java:[line 179]
|
UW
|
Unconditional wait in org.apache.activemq.tool.JmsConsumerClient.receiveAsyncCountBasedMessages(long) |
|
Bug type UW_UNCOND_WAIT (click for details)
In class org.apache.activemq.tool.JmsConsumerClient In method org.apache.activemq.tool.JmsConsumerClient.receiveAsyncCountBasedMessages(long) At JmsConsumerClient.java:[line 197]
|
Bx
|
org.apache.activemq.tool.properties.ReflectionUtil.configureClass(Object, String, String) invokes inefficient new Character(char) constructor; use Character.valueOf(char) instead |
|
Bug type DM_NUMBER_CTOR (click for details)
In class org.apache.activemq.tool.properties.ReflectionUtil In method org.apache.activemq.tool.properties.ReflectionUtil.configureClass(Object, String, String) Called method new Character(char) Should call Character.valueOf(char) instead At ReflectionUtil.java:[line 130]
|
Bx
|
Boxed value is unboxed and then immediately reboxed in org.apache.activemq.tool.sampler.AbstractPerformanceSampler.startSampler(CountDownLatch, ClientRunBasis, long) |
|
Bug type BX_UNBOXING_IMMEDIATELY_REBOXED (click for details)
In class org.apache.activemq.tool.sampler.AbstractPerformanceSampler In method org.apache.activemq.tool.sampler.AbstractPerformanceSampler.startSampler(CountDownLatch, ClientRunBasis, long) Called method Long.valueOf(long) At AbstractPerformanceSampler.java:[line 138] Another occurrence at AbstractPerformanceSampler.java:[line 139] Another occurrence at AbstractPerformanceSampler.java:[line 140]
|
Dm
|
org.apache.activemq.tool.properties.JmsConsumerProperties.setMessageSelector(String) invokes inefficient new String(String) constructor |
|
Bug type DM_STRING_CTOR (click for details)
In class org.apache.activemq.tool.properties.JmsConsumerProperties In method org.apache.activemq.tool.properties.JmsConsumerProperties.setMessageSelector(String) At JmsConsumerProperties.java:[line 95]
|
SBSC
|
org.apache.activemq.tool.AbstractJmsClient.createCompositeDestination(byte, String, int) concatenates strings using + in a loop |
|
Bug type SBSC_USE_STRINGBUFFER_CONCATENATION (click for details)
In class org.apache.activemq.tool.AbstractJmsClient In method org.apache.activemq.tool.AbstractJmsClient.createCompositeDestination(byte, String, int) At AbstractJmsClient.java:[line 182]
|
SBSC
|
org.apache.activemq.tool.AbstractJmsClientSystem.setProviderMetaData(ConnectionMetaData, JmsClientProperties) concatenates strings using + in a loop |
|
Bug type SBSC_USE_STRINGBUFFER_CONCATENATION (click for details)
In class org.apache.activemq.tool.AbstractJmsClientSystem In method org.apache.activemq.tool.AbstractJmsClientSystem.setProviderMetaData(ConnectionMetaData, JmsClientProperties) At AbstractJmsClientSystem.java:[line 257]
|
SBSC
|
org.apache.activemq.tool.properties.ReflectionUtil.configureClass(Object, String, String) concatenates strings using + in a loop |
|
Bug type SBSC_USE_STRINGBUFFER_CONCATENATION (click for details)
In class org.apache.activemq.tool.properties.ReflectionUtil In method org.apache.activemq.tool.properties.ReflectionUtil.configureClass(Object, String, String) At ReflectionUtil.java:[line 77]
|
SBSC
|
org.apache.activemq.tool.reports.XmlFilePerfReportWriter.parsePerfCsvData(String, String) concatenates strings using + in a loop |
|
Bug type SBSC_USE_STRINGBUFFER_CONCATENATION (click for details)
In class org.apache.activemq.tool.reports.XmlFilePerfReportWriter In method org.apache.activemq.tool.reports.XmlFilePerfReportWriter.parsePerfCsvData(String, String) At XmlFilePerfReportWriter.java:[line 404]
|
SBSC
|
org.apache.activemq.tool.sampler.plugins.LinuxCpuSamplerPlugin.convertToCSV(String, String) concatenates strings using + in a loop |
|
Bug type SBSC_USE_STRINGBUFFER_CONCATENATION (click for details)
In class org.apache.activemq.tool.sampler.plugins.LinuxCpuSamplerPlugin In method org.apache.activemq.tool.sampler.plugins.LinuxCpuSamplerPlugin.convertToCSV(String, String) At LinuxCpuSamplerPlugin.java:[line 103]
|
WMI
|
org.apache.activemq.tool.reports.XmlFilePerfReportWriter.writeMap(String, Map) makes inefficient use of keySet iterator instead of entrySet iterator |
|
Bug type WMI_WRONG_MAP_ITERATOR (click for details)
In class org.apache.activemq.tool.reports.XmlFilePerfReportWriter In method org.apache.activemq.tool.reports.XmlFilePerfReportWriter.writeMap(String, Map) At XmlFilePerfReportWriter.java:[line 385]
|
WMI
|
org.apache.activemq.tool.reports.XmlFilePerfReportWriter.writeXmlTestSettings() makes inefficient use of keySet iterator instead of entrySet iterator |
|
Bug type WMI_WRONG_MAP_ITERATOR (click for details)
In class org.apache.activemq.tool.reports.XmlFilePerfReportWriter In method org.apache.activemq.tool.reports.XmlFilePerfReportWriter.writeXmlTestSettings() Field org.apache.activemq.tool.reports.XmlFilePerfReportWriter.testPropsMap At XmlFilePerfReportWriter.java:[line 182]
|
WMI
|
org.apache.activemq.tool.reports.plugins.ThroughputReportPlugin.getSummary() makes inefficient use of keySet iterator instead of entrySet iterator |
|
Bug type WMI_WRONG_MAP_ITERATOR (click for details)
In class org.apache.activemq.tool.reports.plugins.ThroughputReportPlugin In method org.apache.activemq.tool.reports.plugins.ThroughputReportPlugin.getSummary() Field org.apache.activemq.tool.reports.plugins.ThroughputReportPlugin.clientThroughputs At ThroughputReportPlugin.java:[line 106]
|
BC
|
Unchecked/unconfirmed cast from org.apache.activemq.tool.properties.JmsClientProperties to org.apache.activemq.tool.properties.JmsConsumerProperties in org.apache.activemq.tool.JmsConsumerClient.setClient(JmsClientProperties) |
|
Bug type BC_UNCONFIRMED_CAST (click for details)
In class org.apache.activemq.tool.JmsConsumerClient In method org.apache.activemq.tool.JmsConsumerClient.setClient(JmsClientProperties) Actual type org.apache.activemq.tool.properties.JmsClientProperties Expected org.apache.activemq.tool.properties.JmsConsumerProperties Value loaded from clientProps At JmsConsumerClient.java:[line 272]
|
BC
|
Unchecked/unconfirmed cast from org.apache.activemq.tool.properties.JmsClientSystemProperties to org.apache.activemq.tool.properties.JmsConsumerSystemProperties in org.apache.activemq.tool.JmsConsumerSystem.setSysTest(JmsClientSystemProperties) |
|
Bug type BC_UNCONFIRMED_CAST (click for details)
In class org.apache.activemq.tool.JmsConsumerSystem In method org.apache.activemq.tool.JmsConsumerSystem.setSysTest(JmsClientSystemProperties) Actual type org.apache.activemq.tool.properties.JmsClientSystemProperties Expected org.apache.activemq.tool.properties.JmsConsumerSystemProperties Value loaded from sysTestProps At JmsConsumerSystem.java:[line 36]
|
BC
|
Unchecked/unconfirmed cast from org.apache.activemq.tool.properties.JmsClientProperties to org.apache.activemq.tool.properties.JmsProducerProperties in org.apache.activemq.tool.JmsProducerClient.setClient(JmsClientProperties) |
|
Bug type BC_UNCONFIRMED_CAST (click for details)
In class org.apache.activemq.tool.JmsProducerClient In method org.apache.activemq.tool.JmsProducerClient.setClient(JmsClientProperties) Actual type org.apache.activemq.tool.properties.JmsClientProperties Expected org.apache.activemq.tool.properties.JmsProducerProperties Value loaded from clientProps At JmsProducerClient.java:[line 323]
|
BC
|
Unchecked/unconfirmed cast from org.apache.activemq.tool.properties.JmsClientSystemProperties to org.apache.activemq.tool.properties.JmsProducerSystemProperties in org.apache.activemq.tool.JmsProducerSystem.setSysTest(JmsClientSystemProperties) |
|
Bug type BC_UNCONFIRMED_CAST (click for details)
In class org.apache.activemq.tool.JmsProducerSystem In method org.apache.activemq.tool.JmsProducerSystem.setSysTest(JmsClientSystemProperties) Actual type org.apache.activemq.tool.properties.JmsClientSystemProperties Expected org.apache.activemq.tool.properties.JmsProducerSystemProperties Value loaded from sysTestProps At JmsProducerSystem.java:[line 38]
|
NP
|
Load of known null value in org.apache.activemq.tool.sampler.CpuSamplerTask.createPlugin(String) |
|
Bug type NP_LOAD_OF_KNOWN_NULL_VALUE (click for details)
In class org.apache.activemq.tool.sampler.CpuSamplerTask In method org.apache.activemq.tool.sampler.CpuSamplerTask.createPlugin(String) Value loaded from osName At CpuSamplerTask.java:[line 35]
|
REC
|
Exception is caught when Exception is not thrown in org.apache.activemq.tool.properties.ReflectionUtil.configureClass(Object, String, String) |
|
Bug type REC_CATCH_EXCEPTION (click for details)
In class org.apache.activemq.tool.properties.ReflectionUtil In method org.apache.activemq.tool.properties.ReflectionUtil.configureClass(Object, String, String) At ReflectionUtil.java:[line 157]
|
This cast is unchecked, and not all instances of the type cast from can be cast to
the type it is being cast to. Check that your program logic ensures that this
cast will not fail.
A boxed value is unboxed and then immediately reboxed.
Using new Integer(int)
is guaranteed to always result in a new object whereas
Integer.valueOf(int)
allows caching of values to be done by the compiler, class library, or JVM.
Using of cached values avoids object allocation and the code will be faster.
Values between -128 and 127 are guaranteed to have corresponding cached instances
and using valueOf
is approximately 3.5 times faster than using constructor.
For values outside the constant range the performance of both styles is the same.
Unless the class must be compatible with JVMs predating Java 5,
use either autoboxing or the valueOf()
method when creating instances of
Long
, Integer
, Short
, Character
, and Byte
.
This code creates a classloader, which needs permission if a security manage is installed.
If this code might be invoked by code that does not
have security permissions, then the classloader creation needs to occur inside a doPrivileged block.
Using the java.lang.String(String)
constructor wastes memory
because the object so constructed will be functionally indistinguishable
from the String
passed as a parameter. Just use the
argument String
directly.
Found a call to a method which will perform a byte to String (or String to byte) conversion,
and will assume that the default platform encoding is suitable. This will cause the application
behavior to vary between platforms. Use an alternative API and specify a charset name or Charset
object explicitly.
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.
This code stores a reference to an externally mutable object into 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.
Storing a copy of the object is better approach in many situations.
This method performs synchronization on an object that is an instance of
a class from the java.util.concurrent package (or its subclasses). Instances
of these classes have their own concurrency control mechanisms that are orthogonal to
the synchronization provided by the Java keyword synchronized
. For example,
synchronizing on an AtomicBoolean
will not prevent other threads
from modifying the AtomicBoolean
.
Such code may be correct, but should be carefully reviewed and documented,
and may confuse people who have to maintain the code at a later date.
The variable referenced at this point is known to be null due to an earlier
check against null. Although this is valid, it might be a mistake (perhaps you
intended to refer to a different variable, or perhaps the earlier check to see if the
variable is null should have been a check to see if it was non-null).
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.
A better approach is to either explicitly catch the specific exceptions that are thrown,
or to explicitly catch RuntimeException exception, rethrow it, and then catch all non-Runtime Exceptions, as shown below:
try {
...
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
... deal with all non-runtime exceptions ...
}
This method returns a value that is not checked. The return value should be checked
since it can indicate an unusual or unexpected function execution. For
example, the File.delete()
method returns false
if the file could not be successfully deleted (rather than
throwing an Exception).
If you don't check the result, you won't notice if the method invocation
signals unexpected behavior by returning an atypical return value.
The method seems to be building a String using concatenation in a loop.
In each iteration, the String is converted to a StringBuffer/StringBuilder,
appended to, and converted back to a String.
This can lead to a cost quadratic in the number of iterations,
as the growing string is recopied in each iteration.
Better performance can be obtained by using
a StringBuffer (or StringBuilder in Java 5) explicitly.
For example:
// This is bad
String s = "";
for (int i = 0; i < field.length; ++i) {
s = s + field[i];
}
// This is better
StringBuffer buf = new StringBuffer();
for (int i = 0; i < field.length; ++i) {
buf.append(field[i]);
}
String s = buf.toString();
This method contains a call to java.lang.Object.wait()
which
is not guarded by conditional control flow. The code should
verify that condition it intends to wait for is not already satisfied
before calling wait; any previous notifications will be ignored.
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.