This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 19622
Collapse All | Expand All

(-)ant/manifest.mf (-1 / +1 lines)
Lines 7-13 Link Here
7
OpenIDE-Module-Layer: org/apache/tools/ant/module/resources/AntModuleLayer.xml
7
OpenIDE-Module-Layer: org/apache/tools/ant/module/resources/AntModuleLayer.xml
8
OpenIDE-Module-Module-Dependencies: org.netbeans.modules.javahelp/1 > 1.0
8
OpenIDE-Module-Module-Dependencies: org.netbeans.modules.javahelp/1 > 1.0
9
OpenIDE-Module-IDE-Dependencies: IDE/1 > 2.3
9
OpenIDE-Module-IDE-Dependencies: IDE/1 > 2.3
10
OpenIDE-Module-Package-Dependencies: [org.apache.tools.ant.Location], [org.apache.xerces.parsers.DOMParser]
10
OpenIDE-Module-Package-Dependencies: [org.apache.tools.ant.Location], [org.apache.xerces.parsers.DOMParser], [org.apache.xml.serialize.EncodingInfo]
11
Class-Path: ext/ant-1.4.1.jar ext/ant-optional-1.4.1.jar
11
Class-Path: ext/ant-1.4.1.jar ext/ant-optional-1.4.1.jar
12
12
13
Name: org/apache/tools/ant/module/loader/AntProjectDataLoader.class
13
Name: org/apache/tools/ant/module/loader/AntProjectDataLoader.class
(-)apisupport/manifest.mf (-1 / +1 lines)
Lines 6-12 Link Here
6
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
6
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
7
OpenIDE-Module-Module-Dependencies: org.netbeans.modules.apisupport.lite/1 > 0.1, org.netbeans.modules.jarpackager/2 > 1.8, org.netbeans.modules.javahelp/1 > 1.0
7
OpenIDE-Module-Module-Dependencies: org.netbeans.modules.apisupport.lite/1 > 0.1, org.netbeans.modules.jarpackager/2 > 1.8, org.netbeans.modules.javahelp/1 > 1.0
8
OpenIDE-Module-IDE-Dependencies: IDE/1 > 2.3
8
OpenIDE-Module-IDE-Dependencies: IDE/1 > 2.3
9
OpenIDE-Module-Package-Dependencies: [org.apache.xerces.parsers.DOMParser]
9
OpenIDE-Module-Package-Dependencies: [org.apache.xerces.parsers.DOMParser], [org.apache.xml.serialize.EncodingInfo]
10
Class-Path: docs/apisupport-manual.zip
10
Class-Path: docs/apisupport-manual.zip
11
11
12
Name: org/netbeans/modules/apisupport/ManifestDataLoader.class
12
Name: org/netbeans/modules/apisupport/ManifestDataLoader.class
(-)corba/manifest.mf (+1 lines)
Lines 6-11 Link Here
6
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
6
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
7
OpenIDE-Module-Module-Dependencies: org.netbeans.modules.java/1
7
OpenIDE-Module-Module-Dependencies: org.netbeans.modules.java/1
8
OpenIDE-Module-IDE-Dependencies: IDE/1 > 1.24
8
OpenIDE-Module-IDE-Dependencies: IDE/1 > 1.24
9
OpenIDE-Module-Package-Dependencies: org.apache.regexp[RE]
9
Class-Path: docs/corba.jar
10
Class-Path: docs/corba.jar
10
11
11
Name: org/netbeans/modules/corba/IDLDataLoader.class
12
Name: org/netbeans/modules/corba/IDLDataLoader.class
(-)core/src/org/netbeans/core/modules/Module.java (+15 lines)
Lines 849-854 Link Here
849
        protected PermissionCollection getPermissions(CodeSource cs) {
849
        protected PermissionCollection getPermissions(CodeSource cs) {
850
            return getAllPermission();
850
            return getAllPermission();
851
        }
851
        }
852
        
852
        /** look for JNI libraries also in modules/bin/ */
853
        /** look for JNI libraries also in modules/bin/ */
853
        protected String findLibrary(String libname) {
854
        protected String findLibrary(String libname) {
854
            String mapped = System.mapLibraryName(libname);
855
            String mapped = System.mapLibraryName(libname);
Lines 859-864 Link Here
859
                return null;
860
                return null;
860
            }
861
            }
861
        }
862
        }
863
        
864
        protected boolean shouldDelegateResource(String pkg, ClassLoader parent) {
865
            if (!super.shouldDelegateResource(pkg, parent)) {
866
                return false;
867
            }
868
            Module other;
869
            if (parent instanceof Util.ModuleProvider) {
870
                other = ((Util.ModuleProvider)parent).getModule();
871
            } else {
872
                other = null;
873
            }
874
            return mgr.shouldDelegateResource(Module.this, other, pkg);
875
        }
876
        
862
        public String toString() {
877
        public String toString() {
863
            return super.toString() + "[" + getCodeNameBase() + "]"; // NOI18N
878
            return super.toString() + "[" + getCodeNameBase() + "]"; // NOI18N
864
        }
879
        }
(-)core/src/org/netbeans/core/modules/ModuleInstaller.java (+21 lines)
Lines 92-99 Link Here
92
     *          getDependencies on this module nor attempt to directly change it
92
     *          getDependencies on this module nor attempt to directly change it
93
     *          in any way; overriders may ask for module code name, version, etc.
93
     *          in any way; overriders may ask for module code name, version, etc.
94
     * @param dependencies a set of Dependency's; mutable, entries may be added or removed
94
     * @param dependencies a set of Dependency's; mutable, entries may be added or removed
95
     *                     during the dynamic scope of this call
95
     * @since org.netbeans.core/1 1.2
96
     * @since org.netbeans.core/1 1.2
96
     */
97
     */
97
    public void refineDependencies(Module m, Set dependencies) {}
98
    public void refineDependencies(Module m, Set dependencies) {}
98
    
99
    
100
    /** Optionally mask package use in a module classloader.
101
     * For example, an installer might decide that a given module may not
102
     * use a given package from another module because that package is not
103
     * intended to be publically exposed. Or that a module may not use a
104
     * package in the application classpath because it is an unguaranteed
105
     * implementation package and the module has not explicitly requested
106
     * to use it.
107
     * @param m the module requesting use of a given package
108
     * @param parent the module which might possibly supply that package, or
109
     *               null if the possible provider is not a module (i.e. application
110
     *               classpath)
111
     * @param pkg the name of the package in use, in the form "org/netbeans/modules/foo/"
112
     *            (i.e. slash-separated and ending in a slash as well)
113
     * The default implementation always approves delegation.
114
     * @since org.netbeans.core/1 1.3
115
     */
116
    public boolean shouldDelegateResource(Module m, Module parent, String pkg) {
117
        return true;
118
    }
119
99
}
120
}
(-)core/src/org/netbeans/core/modules/ModuleManager.java (+12 lines)
Lines 324-329 Link Here
324
    void refineDependencies(Module m, Set dependencies) {
324
    void refineDependencies(Module m, Set dependencies) {
325
        installer.refineDependencies(m, dependencies);
325
        installer.refineDependencies(m, dependencies);
326
    }
326
    }
327
    /** Use by OneModuleClassLoader to communicate with the ModuleInstaller re. masking. */
328
    boolean shouldDelegateResource(Module m, Module parent, String pkg) {
329
        boolean r = installer.shouldDelegateResource(m, parent, pkg);
330
        if (!r && Util.err.isLoggable(ErrorManager.INFORMATIONAL)) {
331
            // Note that this is usually harmless. Typical case: Introspector.getBeanInfo
332
            // is called on some module-supplied class; this looks in the module's classloader
333
            // for org.netbeans.beaninfo.ModuleClassBeanInfo, which of course would not be
334
            // found anyway.
335
            Util.err.log("Refusing to load " + pkg + " for " + m + " from parent module " + parent);
336
        }
337
        return r;
338
    }
327
339
328
    private void subCreate(Module m) throws DuplicateException {
340
    private void subCreate(Module m) throws DuplicateException {
329
        Util.err.log("created: " + m);
341
        Util.err.log("created: " + m);
(-)core/src/org/netbeans/core/modules/ModuleSystem.java (+1 lines)
Lines 100-105 Link Here
100
            }
100
            }
101
            list = new ModuleList(mgr, modulesFolder, scandirs, ev);
101
            list = new ModuleList(mgr, modulesFolder, scandirs, ev);
102
            ((NbInstaller)installer).registerList(list);
102
            ((NbInstaller)installer).registerList(list);
103
            ((NbInstaller)installer).registerManager(mgr);
103
        }
104
        }
104
        ev.log(Events.CREATED_MODULE_SYSTEM);
105
        ev.log(Events.CREATED_MODULE_SYSTEM);
105
    }
106
    }
(-)core/src/org/netbeans/core/modules/NbInstaller.java (+118 lines)
Lines 57-62 Link Here
57
    private final Events ev;
57
    private final Events ev;
58
    /** associated controller of module list; needed for handling ModuleInstall ser */
58
    /** associated controller of module list; needed for handling ModuleInstall ser */
59
    private ModuleList moduleList;
59
    private ModuleList moduleList;
60
    /** associated manager */
61
    private ModuleManager mgr;
62
    /** set of permitted core or package dependencies from a module */
63
    private final Map kosherPackages = new HashMap(100); // Map<Module,Set<String>>
60
    
64
    
61
    public NbInstaller(Events ev) {
65
    public NbInstaller(Events ev) {
62
        this.ev = ev;
66
        this.ev = ev;
Lines 67-72 Link Here
67
        if (moduleList != null) throw new IllegalStateException();
71
        if (moduleList != null) throw new IllegalStateException();
68
        moduleList = list;
72
        moduleList = list;
69
    }
73
    }
74
    void registerManager(ModuleManager manager) {
75
        if (mgr != null) throw new IllegalStateException();
76
        mgr = manager;
77
    }
70
    
78
    
71
    public void prepare(Module m) throws InvalidException {
79
    public void prepare(Module m) throws InvalidException {
72
        ev.log(Events.PREPARE, m);
80
        ev.log(Events.PREPARE, m);
Lines 176-181 Link Here
176
        installs.remove(m);
184
        installs.remove(m);
177
        layers.remove(m);
185
        layers.remove(m);
178
        helpsets.remove(m);
186
        helpsets.remove(m);
187
        kosherPackages.remove(m);
179
    }
188
    }
180
    
189
    
181
    public void load(List modules) {
190
    public void load(List modules) {
Lines 674-679 Link Here
674
                                                      "org.netbeans.api.javahelp.Help")); // NOI18N
683
                                                      "org.netbeans.api.javahelp.Help")); // NOI18N
675
            }
684
            }
676
        }
685
        }
686
    }
687
    
688
    // Cf. #19621, #19622
689
    public boolean shouldDelegateResource(Module m, Module parent, String pkg) {
690
        // XXX implement #19621: support OpenIDE-Module-Public-Packages
691
        if (pkg.startsWith("META-INF/")) { // NOI18N
692
            // Modules should not make direct reference to metainfo dirs of
693
            // other modules.
694
            return false;
695
        }
696
        if (parent == null) {
697
            // Application classpath checks.
698
            if (m.getCodeNameBase().equals("org.netbeans.modules.icebrowser") && // NOI18N
699
                    pkg.equals("org/w3c/dom/events/")) { // NOI18N
700
                // XXX delete this clause later. Currently ICE browser JAR includes a copy
701
                // of many XML classes, including two classes in org.w3c.dom.events
702
                // (MouseEvent & UIEvent) which are not in Xerces for some reason.
703
                // This is a temporary workaround to permit these two classes to be loaded
704
                // by the ICE browser even though there is package skew going on.
705
                // When dom.jar is created and added to the classpath, it will include
706
                // the full DOM API including these classes and org.w3c.dom.views.
707
                return false;
708
            }
709
            for (int i = 0; i < CLASSPATH_PACKAGES.length; i++) {
710
                if (pkg.startsWith(CLASSPATH_PACKAGES[i]) &&
711
                        !findKosher(m).contains(CLASSPATH_PACKAGES[i])) {
712
                    // Undeclared use of a classpath package. Refuse it.
713
                    return false;
714
                }
715
            }
716
        }
717
        return true;
718
    }
719
    
720
    private static final String[] CLASSPATH_PACKAGES = new String[] {
721
        // core.jar, various portions
722
        // XXX when platform_feb_2002 is merged, this can be made more precise
723
        // (and when core submodules are autoloads not on the classpath, those
724
        // package prefixes can simply be deleted)
725
        "org/netbeans/core/", // NOI18N
726
        "org/netbeans/beaninfo/", // NOI18N
727
        // terminalemulator.jar
728
        "org/netbeans/lib/terminalemulator/", // NOI18N
729
        // regexp.jar
730
        "org/apache/regexp/", // NOI18N
731
        // crimson.jar
732
        // Note that under JDK 1.4 this might be in the JRE bootclasspath too.
733
        // Tough luck - a module should not be using undocumented rt.jar classes anyway.
734
        "org/apache/crimson/", // NOI18N
735
        // xerces.jar - parser impl
736
        "org/apache/xerces/", // NOI18N
737
        // xerces.jar - serializer library
738
        "org/apache/xml/serialize/", // NOI18N
739
    };
740
    
741
    private Set/*<String>*/ findKosher(Module m) {
742
        Set s = (Set)kosherPackages.get(m);
743
        if (s == null) {
744
            s = new HashSet(); // Set<String>
745
            Dependency[] deps = m.getDependenciesArray();
746
            for (int i = 0; i < deps.length; i++) {
747
                // Extend this for other classpath modules:
748
                if (deps[i].getType() == Dependency.TYPE_MODULE &&
749
                        deps[i].getName().equals("org.netbeans.core/1")) { // NOI18N
750
                    // Legitimate in some cases, e.g. apisupport or autoupdate.
751
                    s.add("org/netbeans/core/"); // NOI18N
752
                    s.add("org/netbeans/beaninfo/"); // NOI18N
753
                } else if (deps[i].getType() == Dependency.TYPE_MODULE) {
754
                    // Module dependency. If a package was kosher for A and B depends
755
                    // on A, we let B use it undeclared. Cf. javacvs -> vcscore & RE.
756
                    String name = deps[i].getName();
757
                    int idx = name.indexOf('/');
758
                    if (idx != -1) {
759
                        name = name.substring(0, idx);
760
                    }
761
                    Module other = mgr.get(name);
762
                    if (other == null) throw new IllegalStateException("Should have found dep " + deps[i] + " from " + m); // NOI18N
763
                    s.addAll(findKosher(other));
764
                } else if (deps[i].getType() == Dependency.TYPE_PACKAGE) {
765
                    String depname = deps[i].getName();
766
                    String req;
767
                    int idx = depname.indexOf('['); // NOI18N
768
                    if (idx == -1) {
769
                        // depname = org.apache.xerces.parsers
770
                        // req = org/apache/xerces/parsers/
771
                        req = depname.replace('.', '/').concat("/"); // NOI18N
772
                    } else if (idx == 0) {
773
                        // depname = [org.apache.xerces.parsers.DOMParser]
774
                        // req = org/apache/xerces/parsers/
775
                        int idx2 = depname.lastIndexOf('.');
776
                        req = depname.substring(1, idx2).replace('.', '/').concat("/"); // NOI18N
777
                    } else {
778
                        // depname = org.apache.xerces.parsers[DOMParser]
779
                        // req = org/apache/xerces/parsers/
780
                        req = depname.substring(0, idx).replace('.', '/').concat("/"); // NOI18N
781
                    }
782
                    for (int j = 0; j < CLASSPATH_PACKAGES.length; j++) {
783
                        if (req.startsWith(CLASSPATH_PACKAGES[j])) {
784
                            // Module requested this exact package or some subpackage or
785
                            // a class in one of these packages; it is kosher.
786
                            s.add(CLASSPATH_PACKAGES[j]);
787
                        }
788
                    }
789
                }
790
            }
791
            if (s.isEmpty()) s = Collections.EMPTY_SET;
792
            kosherPackages.put(m, s);
793
        }
794
        return s;
677
    }
795
    }
678
    
796
    
679
}
797
}
(-)core/src/org/netbeans/core/modules/ProxyClassLoader.java (-35 / +67 lines)
Lines 18-25 Link Here
18
import java.io.IOException;
18
import java.io.IOException;
19
import org.openide.ErrorManager;
19
import org.openide.ErrorManager;
20
import org.openide.util.WeakSet;
20
import org.openide.util.WeakSet;
21
import org.openide.util.enum.ArrayEnumeration;
21
import org.openide.util.enum.*;
22
import org.openide.util.enum.SequenceEnumeration;
23
22
24
/**
23
/**
25
 * A class loader that has multiple parents and uses them for loading
24
 * A class loader that has multiple parents and uses them for loading
Lines 34-39 Link Here
34
public class ProxyClassLoader extends ClassLoader {
33
public class ProxyClassLoader extends ClassLoader {
35
    
34
    
36
    // Map<String,ClassLoader>
35
    // Map<String,ClassLoader>
36
    // packages are given in format "org/netbeans/modules/foo/"
37
    private final Map domainsByPackage = new HashMap(); 
37
    private final Map domainsByPackage = new HashMap(); 
38
    // Map<String,Package>
38
    // Map<String,Package>
39
    private HashMap packages = new HashMap();
39
    private HashMap packages = new HashMap();
Lines 116-124 Link Here
116
    protected synchronized final Class loadClass(String name, boolean resolve)
116
    protected synchronized final Class loadClass(String name, boolean resolve)
117
                                            throws ClassNotFoundException {
117
                                            throws ClassNotFoundException {
118
        zombieCheck(name);
118
        zombieCheck(name);
119
        final int dotIdx = name.lastIndexOf('.');
119
        // XXX this section is a candidate for local optimization:
120
        if (dotIdx == -1) throw new ClassNotFoundException("Will not load classes from default package"); // NOI18N
120
        String filename = name.replace('.', '/').concat(".class"); // NOI18N
121
        Class c = smartLoadClass(name, dotIdx);
121
        int idx = filename.lastIndexOf('/'); // NOI18N
122
        if (idx == -1) throw new ClassNotFoundException("Will not load classes from default package"); // NOI18N
123
        String pkg = filename.substring(0, idx + 1); // "org/netbeans/modules/foo/"
124
        Class c = smartLoadClass(name, filename, pkg);
122
        if(c == null) throw new ClassNotFoundException(name);
125
        if(c == null) throw new ClassNotFoundException(name);
123
        if (resolve) resolveClass(c);
126
        if (resolve) resolveClass(c);
124
        return c;
127
        return c;
Lines 160-168 Link Here
160
    public final URL getResource(final String name) {
163
    public final URL getResource(final String name) {
161
        zombieCheck(name);
164
        zombieCheck(name);
162
        
165
        
163
        if (isSpecialResource(name)) {
166
        final int slashIdx = name.lastIndexOf('/');
167
        if (slashIdx == -1) return null;    // won't load from the default package
168
        final String pkg = name.substring(0, slashIdx + 1);
169
170
        if (isSpecialResource(pkg)) {
164
            // Disable domain cache for this one, do a simple check.
171
            // Disable domain cache for this one, do a simple check.
165
            for (int i = 0; i < parents.length; i++) {
172
            for (int i = 0; i < parents.length; i++) {
173
                if (!shouldDelegateResource(pkg, parents[i])) continue;
166
                URL u;
174
                URL u;
167
                if (parents[i] instanceof ProxyClassLoader) {
175
                if (parents[i] instanceof ProxyClassLoader) {
168
                    u = ((ProxyClassLoader)parents[i]).findResource(name);
176
                    u = ((ProxyClassLoader)parents[i]).findResource(name);
Lines 174-185 Link Here
174
            return findResource(name);
182
            return findResource(name);
175
        }
183
        }
176
        
184
        
177
        final int slashIdx = name.lastIndexOf('/');
178
        if (slashIdx == -1) return null;    // won't load from the default package
179
        final String pkg = name.substring(0, slashIdx);
180
        ClassLoader owner = (ClassLoader)domainsByPackage.get(pkg);
185
        ClassLoader owner = (ClassLoader)domainsByPackage.get(pkg);
181
186
182
        if (owner != null) { // known package
187
        if (owner != null) { // known package
188
            // Note that shouldDelegateResource should already be true for this!
183
            if (owner instanceof ProxyClassLoader) {
189
            if (owner instanceof ProxyClassLoader) {
184
                return ((ProxyClassLoader)owner).findResource(name); // we have its parents, skip them
190
                return ((ProxyClassLoader)owner).findResource(name); // we have its parents, skip them
185
	    } else {
191
	    } else {
Lines 191-203 Link Here
191
        URL retVal = null;
197
        URL retVal = null;
192
        for (int i = 0; i < parents.length; i++) {
198
        for (int i = 0; i < parents.length; i++) {
193
            owner = parents[i];
199
            owner = parents[i];
200
            if (!shouldDelegateResource(pkg, owner)) continue;
194
            if (owner instanceof ProxyClassLoader) {
201
            if (owner instanceof ProxyClassLoader) {
195
                retVal = ((ProxyClassLoader)owner).findResource(name); // skip parents (checked already)
202
                retVal = ((ProxyClassLoader)owner).findResource(name); // skip parents (checked already)
196
            } else {
203
            } else {
197
                retVal = owner.getResource(name); // know nothing about this loader and his structure
204
                retVal = owner.getResource(name); // know nothing about this loader and his structure
198
            }
205
            }
199
            if (retVal != null) {
206
            if (retVal != null) {
200
                domainsByPackage.put(pkg.replace('/', '.'), owner);
201
                domainsByPackage.put(pkg, owner);
207
                domainsByPackage.put(pkg, owner);
202
                return retVal;
208
                return retVal;
203
            }
209
            }
Lines 206-212 Link Here
206
        // try it ourself
212
        // try it ourself
207
        retVal = findResource(name);
213
        retVal = findResource(name);
208
        if (retVal != null) {
214
        if (retVal != null) {
209
            domainsByPackage.put(pkg.replace('/', '.'), this);
210
            domainsByPackage.put(pkg, this);
215
            domainsByPackage.put(pkg, this);
211
        }
216
        }
212
        return retVal;
217
        return retVal;
Lines 235-244 Link Here
235
     */    
240
     */    
236
    protected final synchronized Enumeration findResources(String name) throws IOException {
241
    protected final synchronized Enumeration findResources(String name) throws IOException {
237
        zombieCheck(name);
242
        zombieCheck(name);
243
        final int slashIdx = name.lastIndexOf('/');
244
        if (slashIdx == -1) return EmptyEnumeration.EMPTY; // won't load from the default package
245
        final String pkg = name.substring(0, slashIdx + 1);
246
238
        // Don't bother optimizing this call by domains.
247
        // Don't bother optimizing this call by domains.
239
        // It is mostly used for resources for which isSpecialResource would be true anyway.
248
        // It is mostly used for resources for which isSpecialResource would be true anyway.
240
        Enumeration[] es = new Enumeration[parents.length + 1];
249
        Enumeration[] es = new Enumeration[parents.length + 1];
241
        for (int i = 0; i < parents.length; i++) {
250
        for (int i = 0; i < parents.length; i++) {
251
            if (!shouldDelegateResource(pkg, parents[i])) {
252
                es[i] = EmptyEnumeration.EMPTY;
253
                continue;
254
            }
242
            if (parents[i] instanceof ProxyClassLoader) {
255
            if (parents[i] instanceof ProxyClassLoader) {
243
                es[i] = ((ProxyClassLoader)parents[i]).simpleFindResources(name);
256
                es[i] = ((ProxyClassLoader)parents[i]).simpleFindResources(name);
244
            } else {
257
            } else {
Lines 276-288 Link Here
276
     */
289
     */
277
    protected Package getPackage(String name) {
290
    protected Package getPackage(String name) {
278
        zombieCheck(name);
291
        zombieCheck(name);
292
        
293
        int idx = name.lastIndexOf('.');
294
        if (idx == -1) return null;
295
        String spkg = name.substring(0, idx + 1).replace('.', '/');
296
        
279
	synchronized (packages) {
297
	synchronized (packages) {
280
	    Package pkg = (Package)packages.get(name);
298
	    Package pkg = (Package)packages.get(name);
281
            if (pkg != null) return pkg;
299
            if (pkg != null) return pkg;
282
            
300
            
283
            for (int i = 0; i < parents.length; i++) {
301
            for (int i = 0; i < parents.length; i++) {
284
                ClassLoader par = parents[i];
302
                ClassLoader par = parents[i];
285
                if (par instanceof ProxyClassLoader) {
303
                if (par instanceof ProxyClassLoader && shouldDelegateResource(spkg, par)) {
286
                    pkg = ((ProxyClassLoader)par).getPackage(name);
304
                    pkg = ((ProxyClassLoader)par).getPackage(name);
287
                    if(pkg != null) break;
305
                    if(pkg != null) break;
288
                }
306
                }
Lines 322-327 Link Here
322
        for (int i = 0; i < parents.length; i++) {
340
        for (int i = 0; i < parents.length; i++) {
323
            ClassLoader par = parents[i];
341
            ClassLoader par = parents[i];
324
            if (par instanceof ProxyClassLoader) {
342
            if (par instanceof ProxyClassLoader) {
343
                // XXX should ideally use shouldDelegateResource here...
325
                addPackages(all, ((ProxyClassLoader)par).getPackages());
344
                addPackages(all, ((ProxyClassLoader)par).getPackages());
326
            }
345
            }
327
        }
346
        }
Lines 404-429 Link Here
404
    /** A method that finds a class either in itself or in parents.
423
    /** A method that finds a class either in itself or in parents.
405
     * It uses dual signaling for class not found: it can either return null
424
     * It uses dual signaling for class not found: it can either return null
406
     * or throw CNFE itself.
425
     * or throw CNFE itself.
407
     *
426
     * @param name class name, e.g. "org.netbeans.modules.foo.Clazz"
427
     * @param fileName resource name, e.g. "org/netbeans/modules/foo/Clazz.class"
428
     * @param pkg package component, e.g. "org/netbeans/modules/foo/"
408
     * @return a class or null if not found. It can also throw an exception.
429
     * @return a class or null if not found. It can also throw an exception.
409
     * @throws ClassNotFoundException in case it doesn't found a class
430
     * @throws ClassNotFoundException in case it doesn't found a class
410
     * and a parent eglible for loading it thrown it already.
431
     * and a parent eglible for loading it thrown it already.
411
     */
432
     */
412
    private final Class smartLoadClass(String name, final int dotIdx) throws ClassNotFoundException {
433
    private final Class smartLoadClass(String name, String fileName, String pkg) throws ClassNotFoundException {
413
	// First, check if the class has already been loaded
434
	// First, check if the class has already been loaded
414
	Class c = findLoadedClass(name);
435
	Class c = findLoadedClass(name);
415
	if(c != null) return c;
436
	if(c != null) return c;
416
        
437
        
417
        // next check the package caches
438
        final ClassLoader owner = isSpecialResource(pkg) ? null : (ClassLoader)domainsByPackage.get(pkg);
418
        final String pkg = name.substring(0, dotIdx);
439
        if (owner == this) {
419
        String fileName = name.replace('.', '/').concat(".class"); // NOI18N
440
            return simpleFindClass(name,fileName);
420
        
441
        }
421
        final ClassLoader owner = isSpecialResource(fileName) ? null : (ClassLoader)domainsByPackage.get(pkg);
442
        if (owner != null) {
422
          if (owner != null) {
443
            // Note that shouldDelegateResource should already be true as we hit this pkg before.
423
            if (owner instanceof ProxyClassLoader) {
444
            if (owner instanceof ProxyClassLoader) {
424
                if(owner == this) {
425
                    return simpleFindClass(name,fileName);
426
                }
427
                return ((ProxyClassLoader)owner).fullFindClass(name,fileName);
445
                return ((ProxyClassLoader)owner).fullFindClass(name,fileName);
428
            } else {
446
            } else {
429
                return owner.loadClass(name); // May throw CNFE, will be propagated
447
                return owner.loadClass(name); // May throw CNFE, will be propagated
Lines 431-451 Link Here
431
        }
449
        }
432
        
450
        
433
        // Virgin package, do the parent scan 
451
        // Virgin package, do the parent scan 
434
        c = loadInOrder(name,fileName);
452
        c = loadInOrder(name, fileName, pkg);
435
453
436
        if (c != null) {
454
        if (c != null) {
437
            final ClassLoader owner2 = c.getClassLoader(); // who got it?
455
            final ClassLoader owner2 = c.getClassLoader(); // who got it?
438
            domainsByPackage.put(pkg, owner2);
456
            domainsByPackage.put(pkg, owner2);
439
            domainsByPackage.put(pkg.replace('.', '/'), owner2);
440
        }
457
        }
441
        return c;
458
        return c;
442
    }
459
    }
443
    
460
    
444
    
461
    
445
    private final Class loadInOrder( String name, String fileName ) throws ClassNotFoundException {
462
    private final Class loadInOrder( String name, String fileName, String pkg ) throws ClassNotFoundException {
446
        ClassNotFoundException cached = null;
463
        ClassNotFoundException cached = null;
447
        for (int i = 0; i < parents.length; i++) {
464
        for (int i = 0; i < parents.length; i++) {
448
	    ClassLoader par = parents[i];
465
	    ClassLoader par = parents[i];
466
            if (!shouldDelegateResource(pkg, par)) continue;
449
	    if (par instanceof ProxyClassLoader) {
467
	    if (par instanceof ProxyClassLoader) {
450
		Class c = ((ProxyClassLoader)par).fullFindClass(name,fileName);
468
		Class c = ((ProxyClassLoader)par).fullFindClass(name,fileName);
451
                if (c != null) return c;
469
                if (c != null) return c;
Lines 478-495 Link Here
478
    
496
    
479
    /** Test whether a given resource name is something that any JAR might
497
    /** Test whether a given resource name is something that any JAR might
480
     * have, and for which the domain cache should be disabled.
498
     * have, and for which the domain cache should be disabled.
481
     * @param the tested resource name
499
     * The result must not change from one call to the next with the same argument.
500
     * By default the domain cache is disabled only for META-INF/* JAR information.
501
     * @param pkg the package component of the resource path ending with a slash,
502
     *        e.g. "org/netbeans/modules/foo/"
482
     * @return true if it is a special resource, false for normal domain-cached resource
503
     * @return true if it is a special resource, false for normal domain-cached resource
504
     * @since org.netbeans.core/1 1.3
483
     */
505
     */
484
    protected boolean isSpecialResource(String name) {
506
    protected boolean isSpecialResource(String pkg) {
485
        if (name.startsWith("META-INF/")) return true; // NOI18N
507
        if (pkg.startsWith("META-INF/")) return true; // NOI18N
486
        // XXX fix later!
487
        // Currently ICE browser JAR includes a copy of many XML classes, including
488
        // two classes in org.w3c.dom.events which are not in Xerces for some reason.
489
        // This is a temporary workaround to permit these two classes to be loaded
490
        // by the ICE browser even though there is package skew going on.
491
        if (name.startsWith("org/w3c/dom/events/")) return true; // NOI18N
492
        return false;
508
        return false;
509
    }
510
    
511
    /** Test whether a given resource request (for a class or not) should be
512
     * searched for in the specified parent classloader or not.
513
     * The result must not change from one call to the next with the same arguments.
514
     * By default, always true. Subclasses may override to "mask" certain
515
     * packages from view, possibly according to the classloader chain.
516
     * @param pkg the package component of the resource path ending with a slash,
517
     *        e.g. "org/netbeans/modules/foo/"
518
     * @param parent a classloader which is a direct or indirect parent of this one
519
     * @return true if the request should be delegated to this parent; false to
520
     *         only search elsewhere (other parents, this loader's own namespace)
521
     * @since org.netbeans.core/1 1.3
522
     */
523
    protected boolean shouldDelegateResource(String pkg, ClassLoader parent) {
524
        return true;
493
    }
525
    }
494
    
526
    
495
}
527
}
(-)debuggercore/src/org/netbeans/modules/debugger/support/nodes/DebuggerWindow.java (-3 / +6 lines)
Lines 119-127 Link Here
119
        cListener = new CListener ();
119
        cListener = new CListener ();
120
        setName (DebuggerNode.getLocalizedString ("CTL_Debugger_Window")); // NOI18N
120
        setName (DebuggerNode.getLocalizedString ("CTL_Debugger_Window")); // NOI18N
121
        setToolTipText(DebuggerNode.getLocalizedString ("CTL_Debugger_Window")); // NOI18N
121
        setToolTipText(DebuggerNode.getLocalizedString ("CTL_Debugger_Window")); // NOI18N
122
        setIcon (new ImageIcon (DebuggerWindow.class.getResource (
122
        try {
123
            "/org/netbeans/core/resources/debuggerView.gif" // NOI18N
123
            // XXX do not use core resources! must move to module
124
        )).getImage ());
124
            setIcon (new ImageIcon (new java.net.URL("nbresboot:/org/netbeans/core/resources/debuggerView.gif")).getImage ());
125
        } catch (java.net.MalformedURLException mfue) {
126
            mfue.printStackTrace();
127
        }
125
        GUIManager.getDefault ().addPropertyChangeListener (
128
        GUIManager.getDefault ().addPropertyChangeListener (
126
            new GUIManagerListener (this)
129
            new GUIManagerListener (this)
127
        );
130
        );
(-)editor/manifest.mf (+1 lines)
Lines 5-10 Link Here
5
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
5
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
6
OpenIDE-Module-Layer: org/netbeans/modules/editor/resources/layer.xml
6
OpenIDE-Module-Layer: org/netbeans/modules/editor/resources/layer.xml
7
OpenIDE-Module-IDE-Dependencies: IDE/1 > 1.24
7
OpenIDE-Module-IDE-Dependencies: IDE/1 > 1.24
8
OpenIDE-Module-Module-Dependencies: org.netbeans.core/1 > 1.0
8
Class-Path: ext/nb-editor.jar
9
Class-Path: ext/nb-editor.jar
9
10
10
Name: org/netbeans/modules/editor/java/JCUpdateAction.class
11
Name: org/netbeans/modules/editor/java/JCUpdateAction.class
(-)externaleditor/manifest.mf (-1 / +1 lines)
Lines 4-8 Link Here
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/externaleditor/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/externaleditor/Bundle.properties
5
OpenIDE-Module-Install: org/netbeans/modules/externaleditor/ExtEdModule.class
5
OpenIDE-Module-Install: org/netbeans/modules/externaleditor/ExtEdModule.class
6
OpenIDE-Module-IDE-Dependencies: IDE/1 > 1.33
6
OpenIDE-Module-IDE-Dependencies: IDE/1 > 1.33
7
OpenIDE-Module-Module-Dependencies: org.netbeans.modules.editor/1
7
OpenIDE-Module-Module-Dependencies: org.netbeans.modules.editor/1, org.netbeans.core/1 > 1.0
8
OpenIDE-Module-Layer: org/netbeans/modules/externaleditor/resources/mf-layer.xml
8
OpenIDE-Module-Layer: org/netbeans/modules/externaleditor/resources/mf-layer.xml
(-)form/manifest.mf (-1 / +1 lines)
Lines 4-10 Link Here
4
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
4
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
5
OpenIDE-Module-Install: org/netbeans/modules/form/FormEditorModule.class
5
OpenIDE-Module-Install: org/netbeans/modules/form/FormEditorModule.class
6
OpenIDE-Module-IDE-Dependencies: IDE/1 > 1.24
6
OpenIDE-Module-IDE-Dependencies: IDE/1 > 1.24
7
OpenIDE-Module-Module-Dependencies: org.netbeans.modules.java/1
7
OpenIDE-Module-Module-Dependencies: org.netbeans.modules.java/1, org.netbeans.core/1 > 1.0
8
OpenIDE-Module-Layer: org/netbeans/modules/form/resources/layer.xml
8
OpenIDE-Module-Layer: org/netbeans/modules/form/resources/layer.xml
9
Class-Path: ext/AbsoluteLayout.jar
9
Class-Path: ext/AbsoluteLayout.jar
10
10
(-)i18n/manifest.mf (-1 / +1 lines)
Lines 1-7 Link Here
1
OpenIDE-Module: org.netbeans.modules.i18n/1
1
OpenIDE-Module: org.netbeans.modules.i18n/1
2
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/i18n/Bundle.properties
2
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/i18n/Bundle.properties
3
OpenIDE-Module-IDE-Dependencies: IDE/1 > 1.24
3
OpenIDE-Module-IDE-Dependencies: IDE/1 > 1.24
4
OpenIDE-Module-Module-Dependencies: org.netbeans.modules.properties/1
4
OpenIDE-Module-Module-Dependencies: org.netbeans.modules.properties/1, org.netbeans.core/1 > 1.0
5
OpenIDE-Module-Specification-Version: 1.10
5
OpenIDE-Module-Specification-Version: 1.10
6
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
6
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
7
OpenIDE-Module-Layer: org/netbeans/modules/i18n/Layer.xml
7
OpenIDE-Module-Layer: org/netbeans/modules/i18n/Layer.xml
(-)jarpackager/manifest.mf (+1 lines)
Lines 2-7 Link Here
2
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jarpackager/Bundle.properties
2
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jarpackager/Bundle.properties
3
OpenIDE-Module-Display-Category: Tools
3
OpenIDE-Module-Display-Category: Tools
4
OpenIDE-Module-IDE-Dependencies: IDE/1 > 1.31
4
OpenIDE-Module-IDE-Dependencies: IDE/1 > 1.31
5
OpenIDE-Module-Package-Dependencies: org.apache.regexp[RE]
5
OpenIDE-Module-Specification-Version: 1.10
6
OpenIDE-Module-Specification-Version: 1.10
6
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
7
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
7
OpenIDE-Module-Layer: org/netbeans/modules/jarpackager/resources/mf-layer.xml
8
OpenIDE-Module-Layer: org/netbeans/modules/jarpackager/resources/mf-layer.xml
(-)java/manifest.mf (-1 / +1 lines)
Lines 5-11 Link Here
5
OpenIDE-Module-IDE-Dependencies: IDE/1 > 1.24
5
OpenIDE-Module-IDE-Dependencies: IDE/1 > 1.24
6
OpenIDE-Module-Specification-Version: 1.8
6
OpenIDE-Module-Specification-Version: 1.8
7
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
7
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
8
OpenIDE-Module-Package-Dependencies: [org.netbeans.modules.java.gj.JavaCompilerType], [org.netbeans.lib.javac.Main]
8
OpenIDE-Module-Package-Dependencies: [org.netbeans.modules.java.gj.JavaCompilerType], [org.netbeans.lib.javac.Main], org.apache.regexp[RE]
9
Class-Path: ext/javac.jar ext/java-gj.jar
9
Class-Path: ext/javac.jar ext/java-gj.jar
10
10
11
Name: org/netbeans/modules/java/JavaDataLoader.class
11
Name: org/netbeans/modules/java/JavaDataLoader.class
(-)objectbrowser/manifest.mf (-1 / +1 lines)
Lines 4-10 Link Here
4
OpenIDE-Module-Specification-Version: 1.8
4
OpenIDE-Module-Specification-Version: 1.8
5
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
5
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
6
OpenIDE-Module-Layer: org/netbeans/modules/objectbrowser/resources/mf-layer.xml
6
OpenIDE-Module-Layer: org/netbeans/modules/objectbrowser/resources/mf-layer.xml
7
OpenIDE-Module-Package-Dependencies: [javax.infobus.InfoBus]
7
OpenIDE-Module-Package-Dependencies: [javax.infobus.InfoBus], org.apache.regexp[RE]
8
Class-Path: ext/infobus.jar docs/objectbrowser-manual.zip
8
Class-Path: ext/infobus.jar docs/objectbrowser-manual.zip
9
OpenIDE-Module-IDE-Dependencies: IDE/1 > 1.24
9
OpenIDE-Module-IDE-Dependencies: IDE/1 > 1.24
10
10
(-)web/advanced/manifest.mf (-1 / +2 lines)
Lines 15-21 Link Here
15
   org.netbeans.modules.schema2beans/1,
15
   org.netbeans.modules.schema2beans/1,
16
   com.sun.forte4j.modules.depclass/1 > 2.0,
16
   com.sun.forte4j.modules.depclass/1 > 2.0,
17
   org.netbeans.modules.html/1,
17
   org.netbeans.modules.html/1,
18
   org.openidex.util/2
18
   org.openidex.util/2,
19
   org.netbeans.core/1 > 1.0
19
OpenIDE-Module-Description: org.netbeans.modules.web.ie.docs.jsp
20
OpenIDE-Module-Description: org.netbeans.modules.web.ie.docs.jsp
20
Class-Path: docs/jspie.jar
21
Class-Path: docs/jspie.jar
21
22
(-)web/taglibed/manifest.mf (-1 / +1 lines)
Lines 4-10 Link Here
4
OpenIDE-Module-Layer: org/netbeans/modules/web/taglibed/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/web/taglibed/layer.xml
5
OpenIDE-Module-Specification-Version: 1.5
5
OpenIDE-Module-Specification-Version: 1.5
6
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
6
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
7
OpenIDE-Module-Module-Dependencies: org.netbeans.modules.web.core/1, org.netbeans.modules.jarpackager/2, org.netbeans.modules.xml.core/1, org.netbeans.modules.servletapi/1
7
OpenIDE-Module-Module-Dependencies: org.netbeans.modules.web.core/1, org.netbeans.modules.jarpackager/2, org.netbeans.modules.xml.core/1, org.netbeans.modules.servletapi/1, org.netbeans.core/1 > 1.0
8
OpenIDE-Module-IDE-Dependencies: IDE/1 > 1.24
8
OpenIDE-Module-IDE-Dependencies: IDE/1 > 1.24
9
9
10
Name: org/netbeans/modules/web/taglibed/TLDLoader.class
10
Name: org/netbeans/modules/web/taglibed/TLDLoader.class
(-)webl/manifest.mf (-1 / +1 lines)
Lines 6-12 Link Here
6
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
6
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
7
OpenIDE-Module-Layer: org/netbeans/modules/webl/Layer.xml
7
OpenIDE-Module-Layer: org/netbeans/modules/webl/Layer.xml
8
OpenIDE-Module-Short-Description: Enables the IDE to work with WebL files..
8
OpenIDE-Module-Short-Description: Enables the IDE to work with WebL files..
9
OpenIDE-Module-Module-Dependencies: org.netbeans.modules.java/1 > 1.2
9
OpenIDE-Module-Module-Dependencies: org.netbeans.modules.java/1 > 1.2, org.netbeans.core/1 > 1.0
10
10
11
Name: org/netbeans/modules/webl/WebLDataLoader.class
11
Name: org/netbeans/modules/webl/WebLDataLoader.class
12
OpenIDE-Module-Class: Loader
12
OpenIDE-Module-Class: Loader
(-)workspaceswitcher/manifest.mf (+1 lines)
Lines 4-9 Link Here
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/comboswitcher/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/comboswitcher/Bundle.properties
5
OpenIDE-Module-Install: org/netbeans/modules/comboswitcher/ComboInstaller.class
5
OpenIDE-Module-Install: org/netbeans/modules/comboswitcher/ComboInstaller.class
6
OpenIDE-Module: org.netbeans.modules.comboswitcher
6
OpenIDE-Module: org.netbeans.modules.comboswitcher
7
OpenIDE-Module-Module-Dependencies: org.netbeans.core/1 > 1.0
7
OpenIDE-Module-Layer: org/netbeans/modules/comboswitcher/layer.xml
8
OpenIDE-Module-Layer: org/netbeans/modules/comboswitcher/layer.xml
8
OpenIDE-Module-Name: Workspace Combo Switcher
9
OpenIDE-Module-Name: Workspace Combo Switcher
9
10

Return to bug 19622