Merge "Fix NumberFormat's behavior with BigInteger and custom Number subclasses."
diff --git a/libcore/security/src/main/java/org/bouncycastle/asn1/x509/X509Name.java b/libcore/security/src/main/java/org/bouncycastle/asn1/x509/X509Name.java
index c3e1f46..50b1a60 100644
--- a/libcore/security/src/main/java/org/bouncycastle/asn1/x509/X509Name.java
+++ b/libcore/security/src/main/java/org/bouncycastle/asn1/x509/X509Name.java
@@ -642,7 +642,7 @@
 
             if (index == -1)
             {
-                throw new IllegalArgumentException("badly formated directory string");
+                throw new IllegalArgumentException("badly formatted directory string");
             }
 
             String              name = token.substring(0, index);
diff --git a/libcore/security/src/main/java/org/bouncycastle/i18n/LocalizedMessage.java b/libcore/security/src/main/java/org/bouncycastle/i18n/LocalizedMessage.java
index b5ab60f..63825dd 100644
--- a/libcore/security/src/main/java/org/bouncycastle/i18n/LocalizedMessage.java
+++ b/libcore/security/src/main/java/org/bouncycastle/i18n/LocalizedMessage.java
@@ -63,7 +63,7 @@
     
     /**
      * Reads the entry <code>id + "." + key</code> from the resource file and returns a 
-     * formated message for the given Locale and TimeZone.
+     * formatted message for the given Locale and TimeZone.
      * @param key second part of the entry id
      * @param loc the used {@link Locale}
      * @param timezone the used {@link TimeZone}
diff --git a/vm/compiler/codegen/arm/CodegenDriver.c b/vm/compiler/codegen/arm/CodegenDriver.c
index 1993c9d..8861102 100644
--- a/vm/compiler/codegen/arm/CodegenDriver.c
+++ b/vm/compiler/codegen/arm/CodegenDriver.c
@@ -2454,7 +2454,19 @@
             RegLocation rlResult;
             ClassObject *classPtr =
               (cUnit->method->clazz->pDvmDex->pResClasses[mir->dalvikInsn.vC]);
-            assert(classPtr != NULL);
+            /*
+             * Note: It is possible that classPtr is NULL at this point,
+             * even though this instruction has been successfully interpreted.
+             * If the previous interpretation had a null source, the
+             * interpreter would not have bothered to resolve the clazz.
+             * Bail out to the interpreter in this case, and log it
+             * so that we can tell if it happens frequently.
+             */
+            if (classPtr == NULL) {
+                LOGD("null clazz in OP_INSTANCE_OF, single-stepping");
+                genInterpSingleStep(cUnit, mir);
+                break;
+            }
             flushAllRegs(cUnit);   /* Send everything to home location */
             loadValueDirectFixed(cUnit, rlSrc, r0);  /* Ref */
             loadConstant(cUnit, r2, (int) classPtr );