View Javadoc

1   /*
2    * Copyright  2000-2004 The Apache Software Foundation
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License"); 
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License. 
15   *
16   */ 
17  package org.apache.bcel.verifier.structurals;
18  
19  
20  import org.apache.bcel.generic.InstructionHandle;
21  import org.apache.bcel.generic.ObjectType;
22  
23  /***
24   * This class represents an exception handler; that is, an ObjectType
25   * representing a subclass of java.lang.Throwable and the instruction
26   * the handler starts off (represented by an InstructionContext).
27   * 
28   * @version $Id: ExceptionHandler.java 371539 2006-01-23 14:08:00Z tcurdt $
29   * @author Enver Haase
30   */
31  public class ExceptionHandler{
32  	/*** The type of the exception to catch. NULL means ANY. */
33  	private ObjectType catchtype;
34  	
35  	/*** The InstructionHandle where the handling begins. */
36  	private InstructionHandle handlerpc;
37  
38  	/*** Leave instance creation to JustIce. */
39  	ExceptionHandler(ObjectType catch_type, InstructionHandle handler_pc){
40  		catchtype = catch_type;
41  		handlerpc = handler_pc;
42  	}
43  
44  	/***
45  	 * Returns the type of the exception that's handled. <B>'null' means 'ANY'.</B>
46  	 */
47  	public ObjectType getExceptionType(){
48  		return catchtype;
49  	}
50  
51  	/***
52  	 * Returns the InstructionHandle where the handler starts off.
53  	 */
54  	public InstructionHandle getHandlerStart(){
55  		return handlerpc;
56  	}
57  }