/*
 * This file is covered by the terms of the Common Public License v1.0.
 *
 * Copyright (c) SZEDER Gábor
 *
 * Parts of this software were developed within the JEOPARD research
 * project, which received funding from the European Union's Seventh
 * Framework Programme under grant agreement No. 216682.
 */

package de.fzi.cjunit.jpf.outside;

import gov.nasa.jpf.jvm.DynamicArea;
import gov.nasa.jpf.jvm.JVM;

import de.fzi.cjunit.jpf.exceptioninfo.ExceptionInfo;
import de.fzi.cjunit.jpf.exceptioninfo.ExceptionWrapper;


public class ExceptionInfoCollector {

	public ExceptionInfoCollector() { }

	public ExceptionInfo collectFromStack(JVM vm) {
		int argRef = vm.getLastThreadInfo().peek();
		if (argRef == -1) {
			throw new RuntimeException(
					"Cannot examine stack: " +
					"cannot collect ExceptionInfo");
		}

		return collectFromReference(argRef);
	}

	public ExceptionInfo collectFromReference(int argRef) {
		return new ExceptionWrapper(DynamicArea.getHeap().get(argRef));
	}
}

@@ -643,16 +643,33 @@
 (JVM vm)
+ throws Exception
  %7B%0A%09%09int
@@ -748,15 +748,8 @@
 new 
-Runtime
 Exce
@@ -754,22 +754,16 @@
 ception(
-%0A%09%09%09%09%09
 %22Cannot 

throw Exception instead of RuntimeException