harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From regi...@apache.org
Subject svn commit: r763527 - /harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/IDN.java
Date Thu, 09 Apr 2009 06:29:45 GMT
Author: regisxu
Date: Thu Apr  9 06:29:45 2009
New Revision: 763527

URL: http://svn.apache.org/viewvc?rev=763527&view=rev
Log:
fix test failure of org.apache.harmony.luni.tests.java.net.IDNTest

convert all forms of labs separator to \u002E in IDN.toUnicode
This behavior is undefined in spec, just follow RI

Modified:
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/IDN.java

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/IDN.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/IDN.java?rev=763527&r1=763526&r2=763527&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/IDN.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/IDN.java
Thu Apr  9 06:29:45 2009
@@ -132,10 +132,27 @@
 		} catch (StringPrepParseException e) {
 			throw new IllegalArgumentException(e.getMessage());
 		}
-		return result;
+        return convertDots(result);
 	}
 
-	private static int convertFlags(int flag) {
+	private static String convertDots(String input) {
+	    String result = input;
+        if (result.indexOf("\u3002") != -1) {
+            result = result.replace("\u3002", "\u002E");
+        }
+
+        if (result.indexOf("\uFF0E") != -1) {
+            result = result.replace("\uFF0E", "\u002E");
+        }
+
+        if (result.indexOf("\uFF61") != -1) {
+            result = result.replace("\uFF61", "\u002E");
+        }
+
+        return result;
+    }
+
+    private static int convertFlags(int flag) {
 		int ICUFlag = ((flag & IDN.ALLOW_UNASSIGNED) == 0)? 0:IDNA.ALLOW_UNASSIGNED;
 		ICUFlag |= ((flag & IDN.USE_STD3_ASCII_RULES) == 0)? 0:IDNA.USE_STD3_RULES;
 		return ICUFlag;



Mime
View raw message