It's failing because you're pointing to a zip file instead of a shp one Cheers Andrea
On Mon, Aug 18, 2014 at 11:02 AM, Manuel <freaku...@gmx.de> wrote: > Hello guys, > > I have a short question which can be answered here hopefully cause I > really dont know why datastore is null in my code. > Here is the code fragment: > > 158 try { > 159 File dirUpload = new File > (dir.getAbsolutePath()+"\\"+filename); > 160 System.out.println("dirUpload: " + dirUpload ); > 161 > 162 Map<Object, Serializable> shapeParams = new > HashMap<Object, Serializable>(); > 163 System.out.println("shapeParams: " + shapeParams); > 164 > 165 shapeParams.put("url", dirUpload.toURI().toURL()); > 166 shapeParams.put("create spatial index", true); > 167 System.out.println("ShapeParams after put: " + > shapeParams); > 168 > 169 DataStore dataStore = > DataStoreFinder.getDataStore(shapeParams); > 170 System.out.println("Datastore: " + dataStore); > 171 > 172 String typeName = dataStore.getTypeNames()[0]; > > > And this is the debug output I get after running: > > dirUpload: > > C:\Users\DPipjorke\git\geonetwork\web\src\main\webapp\WEB-INF\data\data\metadata_data\00000-00099\51\private\dano.zip > shapeParams: {} > ShapeParams after put: {create spatial index=true, > > url=file:/C:/Users/DPipjorke/git/geonetwork/web/src/main/webapp/WEB-INF/data/data/metadata_data/00000-00099/51/private/dano.zip} > Datastore: null > java.lang.NullPointerException > at > > org.fao.geonet.services.resources.UploadAndProcess.exec(UploadAndProcess.java:172) > > > The exception which is mentioned in line 172 is caused by the dataStore > in line 169 which is null. But I dont understand why cause the > shapeParams Hashmap which is created before is not empty: > > I am thankful for evey advice > > Greetings > manuel > > > ------------------------------------------------------------------------------ > _______________________________________________ > GeoTools-GT2-Users mailing list > GeoTools-GT2-Users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > -- == GeoServer Professional Services from the experts! Visit http://goo.gl/NWWaa2 for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it -------------------------------------------------------
------------------------------------------------------------------------------
_______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users