--- old/test/jdk/java/util/Scanner/FailingConstructors.java 2017-12-11 11:59:54.210526978 -0800 +++ new/test/jdk/java/util/Scanner/FailingConstructors.java 2017-12-11 11:59:53.970514961 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /** * @test - * @bug 7000511 + * @bug 7000511 8190577 * @summary PrintStream, PrintWriter, Formatter, Scanner leave files open when * exception thrown */ @@ -33,6 +33,7 @@ import java.io.FileOutputStream; import java.io.FileNotFoundException; import java.io.IOException; +import java.nio.charset.Charset; import java.nio.file.Files; import java.util.Scanner; @@ -65,7 +66,14 @@ check(exists, file); try { - new Scanner(file, null); + new Scanner(file, (String)null); + fail(); + } catch(FileNotFoundException|NullPointerException e) { + pass(); + } + + try { + new Scanner(file, (Charset)null); fail(); } catch(FileNotFoundException|NullPointerException e) { pass(); @@ -84,7 +92,14 @@ check(exists, file); try { - new Scanner(file.toPath(), null); + new Scanner(file.toPath(), (String)null); + fail(); + } catch(FileNotFoundException|NullPointerException e) { + pass(); + } + + try { + new Scanner(file.toPath(), (Charset)null); fail(); } catch(FileNotFoundException|NullPointerException e) { pass();