Catch exception if reading webbrowser favorites
[phpeclipse.git] / net.sourceforge.phpeclipse.webbrowser / src / net / sourceforge / phpeclipse / webbrowser / internal / WebBrowserPreference.java
index 2198585..f8eea79 100644 (file)
@@ -1,17 +1,21 @@
 /**
  * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved.   This program and the accompanying materials
+ * All rights reserved. � This program and the accompanying materials
  * are made available under the terms of the Common Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/cpl-v10.html
- *
+�*
  * Contributors:
  *    IBM - Initial API and implementation
  */
 package net.sourceforge.phpeclipse.webbrowser.internal;
 
-import java.util.*;
 import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.jface.preference.IPreferenceStore;
 /**
@@ -81,8 +85,12 @@ public class WebBrowserPreference {
                String temp = getPreferenceStore().getString(PREF_INTERNAL_WEB_BROWSER_FAVORITES);
                StringTokenizer st = new StringTokenizer(temp, "|*|");
                List l = new ArrayList();
-               while (st.hasMoreTokens()) {
-                       l.add(new Favorite(st.nextToken(), st.nextToken()));
+               try {
+                   while (st.hasMoreTokens()) {
+                           l.add(new Favorite(st.nextToken(), st.nextToken()));
+                   }
+               } catch (Exception e) {
+                 // ignore 
                }
                return l;
        }
@@ -96,10 +104,13 @@ public class WebBrowserPreference {
                String temp = store.getString(PREF_INTERNAL_WEB_BROWSER_OLD_FAVORITES);
                StringTokenizer st = new StringTokenizer(temp, "|*|");
                List def = new ArrayList();
-               while (st.hasMoreTokens()) {
-                       def.add(new Favorite(st.nextToken(), st.nextToken()));
-               }
-               
+               try {
+                   while (st.hasMoreTokens()) {
+                           def.add(new Favorite(st.nextToken(), st.nextToken()));
+                   }
+           } catch (Exception e) {
+             // ignore 
+           }
                List list = getInternalWebBrowserFavorites(); 
                Iterator iterator = WebBrowserUtil.getUnlockedFavorites().iterator();
                while (iterator.hasNext()) {