activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [2/3] activemq-artemis git commit: ARTEMIS-667 Make AMQP Exceptions extend ActiveMQException
Date Fri, 05 Aug 2016 14:35:32 GMT
ARTEMIS-667 Make AMQP Exceptions extend ActiveMQException


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/06fb4a12
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/06fb4a12
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/06fb4a12

Branch: refs/heads/master
Commit: 06fb4a1234887737b9e4d02c75e51836d286023a
Parents: d871dfe
Author: Martyn Taylor <mtaylor@redhat.com>
Authored: Thu Aug 4 13:58:30 2016 +0100
Committer: Martyn Taylor <mtaylor@redhat.com>
Committed: Fri Aug 5 15:29:01 2016 +0100

----------------------------------------------------------------------
 .../artemis/api/core/ActiveMQException.java     | 10 ++++++++
 .../artemis/api/core/ActiveMQExceptionType.java |  3 ++-
 artemis-protocols/artemis-proton-plug/pom.xml   |  5 ++++
 .../plug/exceptions/ActiveMQAMQPException.java  | 12 +++++----
 .../ActiveMQAMQPIllegalStateException.java      |  3 ++-
 .../ActiveMQAMQPInternalErrorException.java     |  5 ++--
 .../ActiveMQAMQPInvalidFieldException.java      |  3 ++-
 .../ActiveMQAMQPNotFoundException.java          |  7 ++---
 .../ActiveMQAMQPNotImplementedException.java    |  5 ++--
 ...iveMQAMQPResourceLimitExceededException.java | 27 ++++++++++++++++++++
 .../ActiveMQAMQPTimeoutException.java           |  3 ++-
 11 files changed, 65 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/06fb4a12/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQException.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQException.java
b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQException.java
index 13a35b1..6404c74 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQException.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQException.java
@@ -34,6 +34,16 @@ public class ActiveMQException extends Exception {
       type = ActiveMQExceptionType.GENERIC_EXCEPTION;
    }
 
+   public ActiveMQException(String msg, ActiveMQExceptionType t) {
+      super(msg);
+      type = t;
+   }
+
+   public ActiveMQException(String message, Throwable t, ActiveMQExceptionType type) {
+      super(message, t);
+      this.type = type;
+   }
+
    /*
    * This constructor is needed only for the native layer
    */

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/06fb4a12/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQExceptionType.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQExceptionType.java
b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQExceptionType.java
index f135653..eb4bf5d 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQExceptionType.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQExceptionType.java
@@ -201,7 +201,8 @@ public enum ActiveMQExceptionType {
          return new ActiveMQClusterSecurityException(msg);
       }
 
-   };
+   },
+   NOT_IMPLEMTNED_EXCEPTION(213);
 
    private static final Map<Integer, ActiveMQExceptionType> TYPE_MAP;
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/06fb4a12/artemis-protocols/artemis-proton-plug/pom.xml
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-proton-plug/pom.xml b/artemis-protocols/artemis-proton-plug/pom.xml
index 684b3ce..b4876cf 100644
--- a/artemis-protocols/artemis-proton-plug/pom.xml
+++ b/artemis-protocols/artemis-proton-plug/pom.xml
@@ -77,6 +77,11 @@
          <version>${project.version}</version>
       </dependency>
       <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-commons</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
          <groupId>org.apache.qpid</groupId>
          <artifactId>proton-j</artifactId>
       </dependency>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/06fb4a12/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPException.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPException.java
b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPException.java
index 6e240e3..4838d55 100644
--- a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPException.java
+++ b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPException.java
@@ -16,9 +16,11 @@
  */
 package org.proton.plug.exceptions;
 
+import org.apache.activemq.artemis.api.core.ActiveMQException;
+import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
 import org.apache.qpid.proton.amqp.Symbol;
 
-public class ActiveMQAMQPException extends Exception {
+public class ActiveMQAMQPException extends ActiveMQException {
 
    private static final String ERROR_PREFIX = "amqp:";
 
@@ -28,13 +30,13 @@ public class ActiveMQAMQPException extends Exception {
 
    private final Symbol amqpError;
 
-   public ActiveMQAMQPException(Symbol amqpError, String message, Throwable e) {
-      super(message, e);
+   public ActiveMQAMQPException(Symbol amqpError, String message, Throwable e, ActiveMQExceptionType
t) {
+      super(message, e, t);
       this.amqpError = amqpError;
    }
 
-   public ActiveMQAMQPException(Symbol amqpError, String message) {
-      super(message);
+   public ActiveMQAMQPException(Symbol amqpError, String message, ActiveMQExceptionType t)
{
+      super(message, t);
       this.amqpError = amqpError;
    }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/06fb4a12/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPIllegalStateException.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPIllegalStateException.java
b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPIllegalStateException.java
index cdbf4fa..7818ef9 100644
--- a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPIllegalStateException.java
+++ b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPIllegalStateException.java
@@ -16,11 +16,12 @@
  */
 package org.proton.plug.exceptions;
 
+import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
 import org.apache.qpid.proton.amqp.transport.AmqpError;
 
 public class ActiveMQAMQPIllegalStateException extends ActiveMQAMQPException {
 
    public ActiveMQAMQPIllegalStateException(String message) {
-      super(AmqpError.ILLEGAL_STATE, message);
+      super(AmqpError.ILLEGAL_STATE, message, ActiveMQExceptionType.ILLEGAL_STATE);
    }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/06fb4a12/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPInternalErrorException.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPInternalErrorException.java
b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPInternalErrorException.java
index e30073c..2c0b0ae 100644
--- a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPInternalErrorException.java
+++ b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPInternalErrorException.java
@@ -16,15 +16,16 @@
  */
 package org.proton.plug.exceptions;
 
+import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
 import org.apache.qpid.proton.amqp.transport.AmqpError;
 
 public class ActiveMQAMQPInternalErrorException extends ActiveMQAMQPException {
 
    public ActiveMQAMQPInternalErrorException(String message, Throwable e) {
-      super(AmqpError.INTERNAL_ERROR, message, e);
+      super(AmqpError.INTERNAL_ERROR, message, e, ActiveMQExceptionType.INTERNAL_ERROR);
    }
 
    public ActiveMQAMQPInternalErrorException(String message) {
-      super(AmqpError.INTERNAL_ERROR, message);
+      super(AmqpError.INTERNAL_ERROR, message, ActiveMQExceptionType.INTERNAL_ERROR);
    }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/06fb4a12/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPInvalidFieldException.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPInvalidFieldException.java
b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPInvalidFieldException.java
index c6978a2..f5dd168 100644
--- a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPInvalidFieldException.java
+++ b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPInvalidFieldException.java
@@ -16,11 +16,12 @@
  */
 package org.proton.plug.exceptions;
 
+import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
 import org.apache.qpid.proton.amqp.transport.AmqpError;
 
 public class ActiveMQAMQPInvalidFieldException extends ActiveMQAMQPException {
 
    public ActiveMQAMQPInvalidFieldException(String message) {
-      super(AmqpError.INVALID_FIELD, message);
+      super(AmqpError.INVALID_FIELD, message, ActiveMQExceptionType.ILLEGAL_STATE);
    }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/06fb4a12/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPNotFoundException.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPNotFoundException.java
b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPNotFoundException.java
index dc4c400..02cc15c 100644
--- a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPNotFoundException.java
+++ b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPNotFoundException.java
@@ -16,15 +16,12 @@
  */
 package org.proton.plug.exceptions;
 
+import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
 import org.apache.qpid.proton.amqp.transport.AmqpError;
 
 public class ActiveMQAMQPNotFoundException extends ActiveMQAMQPException {
 
-   public ActiveMQAMQPNotFoundException(String message, Throwable e) {
-      super(AmqpError.NOT_FOUND, message, e);
-   }
-
    public ActiveMQAMQPNotFoundException(String message) {
-      super(AmqpError.NOT_FOUND, message);
+      super(AmqpError.NOT_FOUND, message, ActiveMQExceptionType.QUEUE_DOES_NOT_EXIST);
    }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/06fb4a12/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPNotImplementedException.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPNotImplementedException.java
b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPNotImplementedException.java
index 6a1c95c..861e236 100644
--- a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPNotImplementedException.java
+++ b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPNotImplementedException.java
@@ -16,11 +16,12 @@
  */
 package org.proton.plug.exceptions;
 
+import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
 import org.apache.qpid.proton.amqp.transport.AmqpError;
 
 public class ActiveMQAMQPNotImplementedException extends ActiveMQAMQPException {
 
    public ActiveMQAMQPNotImplementedException(String message) {
-      super(AmqpError.NOT_IMPLEMENTED, message);
+      super(AmqpError.NOT_IMPLEMENTED, message, ActiveMQExceptionType.NOT_IMPLEMTNED_EXCEPTION);
    }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/06fb4a12/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPResourceLimitExceededException.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPResourceLimitExceededException.java
b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPResourceLimitExceededException.java
new file mode 100644
index 0000000..2c64a8d
--- /dev/null
+++ b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPResourceLimitExceededException.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.proton.plug.exceptions;
+
+import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
+import org.apache.qpid.proton.amqp.transport.AmqpError;
+
+public class ActiveMQAMQPResourceLimitExceededException extends ActiveMQAMQPException {
+
+   public ActiveMQAMQPResourceLimitExceededException(String message) {
+      super(AmqpError.RESOURCE_LIMIT_EXCEEDED, message, ActiveMQExceptionType.ADDRESS_FULL);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/06fb4a12/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPTimeoutException.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPTimeoutException.java
b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPTimeoutException.java
index 25b4ea6..c86c25d 100644
--- a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPTimeoutException.java
+++ b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/exceptions/ActiveMQAMQPTimeoutException.java
@@ -16,12 +16,13 @@
  */
 package org.proton.plug.exceptions;
 
+import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
 import org.apache.qpid.proton.amqp.transport.AmqpError;
 
 public class ActiveMQAMQPTimeoutException extends ActiveMQAMQPException {
 
    public ActiveMQAMQPTimeoutException(String message) {
-      super(AmqpError.ILLEGAL_STATE, message);
+      super(AmqpError.ILLEGAL_STATE, message, ActiveMQExceptionType.CONNECTION_TIMEDOUT);
    }
 
 }


Mime
View raw message