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

Bug 282367

Summary: Exception on windows XP on creating images out of URL containing "host:port"
Product: [RT] RAP Reporter: Bogdan B. <bbarzu>
Component: JFaceAssignee: Project Inbox <rap-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: batxut, simon_gao
Version: 1.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Bogdan B. CLA 2009-07-03 07:22:58 EDT
The following error happens by using a rap-runtime-1.2.0-R-20090616-1425.zip (launched with eclipse 3.5 galileo) target.

My login action creates its icon descriptor using:
ImageDescriptor.createFromURL(MyPlugin.getDefault().getBundle().getResource("icons/login.gif"))
which holds the following URL (using the RAP target):
bundleresource://31.fwk22375698:1/icons/login.gif

Further, on Image creation, org.eclipse.jface.resource.URLImageDescriptor.createImage(boolean, Device) (from org.eclipse.rap.jface_1.2.0.20090616-1425.jar) eliminates the "bundleresource://" protocol and passes the rest to org.eclipse.rwt.graphics.Graphics.getImage(String, InputStream), which tries to create the folder "<runtime_workspace>\.metadata\.plugins\org.eclipse.rap.ui\context\31.fwk22375698:1". 
Which on Windows XP fails because ":" is not allowed in a folder or file name.

Shouldn't the RAP implementation of URLImageDescriptor.createImage() be also able to create an image out of an URL which contains a host:port construct?
Any idea of how I could fix this?
Comment 1 RĂ¼diger Herrmann CLA 2009-07-03 07:52:57 EDT
(In reply to comment #0)
> [..]
> Shouldn't the RAP implementation of URLImageDescriptor.createImage() be also
> able to create an image out of an URL which contains a host:port construct?
> Any idea of how I could fix this?
I agree that this is a bug, a similar use case is decribed in bug 280582, that fails for the same reason.
The RAP resource manager should escape charaters that aren't allowed in file names.
Currently I have no idea how to work around this.
Comment 2 Bogdan B. CLA 2009-07-03 08:22:48 EDT
Just for testing I have eliminated the troubling port (":1") from my URL so it became:
bundleresource://31.fwk22375698/icons/login.gif
and it worked:
"<runtime_workspace>\.metadata\.plugins\org.eclipse.rap.ui\context\31.fwk22375698\icons\login.gif" was created on the disk and could be displayed.

I also mention that on using the same code with an Eclipse 3.3 RCP target, the URL looks like:
bundleresource://6/icons/login.gif
so no problem for Windows.
Comment 3 RĂ¼diger Herrmann CLA 2009-07-15 04:55:51 EDT

*** This bug has been marked as a duplicate of bug 280582 ***