Changeset 17332 in josm for trunk/src


Ignore:
Timestamp:
2020-11-23T16:01:19+01:00 (4 years ago)
Author:
Don-vip
Message:

fix #20131 - fix unit tests and codestyle violations

Location:
trunk/src/org/openstreetmap/josm
Files:
5 edited

Legend:

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

    r17330 r17332  
    124124        // multiple error object? prepare a HTML list
    125125        //
    126         if (!errors.isEmpty() && !GraphicsEnvironment.isHeadless()) {
     126        final Collection<String> items = task.getErrorMessages();
     127        if (!items.isEmpty() && !GraphicsEnvironment.isHeadless()) {
    127128            SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog(
    128129                    MainApplication.getMainFrame(),
    129                     "<html>"+Utils.joinAsHtmlUnorderedList(task.getErrorMessages())+"</html>",
     130                    "<html>"+Utils.joinAsHtmlUnorderedList(items)+"</html>",
    130131                    tr("Errors during download"),
    131132                    JOptionPane.ERROR_MESSAGE));
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r17283 r17332  
    765765        OsmPrimitive result = getPrimitiveById(primitiveId);
    766766        if (result == null && primitiveId != null) {
    767             Logging.warn(tr(
     767            Logging.error(new IllegalStateException(tr(
    768768                    "JOSM expected to find primitive [{0} {1}] in dataset but it is not there. Please report this "
    769769                            + "at {2}. This is not a critical error, it should be safe to continue in your work.",
    770                     primitiveId.getType(), Long.toString(primitiveId.getUniqueId()), Config.getUrls().getJOSMWebsite()));
    771             Logging.error(new Exception());
     770                    primitiveId.getType(), Long.toString(primitiveId.getUniqueId()), Config.getUrls().getJOSMWebsite())));
    772771        }
    773772
  • trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesWithReferrersTask.java

    r16611 r17332  
    234234        }
    235235        List<PrimitiveId> downloaded = new ArrayList<>(ids);
    236         downloaded.removeAll(missingPrimitives);
     236        if (missingPrimitives != null) {
     237            downloaded.removeAll(missingPrimitives);
     238        }
    237239        return downloaded;
    238240    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java

    r17314 r17332  
    171171
    172172        gc.anchor = GridBagConstraints.NORTHWEST;
    173         gc.fill = GridBagConstraints.HORIZONTAL;
     173        gc.fill = HORIZONTAL;
    174174        gc.weightx = 0.0;
    175175        gc.insets = new Insets(0, 0, 0, 3);
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandler.java

    r17330 r17332  
    66import java.util.LinkedList;
    77import java.util.List;
     8import java.util.concurrent.ExecutionException;
     9import java.util.concurrent.TimeUnit;
     10import java.util.concurrent.TimeoutException;
    811import java.util.stream.Collectors;
    912
     
    6770            final DownloadPrimitivesWithReferrersTask task = new DownloadPrimitivesWithReferrersTask(
    6871                    newLayer, ps, referrers, relationMembers, args.get("layer_name"), null);
    69             MainApplication.worker.submit(task);
     72            try {
     73                MainApplication.worker.submit(task).get(OSM_DOWNLOAD_TIMEOUT.get(), TimeUnit.SECONDS);
     74            } catch (InterruptedException | ExecutionException | TimeoutException e) {
     75                Logging.error(e);
     76            }
    7077            MainApplication.worker.submit(() -> {
    7178                final List<PrimitiveId> downloaded = task.getDownloadedId();
Note: See TracChangeset for help on using the changeset viewer.