#3 NPE in RSyntaxTextArea(String) constructor

v1.3.x
closed-fixed
None
3
2014-03-26
2009-06-25
No

The "new RSyntaxTextArea(String)" constructor throws an NPE. A simple workaround is:

RSyntaxTextArea textArea = new RSyntaxTextArea(); // Any other constructor
textArea.setText(text);

The reason this occurs is the funky way RSTA installs its own TextAreaUI. The JTextArea constructor taking a String parameter takes a code path that breaks because of the way the proper TextAreaUI isn't yet installed.

A fix for this may be tricky to come up with. There's probably a better way to handle installing the UI, but right now things are delicately done (i.e. hacked together) to keep things working and avoid other issues. In the meantime, the next release might see this constructor go away, or maybe throw an "UnsupportedOperationException" until I have more time to come up with a real fix. It's not such a big deal since the workaround is so simple.

Discussion

  • Robert Futrell

    Robert Futrell - 2009-06-25
    • priority: 5 --> 3
     
  • Robert Futrell

    Robert Futrell - 2014-03-26
    • status: open --> closed-fixed
    • Group: --> v1.3.x
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks