Lines 1056-1071
Link Here
|
1056 |
// Move on to "startup classpath", qualified by applicable package deps etc. |
1056 |
// Move on to "startup classpath", qualified by applicable package deps etc. |
1057 |
// Fixed classpath modules don't get restricted in this way. |
1057 |
// Fixed classpath modules don't get restricted in this way. |
1058 |
Set kosher = m.isFixed() ? null : findKosher(m); |
1058 |
Set kosher = m.isFixed() ? null : findKosher(m); |
1059 |
String home = System.getProperty("netbeans.home"); // NOI18N |
1059 |
tok = new StringTokenizer(System.getProperty("java.class.path", ""), File.pathSeparator); |
1060 |
if (home != null) { |
1060 |
while (tok.hasMoreTokens()) { |
1061 |
File lib = new File(new File(home), "lib"); // NOI18N |
1061 |
addStartupClasspathEntry(new File(tok.nextToken()), l, kosher); |
1062 |
// Cf. launcher: |
1062 |
} |
1063 |
addStartupClasspathEntries(new File(lib, "ext"), l, kosher); // NOI18N |
1063 |
// See org.netbeans.Main for actual computation of the dynamic classpath. |
1064 |
addStartupClasspathEntries(new File(new File(lib, "ext"), "locale"), l, kosher); // NOI18N |
1064 |
tok = new StringTokenizer(System.getProperty("netbeans.dynamic.classpath", ""), File.pathSeparator); |
1065 |
// Cf. org.netbeans.Main.build_cp(): |
1065 |
while (tok.hasMoreTokens()) { |
1066 |
addStartupClasspathEntries(new File(lib, "patches"), l, kosher); // NOI18N |
1066 |
addStartupClasspathEntry(new File(tok.nextToken()), l, kosher); |
1067 |
addStartupClasspathEntries(lib, l, kosher); |
|
|
1068 |
addStartupClasspathEntries(new File(lib, "locale"), l, kosher); // NOI18N |
1069 |
} |
1067 |
} |
1070 |
// Finally include this module and its dependencies recursively. |
1068 |
// Finally include this module and its dependencies recursively. |
1071 |
// Modules whose direct classpath has already been added to the list: |
1069 |
// Modules whose direct classpath has already been added to the list: |
Lines 1098-1124
Link Here
|
1098 |
return buf.toString(); |
1096 |
return buf.toString(); |
1099 |
} |
1097 |
} |
1100 |
|
1098 |
|
1101 |
/** Add classpath entries from the lib/ or lib/ext/ dirs, if appropriate. |
1099 |
/** Add a classpath entry from the lib/ or lib/ext/ dirs, if appropriate. |
1102 |
* @param dir the directory to scan for JAR and ZIP files |
1100 |
* @param entry a classpath entry; either a directory, or a JAR file which might be controlled |
1103 |
* @param cp the classpath (<code>List<String></code>) to add to |
1101 |
* @param cp the classpath (<code>List<String></code>) to add to |
1104 |
* @param kosher known packages which may be accessed (<code>Set<String></code>), or null for no restrictions |
1102 |
* @param kosher known packages which may be accessed (<code>Set<String></code>), or null for no restrictions |
1105 |
* @see #22466 |
1103 |
* @see #22466 |
1106 |
*/ |
1104 |
*/ |
1107 |
private static void addStartupClasspathEntries(File dir, List cp, Set kosher) { |
1105 |
private static void addStartupClasspathEntry(File cpEntry, List cp, Set kosher) { |
1108 |
if (!dir.isDirectory()) { |
1106 |
if (cpEntry.isDirectory()) { |
|
|
1107 |
cp.add(cpEntry.getAbsolutePath()); |
1109 |
return; |
1108 |
return; |
1110 |
} |
1109 |
} |
1111 |
class JarZipFilter implements FilenameFilter { |
1110 |
// JAR or ZIP. Check whether we can access it. |
1112 |
public boolean accept(File dir, String name) { |
1111 |
String name = cpEntry.getName(); |
1113 |
String n = name.toLowerCase(Locale.US); |
|
|
1114 |
return !n.startsWith("updater") && (n.endsWith(".jar") || n.endsWith(".zip")); // NOI18N |
1115 |
} |
1116 |
} |
1117 |
File[] exts = dir.listFiles(new JarZipFilter()); |
1118 |
if (exts != null) { |
1119 |
EXTS: |
1120 |
for (int i = 0; i < exts.length; i++) { |
1121 |
String name = exts[i].getName(); |
1122 |
for (int j = 0; j < CLASSPATH_JARS.length; j++) { |
1112 |
for (int j = 0; j < CLASSPATH_JARS.length; j++) { |
1123 |
if (kosher != null && name.startsWith(CLASSPATH_JARS[j][0])) { |
1113 |
if (kosher != null && name.startsWith(CLASSPATH_JARS[j][0])) { |
1124 |
// Restricted JAR. |
1114 |
// Restricted JAR. |
Lines 1129-1135
Link Here
|
1129 |
// Module is permitted to use this package. |
1119 |
// Module is permitted to use this package. |
1130 |
if (entry == null) { |
1120 |
if (entry == null) { |
1131 |
entry = new StringBuffer(100); |
1121 |
entry = new StringBuffer(100); |
1132 |
entry.append(exts[i].getAbsolutePath()); |
1122 |
entry.append(cpEntry.getAbsolutePath()); |
1133 |
entry.append('['); // NOI18N |
1123 |
entry.append('['); // NOI18N |
1134 |
} else { |
1124 |
} else { |
1135 |
entry.append(','); // NOI18N |
1125 |
entry.append(','); // NOI18N |
Lines 1148-1156
Link Here
|
1148 |
} |
1138 |
} |
1149 |
} |
1139 |
} |
1150 |
// Did not match any, assumed to be on classpath. |
1140 |
// Did not match any, assumed to be on classpath. |
1151 |
cp.add(exts[i].getAbsolutePath()); |
1141 |
cp.add(cpEntry.getAbsolutePath()); |
1152 |
} |
|
|
1153 |
} |
1154 |
} |
1142 |
} |
1155 |
|
1143 |
|
1156 |
/** Recursively build a classpath based on the module dependency tree. |
1144 |
/** Recursively build a classpath based on the module dependency tree. |