From 22e59fd2861a4aab16adb2b80a1d5166382a6617 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Wed, 23 Jul 2014 20:18:36 -0700 Subject: [PATCH] ART: Allow arrays with erroneous component type Array classes must tolerate having component type classes that are erroneous. Change CreateArrayClass to use LookupClass when FindClass failed. Bug: 16019155 (cherry picked from commit dc13d7df5da49e93963035633a82699c68fa0971) Change-Id: I506250949a1802898433e9099dcb8ef31dd89659 --- runtime/class_linker.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 617f4bd20..1ea42bb09 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -2398,7 +2398,14 @@ mirror::Class* ClassLinker::CreateArrayClass(Thread* self, const char* descripto Handle component_type(hs.NewHandle(FindClass(self, descriptor + 1, class_loader))); if (component_type.Get() == nullptr) { DCHECK(self->IsExceptionPending()); - return nullptr; + // We need to accept erroneous classes as component types. + component_type.Assign(LookupClass(descriptor + 1, class_loader.Get())); + if (component_type.Get() == nullptr) { + DCHECK(self->IsExceptionPending()); + return nullptr; + } else { + self->ClearException(); + } } if (UNLIKELY(component_type->IsPrimitiveVoid())) { ThrowNoClassDefFoundError("Attempt to create array of void primitive type"); -- 2.11.0