jdk 源码的一个BUG,大家来看看

04-03-20 wqy518

Runtime类的下面这个方法:

public Process exec(String command, String envp[], File dir)

throws IOException {

int count = 0;

String cmdarray[];

StringTokenizer st;

if (command == "")

throw new IllegalArgumentException("Empty command");

st = new StringTokenizer(command);

count = st.countTokens();

cmdarray = new String[count];

//上面已经取过了,为什么重取一次,而且count值没有用????

st = new StringTokenizer(command);

count = 0;

while (st.hasMoreTokens()) {

cmdarray[count++] = st.nextToken();

}

return exec(cmdarray, envp, dir);

}

不知大家的jdk源码是不是这样得?我的好像是1.41版的