You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Andrea Faustini <an...@sosinel.com> on 2005/07/27 11:49:04 UTC
[Slide Client API] Cannot delete source file after WebDavResource creation
I can reproduce this error only on Windows 2000. On Linux all works fine:
My servlet runs on Tomcat and uses the Jakarta Slide Client API.
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 =3D File.createTempFile(SCHEMA, EXT_SCHEMA, new = File("."));
FileOutputStream fileOut =3D new FileOutputStream(file);
byte[] buffer =3D new byte[LEN_BUFFER];
int byteRead;
while ( (byteRead =3D theStream.read(buffer, 0, buffer.length)) !=3D
=-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: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
RE: [Slide Client API] Cannot delete source file after WebDavResource creation
Posted by Andrea Faustini <an...@sosinel.com>.
Up !
> 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: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.338 / Virus Database: 267.9.7/60 - Release Date: 28/07/2005
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.338 / Virus Database: 267.9.7/60 - Release Date: 28/07/2005
>
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.9/62 - Release Date: 02/08/2005
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
RE: [Slide Client API] Cannot delete source file after WebDavResource creation
Posted by Andrea Faustini <an...@sosinel.com>.
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: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
RE: [Slide Client API] Cannot delete source file after WebDavResource creation
Posted by Andrea Faustini <an...@sosinel.com>.
Please ignore previous mail. It contains some error due to the mail agent...
a new mail will follow.
tnx
AF
> -----Original Message-----
> From: Andrea Faustini [mailto:andrea.faustini@sosinel.com]
> Sent: Wednesday, July 27, 2005 11:49 AM
> To: Slide Users Mailing List
> Subject: [Slide Client API] Cannot delete source file after
> WebDavResource creation
>
>
> I can reproduce this error only on Windows 2000. On Linux all works fine:
>
> My servlet runs on Tomcat and uses the Jakarta Slide Client API.
> 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 =3D File.createTempFile(SCHEMA, EXT_SCHEMA, new =
> File("."));
> FileOutputStream fileOut =3D new FileOutputStream(file);
> byte[] buffer =3D new byte[LEN_BUFFER];
> int byteRead;
> while ( (byteRead =3D theStream.read(buffer, 0, buffer.length)) !=3D
> =-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: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.338 / Virus Database: 267.9.5/58 - Release Date: 25/07/2005
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.338 / Virus Database: 267.9.5/58 - Release Date: 25/07/2005
>
--
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: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org