QDox
  1. QDox
  2. QDOX-78

EOL chars are discarded in comment

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.6
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      It seems that the getComment() method "swallow" all the end-of-line
      separators.

      For example, java.lang.String defines the following blockquote:

      • <p><blockquote><pre>
      • System.out.println("abc");
      • String cde = "cde";
      • System.out.println("abc" + cde);
      • String c = "abc".substring(2,3);
      • String d = cde.substring(1, 2);
      • </pre></blockquote>

      But getComment() returns the following text:

      <p><blockquote><pre> System.out.println("abc"); String cde = "cde";
      System.out.println("abc" + cde); String c = "abc".substring(2,3);
      String d = cde.substring(1, 2); </pre></blockquote>

      Here's a testcase to show the problem:

      public void testCommentsCanHaveNewlines() {
      String source = "" +
      "/** Hello\n"
      + "* world!"
      + "*/" +
      "class x{}";
      JavaDocBuilder builder = new JavaDocBuilder();
      builder.addSource(new StringReader(source));
      JavaClass x = builder.getClassByName("x");
      assertEquals("Hello\nworld!", x.getComment());
      }

        Activity

        Hide
        Joe Walnes added a comment -

        Done!

        Show
        Joe Walnes added a comment - Done!

          People

          • Assignee:
            Unassigned
            Reporter:
            Joe Walnes
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: