Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 220435

Summary: [api] unable to save task data for messages with an id that is not compatible with the filesystem
Product: z_Archived Reporter: Shawn Minto <shawn.minto>
Component: MylynAssignee: Steffen Pingel <steffen.pingel>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P2 CC: robert.elves, steffen.pingel
Version: unspecified   
Target Milestone: 3.0   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 226822    
Attachments:
Description Flags
mylyn/context/zip none

Description Shawn Minto CLA 2008-02-26 14:04:43 EST
If I have a unique id that is not just a number, but a pseudo random string of characters, Mylyn is unable to save the offline data since the name of the data file is specified by the task id.

java.io.FileNotFoundException: <path>\<$b46eb3c0$5a36a2c6@!>.zip (The filename, directory name, or volume label syntax is incorrect)
	at java.io.FileOutputStream.open(Native Method)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
	at org.eclipse.mylyn.internal.tasks.ui.OfflineFileStorage.put(OfflineFileStorage.java:251)
	at org.eclipse.mylyn.internal.tasks.ui.OfflineCachingStorage.persistToStorage(OfflineCachingStorage.java:208)
	at org.eclipse.mylyn.internal.tasks.ui.OfflineCachingStorage.access$0(OfflineCachingStorage.java:203)
	at org.eclipse.mylyn.internal.tasks.ui.OfflineCachingStorage$CacheFlushJob.run(OfflineCachingStorage.java:234)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Comment 1 Mik Kersten CLA 2008-02-28 16:15:21 EST
Rob, Steffen: not sure who is best to handle this one.
Comment 2 Steffen Pingel CLA 2008-02-28 16:31:17 EST
The offline storage needs to properly encode the filenames before serializing to disk, e.g. use Base64. Reassigning to Rob who is more familiar with that code.
Comment 3 Mik Kersten CLA 2008-04-08 11:56:44 EDT
Unless we decide to encode the IDs in a filesystem compatible way, we need to specify the legal ID format in the Javadoc.
Comment 4 Steffen Pingel CLA 2008-04-11 01:36:00 EDT
Rob, I'll consider this as part of the task data refactoring that is needed for the new editor architecture. It is likely that we will have to do some type of data migration and we can encode handles as part of that.
Comment 5 Steffen Pingel CLA 2008-04-28 05:22:16 EDT
Shawn, do you have a suggestion for an encoding that will work for file systems?
Comment 6 Shawn Minto CLA 2008-04-28 11:18:26 EDT
I think that Base64 would be the best choice for this encoding.  The only issue is that it makes the information stored on disk very unreadable.  To get around this bug, I URL encoded the Task id, then replaced any other offending characters with the base 64 version.  This seems to work.
Comment 7 Steffen Pingel CLA 2008-05-06 03:10:30 EDT
Here is an example of Base64 encoded path name:

.mylyn/tasks/jira-aHR0cDovL215bHluLmVjbGlwc2Uub3JnL2ppcmEtZW50ZXJwcmlzZS0zLjk\=/MTQxNjE\=/

I think we would be better off writing our own escaping routine.
Comment 8 Steffen Pingel CLA 2008-05-06 03:19:41 EDT
I opted for a homegrown URL encoding like implementation that escapes anything that is not a number or latin letter:

.mylyn/tasks/jira-http%3A%2F%2Fmylyn%2Eeclipse%2Eorg%2Fjira%2Denterprise%2D3%2E9/14162/jira-data.zip
Comment 9 Steffen Pingel CLA 2008-05-06 03:19:44 EDT
Created attachment 98759 [details]
mylyn/context/zip