[Gdal-dev] Strange error during Driver.Create(String filename, ...)

Frank Warmerdam warmerdam at pobox.com
Tue Jan 9 11:51:25 EST 2007


Daniele Romagnoli wrote:
> However, using the SAME code within the body of the "write" method of 
> the MyJP2KImageWriter class (which extends ImageWriter), it does not work.
> (Such a method will be called during an ImageWrite operation performed 
> using JAI-ImageIO toolkit).

Daniele,

I'm afraid I am unclear of the differences between the standalone JUnit
test, and the MyJP2KImageWriter case.  Is, by any chance, the second running
as a web service with different permissions than when run directly by you
under your user account?

> containing the code
> 
> hFile = CreateFile( pszFilename, dwDesiredAccess, FILE_SHARE_READ | 
> FILE_SHARE_WRITE, NULL, dwCreationDisposition,  dwFlagsAndAttributes, 
> NULL );
 >
> which makes hFile equal to INVALID_HANDLE_VALUE (By this reason, the 
> Open method returns NULL).

You might want to copy some error reporting code similar to what is
in the ::Seek() method (ifdef'ed out) into the ::Open() method in
an attempt to see what errors windows is encountering.  Really the
cpl_vsil_win32.cpp code should be querying win32 errors, and attempting
to translate them into corresponding settings of the errno global so that
higher up functions can try and report the errors.

I will file a bug against GDAL about this, though it won't solve your
problem.  At best it would help diagnose it more easily.

I suspect the file creation is failing either:
  o Because your failing case has different permissions.
  o In your failing case the file already exists and is held open by something
    so it cannot be overwritten/replaced.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list