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

(-)a/src/jdk/nashorn/internal/runtime/ScriptLoader.java (-16 / +3 lines)
Lines 52-74 Link Here
52
    @Override
52
    @Override
53
    protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
53
    protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
54
        checkPackageAccess(name);
54
        checkPackageAccess(name);
55
        try {
55
        if (name.startsWith(NASHORN_PKG_PREFIX)) {
56
            return super.loadClass(name, resolve);
56
            return context.getSharedLoader().loadClass(name);
57
        } catch (final ClassNotFoundException | SecurityException e) {
58
            // We'll get ClassNotFoundException for Nashorn 'struct' classes.
59
            // Also, we'll get SecurityException for jdk.nashorn.internal.*
60
            // classes. So, load these using to context's 'shared' loader.
61
            // All these classes start with "jdk.nashorn.internal." prefix.
62
            try {
63
                if (name.startsWith(NASHORN_PKG_PREFIX)) {
64
                    return context.getSharedLoader().loadClass(name);
65
                }
66
            } catch (final ClassNotFoundException ignored) {
67
            }
68
69
            // throw the original exception from here
70
            throw e;
71
        }
57
        }
58
        return super.loadClass(name, resolve);
72
    }
59
    }
73
60
74
    // package-private and private stuff below this point
61
    // package-private and private stuff below this point

Return to bug 236704