Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2014-03-01 08:58:43 +0000
committerEike Stepper2014-03-01 08:58:43 +0000
commitd2ad75a5d0caaf42015d0caa71d0dad1e17e8f2d (patch)
treed10f95d45c3ae6de66d0cd946a77547ade418e80
parent47ec83d86fd158b78181e77b9a008e38fc8e8d85 (diff)
downloadcdo-d2ad75a5d0caaf42015d0caa71d0dad1e17e8f2d.tar.gz
cdo-d2ad75a5d0caaf42015d0caa71d0dad1e17e8f2d.tar.xz
cdo-d2ad75a5d0caaf42015d0caa71d0dad1e17e8f2d.zip
[429181] [Oomph] NullPointerException in TargletTaskImpl.perform()
https://bugs.eclipse.org/bugs/show_bug.cgi?id=429181
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup.editor/src/org/eclipse/emf/cdo/releng/setup/presentation/ComponentModelWizard.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainer.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainerDescriptor.java35
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainerManager.java47
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainerUI.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/util/UpdateUtil.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/TargletTaskImpl.java3
7 files changed, 87 insertions, 40 deletions
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup.editor/src/org/eclipse/emf/cdo/releng/setup/presentation/ComponentModelWizard.java b/plugins/org.eclipse.emf.cdo.releng.setup.editor/src/org/eclipse/emf/cdo/releng/setup/presentation/ComponentModelWizard.java
index 910361a518..39e6af0939 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup.editor/src/org/eclipse/emf/cdo/releng/setup/presentation/ComponentModelWizard.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup.editor/src/org/eclipse/emf/cdo/releng/setup/presentation/ComponentModelWizard.java
@@ -132,7 +132,7 @@ public abstract class ComponentModelWizard extends Wizard implements INewWizard
}
else
{
- IWizardPage page = createPage();
+ IWizardPage page = createPage(file);
page.setTitle(getModelName());
page.setDescription("Create a new " + modelName + " file.");
@@ -231,7 +231,7 @@ public abstract class ComponentModelWizard extends Wizard implements INewWizard
protected abstract EObject createModel();
- protected abstract IWizardPage createPage();
+ protected abstract IWizardPage createPage(IFile file);
protected abstract String getErrorMessage(IFile file);
@@ -292,9 +292,11 @@ public abstract class ComponentModelWizard extends Wizard implements INewWizard
}
@Override
- protected IWizardPage createPage()
+ protected IWizardPage createPage(IFile file)
{
model = SetupFactory.eINSTANCE.createComponentDefinition();
+ model.setID(file.getProject().getName());
+ model.setVersion(Version.createOSGi(1, 0, 0));
return new WizardPage(getModelName())
{
@@ -412,7 +414,7 @@ public abstract class ComponentModelWizard extends Wizard implements INewWizard
}
@Override
- protected IWizardPage createPage()
+ protected IWizardPage createPage(IFile file)
{
return new WizardPage(getModelName())
{
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainer.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainer.java
index ce2a219378..0b867c81ac 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainer.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainer.java
@@ -829,6 +829,7 @@ public class TargletContainer extends AbstractBundleContainer
catch (Throwable t)
{
descriptor.rollbackUpdateTransaction(t, monitor);
+ Activator.log(t);
Activator.coreException(t);
}
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainerDescriptor.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainerDescriptor.java
index 877cb7fdc3..5fc0ecd238 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainerDescriptor.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainerDescriptor.java
@@ -178,9 +178,9 @@ public final class TargletContainerDescriptor implements Serializable, Comparabl
/**
* @author Eike Stepper
*/
- public static final class UpdateProblem implements Serializable
+ public static final class UpdateProblem implements Serializable, IStatus
{
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
private static final UpdateProblem[] NO_CHILDREN = {};
@@ -192,6 +192,8 @@ public final class TargletContainerDescriptor implements Serializable, Comparabl
private int code;
+ private Throwable exception;
+
private UpdateProblem[] children;
public UpdateProblem()
@@ -209,6 +211,7 @@ public final class TargletContainerDescriptor implements Serializable, Comparabl
message = status.getMessage();
severity = status.getSeverity();
code = status.getCode();
+ exception = status.getException();
IStatus[] statusChildren = status.getChildren();
if (statusChildren != null && statusChildren.length != 0)
@@ -242,14 +245,34 @@ public final class TargletContainerDescriptor implements Serializable, Comparabl
return code;
}
+ public Throwable getException()
+ {
+ return exception;
+ }
+
public UpdateProblem[] getChildren()
{
- return children == null ? NO_CHILDREN : children;
+ return isMultiStatus() ? children : NO_CHILDREN;
+ }
+
+ public boolean isMultiStatus()
+ {
+ return children != null;
+ }
+
+ public boolean isOK()
+ {
+ return severity == OK;
+ }
+
+ public boolean matches(int severityMask)
+ {
+ return (severity & severityMask) != 0;
}
public IStatus toStatus()
{
- if (children != null)
+ if (isMultiStatus())
{
IStatus[] statusChildren = new IStatus[children.length];
for (int i = 0; i < children.length; i++)
@@ -257,10 +280,10 @@ public final class TargletContainerDescriptor implements Serializable, Comparabl
statusChildren[i] = children[i].toStatus();
}
- return new MultiStatus(plugin, code, statusChildren, message, null);
+ return new MultiStatus(plugin, code, statusChildren, message, exception);
}
- return new Status(severity, plugin, code, message, null);
+ return new Status(severity, plugin, code, message, exception);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainerManager.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainerManager.java
index 1d90847a64..c58544962f 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainerManager.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainerManager.java
@@ -133,9 +133,17 @@ public final class TargletContainerManager extends P2
{
if (WORKSPACE_STATE_FILE.exists())
{
- descriptors = loadDescriptors(WORKSPACE_STATE_FILE);
+ try
+ {
+ descriptors = loadDescriptors(WORKSPACE_STATE_FILE);
+ }
+ catch (Exception ex)
+ {
+ Activator.log(ex);
+ }
}
- else
+
+ if (descriptors == null)
{
descriptors = new HashMap<String, TargletContainerDescriptor>();
}
@@ -151,27 +159,34 @@ public final class TargletContainerManager extends P2
IProfileRegistry profileRegistry = getProfileRegistry();
for (IProfile profile : profileRegistry.getProfiles())
{
- String workspace = profile.getProperty(PROP_TARGLET_CONTAINER_WORKSPACE);
- if (workspace != null)
+ try
{
- if (workspaces.add(workspace))
+ String workspace = profile.getProperty(PROP_TARGLET_CONTAINER_WORKSPACE);
+ if (workspace != null)
{
- File file = new File(workspace, WORKSPACE_STATE_RELATIVE_PATH);
- if (file.exists())
+ if (workspaces.add(workspace))
{
- Map<String, TargletContainerDescriptor> workspaceDescriptors = loadDescriptors(file);
- addWorkingDigests(workingDigests, workspaceDescriptors);
+ File file = new File(workspace, WORKSPACE_STATE_RELATIVE_PATH);
+ if (file.exists())
+ {
+ Map<String, TargletContainerDescriptor> workspaceDescriptors = loadDescriptors(file);
+ addWorkingDigests(workingDigests, workspaceDescriptors);
+ }
}
- }
- String digest = profile.getProperty(PROP_TARGLET_CONTAINER_DIGEST);
- if (!workingDigests.contains(digest))
- {
- String profileID = profile.getProfileId();
- profileRegistry.removeProfile(profileID);
- Activator.log("Profile " + profileID + " for workspace " + workspace + " removed");
+ String digest = profile.getProperty(PROP_TARGLET_CONTAINER_DIGEST);
+ if (!workingDigests.contains(digest))
+ {
+ String profileID = profile.getProfileId();
+ profileRegistry.removeProfile(profileID);
+ Activator.log("Profile " + profileID + " for workspace " + workspace + " removed");
+ }
}
}
+ catch (Exception ex)
+ {
+ Activator.log(ex);
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainerUI.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainerUI.java
index 68646c83bd..e51f785a7f 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainerUI.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletContainerUI.java
@@ -237,6 +237,10 @@ public class TargletContainerUI implements IAdapterFactory, ITargetLocationEdito
children.add(status);
parents.put(status, location);
+ // TODO Uncomment when bug 429373 is fixed
+ // children.add(updateProblem);
+ // parents.put(updateProblem, location);
+
if (descriptor.getWorkingDigest() != null)
{
IStatus info = Activator.getStatus("Location content is available from the last working profile.");
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/util/UpdateUtil.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/util/UpdateUtil.java
index 09b87a1401..7409b19e9d 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/util/UpdateUtil.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/util/UpdateUtil.java
@@ -82,18 +82,21 @@ public final class UpdateUtil extends Plugin
Set<URI> set = new LinkedHashSet<URI>(uris);
String list = profile.getProperty(PROP_REPO_LIST);
- StringTokenizer tokenizer = new StringTokenizer(list, ",");
- while (tokenizer.hasMoreTokens())
+ if (list != null)
{
- String uri = tokenizer.nextToken();
-
- try
- {
- set.add(new URI(uri));
- }
- catch (URISyntaxException ex)
+ StringTokenizer tokenizer = new StringTokenizer(list, ",");
+ while (tokenizer.hasMoreTokens())
{
- Activator.log(ex);
+ String uri = tokenizer.nextToken();
+
+ try
+ {
+ set.add(new URI(uri));
+ }
+ catch (URISyntaxException ex)
+ {
+ Activator.log(ex);
+ }
}
}
@@ -315,7 +318,7 @@ public final class UpdateUtil extends Plugin
public static Pair<String, List<IInstallableUnit>> getInstalledUnits(ProvisioningSession session,
String... iuPrefixes)
- {
+ {
IProvisioningAgent agent = session.getProvisioningAgent();
IProfileRegistry profileRegistry = (IProfileRegistry)agent.getService(IProfileRegistry.class.getName());
IProfile profile = profileRegistry.getProfile(IProfileRegistry.SELF);
@@ -346,7 +349,7 @@ public final class UpdateUtil extends Plugin
}
return Pair.create(profile.getProfileId(), ius);
- }
+ }
public static boolean hasPrefix(String id)
{
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/TargletTaskImpl.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/TargletTaskImpl.java
index 2f1b032ef6..016c183a28 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/TargletTaskImpl.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/TargletTaskImpl.java
@@ -772,8 +772,7 @@ public class TargletTaskImpl extends SetupTaskImpl implements TargletTask
UpdateProblem updateProblem = descriptor.getUpdateProblem();
if (updateProblem != null)
{
- IStatus status = updateProblem.toStatus();
- throw new CoreException(status);
+ throw new CoreException(updateProblem);
}
LoadTargetDefinitionJob job = new LoadTargetDefinitionJob(target);

Back to the top