X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Futil%2FForesterUtil.java;h=cb04e6521e93833a056a9756c4cad769ed6647ac;hb=cc75486aa58b98ab6fa53d8de4cb9b984a86bf83;hp=bf9dc7fb64715335f418d8343f218b1db8fa8e7a;hpb=99c1b5211c817dbe35a646589d9c4dbf508b8d50;p=jalview.git diff --git a/forester/java/src/org/forester/util/ForesterUtil.java b/forester/java/src/org/forester/util/ForesterUtil.java index bf9dc7f..cb04e65 100644 --- a/forester/java/src/org/forester/util/ForesterUtil.java +++ b/forester/java/src/org/forester/util/ForesterUtil.java @@ -933,6 +933,14 @@ public final class ForesterUtil { final public static void unexpectedFatalError( final Exception e ) { System.err.println(); + System.err.println( "unexpected exception: should not have occured! Please contact program author(s)." ); + e.printStackTrace( System.err ); + System.err.println(); + System.exit( -1 ); + } + + final public static void unexpectedFatalError( final Error e ) { + System.err.println(); System.err.println( "unexpected error: should not have occured! Please contact program author(s)." ); e.printStackTrace( System.err ); System.err.println(); @@ -979,7 +987,7 @@ public final class ForesterUtil { final int width = 50; System.out.print( "\r[" ); int i = 0; - for( ; i <= ( int ) ( progress_percentage * width ); i++ ) { + for( ; i <= ForesterUtil.roundToInt( progress_percentage * width ); i++ ) { System.out.print( "." ); } for( ; i < width; i++ ) { @@ -1054,4 +1062,13 @@ public final class ForesterUtil { final String regex = "[\\s;,]+"; return str.split( regex ); } + + public final static void outOfMemoryError( final OutOfMemoryError e ) { + System.err.println(); + System.err.println( "Java memory allocation might be too small, try \"-Xmx2048m\" java command line option" ); + System.err.println(); + e.printStackTrace( System.err ); + System.err.println(); + System.exit( -1 ); + } }