Deleting programmaticaly xul files

sgfdgf ryejt <[email protected]> Thu, 10 Feb 2005 04:18:56 +0100 (CET)
Newsgroups gmane.comp.java.luxor-xul.user
Message-ID <[email protected]>
--0-1665304528-1108005536=:40218
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi all,
=20
My application dynamically generates xul files and copy them in the chrom=
e/startup directory. Then I use Luxor to render them in a java environmen=
t. But once the rendering is done, I would like to delete 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 false.
=20
I suspect, the xul file might be used my a thread or something. However I=
 can delete it manually from the windows explorer...
=20
I tried, in vain:

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 );
      }
   }

...didn't work either....

Would you have an idea of how to fix this?
=20
Cheers,
=20
Julien
=20

	=09
---------------------------------
 D=E9couvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vo=
s mails !
Cr=E9ez votre Yahoo! Mail
--0-1665304528-1108005536=:40218
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

<DIV>Hi all,</DIV>
<DIV>&nbsp;</DIV>
<DIV>My application dynamically generates xul files and copy them in the =
chrome/startup directory. Then I use Luxor to render them in a java envir=
onment. But once the rendering is done, I would like to delete these xul =
files.</DIV>
<DIV>&nbsp;</DIV>
<DIV>To do so:</DIV>
<DIV>&nbsp;</DIV>
<DIV>File file =3D new file ("chrome/startup/myfile.xul");<BR>boolean b =3D=
 file.delete();</DIV>
<DIV>&nbsp;</DIV>
<DIV>However, 90% (yes, not 100%) of the times, I cannot delete them and =
b =3D=3D false.</DIV>
<DIV>&nbsp;</DIV>
<DIV>I suspect, the xul file might be used my a thread or something. Howe=
ver I can delete it manually from the windows explorer...</DIV>
<DIV>&nbsp;</DIV>
<DIV>I tried, in vain:</DIV>
<DIV><BR>while (!file.delete()) {}&nbsp; which loops forever...</DIV>
<DIV>&nbsp;</DIV>
<DIV>I also tried to modify the method:</DIV>
<DIV>&nbsp;</DIV>
<DIV>XulLoader.load(String name) {<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp; try<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; T.debug( "loading xul file " + name );<B=
R>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InputStream in =3D _lo=
ader.getResourceAsStream( name );</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SAXBuilder builder =
=3D new SAXBuilder();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 Document doc =3D builder.build( in );</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Element xul =3D doc=
.getRootElement();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cr=
eateElements( null, xul );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp; T.debug( "xul file " + name + " successfully loaded" );</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Here's my modification=
...<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<BR>&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in.close();<BR>&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 catch (IOException ex) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }=
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ca=
tch( JDOMException jex )<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Xul.Error.XUL_PARSING_EXCEPTION( =
name, jex );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp; }</DIV>
<DIV><BR>...didn't work either....</DIV>
<DIV><BR>Would you have an idea of how to fix this?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Cheers,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Julien</DIV>
<DIV>&nbsp;</DIV><p>
		<hr size=3D1>=20
D=E9couvrez le nouveau Yahoo! Mail : <font color=3D"red">250 Mo d'espace<=
/font> de stockage pour vos mails !<br><a href=3D"http://fr.rd.yahoo.com/=
mail/taglines/*http://fr.rd.yahoo.com/evt=3D25917/*http://fr.rd.yahoo.com=
/mail_fr/mail_campaigns/splash/taglines_250/default/*http://fr.promotions=
.yahoo.com/mail/creer28.html">Cr=E9ez votre Yahoo! Mail</a>
--0-1665304528-1108005536=:40218--


-------------------------------------------------------
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=6595&alloc_id=14396&op=click