2017-01-18 19:46 GMT+01:00 <ma...@apache.org>:

> Author: markt
> Date: Wed Jan 18 18:46:27 2017
> New Revision: 1779370
>
> URL: http://svn.apache.org/viewvc?rev=1779370&view=rev
> Log:
> Java 9 can throw a Java 9 specific exception here
> (InaccessibleObjectException) so tweak the handling
>

This isn't supposed to happen following r1762753. If this no longer works,
it is necessary to find a new hack that fixes it or scream at Oracle, since
otherwise direct buffers cannot be used at all (they will leak memory
really fast).

Rémy


>
> Modified:
>     tomcat/trunk/java/org/apache/tomcat/util/buf/ByteBufferUtils.java
>
> 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=1779370&r1=1779369&r2=1779370&
> view=diff
> ============================================================
> ==================
> --- tomcat/trunk/java/org/apache/tomcat/util/buf/ByteBufferUtils.java
> (original)
> +++ tomcat/trunk/java/org/apache/tomcat/util/buf/ByteBufferUtils.java Wed
> Jan 18 18:46:27 2017
> @@ -22,6 +22,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.res.StringManager;
>
>  public class ByteBufferUtils {
> @@ -46,9 +47,11 @@ public class ByteBufferUtils {
>                  cleanMethodLocal = cleanerObject.getClass().
> getMethod("clean");
>              }
>              cleanMethodLocal.invoke(cleanerObject);
> -        } catch (IllegalAccessException | IllegalArgumentException
> -                | InvocationTargetException | NoSuchMethodException |
> SecurityException e) {
> -            log.warn(sm.getString("byteBufferUtils.cleaner"), e);
> +        } catch (Throwable t) {
> +            // Use throwable as when running on Java 9 we may see a Java 9
> +            // specific exception (InaccessibleObjectException) here.
> +            ExceptionUtils.handleThrowable(t);
> +            log.warn(sm.getString("byteBufferUtils.cleaner"), t);
>              cleanerMethodLocal = null;
>              cleanMethodLocal = null;
>          }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>

Reply via email to