I found a little problem in the logic of the "prompt" matching process
if we matching "\r\n" and input "\r\r\n" then the origin logic can't match,
so I changed to the following :
Prompt prompt = (Prompt) waitFor.get(m);
boolean curCharMatch=prompt.matchChar(s);
if(!curCharMatch)
{
//prev matched already
if(prompt.pos!=0)
{
prompt.resetPos();
curCharMatch=prompt.matchChar(s);
}
}
if (curCharMatch) {
// the whole thing matched so, return the match answer
if (prompt.match()) {
return m;
} else {
prompt.nextPos();
}
} else {
// if the current character did not match reset
prompt.resetPos();
if (s == '\n' || s == '\r') {
lastLine.setLength(0);
}
}
It works !!
I hope you will continue this project ,I think it's the best "expect liked
tools in Java
Original issue reported on code.google.com by springco...@hotmail.com on 29 Oct 2009 at 4:52
Original issue reported on code.google.com by
springco...@hotmail.com
on 29 Oct 2009 at 4:52