void unexpectedErrorHandling(String message,final Throwable t){
  Throwable e=t;
  while (e.getCause() != null) {
    e=e.getCause();
  }
  e.printStackTrace();
  if (e instanceof OutOfMemoryError) {
    LoneOptionDialog.showMessageDialog("Sorry, an OutOfMemoryError occurred. Please restart " + ClientGameConfiguration.get("GAME_NAME") + ".");
  }
 else   if (e instanceof LinkageError || e instanceof SecurityException || e instanceof ClassNotFoundException) {
    int res=LoneOptionDialog.showConfirmDialog(message + " Sorry an error occurred because of an inconsistent update state.\r\nDelete update files so that they are downloaded again after you restart " + ClientGameConfiguration.get("GAME_NAME")+ "?",ClientGameConfiguration.get("GAME_NAME"),JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
    if (res == JOptionPane.YES_OPTION) {
      clearUpdateFiles();
    }
  }
 else {
    String errorMessage=stacktraceToString(e);
    LoneOptionDialog.showMessageDialog(message + " An unexpected error occurred.\r\nPlease open a bug report at http://sf.net/projects/arianne with this error message:\r\n" + errorMessage);
  }
  System.exit(1);
}

void unexpectedErrorHandling ( String message , final Throwable t ) { Throwable e = t ; while ( e . getCause ( ) != null ) { e = e . getCause ( ) ; } e . printStackTrace ( ) ; if ( e instanceof OutOfMemoryError ) { LoneOptionDialog . showMessageDialog ( "Sorry, an OutOfMemoryError occurred. Please restart " + ClientGameConfiguration . get ( "GAME_NAME" ) + "." ) ; } else if ( e instanceof LinkageError || e instanceof SecurityException || e instanceof ClassNotFoundException ) { int res = LoneOptionDialog . showConfirmDialog ( message + " Sorry an error occurred because of an inconsistent update state.\r\nDelete update files so that they are downloaded again after you restart " + ClientGameConfiguration . get ( "GAME_NAME" ) + "?" , ClientGameConfiguration . get ( "GAME_NAME" ) , JOptionPane . YES_NO_OPTION , JOptionPane . QUESTION_MESSAGE ) ; if ( res == JOptionPane . YES_OPTION ) { clearUpdateFiles ( ) ; } } else { String errorMessage = stacktraceToString ( e ) ; LoneOptionDialog . showMessageDialog ( message + " An unexpected error occurred.\r\nPlease open a bug report at http://sf.net/projects/arianne with this error message:\r\n" + errorMessage ) ; } System . exit ( 1 ) ; }
handles exceptions during program invocation .
