harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r495712 - in /harmony/enhanced/classlib/trunk/modules/regex/src: main/java/java/util/regex/Matcher.java main/java/org/apache/harmony/regex/internal/nls/messages.properties test/java/org/apache/harmony/tests/java/util/regex/Matcher2Test.java
Date Fri, 12 Jan 2007 19:55:29 GMT
Author: hindessm
Date: Fri Jan 12 11:55:29 2007
New Revision: 495712

URL: http://svn.apache.org/viewvc?view=rev&rev=495712
Log:
Applied patches from "[#HARMONY-2418] [classlib][regex]
java.util.regex.Matcher.usePattern(Pattern) throws NPE instead of
specified IllegalArgumentException".

Modified:
    harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Matcher.java
    harmony/enhanced/classlib/trunk/modules/regex/src/main/java/org/apache/harmony/regex/internal/nls/messages.properties
    harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/Matcher2Test.java

Modified: harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Matcher.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Matcher.java?view=diff&rev=495712&r1=495711&r2=495712
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Matcher.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Matcher.java
Fri Jan 12 11:55:29 2007
@@ -508,6 +508,9 @@
      * @com.intel.drl.spec_ref
      */
     public Matcher usePattern(Pattern pat) {
+    	if (pat == null) {
+    		throw new IllegalArgumentException(Messages.getString("regex.1B"));
+    	}
         int startIndex = matchResult.getPreviousMatchEnd();
         int mode = matchResult.mode();
         this.pat = pat;

Modified: harmony/enhanced/classlib/trunk/modules/regex/src/main/java/org/apache/harmony/regex/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/regex/src/main/java/org/apache/harmony/regex/internal/nls/messages.properties?view=diff&rev=495712&r1=495711&r2=495712
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/regex/src/main/java/org/apache/harmony/regex/internal/nls/messages.properties
(original)
+++ harmony/enhanced/classlib/trunk/modules/regex/src/main/java/org/apache/harmony/regex/internal/nls/messages.properties
Fri Jan 12 11:55:29 2007
@@ -41,3 +41,4 @@
 regex.18=Invalid {0} escape sequence
 regex.19=Invalid octal escape sequence
 regex.1A=Illegal inline construct
+regex.1B=Pattern cannot be null

Modified: harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/Matcher2Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/Matcher2Test.java?view=diff&rev=495712&r1=495711&r2=495712
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/Matcher2Test.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/Matcher2Test.java
Fri Jan 12 11:55:29 2007
@@ -71,6 +71,14 @@
 			fail("IllegalStateException expected");
 		} catch (IllegalStateException e) {
 		}
+		
+               // regression test for HARMONY-2418
+		try {
+			m.usePattern(null);
+			fail("IllegalArgumentException expected");
+		} catch (IllegalArgumentException e) {
+                 // PASSED
+		}
     }
 
     public void testErrorConditions2() throws PatternSyntaxException {



Mime
View raw message