jdk/src/share/classes/java/text/RuleBasedCollator.java
changeset 6834 303c8cca4a31
parent 5506 202f599c92aa
child 7511 54a6d9105e27
--- a/jdk/src/share/classes/java/text/RuleBasedCollator.java	Thu Oct 07 18:23:13 2010 +0400
+++ b/jdk/src/share/classes/java/text/RuleBasedCollator.java	Fri Oct 08 09:50:56 2010 +0900
@@ -335,9 +335,15 @@
      * collation rules.  Returns information about whether a string is less
      * than, greater than or equal to another string in a language.
      * This can be overriden in a subclass.
+     *
+     * @exception NullPointerException if <code>source</code> or <code>target</code> is null.
      */
     public synchronized int compare(String source, String target)
     {
+        if (source == null || target == null) {
+            throw new NullPointerException();
+        }
+
         // The basic algorithm here is that we use CollationElementIterators
         // to step through both the source and target strings.  We compare each
         // collation element in the source string against the corresponding one