Opened 13 years ago
Closed 13 years ago
#7027 closed defect (fixed)
Windows user preferences are lost when running 4550 after 4553
Reported by: | Don-vip | Owned by: | team |
---|---|---|---|
Priority: | critical | Milestone: | |
Component: | Core | Version: | tested |
Keywords: | preferences | Cc: |
Description (last modified by )
Damn, I just had the following error message after upgrading to 4550:
I don't know what the error was, because no backup file has been created, despite the popup saying me it would.
The only two preferences files located in my %APPDATA%/JOSM are "preferences" and "preferences_backup", almost equal each other (only one line "gui.geometry=1920x1034+0+0" present in preferences and not in preferences_backup).
The file "preferences.bak" I was expecting to find is not there. I don't know if it has been deleted or never created.
Any idea on this ? This could be a major problem if the new tested version drops all user preferences. Maybe it is just located somewhere else ?
Attachments (4)
Change History (47)
by , 13 years ago
Attachment: | screenshot.png added |
---|
comment:1 by , 13 years ago
Description: | modified (diff) |
---|
comment:2 by , 13 years ago
comment:3 by , 13 years ago
Confirmed. Launch 4553, then 4550, the preferences file disappears. Shouldn't we release a new tested version containing read-only XML support before effectively switch to XML saving ? I think it's a common practice to switch between 2 versions of JOSM (at least tested/latest), and this change is going to break many user configurations without any warning.
comment:4 by , 13 years ago
It appears to be a Windows issue. In debug mode, I can see File.rename() of "C:\Users\Vincent\AppData\Roaming\JOSM\preferences" to "C:\Users\Vincent\AppData\Roaming\JOSM\preferences.bak" fails under Windows, I think we should change the filename to something else, "preferences_invalid" or something like that. In all cases, we need to check the return value and do something it the operation fails. The proper way seems to abort JOSM startup, no ?
comment:5 by , 13 years ago
Summary: | User preferences can be lost → Windows user preferences can be lost when running 4550 after 4553 |
---|
comment:6 by , 13 years ago
Priority: | major → critical |
---|---|
Summary: | Windows user preferences can be lost when running 4550 after 4553 → Windows user preferences are lost when running 4550 after 4553 |
comment:8 by , 13 years ago
Users that encounter a regression on JOSM latest may want to use tested version. Plugin developers may want to check if their plugin works well with both the tested and latest version. Personnaly, I frequently launch older JOSM versions in order to reproduce user bugs. I will no longer do that for versions older than the one that fixes this issue, it's a real pain to lose all my preferences.
comment:10 by , 13 years ago
4554 saves old style preferences again (except prefs are already loaded in XML format). Will be switched again in December after next tested.
comment:13 by , 13 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Why not call it "preferences.xml
"? This file extension is common convention and it avoids the compatibility hacks.
comment:14 by , 13 years ago
The xml format is not fully optimized for our data structures. Instead of
<collection key='imagery.entries.1'> <entry value='name:LandSat' /> <entry value='type:wms' /> <entry value='url:http://irs.gis-lab.info/?layers=landsat&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}' /> </collection> <collection key='imagery.entries.2'> <entry value='name:MapQuest Open Aerial' /> <entry value='type:tms' /> <entry value='url:http://oatile{switch:1,2,3,4}.mqcdn.com/tiles/1.0.0/sat/{zoom}/{x}/{y}.png' /> </collection>
I would expect something like this:
<collection key='imagery.entries'> <entry> <tag key='name' value='LandSat'/> <tag key='type' value='wms'/> <tag key='url' value='http://irs.gis-lab.info/?layers=landsat&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}'/> </entry> <entry> <tag key='name' value='MapQuest Open Aerial'/> <tag key='type' value='tms'/> <tag key='url' value='http://oatile{switch:1,2,3,4}.mqcdn.com/tiles/1.0.0/sat/{zoom}/{x}/{y}.png'/> </entry> </collection>
I suppose we can fix this step by step?
follow-up: 17 comment:15 by , 13 years ago
You're right. The newer structures you introduced aren't yet implemented in XML.
by , 13 years ago
Attachment: | preferences.xml.patch added |
---|
comment:16 by , 13 years ago
This patch writes xml to preferences.xml and just keeps the old preference file as it is.
follow-up: 18 comment:17 by , 13 years ago
Replying to stoecker:
You're right. The newer structures you introduced aren't yet implemented in XML.
Your Array type deserves special handling as well.
follow-up: 19 comment:18 by , 13 years ago
Replying to bastiK:
Your Array type deserves special handling as well.
XML code is there for years. I thought that we never switch, when I wait again until the format is perfect. So I decided to start now and leave improvements to the future :-)
We need to change the internal prefs handling a bit as well, as currently we do not really know which prefs key is of which type.
I see no problems with your patch, why didn't you apply it directly?
comment:19 by , 13 years ago
Replying to stoecker:
I see no problems with your patch, why didn't you apply it directly?
I don't want to make matters worse and give you and others time to object.
comment:20 by , 13 years ago
A bit off topic, but here are some things we can change in the process:
put(key, "")
should not remove the tag, but map the key to the empty string- likewise, allow saving collections of size zero as values
put(key, null)
should not remove the tag, but throw an exception (?)
Rename the structures to match the proposed new return types List<String>, List<List<String>> and List<Map<String,String>>:
- getCollection -> getList
- getArray -> getListList
- getListOfStructs -> getMapList
follow-up: 23 comment:22 by , 13 years ago
Why do you want to change semantics of put()? What improvement would this bring?
comment:23 by , 13 years ago
Replying to stoecker:
Why do you want to change semantics of put()? What improvement would this bring?
E.g. print plugin adds a label to the map:
String text = Main.pref.get("print.attribution", "OSM Map data (c) OpenStreetMap contributors, CC-BY-SA");
If you don't want that label, you could go to advanced preferences and set the property "print.attribution" to the empty string. This doesn't work, because then the tag is removed and the default value is used again.
Obviously there are workarounds (e.g. use a single space character) but that's silly.
follow-up: 26 comment:24 by , 13 years ago
I fear that such a change would break a lot of code. Most places silently assume the current behaviour.
by , 13 years ago
Attachment: | preferences-structures.patch added |
---|
comment:25 by , 13 years ago
This patch adds internal data structures that match the types of collection, array and listOfStructs. It should work mostly. What's missing is refactoring of PreferenceChangeEvent and a GUI to edit these values in advanced preferences pane. I'd suggest to postpone the GUI and check in what's done.
comment:26 by , 13 years ago
Replying to stoecker:
I fear that such a change would break a lot of code. Most places silently assume the current behaviour.
Yes, I know. If it's too much work, I'll drop it, but it has been bugging me for some time now. :)
comment:28 by , 13 years ago
TODO:
- Status report (uses old file)
- Advanced preferences (shows only simple key=value prefs)
- Windows installer
comment:31 by , 13 years ago
The file josm.nsi should be changed, to write to preference.xml
instead of preference
. I'm not familiar with the scripting language, so if anyone has a clue, please go ahead.
follow-up: 34 comment:33 by , 13 years ago
I fixed the installer in [o27235]. Anyone wants to test it download/windows/josm-setup-4661.exe?
follow-up: 35 comment:34 by , 13 years ago
Replying to stoecker:
I fixed the installer in [o27235]. Anyone wants to test it download/windows/josm-setup-4661.exe?
You can select certain plugins in the installer dialog. This should be respected by the plugins=... pref entry.
follow-up: 36 comment:35 by , 13 years ago
You can select certain plugins in the installer dialog. This should be respected by the plugins=... pref entry.
Actually I have no idea how to do this. I don't use Windows very often.
comment:36 by , 13 years ago
Replying to stoecker:
You can select certain plugins in the installer dialog. This should be respected by the plugins=... pref entry.
Actually I have no idea how to do this. I don't use Windows very often.
Enter
wine josm-setup-4661.exe
a dialog pops up > ok > next > accept
Then you can select components, e.g. plugins.
Afterwards, preference file can be found in ~/.wine/.../JOSM
.
follow-ups: 38 39 comment:37 by , 13 years ago
I've run it on Win 7 x64. Some remarks/questions:
- The install seems to work fine (a new file preferences.xml is created when no previous preferences exist, an existing preferences file is not deleted) but the launched version is r4550, is it expected or not ?
- I'll add a new file for the French language, if you're OK
- The authors list is not up to date
- I think we should at least remove the "WMS downloader" plugin (is it the old WMS plugin ?) and add the license change plugin to default suggested plugins. Maybe others, based on the most popular plugins we see in bug reports ? (Off-topic: By the way, do we have any kind of statistics on plugins usage ?)
comment:38 by , 13 years ago
Replying to Don-vip:
- I think we should at least remove the "WMS downloader" plugin (is it the old WMS plugin ?)
I think "WMS downloader" is webkit-image-qt for Yahoo imagery. It's now obsolete, but may be needed again in future (?).
and add the license change plugin to default suggested plugins. Maybe others, based on the most popular plugins we see in bug reports ? (Off-topic: By the way, do we have any kind of statistics on plugins usage ?)
Yes, I can send you the stats by email.
follow-up: 40 comment:39 by , 13 years ago
Actually I have no idea how to do this. I don't use Windows very often.
... do this IN THE INSTALLER. :-)
- The install seems to work fine (a new file preferences.xml is created when no previous preferences exist, an existing preferences file is not deleted) but the launched version is r4550, is it expected or not ?
Not expected, but understandable. I called only a part of the build script and probably missed something.
- I'll add a new file for the French language, if you're OK
Sure.
- The authors list is not up to date
You mean the one in JOSM svn. Update it when necessary.
- I think we should at least remove the "WMS downloader" plugin (is it the old WMS plugin ?) and add the license change plugin to default suggested plugins. Maybe others, based on the most popular plugins we see in bug reports ? (Off-topic: By the way, do we have any kind of statistics on plugins usage ?)
I would not remove it. It is not really large and does no harm.
follow-up: 41 comment:40 by , 13 years ago
Replying to stoecker:
- I'll add a new file for the French language, if you're OK
Sure.
Done in [o27246] :)
- The authors list is not up to date
You mean the one in JOSM svn. Update it when necessary.
No, it's not this one. I don't understand where this list comes from, but it's not the one used in JOSM itself. It's really outdated as it ends by "The current JOSM maintainer is Frederik Ramm <frederik@…>." ;)
comment:41 by , 13 years ago
You mean the one in JOSM svn. Update it when necessary.
No, it's not this one. I don't understand where this list comes from, but it's not the one used in JOSM itself. It's really outdated as it ends by "The current JOSM maintainer is Frederik Ramm <frederik@…>." ;)
Found and fixed.
comment:43 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
I see r4553 switched preferences file format to XML. I think I've run JOSM once from my up-to-date Eclipse, then launched r4550. That would explain all these errors and the huge number of lines for a preferences file.