- Timestamp:
- 2026-10-06T08:57:52+02:00 (2 weeks ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
-
gui/bugreport/BugReportDialog.java (modified) (3 diffs)
-
tools/bugreport/ReportedException.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/bugreport/BugReportDialog.java
r17392 r19637 32 32 import org.openstreetmap.josm.tools.ImageProvider; 33 33 import org.openstreetmap.josm.tools.InputMapUtils; 34 import org.openstreetmap.josm.tools.Utils; 34 35 import org.openstreetmap.josm.tools.bugreport.BugReport; 35 36 import org.openstreetmap.josm.tools.bugreport.BugReportQueue.SuppressionMode; … … 46 47 public class BugReportDialog extends JDialog { 47 48 private static final int MAX_MESSAGE_SIZE = 500; 49 /** whether the user has been told about file names that cannot be represented, which is done once per session */ 50 private static volatile boolean unmappableFileNameExplained; 48 51 // This is explicitly not an ExtendedDialog - we still want to be able to display bug reports if there are problems with preferences/.. 49 52 private final JPanel content = new JPanel(new GridBagLayout()); … … 229 232 ); 230 233 return SuppressionMode.NONE; 234 } else if (e.isUnmappableFileName()) { 235 // Not a bug in JOSM, but a locale which cannot represent the name of a file, see #14596. Explain how to 236 // fix it rather than asking for a bug report, and only once: browsing other folders throws it again. 237 if (!unmappableFileNameExplained) { 238 unmappableFileNameExplained = true; 239 GuiHelper.runInEDTAndWait(() -> JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 240 tr("<html>JOSM cannot handle the name of a file, because it is running with the character set {0} " 241 + "for file names, which cannot represent it.<br>" 242 + "This happens when JOSM is started without a UTF-8 locale, for example with {1}, " 243 + "or with a locale which is not installed.<br><br>" 244 + "Please start JOSM with the environment variable {2}.</html>", 245 Utils.getSystemProperty("sun.jnu.encoding"), "<tt>LANG=C</tt>", "<tt>LC_ALL=C.UTF-8</tt>"), 246 tr("Unsupported file name"), 247 JOptionPane.WARNING_MESSAGE)); 248 } 249 return SuppressionMode.NONE; 231 250 } else { 232 251 PluginDownloadTask downloadTask = PluginHandler.updateOrdisablePluginAfterException(e); -
trunk/src/org/openstreetmap/josm/tools/bugreport/ReportedException.java
r19535 r19637 5 5 import java.io.Serializable; 6 6 import java.lang.reflect.InvocationTargetException; 7 import java.nio.file.InvalidPathException; 7 8 import java.util.ArrayList; 8 9 import java.util.Arrays; … … 22 23 import org.openstreetmap.josm.tools.Logging; 23 24 import org.openstreetmap.josm.tools.StreamUtils; 25 import org.openstreetmap.josm.tools.Utils; 24 26 25 27 /** … … 279 281 280 282 /** 283 * Check if this is caused by the name of a file which cannot be represented in the character set Java uses for 284 * file names. Java takes that character set from the locale, so this happens when JOSM runs in the C/POSIX locale, 285 * or with a locale which is not installed: file names are then ASCII only, and opening a folder which holds a 286 * non-ASCII name fails. See #14596. 287 * @return <code>true</code> if it is. 288 * @since 19637 289 */ 290 public boolean isUnmappableFileName() { 291 return !"UTF-8".equalsIgnoreCase(Utils.getSystemProperty("sun.jnu.encoding")) 292 && StreamUtils.toStream(CauseTraceIterator::new).anyMatch(t -> t instanceof InvalidPathException 293 && String.valueOf(((InvalidPathException) t).getReason()).contains("unmappable characters")); 294 } 295 296 /** 281 297 * Iterates over the causes for this exception. Ignores cycles and aborts iteration then. 282 298 * @author Michal Zangl
Note:
See TracChangeset
for help on using the changeset viewer.
