From 27ed0a72faaa85ba456a24c8292735bbe2fa82ab Mon Sep 17 00:00:00 2001 From: Tobias Kellner Date: Mon, 12 Jan 2015 18:59:30 +0100 Subject: JarLocation fix --- .../src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'BKUApplet/src/main/java/at') diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java index 8ae1471b..46ee4102 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java @@ -31,6 +31,7 @@ import java.awt.Container; import java.awt.Point; import java.io.IOException; import java.net.MalformedURLException; +import java.net.URISyntaxException; import java.net.URL; import java.security.AccessController; import java.security.AllPermission; @@ -58,6 +59,7 @@ import at.gv.egiz.bku.gui.BKUGUIImpl; import at.gv.egiz.bku.gui.HelpListener; import at.gv.egiz.bku.gui.viewer.FontProvider; import at.gv.egiz.bku.online.applet.viewer.URLFontLoader; +import at.gv.egiz.bku.utils.JarLocation; import at.gv.egiz.smcc.SignatureCardFactory; import at.gv.egiz.stal.service.STALPortType; import at.gv.egiz.stal.service.STALService; @@ -107,8 +109,8 @@ public class BKUApplet extends JApplet { String tmp = UNKNOWN_VERSION; Logger log = LoggerFactory.getLogger(BKUApplet.class); try { - String BKUAppletJar = BKUApplet.class.getProtectionDomain().getCodeSource().getLocation().toString(); - URL manifestURL = new URL("jar:" + BKUAppletJar + "!/META-INF/MANIFEST.MF"); + String bKUAppletJar = JarLocation.get(BKUApplet.class); + URL manifestURL = new URL("jar:" + bKUAppletJar + "!/META-INF/MANIFEST.MF"); log.trace("Read version information from {}.", manifestURL); Manifest manifest = new Manifest(manifestURL.openStream()); Attributes atts = manifest.getMainAttributes(); @@ -117,6 +119,8 @@ public class BKUApplet extends JApplet { } } catch (IOException ex) { log.error("Failed to read version.", ex); + } catch (URISyntaxException ex) { + log.error("Failed to read version.", ex); } finally { VERSION = tmp; log.debug("BKU Applet {}.", VERSION); -- cgit v1.2.3