hello, I'm still working on the editableMap2D and I felt on a new kind of error when trying to edit or add a new feature in a indexedShapefileDatastore. It looks like this error happen on big shapefiles (>5000 features) and not on small ones.
First time I see this error : java.io.IOException: Current fid index is null, next must be called before write() at org.geotools.data.shapefile.indexed.IndexedFidWriter.write(IndexedFidWriter.java:244) at org.geotools.data.shapefile.indexed.IndexedShapefileFeatureWriter.write(IndexedShapefileFeatureWriter.java:80) at org.geotools.data.shapefile.ShapefileFeatureWriter.close(ShapefileFeatureWriter.java:212) at org.geotools.data.shapefile.indexed.IndexedShapefileFeatureWriter.close(IndexedShapefileFeatureWriter.java:88) at org.geotools.data.TransactionStateDiff.applyDiff(TransactionStateDiff.java:264) at org.geotools.data.TransactionStateDiff.commit(TransactionStateDiff.java:149) at org.geotools.data.DefaultTransaction.commit(DefaultTransaction.java:181) at org.geotools.gui.swing.map.map2d.JDefaultEditableMap2D.editAddGeometry(JDefaultEditableMap2D.java:361) here is the method I use: I already checked that the geometry and the String ID exists and are valid. String ID is like : "BATIMENT_SURF.9475" and Geometry is a JTS geometry. private synchronized void validateModifiedGeometry(Geometry geo, String ID) { FeatureStore store; if (editionLayer.getFeatureSource() instanceof FeatureStore) { String name = editionLayer.getFeatureSource().getSchema().getTypeName(); try { FeatureSource source = editionLayer.getFeatureSource().getDataStore().getFeatureSource(name); store = (FeatureStore) source; } catch (IOException e) { store = (FeatureStore) editionLayer.getFeatureSource(); } DefaultTransaction transaction = new DefaultTransaction("trans_maj"); store.setTransaction(transaction); FilterFactory ff = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints()); Filter filter = ff.id(Collections.singleton(ff.featureId(ID))); SimpleFeatureType featureType = editionLayer.getFeatureSource().getSchema(); AttributeDescriptor geomAttribut = featureType.getDefaultGeometry(); geo = projectGeometry(geo, editionLayer); try { store.modifyFeatures(geomAttribut, geo, filter); transaction.commit(); } catch (IOException ex) { ex.printStackTrace(); try { transaction.rollback(); } catch (IOException e) { e.printStackTrace(); } } finally { transaction.close(); } } } johann sorel ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Geotools-devel mailing list Geotools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel