com.sun.jdi.request.ExceptionRequest Java Examples

The following examples show how to use com.sun.jdi.request.ExceptionRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EventRequestSpec.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
synchronized void remove() {
    if (isResolved()) {
        Env.vm().eventRequestManager().deleteEventRequest(resolved());
    }
    if (refSpec instanceof PatternReferenceTypeSpec) {
        PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec;
        if (! prs.isUnique()){
            /*
             * This is a class pattern.  Track down and delete
             * all EventRequests matching this spec.
             * Note: Class patterns apply only to ExceptionRequests,
             * so that is all we need to examine.
             */
            ArrayList<ExceptionRequest> deleteList = new ArrayList<ExceptionRequest>();
            for (ExceptionRequest er :
                     Env.vm().eventRequestManager().exceptionRequests()) {
                if (prs.matches(er.exception())) {
                    deleteList.add (er);
                }
            }
            Env.vm().eventRequestManager().deleteEventRequests(deleteList);
        }
    }
}
 
Example #2
Source File: EventRequestSpec.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
synchronized void remove() {
    if (isResolved()) {
        Env.vm().eventRequestManager().deleteEventRequest(resolved());
    }
    if (refSpec instanceof PatternReferenceTypeSpec) {
        PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec;
        if (! prs.isUnique()){
            /*
             * This is a class pattern.  Track down and delete
             * all EventRequests matching this spec.
             * Note: Class patterns apply only to ExceptionRequests,
             * so that is all we need to examine.
             */
            ArrayList<ExceptionRequest> deleteList = new ArrayList<ExceptionRequest>();
            for (ExceptionRequest er :
                     Env.vm().eventRequestManager().exceptionRequests()) {
                if (prs.matches(er.exception())) {
                    deleteList.add (er);
                }
            }
            Env.vm().eventRequestManager().deleteEventRequests(deleteList);
        }
    }
}
 
Example #3
Source File: EventRequestSpec.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
synchronized void remove() {
    if (isResolved()) {
        Env.vm().eventRequestManager().deleteEventRequest(resolved());
    }
    if (refSpec instanceof PatternReferenceTypeSpec) {
        PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec;
        if (! prs.isUnique()){
            /*
             * This is a class pattern.  Track down and delete
             * all EventRequests matching this spec.
             * Note: Class patterns apply only to ExceptionRequests,
             * so that is all we need to examine.
             */
            ArrayList<ExceptionRequest> deleteList = new ArrayList<ExceptionRequest>();
            for (ExceptionRequest er :
                     Env.vm().eventRequestManager().exceptionRequests()) {
                if (prs.matches(er.exception())) {
                    deleteList.add (er);
                }
            }
            Env.vm().eventRequestManager().deleteEventRequests(deleteList);
        }
    }
}
 
Example #4
Source File: EventRequestSpec.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
synchronized void remove() {
    if (isResolved()) {
        Env.vm().eventRequestManager().deleteEventRequest(resolved());
    }
    if (refSpec instanceof PatternReferenceTypeSpec) {
        PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec;
        if (! prs.isUnique()){
            /*
             * This is a class pattern.  Track down and delete
             * all EventRequests matching this spec.
             * Note: Class patterns apply only to ExceptionRequests,
             * so that is all we need to examine.
             */
            ArrayList<ExceptionRequest> deleteList = new ArrayList<ExceptionRequest>();
            for (ExceptionRequest er :
                     Env.vm().eventRequestManager().exceptionRequests()) {
                if (prs.matches(er.exception())) {
                    deleteList.add (er);
                }
            }
            Env.vm().eventRequestManager().deleteEventRequests(deleteList);
        }
    }
}
 
Example #5
Source File: EventRequestSpec.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
synchronized void remove() {
    if (isResolved()) {
        Env.vm().eventRequestManager().deleteEventRequest(resolved());
    }
    if (refSpec instanceof PatternReferenceTypeSpec) {
        PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec;
        if (! prs.isUnique()){
            /*
             * This is a class pattern.  Track down and delete
             * all EventRequests matching this spec.
             * Note: Class patterns apply only to ExceptionRequests,
             * so that is all we need to examine.
             */
            ArrayList<ExceptionRequest> deleteList = new ArrayList<ExceptionRequest>();
            for (ExceptionRequest er :
                     Env.vm().eventRequestManager().exceptionRequests()) {
                if (prs.matches(er.exception())) {
                    deleteList.add (er);
                }
            }
            Env.vm().eventRequestManager().deleteEventRequests(deleteList);
        }
    }
}
 
Example #6
Source File: EventRequestSpec.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
synchronized void remove() {
    if (isResolved()) {
        Env.vm().eventRequestManager().deleteEventRequest(resolved());
    }
    if (refSpec instanceof PatternReferenceTypeSpec) {
        PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec;
        if (! prs.isUnique()){
            /*
             * This is a class pattern.  Track down and delete
             * all EventRequests matching this spec.
             * Note: Class patterns apply only to ExceptionRequests,
             * so that is all we need to examine.
             */
            ArrayList<ExceptionRequest> deleteList = new ArrayList<ExceptionRequest>();
            for (ExceptionRequest er :
                     Env.vm().eventRequestManager().exceptionRequests()) {
                if (prs.matches(er.exception())) {
                    deleteList.add (er);
                }
            }
            Env.vm().eventRequestManager().deleteEventRequests(deleteList);
        }
    }
}
 
Example #7
Source File: EventRequestSpec.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
synchronized void remove() {
    if (isResolved()) {
        Env.vm().eventRequestManager().deleteEventRequest(resolved());
    }
    if (refSpec instanceof PatternReferenceTypeSpec) {
        PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec;
        if (! prs.isUnique()){
            /*
             * This is a class pattern.  Track down and delete
             * all EventRequests matching this spec.
             * Note: Class patterns apply only to ExceptionRequests,
             * so that is all we need to examine.
             */
            ArrayList<ExceptionRequest> deleteList = new ArrayList<ExceptionRequest>();
            for (ExceptionRequest er :
                     Env.vm().eventRequestManager().exceptionRequests()) {
                if (prs.matches(er.exception())) {
                    deleteList.add (er);
                }
            }
            Env.vm().eventRequestManager().deleteEventRequests(deleteList);
        }
    }
}
 
Example #8
Source File: EventRequestSpec.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
synchronized void remove() {
    if (isResolved()) {
        Env.vm().eventRequestManager().deleteEventRequest(resolved());
    }
    if (refSpec instanceof PatternReferenceTypeSpec) {
        PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec;
        if (! prs.isUnique()){
            /*
             * This is a class pattern.  Track down and delete
             * all EventRequests matching this spec.
             * Note: Class patterns apply only to ExceptionRequests,
             * so that is all we need to examine.
             */
            ArrayList<ExceptionRequest> deleteList = new ArrayList<ExceptionRequest>();
            for (ExceptionRequest er :
                     Env.vm().eventRequestManager().exceptionRequests()) {
                if (prs.matches(er.exception())) {
                    deleteList.add (er);
                }
            }
            Env.vm().eventRequestManager().deleteEventRequests(deleteList);
        }
    }
}
 
Example #9
Source File: EventRequestSpec.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
synchronized void remove() {
    if (isResolved()) {
        Env.vm().eventRequestManager().deleteEventRequest(resolved());
    }
    if (refSpec instanceof PatternReferenceTypeSpec) {
        PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec;
        if (! prs.isUnique()){
            /*
             * This is a class pattern.  Track down and delete
             * all EventRequests matching this spec.
             * Note: Class patterns apply only to ExceptionRequests,
             * so that is all we need to examine.
             */
            ArrayList<ExceptionRequest> deleteList = new ArrayList<ExceptionRequest>();
            for (ExceptionRequest er :
                     Env.vm().eventRequestManager().exceptionRequests()) {
                if (prs.matches(er.exception())) {
                    deleteList.add (er);
                }
            }
            Env.vm().eventRequestManager().deleteEventRequests(deleteList);
        }
    }
}
 
Example #10
Source File: EventRequestSpec.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
synchronized void remove() {
    if (isResolved()) {
        Env.vm().eventRequestManager().deleteEventRequest(resolved());
    }
    if (refSpec instanceof PatternReferenceTypeSpec) {
        PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec;
        if (! prs.isUnique()){
            /*
             * This is a class pattern.  Track down and delete
             * all EventRequests matching this spec.
             * Note: Class patterns apply only to ExceptionRequests,
             * so that is all we need to examine.
             */
            ArrayList<ExceptionRequest> deleteList = new ArrayList<ExceptionRequest>();
            for (ExceptionRequest er :
                     Env.vm().eventRequestManager().exceptionRequests()) {
                if (prs.matches(er.exception())) {
                    deleteList.add (er);
                }
            }
            Env.vm().eventRequestManager().deleteEventRequests(deleteList);
        }
    }
}
 
Example #11
Source File: EventRequestSpec.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
synchronized void remove() {
    if (isResolved()) {
        Env.vm().eventRequestManager().deleteEventRequest(resolved());
    }
    if (refSpec instanceof PatternReferenceTypeSpec) {
        PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec;
        if (! prs.isUnique()){
            /*
             * This is a class pattern.  Track down and delete
             * all EventRequests matching this spec.
             * Note: Class patterns apply only to ExceptionRequests,
             * so that is all we need to examine.
             */
            ArrayList<ExceptionRequest> deleteList = new ArrayList<ExceptionRequest>();
            for (ExceptionRequest er :
                     Env.vm().eventRequestManager().exceptionRequests()) {
                if (prs.matches(er.exception())) {
                    deleteList.add (er);
                }
            }
            Env.vm().eventRequestManager().deleteEventRequests(deleteList);
        }
    }
}
 
Example #12
Source File: EventRequestSpec.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
synchronized void remove() {
    if (isResolved()) {
        Env.vm().eventRequestManager().deleteEventRequest(resolved());
    }
    if (refSpec instanceof PatternReferenceTypeSpec) {
        PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec;
        if (! prs.isUnique()){
            /*
             * This is a class pattern.  Track down and delete
             * all EventRequests matching this spec.
             * Note: Class patterns apply only to ExceptionRequests,
             * so that is all we need to examine.
             */
            ArrayList<ExceptionRequest> deleteList = new ArrayList<ExceptionRequest>();
            for (ExceptionRequest er :
                     Env.vm().eventRequestManager().exceptionRequests()) {
                if (prs.matches(er.exception())) {
                    deleteList.add (er);
                }
            }
            Env.vm().eventRequestManager().deleteEventRequests(deleteList);
        }
    }
}
 
Example #13
Source File: EventRequestSpec.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
synchronized void remove() {
    if (isResolved()) {
        Env.vm().eventRequestManager().deleteEventRequest(resolved());
    }
    if (refSpec instanceof PatternReferenceTypeSpec) {
        PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec;
        if (! prs.isUnique()){
            /*
             * This is a class pattern.  Track down and delete
             * all EventRequests matching this spec.
             * Note: Class patterns apply only to ExceptionRequests,
             * so that is all we need to examine.
             */
            ArrayList<ExceptionRequest> deleteList = new ArrayList<ExceptionRequest>();
            for (ExceptionRequest er :
                     Env.vm().eventRequestManager().exceptionRequests()) {
                if (prs.matches(er.exception())) {
                    deleteList.add (er);
                }
            }
            Env.vm().eventRequestManager().deleteEventRequests(deleteList);
        }
    }
}
 
Example #14
Source File: ExceptionBreakpointImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected ExceptionRequest createEventRequest(EventRequest oldRequest) throws VMDisconnectedExceptionWrapper, InternalExceptionWrapper {
    ExceptionRequest excRequest = (ExceptionRequest) oldRequest;
    ExceptionRequest er = EventRequestManagerWrapper.createExceptionRequest (
            getEventRequestManager(),
            ExceptionRequestWrapper.exception(excRequest),
            ExceptionRequestWrapper.notifyCaught(excRequest),
            ExceptionRequestWrapper.notifyUncaught(excRequest)
        );
    addFilters(er, breakpoint.getClassFilters(), breakpoint.getClassExclusionFilters());
    return er;
}
 
Example #15
Source File: ExceptionBreakpointImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void addFilters(ExceptionRequest er, String[] classFilters, String[] classExclusionFilters) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper {
    int i, k = classFilters.length;
    for (i = 0; i < k; i++) {
        ExceptionRequestWrapper.addClassFilter (er, classFilters [i]);
    }
    k = classExclusionFilters.length;
    for (i = 0; i < k; i++) {
        ExceptionRequestWrapper.addClassExclusionFilter (er, classExclusionFilters [i]);
    }
}
 
Example #16
Source File: DebugSession.java    From java-debug with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, String[] classFilters, String[] classExclusionFilters) {
    EventRequestManager manager = vm.eventRequestManager();
    ArrayList<ExceptionRequest> legacy = new ArrayList<>(manager.exceptionRequests());
    manager.deleteEventRequests(legacy);
    // When no exception breakpoints are requested, no need to create an empty exception request.
    if (notifyCaught || notifyUncaught) {
        // from: https://www.javatips.net/api/REPLmode-master/src/jm/mode/replmode/REPLRunner.java
        // Calling this seems to set something internally to make the
        // Eclipse JDI wake up. Without it, an ObjectCollectedException
        // is thrown on request.enable(). No idea why this works,
        // but at least exception handling has returned. (Suspect that it may
        // block until all or at least some threads are available, meaning
        // that the app has launched and we have legit objects to talk to).
        vm.allThreads();
        // The bug may not have been noticed because the test suite waits for
        // a thread to be available, and queries it by calling allThreads().
        // See org.eclipse.debug.jdi.tests.AbstractJDITest for the example.

        // get only the uncaught exceptions
        ExceptionRequest request = manager.createExceptionRequest(null, notifyCaught, notifyUncaught);
        request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
        if (classFilters != null) {
            for (String classFilter : classFilters) {
                request.addClassFilter(classFilter);
            }
        }
        if (classExclusionFilters != null) {
            for (String exclusionFilter : classExclusionFilters) {
                request.addClassExclusionFilter(exclusionFilter);
            }
        }
        request.enable();
    }
}