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 205678
Collapse All | Expand All

(-)a/core.netigso/src/org/netbeans/core/netigso/Netigso.java (-4 / +19 lines)
Lines 248-253 Link Here
248
            if (knownPkgs == EMPTY) {
248
            if (knownPkgs == EMPTY) {
249
                try {
249
                try {
250
                    SELF_QUERY.set(true);
250
                    SELF_QUERY.set(true);
251
                    String hints = (String)m.getAttribute("Hint-Packages");
252
                    if (hints != null) {
253
                        pkgs.addAll(Arrays.asList(hints.split(",")));
254
                        Object exported = m.getAttribute("Export-Package");
255
                        if (exported instanceof String) {
256
                            for (String p : exported.toString().split(",")) { // NOI18N
257
                                int semic = p.indexOf(';');
258
                                if (semic >= 0) {
259
                                    p = p.substring(0, semic);
260
                                }
261
                                pkgs.add(p);
262
                            }
263
                        }
264
                    }
265
                    /*
251
                    Enumeration en = b.findEntries("", null, true);
266
                    Enumeration en = b.findEntries("", null, true);
252
                    if (en == null) {
267
                    if (en == null) {
253
                        LOG.log(Level.INFO, "Bundle {0}: {1} is empty", new Object[] { b.getBundleId(), b.getSymbolicName() });
268
                        LOG.log(Level.INFO, "Bundle {0}: {1} is empty", new Object[] { b.getBundleId(), b.getSymbolicName() });
Lines 270-276 Link Here
270
                            }
285
                            }
271
                            pkgs.add(p);
286
                            pkgs.add(p);
272
                        }
287
                        }
273
                    }
288
                    }*/
274
                } finally {
289
                } finally {
275
                    SELF_QUERY.set(false);
290
                    SELF_QUERY.set(false);
276
                }
291
                }
Lines 291-299 Link Here
291
                LOG.log(Level.FINE, "Starting bundle {0}: {1}", new Object[] { m.getCodeNameBase(), start });
306
                LOG.log(Level.FINE, "Starting bundle {0}: {1}", new Object[] { m.getCodeNameBase(), start });
292
                if (start) {
307
                if (start) {
293
                    b.start();
308
                    b.start();
294
                    if (b.getState() == Bundle.INSTALLED && isRealBundle(b)) {
309
//                    if (b.getState() == Bundle.INSTALLED && isRealBundle(b)) {
295
                        throw new IOException("Cannot start " + m.getCodeName() + " state remains INSTALLED after start()"); // NOI18N
310
    //                    throw new IOException("Cannot start " + m.getCodeName() + " state remains INSTALLED after start()"); // NOI18N
296
                    }
311
  //                  }
297
                }
312
                }
298
            } catch (BundleException possible) {
313
            } catch (BundleException possible) {
299
                if (isRealBundle(b)) {
314
                if (isRealBundle(b)) {
(-)a/core.startup/src/org/netbeans/core/startup/NbInstaller.java (-8 / +1 lines)
Lines 73-86 Link Here
73
import java.util.jar.Manifest;
73
import java.util.jar.Manifest;
74
import java.util.logging.Level;
74
import java.util.logging.Level;
75
import java.util.logging.Logger;
75
import java.util.logging.Logger;
76
import org.netbeans.Events;
76
import org.netbeans.*;
77
import org.netbeans.InvalidException;
78
import org.netbeans.Module;
79
import org.netbeans.ModuleInstaller;
80
import org.netbeans.ModuleManager;
81
import org.netbeans.ProxyClassLoader;
82
import org.netbeans.Stamps;
83
import org.netbeans.Util;
84
import org.netbeans.core.startup.layers.ModuleLayeredFileSystem;
77
import org.netbeans.core.startup.layers.ModuleLayeredFileSystem;
85
import org.openide.filesystems.FileObject;
78
import org.openide.filesystems.FileObject;
86
import org.openide.filesystems.FileStateInvalidException;
79
import org.openide.filesystems.FileStateInvalidException;
(-)a/o.n.bootstrap/src/org/netbeans/JarClassLoader.java (-23 / +26 lines)
Lines 522-527 Link Here
522
            if (init != null) init.run();
522
            if (init != null) init.run();
523
            return callGet();
523
            return callGet();
524
        }
524
        }
525
526
        static void listCoveredPackages(JarFile src, Set<String> known, StringBuffer save) {
527
            Enumeration<JarEntry> en = src.entries();
528
            while (en.hasMoreElements()) {
529
                JarEntry je = en.nextElement();
530
                if (! je.isDirectory()) {
531
                    String itm = je.getName();
532
                    int slash = itm.lastIndexOf('/');
533
                    if (slash == -1) {
534
                        // resource in default package
535
                        String res = "default/" + je.getName();
536
                        if (known.add(res)) {
537
                            save.append(res).append(',');
538
                        }
539
                        continue;
540
                    }
541
                    String pkg = slash > 0 ? itm.substring(0, slash).replace('/','.') : "";
542
                    if (known.add(pkg)) save.append(pkg).append(',');
543
                    if (itm.startsWith("META-INF/")) {
544
                            String res = itm.substring(8); // "/services/pkg.Service"
545
                            if (known.add(res)) save.append(res).append(',');
546
                    }
547
                }
548
            }
549
        }
525
        
550
        
526
        private void releaseJarFile() {
551
        private void releaseJarFile() {
527
            synchronized(sources) {
552
            synchronized(sources) {
Lines 590-618 Link Here
590
        protected void listCoveredPackages(Set<String> known, StringBuffer save) {
615
        protected void listCoveredPackages(Set<String> known, StringBuffer save) {
591
            try {
616
            try {
592
                JarFile src = getJarFile("pkg");
617
                JarFile src = getJarFile("pkg");
593
618
                listCoveredPackages(src, known, save);
594
                Enumeration<JarEntry> en = src.entries();
595
                while (en.hasMoreElements()) {
596
                    JarEntry je = en.nextElement();
597
                    if (! je.isDirectory()) {
598
                        String itm = je.getName();
599
                        int slash = itm.lastIndexOf('/');
600
                        if (slash == -1) {
601
                            // resource in default package
602
                            String res = "default/" + je.getName();
603
                            if (known.add(res)) {
604
                                save.append(res).append(',');
605
                            }
606
                            continue;
607
                        }
608
                        String pkg = slash > 0 ? itm.substring(0, slash).replace('/','.') : "";
609
                        if (known.add(pkg)) save.append(pkg).append(',');
610
                        if (itm.startsWith("META-INF/")) {
611
                                String res = itm.substring(8); // "/services/pkg.Service"
612
                                if (known.add(res)) save.append(res).append(',');
613
                        }
614
                    }
615
                }
616
            } catch (ZipException x) { // Unix
619
            } catch (ZipException x) { // Unix
617
                if (warnedFiles.add(file)) {
620
                if (warnedFiles.add(file)) {
618
                    LOGGER.log(Level.INFO, "Cannot open " + file, x);
621
                    LOGGER.log(Level.INFO, "Cannot open " + file, x);
(-)a/o.n.bootstrap/src/org/netbeans/ModuleInstaller.java (+7 lines)
Lines 46-51 Link Here
46
46
47
import java.io.File;
47
import java.io.File;
48
import java.io.IOException;
48
import java.io.IOException;
49
import java.util.HashSet;
49
import java.util.List;
50
import java.util.List;
50
import java.util.Set;
51
import java.util.Set;
51
import java.util.jar.JarFile;
52
import java.util.jar.JarFile;
Lines 187-192 Link Here
187
        try {
188
        try {
188
            Manifest m = jarFile.getManifest();
189
            Manifest m = jarFile.getManifest();
189
            if (m == null) throw new IOException("No manifest found in " + jar); // NOI18N
190
            if (m == null) throw new IOException("No manifest found in " + jar); // NOI18N
191
            if (!m.getMainAttributes().containsKey("Covered-Packages")) { // NOI18N
192
                Set<String> known = new HashSet<String>();
193
                StringBuffer sb = new StringBuffer();
194
                JarClassLoader.JarSource.listCoveredPackages(jarFile, known, sb);
195
                m.getMainAttributes().putValue("Hint-Packages", sb.toString()); // NOI18N
196
            }
190
            return m;
197
            return m;
191
        } finally {
198
        } finally {
192
            jarFile.close();
199
            jarFile.close();

Return to bug 205678