geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r428818 - in /geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src: ./ java/org/apache/geronimo/console/car/AddRepositoryHandler.java java/org/apache/geronimo/console/car/ListHandler.java
Date Fri, 04 Aug 2006 18:25:15 GMT
Author: jdillon
Date: Fri Aug  4 11:25:15 2006
New Revision: 428818

URL: http://svn.apache.org/viewvc?rev=428818&view=rev
Log:
 r630@jason-dillons-computer (orig r427999):  jdillon | 2006-08-02 07:15:34 -0700
  r615@dyn456093 (orig r427714):  ammulder | 2006-08-01 13:32:17 -0700
  Merge GERONIMO-2261 and GERONIMO-2243 to trunk
  
 

Modified:
    geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/   (props
changed)
    geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/AddRepositoryHandler.java
    geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java

Propchange: geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Fri Aug  4 11:25:15 2006
@@ -1 +1 @@
-13f79535-47bb-0310-9956-ffa450edef68:/geronimo/sandbox/svkmerge/trunk/applications/console/console-standard/src:427998
+13f79535-47bb-0310-9956-ffa450edef68:/geronimo/sandbox/svkmerge/trunk/applications/console/console-standard/src:427999

Modified: geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/AddRepositoryHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/AddRepositoryHandler.java?rev=428818&r1=428817&r2=428818&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/AddRepositoryHandler.java
(original)
+++ geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/AddRepositoryHandler.java
Fri Aug  4 11:25:15 2006
@@ -16,12 +16,11 @@
  */
 package org.apache.geronimo.console.car;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.console.MultiPageModel;
 import org.apache.geronimo.console.util.PortletManager;
-import org.apache.geronimo.console.util.ConfigurationData;
 import org.apache.geronimo.system.plugin.PluginRepositoryList;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
@@ -30,14 +29,14 @@
 import javax.portlet.RenderResponse;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.FileNotFoundException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.net.URL;
+import java.net.ConnectException;
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
+import java.net.URL;
 import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 
 /**
  * Handler for the import export main screen.
@@ -116,7 +115,12 @@
             URLConnection urlConnection = test.openConnection();
             if(urlConnection instanceof HttpURLConnection) {
                 HttpURLConnection con = (HttpURLConnection) urlConnection;
-                con.connect();
+                try {
+                    con.connect();
+                } catch (ConnectException e) {
+                    response.setRenderParameter("repoError", "Unable to connect to "+url+"
("+e.getMessage()+")");
+                    return false;
+                }
                 int result = con.getResponseCode();
                 log.debug("Repository check response: "+result);
                 if(result == 404) {

Modified: geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java?rev=428818&r1=428817&r2=428818&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java
(original)
+++ geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java
Fri Aug  4 11:25:15 2006
@@ -67,7 +67,9 @@
         String repository = request.getParameter("repository");
         String user = request.getParameter("repo-user");
         String pass = request.getParameter("repo-pass");
-        loadFromRepository(request, repository, user, pass);
+        if(!loadFromRepository(request, repository, user, pass)) {
+            //todo: loading failed -- do something!
+        }
         request.setAttribute("repository", repository);
         request.setAttribute("repouser", user);
         request.setAttribute("repopass", pass);
@@ -77,7 +79,7 @@
         return getMode()+BEFORE_ACTION;
     }
 
-    private void loadFromRepository(RenderRequest request, String repository, String username,
String password) throws IOException, PortletException {
+    private boolean loadFromRepository(RenderRequest request, String repository, String username,
String password) throws IOException, PortletException {
         PluginList data;
         try {
             data = PortletManager.getCurrentServer(request).getPluginInstaller().listPlugins(new
URL(repository), username, password);
@@ -85,6 +87,9 @@
             throw new PortletException("Invalid login for Maven repository '"+repository+"'",
e);
         }
         Map results = new HashMap();
+        if(data == null || data.getPlugins() == null) {
+            return false;
+        }
         for (int i = 0; i < data.getPlugins().length; i++) {
             PluginMetadata metadata = data.getPlugins()[i];
             List values = (List) results.get(metadata.getCategory());
@@ -101,5 +106,6 @@
         }
         request.setAttribute("categories", results);
         request.getPortletSession(true).setAttribute(CONFIG_LIST_SESSION_KEY, data);
+        return true;
     }
 }



Mime
View raw message