1 /*
2 * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
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 *
42 private:
43 enum SomeConstants {
44 max_classpath_index = 0x7fff
45 };
46
47 static char* get_class_path_attr(const char* jar_path, char* manifest, jint manifest_size);
48 static void setup_app_search_path(JavaThread* current); // Only when -Xshare:dump
49 static void process_module_table(JavaThread* current, ModuleEntryTable* met);
50 // index of first app JAR in shared classpath entry table
51 static jshort _app_class_paths_start_index;
52 // index of first modular JAR in shared modulepath entry table
53 static jshort _app_module_paths_start_index;
54 // the largest path index being used during CDS dump time
55 static jshort _max_used_path_index;
56
57 static bool _has_app_classes;
58 static bool _has_platform_classes;
59 static bool _has_non_jar_in_classpath;
60
61 static char* read_manifest(JavaThread* current, ClassPathEntry* entry, jint *manifest_size, bool clean_text);
62
63 public:
64 static void process_jar_manifest(JavaThread* current, ClassPathEntry* entry);
65
66 // Called by JVMTI code to add boot classpath
67 static void append_boot_classpath(ClassPathEntry* new_entry);
68
69 static void setup_search_paths(JavaThread* current);
70 static void setup_module_paths(JavaThread* current);
71
72 static char* read_manifest(JavaThread* current, ClassPathEntry* entry, jint *manifest_size) {
73 // Remove all the new-line continuations (which wrap long lines at 72 characters, see
74 // http://docs.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#JAR%20Manifest), so
75 // that the manifest is easier to parse.
76 return read_manifest(current, entry, manifest_size, true);
77 }
78 static char* read_raw_manifest(JavaThread* current, ClassPathEntry* entry, jint *manifest_size) {
79 // Do not remove new-line continuations, so we can easily pass it as an argument to
80 // java.util.jar.Manifest.getManifest() at run-time.
81 return read_manifest(current, entry, manifest_size, false);
82 }
|
1 /*
2 * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
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 *
42 private:
43 enum SomeConstants {
44 max_classpath_index = 0x7fff
45 };
46
47 static char* get_class_path_attr(const char* jar_path, char* manifest, jint manifest_size);
48 static void setup_app_search_path(JavaThread* current); // Only when -Xshare:dump
49 static void process_module_table(JavaThread* current, ModuleEntryTable* met);
50 // index of first app JAR in shared classpath entry table
51 static jshort _app_class_paths_start_index;
52 // index of first modular JAR in shared modulepath entry table
53 static jshort _app_module_paths_start_index;
54 // the largest path index being used during CDS dump time
55 static jshort _max_used_path_index;
56
57 static bool _has_app_classes;
58 static bool _has_platform_classes;
59 static bool _has_non_jar_in_classpath;
60
61 static char* read_manifest(JavaThread* current, ClassPathEntry* entry, jint *manifest_size, bool clean_text);
62 static ClassPathEntry* get_class_path_entry(s2 classpath_index);
63 static void check_invalid_classpath_index(s2 classpath_index, InstanceKlass* ik);
64 public:
65 static void process_jar_manifest(JavaThread* current, ClassPathEntry* entry);
66
67 // Called by JVMTI code to add boot classpath
68 static void append_boot_classpath(ClassPathEntry* new_entry);
69
70 static void setup_search_paths(JavaThread* current);
71 static void setup_module_paths(JavaThread* current);
72
73 static char* read_manifest(JavaThread* current, ClassPathEntry* entry, jint *manifest_size) {
74 // Remove all the new-line continuations (which wrap long lines at 72 characters, see
75 // http://docs.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#JAR%20Manifest), so
76 // that the manifest is easier to parse.
77 return read_manifest(current, entry, manifest_size, true);
78 }
79 static char* read_raw_manifest(JavaThread* current, ClassPathEntry* entry, jint *manifest_size) {
80 // Do not remove new-line continuations, so we can easily pass it as an argument to
81 // java.util.jar.Manifest.getManifest() at run-time.
82 return read_manifest(current, entry, manifest_size, false);
83 }
|