• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Post parameters are becoming null (at random)

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

My web application is developed with Struts2 and it was working fine till recently. All of a sudden one of the modules has started malfunctioning.

The malfunctioning module is 'Update Student details' page. This page has a lot of fields like 'schoolName', 'degreeName', etc .

School 1: <input name="schoolName">

School 2: <input name="schoolName">

.....
School n: <input name="schoolName">



As mentioned earlier, the page was working perfectly fine till recently. Now, one/many of the values of 'schoolName', 'degreeName', etc are being received as "" (EMPTY STRING) on the server-side.

For debugging, I used firebug and remote-debugging in eclipse. I find that the post-parameters are correct on the client-side. For instance, during one of the submissions the post-parameters were as below (i noted them from firebug).

Content-Type: multipart/form-data; boundary=---------------------------2921238217421
Content-Length: 48893

<OTHER_PARAMETERS> <!--Truncated for clarity -->

-----------------------------2921238217421
Content-Disposition: form-data; name="schoolName"

ABC Institute
-----------------------------2921238217421
Content-Disposition: form-data; name="schoolName"

Test School
-----------------------------2921238217421
Content-Disposition: form-data; name="schoolName"

XYZ
-----------------------------2921238217421
Content-Disposition: form-data; name="schoolName"

Texas Institute
-----------------------------2921238217421
Content-Disposition: form-data; name="schoolName"

XXXX School

-----------------------------2921238217421--



But on the server-side, the request params were as below:

schoolName=[ABC Institute, Test School, XYZ, , XXXX School],

"Texas Institute" was received as "" (EMPTY STRING) in this particular case. This is not happening consistently. The parameters that become NULL (or EMPTY STRING) seem random to me - during one instance, parameter schoolName[3] became null as illustrated above, parameter schoolName[2] became null during yet another submission, etc. At times, none of the parameters are nullified.

The following is the list of the interceptors in the action definition.

List of interceptors:
----------------------
FileUploadInterceptor org.apache.struts2.interceptor.FileUploadInterceptor
ServletConfigInterceptor org.apache.struts2.interceptor.ServletConfigInterceptor
StaticParametersInterceptor com.opensymphony.xwork2.interceptor.StaticParametersInterceptor
ParametersInterceptor com.opensymphony.xwork2.interceptor.ParametersInterceptor
MyCustomInterceptor com.xxxx.yyyy.interceptors.GetLoggedOnUserInterceptor


This issue appears rather weird to me and I have not been able to zero-in on the exact cause of the issue. Any help in this regard would be highly appreciated. Thanks in advance.


Thanks,
Raghuram
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What changed? Did you upgrade anything? Change code? Configs?
 
Raghuram Duraisamy
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi David,

Sorry for the late reply - was held up elsewhere.


What changed? Did you upgrade anything? Change code? Configs?



I upgraded commons-beanutils from 1.6 to 1.8. But after the issue turned up, i degraded back to 1.6 to check whether this was the cause. But parameters are getting lost even with beanutils1.6.


My form sends a multipart request (needed since file upload is enabled on the form). I decided to log the post-data that comes to the server. I modified RequestDumperFilter.java to log the multipart post data. After i added this filter, the parameter loss issue seems to have ceased (0 loss out of 150 submissions of form). I removed the filter and was able to reproduce the issue again.


Thanks,
Raghuram



 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll have to show some configuration or something; I don't have enough information to help.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, have you found a reason of the given behavior? Actually, I have the same bug, and your fix with RequestDumperFilter works for me also, but it is weird.
 
passwords must contain 14 characters, a number, punctuation, a small bird, a bit of cheese and a tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic