| | |
| | | msg = i18n.getMsg(key); |
| | | } |
| | | |
| | | String tag; |
| | | if (isOutOfMemory(t)) |
| | | { |
| | | tag = "exception-out-of-memory-details"; |
| | | } |
| | | else |
| | | { |
| | | tag = "exception-details"; |
| | | } |
| | | String detail = t.toString(); |
| | | if (detail != null) |
| | | { |
| | | String[] arg = |
| | | { detail }; |
| | | msg = msg + " " + i18n.getMsg("exception-details", arg); |
| | | { detail }; |
| | | msg = msg + " " + i18n.getMsg(tag, arg); |
| | | } |
| | | return msg; |
| | | } |
| | |
| | | System.setProperty("com.apple.mrj.application.apple.menu.about.name", |
| | | appName); |
| | | } |
| | | |
| | | /** |
| | | * Tells whether this throwable has been generated for an out of memory |
| | | * error or not. |
| | | * @param t the throwable to analyze. |
| | | * @return <CODE>true</CODE> if the throwable was generated by an out of |
| | | * memory error and false otherwise. |
| | | */ |
| | | private static boolean isOutOfMemory(Throwable t) |
| | | { |
| | | boolean isOutOfMemory = false; |
| | | while (!isOutOfMemory && (t != null)) |
| | | { |
| | | if (t instanceof OutOfMemoryError) |
| | | { |
| | | isOutOfMemory = true; |
| | | } |
| | | else if (t instanceof IOException) |
| | | { |
| | | String msg = t.toString(); |
| | | if (msg != null) |
| | | { |
| | | isOutOfMemory = msg.indexOf("Not enough space") != -1; |
| | | } |
| | | } |
| | | t = t.getCause(); |
| | | } |
| | | return isOutOfMemory; |
| | | } |
| | | } |