Menu

#341 Check-spelling/styles error

1.8
closed-fixed
tiago
Interface (55)
5
2008-02-12
2007-10-30
No

This bug was first reported in the development mailing list.
Tiago wrote:
I have had the following error when opening a project:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.text.StyleConstants.getBackground(StyleConstants.java:554)
at org.omegat.util.gui.Styles.applyStyles(Styles.java:119)
at org.omegat.gui.main.MainWindow.checkSpelling(MainWindow.java:2358)
at org.omegat.gui.main.MainWindow.loadDocument(MainWindow.java:1648)
at org.omegat.gui.main.MainWindow.access$5(MainWindow.java:1583)
at org.omegat.gui.main.MainWindow$6.run(MainWindow.java:1492)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

Editor window was showing the first 4 segments of the project, project
window was ok (number of segments was correct), but the MainWindow did
not know there was something open (menus were as if no project was
open, no segment was active). If I chose a menu item from the "view"
menu, OmegaT shows everything, but does not know that I have an open
project. I tried again, with the same results, and then opened another
project, which loaded ok, and when trying back the first one, it
loaded fine.

I cannot reproduce it now, but I thought it was worth reporting.

Zoltan replied:
sometimes this happens when trying to get the background of a style, which has none. It (i.e. javax.swing.text.StyleConstants.getBackground() )should
return the background, but it doesn't, just throws null. It is trivial to explicitly add a background color to all styles in
org.omegat.util.gui.Styles. The other possibility is to catch the exception
in org.omegat.util.gui.Styles.applyStyles(Styles.java:119) and use the
default background if something like this happens. I think the latter is the better solution.

If you need the fix urgently, do it yourself (really trivial) or I put it on my TODO list.

I have now another report. The user cannot load a specific ODT document if spell checking is on. OmegaT freezes, and gives the following messages:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.text.StyleConstants.getBackground(Unknown Source)
at org.omegat.util.gui.Styles.applyStyles(Styles.java:119)
at
org.omegat.gui.main.MainWindow.checkSpelling(MainWindow.java:2335)
at
org.omegat.gui.main.MainWindow.loadDocument(MainWindow.java:1633)
at org.omegat.gui.main.MainWindow.access$500(MainWindow.java:117)
at org.omegat.gui.main.MainWindow$6.run(MainWindow.java:1477)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown
Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Didier

Discussion

  • Didier Briel

    Didier Briel - 2008-02-05
    • milestone: 667985 --> 1.8
    • assigned_to: nobody --> klain
    • status: open --> open-fixed
     
  • Didier Briel

    Didier Briel - 2008-02-05

    Logged In: YES
    user_id=1343245
    Originator: YES

    Fixed in CVS.

    There were also similar reports in
    [ 1886239 ] Weird display with spellcheck
    http://sourceforge.net/support/tracker.php?aid=1886239

    Didier

     
  • Didier Briel

    Didier Briel - 2008-02-12

    Logged In: YES
    user_id=1343245
    Originator: YES

    Closing, since this bug only appeared in CVS versions.

    Didier

     
  • Didier Briel

    Didier Briel - 2008-02-12
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.