if (limitedAttributeSize > 0 && fc.getSchema().getDescriptors().size() > limitedAttributeSize) {
if(fc instanceof SimpleFeatureCollection) {
// the datastore did not honour the query properties?? It's broken, but we can fix it
SimpleFeatureCollection sfc = (SimpleFeatureCollection) fc;
SimpleFeatureType target = SimpleFeatureTypeBuilder.retype(sfc.getSchema(), mixed.getPropertyNames());
ReTypingFeatureCollection retyped = new ReTypingFeatureCollection(sfc, target);
return (FeatureCollection) SecuredObjects.secure(retyped, policy);
} else {
// complex feature store eh? No way to fix it at least warn the admin
LOGGER.log(Level.SEVERE, "Complex store returned more properties than allowed " +
"by security (because they are required by the schema). " +