abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r609233 - in /incubator/abdera/java/trunk/dependencies/i18n/src: main/java/org/apache/abdera/i18n/iri/IRI.java test/java/org/apache/abdera/i18n/test/iri/TestIDNA.java
Date Sat, 05 Jan 2008 22:45:41 GMT
Author: jmsnell
Date: Sat Jan  5 14:45:40 2008
New Revision: 609233

URL: http://svn.apache.org/viewvc?rev=609233&view=rev
Log:
Fix the broken test cases

Modified:
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/IRI.java
    incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestIDNA.java

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/IRI.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/IRI.java?rev=609233&r1=609232&r2=609233&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/IRI.java
(original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/IRI.java
Sat Jan  5 14:45:40 2008
@@ -410,6 +410,14 @@
   }
   
   public static IRI resolve(IRI b, IRI c) {
+    
+    if (c == null) return null;
+    if ("".equals(c.toString()) || 
+        "#".equals(c.toString()) ||
+        ".".equals(c.toString()) ||
+        "./".equals(c.toString())) return b;
+    if (b == null) return c;
+    
     if (c.isOpaque() || b.isOpaque()) return c;
     if (c.isSameDocumentReference()) {
       String cfragment = c.getFragment();
@@ -539,6 +547,7 @@
     int n = bpath.lastIndexOf('/');
     if (n > -1) buf.append(bpath.substring(0,n+1));
     if (cpath.length() != 0) buf.append(cpath);
+    if (buf.charAt(0) != '/') buf.insert(0,'/');
     return normalize(buf.toString());
   }
   

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestIDNA.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestIDNA.java?rev=609233&r1=609232&r2=609233&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestIDNA.java
(original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestIDNA.java
Sat Jan  5 14:45:40 2008
@@ -22,12 +22,12 @@
 public class TestIDNA extends TestBase {
 
   public static void testPunycode() throws Exception {
-    String o = "áéíñó½©";
+    String o = "\u00e1\u00e9\u00ed\u00f1\u00f3\u00bd\u00a9";
     String i = "12-uda5tmbya2aq8623e";
     String out = IDNA.toASCII(o);
     String in = IDNA.toUnicode(i);
-//    assertTrue(out.equalsIgnoreCase("xn--" + i));
-//    assertTrue(in.equalsIgnoreCase(i));
+    assertTrue(out.equalsIgnoreCase("xn--" + i));
+    assertTrue(in.equalsIgnoreCase(i));
   }
   
 }



Mime
View raw message