Created
March 9, 2012 14:56
-
-
Save elek/2006855 to your computer and use it in GitHub Desktop.
Daily WTF from javax.comm.jar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//from javax.comm.jar | |
private static String findPropFile() | |
{ | |
String str1 = System.getProperty("java.class.path"); | |
StreamTokenizer localStreamTokenizer = new StreamTokenizer(new StringReader(str1)); | |
localStreamTokenizer.whitespaceChars(File.pathSeparatorChar, File.pathSeparatorChar); | |
localStreamTokenizer.wordChars(File.separatorChar, File.separatorChar); | |
localStreamTokenizer.ordinaryChar(46); | |
localStreamTokenizer.wordChars(46, 46); | |
try | |
{ | |
while (localStreamTokenizer.nextToken() != -1) | |
{ | |
int i = -1; | |
if ((localStreamTokenizer.ttype != -3) || | |
((i = localStreamTokenizer.sval.indexOf("comm.jar")) == -1)) | |
continue; | |
String str2 = new String(localStreamTokenizer.sval); | |
File localFile = new File(str2); | |
if (localFile.exists()) { | |
String str3 = str2.substring(0, i); | |
if (str3 != null) { | |
str3 = str3 + "." + File.separator + "javax.comm.properties"; | |
} | |
else { | |
str3 = "." + File.separator + "javax.comm.properties"; | |
} | |
localFile = new File(str3); | |
if (localFile.exists()) { | |
return new String(str3); | |
} | |
return null; | |
} | |
} | |
} | |
catch (IOException localIOException) | |
{ | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
comm.jar name is hardcoded!