From b950136a679ad621fda3a3bf4d7e1e89b1f5a5e4 Mon Sep 17 00:00:00 2001 From: Pascal Rapicault Date: Tue, 2 Nov 2010 21:40:20 +0000 Subject: Bug 321997 - P2 Publisher applications hide the exception which caused the ERROR result status --- .../org/eclipse/equinox/internal/p2/publisher/Messages.java | 2 ++ .../equinox/internal/p2/publisher/messages.properties | 2 ++ .../equinox/p2/publisher/AbstractPublisherApplication.java | 12 +++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) (limited to 'bundles/org.eclipse.equinox.p2.publisher') 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 1f74107d7..69287e4b1 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 @@ -31,6 +31,8 @@ public class Messages extends NLS { public static String message_generatingMetadata; public static String message_generationCompleted; public static String message_noSimpleconfigurator; + public static String message_resultException; + public static String message_publisherArguments; public static String exception_artifactRepoNoAppendDestroysInput; 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 80a800881..d7be89b26 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 @@ -24,6 +24,8 @@ exception_sourcePath=Source location ({0}) must be a valid file-system path. message_generatingMetadata = Generating metadata for {0}. message_generationCompleted = Generation completed with success [{0} seconds]. message_noSimpleconfigurator = Could not find simpleconfigurator bundle. +message_resultException=Product publishing ended with the following exception: +message_publisherArguments=Product publisher application was executed with the following arguments: exception_artifactRepoNoAppendDestroysInput = Not appending to artifact repository ({0}) may destroy input files. error_rootIU_generation = Could not generate root IU {0}, {1}, {2}.. exception_errorLoadingProductFile = An error has occurred while loading product file {0}. Exception details: {1}. \ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherApplication.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherApplication.java index 418de4492..6e3385e33 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherApplication.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherApplication.java @@ -251,9 +251,11 @@ public abstract class AbstractPublisherApplication implements IApplication { info = createPublisherInfo(); processCommandLineArguments(args, info); Object result = run(info); - if (result != IApplication.EXIT_OK) + if (result != IApplication.EXIT_OK) { + System.out.println(NLS.bind(Messages.message_publisherArguments, null)); for (int i = 0; i < args.length; i++) System.out.println(args[i]); + } return result; } catch (Exception e) { if (e.getMessage() != null) @@ -285,7 +287,15 @@ public abstract class AbstractPublisherApplication implements IApplication { System.out.println(NLS.bind(Messages.message_generationCompleted, String.valueOf((after - before) / 1000))); return IApplication.EXIT_OK; } + // TODO: improve the string representation of the result System.out.println(result); + Throwable th = result.getException(); + if (th != null) { + System.out.println(); + System.out.println(NLS.bind(Messages.message_resultException, null)); + th.printStackTrace(System.out); + System.out.println(); + } } catch (ProvisionException e) { status = e.getStatus(); if (status.getSeverity() == IStatus.ERROR && status.getMessage() != null) { -- cgit v1.2.3