Ignore:
Timestamp:
2016-04-09T23:24:01+02:00 (8 years ago)
Author:
Don-vip
Message:

refactor duplicated code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/ChangesetHeaderDownloadTask.java

    r10124 r10129  
    66import java.awt.Component;
    77import java.io.IOException;
    8 import java.lang.reflect.InvocationTargetException;
    98import java.util.Collection;
    109import java.util.Collections;
    1110import java.util.HashSet;
    1211import java.util.Set;
    13 
    14 import javax.swing.SwingUtilities;
    1512
    1613import org.openstreetmap.josm.Main;
     
    2017import org.openstreetmap.josm.io.OsmTransferException;
    2118import org.openstreetmap.josm.tools.CheckParameterUtil;
    22 import org.openstreetmap.josm.tools.ExceptionUtil;
    23 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler;
    2419import org.xml.sax.SAXException;
    2520
     
    7469                ExceptionDialogUtil.explainException(lastException);
    7570            }
    76             Runnable r = new Runnable() {
    77                 @Override
    78                 public void run() {
    79                     ChangesetCache.getInstance().update(downloadedChangesets);
    80                 }
    81             };
    82 
    83             if (SwingUtilities.isEventDispatchThread()) {
    84                 r.run();
    85             } else {
    86                 try {
    87                     SwingUtilities.invokeAndWait(r);
    88                 } catch (InterruptedException e) {
    89                     Main.warn("InterruptedException in "+getClass().getSimpleName()+" while updating changeset cache");
    90                 } catch (InvocationTargetException e) {
    91                     Throwable t = e.getTargetException();
    92                     if (t instanceof RuntimeException) {
    93                         BugReportExceptionHandler.handleException(t);
    94                     } else if (t instanceof Exception) {
    95                         ExceptionUtil.explainException(e);
    96                     } else {
    97                         BugReportExceptionHandler.handleException(t);
    98                     }
    99                 }
    100             }
     71            updateChangesets();
    10172        }
    10273    }
Note: See TracChangeset for help on using the changeset viewer.