Subject: [PATCH] Fix #23866: java.io.UncheckedIOException: java.nio.file.FileSystemException: The device is not ready
---
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/gui/layer/geoimage/ImagesLoader.java b/src/org/openstreetmap/josm/gui/layer/geoimage/ImagesLoader.java
|
a
|
b
|
|
| 5 | 5 | |
| 6 | 6 | import java.io.File; |
| 7 | 7 | import java.io.IOException; |
| | 8 | import java.io.UncheckedIOException; |
| 8 | 9 | import java.util.ArrayList; |
| 9 | 10 | import java.util.Arrays; |
| 10 | 11 | import java.util.Collection; |
| … |
… |
|
| 90 | 91 | progressMonitor.worked(1); |
| 91 | 92 | |
| 92 | 93 | ImageEntry e = new ImageEntry(f); |
| 93 | | e.extractExif(); |
| | 94 | try { |
| | 95 | e.extractExif(); |
| | 96 | } catch (UncheckedIOException uncheckedIOException) { |
| | 97 | // We want to throw the actual IOException that is wrapped, not the unchecked IO exception. |
| | 98 | // See #23866 |
| | 99 | Logging.trace(uncheckedIOException); |
| | 100 | throw uncheckedIOException.getCause(); |
| | 101 | } |
| 94 | 102 | File parentFile = f.getParentFile(); |
| 95 | 103 | entries.computeIfAbsent(parentFile != null ? parentFile.getName() : "", x -> new ArrayList<>()).add(e); |
| 96 | 104 | } |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java b/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java
|
a
|
b
|
|
| 9 | 9 | import java.net.HttpURLConnection; |
| 10 | 10 | import java.net.SocketException; |
| 11 | 11 | import java.net.UnknownHostException; |
| | 12 | import java.nio.file.FileSystemException; |
| 12 | 13 | import java.util.regex.Matcher; |
| 13 | 14 | import java.util.regex.Pattern; |
| 14 | 15 | |
| … |
… |
|
| 143 | 144 | ); |
| 144 | 145 | } |
| 145 | 146 | |
| | 147 | /** |
| | 148 | * Explains a {@link IOException} |
| | 149 | * |
| | 150 | * @param e the exception |
| | 151 | */ |
| | 152 | private static void explainIOException(Exception e) { |
| | 153 | if (e instanceof FileSystemException && e.getMessage().contains("The device is not ready")) { |
| | 154 | showErrorDialog(ExceptionUtil.explainException(e), tr("File System Exception"), null); |
| | 155 | } else { |
| | 156 | explainGeneric(e); |
| | 157 | } |
| | 158 | } |
| | 159 | |
| 146 | 160 | /** |
| 147 | 161 | * Explains a {@link IllegalDataException} which has caused an {@link OsmTransferException}. |
| 148 | 162 | * This is most likely happening when JOSM tries to load data in an unsupported format. |
| … |
… |
|
| 491 | 505 | if (e instanceof OsmTransferException) { |
| 492 | 506 | explainOsmTransferException((OsmTransferException) e); |
| 493 | 507 | return; |
| | 508 | } |
| | 509 | FileSystemException fileSystemException = ExceptionUtil.getNestedException(e, FileSystemException.class); |
| | 510 | if (fileSystemException != null) { |
| | 511 | explainIOException(fileSystemException); |
| | 512 | return; |
| 494 | 513 | } |
| 495 | 514 | explainGeneric(e); |
| 496 | 515 | } |