Commit 13e4179e authored by Andre Freyssinet's avatar Andre Freyssinet

Javadoc enhancements and fixes.

parent 4afa0101
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 2013 ScalAgent Distributed Technologies
* Copyright (C) 2001 - 2020 ScalAgent Distributed Technologies
* Copyright (C) 1996 - 2000 Dyade
*
* This library is free software; you can redistribute it and/or
......@@ -88,15 +88,14 @@ public final class BytesMessage extends Message implements javax.jms.BytesMessag
*
* @param sess The consuming session.
* @param momMsg The MOM message to wrap.
* @throws IOException if an I/O error has occurred
* @throws JMSException if an error has occurred
*/
BytesMessage(Session sess, org.objectweb.joram.shared.messages.Message momMsg) throws JMSException {
super(sess, momMsg);
try {
inputStream = new DataInputStream(new ByteArrayInputStream(momMsg.getBody()));
} catch (IOException exc) {
MessageFormatException jExc =
new MessageFormatException("The message body could not be uncompressed.");
MessageFormatException jExc = new MessageFormatException("The message body could not be uncompressed.");
jExc.setLinkedException(exc);
throw jExc;
}
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2006 - 2018 ScalAgent Distributed Technologies
* Copyright (C) 2006 - 2020 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -827,17 +827,10 @@ public class Message implements javax.jms.Message {
* @param name The property name.
* @param value The property value.
*
* @exception MessageROException
* If the message properties are read-only.
* @exception MessageFormatException
* If the value is not a Java primitive object.
* @exception IllegalArgumentException
* If the key name is illegal (null or empty string).
*
* @exception MessageFormatException If the property type is invalid.
* @exception IllegalArgumentException If the key name is illegal (null or empty string).
* @exception MessageFormatException If the value is not a Java primitive object.
* @exception MessageNotWriteableException If the message is read-only.
* @exception JMSException If the property name is invalid, or if the
* object is invalid.
* @exception JMSException If the property name is invalid, or if the object is invalid.
*/
public final void setObjectProperty(String name, Object value) throws JMSException {
if (value instanceof Boolean ||
......@@ -1279,8 +1272,7 @@ public class Message implements javax.jms.Message {
* Check if the message body is capable of being assigned to specified type
* @return true if Message is TextMessage or MapMessage, or BytesMessage, or ObjectMessage when
* it's deserializable false otherwise
* @throws JMSExeption if fail to return a value due to some internal error
*
* @throws JMSException if fail to return a value due to some internal error
*/
public boolean isBodyAssignableTo(Class c) throws JMSException {
if (momMsg.body == null) return true;
......@@ -1304,39 +1296,44 @@ public class Message implements javax.jms.Message {
}
/**
* @param c- The type to which the message body will be assigned. <br/>
* Returns the message body as an object of the specified type. This method may be called on
* any type of message except for StreamMessage. The message body must be capable of being
* assigned to the specified type. This means that the specified class or interface must be
* either the same as, or a superclass or superinterface of, the class of the message body.
*
* @param c The type to which the message body will be assigned.
* If the message has no body then any type may be specified and null is returned.
* <br>
* If the message is a <code>TextMessage</code> then this parameter must
* be set to <code>String.class</code> or another type to which
* a <code>String</code> is assignable.
* <br/>
* <br>
* If the message is a <code>ObjectMessage</code> then parameter must
* be set to <code>java.io.Serializable.class</code> or
* another type to which the body is assignable.
* <br/>
* <br>
* If the message is a <code>MapMessage</code> then this parameter must
* be set to <code>java.util.Map.class</code> (or <code>java.lang.Object.class</code>).
* <br/>
* <br>
* If the message is a <code>BytesMessage</code> then this parameter must
* be set to <code>byte[].class</code> (or <code>java.lang.Object.class</code>). This method
* will reset the <code>BytesMessage</code> before and after use.
* <br/>
* <br>
* If the message is a
* <code>TextMessage</code>, <code>ObjectMessage</code>, <code>MapMessage</code>
* or <code>BytesMessage</code> and the message has no body,
* then the above does not apply and this parameter may be set to any type;
* the returned value will always be null.
* <br/>
* <br>
* If the message is a <code>Message</code> (but not one of its subtypes)
* then this parameter may be set to any type;
* the returned value will always be null.</dd>
* <dt><span class="strong">Returns:</span></dt><dd>the message body</dd>
* the returned value will always be null.
*
* @return the message body
* @Throws:
* MessageFormatException -if the message is a StreamMessage
* if the message body cannot be assigned to the specified type
* if the message is an ObjectMessage and object deserialization fails.
* JMSException - if the JMS provider fails to get the message body due to some internal error.
*
* @throws MessageFormatException if the message is a StreamMessage, if the message body cannot be
* assigned to the specified type, or if the message is an ObjectMessage and object deserialization fails.
* @throws JMSException if the JMS provider fails to get the message body due to some internal error.
*/
public <T> T getBody(Class<T> c) throws JMSException {
if (isBodyAssignableTo(c))
......@@ -1357,7 +1354,7 @@ public class Message implements javax.jms.Message {
/**
* Get message body
* @ @param c- The type to which the message body will be assigned.
* @param c The type to which the message body will be assigned.
* @return message body
* @throws JMSException if the JMS provider fails to return a value due to some internal error.
*/
......@@ -1370,7 +1367,7 @@ public class Message implements javax.jms.Message {
* Gets the message delivery time value.
*
* @return the message delivery time value.
* @exception if fail to get the delivery time due to some internal error.
* @exception JMSException if fail to get the delivery time due to some internal error.
*/
public long getJMSDeliveryTime() throws JMSException {
return momMsg.deliveryTime;
......@@ -1381,7 +1378,7 @@ public class Message implements javax.jms.Message {
* Sets the message delivery time value.
*
* @param deliveryTime the message delivery time value
* @exception if fail to set the delivery time due to some internal error.
* @exception JMSException if fail to set the delivery time due to some internal error.
*/
public void setJMSDeliveryTime(long deliveryTime) throws JMSException {
momMsg.deliveryTime = deliveryTime;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment