2 * Copyright (C) 2014, United States Government, as represented by the
3 * Administrator of the National Aeronautics and Space Administration.
6 * The Java Pathfinder core (jpf-core) platform is licensed under the
7 * Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0.
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 package gov.nasa.jpf.vm;
21 * @author Nastaran Shafiei <nastaran.shafiei@gmail.com>
23 * This unchecked exception is thrown by the host VM. It captures all errors
24 * and exceptions that can occur at the load of a JPF class, which includes
25 * defining, and resolving it. Here are some of the scenarios that this
26 * exception is thrown and captures the corresponding exception:
28 * * if the representation does not represent a class with the requested
29 * name, loading throws an instance of NoClassDefFoundError
31 * * if any of the superclasses of a class, is the class itself, or if
32 * any of the superinterfaces of an interface, is the interface itself,
33 * loading throws an instance of ClassCircularityError
35 * * if the representation is not a ClassFile structure, loading throws an
36 * instance of ClassFormatError
38 * If this exception is thrown during the initialization of VM, and the failed
39 * class is a system class, or creating of the main thread in not successful, we
40 * immediately bail out by throwing JPFException.
42 * While JPF is running, this error is handled by throwing an exception at the
43 * SUT level. This exception is handled if it is thrown by
45 * 1. a native peer method,
46 * 2. Intruction.execute(),
47 * 3. ThreadInfo.creatAndThrowException()
48 * 4. VM.initialize() // here it is handled only if it a non-system class
50 * If this exception is thrown by a Listener, the host VM throws JPFListenerException.
53 public class ClassInfoException extends RuntimeException{
55 ClassLoaderInfo classLoader;
56 String exceptionClass; // how we map this into the SUT (i.e. the JPF side)
59 public ClassInfoException(String details, ClassLoaderInfo cl, String exceptionClass, String faildClass) {
61 this.classLoader = cl;
62 this.exceptionClass = exceptionClass;
63 this.failedClass = faildClass;
66 public ClassInfoException (String details, ClassLoaderInfo cl, String exceptionClass, String faildClass, Throwable cause) {
67 super(details, cause);
68 this.classLoader = cl;
69 this.exceptionClass = exceptionClass;
70 this.failedClass = faildClass;
74 public boolean checkSystemClassFailure() {
75 return (failedClass.startsWith("java."));
78 public ClassLoaderInfo getClassLoaderInfo() {
82 public String getFailedClass() {
86 public String getExceptionClass() {
87 return exceptionClass;