SRADA-511: Fix incorrect remove of start rows in FileApiListTable.
authorMaria Guseva <m.guseva@samsung.com>
Fri, 27 May 2016 12:17:19 +0000 (15:17 +0300)
committerMaria Guseva <m.guseva@samsung.com>
Fri, 1 Jul 2016 08:24:02 +0000 (17:24 +0900)
Change-Id: I0dc97d42181c846ce663af515ec3fb9801d27de1

org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileApiListTable.java

index c1326f5..3487961 100644 (file)
@@ -29,6 +29,7 @@ package org.tizen.dynamicanalyzer.ui.file;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 
@@ -144,6 +145,7 @@ public class FileApiListTable extends DAApiListTableComposite {
                if (rs != null) {
                        try {
                                int i = -1;
+                               int indexToRemove = 0;
                                int index = 0;
                                while (rs.next()) {
                                        i++;
@@ -200,6 +202,9 @@ public class FileApiListTable extends DAApiListTableComposite {
                                                contentText.add("-");//$NON-NLS-1$
                                                contentData.add("-");//$NON-NLS-1$
 
+                                               // to remove start log from table
+                                               removeTableIndex.add(indexToRemove);
+
                                        } else if (fdApiType == LogCenterConstants.FD_API_TYPE_READ_END
                                                        || fdApiType == LogCenterConstants.FD_API_TYPE_WRITE_END
                                                        || fdApiType == LogCenterConstants.FD_API_TYPE_LOCK_END) {
@@ -227,8 +232,6 @@ public class FileApiListTable extends DAApiListTableComposite {
                                                        contentText.add(elapsedTime);
                                                        contentData.add(Long.toString(time - startTime));
 
-                                                       // to remove start log from table
-                                                       removeTableIndex.add(startLogIndex);
                                                } else {
                                                        // when having no start event(in case of running
                                                        // process), do not show
@@ -281,6 +284,7 @@ public class FileApiListTable extends DAApiListTableComposite {
                                                tableInput.setFailed(true);
                                        }
                                        input.add(tableInput);
+                                       indexToRemove++;
 
                                        if (time >= rangeStartTime && time <= rangeEndTime) {
                                                tableInput.setInRange(true);
@@ -293,13 +297,10 @@ public class FileApiListTable extends DAApiListTableComposite {
                        }
                }
 
-               int removeCount = 0;
+               Collections.sort(removeTableIndex, Collections.reverseOrder());
+
                for (int index : removeTableIndex) {
-                       int removeIndex = index - removeCount;
-                       if (removeIndex >= 0) {
-                               input.remove(removeIndex);
-                               removeCount++;
-                       }
+                       input.remove(index);
                }
 
                removeTableDataByFilterProperty(input, filterList);