/*
* 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
/*
* Copyright 2003 Wily Technology, Inc.
*/
#include <jni.h>
#include <jvmti.h>
#include "JPLISAssert.h"
#include "Utilities.h"
#include "JavaExceptions.h"
/**
* This module contains utility routines for manipulating Java throwables
* and JNIEnv throwable state from native code.
*/
/*
* Local forward declarations.
*/
/* insist on having a throwable. If we already have one, return it.
* If not, map to fallback
*/
if ( potentialException == NULL ) {
return sFallbackInternalError;
}
else {
return potentialException;
}
}
/**
* Returns true if it properly sets up a fallback exception
*/
return (sFallbackInternalError != NULL);
}
/*
* Map everything to InternalError.
*/
return mappedThrowable;
}
}
}
void
if ( checkForThrowable(jnienv) ) {
}
}
/**
* and message passed to its constructor
*/
const char * className,
/* create new VMError with message from exception */
if (!errorOutstanding) {
"<init>",
}
if (!errorOutstanding) {
}
return exception;
}
return createThrowable( jnienv,
message);
}
switch ( errorCode ) {
case JVMTI_ERROR_NULL_POINTER:
break;
break;
break;
break;
break;
message = "class redefinition failed: attempted to add a method";
break;
break;
message = "class redefinition failed: attempted to change superclass or interfaces";
break;
message = "class redefinition failed: attempted to delete a method";
break;
message = "class redefinition failed: attempted to change the class modifiers";
break;
message = "class redefinition failed: attempted to change method modifiers";
break;
break;
message = "class names don't match";
break;
break;
break;
message = "class redefinition failed: invalid class";
break;
message = "unsupported operation";
break;
case JVMTI_ERROR_INTERNAL:
default:
break;
}
}
return createThrowable( jnienv,
}
/**
* Calls toString() on the given message which is the same call made by
* Exception when passed a throwable to its constructor
*/
/* call getMessage on exception */
if (!errorOutstanding) {
"toString",
}
if (!errorOutstanding) {
}
return message;
}
/**
* Returns whether the exception given is an unchecked exception:
* a subclass of Error or RuntimeException
*/
return result;
}
/*
* Returns the current throwable, if any. Clears the throwable state.
* Clients can use this to preserve the current throwable state on the stack.
*/
}
return result;
}
/*
* Installs the supplied throwable into the JNIEnv if the throwable is not null.
* Clients can use this to preserve the current throwable state on the stack.
*/
void
return;
}
void
}
return;
}
/*
* Always clears the JNIEnv throwable state. Returns true if an exception was present
* before the clearing operation.
*/
if ( result ) {
}
return result;
}
/* creates a java.lang.InternalError and installs it into the JNIEnv */
void
}
void
}
void
/* the throwable is now cleared, so JNI calls are safe */
if ( originalThrowable != NULL ) {
/* if there is an exception: we can just throw it if it is unchecked. If checked,
* we need to map it (mapper is conditional, will vary by usage, hence the callback)
*/
}
else {
}
}
/* re-establish the correct throwable */
if ( resultThrowable != NULL ) {
}
}