OutOfMemory try catch
authoramwaterhouse <Andrew Waterhouse>
Wed, 14 Sep 2005 12:40:29 +0000 (12:40 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 14 Sep 2005 12:40:29 +0000 (12:40 +0000)
src/jalview/gui/AlignmentPanel.java

index 1358257..f6e6114 100755 (executable)
@@ -860,7 +860,22 @@ public class AlignmentPanel extends GAlignmentPanel
 \r
             pg.flush();\r
             pg.close();\r
-        }\r
+          }\r
+          catch (OutOfMemoryError err)\r
+          {\r
+            System.out.println("########################\n"\r
+                               + "OUT OF MEMORY " + epsFile + "\n"\r
+                               + "########################");\r
+\r
+            JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+                                                  "Out of memory creating EPS file!!"\r
+                                                  +\r
+                                                  "\nSee help files for increasing Java Virtual Machine memory."\r
+                                                  , "Out of memory",\r
+                                                  JOptionPane.WARNING_MESSAGE);\r
+            System.out.println("Create EPS: " + err);\r
+            System.gc();\r
+          }\r
         catch (Exception ex)\r
         {\r
             ex.printStackTrace();\r
@@ -1007,12 +1022,21 @@ public class AlignmentPanel extends GAlignmentPanel
             ImageIO.write(bi, "png", out);\r
             out.close();\r
         }\r
-        catch(OutOfMemoryError err)\r
+        catch (OutOfMemoryError err)\r
         {\r
           System.out.println("########################\n"\r
-                             +"OUT OF MEMORY "+pngFile+"\n"\r
-                             +"########################");\r
+                             + "OUT OF MEMORY " + pngFile + "\n"\r
+                             + "########################");\r
+\r
+          JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+                                                "Out of memory creating PNG!!"\r
+                                                +\r
+                                                "\nSee help files for increasing Java Virtual Machine memory."\r
+                                                , "Out of memory",\r
+                                                JOptionPane.WARNING_MESSAGE);\r
+          System.out.println("Create PNG: " + err);\r
           System.gc();\r
+\r
         }\r
         catch (Exception ex)\r
         {\r