Author: jflesch
Date: 2007-07-09 16:21:13 +0000 (Mon, 09 Jul 2007)
New Revision: 14004
Modified:
trunk/apps/Thaw/src/thaw/core/Core.java
trunk/apps/Thaw/src/thaw/core/PluginManager.java
trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
trunk/apps/Thaw/src/thaw/i18n/thaw.properties
trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
trunk/apps/Thaw/src/thaw/plugins/TrayIcon.java
Log:
#1481 : Check the jvm version before trying to start the systray plugin
Modified: trunk/apps/Thaw/src/thaw/core/Core.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/Core.java 2007-07-09 16:04:05 UTC (rev
14003)
+++ trunk/apps/Thaw/src/thaw/core/Core.java 2007-07-09 16:21:13 UTC (rev
14004)
@@ -723,4 +723,35 @@
public boolean isStopping() {
return isStopping;
}
+
+
+ /*
+ * @param major always 1 atm
+ * @param minor 5, 6, etc, depending of what you want
+ */
+ public static boolean checkJavaVersion(int major, int minor) {
+ String ver = System.getProperty("java.version");
+
+ if (ver == null) {
+ Logger.notice(ver, "No Jvm version ?!");
+ return false;
+ }
+
+ Logger.info(ver, "JVM Version : "+ver);
+
+ String[] version = ver.split("\\.");
+
+ if (version.length < 2) {
+ Logger.notice(ver, "Can't parse the jvm version !");
+ return false;
+ }
+
+ if (Integer.parseInt(version[0]) < major)
+ return false;
+
+ if (Integer.parseInt(version[1]) < minor)
+ return false;
+
+ return true;
+ }
}
Modified: trunk/apps/Thaw/src/thaw/core/PluginManager.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/PluginManager.java 2007-07-09 16:04:05 UTC
(rev 14003)
+++ trunk/apps/Thaw/src/thaw/core/PluginManager.java 2007-07-09 16:21:13 UTC
(rev 14004)
@@ -197,7 +197,7 @@
try {
if(plugins.get(className) != null) {
- Logger.warning(this, "loadPlugin(): Plugin
'"+className+"' already loaded");
+ Logger.notice(this, "loadPlugin(): Plugin
'"+className+"' already loaded");
return null;
}
@@ -246,7 +246,8 @@
((Plugin)plugins.get(className)).stop();
} catch(final Exception e) {
- Logger.warning(this, "runPlugin('"+className+"'):
Exception: "+e);
+ Logger.error(this, "runPlugin('"+className+"'):
Exception: "+e);
+ e.printStackTrace();
return false;
}
@@ -260,14 +261,15 @@
public synchronized boolean unloadPlugin(final String className) {
try {
if(plugins.get(className) == null) {
- Logger.warning(this, "unloadPlugin(): Plugin
'"+className+"' already unloaded");
+ Logger.notice(this, "unloadPlugin(): Plugin
'"+className+"' already unloaded");
return false;
}
plugins.remove(className);
} catch(final Exception e) {
- Logger.warning(this, "unloadPlugin('"+className+"'):
Exception: "+e);
+ Logger.error(this, "unloadPlugin('"+className+"'):
Exception: "+e);
+ e.printStackTrace();
return false;
}
Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2007-07-09
16:04:05 UTC (rev 14003)
+++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2007-07-09
16:21:13 UTC (rev 14004)
@@ -507,3 +507,6 @@
thaw.plugin.transferLogs.importedKey=Clef import?e
thaw.plugin.trayIcon.pluginName=Ic?ne systray
+thaw.plugin.trayIcon.dialogTitle=Transferts Freenet
+thaw.plugin.trayIcon.java1.6=D?sol?, ce plugin n?cessite au moins Java 1.6
(parfois appell? J2SE 6)
+
Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2007-07-09 16:04:05 UTC
(rev 14003)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2007-07-09 16:21:13 UTC
(rev 14004)
@@ -519,4 +519,6 @@
thaw.plugin.trayIcon.pluginName=Tray icon
-thaw.plugin.trayIcon.dialogTitle=Thaw transfers
+thaw.plugin.trayIcon.dialogTitle=Freenet transfers
+thaw.plugin.trayIcon.java1.6=Sorry, this plugin requires at least Java 1.6
(aka J2SE 6)
+
Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2007-07-09 16:04:05 UTC
(rev 14003)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2007-07-09 16:21:13 UTC
(rev 14004)
@@ -507,3 +507,6 @@
thaw.plugin.transferLogs.importedKey=Clef import\u00e9e
thaw.plugin.trayIcon.pluginName=Ic\u00f4ne systray
+thaw.plugin.trayIcon.dialogTitle=Transferts Freenet
+thaw.plugin.trayIcon.java1.6=D\u00e9sol\u00e9, ce plugin n\u00e9cessite au
moins Java 1.6 (parfois appell\u00e9 J2SE 6)
+
Modified: trunk/apps/Thaw/src/thaw/plugins/TrayIcon.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/TrayIcon.java 2007-07-09 16:04:05 UTC
(rev 14003)
+++ trunk/apps/Thaw/src/thaw/plugins/TrayIcon.java 2007-07-09 16:21:13 UTC
(rev 14004)
@@ -33,6 +33,7 @@
import thaw.gui.SysTrayIcon;
import thaw.gui.TransferProgressBar;
import thaw.gui.IconBox;
+import thaw.gui.WarningWindow;
public class TrayIcon implements thaw.core.Plugin, MouseListener,
WindowListener, ActionListener {
private Core core;
@@ -53,6 +54,12 @@
public boolean run(Core core) {
this.core = core;
+ if (!Core.checkJavaVersion(1, 6)) {
+ new WarningWindow(core,
+
I18n.getMessage("thaw.plugin.trayIcon.java1.6"));
+ return false;
+ }
+
icon = new SysTrayIcon(thaw.gui.IconBox.blueBunny);
icon.setToolTip("Thaw "+thaw.core.Main.VERSION);
icon.addMouseListener(this);
@@ -66,6 +73,9 @@
public boolean stop() {
+ if (icon == null)
+ return false;
+
core.getMainWindow().removeWindowListener(this);
icon.removeMouseListener(this);