harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r431565 - /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/Environment.java
Date Tue, 15 Aug 2006 09:31:31 GMT
Author: pyang
Date: Tue Aug 15 02:31:31 2006
New Revision: 431565

URL: http://svn.apache.org/viewvc?rev=431565&view=rev
Log:
One more modification to the error handling, it should throw error when native codes return
null, which means failed to get the env variables.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/Environment.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/Environment.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/Environment.java?rev=431565&r1=431564&r2=431565&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/Environment.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/Environment.java
Tue Aug 15 02:31:31 2006
@@ -27,22 +27,23 @@
 
 	static {
         byte[] bytes = getEnvBytes();
-        if (bytes != null) {
-            String[] envStrings = new String(bytes).split("\0");
-            for (int i = 0; i < envStrings.length; i++) {
-                int separator = envStrings[i].indexOf("=");
-                envMap.put(envStrings[i].substring(0, separator), envStrings[i]
-                        .substring(separator + 1));
-            }
+        if (bytes == null) {
+            throw new Error("Failed to get environment variables.");
+        }
+        String[] envStrings = new String(bytes).split("\0");
+        for (int i = 0; i < envStrings.length; i++) {
+            int separator = envStrings[i].indexOf("=");
+            envMap.put(envStrings[i].substring(0, separator), envStrings[i]
+                    .substring(separator + 1));
         }
 	}
 
 	/**
-	 * Returns a Map of the current environment variables, containing key and
-	 * value pairs.
-	 * 
-	 * @return a Map containing the environment variables and their values
-	 */
+     * Returns a Map of the current environment variables, containing key and
+     * value pairs.
+     * 
+     * @return a Map containing the environment variables and their values
+     */
 	public static Map<String, String> getenv() {
 		return envMap;
 	}



Mime
View raw message