| Summary: | Error running findbugs on virgo.kernel | ||
|---|---|---|---|
| Product: | [RT] Virgo | Reporter: | Hristo Iliev <hsiliev> |
| Component: | virgo-build | Assignee: | Hristo Iliev <hsiliev> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | eclipse, glyn.normington |
| Version: | unspecified | ||
| Target Milestone: | 3.0.0.M01 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
Fixed by removing redundant toString() invocation |
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(); }