On Sun, 3 Jan 2021 03:08:31 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:

>> Cleanup code to use new handy methods in 
>> `java.io.InputStream`/`java.nio.file.Files` instead of manual stream copy:
>> 1. java.io.InputStream#readAllBytes
>> 2. java.io.InputStream#transferTo
>> 3. java.nio.file.Files#copy
>> 
>> Similar issue - https://bugs.openjdk.java.net/browse/JDK-8080272
>
> src/java.desktop/windows/classes/sun/print/Win32PrintJob.java line 435:
> 
>> 433:             if (mDestination != null) { // if destination attribute is 
>> set
>> 434:                 try {
>> 435:                     Files.copy(instream, Path.of(mDestination));
> 
> Looks like the new code unlike the old one will throw an exception if the 
> file is exists already. WIll it affect the printing functionality?

good catch! Added `StandardCopyOption.REPLACE_EXISTING` to preserve behavior.

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

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

Reply via email to