https://issues.apache.org/bugzilla/show_bug.cgi?id=46048

           Summary: Wrong images used (how to clear image cache?)
           Product: Fop
           Version: 0.95
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Severity: normal
          Priority: P2
         Component: images
        AssignedTo: fop-dev@xmlgraphics.apache.org
        ReportedBy: [EMAIL PROTECTED]


The problem: if an (SVG) image with the same file name (but different file
path!)  is generated more than 1 times, FOP always uses the (wrong) first
image.

We use relative paths in our XSLs to reference SVG images. This worked good in
FOP 0.20.5 but doesn't work in FOP 0.95 anymore (well, it works with FOP 0.95
when called via FOP.bat but it doesn't work when called from within a Java app
via the FOP Java API). So I wrote a custom URIResolver to change the file name
to the current unique file path. This solves the problem of the (so far) not
working relative paths for images.

However, if a subsequent document generates the same report with the same file
but with different data, FOP doesn't use the newly generated file content but
the old image of the first report. I guess the internal image cache doesn't use
the resolved image file name but the first generated one.

Example:

1. XSL content:

<svg:image width="170mm" height="120mm" xlink:href="C_PerfRiskCons_M.svg"
xmlns:xlink="http://www.w3.org/1999/xlink"/>

2. custom URIResolver changes

  'file:/D:/Tmp/iComps/amc/reports/C_PerfRiskCons_M.svg' 

to

 
'file:///D:\Tmp\iComps\amc\reports\dVwIIqKYfobFQDzUFJDQ5Er60ovA0G7YMpAVypnaMhY=\C_PerfRiskCons_M.svg'.

with "dVwIIqKYfobFQDzUFJDQ5Er60ovA0G7YMpAVypnaMhY=" being a unique GUID for
each report.

=> it seems FOP 0.95 uses  
'file:/D:/Tmp/iComps/amc/reports/C_PerfRiskCons_M.svg' for the image cache
which would explain the faulty behaviour.

I tried to work around this by serializing report generation and clearing the
image cache before each report, but there is no
org.apache.fop.image.FopImageFactory.resetCache() anymore in FOP 0.95 and I
didn't find any other resetCache() method in the API.

How can I work around this?


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to