Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 332469

Summary: Error running findbugs on virgo.kernel
Product: [RT] Virgo Reporter: Hristo Iliev <hsiliev>
Component: virgo-buildAssignee: 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:

Description Hristo Iliev CLA 2010-12-13 15:13:31 EST
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();
    }
Comment 1 Hristo Iliev CLA 2010-12-14 17:09:10 EST
Fixed by removing redundant toString() invocation