OODT-887 change url to uri to prevent dns resolution

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

Branch: refs/heads/master
Commit: d653cb05d0a2c7ebd9f74c26b11b1b2bc45c4a33
Parents: 1b8d1f7
Author: Tom Barber <[email protected]>
Authored: Fri Oct 9 20:33:23 2015 +0100
Committer: Tom Barber <[email protected]>
Committed: Fri Oct 9 20:33:23 2015 +0100

----------------------------------------------------------------------
 .../lightweight/LightweightProfileServer.java   | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oodt/blob/d653cb05/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServer.java
----------------------------------------------------------------------
diff --git 
a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServer.java
 
b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServer.java
index 947d67f..a557724 100644
--- 
a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServer.java
+++ 
b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServer.java
@@ -34,6 +34,7 @@ import org.xml.sax.SAXParseException;
 
 import java.io.IOException;
 import java.net.MalformedURLException;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.*;
 
@@ -51,9 +52,8 @@ final public class LightweightProfileServer implements 
ProfileHandler {
         *
         * @throws IOException If an I/O error occurs.
         * @throws SAXException If an error occurs parsing the profile file.
-        * @throws MalformedURLException If the default profile URL is 
malformed.
         */
-       public LightweightProfileServer() throws IOException, SAXException, 
MalformedURLException {
+       public LightweightProfileServer() throws IOException, SAXException {
                this(System.getProperties());
        }
 
@@ -90,8 +90,12 @@ final public class LightweightProfileServer implements 
ProfileHandler {
                this.id = id;
 
                // Get the list of profiles from the cache, if it's there.
-               profiles = (List) cache.get(url);
-               if (profiles != null) return;
+         try {
+               profiles = (List) cache.get(url.toURI());
+         } catch (URISyntaxException e) {
+               e.printStackTrace();
+         }
+         if (profiles != null) return;
 
                // It wasn't in the cache, so create a parser to parse the 
file.  We only
                // deal with correct files, so turn on validation and install 
an error
@@ -122,9 +126,13 @@ final public class LightweightProfileServer implements 
ProfileHandler {
                doc.normalize();
                Element root = doc.getDocumentElement();
                profiles = Profile.createProfiles(root, new 
SearchableObjectFactory());
-               cache.put(url, profiles);
+         try {
+               cache.put(url.toURI(), profiles);
+         } catch (URISyntaxException e) {
+               e.printStackTrace();
+         }
 
-               System.err.println("LightweightProfileServer ready");
+         System.err.println("LightweightProfileServer ready");
        }
 
        public List findProfiles(XMLQuery query) throws ProfileException {

Reply via email to