Re: Migration to 1.5: 'X' is not a valid Serializable

2012-09-07 Thread Alec Swan
 // Via generics
Paul, I am not seeing this comment in the actual code. I am assuming
that you added this comment to clarify something for me, but I am not
getting it.

 Thus if you use generics your problem would most likely go away
Are you saying that Wicket has a different code path for models
defined as new Model(x) and new ModelSomeType(x)? It's impossible
because SomeType information is lost at runtime.

 , otherwise you would have to suffer a bit and you should porb call setType() 
 so Wicket
 would know what implementation of IConverter to use.
Default type converters worked well in 1.4 and in 1.5 require
setType() in some situations. How can I track down all the components
in my code that require setType() 1.5?

Thanks,

Alec

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Migration to 1.5: 'X' is not a valid Serializable

2012-09-07 Thread Paul Bors
Yes I added the comments in and perhaps I should have stated more clear what
I meant. Sorry I was rushing at the end of the day :)

As you must have figured it out by now if you do not specify a type for the
form field then Wicket converts the input via
FormComponet#convertValue(getInputAsArray()) which is what your code hits
and the type passed to it is not Object.class but rather String[].

If you use generics or specify the type then Wicket knows what IConverter to
use.

In one of your replies you referred to
EditableLabel(..).setType(String.class) and I take it EditableLabel is
nothing but a compound FormComponent which would explain why it works for
you when you call #setType().

Personally I upgraded from 1.3.7 to 1.5.8 and even though I'm not done
refactoring the entire webapp, I haven't yet run into the problem you first
described. Perhaps you should create a quick start so that we can all
reproduce your problem on our own to better help you?

~ Thank you,
  Paul Bors

-Original Message-
From: Alec Swan [mailto:alecs...@gmail.com] 
Sent: Friday, September 07, 2012 2:09 PM
To: users@wicket.apache.org
Subject: Re: Migration to 1.5: 'X' is not a valid Serializable

 // Via generics
Paul, I am not seeing this comment in the actual code. I am assuming that
you added this comment to clarify something for me, but I am not getting it.

 Thus if you use generics your problem would most likely go away
Are you saying that Wicket has a different code path for models defined as
new Model(x) and new ModelSomeType(x)? It's impossible because SomeType
information is lost at runtime.

 , otherwise you would have to suffer a bit and you should porb call 
 setType() so Wicket would know what implementation of IConverter to use.
Default type converters worked well in 1.4 and in 1.5 require
setType() in some situations. How can I track down all the components in my
code that require setType() 1.5?

Thanks,

Alec

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Migration to 1.5: 'X' is not a valid Serializable

2012-09-07 Thread Alec Swan
 As you must have figured it out by now if you do not specify a type for the
 form field then Wicket converts the input via
 FormComponet#convertValue(getInputAsArray()) which is what your code hits
 and the type passed to it is not Object.class but rather String[].
I just opened a new thread which describes the bug in
Objects#convertValue which describes the problem.

 If you use generics or specify the type then Wicket knows what IConverter to
 use.
I keep getting hung up on what you mean by if you use generics ..
then Wicket knows what IConverter to use. Can you explain this? Maybe
give an example?

 In one of your replies you referred to
 EditableLabel(..).setType(String.class) and I take it EditableLabel is
 nothing but a compound FormComponent which would explain why it works for
 you when you call #setType().
Correct.

 Personally I upgraded from 1.3.7 to 1.5.8 and even though I'm not done
 refactoring the entire webapp, I haven't yet run into the problem you first
 described. Perhaps you should create a quick start so that we can all
 reproduce your problem on our own to better help you?
I will create a quickstart if it turns out that the problem I
described in Objects#convertValue is not a bug.

Thanks,

Alec

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Migration to 1.5: 'X' is not a valid Serializable

2012-09-07 Thread Paul Bors
:) In the else branch for when the type is not null.

final IConverterT converter =
getConverter(getType());

-Original Message-
From: Alec Swan [mailto:alecs...@gmail.com] 
Sent: Friday, September 07, 2012 3:00 PM
To: users@wicket.apache.org
Subject: Re: Migration to 1.5: 'X' is not a valid Serializable

 As you must have figured it out by now if you do not specify a type 
 for the form field then Wicket converts the input via
 FormComponet#convertValue(getInputAsArray()) which is what your code 
 hits and the type passed to it is not Object.class but rather String[].
I just opened a new thread which describes the bug in Objects#convertValue
which describes the problem.

 If you use generics or specify the type then Wicket knows what 
 IConverter to use.
I keep getting hung up on what you mean by if you use generics ..
then Wicket knows what IConverter to use. Can you explain this? Maybe give
an example?

 In one of your replies you referred to 
 EditableLabel(..).setType(String.class) and I take it EditableLabel 
 is nothing but a compound FormComponent which would explain why it 
 works for you when you call #setType().
Correct.

 Personally I upgraded from 1.3.7 to 1.5.8 and even though I'm not done 
 refactoring the entire webapp, I haven't yet run into the problem you 
 first described. Perhaps you should create a quick start so that we 
 can all reproduce your problem on our own to better help you?
I will create a quickstart if it turns out that the problem I described in
Objects#convertValue is not a bug.

Thanks,

Alec

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Migration to 1.5: 'X' is not a valid Serializable

2012-09-06 Thread Alec Swan
I just ran into another problem with type resolution. In fact, it
looks like a bug in org.apache.wicket.util.lang.Objects#convertValue.
The call convertValue(nonNullNonArrayValue, Object.class) will always
return null if nonNullNonArrayValue is a value that is not null and
not an array!

Is that a legitimate bug?

Thanks,

Alec

On Wed, Sep 5, 2012 at 1:12 AM, dpmihai dpmi...@yahoo.com wrote:
 see this:
 http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-ListMultipleChoice-add-Serializable-values-td4585991.html#a4586026



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Migration-to-1-5-X-is-not-a-valid-Serializable-tp4651757p4651764.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Migration to 1.5: 'X' is not a valid Serializable

2012-09-06 Thread Alec Swan
The fix for this is the same as for the X is not a valid
Serializable, specifically: new
EditableLabel(..).setType(String.class)

Is there anybody who thinks that requiring setType(..) call on all
components which models don't resolve to a supported type is huge
problem?

Can this be fixed in 1.5.9?


Alec

On Thu, Sep 6, 2012 at 2:41 PM, Alec Swan alecs...@gmail.com wrote:
 I just ran into another problem with type resolution. In fact, it
 looks like a bug in org.apache.wicket.util.lang.Objects#convertValue.
 The call convertValue(nonNullNonArrayValue, Object.class) will always
 return null if nonNullNonArrayValue is a value that is not null and
 not an array!

 Is that a legitimate bug?

 Thanks,

 Alec

 On Wed, Sep 5, 2012 at 1:12 AM, dpmihai dpmi...@yahoo.com wrote:
 see this:
 http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-ListMultipleChoice-add-Serializable-values-td4585991.html#a4586026



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Migration-to-1-5-X-is-not-a-valid-Serializable-tp4651757p4651764.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Migration to 1.5: 'X' is not a valid Serializable

2012-09-06 Thread Paul Bors
Besides calling #setType() do you actually use generics with your models and
components?

See also:
http://wicket.apache.org/apidocs/1.5/org/apache/wicket/markup/html/form/Form
Component.html#setType(java.lang.Class)

And the model changes done in 1.4:
https://cwiki.apache.org/WICKET/migrating-to-wicket-14.html#MigratingtoWicke
t1.4-Modelchanges

~ Thank you
  Paul Bors

-Original Message-
From: Alec Swan [mailto:alecs...@gmail.com] 
Sent: Thursday, September 06, 2012 5:18 PM
To: users@wicket.apache.org
Subject: Re: Migration to 1.5: 'X' is not a valid Serializable

The fix for this is the same as for the X is not a valid Serializable,
specifically: new
EditableLabel(..).setType(String.class)

Is there anybody who thinks that requiring setType(..) call on all
components which models don't resolve to a supported type is huge problem?

Can this be fixed in 1.5.9?


Alec

On Thu, Sep 6, 2012 at 2:41 PM, Alec Swan alecs...@gmail.com wrote:
 I just ran into another problem with type resolution. In fact, it 
 looks like a bug in org.apache.wicket.util.lang.Objects#convertValue.
 The call convertValue(nonNullNonArrayValue, Object.class) will always 
 return null if nonNullNonArrayValue is a value that is not null and 
 not an array!

 Is that a legitimate bug?

 Thanks,

 Alec

 On Wed, Sep 5, 2012 at 1:12 AM, dpmihai dpmi...@yahoo.com wrote:
 see this:
 http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-ListMultipleCho
 ice-add-Serializable-values-td4585991.html#a4586026



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Migration-to-1-5-X-is-not-
 a-valid-Serializable-tp4651757p4651764.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Migration to 1.5: 'X' is not a valid Serializable

2012-09-06 Thread Alec Swan
 Besides calling #setType() do you actually use generics with your models and
 components?
Sorry, don't quite understand the question. I am not calling setType()
hence the problems with type detection in Wicket. Why is it important
if I use generics if they are only compile-time syntactic sugar?

 See also:
 http://wicket.apache.org/apidocs/1.5/org/apache/wicket/markup/html/form/Form
 Component.html#setType(java.lang.Class)
I don't call setType() and the type passed to Objects#convertValue is
Object.class, not String.class, as you would assume from  the JavaDoc
that String.class would be used.

 And the model changes done in 1.4:
 https://cwiki.apache.org/WICKET/migrating-to-wicket-14.html#MigratingtoWicke
 t1.4-Modelchanges
I am migrating from 1.4, so I was using information from this link.

Thanks,

Alec

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Migration to 1.5: 'X' is not a valid Serializable

2012-09-06 Thread Paul Bors
From inside Wicket 1.5.8 the FormComponent:1112

protected void convertInput()
{
// No generics and the type is null
if (typeName == null)
{
try
{
convertedInput =
convertValue(getInputAsArray());
}
...
}
// Via generics
else
{
final IConverterT converter =
getConverter(getType());
...
}
}

Thus if you use generics your problem would most likely go away, otherwise
you would have to suffer a bit and you should porb call setType() so Wicket
would know what implementation of IConverter to use.

~ Thank you,
  Paul Bors

-Original Message-
From: Alec Swan [mailto:alecs...@gmail.com] 
Sent: Thursday, September 06, 2012 6:13 PM
To: users@wicket.apache.org
Subject: Re: Migration to 1.5: 'X' is not a valid Serializable

 Besides calling #setType() do you actually use generics with your 
 models and components?
Sorry, don't quite understand the question. I am not calling setType() hence
the problems with type detection in Wicket. Why is it important if I use
generics if they are only compile-time syntactic sugar?

 See also:
 http://wicket.apache.org/apidocs/1.5/org/apache/wicket/markup/html/for
 m/Form
 Component.html#setType(java.lang.Class)
I don't call setType() and the type passed to Objects#convertValue is
Object.class, not String.class, as you would assume from  the JavaDoc that
String.class would be used.

 And the model changes done in 1.4:
 https://cwiki.apache.org/WICKET/migrating-to-wicket-14.html#Migratingt
 oWicke
 t1.4-Modelchanges
I am migrating from 1.4, so I was using information from this link.

Thanks,

Alec

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Migration to 1.5: 'X' is not a valid Serializable

2012-09-05 Thread dpmihai
see this:
http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-ListMultipleChoice-add-Serializable-values-td4585991.html#a4586026



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Migration-to-1-5-X-is-not-a-valid-Serializable-tp4651757p4651764.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Migration to 1.5: 'X' is not a valid Serializable

2012-09-04 Thread Alec Swan
Hello,

I ran into another problem while migrating to 1.5. I have a form with
a TextFieldString(new PropertyModelString(obj, value)). The test
that fills and submitts the form in 1.4 worked just fine. In 1.5 I get
an error 'X' is not a valid Serializable where 'X' is what's
returned from obj.getValue() method.

The problem is that in 1.5 Wicket uses static type analysis based on
getValue() return type, which in my case is Serializable. This check
is done in 
org.apache.wicket.markup.html.form.AbstractTextComponent#getModelType.

This is a pretty bad change because now every Component that used to
work with Serializable models now require the user to set the type
explicitly! Is there a way to fix this without having to change all
such components?

Thanks,

Alec

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org