Fixed potential NullPointer exception in generated Java class.