Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-796

Servlet response contains DOS-style EOL characters

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Major Major
    • None
    • None
    • Web (Undertow)
    • None

      I'm running AS7 on Mac, but found sometimes my servlet PrintWriter produces output with dos-style eol. When opening the output in vi, there are a couple of ^M at end of line.

      This does not always happen. After trying out a few samples, I found if the line already contains line.separator, then its eol will be ^M. For example,

      PrintWriter out = response.getWriter();
      
      out.println("From " + System.getProperty("line.separator") + this);
      
      
      From
      
      test.TestServlet@180ab18^M
      
      

      If line.separator is not used when constructing servlet output, then everything looks normal.

      My guess is the servlet container may first apply a dos-style eol, then does some sort of replacing with native eol by searching for the first occurrence of line.separator.

            rmaucher Remy Maucherat
            cfang@redhat.com Cheng Fang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: