Re: Deleting programmaticaly xul files
Martin van den Bemt <[email protected]> Thu, 10 Feb 2005 10:09:37 +0100
| Newsgroups | gmane.comp.java.luxor-xul.user |
|---|---|
| Message-ID | <[email protected]> |
Your try catch doesn't really add anything.
Add a finally, so the in.close is always executed in case of an error..
Don't know if it solves anything, but it at least is an improvement.
Mvgr,
Martin
sgfdgf ryejt wrote:
> Hi all,
> =20
> My application dynamically generates xul files and copy them in the=20
> chrome/startup directory. Then I use Luxor to render them in a java=20
> environment. But once the rendering is done, I would like to delete=20
> these xul files.
> =20
> To do so:
> =20
> File file =3D new file ("chrome/startup/myfile.xul");
> boolean b =3D file.delete();
> =20
> However, 90% (yes, not 100%) of the times, I cannot delete them and b =3D=
=3D=20
> false.
> =20
> I suspect, the xul file might be used my a thread or something. However=
=20
> I can delete it manually from the windows explorer...
> =20
> I tried, in vain:
>=20
> while (!file.delete()) {} which loops forever...
> =20
> I also tried to modify the method:
> =20
> XulLoader.load(String name) {
> {
> try
> {
> T.debug( "loading xul file " + name );
> InputStream in =3D _loader.getResourceAsStream( name );
> SAXBuilder builder =3D new SAXBuilder();
> Document doc =3D builder.build( in );
> Element xul =3D doc.getRootElement();
> createElements( null, xul );
> T.debug( "xul file " + name + " successfully loaded" );
> // Here's my modification...
> try {
> in.close();
> }
> catch (IOException ex) {
> }
> }
> catch( JDOMException jex )
> {
> Xul.Error.XUL_PARSING_EXCEPTION( name, jex );
> }
> }
>=20
> ...didn't work either....
>=20
> Would you have an idea of how to fix this?
> =20
> Cheers,
> =20
> Julien
> =20
>=20
> -----------------------------------------------------------------------=
-
> D=E9couvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour v=
os=20
> mails !
> Cr=E9ez votre Yahoo! Mail=20
> <http://fr.rd.yahoo.com/mail/taglines/*http://fr.rd.yahoo.com/evt=3D259=
17/*http://fr.rd.yahoo.com/mail_fr/mail_campaigns/splash/taglines_250/def=
ault/*http://fr.promotions.yahoo.com/mail/creer28.html>=20
>=20
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=3D6595&alloc_id=3D14396&op=3Dclick