From ae3f93aef90e280a1711da4ac11342c011ba480d Mon Sep 17 00:00:00 2001 From: Jan Sievers Date: Mon, 17 Dec 2012 11:20:03 +0100 Subject: 331683 Publisher returns error status in case of invalid manifest - 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 --- .../p2/directorywatcher/RepositoryListener.java | 2 +- .../p2/extensionlocation/SiteListener.java | 2 +- .../p2/publisher/eclipse/BundlesAction.java | 130 ++++++++++++++++----- .../p2/publisher/eclipse/ConfigCUsAction.java | 3 +- .../build/publisher/GatherBundleAction.java | 2 +- .../equinox/internal/p2/publisher/Messages.java | 2 + .../internal/p2/publisher/messages.properties | 2 + .../tests/publisher/actions/BundlesActionTest.java | 26 ++++- .../eclipse/AddProgramArgumentActionTest.java | 8 +- .../eclipse/AddSourceBundleActionTest.java | 2 +- .../touchpoint/eclipse/CheckTrustActionTest.java | 2 +- .../tests/touchpoint/eclipse/ChmodActionTest.java | 4 +- .../touchpoint/eclipse/CollectActionTest.java | 2 +- .../touchpoint/eclipse/EclipseTouchpointTest.java | 4 +- .../eclipse/InstallBundleActionTest.java | 2 +- .../tests/touchpoint/eclipse/LinkActionTest.java | 4 +- .../touchpoint/eclipse/MarkStartedActionTest.java | 6 +- .../eclipse/RemoveProgramArgumentActionTest.java | 4 +- .../eclipse/RemoveSourceBundleActionTest.java | 2 +- .../eclipse/SetProgramPropertyActionTest.java | 4 +- .../eclipse/SetStartLevelActionTest.java | 6 +- .../eclipse/UninstallBundleActionTest.java | 2 +- .../bug331683/invalid/META-INF/MANIFEST.MF | 6 + .../testData/bug331683/valid/META-INF/MANIFEST.MF | 5 + .../p2/touchpoint/eclipse/PublisherUtil.java | 2 +- .../equinox/internal/p2/updatesite/UpdateSite.java | 2 +- 26 files changed, 171 insertions(+), 65 deletions(-) create mode 100644 bundles/org.eclipse.equinox.p2.tests/testData/bug331683/invalid/META-INF/MANIFEST.MF create mode 100644 bundles/org.eclipse.equinox.p2.tests/testData/bug331683/valid/META-INF/MANIFEST.MF 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 132e5f410..0f294aced 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 74e1307ef..3aac05499 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 39f079573..d34031d2e 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 manifest = loadManifest(bundleLocation); if (manifest == null) return null; return createBundleDescription(manifest, bundleLocation); } - public static Dictionary loadManifest(File bundleLocation) { + /** + * @deprecated use {@link #loadManifest(File)} instead. + */ + @Deprecated + public static Dictionary 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 loadManifest(File bundleLocation) throws IOException, BundleException { Dictionary manifest = basicLoadManifest(bundleLocation); if (manifest == null) return null; @@ -569,39 +607,41 @@ public class BundlesAction extends AbstractPublisherAction { return manifest; } - public static Dictionary basicLoadManifest(File bundleLocation) { + /** + * @deprecated use {@link #basicLoadManifest(File)} instead. + */ + @Deprecated + public static Dictionary 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 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 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 result = new ArrayList(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 e254cb021..38a7eaa38 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 manifest = BundlesAction.loadManifest(location); + Dictionary 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 ef8b7ca79..d82b422fc 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 manifest = basicLoadManifest(manifestRoot); + Dictionary 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 0b8f76634..a6623af38 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 6d1f30db8..aa28ffe16 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'' 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 c07bed42c..d26721632 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 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 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 a4adfc3b5..c3974abeb 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 0cf94af27..4160b0e06 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 4335a6aab..de6dc7fa4 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 28f6000cf..1f4479bd9 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 e1dc4156b..0891119c4 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 a8eebbc49..194066753 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 285cd62a5..e47341493 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 18069e9e7..c2153841a 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 84bf1dc56..245612353 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 14136d83b..0187a7e1d 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 321d11496..d86b3d742 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 c727822de..b9f1bfea4 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 371615c5b..7de00e543 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 7c705b562..ad84ace14 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 000000000..f9c02e827 --- /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 000000000..22caeecd7 --- /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 fa186eae4..b128f8e88 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 57533cb58..be6aeff2f 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 { -- cgit v1.2.3 From c847dee6f33950f48ecd1d8eca18729f6ffc470f Mon Sep 17 00:00:00 2001 From: Tobias Oberlies Date: Fri, 25 Jan 2013 12:57:00 +0100 Subject: 331683 Update bundle version for first change in Kepler - According to http://wiki.eclipse.org/Version_Numbering Bug: 331683 --- .../org.eclipse.equinox.p2.publisher.eclipse/META-INF/MANIFEST.MF | 2 +- bundles/org.eclipse.equinox.p2.publisher.eclipse/pom.xml | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.publisher.eclipse/META-INF/MANIFEST.MF index dce829dff..1bf34b7cd 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %bundleName Bundle-SymbolicName: org.eclipse.equinox.p2.publisher.eclipse;singleton:=true -Bundle-Version: 1.1.100.qualifier +Bundle-Version: 1.1.200.qualifier Bundle-Activator: org.eclipse.pde.internal.publishing.Activator Bundle-ActivationPolicy: lazy Bundle-Vendor: %providerName diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/pom.xml b/bundles/org.eclipse.equinox.p2.publisher.eclipse/pom.xml index 95497f149..24df8d766 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/pom.xml +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/pom.xml @@ -1,6 +1,5 @@ - 4.0.0 @@ -9,9 +8,9 @@ 0.0.1-SNAPSHOT ../../org.eclipse.equinox.p2.releng/org.eclipse.equinox.p2-parent - + org.eclipse.equinox.p2.publisher.eclipse - 1.1.100-SNAPSHOT + 1.1.200-SNAPSHOT eclipse-plugin -- cgit v1.2.3