[ 
https://jira.codehaus.org/browse/XSTR-685?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Joerg Schaible resolved XSTR-685.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 1.x Maintenance

Fixed in trunk. For now you may use a workaround by invoking the driver 
directly:
{code:java}
XStream xstream = new XStream((HierarchicalStreamDriver)null);
HierarchicalStreamDriver driver = new StaxDriver();
HierarchicalStreamReader reader = driver.createReader(file);
Object result = xstream.unmarshal(reader);
reader.close();
{code}
                
> 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
>             Fix For: 1.x Maintenance
>
>
> 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