Project

Profile

Help

Support #4833

closed

Resource leak when using an URIResolver

Added by Philip Helger over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
JAXP Java API
Sprint/Milestone:
-
Start date:
2020-11-19
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
10
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

Hi,

I've been pointed to an issue, that included resources of some Schematrons cannot be deleted after compilations, because the resource is "in use". When debugging through the relevant code pieces, I stumbled upon this code snippet in clas DocumentFN lines 385ff (Saxon-HE Java, 10.3):

        if (source instanceof StreamSource && ((StreamSource)source).getInputStream() == null && ((StreamSource)source).getReader() == null) {
            String uri = source.getSystemId();
 ...
       }

In my scenario ((StreamSource)source).getInputStream() opens a File and returns the respective handle (the same applies of course to ((StreamSource)source).getReader()) as well. As this InputStream is never closed it creates a resource leak.

So please make sure InputStream and Reader are closed if they are opened.

Thanks, Philip

Please register to edit this issue

Also available in: Atom PDF