Uploaded image for project: 'FOP'
  1. FOP
  2. FOP-2211

[PATCH] Fix & improve the handling of temporary files using the new URI resource resolvers



    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5
    • 2.2
    • unqualified
    • None


      As written in http://markmail.org/message/zelumstxxsdyvkcz , after the merge of the Temp_URI_Resolution branch (Sept 2012), the actual pattern of using temp files has changed from:

      File tmpFile = File.createTempFile(....);
      // Write and read from the file


      File tmpFile = new File(System.getProperty("java.io.tmpdir"), counterStartingFrom1AsString);
      // Write and read from the file

      This is fine when FOP is executed from the command line (which I guess this is how most people use it) but it introduces a number of bad side effects for long running processes that use FOP embedded.

      1. Different FOP processes can't be executed in parallel on the same system because creating the same temp file fails.

      2. If the JVM is not normally terminated, the temp files are never deleted and the next invocation of the JVM fails to run.

      3. deleteOnExit() keeps for the life of the JVM an unknown number of temp files both on disk and a reference in memory.

      There should not be a need to implement a custom resource resolver when using FOP embedded in order to fix those issues. The default implementation should work at least as good as it worked in FOP 1.1 or earlier.

      Attached are 2 patches, one for XGC and one for FOP that should fix and improve the handling of at least the temporary files.

      For reference, [1] lists some reasons for implementing the new URI resource resolvers.

      [1] http://wiki.apache.org/xmlgraphics-fop/URIResolution


        1. fop.patch
          3 kB
          Peter Hancock
        2. fop.patch
          31 kB
          Alexios Giotis
        3. tempurisimple.patch
          3 kB
          Simon Steiner
        4. xgc.patch
          4 kB
          Alexios Giotis



            phancock Peter Hancock
            alex.giotis Alexios Giotis
            0 Vote for this issue
            4 Start watching this issue