Rename xxx.lttng to xxx.lttng.core
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.tests / stubs / org / eclipse / linuxtools / tmf / trace / TmfEventParserStub.java
index ceb98993f036077d430586a32e76405be1fbd97f..eab0891473a8abaebd56697eb45237f183bb1f7d 100644 (file)
@@ -30,6 +30,7 @@ import org.eclipse.linuxtools.tmf.parser.ITmfEventParser;
  * <p>
  * TODO: Implement me. Please.
  */
+@SuppressWarnings("nls")
 public class TmfEventParserStub implements ITmfEventParser {
 
     // ------------------------------------------------------------------------
@@ -60,7 +61,8 @@ public class TmfEventParserStub implements ITmfEventParser {
     // ------------------------------------------------------------------------
 
     static final String typePrefix = "Type-";
-    @SuppressWarnings("unchecked")
+    @Override
+       @SuppressWarnings("unchecked")
        public TmfEvent parseNextEvent(ITmfTrace eventStream, TmfContext context) throws IOException {
 
         if (! (eventStream instanceof TmfTraceStub)) {
@@ -72,44 +74,44 @@ public class TmfEventParserStub implements ITmfEventParser {
                String name = eventStream.getName();
                name = name.substring(name.lastIndexOf('/') + 1);
 
-        synchronized(stream) {
-               long location = 0;
-               if (context != null)
-                       location = ((TmfLocation<Long>) (context.getLocation())).getValue();
-               stream.seek(location);
-
-               try {
-                       long ts        = stream.readLong();
-                       String source  = stream.readUTF();
-                       String type    = stream.readUTF();
-                       @SuppressWarnings("unused")
-                       int reference  = stream.readInt();
-                       int typeIndex  = Integer.parseInt(type.substring(typePrefix.length()));
-                       String[] fields = new String[typeIndex];
-                       for (int i = 0; i < typeIndex; i++) {
-                               fields[i] = stream.readUTF();
-                       }
-
-                       String content = "[";
-                       if (typeIndex > 0) {
-                               content += fields[0];
-                       }
-                       for (int i = 1; i < typeIndex; i++) {
-                               content += ", " + fields[i];
-                       }
-                       content += "]";
-
-                       TmfEvent event = new TmfEvent(
-                                       new TmfTimestamp(ts, (byte) -3, 0),     // millisecs
-                                       new TmfEventSource(source),
-                                       fTypes[typeIndex],
-                                       new TmfEventReference(name));
-                               TmfEventContent cnt = new TmfEventContent(event, content);
-                               event.setContent(cnt);
-                               return event;
-               } catch (EOFException e) {
-               }
-        }
+               // no need to use synchronized since it's already cover by the calling method
+               
+               long location = 0;
+               if (context != null)
+                   location = ((TmfLocation<Long>) (context.getLocation())).getLocation();
+               stream.seek(location);
+
+               try {
+                   long ts        = stream.readLong();
+                   String source  = stream.readUTF();
+                   String type    = stream.readUTF();
+                   @SuppressWarnings("unused")
+                   int reference  = stream.readInt();
+                   int typeIndex  = Integer.parseInt(type.substring(typePrefix.length()));
+                   String[] fields = new String[typeIndex];
+                   for (int i = 0; i < typeIndex; i++) {
+                       fields[i] = stream.readUTF();
+                   }
+
+                   String content = "[";
+                   if (typeIndex > 0) {
+                       content += fields[0];
+                   }
+                   for (int i = 1; i < typeIndex; i++) {
+                       content += ", " + fields[i];
+                   }
+                   content += "]";
+
+                   TmfEvent event = new TmfEvent(
+                           new TmfTimestamp(ts, (byte) -3, 0),     // millisecs
+                           new TmfEventSource(source),
+                           fTypes[typeIndex],
+                           new TmfEventReference(name));
+                   TmfEventContent cnt = new TmfEventContent(event, content);
+                   event.setContent(cnt);
+                   return event;
+               } catch (EOFException e) {
+               }
         return null;
     }
 
This page took 0.025119 seconds and 5 git commands to generate.