Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 332469 - Error running findbugs on virgo.kernel
Summary: Error running findbugs on virgo.kernel
Status: CLOSED FIXED
Alias: None
Product: Virgo
Classification: RT
Component: virgo-build (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.0.0.M01   Edit
Assignee: Hristo Iliev CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-13 15:13 EST by Hristo Iliev CLA
Modified: 2011-02-28 10:37 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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