Menu

#36 JFileField performs strange encoding (URI)

open
nobody
5
2009-12-21
2009-12-21
No

In the project karatasi, we had big problems when we used a JFileField in the KaratasiDesktopPrefs.
The encoding of the file path seems strange - when I use the fileChooser to walk through the file system, it URI-encodes the path.
We are not sure whether this is a bug in JAPI or whether we have not used it correctly.

We had submitted the tracker #2886194 in karatasi for this, but the behavior was not acceptable, so for now we are using a simple JTextField instead, and have closed our tracker.

See below the text of the karatasi tracker:

Summary: Preferences: Working directory results in strange path
ID: 2886194
Details:
The following issue was reported by Claus Jarnik for Server 0.1.0 beta 2:
(see also his email from 23.10.2009)
2) Menu File / Import:
Bei der Pfadauswahl unter Einstellungen habe ich ein Problem. Wenn ich bei
"Datenbank Dateien" einen anderen Ordner auswählen möchte, wird der
Zielort "H:\G+D\Christa\server-0.1.0-beta3" als
"file:/H:/G+D/Christa/server-0.1.0-beta3/" gespeichert. (siehe Bild1)
Wenn ich nun aber unter Import Dateien importieren möchte, komme ich im
"Eigene Dateien" Ordner raus. (siehe Bild 2). Wenn ich das Programm beende
und neu starten möchte, bekomme ich eine neue Fehlermeldung (siehe Bild 3)
=> muss wieder die Registry manuell bearbeiten, damit ich das Programm
starten kann...
Dies betrifft auch Pfade ohne Sonderzeichen.

Commented by Christian Hujer:
2. Fix file:-Bug in Preferences
(Bezieht sich auf Nr. 2 von Claus.)
Wenn man in den Preferences den Order auswählt, wird ein file:/
vorangestellt.
Offensichtlich arbeitet hier ein Teil mit URLs, ein anderer mit Files,
und die Umwandlung ist nicht 100% sauber.
Das könnte eventuell ein Bug in JAPI statt Karatasi sein.

kussinger 2009-12-17 22:29:
svn1642: still exists

kussinger 2009-12-18 19:20
conversation to URI format happens at:
JAPI: JFileChooserButton:156:
textField.setText(base.toURI().relativize(chooser.getSelectedFile().toURI()).toString());

ndegendogo 2009-12-19 13:35
Seen similar behavior also on Mac-OS: the fileChooser prepends the selected
path with file:
After this the librarian does no longer find the databases.

ndegendogo 2009-12-19 18:44
Another observation which seems to be related to this issue: something (the
server??) created a new directory path in my karatasi.java directory, its
name is file:/Users/kiri/Documents.

ndegendogo 2009-12-20 01:13
svn 1633 (version 0.1.0 beta-4): tested again under Windows XP in a virtual
box on Mac-OS.
When I modify the database storage path with the fileChooser, the behavior
is quite strange:
- default setting is C:\Dokumente und Einstellungen\Mathias\karatasi
- click the file chooser icon and see C:\Dokumente und
Einstellungen\Mathias\Eigene Dateien
- accept this path. But now the Settings diaogue displays the path
URI-encoded as
file:/C:/Dokumente%20und%20Einstellungen/Mathias/Eigene%20Dateien/
- I also saw the path sometimes shown as 'Eigene%20Dateien' but currently
I cannot reproduce this.

kussinger 2009-12-20 12:08
fixed with svn1663. I did replace the strange file chooser with a normal
text input field.

Discussion


Log in to post a comment.