Alessio Pollero created XSTR-685:
------------------------------------

             Summary: Deserializing with StaxDriver cause xml source file kept 
opened 
                 Key: XSTR-685
                 URL: https://jira.codehaus.org/browse/XSTR-685
             Project: XStream
          Issue Type: Bug
          Components: IO
    Affects Versions: 1.4.2
            Reporter: Alessio Pollero
            Assignee: Joerg Schaible
            Priority: Critical


Deserializing a class from an xml previously generated with xStream 
StaxDriver() cause that the file remain opened until i close the entire 
application.

A snippet of code that cause the issue :

File file = new File("C:\settings.xml");
XStream xstream = new XStream(new StaxDriver());
xstream.alias("Settings", Settings.class);
Settings s = (Settings) xstream.fromXML(file);

After calling fromXml() the file settings.xml remain locked(i can't remove the 
file) until the application ends.

A possible ugly workaround seem calling System.gc() after the fromXML() method 
...

See this related question on StackOverflow : 
http://stackoverflow.com/questions/8173124/java-xstream-closing-connection-to-file

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a 
href="http://xircles.codehaus.org/manage_email";>http://xircles.codehaus.org/manage_email</a>
</p>

Reply via email to