Backslashes and spaces in EMF URI's [message #416514] |
Wed, 06 February 2008 04:09  |
Eclipse User |
|
|
|
It appears that ResourceSetImpl#getResource(URI,boolean) chokes on any
URI with a %20 (space) in it if its a URI with an archive scheme. See
stacktrace below.
Seems to me that the URI isn't being decoded, whereas it is when the URI
is not an archive scheme. Is this a bug?
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:114)
at java.util.zip.ZipFile.<init>(ZipFile.java:75)
at
org.eclipse.emf.common.archive.ArchiveURLConnection.getInput Stream(ArchiveURLConnection.java:232)
at
org.eclipse.emf.ecore.resource.impl.URIConverterImpl.createA rchiveInputStream(URIConverterImpl.java:615)
at
org.eclipse.emf.ecore.resource.impl.URIConverterImpl.createI nputStream(URIConverterImpl.java:534)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1152)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo ad(ResourceSetImpl.java:256)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo adHelper(ResourceSetImpl.java:271)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResou rce(ResourceSetImpl.java:369)
On a related note: Why does URI#createURI(String) not take care of
encoding, while URI#createURI(String, boolean) and other creational
methods do?
Thanks,
Jasper.
|
|
|
Re: Backslashes and spaces in EMF URI's [message #416515 is a reply to message #416514] |
Wed, 06 February 2008 09:49   |
Eclipse User |
|
|
|
Jasper wrote:
> It appears that ResourceSetImpl#getResource(URI,boolean) chokes on any
> URI with a %20 (space) in it if its a URI with an archive scheme. See
> stacktrace below.
>
> Seems to me that the URI isn't being decoded, whereas it is when the URI
> is not an archive scheme. Is this a bug?
Hi Jasper,
Yes, this appears to me to be a bug. Please open a bugzilla.
By the way, it's helpful to mention the version of EMF you're using when
you give a strack trace.
> On a related note: Why does URI#createURI(String) not take care of
> encoding, while URI#createURI(String, boolean) and other creational
> methods do?
Because sometimes you know you don't need any encoding, such as when
you're creating a URI for a literal string or when you've already done
the encoding, so it's handy to be able to skip it.
Cheers,
Dave
|
|
|
Re: Backslashes and spaces in EMF URI's [message #416592 is a reply to message #416515] |
Thu, 07 February 2008 03:27   |
Eclipse User |
|
|
|
OK, bug #218130.
Thanks,
Jasper.
Dave Steinberg wrote:
> Jasper wrote:
>> It appears that ResourceSetImpl#getResource(URI,boolean) chokes on any
>> URI with a %20 (space) in it if its a URI with an archive scheme. See
>> stacktrace below.
>>
>> Seems to me that the URI isn't being decoded, whereas it is when the
>> URI is not an archive scheme. Is this a bug?
>
> Hi Jasper,
>
> Yes, this appears to me to be a bug. Please open a bugzilla.
>
> By the way, it's helpful to mention the version of EMF you're using when
> you give a strack trace.
>
>> On a related note: Why does URI#createURI(String) not take care of
>> encoding, while URI#createURI(String, boolean) and other creational
>> methods do?
>
> Because sometimes you know you don't need any encoding, such as when
> you're creating a URI for a literal string or when you've already done
> the encoding, so it's handy to be able to skip it.
>
> Cheers,
> Dave
|
|
|
|
Re: Backslashes and spaces in EMF URI's [message #1053532 is a reply to message #1053522] |
Mon, 06 May 2013 08:16  |
Eclipse User |
|
|
|
Marek,
Well that depends on how the URI is constructed, but yes,
URI.createFileURI and URI.createPlatform*URI will generally (the latter
depending on the argument, but specifying true is strongly encouraged)
encode characters such as space which are not strictly valid according
to the URI RFC. You can always use URI.decode to decode strings, and
methods like URI.toFileString and URI.toPlatformString will generally do
that decoding for you to produce OS-specific valid file system paths or
Eclipse valid resource paths. Failure to encode URIs can cause nasty
problems in deserialization, i.e., a URI with a space could end up being
interpreted as two separate URIs...
On 06/05/2013 1:17 PM, Marek Jagielski wrote:
> Hi,
> I have EMF 2.6.0 v.20120917. Is it normal behavior that
> myUri.segment(1) gives me a String with encoded spaces (%20) ? Thanks,
>
> Marek
|
|
|
Powered by
FUDForum. Page generated in 0.03178 seconds