You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2017/01/20 11:58:51 UTC

svn commit: r1779612 - in /tomcat/trunk/java/org/apache/tomcat/util/buf: ByteBufferUtils.java LocalStrings.properties

Author: markt
Date: Fri Jan 20 11:58:51 2017
New Revision: 1779612

URL: http://svn.apache.org/viewvc?rev=1779612&view=rev
Log:
Log message that includes command line option required when running on Java 9

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/buf/ByteBufferUtils.java
    tomcat/trunk/java/org/apache/tomcat/util/buf/LocalStrings.properties

Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/ByteBufferUtils.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/ByteBufferUtils.java?rev=1779612&r1=1779611&r2=1779612&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/buf/ByteBufferUtils.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/buf/ByteBufferUtils.java Fri Jan 20 11:58:51 2017
@@ -23,6 +23,7 @@ import java.nio.ByteBuffer;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.ExceptionUtils;
+import org.apache.tomcat.util.compat.JreCompat;
 import org.apache.tomcat.util.res.StringManager;
 
 public class ByteBufferUtils {
@@ -48,9 +49,14 @@ public class ByteBufferUtils {
             }
             cleanMethodLocal.invoke(cleanerObject);
         } catch (Throwable t) {
-            // Use throwable as when running on Java 9 we may see a Java 9
-            // specific exception (InaccessibleObjectException) here.
-            ExceptionUtils.handleThrowable(t);
+            JreCompat jreCompat = JreCompat.getInstance();
+            if (jreCompat.isInstanceOfInaccessibleObjectException(t)) {
+                // Must be running on Java 9 without the necessary command line
+                // options.
+                log.warn(sm.getString("byteBufferUtils.addExportsCleaner"));
+            } else {
+                ExceptionUtils.handleThrowable(t);
+            }
             log.warn(sm.getString("byteBufferUtils.cleaner"), t);
             cleanerMethodLocal = null;
             cleanMethodLocal = null;

Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/LocalStrings.properties?rev=1779612&r1=1779611&r2=1779612&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/buf/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/buf/LocalStrings.properties Fri Jan 20 11:58:51 2017
@@ -23,4 +23,5 @@ uDecoder.urlDecode.missingDigit=The % ch
 uDecoder.convertHexDigit.notHex=[{0}] is not a hexadecimal digit
 uDecoder.urlDecode.uee=Unable to URL decode the specified input since the encoding [{0}] is not supported.
 
-byteBufferUtils.cleaner=Cannot use direct ByteBuffer cleaner, memory leaking may occur
\ No newline at end of file
+byteBufferUtils.addExportsCleaner=When running on Java 9 you need to add "--add-opens=java.base/java.nio=ALL-UNNAMED" to the JVM command line arguments to enable the direct ByteBuffer cleaner
+byteBufferUtils.cleaner=Cannot use direct ByteBuffer cleaner, memory leaking may occur



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org