PostgisDataStore.createSchema fails with type java.lang.Long
------------------------------------------------------------
Key: GEOT-1508
URL: http://jira.codehaus.org/browse/GEOT-1508
Project: GeoTools
Issue Type: Bug
Components: data postgis
Affects Versions: 2.4-RC0
Environment: JRE 1.5.0
Reporter: Andrew M
Assignee: Justin Deoliveira
Fix For: 2.4-RC1, 2.4-RC0
Attachments: PostgisDataStoreAPIOnlineTest.java
I found this when testing with this shapefile I found:
http://maps.civicactions.net/maps/geodata/world_borders/
Here is my altered JUnit test case. Attribute at4 has been added.
public void testCreateSchema() throws Exception {
String featureTypeName = "stuff";
// delete the table, if it exists
try {
Connection conn = pool.getConnection();
conn.setAutoCommit(true);
Statement st = conn.createStatement();
String sql = "DROP TABLE " + featureTypeName + ";";
st.execute(sql);
conn.close();
} catch (Exception e) {
// table didn't exist
}
// create a featureType and write it to PostGIS
CoordinateReferenceSystem crs = CRS.decode("EPSG:4326"); // requires
gt2-epsg-wkt
AttributeType at1 = AttributeTypeFactory.newAttributeType("id",
Integer.class);
AttributeType at2 = AttributeTypeFactory.newAttributeType("name",
String.class, false, 256);
AttributeType at3 = AttributeTypeFactory.newAttributeType("the_geom",
Point.class, false,
Filter.INCLUDE, null, crs);
AttributeType at4 = AttributeTypeFactory.newAttributeType("longtest",
Long.class);
AttributeType[] atts = new AttributeType[] { at1, at2, at3, at4 };
FeatureType newFT = FeatureTypeBuilder.newFeatureType(atts,
featureTypeName);
data.createSchema(newFT);
FeatureType newSchema = data.getSchema(featureTypeName);
assertNotNull(newSchema);
assertEquals(3, newSchema.getAttributeCount());
}
Here is the stack trace:
java.io.IOException: Type 'class java.lang.Long' not supported!
at
org.geotools.data.postgis.PostgisDataStore.makeSqlCreate(PostgisDataStore.java:1545)
at
org.geotools.data.postgis.PostgisDataStore.createSchema(PostgisDataStore.java:1218)
at
org.geotools.data.postgis.PostgisDataStoreAPIOnlineTest.testCreateSchema(PostgisDataStoreAPIOnlineTest.java:420)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel