Index: modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatSymbolsTest.java =================================================================== --- modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatSymbolsTest.java (revision 406627) +++ modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatSymbolsTest.java (working copy) @@ -239,7 +239,20 @@ assertTrue("Returned incorrect pattern string", retVal.equals(val)); } - /** + /** + * @tests java.text.DateFormatSymbols#setLocalPatternChars(java.lang.String) + */ + public void test_setLocalPatternCharsLjava_lang_String_2() throws Exception { + DateFormatSymbols obj = new DateFormatSymbols(); + try { + obj.setLocalPatternChars((String) null); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // expected + } + } + + /** * @tests java.text.DateFormatSymbols#setMonths(java.lang.String[]) */ public void test_setMonths$Ljava_lang_String() { Index: modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java =================================================================== --- modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java (revision 406627) +++ modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java (working copy) @@ -319,7 +319,20 @@ .t_formatToCharacterIterator(); } - /** + /** + * @tests java.text.SimpleDateFormat#formatToCharacterIterator(java.lang.Object) + */ + public void test_formatToCharacterIteratorLjava_lang_Object_2() throws Exception { + SimpleDateFormat obj = new SimpleDateFormat(); + try { + obj.formatToCharacterIterator(null); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // expected + } + } + + /** * @tests java.text.SimpleDateFormat#format(java.util.Date, * java.lang.StringBuffer, java.text.FieldPosition) */ Index: modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java =================================================================== --- modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java (revision 406627) +++ modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java (working copy) @@ -1083,6 +1083,19 @@ } /** + * @tests java.text.DecimalFormat#formatToCharacterIterator(java.lang.Object) + */ + public void test_formatToCharacterIteratorLjava_lang_Object_2() throws Exception { + DecimalFormat obj = new DecimalFormat(); + try { + obj.formatToCharacterIterator(null); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // expected + } + } + + /** * @tests java.text.DecimalFormat#format(double) */ public void test_formatD() { Index: modules/text/src/main/java/java/text/DateFormatSymbols.java =================================================================== --- modules/text/src/main/java/java/text/DateFormatSymbols.java (revision 406627) +++ modules/text/src/main/java/java/text/DateFormatSymbols.java (working copy) @@ -284,6 +284,9 @@ * the String containing the pattern characters */ public void setLocalPatternChars(String data) { + if (data == null) { + throw new NullPointerException("data"); + } localPatternChars = data; } Index: modules/text/src/main/java/java/text/SimpleDateFormat.java =================================================================== --- modules/text/src/main/java/java/text/SimpleDateFormat.java (revision 406627) +++ modules/text/src/main/java/java/text/SimpleDateFormat.java (working copy) @@ -402,10 +402,15 @@ * @return an AttributedCharacterIterator with the formatted date and * attributes * + * @exception NullPointerException + * when the object is null * @exception IllegalArgumentException * when the object cannot be formatted by this Format */ public AttributedCharacterIterator formatToCharacterIterator(Object object) { + if (object == null) { + throw new NullPointerException("object"); + } if (object instanceof Date) return formatToCharacterIteratorImpl((Date) object); if (object instanceof Number) Index: modules/text/src/main/java/java/text/DecimalFormat.java =================================================================== --- modules/text/src/main/java/java/text/DecimalFormat.java (revision 406627) +++ modules/text/src/main/java/java/text/DecimalFormat.java (working copy) @@ -173,10 +173,15 @@ * @return an AttributedCharacterIterator with the formatted number and * attributes * + * @exception NullPointerException + * when the object is null * @exception IllegalArgumentException * when the object cannot be formatted by this Format */ public AttributedCharacterIterator formatToCharacterIterator(Object object) { + if (object == null) { + throw new NullPointerException("object"); + } return dform.formatToCharacterIterator(object); }