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:18:34 UTC
qpid-broker-j git commit: QPID-8067: [Broker-J] Improve exception if
x-qpid-replay-period does not contain a parseable long
Repository: qpid-broker-j
Updated Branches:
refs/heads/master f561984e7 -> f877df106
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/f877df10
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/f877df10
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/f877df10
Branch: refs/heads/master
Commit: f877df1065c3dff7f20a30c22322938c054ade92
Parents: f561984
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:18:29 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/f877df10/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