RFR: [test,16] JDK-8164597 : TestIOException.java fails after push for JDK-8164130.

Pavel Rappo pavel.rappo at oracle.com
Wed Jun 24 12:19:53 UTC 2020


Jon,

Consider deleting that entry in ProblemList.txt instead of commenting it out. Otherwise, the change looks good.

***

That change reminded me of a question I had: do we really need to split I/O errors into "read" and "write" errors and associate filenames with I/O errors on the Java level?

I'm asking this because it's very tempting to refactor that code. For example, thanks to NIO, we could fold code like this into a one-liner:

    public void copyFile(DocFile fromFile) throws DocFileIOException {
        try (OutputStream output = openOutputStream()) {
            try (InputStream input = fromFile.openInputStream()) {
                byte[] bytearr = new byte[1024];
                int len;
                while ((len = read(fromFile, input, bytearr)) != -1) {
                    write(this, output, bytearr, len);
                }
            } catch (IOException e) {
                throw new DocFileIOException(fromFile, DocFileIOException.Mode.READ, e);
            }
        } catch (IOException e) {
            throw new DocFileIOException(this, DocFileIOException.Mode.WRITE, e);
        }
    }

I'm pretty sure that if any of the java.nio.file.Files's methods throws IOException, the user will be able to quickly and accurately diagnose the error using the accompanying message.

Should I create an RFE to investigate that?

-Pavel

> On 15 Jun 2020, at 19:41, Jonathan Gibbons <jonathan.gibbons at oracle.com> wrote:
> 
> Please review a change to enable a javadoc test to be removed from the problem list.
> 
> The test was excluded because an IOException was occurring when running the test
> on Windows, Most of the change here is support code to diagnose the problem, and
> to investigate whether the issue can be fixed.
> 
> Eventually, a reference was found on a Microsoft site, indicating that normal directories
> cannot be made read-only on Windows.  Thus the primary fix is to skip each test-case
> if the setup for the test case fails to create a readonly directory on Windows.
> 
> In addition doc comments and -Xdoclint:-missing are added to reduce the number of
> irrelevant diagnostics in the output.
> 
> In conjunction with the fix for JDK-8152313, this will fix all javadoc tests on the
> LangTools exclude list.
> 
> -- Jon
> 
> JBS: https://bugs.openjdk.java.net/browse/JDK-8164597
> Webrev: http://cr.openjdk.java.net/~jjg/8164597/webrev.00/
> 



More information about the javadoc-dev mailing list