Community
Participate
Working Groups
When running ant precommit on virgo.kernel I found the following error: - <BugInstance type="DM_STRING_TOSTRING" priority="2" abbrev="Dm" category="PERFORMANCE"> - <Class classname="org.eclipse.virgo.kernel.install.artifact.internal.StandardScopeServiceRepository"> <SourceLine classname="org.eclipse.virgo.kernel.install.artifact.internal.StandardScopeServiceRepository" start="1" end="139" sourcefile="StandardScopeServiceRepository.java" sourcepath="org/eclipse/virgo/kernel/install/artifact/internal/StandardScopeServiceRepository.java" /> </Class> - <Method classname="org.eclipse.virgo.kernel.install.artifact.internal.StandardScopeServiceRepository" name="dictionaryToCommaSeparatedString" signature="(Ljava/util/Dictionary;)Ljava/lang/String;" isStatic="true"> <SourceLine classname="org.eclipse.virgo.kernel.install.artifact.internal.StandardScopeServiceRepository" start="81" end="92" startBytecode="0" endBytecode="285" sourcefile="StandardScopeServiceRepository.java" sourcepath="org/eclipse/virgo/kernel/install/artifact/internal/StandardScopeServiceRepository.java" /> </Method> <SourceLine classname="org.eclipse.virgo.kernel.install.artifact.internal.StandardScopeServiceRepository" start="88" end="88" startBytecode="51" endBytecode="51" sourcefile="StandardScopeServiceRepository.java" sourcepath="org/eclipse/virgo/kernel/install/artifact/internal/StandardScopeServiceRepository.java" /> </BugInstance> The related code snippet is: private static String dictionaryToCommaSeparatedString(Dictionary<String, Object> properties) { StringBuffer propsString = new StringBuffer(); if (properties != null) { Enumeration<String> keys = properties.keys(); for (int i = 0; keys.hasMoreElements(); i++) { if (i > 0) { propsString.append(", "); } 88: String key = keys.nextElement().toString(); propsString.append(key + "=" + properties.get(key).toString()); } } return propsString.toString(); }
Fixed by removing redundant toString() invocation