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

(-)autoupdate/src/org/netbeans/modules/autoupdate/AutoupdateType.java (-8 / +12 lines)
Lines 7-13 Link Here
7
 * http://www.sun.com/
7
 * http://www.sun.com/
8
 * 
8
 * 
9
 * The Original Code is NetBeans. The Initial Developer of the Original
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
11
 * Microsystems, Inc. All Rights Reserved.
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
12
 */
13
13
Lines 65-80 Link Here
65
    * @return enumeration of <code>autoupdateType</code>s
65
    * @return enumeration of <code>autoupdateType</code>s
66
    */
66
    */
67
    public static Enumeration autoupdateTypes () {
67
    public static Enumeration autoupdateTypes () {
68
        Iterator it = Lookup.getDefault ().lookup ( new Lookup.Template( AutoupdateType.class ) ).allInstances().iterator();
68
        Collection col = Lookup.getDefault ().lookup ( new Lookup.Template( AutoupdateType.class ) ).allInstances();
69
        Iterator it = col.iterator();
69
        java.util.List lst = new ArrayList();
70
        java.util.List lst = new ArrayList();
70
        while ( it.hasNext() ) {
71
        while ( it.hasNext() ) {
71
            AutoupdateType at = (AutoupdateType)it.next();
72
            AutoupdateType at = (AutoupdateType)it.next();
72
            // XXX hack because of QuantumAutoupdateType from S1S
73
            if (at instanceof XMLAutoupdateType) {
73
            if ( at.displayName().equals(
74
                // don't add a unvalid XMLAutoupdateType
74
                    NbBundle.getBundle( Settings.class).getString("CTL_QuantumAutoupdateType_Name")))
75
                if (((XMLAutoupdateType) at).isValid ()) {
75
                lst.add(0,at);
76
                    lst.add (at);
76
            else
77
                }
77
                lst.add(at);             
78
            } else {
79
                // other types are added as default
80
                lst.add (at);
81
            }
78
        }
82
        }
79
        return Collections.enumeration( lst );
83
        return Collections.enumeration( lst );
80
    }
84
    }
(-)autoupdate/src/org/netbeans/modules/autoupdate/Bundle.properties (+1 lines)
Lines 75-80 Link Here
75
CTL_AutoupdateType_Name=Autoupdate Types
75
CTL_AutoupdateType_Name=Autoupdate Types
76
76
77
CTL_XMLAutoupdateType_Name=NetBeans Update Center
77
CTL_XMLAutoupdateType_Name=NetBeans Update Center
78
XMLAutoupdateType_InvalidSetting=Invalid: {0}
78
79
79
CTL_QuantumAutoupdateType_Name=Sun ONE Studio Update Center
80
CTL_QuantumAutoupdateType_Name=Sun ONE Studio Update Center
80
81
(-)autoupdate/src/org/netbeans/modules/autoupdate/XMLAutoupdateType.java (-14 / +33 lines)
Lines 7-13 Link Here
7
 * http://www.sun.com/
7
 * http://www.sun.com/
8
 * 
8
 * 
9
 * The Original Code is NetBeans. The Initial Developer of the Original
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
11
 * Microsystems, Inc. All Rights Reserved.
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
12
 */
13
13
Lines 69-74 Link Here
69
    
69
    
70
    /** Holds value of property localizing bundle in update center declaration. */
70
    /** Holds value of property localizing bundle in update center declaration. */
71
    private String localizingBundleName;
71
    private String localizingBundleName;
72
73
    private boolean valid = true;
72
    
74
    
73
    /** Creates new XMLAutoupdateType */
75
    /** Creates new XMLAutoupdateType */
74
    public XMLAutoupdateType() {
76
    public XMLAutoupdateType() {
Lines 248-253 Link Here
248
        return sb.toString();
250
        return sb.toString();
249
    }
251
    }
250
252
253
    boolean isValid () {
254
        return valid;
255
    }
256
251
    /** What to replace by what in URL string         
257
    /** What to replace by what in URL string         
252
    */
258
    */
253
    protected String getReplacement(String whatToReplace) {        
259
    protected String getReplacement(String whatToReplace) {        
Lines 291-306 Link Here
291
        return NbBundle.getBundle (XMLAutoupdateType.class);
297
        return NbBundle.getBundle (XMLAutoupdateType.class);
292
    }
298
    }
293
    
299
    
294
    private static ResourceBundle getBundleFromName (String name) {
300
    private static ResourceBundle getBundleFromName (String name) throws MissingResourceException {
295
        ResourceBundle bundle = null;
301
        ResourceBundle bundle = null;
296
        if (name == null) {
302
        if (name == null) {
297
            bundle = getOldLocalizingBundle ();
303
            bundle = getOldLocalizingBundle ();
298
        } else {
304
        } else {
299
            try {
305
            bundle = NbBundle.getBundle (name);
300
                bundle = NbBundle.getBundle (name);
301
            } catch (MissingResourceException mre) {
302
                ErrorManager.getDefault ().notify (mre);
303
            }
304
        }
306
        }
305
        return bundle;
307
        return bundle;
306
    }
308
    }
Lines 320-331 Link Here
320
    
322
    
321
    protected String getDefaultURL() {
323
    protected String getDefaultURL() {
322
        if ( defaultURL == null ) {
324
        if ( defaultURL == null ) {
323
            ResourceBundle remoteBundle = getBundleFromName (localizingBundleName);
325
            ResourceBundle remoteBundle = null;
324
            assert remoteBundle != null : "remoteBundle cannot be null for localizingBundleName: " + localizingBundleName;
325
            try {
326
            try {
327
                remoteBundle = getBundleFromName (localizingBundleName);
326
                defaultURL = url_key != null ? remoteBundle.getString( url_key ) : remoteBundle.getString( "URL_Default_N" );
328
                defaultURL = url_key != null ? remoteBundle.getString( url_key ) : remoteBundle.getString( "URL_Default_N" );
327
            } catch (MissingResourceException mre) {
329
            } catch (MissingResourceException mre) {
328
                defaultURL = "http://"; // XXX What set if the key is not in any bundle
330
                // non-existent localizingBundleName
331
                // the module which did this setting declaration, was removed
332
                // return null and ignore this setting
333
                this.valid = false;
334
                return null;
329
            }
335
            }
330
            //System.out.println(localizingBundleName + " for <" + url_key + "> returns " + defaultURL);
336
            //System.out.println(localizingBundleName + " for <" + url_key + "> returns " + defaultURL);
331
        }
337
        }
Lines 346-351 Link Here
346
            ClassNotFoundException {
352
            ClassNotFoundException {
347
        URL u = null;
353
        URL u = null;
348
        try {
354
        try {
355
            // initialy is valid
356
            valid = true;
357
349
            u = (URL)in.readObject();
358
            u = (URL)in.readObject();
350
            String display = (String)in.readObject();
359
            String display = (String)in.readObject();
351
            if (display != null)
360
            if (display != null)
Lines 370-379 Link Here
370
                throw ode;
379
                throw ode;
371
        }
380
        }
372
        
381
        
373
        if ( u == null || u.toString().startsWith("http://www.netbeans.org/updates/31_" ))  // NOI18N
382
        if ( u == null || u.toString().startsWith("http://www.netbeans.org/updates/31_" ))  { // NOI18N
374
            setURL(new URL( getDefaultURL() ));
383
            String urlSpec = getDefaultURL ();
375
        else
384
            if (urlSpec != null) {
376
            setURL(u);        
385
                setURL(new URL( urlSpec ));
386
            }
387
        } else {
388
            setURL(u);
389
        }
390
391
        if (! isValid ()) {
392
            setEnabled (false);
393
            displayName = NbBundle.getMessage (XMLAutoupdateType.class, "XMLAutoupdateType_InvalidSetting", displayName); // NOI18N
394
        }
395
377
    }
396
    }
378
    
397
    
379
}
398
}

Return to bug 72102