Re: Deleting programmaticaly xul files

Phalip Julien <[email protected]> Tue, 15 Feb 2005 00:01:33 +0100 (CET)
Newsgroups gmane.comp.java.luxor-xul.user
Message-ID <[email protected]>
--0-1112784435-1108422093=:73465
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Apparently the problem was not from Luxor.
I forgot to close explicitly the fileOutputStream I used to create the fi=
le. As I didn't keep any reference of this object I thought it would have=
 been closed automatically when the garbage collector killed it.
=20
So, forget about my "in.close()" patch.
=20
Cheers.

Martin van den Bemt <[email protected]> wrote:
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
>=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
_______________________________________________
luxor-xul-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luxor-xul-user

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

<DIV>Apparently the problem was not from Luxor.</DIV>
<DIV>I forgot to close explicitly the fileOutputStream I used to create t=
he file. As I didn't keep any reference of this object I thought it would=
 have been closed automatically when the garbage collector killed it.</DI=
V>
<DIV>&nbsp;</DIV>
<DIV>So, forget about my "in.close()" patch.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Cheers.<BR><BR><B><I>Martin van den Bemt &lt;[email protected]&gt;</I>=
</B> wrote:</DIV>
<BLOCKQUOTE class=3Dreplbq style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #1010ff 2px solid">Your try catch doesn't really add anythin=
g.<BR>Add a finally, so the in.close is always executed in case of an err=
or..<BR>Don't know if it solves anything, but it at least is an improveme=
nt.<BR><BR>Mvgr,<BR>Martin<BR><BR>sgfdgf ryejt wrote:<BR>&gt; Hi all,<BR>=
&gt; <BR>&gt; My application dynamically generates xul files and copy the=
m in the <BR>&gt; chrome/startup directory. Then I use Luxor to render th=
em in a java <BR>&gt; environment. But once the rendering is done, I woul=
d like to delete <BR>&gt; these xul files.<BR>&gt; <BR>&gt; To do so:<BR>=
&gt; <BR>&gt; File file =3D new file ("chrome/startup/myfile.xul");<BR>&g=
t; boolean b =3D file.delete();<BR>&gt; <BR>&gt; However, 90% (yes, not 1=
00%) of the times, I cannot delete them and b =3D=3D <BR>&gt; false.<BR>&=
gt; <BR>&gt; I suspect, the xul file might be used my a thread or somethi=
ng. However <BR>&gt; I can delete it manually from the
 windows explorer...<BR>&gt; <BR>&gt; I tried, in vain:<BR>&gt; <BR>&gt; =
while (!file.delete()) {} which loops forever...<BR>&gt; <BR>&gt; I also =
tried to modify the method:<BR>&gt; <BR>&gt; XulLoader.load(String name) =
{<BR>&gt; {<BR>&gt; try<BR>&gt; {<BR>&gt; T.debug( "loading xul file " + =
name );<BR>&gt; InputStream in =3D _loader.getResourceAsStream( name );<B=
R>&gt; SAXBuilder builder =3D new SAXBuilder();<BR>&gt; Document doc =3D =
builder.build( in );<BR>&gt; Element xul =3D doc.getRootElement();<BR>&gt=
; createElements( null, xul );<BR>&gt; T.debug( "xul file " + name + " su=
ccessfully loaded" );<BR>&gt; // Here's my modification...<BR>&gt; try {<=
BR>&gt; in.close();<BR>&gt; }<BR>&gt; catch (IOException ex) {<BR>&gt; }<=
BR>&gt; }<BR>&gt; catch( JDOMException jex )<BR>&gt; {<BR>&gt; Xul.Error.=
XUL_PARSING_EXCEPTION( name, jex );<BR>&gt; }<BR>&gt; }<BR>&gt; <BR>&gt; =
...didn't work either....<BR>&gt; <BR>&gt; Would you have an idea of how =
to fix this?<BR>&gt; <BR>&gt; Cheers,<BR>&gt; <BR>&gt;
 Julien<BR>&gt; <BR>&gt; <BR>&gt; ---------------------------------------=
---------------------------------<BR>&gt; D=E9couvrez le nouveau Yahoo! M=
ail : 250 Mo d'espace de stockage pour vos <BR>&gt; mails !<BR>&gt; Cr=E9=
ez votre Yahoo! Mail <BR>&gt; <HTTP: evt=3D"25917/*http://fr.rd.yahoo.com=
/mail_fr/mail_campaigns/splash/taglines_250/default/*http://fr.promotions=
.yahoo.com/mail/creer28.html" fr.rd.yahoo.com *http: taglines mail><BR>&g=
t; <BR><BR><BR>-------------------------------------------------------<BR=
>SF email is sponsored by - The IT Product Guide<BR>Read honest &amp; can=
did reviews on hundreds of IT Products from real users.<BR>Discover which=
 products truly live up to the hype. Start reading now.<BR>http://ads.osd=
n.com/?ad_id=3D6595&amp;alloc_id=3D14396&amp;op=3Dclick<BR>______________=
_________________________________<BR>luxor-xul-user mailing list<BR>luxor=
[email protected]<BR>https://lists.sourceforge.net/lists/li=
stinfo/luxor-xul-user<BR></BLOCKQUOTE><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-1112784435-1108422093=:73465--


-------------------------------------------------------
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