Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2010-03-15 20:04:54 +0000
committerDJ Houghton2010-03-15 20:04:54 +0000
commit01a8019d71bc7bb1f7c5f1518404cecd9b9515da (patch)
tree2fff865b4dc62347579fb857dd8836a419bcf7d4
parentfc60fb8746a6a62422c2ae36804aeea70e190bd1 (diff)
downloadrt.equinox.p2-01a8019d71bc7bb1f7c5f1518404cecd9b9515da.tar.gz
rt.equinox.p2-01a8019d71bc7bb1f7c5f1518404cecd9b9515da.tar.xz
rt.equinox.p2-01a8019d71bc7bb1f7c5f1518404cecd9b9515da.zip
Bug 304994 - Null Pointer Exception when using P2 with RCP applicationR34x_v20100315-1600
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/Messages.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java44
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/messages.properties1
4 files changed, 46 insertions, 11 deletions
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF
index c118e8117..df4672270 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-SymbolicName: org.eclipse.equinox.p2.directorywatcher;singleton:=true
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
-Bundle-Version: 1.0.2.qualifier
+Bundle-Version: 1.0.3.qualifier
Import-Package: org.eclipse.equinox.internal.p2.core.helpers,
org.eclipse.equinox.internal.p2.metadata.generator.features,
org.eclipse.equinox.internal.provisional.p2.artifact.repository,
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/Messages.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/Messages.java
index 1c5ded922..a1bad8c97 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/Messages.java
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/Messages.java
@@ -1,3 +1,12 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 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 http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial implementation and ideas
+ ******************************************************************************/
package org.eclipse.equinox.internal.provisional.p2.directorywatcher;
import org.eclipse.osgi.util.NLS;
@@ -9,6 +18,7 @@ public class Messages extends NLS {
public static String error_processing;
public static String failed_create_artifact_repo;
public static String failed_create_metadata_repo;
+ public static String filename_missing;
public static String metadata_repo_manager_not_registered;
public static String multiple_bundle_ius;
public static String null_folder;
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java
index 04132b7db..692ae9615 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java
@@ -377,7 +377,13 @@ public class RepositoryListener extends DirectoryChangeListener {
if (!(candidate instanceof IInstallableUnit))
return false;
IInstallableUnit iu = (IInstallableUnit) candidate;
- File iuFile = new File(iu.getProperty(FILE_NAME));
+ String filename = iu.getProperty(FILE_NAME);
+ if (filename == null) {
+ String message = NLS.bind(Messages.filename_missing, "installable unit", iu.getId()); //$NON-NLS-1$
+ LogHelper.log(new Status(IStatus.ERROR, Activator.ID, message, null));
+ return false;
+ }
+ File iuFile = new File(filename);
return removedFiles.contains(iuFile);
}
};
@@ -394,9 +400,15 @@ public class RepositoryListener extends DirectoryChangeListener {
IArtifactDescriptor[] descriptors = artifactRepository.getArtifactDescriptors(key);
for (int i = 0; i < descriptors.length; i++) {
ArtifactDescriptor descriptor = (ArtifactDescriptor) descriptors[i];
- File artifactFile = new File(descriptor.getRepositoryProperty(FILE_NAME));
- if (removedFiles.contains(artifactFile))
- artifactRepository.removeDescriptor(descriptor);
+ String filename = descriptor.getRepositoryProperty(FILE_NAME);
+ if (filename == null) {
+ String message = NLS.bind(Messages.filename_missing, "artifact", descriptor.getArtifactKey()); //$NON-NLS-1$
+ LogHelper.log(new Status(IStatus.ERROR, Activator.ID, message, null));
+ } else {
+ File artifactFile = new File(filename);
+ if (removedFiles.contains(artifactFile))
+ artifactRepository.removeDescriptor(descriptor);
+ }
}
}
@@ -410,9 +422,15 @@ public class RepositoryListener extends DirectoryChangeListener {
Collector ius = metadataRepository.query(InstallableUnitQuery.ANY, new Collector(), null);
for (Iterator it = ius.iterator(); it.hasNext();) {
IInstallableUnit iu = (IInstallableUnit) it.next();
- File iuFile = new File(iu.getProperty(FILE_NAME));
- Long iuLastModified = new Long(iu.getProperty(FILE_LAST_MODIFIED));
- currentFiles.put(iuFile, iuLastModified);
+ String filename = iu.getProperty(FILE_NAME);
+ if (filename == null) {
+ String message = NLS.bind(Messages.filename_missing, "installable unit", iu.getId()); //$NON-NLS-1$
+ LogHelper.log(new Status(IStatus.ERROR, Activator.ID, message, null));
+ } else {
+ File iuFile = new File(filename);
+ Long iuLastModified = new Long(iu.getProperty(FILE_LAST_MODIFIED));
+ currentFiles.put(iuFile, iuLastModified);
+ }
}
}
@@ -423,9 +441,15 @@ public class RepositoryListener extends DirectoryChangeListener {
IArtifactDescriptor[] descriptors = artifactRepository.getArtifactDescriptors(key);
for (int i = 0; i < descriptors.length; i++) {
ArtifactDescriptor descriptor = (ArtifactDescriptor) descriptors[i];
- File artifactFile = new File(descriptor.getRepositoryProperty(FILE_NAME));
- Long artifactLastModified = new Long(descriptor.getRepositoryProperty(FILE_LAST_MODIFIED));
- currentFiles.put(artifactFile, artifactLastModified);
+ String filename = descriptor.getRepositoryProperty(FILE_NAME);
+ if (filename == null) {
+ String message = NLS.bind(Messages.filename_missing, "artifact", descriptor.getArtifactKey()); //$NON-NLS-1$
+ LogHelper.log(new Status(IStatus.ERROR, Activator.ID, message, null));
+ } else {
+ File artifactFile = new File(filename);
+ Long artifactLastModified = new Long(descriptor.getRepositoryProperty(FILE_LAST_MODIFIED));
+ currentFiles.put(artifactFile, artifactLastModified);
+ }
}
}
}
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/messages.properties b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/messages.properties
index 858807af3..db82ed280 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/messages.properties
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/messages.properties
@@ -3,6 +3,7 @@ error_main_loop=Error in watcher thread main loop.
error_processing=Error Processing: {0}
failed_create_artifact_repo=Could not create artifact repository for: {0}
failed_create_metadata_repo=Could not create metadata repository for: {0}
+filename_missing=The {0} {1} is missing the filename property.
metadata_repo_manager_not_registered=MetadataRepositoryManager not registered.
multiple_bundle_ius=There should be exactly one Bundle IU
null_folder=Folder must not be null

Back to the top