< prev index next >

src/share/vm/utilities/exceptions.cpp

Print this page




 248   vsnprintf(msg, max_msg_size, format, ap);
 249   msg[max_msg_size-1] = '\0';
 250   va_end(ap);
 251   _throw_msg(thread, file, line, h_name, msg);
 252 }
 253 
 254 
 255 // Creates an exception oop, calls the <init> method with the given signature.
 256 // and returns a Handle
 257 Handle Exceptions::new_exception(Thread *thread, Symbol* name,
 258                                  Symbol* signature, JavaCallArguments *args,
 259                                  Handle h_loader, Handle h_protection_domain) {
 260   assert(Universe::is_fully_initialized(),
 261     "cannot be called during initialization");
 262   assert(thread->is_Java_thread(), "can only be called by a Java thread");
 263   assert(!thread->has_pending_exception(), "already has exception");
 264 
 265   Handle h_exception;
 266 
 267   // Resolve exception klass
 268   Klass* ik = SystemDictionary::resolve_or_fail(name, h_loader, h_protection_domain, true, thread);
 269   instanceKlassHandle klass(thread, ik);
 270 
 271   if (!thread->has_pending_exception()) {
 272     assert(klass.not_null(), "klass must exist");
 273     // We are about to create an instance - so make sure that klass is initialized
 274     klass->initialize(thread);
 275     if (!thread->has_pending_exception()) {
 276       // Allocate new exception
 277       h_exception = klass->allocate_instance_handle(thread);
 278       if (!thread->has_pending_exception()) {
 279         JavaValue result(T_VOID);
 280         args->set_receiver(h_exception);
 281         // Call constructor
 282         JavaCalls::call_special(&result, klass,
 283                                          vmSymbols::object_initializer_name(),
 284                                          signature,
 285                                          args,
 286                                          thread);
 287       }
 288     }
 289   }
 290 
 291   // Check if another exception was thrown in the process, if so rethrow that one
 292   if (thread->has_pending_exception()) {




 248   vsnprintf(msg, max_msg_size, format, ap);
 249   msg[max_msg_size-1] = '\0';
 250   va_end(ap);
 251   _throw_msg(thread, file, line, h_name, msg);
 252 }
 253 
 254 
 255 // Creates an exception oop, calls the <init> method with the given signature.
 256 // and returns a Handle
 257 Handle Exceptions::new_exception(Thread *thread, Symbol* name,
 258                                  Symbol* signature, JavaCallArguments *args,
 259                                  Handle h_loader, Handle h_protection_domain) {
 260   assert(Universe::is_fully_initialized(),
 261     "cannot be called during initialization");
 262   assert(thread->is_Java_thread(), "can only be called by a Java thread");
 263   assert(!thread->has_pending_exception(), "already has exception");
 264 
 265   Handle h_exception;
 266 
 267   // Resolve exception klass
 268   InstanceKlass* klass = InstanceKlass::cast(SystemDictionary::resolve_or_fail(name, h_loader, h_protection_domain, true, thread));

 269 
 270   if (!thread->has_pending_exception()) {
 271     assert(klass != NULL, "klass must exist");
 272     // We are about to create an instance - so make sure that klass is initialized
 273     klass->initialize(thread);
 274     if (!thread->has_pending_exception()) {
 275       // Allocate new exception
 276       h_exception = klass->allocate_instance_handle(thread);
 277       if (!thread->has_pending_exception()) {
 278         JavaValue result(T_VOID);
 279         args->set_receiver(h_exception);
 280         // Call constructor
 281         JavaCalls::call_special(&result, klass,
 282                                          vmSymbols::object_initializer_name(),
 283                                          signature,
 284                                          args,
 285                                          thread);
 286       }
 287     }
 288   }
 289 
 290   // Check if another exception was thrown in the process, if so rethrow that one
 291   if (thread->has_pending_exception()) {


< prev index next >