add guard for ex.stack unavailable case

In Java 6, ex.stack is not available.