Bug 5162 - 1.0 -- JSP breakpoints don't get removed
Summary: 1.0 -- JSP breakpoints don't get removed
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P1 normal (vote)
Target Milestone: 2.0 M6   Edit
Assignee: Darin Wright CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-22 19:53 EDT by Jed Anderson CLA
Modified: 2002-04-16 23:33 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jed Anderson CLA 2001-10-22 19:53:04 EDT
This is a 1.0 stream stop-ship!

How to reproduce the bug:

- Publish and run the JSPandServletExample
- Run the Form example and get the result page
- Set a breakpoint in FormServletResultPage.jsp
- Refresh the browser on the result page (it's not necessary to go back to the
input form, just Refresh the result page)
- Debugger stops on breakpoint correctly.  Resume and run to completion to
display the JSP output.
- Remove the breakpoint
- Touch the JSP file and save it
- Refresh the browser on the result page
- The JSP gets regenerated into .java, the .java gets compiled into .class, but
the browser hangs without displaying any output

- If you Refresh the browser again the result page will be displayed
- If you try to stop the server it won't stop successfully and you have to
terminate it.  Even after you terminate it, the Debug view still shows an
active Server Launcher process.
Following these steps, you will notice this bug every time.

The problem is that JDIDebugTarget.lineBreakpointRemoved(IMarker) makes the
following call, which always returns too early on PatternBreakpoints because the
breakpoint never has a type (only a pattern):
                ...
		String name= getTopLevelTypeName(breakpoint);
		if (name == null) {
			internalError(ERROR_BREAKPOINT_NO_TYPE);
			return;
		}
		List markers= (List) fDeferredBreakpointsByClass.get(name);
		if (markers == null) {
			return;
		}

		markers.remove(breakpoint);
		if (markers.isEmpty()) {
			fDeferredBreakpointsByClass.remove(name);
		}        }
Comment 1 Jed Anderson CLA 2001-10-22 19:55:50 EDT
Proposed fix follows.  This fixes the reported bug, but may have adverse side
effects.  I will spend some more time investigating the consequences of this fix.

Add the following method to PatternDebugTarget

protected void lineBreakpointRemoved(IMarker breakpoint) {	
	if (!PatternDebugModel.isPatternBreakpoint(breakpoint)) {
		super.lineBreakpointRemoved(breakpoint);
		return;
	}
	List list = removeBreakpointRequests(breakpoint);
	if (list != null) {
		//installed breakpoint
		Iterator iter = list.iterator();
		while (iter.hasNext()) {
			BreakpointRequest request = (BreakpointRequest)iter.next();
			try {
				// cannot delete an expired request
				if (!isExpired(request)) {
					getEventRequestManager().deleteEventRequest(request); // disable & remove
				}
			} catch (VMDisconnectedException e) {
				return;
			} catch (RuntimeException e) {
				internalError(e);
			}
		}
	}
	
	//deferred breakpoint
	if (!breakpoint.exists()) {
		//resource no longer exists
		return;
	}
	String name= getPattern(breakpoint);
	if (name == null) {
		internalError(ERROR_BREAKPOINT_NO_TYPE);
		return;
	}
	List markers= (List) fDeferredBreakpointsByClass.get(name);
	if (markers == null) {
		return;
	}

	markers.remove(breakpoint);
	if (markers.isEmpty()) {
		fDeferredBreakpointsByClass.remove(name);
	}
}
Comment 2 Jed Anderson CLA 2001-10-29 13:20:23 EST
PatternDebugTarget.defer(IMarker, String) did not check the list before adding 
the marker it was attempting to defer.  Adding this check allows breakpoints to 
be removed:

		if (!bps.contains(breakpoint)) {
			bps.add(breakpoint);
		}
Comment 3 Darin Wright CLA 2001-11-28 13:03:34 EST
Need to ensure the same problem does not exist in 2.0
Comment 4 Darin Wright CLA 2001-12-04 12:25:58 EST
Reduced severity to normal - not ciritcal for stable Dec 07 build.
Comment 5 Darin Wright CLA 2001-12-04 18:22:03 EST
Fixed in Rollup 1. Need to ensure that we work in 2.0.
Comment 6 Darin Wright CLA 2002-04-16 23:32:46 EDT
Fixed in 2.0
Comment 7 Darin Wright CLA 2002-04-16 23:33:17 EDT
Verified by Jay Cagle