Hi !
I found an error trying to add a SimpleFeature via WFSFeatureStore. Indeed a java.util.Date field seems to launch an error... here is my code :

Map connectionParameters = new HashMap();
                
connectionParameters.put("WFSDataStoreFactory:GET_CAPABILITIES_URL", monUrl);
                connectionParameters.put("WFSDataStoreFactory:TIMEOUT", 120000);

                WFSDataStore data;
                try {
                        data = (WFSDataStore) 
DataStoreFinder.getDataStore(connectionParameters);
                        WFSFeatureStore store = new 
WFSFeatureStore((WFS_1_0_0_DataStore) data, "ma_couche_wfs);
                        SimpleFeatureType schema = store.getSchema();

                        store.setTransaction(Transaction.AUTO_COMMIT);

                        /**
                         * Ajout
                         */
                        Geometry geom = 
GeometryBuilder.create().safeCreateGeometry(
                                MultiPolygon.class,
                                new Coordinate[] { new Coordinate(-3.75494301, 
5.43418669),
                                        new Coordinate(-4.27546832, 
5.45268878), new Coordinate(-4.28410263, 5.22572988),
                                        new Coordinate(-3.74754218, 5.22696335) 
});
                        geom.setSRID(4326);
                        geom.toString();
                        new WKTWriter().write(geom);
                        SimpleFeatureBuilder builder = new 
SimpleFeatureBuilder(FeatureTypeFactory
                                .createWFSFeatureType("nom_de_couche"));
                        SimpleFeature feat = builder.buildFeature("id_de_test");

                        feat.setAttribute("NAME_FR", "nom_fr_test");
                        feat.setAttribute("NAME_EN", "nom_anglais");
                        feat.setAttribute("DESCRIPTION", "descp");
                        feat.setAttribute("DIFFUSION_STATUS", "T");

                        feat.setAttribute("*C_DATE", new Date()*);
                        feat.setAttribute("M_DATE", null);
                        feat.setAttribute("D_DATE", null);
                        feat.setDefaultGeometry(geom);
                        store.*addFeatures*(new CollectionFeatureReader(new 
SimpleFeature[] { feat }));


and here is the error :

8 juin 2010 16:45:52 org.geotools.data.wfs.v1_0_0.WFSTransactionState commit
ATTENTION: javax.naming*.OperationNotSupportedException: java.util.Date*
java.io.IOException: An error occured while committing.
        at 
org.geotools.data.wfs.v1_0_0.WFSTransactionState.commit(WFSTransactionState.java:177)
        at 
org.geotools.data.wfs.v1_0_0.WFSFeatureStore.addFeatures(WFSFeatureStore.java:181)
        at 
org.geotools.data.wfs.v1_0_0.WFSFeatureStore.addFeatures(WFSFeatureStore.java:89)


thanks before :)

jonathan

<<attachment: jonathan_roques.vcf>>

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to