On Sun, 6 Sep 2020 09:38:09 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 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. The 
> pull request contains one new commit since
> the last revision:
>   8252767: URLConnection.setRequestProperty throws IllegalAccessError
>   Summary: Throw an IllegalStateException from 
> sun.net.www.URLConnection#setRequestProperty when already connected
>   Reviewed-By:

test/jdk/java/net/URLConnection/RequestProperties.java line 93:

> 91:     private static void testSetRequestPropIllegalStateException() throws 
> Exception {
> 92:         final URL url = new URL("file://" + 
> System.getProperty("java.io.tmpdir"));
> 93:         final java.net.URLConnection conn = url.openConnection();

The URL creation isn't technically right as you can't reliably use a file path 
string as a URL path. Something like the
following would be more correct: `URL url = 
Path.of(System.getProperty("java.io.tmpdir")).toUri().toURL();`

Also minor nit but importing java.net.URL and not URLConnection is a bit 
strange.

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

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

Reply via email to