mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-13 05:18:45 +00:00
Better OutOfMemory messages
This commit is contained in:
@@ -1176,7 +1176,7 @@ public class Main {
|
||||
}
|
||||
} catch (OutOfMemoryError ex) {
|
||||
logger.log(Level.SEVERE, null, ex);
|
||||
ViewMessages.showMessageDialog(getDefaultMessagesComponent(), "Cannot load SWF file. Out of memory.");
|
||||
handleOutOfMemory("Cannot load SWF file.");
|
||||
continue;
|
||||
} catch (SwfOpenException ex) {
|
||||
logger.log(Level.SEVERE, null, ex);
|
||||
@@ -1184,7 +1184,7 @@ public class Main {
|
||||
continue;
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, null, ex);
|
||||
ViewMessages.showMessageDialog(getDefaultMessagesComponent(), "Cannot load SWF file.");
|
||||
ViewMessages.showMessageDialog(getDefaultMessagesComponent(), "Cannot load SWF file: " + ex.getLocalizedMessage());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1563,24 +1563,36 @@ public class Main {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void handleOutOfMemory(String actionMessage) {
|
||||
String errorMessage = actionMessage;
|
||||
if (!errorMessage.isEmpty()) {
|
||||
errorMessage += " ";
|
||||
}
|
||||
long heapMaxSize = Runtime.getRuntime().maxMemory();
|
||||
long heapMaxSizeMb = heapMaxSize / 1024 / 1024;
|
||||
String currentMaxHeap = "" + heapMaxSizeMb + "m";
|
||||
errorMessage += AppStrings.translate("error.outOfMemory").replace("%maxheap%", currentMaxHeap);
|
||||
errorMessage += "\n";
|
||||
if (Platform.isWindows()) {
|
||||
errorMessage += AppStrings.translate("error.outOfMemory.windows");
|
||||
} else {
|
||||
errorMessage += AppStrings.translate("error.outOfMemory.unixmac");
|
||||
}
|
||||
errorMessage += "\n";
|
||||
if (Helper.is64BitOs() && !Helper.is64BitJre()) {
|
||||
errorMessage += AppStrings.translate("error.outOfMemory.32BitJreOn64bitOs");
|
||||
errorMessage += "\n";
|
||||
}
|
||||
|
||||
errorMessage += AppStrings.translate("error.outOfMemory.64bit");
|
||||
ViewMessages.showMessageDialog(getDefaultMessagesComponent(), errorMessage, AppStrings.translate("error.outOfMemory.title"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
public static void handleSaveError(Throwable ex) {
|
||||
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, "Error saving file", ex);
|
||||
if (ex instanceof OutOfMemoryError) {
|
||||
String errorMessage = AppStrings.translate("error.file.save") + ".";
|
||||
errorMessage += " ";
|
||||
long heapMaxSize = Runtime.getRuntime().maxMemory();
|
||||
long heapMaxSizeMb = heapMaxSize / 1024 / 1024;
|
||||
String currentMaxHeap = "" + heapMaxSizeMb + "m";
|
||||
errorMessage += AppStrings.translate("error.outOfMemory").replace("%maxheap%", currentMaxHeap);
|
||||
errorMessage += "\n";
|
||||
if (Platform.isWindows()) {
|
||||
errorMessage += AppStrings.translate("error.outOfMemory.windows");
|
||||
} else {
|
||||
errorMessage += AppStrings.translate("error.outOfMemory.unixmac");
|
||||
}
|
||||
errorMessage += "\n";
|
||||
errorMessage += AppStrings.translate("error.outOfMemory.64bit");
|
||||
ViewMessages.showMessageDialog(getDefaultMessagesComponent(), errorMessage, AppStrings.translate("error.outOfMemory.title"), JOptionPane.ERROR_MESSAGE);
|
||||
handleOutOfMemory(errorMessage);
|
||||
} else {
|
||||
ViewMessages.showMessageDialog(getDefaultMessagesComponent(), AppStrings.translate("error.file.save") + ": " + ex.getLocalizedMessage(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
@@ -2544,8 +2556,8 @@ public class Main {
|
||||
@Override
|
||||
public void uncaughtException(Thread t, Throwable e) {
|
||||
logger.log(Level.SEVERE, "Uncaught exception in thread: " + t.getName(), e);
|
||||
if (e instanceof OutOfMemoryError && !Helper.is64BitJre() && Helper.is64BitOs()) {
|
||||
ViewMessages.showMessageDialog(getDefaultMessagesComponent(), AppStrings.translate("message.warning.outOfMemory32BitJre"), AppStrings.translate("message.warning"), JOptionPane.WARNING_MESSAGE);
|
||||
if (e instanceof OutOfMemoryError) {
|
||||
handleOutOfMemory("");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -811,7 +811,8 @@ button.freetransform = Free transform
|
||||
|
||||
error.outOfMemory.title = Error - out of memory
|
||||
error.outOfMemory = The decompiler ran out of memory. Current maximum size of Java Heap is set to %maxheap%.
|
||||
error.outOfMemory.windows = You can increase this maximum by editing "ffdec.bat" file and then running the app via this file instead of "ffdec.exe".
|
||||
error.outOfMemory.windows = It is set to maximum available when you run app via "ffdec.exe".\nIf you run the app via "ffdec.bat", you can configure it in that file manually to higher value.
|
||||
error.outOfMemory.unixmac = You can increase this maximum by editing "ffdec.sh" file.
|
||||
error.outOfMemory.64bit = You need 64 bit OS and 64 bit Java to use more than cca 1GB.
|
||||
error.outOfMemory.64bit = You need 64 bit OS and 64 bit Java to use more memory than cca 1GB.
|
||||
error.outOfMemory.32BitJreOn64bitOs = WARNING: You are running 32bit Java on 64bit system. Please use 64bit Java.
|
||||
|
||||
|
||||
@@ -787,6 +787,7 @@ button.freetransform = Voln\u00e1 transformace
|
||||
|
||||
error.outOfMemory.title = Chyba - do\u0161la pam\u011b\u0165
|
||||
error.outOfMemory = Dekompil\u00e1toru do\u0161la pam\u011b\u0165. Aktu\u00e1ln\u00ed maxim\u00e1ln\u00ed velikost Java Heapu je nastavena na %maxheap%.
|
||||
error.outOfMemory.windows = Toto maximum m\u016f\u017eete nav\u00fd\u0161it upraven\u00edm souboru "ffdec.bat" a pak spou\u0161t\u011bn\u00edm aplikace p\u0159es tento soubor m\u00edsto "ffdec.exe".
|
||||
error.outOfMemory.windows = Pokud pou\u0161t\u00edte aplikaci p\u0159es "ffdec.exe", je to ji\u017e nastavov\u00e1no na maximum mo\u017en\u00e9 pam\u011bti, \npokud p\u0159es "ffdec.bat", m\u016f\u017eete to v tomto souboru nastavit manu\u00e1ln\u011b na vy\u0161\u0161\u00ed hodnotu.
|
||||
error.outOfMemory.unixmac = Toto maximum m\u016f\u017eete nav\u00fd\u0161it upraven\u00edm souboru "ffdec.sh".
|
||||
error.outOfMemory.64bit = Pro pou\u017eit\u00ed v\u00edc jak zhruba 1GB budete pot\u0159ebovat 64bitov\u00fd opera\u010dn\u00ed syst\u00e9m a 64bitovou Javu.
|
||||
error.outOfMemory.64bit = Pot\u0159ebujete 64 bitov\u00fd opera\u010dn\u00ed syst\u00e9m a 64 bitovou Javu pro pou\u017eit\u00ed v\u00edc jak zhruba 1GB.
|
||||
error.outOfMemory.32BitJreOn64bitOs = VAROV\u00c1N\u00cd: Pou\u017e\u00edv\u00e1te 32bitovou Javu na 64bitov\u00e9m syst\u00e9mu. Pros\u00edm pou\u017e\u00edvejte 64bitovou Javu.
|
||||
Reference in New Issue
Block a user