[ 
https://issues.apache.org/jira/browse/XGC-131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chris Bowditch updated XGC-131:
-------------------------------
    Summary: [PATCH] UnrestrictedFallbackResolver opens input stream for wrong 
resource  (was: UnrestrictedFallbackResolver opens input stream for wrong 
resource)

> [PATCH] UnrestrictedFallbackResolver opens input stream for wrong resource
> --------------------------------------------------------------------------
>
>                 Key: XGC-131
>                 URL: https://issues.apache.org/jira/browse/XGC-131
>             Project: XMLGraphicsCommons
>          Issue Type: Bug
>          Components: general
>    Affects Versions: 2.7, trunk
>            Reporter: Peter Schlömer
>            Priority: Major
>         Attachments: test-unrestricted-fallback-resolver.zip, 
> xmlgraphics-commons-patch-1.txt
>
>
> There is a bug in {{UnrestrictedFallbackResolver}} (an embedded class in 
> {{{}AbstractImageSessionContext{}}}) which causes it to open an input stream 
> for the wrong resource (the Source) instead of the {{uri}} of the image 
> passed to {{{}createSource(...){}}}.
> This happens whenever the systemId in the Source starts with {{{}file:{}}}. 
> Instead of opening a {{FileInputStream}} for the image referenced by 
> {{{}uri{}}}, a stream for the URI in the Source's systemId is opened.
> I discovered this because FOP is unable to include images in a PDF in one of 
> our applications. Instead of reading the image file, it tries to use the FOP 
> document as an image. I was able to avoid this problem on the FOP level by 
> using {{{}EnvironmentalProfileFactory.createRestrictedIO(...){}}}, which 
> switches to the {{RestricedFallbackResolver}} which does not have the problem.
> A patch for {{AbstractImageSessionContext.java}} is attached 
> ([^xmlgraphics-commons-patch-1.txt]).
> Also attached is a Zip file countaining a Maven project 
> ([^test-unrestricted-fallback-resolver.zip]). Running {{mvn test}} on this 
> project will run 6 unit tests, repeating the same tests 3 times to show the 
> different behaviour between
>  * {{UnrestrictedFallbackResolver}} (where the test recreating the conditions 
> described above fails)
>  * {{RestricedFallbackResolver}}
>  * a class containing the patched version of {{UnrestrictedFallbackResolver}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: general-h...@xmlgraphics.apache.org

Reply via email to