Author: oheger
Date: Fri Jan 2 08:45:25 2009
New Revision: 730782
URL: http://svn.apache.org/viewvc?rev=730782&view=rev
Log:
CONFIGURATION-357: Fixed message of the ConversionException thrown by
AbstractConfiguration.getBigInteger(). Ported the fix to configuration2 branch.
Also fixed some Java 1.5-related warnings in the test class.
Modified:
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java
commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestAbstractConfiguration.java
commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml
Modified:
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java?rev=730782&r1=730781&r2=730782&view=diff
==============================================================================
---
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java
(original)
+++
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java
Fri Jan 2 08:45:25 2009
@@ -1023,7 +1023,7 @@
}
catch (ConversionException e)
{
- throw new ConversionException('\'' + key + "' doesn't map to a
BigDecimal object", e);
+ throw new ConversionException('\'' + key + "' doesn't map to a
BigInteger object", e);
}
}
}
Modified:
commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestAbstractConfiguration.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestAbstractConfiguration.java?rev=730782&r1=730781&r2=730782&view=diff
==============================================================================
---
commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestAbstractConfiguration.java
(original)
+++
commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestAbstractConfiguration.java
Fri Jan 2 08:45:25 2009
@@ -61,7 +61,7 @@
{
Configuration config = getConfiguration();
- List list = config.getList("list");
+ List<?> list = config.getList("list");
assertNotNull("list not found", config.getProperty("list"));
assertEquals("list size", 2, list.size());
assertTrue("'value1' is not in the list", list.contains("value1"));
@@ -69,7 +69,7 @@
}
/**
- * Tests whether the escape character for list delimiters is recocknized
and
+ * Tests whether the escape character for list delimiters is recognized and
* removed.
*/
public void testListEscaped()
@@ -86,10 +86,10 @@
config.addPropertyDirect("key3", "value4");
config.addPropertyDirect("key3", "value5");
- List list = config.getList("key3");
+ List<?> list = config.getList("key3");
assertNotNull("no list found for the 'key3' property", list);
- List expected = new ArrayList();
+ List<Object> expected = new ArrayList<Object>();
expected.add("value3");
expected.add("value4");
expected.add("value5");
@@ -121,9 +121,9 @@
public void testGetKeys()
{
Configuration config = getConfiguration();
- Iterator keys = config.getKeys();
+ Iterator<String> keys = config.getKeys();
- List expectedKeys = new ArrayList();
+ List<String> expectedKeys = new ArrayList<String>();
expectedKeys.add("key1");
expectedKeys.add("key2");
expectedKeys.add("list");
@@ -132,7 +132,7 @@
assertNotNull("null iterator", keys);
assertTrue("empty iterator", keys.hasNext());
- List actualKeys = new ArrayList();
+ List<String> actualKeys = new ArrayList<String>();
while (keys.hasNext())
{
actualKeys.add(keys.next());
@@ -152,4 +152,24 @@
config.setLogger(log);
assertSame("Logger was not set", log, config.getLogger());
}
+
+ /**
+ * Tests the exception message triggered by the conversion to BigInteger.
+ * This test is related to CONFIGURATION-357.
+ */
+ public void testGetBigIntegerConversion()
+ {
+ Configuration config = getConfiguration();
+ try
+ {
+ config.getBigInteger("key1");
+ fail("No conversion exception thrown!");
+ }
+ catch (ConversionException cex)
+ {
+ assertEquals("Wrong exception message",
+ "'key1' doesn't map to a BigInteger object", cex
+ .getMessage());
+ }
+ }
}
Modified:
commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml?rev=730782&r1=730781&r2=730782&view=diff
==============================================================================
---
commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml
(original)
+++
commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml
Fri Jan 2 08:45:25 2009
@@ -85,6 +85,10 @@
</release>
<release version="1.7" date="in SVN" description="">
+ <action dev="oheger" type="fix" issue="CONFIGURATION-357">
+ The message of the ConversionException thrown by
+ AbstractConfiguration.getBigInteger() is now correct.
+ </action>
<action dev="rgoers" type="add" issue="CONFIGURATION-356">
Added getConfigurations and getConfigurationNameList.
</action>