Hi,

I am developing an application on the top of the geotools. Basically 
this is JMapPane plus ability to edit attribute data in dbf.

I get a lot of the following exceptions:
org.geotools.data.shapefile.ShpFilesLocker$Trace: Locking 
file://D:/world.shp for write by StorageFile: 
world3299191838008476047.shx in thread main
     at 
org.geotools.data.shapefile.ShpFilesLocker.setTraceException(ShpFilesLocker.java:54)
     at 
org.geotools.data.shapefile.ShpFilesLocker.<init>(ShpFilesLocker.java:41)
     at org.geotools.data.shapefile.ShpFiles.acquireWrite(ShpFiles.java:509)
     at 
org.geotools.data.shapefile.StorageFile.replaceOriginals(StorageFile.java:97)
     at 
org.geotools.data.shapefile.ShapefileFeatureWriter.clean(ShapefileFeatureWriter.java:208)
     at 
org.geotools.data.shapefile.ShapefileFeatureWriter.close(ShapefileFeatureWriter.java:259)
     at 
org.geotools.data.TransactionStateDiff.applyDiff(TransactionStateDiff.java:271)
     at 
org.geotools.data.TransactionStateDiff.commit(TransactionStateDiff.java:151)
     at 
org.geotools.data.DefaultTransaction.commit(DefaultTransaction.java:182)

My rendering code is almost the same as famous ShapefileViewer.java example.

My writing code is:
Transaction updateTrans = new DefaultTransaction("update");
FeatureWriter<SimpleFeatureType, SimpleFeature> writer = 
featureStore.getDataStore()
     .getFeatureWriter(featureStore.getDataStore().getTypeNames()[0],
         new FidFilterImpl(changedFeautureId2Feature.keySet()), 
updateTrans);
for (; writer.hasNext();) {
   SimpleFeature feature2Update = writer.next();
   SimpleFeature feature = 
changedFeautureId2Feature.get(feature2Update.getIdentifier());
   for (int i = 0; i < attributes.length; i++) {
     feature2Update.setAttribute(attributes[i], 
feature.getAttribute(attributes[i]));
   }
   writer.write();
}
writer.close();
updateTrans.commit();
updateTrans.close();

Please tell me where can I go from here to fix this problem.

Thanks,
Sergey


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to