ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1371125 - /ace/sandbox/marrs/org.apache.ace.deployment.provider.repositorybased/src/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java
Date Thu, 09 Aug 2012 09:46:14 GMT
Author: marrs
Date: Thu Aug  9 09:46:14 2012
New Revision: 1371125

URL: http://svn.apache.org/viewvc?rev=1371125&view=rev
Log:
Changed a slow and dangerous URL.equals(URL) into an URI.equals(URI) and added some extra
logging when things go wrong.

Modified:
    ace/sandbox/marrs/org.apache.ace.deployment.provider.repositorybased/src/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java

Modified: ace/sandbox/marrs/org.apache.ace.deployment.provider.repositorybased/src/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.deployment.provider.repositorybased/src/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java?rev=1371125&r1=1371124&r2=1371125&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.deployment.provider.repositorybased/src/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java
(original)
+++ ace/sandbox/marrs/org.apache.ace.deployment.provider.repositorybased/src/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java
Thu Aug  9 09:46:14 2012
@@ -22,6 +22,8 @@ import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -256,11 +258,24 @@ public class RepositoryBasedProvider imp
      */
     private ArtifactData getArtifactData(URL url, Collection<ArtifactData> data) {
         ArtifactData bundle = null;
+        URI uri = null;
+        try {
+            uri = url.toURI();
+        }
+        catch (URISyntaxException e) {
+            m_log.log(LogService.LOG_ERROR, "Could not convert URL " + url + " to a URI");
+            return null;
+        }
         Iterator<ArtifactData> it = data.iterator();
         while (it.hasNext()) {
             bundle = it.next();
-            if (bundle.getUrl().equals(url)) {
-                return bundle;
+            try {
+                if (uri.equals(bundle.getUrl().toURI())) {
+                    return bundle;
+                }
+            }
+            catch (URISyntaxException e) {
+                m_log.log(LogService.LOG_ERROR, "Could not convert bundle URL for " + bundle.getFilename()
+ " to a URI");
             }
         }
         return null;
@@ -278,7 +293,8 @@ public class RepositoryBasedProvider imp
         Iterator<ArtifactData> it = data.iterator();
         while (it.hasNext()) {
             bundle = it.next();
-            if ((bundle.getSymbolicName() != null) && bundle.getSymbolicName().equals(symbolicName))
{
+            String bsn = bundle.getSymbolicName();
+            if ((bsn != null) && bsn.equals(symbolicName)) {
                 return bundle;
             }
         }



Mime
View raw message