/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test OnThrowTest.java
* @bug 6263814
* @summary Test for -agentlib::[onthrow,launch]
* @author Kelly O'Hair
*
* @run compile -g OnThrowTest.java
* @run compile -g OnThrowTarget.java
* @run compile -g VMConnection.java
*/
/* Full pathname for file to be touched or created by the launch */
/* Name of touch file */
/* Make sure it's gone when we start */
f.delete();
if ( f.exists() ) {
throw new Exception("Test failed: Cannot remove old touch file: " +
}
}
/* Used to see if touch file exists */
private boolean touchFileExists() {
return f.exists();
}
/**
* Run an arbitrary command
*
*/
int subprocessStatus = 1;
}
try {
int BUFFERSIZE = 4096;
/*
* Gather up the output of the subprocess using non-blocking
* reads so we can get both the subprocess stdout and the
* subprocess stderr without overfilling any buffers.
*/
int isLen = 0;
byte[] isBuf = new byte[BUFFERSIZE];
int esLen = 0;
byte[] esBuf = new byte[BUFFERSIZE];
do {
if (isLen > 0) {
}
if (esLen > 0) {
}
try {
throw new Exception("Test failed: process interrupted");
}
} catch(IOException ex) {
throw new Exception("Test failed: IO error running process");
}
}
f.delete();
if ( ! f.exists() ) {
}
"-agentlib:jdwp=transport=dt_socket," +
"onthrow=OnThrowException,server=y,suspend=n," +
/* Run the target app, which will launch the launch script */
if ( !myTest.touchFileExists() ) {
throw new Exception("Test failed: touch file not found: " +
}
}
}