Bug 442683 - org.apache.qpid.util.PropertiesUtil.trim() has no effect
org.apache.qpid.util.PropertiesUtil.trim() has no effect
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: qpid-java (Show other bugs)
All Linux
low Severity low
: Next Version
: ---
Assigned To: Marc Schoenefeld
Kim van der Riet
Depends On:
  Show dependency treegraph
Reported: 2008-04-16 05:16 EDT by Marc Schoenefeld
Modified: 2012-12-07 12:46 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Marc Schoenefeld 2008-04-16 05:16:44 EDT
Strings are immutable in Java, so the trim() method on strings returns
a value of the trimmed value. PropertiesUtil ignores the return 
value and uses the original (untrimmed) value. Therefore effect-dead 
code unless the "nextValue.trim()" is not rephrased to 
"nextValue = nextValue.trim()".

   public static Properties trim(Properties properties)
        Properties trimmedProperties = new Properties();

        // Loop over all the properties
        for (Iterator i = properties.keySet().iterator(); i.hasNext();)
            String next = (String) i.next();
            String nextValue = properties.getProperty(next);

            // Trim the value if it is not null
            if (nextValue != null)

            // Store the trimmed value in the trimmed properties
            trimmedProperties.setProperty(next, nextValue);

        return trimmedProperties;
Comment 1 Rajith Attapattu 2009-04-21 09:52:24 EDT
I have removed this particular method from the PropertiesUtil class from r756231 on Qpid trunk.
So this should not longer be a problem.
Comment 2 ppecka 2012-07-10 04:38:19 EDT
[root@qpid trunk]# svn log -v -r756231
r756231 | rajith | 2009-03-19 18:00:34 -0400 (Thu, 19 Mar 2009) | 3 lines
Changed paths:
   D /qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/JMSTestCase.java
   D /qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/util/PropertiesUtils.java

These classes are not used in any meaningful way.
I am removing them to avoid any confusion they may cause.


since the classes were removed, marking this issue as VERIFIED

Note You need to log in before you can comment on or make changes to this bug.