DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25583>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25583 FormFile not entered, changes to String CLass Summary: FormFile not entered, changes to String CLass Product: Commons Version: 1.6 Final Platform: All OS/Version: Other Status: NEW Severity: Critical Priority: Other Component: Bean Utilities AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] I am using struts 1.1, and when I use a <html:file ... /> parameter it works fine as long as the user enteres a fileHowever when someone doesn't enter a file it crashes, as it converts the item to a String and then tries to setProperty(java.lang.String) instead of setProperty(org.apache.struts.upload. FormFile) I downloaded the source edited it adding some System.out.println etc. calls to track the error, following the changes I got this output just before a crash 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.. The altered code below from line 1773 in PropertyUtils // 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); } The Stack Trace: avax.servlet.ServletException: BeanUtils.populate at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor. java:821) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) --- and so on root cause java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl. java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils. java:1798) at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils. java:1684) at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java: 1713) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor. java:821) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) --- and so on --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
