You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Michael Mehrle (JIRA)" <ji...@apache.org> on 2008/04/29 20:17:56 UTC

[jira] Created: (WICKET-1577) Int based PropertyModel throws convertion error

Int based PropertyModel throws convertion error
-----------------------------------------------

                 Key: WICKET-1577
                 URL: https://issues.apache.org/jira/browse/WICKET-1577
             Project: Wicket
          Issue Type: Bug
         Environment: Replicated on Windows XP and Mac OS X
            Reporter: Michael Mehrle
             Fix For: 1.3.4


Setup: Create a radio group that's tied to a propertymodel which is set to '0' by default, e.g.:

RadioGroup myRadioGroup = new RadioGroup("interval"); // interval is an int property of a bean 

When saving the form one encounters this error:

org.apache.wicket.util.convert.ConversionException: Can't convert null value to a primitive class: int for setting it on com.evite.event.model.EventSchedule@1b33228[id=<null>]

            at
org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.setValue(Pr
opertyResolver.java:1079)

When setting the value to anything else but '0' it doesn't throw this. Also, changing the model type to Integer fixes the issue. 

Suspected bug and this issue was opened per Johan's request.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-1577) Int based PropertyModel throws convertion error

Posted by "Martijn Dashorst (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martijn Dashorst updated WICKET-1577:
-------------------------------------

    Fix Version/s:     (was: 1.3.4)
                   1.3.5

> Int based PropertyModel throws convertion error
> -----------------------------------------------
>
>                 Key: WICKET-1577
>                 URL: https://issues.apache.org/jira/browse/WICKET-1577
>             Project: Wicket
>          Issue Type: Bug
>         Environment: Replicated on Windows XP and Mac OS X
>            Reporter: Michael Mehrle
>            Assignee: Johan Compagner
>             Fix For: 1.3.5
>
>
> Setup: Create a radio group that's tied to a propertymodel which is set to '0' by default, e.g.:
> RadioGroup myRadioGroup = new RadioGroup("interval"); // interval is an int property of a bean 
> When saving the form one encounters this error:
> org.apache.wicket.util.convert.ConversionException: Can't convert null value to a primitive class: int for setting it on com.evite.event.model.EventSchedule@1b33228[id=<null>]
>             at
> org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.setValue(Pr
> opertyResolver.java:1079)
> When setting the value to anything else but '0' it doesn't throw this. Also, changing the model type to Integer fixes the issue. 
> Suspected bug and this issue was opened per Johan's request.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-1577) Int based PropertyModel throws convertion error

Posted by "Bruno Borges (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bruno Borges updated WICKET-1577:
---------------------------------

    Attachment: patch-1577.diff

> Int based PropertyModel throws convertion error
> -----------------------------------------------
>
>                 Key: WICKET-1577
>                 URL: https://issues.apache.org/jira/browse/WICKET-1577
>             Project: Wicket
>          Issue Type: Bug
>         Environment: Replicated on Windows XP and Mac OS X
>            Reporter: Michael Mehrle
>            Assignee: Johan Compagner
>             Fix For: 1.3.5
>
>         Attachments: patch-1577.diff
>
>
> Setup: Create a radio group that's tied to a propertymodel which is set to '0' by default, e.g.:
> RadioGroup myRadioGroup = new RadioGroup("interval"); // interval is an int property of a bean 
> When saving the form one encounters this error:
> org.apache.wicket.util.convert.ConversionException: Can't convert null value to a primitive class: int for setting it on com.evite.event.model.EventSchedule@1b33228[id=<null>]
>             at
> org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.setValue(Pr
> opertyResolver.java:1079)
> When setting the value to anything else but '0' it doesn't throw this. Also, changing the model type to Integer fixes the issue. 
> Suspected bug and this issue was opened per Johan's request.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-1577) Int based PropertyModel throws convertion error

Posted by "Bruno Borges (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12631237#action_12631237 ] 

Bruno Borges commented on WICKET-1577:
--------------------------------------

This bug affects 1.4 versions as well.

> Int based PropertyModel throws convertion error
> -----------------------------------------------
>
>                 Key: WICKET-1577
>                 URL: https://issues.apache.org/jira/browse/WICKET-1577
>             Project: Wicket
>          Issue Type: Bug
>         Environment: Replicated on Windows XP and Mac OS X
>            Reporter: Michael Mehrle
>            Assignee: Johan Compagner
>             Fix For: 1.3.5
>
>         Attachments: patch-1577.diff
>
>
> Setup: Create a radio group that's tied to a propertymodel which is set to '0' by default, e.g.:
> RadioGroup myRadioGroup = new RadioGroup("interval"); // interval is an int property of a bean 
> When saving the form one encounters this error:
> org.apache.wicket.util.convert.ConversionException: Can't convert null value to a primitive class: int for setting it on com.evite.event.model.EventSchedule@1b33228[id=<null>]
>             at
> org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.setValue(Pr
> opertyResolver.java:1079)
> When setting the value to anything else but '0' it doesn't throw this. Also, changing the model type to Integer fixes the issue. 
> Suspected bug and this issue was opened per Johan's request.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WICKET-1577) Int based PropertyModel throws convertion error

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg reassigned WICKET-1577:
-------------------------------------

    Assignee: Johan Compagner

> Int based PropertyModel throws convertion error
> -----------------------------------------------
>
>                 Key: WICKET-1577
>                 URL: https://issues.apache.org/jira/browse/WICKET-1577
>             Project: Wicket
>          Issue Type: Bug
>         Environment: Replicated on Windows XP and Mac OS X
>            Reporter: Michael Mehrle
>            Assignee: Johan Compagner
>             Fix For: 1.3.4
>
>
> Setup: Create a radio group that's tied to a propertymodel which is set to '0' by default, e.g.:
> RadioGroup myRadioGroup = new RadioGroup("interval"); // interval is an int property of a bean 
> When saving the form one encounters this error:
> org.apache.wicket.util.convert.ConversionException: Can't convert null value to a primitive class: int for setting it on com.evite.event.model.EventSchedule@1b33228[id=<null>]
>             at
> org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.setValue(Pr
> opertyResolver.java:1079)
> When setting the value to anything else but '0' it doesn't throw this. Also, changing the model type to Integer fixes the issue. 
> Suspected bug and this issue was opened per Johan's request.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-1577) Int based PropertyModel throws convertion error

Posted by "Bruno Borges (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12631234#action_12631234 ] 

Bruno Borges commented on WICKET-1577:
--------------------------------------

If autounboxing is not allowed for null values, why not just avoid calling the setter for primitive properties?

See
http://java.sun.com/j2se/1.5.0/docs/guide/language/autoboxing.html

Anyway, there's a patch attached that does what I suggested.

Regards,
Bruno

> Int based PropertyModel throws convertion error
> -----------------------------------------------
>
>                 Key: WICKET-1577
>                 URL: https://issues.apache.org/jira/browse/WICKET-1577
>             Project: Wicket
>          Issue Type: Bug
>         Environment: Replicated on Windows XP and Mac OS X
>            Reporter: Michael Mehrle
>            Assignee: Johan Compagner
>             Fix For: 1.3.5
>
>
> Setup: Create a radio group that's tied to a propertymodel which is set to '0' by default, e.g.:
> RadioGroup myRadioGroup = new RadioGroup("interval"); // interval is an int property of a bean 
> When saving the form one encounters this error:
> org.apache.wicket.util.convert.ConversionException: Can't convert null value to a primitive class: int for setting it on com.evite.event.model.EventSchedule@1b33228[id=<null>]
>             at
> org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.setValue(Pr
> opertyResolver.java:1079)
> When setting the value to anything else but '0' it doesn't throw this. Also, changing the model type to Integer fixes the issue. 
> Suspected bug and this issue was opened per Johan's request.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-1577) Int based PropertyModel throws convertion error

Posted by "Bruno Borges (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12631406#action_12631406 ] 

Bruno Borges commented on WICKET-1577:
--------------------------------------

The thing is that if the property is an Integer, the exception is not throw because... is not a primitive type. Just because of that. The property is set with null value.

Setting an Object property with null value is correct, because of the idea of reseting its value to nothing. But what is the default value for a primitive property? Should we consider default IConverters for that?

ConverterLocator {
   set(int.class, PrimitiveIntConverter.class);
   set(boolean.class, PrimitiveBooleanConverter.class);
   set(char.class, PrimitiveCharConverter.class);
}

And then, the user could set its own primitive converters.

What about this?

> Int based PropertyModel throws convertion error
> -----------------------------------------------
>
>                 Key: WICKET-1577
>                 URL: https://issues.apache.org/jira/browse/WICKET-1577
>             Project: Wicket
>          Issue Type: Bug
>         Environment: Replicated on Windows XP and Mac OS X
>            Reporter: Michael Mehrle
>            Assignee: Johan Compagner
>             Fix For: 1.3.5
>
>         Attachments: patch-1577.diff
>
>
> Setup: Create a radio group that's tied to a propertymodel which is set to '0' by default, e.g.:
> RadioGroup myRadioGroup = new RadioGroup("interval"); // interval is an int property of a bean 
> When saving the form one encounters this error:
> org.apache.wicket.util.convert.ConversionException: Can't convert null value to a primitive class: int for setting it on com.evite.event.model.EventSchedule@1b33228[id=<null>]
>             at
> org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.setValue(Pr
> opertyResolver.java:1079)
> When setting the value to anything else but '0' it doesn't throw this. Also, changing the model type to Integer fixes the issue. 
> Suspected bug and this issue was opened per Johan's request.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-1577) Int based PropertyModel throws convertion error

Posted by "Johan Compagner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12631277#action_12631277 ] 

Johan Compagner commented on WICKET-1577:
-----------------------------------------

but doing nothing is even more dangerous!
Then we get complains that wicket doesnt set sometimes a value without reporting that it couldnt
no i dont want to kill the exception. It is an exception that has to happen.

> Int based PropertyModel throws convertion error
> -----------------------------------------------
>
>                 Key: WICKET-1577
>                 URL: https://issues.apache.org/jira/browse/WICKET-1577
>             Project: Wicket
>          Issue Type: Bug
>         Environment: Replicated on Windows XP and Mac OS X
>            Reporter: Michael Mehrle
>            Assignee: Johan Compagner
>             Fix For: 1.3.5
>
>         Attachments: patch-1577.diff
>
>
> Setup: Create a radio group that's tied to a propertymodel which is set to '0' by default, e.g.:
> RadioGroup myRadioGroup = new RadioGroup("interval"); // interval is an int property of a bean 
> When saving the form one encounters this error:
> org.apache.wicket.util.convert.ConversionException: Can't convert null value to a primitive class: int for setting it on com.evite.event.model.EventSchedule@1b33228[id=<null>]
>             at
> org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.setValue(Pr
> opertyResolver.java:1079)
> When setting the value to anything else but '0' it doesn't throw this. Also, changing the model type to Integer fixes the issue. 
> Suspected bug and this issue was opened per Johan's request.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WICKET-1577) Int based PropertyModel throws convertion error

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-1577.
-----------------------------------

    Resolution: Won't Fix
      Assignee: Igor Vaynberg  (was: Johan Compagner)

we are not going to do anything about this because the current behavior is correct. primitive types do not support null values, so if you want to have null use the equivalent object type. the definition of nullness varies for the primitive types per usecase so a global setting wont help; besides, it is very easy to perform the proper conversion in the imodel where it belongs.

> Int based PropertyModel throws convertion error
> -----------------------------------------------
>
>                 Key: WICKET-1577
>                 URL: https://issues.apache.org/jira/browse/WICKET-1577
>             Project: Wicket
>          Issue Type: Bug
>         Environment: Replicated on Windows XP and Mac OS X
>            Reporter: Michael Mehrle
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.5
>
>         Attachments: patch-1577.diff
>
>
> Setup: Create a radio group that's tied to a propertymodel which is set to '0' by default, e.g.:
> RadioGroup myRadioGroup = new RadioGroup("interval"); // interval is an int property of a bean 
> When saving the form one encounters this error:
> org.apache.wicket.util.convert.ConversionException: Can't convert null value to a primitive class: int for setting it on com.evite.event.model.EventSchedule@1b33228[id=<null>]
>             at
> org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.setValue(Pr
> opertyResolver.java:1079)
> When setting the value to anything else but '0' it doesn't throw this. Also, changing the model type to Integer fixes the issue. 
> Suspected bug and this issue was opened per Johan's request.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-1577) Int based PropertyModel throws convertion error

Posted by "Matej Knopp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12631370#action_12631370 ] 

Matej Knopp commented on WICKET-1577:
-------------------------------------

What are we supposed to do about this? Swallowing the exception certainly isn't the solution. If you want assign to assign null value, your model object must have Integer property.

> Int based PropertyModel throws convertion error
> -----------------------------------------------
>
>                 Key: WICKET-1577
>                 URL: https://issues.apache.org/jira/browse/WICKET-1577
>             Project: Wicket
>          Issue Type: Bug
>         Environment: Replicated on Windows XP and Mac OS X
>            Reporter: Michael Mehrle
>            Assignee: Johan Compagner
>             Fix For: 1.3.5
>
>         Attachments: patch-1577.diff
>
>
> Setup: Create a radio group that's tied to a propertymodel which is set to '0' by default, e.g.:
> RadioGroup myRadioGroup = new RadioGroup("interval"); // interval is an int property of a bean 
> When saving the form one encounters this error:
> org.apache.wicket.util.convert.ConversionException: Can't convert null value to a primitive class: int for setting it on com.evite.event.model.EventSchedule@1b33228[id=<null>]
>             at
> org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.setValue(Pr
> opertyResolver.java:1079)
> When setting the value to anything else but '0' it doesn't throw this. Also, changing the model type to Integer fixes the issue. 
> Suspected bug and this issue was opened per Johan's request.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.