Merge "Bring our XML APIs up to date with Java 5."
diff --git a/libcore/icu/src/main/java/com/ibm/icu4jni/text/NativeDecimalFormat.java b/libcore/icu/src/main/java/com/ibm/icu4jni/text/NativeDecimalFormat.java
index fd22ed0..034491c 100644
--- a/libcore/icu/src/main/java/com/ibm/icu4jni/text/NativeDecimalFormat.java
+++ b/libcore/icu/src/main/java/com/ibm/icu4jni/text/NativeDecimalFormat.java
@@ -218,40 +218,30 @@
// Get new value by multiplying multiplier.
return valBigDecimal.multiply(multiplierBigDecimal);
}
-
- public StringBuffer format(Object value, StringBuffer buffer, FieldPosition field) {
- if (!(value instanceof Number)) {
- throw new IllegalArgumentException();
+
+ public StringBuffer formatBigDecimal(BigDecimal value, StringBuffer buffer, FieldPosition field) {
+ if (buffer == null || field == null) {
+ throw new NullPointerException();
}
+ if (getMultiplier() != 1) {
+ value = applyMultiplier(value);
+ }
+ StringBuilder val = new StringBuilder();
+ val.append(value.unscaledValue().toString(10));
+ int scale = value.scale();
+ scale = makeScalePositive(scale, val);
+ String fieldType = getFieldType(field.getFieldAttribute());
+ String result = format(this.addr, val.toString(), field, fieldType, null, scale);
+ return buffer.append(result);
+ }
+
+ public StringBuffer formatBigInteger(BigInteger value, StringBuffer buffer, FieldPosition field) {
if (buffer == null || field == null) {
throw new NullPointerException();
}
String fieldType = getFieldType(field.getFieldAttribute());
- Number number = (Number) value;
- if (number instanceof BigInteger) {
- BigInteger valBigInteger = (BigInteger) number;
- String result = format(this.addr, valBigInteger.toString(10), field, fieldType, null, 0);
- return buffer.append(result);
- } else if (number instanceof BigDecimal) {
- BigDecimal valBigDecimal = (BigDecimal) number;
- if (getMultiplier() != 1) {
- valBigDecimal = applyMultiplier(valBigDecimal);
- }
- StringBuilder val = new StringBuilder();
- val.append(valBigDecimal.unscaledValue().toString(10));
- int scale = valBigDecimal.scale();
- scale = makeScalePositive(scale, val);
- String result = format(this.addr, val.toString(), field, fieldType, null, scale);
- return buffer.append(result);
- } else if (number instanceof Double || number instanceof Float) {
- double dv = number.doubleValue();
- String result = format(this.addr, dv, field, fieldType, null);
- return buffer.append(result);
- } else {
- long lv = number.longValue();
- String result = format(this.addr, lv, field, fieldType, null);
- return buffer.append(result);
- }
+ String result = format(this.addr, value.toString(10), field, fieldType, null, 0);
+ return buffer.append(result);
}
public StringBuffer format(long value, StringBuffer buffer, FieldPosition field) {
diff --git a/libcore/luni/src/test/java/java/text/NumberFormatTest.java b/libcore/luni/src/test/java/java/text/NumberFormatTest.java
index 3626a44..66e1759 100644
--- a/libcore/luni/src/test/java/java/text/NumberFormatTest.java
+++ b/libcore/luni/src/test/java/java/text/NumberFormatTest.java
@@ -19,9 +19,49 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+import java.math.BigInteger;
import java.util.Locale;
public class NumberFormatTest extends junit.framework.TestCase {
+ // NumberFormat.format(Object, StringBuffer, FieldPosition) guarantees it calls doubleValue for
+ // custom Number subclasses.
+ public void test_custom_Number_gets_longValue() throws Exception {
+ class MyNumber extends Number {
+ public byte byteValue() { throw new UnsupportedOperationException(); }
+ public double doubleValue() { return 123; }
+ public float floatValue() { throw new UnsupportedOperationException(); }
+ public int intValue() { throw new UnsupportedOperationException(); }
+ public long longValue() { throw new UnsupportedOperationException(); }
+ public short shortValue() { throw new UnsupportedOperationException(); }
+ public String toString() { throw new UnsupportedOperationException(); }
+ }
+ NumberFormat nf = NumberFormat.getNumberInstance(Locale.US);
+ assertEquals("123", nf.format(new MyNumber()));
+ }
+
+ // NumberFormat.format(Object, StringBuffer, FieldPosition) guarantees it calls longValue for
+ // any BigInteger with a bitLength strictly less than 64.
+ public void test_small_BigInteger_gets_longValue() throws Exception {
+ class MyNumberFormat extends NumberFormat {
+ public StringBuffer format(double value, StringBuffer b, FieldPosition f) {
+ b.append("double");
+ return b;
+ }
+ public StringBuffer format(long value, StringBuffer b, FieldPosition f) {
+ b.append("long");
+ return b;
+ }
+ public Number parse(String string, ParsePosition p) {
+ throw new UnsupportedOperationException();
+ }
+ }
+ NumberFormat nf = new MyNumberFormat();
+ assertEquals("long", nf.format(BigInteger.valueOf(Long.MAX_VALUE)));
+ assertEquals("double", nf.format(BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.ONE)));
+ assertEquals("long", nf.format(BigInteger.valueOf(Long.MIN_VALUE)));
+ assertEquals("double", nf.format(BigInteger.valueOf(Long.MIN_VALUE).subtract(BigInteger.ONE)));
+ }
+
public void test_getIntegerInstance_ar() throws Exception {
NumberFormat numberFormat = NumberFormat.getNumberInstance(new Locale("ar"));
assertEquals("#,##0.###;#,##0.###-", ((DecimalFormat) numberFormat).toPattern());
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/libcore/security/src/test/java/tests/security/cert/CertPathBuilder1Test.java b/libcore/security/src/test/java/tests/security/cert/CertPathBuilder1Test.java
index 5af75c2..1c45e57 100644
--- a/libcore/security/src/test/java/tests/security/cert/CertPathBuilder1Test.java
+++ b/libcore/security/src/test/java/tests/security/cert/CertPathBuilder1Test.java
@@ -22,12 +22,11 @@
package tests.security.cert;
+import dalvik.annotation.KnownFailure;
import dalvik.annotation.TestLevel;
import dalvik.annotation.TestTargetClass;
import dalvik.annotation.TestTargetNew;
-import junit.framework.TestCase;
-
import org.apache.harmony.security.tests.support.SpiEngUtils;
import org.apache.harmony.security.tests.support.cert.MyCertPathBuilderSpi;
import org.apache.harmony.security.tests.support.cert.TestUtils;
@@ -45,6 +44,8 @@
import java.security.cert.CertPathParameters;
import java.security.cert.CertificateException;
+import junit.framework.TestCase;
+
/**
* Tests for <code>CertPathBuilder</code> class constructors and
* methods.
@@ -392,6 +393,7 @@
args={CertPathParameters.class}
)
// Test passed on RI
+ @KnownFailure(value="expired certificate bug 2322662")
public void testBuild() throws Exception {
TestUtils.initCertPathSSCertChain();
CertPathParameters params = TestUtils.getCertPathParameters();
diff --git a/libcore/security/src/test/java/tests/security/cert/CertPathTest.java b/libcore/security/src/test/java/tests/security/cert/CertPathTest.java
index 5edb3f5..31ffeee 100644
--- a/libcore/security/src/test/java/tests/security/cert/CertPathTest.java
+++ b/libcore/security/src/test/java/tests/security/cert/CertPathTest.java
@@ -22,6 +22,7 @@
package tests.security.cert;
+import dalvik.annotation.KnownFailure;
import dalvik.annotation.TestLevel;
import dalvik.annotation.TestTargetClass;
import dalvik.annotation.TestTargetNew;
@@ -342,6 +343,7 @@
)
})
// Test passed on RI
+ @KnownFailure(value="expired certificate bug 2322662")
public void testSerializationSelf() throws Exception {
TestUtils.initCertPathSSCertChain();
CertPath certPath = TestUtils.buildCertPathSSCertChain();
@@ -373,6 +375,7 @@
)
})
// Test passed on RI
+ @KnownFailure(value="expired certificate bug 2322662")
public void testSerializationCompatibility() throws Exception {
TestUtils.initCertPathSSCertChain();
CertPath certPath = TestUtils.buildCertPathSSCertChain();
diff --git a/libcore/support/src/test/java/tests/support/Support_DecimalFormat.java b/libcore/support/src/test/java/tests/support/Support_DecimalFormat.java
index d86f1a2..55bea1e 100644
--- a/libcore/support/src/test/java/tests/support/Support_DecimalFormat.java
+++ b/libcore/support/src/test/java/tests/support/Support_DecimalFormat.java
@@ -1,13 +1,13 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -132,60 +132,66 @@
public void t_formatToCharacterIterator() {
Number number = new Double(350.76);
+ Number longNumber = new Long(100300400);
+ Number zeroNumber = new Long(0);
Number negativeNumber = new Double(-350.76);
Locale us = Locale.US;
Locale tr = new Locale("de", "CH");
- // test number instance
- t_Format(1, number, NumberFormat.getNumberInstance(us),
- getNumberVectorUS());
+ if (Support_Locale.areLocalesAvailable(us)) {
+ // locale dependent test, bug 1943269
- // test integer instance
- t_Format(2, number, NumberFormat.getIntegerInstance(us),
- getIntegerVectorUS());
+ // test number instance
+ t_Format(1, number, NumberFormat.getNumberInstance(us),
+ getNumberVectorUS());
- // test percent instance
- t_Format(3, number, NumberFormat.getPercentInstance(us),
- getPercentVectorUS());
+ // test integer instance
+ t_Format(2, number, NumberFormat.getIntegerInstance(us),
+ getIntegerVectorUS());
+
+ // test percent instance
+ t_Format(3, number, NumberFormat.getPercentInstance(us),
+ getPercentVectorUS());
+
+ // test currency instance with US Locale
+ t_Format(4, number, NumberFormat.getCurrencyInstance(us),
+ getPositiveCurrencyVectorUS());
+
+ // test negative currency instance with US Locale
+ t_Format(5, negativeNumber, NumberFormat.getCurrencyInstance(us),
+ getNegativeCurrencyVectorUS());
+
+ // test multiple grouping seperators
+ t_Format(6, longNumber, NumberFormat.getNumberInstance(us),
+ getNumberVector2US());
+
+ // test 0
+ t_Format(7, zeroNumber, NumberFormat.getNumberInstance(us),
+ getZeroVector());
+ }
// test permille pattern
DecimalFormat format = new DecimalFormat("###0.##\u2030");
- t_Format(4, number, format, getPermilleVector());
+ t_Format(8, number, format, getPermilleVector());
// test exponential pattern with positive exponent
format = new DecimalFormat("00.0#E0");
- t_Format(5, number, format, getPositiveExponentVector());
+ t_Format(9, number, format, getPositiveExponentVector());
// test exponential pattern with negative exponent
format = new DecimalFormat("0000.0#E0");
- t_Format(6, number, format, getNegativeExponentVector());
+ t_Format(10, number, format, getNegativeExponentVector());
- // test currency instance with US Locale
- t_Format(7, number, NumberFormat.getCurrencyInstance(us),
- getPositiveCurrencyVectorUS());
+ if (Support_Locale.areLocalesAvailable(tr)) {
+ // test currency instance with TR Locale
+ t_Format(11, number, NumberFormat.getCurrencyInstance(tr),
+ getPositiveCurrencyVectorCH());
- // test negative currency instance with US Locale
- t_Format(8, negativeNumber, NumberFormat.getCurrencyInstance(us),
- getNegativeCurrencyVectorUS());
-
- // test currency instance with TR Locale
- t_Format(9, number, NumberFormat.getCurrencyInstance(tr),
- getPositiveCurrencyVectorCH());
-
- // test negative currency instance with TR Locale
- t_Format(10, negativeNumber, NumberFormat.getCurrencyInstance(tr),
- getNegativeCurrencyVectorCH());
-
- // test multiple grouping seperators
- number = new Long(100300400);
- t_Format(11, number, NumberFormat.getNumberInstance(us),
- getNumberVector2US());
-
- // test 0
- number = new Long(0);
- t_Format(12, number, NumberFormat.getNumberInstance(us),
- getZeroVector());
+ // test negative currency instance with TR Locale
+ t_Format(12, negativeNumber, NumberFormat.getCurrencyInstance(tr),
+ getNegativeCurrencyVectorCH());
+ }
}
private static Vector<FieldContainer> getNumberVectorUS() {
diff --git a/libcore/support/src/test/java/tests/support/Support_Locale.java b/libcore/support/src/test/java/tests/support/Support_Locale.java
index c5776cc..92426e3 100644
--- a/libcore/support/src/test/java/tests/support/Support_Locale.java
+++ b/libcore/support/src/test/java/tests/support/Support_Locale.java
@@ -35,7 +35,7 @@
*
* @return true if all requiredLocales are available.
*/
- public static boolean areLocalesAvailable(Locale[] requiredLocales) {
+ public static boolean areLocalesAvailable(Locale... requiredLocales) {
Locale[] availableLocales = Locale.getAvailableLocales();
Set<Locale> localeSet = new HashSet<Locale>(Arrays.asList(availableLocales));
for (Locale requiredLocale : requiredLocales) {
@@ -45,5 +45,4 @@
}
return true;
}
-
}
\ No newline at end of file
diff --git a/libcore/text/src/main/java/java/text/DateFormat.java b/libcore/text/src/main/java/java/text/DateFormat.java
index 8c9ded5..bf7ebbe 100644
--- a/libcore/text/src/main/java/java/text/DateFormat.java
+++ b/libcore/text/src/main/java/java/text/DateFormat.java
@@ -26,9 +26,6 @@
import java.util.Date;
import java.util.Hashtable;
import java.util.Locale;
-// BEGIN android-added
-import java.util.ResourceBundle;
-// BEGIN android-added
import java.util.TimeZone;
import com.ibm.icu4jni.util.LocaleData;
diff --git a/libcore/text/src/main/java/java/text/DateFormatSymbols.java b/libcore/text/src/main/java/java/text/DateFormatSymbols.java
index 184cdcf..ac23ad2 100644
--- a/libcore/text/src/main/java/java/text/DateFormatSymbols.java
+++ b/libcore/text/src/main/java/java/text/DateFormatSymbols.java
@@ -26,9 +26,6 @@
import java.io.Serializable;
import java.util.Arrays;
import java.util.Locale;
-// BEGIN android-added
-import java.util.ResourceBundle;
-// END android-added
// BEGIN android-added
import com.ibm.icu4jni.util.LocaleData;
diff --git a/libcore/text/src/main/java/java/text/DecimalFormat.java b/libcore/text/src/main/java/java/text/DecimalFormat.java
index 0991adb..8d5d022 100644
--- a/libcore/text/src/main/java/java/text/DecimalFormat.java
+++ b/libcore/text/src/main/java/java/text/DecimalFormat.java
@@ -707,89 +707,27 @@
return dform.formatToCharacterIterator(object);
}
- /**
- * Formats the specified double value as a string using the pattern of this
- * decimal format and appends the string to the specified string buffer.
- * <p>
- * If the {@code field} member of {@code position} contains a value
- * specifying a format field, then its {@code beginIndex} and
- * {@code endIndex} members will be updated with the position of the first
- * occurrence of this field in the formatted text.
- *
- * @param value
- * the double to format.
- * @param buffer
- * the target string buffer to append the formatted double value
- * to.
- * @param position
- * on input: an optional alignment field; on output: the offsets
- * of the alignment field in the formatted text.
- * @return the string buffer.
- */
@Override
- public StringBuffer format(double value, StringBuffer buffer,
- FieldPosition position) {
+ public StringBuffer format(double value, StringBuffer buffer, FieldPosition position) {
return dform.format(value, buffer, position);
}
- /**
- * Formats the specified long value as a string using the pattern of this
- * decimal format and appends the string to the specified string buffer.
- * <p>
- * If the {@code field} member of {@code position} contains a value
- * specifying a format field, then its {@code beginIndex} and
- * {@code endIndex} members will be updated with the position of the first
- * occurrence of this field in the formatted text.
- *
- * @param value
- * the long to format.
- * @param buffer
- * the target string buffer to append the formatted long value
- * to.
- * @param position
- * on input: an optional alignment field; on output: the offsets
- * of the alignment field in the formatted text.
- * @return the string buffer.
- */
@Override
- public StringBuffer format(long value, StringBuffer buffer,
- FieldPosition position) {
+ public StringBuffer format(long value, StringBuffer buffer, FieldPosition position) {
return dform.format(value, buffer, position);
}
- /**
- * Formats the specified object as a string using the pattern of this
- * decimal format and appends the string to the specified string buffer.
- * <p>
- * If the {@code field} member of {@code position} contains a value
- * specifying a format field, then its {@code beginIndex} and
- * {@code endIndex} members will be updated with the position of the first
- * occurrence of this field in the formatted text.
- *
- * @param number
- * the object to format.
- * @param toAppendTo
- * the target string buffer to append the formatted number to.
- * @param pos
- * on input: an optional alignment field; on output: the offsets
- * of the alignment field in the formatted text.
- * @return the string buffer.
- * @throws IllegalArgumentException
- * if {@code number} is not an instance of {@code Number}.
- * @throws NullPointerException
- * if {@code toAppendTo} or {@code pos} is {@code null}.
- */
@Override
- public final StringBuffer format(Object number, StringBuffer toAppendTo,
- FieldPosition pos) {
- if (!(number instanceof Number)) {
- throw new IllegalArgumentException();
- }
- if (toAppendTo == null || pos == null) {
- throw new NullPointerException();
- }
- if (number instanceof BigInteger || number instanceof BigDecimal) {
- return dform.format(number, toAppendTo, pos);
+ public final StringBuffer format(Object number, StringBuffer toAppendTo, FieldPosition pos) {
+ if (number instanceof BigInteger) {
+ BigInteger bigInteger = (BigInteger) number;
+ if (bigInteger.bitLength() < 64) {
+ return dform.format(bigInteger.longValue(), toAppendTo, pos);
+ } else {
+ return dform.formatBigInteger(bigInteger, toAppendTo, pos);
+ }
+ } else if (number instanceof BigDecimal) {
+ return dform.formatBigDecimal((BigDecimal) number, toAppendTo, pos);
}
return super.format(number, toAppendTo, pos);
}
diff --git a/libcore/text/src/main/java/java/text/Format.java b/libcore/text/src/main/java/java/text/Format.java
index eb1b837..567b0f6 100644
--- a/libcore/text/src/main/java/java/text/Format.java
+++ b/libcore/text/src/main/java/java/text/Format.java
@@ -22,7 +22,6 @@
import java.security.PrivilegedAction;
// BEGIN android-added
import java.util.Locale;
-import java.util.ResourceBundle;
// END android-added
import org.apache.harmony.text.internal.nls.Messages;
diff --git a/libcore/text/src/main/java/java/text/NumberFormat.java b/libcore/text/src/main/java/java/text/NumberFormat.java
index 5f6693d..0ad6ac4 100644
--- a/libcore/text/src/main/java/java/text/NumberFormat.java
+++ b/libcore/text/src/main/java/java/text/NumberFormat.java
@@ -26,11 +26,9 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamField;
+import java.math.BigInteger;
import java.util.Currency;
import java.util.Locale;
-// BEGIN android-added
-import java.util.ResourceBundle;
-// END android-added
import com.ibm.icu4jni.util.LocaleData;
import org.apache.harmony.text.internal.nls.Messages;
@@ -242,8 +240,7 @@
* of the alignment field in the formatted text.
* @return the string buffer.
*/
- public abstract StringBuffer format(double value, StringBuffer buffer,
- FieldPosition field);
+ public abstract StringBuffer format(double value, StringBuffer buffer, FieldPosition field);
/**
* Formats the specified long using the rules of this number format.
@@ -276,12 +273,15 @@
* of the alignment field in the formatted text.
* @return the string buffer.
*/
- public abstract StringBuffer format(long value, StringBuffer buffer,
- FieldPosition field);
+ public abstract StringBuffer format(long value, StringBuffer buffer, FieldPosition field);
/**
- * Formats the specified object as a string using the pattern of this number
- * format and appends the string to the specified string buffer.
+ * Formats a number into a supplied buffer.
+ * <p>
+ * The number must be a subclass of {@code Number}. Instances of {@code Byte}, {@code Short},
+ * {@code Integer}, and {@code Long} have {@code Number.longValue} invoked, as do instances of
+ * {@code BigInteger} where {@code BigInteger.bitLength} returns <i>less than</i> 64. All other
+ * values have {@code Number.doubleValue} invoked instead.
* <p>
* If the {@code field} member of {@code field} contains a value specifying
* a format field, then its {@code beginIndex} and {@code endIndex} members
@@ -300,14 +300,15 @@
* if {@code object} is not an instance of {@code Number}.
*/
@Override
- public StringBuffer format(Object object, StringBuffer buffer,
- FieldPosition field) {
- if (object instanceof Double || object instanceof Float) {
- double dv = ((Number) object).doubleValue();
- return format(dv, buffer, field);
- } else if (object instanceof Number) {
+ public StringBuffer format(Object object, StringBuffer buffer, FieldPosition field) {
+ if (object instanceof Byte || object instanceof Short || object instanceof Integer ||
+ object instanceof Long ||
+ (object instanceof BigInteger && ((BigInteger) object).bitLength() < 64)) {
long lv = ((Number) object).longValue();
return format(lv, buffer, field);
+ } else if (object instanceof Number) {
+ double dv = ((Number) object).doubleValue();
+ return format(dv, buffer, field);
}
throw new IllegalArgumentException();
}
diff --git a/libcore/text/src/main/java/java/text/SimpleDateFormat.java b/libcore/text/src/main/java/java/text/SimpleDateFormat.java
index e2422ad..a67c7e6 100644
--- a/libcore/text/src/main/java/java/text/SimpleDateFormat.java
+++ b/libcore/text/src/main/java/java/text/SimpleDateFormat.java
@@ -1040,7 +1040,6 @@
* @return the {@code DateFormatSymbols} object.
*/
public DateFormatSymbols getDateFormatSymbols() {
- // Return a clone so the arrays in the ResourceBundle are not modified
return (DateFormatSymbols) formatData.clone();
}
diff --git a/libcore/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java b/libcore/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
index ec8c9a2..92945ee 100644
--- a/libcore/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
+++ b/libcore/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
@@ -1832,12 +1832,6 @@
args = {java.lang.Object.class}
)
public void test_formatToCharacterIteratorLjava_lang_Object() {
- Locale[] requiredLocales = {Locale.US};
- if (!Support_Locale.areLocalesAvailable(requiredLocales)) {
- // locale dependent test, bug 1943269
- return;
- }
-
try {
// Regression for HARMONY-466
new DecimalFormat().formatToCharacterIterator(null);
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 );