Hi, all: I wonder if we need to get the exception from the exec framework. As an exec result, we need only get whether it succeeds or not. Besides, I do not think it is so reliable to parse error message to get exception. We can design sophisticated testcase to deduce whether the expected exception has been thrown out from the status of exec. For example, during VM init there are some errors that can be caught by some java class. If we add a null object as Transformer, the VM will go down by nullpointerexception. But it can be caught be its caller: public static void premain(String agentArgs, Instrumentation inst) { try { inst.addTransformer(null); //should throw NullPointerException System.exit(1); } catch(NullPointerException e) { //expected } }
From the exec result, if there is no error, that is return value is 0, we can deduce that the expected exception is thrown. As for those fault errors raised from VM init, if they cannot be caught by any java class, they are just error messages that can be got from console. I do not think some application will depend on such message. Furthermore, some of these messages cannot be classified to any exception type: some are errors about runtime environment, some are related to VM. Actually, in reality, some error events are related to Harmony's implemenation. For example, in our instrumentation impl class, there are two methods executePremain and transform, which are called duirng VM and might cause VM to die if these methods cannot be invoked. In such circumstances, we cannot behave just like RI. So in my opinion, if the exception can be caught by any java class, we try to design testcase to verify it; or else, they are just error messages that are related to implementation. On 8/17/06, Anton Luht <[EMAIL PROTECTED]> wrote:
Jimmy, > Ah, we are trying to catch the exact exception name, not its message. I > agree parsing the message is a bad idea, but find an exact exception > name in the output is still stable, am I right? Yes, it's stable. > In fact, I have no idea to catch an exception in "exec", it surely > contains no such function, right? No, it doesn't. -- Regards, Anton Luht, Intel Middleware Products Division --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Leo Li China Software Development Lab, IBM