Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Kaegi2008-04-07 15:53:07 -0400
committerSimon Kaegi2008-04-07 15:53:07 -0400
commit42540eafde1485e5f2f5a7ac5fa9c541f46148ab (patch)
tree440a08b06080e5c41a1034e9e1562b9457117f4e /bundles/org.eclipse.equinox.p2.directorywatcher
parent235f7cf73e928054c5d2bae3a624eeff7b6ac4a3 (diff)
downloadrt.equinox.p2-42540eafde1485e5f2f5a7ac5fa9c541f46148ab.tar.gz
rt.equinox.p2-42540eafde1485e5f2f5a7ac5fa9c541f46148ab.tar.xz
rt.equinox.p2-42540eafde1485e5f2f5a7ac5fa9c541f46148ab.zip
Adding null checks
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.directorywatcher')
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java12
1 files changed, 11 insertions, 1 deletions
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 2ffa581c0..ba5baf51c 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
@@ -270,7 +270,8 @@ public class RepositoryListener extends DirectoryChangeListener {
if (!snapshot.isEmpty()) {
IInstallableUnit[] iusToAdd = generateIUs(snapshot.keySet());
- metadataRepository.addInstallableUnits(iusToAdd);
+ if (iusToAdd.length != 0)
+ metadataRepository.addInstallableUnits(iusToAdd);
}
}
@@ -309,6 +310,9 @@ public class RepositoryListener extends DirectoryChangeListener {
protected IArtifactDescriptor generateArtifactDescriptor(File candidate) {
IArtifactDescriptor basicDescriptor = generateBasicDescriptor(candidate);
+ if (basicDescriptor == null)
+ return null;
+
ArtifactDescriptor pathDescriptor = new ArtifactDescriptor(basicDescriptor);
try {
pathDescriptor.setRepositoryProperty(ARTIFACT_REFERENCE, candidate.toURL().toExternalForm());
@@ -331,11 +335,15 @@ public class RepositoryListener extends DirectoryChangeListener {
if (isFeature(candidate)) {
FeatureParser parser = new FeatureParser();
Feature feature = parser.parse(candidate);
+ if (feature == null)
+ return null;
IArtifactKey featureKey = MetadataGeneratorHelper.createFeatureArtifactKey(feature.getId(), feature.getVersion());
return new ArtifactDescriptor(featureKey);
}
BundleDescription bundleDescription = bundleDescriptionFactory.getBundleDescription(candidate);
+ if (bundleDescription == null)
+ return null;
IArtifactKey key = MetadataGeneratorHelper.createBundleArtifactKey(bundleDescription.getSymbolicName(), bundleDescription.getVersion().toString());
return MetadataGeneratorHelper.createArtifactDescriptor(key, candidate, true, false);
}
@@ -369,6 +377,8 @@ public class RepositoryListener extends DirectoryChangeListener {
FeatureParser parser = new FeatureParser();
Feature feature = parser.parse(featureFile);
+ if (feature == null)
+ return null;
IInstallableUnit featureIU = MetadataGeneratorHelper.createFeatureJarIU(feature, true, props);
IInstallableUnit groupIU = MetadataGeneratorHelper.createGroupIU(feature, featureIU, props);

Back to the top