JDK-8213781 : web page background renders blue in JEditorPane
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u10,7,8,9,10,11,12
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_7
  • CPU: x86_64
  • Submitted: 2018-10-26
  • Updated: 2025-12-03
  • Resolved: 2019-02-26
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 11 JDK 13
11.0.30Fixed 13 b10Fixed
Related Reports
Blocks :  
Causes :  
Duplicate :  
Description
A DESCRIPTION OF THE PROBLEM :
When displayed in JEditorPane, some web pages (ex: http://www.google.com/ ) have wrong background color (blue instead of white). This is related to https://bugs.openjdk.java.net/browse/JDK-4895924 "Strings in format #rgb not handled by Color.decode()"


CUSTOMER SUBMITTED WORKAROUND :
--- a/html/src/javax/swing/text/html/CSS.java
+++ b/html/src/javax/swing/text/html/CSS.java
@@ -1164,6 +1164,12 @@
         } else {
             digits = value;
         }
+	if (digits.length() == 3) {
+		final String r = digits.substring(0, 1);
+		final String v = digits.substring(1, 2);
+		final String b = digits.substring(2, 3);
+		digits = String.format("%s%s%s%s%s%s", r, r, v, v, b, b);
+	}
         String hstr = "0x" + digits;
         Color c;
         try {

FREQUENCY : always



Comments
[jdk11u-fix-request] Approval Request from Mangovnik Clean back port fixing background rendering for some webpages when JEditorPane is used. Tests run on fedora 43. Gtests passed, same T1 failing before and after the backport - not related to this issue.
20-11-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk11u-dev/pull/3118 Date: 2025-11-12 16:34:52 +0000
20-11-2025

GitHub changeset: https://github.com/openjdk/jdk/commit/f3c10c8049008a170af997d9f5bd70ab6805b243
29-09-2025

URL: http://hg.openjdk.java.net/jdk/jdk/rev/a986e16d8449 User: psadhukhan Date: 2019-02-27 09:16:08 +0000
27-02-2019

URL: http://hg.openjdk.java.net/jdk/client/rev/a986e16d8449 User: psadhukhan Date: 2019-02-26 05:38:27 +0000
26-02-2019

Webpage background renders blue in JEditorPane. The issue exists from the past (ref: JDK-4895924). Checked this for reported versions and could confirm the issue. Results: ========= 6u10: Fail 8u191: Fail 9: Fail 12 ea b19: Fail To verify, run the attached test case with respective JDK versions. Try outside OWAN. See Capture.png as reference.
13-11-2018