Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeneviève Bastien2014-06-04 12:53:07 +0000
committerGenevieve Bastien2014-06-06 12:45:57 +0000
commit2e111d9fcdf559bf9ba0df6f74ac1e782f531097 (patch)
tree29a17d0bd62a663281e936b891e6b71626f5672d
parent87e6bc143b98a67425679afb81fc4b2166df1d06 (diff)
downloadorg.eclipse.linuxtools-2e111d9fcdf559bf9ba0df6f74ac1e782f531097.tar.gz
org.eclipse.linuxtools-2e111d9fcdf559bf9ba0df6f74ac1e782f531097.tar.xz
org.eclipse.linuxtools-2e111d9fcdf559bf9ba0df6f74ac1e782f531097.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 (cherry picked from commit c3c922bd0a9373bae387ef9b8c80d90ed8a4db9c) Reviewed-on: https://git.eclipse.org/r/27985
-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