?? nestedtrycatchfinallytest.java
字號:
/**
* Copyright (c) 2003-2004 Craig Setera
* All Rights Reserved.
* Licensed under the Eclipse Public License - v 1.0
* For more information see http://www.eclipse.org/legal/epl-v10.html
*/
package preverification.inputs;
import java.io.IOException;
import java.util.Vector;
import preverification.tests.ITestable;
import preverification.tests.TestException;
/**
* Type description
* <p />
* Copyright (c) 2003-2004 Craig Setera<br>
* All Rights Reserved.<br>
* Licensed under the Eclipse Public License - v 1.0<p/>
* <br>
* $Revision: 1.1 $
* <br>
* $Date: 2005/09/25 23:53:29 $
* <br>
* @author Craig Setera
*/
public class NestedTryCatchFinallyTest implements ITestable {
/**
* @see preverification.tests.ITestable#test(java.lang.Object[])
*/
public Object test(Object[] arguments)
throws TestException
{
Vector testData = new Vector();
boolean throwException = ((Boolean) arguments[0]).booleanValue();
try {
System.out.println("Begin outer try block");
testData.add(new Integer(1));
if (throwException) {
throw new IOException("Test Exception");
}
testData.add(new Integer(2));
System.out.println("End outer try block");
} catch (IOException e) {
System.out.println("Begin outer exception handler block");
testData.add(new Integer(3));
TestException te = new TestException(e.getMessage(), e);
te.setTestData(testData);
System.out.println("End outer exception handler block");
throw te;
} finally {
System.out.println("Begin outer finally block");
try {
System.out.println("Begin inner try block");
int i = 4;
testData.add(new Integer(i));
if (throwException) {
throw new IOException("Test Exception");
}
testData.add(new Integer(2));
System.out.println("End inner try block");
} catch (IOException e) {
System.out.println("Begin inner exception handler block");
testData.add(new Integer(5));
TestException te = new TestException(e.getMessage(), e);
te.setTestData(testData);
System.out.println("End inner exception handler block");
throw te;
} finally {
System.out.println("Begin inner finally block");
testData.add(new Integer(6));
System.out.println("End inner finally block");
}
System.out.println("End outer finally block");
}
return testData;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -