Index: autoupdate/src/org/netbeans/modules/autoupdate/AutoupdateType.java =================================================================== RCS file: /shared/data/ccvs/repository/autoupdate/src/org/netbeans/modules/autoupdate/AutoupdateType.java,v retrieving revision 1.17 diff -u -r1.17 AutoupdateType.java --- autoupdate/src/org/netbeans/modules/autoupdate/AutoupdateType.java 10 Mar 2005 14:47:52 -0000 1.17 +++ autoupdate/src/org/netbeans/modules/autoupdate/AutoupdateType.java 2 Mar 2006 14:18:31 -0000 @@ -7,7 +7,7 @@ * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original - * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun * Microsystems, Inc. All Rights Reserved. */ @@ -65,16 +65,20 @@ * @return enumeration of autoupdateTypes */ public static Enumeration autoupdateTypes () { - Iterator it = Lookup.getDefault ().lookup ( new Lookup.Template( AutoupdateType.class ) ).allInstances().iterator(); + Collection col = Lookup.getDefault ().lookup ( new Lookup.Template( AutoupdateType.class ) ).allInstances(); + Iterator it = col.iterator(); java.util.List lst = new ArrayList(); while ( it.hasNext() ) { AutoupdateType at = (AutoupdateType)it.next(); - // XXX hack because of QuantumAutoupdateType from S1S - if ( at.displayName().equals( - NbBundle.getBundle( Settings.class).getString("CTL_QuantumAutoupdateType_Name"))) - lst.add(0,at); - else - lst.add(at); + if (at instanceof XMLAutoupdateType) { + // don't add a unvalid XMLAutoupdateType + if (((XMLAutoupdateType) at).isValid ()) { + lst.add (at); + } + } else { + // other types are added as default + lst.add (at); + } } return Collections.enumeration( lst ); } Index: autoupdate/src/org/netbeans/modules/autoupdate/Bundle.properties =================================================================== RCS file: /shared/data/ccvs/repository/autoupdate/src/org/netbeans/modules/autoupdate/Bundle.properties,v retrieving revision 1.169 diff -u -r1.169 Bundle.properties --- autoupdate/src/org/netbeans/modules/autoupdate/Bundle.properties 16 Nov 2005 11:17:37 -0000 1.169 +++ autoupdate/src/org/netbeans/modules/autoupdate/Bundle.properties 2 Mar 2006 14:18:31 -0000 @@ -75,6 +75,7 @@ CTL_AutoupdateType_Name=Autoupdate Types CTL_XMLAutoupdateType_Name=NetBeans Update Center +XMLAutoupdateType_InvalidSetting=Invalid: {0} CTL_QuantumAutoupdateType_Name=Sun ONE Studio Update Center Index: autoupdate/src/org/netbeans/modules/autoupdate/XMLAutoupdateType.java =================================================================== RCS file: /shared/data/ccvs/repository/autoupdate/src/org/netbeans/modules/autoupdate/XMLAutoupdateType.java,v retrieving revision 1.34.4.1 diff -u -r1.34.4.1 XMLAutoupdateType.java --- autoupdate/src/org/netbeans/modules/autoupdate/XMLAutoupdateType.java 12 Dec 2005 09:30:20 -0000 1.34.4.1 +++ autoupdate/src/org/netbeans/modules/autoupdate/XMLAutoupdateType.java 2 Mar 2006 14:18:31 -0000 @@ -7,7 +7,7 @@ * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original - * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun * Microsystems, Inc. All Rights Reserved. */ @@ -69,6 +69,8 @@ /** Holds value of property localizing bundle in update center declaration. */ private String localizingBundleName; + + private boolean valid = true; /** Creates new XMLAutoupdateType */ public XMLAutoupdateType() { @@ -248,6 +250,10 @@ return sb.toString(); } + boolean isValid () { + return valid; + } + /** What to replace by what in URL string */ protected String getReplacement(String whatToReplace) { @@ -291,16 +297,12 @@ return NbBundle.getBundle (XMLAutoupdateType.class); } - private static ResourceBundle getBundleFromName (String name) { + private static ResourceBundle getBundleFromName (String name) throws MissingResourceException { ResourceBundle bundle = null; if (name == null) { bundle = getOldLocalizingBundle (); } else { - try { - bundle = NbBundle.getBundle (name); - } catch (MissingResourceException mre) { - ErrorManager.getDefault ().notify (mre); - } + bundle = NbBundle.getBundle (name); } return bundle; } @@ -320,12 +322,16 @@ protected String getDefaultURL() { if ( defaultURL == null ) { - ResourceBundle remoteBundle = getBundleFromName (localizingBundleName); - assert remoteBundle != null : "remoteBundle cannot be null for localizingBundleName: " + localizingBundleName; + ResourceBundle remoteBundle = null; try { + remoteBundle = getBundleFromName (localizingBundleName); defaultURL = url_key != null ? remoteBundle.getString( url_key ) : remoteBundle.getString( "URL_Default_N" ); } catch (MissingResourceException mre) { - defaultURL = "http://"; // XXX What set if the key is not in any bundle + // non-existent localizingBundleName + // the module which did this setting declaration, was removed + // return null and ignore this setting + this.valid = false; + return null; } //System.out.println(localizingBundleName + " for <" + url_key + "> returns " + defaultURL); } @@ -346,6 +352,9 @@ ClassNotFoundException { URL u = null; try { + // initialy is valid + valid = true; + u = (URL)in.readObject(); String display = (String)in.readObject(); if (display != null) @@ -370,10 +379,20 @@ throw ode; } - if ( u == null || u.toString().startsWith("http://www.netbeans.org/updates/31_" )) // NOI18N - setURL(new URL( getDefaultURL() )); - else - setURL(u); + if ( u == null || u.toString().startsWith("http://www.netbeans.org/updates/31_" )) { // NOI18N + String urlSpec = getDefaultURL (); + if (urlSpec != null) { + setURL(new URL( urlSpec )); + } + } else { + setURL(u); + } + + if (! isValid ()) { + setEnabled (false); + displayName = NbBundle.getMessage (XMLAutoupdateType.class, "XMLAutoupdateType_InvalidSetting", displayName); // NOI18N + } + } }