Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 930DA18A49 for ; Mon, 25 Jan 2016 17:09:43 +0000 (UTC) Received: (qmail 99107 invoked by uid 500); 25 Jan 2016 17:09:43 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 99031 invoked by uid 500); 25 Jan 2016 17:09:43 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 99003 invoked by uid 99); 25 Jan 2016 17:09:43 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Jan 2016 17:09:43 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 24129E012C; Mon, 25 Jan 2016 17:09:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: clebertsuconic@apache.org To: commits@activemq.apache.org Date: Mon, 25 Jan 2016 17:09:44 -0000 Message-Id: <3e54f204727b4659963cc81899689c3b@git.apache.org> In-Reply-To: <5987c6dff24942d0a21b9cbf4a85dc15@git.apache.org> References: <5987c6dff24942d0a21b9cbf4a85dc15@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/3] activemq-artemis git commit: Include key name in property conversion exception messages 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ä Authored: Sun Jan 24 12:50:26 2016 +0200 Committer: Clebert Suconic 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) {