Uploaded image for project: 'Click'
  1. Click
  2. CLK-312

request.setCharacterEncoding is called after request parameters are read

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None
    • Environment:
      Click 1.4RC3

      Description

      Ricardo identified a problem in ClickServlet where request.setCharacterEncoding is called after ClickRequestWrapper is created which can potentially read request parameters in the case of a file upload.

      According to the Servlet javadoc ServletRequest#setCharacterEncoding states:

      This method must be called prior to reading request parameters or reading input using getReader().

      To fix we can move the request.setCharacterEncoding code before we create a new Context.

      Kudos to Ricardo for identifying and providing a fix for this issue!

        Activity

        Hide
        medgar Malcolm Edgar added a comment -

        OK, sounds like this patch should be applied for 1.4. With the charset being applied if defined.

        Show
        medgar Malcolm Edgar added a comment - OK, sounds like this patch should be applied for 1.4. With the charset being applied if defined.
        Hide
        sabob Bob Schellink added a comment -

        Have applied the fix to trunk.

        Note that I have moved the request#setCharacterEncoding call inside the request instanceof check. That way the character encoding is only applied for new requests, not forwards and includes.

        Ricardo can you please check that this fix indeed resolve your issue?

        Show
        sabob Bob Schellink added a comment - Have applied the fix to trunk. Note that I have moved the request#setCharacterEncoding call inside the request instanceof check. That way the character encoding is only applied for new requests, not forwards and includes. Ricardo can you please check that this fix indeed resolve your issue?
        Hide
        rlecheta Ricardo R. Lecheta added a comment -

        Bob,

        after update the SVN, I could not build the framework.

        [javac] C:\Ricardo\JAVA\Click\Eclipse\Click-SVN\click\extras\src\net\sf\click\extras\cayenne\CayenneForm.java:730: cannot resolve symbol
        [javac] symbol : class DbAttribute
        [javac] location: class net.sf.click.extras.cayenne.CayenneForm
        [javac] DbAttribute attr = (DbAttribute) pkAttributes.get(0);
        [javac] ^
        [javac] 100 errors

        it seems that it also generate the "click-1.4.jar", not the RC3

        Show
        rlecheta Ricardo R. Lecheta added a comment - Bob, after update the SVN, I could not build the framework. [javac] C:\Ricardo\JAVA\Click\Eclipse\Click-SVN\click\extras\src\net\sf\click\extras\cayenne\CayenneForm.java:730: cannot resolve symbol [javac] symbol : class DbAttribute [javac] location: class net.sf.click.extras.cayenne.CayenneForm [javac] DbAttribute attr = (DbAttribute) pkAttributes.get(0); [javac] ^ [javac] 100 errors it seems that it also generate the "click-1.4.jar", not the RC3
        Hide
        medgar Malcolm Edgar added a comment -

        Is this issue resolved?

        regards Malcolm Edgar

        Show
        medgar Malcolm Edgar added a comment - Is this issue resolved? regards Malcolm Edgar
        Hide
        rlecheta Ricardo R. Lecheta added a comment -

        Hi Bob, Malcolm,

        yes it worked, thank you

        Show
        rlecheta Ricardo R. Lecheta added a comment - Hi Bob, Malcolm, yes it worked, thank you

          People

          • Assignee:
            sabob Bob Schellink
            Reporter:
            sabob Bob Schellink
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development