Summary
java.net.ProxySelector::select needs to define all situations where IllegalArgumentException is thrown.
Problem
The default JDK implementation of ProxySelector throws an IAE if the URI provided has an empty protocol or host field, or if the URI itself is null. However, it is only documented to do this in case of null URI. The apidoc needs to be updated to reflect the current (correct) behavior.
Solution
Update to ProxySelector apidoc as per spec below. No behavior change.
Specification
diff -r de0ccdc4db13 src/java.base/share/classes/java/net/ProxySelector.java
--- a/src/java.base/share/classes/java/net/ProxySelector.java Thu Aug 22 15:52:03 2019 +0200
+++ b/src/java.base/share/classes/java/net/ProxySelector.java Thu Aug 22 15:34:29 2019 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -143,7 +143,9 @@
* contain one element of type
* {@link java.net.Proxy Proxy}
* that represents a direct connection.
- * @throws IllegalArgumentException if the argument is null
+ * @throws IllegalArgumentException if the argument is null or if
+ * the protocol or host cannot be determined from the provided
+ * {@code uri}
*/
public abstract List<Proxy> select(URI uri);
- csr of
-
JDK-8177648 getResponseCode() throws IllegalArgumentException caused by protocol error while following redirect
-
- Resolved
-
- duplicates
-
JDK-6797318 Undeclared IAE thrown from HttpURLConnection.connect for some URLs
-
- Closed
-