Index: trunk/src/org/openstreetmap/josm/io/OsmImporter.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmImporter.java	(revision 4685)
+++ trunk/src/org/openstreetmap/josm/io/OsmImporter.java	(revision 4686)
@@ -45,5 +45,5 @@
 
     protected void importData(InputStream in, final File associatedFile) throws IllegalDataException {
-        loadLayer(in, associatedFile, associatedFile.getName(), NullProgressMonitor.INSTANCE);
+        loadLayer(in, associatedFile, associatedFile == null ? OsmDataLayer.createNewName() : associatedFile.getName(), NullProgressMonitor.INSTANCE);
         // FIXME: remove UI stuff from IO subsystem
         Runnable uiStuff = new Runnable() {
@@ -68,7 +68,14 @@
     public void loadLayer(InputStream in, final File associatedFile, final String layerName, ProgressMonitor progressMonitor) throws IllegalDataException {
         final DataSet dataSet = OsmReader.parseDataSet(in, progressMonitor);
-        String name = associatedFile == null ? OsmDataLayer.createNewName() : associatedFile.getName();
-        layer = new OsmDataLayer(dataSet, layerName, associatedFile);
-        postLayerTask = new Runnable() {
+        layer = createLayer(dataSet, associatedFile, layerName);
+        postLayerTask = createPostLayerTask(dataSet, associatedFile, layerName);
+    }
+    
+    protected OsmDataLayer createLayer(final DataSet dataSet, final File associatedFile, final String layerName) {
+        return new OsmDataLayer(dataSet, layerName, associatedFile);
+    }
+    
+    protected Runnable createPostLayerTask(final DataSet dataSet, final File associatedFile, final String layerName) {
+        return new Runnable() {
             @Override
             public void run() {
