Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Regression in URI parsing?
Regression in URI parsing? [message #1020763] Mon, 18 March 2013 22:03 Go to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi,

I have pulled EMF commit 14739192c0f373916dfc565d78f4c1011e34b85e in
preparation for the Papyrus M6 build.

I get test failures in some tests that try to get EObjects from
resource sets with URIs constructed like this:

URI.createPlatformResourceURI(RESOURCE_URI +
"MyProfile.uml#_XkGiwB07Ed-QQ4mYkrb7Gg", false)

Should constructing platform:/resource URIs including fragments in this
way ever have worked? Because it doesn't now. The result is a URI
like this:


platform:/resource/org.eclipse.papyrus.core.resourceloading.tests/resources/TestModel1/MyProfile.uml%23_XkGiwB07Ed-QQ4mYkrb7Gg


Notice the encoding of the hash mark as %23.

Thanks,

Christian
Re: Regression in URI parsing? [message #1020783 is a reply to message #1020763] Mon, 18 March 2013 22:42 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Christian

Make sure you are using the M6 EMF; later than the platform M6. Your
problem looks like:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=403547

which concludes that indeed it should never have worked. QVTo JUnit
tests had to be recoded.

Regards

Ed Willink


On 18/03/2013 22:03, Christian W. Damus wrote:
> Hi,
>
> I have pulled EMF commit 14739192c0f373916dfc565d78f4c1011e34b85e in
> preparation for the Papyrus M6 build.
>
> I get test failures in some tests that try to get EObjects from
> resource sets with URIs constructed like this:
>
> URI.createPlatformResourceURI(RESOURCE_URI +
> "MyProfile.uml#_XkGiwB07Ed-QQ4mYkrb7Gg", false)
>
> Should constructing platform:/resource URIs including fragments in
> this way ever have worked? Because it doesn't now. The result is a
> URI like this:
>
> platform:/resource/org.eclipse.papyrus.core.resourceloading.tests/resources/TestModel1/MyProfile.uml%23_XkGiwB07Ed-QQ4mYkrb7Gg
>
>
> Notice the encoding of the hash mark as %23.
>
> Thanks,
>
> Christian
>
Re: Regression in URI parsing? [message #1020784 is a reply to message #1020783] Mon, 18 March 2013 22:45 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Or just use the current EMF I-build that is prehistoric.

Regards

Ed Willink

On 18/03/2013 22:42, Ed Willink wrote:
> Hi Christian
>
> Make sure you are using the M6 EMF; later than the platform M6. Your
> problem looks like:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=403547
>
> which concludes that indeed it should never have worked. QVTo JUnit
> tests had to be recoded.
>
> Regards
>
> Ed Willink
>
>
> On 18/03/2013 22:03, Christian W. Damus wrote:
>> Hi,
>>
>> I have pulled EMF commit 14739192c0f373916dfc565d78f4c1011e34b85e in
>> preparation for the Papyrus M6 build.
>>
>> I get test failures in some tests that try to get EObjects from
>> resource sets with URIs constructed like this:
>>
>> URI.createPlatformResourceURI(RESOURCE_URI +
>> "MyProfile.uml#_XkGiwB07Ed-QQ4mYkrb7Gg", false)
>>
>> Should constructing platform:/resource URIs including fragments in
>> this way ever have worked? Because it doesn't now. The result is a
>> URI like this:
>>
>> platform:/resource/org.eclipse.papyrus.core.resourceloading.tests/resources/TestModel1/MyProfile.uml%23_XkGiwB07Ed-QQ4mYkrb7Gg
>>
>>
>> Notice the encoding of the hash mark as %23.
>>
>> Thanks,
>>
>> Christian
>>
>
Re: Regression in URI parsing? [message #1020856 is a reply to message #1020784] Tue, 19 March 2013 03:39 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

In fact, it was easy to work around in my case simply by changing the test code to parse the resource URI and then ask the URI to append a fragment ... several times in a few different test classes.

This is not bug 403547. The fragments are UUIDs, not paths. There are no GenModels.

I think it is a valid request of the URI class to parse a string that includes a fragment. Such a string is a URI. I would expect other code already in production to break when upgrading EMF. Accordingly, I have raised bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=403708 .
Re: Regression in URI parsing? [message #1020900 is a reply to message #1020856] Tue, 19 March 2013 06:25 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Christian,

As I commented in the bug, I think the whole this is questionable at
best. Firstly, unless the entire string is hard coded, it's
questionable to call
URI.createPlatformResourceURI(<workspace-relative-path>, false) because
you can't know if the path contains characters that need to be encoded.
It's also questionable whether fragments and queries are part of the
concept of a workspace relative path in the first place. If the problem
is indeed restricted to "questionably written" test cases, I think it's
better to change them in favor of an API that behaves consistently with
its description and consistently with respect to encode being true or
false...

On 19/03/2013 4:39 AM, Christian W. Damus wrote:
> In fact, it was easy to work around in my case simply by changing the
> test code to parse the resource URI and then ask the URI to append a
> fragment ... several times in a few different test classes.
>
> This is not bug 403547. The fragments are UUIDs, not paths. There are
> no GenModels.
>
> I think it is a valid request of the URI class to parse a string that
> includes a fragment. Such a string is a URI. I would expect other
> code already in production to break when upgrading EMF. Accordingly, I
> have raised bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=403708 .


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Could not initialize class org.eclipse.emf.server.ecore.resource.DatastoreUtil
Next Topic:Provide context specific "views" on an EObject
Goto Forum:
  


Current Time: Fri Apr 19 03:11:15 GMT 2024

Powered by FUDForum. Page generated in 0.02525 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top