-
Bug
-
Resolution: Fixed
-
P2
-
8u221, 11.0.4-oracle, 13, 14
-
b26
-
x86_64
-
windows_10
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8241567 | 13.0.3 | Pankaj Bansal | P2 | Resolved | Fixed | b02 |
JDK-8236909 | 11.0.7-oracle | Pankaj Bansal | P2 | Closed | Fixed | b02 |
JDK-8237793 | 11.0.7 | Pankaj Bansal | P2 | Resolved | Fixed | b01 |
JDK-8241552 | openjdk8u262 | Pankaj Bansal | P2 | Resolved | Fixed | team |
JDK-8240836 | openjdk8u252 | Pankaj Bansal | P2 | Resolved | Fixed | b06 |
JDK-8236910 | 8u251 | Pankaj Bansal | P2 | Closed | Fixed | b01 |
JDK-8239711 | emb-8u251 | Pankaj Bansal | P2 | Resolved | Fixed | team |
Processor Intel(R) Xeon(R) CPU E5-2683 v4 @ 2.10GHz, 2095 Mhz, 2 Core(s), 2 Logical Processor(s)
System Type x64-based PC
OS Name Microsoft Windows 10 Enterprise
Version 10.0.15063 Build 15063
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
A DESCRIPTION OF THE PROBLEM :
Rendering a Label using HTML text cause an NullPointerException when:
- The img attribute is empty e.g. "<html><img src=''/></html>"
- and the JComponent has a custom image base URL (BasicHTML.documentBaseKey)
REGRESSION : Last worked in version 8u221
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- Create a javax.swing.JLabel
- Set a custome BasicHTML.documentBaseKey URL for the JLabel using putClientProperty
- Set a HTML as text via setText("<html><img src=''/></html>")
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The configured ImageView.MISSING_IMAGE (html.missingImage) is rendered
ACTUAL -
A java.lang.NullPointerException is thrown see below:
Stacktrace:
at javax.swing.text.html.ImageView.updateImageSize(Unknown Source)
at javax.swing.text.html.ImageView.refreshImage(Unknown Source)
at javax.swing.text.html.ImageView.sync(Unknown Source)
at javax.swing.text.html.ImageView.getPreferredSpan(Unknown Source)
at javax.swing.text.FlowView$LogicalView.getPreferredSpan(Unknown Source)
at javax.swing.text.FlowView.calculateMinorAxisRequirements(Unknown Source)
at javax.swing.text.ParagraphView.calculateMinorAxisRequirements(Unknown Source)
at javax.swing.text.html.ParagraphView.calculateMinorAxisRequirements(Unknown Source)
at javax.swing.text.BoxView.checkRequests(Unknown Source)
at javax.swing.text.BoxView.getMinimumSpan(Unknown Source)
at javax.swing.text.html.ParagraphView.getMinimumSpan(Unknown Source)
at javax.swing.text.BoxView.calculateMinorAxisRequirements(Unknown Source)
at javax.swing.text.html.BlockView.calculateMinorAxisRequirements(Unknown Source)
at javax.swing.text.BoxView.checkRequests(Unknown Source)
at javax.swing.text.BoxView.getMinimumSpan(Unknown Source)
at javax.swing.text.html.BlockView.getMinimumSpan(Unknown Source)
at javax.swing.text.BoxView.calculateMinorAxisRequirements(Unknown Source)
at javax.swing.text.html.BlockView.calculateMinorAxisRequirements(Unknown Source)
at javax.swing.text.BoxView.checkRequests(Unknown Source)
at javax.swing.text.BoxView.getPreferredSpan(Unknown Source)
at javax.swing.text.html.BlockView.getPreferredSpan(Unknown Source)
at javax.swing.plaf.basic.BasicHTML$Renderer.<init>(Unknown Source)
at javax.swing.plaf.basic.BasicHTML.createHTMLView(Unknown Source)
at javax.swing.plaf.basic.BasicHTML.updateRenderer(Unknown Source)
at javax.swing.plaf.basic.BasicLabelUI.propertyChange(Unknown Source)
at java.beans.PropertyChangeSupport.fire(Unknown Source)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at java.awt.Component.firePropertyChange(Unknown Source)
at javax.swing.JLabel.setText(Unknown Source)
at SwingApp.initialize(SwingApp.java:32)
at SwingApp.<init>(SwingApp.java:21)
at SwingApp.main(SwingApp.java:13)
---------- BEGIN SOURCE ----------
import java.awt.BorderLayout;
import java.net.URL;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.plaf.basic.BasicHTML;
public class SwingApp {
private JFrame frame;
public static void main(String[] args) {
try {
SwingApp window = new SwingApp();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
public SwingApp() {
initialize();
}
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// This Label cause an exception
try {
JLabel broken = new JLabel();
broken.putClientProperty(BasicHTML.documentBaseKey, new URL("https://www.google.com/"));
broken.setText("<html><img src=''/></html>");
frame.add(broken, BorderLayout.EAST);
} catch (Exception ex) {
ex.printStackTrace();
}
frame.add(new JLabel("Test"), BorderLayout.CENTER);
frame.add(new JLabel("<html><img src=''/></html>"), BorderLayout.WEST);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround known
FREQUENCY : always
- backported by
-
JDK-8237793 Rendering HTML with empty img attribute and documentBaseKey cause Exception
- Resolved
-
JDK-8239711 Rendering HTML with empty img attribute and documentBaseKey cause Exception
- Resolved
-
JDK-8240836 Rendering HTML with empty img attribute and documentBaseKey cause Exception
- Resolved
-
JDK-8241552 Rendering HTML with empty img attribute and documentBaseKey cause Exception
- Resolved
-
JDK-8241567 Rendering HTML with empty img attribute and documentBaseKey cause Exception
- Resolved
-
JDK-8236909 Rendering HTML with empty img attribute and documentBaseKey cause Exception
- Closed
-
JDK-8236910 Rendering HTML with empty img attribute and documentBaseKey cause Exception
- Closed
- relates to
-
JDK-8218674 HTML Tooltip with "img src=" on component doesn't show
- Resolved