philipparndt / workspacemechanic

Sync your workspace settings with your team
0 stars 0 forks source link

Make BlockedTaskIdsParser more robust #60

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I recently hit the problem, that there was an uncatched exception in Workspace 
Mechanic. The log shows the following:

com.google.gson.JsonSyntaxException: 
com.google.gson.stream.MalformedJsonException: Expected literal value near 
maven-settings.epf"]:
    at com.google.gson.Gson.assertFullConsumption(Gson.java:495)
    at com.google.gson.Gson.fromJson(Gson.java:485)
    at com.google.gson.Gson.fromJson(Gson.java:434)
    at com.google.gson.Gson.fromJson(Gson.java:406)
    at com.google.eclipse.mechanic.internal.BlockedTaskIdsParser.parse(BlockedTaskIdsParser.java:39)
    at com.google.eclipse.mechanic.plugin.core.MechanicPreferences.getBlockedTaskIds(MechanicPreferences.java:191)
    at com.google.eclipse.mechanic.MechanicService.updateTaskStatus(MechanicService.java:283)
    at com.google.eclipse.mechanic.MechanicService.updateTasks(MechanicService.java:272)
    at com.google.eclipse.mechanic.MechanicService.update(MechanicService.java:230)
    at com.google.eclipse.mechanic.MechanicService.run(MechanicService.java:165)
    at com.google.eclipse.mechanic.MechanicService.access$2(MechanicService.java:160)
    at com.google.eclipse.mechanic.MechanicService$ServiceJob.run(MechanicService.java:367)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: com.google.gson.stream.MalformedJsonException: Expected literal 
value near maven-settings.epf"]:
    at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1110)
    at com.google.gson.stream.JsonReader.readLiteral(JsonReader.java:1079)
    at com.google.gson.stream.JsonReader.nextValue(JsonReader.java:808)
    at com.google.gson.stream.JsonReader.quickPeek(JsonReader.java:382)
    at com.google.gson.stream.JsonReader.peek(JsonReader.java:340)
    at com.google.gson.Gson.assertFullConsumption(Gson.java:491)
    ... 12 more

Apparently the json-format in the preferences is broken for some reason. In 
such a case, you should display a warning, but right now the exception leads to 
the plugin not being available. Attached is the prefs file which lead to that 
exception, but I don't know how it could get to that corrupt state, since I 
never edited it manually.

Original issue reported on code.google.com by konra...@gmx.de on 19 Jul 2011 at 3:33

Attachments:

GoogleCodeExporter commented 8 years ago
Wow I don't think that colon should be there.  One possibility would be for you 
to remove the preference and reimport that file, and another would be to remove 
the colon.

The format isn't so much broken as it's in transition from colon-separated to 
JSON. I worry a little that the format transition might have some problems, but 
not terribly so.

Original comment by konigsb...@gmail.com on 10 Sep 2011 at 2:21

GoogleCodeExporter commented 8 years ago
I hit this as well.  I have a keyboard binding task that is blocked currently, 
and that results in the results list appearing incorrect 
(http://code.google.com/a/eclipselabs.org/p/workspacemechanic/issues/detail?id=5
7)

Well if the block task list looks like this, and I change another preference 
i.e. uncheck the "show popup when tasks fail" then it writes the prefs file 
incorrectly.  The blocked tasks has a trailing \: which then causes it to fail 
subsequently on parse with the exception above.

Attached is the broken prefs file.  

The workaround is simple (as noted in a previous comment) just remove the \: at 
the end of the blocked tasks line (it should end with a closing square 
bracket).  Then restart eclipse.

Original comment by stevemash on 9 Dec 2011 at 5:22

Attachments:

GoogleCodeExporter commented 8 years ago
This was happening due to the "PathEditor" widget reading and writing the 
preference directly as a list of strings separated by the File.pathSeparator.  
That trailing ":" is the linux path separator.

http://code.google.com/a/eclipselabs.org/p/workspacemechanic/issues/detail?id=81
 is a fix for Issue 57 which will implicitly fix this as well.

Original comment by stevemash on 10 Dec 2011 at 3:59

GoogleCodeExporter commented 8 years ago

Original comment by konigsb...@gmail.com on 22 Dec 2011 at 7:46