You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2015/09/16 17:46:30 UTC

svn commit: r1703429 - /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ExceptionHelper.java

Author: fmui
Date: Wed Sep 16 15:46:29 2015
New Revision: 1703429

URL: http://svn.apache.org/r1703429
Log:
CMIS-950: disable stack traces in CMIS exceptions by default

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ExceptionHelper.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ExceptionHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ExceptionHelper.java?rev=1703429&r1=1703428&r2=1703429&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ExceptionHelper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ExceptionHelper.java Wed Sep 16 15:46:29 2015
@@ -28,12 +28,27 @@ import org.w3c.dom.Node;
 
 public final class ExceptionHelper {
 
-    public static final String STACK_TRACE_PROPERTY = "org.apache.chemistry.opencmis.stacktrace.disable";
+    /**
+     * System property to enable stack traces in CMIS exceptions.
+     */
+    public static final String ENABLE_STACK_TRACE_PROPERTY = "org.apache.chemistry.opencmis.stacktrace.enable";
+
+    /**
+     * System property to disable stack traces in CMIS exceptions. It's only
+     * here for legacy reasons and should not be used.
+     * 
+     * If this system property is set it takes precedence over
+     * {@link ExceptionHelper#ENABLE_STACK_TRACE_PROPERTY} for backwards
+     * compatibility.
+     */
+    @Deprecated
+    public static final String DISABLE_STACK_TRACE_PROPERTY = "org.apache.chemistry.opencmis.stacktrace.disable";
 
     private static final boolean SEND_STACK_TRACE;
 
     static {
-        SEND_STACK_TRACE = System.getProperty(STACK_TRACE_PROPERTY) == null;
+        SEND_STACK_TRACE = Boolean.parseBoolean(System.getProperty(ENABLE_STACK_TRACE_PROPERTY, "false"))
+                && System.getProperty(DISABLE_STACK_TRACE_PROPERTY) == null;
     }
 
     private ExceptionHelper() {
@@ -47,7 +62,7 @@ public final class ExceptionHelper {
             return null;
         }
 
-        StringWriter sw = new StringWriter();
+        StringWriter sw = new StringWriter(512);
         PrintWriter pw = new PrintWriter(sw);
 
         t.printStackTrace(pw);