< prev index next >

src/java.base/windows/classes/java/lang/ProcessEnvironment.java

Print this page




 249               (eql = envblock.indexOf('='     , beg+1)) != -1);
 250              beg = end + 1) {
 251             // Ignore corrupted environment strings.
 252             if (eql < end)
 253                 theEnvironment.put(envblock.substring(beg, eql),
 254                                    envblock.substring(eql+1,end));
 255         }
 256 
 257         theCaseInsensitiveEnvironment = new TreeMap<>(nameComparator);
 258         theCaseInsensitiveEnvironment.putAll(theEnvironment);
 259     }
 260 
 261     private ProcessEnvironment() {
 262         super();
 263     }
 264 
 265     private ProcessEnvironment(int capacity) {
 266         super(capacity);
 267     }
 268 




 269     // Only for use by System.getenv(String)
 270     static String getenv(String name) {
 271         // The original implementation used a native call to _wgetenv,
 272         // but it turns out that _wgetenv is only consistent with
 273         // GetEnvironmentStringsW (for non-ASCII) if `wmain' is used
 274         // instead of `main', even in a process created using
 275         // CREATE_UNICODE_ENVIRONMENT.  Instead we perform the
 276         // case-insensitive comparison ourselves.  At least this
 277         // guarantees that System.getenv().get(String) will be
 278         // consistent with System.getenv(String).
 279         return theCaseInsensitiveEnvironment.get(name);
 280     }
 281 
 282     // Only for use by System.getenv()
 283     static Map<String,String> getenv() {
 284         return theUnmodifiableEnvironment;
 285     }
 286 
 287     // Only for use by ProcessBuilder.environment()
 288     @SuppressWarnings("unchecked")




 249               (eql = envblock.indexOf('='     , beg+1)) != -1);
 250              beg = end + 1) {
 251             // Ignore corrupted environment strings.
 252             if (eql < end)
 253                 theEnvironment.put(envblock.substring(beg, eql),
 254                                    envblock.substring(eql+1,end));
 255         }
 256 
 257         theCaseInsensitiveEnvironment = new TreeMap<>(nameComparator);
 258         theCaseInsensitiveEnvironment.putAll(theEnvironment);
 259     }
 260 
 261     private ProcessEnvironment() {
 262         super();
 263     }
 264 
 265     private ProcessEnvironment(int capacity) {
 266         super(capacity);
 267     }
 268 
 269     static void refreshEnv() {
 270         // TODO
 271     }
 272 
 273     // Only for use by System.getenv(String)
 274     static String getenv(String name) {
 275         // The original implementation used a native call to _wgetenv,
 276         // but it turns out that _wgetenv is only consistent with
 277         // GetEnvironmentStringsW (for non-ASCII) if `wmain' is used
 278         // instead of `main', even in a process created using
 279         // CREATE_UNICODE_ENVIRONMENT.  Instead we perform the
 280         // case-insensitive comparison ourselves.  At least this
 281         // guarantees that System.getenv().get(String) will be
 282         // consistent with System.getenv(String).
 283         return theCaseInsensitiveEnvironment.get(name);
 284     }
 285 
 286     // Only for use by System.getenv()
 287     static Map<String,String> getenv() {
 288         return theUnmodifiableEnvironment;
 289     }
 290 
 291     // Only for use by ProcessBuilder.environment()
 292     @SuppressWarnings("unchecked")


< prev index next >