On Mon, 7 Sep 2020 11:04:35 GMT, Jaikiran Pai <j...@openjdk.org> wrote:
>> Can I please get a review and a sponsor for a fix for the issue reported at >> https://bugs.openjdk.java.net/browse/JDK-8252767? >> As noted in that issue, the `sun.net.www.URLConnection#setRequestProperty` >> is throwing a `IllegalAccessError` instead >> of a `IllegalStateException`. The commit here fixes that and includes a test >> which reproduces the issue and verifies >> the fix. Would a CSR be needed for this change? > > Jaikiran Pai has updated the pull request incrementally with one additional > commit since the last revision: > > Convert to TestNG test case test/jdk/java/net/URLConnection/RequestProperties.java line 90: > 88: try { > 89: conn.addRequestProperty(null, "hello"); > 90: Assert.fail("addRequestProperty on " + > conn.getClass().getName() Now that the test is using TestNG, you can use the convenient Assert.assertThrows / Assert.expectThrows, e.g. something like: static final Class<NullPointerException> NPE = NullPointerException.class; assertThrows(NPE, () -> conn.addRequestProperty(null, "hello")); similar for IllegalStateException ------------- PR: https://git.openjdk.java.net/jdk/pull/26