Index: vm/vmcore/src/class_support/classloader.cpp =================================================================== --- vm/vmcore/src/class_support/classloader.cpp (revision 452710) +++ vm/vmcore/src/class_support/classloader.cpp (working copy) @@ -398,6 +398,7 @@ void ClassLoader::AddFailedClass(const String *className, const jthrowable exn) { assert(exn != NULL); + exn_print_stack_trace(stderr, exn); tmn_suspend_disable(); m_lock._lock(); @@ -1359,10 +1360,6 @@ size_t len = strlen(bcp_value) + 1; char *bcp = (char *)STD_ALLOCA( len ); memcpy(bcp, bcp_value, len); -#ifdef PLATFORM_NT - //on windows, we change the path to lower case - strlwr(bcp); -#endif // PLATFORM_NT // set bootclasspath elements const char separator[2] = {PORT_PATH_SEPARATOR, 0}; @@ -1442,10 +1439,6 @@ size_t len = strlen(jar_classpath) + 1; char* classpath = (char*)STD_ALLOCA(len); memcpy(classpath, jar_classpath, len); -#ifdef PLATFORM_NT - //on windows, we change the path to lower case - strlwr(classpath); -#endif // PLATFORM_NT // get archive file directory const char* jar_name = jar->GetName(); @@ -1461,10 +1454,6 @@ end_dir--; } *(end_dir + 1) = '\0'; -#ifdef PLATFORM_NT - //on windows, we change the path to lower case - strlwr(dir_name); -#endif // PLATFORM_NT } else { // only file name without directory dir_name = NULL; @@ -1530,11 +1519,11 @@ // init bootstrap class loader ClassLoader::Initialize(); + PropertiesHandle props = reinterpret_cast(&m_env->properties); + // get list of natives libraries const char *lib_list = - properties_get_string_property( - reinterpret_cast(&m_env->properties), - "vm.other_natives_dlls" ); + properties_get_string_property(props, "vm.other_natives_dlls"); size_t len = strlen( lib_list ) + 1; char *libraries = (char*)STD_ALLOCA( len ); memcpy( libraries, lib_list, len ); @@ -1555,6 +1544,39 @@ apr_pool_t *tmp_pool; apr_pool_create(&tmp_pool, NULL); + // normally bootclasspath is defined during "hyluni" loading + // otherwise user could override the whole BCP + // or/and append/prepend extra paths + const char *bcp = + properties_get_string_property(props, "vm.boot.class.path"); + if (!bcp) { + // default classlib-defined BCP + bcp = properties_get_string_property(props, + "org.apache.harmony.boot.class.path"); + ASSERT(vm_bcp, "No bootclasspath specified"); + // but classlib does not care about kernel classes + const char* home = properties_get_string_property(props, "java.home"); + assert(home); + const char * kernel_path = port_filepath_merge(home, + "lib" PORT_FILE_SEPARATOR_STR "boot" PORT_FILE_SEPARATOR_STR "kernel.jar", + tmp_pool); + bcp = apr_pstrcat(tmp_pool, kernel_path, bcp, NULL); + } + const char *pre_bcp = + properties_get_string_property(props, "_vm.bcp.prepend"); + if (pre_bcp) { + bcp = apr_pstrcat(tmp_pool, pre_bcp, bcp, NULL); + } + const char *post_bcp = + properties_get_string_property(props, "_vm.bcp.append"); + if (post_bcp) { + bcp = apr_pstrcat(tmp_pool, bcp, post_bcp, NULL); + } + // sync synonym properties + add_pair_to_properties(m_env->properties, "vm.boot.class.path", bcp); + add_pair_to_properties(m_env->properties, "sun.boot.class.path", bcp); + add_pair_to_properties(m_env->properties, "org.apache.harmony.boot.class.path", bcp); + // create a bootclasspath collection SetClasspathFromProperty("vm.boot.class.path", tmp_pool); Index: vm/vmcore/src/init/parse_arguments.cpp =================================================================== --- vm/vmcore/src/init/parse_arguments.cpp (revision 452710) +++ vm/vmcore/src/init/parse_arguments.cpp (working copy) @@ -172,21 +172,16 @@ if (begins_with(option, "-Xbootclasspath:")) { // replace boot class path by argument add_pair_to_properties(p_env->properties, "vm.boot.class.path", option + 16); - add_pair_to_properties(p_env->properties, "sun.boot.class.path", option + 16); } else if (begins_with(option, "-Xbootclasspath/a:")) { // append argument to boot class path - char *bcp_old = (char *)properties_get_string_property((PropertiesHandle)&p_env->properties, "vm.boot.class.path"); - assert(bcp_old); - char *bcp_new = apr_pstrcat(pool, bcp_old, PORT_PATH_SEPARATOR_STR, option + 18, NULL); - add_pair_to_properties(p_env->properties, "vm.boot.class.path", bcp_new); - add_pair_to_properties(p_env->properties, "sun.boot.class.path", bcp_new); + const char *bcp_old = (char *)properties_get_string_property((PropertiesHandle)&p_env->properties, "_vm.bcp.append"); + const char *bcp_new = bcp_old ? apr_pstrcat(pool, bcp_old, PORT_PATH_SEPARATOR_STR, option + 18, NULL) : option + 18; + add_pair_to_properties(p_env->properties, "_vm.bcp.append", bcp_new); } else if (begins_with(option, "-Xbootclasspath/p:")) { // prepend argument to boot class path - char *bcp_old = (char*)properties_get_string_property((PropertiesHandle)&p_env->properties, "vm.boot.class.path"); - assert(bcp_old); - char *bcp_new = apr_pstrcat(pool, option + 18, PORT_PATH_SEPARATOR_STR, bcp_old, NULL); - add_pair_to_properties(p_env->properties, "vm.boot.class.path", bcp_new); - add_pair_to_properties(p_env->properties, "sun.boot.class.path", bcp_new); + const char *bcp_old = (char*)properties_get_string_property((PropertiesHandle)&p_env->properties, "_vm.bcp.prepend"); + const char *bcp_new = bcp_old ? apr_pstrcat(pool, option + 18, PORT_PATH_SEPARATOR_STR, bcp_old, NULL) : option + 18; + add_pair_to_properties(p_env->properties, "_vm.bcp.prepend", bcp_new); } else if (begins_with(option, "-Xhelp:")) { const char* arg = option + strlen("-Xhelp:"); Index: vm/vmcore/src/init/vm.cpp =================================================================== --- vm/vmcore/src/init/vm.cpp (revision 452710) +++ vm/vmcore/src/init/vm.cpp (working copy) @@ -262,8 +262,6 @@ // Non-boolean properties below. (sorted for convenience) {"vm.boot.library.path", "List of directories which contain additional dynamic libraries to load into VM"}, {"vm.boot.class.path", "Virtual machine bootclasspath"}, - {"vm.bootclasspath.initmethod", "Set to \"java-home\" to use a JDK style bootclasspath based on java home."}, - {"vm.bootclasspath.prepend", "Prepended to the JDK style booclasspath."}, {"vm.dlls", "A ';'-delimited list of modular dlls (GC/etc.) to load at startup."}, {"vm.ee_dlls", "A ';'-delimited list of modular dlls (JIT/Interpreter/etc.) to load at startup."}, {"vm.em_dll", "A ';'-execution manager (EM) dll to load at startup."}, Index: vm/vmcore/src/init/properties.cpp =================================================================== --- vm/vmcore/src/init/properties.cpp (revision 452710) +++ vm/vmcore/src/init/properties.cpp (working copy) @@ -35,9 +35,6 @@ #define PROP_ENV_NAME "VM_PROPERTIES" #define PROP_FILE_NAME "vm.properties" -#define BOOT_PROPS_FILE_NAME "bootclasspath.properties" -#define BOOTCLASSPATH_PROP_NAME "bootclasspath" -#define BOOTCLASSPATH_KERNEL_JAR "kernel.jar" #define MAX_PROP_LINE 5120 @@ -189,85 +186,6 @@ return full_name; } -int str_compare(const void *arg1, const void *arg2) { - char *string1 = *(char**)arg1; - char *string2 = *(char**)arg2; - if (strlen(string1) < strlen(string2)) - return -1; - if (strlen(string2) < strlen(string1)) - return 1; - return strcmp(string1, string2); -} - -static char *load_full_api_files_path_names_list(const char *path) -{ - char *full_name = ""; - int array_size = 30; - char **props = (char**)STD_MALLOC(array_size*sizeof(char*)); - char *jre_file_path = apr_pstrcat(prop_pool, path, PORT_FILE_SEPARATOR_STR BOOT_PROPS_FILE_NAME, NULL); - apr_file_t *f_jre; - if (APR_SUCCESS == apr_file_open(&f_jre, jre_file_path, APR_FOPEN_READ, 0, prop_pool)) - { - char jre_file_name[MAX_PROP_LINE]; - int props_count = 0; - while (!apr_file_eof(f_jre) && !apr_file_gets(jre_file_name, MAX_PROP_LINE, f_jre)) { - if ((jre_file_name[0] != 0x0D || jre_file_name[0] != 0x0A) - && !strncmp(jre_file_name ,BOOTCLASSPATH_PROP_NAME, strlen(BOOTCLASSPATH_PROP_NAME))) { - char *char_pos = jre_file_name + strlen(BOOTCLASSPATH_PROP_NAME); - // Check that there are digits after dots so only bootclasspath - // elements appear in the property - if (char_pos[0] != '.' || char_pos[1] < '0' || char_pos[1] > '9') - continue; - - if(props_count == array_size) { - array_size *= 2; - props = (char**)STD_REALLOC(props, array_size*sizeof(char*)); - } - unsigned length; - char_pos = strchr(jre_file_name, 0x0D); - if (!char_pos) { - char_pos = strchr(jre_file_name, 0x0A); - } - if (char_pos) { - *char_pos = '\0'; - length = char_pos - jre_file_name + 1; - } else { - length = strlen(jre_file_name) + 1; - } - char_pos = strchr(jre_file_name, '='); - if (!char_pos) { - DIE("Malformed bootclasspath entry: " << jre_file_name); - } - *char_pos = '\0'; - props[props_count] = (char*)STD_MALLOC(length * sizeof(char)); - memcpy(props[props_count], jre_file_name, length); - props_count++; - } - } - - qsort(props, props_count, sizeof(char*), str_compare); - - full_name = apr_pstrcat(prop_pool, path, PORT_FILE_SEPARATOR_STR, - BOOTCLASSPATH_KERNEL_JAR, NULL); - - TRACE2("init", "kernel jar path : " << full_name); - - for(int i = 0; i < props_count; i++){ - full_name = apr_pstrcat(prop_pool, full_name, PORT_PATH_SEPARATOR_STR, - path, PORT_FILE_SEPARATOR_STR, props[i] + strlen(props[i]) + 1, NULL); - STD_FREE(props[i]); - } - STD_FREE(props); - apr_file_close(f_jre); - } - else - { - DIE("Can't find file : " << jre_file_path); - } - return full_name; -} - - void post_initialize_ee_dlls(PropertiesHandle ph) { if (!prop_pool) { apr_pool_create(&prop_pool, 0); @@ -409,19 +327,6 @@ add_pair_to_properties(properties, "java.ext.dirs", ext_path); TRACE( "java.ext.dirs = " << ext_path); - // vm.boot.class.path initialization. Value is - // java.home PATH_SEPARATOR lib PATH_SEPARATOR API_CLASSES_ARCHIVE - // where API_CLASSES_ARCHIVE is defined in this file - char *boot_path = port_filepath_merge(base_path_buf, "lib" PORT_FILE_SEPARATOR_STR "boot", prop_pool); - - path_buf = load_full_api_files_path_names_list(boot_path); - add_pair_to_properties(properties, "vm.boot.class.path", path_buf); - TRACE( "vm.boot.class.path = " << path_buf); - - // Added for compatibility with a reference JDWP agent - add_pair_to_properties(properties, "sun.boot.class.path", path_buf); - TRACE( "sun.boot.class.path = " << path_buf); - // user.name initialization, try to get the name from the system char *user_buf; apr_status_t status = port_user_name(&user_buf, prop_pool);