Package org.springframework.messaging.converter

Examples of org.springframework.messaging.converter.MessageConversionException


    }
    try {
      return (Message<?>) getJmsMessageConverter().fromMessage(message);
    }
    catch (Exception ex) {
      throw new MessageConversionException("Could not convert '" + message + "'", ex);
    }
  }
View Full Code Here


    if (ex instanceof org.springframework.jms.support.destination.DestinationResolutionException ||
        ex instanceof InvalidDestinationException) {
      return new DestinationResolutionException(ex.getMessage(), ex);
    }
    if (ex instanceof org.springframework.jms.support.converter.MessageConversionException) {
      return new MessageConversionException(ex.getMessage(), ex);
    }
    // Fallback
    return new MessagingException(ex.getMessage(), ex);
  }
View Full Code Here

    public javax.jms.Message createMessage(Session session) throws JMSException {
      try {
        return this.messageConverter.toMessage(this.message, session);
      }
      catch (Exception ex) {
        throw new MessageConversionException("Could not convert '" + this.message + "'", ex);
      }
    }
View Full Code Here

  @SuppressWarnings("unchecked")
  protected <T> T doConvert(Message<?> message, Class<T> targetClass) {
    MessageConverter messageConverter = getMessageConverter();
    T value = (T) messageConverter.fromMessage(message, targetClass);
    if (value == null) {
      throw new MessageConversionException(message, "Unable to convert payload [" + message.getPayload() +
          "] to type [" + targetClass + "] using converter [" + messageConverter + "]");
    }
    return value;
  }
View Full Code Here

    Message<?> message = getMessageConverter().toMessage(payload, messageHeaders);
    if (message == null) {
      String payloadType = (payload != null ? payload.getClass().getName() : null);
      Object contentType = (messageHeaders != null ? messageHeaders.get(MessageHeaders.CONTENT_TYPE) : null);
      throw new MessageConversionException("Unable to convert payload with type='" + payloadType +
          "', contentType='" + contentType + "', converter=[" + getMessageConverter() + "]");
    }
    if (postProcessor != null) {
      message = postProcessor.postProcessMessage(message);
    }
View Full Code Here

      return payload;
    }
    else {
      payload = this.converter.fromMessage(message, targetClass);
      if (payload == null) {
        throw new MessageConversionException(message,
            "No converter found to convert to " + targetClass + ", message=" + message, null);
      }
      validate(message, param, payload);
      return payload;
    }
View Full Code Here

  private org.springframework.amqp.core.Message createMessage(Message<?> message) {
    try {
      return getAmqpMessageConverter().toMessage(message, new MessageProperties());
    }
    catch (org.springframework.amqp.support.converter.MessageConversionException ex) {
      throw new MessageConversionException("Could not convert '" + message + "'", ex);
    }
  }
View Full Code Here

    }
    try {
      return (Message<?>) getAmqpMessageConverter().fromMessage(message);
    }
    catch (Exception ex) {
      throw new MessageConversionException("Could not convert '" + message + "'", ex);
    }
  }
View Full Code Here

  protected MessagingException convertAmqpException(RuntimeException ex) {
    if (ex instanceof MessagingException) {
      return (MessagingException) ex;
    }
    if (ex instanceof org.springframework.amqp.support.converter.MessageConversionException) {
      return new MessageConversionException(ex.getMessage(), ex);
    }
    // Fallback
    return new MessagingException(ex.getMessage(), ex);
  }
View Full Code Here

TOP

Related Classes of org.springframework.messaging.converter.MessageConversionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.