Index: trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java	(revision 7452)
+++ trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java	(revision 7453)
@@ -42,8 +42,8 @@
 
 /**
- * Open a file chooser dialog and select an file to import. Then call the gpx-import driver. Finally
- * open an internal frame into the main window with the gpx data shown.
+ * Open a file chooser dialog and select a file to import.
  *
  * @author imi
+ * @since 1146
  */
 public class OpenFileAction extends DiskAccessAction {
@@ -94,7 +94,9 @@
 
     public static class OpenFileTask extends PleaseWaitRunnable {
-        private List<File> files;
-        private List<File> successfullyOpenedFiles = new ArrayList<>();
-        private FileFilter fileFilter;
+        private final List<File> files;
+        private final List<File> successfullyOpenedFiles = new ArrayList<>();
+        private final Set<String> fileHistory = new LinkedHashSet<>();
+        private final Set<String> failedAll = new HashSet<>();
+        private final FileFilter fileFilter;
         private boolean canceled;
         private boolean recordHistory = false;
@@ -269,23 +271,6 @@
                 Collections.reverse(importers);
 
-                Set<String> fileHistory = new LinkedHashSet<>();
-                Set<String> failedAll = new HashSet<>();
-
                 for (FileImporter importer : importers) {
-                    List<File> files = new ArrayList<>(importerMap.get(importer));
-                    importData(importer, files);
-                    // suppose all files will fail to load
-                    List<File> failedFiles = new ArrayList<>(files);
-
-                    if (recordHistory && !importer.isBatchImporter()) {
-                        // remove the files which didn't fail to load from the failed list
-                        failedFiles.removeAll(successfullyOpenedFiles);
-                        for (File f : successfullyOpenedFiles) {
-                            fileHistory.add(f.getCanonicalPath());
-                        }
-                        for (File f : failedFiles) {
-                            failedAll.add(f.getCanonicalPath());
-                        }
-                    }
+                    importData(importer, new ArrayList<>(importerMap.get(importer)));
                 }
 
@@ -304,13 +289,13 @@
                     }
                 }
-
-                if (recordHistory) {
-                    Collection<String> oldFileHistory = Main.pref.getCollection("file-open.history");
-                    fileHistory.addAll(oldFileHistory);
-                    // remove the files which failed to load from the list
-                    fileHistory.removeAll(failedAll);
-                    int maxsize = Math.max(0, Main.pref.getInteger("file-open.history.max-size", 15));
-                    Main.pref.putCollectionBounded("file-open.history", maxsize, fileHistory);
-                }
+            }
+
+            if (recordHistory) {
+                Collection<String> oldFileHistory = Main.pref.getCollection("file-open.history");
+                fileHistory.addAll(oldFileHistory);
+                // remove the files which failed to load from the list
+                fileHistory.removeAll(failedAll);
+                int maxsize = Math.max(0, Main.pref.getInteger("file-open.history.max-size", 15));
+                Main.pref.putCollectionBounded("file-open.history", maxsize, fileHistory);
             }
         }
@@ -334,4 +319,17 @@
                 }
             }
+            if (recordHistory && !importer.isBatchImporter()) {
+                for (File f : files) {
+                    try {
+                        if (successfullyOpenedFiles.contains(f)) {
+                            fileHistory.add(f.getCanonicalPath());
+                        } else {
+                            failedAll.add(f.getCanonicalPath());
+                        }
+                    } catch (IOException e) {
+                        Main.warn(e);
+                    }
+                }
+            }
         }
 
