|
|
вернуться в форумОбщий форумTo admins: Incorrect handling Java exceptions thrown by another thread Послано I&K 11 окт 2009 10:15 The testing system doesn't treat exceptions thrown by a thread another than "main" as exceptions and does checking of correctness of the output after such exceptions. For example, if I write my main method in such way: new Thread() { public void run() { new Main().run(); } }.start(); and the first operator in "run" is if (true) throw new RuntimeException(); I'll get WA 1, not Crash 1. It seems to be very strange, because such uncaught exceptions is really thrown by jvm and it terminates abnormally and prints a stack trace. This behaviour of the testing system is very nagging because it hides things that really happen in the program. Re: To admins: Incorrect handling Java exceptions thrown by another thread I never used this method, but if I wanna throw an exception - i wrote if (condition){ throw new Error(); } In this case if condition will be true you got Crash Re: To admins: Incorrect handling Java exceptions thrown by another thread Послано I&K 11 окт 2009 21:41 No, in this case you also will not get Crash, if this code is executed in not main thread. Otherwise, my code if (true) throw new RuntimeException(); would get Crash too. The problem is that this code is executed in the method run which in turn is executed in another thread, and the only code which is executed in main thread is new Thread() { public void run() { new Main().run(); } }.start(); For JDK 1.6 it is not necessary to create new threads, but in JDK 1.5 one can not use normal stack size in the main thread because it is determined by OS as for ordinary new thread. Despite the fact that the testing system is already using JDK 1.6, I think this issue should be fixed. After all, I didn't get AC in the last contest just because I got WA and in the last 5 minutes tried to find a bug in the logic of the program, but didn't check array sizes:( |
|
|