GMLDataSotre GMLDataStoreFactory, file vs directory

Description

org.geotools.data.gml.GMLDataStoreFactory method createDataStore(url) expects url to ends with ".gml" or ".xml" which means the url must point to a file.
but GMLDataStore constructor expects uri (based on the url above) to be a directory.

suggestion to fix that :
change File dir = new File(udir.getPath()); with File dir = new File(udir.getPath()).getParentFile();
in GMLDataStore.java line 45

Environment

None

Activity

Show:
codehaus
April 10, 2015, 2:58 PM

CodeHaus Comment From: taraathan - Time: Mon, 22 Sep 2008 23:03:24 -0500
---------------------
I investigated this bug report- it appears to have been resolved already.

The unit test GMLDataStoreFactoryTest.java has test cases which call

GMLDataStoreFactory.CreateDataStore with a URL to a file and a URL to a

directory, and both tests are passed.

However, the test for the directory URL is a little weak- it doesn't really

demonstrate that the GMLDataStore that is created contains multiple files.

So I fixed this up by putting two data files into the test directory,

so the expected value in the assert statement is 2 when the datastore

refers to the directory, and 1 when it refers to a file.

I made one of the datafiles with an .xml extension, so this also tests the filename filter.

The existing GMLDataSourceFactory.java also passes this enhanced test.

The attached files

  GMLDataStoreFactoryTest.java

and

  AbstractGMLTestCase.java

constitute the enhanced test.

I also replaced deprecated calls of toURL() with toURI().toURL() in the test.

However, in the process of sorting through the code, I found a small error

on line 71 of GMLDataSourceFactory.java

71 Integer buffer=(Integer) params.get(TIMEOUT.key);

should be

71 Integer buffer=(Integer) params.get(BUFFER_SIZEP.key);

The attached file

  GMLDataStoreFactory.java

contains the corrected code.

I could not figure out how to write a unit test for this.

codehaus
April 10, 2015, 2:58 PM

CodeHaus Comment From: taraathan - Time: Mon, 22 Sep 2008 23:35:51 -0500
---------------------
Here is the patch.

codehaus
April 10, 2015, 2:58 PM

CodeHaus Comment From: aaime - Time: Sat, 5 Mar 2011 11:47:43 -0600
---------------------
The GML datastore has been dropped due to persistent lack of mantainership

Assignee

Unassigned

Reporter

codehaus

Triage

None

Components

Affects versions

Priority

Lowest
Configure