- Timestamp:
- 2022-10-24T20:54:43+02:00 (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java
r18200 r18581 10 10 import java.util.Collections; 11 11 import java.util.LinkedHashSet; 12 import java.util.List; 12 13 import java.util.Map; 13 14 import java.util.Set; … … 16 17 import java.util.concurrent.TimeUnit; 17 18 import java.util.concurrent.TimeoutException; 19 import java.util.stream.Collectors; 18 20 19 21 import javax.swing.JOptionPane; … … 165 167 if (osmTask.isFailed()) { 166 168 Object error = osmTask.getErrorObjects().get(0); 167 throw error instanceof OsmApiException 168 ? (OsmApiException) error 169 : new OsmTransferException(String.join(", ", osmTask.getErrorMessages())); 169 if (error instanceof OsmApiException) { 170 throw (OsmApiException) error; 171 } 172 List<Throwable> exceptions = osmTask.getErrorObjects().stream() 173 .filter(Throwable.class::isInstance).map(Throwable.class::cast) 174 .collect(Collectors.toList()); 175 OsmTransferException osmTransferException = 176 new OsmTransferException(String.join(", ", osmTask.getErrorMessages())); 177 if (!exceptions.isEmpty()) { 178 osmTransferException.initCause(exceptions.get(0)); 179 exceptions.remove(0); 180 exceptions.forEach(osmTransferException::addSuppressed); 181 } 182 throw osmTransferException; 170 183 } 171 184 } catch (InterruptedException | ExecutionException | TimeoutException |
Note:
See TracChangeset
for help on using the changeset viewer.