VTDGenHuge.parseFile() leaves the InputStream open

grimlock81
2013-07-29
2013-11-27
  • grimlock81
    grimlock81
    2013-07-29

    I'm referring to this bug https://sourceforge.net/p/vtd-xml/bugs/31/ but I can't figure out a way to leave a comment there so I'm starting this discussion topic.

    jimmy I agree with your last comment in that issue but I think a close() method should be added to the IByteBuffer interface so that the FileInputStream variable in XmlBuffer, or the RandomAccessFile in XMLMemMappedBuffer can be closed to allow the underlying file to be deleted after the user is finished processing it. Currently, with those streams open I am unable to delete those XML files which is a critical requirement for my application.

    I believe this IByteBuffer.close() method should be invoked in VTDGenHuge.clear(), where currently the IByteBuffer variable xb is set to null as this is an indication that the IByteBuffer object is no longer needed. Hence a cleanup of the resources would be most approriate at this location.

    Keen to hear your thoughts.

     
  • jimmy zhang
    jimmy zhang
    2013-07-29

    ok, will look into this sounds like a quick fix

     
  • jimmy zhang
    jimmy zhang
    2013-07-29

    Yes, I think you suggestion is quite reasonable, I have added that method to IByteBuffer and XMLBuffer and XMLMemMappedBuffer, slated for official release in 2.12. how does that sound?

     
    • grimlock81
      grimlock81
      2013-07-30

      That sounds great jimmy! What's the release schedule for 2.12 like?

       
  • jimmy zhang
    jimmy zhang
    2013-07-30

    Hopefully by the end of august

     
  • I have the same problem. Any news about the 2.12 release?

    Are the changes commited?
    Then I can just build the library from the source.

     
    • jimmy zhang
      jimmy zhang
      2013-11-27

      change is commited plz check out cvs