LOGGER.fine("Query is " + query + "\n To gt2: "
+ query.toDataQuery(maxFeatures));
//DJB: note if maxFeatures gets to 0 the while loop above takes care of this! (this is a subtle situation)
FeatureResults features = source.getFeatures(query.toDataQuery(
maxFeatures));
if (it.hasNext()) //DJB: dont calculate feature count if you dont have to. The MaxFeatureReader will take care of the last iteration
maxFeatures -= features.getCount();
//GR: I don't know if the featuresults should be added here for later
//encoding if it was a lock request. may be after ensuring the lock
//succeed?
results.addFeatures(meta, features);
if (featureLock != null) {
// geotools2 locking code
if (source instanceof FeatureLocking) {
((FeatureLocking) source).setFeatureLock(featureLock);
}
FeatureReader reader = null;
try {
for (reader = features.reader(); reader.hasNext();) {
feature = reader.next();
fid = feature.getID();
if (!(source instanceof FeatureLocking)) {
LOGGER.finest("Lock " + fid