Oracle is buggy and throws NullPointerException for getGenericTypeName() too, so recover from that too.

This should fix bug #10744.