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

(-)core/bootstrap/src/org/netbeans/Main.java (-2 / +2 lines)
Lines 38-45 Link Here
38
        // NbBundle or any other library compiled against java5 only
38
        // NbBundle or any other library compiled against java5 only
39
        // also prevent usage of java5 methods and classes
39
        // also prevent usage of java5 methods and classes
40
        try {
40
        try {
41
            Class.forName("java.lang.StringBuilder"); // NOI18N
41
            StringBuilder sb = new StringBuilder();
42
        } catch (ClassNotFoundException ex) {
42
        } catch (NoClassDefFoundError ex) {
43
            JOptionPane.showMessageDialog(
43
            JOptionPane.showMessageDialog(
44
                null,
44
                null,
45
                ResourceBundle.getBundle("org.netbeans.Bundle").getString("MSG_InstallJava5"),
45
                ResourceBundle.getBundle("org.netbeans.Bundle").getString("MSG_InstallJava5"),
(-)core/bootstrap/src/org/netbeans/Module.java (-25 / +55 lines)
Lines 270-277 Link Here
270
        }
270
        }
271
        try {
271
        try {
272
            // This has the side effect of checking syntax:
272
            // This has the side effect of checking syntax:
273
            if (codeName.indexOf(',') != -1) {
273
            try {
274
                throw new InvalidException("Illegal code name syntax parsing OpenIDE-Module: " + codeName); // NOI18N
274
                assert codeName.indexOf (',') == -1;
275
            } catch (AssertionError e) {
276
                throw new InvalidException("Illegal code name syntax " +
277
                    "in OpenIDE-Module: " + codeName); // NOI18N
275
            }
278
            }
276
            Dependency.create(Dependency.TYPE_MODULE, codeName);
279
            Dependency.create(Dependency.TYPE_MODULE, codeName);
277
            Object[] cnParse = Util.parseCodeName(codeName);
280
            Object[] cnParse = Util.parseCodeName(codeName);
Lines 292-314 Link Here
292
            // Token provides
295
            // Token provides
293
            String providesS = attr.getValue("OpenIDE-Module-Provides"); // NOI18N
296
            String providesS = attr.getValue("OpenIDE-Module-Provides"); // NOI18N
294
            if (providesS == null) {
297
            if (providesS == null) {
295
                provides = new String[] {};
298
                provides = new String[0];
296
            } else {
299
            } else {
297
                StringTokenizer tok = new StringTokenizer(providesS, ", "); // NOI18N
300
                provides = providesS.trim().split (",\\s+");
298
                provides = new String[tok.countTokens()];
301
                Set<String> dupTest = null;
299
                for (int i = 0; i < provides.length; i++) {
302
                assert (dupTest = new HashSet<String>()) != null;
300
                    String provide = tok.nextToken();
303
                for (String provide : provides) {
301
                    if (provide.indexOf(',') != -1) {
304
                    if (dupTest != null) {
302
                        throw new InvalidException("Illegal code name syntax parsing OpenIDE-Module-Provides: " + provide); // NOI18N
305
                        if (dupTest.contains(provides)) {
306
                            throw new IllegalArgumentException("Duplicate " +
307
                                "entries in OpenIDE-Module-Provides: " + 
308
                                providesS); // NOI18N
303
                    }
309
                    }
304
                    Dependency.create(Dependency.TYPE_MODULE, provide);
310
                        dupTest.add(provide);
305
                    if (provide.lastIndexOf('/') != -1) throw new IllegalArgumentException("Illegal OpenIDE-Module-Provides: " + provide); // NOI18N
306
                    provides[i] = provide;
307
                }
311
                }
308
                if (new HashSet<String>(Arrays.asList(provides)).size() < provides.length) {
312
                    try {
309
                    throw new IllegalArgumentException("Duplicate entries in OpenIDE-Module-Provides: " + providesS); // NOI18N
313
                        assert checkForIllegalCharacters (provide) == null : 
314
                            checkForIllegalCharacters (provide);
315
                    } catch (AssertionError e) {
316
                        throw new IllegalArgumentException (e);
310
                }
317
                }
318
                    Dependency.create(Dependency.TYPE_MODULE, provide);
311
            }
319
            }
320
            }
312
            String[] additionalProvides = mgr.refineProvides (this);
321
            String[] additionalProvides = mgr.refineProvides (this);
313
            if (additionalProvides != null) {
322
            if (additionalProvides != null) {
314
                if (provides == null) {
323
                if (provides == null) {
Lines 397-420 Link Here
397
                
406
                
398
                Util.err.warning("the module " + codeNameBase + " uses OpenIDE-Module-IDE-Dependencies which is deprecated. See http://openide.netbeans.org/proposals/arch/modularize.html"); // NOI18N
407
                Util.err.warning("the module " + codeNameBase + " uses OpenIDE-Module-IDE-Dependencies which is deprecated. See http://openide.netbeans.org/proposals/arch/modularize.html"); // NOI18N
399
            }
408
            }
400
            dependencies.addAll(Dependency.create(Dependency.TYPE_JAVA, attr.getValue("OpenIDE-Module-Java-Dependencies"))); // NOI18N
409
            provisionallyAddDep (dependencies, Dependency.TYPE_JAVA, "OpenIDE-Module-Java-Dependencies", attr);
401
            dependencies.addAll(Dependency.create(Dependency.TYPE_MODULE, attr.getValue("OpenIDE-Module-Module-Dependencies"))); // NOI18N
410
            provisionallyAddDep (dependencies, Dependency.TYPE_MODULE, "OpenIDE-Module-Module-Dependencies", attr);
402
            String pkgdeps = attr.getValue("OpenIDE-Module-Package-Dependencies"); // NOI18N
411
            provisionallyAddDep (dependencies, Dependency.TYPE_PACKAGE, "OpenIDE-Module-Package-Dependencies", attr);
403
            if (pkgdeps != null) {
412
            provisionallyAddDep (dependencies, Dependency.TYPE_REQUIRES, "OpenIDE-Module-Requires", attr);
404
                // XXX: Util.err.log(ErrorManager.WARNING, "Warning: module " + codeNameBase + " uses the OpenIDE-Module-Package-Dependencies manifest attribute, which is now deprecated: XXX URL TBD");
413
            provisionallyAddDep (dependencies, Dependency.TYPE_NEEDS, "OpenIDE-Module-Needs", attr);
405
                dependencies.addAll(Dependency.create(Dependency.TYPE_PACKAGE, pkgdeps)); // NOI18N
414
            provisionallyAddDep (dependencies, Dependency.TYPE_RECOMMENDS, "OpenIDE-Module-Recommends", attr);
406
            }
407
            dependencies.addAll(Dependency.create(Dependency.TYPE_REQUIRES, attr.getValue("OpenIDE-Module-Requires"))); // NOI18N
408
            dependencies.addAll(Dependency.create(Dependency.TYPE_NEEDS, attr.getValue("OpenIDE-Module-Needs"))); // NOI18N
409
            dependencies.addAll(Dependency.create(Dependency.TYPE_RECOMMENDS, attr.getValue("OpenIDE-Module-Recommends"))); // NOI18N
410
            // Permit the concrete installer to make some changes:
411
            mgr.refineDependencies(this, dependencies);
415
            mgr.refineDependencies(this, dependencies);
412
            dependenciesA = dependencies.toArray(new Dependency[dependencies.size()]);
416
            dependenciesA = dependencies.toArray(new Dependency[dependencies.size()]);
413
        } catch (IllegalArgumentException iae) {
417
        } catch (IllegalArgumentException iae) {
414
            throw (InvalidException) new InvalidException("While parsing " + codeName + " a dependency attribute: " + iae.toString()).initCause(iae); // NOI18N
418
            throw (InvalidException) new InvalidException("While parsing " + codeName + " a dependency attribute: " + iae.toString()).initCause(iae); // NOI18N
415
        }
419
        }
420
        if (provides == null) {
421
            provides = new String[0];
416
    }
422
    }
423
    }
417
424
425
    private static String checkForIllegalCharacters(String provide) {
426
        char[] c = provide.toCharArray();
427
        for (char cc : c) {
428
            switch (cc) {
429
            case ',' :
430
                return "Illegal code name syntax in " +
431
                    "OpenIDE-Module-Provides: " + provide; // NOI18N
432
            case '/' :
433
                return "Illegal OpenIDE-Module-Provides: " + provide; // NOI18N
434
            default :
435
                continue;
436
            }
437
        }
438
        return null;
439
    }
440
            
441
    private void provisionallyAddDep (Set<Dependency> dependencies, int type, String key, Attributes attrs) {
442
        String val = attrs.getValue(key);
443
        if (val != null) {
444
            dependencies.addAll(Dependency.create(type, val));
445
        }
446
    }
447
418
    /** Get all JARs loaded by this module.
448
    /** Get all JARs loaded by this module.
419
     * Includes the module itself, any locale variants of the module,
449
     * Includes the module itself, any locale variants of the module,
420
     * any extensions specified with Class-Path, any locale variants
450
     * any extensions specified with Class-Path, any locale variants
(-)core/bootstrap/src/org/netbeans/ModuleManager.java (-1 / +3 lines)
Lines 1052-1058 Link Here
1052
    private void maybeAddToEnableList(Set<Module> willEnable, Set<Module> mightEnable, Module m, boolean okToFail) {
1052
    private void maybeAddToEnableList(Set<Module> willEnable, Set<Module> mightEnable, Module m, boolean okToFail) {
1053
        if (! missingDependencies(m).isEmpty()) {
1053
        if (! missingDependencies(m).isEmpty()) {
1054
            // Should never happen:
1054
            // Should never happen:
1055
            if (! okToFail) throw new IllegalStateException("Module was supposed to be OK: " + m); // NOI18N
1055
            if (! okToFail) throw new IllegalStateException("Module was supposed" +
1056
                " to be OK: " + m + " but is missing dependencies " + 
1057
                missingDependencies(m)); // NOI18N
1056
            // Cannot satisfy its dependencies, exclude it.
1058
            // Cannot satisfy its dependencies, exclude it.
1057
            return;
1059
            return;
1058
        }
1060
        }

Return to bug 116891