Path: blob/master/test/jdk/com/sun/jdi/CountEvent.java
41149 views
/*1* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/**24* @test25* @bug 431535226* @summary disabling EventRequest expired with addCountFilter() throws27* InternalException.28* @author Robert Field29*30* @run build TestScaffold VMConnection TargetAdapter TargetListener31* @run compile -g CountEvent.java32* @run driver CountEvent33*/34import com.sun.jdi.*;35import com.sun.jdi.event.*;36import com.sun.jdi.request.*;3738class CountEventTarg {3940static CountEventTarg first = new CountEventTarg();41static CountEventTarg second = new CountEventTarg();42static CountEventTarg third = new CountEventTarg();4344public static void main(String args[]) {45start();46}4748static void start() {49first.go();50second.go();51third.go();52}5354void go() {55one();56two();57three();58}5960void one() {61}6263void two() {64}6566void three() {67}68}6970public class CountEvent extends TestScaffold {7172public static void main(String args[]) throws Exception {73new CountEvent(args).startTests();74}7576CountEvent(String args[]) throws Exception {77super(args);78}7980protected void runTests() throws Exception {8182BreakpointEvent bpe = startToMain("CountEventTarg");83ThreadReference thread = bpe.thread();8485StepEvent stepEvent = stepIntoLine(thread);8687ReferenceType clazz = thread.frame(0).location().declaringType();88String className = clazz.name();8990// uses addCountFilter91BreakpointEvent bpEvent = resumeTo(className, "go", "()V");9293bpEvent.request().disable();94System.out.println("About to resume");95resumeToVMDisconnect();9697if (!testFailed) {98println("CountEvent: passed");99} else {100throw new Exception("CountEvent: failed");101}102}103}104105106