harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r507028 - in /harmony/enhanced/classlib/trunk/modules/regex/src: main/java/java/util/regex/AbstractCharClass.java test/java/org/apache/harmony/tests/java/util/regex/MatcherTest.java
Date Tue, 13 Feb 2007 14:50:37 GMT
Author: apetrenko
Date: Tue Feb 13 06:50:30 2007
New Revision: 507028

URL: http://svn.apache.org/viewvc?view=rev&rev=507028
Log:
Patch for HARMONY-3145 "[regex] java.util.regex.Pattern failed to compile "(\\P{all})+" pattern
unlike RI"

Modified:
    harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/AbstractCharClass.java
    harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/MatcherTest.java

Modified: harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/AbstractCharClass.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/AbstractCharClass.java?view=diff&rev=507028&r1=507027&r2=507028
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/AbstractCharClass.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/AbstractCharClass.java
Tue Feb 13 06:50:30 2007
@@ -782,6 +782,7 @@
                 { "SmallFormVariants", new LazyRange(0xFE50, 0xFE6F) }, //$NON-NLS-1$
                 { "ArabicPresentationForms-B", new LazyRange(0xFE70, 0xFEFF) }, //$NON-NLS-1$
                 { "HalfwidthandFullwidthForms", new LazyRange(0xFF00, 0xFFEF) }, //$NON-NLS-1$
+                { "all", new LazyRange(0x00, 0x10FFFF) }, //$NON-NLS-1$ 
                 { "Specials", new LazySpecialsBlock() }, //$NON-NLS-1$
                 { "Cn", new LazyCategory(Character.UNASSIGNED, true) },
                 { "IsL", new LazyCategoryScope(0x3E, true) },

Modified: harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/MatcherTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/MatcherTest.java?view=diff&rev=507028&r1=507027&r2=507028
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/MatcherTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/MatcherTest.java
Tue Feb 13 06:50:30 2007
@@ -614,6 +614,41 @@
 		assertTrue(matcher.matches());
 	}
 
+        public void testAllCodePoints() {
+                // Regression for HARMONY-3145
+                int[] codePoint = new int[1];
+		Pattern p = Pattern.compile("(\\p{all})+");		
+		boolean res = true;
+		int cnt = 0;
+		String s;
+		for (int i =0; i < 0x110000; i ++) {
+			codePoint[0] = i;
+			s = new String(codePoint, 0, 1);
+			if (!s.matches(p.toString())) {
+				cnt++;
+				res = false;
+			}
+		}
+		assertTrue(res);
+                assertEquals(0, cnt);
+		
+		p = Pattern.compile("(\\P{all})+");		
+		res = true;
+		cnt = 0;
+		
+		for (int i =0; i < 0x110000; i ++) {
+			codePoint[0] = i;
+			s = new String(codePoint, 0, 1);			
+			if (!s.matches(p.toString())) {
+				cnt++;
+				res = false;
+			}
+		}		 
+		
+		assertFalse(res);
+                assertEquals(0x110000, cnt);
+        } 
+
 	/*
 	 * Verify if the Matcher behaves correct when region is changed
 	 */



Mime
View raw message