|
From: <pe...@us...> - 2003-12-19 00:31:19
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons
In directory sc8-pr-cvs1:/tmp/cvs-serv18953/src/java/org/neuclear/commons
Modified Files:
LowLevelException.java Utility.java
Log Message:
Lots of usability changes through out all the passphrase agents and end user tools.
Index: LowLevelException.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/LowLevelException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** LowLevelException.java 11 Dec 2003 23:56:28 -0000 1.1
--- LowLevelException.java 19 Dec 2003 00:31:16 -0000 1.2
***************
*** 21,24 ****
--- 21,27 ----
$Id$
$Log$
+ Revision 1.2 2003/12/19 00:31:16 pelle
+ Lots of usability changes through out all the passphrase agents and end user tools.
+
Revision 1.1 2003/12/11 23:56:28 pelle
Trying to test the ReceiverServlet with cactus. Still no luck. Need to return a ElementProxy of some sort.
***************
*** 33,38 ****
*/
public class LowLevelException extends RuntimeException {
! public LowLevelException(Throwable throwable) {
! super("LowLevelException in a sub system of NeuClear", throwable);
}
}
--- 36,41 ----
*/
public class LowLevelException extends RuntimeException {
! public LowLevelException(Throwable e) {
! super("LowLevelException in a sub system of NeuClear:\n"+e.getLocalizedMessage(), e);
}
}
Index: Utility.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/Utility.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Utility.java 18 Dec 2003 17:40:07 -0000 1.3
--- Utility.java 19 Dec 2003 00:31:16 -0000 1.4
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * Revision 1.4 2003/12/19 00:31:16 pelle
+ * Lots of usability changes through out all the passphrase agents and end user tools.
+ *
* Revision 1.3 2003/12/18 17:40:07 pelle
* You can now create keys that get stored with a X509 certificate in the keystore. These can be saved as well.
***************
*** 136,139 ****
--- 139,144 ----
import java.io.InputStreamReader;
import java.io.IOException;
+ import java.util.regex.Pattern;
+ import java.util.regex.Matcher;
public final class Utility {
***************
*** 221,224 ****
--- 226,248 ----
BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
return reader.readLine();
+ }
+
+ public static String getExecutable(Class reference){
+ Pattern p=Pattern.compile("\\.");
+ Matcher m=p.matcher(reference.getName());
+ String classfile=m.replaceAll("/")+".class";
+ String url=reference.getClassLoader().getResource(classfile).toExternalForm();
+ if (url.startsWith("jar:")) {
+ Pattern r2=Pattern.compile(":([^:]*\\.jar)!");
+ Matcher m2=r2.matcher(url);
+ if(m2.matches()){
+ String path=m2.group(1);
+ String cd=System.getProperty("user.dir");
+ if (path.startsWith(cd))
+ return "$ java -jar "+path.substring(cd.length());
+ return "$ java -jar "+path;
+ }
+ }
+ return "$ java "+reference.getName();
}
|