[Geoserver-devel] [jira] Created: (GEOS-1296) NPE when adding a new feature type on PostGIS data source where the table is empty

NPE when adding a new feature type on PostGIS data source where the table is empty
----------------------------------------------------------------------------------

                 Key: GEOS-1296
                 URL: http://jira.codehaus.org/browse/GEOS-1296
             Project: GeoServer
          Issue Type: Bug
    Affects Versions: 1.6.0-beta2
         Environment: MacOS Tomcat-6.0.13 java-1.5.0_07
            Reporter: Jean-Pierre Fiset
            Assignee: Andrea Aime

Attempting to add a new feature type on a PostGIS/PostgreSQL table, when the table is empty, produces a Null Pointer Excpetion in GeoServer when applying the configuration. The error does not happen if a single row is populated.

To reproduce the problem:
1. Create a new table on a PostgreSQL database loaded with PostGIS. This new table should have a geometry column and the geometry column should be properly reported in the 'geometry_columns' table. For example's sake, use 4326 as srid.
2. Add database to data stores
3. Add a new feature type based on the created table. The SRS will be filled out properly to 4326, however the user must enter the bounding box (0,0,0,0)
4. Press submit
5. Press apply
6. Witness crash

Here are the logs reported by GeoServer. This log portion occurs after the feature 'new' button:

17 Aug 13:54:38 DEBUG [data.postgis] - PostGIS version is 1.2 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
17 Aug 13:54:38 DEBUG [data.postgis] - Postgres version is 8.2.3
17 Aug 13:54:38 DEBUG [data.postgis] - geometry type sql statement is SELECT type FROM geometry_columns WHERE f_table_schema='public' AND f_table_name='jp_comments' AND f_geometry_column='the_geom';
17 Aug 13:54:38 DEBUG [data.postgis] - geometry type is: MULTIPOINT
17 Aug 13:54:38 DEBUG [data.postgis] - srid statement is SELECT srid FROM geometry_columns WHERE f_table_schema='public' AND f_table_name='jp_comments' AND f_geometry_column='the_geom';
17 Aug 13:54:38 DEBUG [data.postgis] - srid statement is SELECT srid FROM geometry_columns WHERE f_table_schema='public' AND f_table_name='jp_comments' AND f_geometry_column='the_geom';
17 Aug 13:54:38 DEBUG [data.postgis] - get Feature source called on jp_comments
17 Aug 13:54:38 DEBUG [data.postgis] - returning pg feature locking
rest based on schemaBase: gml:AbstractFeatureType
17 Aug 13:54:38 DEBUG [data.postgis] - PostGIS version is 1.2 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
17 Aug 13:54:38 DEBUG [data.postgis] - Postgres version is 8.2.3
17 Aug 13:54:38 DEBUG [data.postgis] - geometry type sql statement is SELECT type FROM geometry_columns WHERE f_table_schema='public' AND f_table_name='jp_comments' AND f_geometry_column='the_geom';
17 Aug 13:54:38 DEBUG [data.postgis] - geometry type is: MULTIPOINT
17 Aug 13:54:38 DEBUG [data.postgis] - srid statement is SELECT srid FROM geometry_columns WHERE f_table_schema='public' AND f_table_name='jp_comments' AND f_geometry_column='the_geom';
17 Aug 13:54:38 DEBUG [data.postgis] - srid statement is SELECT srid FROM geometry_columns WHERE f_table_schema='public' AND f_table_name='jp_comments' AND f_geometry_column='the_geom';

This portion of the logs occurs after the 'submit' button:

rest based on schemaBase: gml:AbstractFeatureType
17 Aug 13:55:01 DEBUG [data.postgis] - PostGIS version is 1.2 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
17 Aug 13:55:01 DEBUG [data.postgis] - Postgres version is 8.2.3
17 Aug 13:55:01 DEBUG [data.postgis] - geometry type sql statement is SELECT type FROM geometry_columns WHERE f_table_schema='public' AND f_table_name='jp_comments' AND f_geometry_column='the_geom';
17 Aug 13:55:01 DEBUG [data.postgis] - geometry type is: MULTIPOINT
17 Aug 13:55:01 DEBUG [data.postgis] - srid statement is SELECT srid FROM geometry_columns WHERE f_table_schema='public' AND f_table_name='jp_comments' AND f_geometry_column='the_geom';
17 Aug 13:55:01 DEBUG [data.postgis] - srid statement is SELECT srid FROM geometry_columns WHERE f_table_schema='public' AND f_table_name='jp_comments' AND f_geometry_column='the_geom';
17 Aug 13:55:01 DEBUG [geoserver.action] - form bean:org.vfny.geoserver.form.data.TypesEditorForm
17 Aug 13:55:01 DEBUG [geoserver.action] - TypesEditorAction is Submit
17 Aug 13:55:01 DEBUG [geoserver.action] - BBOX: Generate
17 Aug 13:55:01 DEBUG [geoserver.action] - config schema atts is null

This portion of the logs occurs after the 'apply' button:

17 Aug 13:55:13 WARN [action.RequestProcessor] - Unhandled Exception thrown: class java.lang.NullPointerException

I suspect that this problem is related to GEOS-1295

--
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