diff options
| author | Robert Godfrey <rgodfrey@apache.org> | 2014-02-14 10:52:47 +0000 |
|---|---|---|
| committer | Robert Godfrey <rgodfrey@apache.org> | 2014-02-14 10:52:47 +0000 |
| commit | 50b314a51a2c787fcd412a84cb8464f72e3868b4 (patch) | |
| tree | fa6e85db6da742fbb9b235ca3e1d036d288ae970 /qpid/java/broker-plugins/management-http | |
| parent | 08b64b592cb844cbd746b33e5f17c94b2158a115 (diff) | |
| download | qpid-python-50b314a51a2c787fcd412a84cb8464f72e3868b4.tar.gz | |
QPID-5551 : Remove uses of AMQException, add ServerScopedRuntimeException and ConnectionScopedRuntimeException
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1568235 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins/management-http')
4 files changed, 20 insertions, 7 deletions
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java index 3375a784ea..08b99a206d 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java +++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java @@ -76,6 +76,7 @@ import org.apache.qpid.server.model.VirtualHost; import org.apache.qpid.server.model.adapter.AbstractPluginAdapter; import org.apache.qpid.server.plugin.PluginFactory; import org.apache.qpid.server.util.MapValueConverter; +import org.apache.qpid.server.util.ServerScopedRuntimeException; import org.apache.qpid.transport.network.security.ssl.QpidMultipleTrustManager; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; @@ -181,7 +182,7 @@ public class HttpManagement extends AbstractPluginAdapter implements HttpManagem } catch (Exception e) { - throw new RuntimeException("Failed to start HTTP management on ports : " + httpPorts, e); + throw new ServerScopedRuntimeException("Failed to start HTTP management on ports : " + httpPorts, e); } CurrentActor.get().message(ManagementConsoleMessages.READY(OPERATIONAL_LOGGING_NAME)); @@ -198,7 +199,7 @@ public class HttpManagement extends AbstractPluginAdapter implements HttpManagem } catch (Exception e) { - throw new RuntimeException("Failed to stop HTTP management on ports : " + getHttpPorts(getBroker().getPorts()), e); + throw new ServerScopedRuntimeException("Failed to stop HTTP management on ports : " + getHttpPorts(getBroker().getPorts()), e); } } @@ -310,7 +311,7 @@ public class HttpManagement extends AbstractPluginAdapter implements HttpManagem } catch (GeneralSecurityException e) { - throw new RuntimeException("Cannot configure port " + port.getName() + " for transport " + Transport.SSL, e); + throw new ServerScopedRuntimeException("Cannot configure port " + port.getName() + " for transport " + Transport.SSL, e); } connector = new SslSocketConnector(factory); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementUtil.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementUtil.java index f6674b5152..9a2f0dd1f6 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementUtil.java +++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementUtil.java @@ -50,6 +50,7 @@ import org.apache.qpid.server.security.auth.SubjectAuthenticationResult; import org.apache.qpid.server.security.auth.UsernamePrincipal; import org.apache.qpid.server.security.auth.manager.ExternalAuthenticationManager; import org.apache.qpid.server.security.auth.manager.ExternalAuthenticationManagerFactory; +import org.apache.qpid.server.util.ServerScopedRuntimeException; import org.apache.qpid.transport.network.security.ssl.SSLUtil; public class HttpManagementUtil @@ -138,7 +139,7 @@ public class HttpManagementUtil } catch (PrivilegedActionException e) { - throw new RuntimeException("Unable to perform access check", e); + throw new ServerScopedRuntimeException("Unable to perform access check", e); } } finally diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java index ee481ebdbe..0381b711bc 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java +++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java @@ -40,6 +40,7 @@ import org.apache.qpid.server.management.plugin.HttpManagementConfiguration; import org.apache.qpid.server.management.plugin.HttpManagementUtil; import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.security.SecurityManager; +import org.apache.qpid.server.util.ConnectionScopedRuntimeException; import org.codehaus.jackson.JsonGenerationException; import org.codehaus.jackson.map.JsonMappingException; import org.codehaus.jackson.map.ObjectMapper; @@ -214,7 +215,16 @@ public abstract class AbstractServlet extends HttpServlet catch (PrivilegedActionException e) { LOGGER.error("Unable to perform action", e); - throw new RuntimeException(e.getCause()); + Throwable cause = e.getCause(); + if(cause instanceof RuntimeException) + { + throw (RuntimeException)cause; + } + if(cause instanceof Error) + { + throw (Error)cause; + } + throw new ConnectionScopedRuntimeException(e.getCause()); } finally { @@ -255,7 +265,7 @@ public abstract class AbstractServlet extends HttpServlet } catch (IOException e) { - throw new RuntimeException("Failed to send error response code " + errorCode, e); + throw new ConnectionScopedRuntimeException("Failed to send error response code " + errorCode, e); } } diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java index 9ad52007ab..a29a875071 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java +++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java @@ -21,6 +21,7 @@ package org.apache.qpid.server.management.plugin.servlet.rest; import org.apache.commons.codec.binary.Base64; +import org.apache.qpid.server.util.ConnectionScopedRuntimeException; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.SerializationConfig; @@ -210,7 +211,7 @@ public class SaslServlet extends AbstractServlet } if (!saslAuthEnabled) { - throw new RuntimeException("Sasl authentication disabled."); + throw new ConnectionScopedRuntimeException("Sasl authentication disabled."); } } |
