You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Oliver Heger (JIRA)" <ji...@apache.org> on 2007/01/27 19:32:50 UTC
[jira] Updated: (CONFIGURATION-214) Adding an integer and getting
it as a long causes an exception
[ https://issues.apache.org/jira/browse/CONFIGURATION-214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oliver Heger updated CONFIGURATION-214:
---------------------------------------
Fix Version/s: (was: Nightly Builds)
1.3
> Adding an integer and getting it as a long causes an exception
> --------------------------------------------------------------
>
> Key: CONFIGURATION-214
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-214
> Project: Commons Configuration
> Issue Type: Bug
> Affects Versions: 1.2
> Environment: Linux, java 1.5
> Reporter: Sebastiano Vigna
> Assigned To: Oliver Heger
> Priority: Minor
> Fix For: 1.3
>
>
> Try this in a BeanShell:
> bsh % p = new org.apache.commons.configuration.PropertiesConfiguration();
> bsh % p.setProperty("foo", 6);
> bsh % p.getLong("foo");
> // Error: // Uncaught Exception: Method Invocation p.getLong : at Line: 3 : in file: <unknown file> : p .getLong ( "foo" )
> Target exception: org.apache.commons.configuration.ConversionException: 'foo' doesn't map to a Long object
> org.apache.commons.configuration.ConversionException: 'foo' doesn't map to a Long object
> at org.apache.commons.configuration.AbstractConfiguration.getLong(AbstractConfiguration.java:667)
> The problem is that when an object in a property is not a Long, the only attempt of PropertyConverter.toLong() is that of treating it as a string. It could try to convert it to a Number first and then try to convert it to a long. It is a very confusing behaviour, because if you save and reload the properties everything works fine (as now the integer is a string).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org