RFR: 8268222: javax/xml/jaxp/unittest/transform/Bug6216226Test.java failed, cannot delete file

Joe Wang joehw at openjdk.java.net
Fri Jun 4 16:06:59 UTC 2021


On Fri, 4 Jun 2021 08:50:09 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> Revert changes in StreamResult.java made through https://github.com/openjdk/jdk/pull/4318 since it was creating a file stream on behalf of the Transformer, which resulted in a leaking file handle because the Transformer would only close files it opened.
>> 
>> This change instead replace the problematic file-uri-url-file conversion code with nio Paths. While we generally don't make such changes if it's not necessary as Apache still supports older versions of the JDK, we are okay with a code level 8.
>
> src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java line 52:
> 
>> 50: import java.net.UnknownServiceException;
>> 51: import java.nio.file.Path;
>> 52: import java.nio.file.Paths;
> 
> Nit: you should not need to use Paths. `Paths.get(URI)` just calls `Path.of(URI)`

Right, but Path.of was introduced in JDK 11. I hope to avoid more advanced features if we can keep the code level at 8. There had been previous cases where we stayed at 8. So far, only a few classes need to be modified for java.xml to compile at 8.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4353


More information about the core-libs-dev mailing list