Hi
Further to my other mail I have tracked the source of my problem here....
org.apache.commons.beanutils.PropertyUtils#setSimpleProperty
The problem is that when you submit a form, with a file element and the user has left
the file
elemet blank, it crashes.... The altered code below from line 1773 in PropertyUtils
gives the
following output just before the error
descriptor.getWriteMethod():1:public void
com.meganexus.networking.struts.form.ChangeContactForm.setPhoto(org.apache.struts.upload.FormFile)
descriptor.getWriteMethod():2:public void
com.meganexus.networking.struts.form.ChangeContactForm.setPhoto(org.apache.struts.upload.FormFile)
params:interface org.apache.struts.upload.FormFile,value.getClass():class
java.lang.String
So as you can see, the program expects a FormFile parameter, but gets a String....
Major error I
think
// Retrieve the property setter method for the specified property
PropertyDescriptor descriptor =
getPropertyDescriptor(bean, name);
if (descriptor == null) {
throw new NoSuchMethodException("Unknown property '" +
name + "'");
}
System.out.println("descriptor.getWriteMethod():1:"+descriptor.getWriteMethod().toString());
Method writeMethod = getWriteMethod(descriptor);
System.out.println("descriptor.getWriteMethod():2:"+descriptor.getWriteMethod().toString());
if (writeMethod == null) {
throw new NoSuchMethodException("Property '" + name +
"' has no setter method");
}
System.out.print("params:");
Class [] cls=writeMethod.getParameterTypes();
for (int i=0;i<cls.length;i++) {
System.out.print(cls[i].toString()+",");
}
System.out.println();
// Call the property setter method
Object values[] = new Object[1];
values[0] = value;
System.out.println("value.getClass():"+value.getClass());
writeMethod.invoke(bean, values);
}
[EMAIL PROTECTED]
Benjamin A. Janes
------------------------------------
BLUEWAVE SVERIGE
M. +46 (0)40-631 1068
F. +46 (0)40 -631 10 50
F. +46 (0)46-540 03 50
Drottninggatan 18,
S-211 49 Malm�,
Sweden
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]