[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [udig-devel] Spaces In FileNames
|
Hi Emily; I am madly trying to hook up the ID class since I am sick of
all these path based issues in our code base.
> net.refractions.udig.catalog.internal.shp.ShpGeoResourceImpl.<init>(ShpGeoResourceImpl.java:75)
> at
> net.refractions.udig.catalog.internal.shp.ShpServiceImpl.resources(ShpServiceImpl.java:177)
> ...
So why is the ID class being created with null?
> From what I can tell this boils down to the ID.java class.
>
> public ID( URL url ){
>
> this.url = url;
> try {
> this.uri = url.toURI();
> } catch (URISyntaxException e) {
> }
>
>
> this.uri = url.toURI() -> this throws an exception and thus uri is null. I
> believe this is the source of the null pointer exception above.
I agree; now I wonder why the provided url is null?
> From experimenting:
>
> If you have a url with spaces:
> url = new URL("file:/C:/temp/habc poa/my border.shp");
>
> You cannot convert it to a URI without an error.
That would probably be correct; since " " is not valid in a URL; can
we detect where in the code this is happening?
> However if you encode the spaces in this url everything is okay.
> url = new URL("file:/C:/temp/habc%20poa/my%20border.shp");
>
> Is there some way we can encode the url's that have spaces so we can properly create uri's out of them?
Richard made a URLUtils class that handles these cases (I added a test
case based on a File with spaces; but not for a URL with spaces). All
our code should be using this URLUtils; so it is my hope we can use
the debugger to find a case where this is not being called. Use of
this class is covered in the udig coding conventions:
- http://udig.refractions.net/confluence/display/DEV/5+Coding+Conventions
Jody