Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6222200

REGRESSION: JEditorPane posts HTML content with post even using GET

XMLWordPrintable

    • b08
    • b94
    • x86
    • linux

      FULL PRODUCT VERSION :
      java version "1.5.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
      Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)


      ADDITIONAL OS VERSION INFORMATION :
      Linux lianli 2.4.21-166-athlon #1 Thu Dec 18 18:24:05 UTC 2003 i686 athlon i386 GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      An HTML page containing a formular (<form ... method="post">...</form>) is displayed within a JEditorPane. When hitting the submit button in the form, the cgi script is triggered but the script sais REQUEST_METHOD = "GET", although "method=post" is set in the HTML page.

      Further:
      CONTENT_LENGTH is not set
      read(STDIN, $buffer, 10); in the perl script results in an empty buffer.

      Exactly the same Code using Java 1.4.2_04 works fine.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      * save the following HTML code as a file:
      <html>
      <head></head>
      <body>
      <form action="http://cgi.snafu.de/nmichael/user-cgi-bin/javabug.pl" method="post">
      <input type="text" name="test" value="data">
      <input type="submit" value="Submit">
      </form>
      </body>
      </html>

      * call the Java program (code see below) with argument "file:./<filename>"
      * hit the submit button in the form

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      the results are produced by the following perl script installed on my webserver:

      #!/usr/bin/perl
      print "Content-type: text/html\n";
      print "Pragma: no-cache\n\n";
      read(STDIN, $buffer, 10);
      print "buffer's 10 first bytes=\"$buffer\"<br>\n";
      foreach $key (sort keys %ENV) { print "$key = \"$ENV{$key}\"<br>\n"; }

      This is the expected result. It can be produced by using Java 1.4.2_04:
      buffer's 10 first bytes="test=data"
      CONTENT_LENGTH = "9"
      CONTENT_TYPE = "application/x-www-form-urlencoded"
      [...]
      GATEWAY_INTERFACE = "CGI/1.1"
      [...]
      HTTP_USER_AGENT = "Java/1.4.2_04"
      [...]
      QUERY_STRING = ""
      [...]
      REQUEST_METHOD = "POST"
      [...]
      ACTUAL -
       when using Java 1.5.0, this is the result: Note that CONTENT_LENGTH is missing, the buffer is empty and method=GET instead of POST.

      buffer's 10 first bytes=""
      CONTENT_TYPE = "application/x-www-form-urlencoded"
      [...]
      GATEWAY_INTERFACE = "CGI/1.1"
      [...]
      HTTP_USER_AGENT = "Java/1.5.0_01"
      [...]
      QUERY_STRING = ""
      [...]
      REQUEST_METHOD = "GET"
      [...]

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      see above.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import javax.swing.*;

      public class JEditorPaneTest extends JFrame {
        JEditorPane pane = new JEditorPane();

        public JEditorPaneTest(String url) {
          try {
            pane = new JEditorPane();
            this.getContentPane().add(pane, BorderLayout.CENTER);
            pane.setContentType("text/html");
            pane.setPage(url);
            pane.setEditable(false);
          }
          catch(Exception e) {
            e.printStackTrace();
          }
        }

        public static void main(String[] args) {
          JEditorPaneTest frame = new JEditorPaneTest(args[0]);
          frame.show();
        }

      }
      ---------- END SOURCE ----------

      Release Regression From : 5.0
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.
      ###@###.### 2005-1-27 06:35:53 GMT

      =================

      It is release regression Wrom: TFJMV
      5.0 and 5.0_01 both use GET

      ###@###.### 2005-1-27 18:51:05 GMT

            gsm Sergey Groznyh (Inactive)
            jssunw Jitender S (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: