Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Montplaisir2012-07-17 17:33:35 -0400
committerGerrit Code Review @ Eclipse.org2012-07-17 17:33:35 -0400
commit1859f913bd25ce9e9bc6267367982510c257eb75 (patch)
treed02f4a2e3c65132db4a18c262c9659f649575e32
parent30873160d6662720b5e673bd34d2016382209913 (diff)
parent898f2a91550eaf5f22cd95ea9d500ec4b1c71a28 (diff)
downloadorg.eclipse.linuxtools-1859f913bd25ce9e9bc6267367982510c257eb75.tar.gz
org.eclipse.linuxtools-1859f913bd25ce9e9bc6267367982510c257eb75.tar.xz
org.eclipse.linuxtools-1859f913bd25ce9e9bc6267367982510c257eb75.zip
Merge "lttng: Correctly validate traces of kernel type"
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.kernel.core/META-INF/MANIFEST.MF1
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/CtfKernelTrace.java20
2 files changed, 18 insertions, 3 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/META-INF/MANIFEST.MF b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/META-INF/MANIFEST.MF
index bb8e8cfbfe..c4e2cc2d5b 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/META-INF/MANIFEST.MF
+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/META-INF/MANIFEST.MF
@@ -10,6 +10,7 @@ Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0",
org.eclipse.core.resources;bundle-version="3.7.0",
+ org.eclipse.linuxtools.ctf.core;bundle-version="1.0.0",
org.eclipse.linuxtools.tmf.core;bundle-version="1.0.0"
Export-Package: org.eclipse.linuxtools.internal.lttng2.kernel.core;x-friends:="org.eclipse.linuxtools.lttng2.kernel.ui",
org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider;x-internal:=true,
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/CtfKernelTrace.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/CtfKernelTrace.java
index eba09db930..fb4f26d0e3 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/CtfKernelTrace.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/CtfKernelTrace.java
@@ -17,6 +17,8 @@ import java.io.File;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
+import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.CtfKernelStateInput;
import org.eclipse.linuxtools.tmf.core.TmfCommonConstants;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
@@ -47,11 +49,23 @@ public class CtfKernelTrace extends CtfTmfTrace {
@Override
public boolean validate(final IProject project, final String path) {
- if (!super.validate(project, path)) {
+ CTFTrace temp;
+ /*
+ * Make sure the trace is openable as a CTF trace. We do this here
+ * instead of calling super.validate() to keep the reference to "temp".
+ */
+ try {
+ temp = new CTFTrace(path);
+ } catch (CTFReaderException e) {
return false;
}
- /* Add extra checks specific to kernel traces here */
- return true;
+
+ /* Make sure the domain is "kernel" in the trace's env vars */
+ String dom = temp.getEnvironment().get("domain"); //$NON-NLS-1$
+ if (dom != null && dom.equals("\"kernel\"")) { //$NON-NLS-1$
+ return true;
+ }
+ return false;
}
@Override

Back to the top