getJavaMainClass fixes

This commit is contained in:
Doug MacEachern 2006-05-24 22:23:49 +00:00
parent c0ca2183a6
commit a0ed010359
1 changed files with 5 additions and 1 deletions

View File

@ -9,6 +9,10 @@ public class ProcUtil {
private static boolean isClassName(String name) { private static boolean isClassName(String name) {
int len = name.length(); int len = name.length();
if (len == 0) {
return false;
}
for (int i=0; i<len; i++) { for (int i=0; i<len; i++) {
char c = name.charAt(i); char c = name.charAt(i);
if (!((c == '.') || Character.isLetter(c))) { if (!((c == '.') || Character.isLetter(c))) {
@ -28,7 +32,7 @@ public class ProcUtil {
String[] args = sigar.getProcArgs(pid); String[] args = sigar.getProcArgs(pid);
for (int i=1; i<args.length; i++) { for (int i=1; i<args.length; i++) {
String arg = args[i]; String arg = args[i];
if (isClassName(arg)) { if (isClassName(arg.trim())) {
//example: "java:weblogic.Server" //example: "java:weblogic.Server"
return arg; return arg;
} }