Yes, you need to set a Model object into FileUploadField. :-)

Bruno

-----Mensagem original-----
De: Martin Makundi [mailto:[EMAIL PROTECTED]
Enviada em: quarta-feira, 19 de novembro de 2008 14:33
Para: users@wicket.apache.org
Assunto: FileUploadField usage changed in 1.4 rc-1?


Hi!

My FileUploadField worked fine before:

      dataForm.add(fileUploadField = new FileUploadField(COMPANY_LOGO));

After upgrading to 1.4 rc-1 (from 1.4-m1) the upload crashes.

Am I doing something wrong or is there a bug in rc-1?

Caused by: java.lang.IllegalStateException: Attempt to set model
object on null model of component:
mainTabs:panel:innerTabs:panel:dataForm:company_logo
        at 
org.apache.wicket.Component.setDefaultModelObject(Component.java:2933)
        at 
org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1149)
        at 
org.apache.wicket.markup.html.form.Form$FormModelUpdateVisitor.component(Form.java:223)

ERROR - RequestCycle               - there was an error cleaning up target
java.lang.IllegalStateException: Attempt to set model object on null
model of component:
mainTabs:panel:innerTabs:panel:dataForm:company_logo
        at 
org.apache.wicket.Component.setDefaultModelObject(Component.java:2933)
        at 
org.apache.wicket.markup.html.form.FormComponent.setModelObject(FormComponent.java:1647)
        at 
org.apache.wicket.markup.html.form.upload.FileUploadField.onDetach(FileUploadField.java:175)
        at org.apache.wicket.Component.detach(Component.java:1119)

The 1.4-m-3 code avoided the nullpointer like this:
        @Override
        public void updateModel()
        {
                // Only update the model if one was passed in
                if (hasExplicitModel)
                {
                        setDefaultModelObject(getConvertedInput());
                }
        }

However, this "hasExplicitModel" is not there anymore in 1.4-rc1

No documentation seems to have changed..

**
Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

***************************************************************************************************
"Atenção: Esta mensagem foi enviada para uso exclusivo do(s) destinatários(s) 
acima identificado(s),
podendo conter informações e/ou documentos confidencias/privilegiados e seu 
sigilo é protegido por 
lei. Caso você tenha recebido por engano, por favor, informe o remetente e 
apague-a de seu sistema.
Notificamos que é proibido por lei a sua retenção, disseminação, distribuição, 
cópia ou uso sem 
expressa autorização do remetente. Opiniões pessoais do remetente não refletem, 
necessariamente, 
o ponto de vista da CETIP, o qual é divulgado somente por pessoas autorizadas."


"Warning: This message was sent for exclusive use of the addressees above 
identified, possibly 
containing information and or privileged/confidential documents whose content 
is protected by law. 
In case you have mistakenly received it, please notify the sender and delete it 
from your system. 
Be noticed that the law forbids the retention, dissemination, distribution, 
copy or use without 
express authorization from the sender. Personal opinions of the sender do not 
necessarily reflect 
CETIP's point of view, which is only divulged by authorized personnel."
***************************************************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to