Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 332472

Summary: Breakpoints being added to JSPs are not being hit
Product: [WebTools] WTP Source Editing Reporter: Nick Sandonato <nsand.dev>
Component: jst.jspAssignee: Nick Sandonato <nsand.dev>
Status: RESOLVED FIXED QA Contact: Nick Sandonato <nsand.dev>
Severity: normal    
Priority: P3 CC: ndsilva, thatnitind
Version: 3.2.2Flags: thatnitind: review+
Target Milestone: 3.2.3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch
none
updated patch
none
Corrects potential IIOBE none

Description Nick Sandonato CLA 2010-12-13 15:48:59 EST
Breakpoints added to the JSP editor are not being hit when their class pattern doesn't match the server's specific classnames.
Comment 1 Nick Sandonato CLA 2010-12-13 15:51:32 EST
Created attachment 185093 [details]
patch
Comment 2 Nitin Dahyabhai CLA 2010-12-13 17:16:33 EST
Don't forget to check for contentType also being null (in addition to pattern) and for trailing commas, not just extraneous leading ones.
Comment 3 Nick Sandonato CLA 2010-12-13 17:48:06 EST
Created attachment 185097 [details]
updated patch
Comment 4 Nitin Dahyabhai CLA 2010-12-14 13:59:53 EST
Almost a guaranteed IOOBE from buffer.charAt(buffer.length()).
Comment 5 Nick Sandonato CLA 2010-12-14 15:06:57 EST
Created attachment 185168 [details]
Corrects potential IIOBE
Comment 6 Nick Sandonato CLA 2010-12-14 17:42:33 EST
Thanks for the review. Committed.
Comment 7 Natasha D'Silva CLA 2010-12-22 12:09:15 EST
There is an issue with this patch that has to do with the content type hierarchy.
If I contribute the same pattern to the cssjspfragment content type and the jspfragment content type, then the final pattern contains duplicates.
Is there a way to check for duplicates or the content type hierarchy?
Comment 8 Nitin Dahyabhai CLA 2010-12-23 16:15:30 EST
(In reply to comment #7)
> There is an issue with this patch that has to do with the content type
> hierarchy.
> If I contribute the same pattern to the cssjspfragment content type and the
> jspfragment content type, then the final pattern contains duplicates.
> Is there a way to check for duplicates or the content type hierarchy?

Is there a reason not to attach the pattern to the main JSP content type?
Comment 9 Natasha D'Silva CLA 2010-12-23 17:14:13 EST
My pattern is specified for  the base JSP content type. 
When	Platform.getContentTypeManager().findContentTypesFor(resource.getName()) in JavaStratumBreakpointProvider.getClassPattern()

is called on a .jspf file, the only two content types returned are the css jsp fragment and the jsp fragment.  The base JSP content type is not included in the list. So, I had to explicitly add a pattern provider for those types, which results in the patterns being added to the breakpoint twice. 
So, perhaps the issue is in the findContentTypesFor() method.
The easy thing to do would be to put all the patterns in a set until we had checked all the contributors.  


A side effect of this is that breakpoints in .jspf files do not work when debugging on Tomcat, since WTP itself does not specify patterns for the (css)/jsp fragment content types.
Comment 10 Nitin Dahyabhai CLA 2011-01-06 08:40:31 EST
(In reply to comment #7)
> There is an issue with this patch that has to do with the content type
> hierarchy.
> If I contribute the same pattern to the cssjspfragment content type and the
> jspfragment content type, then the final pattern contains duplicates.
> Is there a way to check for duplicates or the content type hierarchy?

Then I think we need a new bug to allow for and remove duplicates on our end.
Comment 11 Natasha D'Silva CLA 2011-01-13 10:11:57 EST
Opened bug 334150 for the issue with jsp fragments.