Author: robbie
Date: Tue May  6 12:25:37 2014
New Revision: 1592733

URL: http://svn.apache.org/r1592733
Log:
QPIDJMS-18: update other exception handling to match previous commit

Added:
    
qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/QpidJmsMessageEofException.java
      - copied, changed from r1592732, 
qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/QpidJmsException.java
Modified:
    qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/BytesMessageImpl.java
    qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MessageImpl.java
    qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/QpidJmsException.java

Modified: 
qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/BytesMessageImpl.java
URL: 
http://svn.apache.org/viewvc/qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/BytesMessageImpl.java?rev=1592733&r1=1592732&r2=1592733&view=diff
==============================================================================
--- qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/BytesMessageImpl.java 
(original)
+++ qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/BytesMessageImpl.java 
Tue May  6 12:25:37 2014
@@ -25,8 +25,6 @@ import java.io.IOException;
 import javax.jms.BytesMessage;
 import javax.jms.Destination;
 import javax.jms.JMSException;
-import javax.jms.MessageEOFException;
-import javax.jms.MessageFormatException;
 import javax.jms.MessageNotReadableException;
 
 import org.apache.qpid.jms.engine.AmqpBytesMessage;
@@ -81,18 +79,14 @@ public class BytesMessageImpl extends Me
 
     private JMSException createInputException(final IOException e)
     {
-        JMSException ex;
         if(e instanceof EOFException)
         {
-            ex = new MessageEOFException(e.getMessage());
+            return new QpidJmsMessageEofException(e.getMessage(), e);
         }
         else
         {
-            ex = new MessageFormatException(e.getMessage());
+            return new QpidJmsMessageFormatException(e.getMessage(), e);
         }
-        ex.initCause(e);
-        ex.setLinkedException(e);
-        return ex;
     }
 
     private JMSException createOutputException(final IOException e)
@@ -532,7 +526,7 @@ public class BytesMessageImpl extends Me
         }
         else
         {
-            throw new MessageFormatException("Value passed to 
BytesMessage.writeObject() must be of primitive type.  Type passed was " + 
value.getClass().getName());
+            throw new QpidJmsMessageFormatException("Value passed to 
BytesMessage.writeObject() must be of primitive type.  Type passed was " + 
value.getClass().getName());
         }
     }
 

Modified: qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MessageImpl.java
URL: 
http://svn.apache.org/viewvc/qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MessageImpl.java?rev=1592733&r1=1592732&r2=1592733&view=diff
==============================================================================
--- qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MessageImpl.java 
(original)
+++ qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MessageImpl.java Tue 
May  6 12:25:37 2014
@@ -212,7 +212,7 @@ public abstract class MessageImpl<T exte
                         object instanceof Double || object instanceof String|| 
object == null;
         if(!valid)
         {
-            throw createMessageFormatException("Invalid object property value 
type: " + object.getClass());
+            throw new QpidJmsMessageFormatException("Invalid object property 
value type: " + object.getClass());
         }
 
         return true;
@@ -265,7 +265,7 @@ public abstract class MessageImpl<T exte
             }
             else
             {
-                throw createMessageFormatException(JMSXGROUPID + " must be a 
String");
+                throw new QpidJmsMessageFormatException(JMSXGROUPID + " must 
be a String");
             }
         }
 
@@ -283,7 +283,7 @@ public abstract class MessageImpl<T exte
             }
             else
             {
-                throw createMessageFormatException(JMSXGROUPID + " must be an 
Integer");
+                throw new QpidJmsMessageFormatException(JMSXGROUPID + " must 
be an Integer");
             }
         }
 
@@ -303,12 +303,12 @@ public abstract class MessageImpl<T exte
                 }
                 catch (UnsupportedEncodingException e)
                 {
-                    throw createMessageFormatException("Unable to encode user 
id", e);
+                    throw new QpidJmsMessageFormatException("Unable to encode 
user id", e);
                 }
             }
             else
             {
-                throw createMessageFormatException(JMSXUSERID + " must be a 
String");
+                throw new QpidJmsMessageFormatException(JMSXUSERID + " must be 
a String");
             }
         }
 
@@ -329,7 +329,7 @@ public abstract class MessageImpl<T exte
         }
         else
         {
-            throw createMessageFormatException(JMS_AMQP_TTL + " must be a long 
with value in range 0 to 2^31 - 1");
+            throw new QpidJmsMessageFormatException(JMS_AMQP_TTL + " must be a 
long with value in range 0 to 2^31 - 1");
         }
     }
 
@@ -344,7 +344,7 @@ public abstract class MessageImpl<T exte
             }
             else
             {
-                throw createMessageFormatException(JMS_AMQP_REPLY_TO_GROUP_ID 
+ " must be a String");
+                throw new 
QpidJmsMessageFormatException(JMS_AMQP_REPLY_TO_GROUP_ID + " must be a String");
             }
         }
 
@@ -395,7 +395,7 @@ public abstract class MessageImpl<T exte
             }
             catch (UnsupportedEncodingException e)
             {
-                throw createMessageFormatException("Unable to decode user id", 
e);
+                throw new QpidJmsMessageFormatException("Unable to decode user 
id", e);
             }
         }
     }
@@ -415,23 +415,6 @@ public abstract class MessageImpl<T exte
         }
     }
 
-    private MessageFormatException createMessageFormatException(String message)
-    {
-        return createMessageFormatException(message, null);
-    }
-
-    private MessageFormatException createMessageFormatException(String 
message, Exception cause)
-    {
-        MessageFormatException mfe = new MessageFormatException(message);
-        if(cause != null)
-        {
-            mfe.setLinkedException(cause);
-            mfe.initCause(cause);
-        }
-
-        return mfe;
-    }
-
     private boolean propertyExistsJMSXUserID()
     {
         return _amqpMessage.getUserId() != null;
@@ -845,7 +828,7 @@ public abstract class MessageImpl<T exte
         {
             String message = "Property " + name + " of type " + 
value.getClass().getName() + " cannot be converted to boolean.";
 
-            throw createMessageFormatException(message);
+            throw new QpidJmsMessageFormatException(message);
         }
     }
 
@@ -866,7 +849,7 @@ public abstract class MessageImpl<T exte
         {
             String message = "Property " + name + " of type " + 
value.getClass().getName() + " cannot be converted to byte.";
 
-            throw createMessageFormatException(message);
+            throw new QpidJmsMessageFormatException(message);
         }
     }
 
@@ -891,7 +874,7 @@ public abstract class MessageImpl<T exte
         {
             String message = "Property " + name + " of type " + 
value.getClass().getName() + " cannot be converted to short.";
 
-            throw createMessageFormatException(message);
+            throw new QpidJmsMessageFormatException(message);
         }
     }
 
@@ -920,7 +903,7 @@ public abstract class MessageImpl<T exte
         {
             String message = "Property " + name + " of type " + 
value.getClass().getName() + " cannot be converted to int.";
 
-            throw createMessageFormatException(message);
+            throw new QpidJmsMessageFormatException(message);
         }
     }
 
@@ -953,7 +936,7 @@ public abstract class MessageImpl<T exte
         {
             String message = "Property " + name + " of type " + 
value.getClass().getName() + " cannot be converted to long.";
 
-            throw createMessageFormatException(message);
+            throw new QpidJmsMessageFormatException(message);
         }
     }
 
@@ -974,7 +957,7 @@ public abstract class MessageImpl<T exte
         {
             String message = "Property " + name + " of type " + 
value.getClass().getName() + " cannot be converted to float.";
 
-            throw createMessageFormatException(message);
+            throw new QpidJmsMessageFormatException(message);
         }
     }
 
@@ -999,7 +982,7 @@ public abstract class MessageImpl<T exte
         {
             String message = "Property " + name + " of type " + 
value.getClass().getName() + " cannot be converted to double.";
 
-            throw createMessageFormatException(message);
+            throw new QpidJmsMessageFormatException(message);
         }
     }
 

Modified: 
qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/QpidJmsException.java
URL: 
http://svn.apache.org/viewvc/qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/QpidJmsException.java?rev=1592733&r1=1592732&r2=1592733&view=diff
==============================================================================
--- qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/QpidJmsException.java 
(original)
+++ qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/QpidJmsException.java 
Tue May  6 12:25:37 2014
@@ -28,7 +28,7 @@ public class QpidJmsException extends JM
 
     public QpidJmsException(String reason)
     {
-        super(reason);
+        this(reason, null);
     }
 
     public QpidJmsException(String reason, Exception cause)

Copied: 
qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/QpidJmsMessageEofException.java
 (from r1592732, 
qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/QpidJmsException.java)
URL: 
http://svn.apache.org/viewvc/qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/QpidJmsMessageEofException.java?p2=qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/QpidJmsMessageEofException.java&p1=qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/QpidJmsException.java&r1=1592732&r2=1592733&rev=1592733&view=diff
==============================================================================
--- qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/QpidJmsException.java 
(original)
+++ 
qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/QpidJmsMessageEofException.java
 Tue May  6 12:25:37 2014
@@ -20,18 +20,13 @@
  */
 package org.apache.qpid.jms.impl;
 
-import javax.jms.JMSException;
+import javax.jms.MessageEOFException;
 
-public class QpidJmsException extends JMSException
+public class QpidJmsMessageEofException extends MessageEOFException
 {
-    private static final long serialVersionUID = 751932967255393054L;
+    private static final long serialVersionUID = -4738672252802239185L;
 
-    public QpidJmsException(String reason)
-    {
-        super(reason);
-    }
-
-    public QpidJmsException(String reason, Exception cause)
+    public QpidJmsMessageEofException(String reason, Exception cause)
     {
         super(reason);
         if (cause != null)



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to