17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/classFileParser.hpp"
27 #include "classfile/classFileStream.hpp"
28 #include "classfile/classListParser.hpp"
29 #include "classfile/classLoader.inline.hpp"
30 #include "classfile/classLoaderExt.hpp"
31 #include "classfile/classLoaderData.inline.hpp"
32 #include "classfile/klassFactory.hpp"
33 #include "classfile/modules.hpp"
34 #include "classfile/sharedPathsMiscInfo.hpp"
35 #include "classfile/systemDictionaryShared.hpp"
36 #include "classfile/vmSymbols.hpp"
37 #include "memory/allocation.inline.hpp"
38 #include "memory/filemap.hpp"
39 #include "memory/resourceArea.hpp"
40 #include "oops/instanceKlass.hpp"
41 #include "oops/oop.inline.hpp"
42 #include "oops/symbol.hpp"
43 #include "runtime/arguments.hpp"
44 #include "runtime/handles.inline.hpp"
45 #include "runtime/java.hpp"
46 #include "runtime/javaCalls.hpp"
47 #include "runtime/os.hpp"
48 #include "services/threadService.hpp"
49 #include "utilities/stringUtils.hpp"
50
51 jshort ClassLoaderExt::_app_class_paths_start_index = ClassLoaderExt::max_classpath_index;
52 jshort ClassLoaderExt::_app_module_paths_start_index = ClassLoaderExt::max_classpath_index;
53 jshort ClassLoaderExt::_max_used_path_index = 0;
54 bool ClassLoaderExt::_has_app_classes = false;
55 bool ClassLoaderExt::_has_platform_classes = false;
56
158 assert(found <= line_end, "sanity");
159 *line_end = '\0';
160 }
161 line_start = line_end + 1;
162 }
163 return found;
164 }
165
166 void ClassLoaderExt::process_jar_manifest(ClassPathEntry* entry,
167 bool check_for_duplicates) {
168 Thread* THREAD = Thread::current();
169 ResourceMark rm(THREAD);
170 jint manifest_size;
171 char* manifest = read_manifest(entry, &manifest_size, CHECK);
172
173 if (manifest == NULL) {
174 return;
175 }
176
177 if (strstr(manifest, "Extension-List:") != NULL) {
178 tty->print_cr("-Xshare:dump does not support Extension-List in JAR manifest: %s", entry->name());
179 vm_exit(1);
180 }
181
182 char* cp_attr = get_class_path_attr(entry->name(), manifest, manifest_size);
183
184 if (cp_attr != NULL && strlen(cp_attr) > 0) {
185 trace_class_path("found Class-Path: ", cp_attr);
186
187 char sep = os::file_separator()[0];
188 const char* dir_name = entry->name();
189 const char* dir_tail = strrchr(dir_name, sep);
190 int dir_len;
191 if (dir_tail == NULL) {
192 dir_len = 0;
193 } else {
194 dir_len = dir_tail - dir_name + 1;
195 }
196
197 // Split the cp_attr by spaces, and add each file
198 char* file_start = cp_attr;
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/classFileParser.hpp"
27 #include "classfile/classFileStream.hpp"
28 #include "classfile/classListParser.hpp"
29 #include "classfile/classLoader.inline.hpp"
30 #include "classfile/classLoaderExt.hpp"
31 #include "classfile/classLoaderData.inline.hpp"
32 #include "classfile/klassFactory.hpp"
33 #include "classfile/modules.hpp"
34 #include "classfile/sharedPathsMiscInfo.hpp"
35 #include "classfile/systemDictionaryShared.hpp"
36 #include "classfile/vmSymbols.hpp"
37 #include "logging/log.hpp"
38 #include "memory/allocation.inline.hpp"
39 #include "memory/filemap.hpp"
40 #include "memory/resourceArea.hpp"
41 #include "oops/instanceKlass.hpp"
42 #include "oops/oop.inline.hpp"
43 #include "oops/symbol.hpp"
44 #include "runtime/arguments.hpp"
45 #include "runtime/handles.inline.hpp"
46 #include "runtime/java.hpp"
47 #include "runtime/javaCalls.hpp"
48 #include "runtime/os.hpp"
49 #include "services/threadService.hpp"
50 #include "utilities/stringUtils.hpp"
51
52 jshort ClassLoaderExt::_app_class_paths_start_index = ClassLoaderExt::max_classpath_index;
53 jshort ClassLoaderExt::_app_module_paths_start_index = ClassLoaderExt::max_classpath_index;
54 jshort ClassLoaderExt::_max_used_path_index = 0;
55 bool ClassLoaderExt::_has_app_classes = false;
56 bool ClassLoaderExt::_has_platform_classes = false;
57
159 assert(found <= line_end, "sanity");
160 *line_end = '\0';
161 }
162 line_start = line_end + 1;
163 }
164 return found;
165 }
166
167 void ClassLoaderExt::process_jar_manifest(ClassPathEntry* entry,
168 bool check_for_duplicates) {
169 Thread* THREAD = Thread::current();
170 ResourceMark rm(THREAD);
171 jint manifest_size;
172 char* manifest = read_manifest(entry, &manifest_size, CHECK);
173
174 if (manifest == NULL) {
175 return;
176 }
177
178 if (strstr(manifest, "Extension-List:") != NULL) {
179 log_error(cds)("-Xshare:dump does not support Extension-List in JAR manifest: %s", entry->name());
180 vm_exit(1);
181 }
182
183 char* cp_attr = get_class_path_attr(entry->name(), manifest, manifest_size);
184
185 if (cp_attr != NULL && strlen(cp_attr) > 0) {
186 trace_class_path("found Class-Path: ", cp_attr);
187
188 char sep = os::file_separator()[0];
189 const char* dir_name = entry->name();
190 const char* dir_tail = strrchr(dir_name, sep);
191 int dir_len;
192 if (dir_tail == NULL) {
193 dir_len = 0;
194 } else {
195 dir_len = dir_tail - dir_name + 1;
196 }
197
198 // Split the cp_attr by spaces, and add each file
199 char* file_start = cp_attr;
|