Conversion bug (different behavior between java6 and java7) #71

Closed
lviggiano opened this Issue Feb 25, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@lviggiano
Owner

lviggiano commented Feb 25, 2014

    public static interface PrimitiveTypesConfig extends Config {
        @DefaultValue("invalid")
        Integer invalid();
    }

    @Test(expected = UnsupportedOperationException.class)
    public void testInvalid() {
        PrimitiveTypesConfig config = ConfigFactory.create(PrimitiveTypesConfig.class);
        config.invalid();
    }

is raising NumberFormatException on java 7:

java.lang.NumberFormatException: For input string: "invalid"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
        at java.lang.Integer.parseInt(Integer.java:492)
        at java.lang.Integer.valueOf(Integer.java:556)
        at java.lang.Integer.decode(Integer.java:984)
        at com.sun.beans.editors.IntegerEditor.setAsText(IntegerEditor.java:39)
        at org.aeonbits.owner.Converters$4.tryConvert(Converters.java)

is raising UnsupportedOperationException on java 6

java.lang.UnsupportedOperationException: Cannot convert 'invalid' to java.lang.Integer
    at org.aeonbits.owner.Util.unsupported(Util.java:119)
    at org.aeonbits.owner.Converters.unsupportedConversion(Converters.java:239)
    at org.aeonbits.owner.Converters.access$200(Converters.java:39)
    at org.aeonbits.owner.Converters$10.tryConvert(Converters.java)

@lviggiano lviggiano added this to the 1.0.6 milestone Feb 25, 2014

@lviggiano lviggiano added the bug label Feb 25, 2014

@lviggiano lviggiano self-assigned this Feb 25, 2014

lviggiano added a commit that referenced this issue Feb 25, 2014

@lviggiano lviggiano closed this Feb 25, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment