Fixed weird logic intruced in commit r24568
authorWilliam Bourque <william.bourque@polymtl.ca>
Wed, 14 Apr 2010 21:43:55 +0000 (21:43 +0000)
committerWilliam Bourque <william.bourque@polymtl.ca>
Wed, 14 Apr 2010 21:43:55 +0000 (21:43 +0000)
org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventContent.java

index 8530ca17573aeddbe8021f4be9fc3bee3ad97057..3afb162ce4e8b639352c33b17c2acc32ef898193 100644 (file)
@@ -155,24 +155,27 @@ public class LttngEventContent extends TmfEventContent {
      */
     @Override
     public synchronized LttngEventField[] getFields() {
-        
-        
         if ( fFieldsMap.size() < fParentEvent.getType().getNbFields() ) {
                LttngEventField tmpField = null;
                LttngEventType tmpType = (LttngEventType)fParentEvent.getType();
                
                for ( int pos=0; pos<tmpType.getNbFields(); pos++ ) {
                    String name = null;
-                               try {
-                                       name = tmpType.getLabel(pos);
-                               } catch (TmfNoSuchFieldException e) {
-                               }
-                   JniEvent tmpEvent = ((LttngEvent)getEvent()).convertEventTmfToJni();
-                   
-                   if ( tmpEvent != null ) {
-                           Object newValue = tmpEvent.parseFieldByName(name);
-                           tmpField = new LttngEventField(this, name, newValue );
-                           fFieldsMap.put(name, tmpField);
+                               JniEvent tmpEvent = ((LttngEvent)getEvent()).convertEventTmfToJni();
+                               
+                               // tmpEvent == null probably mean there is a discrepancy between Eclipse and C library
+                               // An error was probably printed in convertEventTmfToJni() already, but keep in mind this is SERIOUS
+                               if ( tmpEvent != null ) {
+                                       try {
+                                               name = tmpType.getLabel(pos);
+                                       
+                                               Object newValue = tmpEvent.parseFieldByName(name);
+                                               tmpField = new LttngEventField(this, name, newValue );
+                                               fFieldsMap.put(name, tmpField);
+                                       }
+                                       catch (TmfNoSuchFieldException e) {
+                                               System.out.println("Invalid field position requested : " + pos + ", ignoring (getFields).");
+                                       }
                    }
                }
         }
@@ -192,13 +195,13 @@ public class LttngEventContent extends TmfEventContent {
         String label = null;
                try {
                        label = fParentEvent.getType().getLabel(position);
-               } catch (TmfNoSuchFieldException e) {
+                       
+                       returnedField = this.getField(label);
+               } 
+               catch (TmfNoSuchFieldException e) {
+                       System.out.println("Invalid field position requested : " + position + ", ignoring (getField).");
                }
         
-        if ( label != null ) {
-            returnedField = this.getField(label);
-        }
-        
         return returnedField;
     }
     
This page took 0.025302 seconds and 5 git commands to generate.