http-client-branch: fixed activation of debug traces http-client-branch
authordfuchs
Wed, 08 Nov 2017 14:04:58 +0000
branchhttp-client-branch
changeset 55781 16e7156053f5
parent 55780 d4b5b95da972
child 55783 5cd3c3a62aaf
http-client-branch: fixed activation of debug traces
src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpClientImpl.java
src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/common/Utils.java
--- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpClientImpl.java	Wed Nov 08 14:08:52 2017 +0300
+++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpClientImpl.java	Wed Nov 08 14:04:58 2017 +0000
@@ -79,7 +79,7 @@
 class HttpClientImpl extends HttpClient {
 
     static final boolean DEBUG = Utils.DEBUG;  // Revisit: temporary dev flag.
-    static final boolean DEBUGELAPSED = Utils.ASSERTIONSENABLED || DEBUG;  // Revisit: temporary dev flag.
+    static final boolean DEBUGELAPSED = Utils.TESTING || DEBUG;  // Revisit: temporary dev flag.
     static final boolean DEBUGTIMEOUT = false; // Revisit: temporary dev flag.
     final System.Logger  debug = Utils.getDebugLogger(this::dbgString, DEBUG);
     final System.Logger  debugelapsed = Utils.getDebugLogger(this::dbgString, DEBUGELAPSED);
--- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/common/Utils.java	Wed Nov 08 14:08:52 2017 +0300
+++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/common/Utils.java	Wed Nov 08 14:04:58 2017 +0000
@@ -78,8 +78,15 @@
         assert enabled = true;
         ASSERTIONSENABLED = enabled;
     }
-    public static final boolean DEBUG = true;// Revisit: temporary dev flag.
-            //getBooleanProperty(DebugLogger.HTTP_NAME, false);
+    public static final boolean TESTING;
+    static {
+        if (ASSERTIONSENABLED) {
+            PrivilegedAction<String> action = () -> System.getProperty("test.src");
+            TESTING = AccessController.doPrivileged(action) != null;
+        } else TESTING = false;
+    }
+    public static final boolean DEBUG = // Revisit: temporary dev flag.
+            getBooleanProperty(DebugLogger.HTTP_NAME, false);
     public static final boolean DEBUG_HPACK = // Revisit: temporary dev flag.
             getBooleanProperty(DebugLogger.HPACK_NAME, false);