diff options
author | DJ Houghton | 2008-09-01 15:17:01 +0000 |
---|---|---|
committer | DJ Houghton | 2008-09-01 15:17:01 +0000 |
commit | d37f8de52ee696d5dff89d1f14af000994c92e35 (patch) | |
tree | af579fe6b0ae07d934ba94ea64b09de93a431335 | |
parent | 4a974f67736c17082492cb969bbced7ffd79a825 (diff) | |
download | rt.equinox.p2-d37f8de52ee696d5dff89d1f14af000994c92e35.tar.gz rt.equinox.p2-d37f8de52ee696d5dff89d1f14af000994c92e35.tar.xz rt.equinox.p2-d37f8de52ee696d5dff89d1f14af000994c92e35.zip |
3 files changed, 29 insertions, 7 deletions
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..49999d0ee 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 @@ -9,6 +9,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 477aa0450..3e68f10a6 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 @@ -14,6 +14,8 @@ import java.io.File; import java.net.MalformedURLException; import java.net.URL; import java.util.*; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*; import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; @@ -221,7 +223,13 @@ public class RepositoryListener extends DirectoryChangeListener { IInstallableUnit iu = (IInstallableUnit) candidate; if (changes.contains(iu)) return true; - 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); } }; @@ -249,9 +257,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); + } } } } @@ -268,9 +282,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); + } } } // 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 |