You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2018/06/06 17:10:42 UTC
[cxf] 06/07: Only read the default threshold system property once
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 2f7fcc9cd52fa063947c249135592918b314836c
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Wed Jun 6 15:54:39 2018 +0100
Only read the default threshold system property once
---
.../main/java/org/apache/cxf/attachment/AttachmentUtil.java | 4 +---
core/src/main/java/org/apache/cxf/io/CachedOutputStream.java | 10 ++++++++++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java b/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
index 448eef8..6e6277c 100644
--- a/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
+++ b/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
@@ -53,10 +53,8 @@ import javax.activation.MailcapCommandMap;
import javax.activation.URLDataSource;
import org.apache.cxf.common.util.StringUtils;
-import org.apache.cxf.common.util.SystemPropertyAction;
import org.apache.cxf.helpers.HttpHeaderHelper;
import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.io.CachedConstants;
import org.apache.cxf.io.CachedOutputStream;
import org.apache.cxf.message.Attachment;
import org.apache.cxf.message.Message;
@@ -179,7 +177,7 @@ public final class AttachmentUtil {
} else {
bos.setThreshold(Long.parseLong((String)threshold));
}
- } else if (SystemPropertyAction.getProperty(CachedConstants.THRESHOLD_SYS_PROP) == null) {
+ } else if (!CachedOutputStream.isThresholdSysPropSet()) {
// Use the default AttachmentDeserializer Threshold only if there is no system property defined
bos.setThreshold(AttachmentDeserializer.THRESHOLD);
}
diff --git a/core/src/main/java/org/apache/cxf/io/CachedOutputStream.java b/core/src/main/java/org/apache/cxf/io/CachedOutputStream.java
index bbdb49e..56cf5bd 100644
--- a/core/src/main/java/org/apache/cxf/io/CachedOutputStream.java
+++ b/core/src/main/java/org/apache/cxf/io/CachedOutputStream.java
@@ -53,6 +53,7 @@ public class CachedOutputStream extends OutputStream {
private static int defaultThreshold;
private static long defaultMaxSize;
private static String defaultCipherTransformation;
+ private static boolean thresholdSysPropSet;
static {
String s = SystemPropertyAction.getPropertyOrNull(CachedConstants.OUTPUT_DIRECTORY_SYS_PROP);
@@ -586,12 +587,21 @@ public class CachedOutputStream extends OutputStream {
i = Integer.parseInt(s);
if (i <= 0) {
i = 128 * 1024;
+ } else {
+ thresholdSysPropSet = true;
}
}
defaultThreshold = i;
}
+ /**
+ * Returns true if the default threshold is explicitly set via CachedConstants.THRESHOLD_SYS_PROP
+ */
+ public static boolean isThresholdSysPropSet() {
+ return thresholdSysPropSet;
+ }
+
public static void setDefaultCipherTransformation(String n) {
if (n == null) {
n = SystemPropertyAction.getPropertyOrNull(CachedConstants.CIPHER_TRANSFORMATION_SYS_PROP);
--
To stop receiving notification emails like this one, please contact
coheigea@apache.org.