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; }
I have removed this particular method from the PropertiesUtil class from r756231 on Qpid trunk. So this should not longer be a problem.
[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