Sorry for the late response. Not sure if you have already addressed it but
I am fine with your proposed change to special case windows.

On Sun, Nov 2, 2014 at 9:19 AM, Andrea Aime <[email protected]>
wrote:

> Hi,
> during the last two days I've spend a good amount of time trying to get
> the importer build on Windows.
> I've managed to fix some issues, but one remains that seems to be
> impregnable to my attempts at fixing it.
>
> This is the failure, in summary:
>
> Results :
>
> Failed tests:
> testArchiveOnIndirectImport(org.geoserver.importer.ImporterDataTest)
>
> And it's due to this log statement:
>
> Running org.geoserver.importer.ImporterDataTest
> SimpleFeatureTypeImpl http://geotools.org:feature identified extends
> Feature(geometry:geometry,int:int,string:string,double:double)
> java.io.IOException: unable to delete
> target\importer2070856181511784271data\archsites.shp
>         at org.geoserver.importer.Directory.cleanup(Directory.java:450)
>         at org.geoserver.importer.Directory.archive(Directory.java:434)
>         at org.geoserver.importer.Importer.run(Importer.java:711)
>         at org.geoserver.importer.Importer.run(Importer.java:663)
>         at org.geoserver.importer.Importer.run(Importer.java:659)
>         at
> org.geoserver.importer.ImporterDataTest.testArchiveOnIndirectImport(ImporterDataTest.java:480)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
>         at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>         at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
>         at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>         at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
>         at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
>
> Now... I saw that the code in the importer was pretty fragile, opening a
> feature reader and a writer
> outside of a try/finally block, with no guarantee of them being always
> closed.
> So I've modified that, and it did not help.
>
> Then tried to replicate sort of what the importer is doing in a Shapefile
> test (and committed it), but it is not breaking
> on Windows for me, which seems to suggest Shapefile itself is not leaving
>
> @Test
>     public void testReadDelete() throws Exception {
>         File shpFile = copyShapefiles(STATE_POP);
>         ShapefileDataStore ds = new
> ShapefileDataStore(shpFile.toURI().toURL());
>         try (FeatureReader<SimpleFeatureType, SimpleFeature> reader =
> ds.getFeatureReader(new Query(ds.getTypeNames()[0]),
> Transaction.AUTO_COMMIT)) {
>             reader.getFeatureType();
>             while(reader.hasNext()) {
>                 reader.next();
>             }
>         }
>         ds.dispose();
>
>         assertTrue(shpFile.delete());
>         assertTrue(sibling(shpFile, "shx").delete());
>         assertTrue(sibling(shpFile, "dbf").delete());
>     }
>
> The issue seems to be related to garbage collection and/or timing, because
> I cannot reproduce
> it while debugging, only while running (and even there, often, but not
> always).
>
> One thing that I've noticed is that the common VFS code in VFSWorker seems
> to memory map the shapefile in question (as reported by Sysinternals
> "Process monitor"),
> and also noticed that we are using a old version of VFS (v1.0, whilst v2.0
> has been released in 2011).
> So maybe the issue could be here, but it's just a blind guess.
>
> Anyone has ideas? I'm tempted to just check if the OS is Windows, and if
> so, do not check
> that the input directory has been deleted at line 481 of that test.
> To the best of my knowledge, this is the last issue before we can get a
> working build of GeoServer
> on Windows.
>
> Cheers
> Andrea
>
>
> --
> ==
> 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
>
> *AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*
>
> Le informazioni contenute in questo messaggio di posta elettronica e/o
> nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
> loro utilizzo è consentito esclusivamente al destinatario del messaggio,
> per le finalità indicate nel messaggio stesso. Qualora riceviate questo
> messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
> darcene notizia via e-mail e di procedere alla distruzione del messaggio
> stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
> divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
> utilizzarlo per finalità diverse, costituisce comportamento contrario ai
> principi dettati dal D.Lgs. 196/2003.
>
>
>
> The information in this message and/or attachments, is intended solely for
> the attention and use of the named addressee(s) and may be confidential or
> proprietary in nature or covered by the provisions of privacy act
> (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
> Code).Any use not in accord with its purpose, any disclosure, reproduction,
> copying, distribution, or either dissemination, either whole or partial, is
> strictly forbidden except previous formal approval of the named
> addressee(s). If you are not the intended recipient, please contact
> immediately the sender by telephone, fax or e-mail and delete the
> information in this message that has been received in error. The sender
> does not give any warranty or accept liability as the content, accuracy or
> completeness of sent messages and accepts no responsibility  for changes
> made after they were sent or for other risks which arise as a result of
> e-mail transmission, viruses, etc.
>
> -------------------------------------------------------
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Geoserver-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-devel
>
>


-- 
Justin Deoliveira
VP Engineering | Boundless <http://boundlessgeo.com/>
[email protected]
@boundlessgeo <http://twitter.com/boundlessgeo/>
------------------------------------------------------------------------------
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to