|
From: Michal P. <pl...@nc...> - 2005-08-10 01:16:02
|
Dnia 2005-08-10 02:57, Michal Postupalski napisa=B3(a):
> Hi !
>=20
> I've got problem with deleting attached file as payload after
> successfully sent message. Seems that attached file is lock'ed. Doing
> something like this:
>=20
> <stub>
> File payload =3D new File("payload.xml");
> ...
> ...
> AttachmentDataSource ads =3D new AttachmentDataSource( payload,
> "application/xml" );
> DataHandler dataHandler =3D new DataHandler( ads );
> message.addPayloadContainer( dataHandler, payload.getName(),
> "description" );
> ....
> ....
> message.saveChanges();
> mshRequest.send( message );
>=20
> if ( !payload.delete() ) {
> //and can't delete file
> System.out.println( "always return false" );
> }
> </stub>
>=20
> I was checking read/write rights and always returned true.
>=20
> Can anybody help me with it???
ok, problem solved ;) I should load attachment to memory:
AttachmentDataSource ads =3D new AttachmentDataSource( payload,
"application/xml", true );
|