Bug 191783 NullPointerException in FeatureDownloader
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/Site.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/Site.java
index fd1b5ec..4066c12 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/Site.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/Site.java
@@ -7,11 +7,13 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * James D Miles (IBM Corp.) - bug 191783, NullPointerException in FeatureDownloader
*******************************************************************************/
package org.eclipse.update.core;
import java.net.*;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -78,7 +80,7 @@
private ISiteContentProvider siteContentProvider;
- private Map featureCache = new HashMap(); // key=URLKey value=IFeature
+ private Map featureCache = Collections.synchronizedMap(new HashMap()); // key=URLKey value=IFeature
/**
* Constructor for Site
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureModel.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureModel.java
index f83550c..ee9b03a 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureModel.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * James D Miles (IBM Corp.) - bug 191783, NullPointerException in FeatureDownloader
*******************************************************************************/
package org.eclipse.update.core.model;
@@ -897,12 +898,12 @@
if (resolved)
return;
- resolved = true;
// resolve local elements
localizedLabel = resolveNLString(bundleURL, label);
localizedProvider = resolveNLString(bundleURL, provider);
try {
imageURL = resolveURL(base,bundleURL, imageURLString);
+ resolved = true;
} catch (MalformedURLException e){
UpdateCore.warn("",e); //$NON-NLS-1$
}
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureReferenceModel.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureReferenceModel.java
index dda56ad..148b528 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureReferenceModel.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureReferenceModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * James D Miles (IBM Corp.) - bug 191783, NullPointerException in FeatureDownloader
*******************************************************************************/
package org.eclipse.update.core.model;
@@ -250,11 +251,11 @@
if (resolved)
return;
- resolved = true;
// resolve local elements
localizedLabel = resolveNLString(bundleURL, label);
try {
url = resolveURL(base, bundleURL, urlString);
+ resolved = true;
} catch (MalformedURLException e){
UpdateCore.warn("",e); //$NON-NLS-1$
}
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/UpdateSession.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/UpdateSession.java
index 2919f9d..9b2cb64 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/UpdateSession.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/UpdateSession.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,18 +7,20 @@
*
* Contributors:
* IBM - Initial API and implementation
+ * James D Miles (IBM Corp.) - bug 191783, NullPointerException in FeatureDownloader
*******************************************************************************/
package org.eclipse.update.internal.core;
import java.net.URL;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
public class UpdateSession {
private boolean enabled = false;
- private Set visitedURLs = new HashSet();
+ private Set visitedURLs = Collections.synchronizedSet(new HashSet());
UpdateSession() {
}
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/search/SiteSearchCategory.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/search/SiteSearchCategory.java
index bcbc8e6..0d8534f 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/search/SiteSearchCategory.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/search/SiteSearchCategory.java
@@ -8,7 +8,8 @@
* Contributors:
* IBM Corporation - initial API and implementation
* James D Miles (IBM Corp.) - bug 181375, ArrayIndexOutOfBoundsException in SiteSearchCategory$Query
-*******************************************************************************/
+ * James D Miles (IBM Corp.) - bug 191783, NullPointerException in FeatureDownloader
+ *******************************************************************************/
package org.eclipse.update.internal.search;
@@ -188,10 +189,11 @@
while (siteFeatureReferences.size() != 0) {
synchronized(siteFeatureReferences) {
- if (siteFeatureReferences.size() != 0) {
+ try{
siteFeatureReference = (ISiteFeatureReference)siteFeatureReferences.remove(0);
- } else {
+ }catch(IndexOutOfBoundsException e){
siteFeatureReference = null;
+ break;
}
}
if (siteFeatureReference != null) {