コード例 #1
0
 /* gets target VM version from the given VMVersionMismatchException.
  * Note that we need to reflectively call the method because of we may
  * have got this from different classloader's namespace */
 private static String getVMVersion(Throwable throwable)
     throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
   // assert isVMVersionMismatch(throwable), "not a VMVersionMismatch"
   Class expClass = throwable.getClass();
   Method targetVersionMethod = expClass.getMethod("getTargetVersion", new Class[0]);
   return (String) targetVersionMethod.invoke(throwable);
 }
コード例 #2
0
 /* Is the given throwable an instanceof VMVersionMismatchException?
  * Note that we can't do instanceof check because the exception
  * class might have been loaded by a different class loader.
  */
 private static boolean isVMVersionMismatch(Throwable throwable) {
   String className = throwable.getClass().getName();
   return className.equals("sun.jvm.hotspot.runtime.VMVersionMismatchException");
 }