Bug 442683 - org.apache.qpid.util.PropertiesUtil.trim() has no effect
Summary: org.apache.qpid.util.PropertiesUtil.trim() has no effect
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: qpid-java
Version: beta
Hardware: All
OS: Linux
low
low
Target Milestone: Next Version
: ---
Assignee: Marc Schoenefeld
QA Contact: Kim van der Riet
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-04-16 09:16 UTC by Marc Schoenefeld
Modified: 2012-12-07 17:46 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Marc Schoenefeld 2008-04-16 09:16:44 UTC
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)
            {
                nextValue.trim();
            }

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

        return trimmedProperties;
    }

Comment 1 Rajith Attapattu 2009-04-21 13:52:24 UTC
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 08:38:19 UTC
[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.