From 602170f45acfb7a45d92d7ced1f2f1206d6fc4dd Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 1 Apr 2005 16:38:04 +0000 Subject: [PATCH] Build date determination --- src/jalview/bin/Cache.java | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 7eaae62..7dbdc94 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -31,31 +31,27 @@ public class Cache public static void loadProperties() { // get last build time. + long date = 0; try{ - long date = 0; - String localFile = Cache.class.getProtectionDomain().getCodeSource().getLocation().toString(); localFile = localFile.concat("!/"); String tmpString = "jar:"; String localJarFileString = tmpString.concat(localFile); java.net.URL localJarFileURL = new java.net.URL(localJarFileString); java.net.JarURLConnection localJarFile = (java.net.JarURLConnection)localJarFileURL.openConnection(); - date = localJarFile.getLastModified(); + }catch(Exception ex){ex.printStackTrace();} + if(date==0) + { + // this is called for unpackaged class files. + // not entirely accurate as it only tells you when Cache.class was last compiled + java.net.URL url = Cache.class.getResource("/jalview/bin/Cache.class"); + java.io.File f = new java.io.File(url.getFile()); + date = f.lastModified(); + } - if(date==0) - { - // this is called for unpackaged class files. - // not entirely accurate as it only tells you when Cache.class was last compiled - java.net.URL url = Cache.class.getResource("/jalview/bin/Cache.class"); - java.io.File f = new java.io.File(url.getFile()); - date = f.lastModified(); - } - - BUILD_DATE = new Date( date ).toString(); - + BUILD_DATE = new Date( date ).toString(); - }catch(Exception ex){ex.printStackTrace();} applicationProperties = new Properties(); -- 1.7.10.2