< prev index next >

src/java.base/share/classes/jdk/internal/loader/URLClassPath.java

Print this page
rev 52881 : 8214971: Replace use of string.equals("") with isEmpty()
Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad


  80 /**
  81  * This class is used to maintain a search path of URLs for loading classes
  82  * and resources from both JAR files and directories.
  83  *
  84  * @author  David Connelly
  85  */
  86 public class URLClassPath {
  87     private static final String USER_AGENT_JAVA_VERSION = "UA-Java-Version";
  88     private static final String JAVA_VERSION;
  89     private static final boolean DEBUG;
  90     private static final boolean DISABLE_JAR_CHECKING;
  91     private static final boolean DISABLE_ACC_CHECKING;
  92     private static final boolean DISABLE_CP_URL_CHECK;
  93     private static final boolean DEBUG_CP_URL_CHECK;
  94 
  95     static {
  96         Properties props = GetPropertyAction.privilegedGetProperties();
  97         JAVA_VERSION = props.getProperty("java.version");
  98         DEBUG = (props.getProperty("sun.misc.URLClassPath.debug") != null);
  99         String p = props.getProperty("sun.misc.URLClassPath.disableJarChecking");
 100         DISABLE_JAR_CHECKING = p != null ? p.equals("true") || p.equals("") : false;
 101 
 102         p = props.getProperty("jdk.net.URLClassPath.disableRestrictedPermissions");
 103         DISABLE_ACC_CHECKING = p != null ? p.equals("true") || p.equals("") : false;
 104 
 105         // This property will be removed in a later release
 106         p = props.getProperty("jdk.net.URLClassPath.disableClassPathURLCheck", "true");
 107 
 108         DISABLE_CP_URL_CHECK = p != null ? p.equals("true") || p.isEmpty() : false;
 109         DEBUG_CP_URL_CHECK = "debug".equals(p);
 110     }
 111 
 112     /* The original search path of URLs. */
 113     private final ArrayList<URL> path;
 114 
 115     /* The deque of unopened URLs */
 116     private final ArrayDeque<URL> unopenedUrls;
 117 
 118     /* The resulting search path of Loaders */
 119     private final ArrayList<Loader> loaders = new ArrayList<>();
 120 
 121     /* Map of each URL opened to its corresponding Loader */
 122     private final HashMap<String, Loader> lmap = new HashMap<>();
 123 




  80 /**
  81  * This class is used to maintain a search path of URLs for loading classes
  82  * and resources from both JAR files and directories.
  83  *
  84  * @author  David Connelly
  85  */
  86 public class URLClassPath {
  87     private static final String USER_AGENT_JAVA_VERSION = "UA-Java-Version";
  88     private static final String JAVA_VERSION;
  89     private static final boolean DEBUG;
  90     private static final boolean DISABLE_JAR_CHECKING;
  91     private static final boolean DISABLE_ACC_CHECKING;
  92     private static final boolean DISABLE_CP_URL_CHECK;
  93     private static final boolean DEBUG_CP_URL_CHECK;
  94 
  95     static {
  96         Properties props = GetPropertyAction.privilegedGetProperties();
  97         JAVA_VERSION = props.getProperty("java.version");
  98         DEBUG = (props.getProperty("sun.misc.URLClassPath.debug") != null);
  99         String p = props.getProperty("sun.misc.URLClassPath.disableJarChecking");
 100         DISABLE_JAR_CHECKING = p != null ? p.equals("true") || p.isEmpty() : false;
 101 
 102         p = props.getProperty("jdk.net.URLClassPath.disableRestrictedPermissions");
 103         DISABLE_ACC_CHECKING = p != null ? p.equals("true") || p.isEmpty() : false;
 104 
 105         // This property will be removed in a later release
 106         p = props.getProperty("jdk.net.URLClassPath.disableClassPathURLCheck", "true");
 107 
 108         DISABLE_CP_URL_CHECK = p != null ? p.equals("true") || p.isEmpty() : false;
 109         DEBUG_CP_URL_CHECK = "debug".equals(p);
 110     }
 111 
 112     /* The original search path of URLs. */
 113     private final ArrayList<URL> path;
 114 
 115     /* The deque of unopened URLs */
 116     private final ArrayDeque<URL> unopenedUrls;
 117 
 118     /* The resulting search path of Loaders */
 119     private final ArrayList<Loader> loaders = new ArrayList<>();
 120 
 121     /* Map of each URL opened to its corresponding Loader */
 122     private final HashMap<String, Loader> lmap = new HashMap<>();
 123 


< prev index next >