This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 265380 - JSPTokenizer encounters stack overflows frequently when typing
Summary: JSPTokenizer encounters stack overflows frequently when typing
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: jst.jsp (show other bugs)
Version: 3.0.4   Edit
Hardware: PC Windows XP
: P1 major (vote)
Target Milestone: 3.0.5   Edit
Assignee: Nick Sandonato CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
: 265370 268214 270188 271796 282829 (view as bug list)
Depends on:
Blocks: 266414
  Show dependency tree
 
Reported: 2009-02-18 17:24 EST by Nick Sandonato CLA
Modified: 2009-07-08 09:15 EDT (History)
8 users (show)

See Also:
thatnitind: review+


Attachments
patch with generated tokenizer (6.68 KB, patch)
2009-02-19 17:54 EST, Nick Sandonato CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Sandonato CLA 2009-02-18 17:24:47 EST
When typing into the JSP editor, the tokenizer will frequently overflow its JSP tag stack. It looks like this is occurring because each succession of typing a character is considered a new tag by the tokenizer:
<c
<c:
<c:o
<c:ou
<c:out

will push 5 boolean values onto the stack.

Meanwhile, terminating the tag will only pop one value from the stack.  This results in an eventual stack overflow.
Comment 1 Nick Sandonato CLA 2009-02-19 17:19:19 EST
*** Bug 265370 has been marked as a duplicate of this bug. ***
Comment 2 Nick Sandonato CLA 2009-02-19 17:54:36 EST
Created attachment 126236 [details]
patch with generated tokenizer

I've attached a patch that resolves the stack overflow. The issue was that fJspTagStack was not being cleared on reset. So each time a new character was entered in a tag name, it was being added to the stack, but because the tag was never properly terminated (thus closing the scope of the tag), its state was never popped. This would eventually lead to a stack overflow after roughly 100 characters were entered.

Now, when the tokenizer is reset, the stack is cleared. The changes in the generated source code from the jflex spec was small enough that I felt I could include it in the patch.

I've added a test that modifies a document by inserting a series of elements character-by-character.
Comment 3 Nick Sandonato CLA 2009-02-19 17:57:01 EST
Nitin, could you please review this?
Comment 4 Nick Sandonato CLA 2009-03-10 10:49:59 EDT
Released to Maintenance and Head.
Comment 5 Nick Sandonato CLA 2009-03-12 09:22:58 EDT
*** Bug 268214 has been marked as a duplicate of this bug. ***
Comment 6 Nitin Dahyabhai CLA 2009-03-27 13:55:14 EDT
*** Bug 270188 has been marked as a duplicate of this bug. ***
Comment 7 Nitin Dahyabhai CLA 2009-04-09 12:53:18 EDT
*** Bug 271796 has been marked as a duplicate of this bug. ***
Comment 8 Jonathan Pearson CLA 2009-04-09 15:29:37 EDT
How would one go about integrating this patch into an existing Eclipse installation?
Comment 9 Nick Sandonato CLA 2009-04-09 15:41:42 EDT
Keep an eye on bug 271506, which is tracking moving this fix to the update site. Once there, you should be able to update like normal to pull down the fix.
Comment 10 Nick Sandonato CLA 2009-07-08 09:15:40 EDT
*** Bug 282829 has been marked as a duplicate of this bug. ***