You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/02/09 08:29:12 UTC
[camel] branch main updated: CAMEL-19014: Disabling simple cache with 0 or negative value should be possible
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 33c0c92d6df CAMEL-19014: Disabling simple cache with 0 or negative value should be possible
33c0c92d6df is described below
commit 33c0c92d6dff2f1a4952cb58958e783fd6517df4
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Feb 9 09:28:23 2023 +0100
CAMEL-19014: Disabling simple cache with 0 or negative value should be possible
---
.../main/java/org/apache/camel/support/CamelContextHelper.java | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/CamelContextHelper.java b/core/camel-support/src/main/java/org/apache/camel/support/CamelContextHelper.java
index 3ea7a2ce2d7..1bc6e784746 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/CamelContextHelper.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/CamelContextHelper.java
@@ -343,6 +343,7 @@ public final class CamelContextHelper {
* <p/>
* Will use the property set on CamelContext with the key {@link Exchange#MAXIMUM_SIMPLE_CACHE_SIZE}. If no property
* has been set, then it will fallback to return a size of 1000.
+ * Use value of 0 or negative to disable the cache.
*
* @param camelContext the camel context
* @return the maximum cache size
@@ -354,12 +355,7 @@ public final class CamelContextHelper {
if (s != null) {
// we cannot use Camel type converters as they may not be ready this early
try {
- Integer size = Integer.valueOf(s);
- if (size == null || size <= 0) {
- throw new IllegalArgumentException(
- "Property " + Exchange.MAXIMUM_SIMPLE_CACHE_SIZE + " must be a positive number, was: " + s);
- }
- return size;
+ return Integer.parseInt(s);
} catch (NumberFormatException e) {
throw new IllegalArgumentException(
"Property " + Exchange.MAXIMUM_SIMPLE_CACHE_SIZE + " must be a positive number, was: " + s, e);