Index: modules/text/src/test/java/org/apache/harmony/text/tests/java/text/RuleBasedCollatorTest.java =================================================================== --- modules/text/src/test/java/org/apache/harmony/text/tests/java/text/RuleBasedCollatorTest.java (revision 420760) +++ modules/text/src/test/java/org/apache/harmony/text/tests/java/text/RuleBasedCollatorTest.java (working copy) @@ -264,6 +264,17 @@ } /** + * @tests java.text.RuleBasedCollator.compare(java.lang.String, java.lang.String) + */ + public void testCompareNull() throws Exception { + try { + new RuleBasedCollator("< a").compare(null, null); + fail("RuleBasedCollator.compare(null, null) " + + "should throw NullPointerException"); + } catch (NullPointerException e) {} + } + + /** * @tests java.text.RuleBasedCollator.RuleBasedCollator(java.lang.String) */ public void testEmptyStringException() { Index: modules/text/src/main/java/java/text/RuleBasedCollator.java =================================================================== --- modules/text/src/main/java/java/text/RuleBasedCollator.java (revision 420760) +++ modules/text/src/main/java/java/text/RuleBasedCollator.java (working copy) @@ -148,6 +148,9 @@ * than, equivalent to, or greater than target. */ public int compare(String source, String target) { + if(source == null || target == null) { + throw new NullPointerException("one of arguments is null"); + } return this.icuColl.compare(source, target); }