Class JMSExceptionSupport

java.lang.Object
org.messaginghub.pooled.jms.util.JMSExceptionSupport

public final class JMSExceptionSupport extends Object
Exception support class. Factory class for creating JMSException instances based on String messages or by wrapping other non-JMS exception.
  • Constructor Details

    • JMSExceptionSupport

      public JMSExceptionSupport()
  • Method Details

    • create

      public static jakarta.jms.JMSException create(String message, Throwable cause)
      Creates or passes through a JMSException to be thrown to the client. In the event that the exception passed to this method is already a JMSException it is passed through unmodified, otherwise a new JMSException is created with the given message and the cause is set to the given cause Throwable instance.
      Parameters:
      message - The message value to set when a new JMSException is created.
      cause - The exception that caused this error state.
      Returns:
      a JMSException instance.
    • create

      public static jakarta.jms.JMSException create(Throwable cause)
      Creates or passes through a JMSException to be thrown to the client. In the event that the exception passed to this method is already a JMSException it is passed through unmodified, otherwise a new JMSException is created using the error message taken from the given Throwable value and the cause value is set to the given Throwable instance.
      Parameters:
      cause - The exception that caused this error state.
      Returns:
      a JMSException instance.
    • createMessageEOFException

      public static jakarta.jms.MessageEOFException createMessageEOFException(Throwable cause)
      Creates or passes through a MessageEOFException to be thrown to the client. In the event that the exception passed to this method is already a MessageEOFException it is passed through unmodified, otherwise a new MessageEOFException is created using the error message taken from the given Throwable value and the cause value is set to the given Throwable instance.
      Parameters:
      cause - The exception that caused this error state.
      Returns:
      a MessageEOFException instance.
    • createMessageFormatException

      public static jakarta.jms.MessageFormatException createMessageFormatException(Throwable cause)
      Creates or passes through a MessageFormatException to be thrown to the client. In the event that the exception passed to this method is already a MessageFormatException it is passed through unmodified, otherwise a new MessageFormatException is created using the error message taken from the given Throwable value and the cause value is set to the given Throwable instance.
      Parameters:
      cause - The exception that caused this error state.
      Returns:
      a MessageEOFException instance.
    • createResourceAllocationException

      public static jakarta.jms.ResourceAllocationException createResourceAllocationException(Throwable cause)
      Creates or passes through a ResourceAllocationException to be thrown to the client. In the event that the exception passed to this method is already a ResourceAllocationException it is passed through unmodified, otherwise a new ResourceAllocationException is created using the error message taken from the given Throwable value and the cause value is set to the given Throwable instance.
      Parameters:
      cause - The exception that caused this error state.
      Returns:
      a ResourceAllocationException instance.
    • createRuntimeException

      public static jakarta.jms.JMSRuntimeException createRuntimeException(Exception exception)
      Creates the proper instance of a JMSRuntimeException based on the type of JMSException that is passed.
      Parameters:
      exception - The JMSException instance to convert to a JMSRuntimeException
      Returns:
      a new JMSRuntimeException instance that reflects the original error.