Use specific exception class to abort transaction
We used to throw a java.lang.InternalError when aborting a
transaction (when preinitializing image classes at compilation time).
We now use dedicated class dalvik.system.TransactionAbortError that
is only thrown by the compiler to abort a transaction. This class has
constructors taking a java.lang.Throwable "cause" so we can wrap
exceptions causing the transaction to abort (for instance class
java.lang.ClassNotFoundException) and give more information about the
cause of the transaction abort.
Bug: 20019689
Change-Id: I019a72a1c754d8bba6a7ad6bb0f02e4fd6668622
diff --git a/runtime/transaction.h b/runtime/transaction.h
index e1b93c9..1419a38 100644
--- a/runtime/transaction.h
+++ b/runtime/transaction.h
@@ -39,13 +39,16 @@
class Transaction FINAL {
public:
+ static constexpr const char* kAbortExceptionDescriptor = "dalvik.system.TransactionAbortError";
+ static constexpr const char* kAbortExceptionSignature = "Ldalvik/system/TransactionAbortError;";
+
Transaction();
~Transaction();
void Abort(const std::string& abort_message)
LOCKS_EXCLUDED(log_lock_)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- void ThrowInternalError(Thread* self, bool rethrow)
+ void ThrowAbortError(Thread* self, bool rethrow)
LOCKS_EXCLUDED(log_lock_)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
bool IsAborted() LOCKS_EXCLUDED(log_lock_);