| author | Jan Sievers | 2012-12-17 05:20:03 (EST) |
|---|---|---|
| committer | Tobias Oberlies | 2013-01-25 08:23:42 (EST) |
| commit | ae3f93aef90e280a1711da4ac11342c011ba480d (patch) (side-by-side diff) | |
| tree | a491f66a2bbb94d1cee53e0bd02d3306eca7ca2e | |
| parent | c32f1112f9b3d28bd3208ddb11c54ef2010b5eac (diff) | |
| download | rt.equinox.p2-ae3f93aef90e280a1711da4ac11342c011ba480d.zip rt.equinox.p2-ae3f93aef90e280a1711da4ac11342c011ba480d.tar.gz rt.equinox.p2-ae3f93aef90e280a1711da4ac11342c011ba480d.tar.bz2 | |
331683 Publisher returns error status in case of invalid manifestv20130125-132342
- BundlesAction will now return a multi-status with severity error (and
details in child message(s)) in case of invalid MANIFEST or
IOException.
- Static helper methods createBundleDescription(), loadManifest() and
basicLoadManifest() now throw BundleException and IOException instead
of ignoring them.
- Added corresponding ...IgnoringExceptions() methods (and marked them
as deprecated) which preserve old behaviour and allow to adapt users
of these methods as they see fit.
Bug 331683
26 files changed, 171 insertions, 65 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 132e5f4..0f294ac 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 @@ -138,7 +138,7 @@ public class RepositoryListener extends DirectoryChangeListener { } private boolean processBundle(File file, boolean isDirectory, boolean isAddition) { - BundleDescription bundleDescription = BundlesAction.createBundleDescription(file); + BundleDescription bundleDescription = BundlesAction.createBundleDescriptionIgnoringExceptions(file); if (bundleDescription == null) return false; diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java index 74e1307..3aac054 100644 --- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java +++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java @@ -318,7 +318,7 @@ public class SiteListener extends DirectoryChangeListener { for (int i = 0; plugins != null && i < plugins.length; i++) { File bundleLocation = plugins[i]; if (bundleLocation.isDirectory() || bundleLocation.getName().endsWith(".jar")) { //$NON-NLS-1$ - BundleDescription description = BundlesAction.createBundleDescription(bundleLocation); + BundleDescription description = BundlesAction.createBundleDescriptionIgnoringExceptions(bundleLocation); if (description != null) { String id = description.getSymbolicName(); String version = description.getVersion().toString(); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java index 39f0795..d34031d 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java @@ -116,6 +116,7 @@ public class BundlesAction extends AbstractPublisherAction { private File[] locations; private BundleDescription[] bundles; + protected MultiStatus finalStatus; public static IArtifactKey createBundleArtifactKey(String bsn, String version) { return new ArtifactKey(OSGI_BUNDLE_CLASSIFIER, bsn, Version.parseVersion(version)); @@ -552,14 +553,51 @@ public class BundlesAction extends AbstractPublisherAction { } } - public static BundleDescription createBundleDescription(File bundleLocation) { + /** + * @deprecated use {@link #createBundleDescription(File)} instead. + */ + @Deprecated + public static BundleDescription createBundleDescriptionIgnoringExceptions(File bundleLocation) { + try { + return createBundleDescription(bundleLocation); + } catch (IOException e) { + logWarning(bundleLocation, e); + return null; + } catch (BundleException e) { + logWarning(bundleLocation, e); + return null; + } + } + + private static void logWarning(File bundleLocation, Throwable t) { + String message = NLS.bind(Messages.exception_errorLoadingManifest, bundleLocation); + LogHelper.log(new Status(IStatus.WARNING, Activator.ID, message, t)); + } + + public static BundleDescription createBundleDescription(File bundleLocation) throws IOException, BundleException { Dictionary<String, String> manifest = loadManifest(bundleLocation); if (manifest == null) return null; return createBundleDescription(manifest, bundleLocation); } - public static Dictionary<String, String> loadManifest(File bundleLocation) { + /** + * @deprecated use {@link #loadManifest(File)} instead. + */ + @Deprecated + public static Dictionary<String, String> loadManifestIgnoringExceptions(File bundleLocation) { + try { + return loadManifest(bundleLocation); + } catch (IOException e) { + logWarning(bundleLocation, e); + return null; + } catch (BundleException e) { + logWarning(bundleLocation, e); + return null; + } + } + + public static Dictionary<String, String> loadManifest(File bundleLocation) throws IOException, BundleException { Dictionary<String, String> manifest = basicLoadManifest(bundleLocation); if (manifest == null) return null; @@ -569,39 +607,41 @@ public class BundlesAction extends AbstractPublisherAction { return manifest; } - public static Dictionary<String, String> basicLoadManifest(File bundleLocation) { + /** + * @deprecated use {@link #basicLoadManifest(File)} instead. + */ + @Deprecated + public static Dictionary<String, String> basicLoadManifestIgnoringExceptions(File bundleLocation) { + try { + return basicLoadManifest(bundleLocation); + } catch (IOException e) { + logWarning(bundleLocation, e); + return null; + } catch (BundleException e) { + logWarning(bundleLocation, e); + return null; + } + } + + public static Dictionary<String, String> basicLoadManifest(File bundleLocation) throws IOException, BundleException { InputStream manifestStream = null; ZipFile jarFile = null; - try { - if ("jar".equalsIgnoreCase(new Path(bundleLocation.getName()).getFileExtension()) && bundleLocation.isFile()) { //$NON-NLS-1$ - jarFile = new ZipFile(bundleLocation, ZipFile.OPEN_READ); - ZipEntry manifestEntry = jarFile.getEntry(JarFile.MANIFEST_NAME); - if (manifestEntry != null) { - manifestStream = jarFile.getInputStream(manifestEntry); - } - } else { - File manifestFile = new File(bundleLocation, JarFile.MANIFEST_NAME); - if (manifestFile.exists()) - manifestStream = new BufferedInputStream(new FileInputStream(manifestFile)); + if ("jar".equalsIgnoreCase(new Path(bundleLocation.getName()).getFileExtension()) && bundleLocation.isFile()) { //$NON-NLS-1$ + jarFile = new ZipFile(bundleLocation, ZipFile.OPEN_READ); + ZipEntry manifestEntry = jarFile.getEntry(JarFile.MANIFEST_NAME); + if (manifestEntry != null) { + manifestStream = jarFile.getInputStream(manifestEntry); + } + } else { + File manifestFile = new File(bundleLocation, JarFile.MANIFEST_NAME); + if (manifestFile.exists()) { + manifestStream = new BufferedInputStream(new FileInputStream(manifestFile)); } - } catch (IOException e) { - String message = NLS.bind(Messages.exception_errorLoadingManifest, bundleLocation); - LogHelper.log(new Status(IStatus.WARNING, Activator.ID, message, e)); } Dictionary<String, String> manifest = null; try { if (manifestStream != null) { - try { - manifest = parseBundleManifestIntoModifyableDictionaryWithCaseInsensitiveKeys(manifestStream); - } catch (IOException e) { - String message = NLS.bind(Messages.exception_errorReadingManifest, bundleLocation, e.getMessage()); - LogHelper.log(new Status(IStatus.ERROR, Activator.ID, message, e)); - return null; - } catch (BundleException e) { - String message = NLS.bind(Messages.exception_errorReadingManifest, bundleLocation, e.getMessage()); - LogHelper.log(new Status(IStatus.ERROR, Activator.ID, message, e)); - return null; - } + manifest = parseBundleManifestIntoModifyableDictionaryWithCaseInsensitiveKeys(manifestStream); } else { manifest = convertPluginManifest(bundleLocation, true); } @@ -668,6 +708,7 @@ public class BundlesAction extends AbstractPublisherAction { throw new IllegalStateException(Messages.exception_noBundlesOrLocations); setPublisherInfo(publisherInfo); + finalStatus = new MultiStatus(Activator.ID, IStatus.OK, Messages.message_bundlesPublisherMultistatus, null); try { if (bundles == null) @@ -677,6 +718,9 @@ public class BundlesAction extends AbstractPublisherAction { } catch (OperationCanceledException e) { return Status.CANCEL_STATUS; } + if (!finalStatus.isOK()) { + return finalStatus; + } return Status.OK_STATUS; } @@ -856,11 +900,21 @@ public class BundlesAction extends AbstractPublisherAction { } if (scIn) addSimpleConfigurator = false; - BundleDescription[] result = new BundleDescription[bundleLocations.length + (addSimpleConfigurator ? 1 : 0)]; + List<BundleDescription> result = new ArrayList<BundleDescription>(bundleLocations.length); for (int i = 0; i < bundleLocations.length; i++) { if (monitor.isCanceled()) throw new OperationCanceledException(); - result[i] = createBundleDescription(bundleLocations[i]); + BundleDescription description = null; + try { + description = createBundleDescription(bundleLocations[i]); + } catch (IOException e) { + addPublishingErrorToFinalStatus(e, bundleLocations[i]); + } catch (BundleException e) { + addPublishingErrorToFinalStatus(e, bundleLocations[i]); + } + if (description != null) { + result.add(description); + } } if (addSimpleConfigurator) { // Add simple configurator to the list of bundles @@ -870,13 +924,25 @@ public class BundlesAction extends AbstractPublisherAction { LogHelper.log(new Status(IStatus.INFO, Activator.ID, Messages.message_noSimpleconfigurator)); else { File location = FileLocator.getBundleFile(simpleConfigBundle); - result[result.length - 1] = createBundleDescription(location); + BundleDescription description = null; + try { + description = createBundleDescription(location); + } catch (BundleException e) { + addPublishingErrorToFinalStatus(e, location); + } + if (description != null) { + result.add(description); + } } } catch (IOException e) { e.printStackTrace(); } } - return result; + return result.toArray(new BundleDescription[0]); + } + + private void addPublishingErrorToFinalStatus(Throwable t, File bundleLocation) { + finalStatus.add(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.exception_errorPublishingBundle, bundleLocation, t.getMessage()), t)); } // This method is based on core.runtime's InternalPlatform.getBundle(...) with a difference just in how we get PackageAdmin diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java index e254cb0..38a7eaa 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java @@ -85,6 +85,7 @@ public class ConfigCUsAction extends AbstractPublisherAction { this.version = version; } + @Override public IStatus perform(IPublisherInfo publisherInfo, IPublisherResult results, IProgressMonitor monitor) { IPublisherResult innerResult = new PublisherResult(); this.outerResults = results; @@ -148,7 +149,7 @@ public class ConfigCUsAction extends AbstractPublisherAction { else { try { File location = new File(bundleInfo.getLocation()); - Dictionary<String, String> manifest = BundlesAction.loadManifest(location); + Dictionary<String, String> manifest = BundlesAction.loadManifestIgnoringExceptions(location); if (manifest == null) continue; GeneratorBundleInfo newInfo = new GeneratorBundleInfo(bundleInfo); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/build/publisher/GatherBundleAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/build/publisher/GatherBundleAction.java index ef8b7ca..d82b422 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/build/publisher/GatherBundleAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/build/publisher/GatherBundleAction.java @@ -50,7 +50,7 @@ public class GatherBundleAction extends BundlesAction { @Override protected BundleDescription[] getBundleDescriptions(File[] bundleLocations, IProgressMonitor monitor) { - Dictionary<String, String> manifest = basicLoadManifest(manifestRoot); + Dictionary<String, String> manifest = basicLoadManifestIgnoringExceptions(manifestRoot); if (manifest == null) return null; diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/Messages.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/Messages.java index 0b8f766..a6623af 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/Messages.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/Messages.java @@ -19,6 +19,7 @@ public class Messages extends NLS { public static String exception_stateAddition; public static String exception_errorReadingManifest; public static String exception_errorLoadingManifest; + public static String exception_errorPublishingBundle; public static String exception_errorLoadingProductFile; public static String exception_noPluginConverter; public static String exception_noArtifactRepo; @@ -31,6 +32,7 @@ public class Messages extends NLS { public static String exception_sourcePath; public static String exception_nonExistingJreLocationFile; + public static String message_bundlesPublisherMultistatus; public static String message_generatingMetadata; public static String message_generationCompleted; public static String message_noSimpleconfigurator; diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/messages.properties b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/messages.properties index 6d1f30d..aa28ffe 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/messages.properties +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/messages.properties @@ -13,6 +13,7 @@ exception_errorConverting = An error occurred while generating manifest for {0}. exception_stateAddition = An error has occurred while adding the bundle {0}. exception_errorReadingManifest = An error occurred while parsing the bundle manifest {0}: {1}. exception_errorLoadingManifest = An error occurred while loading the manifest {0}. +exception_errorPublishingBundle = An error occurred while publishing bundle {0}: {1} exception_noBundlesOrLocations=No bundles or locations provided. exception_noFeaturesOrLocations=No features or locations provided. exception_noPluginConverter=Unable to acquire PluginConverter service during generation for: {0}. @@ -23,6 +24,7 @@ exception_invalidSiteReferenceInFeature=Invalid site reference {0} in feature {1 exception_repoMustBeURL=Repository location ({0}) must be a URL. exception_sourcePath=Source location ({0}) must be a valid file-system path. exception_nonExistingJreLocationFile=Provided location to JRE \"{0}\" does not exist on the file system. +message_bundlesPublisherMultistatus=Messages while publishing bundles message_eeDuplicateVersionAttribute=Cannot specify both ''version:Version'' and ''version:List<Version>'' in one entry: {0} message_eeIgnoringNamespace=Ignoring unknown capability namespace ''{0}'' message_eeInvalidVersionAttribute=Syntax error in version ''{0}'' diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java index c07bed4..d267216 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java @@ -12,6 +12,12 @@ package org.eclipse.equinox.p2.tests.publisher.actions; import static org.easymock.EasyMock.*; +import static org.eclipse.equinox.p2.tests.publisher.actions.StatusMatchers.errorStatus; +import static org.eclipse.equinox.p2.tests.publisher.actions.StatusMatchers.statusWithMessageWhich; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; +import static org.junit.matchers.JUnitMatchers.containsString; +import static org.junit.matchers.JUnitMatchers.hasItem; import java.io.*; import java.util.*; @@ -437,9 +443,27 @@ public class BundlesActionTest extends ActionTest { return mockAdvice; } - public void testDynamicImport() { + public void testDynamicImport() throws Exception { File testData = getTestData("dymamicImport", "testData/dynamicImport"); IInstallableUnit iu = BundlesAction.createBundleIU(BundlesAction.createBundleDescription(testData), null, new PublisherInfo()); assertEquals(0, iu.getRequirements().size()); } + + public void testPublishBundlesWhereOneBundleIsInvalid() throws Exception { + File[] bundleLocations = new File(TestActivator.getTestDataFolder(), "bug331683").listFiles(); + testAction = new BundlesAction(bundleLocations); + setupPublisherResult(); + PublisherInfo info = new PublisherInfo(); + IStatus status = testAction.perform(info, publisherResult, new NullProgressMonitor()); + + // overall status shall be error... + assertThat(status, errorStatus()); + List<IStatus> childStatuses = Arrays.asList(status.getChildren()); + assertThat(childStatuses, hasItem(statusWithMessageWhich(containsString("The manifest line \"foo\" is invalid; it has no colon ':' character after the header key.")))); + assertThat(childStatuses.size(), is(1)); + + // ... but the valid bundle must still be published + Collection<IInstallableUnit> ius = publisherResult.getIUs("org.eclipse.p2.test.validManifest", IPublisherResult.ROOT); + assertThat(ius.size(), is(1)); + } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/AddProgramArgumentActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/AddProgramArgumentActionTest.java index a4adfc3..c3974ab 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/AddProgramArgumentActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/AddProgramArgumentActionTest.java @@ -64,7 +64,7 @@ public class AddProgramArgumentActionTest extends AbstractProvisioningTest { assertFalse(Arrays.asList(manipulator.getLauncherData().getProgramArgs()).contains(programArg)); } - public void testExecuteUndoWithArtifact() { + public void testExecuteUndoWithArtifact() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); @@ -117,7 +117,7 @@ public class AddProgramArgumentActionTest extends AbstractProvisioningTest { assertFalse(Arrays.asList(manipulator.getLauncherData().getProgramArgs()).contains(resolvedArtifact)); } - public void testExecuteUndoWithArtifactByProgramArgValue() { + public void testExecuteUndoWithArtifactByProgramArgValue() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); @@ -176,7 +176,7 @@ public class AddProgramArgumentActionTest extends AbstractProvisioningTest { assertFalse(Arrays.asList(manipulator.getLauncherData().getProgramArgs()).contains(resolvedArtifact)); } - public void testExecuteUndoWithArtifactLocation() { + public void testExecuteUndoWithArtifactLocation() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); @@ -229,7 +229,7 @@ public class AddProgramArgumentActionTest extends AbstractProvisioningTest { assertFalse(Arrays.asList(manipulator.getLauncherData().getProgramArgs()).contains(resolvedArtifact)); } - public void testExecuteUndoWithArtifactLocationByProgramArgValue() { + public void testExecuteUndoWithArtifactLocationByProgramArgValue() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/AddSourceBundleActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/AddSourceBundleActionTest.java index 0cf94af..4160b0e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/AddSourceBundleActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/AddSourceBundleActionTest.java @@ -39,7 +39,7 @@ public class AddSourceBundleActionTest extends AbstractProvisioningTest { super(""); } - public void testExecuteUndo() throws IOException { + public void testExecuteUndo() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CheckTrustActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CheckTrustActionTest.java index 4335a6a..de6dc7f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CheckTrustActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CheckTrustActionTest.java @@ -38,7 +38,7 @@ public class CheckTrustActionTest extends AbstractProvisioningTest { super(""); } - public void testExecuteUndo() { + public void testExecuteUndo() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/ChmodActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/ChmodActionTest.java index 28f6000..1f4479b 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/ChmodActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/ChmodActionTest.java @@ -104,7 +104,7 @@ public class ChmodActionTest extends AbstractProvisioningTest { } - public void testExecuteUndoWithArtifact() { + public void testExecuteUndoWithArtifact() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); @@ -182,7 +182,7 @@ public class ChmodActionTest extends AbstractProvisioningTest { action.undo(xparameters); } - public void testExecuteUndoWithArtifactLocation() { + public void testExecuteUndoWithArtifactLocation() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CollectActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CollectActionTest.java index e1dc415..0891119 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CollectActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CollectActionTest.java @@ -36,7 +36,7 @@ public class CollectActionTest extends AbstractProvisioningTest { super(""); } - public void testExecuteUndo() { + public void testExecuteUndo() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/EclipseTouchpointTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/EclipseTouchpointTest.java index a8eebbc..1940667 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/EclipseTouchpointTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/EclipseTouchpointTest.java @@ -115,7 +115,7 @@ public class EclipseTouchpointTest extends AbstractProvisioningTest { touchpoint.completeOperand(profile, parameters); } - public void testPrepareIU() { + public void testPrepareIU() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); @@ -153,7 +153,7 @@ public class EclipseTouchpointTest extends AbstractProvisioningTest { assertFalse(Boolean.valueOf(fullIU.getProperty(IInstallableUnit.PROP_PARTIAL_IU)).booleanValue()); } - public void testInstallPartialIU() { + public void testInstallPartialIU() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/InstallBundleActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/InstallBundleActionTest.java index 285cd62..e473414 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/InstallBundleActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/InstallBundleActionTest.java @@ -40,7 +40,7 @@ public class InstallBundleActionTest extends AbstractProvisioningTest { super(""); } - public void testExecuteUndo() { + public void testExecuteUndo() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/LinkActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/LinkActionTest.java index 18069e9..c215384 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/LinkActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/LinkActionTest.java @@ -67,7 +67,7 @@ public class LinkActionTest extends AbstractProvisioningTest { action.undo(parameters); } - public void testExecuteUndoWithArtifact() { + public void testExecuteUndoWithArtifact() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); @@ -112,7 +112,7 @@ public class LinkActionTest extends AbstractProvisioningTest { action.undo(parameters); } - public void testExecuteUndoWithArtifactLocation() { + public void testExecuteUndoWithArtifactLocation() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/MarkStartedActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/MarkStartedActionTest.java index 84bf1dc..2456123 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/MarkStartedActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/MarkStartedActionTest.java @@ -40,7 +40,7 @@ public class MarkStartedActionTest extends AbstractProvisioningTest { super(""); } - public void testExecuteUndo() { + public void testExecuteUndo() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); @@ -86,7 +86,7 @@ public class MarkStartedActionTest extends AbstractProvisioningTest { assertTrue(isMarkedStarted(manipulator, osgiTarget, false)); } - public void testExecuteUndoWithMissingArtifact() { + public void testExecuteUndoWithMissingArtifact() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); @@ -135,7 +135,7 @@ public class MarkStartedActionTest extends AbstractProvisioningTest { assertTrue(isMarkedStarted(manipulator, osgiTarget, false)); } - public void testExecuteOnFragmentBundleResultsInBundleNotBeingMarkedStarted() { + public void testExecuteOnFragmentBundleResultsInBundleNotBeingMarkedStarted() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/RemoveProgramArgumentActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/RemoveProgramArgumentActionTest.java index 14136d8..0187a7e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/RemoveProgramArgumentActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/RemoveProgramArgumentActionTest.java @@ -66,7 +66,7 @@ public class RemoveProgramArgumentActionTest extends AbstractProvisioningTest { assertTrue(Arrays.asList(manipulator.getLauncherData().getProgramArgs()).contains(programArg)); } - public void testExecuteUndoWithArtifact() { + public void testExecuteUndoWithArtifact() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); @@ -122,7 +122,7 @@ public class RemoveProgramArgumentActionTest extends AbstractProvisioningTest { assertTrue(Arrays.asList(manipulator.getLauncherData().getProgramArgs()).contains(resolvedArtifact)); } - public void testExecuteUndoWithArtifactLocation() { + public void testExecuteUndoWithArtifactLocation() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/RemoveSourceBundleActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/RemoveSourceBundleActionTest.java index 321d114..d86b3d7 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/RemoveSourceBundleActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/RemoveSourceBundleActionTest.java @@ -39,7 +39,7 @@ public class RemoveSourceBundleActionTest extends AbstractProvisioningTest { super(""); } - public void testExecuteUndo() throws IOException { + public void testExecuteUndo() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/SetProgramPropertyActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/SetProgramPropertyActionTest.java index c727822..b9f1bfe 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/SetProgramPropertyActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/SetProgramPropertyActionTest.java @@ -66,7 +66,7 @@ public class SetProgramPropertyActionTest extends AbstractProvisioningTest { assertFalse(manipulator.getConfigData().getProperties().containsKey(frameworkDependentPropertyName)); } - public void testExecuteUndoWithArtifact() { + public void testExecuteUndoWithArtifact() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); @@ -123,7 +123,7 @@ public class SetProgramPropertyActionTest extends AbstractProvisioningTest { assertTrue(manipulator.getConfigData().getProperty("test").equals(resolvedArtifact)); } - public void testExecuteUndoWithArtifactLocation() { + public void testExecuteUndoWithArtifactLocation() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/SetStartLevelActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/SetStartLevelActionTest.java index 371615c..7de00e5 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/SetStartLevelActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/SetStartLevelActionTest.java @@ -40,7 +40,7 @@ public class SetStartLevelActionTest extends AbstractProvisioningTest { super(""); } - public void testExecuteUndo() { + public void testExecuteUndo() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); @@ -86,7 +86,7 @@ public class SetStartLevelActionTest extends AbstractProvisioningTest { assertTrue(isStartLevel(manipulator, osgiTarget, -1)); } - public void testExecuteUndoWithMissingArtifact() { + public void testExecuteUndoWithMissingArtifact() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); @@ -135,7 +135,7 @@ public class SetStartLevelActionTest extends AbstractProvisioningTest { assertTrue(isStartLevel(manipulator, osgiTarget, -1)); } - public void testExecuteOnFragmentBundleResultsInBundleNotBeingMarkedStarted() { + public void testExecuteOnFragmentBundleResultsInBundleNotBeingMarkedStarted() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/UninstallBundleActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/UninstallBundleActionTest.java index 7c705b5..ad84ace 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/UninstallBundleActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/UninstallBundleActionTest.java @@ -40,7 +40,7 @@ public class UninstallBundleActionTest extends AbstractProvisioningTest { super(""); } - public void testExecuteUndo() { + public void testExecuteUndo() throws Exception { Properties profileProperties = new Properties(); File installFolder = getTempFolder(); profileProperties.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.toString()); diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/bug331683/invalid/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests/testData/bug331683/invalid/META-INF/MANIFEST.MF new file mode 100644 index 0000000..f9c02e8 --- a/dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/bug331683/invalid/META-INF/MANIFEST.MF @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.eclipse.p2.test.invalidManifestHeader +Bundle-Version: 1.0.0 +foo + diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/bug331683/valid/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests/testData/bug331683/valid/META-INF/MANIFEST.MF new file mode 100644 index 0000000..22caeec --- a/dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/bug331683/valid/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.eclipse.p2.test.validManifest +Bundle-Version: 1.0.0 + diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PublisherUtil.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PublisherUtil.java index fa186ea..b128f8e 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PublisherUtil.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PublisherUtil.java @@ -26,7 +26,7 @@ public class PublisherUtil { * if an IU could not be created. */ public static IInstallableUnit createBundleIU(IArtifactKey artifactKey, File bundleFile) { - BundleDescription bundleDescription = BundlesAction.createBundleDescription(bundleFile); + BundleDescription bundleDescription = BundlesAction.createBundleDescriptionIgnoringExceptions(bundleFile); if (bundleDescription == null) return null; PublisherInfo info = new PublisherInfo(); diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java index 57533cb..be6aeff 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java @@ -690,7 +690,7 @@ public class UpdateSite { LogHelper.log(new ProvisionException(transferResult)); return null; } - return BundlesAction.createBundleDescription(bundleFile); + return BundlesAction.createBundleDescriptionIgnoringExceptions(bundleFile); } catch (IOException e) { LogHelper.log(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.ErrorReadingBundle, bundleURI), e)); } finally { |

