summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2006-12-15 13:30:44 +0000
committerMartin Ritchie <ritchiem@apache.org>2006-12-15 13:30:44 +0000
commit7977b456f513ac1da247b1b16423fb23bbf2a3bf (patch)
treec9835636f61f8ebb5e81987df76f7195d9d4ea03 /qpid/java
parent4480d294e75dc7f70a414b8750e40b9d1888bbfc (diff)
downloadqpid-python-7977b456f513ac1da247b1b16423fb23bbf2a3bf.tar.gz
QPID-182
Fixed the incorrect exception being thrown by JMSPropertyFieldTable.java. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@487548 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java14
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/JMSPropertyFieldTable.java45
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/framing/JMSPropertyFieldTableTest.java40
3 files changed, 23 insertions, 76 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java b/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java
index fccce92dee..618d290ffd 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java
@@ -54,7 +54,7 @@ public class JMSMapMessage extends JMSBytesMessage implements javax.jms.MapMessa
_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 class JMSMapMessage extends JMSBytesMessage implements javax.jms.MapMessa
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
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/JMSPropertyFieldTable.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/JMSPropertyFieldTable.java
index cc56e7c4de..d2b64ec3c5 100644
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/JMSPropertyFieldTable.java
+++ b/qpid/java/common/src/main/java/org/apache/qpid/framing/JMSPropertyFieldTable.java
@@ -205,8 +205,6 @@ public class JMSPropertyFieldTable
public byte getByte(String string) throws JMSException
{
- try
- {
Byte b = _fieldtable.getByte(string);
if (b == null)
{
@@ -230,17 +228,10 @@ public class JMSPropertyFieldTable
}
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 @@ public class JMSPropertyFieldTable
}
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 @@ public class JMSPropertyFieldTable
}
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 @@ public class JMSPropertyFieldTable
}
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 @@ public class JMSPropertyFieldTable
}
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 @@ public class JMSPropertyFieldTable
d = Double.valueOf(getFloat(string));
}
- return d;
- }
- catch (NumberFormatException nfe)
- {
- throw new MessageFormatException(nfe.getMessage());
- }
+ return d;
}
public String getString(String string) throws JMSException
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/framing/JMSPropertyFieldTableTest.java b/qpid/java/common/src/test/java/org/apache/qpid/framing/JMSPropertyFieldTableTest.java
index 98202ddd1a..865735499b 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/framing/JMSPropertyFieldTableTest.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/framing/JMSPropertyFieldTableTest.java
@@ -254,9 +254,9 @@ public class JMSPropertyFieldTableTest extends TestCase
try
{
table1.getByte("Rubbish");
- fail("Should throw MessageFormatException");
+ fail("Should throw NumberFormatException");
}
- catch (MessageFormatException mfs)
+ catch (NumberFormatException mfs)
{
//normal Execution
}
@@ -334,9 +334,9 @@ public class JMSPropertyFieldTableTest extends TestCase
try
{
table1.getShort("Rubbish");
- fail("Should throw MessageFormatException");
+ fail("Should throw NumberFormatException");
}
- catch (MessageFormatException mfe)
+ catch (NumberFormatException mfe)
{
//normal path
}
@@ -597,9 +597,9 @@ public class JMSPropertyFieldTableTest extends TestCase
try
{
table1.getInteger("Rubbish");
- fail("Should throw MessageFormatException");
+ fail("Should throw NumberFormatException");
}
- catch (MessageFormatException mfe)
+ catch (NumberFormatException mfe)
{
//normal path
}
@@ -690,9 +690,9 @@ public class JMSPropertyFieldTableTest extends TestCase
try
{
table1.getLong("Rubbish");
- fail("Should throw MessageFormatException");
+ fail("Should throw NumberFormatException");
}
- catch (MessageFormatException mfs)
+ catch (NumberFormatException mfs)
{
//normal Execution
}
@@ -731,54 +731,54 @@ public class JMSPropertyFieldTableTest extends TestCase
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
}