You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2018/02/01 17:35:51 UTC
[2/2] qpid-broker-j git commit: QPID-8067: [Broker-J] Improve
exception if x-qpid-replay-period does not contain a parseable long
QPID-8067: [Broker-J] Improve exception if x-qpid-replay-period does not contain a parseable long
Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/0d6b0897
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/0d6b0897
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/0d6b0897
Branch: refs/heads/7.0.x
Commit: 0d6b0897d8691f16434dce171977ea69c86ffaac
Parents: e5dce3c
Author: Keith Wall <kw...@apache.org>
Authored: Thu Feb 1 17:18:11 2018 +0000
Committer: Keith Wall <kw...@apache.org>
Committed: Thu Feb 1 17:35:25 2018 +0000
----------------------------------------------------------------------
.../server/filter/ArrivalTimeFilterFactory.java | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0d6b0897/broker-core/src/main/java/org/apache/qpid/server/filter/ArrivalTimeFilterFactory.java
----------------------------------------------------------------------
diff --git a/broker-core/src/main/java/org/apache/qpid/server/filter/ArrivalTimeFilterFactory.java b/broker-core/src/main/java/org/apache/qpid/server/filter/ArrivalTimeFilterFactory.java
index fc965db..28031d3 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/filter/ArrivalTimeFilterFactory.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/filter/ArrivalTimeFilterFactory.java
@@ -34,10 +34,20 @@ public final class ArrivalTimeFilterFactory implements MessageFilterFactory
{
if(arguments == null || arguments.size() != 1)
{
- throw new IllegalArgumentException("Cannot create a filter from these arguments: " + arguments);
+ throw new IllegalArgumentException(String.format("Cannot create a %s filter from these arguments: %s",
+ getType(), arguments));
+ }
+ final String periodArgument = arguments.get(0);
+ try
+ {
+ long periodInSeconds = Long.parseLong(periodArgument);
+ return new ArrivalTimeFilter(System.currentTimeMillis() - (periodInSeconds * 1000L), periodInSeconds == 0L);
+ }
+ catch (NumberFormatException e)
+ {
+ throw new IllegalArgumentException(String.format("Cannot create a %s filter. Period value '%s' does not contain a parsable long value",
+ getType(), periodArgument), e);
}
- long periodInSeconds = Long.parseLong(arguments.get(0));
- return new ArrivalTimeFilter(System.currentTimeMillis() - periodInSeconds * 1000L, periodInSeconds == 0L);
}
@Override
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org