Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] Spaces In FileNames

I'm trying to load a shapefile with a space in the file name into udig and currently get the following error:

java.lang.NullPointerException
	at net.refractions.udig.catalog.ID.<init>(ID.java:115)
at net.refractions.udig.catalog.internal.shp.ShpGeoResourceImpl.<init>(ShpGeoResourceImpl.java:75) at net.refractions.udig.catalog.internal.shp.ShpServiceImpl.resources(ShpServiceImpl.java:177)
...

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.

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.

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?

Emily


Back to the top