Bug 237304 - JEditorPane.setContentType NullPointer
Summary: JEditorPane.setContentType NullPointer
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
(Show other bugs)
Version: rawhide
Hardware: All Linux
medium
medium
Target Milestone: ---
Assignee: Thomas Fitzsimmons
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-04-20 17:56 UTC by Sander Hoentjen
Modified: 2007-11-30 22:12 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-05-14 23:45:59 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description Sander Hoentjen 2007-04-20 17:56:38 UTC
Description of problem:
when you call the setContentType function of a JEditorPane it results in a
NullPointer exception.

Version-Release number of selected component (if applicable):
1.5.0-gcj-1.5.0.0-14.fc7

How reproducible:
always

Steps to Reproduce:
1. create file with contents:
----------------------------
import javax.swing.JEditorPane;

public class SetContentTypeTest {
	public static void main(String[] args){

		JEditorPane jpane = new JEditorPane();
		jpane.setContentType("text/html");
	}
}
----------------------------
2. compile the file
3. run the file
  
Actual results:
$ java SetContentTypeTest
Exception in thread "main" java.lang.NullPointerException
   at java.io.InputStreamReader.read(libgcj.so.8rh)
   at gnu.javax.swing.text.html.css.CSSScanner.read(libgcj.so.8rh)
   at gnu.javax.swing.text.html.css.CSSScanner.nextToken(libgcj.so.8rh)
   at gnu.javax.swing.text.html.css.CSSParser.peekToken(libgcj.so.8rh)
   at gnu.javax.swing.text.html.css.CSSParser.parseStylesheet(libgcj.so.8rh)
   at gnu.javax.swing.text.html.css.CSSParser.parse(libgcj.so.8rh)
   at javax.swing.text.html.StyleSheet.loadRules(libgcj.so.8rh)
   at javax.swing.text.html.HTMLEditorKit.getStyleSheet(libgcj.so.8rh)
   at javax.swing.text.html.HTMLEditorKit.createDefaultDocument(libgcj.so.8rh)
   at javax.swing.JEditorPane.setEditorKit(libgcj.so.8rh)
   at javax.swing.JEditorPane.setContentType(libgcj.so.8rh)
   at SetContentTypeTest.main(SetContentTypeTest.java:7)


Expected results:
nothing bad happens


Additional info:
this doesn't happen with the latest classpath version

Comment 1 Mario Torre 2007-04-29 18:07:37 UTC
Hello!

I've run your test program with cacao + classpath HEAD and it works. I'm on a
Fedora 6 and I've tested it with the system gcj (4.1.1 20070105) and with sun
java 6u1 and it works too. I think this can be either a regression introduced
classpath and then fixed or a gcj-1.5 issue.

Comment 2 Thomas Fitzsimmons 2007-04-30 21:42:59 UTC
Yes, the problem is this code:

        try
          {
            styleSheet = new StyleSheet();
            Class c = HTMLEditorKit.class;
            InputStream in = c.getResourceAsStream(DEFAULT_CSS);
            InputStreamReader r = new InputStreamReader(in);
            styleSheet.loadRules(r,  null);
            r.close();
          }
        catch (IOException ex)
          {
            // No style available.
          }

DEFAULT_CSS is "default.css" which not being compiled into libgcj (but is built
into GNU Classpath's glibj.zip).  The exception is silently eaten and manifests
later as a NullPointerException.  I'm working on a fix.


Comment 3 Thomas Fitzsimmons 2007-05-03 21:39:00 UTC
I committed my fix to redhat/gcc-4_1-branch.  It will be included in the next
Rawhide gcc build, at which point I'll close this bug report.


Comment 4 Sander Hoentjen 2007-05-09 14:53:24 UTC
thanks, i grabbed the build from koji and it works fine.


Comment 5 Thomas Fitzsimmons 2007-05-14 23:45:59 UTC
The fix hit Rawhide.  Closing.



Note You need to log in before you can comment on or make changes to this bug.