Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/catchLocation/location002a.java
41161 views
/*1* Copyright (c) 2001, 2018, 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*/2223package nsk.jdi.ExceptionEvent.catchLocation;2425import nsk.share.*;26import nsk.share.jpda.*;27import nsk.share.jdi.*;2829import java.io.*;30import java.lang.Integer.*;3132// This class is the debugged application in the test3334class location002a {35static final int PASSED = 0;36static final int FAILED = 2;37static final int JCK_STATUS_BASE = 95;3839// synchronization commands40static final String COMMAND_READY = "ready";41static final String COMMAND_QUIT = "quit";42static final String COMMAND_GO = "go";43static final String COMMAND_DONE = "done";44static final String COMMAND_ERROR = "error";4546// start debuggee47public static void main(String args[]) throws Throwable {48location002a _location002a = new location002a();49System.exit(JCK_STATUS_BASE + _location002a.runIt(args, System.err));50}5152// perform debugee execution53int runIt(String args[], PrintStream out) throws Throwable {54ArgumentHandler argHandler = new ArgumentHandler(args);55IOPipe pipe = argHandler.createDebugeeIOPipe();56Log log = new Log(out, argHandler);5758// notify debuggeer that debuggee started59pipe.println(COMMAND_READY);6061// wait for command <GO> from debugger62String command = pipe.readln();63if (!command.equals(COMMAND_GO)) {64log.complain("TEST BUG: unknown command: " + command);65return FAILED;66}6768// throw uncaught exception, which should terminate debuggee69System.err.println("Raising NumberFormatException");70int i = Integer.parseInt("foo");7172// return FAILED if not terminated by uncaught exception73return FAILED;74}75}767778