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

(-)org/netbeans/modules/extbrowser/URLUtil.java (-5 / +9 lines)
Lines 47-53 Link Here
47
            return null;
47
            return null;
48
48
49
        // return if the protocol is fine
49
        // return if the protocol is fine
50
        if (isAcceptableProtocol(url.getProtocol().toLowerCase(), allowJar))
50
        if (isAcceptableProtocol(url, allowJar))
51
            return url;
51
            return url;
52
        
52
        
53
        // remove the anchor
53
        // remove the anchor
Lines 96-102 Link Here
96
        while (instances.hasNext()) {
96
        while (instances.hasNext()) {
97
            URLMapper mapper = (URLMapper) instances.next();
97
            URLMapper mapper = (URLMapper) instances.next();
98
            retVal = mapper.getURL (fo, URLMapper.EXTERNAL);
98
            retVal = mapper.getURL (fo, URLMapper.EXTERNAL);
99
            if ((retVal != null) && isAcceptableProtocol(retVal.getProtocol().toLowerCase(), allowJar)) {
99
            if ((retVal != null) && isAcceptableProtocol(retVal, allowJar)) {
100
                // return if this is a 'file' or 'jar' URL
100
                // return if this is a 'file' or 'jar' URL
101
                String p = retVal.getProtocol().toLowerCase();
101
                String p = retVal.getProtocol().toLowerCase();
102
                if ("file".equals(p) || "jar".equals(p)) { // NOI18N
102
                if ("file".equals(p) || "jar".equals(p)) { // NOI18N
Lines 117-129 Link Here
117
    /** Returns true if the protocol is acceptable for usual web browsers.
117
    /** Returns true if the protocol is acceptable for usual web browsers.
118
     * Specifically, returns true for file, http and ftp protocols.
118
     * Specifically, returns true for file, http and ftp protocols.
119
     */
119
     */
120
    private static boolean isAcceptableProtocol(String protocol, boolean allowJar) {
120
    private static boolean isAcceptableProtocol(URL url, boolean allowJar) {
121
        String protocol = url.getProtocol().toLowerCase();
121
        if ("http".equals(protocol)          // NOI18N
122
        if ("http".equals(protocol)          // NOI18N
122
        ||  "ftp".equals(protocol)           // NOI18N
123
        ||  "ftp".equals(protocol)           // NOI18N
123
        ||  "file".equals(protocol))         // NOI18N
124
        ||  "file".equals(protocol))         // NOI18N
124
            return true;
125
            return true;
125
        if (allowJar && "jar".equals(protocol))
126
        if (allowJar && "jar".equals(protocol)) { // NOI18N
126
            return true;
127
            String urlString = url.toString();
128
            if (!urlString.toLowerCase().startsWith("jar:nbinst:")) // NOI18N
129
                return true;
130
        }
127
        
131
        
128
        return false;
132
        return false;
129
    }
133
    }

Return to bug 70784