This 'error' is showstopper on Windows 2000 and on Linux until the process
container is active; the Linux command 'fuser' on the temporary file returns
the Tomcat PID but, when the container stops, the file can be deleted:

The servlet runs on Tomcat v 5.0.28 and uses the Jakarta Slide WebDav Client
API v 2.1




 I created a WebDavResource using a File from local filesystem.....

 [CODE]
       File fileSchema = getFile(theRequest.getInputStream());
       WebDavSchema webDav = new WebDavSchema(pathSchemaWeb, userWeb,
passwordWeb, nameSchema, fileSchema);

 [/CODE]









The getFile Method comes from a perfectly-tested servlet....

[CODE]
 public File getFile(InputStream theStream) throws Exception {
   File file = File.createTempFile(SCHEMA, EXT_SCHEMA, new File("."));
   FileOutputStream fileOut = new FileOutputStream(file);
   byte[] buffer = new byte[LEN_BUFFER];
   int byteRead;
   while ( (byteRead = theStream.read(buffer, 0, buffer.length)) != -1) {
     fileOut.write(buffer, 0, byteRead);
   }
   fileOut.close();
   return file;
 }
[/CODE]



WebDavSchema is the following....

[CODE]
public WebDavSchema(String theUrl, String theUser, String thePassword,
String theNameSchema, File theSchema) {
      HttpURL hrl = new HttpURL(theUrl);
      hrl.setUserinfo(theUser, thePassword);
      WebdavResource wdr = new WebdavResource(hrl);
      wdr.putMethod( (wdr.getPath() + "/" + theNameSchema), theSchema);
      wdr.close();
    }
[/CODE]











The file on WebDav was succesfully wrote, but i cannot delete the temporary
File 'fileschema' ...

[CODE]
      boolean isWritable = fileSchema.canWrite();
      log_.debug("isWritable: " + isWritable);
      boolean isDelete = fileSchema.delete();
      log_.debug("isDelete: " + isDelete);
[/CODE]








The debugger returns:

isWritable = TRUE
isDelete   = FALSE





In fact file was'n't deleted !
Any idea?!?!?!?!?

All comments are welcome.
Thanks
AF
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.5/58 - Release Date: 25/07/2005


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to