XStream
  1. XStream
  2. XSTR-685

Deserializing with StaxDriver cause xml source file kept opened

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.4.2
    • Fix Version/s: 1.4.5
    • Component/s: IO
    • Labels:
      None
    • JDK version and platform:
      1.7

      Description

      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

        People

        • Assignee:
          Jörg Schaible
          Reporter:
          Alessio Pollero
        • Votes:
          0 Vote for this issue
          Watchers:
          2 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: