You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ba...@apache.org on 2008/03/26 06:18:46 UTC
svn commit: r641153 - in /commons/proper/collections/trunk/src:
java/org/apache/commons/collections/ExtendedProperties.java
test/org/apache/commons/collections/TestExtendedProperties.java
Author: bayard
Date: Tue Mar 25 22:18:45 2008
New Revision: 641153
URL: http://svn.apache.org/viewvc?rev=641153&view=rev
Log:
Applying a unit test and a fix for COLLECTIONS-238 - allowing ExtendedProperties to support empty property values
Modified:
commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestExtendedProperties.java
Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java?rev=641153&r1=641152&r2=641153&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java (original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java Tue Mar 25 22:18:45 2008
@@ -593,10 +593,12 @@
String key = line.substring(0, equalSign).trim();
String value = line.substring(equalSign + 1).trim();
+ /* COLLECTIONS-238 allows empty properties to exist by commenting this out
// Configure produces lines like this ... just ignore them
if ("".equals(value)) {
continue;
}
+ */
if (includeProperty != null && key.equalsIgnoreCase(includeProperty)) {
// Recursively load properties files.
Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestExtendedProperties.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestExtendedProperties.java?rev=641153&r1=641152&r2=641153&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestExtendedProperties.java (original)
+++ commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestExtendedProperties.java Tue Mar 25 22:18:45 2008
@@ -407,4 +407,16 @@
assertEquals( "\\\\192.168.1.91\\test", props2.getProperty("test") );
}
+ public void testCollections238() throws IOException {
+ ExtendedProperties props = new ExtendedProperties();
+ String txt = "x=1\ny=\nz=3";
+ byte[] bytes = txt.getBytes();
+ ByteArrayInputStream in = new ByteArrayInputStream(bytes);
+ props.load(in);
+ assertEquals("1", props.getProperty("x"));
+ assertEquals("3", props.getProperty("z"));
+ assertEquals("", props.getProperty("y"));
+ assertEquals(3, props.size());
+ }
+
}