Changeset 12814 in josm


Ignore:
Timestamp:
2017-09-10T12:57:18+02:00 (9 days ago)
Author:
Don-vip
Message:

fix #15282 - JOSM reloads multiple times a local style/validation file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/FileWatcher.java

    r12651 r12814  
    55import java.io.IOException;
    66import java.nio.file.FileSystems;
     7import java.nio.file.Files;
    78import java.nio.file.Path;
    89import java.nio.file.StandardWatchEventKinds;
     
    136137                Path fullPath = ((Path) key.watchable()).resolve(filename);
    137138
     139                try {
     140                    // Some filesystems fire two events when a file is modified. Skip first event (file is empty)
     141                    if (Files.size(fullPath) == 0) {
     142                        continue;
     143                    }
     144                } catch (IOException ex) {
     145                    Logging.error(ex);
     146                    continue;
     147                }
     148
    138149                synchronized (this) {
    139150                    StyleSource style = styleMap.get(fullPath);
Note: See TracChangeset for help on using the changeset viewer.