United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 7126979 (props) JCK test java_lang/System/GetProperties.java failing [macosx]
7126979 : (props) JCK test java_lang/System/GetProperties.java failing [macosx]

Details
Type:
Bug
Submit Date:
2012-01-04
Status:
Closed
Updated Date:
2012-10-06
Project Name:
JDK
Resolved Date:
2012-04-09
Component:
core-libs
OS:
os_x
Sub-Component:
java.lang
CPU:
x86,unknown
Priority:
P3
Resolution:
Fixed
Affected Versions:
7,7u4
Fixed Versions:
7u4

Related Reports
Duplicate:

Sub Tasks

Description
(macosx) JCK test java_lang/System/GetProperties.java failing

                                    

Comments
SUGGESTED FIX

diff -r a301b69dfdc3 src/share/native/java/lang/System.c
--- a/src/share/native/java/lang/System.c	Tue Jan 03 13:43:05 2012 -0800
+++ b/src/share/native/java/lang/System.c	Wed Jan 04 06:39:55 2012 -0800
@@ -165,10 +165,6 @@
     return NULL;
 }
 
-#ifdef MACOSX
-extern void freeProps(java_props_t *sProps);
-#endif
-
 JNIEXPORT jobject JNICALL
 Java_java_lang_System_initProperties(JNIEnv *env, jclass cla, jobject props)
 {
@@ -395,10 +391,6 @@
         (*env)->DeleteLocalRef(env, jVMVal);
     }
 
-#ifdef MACOSX
-    // Free malloced memory.
-    freeProps(sprops);
-#endif
     return ret;
 }
diff -r a301b69dfdc3 src/solaris/native/java/lang/java_props_macosx.c
--- a/src/solaris/native/java/lang/java_props_macosx.c	Tue Jan 03 13:43:05 2012 -0800
+++ b/src/solaris/native/java/lang/java_props_macosx.c	Wed Jan 04 06:45:42 2012 -0800
@@ -348,37 +348,3 @@
 
     CFRelease(dict);
 }
-
-
-void freeProps(java_props_t *sprops) {
-    if (sprops->httpProxyEnabled) {
-        free(sprops->httpHost);
-        free(sprops->httpPort);
-    }
-
-    if (sprops->httpsProxyEnabled) {
-        free(sprops->httpsHost);
-        free(sprops->httpsPort);
-    }
-
-    if (sprops->ftpProxyEnabled) {
-        free(sprops->ftpHost);
-        free(sprops->ftpPort);
-    }
-
-    if (sprops->socksProxyEnabled) {
-        free(sprops->socksHost);
-        free(sprops->socksPort);
-    }
-
-    if (sprops->gopherProxyEnabled) {
-        free(sprops->gopherHost);
-        free(sprops->gopherPort);
-    }
-    if (sprops->exceptionList) {
-        free(sprops->exceptionList);
-    }
-
-    free(sprops->os_name);
-    free(sprops->os_version);
-}
                                     
2012-01-04
EVALUATION

freeProps() call added by mac port can only be called once. Issue seen if System.setProperties(null) is called.
GetJavaProperties() called a second time, which is supposed to return the statically populated information
from first call. But some of it has been freed already.

Fix is to remove the freeProps() code added in the original port changeset.
                                     
2012-01-04



Hardware and Software, Engineered to Work Together