geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r427711 - in /geronimo/branches/1.1: applications/console-standard/src/java/org/apache/geronimo/console/car/ modules/system/src/java/org/apache/geronimo/system/plugin/
Date Tue, 01 Aug 2006 20:29:07 GMT
Author: ammulder
Date: Tue Aug  1 13:29:07 2006
New Revision: 427711

URL: http://svn.apache.org/viewvc?rev=427711&view=rev
Log:
Don't show plugins as available if they're installed but just not
  running at the moment (GERONIMO-2261)
Avoid an NPE from abusing the back button
Handle another case where adding a repository fails

Modified:
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/AddRepositoryHandler.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java

Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/AddRepositoryHandler.java
URL: http://svn.apache.org/viewvc/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/AddRepositoryHandler.java?rev=427711&r1=427710&r2=427711&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/AddRepositoryHandler.java
(original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/AddRepositoryHandler.java
Tue Aug  1 13:29:07 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/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java
URL: http://svn.apache.org/viewvc/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java?rev=427711&r1=427710&r2=427711&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java
(original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java
Tue Aug  1 13:29:07 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;
     }
 }

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java?rev=427711&r1=427710&r2=427711&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
(original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
Tue Aug  1 13:29:07 2006
@@ -1351,7 +1351,7 @@
         if (moduleId != null) {
             artifact = Artifact.create(moduleId);
             // Tests, etc. don't need to have a ConfigurationManager
-            installed = configManager != null && configManager.isLoaded(artifact);
+            installed = configManager != null && configManager.isInstalled(artifact);
         }
         log.trace("Checking "+moduleId+": installed="+installed+", eligible="+eligible);
         PluginMetadata data = new PluginMetadata(getChildText(plugin, "name"),



Mime
View raw message