OODT-887 remove URL network dependency

Project: http://git-wip-us.apache.org/repos/asf/oodt/repo
Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/5cad5670
Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/5cad5670
Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/5cad5670

Branch: refs/heads/master
Commit: 5cad567031145ebde0bba9348e409202ddf86c99
Parents: e03610d
Author: Tom Barber <[email protected]>
Authored: Fri Oct 9 17:01:50 2015 +0100
Committer: Tom Barber <[email protected]>
Committed: Fri Oct 9 17:01:50 2015 +0100

----------------------------------------------------------------------
 .../oodt/cas/pushpull/config/SiteInfo.java      | 28 ++++++++++++++------
 1 file changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oodt/blob/5cad5670/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/SiteInfo.java
----------------------------------------------------------------------
diff --git 
a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/SiteInfo.java 
b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/SiteInfo.java
index 487284b..d96ad09 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/SiteInfo.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/SiteInfo.java
@@ -19,14 +19,18 @@
 package org.apache.oodt.cas.pushpull.config;
 
 //JDK imports
+import org.apache.oodt.cas.pushpull.protocol.RemoteSite;
+
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.HashMap;
 import java.util.LinkedList;
-import java.util.Set;
 import java.util.Map.Entry;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 //OODT imports
-import org.apache.oodt.cas.pushpull.protocol.RemoteSite;
 
 /**
  * 
@@ -39,6 +43,10 @@ import org.apache.oodt.cas.pushpull.protocol.RemoteSite;
  */
 public class SiteInfo {
 
+    /* our log stream */
+    private final static Logger LOG = Logger.getLogger(SiteInfo.class
+        .getName());
+
     private HashMap<String, RemoteSite> aliasAndRemoteSite;
 
     public SiteInfo() {
@@ -67,12 +75,16 @@ public class SiteInfo {
                     .entrySet();
             for (Entry<String, RemoteSite> entry : set) {
                 RemoteSite rs = entry.getValue();
-                if (rs.getURL().equals(url)
-                        && (username == null || rs.getUsername().equals(
-                                username))
-                        && (password == null || rs.getPassword().equals(
-                                password)))
-                    remoteSites.add(rs);
+                try {
+                    if (rs.getURL().toURI().equals(url.toURI())
+                            && (username == null || rs.getUsername().equals(
+                                    username))
+                            && (password == null || rs.getPassword().equals(
+                                    password)))
+                        remoteSites.add(rs);
+                } catch (URISyntaxException e) {
+                    LOG.log(Level.SEVERE, "Could not convert URL to URI 
Message: "+e.getMessage());
+                }
             }
             if (remoteSites.size() == 0) {
                 if (url != null && username != null && password != null)

Reply via email to