tmf: Fix duplicate trace check in TmfOpenTraceHelper
authorPatrick Tasse <patrick.tasse@gmail.com>
Thu, 3 Dec 2015 18:33:13 +0000 (13:33 -0500)
committerPatrick Tasse <patrick.tasse@gmail.com>
Wed, 9 Dec 2015 23:30:36 +0000 (18:30 -0500)
If the provided path was a convoluted path which resolved to the same
path as an existing trace location of the same name, it was incorrectly
considered a different trace and renamed with a numbered suffix.

Change-Id: Ic802cd5ffd83c5a29e422dfddbb0463aca1b372a
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/62136
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Reviewed-by: Hudson CI
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfOpenTraceHelper.java

index 38d37be11422b05e333dcde161c600ce4cf6ae94..276ad402bcf6bbfc5465f8a81721756d45709fa5 100644 (file)
@@ -16,6 +16,7 @@
 package org.eclipse.tracecompass.tmf.ui.project.model;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.List;
 
 import org.eclipse.core.resources.IFile;
@@ -204,7 +205,12 @@ public class TmfOpenTraceHelper {
      */
     private static String getTraceName(String path, IFolder folder) {
         String name;
-        final File traceFile = new File(path);
+        File traceFile = new File(path);
+        try {
+            traceFile = traceFile.getCanonicalFile();
+        } catch (IOException e) {
+            /* just use original file path */
+        }
         name = traceFile.getName();
         for (int i = 2; isWrongMember(folder, name, traceFile); i++) {
             name = traceFile.getName() + '(' + i + ')';
This page took 0.025216 seconds and 5 git commands to generate.