ARTEMIS-667 Make AMQP Exceptions extend ActiveMQException
This commit is contained in:
parent
d871dfe622
commit
06fb4a1234
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -201,7 +201,8 @@ public enum ActiveMQExceptionType {
|
|||
return new ActiveMQClusterSecurityException(msg);
|
||||
}
|
||||
|
||||
};
|
||||
},
|
||||
NOT_IMPLEMTNED_EXCEPTION(213);
|
||||
|
||||
private static final Map<Integer, ActiveMQExceptionType> TYPE_MAP;
|
||||
|
||||
|
|
|
@ -76,6 +76,11 @@
|
|||
<artifactId>artemis-server</artifactId>
|
||||
<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>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue