Search in sources :

Example 1 with IllegalStateRuntimeException

use of jakarta.jms.IllegalStateRuntimeException in project openmq by eclipse-ee4j.

the class JMSContextImpl method setClientID.

@Override
public void setClientID(String clientID) {
    // this method is not permitted in the Java EE web or EJB containers
    if (containerType == ContainerType.JavaEE_Web_or_EJB) {
        // "This method may not be called in a Java EE web or EJB container"
        String errorString = AdministeredObject.cr.getKString(ClientResources.X_FORBIDDEN_IN_JAVAEE_WEB_EJB);
        JMSRuntimeException jmsre = new com.sun.messaging.jms.MQRuntimeException(errorString, ClientResources.X_FORBIDDEN_IN_JAVAEE_WEB_EJB);
        ExceptionHandler.throwJMSRuntimeException(jmsre);
    }
    // may throw JMSRuntimeException
    checkNotClosed();
    // may throw IllegalStateRuntimeException
    checkSetClientIDAllowed();
    // may throw InvalidClientIDRuntimeException
    checkClientID(clientID);
    if (connection instanceof ContextableConnection) {
        ((ContextableConnection) connection)._setClientIDForContext(clientID);
    } else {
        // for debugging
        throw new RuntimeException("Not yet implemented for " + connection.getClass());
    }
    disallowSetClientID();
}
Also used : MQInvalidDestinationRuntimeException(com.sun.messaging.jms.MQInvalidDestinationRuntimeException) JMSRuntimeException(jakarta.jms.JMSRuntimeException) MQTransactionRolledBackRuntimeException(com.sun.messaging.jms.MQTransactionRolledBackRuntimeException) JMSSecurityRuntimeException(jakarta.jms.JMSSecurityRuntimeException) MQInvalidSelectorRuntimeException(com.sun.messaging.jms.MQInvalidSelectorRuntimeException) MQTransactionInProgressRuntimeException(com.sun.messaging.jms.MQTransactionInProgressRuntimeException) IllegalStateRuntimeException(jakarta.jms.IllegalStateRuntimeException) InvalidClientIDRuntimeException(jakarta.jms.InvalidClientIDRuntimeException) MQIllegalStateRuntimeException(com.sun.messaging.jms.MQIllegalStateRuntimeException) MQRuntimeException(com.sun.messaging.jms.MQRuntimeException) MQSecurityRuntimeException(com.sun.messaging.jms.MQSecurityRuntimeException) JMSRuntimeException(jakarta.jms.JMSRuntimeException) MQRuntimeException(com.sun.messaging.jms.MQRuntimeException)

Example 2 with IllegalStateRuntimeException

use of jakarta.jms.IllegalStateRuntimeException in project openmq by eclipse-ee4j.

the class JMSContextImpl method checkSetClientIDAllowed.

/**
 * Check that setClientID is allowed to be called. If it isn't, log and throw a IllegalStateRuntimeException.
 */
private void checkSetClientIDAllowed() {
    boolean throwex = false;
    JMSException ex = null;
    try {
        if (allowToSetClientID == false || connection.getClientID() != null) {
            throwex = true;
        }
    } catch (JMSException e) {
        ex = e;
    }
    if (throwex || ex != null) {
        String errorString = AdministeredObject.cr.getKString(ClientResources.X_SET_CLIENT_ID);
        IllegalStateRuntimeException isre = new jakarta.jms.IllegalStateRuntimeException(errorString, ClientResources.X_SET_CLIENT_ID, ex);
        ExceptionHandler.throwJMSRuntimeException(isre);
    }
}
Also used : IllegalStateRuntimeException(jakarta.jms.IllegalStateRuntimeException) MQIllegalStateRuntimeException(com.sun.messaging.jms.MQIllegalStateRuntimeException) JMSException(jakarta.jms.JMSException)

Aggregations

MQIllegalStateRuntimeException (com.sun.messaging.jms.MQIllegalStateRuntimeException)2 IllegalStateRuntimeException (jakarta.jms.IllegalStateRuntimeException)2 MQInvalidDestinationRuntimeException (com.sun.messaging.jms.MQInvalidDestinationRuntimeException)1 MQInvalidSelectorRuntimeException (com.sun.messaging.jms.MQInvalidSelectorRuntimeException)1 MQRuntimeException (com.sun.messaging.jms.MQRuntimeException)1 MQSecurityRuntimeException (com.sun.messaging.jms.MQSecurityRuntimeException)1 MQTransactionInProgressRuntimeException (com.sun.messaging.jms.MQTransactionInProgressRuntimeException)1 MQTransactionRolledBackRuntimeException (com.sun.messaging.jms.MQTransactionRolledBackRuntimeException)1 InvalidClientIDRuntimeException (jakarta.jms.InvalidClientIDRuntimeException)1 JMSException (jakarta.jms.JMSException)1 JMSRuntimeException (jakarta.jms.JMSRuntimeException)1 JMSSecurityRuntimeException (jakarta.jms.JMSSecurityRuntimeException)1