262 // Resolve exception klass, and check for pending exception below. |
262 // Resolve exception klass, and check for pending exception below. |
263 Klass* klass = SystemDictionary::resolve_or_fail(name, h_loader, h_protection_domain, true, thread); |
263 Klass* klass = SystemDictionary::resolve_or_fail(name, h_loader, h_protection_domain, true, thread); |
264 |
264 |
265 if (!thread->has_pending_exception()) { |
265 if (!thread->has_pending_exception()) { |
266 assert(klass != NULL, "klass must exist"); |
266 assert(klass != NULL, "klass must exist"); |
267 // We are about to create an instance - so make sure that klass is initialized |
267 h_exception = JavaCalls::construct_new_instance(InstanceKlass::cast(klass), |
268 InstanceKlass* ik = InstanceKlass::cast(klass); |
|
269 ik->initialize(thread); |
|
270 if (!thread->has_pending_exception()) { |
|
271 // Allocate new exception |
|
272 h_exception = ik->allocate_instance_handle(thread); |
|
273 if (!thread->has_pending_exception()) { |
|
274 JavaValue result(T_VOID); |
|
275 args->set_receiver(h_exception); |
|
276 // Call constructor |
|
277 JavaCalls::call_special(&result, ik, |
|
278 vmSymbols::object_initializer_name(), |
|
279 signature, |
268 signature, |
280 args, |
269 args, |
281 thread); |
270 thread); |
282 } |
|
283 } |
|
284 } |
271 } |
285 |
272 |
286 // Check if another exception was thrown in the process, if so rethrow that one |
273 // Check if another exception was thrown in the process, if so rethrow that one |
287 if (thread->has_pending_exception()) { |
274 if (thread->has_pending_exception()) { |
288 h_exception = Handle(thread, thread->pending_exception()); |
275 h_exception = Handle(thread, thread->pending_exception()); |