我有以下的代码框架异常处理冒险
try {
...
...
sysout("Please provide an input: ");
Thread.sleep(10000); //10 secs time given to the user to give the input. If the user doesn't enter the input it is throwing the exception, which is not being handled (with the custom message)
interact(); //This is a method that belongs to **expectj.Spawn** class
...
...
} catch (Exception e) {
System.out.println("You have not given any input!Please try again!");
}
,但我仍然得到以下输出 -
Exception in thread "ExpectJ Stream Piper" java.nio.channels.IllegalBlockingModeException
at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:39)
at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:92)
at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:86)
at java.io.InputStream.read(InputStream.java:85)
at expectj.StreamPiper.run(StreamPiper.java:134)
是否有任何其他类型的异常,我需要处理?
您确定异常正在引发您捕捉的同一线程上吗? – forsvarir 2011-04-28 12:04:24
我这么认为。但我不确定。 – hari 2011-04-29 09:49:39