activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [2/3] activemq-artemis git commit: Include key name in property conversion exception messages
Date Mon, 25 Jan 2016 17:09:44 GMT
Include key name in property conversion exception messages


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/3e783a1c
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/3e783a1c
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/3e783a1c

Branch: refs/heads/master
Commit: 3e783a1c2f18394bdd99533b83c823b55c1cc3e6
Parents: ca34f7f
Author: Ville Skyttä <ville.skytta@iki.fi>
Authored: Sun Jan 24 12:50:26 2016 +0200
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Mon Jan 25 11:23:07 2016 -0500

----------------------------------------------------------------------
 .../activemq/artemis/utils/TypedProperties.java | 36 ++++++--------------
 1 file changed, 10 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3e783a1c/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java
b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java
index 5bff66f..166f39e 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java
@@ -161,9 +161,7 @@ public final class TypedProperties {
       else if (value instanceof SimpleString) {
          return Boolean.valueOf(((SimpleString) value).toString());
       }
-      else {
-         throw new ActiveMQPropertyConversionException("Invalid conversion");
-      }
+      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
    }
 
    public Byte getByteProperty(final SimpleString key) throws ActiveMQPropertyConversionException
{
@@ -177,23 +175,19 @@ public final class TypedProperties {
       else if (value instanceof SimpleString) {
          return Byte.parseByte(((SimpleString) value).toString());
       }
-      else {
-         throw new ActiveMQPropertyConversionException("Invalid conversion");
-      }
+      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
    }
 
    public Character getCharProperty(final SimpleString key) throws ActiveMQPropertyConversionException
{
       Object value = doGetProperty(key);
       if (value == null) {
-         throw new NullPointerException("Invalid conversion");
+         throw new NullPointerException("Invalid conversion: " + key);
       }
 
       if (value instanceof Character) {
          return ((Character) value);
       }
-      else {
-         throw new ActiveMQPropertyConversionException("Invalid conversion");
-      }
+      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
    }
 
    public byte[] getBytesProperty(final SimpleString key) throws ActiveMQPropertyConversionException
{
@@ -204,9 +198,7 @@ public final class TypedProperties {
       else if (value instanceof byte[]) {
          return (byte[]) value;
       }
-      else {
-         throw new ActiveMQPropertyConversionException("Invalid conversion");
-      }
+      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
    }
 
    public Double getDoubleProperty(final SimpleString key) throws ActiveMQPropertyConversionException
{
@@ -223,9 +215,7 @@ public final class TypedProperties {
       else if (value instanceof SimpleString) {
          return Double.parseDouble(((SimpleString) value).toString());
       }
-      else {
-         throw new ActiveMQPropertyConversionException("Invalid conversion");
-      }
+      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
    }
 
    public Integer getIntProperty(final SimpleString key) throws ActiveMQPropertyConversionException
{
@@ -245,9 +235,7 @@ public final class TypedProperties {
       else if (value instanceof SimpleString) {
          return Integer.parseInt(((SimpleString) value).toString());
       }
-      else {
-         throw new ActiveMQPropertyConversionException("Invalid conversion");
-      }
+      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
    }
 
    public Long getLongProperty(final SimpleString key) throws ActiveMQPropertyConversionException
{
@@ -270,9 +258,7 @@ public final class TypedProperties {
       else if (value instanceof SimpleString) {
          return Long.parseLong(((SimpleString) value).toString());
       }
-      else {
-         throw new ActiveMQPropertyConversionException("Invalid conversion");
-      }
+      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
    }
 
    public Short getShortProperty(final SimpleString key) throws ActiveMQPropertyConversionException
{
@@ -289,9 +275,7 @@ public final class TypedProperties {
       else if (value instanceof SimpleString) {
          return Short.parseShort(((SimpleString) value).toString());
       }
-      else {
-         throw new ActiveMQPropertyConversionException("Invalid Conversion.");
-      }
+      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
    }
 
    public Float getFloatProperty(final SimpleString key) throws ActiveMQPropertyConversionException
{
@@ -341,7 +325,7 @@ public final class TypedProperties {
       else if (value instanceof Double) {
          return new SimpleString(value.toString());
       }
-      throw new ActiveMQPropertyConversionException("Invalid conversion");
+      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
    }
 
    public Object removeProperty(final SimpleString key) {


Mime
View raw message