jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [2/2] jena git commit: JENA-846 : Implement IRI.toURI. Clean up exception declarations.
Date Sat, 10 Jan 2015 19:08:25 GMT
JENA-846 : Implement IRI.toURI. Clean up exception declarations.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/612c1bc2
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/612c1bc2
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/612c1bc2

Branch: refs/heads/master
Commit: 612c1bc2a29c56de667ef475fd38a071e8668f78
Parents: 1e18e1d
Author: Andy Seaborne <andy@apache.org>
Authored: Sat Jan 10 19:08:08 2015 +0000
Committer: Andy Seaborne <andy@apache.org>
Committed: Sat Jan 10 19:08:08 2015 +0000

----------------------------------------------------------------------
 .../org/apache/jena/iri/impl/AbsIRIImpl.java    | 36 +++++++++-----------
 1 file changed, 16 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/612c1bc2/jena-iri/src/main/java/org/apache/jena/iri/impl/AbsIRIImpl.java
----------------------------------------------------------------------
diff --git a/jena-iri/src/main/java/org/apache/jena/iri/impl/AbsIRIImpl.java b/jena-iri/src/main/java/org/apache/jena/iri/impl/AbsIRIImpl.java
index fec96ef..2416bf2 100644
--- a/jena-iri/src/main/java/org/apache/jena/iri/impl/AbsIRIImpl.java
+++ b/jena-iri/src/main/java/org/apache/jena/iri/impl/AbsIRIImpl.java
@@ -18,14 +18,11 @@
 
 package org.apache.jena.iri.impl;
 
-import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-import java.net.IDN;
+import java.io.UnsupportedEncodingException ;
+import java.net.* ;
+import java.util.ArrayList ;
+import java.util.Iterator ;
+import java.util.NoSuchElementException ;
 
 import org.apache.jena.iri.* ;
 /*
@@ -270,6 +267,12 @@ abstract public class AbsIRIImpl extends  IRI implements
         return new URL(toASCIIString());
     }
 
+    @Override
+    public URI toURI() {
+        String x = createASCIIString() ;
+        return URI.create(x) ;
+    }
+
     // TODO ToAsciiMask
     static long ToAsciiMask = 
         ~0l;
@@ -280,14 +283,14 @@ abstract public class AbsIRIImpl extends  IRI implements
             | (1l << DOUBLE_DASH_IN_REG_NAME);
 */
     @Override
-    public String toASCIIString() throws MalformedURLException {
+    public String toASCIIString() {
         if (hasExceptionMask(ToAsciiMask)) {
             return createASCIIString();
         }
         return toString();
     }
 
-    private String createASCIIString() throws MalformedURLException {
+    private String createASCIIString() {
         StringBuffer asciiString = new StringBuffer();
 
         if (has(SCHEME)) {
@@ -320,24 +323,17 @@ abstract public class AbsIRIImpl extends  IRI implements
         return asciiString.toString();
     }
 
-    private void regNameToAscii(StringBuffer asciiString, String host)
-            throws MalformedURLException {
+    private void regNameToAscii(StringBuffer asciiString, String host) {
         if ((errors(HOST) & ToAsciiMask) == 0) {
             asciiString.append(host);
             return;
         }
-       
         asciiString.append(domainToAscii(host));
-
     }
 
-    static CharSequence domainToAscii(String host) throws MalformedIDNException {
+    static CharSequence domainToAscii(String host) {
         
-        try {
-            return IDNP.toASCII(host, IDN.USE_STD3_ASCII_RULES|IDN.ALLOW_UNASSIGNED);
-        } catch (Exception e) {
-            throw new MalformedIDNException(e);
-        } 
+        return IDNP.toASCII(host, IDN.USE_STD3_ASCII_RULES|IDN.ALLOW_UNASSIGNED);
         /*
         int u[] = new int[host.length()];
         for (int i = 0; i < host.length(); i++)


Mime
View raw message