cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1347020 - in /cxf/branches/2.4.x-fixes: ./ api/src/main/java/org/apache/cxf/io/CachedOutputStream.java
Date Wed, 06 Jun 2012 18:13:52 GMT
Author: dkulp
Date: Wed Jun  6 18:13:51 2012
New Revision: 1347020

URL: http://svn.apache.org/viewvc?rev=1347020&view=rev
Log:
Merged revisions 1347004 via  svn merge from
https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes

........
  r1347004 | dkulp | 2012-06-06 13:56:50 -0400 (Wed, 06 Jun 2012) | 9 lines
  
  Merged revisions 1345413 via  git cherry-pick from
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1345413 | dkulp | 2012-06-01 21:54:01 -0400 (Fri, 01 Jun 2012) | 2 lines
  
    Allow configuring the statics to make it easier for testing
  
  ........
........

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java?rev=1347020&r1=1347019&r2=1347020&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java (original)
+++ cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java Wed
Jun  6 18:13:51 2012
@@ -41,18 +41,11 @@ import org.apache.cxf.helpers.LoadingByt
 
 public class CachedOutputStream extends OutputStream {
     private static final File DEFAULT_TEMP_DIR;
-    private static final int DEFAULT_THRESHOLD;
-    private static final long DEFAULT_MAX_SIZE;
+    private static int defaultThreshold;
+    private static long defaultMaxSize;
     static {
-        String s = System.getProperty("org.apache.cxf.io.CachedOutputStream.Threshold",
-                                      "-1");
-        int i = Integer.parseInt(s);
-        if (i <= 0) {
-            i = 64 * 1024;
-        }
-        DEFAULT_THRESHOLD = i;
         
-        s = System.getProperty("org.apache.cxf.io.CachedOutputStream.OutputDirectory");
+        String s = System.getProperty("org.apache.cxf.io.CachedOutputStream.OutputDirectory");
         if (s != null) {
             File f = new File(s);
             if (f.exists() && f.isDirectory()) {
@@ -64,16 +57,15 @@ public class CachedOutputStream extends 
             DEFAULT_TEMP_DIR = null;
         }
 
-        s = System.getProperty("org.apache.cxf.io.CachedOutputStream.MaxSize",
-                               "-1");
-        DEFAULT_MAX_SIZE = Long.parseLong(s);
+        setDefaultThreshold(-1);
+        setDefaultMaxSize(-1);
     }
 
     protected boolean outputLocked;
     protected OutputStream currentStream;
 
-    private long threshold = DEFAULT_THRESHOLD;
-    private long maxSize = DEFAULT_MAX_SIZE;
+    private long threshold = defaultThreshold;
+    private long maxSize = defaultMaxSize;
 
     private int totalLength;
 
@@ -518,4 +510,23 @@ public class CachedOutputStream extends 
     public void setMaxSize(long maxSize) {
         this.maxSize = maxSize;
     }
+    
+    public static void setDefaultMaxSize(long l) {
+        if (l == -1) {
+            String s = System.getProperty("org.apache.cxf.io.CachedOutputStream.MaxSize",
"-1");
+            l = Long.parseLong(s);
+        }
+        defaultMaxSize = l;
+    }
+    public static void setDefaultThreshold(int i) {
+        if (i == -1) {
+            String s = System.getProperty("org.apache.cxf.io.CachedOutputStream.Threshold",
"-1");
+            i = Integer.parseInt(s);
+            if (i <= 0) {
+                i = 64 * 1024;
+            }
+        }
+        defaultThreshold = i;
+        
+    }
 }



Mime
View raw message