Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaxsun McCarthy Huggan2016-09-27 17:00:12 -0400
committerSam Davis2016-09-29 14:05:25 -0400
commit288789a96cd2c7017156b29118f3583f2b03affb (patch)
treea317e81e0159bee7821a1361edf10f59f5307db5
parent384acbe8f6281410589c59861cbe366a839db62f (diff)
downloadorg.eclipse.mylyn.tasks-288789a96cd2c7017156b29118f3583f2b03affb.tar.gz
org.eclipse.mylyn.tasks-288789a96cd2c7017156b29118f3583f2b03affb.tar.xz
org.eclipse.mylyn.tasks-288789a96cd2c7017156b29118f3583f2b03affb.zip
[3.21] 501993: fix NullPointerException in DefaultSupportHandler.getDescriptionR_3_21_0e_4_5_m_3_21_x
Change-Id: I17bbf252f1980c4631f02d8f1420cc9207f57a97 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=501993 Signed-off-by: Jaxsun McCarthy Huggan <jaxsun.mccarthy@tasktop.com>
-rw-r--r--org.eclipse.mylyn.tasks.bugs/src/org/eclipse/mylyn/internal/tasks/bugs/DefaultSupportHandler.java63
1 files changed, 26 insertions, 37 deletions
diff --git a/org.eclipse.mylyn.tasks.bugs/src/org/eclipse/mylyn/internal/tasks/bugs/DefaultSupportHandler.java b/org.eclipse.mylyn.tasks.bugs/src/org/eclipse/mylyn/internal/tasks/bugs/DefaultSupportHandler.java
index 4ae998830..c1860964f 100644
--- a/org.eclipse.mylyn.tasks.bugs/src/org/eclipse/mylyn/internal/tasks/bugs/DefaultSupportHandler.java
+++ b/org.eclipse.mylyn.tasks.bugs/src/org/eclipse/mylyn/internal/tasks/bugs/DefaultSupportHandler.java
@@ -80,10 +80,8 @@ public class DefaultSupportHandler extends AbstractSupportHandler {
}
}
if (response.getProduct() != null) {
- IBundleGroup bundleGroup = ((SupportProduct) response.getProduct()).getVersioningBundleGroup();
- if (bundleGroup == null) {
- bundleGroup = ((SupportProduct) response.getProduct()).getBundleGroup();
- }
+ SupportProduct supportProduct = (SupportProduct) response.getProduct();
+ IBundleGroup bundleGroup = getBundleGroup(supportProduct);
if (bundleGroup != null) {
TaskAttribute attribute = taskData.getRoot().getMappedAttribute(TaskAttribute.VERSION);
if (attribute != null) {
@@ -104,6 +102,14 @@ public class DefaultSupportHandler extends AbstractSupportHandler {
}
}
+ private IBundleGroup getBundleGroup(SupportProduct supportProduct) {
+ IBundleGroup bundleGroup = supportProduct.getVersioningBundleGroup();
+ if (bundleGroup == null) {
+ bundleGroup = supportProduct.getBundleGroup();
+ }
+ return bundleGroup;
+ }
+
private String getBestMatch(String version, Map<String, String> options) {
String match = ""; //$NON-NLS-1$
for (String option : options.values()) {
@@ -156,45 +162,19 @@ public class DefaultSupportHandler extends AbstractSupportHandler {
public String getDescription(IStatus status) {
if (status instanceof ProductStatus) {
SupportProduct product = (SupportProduct) ((ProductStatus) status).getProduct();
- if (product.getBundleGroup() != null) {
+ IBundleGroup bundleGroup = product.getBundleGroup();
+ if (bundleGroup != null) {
StringBuilder sb = new StringBuilder();
sb.append("\n\n\n"); //$NON-NLS-1$
sb.append(Messages.DefaultSupportHandler_Configuration_Details);
appendProductInformation(sb);
- sb.append("\n"); //$NON-NLS-1$
sb.append(Messages.DefaultSupportHandler_Installed_Features);
- sb.append("\n"); //$NON-NLS-1$
- for (IBundleGroup bundleGroup : new IBundleGroup[] { product.getBundleGroup() }) {
- sb.append(" "); //$NON-NLS-1$
- sb.append(bundleGroup.getIdentifier());
- sb.append(" "); //$NON-NLS-1$
- sb.append(bundleGroup.getVersion());
- sb.append("\n"); //$NON-NLS-1$
-
-// Bundle[] bundles = bundleGroup.getBundles();
-// if (bundles != null) {
-// for (Bundle bundle : bundles) {
-// sb.append(" "); //$NON-NLS-1$
-// sb.append(bundle.getSymbolicName());
-// String version = (String) bundle.getHeaders().get(
-// Messages.DefaultTaskContributor_Bundle_Version);
-// if (version != null) {
-// sb.append(" "); //$NON-NLS-1$
-// sb.append(version);
-// }
-// sb.append("\n"); //$NON-NLS-1$
-// }
-// }
+ appendBundleGroup(bundleGroup, sb);
+ IBundleGroup versioningBundleGroup = product.getVersioningBundleGroup();
+ if (versioningBundleGroup != null) {
+ sb.append(Messages.DefaultSupportHandler_VersioningPlugin);
+ appendBundleGroup(versioningBundleGroup, sb);
}
- sb.append(Messages.DefaultSupportHandler_VersioningPlugin);
- sb.append("\n"); //$NON-NLS-1$
- IBundleGroup bundleGroup = product.getVersioningBundleGroup();
- sb.append(" "); //$NON-NLS-1$
- sb.append(bundleGroup.getIdentifier());
- sb.append(" "); //$NON-NLS-1$
- sb.append(bundleGroup.getVersion());
- sb.append("\n"); //$NON-NLS-1$
-
return sb.toString();
}
} else if (status instanceof ErrorLogStatus) {
@@ -222,6 +202,15 @@ public class DefaultSupportHandler extends AbstractSupportHandler {
return null;
}
+ private void appendBundleGroup(IBundleGroup bundleGroup, StringBuilder sb) {
+ sb.append("\n"); //$NON-NLS-1$
+ sb.append(" "); //$NON-NLS-1$
+ sb.append(bundleGroup.getIdentifier());
+ sb.append(" "); //$NON-NLS-1$
+ sb.append(bundleGroup.getVersion());
+ sb.append("\n"); //$NON-NLS-1$
+ }
+
private void appendStatus(IStatus status, StringBuilder sb, boolean includeSessionData) {
Date date = (status instanceof ErrorLogStatus) ? ((ErrorLogStatus) status).getDate() : null;
appendErrorDetails(sb, status, date);

Back to the top