Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernd Hufmann2015-01-13 20:34:07 +0000
committerBernd Hufmann2015-01-28 11:19:24 +0000
commit599920a5802bfa078c242959dfe84c25bc566155 (patch)
treec6d689ab440f53d86dd124bd60fdcc2fddda489f
parentd36de10dd8f3c70d128dcb5f96a5dac40464d060 (diff)
downloadorg.eclipse.linuxtools-599920a5802bfa078c242959dfe84c25bc566155.tar.gz
org.eclipse.linuxtools-599920a5802bfa078c242959dfe84c25bc566155.tar.xz
org.eclipse.linuxtools-599920a5802bfa078c242959dfe84c25bc566155.zip
tmf: support preprocessing of in the TextTrace class Bug 458578
Change-Id: Idc9753d84679d909693f273298e0b573b939d51e Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com> Reviewed-on: https://git.eclipse.org/r/40467 Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com> Tested-by: Hudson CI Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com> Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/text/TextTrace.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/text/TextTrace.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/text/TextTrace.java
index cd48427d6c..44f82b07bf 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/text/TextTrace.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/text/TextTrace.java
@@ -25,6 +25,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.linuxtools.internal.tmf.core.Activator;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
@@ -96,6 +97,7 @@ public abstract class TextTrace<T extends TextTraceEvent> extends TmfTrace imple
String line = rafile.getNextLine();
List<Pattern> validationPatterns = getValidationPatterns();
while ((line != null) && (lineCount++ < MAX_LINES)) {
+ line = preProcessLine(line);
for(Pattern pattern : validationPatterns) {
Matcher matcher = pattern.matcher(line);
if (matcher.matches()) {
@@ -152,6 +154,7 @@ public abstract class TextTrace<T extends TextTraceEvent> extends TmfTrace imple
long rawPos = fFile.getFilePointer();
String line = fFile.getNextLine();
while (line != null) {
+ line = preProcessLine(line);
Matcher matcher = getFirstLinePattern().matcher(line);
if (matcher.matches()) {
setupContext(context, rawPos, line, matcher);
@@ -267,6 +270,7 @@ public abstract class TextTrace<T extends TextTraceEvent> extends TmfTrace imple
long rawPos = fFile.getFilePointer();
String line = fFile.getNextLine();
while (line != null) {
+ line = preProcessLine(line);
Matcher matcher = getFirstLinePattern().matcher(line);
if (matcher.matches()) {
setupContext(context, rawPos, line, matcher);
@@ -285,6 +289,20 @@ public abstract class TextTrace<T extends TextTraceEvent> extends TmfTrace imple
}
/**
+ * Pre-processes the input line. The default implementation returns the
+ * input line.
+ *
+ * @param line
+ * non-null input string
+ * @return the pre-processed input line
+ * @since 3.2
+ */
+ @NonNull
+ protected String preProcessLine(@NonNull String line) {
+ return line;
+ }
+
+ /**
* Gets the first line pattern.
*
* @return The first line pattern

Back to the top