Well that is looking more like a bug; since it is happening inside the
"commit" and not inside code you control.
Is there any chance that the "fid" (or FeatureId) is null (in the feature
collection you are writing out?)
The code looks like the following:
/**
* Writes the current fidIndex. Writes to the same place in the file each time.
Only
* {@link #next()} moves forward in the file.
*
* @throws IOException
* @see #next()
* @see #remove()
*/
public void write() throws IOException {
if (current == -1)
throw new IOException("Current fid index is null, next must be called before
write()");
....
Which eventually was called from the commit() method like follows:
public void close() throws IOException {
if (featureReader == null) {
throw new IOException("Writer closed");
}
// make sure to write the last feature...
if (currentFeature != null) {
write();
}
So something must be odd here?
a) is your feature ID null? Or did something fail writing this out?
b) did you get the feature collection from a database or something? If so you
sometimes need to preprocess the data to match shapefile abilities (string
length; geometry type; etc...)
c) is your feature collection empty?
Next step is to report an issue; with the detail you have provided in this
email thread; and create a test case showing the problem so a developer can
work on it. If you are up against a deadline I encourage you to look at our
support options to get this moving.
Cheers--
Jody Garnett
On Monday, 3 October 2011 at 1:30 AM, filippov70 wrote:
> ОК,
> java.io.IOException: Current fid index is null, next must be called before
> write()
> at
> org.geotools.data.shapefile.indexed.IndexedFidWriter.write(IndexedFidWriter.java:251)
> at
> org.geotools.data.shapefile.indexed.IndexedShapefileFeatureWriter.write(IndexedShapefileFeatureWriter.java:101)
> at
> org.geotools.data.shapefile.ShapefileFeatureWriter.close(ShapefileFeatureWriter.java:230)
> at
> org.geotools.data.shapefile.indexed.IndexedShapefileFeatureWriter.close(IndexedShapefileFeatureWriter.java:109)
> at
> org.geotools.data.TransactionStateDiff.applyDiff(TransactionStateDiff.java:276)
> at
> org.geotools.data.TransactionStateDiff.commit(TransactionStateDiff.java:147)
> at org.geotools.data.DefaultTransaction.commit(DefaultTransaction.java:182)
> at org.tomskgislab.landprocessor.MainForm.SaveToShape(MainForm.java:295)
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users