JDK-8222250 : JLabel with an html img src not working anymore
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8u202,11.0.2,12,13
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2019-04-04
  • Updated: 2019-04-10
  • Resolved: 2019-04-10
Related Reports
Duplicate :  
Description
ADDITIONAL SYSTEM INFORMATION :
Windows 10 (update 1809)

Java 8u201 -> working
Java 8u202 -> not working
Java 11.0.2 -> not working
Java 12 -> not working

A DESCRIPTION OF THE PROBLEM :
Having a JLabel with a text set to an html snippet containing an 'img src="https://...."' tag, does not work as expected, starting from 8u202 while working correctly in 8u201.
It does not work as well with 11.0.2 and 12

REGRESSION : Last worked in version 8u201

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Execute the included test program to open a jframe displaying an oracle logo an some text

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Both the oracle logo and the text should be visible
ACTUAL -
With java 8u202, 11.0.2 and 12, the oracle logo is not visible, while the text is ok.

---------- BEGIN SOURCE ----------
import java.awt.BorderLayout;
import java.awt.Font;
import java.net.URISyntaxException;

import javax.swing.JFrame;
import javax.swing.JLabel; 

public class HtmlImgSrcTest
{
  public static void main(String[] args) throws URISyntaxException
  {
      JFrame frame = new JFrame();
      frame.setLayout(new BorderLayout());
      JLabel label = new JLabel(
          "<html>"
          + "Hello "
          + "<img src=\"https://media.smau.it/x-exhibition/upload/partner/2014/06/12/oracle2014.jpg\">"
          + " World</html>");
      label.setFont(new Font("Tahoma", Font.PLAIN, 30));
      frame.add(label, BorderLayout.CENTER);
      frame.setBounds(100, 100, 700, 300);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setVisible(true);
   }
 }
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Have not found a full workaround.
Using a <div style="background-image: url('http://.....')" /> works only partially because of the div itself (and changing display property does not give ant effect..)

FREQUENCY : always



Comments
This issue is already resolved with JDK-8218674
10-04-2019

JLabel with html img src fails to work with Java 8u202 and 11.0.2 and onward. Checked this for reported versions and could confirm the results. Results: ========= 8u201: OK 8u202: Fail 11.0.1: OK 11.0.2: Fail 12: Fail 13 ea b15: Fail To verify, run the attached test case with respective JDK versions. As per test both Oracle logo and text should appear (see attached image as reference). It fails to work since 8u202 and 11.0.2.
10-04-2019