KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > core > breakpoints > JavaExceptionBreakpoint


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.debug.core.breakpoints;
12
13  
14 import java.util.ArrayList JavaDoc;
15 import java.util.HashSet JavaDoc;
16 import java.util.List JavaDoc;
17 import java.util.Map JavaDoc;
18 import java.util.Set JavaDoc;
19 import java.util.StringTokenizer JavaDoc;
20 import java.util.regex.Pattern JavaDoc;
21
22 import org.eclipse.core.resources.IResource;
23 import org.eclipse.core.resources.IWorkspaceRunnable;
24 import org.eclipse.core.runtime.CoreException;
25 import org.eclipse.core.runtime.IProgressMonitor;
26 import org.eclipse.debug.core.DebugException;
27 import org.eclipse.debug.core.model.IBreakpoint;
28 import org.eclipse.jdt.debug.core.IJavaDebugTarget;
29 import org.eclipse.jdt.debug.core.IJavaExceptionBreakpoint;
30 import org.eclipse.jdt.debug.core.IJavaObject;
31 import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin;
32 import org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget;
33 import org.eclipse.jdt.internal.debug.core.model.JDIThread;
34 import org.eclipse.jdt.internal.debug.core.model.JDIValue;
35
36 import com.sun.jdi.ClassType;
37 import com.sun.jdi.Location;
38 import com.sun.jdi.ObjectReference;
39 import com.sun.jdi.ReferenceType;
40 import com.sun.jdi.ThreadReference;
41 import com.sun.jdi.VMDisconnectedException;
42 import com.sun.jdi.event.Event;
43 import com.sun.jdi.event.ExceptionEvent;
44 import com.sun.jdi.request.EventRequest;
45 import com.sun.jdi.request.EventRequestManager;
46 import com.sun.jdi.request.ExceptionRequest;
47
48 public class JavaExceptionBreakpoint extends JavaBreakpoint implements IJavaExceptionBreakpoint {
49
50     private static final String JavaDoc JAVA_EXCEPTION_BREAKPOINT= "org.eclipse.jdt.debug.javaExceptionBreakpointMarker"; //$NON-NLS-1$
51

52     /**
53      * Exception breakpoint attribute storing the suspend on caught value
54      * (value <code>"org.eclipse.jdt.debug.core.caught"</code>). This attribute is stored as a <code>boolean</code>.
55      * When this attribute is <code>true</code>, a caught exception of the associated
56      * type will cause excecution to suspend .
57      */

58     protected static final String JavaDoc CAUGHT = "org.eclipse.jdt.debug.core.caught"; //$NON-NLS-1$
59
/**
60      * Exception breakpoint attribute storing the suspend on uncaught value
61      * (value <code>"org.eclipse.jdt.debug.core.uncaught"</code>). This attribute is stored as a
62      * <code>boolean</code>. When this attribute is <code>true</code>, an uncaught
63      * exception of the associated type will cause excecution to suspend.
64      */

65     protected static final String JavaDoc UNCAUGHT = "org.eclipse.jdt.debug.core.uncaught"; //$NON-NLS-1$
66
/**
67      * Exception breakpoint attribute storing the checked value (value <code>"org.eclipse.jdt.debug.core.checked"</code>).
68      * This attribute is stored as a <code>boolean</code>, indicating whether an
69      * exception is a checked exception.
70      */

71     protected static final String JavaDoc CHECKED = "org.eclipse.jdt.debug.core.checked"; //$NON-NLS-1$
72

73     /**
74      * Exception breakpoint attribute storing the String value (value <code>"org.eclipse.jdt.debug.core.filters"</code>).
75      * This attribute is stored as a <code>String</code>, a comma delimited list
76      * of class filters. The filters are applied as inclusion or exclusion depending on
77      * INCLUSIVE_FILTERS.
78      */

79     protected static final String JavaDoc INCLUSION_FILTERS = "org.eclipse.jdt.debug.core.inclusion_filters"; //$NON-NLS-1$
80

81     /**
82      * Exception breakpoint attribute storing the String value (value <code>"org.eclipse.jdt.debug.core.filters"</code>).
83      * This attribute is stored as a <code>String</code>, a comma delimited list
84      * of class filters. The filters are applied as inclusion or exclusion depending on
85      * INCLUSIVE_FILTERS.
86      */

87     protected static final String JavaDoc EXCLUSION_FILTERS = "org.eclipse.jdt.debug.core.exclusion_filters"; //$NON-NLS-1$
88
/**
89      * Allows the user to specify whether we should suspend if subclasses of the specified exception are thrown/caught
90      * @since 3.2
91      */

92     protected static final String JavaDoc SUSPEND_ON_SUBCLASSES = "org.eclipse.jdt.debug.core.suspend_on_subclasses"; //$NON-NLS-1$
93

94     /**
95      * Name of the exception that was actually hit (could be a
96      * subtype of the type that is being caught).
97      */

98     protected String JavaDoc fExceptionName = null;
99     
100     /**
101      * The current set of inclusion class filters.
102      */

103     protected String JavaDoc[] fInclusionClassFilters= null;
104     
105     /**
106      * The current set of inclusion class filters.
107      */

108     protected String JavaDoc[] fExclusionClassFilters= null;
109     
110     private ObjectReference fLastException;
111     private JDIDebugTarget fLastTarget;
112     
113     public JavaExceptionBreakpoint() {
114     }
115     
116     /**
117      * Creates and returns an exception breakpoint for the
118      * given (throwable) type. Caught and uncaught specify where the exception
119      * should cause thread suspensions - that is, in caught and/or uncaught locations.
120      * Checked indicates if the given exception is a checked exception.
121      * @param resource the resource on which to create the associated
122      * breakpoint marker
123      * @param exceptionName the fully qualified name of the exception for
124      * which to create the breakpoint
125      * @param caught whether to suspend in caught locations
126      * @param uncaught whether to suspend in uncaught locations
127      * @param checked whether the exception is a checked exception
128      * @param add whether to add this breakpoint to the breakpoint manager
129      * @return a Java exception breakpoint
130      * @exception DebugException if unable to create the associated marker due
131      * to a lower level exception.
132      */

133     public JavaExceptionBreakpoint(final IResource resource, final String JavaDoc exceptionName, final boolean caught, final boolean uncaught, final boolean checked, final boolean add, final Map JavaDoc attributes) throws DebugException {
134         IWorkspaceRunnable wr= new IWorkspaceRunnable() {
135
136             public void run(IProgressMonitor monitor) throws CoreException {
137                 // create the marker
138
setMarker(resource.createMarker(JAVA_EXCEPTION_BREAKPOINT));
139                 
140                 // add attributes
141
attributes.put(IBreakpoint.ID, getModelIdentifier());
142                 attributes.put(TYPE_NAME, exceptionName);
143                 attributes.put(ENABLED, Boolean.TRUE);
144                 attributes.put(CAUGHT, Boolean.valueOf(caught));
145                 attributes.put(UNCAUGHT, Boolean.valueOf(uncaught));
146                 attributes.put(CHECKED, Boolean.valueOf(checked));
147                 attributes.put(SUSPEND_POLICY, new Integer JavaDoc(getDefaultSuspendPolicy()));
148                 
149                 ensureMarker().setAttributes(attributes);
150                 
151                 register(add);
152             }
153
154         };
155         run(getMarkerRule(resource), wr);
156     }
157         
158     /**
159      * Creates a request in the given target to suspend when the given exception
160      * type is thrown. The request is returned installed, configured, and enabled
161      * as appropriate for this breakpoint.
162      */

163     protected EventRequest[] newRequests(JDIDebugTarget target, ReferenceType type) throws CoreException {
164         if (!isCaught() && !isUncaught()) {
165             return null;
166         }
167         ExceptionRequest request= null;
168         EventRequestManager manager = target.getEventRequestManager();
169         if (manager == null) {
170             target.requestFailed(JDIDebugBreakpointMessages.JavaExceptionBreakpoint_Unable_to_create_breakpoint_request___VM_disconnected__1, null);
171             return null;
172         }
173
174         try {
175             request= manager.createExceptionRequest(type, isCaught(), isUncaught());
176             configureRequest(request, target);
177         } catch (VMDisconnectedException e) {
178             if (target.isAvailable()) {
179                 JDIDebugPlugin.log(e);
180             }
181             return null;
182         } catch (RuntimeException JavaDoc e) {
183             target.internalError(e);
184             return null;
185         }
186         return new EventRequest[]{request};
187     }
188
189     /**
190      * Enable this exception breakpoint.
191      *
192      * If the exception breakpoint is not catching caught or uncaught,
193      * turn both modes on. If this isn't done, the resulting
194      * state (enabled with caught and uncaught both disabled)
195      * is ambiguous.
196      */

197     public void setEnabled(boolean enabled) throws CoreException {
198         if (enabled) {
199             if (!(isCaught() || isUncaught())) {
200                 setAttributes(new String JavaDoc[] {CAUGHT, UNCAUGHT}, new Object JavaDoc[] {Boolean.TRUE, Boolean.TRUE});
201             }
202         }
203         super.setEnabled(enabled);
204     }
205     
206     /**
207      * Sets the values for whether this breakpoint will
208      * suspend execution when the associated exception is thrown
209      * and caught or not caught.
210      */

211     protected void setCaughtAndUncaught(boolean caught, boolean uncaught) throws CoreException {
212         Object JavaDoc[] values= new Object JavaDoc[]{Boolean.valueOf(caught), Boolean.valueOf(uncaught)};
213         String JavaDoc[] attributes= new String JavaDoc[]{CAUGHT, UNCAUGHT};
214         setAttributes(attributes, values);
215     }
216         
217     /**
218      * @see IJavaExceptionBreakpoint#isCaught()
219      */

220     public boolean isCaught() throws CoreException {
221         return ensureMarker().getAttribute(CAUGHT, false);
222     }
223     
224     /**
225      * @see IJavaExceptionBreakpoint#setCaught(boolean)
226      */

227     public void setCaught(boolean caught) throws CoreException {
228         if (caught == isCaught()) {
229             return;
230         }
231         setAttribute(CAUGHT, caught);
232         if (caught && !isEnabled()) {
233             setEnabled(true);
234         } else if (!(caught || isUncaught())) {
235             setEnabled(false);
236         }
237         recreate();
238     }
239     
240     /* (non-Javadoc)
241      * @see org.eclipse.jdt.debug.core.IJavaExceptionBreakpoint#setSuspendOnSubclasses(boolean)
242      */

243     public void setSuspendOnSubclasses(boolean suspend) throws CoreException {
244         if(suspend != isSuspendOnSubclasses()) {
245             setAttribute(SUSPEND_ON_SUBCLASSES, suspend);
246             recreate();
247         }
248     }
249     
250     /* (non-Javadoc)
251      * @see org.eclipse.jdt.debug.core.IJavaExceptionBreakpoint#isSuspendOnSubclasses()
252      */

253     public boolean isSuspendOnSubclasses() throws CoreException {
254         return ensureMarker().getAttribute(SUSPEND_ON_SUBCLASSES, false);
255     }
256     
257     /**
258      * @see IJavaExceptionBreakpoint#isUncaught()
259      */

260     public boolean isUncaught() throws CoreException {
261         return ensureMarker().getAttribute(UNCAUGHT, false);
262     }
263     
264     /**
265      * @see IJavaExceptionBreakpoint#setUncaught(boolean)
266      */

267     public void setUncaught(boolean uncaught) throws CoreException {
268         if (uncaught == isUncaught()) {
269             return;
270         }
271         setAttribute(UNCAUGHT, uncaught);
272         if (uncaught && !isEnabled()) {
273             setEnabled(true);
274         } else if (!(uncaught || isCaught())) {
275             setEnabled(false);
276         }
277         recreate();
278     }
279     
280     /**
281      * @see IJavaExceptionBreakpoint#isChecked()
282      */

283     public boolean isChecked() throws CoreException {
284         return ensureMarker().getAttribute(CHECKED, false);
285     }
286         
287     /**
288      * @see JavaBreakpoint#setRequestThreadFilter(EventRequest)
289      */

290     protected void setRequestThreadFilter(EventRequest request, ThreadReference thread) {
291         ((ExceptionRequest)request).addThreadFilter(thread);
292     }
293     
294     /**
295      * @see JavaBreakpoint#handleBreakpointEvent(Event, JDIDebugTarget, JDIThread)
296      * Decides how to handle an exception being thrown
297      *
298      * @return true if we do not want to suspend false otherwise
299      */

300     public boolean handleBreakpointEvent(Event event, JDIDebugTarget target, JDIThread thread) {
301         if (event instanceof ExceptionEvent) {
302             ObjectReference ex = ((ExceptionEvent)event).exception();
303             fLastTarget = target;
304             fLastException = ex;
305             String JavaDoc name = null;
306             try {
307                 name = ex.type().name();
308                 if(!name.equals(getTypeName())) {
309                     if(!isSuspendOnSubclasses() & isSubclass((ClassType) ex.type(), getTypeName())) {
310                         return true;
311                     }
312                 }
313             } catch (VMDisconnectedException e) {
314                 return true;
315             } catch (CoreException e) {
316                 JDIDebugPlugin.log(e);
317             } catch (RuntimeException JavaDoc e) {
318                 try {
319                     target.targetRequestFailed(e.getMessage(), e);
320                 } catch (DebugException de) {
321                     JDIDebugPlugin.log(e);
322                     return false;
323                 }
324             }
325             setExceptionName(name);
326             if (getExclusionClassFilters().length >= 1
327                 || getInclusionClassFilters().length >= 1
328                 || filtersIncludeDefaultPackage(fInclusionClassFilters)
329                 || filtersIncludeDefaultPackage(fExclusionClassFilters)) {
330                     Location location = ((ExceptionEvent)event).location();
331                     String JavaDoc typeName = location.declaringType().name();
332                     boolean defaultPackage = typeName.indexOf('.') == -1;
333                     boolean included = true;
334                     String JavaDoc[] filters = getInclusionClassFilters();
335                     if (filters.length > 0) {
336                         included = matchesFilters(filters, typeName, defaultPackage);
337                     }
338                     boolean excluded = false;
339                     filters = getExclusionClassFilters();
340                     if (filters.length > 0) {
341                         excluded = matchesFilters(filters, typeName, defaultPackage);
342                     }
343                     if (included && !excluded) {
344                         return !suspend(thread);
345                     }
346                     return true;
347                 }
348             return !suspend(thread);
349         }
350         return true;
351     }
352     
353     /**
354      * Returns whether the given class type is a subclass of the classs
355      * with the given name.
356      *
357      * @param type the class type reference
358      * @return true if the specified the class type is a subclass of the class
359      * with the given name
360      * @since 3.2
361      */

362     private boolean isSubclass(ClassType type, String JavaDoc typeName) {
363         type = type.superclass();
364         while (type != null) {
365             if (type.name().equals(typeName)) {
366                 return true;
367             }
368             type = type.superclass();
369         }
370         return false;
371     }
372     
373     /* (non-Javadoc)
374      * @see org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint#setInstalledIn(org.eclipse.jdt.debug.core.IJavaDebugTarget, boolean)
375      */

376     protected void setInstalledIn(IJavaDebugTarget target, boolean installed) {
377         fLastException = null;
378         fLastTarget = null;
379         super.setInstalledIn(target, installed);
380     }
381
382     /**
383      * Determines of the filters for this exception include the default package or not
384      * @param filters the list of filters to inspect
385      * @return true if any one of the spcified filters include the default package
386      */

387     protected boolean filtersIncludeDefaultPackage(String JavaDoc[] filters) {
388         for (int i = 0; i < filters.length; i++) {
389             if (filters[i].length() == 0 || (filters[i].indexOf('.') == -1)) {
390                 return true;
391             }
392         }
393         return false;
394     }
395     
396     /**
397      * Returns whether the given type is in the given filter set.
398      *
399      * @param filters the filter set
400      * @param typeName fully qualified type name
401      * @param defaultPackage whether the type name is in the default package
402      * @return boolean
403      */

404     protected boolean matchesFilters(String JavaDoc[] filters, String JavaDoc typeName, boolean defaultPackage) {
405         for (int i = 0; i < filters.length; i++) {
406             String JavaDoc filter = filters[i];
407             if (defaultPackage && filter.length() == 0) {
408                 return true;
409             }
410             
411             filter = filter.replaceAll("\\.", "\\\\."); //$NON-NLS-1$//$NON-NLS-2$
412
filter = filter.replaceAll("\\*", "\\.\\*"); //$NON-NLS-1$//$NON-NLS-2$
413
Pattern JavaDoc pattern = Pattern.compile(filter);
414             if (pattern.matcher(typeName).find()) {
415                 return true;
416             }
417         }
418         return false;
419     }
420     
421     /**
422      * Sets the name of the exception that was last hit
423      *
424      * @param name fully qualified exception name
425      */

426     protected void setExceptionName(String JavaDoc name) {
427         fExceptionName = name;
428     }
429
430     /* (non-Javadoc)
431      * @see org.eclipse.jdt.debug.core.IJavaExceptionBreakpoint#getExceptionTypeName()
432      */

433     public String JavaDoc getExceptionTypeName() {
434         return fExceptionName;
435     }
436     
437     /**
438      * @see IJavaExceptionBreakpoint#getFilters()
439      * @deprecated
440      */

441     public String JavaDoc[] getFilters() {
442         String JavaDoc[] iFilters= getInclusionFilters();
443         String JavaDoc[] eFilters= getExclusionFilters();
444         String JavaDoc[] filters= new String JavaDoc[iFilters.length + eFilters.length];
445         System.arraycopy(iFilters, 0, filters, 0, iFilters.length);
446         System.arraycopy(eFilters, 0, filters, iFilters.length, eFilters.length);
447         return filters;
448     }
449     
450     /**
451      * @see IJavaExceptionBreakpoint#setFilters(String[], boolean)
452      * @deprecated
453      */

454     public void setFilters(String JavaDoc[] filters, boolean inclusive) throws CoreException {
455         if (inclusive) {
456             setInclusionFilters(filters);
457         } else {
458             setExclusionFilters(filters);
459         }
460         recreate();
461     }
462     
463     /* (non-Javadoc)
464      * @see org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint#configureRequest(com.sun.jdi.request.EventRequest, org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget)
465      */

466     protected void configureRequest(EventRequest eRequest, JDIDebugTarget target) throws CoreException {
467         String JavaDoc[] iFilters= getInclusionClassFilters();
468         String JavaDoc[] eFilters= getExclusionClassFilters();
469         
470         ExceptionRequest request= (ExceptionRequest)eRequest;
471         
472         if (iFilters.length == 1) {
473             if (eFilters.length ==0) {
474                 request.addClassFilter(iFilters[0]);
475             }
476         } else if (eFilters.length == 1) {
477             if (iFilters.length == 0) {
478                 request.addClassExclusionFilter(eFilters[0]);
479             }
480         }
481         
482         super.configureRequest(eRequest, target);
483     }
484     
485     /**
486      * Serializes the array of Strings into one comma
487      * separated String.
488      * Removes duplicates.
489      */

490     protected String JavaDoc serializeList(String JavaDoc[] list) {
491         if (list == null) {
492             return ""; //$NON-NLS-1$
493
}
494         Set JavaDoc set= new HashSet JavaDoc(list.length);
495
496         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
497         for (int i = 0; i < list.length; i++) {
498             if (i > 0) {
499                 buffer.append(',');
500             }
501             String JavaDoc pattern= list[i];
502             if (!set.contains(pattern)) {
503                 if (pattern.length() == 0) {
504                     //serialize the default package
505
pattern= "."; //$NON-NLS-1$
506
}
507                 buffer.append(pattern);
508             }
509         }
510         return buffer.toString();
511     }
512     
513     /**
514      * Parses the comma separated String into an array of Strings
515      */

516     protected String JavaDoc[] parseList(String JavaDoc listString) {
517         List JavaDoc list = new ArrayList JavaDoc(10);
518         StringTokenizer JavaDoc tokenizer = new StringTokenizer JavaDoc(listString, ","); //$NON-NLS-1$
519
while (tokenizer.hasMoreTokens()) {
520             String JavaDoc token = tokenizer.nextToken();
521             if (token.equals(".")) { //$NON-NLS-1$
522
//serialized form for the default package
523
//@see serializeList(String[])
524
token= ""; //$NON-NLS-1$
525
}
526             list.add(token);
527         }
528         return (String JavaDoc[])list.toArray(new String JavaDoc[list.size()]);
529     }
530     
531     /**
532      * @see IJavaExceptionBreakpoint#isInclusiveFiltered()
533      * @deprecated
534      */

535     public boolean isInclusiveFiltered() throws CoreException {
536         return ensureMarker().getAttribute(INCLUSION_FILTERS, "").length() > 0; //$NON-NLS-1$
537
}
538     
539     protected String JavaDoc[] getInclusionClassFilters() {
540         if (fInclusionClassFilters == null) {
541             try {
542                 fInclusionClassFilters= parseList(ensureMarker().getAttribute(INCLUSION_FILTERS, "")); //$NON-NLS-1$
543
} catch (CoreException ce) {
544                 fInclusionClassFilters= new String JavaDoc[]{};
545             }
546         }
547         return fInclusionClassFilters;
548     }
549
550     protected void setInclusionClassFilters(String JavaDoc[] filters) {
551         fInclusionClassFilters = filters;
552     }
553     
554     protected String JavaDoc[] getExclusionClassFilters() {
555         if (fExclusionClassFilters == null) {
556             try {
557                 fExclusionClassFilters= parseList(ensureMarker().getAttribute(EXCLUSION_FILTERS, "")); //$NON-NLS-1$
558
} catch (CoreException ce) {
559                 fExclusionClassFilters= new String JavaDoc[]{};
560             }
561         }
562         return fExclusionClassFilters;
563     }
564
565     protected void setExclusionClassFilters(String JavaDoc[] filters) {
566         fExclusionClassFilters = filters;
567     }
568     
569     /**
570      * @see JavaBreakpoint#installableReferenceType(ReferenceType, JDIDebugTarget)
571      */

572     protected boolean installableReferenceType(ReferenceType type, JDIDebugTarget target) throws CoreException {
573         String JavaDoc installableType= getTypeName();
574         String JavaDoc queriedType= type.name();
575         if (installableType == null || queriedType == null) {
576             return false;
577         }
578         if (installableType.equals(queriedType)) {
579             return queryInstallListeners(target, type);
580         }
581         
582         return false;
583     }
584     /**
585      * @see org.eclipse.jdt.debug.core.IJavaExceptionBreakpoint#getExclusionFilters()
586      */

587     public String JavaDoc[] getExclusionFilters() {
588         return getExclusionClassFilters();
589     }
590
591     /**
592      * @see org.eclipse.jdt.debug.core.IJavaExceptionBreakpoint#getInclusionFilters()
593      */

594     public String JavaDoc[] getInclusionFilters() {
595         return getInclusionClassFilters();
596     }
597
598     /**
599      * @see org.eclipse.jdt.debug.core.IJavaExceptionBreakpoint#setExclusionFilters(String[])
600      */

601     public void setExclusionFilters(String JavaDoc[] filters) throws CoreException {
602         String JavaDoc serializedFilters= serializeList(filters);
603         
604         if (serializedFilters.equals(ensureMarker().getAttribute(EXCLUSION_FILTERS, ""))) { //$NON-NLS-1$
605
//no change
606
return;
607         }
608
609         setExclusionClassFilters(filters);
610         
611         setAttribute(EXCLUSION_FILTERS, serializedFilters);
612         recreate();
613     }
614
615     /**
616      * @see org.eclipse.jdt.debug.core.IJavaExceptionBreakpoint#setInclusionFilters(String[])
617      */

618     public void setInclusionFilters(String JavaDoc[] filters) throws CoreException {
619         String JavaDoc serializedFilters= serializeList(filters);
620         
621         if (serializedFilters.equals(ensureMarker().getAttribute(INCLUSION_FILTERS, ""))) { //$NON-NLS-1$
622
//no change
623
return;
624         }
625
626         setInclusionClassFilters(filters);
627         
628         setAttribute(INCLUSION_FILTERS, serializedFilters);
629         recreate();
630     }
631     
632     /**
633      * @see org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint#addInstanceFilter(EventRequest, ObjectReference)
634      */

635     protected void addInstanceFilter(EventRequest request, ObjectReference object) {
636         if (request instanceof ExceptionRequest) {
637             ((ExceptionRequest)request).addInstanceFilter(object);
638         }
639     }
640     
641     /**
642      * Returns the last exception object that was encountered by this exception
643      *
644      * TODO: make API in future release.
645      *
646      * @return
647      */

648     public IJavaObject getLastException() {
649         if (fLastException != null) {
650             return (IJavaObject) JDIValue.createValue(fLastTarget, fLastException);
651         }
652         return null;
653     }
654 }
655
656
Popular Tags