-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0
-
beta
-
x86
-
windows_nt
Name: stC104175 Date: 05/01/2000
C:\javaBugs\JDK1.3_RC3_CSS_stringToColor.StringIndexOutOfBounds>java -version
java version "1.3.0rc3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc3-Z)
Java HotSpot(TM) Client VM (build 1.3.0rc3-Z, mixed mode)
JEditor.setPage(url) where url is a page containing BGCOLOR="" results in a
StringIndexOutOfBoundsException: String index out of range: 0 within
String.chartAt called from
javax.swing.text.html.CSS.stringToColor(CSS.java:818). This is followed by a
NullPointerException in
javax.swing.text.ParagraphView.getLayoutViewCount(ParagraphView.java:97).
Source of Test Program:
public class TestHTMLRead extends javax.swing.JFrame
implements java.awt.event.ActionListener
{
// Using JDK1.3 RC3, the display of an HTML page with BGCOLOR="", such as
// all of those in www.partsBase.com/xxx, will result in a
// StringIndexOutOfBoundsException. To replicate the bug, start this
// program which displays a window with a JEditorPane and then press the
// "reload" button at the buttom of the screen, which will set the page
// of the JEditorPane to a page with BGCOLOR="" to get the Exception.
//
// String url = "http://www.partsBase.com/auction";
String url = "http://www.partsBase.com/parts";
javax.swing.JEditorPane editorPane;
javax.swing.JScrollPane scrollPane;
javax.swing.JButton reloadButton;
public TestHTMLRead()
{
editorPane = new javax.swing.JEditorPane();
scrollPane = new javax.swing.JScrollPane(editorPane);
getContentPane().add(java.awt.BorderLayout.CENTER, scrollPane);
reloadButton = new javax.swing.JButton("Reload");
reloadButton.addActionListener(this);
getContentPane().add(java.awt.BorderLayout.SOUTH, reloadButton);
setSize(750, 425);
}
public void reloadBrowser()
{
try {
editorPane.setPage(url);
} catch (java.io.IOException ex) { ex.printStackTrace(); }
}
public void actionPerformed(java.awt.event.ActionEvent event)
{
Object source = event.getSource();
if (source == reloadButton)
{
reloadBrowser();
}
}
public static void main(String[] argv)
{
(new TestHTMLRead()).show();
}
}
====================================
Error message:
Exception occurred during event dispatching:
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:503)
at javax.swing.text.html.CSS.stringToColor(CSS.java:818)
at javax.swing.text.html.CSS$ColorValue.parseCssValue(CSS.java:1549)
at javax.swing.text.html.CSS$ColorValue.parseHtmlValue(CSS.java:1560)
at javax.swing.text.html.CSS.getCssValue(CSS.java:970)
at javax.swing.text.html.CSS.translateAttribute(CSS.java:953)
at javax.swing.text.html.CSS.translateAttributes(CSS.java:930)
at javax.swing.text.html.CSS.translateHTMLToCSS(CSS.java:556)
at javax.swing.text.html.StyleSheet.translateHTMLToCSS(StyleSheet.java:437)
at
javax.swing.text.html.StyleSheet$ViewAttributeSet.<init>(StyleSheet.java:2460)
at javax.swing.text.html.StyleSheet.getViewAttributes(StyleSheet.java:274)
at javax.swing.text.html.BlockView.<init>(BlockView.java:43)
at javax.swing.text.html.TableView$CellView.<init>(TableView.java:318)
at
javax.swing.text.html.HTMLEditorKit$HTMLFactory.create(HTMLEditorKit.java:886)
at javax.swing.text.html.TableView$TableFactory.create(TableView.java:423)
at javax.swing.text.html.TableView$TableFactory.create(TableView.java:423)
at javax.swing.text.CompositeView.loadChildren(CompositeView.java:97)
at javax.swing.text.CompositeView.setParent(CompositeView.java:360)
at javax.swing.text.CompositeView.replace(CompositeView.java:185)
at javax.swing.text.BoxView.replace(BoxView.java:116)
at javax.swing.text.TableView.replace(TableView.java:186)
at javax.swing.text.CompositeView.loadChildren(CompositeView.java:99)
at javax.swing.text.CompositeView.setParent(CompositeView.java:360)
at javax.swing.text.html.TableView.setParent(TableView.java:65)
at javax.swing.text.CompositeView.replace(CompositeView.java:185)
at javax.swing.text.BoxView.replace(BoxView.java:116)
at javax.swing.text.CompositeView.loadChildren(CompositeView.java:99)
at javax.swing.text.CompositeView.setParent(CompositeView.java:360)
at javax.swing.text.CompositeView.replace(CompositeView.java:185)
at javax.swing.text.BoxView.replace(BoxView.java:116)
at javax.swing.text.TableView$TableRow.replace(TableView.java:622)
at javax.swing.text.CompositeView.loadChildren(CompositeView.java:99)
at javax.swing.text.CompositeView.setParent(CompositeView.java:360)
at javax.swing.text.CompositeView.replace(CompositeView.java:185)
at javax.swing.text.BoxView.replace(BoxView.java:116)
at javax.swing.text.TableView.replace(TableView.java:186)
at javax.swing.text.CompositeView.loadChildren(CompositeView.java:99)
at javax.swing.text.CompositeView.setParent(CompositeView.java:360)
at javax.swing.text.html.TableView.setParent(TableView.java:65)
at javax.swing.text.CompositeView.replace(CompositeView.java:185)
at javax.swing.text.BoxView.replace(BoxView.java:116)
at javax.swing.text.CompositeView.loadChildren(CompositeView.java:99)
at javax.swing.text.CompositeView.setParent(CompositeView.java:360)
at javax.swing.text.CompositeView.replace(CompositeView.java:185)
at javax.swing.text.BoxView.replace(BoxView.java:116)
at javax.swing.text.CompositeView.loadChildren(CompositeView.java:99)
at javax.swing.text.CompositeView.setParent(CompositeView.java:360)
at javax.swing.text.CompositeView.replace(CompositeView.java:185)
at javax.swing.text.BoxView.replace(BoxView.java:116)
at javax.swing.text.CompositeView.loadChildren(CompositeView.java:99)
at javax.swing.text.CompositeView.setParent(CompositeView.java:360)
at javax.swing.text.CompositeView.replace(CompositeView.java:185)
at javax.swing.text.BoxView.replace(BoxView.java:116)
at javax.swing.text.CompositeView.loadChildren(CompositeView.java:99)
at javax.swing.text.CompositeView.setParent(CompositeView.java:360)
at javax.swing.plaf.basic.BasicTextUI$RootView.setView(BasicTextUI.java:944)
at javax.swing.plaf.basic.BasicTextUI.setView(BasicTextUI.java:384)
at javax.swing.plaf.basic.BasicTextUI.modelChanged(BasicTextUI.java:372)
at
javax.swing.plaf.basic.BasicTextUI$UpdateHandler.propertyChange(BasicTextUI.java
:1382)
at
javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(SwingPropertyCha
ngeSupport.java:154)
at javax.swing.JComponent.firePropertyChange(JComponent.java:3023)
at javax.swing.text.JTextComponent.setDocument(JTextComponent.java:651)
at mergent.html.JEditorPane.setPage(JEditorPane.java:146)
at mergent.html.JEditorPane.setPage(JEditorPane.java:34)
at mergent.html.iExtract.fillBrowser(iExtract.java:1239)
at mergent.html.iExtract.showPage(iExtract.java:3862)
at mergent.html.iExtract.actionPerformed(iExtract.java:4398)
at javax.swing.JTextField.fireActionPerformed(JTextField.java:409)
at javax.swing.JTextField.postActionEvent(JTextField.java:443)
at javax.swing.JTextField$NotifyAction.actionPerformed(JTextField.java:537)
at javax.swing.text.JTextComponent.mapEventToAction(JTextComponent.java:966)
at
javax.swing.text.JTextComponent.processComponentKeyEvent(JTextComponent.java:143
1)
at javax.swing.JComponent.processKeyEvent(JComponent.java:1538)
at java.awt.Component.processEvent(Component.java:3008)
at java.awt.Container.processEvent(Container.java:990)
at java.awt.Component.dispatchEventImpl(Component.java:2394)
at java.awt.Container.dispatchEventImpl(Container.java:1035)
at java.awt.Component.dispatchEvent(Component.java:2307)
at java.awt.LightweightDispatcher.processKeyEvent(Container.java:1766)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:1740)
at java.awt.Container.dispatchEventImpl(Container.java:1022)
at java.awt.Window.dispatchEventImpl(Window.java:749)
at java.awt.Component.dispatchEvent(Component.java:2307)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:287)
at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:92)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:83)
Exception occurred during event dispatching:
java.lang.NullPointerException
at javax.swing.text.ParagraphView.getLayoutViewCount(ParagraphView.java:97)
at javax.swing.text.html.ParagraphView.isVisible(ParagraphView.java:176)
(Review ID: 104320)
======================================================================