<AWT Dev> Proposal: Make JNU_Throw* clear a pending exception

Petr Pchelko petr.pchelko at oracle.com
Tue Feb 25 02:31:56 PST 2014

Hello, Core and AWT teams.

In AWT we have a lot of pending exception warnings which are now being fixed. A big fraction of this warnings is about a pending JNI exception at a call to JNU_Throw*.
Why don’t we add an env->ExceptionClear() call in the beginning of each JNU_Throw function? It is absolutely safe because:
1. We are rethrowing an exception an loosing the original one anyway.
2. In case there’s no pending exception the ExceptionClear is a no-op.

If we do this the code would become much cleaner, because currently we have to manually clear a pending exception before every call to JNU_Throw*.

What do you think about this proposal?

Thank you.
With best regards. Petr.

More information about the awt-dev mailing list