Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeneviève Bastien2014-06-04 12:53:07 +0000
committerGenevieve Bastien2014-06-04 17:21:56 +0000
commitc3c922bd0a9373bae387ef9b8c80d90ed8a4db9c (patch)
treebe53ebce2bbc8d1b9f9067675d6e9d84fce39f08
parent7b3a06dfa3509afd060a378120c837b6b4df57b7 (diff)
downloadorg.eclipse.linuxtools-c3c922bd0a9373bae387ef9b8c80d90ed8a4db9c.tar.gz
org.eclipse.linuxtools-c3c922bd0a9373bae387ef9b8c80d90ed8a4db9c.tar.xz
org.eclipse.linuxtools-c3c922bd0a9373bae387ef9b8c80d90ed8a4db9c.zip
TMF: Bug 436576: Add null check on file field in XML state system module
Change-Id: If3eca378edd8e050114c0b14eebc7f943e28e5c5 Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net> Reviewed-on: https://git.eclipse.org/r/27929 Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Hudson CI
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/stateprovider/XmlStateSystemModule.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/stateprovider/XmlStateSystemModule.java b/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/stateprovider/XmlStateSystemModule.java
index bb59326623..66c8ee9a81 100644
--- a/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/stateprovider/XmlStateSystemModule.java
+++ b/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/stateprovider/XmlStateSystemModule.java
@@ -16,6 +16,7 @@ import java.util.List;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.linuxtools.tmf.analysis.xml.core.module.XmlUtils;
import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemAnalysisModule;
@@ -29,7 +30,7 @@ import org.w3c.dom.Element;
*/
public class XmlStateSystemModule extends TmfStateSystemAnalysisModule {
- private IPath fXmlFile;
+ private @Nullable IPath fXmlFile;
@Override
protected StateSystemBackendType getBackendType() {
@@ -45,7 +46,11 @@ public class XmlStateSystemModule extends TmfStateSystemAnalysisModule {
@Override
public String getName() {
String name = getId();
- Element doc = XmlUtils.getElementInFile(fXmlFile.makeAbsolute().toString(), TmfXmlStrings.STATE_PROVIDER, getId());
+ IPath xmlFile = fXmlFile;
+ if (xmlFile == null) {
+ return name;
+ }
+ Element doc = XmlUtils.getElementInFile(xmlFile.makeAbsolute().toString(), TmfXmlStrings.STATE_PROVIDER, getId());
/* Label may be available in XML header */
List<Element> head = XmlUtils.getChildElements(doc, TmfXmlStrings.HEAD);
if (head.size() == 1) {

Back to the top