JDK-8088916 : Replace sun.net.www.ParseUtil#decode with public API
  • Type: Bug
  • Component: javafx
  • Sub-Component: web
  • Affected Version: 8,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-02-19
  • Updated: 2016-04-29
  • Resolved: 2016-04-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u102Fixed 9Fixed
Related Reports
Relates :  
Description
We currently use a static helper method, sun.net.www.ParseUtil#decode, to decode a 'file:' URL on Windows before trying to open a connection (see RT-22458). The sun.net.www package is an internal JDK pacakge. We need to remove the dependency on this internal API and instead use public API to parse the URL in this case (possibly copying from the internal class if there isn't a suitable replacement.
Comments
http://hg.openjdk.java.net/openjfx/9-dev/rt/rev/cf4676141286
15-04-2016

2 Minor comments: 1. import java.io.UnsupportedEncodingException; can be placed after import java.io.OutputStream; to maintain the order. 2. There is an extra space(2 spaces instead of 1) between "} catch ".
15-04-2016

+1
15-04-2016

Yes, I saw that, the deprecated method is shorter, also it takes default encoding from file.encoding system property: http://hg.openjdk.java.net/jdk9/dev/jdk/file/9d0e97030468/src/java.base/share/classes/java/net/URLEncoder.java#l143 So I guess that we can simply use "UTF-8" here. http://cr.openjdk.java.net/~azvegint/jdk/9/8088916/02/
14-04-2016

The single arg version of URLDecoder.decode is deprecated. The recommended replacement is the two-arg version. As long as we are making the change it would be better to avoid the deprecated method if possible.
14-04-2016

Thanks, http://cr.openjdk.java.net/~azvegint/jdk/9/8088916/01/
14-04-2016

One minor comment is you can keep import java.net.URLDecoder; after import java.net.URLConnection; to maintain the order.
14-04-2016

Please review the simple fix http://cr.openjdk.java.net/~azvegint/jdk/9/8088916/00/ java.net.URLDecoder#decode can directly replace internal sun.net.www.ParseUtil#decode
14-04-2016