jdk/src/java.base/share/classes/sun/nio/ch/Util.java
changeset 46094 0c23b05caf7d
parent 37781 71ed5645f17c
equal deleted inserted replaced
46093:5d86e010d558 46094:0c23b05caf7d
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 package sun.nio.ch;
    26 package sun.nio.ch;
    27 
    27 
    28 import java.lang.reflect.*;
       
    29 import java.io.FileDescriptor;
    28 import java.io.FileDescriptor;
       
    29 import java.lang.reflect.Constructor;
       
    30 import java.lang.reflect.InvocationTargetException;
    30 import java.nio.ByteBuffer;
    31 import java.nio.ByteBuffer;
    31 import java.nio.MappedByteBuffer;
    32 import java.nio.MappedByteBuffer;
    32 import java.security.AccessController;
    33 import java.security.AccessController;
    33 import java.security.PrivilegedAction;
    34 import java.security.PrivilegedAction;
    34 import java.util.*;
    35 import java.util.Collection;
       
    36 import java.util.Iterator;
       
    37 import java.util.Set;
    35 import jdk.internal.misc.Unsafe;
    38 import jdk.internal.misc.Unsafe;
    36 import sun.security.action.GetPropertyAction;
    39 import sun.security.action.GetPropertyAction;
    37 
    40 
    38 
    41 
    39 public class Util {
    42 public class Util {
   454                  InvocationTargetException e) {
   457                  InvocationTargetException e) {
   455             throw new InternalError(e);
   458             throw new InternalError(e);
   456         }
   459         }
   457         return dbb;
   460         return dbb;
   458     }
   461     }
   459 
       
   460 
       
   461     // -- Bug compatibility --
       
   462 
       
   463     private static volatile String bugLevel;
       
   464 
       
   465     static boolean atBugLevel(String bl) {              // package-private
       
   466         if (bugLevel == null) {
       
   467             if (!jdk.internal.misc.VM.isBooted())
       
   468                 return false;
       
   469             String value = GetPropertyAction
       
   470                     .privilegedGetProperty("sun.nio.ch.bugLevel");
       
   471             bugLevel = (value != null) ? value : "";
       
   472         }
       
   473         return bugLevel.equals(bl);
       
   474     }
       
   475 
       
   476 }
   462 }