Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy

2021-03-15 Thread Julia Boes
On Thu, 18 Feb 2021 07:12:34 GMT, Andrey Turbanov 
 wrote:

>> Hi @turbanoff, I'm happy to sponsor but I see two comments by @marschall - 
>> have they been addressed?
>> https://github.com/openjdk/jdk/pull/1853#discussion_r572815422
>> https://github.com/openjdk/jdk/pull/1853#discussion_r572380746
>
> @FrauBoes fixed in the last commit. Is there any way to de-_integrate_ PR (to 
> include last commit)?

@turbanoff  Tier 1-3 still all clear. If you /integrate, I will sponsor this 
tomorrow.

-

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v13]

2021-03-15 Thread Andrey Turbanov
> 8080272  Refactor I/O stream copying to use 
> InputStream.transferTo/readAllBytes and Files.copy

Andrey Turbanov has updated the pull request incrementally with one additional 
commit since the last revision:

  8080272 Refactor I/O stream copying to use 
InputStream.transferTo/readAllBytes and Files.copy
  drop changes in X509CertPath

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/1853/files
  - new: https://git.openjdk.java.net/jdk/pull/1853/files/1b30471d..96920ee6

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1853&range=12
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1853&range=11-12

  Stats: 25 lines in 1 file changed: 22 ins; 0 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1853.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1853/head:pull/1853

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy

2021-03-15 Thread Julia Boes
On Thu, 18 Feb 2021 07:12:34 GMT, Andrey Turbanov 
 wrote:

>> Hi @turbanoff, I'm happy to sponsor but I see two comments by @marschall - 
>> have they been addressed?
>> https://github.com/openjdk/jdk/pull/1853#discussion_r572815422
>> https://github.com/openjdk/jdk/pull/1853#discussion_r572380746
>
> @FrauBoes fixed in the last commit. Is there any way to de-_integrate_ PR (to 
> include last commit)?

@turbanoff Given that this PR has been lingering for a while, you could drop 
the change in `X509CertPath.java` for now and integrate the remaining changes. 
I'm happy to sponsor in that case.

-

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v11]

2021-03-07 Thread Andrey Turbanov
On Fri, 19 Feb 2021 15:03:11 GMT, Sean Mullan  wrote:

>> As I can see only ByteArrayInputStream is actually passed in `InputStream` 
>> in current JDK code:
>> 
>> PKCS7 pkcs7 = new PKCS7(is.readAllBytes());
>> private static List parsePKCS7(InputStream is)
>> certs = parsePKCS7(is);
>> public X509CertPath(InputStream is, String encoding)
>> return new X509CertPath(new ByteArrayInputStream(data), 
>> encoding);
>> 
>> PKCS7 pkcs7 = new PKCS7(is.readAllBytes());
>> private static List parsePKCS7(InputStream is)
>> certs = parsePKCS7(is);
>> public X509CertPath(InputStream is, String encoding)
>> this(is, PKIPATH_ENCODING);
>> public X509CertPath(InputStream is) throws 
>> CertificateException {
>> return new X509CertPath(new 
>> ByteArrayInputStream(encoding));
>> 
>> ![изображение](https://user-images.githubusercontent.com/741251/108475587-f4f61080-72a1-11eb-91e0-ac2b98c7c490.png)
>> 
>> Perhaps original marking approach was lost during refactoring?
>
> You are right, the code was refactored (way back in 2010) [1] to read one 
> block at a time, so this check on mark can be removed. So, in this case, I 
> think it is probably safe to just pass the InputStream as-is to 
> PKCS7(InputStream), but maybe you can add a comment that says this should 
> always be a ByteArrayInputStream. We can look at refactoring this code and 
> clean it up a bit more later.
> 
> [1] https://hg.openjdk.java.net/jdk/jdk/rev/337ae296b6d6

I find implementation of `sun.security.pkcs.PKCS7#PKCS7(java.io.InputStream)` a 
bit confusing (or even buggy). It uses only `InputStream.available()` to parse 
block.
So I would prefer to not use it.

-

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v11]

2021-02-19 Thread Sean Mullan
On Fri, 19 Feb 2021 08:05:06 GMT, Andrey Turbanov 
 wrote:

>> src/java.base/share/classes/sun/security/provider/certpath/X509CertPath.java 
>> line 228:
>> 
>>> 226: try {
>>> 227: if (is.markSupported() == false) {
>>> 228: // Copy the entire input stream into an InputStream 
>>> that does
>> 
>> I don't think you should remove lines 228-232. These methods are called by 
>> methods of CertificateFactory that take InputStream (which may contain a 
>> stream of security data) and they are designed such that they try to read 
>> one Certificate, CRL, or CertPath from the InputStream and leave the 
>> InputStream ready to parse the next structure instead of consuming all of 
>> the bytes. Thus they check if the InputStream supports mark in order to try 
>> to preserve that behavior. If mark is not supported, then it's ok to use 
>> InputStream.readAllBytes, otherwise, leave the stream as-is.
>
> As I can see only ByteArrayInputStream is actually passed in `InputStream` in 
> current JDK code:
> 
> PKCS7 pkcs7 = new PKCS7(is.readAllBytes());
> private static List parsePKCS7(InputStream is)
> certs = parsePKCS7(is);
> public X509CertPath(InputStream is, String encoding)
> return new X509CertPath(new ByteArrayInputStream(data), 
> encoding);
> 
> PKCS7 pkcs7 = new PKCS7(is.readAllBytes());
> private static List parsePKCS7(InputStream is)
> certs = parsePKCS7(is);
> public X509CertPath(InputStream is, String encoding)
> this(is, PKIPATH_ENCODING);
> public X509CertPath(InputStream is) throws 
> CertificateException {
> return new X509CertPath(new 
> ByteArrayInputStream(encoding));
> 
> ![изображение](https://user-images.githubusercontent.com/741251/108475587-f4f61080-72a1-11eb-91e0-ac2b98c7c490.png)
> 
> Perhaps original marking approach was lost during refactoring?

You are right, the code was refactored (way back in 2010) [1] to read one block 
at a time, so this check on mark can be removed. So, in this case, I think it 
is probably safe to just pass the InputStream as-is to PKCS7(InputStream), but 
maybe you can add a comment that says this should always be a 
ByteArrayInputStream. We can look at refactoring this code and clean it up a 
bit more later.

[1] https://hg.openjdk.java.net/jdk/jdk/rev/337ae296b6d6

-

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v11]

2021-02-19 Thread Andrey Turbanov
On Thu, 18 Feb 2021 19:21:45 GMT, Sean Mullan  wrote:

>> Andrey Turbanov has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo
>>   remove unnecessary file.exists() check
>
> src/java.base/share/classes/sun/security/provider/certpath/X509CertPath.java 
> line 228:
> 
>> 226: try {
>> 227: if (is.markSupported() == false) {
>> 228: // Copy the entire input stream into an InputStream 
>> that does
> 
> I don't think you should remove lines 228-232. These methods are called by 
> methods of CertificateFactory that take InputStream (which may contain a 
> stream of security data) and they are designed such that they try to read one 
> Certificate, CRL, or CertPath from the InputStream and leave the InputStream 
> ready to parse the next structure instead of consuming all of the bytes. Thus 
> they check if the InputStream supports mark in order to try to preserve that 
> behavior. If mark is not supported, then it's ok to use 
> InputStream.readAllBytes, otherwise, leave the stream as-is.

As I can see only ByteArrayInputStream is actually passed in `InputStream` in 
current JDK code:

PKCS7 pkcs7 = new PKCS7(is.readAllBytes());
private static List parsePKCS7(InputStream is)
certs = parsePKCS7(is);
public X509CertPath(InputStream is, String encoding)
return new X509CertPath(new ByteArrayInputStream(data), 
encoding);

PKCS7 pkcs7 = new PKCS7(is.readAllBytes());
private static List parsePKCS7(InputStream is)
certs = parsePKCS7(is);
public X509CertPath(InputStream is, String encoding)
this(is, PKIPATH_ENCODING);
public X509CertPath(InputStream is) throws 
CertificateException {
return new X509CertPath(new 
ByteArrayInputStream(encoding));

![изображение](https://user-images.githubusercontent.com/741251/108475587-f4f61080-72a1-11eb-91e0-ac2b98c7c490.png)

Perhaps original marking approach was lost during refactoring?

-

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v11]

2021-02-18 Thread Sean Mullan
On Mon, 15 Feb 2021 19:47:00 GMT, Andrey Turbanov 
 wrote:

>> 8080272  Refactor I/O stream copying to use 
>> InputStream.transferTo/readAllBytes and Files.copy
>
> Andrey Turbanov has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo
>   remove unnecessary file.exists() check

src/java.base/share/classes/sun/security/provider/certpath/X509CertPath.java 
line 228:

> 226: try {
> 227: if (is.markSupported() == false) {
> 228: // Copy the entire input stream into an InputStream that 
> does

I don't think you should remove lines 228-232. These methods are called by 
methods of CertificateFactory that take InputStream (which may contain a stream 
of security data) and they are designed such that they try to read one 
Certificate, CRL, or CertPath from the InputStream and leave the InputStream 
ready to parse the next structure instead of consuming all of the bytes. Thus 
they check if the InputStream supports mark in order to try to preserve that 
behavior. If mark is not supported, then it's ok to use 
InputStream.readAllBytes, otherwise, leave the stream as-is.

-

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy

2021-02-18 Thread Julia Boes
On Thu, 18 Feb 2021 07:12:34 GMT, Andrey Turbanov 
 wrote:

>> Hi @turbanoff, I'm happy to sponsor but I see two comments by @marschall - 
>> have they been addressed?
>> https://github.com/openjdk/jdk/pull/1853#discussion_r572815422
>> https://github.com/openjdk/jdk/pull/1853#discussion_r572380746
>
> @FrauBoes fixed in the last commit. Is there any way to de-_integrate_ PR (to 
> include last commit)?

To re-integrate, just run the /integrate command again. 

Before doing that, could someone from security libs acknowledge the changes in 
their area?

-

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy

2021-02-17 Thread Andrey Turbanov
On Tue, 16 Feb 2021 17:20:37 GMT, Julia Boes  wrote:

>> 8080272  Refactor I/O stream copying to use 
>> InputStream.transferTo/readAllBytes and Files.copy
>
> Hi @turbanoff, I'm happy to sponsor but I see two comments by @marschall - 
> have they been addressed?
> https://github.com/openjdk/jdk/pull/1853#discussion_r572815422
> https://github.com/openjdk/jdk/pull/1853#discussion_r572380746

@FrauBoes fixed in the last commit. Is there any way to de-_integrate_ PR (to 
include last commit)?

-

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v12]

2021-02-16 Thread Andrey Turbanov
> 8080272  Refactor I/O stream copying to use 
> InputStream.transferTo/readAllBytes and Files.copy

Andrey Turbanov has updated the pull request incrementally with one additional 
commit since the last revision:

  8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo
  cleanup

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/1853/files
  - new: https://git.openjdk.java.net/jdk/pull/1853/files/6e71e961..1b30471d

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1853&range=11
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1853&range=10-11

  Stats: 7 lines in 2 files changed: 0 ins; 5 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1853.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1853/head:pull/1853

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v9]

2021-02-16 Thread Andrey Turbanov
On Tue, 9 Feb 2021 11:40:09 GMT, Philippe Marschall 
 wrote:

>> Andrey Turbanov has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo
>>   fix review comments
>
> src/java.base/share/classes/java/util/jar/JarInputStream.java line 93:
> 
>> 91: if (e != null && 
>> JarFile.MANIFEST_NAME.equalsIgnoreCase(e.getName())) {
>> 92: man = new Manifest();
>> 93: byte[] bytes = new BufferedInputStream(this).readAllBytes();
> 
> I wonder if it makes sense to avoid reading the entire manifest into a byte[] 
> when we don't need to verify the JAR. This may help avoiding some 
> intermediate allocation and copying. This make be noticeable for some of the 
> larger manifests (Java EE, OSGi, ...). A possible implementation may look 
> like this 
> https://github.com/marschall/jdk/commit/c50880ffb18607077c4da3456b27957d1df8edb7.
> 
> In either case since we're calling #readAllBytes I don't see why we are 
> wrapping in a BufferedInputStream rather than calling #readAllBytes directly.

Usage of `BufferedInputStream` removed

-

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v9]

2021-02-16 Thread Andrey Turbanov
On Mon, 8 Feb 2021 21:18:44 GMT, Philippe Marschall 
 wrote:

>> Andrey Turbanov has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo
>>   fix review comments
>
> src/java.base/share/classes/sun/security/provider/certpath/X509CertPath.java 
> line 230:
> 
>> 228: // Copy the entire input stream into an InputStream 
>> that does
>> 229: // support mark
>> 230: is = new ByteArrayInputStream(is.readAllBytes());
> 
> I don't understand why the check for #markSupported is done there. The 
> InputStream constructor of PKCS7 creates a DataInputStream on the InputStream 
> only to then call #readFully. I can't find a place where a call to #mark 
> happens. Since the InputStream constructor reads all bytes anyway I wonder 
> whether we could remove this if and unconditionally do:
> 
> PKCS7 pkcs7 = new PKCS7(is.readAllBytes());

Good idea. Will improve.
By the way, code in `sun.security.pkcs.PKCS7#PKCS7(java.io.InputStream)`  looks 
suspicious: it reads only `InputStream.available()` bytes, which doesn't make 
much sense to me.

-

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy

2021-02-16 Thread Julia Boes
On Sun, 20 Dec 2020 17:05:21 GMT, Andrey Turbanov 
 wrote:

> 8080272  Refactor I/O stream copying to use 
> InputStream.transferTo/readAllBytes and Files.copy

Hi @turbanoff, I'm happy to sponsor but I see two comments by @marschall - have 
they been addressed?
https://github.com/openjdk/jdk/pull/1853#discussion_r572815422
https://github.com/openjdk/jdk/pull/1853#discussion_r572380746

-

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v11]

2021-02-15 Thread Alan Bateman
On Mon, 15 Feb 2021 19:47:00 GMT, Andrey Turbanov 
 wrote:

>> 8080272  Refactor I/O stream copying to use 
>> InputStream.transferTo/readAllBytes and Files.copy
>
> Andrey Turbanov has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo
>   remove unnecessary file.exists() check

Thanks for perceiving with this one. I think you've addressed all issues in the 
latest revision.

-

Marked as reviewed by alanb (Reviewer).

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v10]

2021-02-15 Thread Andrey Turbanov
On Mon, 15 Feb 2021 19:23:16 GMT, Alan Bateman  wrote:

>> Andrey Turbanov has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo
>>   revert changes from MimeLauncher
>
> src/java.management/share/classes/javax/management/loading/MLet.java line 
> 1149:
> 
>> 1147:  file.deleteOnExit();
>> 1148:  Files.copy(is, file.toPath(), 
>> StandardCopyOption.REPLACE_EXISTING);
>> 1149:  if (file.exists()) {
> 
> You might have missed the comment from a previous iteration. The 
> files.exists() check goes away when Files.copy succeeds.

You are right. Fixed.

-

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v11]

2021-02-15 Thread Andrey Turbanov
> 8080272  Refactor I/O stream copying to use 
> InputStream.transferTo/readAllBytes and Files.copy

Andrey Turbanov has updated the pull request incrementally with one additional 
commit since the last revision:

  8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo
  remove unnecessary file.exists() check

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/1853/files
  - new: https://git.openjdk.java.net/jdk/pull/1853/files/6614a10f..6e71e961

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1853&range=10
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1853&range=09-10

  Stats: 3 lines in 1 file changed: 0 ins; 2 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1853.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1853/head:pull/1853

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v10]

2021-02-15 Thread Alan Bateman
On Mon, 15 Feb 2021 18:33:00 GMT, Andrey Turbanov 
 wrote:

>> 8080272  Refactor I/O stream copying to use 
>> InputStream.transferTo/readAllBytes and Files.copy
>
> Andrey Turbanov has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo
>   revert changes from MimeLauncher

src/java.management/share/classes/javax/management/loading/MLet.java line 1149:

> 1147:  file.deleteOnExit();
> 1148:  Files.copy(is, file.toPath(), 
> StandardCopyOption.REPLACE_EXISTING);
> 1149:  if (file.exists()) {

You might have missed the comment from a previous iteration. The files.exists() 
check goes away when Files.copy succeeds.

-

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v10]

2021-02-15 Thread Maurizio Cimadamore
On Mon, 15 Feb 2021 18:33:00 GMT, Andrey Turbanov 
 wrote:

>> 8080272  Refactor I/O stream copying to use 
>> InputStream.transferTo/readAllBytes and Files.copy
>
> Andrey Turbanov has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo
>   revert changes from MimeLauncher

The changes to sjavac changes look good

-

Marked as reviewed by mcimadamore (Reviewer).

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v10]

2021-02-15 Thread Andrey Turbanov
> 8080272  Refactor I/O stream copying to use 
> InputStream.transferTo/readAllBytes and Files.copy

Andrey Turbanov has updated the pull request incrementally with one additional 
commit since the last revision:

  8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo
  revert changes from MimeLauncher

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/1853/files
  - new: https://git.openjdk.java.net/jdk/pull/1853/files/6a8a3ae6..6614a10f

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1853&range=09
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1853&range=08-09

  Stats: 19 lines in 1 file changed: 11 ins; 0 del; 8 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1853.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1853/head:pull/1853

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v8]

2021-02-15 Thread Julia Boes
On Sat, 13 Feb 2021 10:56:32 GMT, Andrey Turbanov 
 wrote:

>> This fours tests pass without problems, when I run them separately.
>> 
>> ## sun/security/tools/jarsigner/TimestampCheck.java
>> ## sun/security/tools/keytool/DefaultOptions.java
>> ## sanity/client/SwingSet/src/ColorChooserDemoTest.java
>> ## sanity/client/SwingSet/src/SwingSet2DemoTest.java
>> 
>> make test TEST="jtreg:sun/security/tools/jarsigner/TimestampCheck.java 
>> sun/security/tools/keytool/DefaultOptions.java 
>> sanity/client/SwingSet/src/SwingSet2DemoTest.java 
>> sanity/client/SwingSet/src/ColorChooserDemoTest.java"
>> 
>> Building target 'test' in configuration 'windows-x86_64-server-release'
>> Test selection 'jtreg:sun/security/tools/jarsigner/TimestampCheck.java 
>> sun/security/tools/keytool/DefaultOptions.java 
>> sanity/client/SwingSet/src/SwingSet2DemoTest.java 
>> sanity/client/SwingSet/src/ColorChooserDemoTest.java', will run:
>> * jtreg:test/jdk/sun/security/tools/jarsigner/TimestampCheck.java
>> * jtreg:test/jdk/sun/security/tools/keytool/DefaultOptions.java
>> * jtreg:test/jdk/sanity/client/SwingSet/src/SwingSet2DemoTest.java
>> * jtreg:test/jdk/sanity/client/SwingSet/src/ColorChooserDemoTest.java
>> 
>> Running test 
>> 'jtreg:test/jdk/sun/security/tools/jarsigner/TimestampCheck.java'
>> Passed: sun/security/tools/jarsigner/TimestampCheck.java
>> Test results: passed: 1
>> Report written to 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-results\jtreg_test_jdk_sun_security_tools_jarsigner_TimestampCheck_java\html\report.html
>> Results written to 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_sun_security_tools_jarsigner_TimestampCheck_java
>> Finished running test 
>> 'jtreg:test/jdk/sun/security/tools/jarsigner/TimestampCheck.java'
>> Test report is stored in 
>> build/windows-x86_64-server-release/test-results/jtreg_test_jdk_sun_security_tools_jarsigner_TimestampCheck_java
>> 
>> Running test 
>> 'jtreg:test/jdk/sun/security/tools/keytool/DefaultOptions.java'
>> Passed: sun/security/tools/keytool/DefaultOptions.java
>> Test results: passed: 1
>> Report written to 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-results\jtreg_test_jdk_sun_security_tools_keytool_DefaultOptions_java\html\report.html
>> Results written to 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_sun_security_tools_keytool_DefaultOptions_java
>> Finished running test 
>> 'jtreg:test/jdk/sun/security/tools/keytool/DefaultOptions.java'
>> Test report is stored in 
>> build/windows-x86_64-server-release/test-results/jtreg_test_jdk_sun_security_tools_keytool_DefaultOptions_java
>> 
>> Running test 
>> 'jtreg:test/jdk/sanity/client/SwingSet/src/SwingSet2DemoTest.java'
>> Passed: sanity/client/SwingSet/src/SwingSet2DemoTest.java
>> Test results: passed: 1
>> Report written to 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-results\jtreg_test_jdk_sanity_client_SwingSet_src_SwingSet2DemoTest_java\html\report.html
>> Results written to 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_sanity_client_SwingSet_src_SwingSet2DemoTest_java
>> Finished running test 
>> 'jtreg:test/jdk/sanity/client/SwingSet/src/SwingSet2DemoTest.java'
>> Test report is stored in 
>> build/windows-x86_64-server-release/test-results/jtreg_test_jdk_sanity_client_SwingSet_src_SwingSet2DemoTest_java
>> 
>> Running test 
>> 'jtreg:test/jdk/sanity/client/SwingSet/src/ColorChooserDemoTest.java'
>> Passed: sanity/client/SwingSet/src/ColorChooserDemoTest.java
>> Test results: passed: 1
>> Report written to 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-results\jtreg_test_jdk_sanity_client_SwingSet_src_ColorChooserDemoTest_java\html\report.html
>> Results written to 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_sanity_client_SwingSet_src_ColorChooserDemoTest_java
>> Finished running test 
>> 'jtreg:test/jdk/sanity/client/SwingSet/src/ColorChooserDemoTest.java'
>> Test report is stored in 
>> build/windows-x86_64-server-release/test-results/jtreg_test_jdk_sanity_client_SwingSet_src_ColorChooserDemoTest_java
>> 
>> ==
>> Test summary
>> ==
>>TEST  TOTAL  PASS  FAIL 
>> ERROR
>>jtreg:test/jdk/sun/security/tools/jarsigner/TimestampCheck.java
>>  1 1 0   
>>   0
>>jtreg:test/jdk/sun/security/tools/keytool/DefaultOptions.java
>>  1 1 0   
>>   0
>>jtreg:test/jdk/sanity/client/SwingSe

Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v8]

2021-02-15 Thread Alan Bateman
On Sat, 13 Feb 2021 10:56:32 GMT, Andrey Turbanov 
 wrote:

>> This fours tests pass without problems, when I run them separately.
>> 
>> ## sun/security/tools/jarsigner/TimestampCheck.java
>> ## sun/security/tools/keytool/DefaultOptions.java
>> ## sanity/client/SwingSet/src/ColorChooserDemoTest.java
>> ## sanity/client/SwingSet/src/SwingSet2DemoTest.java
>> 
>> make test TEST="jtreg:sun/security/tools/jarsigner/TimestampCheck.java 
>> sun/security/tools/keytool/DefaultOptions.java 
>> sanity/client/SwingSet/src/SwingSet2DemoTest.java 
>> sanity/client/SwingSet/src/ColorChooserDemoTest.java"
>> 
>> Building target 'test' in configuration 'windows-x86_64-server-release'
>> Test selection 'jtreg:sun/security/tools/jarsigner/TimestampCheck.java 
>> sun/security/tools/keytool/DefaultOptions.java 
>> sanity/client/SwingSet/src/SwingSet2DemoTest.java 
>> sanity/client/SwingSet/src/ColorChooserDemoTest.java', will run:
>> * jtreg:test/jdk/sun/security/tools/jarsigner/TimestampCheck.java
>> * jtreg:test/jdk/sun/security/tools/keytool/DefaultOptions.java
>> * jtreg:test/jdk/sanity/client/SwingSet/src/SwingSet2DemoTest.java
>> * jtreg:test/jdk/sanity/client/SwingSet/src/ColorChooserDemoTest.java
>> 
>> Running test 
>> 'jtreg:test/jdk/sun/security/tools/jarsigner/TimestampCheck.java'
>> Passed: sun/security/tools/jarsigner/TimestampCheck.java
>> Test results: passed: 1
>> Report written to 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-results\jtreg_test_jdk_sun_security_tools_jarsigner_TimestampCheck_java\html\report.html
>> Results written to 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_sun_security_tools_jarsigner_TimestampCheck_java
>> Finished running test 
>> 'jtreg:test/jdk/sun/security/tools/jarsigner/TimestampCheck.java'
>> Test report is stored in 
>> build/windows-x86_64-server-release/test-results/jtreg_test_jdk_sun_security_tools_jarsigner_TimestampCheck_java
>> 
>> Running test 
>> 'jtreg:test/jdk/sun/security/tools/keytool/DefaultOptions.java'
>> Passed: sun/security/tools/keytool/DefaultOptions.java
>> Test results: passed: 1
>> Report written to 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-results\jtreg_test_jdk_sun_security_tools_keytool_DefaultOptions_java\html\report.html
>> Results written to 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_sun_security_tools_keytool_DefaultOptions_java
>> Finished running test 
>> 'jtreg:test/jdk/sun/security/tools/keytool/DefaultOptions.java'
>> Test report is stored in 
>> build/windows-x86_64-server-release/test-results/jtreg_test_jdk_sun_security_tools_keytool_DefaultOptions_java
>> 
>> Running test 
>> 'jtreg:test/jdk/sanity/client/SwingSet/src/SwingSet2DemoTest.java'
>> Passed: sanity/client/SwingSet/src/SwingSet2DemoTest.java
>> Test results: passed: 1
>> Report written to 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-results\jtreg_test_jdk_sanity_client_SwingSet_src_SwingSet2DemoTest_java\html\report.html
>> Results written to 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_sanity_client_SwingSet_src_SwingSet2DemoTest_java
>> Finished running test 
>> 'jtreg:test/jdk/sanity/client/SwingSet/src/SwingSet2DemoTest.java'
>> Test report is stored in 
>> build/windows-x86_64-server-release/test-results/jtreg_test_jdk_sanity_client_SwingSet_src_SwingSet2DemoTest_java
>> 
>> Running test 
>> 'jtreg:test/jdk/sanity/client/SwingSet/src/ColorChooserDemoTest.java'
>> Passed: sanity/client/SwingSet/src/ColorChooserDemoTest.java
>> Test results: passed: 1
>> Report written to 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-results\jtreg_test_jdk_sanity_client_SwingSet_src_ColorChooserDemoTest_java\html\report.html
>> Results written to 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_sanity_client_SwingSet_src_ColorChooserDemoTest_java
>> Finished running test 
>> 'jtreg:test/jdk/sanity/client/SwingSet/src/ColorChooserDemoTest.java'
>> Test report is stored in 
>> build/windows-x86_64-server-release/test-results/jtreg_test_jdk_sanity_client_SwingSet_src_ColorChooserDemoTest_java
>> 
>> ==
>> Test summary
>> ==
>>TEST  TOTAL  PASS  FAIL 
>> ERROR
>>jtreg:test/jdk/sun/security/tools/jarsigner/TimestampCheck.java
>>  1 1 0   
>>   0
>>jtreg:test/jdk/sun/security/tools/keytool/DefaultOptions.java
>>  1 1 0   
>>   0
>>jtreg:test/jdk/sanity/client/SwingSe

Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v8]

2021-02-13 Thread Andrey Turbanov
On Sat, 13 Feb 2021 10:20:29 GMT, Andrey Turbanov 
 wrote:

>> ## tools/jpackage/share/jdk/jpackage/tests/UnicodeArgsTest.java
>> 
>> make test 
>> TEST="jtreg:tools/jpackage/share/jdk/jpackage/tests/UnicodeArgsTest.java"
>> 
>> STDOUT:
>> [00:56:54.598] Parsing [--jpt-run=jdk.jpackage.tests.UnicodeArgsTest]...
>> [00:56:54.650] jdk.jpackage.tests.UnicodeArgsTest.test8246042 -> [public 
>> void jdk.jpackage.tests.UnicodeArgsTest.test8246042(boolean)]
>> [00:56:54.682] Create: UnicodeArgsTest.test8246042(true)
>> [00:56:54.684] Create: UnicodeArgsTest.test8246042(false)
>> [00:56:54.688] [ RUN  ] UnicodeArgsTest.test8246042(false)
>> [00:56:54.693] TRACE: Test string code points: [0x00e9]
>> [00:56:54.875] TRACE: exec: Execute tool provider [javac -d 
>> .\test8246042.9782d070\jar-workdir 
>> F:\Projects\official_openjdk\test\jdk\tools\jpackage\apps\image\Hello.java](4)...
>> [00:56:55.996] TRACE: exec: Done. Exit code: 0
>> [00:56:55.997] TRACE: assertEquals(0): Check command tool provider 
>> [javac -d .\test8246042.9782d070\jar-workdir 
>> F:\Projects\official_openjdk\test\jdk\tools\jpackage\apps\image\Hello.java](4)
>>  exited with 0 code
>> [00:56:56.014] TRACE: exec: Execute tool provider [jar -c -f 
>> .\test8246042.9782d070\input\hello.jar -C .\test8246042.9782d070\jar-workdir 
>> .](7)...
>> [00:56:56.188] TRACE: exec: Done. Exit code: 0
>> [00:56:56.188] TRACE: assertEquals(0): Check command tool provider [jar 
>> -c -f .\test8246042.9782d070\input\hello.jar -C 
>> .\test8246042.9782d070\jar-workdir .](7) exited with 0 code
>> [00:56:56.196] TRACE: exec: Execute tool provider [jpackage --input 
>> .\test8246042.9782d070\input --dest .\test8246042.9782d070\output --name 
>> 8246042UnicodeArgsTest --type app-image --main-jar hello.jar --main-class 
>> Hello --win-console --arguments ? --verbose](17)...
>> [00:56:56.225] Creating app package: 8246042UnicodeArgsTest in 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_tools_jpackage_share_jdk_jpackage_tests_UnicodeArgsTest_java\scratch\0.\test8246042.9782d070\output
>> [00:57:07.680] Command:
>> jlink --output 
>> .\test8246042.9782d070\output\8246042UnicodeArgsTest\runtime --module-path 
>> f:\\projects\\official_openjdk\\build\\windows-x86_64-server-release\\images\\jdk\\jmods
>>  --add-modules 
>> jdk.management.jfr,java.rmi,jdk.jdi,jdk.charsets,java.xml,jdk.xml.dom,java.datatransfer,jdk.jstatd,jdk.httpserver,java.desktop,java.security.sasl,jdk.zipfs,java.base,jdk.crypto.ec,jdk.javadoc,jdk.management.agent,jdk.jshell,jdk.editpad,java.sql.rowset,jdk.jsobject,jdk.sctp,java.smartcardio,jdk.jlink,jdk.unsupported,java.security.jgss,java.compiler,jdk.nio.mapmode,jdk.dynalink,jdk.unsupported.desktop,jdk.accessibility,jdk.security.jgss,java.sql,jdk.incubator.vector,java.xml.crypto,java.logging,java.transaction.xa,jdk.jfr,jdk.crypto.cryptoki,jdk.net,java.naming,jdk.internal.ed,java.prefs,java.net.http,jdk.compiler,jdk.naming.rmi,jdk.internal.opt,jdk.jconsole,jdk.attach,jdk.crypto.mscapi,jdk.internal.le,java.management,jdk.jdwp.agent,jdk.internal.jvmstat,jdk.incubator.foreign,java.instr
 
ument,jdk.management,jdk.security.auth,java.scripting,jdk.jdeps,jdk.jartool,java.management.rmi,jdk.jpackage,jdk.naming.dns,jdk.localedata
 --strip-native-commands --strip-debug --no-man-pages --no-header-files
>> [00:57:07.680] Output:
>> WARNING: Using incubator modules: jdk.incubator.vector, 
>> jdk.incubator.foreign
>> 
>> [00:57:07.681] Returned: 0
>> 
>> [00:57:07.685] Using default package resource java48.ico [icon] (add 
>> 8246042UnicodeArgsTest.ico to the resource-dir to customize).
>> [00:57:07.707] Warning: Windows Defender may prevent jpackage from 
>> functioning. If there is an issue, it can be addressed by either disabling 
>> realtime monitoring, or adding an exclusion for the directory 
>> "f:\projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_tools_jpackage_share_jdk_jpackage_tests_UnicodeArgsTest_java\tmp\jdk.jpackage16485063537873697224".
>> [00:57:07.712] Using default package resource WinLauncher.template 
>> [Template for creating executable properties file] (add 
>> 8246042UnicodeArgsTest.properties to the resource-dir to customize).
>> [00:57:07.746] Succeeded in building Windows Application Image package
>> [00:57:07.748] TRACE: exec: Done. Exit code: 0
>> [00:57:07.748] TRACE: assertEquals(0): Check command tool provider 
>> [jpackage --input .\test8246042.9782d070\input --dest 
>> .\test8246042.9782d070\output --name 8246042UnicodeArgsTest --type app-image 
>> --main-jar hello.jar --main-class Hello --win-console --arguments ? 
>> --verbose](17) exited with 0 code
>> [00:57:07.766] TRACE: assertStringListEquals(): Check there is only one 
>> file with [.jpackage.xml] name in the package
>> [00:57:07.768] TRACE: assertStringListEquals(1

Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v8]

2021-02-13 Thread Andrey Turbanov
On Fri, 12 Feb 2021 22:12:29 GMT, Andrey Turbanov 
 wrote:

>> ## java/security/AccessController/DoPrivAccompliceTest.java
>> 
>> make test 
>> TEST="jtreg:java/security/AccessController/DoPrivAccompliceTest.java"
>> 
>> STDOUT:
>> Adding DoPrivAccomplice.class to 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\DoPrivAccomplice.jar
>> 
>> Created jar file 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\DoPrivAccomplice.jar
>> Adding DoPrivTest.class to 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\DoPrivTest.jar
>> 
>> Created jar file 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\DoPrivTest.jar
>> Created policy for 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\DoPrivAccomplice.jar
>> Command line: 
>> [f:\projects\official_openjdk\build\windows-x86_64-server-release\images\jdk\bin\java.exe
>>  -cp 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\classes\0\java\security\AccessController\DoPrivAccompliceTest.d;F:\Projects\official_openjdk\test\jdk\java\security\AccessController;F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\classes\0\test\lib;F:\Projects\official_openjdk\test\lib;C:\Programs\jtreg-4.2.0-tip\jtreg\lib\javatest.jar;C:\Programs\jtreg-4.2.0-tip\jtreg\lib\jtreg.jar
>>  -Xmx512m -XX:MaxRAMPercentage=6 
>> -Djava.io.tmpdir=f:\projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\tmp
>>  -ea -esa -Djava.security.manager 
>> -Djava.security.policy=F:\Projects\official_openjdk\build\
 
windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\java.policy
 -classpath 
F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\DoPrivAccomplice.jar;F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\DoPrivTest.jar
 DoPrivTest ]
>> [2021-02-12T21:42:29.297091800Z] Gathering output for process 12712
>> [2021-02-12T21:42:29.544092Z] Waiting for completion for process 12712
>> [2021-02-12T21:42:29.544092Z] Waiting for completion finished for 
>> process 12712
>> Output and diagnostic info for process 12712 was saved into 
>> 'pid-12712-output.log'
>> [2021-02-12T21:42:29.547092500Z] Waiting for completion for process 12712
>> [2021-02-12T21:42:29.547092500Z] Waiting for completion finished for 
>> process 12712
>> Created policy for 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\DoPrivTest.jar
>> Command line: 
>> [f:\projects\official_openjdk\build\windows-x86_64-server-release\images\jdk\bin\java.exe
>>  -cp 
>> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\classes\0\java\security\AccessController\DoPrivAccompliceTest.d;F:\Projects\official_openjdk\test\jdk\java\security\AccessController;F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\classes\0\test\lib;F:\Projects\official_openjdk\test\lib;C:\Programs\jtreg-4.2.0-tip\jtreg\lib\javatest.jar;C:\Programs\jtreg-4.2.0-tip\jtreg\lib\jtreg.jar
>>  -Xmx512m -XX:MaxRAMPercentage=6 
>> -Djava.io.tmpdir=f:\projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\tmp
>>  -ea -esa -Djava.security.manager 
>> -Djava.security.policy=F:\Projects\official_openjdk\build\
 
windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\java.policy
 -classpath 
F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\DoPrivAccomplice.jar;F:\Projects\official_openjdk\build\windows-x86_64-serve

Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v8]

2021-02-12 Thread Andrey Turbanov
On Fri, 12 Feb 2021 21:53:13 GMT, Andrey Turbanov 
 wrote:

>> ## java/nio/file/Files/CopyAndMove.java
>> 
>> make test TEST="jtreg:java/nio/file/Files/CopyAndMove.java"
>> 
>> STDOUT:
>> Seed from RandomFactory = 704532001916725417L
>> STDERR:
>> dir1: 
>> f:\projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_nio_file_Files_CopyAndMove_java\tmp\name9678927043623070601
>>  (NTFS)
>> dir2: .\name1900089232270637553 (NTFS)
>> java.lang.RuntimeException: AtomicMoveNotSupportedException expected
>> at CopyAndMove.testMove(CopyAndMove.java:369)
>> at CopyAndMove.main(CopyAndMove.java:74)
>> at 
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
>> Method)
>> at 
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
>> at 
>> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>> at 
>> com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
>> at java.base/java.lang.Thread.run(Thread.java:831)
>> 
>> JavaTest Message: Test threw exception: java.lang.RuntimeException: 
>> AtomicMoveNotSupportedException expected
>> JavaTest Message: shutting down test
>> 
>> STATUS:Failed.`main' threw exception: java.lang.RuntimeException: 
>> AtomicMoveNotSupportedException expected
>> 
>> Checked in debugger:
>> 
>> Files.getFileStore(dir1) = {WindowsFileStore@1211} "ssd (f:)"
>> Files.getFileStore(dir2) = {WindowsFileStore@1213} "ssd (F:)"
>> sameDevice = false
>> 
>> https://bugs.openjdk.java.net/browse/JDK-8219644 looks like there is already 
>> known bug this test.
>
> ## java/security/AccessController/DoPrivAccompliceTest.java
> 
> make test 
> TEST="jtreg:java/security/AccessController/DoPrivAccompliceTest.java"
> 
> STDOUT:
> Adding DoPrivAccomplice.class to 
> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\DoPrivAccomplice.jar
> 
> Created jar file 
> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\DoPrivAccomplice.jar
> Adding DoPrivTest.class to 
> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\DoPrivTest.jar
> 
> Created jar file 
> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\DoPrivTest.jar
> Created policy for 
> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\DoPrivAccomplice.jar
> Command line: 
> [f:\projects\official_openjdk\build\windows-x86_64-server-release\images\jdk\bin\java.exe
>  -cp 
> F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\classes\0\java\security\AccessController\DoPrivAccompliceTest.d;F:\Projects\official_openjdk\test\jdk\java\security\AccessController;F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\classes\0\test\lib;F:\Projects\official_openjdk\test\lib;C:\Programs\jtreg-4.2.0-tip\jtreg\lib\javatest.jar;C:\Programs\jtreg-4.2.0-tip\jtreg\lib\jtreg.jar
>  -Xmx512m -XX:MaxRAMPercentage=6 
> -Djava.io.tmpdir=f:\projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\tmp
>  -ea -esa -Djava.security.manager 
> -Djava.security.policy=F:\Projects\official_openjdk\build\w
 
indows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\java.policy
 -classpath 
F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\DoPrivAccomplice.jar;F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\DoPrivTest.jar
 DoPrivTest ]
> [2021-02-12T21:42:29.297091800Z] Gathering output for process 12712
> [2021-02-12T21:42:29.544092Z] Waiting for completion for process 12712
> [2021-02-12T21:42:29.544092Z] Waiting for completion finished for process 
> 12712
> Output and diagnostic info for process 12712 was saved into 
> 'pid-12712-output.log'

Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v8]

2021-02-12 Thread Andrey Turbanov
On Fri, 12 Feb 2021 21:32:04 GMT, Andrey Turbanov 
 wrote:

>> ## java/net/MulticastSocket/SetLoopbackMode.java
>> 
>> make test 
>> TEST="jtreg:test/jdk/java/net/MulticastSocket/SetLoopbackMode.java"
>> 
>> 
>> STDOUT:
>> IPv6 can be used
>> Default network interface: null
>> 
>> Test will use multicast group: /ff01:0:0:0:0:0:0:1
>> NetworkInterface.getByInetAddress(grp): null
>> STDERR:
>> java.net.NoRouteToHostException: No route to host: no further information
>> at java.base/sun.nio.ch.Net.joinOrDrop6(Native Method)
>> at java.base/sun.nio.ch.Net.join6(Net.java:734)
>> at 
>> java.base/sun.nio.ch.DatagramChannelImpl.innerJoin(DatagramChannelImpl.java:1515)
>> at 
>> java.base/sun.nio.ch.DatagramChannelImpl.join(DatagramChannelImpl.java:1551)
>> at 
>> java.base/sun.nio.ch.DatagramSocketAdaptor.joinGroup(DatagramSocketAdaptor.java:532)
>> at 
>> java.base/sun.nio.ch.DatagramSocketAdaptor.joinGroup(DatagramSocketAdaptor.java:479)
>> at 
>> java.base/java.net.MulticastSocket.joinGroup(MulticastSocket.java:318)
>> at SetLoopbackMode.main(SetLoopbackMode.java:132)
>> at 
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
>> Method)
>> at 
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
>> at 
>> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>> at 
>> com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
>> at java.base/java.lang.Thread.run(Thread.java:831)
>> 
>> JavaTest Message: Test threw exception: java.net.NoRouteToHostException: 
>> No route to host: no further information
>> JavaTest Message: shutting down test
>> 
>> STATUS:Failed.`main' threw exception: java.net.NoRouteToHostException: 
>> No route to host: no further information
>> 
>> Cause looks similar to `MulticastAddresses`: virtualbox network interface:
>> Test: /ff01:0:0:0:0:0:0:1  ni: name:eth10 (VirtualBox Host-Only Ethernet 
>> Adapter)
>> joinGroup(InetAddress) Failed: No route to host: no further information
>> Will investigate futher.
>
> ## java/nio/file/Files/CopyAndMove.java
> 
> make test TEST="jtreg:java/nio/file/Files/CopyAndMove.java"
> 
> STDOUT:
> Seed from RandomFactory = 704532001916725417L
> STDERR:
> dir1: 
> f:\projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_nio_file_Files_CopyAndMove_java\tmp\name9678927043623070601
>  (NTFS)
> dir2: .\name1900089232270637553 (NTFS)
> java.lang.RuntimeException: AtomicMoveNotSupportedException expected
> at CopyAndMove.testMove(CopyAndMove.java:369)
> at CopyAndMove.main(CopyAndMove.java:74)
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
> at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> at 
> com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
> at java.base/java.lang.Thread.run(Thread.java:831)
> 
> JavaTest Message: Test threw exception: java.lang.RuntimeException: 
> AtomicMoveNotSupportedException expected
> JavaTest Message: shutting down test
> 
> STATUS:Failed.`main' threw exception: java.lang.RuntimeException: 
> AtomicMoveNotSupportedException expected
> 
> Checked in debugger:
> 
> Files.getFileStore(dir1) = {WindowsFileStore@1211} "ssd (f:)"
> Files.getFileStore(dir2) = {WindowsFileStore@1213} "ssd (F:)"
> sameDevice = false
> 
> https://bugs.openjdk.java.net/browse/JDK-8219644 looks like there is already 
> known bug this test.

## java/security/AccessController/DoPrivAccompliceTest.java

make test 
TEST="jtreg:java/security/AccessController/DoPrivAccompliceTest.java"

STDOUT:
Adding DoPrivAccomplice.class to 
F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\DoPrivAccomplice.jar

Created jar file 
F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\DoPrivAccomplice.jar
Adding DoPrivTest.class to 
F:\Projects\official_openjdk\build\windows-x86_64-server-release\test-support\jtreg_test_jdk_java_security_AccessController_DoPrivAccompliceTest_java\scratch\0.\DoPrivTest.jar

Created jar file 
F

Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v8]

2021-02-12 Thread Andrey Turbanov
On Fri, 12 Feb 2021 21:12:14 GMT, Andrey Turbanov 
 wrote:

>> ## java/net/MulticastSocket/MulticastAddresses.java
>> 
>> make test 
>> TEST="jtreg:test/jdk/java/net/MulticastSocket/MulticastAddresses.java"
>> 
>> STDOUT:
>> Test: /224.80.80.80  ni: name:eth1 (PANGP Virtual Ethernet Adapter)
>> joinGroup(InetAddress) Passed.
>> joinGroup(InetAddress,NetworkInterface) Passed.
>> Test: /129.1.1.1
>> joinGroup(InetAddress)
>> Passed: Not a multicast address
>> Test: /ff01:0:0:0:0:0:0:1  ni: name:eth10 (VirtualBox Host-Only Ethernet 
>> Adapter)
>> joinGroup(InetAddress) Failed: No route to host: no further 
>> information
>> Test: /ff02:0:0:0:0:0:0:1234  ni: name:eth10 (VirtualBox Host-Only 
>> Ethernet Adapter)
>> joinGroup(InetAddress) Passed.
>> joinGroup(InetAddress,NetworkInterface) Passed.
>> Test: /ff05:0:0:0:0:0:0:a  ni: name:eth10 (VirtualBox Host-Only Ethernet 
>> Adapter)
>> joinGroup(InetAddress) Passed.
>> joinGroup(InetAddress,NetworkInterface) Passed.
>> Test: /ff0e:0:0:0:0:0:1234:a  ni: name:eth10 (VirtualBox Host-Only 
>> Ethernet Adapter)
>> joinGroup(InetAddress) Passed.
>> joinGroup(InetAddress,NetworkInterface) Passed.
>> Test: /0:0:0:0:0:0:0:1
>> joinGroup(InetAddress)
>> Passed: Not a multicast address
>> Test: /0:0:0:0:0:0:8101:101
>> joinGroup(InetAddress)
>> Passed: Not a multicast address
>> Test: /fe80:0:0:0:a00:20ff:fee5:bc02
>> joinGroup(InetAddress)
>> Passed: Not a multicast address
>> STDERR:
>> java.lang.Exception: 1 test(s) failed - see log file.
>> at MulticastAddresses.runTest(MulticastAddresses.java:93)
>> at MulticastAddresses.main(MulticastAddresses.java:138)
>> at 
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
>> Method)
>> at 
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
>> at 
>> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>> at 
>> com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:312)
>> at java.base/java.lang.Thread.run(Thread.java:831)
>> 
>> JavaTest Message: Test threw exception: java.lang.Exception
>> JavaTest Message: shutting down test
>> 
>> 
>> TEST RESULT: Failed. Execution failed: `main' threw exception: 
>> java.lang.Exception: 1 test(s) failed - see log file.
>> 
>> 
>> I connected debbuger and got this stack trace:
>> 
>> java.net.NoRouteToHostException: No route to host: no further information
>> at java.base/sun.nio.ch.Net.joinOrDrop6(Native Method)
>> at java.base/sun.nio.ch.Net.join6(Net.java:734)
>> at 
>> java.base/sun.nio.ch.DatagramChannelImpl.innerJoin(DatagramChannelImpl.java:1515)
>> at 
>> java.base/sun.nio.ch.DatagramChannelImpl.join(DatagramChannelImpl.java:1551)
>> at 
>> java.base/sun.nio.ch.DatagramSocketAdaptor.joinGroup(DatagramSocketAdaptor.java:532)
>> at 
>> java.base/sun.nio.ch.DatagramSocketAdaptor.joinGroup(DatagramSocketAdaptor.java:479)
>> at 
>> java.base/java.net.MulticastSocket.joinGroup(MulticastSocket.java:318)
>> at MulticastAddresses.runTest(MulticastAddresses.java:56)
>> at MulticastAddresses.main(MulticastAddresses.java:138)
>> at 
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
>> Method)
>> at 
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
>> at 
>> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>> at 
>> com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:312)
>> at java.base/java.lang.Thread.run(Thread.java:831)
>> 
>> Not sure what actual cause. Will investigate further.
>
> ## java/net/MulticastSocket/SetLoopbackMode.java
> 
> make test 
> TEST="jtreg:test/jdk/java/net/MulticastSocket/SetLoopbackMode.java"
> 
> 
> STDOUT:
> IPv6 can be used
> Default network interface: null
> 
> Test will use multicast group: /ff01:0:0:0:0:0:0:1
> NetworkInterface.getByInetAddress(grp): null
> STDERR:
> java.net.NoRouteToHostException: No route to host: no further information
> at java.base/sun.nio.ch.Net.joinOrDrop6(Native Method)
> at java.base/sun.nio.ch.Net.join6(Net.java:734)
> at 
> java.base/sun.nio.ch.DatagramChannelImpl.innerJoin(DatagramChannelImpl.java:1515)
> at 
> java.base/sun.nio.ch.DatagramC

Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v8]

2021-02-12 Thread Andrey Turbanov
On Fri, 12 Feb 2021 21:06:24 GMT, Andrey Turbanov 
 wrote:

>> Then I tried to run tests separately:
>> ## java/io/File/GetXSpace.java
>> 
>> 
>> make test TEST="jtreg:test/jdk/java/io/File/GetXSpace.java"
>> 
>> STDERR:
>> java.nio.file.InvalidPathException: Illegal char <:> at index 0: :
>> at 
>> java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
>> at 
>> java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
>> at 
>> java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
>> at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
>> at 
>> java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:230)
>> at java.base/java.io.File.toPath(File.java:2316)
>> at GetXSpace.compare(GetXSpace.java:219)
>> at GetXSpace.testDF(GetXSpace.java:394)
>> at GetXSpace.main(GetXSpace.java:428)
>> at 
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
>> Method)
>> at 
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
>> at 
>> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>> at 
>> com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:312)
>> at java.base/java.lang.Thread.run(Thread.java:831)
>> 
>> JavaTest Message: Test threw exception: 
>> java.nio.file.InvalidPathException
>> JavaTest Message: shutting down test
>> 
>> STDOUT:
>> --- Testing df
>> C:/Programs/cygwin64   350809332  172573816 178235516  50% /
>> D:3702215676 2812548988 88988  76% 
>> /cygdrive/d
>> E:3906885628 3544182676 362702952  91% 
>> /cygdrive/e
>> F: 250057724  240917056   9140668  97% 
>> /cygdrive/f
>> 
>> 
>> SecurityManager = null
>> C:/Programs/cygwin64:
>>   df   total= 359228755968 free =0 usable = 182513168384
>>   getX total= 359228755968 free = 182513168384 usable = 182513168384
>> ::
>>   df   total= 3791068852224 free =0 usable = 911018688512
>>   getX total=0 free =0 usable =0
>> 
>> TEST RESULT: Failed. Execution failed: `main' threw exception: 
>> java.nio.file.InvalidPathException: Illegal char <:> at index 0: :
>> --
>> 
>> 
>> https://bugs.openjdk.java.net/browse/JDK-8251466 looks like there is already 
>> known bug for similar cygwin output.
>
> ## java/net/MulticastSocket/MulticastAddresses.java
> 
> make test 
> TEST="jtreg:test/jdk/java/net/MulticastSocket/MulticastAddresses.java"
> 
> STDOUT:
> Test: /224.80.80.80  ni: name:eth1 (PANGP Virtual Ethernet Adapter)
> joinGroup(InetAddress) Passed.
> joinGroup(InetAddress,NetworkInterface) Passed.
> Test: /129.1.1.1
> joinGroup(InetAddress)
> Passed: Not a multicast address
> Test: /ff01:0:0:0:0:0:0:1  ni: name:eth10 (VirtualBox Host-Only Ethernet 
> Adapter)
> joinGroup(InetAddress) Failed: No route to host: no further 
> information
> Test: /ff02:0:0:0:0:0:0:1234  ni: name:eth10 (VirtualBox Host-Only 
> Ethernet Adapter)
> joinGroup(InetAddress) Passed.
> joinGroup(InetAddress,NetworkInterface) Passed.
> Test: /ff05:0:0:0:0:0:0:a  ni: name:eth10 (VirtualBox Host-Only Ethernet 
> Adapter)
> joinGroup(InetAddress) Passed.
> joinGroup(InetAddress,NetworkInterface) Passed.
> Test: /ff0e:0:0:0:0:0:1234:a  ni: name:eth10 (VirtualBox Host-Only 
> Ethernet Adapter)
> joinGroup(InetAddress) Passed.
> joinGroup(InetAddress,NetworkInterface) Passed.
> Test: /0:0:0:0:0:0:0:1
> joinGroup(InetAddress)
> Passed: Not a multicast address
> Test: /0:0:0:0:0:0:8101:101
> joinGroup(InetAddress)
> Passed: Not a multicast address
> Test: /fe80:0:0:0:a00:20ff:fee5:bc02
> joinGroup(InetAddress)
> Passed: Not a multicast address
> STDERR:
> java.lang.Exception: 1 test(s) failed - see log file.
> at MulticastAddresses.runTest(MulticastAddresses.java:93)
> at MulticastAddresses.main(MulticastAddresses.java:138)
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
> at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java

Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v8]

2021-02-12 Thread Andrey Turbanov
On Mon, 8 Feb 2021 16:39:55 GMT, Julia Boes  wrote:

>> The other security-related code changes look good to me.
>
> I've updated the issue summary to better reflect the changes, the PR summary 
> should be renamed accordingly. 
> As mentioned earlier, have you run the tests for the affected areas? Here's 
> some information on how to do that: 
> http://openjdk.java.net/guide/#testing-the-jdk

I rebased my changes onto master. (commit 
837bd8930d0a010110f1318b947c036609d3aa33)
and checked tier2 and tier3.
What I got:

==
Test summary
==
   TEST  TOTAL  PASS  FAIL 
ERROR   
>> jtreg:test/jdk:tier2   3698  3690 6 
2 <<
>> jtreg:test/langtools:tier2   1211 1 
0 <<
   jtreg:test/jaxp:tier2   450   450 0 
0   
==
TEST FAILURE




==
Test summary
==
   TEST  TOTAL  PASS  FAIL 
ERROR   
>> jtreg:test/jdk:tier3   1190  1188 2 
0 <<
   jtreg:test/langtools:tier30 0 0 
0   
   jtreg:test/jaxp:tier3 0 0 0 
0   
==
TEST FAILURE


Failed tests:

 tier2:
 java/io/File/GetXSpace.java
 Failed. Execution failed: `main' threw exception: 
java.nio.file.InvalidPathException: Illegal char <:> at index 0: :
 java/net/MulticastSocket/MulticastAddresses.java   
 Failed. Execution failed: `main' threw exception: 
java.lang.Exception: 1 test(s) failed - see log file.
 java/net/MulticastSocket/SetLoopbackMode.java  
 Failed. Execution failed: `main' threw exception: 
java.net.NoRouteToHostException: No route to host: no further information
 java/nio/file/Files/CopyAndMove.java   
 Failed. Execution failed: `main' threw exception: 
java.lang.RuntimeException: AtomicMoveNotSupportedException expected
 java/security/AccessController/DoPrivAccompliceTest.java   
 Failed. Execution failed: `main' threw exception: 
java.lang.RuntimeException: 'user' found in stderr
 tools/jpackage/share/jdk/jpackage/tests/UnicodeArgsTest.java   
 Failed. Execution failed: `main' threw exception: 
jdk.jpackage.test.Functional$ExceptionBox: java.lang.RuntimeException: 2 FAILED 
TESTS
 
 sun/security/tools/jarsigner/TimestampCheck.java   
 Error. Agent error: java.lang.Exception: Agent 72 
timed out with a timeout of 2400 seconds; check console log for any additional 
details
 sun/security/tools/keytool/DefaultOptions.java 
 Error. Agent error: java.lang.Exception: Agent 77 
timed out with a timeout of 480 seconds; check console log for any additional 
details
 
 jdk/jshell/ToolBasicTest.java  Failed. 
Execution failed: `main' threw exception: java.lang.Exception: failures: 1
 
 tier3:
 sanity/client/SwingSet/src/SwingSet2DemoTest.java  
Failed. Execution failed: `main' threw 
exception: java.lang.Exception: failures: 1
 sanity/client/SwingSet/src/ColorChooserDemoTest.java   
Failed. Execution failed: `main' threw 
exception: java.lang.Exception: failures: 1

-

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v8]

2021-02-12 Thread Andrey Turbanov
On Fri, 12 Feb 2021 21:04:54 GMT, Andrey Turbanov 
 wrote:

>> I rebased my changes onto master. (commit 
>> 837bd8930d0a010110f1318b947c036609d3aa33)
>> and checked tier2 and tier3.
>> What I got:
>> 
>> ==
>> Test summary
>> ==
>>TEST  TOTAL  PASS  FAIL 
>> ERROR   
>> >> jtreg:test/jdk:tier2   3698  3690 6   
>>   2 <<
>> >> jtreg:test/langtools:tier2   1211 1   
>>   0 <<
>>jtreg:test/jaxp:tier2   450   450 0   
>>   0   
>> ==
>> TEST FAILURE
>> 
>> 
>> 
>> 
>> ==
>> Test summary
>> ==
>>TEST  TOTAL  PASS  FAIL 
>> ERROR   
>> >> jtreg:test/jdk:tier3   1190  1188 2   
>>   0 <<
>>jtreg:test/langtools:tier30 0 0   
>>   0   
>>jtreg:test/jaxp:tier3 0 0 0   
>>   0   
>> ==
>> TEST FAILURE
>> 
>> 
>> Failed tests:
>> 
>>  tier2:
>>  java/io/File/GetXSpace.java 
>> Failed. Execution failed: `main' threw 
>> exception: java.nio.file.InvalidPathException: Illegal char <:> at index 0: :
>>  java/net/MulticastSocket/MulticastAddresses.java
>> Failed. Execution failed: `main' threw 
>> exception: java.lang.Exception: 1 test(s) failed - see log file.
>>  java/net/MulticastSocket/SetLoopbackMode.java   
>> Failed. Execution failed: `main' threw 
>> exception: java.net.NoRouteToHostException: No route to host: no further 
>> information
>>  java/nio/file/Files/CopyAndMove.java
>> Failed. Execution failed: `main' threw 
>> exception: java.lang.RuntimeException: AtomicMoveNotSupportedException 
>> expected
>>  java/security/AccessController/DoPrivAccompliceTest.java
>> Failed. Execution failed: `main' threw 
>> exception: java.lang.RuntimeException: 'user' found in stderr
>>  tools/jpackage/share/jdk/jpackage/tests/UnicodeArgsTest.java
>> Failed. Execution failed: `main' threw 
>> exception: jdk.jpackage.test.Functional$ExceptionBox: 
>> java.lang.RuntimeException: 2 FAILED TESTS
>>  
>>  sun/security/tools/jarsigner/TimestampCheck.java
>> Error. Agent error: java.lang.Exception: Agent 
>> 72 timed out with a timeout of 2400 seconds; check console log for any 
>> additional details
>>  sun/security/tools/keytool/DefaultOptions.java  
>> Error. Agent error: java.lang.Exception: Agent 
>> 77 timed out with a timeout of 480 seconds; check console log for any 
>> additional details
>>  
>>  jdk/jshell/ToolBasicTest.java  Failed. 
>> Execution failed: `main' threw exception: java.lang.Exception: failures: 1
>>  
>>  tier3:
>>  sanity/client/SwingSet/src/SwingSet2DemoTest.java   
>>Failed. Execution failed: `main' 
>> threw exception: java.lang.Exception: failures: 1
>>  sanity/client/SwingSet/src/ColorChooserDemoTest.java
>>Failed. Execution failed: `main' 
>> threw exception: java.lang.Exception: failures: 1
>
> Then I tried to run tests separately:
> ## java/io/File/GetXSpace.java
> 
> 
> make test TEST="jtreg:test/jdk/java/io/File/GetXSpace.java"
> 
> STDERR:
> java.nio.file.InvalidPathException: Illegal char <:> at index 0: :
> at 
> java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
> at 
> java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
> at 
> java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
> at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
> at 
> java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:230)
> at java.base/java.io.File.toPath(File.java:2316)
> at GetXSpace.compare(GetXSpace.java:219)
> at GetXSpace.testDF(GetXSpace.java:394)
> at GetXSpace.main(GetXSpace.java:428)
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
> at 
> java

Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v8]

2021-02-12 Thread Andrey Turbanov
On Fri, 12 Feb 2021 21:03:04 GMT, Andrey Turbanov 
 wrote:

>> I've updated the issue summary to better reflect the changes, the PR summary 
>> should be renamed accordingly. 
>> As mentioned earlier, have you run the tests for the affected areas? Here's 
>> some information on how to do that: 
>> http://openjdk.java.net/guide/#testing-the-jdk
>
> I rebased my changes onto master. (commit 
> 837bd8930d0a010110f1318b947c036609d3aa33)
> and checked tier2 and tier3.
> What I got:
> 
> ==
> Test summary
> ==
>TEST  TOTAL  PASS  FAIL 
> ERROR   
> >> jtreg:test/jdk:tier2   3698  3690 6
>  2 <<
> >> jtreg:test/langtools:tier2   1211 1
>  0 <<
>jtreg:test/jaxp:tier2   450   450 0
>  0   
> ==
> TEST FAILURE
> 
> 
> 
> 
> ==
> Test summary
> ==
>TEST  TOTAL  PASS  FAIL 
> ERROR   
> >> jtreg:test/jdk:tier3   1190  1188 2
>  0 <<
>jtreg:test/langtools:tier30 0 0
>  0   
>jtreg:test/jaxp:tier3 0 0 0
>  0   
> ==
> TEST FAILURE
> 
> 
> Failed tests:
> 
>  tier2:
>  java/io/File/GetXSpace.java  
>Failed. Execution failed: `main' threw exception: 
> java.nio.file.InvalidPathException: Illegal char <:> at index 0: :
>  java/net/MulticastSocket/MulticastAddresses.java 
>Failed. Execution failed: `main' threw exception: 
> java.lang.Exception: 1 test(s) failed - see log file.
>  java/net/MulticastSocket/SetLoopbackMode.java
>Failed. Execution failed: `main' threw exception: 
> java.net.NoRouteToHostException: No route to host: no further information
>  java/nio/file/Files/CopyAndMove.java 
>Failed. Execution failed: `main' threw exception: 
> java.lang.RuntimeException: AtomicMoveNotSupportedException expected
>  java/security/AccessController/DoPrivAccompliceTest.java 
>Failed. Execution failed: `main' threw exception: 
> java.lang.RuntimeException: 'user' found in stderr
>  tools/jpackage/share/jdk/jpackage/tests/UnicodeArgsTest.java 
>Failed. Execution failed: `main' threw exception: 
> jdk.jpackage.test.Functional$ExceptionBox: java.lang.RuntimeException: 2 
> FAILED TESTS
>  
>  sun/security/tools/jarsigner/TimestampCheck.java 
>Error. Agent error: java.lang.Exception: Agent 72 
> timed out with a timeout of 2400 seconds; check console log for any 
> additional details
>  sun/security/tools/keytool/DefaultOptions.java   
>Error. Agent error: java.lang.Exception: Agent 77 
> timed out with a timeout of 480 seconds; check console log for any additional 
> details
>  
>  jdk/jshell/ToolBasicTest.java  Failed. 
> Execution failed: `main' threw exception: java.lang.Exception: failures: 1
>  
>  tier3:
>  sanity/client/SwingSet/src/SwingSet2DemoTest.java
>   Failed. Execution failed: `main' 
> threw exception: java.lang.Exception: failures: 1
>  sanity/client/SwingSet/src/ColorChooserDemoTest.java 
>   Failed. Execution failed: `main' 
> threw exception: java.lang.Exception: failures: 1

Then I tried to run tests separately:
## java/io/File/GetXSpace.java


make test TEST="jtreg:test/jdk/java/io/File/GetXSpace.java"

STDERR:
java.nio.file.InvalidPathException: Illegal char <:> at index 0: :
at 
java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at 
java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at 
java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
at 
java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:230)
at java.base/java.io.File.toPath(File.java:2316)
at GetXSpace.compare(GetXSpace.java:219)
at GetXSpace.testDF(GetXSpace.java:394)
at GetXSpace.main(GetXSpace.java:428)
at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Na

Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v9]

2021-02-09 Thread Philippe Marschall
On Mon, 8 Feb 2021 20:58:01 GMT, Andrey Turbanov 
 wrote:

>> 8080272  Refactor I/O stream copying to use 
>> InputStream.transferTo/readAllBytes and Files.copy
>
> Andrey Turbanov has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo
>   fix review comments

src/java.base/share/classes/java/util/jar/JarInputStream.java line 93:

> 91: if (e != null && 
> JarFile.MANIFEST_NAME.equalsIgnoreCase(e.getName())) {
> 92: man = new Manifest();
> 93: byte[] bytes = new BufferedInputStream(this).readAllBytes();

I wonder if it makes sense to avoid reading the entire manifest into a byte[] 
when we don't need to verify the JAR. This may help avoiding some intermediate 
allocation and copying. This make be noticeable for some of the larger 
manifests (Java EE, OSGi, ...). A possible implementation may look like this 
https://github.com/marschall/jdk/commit/c50880ffb18607077c4da3456b27957d1df8edb7.

In either case since we're calling #readAllBytes I don't see why we are 
wrapping in a BufferedInputStream rather than calling #readAllBytes directly.

-

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v9]

2021-02-08 Thread Philippe Marschall
On Mon, 8 Feb 2021 20:58:01 GMT, Andrey Turbanov 
 wrote:

>> 8080272  Refactor I/O stream copying to use 
>> InputStream.transferTo/readAllBytes and Files.copy
>
> Andrey Turbanov has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo
>   fix review comments

src/java.base/share/classes/sun/security/provider/certpath/X509CertPath.java 
line 230:

> 228: // Copy the entire input stream into an InputStream that 
> does
> 229: // support mark
> 230: is = new ByteArrayInputStream(is.readAllBytes());

I don't understand why the check for #markSupported is done there. The 
InputStream constructor of PKCS7 creates a DataInputStream on the InputStream 
only to then call #readFully. I can't find a place where a call to #mark 
happens. Since the InputStream constructor reads all bytes anyway I wonder 
whether we could remove this if and unconditionally do:

PKCS7 pkcs7 = new PKCS7(is.readAllBytes());

-

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v9]

2021-02-08 Thread Andrey Turbanov
> 8080272  Refactor I/O stream copying to use 
> InputStream.transferTo/readAllBytes and Files.copy

Andrey Turbanov has updated the pull request incrementally with one additional 
commit since the last revision:

  8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo
  fix review comments

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/1853/files
  - new: https://git.openjdk.java.net/jdk/pull/1853/files/94e99817..6a8a3ae6

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1853&range=08
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1853&range=07-08

  Stats: 29 lines in 10 files changed: 16 ins; 0 del; 13 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1853.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1853/head:pull/1853

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v7]

2021-02-08 Thread Andrey Turbanov
On Mon, 8 Feb 2021 16:19:17 GMT, Julia Boes  wrote:

>> Andrey Turbanov has refreshed the contents of this pull request, and 
>> previous commits have been removed. The incremental views will show 
>> differences compared to the previous content of the PR.
>
> src/java.base/share/classes/sun/security/provider/certpath/X509CertPath.java 
> line 29:
> 
>> 27: 
>> 28: import java.io.ByteArrayInputStream;
>> 29: import java.io.IOException;
> 
> The copyright year needs to be updated for this file and changed to 2021 in 
> the other files where applicable.

done

-

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


Re: RFR: 8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy [v8]

2021-02-08 Thread Andrey Turbanov
On Mon, 8 Feb 2021 14:38:52 GMT, Weijun Wang  wrote:

>> Andrey Turbanov has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo
>>   revert changes in Apache Santuario
>
> src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java 
> line 49:
> 
>> 47: throws IOException
>> 48: {
>> 49: return is.readAllBytes();
> 
> This is also from Apache Santuario. It's better to keep it unchanged.

reverted

-

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