By using the sun.net.www.protocol.file.Handler.openConnection() the sun.net.www.ParseUtil.decode() throws an java.lang.IllegalArgumentException if an URL is used which has been encoded with the default encoding of the platform rather than UTF-8 and if the URI scheme is "file".
There is no problem if the URL is UTF-8 encoded and URI scheme is "file".
There is no problem anymore [to be exact 1.5.0_07+ is required, see CR 6274990] when the ParseUtil.decode() is the URL is not UTF-8 encoded, but run through an HttpURLConnection (if the URI scheme is "http").
$ java -showversion JEditorPaneTest
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Server VM (build 1.6.0-b105, mixed mode)
java.lang.IllegalArgumentException
at sun.net.www.ParseUtil.decode(ParseUtil.java:185)
at sun.net.www.protocol.file.Handler.openConnection(Handler.java:63)
at sun.net.www.protocol.file.Handler.openConnection(Handler.java:55)
at java.net.URL.openConnection(URL.java:945)
at javax.swing.JEditorPane.getStream(JEditorPane.java:769)
at javax.swing.JEditorPane.setPage(JEditorPane.java:418)
at javax.swing.JEditorPane.setPage(JEditorPane.java:922)
at javax.swing.JEditorPane.<init>(JEditorPane.java:258)
at JEditorPaneTest.<init>(JEditorPaneTest.java:18)
at JEditorPaneTest.main(JEditorPaneTest.java:35)
$ java -showversion JEditorPaneTest
java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Server VM (build 1.5.0_11-b03, mixed mode)
java.lang.IllegalArgumentException
at sun.net.www.ParseUtil.decode(ParseUtil.java:185)
at sun.net.www.protocol.file.Handler.openConnection(Handler.java:63)
at sun.net.www.protocol.file.Handler.openConnection(Handler.java:55)
at java.net.URL.openConnection(URL.java:943)
at javax.swing.JEditorPane.getStream(JEditorPane.java:685)
at javax.swing.JEditorPane.setPage(JEditorPane.java:406)
at javax.swing.JEditorPane.setPage(JEditorPane.java:790)
at javax.swing.JEditorPane.<init>(JEditorPane.java:251)
at JEditorPaneTest.<init>(JEditorPaneTest.java:18)
at JEditorPaneTest.main(JEditorPaneTest.java:35)
The sourcecode to reproduce the problem is attached to the bug report (see also workaround).