Bug 294500

Summary: [formatter] MalformedTreeException when formatting an invalid sequence of <code> tags in a javadoc comment
Product: [Eclipse Project] JDT Reporter: Frederic Fusier <frederic_fusier>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann, satyam.kandula, srikanth_sankaran
Version: 3.6   
Target Milestone: 3.6 M4   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed patch none

Description Frederic Fusier CLA 2009-11-06 13:30:15 EST
Using 3.6M3 but it occurs since 3.4...

Consider the following test case:

package wkps3;
/**
 * This sample produce an MalformedTreeException
 * when formatted.
 *
 * <p> First paragraph
 * {@link java.lang.String </code>a simple
 * string<code>}.
 *
 * <p> Second paragraph.
 *
 * <p> Third paragraph. </p>
 *
 */
public class X01 {

}

Try to format it using the Eclipse built-in profile and you get a MalformedTreeException!
Comment 1 Frederic Fusier CLA 2009-11-06 13:33:09 EST
Note that modifying the comment 0 sample as follow:

package wkps3;
/**
 * This sample produce an AIIOBE when formatting.
 *
 * <p> First paragraph
 * {@link java.lang.String </code>a simple
 * string<code>}.
 */
public class X02 {

}

produces an AIOOBE when formatting it instead of a MTE... Not sure this is the same problem. I'll open a separate bug if after having investigated I see that's a different issue...
Comment 2 Frederic Fusier CLA 2009-11-09 17:08:37 EST
Created attachment 151747 [details]
Proposed patch

Store the html tag level when entering into an inline tag, hence it's possible to restore it if necessary when leaving...
Comment 3 Frederic Fusier CLA 2009-11-09 17:09:19 EST
Released for 3.6M4 in HEAD stream.
Comment 4 Satyam Kandula CLA 2009-12-08 04:46:49 EST
Verified for 3.6M4 using I20091207-1800
Comment 5 Srikanth Sankaran CLA 2009-12-08 04:55:06 EST
Verified for 3.6M4 using Build id: I20091207-1800