Opened 5 years ago

Last modified 4 years ago

#20892 closed enhancement

Remove leading blanks from file names before open — at Version 1

Reported by: GerdP Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: template_report Cc:

Description (last modified by GerdP)

What steps will reproduce the problem?

  1. Have a path to an OSM file in the copy&paste buffer, with leading blank(s), e.g. " e:\thomas\ov\50001439.osm.pbf"
  2. Use Ctrl+O to open a file
  3. Paste the file name
  4. Press OK

What is the expected result?

JOSM opens the file

What happens instead?

Error: Could not read file

Please provide any additional information below. Attach a screenshot if possible.

It's quite easy to select such a blank when using copy+paste, but it's very unlikely that the blanks are part of the path. Maybe always strip them? Or maybe try first the given path and then - on error - try with .strip() again?

URL:https://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2021-04-27 20:35:33 +0200 (Tue, 27 Apr 2021)
Build-Date:2021-04-27 21:58:39
Revision:17833
Relative:URL: ^/trunk

Identification: JOSM/1.5 (17833 en) Windows 10 64-Bit
OS Build number: Windows 10 Home 2004 (19041)
Memory Usage: 1925 MB / 3641 MB (949 MB allocated, but free)
Java version: 1.8.0_221-b11, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM
Look and Feel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
Screen: \Display0 1920×1080 (scaling 1.00×1.00)
Maximum Screen Size: 1920×1080
Best cursor sizes: 16×16→32×32, 32×32→32×32
System property file.encoding: Cp1252
System property sun.jnu.encoding: Cp1252
Locale info: en_DE
Numbers with default locale: 1234567890 -> 1234567890
Dataset consistency test: No problems found

Plugins:
+ apache-commons (35524)
+ buildings_tools (35740)
+ contourmerge (v0.1.6)
+ ejml (35458)
+ geotools (35458)
+ imagery-xml-bounds (35723)
+ jaxb (35543)
+ jts (35458)
+ o5m (35640)
+ opendata (35640)
+ pbf (35720)
+ poly (35640)
+ reltoolbox (35640)
+ reverter (35732)
+ undelete (35640)
+ utilsplugin2 (35691)

Validator rules:
+ c:\josm\core\resources\data\validator\geometry.mapcss
+ d:\java_tools\JOSM\mygeometry.mapcss

Last errors/warnings:
- 52496.737 E: java.io.IOException: java.nio.file.InvalidPathException: Illegal char <:> at index 9: f:\osm\ e:\thomas\ov\50001439.osm.pbf. Cause: java.nio.file.InvalidPathException: Illegal char <:> at index 9: f:\osm\ e:\thomas\ov\50001439.osm.pbf
- 52496.778 W: java.io.IOException: Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch
- 52496.866 E: Error - <html>Could not read file '50001439.osm.pbf'.<br>Error is:<br>java.nio.file.InvalidPathException: Illegal char &lt;:&gt; at index 9: f:\osm\ e:\thomas\ov\50001439.osm.pbf</html>

Change History (2)

by GerdP, 5 years ago

Attachment: open.PNG added

comment:1 by GerdP, 5 years ago

Description: modified (diff)
Summary: Remove leading / trailing blanks from file namesRemove leading blanks from file names before open

The message in the popup makes it nearly impossible to understand the problem:

I tried this with different extensions like *.osm, *.o5m and *.osm.pbf

Note: See TracTickets for help on using tickets.