Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 383718 - Wrong resource URL leads to "java.lang.IllegalArgumentException: URI is not hierarchical"
Summary: Wrong resource URL leads to "java.lang.IllegalArgumentException: URI is not h...
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.5   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 2.0 M1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard: sr151
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-28 01:58 EDT by Thomas Küstermann CLA
Modified: 2012-06-30 05:58 EDT (History)
1 user (show)

See Also:
ivan: review+


Attachments
Stacktrace (779 bytes, text/plain)
2012-06-28 01:58 EDT, Thomas Küstermann CLA
no flags Details
Patch for RAP 1.5 (826 bytes, patch)
2012-06-28 01:59 EDT, Thomas Küstermann CLA
rsternberg: iplog+
Details | Diff
Patch for RAP 1.4.2 (895 bytes, patch)
2012-06-28 02:00 EDT, Thomas Küstermann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Küstermann CLA 2012-06-28 01:58:50 EDT
Created attachment 217981 [details]
Stacktrace

Forum reference: http://www.eclipse.org/forums/index.php/t/366491/

A RAP application deployed onto a JBoss AS 5.1.2 throws "java.lang.IllegalArgumentException: URI is not hierarchical" when a resource (javascript, images) is requested. The application server ships with a custom file protocol url handler which essentially does this:

file = new File(url.toURI());

I tracked the problem down to org.eclipse.rap.rwt.osgi.internal.HttpContextWrapper#getResource(String) which seems to generate a wrong resource URL, e.g file:C:/path/to/resource/favicon.png instead of file:/C:/path/to/resource/favicon.png.

This applies to RAP 1.4.2 as well as 1.5 RC3.

Steps to reproduce:
1. Get jboss-common-core-2.2.18.GA [1] and jboss-logging-spi-2.1.0.GA [2]
2. Add these jars to the boot classpath
3. Add -Djava.protocol.handler.pkgs=org.jboss.net.protocol to the VM arguments
4. Start the application

[1] https://repository.jboss.org/nexus/index.html#nexus-search;gav~org.jboss~jboss-common-core~2.2.18.GA~jar~
[2] https://repository.jboss.org/nexus/index.html#nexus-search;gav~org.jboss.logging~jboss-logging-spi~2.1.0.GA~jar~
Comment 1 Thomas Küstermann CLA 2012-06-28 01:59:53 EDT
Created attachment 217982 [details]
Patch for RAP 1.5
Comment 2 Thomas Küstermann CLA 2012-06-28 02:00:25 EDT
Created attachment 217983 [details]
Patch for RAP 1.4.2
Comment 3 Ralf Sternberg CLA 2012-06-29 04:35:48 EDT
Thanks for the patch! Applied with commit ddfea42762da5099c176477f05aba6ea156cb8bc, together with an improved test.
I couldn't come up with a test that fails on Unix, but at least the test fails on Windows now.

I think this fix should be backported to 1.5.
Comment 4 Ivan Furnadjiev CLA 2012-06-29 09:19:54 EDT
The fix looks good to me too. +1 to be backported to 1.5.
Comment 5 Ralf Sternberg CLA 2012-06-30 05:58:21 EDT
Applied to 1.5 maintenance branch with commit 910538a0955bc26a00e4fe8c60c410dca4b1338a.