cleaned up exception handling
This commit is contained in:
parent
be9bc1570d
commit
9a388fbd99
|
@ -24,7 +24,7 @@
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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;
|
package se.sics.cooja;
|
||||||
|
@ -254,27 +254,12 @@ public class Simulation extends Observable implements Runnable {
|
||||||
isRunning = false;
|
isRunning = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
logger.warn("llegalArgumentException:" + e);
|
|
||||||
} catch (IllegalMonitorStateException e) {
|
|
||||||
logger.warn("IllegalMonitorStateException:" + e);
|
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
if (e.getClass().getName().contains("IllegalStateException")) { /* XXX Change exception type */
|
logger.fatal("Simulation stopped due to error", e);
|
||||||
/* MSPSim memory alignment exception */
|
|
||||||
logger.fatal("MSPSim detected memory alignment error: " + e);
|
|
||||||
} else {
|
|
||||||
logger.fatal("Simulation stopped for unknown reason: " + e);
|
|
||||||
|
|
||||||
/* Print exception stack trace with logger */
|
if (!GUI.isVisualized()) {
|
||||||
StackTraceElement[] stackTrace = e.getStackTrace();
|
/* Quit simulator if in test mode */
|
||||||
for (StackTraceElement element : stackTrace) {
|
System.exit(1);
|
||||||
logger.fatal(element.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GUI.isVisualized()) {
|
|
||||||
/* Quit simulator if in test mode */
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isRunning = false;
|
isRunning = false;
|
||||||
|
|
Loading…
Reference in a new issue