public static ProviderConnectionRemotelyClosedException convertToConnectionClosedException()

in qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpSupport.java [116:148]


    public static ProviderConnectionRemotelyClosedException convertToConnectionClosedException(AmqpProvider provider, Endpoint endpoint, ErrorCondition errorCondition) {
        ProviderConnectionRemotelyClosedException remoteError = null;

        if (errorCondition != null && errorCondition.getCondition() != null) {
            Symbol error = errorCondition.getCondition();
            String message = extractErrorMessage(errorCondition);

            if (error.equals(AmqpError.UNAUTHORIZED_ACCESS)) {
                remoteError = new ProviderConnectionSecurityException(message);
            } else if (error.equals(AmqpError.RESOURCE_LIMIT_EXCEEDED)) {
                remoteError = new ProviderConnectionResourceAllocationException(message);
            } else if (error.equals(ConnectionError.CONNECTION_FORCED)) {
                remoteError = new ProviderConnectionRemotelyClosedException(message);
            } else if (error.equals(AmqpError.NOT_FOUND)) {
                remoteError = new ProviderConnectionResourceNotFoundException(message);
            } else if (error.equals(ConnectionError.REDIRECT)) {
                remoteError = createRedirectException(provider, error, message, errorCondition);
            } else if (error.equals(AmqpError.INVALID_FIELD)) {
                Map<?, ?> info = errorCondition.getInfo();
                if (info != null && CONTAINER_ID.equals(info.get(INVALID_FIELD))) {
                    remoteError = new ProviderInvalidClientIDException(message);
                } else {
                    remoteError = new ProviderConnectionRemotelyClosedException(message);
                }
            } else {
                remoteError = new ProviderConnectionRemotelyClosedException(message);
            }
        } else if (remoteError == null) {
            remoteError = new ProviderConnectionRemotelyClosedException("Unknown error from remote peer");
        }

        return remoteError;
    }