You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2006/12/15 14:30:47 UTC

svn commit: r487548 - in /incubator/qpid/trunk/qpid/java: client/src/main/java/org/apache/qpid/client/message/ common/src/main/java/org/apache/qpid/framing/ common/src/test/java/org/apache/qpid/framing/

Author: ritchiem
Date: Fri Dec 15 05:30:44 2006
New Revision: 487548

URL: http://svn.apache.org/viewvc?view=rev&rev=487548
Log:
QPID-182
Fixed the incorrect exception being thrown by JMSPropertyFieldTable.java. 

Modified:
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java
    incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/JMSPropertyFieldTable.java
    incubator/qpid/trunk/qpid/java/common/src/test/java/org/apache/qpid/framing/JMSPropertyFieldTableTest.java

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java?view=diff&rev=487548&r1=487547&r2=487548
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java Fri Dec 15 05:30:44 2006
@@ -54,7 +54,7 @@
         _properties = new JMSPropertyFieldTable();
     }
 
-	JMSMapMessage(long messageNbr, ContentHeaderBody contentHeader, ByteBuffer data)
+    JMSMapMessage(long messageNbr, ContentHeaderBody contentHeader, ByteBuffer data)
             throws AMQException
     {
         super(messageNbr, contentHeader, data);
@@ -129,17 +129,7 @@
 
     public char getChar(String string) throws JMSException
     {
-
-        Character result = _properties.getCharacter(string);
-
-        if (result == null)
-        {
-            throw new NullPointerException("getChar couldn't find " + string + " item.");
-        }
-        else
-        {
-            return result;
-        }
+        return _properties.getCharacter(string);
     }
 
     public int getInt(String string) throws JMSException

Modified: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/JMSPropertyFieldTable.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/JMSPropertyFieldTable.java?view=diff&rev=487548&r1=487547&r2=487548
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/JMSPropertyFieldTable.java (original)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/JMSPropertyFieldTable.java Fri Dec 15 05:30:44 2006
@@ -205,8 +205,6 @@
 
     public byte getByte(String string) throws JMSException
     {
-        try
-        {
             Byte b = _fieldtable.getByte(string);
             if (b == null)
             {
@@ -230,17 +228,10 @@
             }
 
             return b;
-        }
-        catch (NumberFormatException nfe)
-        {
-            throw new MessageFormatException(nfe.getMessage());
-        }
     }
 
     public short getShort(String string) throws JMSException
     {
-        try
-        {
             Short s = _fieldtable.getShort(string);
 
             if (s == null)
@@ -249,17 +240,10 @@
             }
 
             return s;
-        }
-        catch (NumberFormatException nfe)
-        {
-            throw new MessageFormatException(nfe.getMessage());
-        }
     }
 
     public int getInteger(String string) throws JMSException
     {
-        try
-        {
             Integer i = _fieldtable.getInteger(string);
 
             if (i == null)
@@ -268,17 +252,10 @@
             }
 
             return i;
-        }
-        catch (NumberFormatException nfe)
-        {
-            throw new MessageFormatException(nfe.getMessage());
-        }
     }
 
     public long getLong(String string) throws JMSException
     {
-        try
-        {
             Long l = _fieldtable.getLong(string);
 
             if (l == null)
@@ -287,18 +264,10 @@
             }
 
             return l;
-        }
-        catch (NumberFormatException nfe)
-        {
-            throw new MessageFormatException(nfe.getMessage());
-        }
-
     }
 
     public float getFloat(String string) throws JMSException
     {
-        try
-        {
             Float f = _fieldtable.getFloat(string);
 
             if (f == null)
@@ -324,17 +293,10 @@
             }
 
             return f;
-        }
-        catch (NumberFormatException nfe)
-        {
-            throw new MessageFormatException(nfe.getMessage());
-        }
     }
 
     public double getDouble(String string) throws JMSException
     {
-        try
-        {
             Double d = _fieldtable.getDouble(string);
 
             if (d == null)
@@ -342,12 +304,7 @@
                 d = Double.valueOf(getFloat(string));
             }
 
-            return d;
-        }
-        catch (NumberFormatException nfe)
-        {
-            throw new MessageFormatException(nfe.getMessage());
-        }
+            return d;        
     }
 
     public String getString(String string) throws JMSException

Modified: incubator/qpid/trunk/qpid/java/common/src/test/java/org/apache/qpid/framing/JMSPropertyFieldTableTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/test/java/org/apache/qpid/framing/JMSPropertyFieldTableTest.java?view=diff&rev=487548&r1=487547&r2=487548
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/test/java/org/apache/qpid/framing/JMSPropertyFieldTableTest.java (original)
+++ incubator/qpid/trunk/qpid/java/common/src/test/java/org/apache/qpid/framing/JMSPropertyFieldTableTest.java Fri Dec 15 05:30:44 2006
@@ -254,9 +254,9 @@
         try
         {
             table1.getByte("Rubbish");
-            fail("Should throw MessageFormatException");
+            fail("Should throw NumberFormatException");
         }
-        catch (MessageFormatException mfs)
+        catch (NumberFormatException mfs)
         {
             //normal Execution
         }
@@ -334,9 +334,9 @@
         try
         {
             table1.getShort("Rubbish");
-            fail("Should throw MessageFormatException");
+            fail("Should throw NumberFormatException");
         }
-        catch (MessageFormatException mfe)
+        catch (NumberFormatException mfe)
         {
             //normal path
         }
@@ -597,9 +597,9 @@
         try
         {
             table1.getInteger("Rubbish");
-            fail("Should throw MessageFormatException");
+            fail("Should throw NumberFormatException");
         }
-        catch (MessageFormatException mfe)
+        catch (NumberFormatException mfe)
         {
             //normal path
         }
@@ -690,9 +690,9 @@
         try
         {
             table1.getLong("Rubbish");
-            fail("Should throw MessageFormatException");
+            fail("Should throw NumberFormatException");
         }
-        catch (MessageFormatException mfs)
+        catch (NumberFormatException mfs)
         {
             //normal Execution
         }
@@ -731,54 +731,54 @@
         try
         {
             table1.getByte("value");
-            fail("Should throw MessageFormatException");
+            fail("Should throw NumberFormatException");
         }
-        catch (MessageFormatException nfs)
+        catch (NumberFormatException nfs)
         {
             //normal Execution
         }
         try
         {
             table1.getShort("value");
-            fail("Should throw MessageFormatException");
+            fail("Should throw NumberFormatException");
         }
-        catch (MessageFormatException nfs)
+        catch (NumberFormatException nfs)
         {
             //normal Execution
         }
         try
         {
             table1.getDouble("value");
-            fail("Should throw MessageFormatException");
+            fail("Should throw NumberFormatException");
         }
-        catch (MessageFormatException nfs)
+        catch (NumberFormatException nfs)
         {
             //normal Execution
         }
         try
         {
             table1.getFloat("value");
-            fail("Should throw MessageFormatException");
+            fail("Should throw NumberFormatException");
         }
-        catch (MessageFormatException nfs)
+        catch (NumberFormatException nfs)
         {
             //normal Execution
         }
         try
         {
             table1.getInteger("value");
-            fail("Should throw MessageFormatException");
+            fail("Should throw NumberFormatException");
         }
-        catch (MessageFormatException nfs)
+        catch (NumberFormatException nfs)
         {
             //normal Execution
         }
         try
         {
             table1.getLong("value");
-            fail("Should throw MessageFormatException");
+            fail("Should throw NumberFormatException");
         }
-        catch (MessageFormatException nfs)
+        catch (NumberFormatException nfs)
         {
             //normal Execution
         }