cleaned up exception handling

This commit is contained in:
nifi 2009-03-12 11:01:26 +00:00
parent be9bc1570d
commit 9a388fbd99

View file

@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: Simulation.java,v 1.45 2009/03/11 22:17:04 fros4943 Exp $
* $Id: Simulation.java,v 1.46 2009/03/12 11:01:26 nifi Exp $
*/
package se.sics.cooja;
@ -254,27 +254,12 @@ public class Simulation extends Observable implements Runnable {
isRunning = false;
}
}
} catch (IllegalArgumentException e) {
logger.warn("llegalArgumentException:" + e);
} catch (IllegalMonitorStateException e) {
logger.warn("IllegalMonitorStateException:" + e);
} catch (RuntimeException e) {
if (e.getClass().getName().contains("IllegalStateException")) { /* XXX Change exception type */
/* MSPSim memory alignment exception */
logger.fatal("MSPSim detected memory alignment error: " + e);
} else {
logger.fatal("Simulation stopped for unknown reason: " + e);
logger.fatal("Simulation stopped due to error", e);
/* Print exception stack trace with logger */
StackTraceElement[] stackTrace = e.getStackTrace();
for (StackTraceElement element : stackTrace) {
logger.fatal(element.toString());
}
if (!GUI.isVisualized()) {
/* Quit simulator if in test mode */
System.exit(1);
}
if (!GUI.isVisualized()) {
/* Quit simulator if in test mode */
System.exit(1);
}
}
isRunning = false;