After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 435553 - KeyError: 'startOffset' during Java Control Panel flat-review
KeyError: 'startOffset' during Java Control Panel flat-review
Status: RESOLVED FIXED
Product: orca
Classification: Applications
Component: speech
1.0.x
Other Linux
: High normal
: 2.20.0
Assigned To: Lynn Monsanto
Orca Maintainers
Depends on:
Blocks: orca-java
 
 
Reported: 2007-05-03 16:27 UTC by Lynn Monsanto
Modified: 2008-07-22 19:27 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18


Attachments
proposed patch (1.13 KB, patch)
2007-06-06 17:19 UTC, Lynn Monsanto
accepted-commit_now Details | Review

Description Lynn Monsanto 2007-05-03 16:27:17 UTC
I got the traceback below when using flat-review in the Java ControlPanel About dialog.

1. Launch /usr/lib/jvm/java-6-sun/ControlPanel
2. Hit About button on the General page.
2. Hit Keypad-9

Traceback (most recent call last):
  • File "/usr/lib/python2.5/site-packages/orca/input_event.py", line 178 in processInputEvent
    consumed = self._function(script, inputEvent)
  • File "/usr/lib/python2.5/site-packages/orca/default.py", line 3498 in reviewNextLine
    self._reviewCurrentLine(inputEvent)
  • File "/usr/lib/python2.5/site-packages/orca/default.py", line 3455 in _reviewCurrentLine
    self.updateBrailleReview()
  • File "/usr/lib/python2.5/site-packages/orca/default.py", line 3222 in updateBrailleReview
    [regions, regionWithFocus] = context.getCurrentBrailleRegions()
  • File "/usr/lib/python2.5/site-packages/orca/flat_review.py", line 1262 in getCurrentBrailleRegions
    regions = line.getBrailleRegions()
  • File "/usr/lib/python2.5/site-packages/orca/flat_review.py", line 326 in getBrailleRegions
    zone.startOffset,
  • File "/usr/lib/python2.5/site-packages/orca/flat_review.py", line 180 in __getattr__
    return self.__dict__[attr]
KeyError: 'startOffset'

Comment 1 Lynn Monsanto 2007-05-03 16:31:27 UTC
I retested and found this is an intermittent error. It happened in 2 of the 5 times I tried flat-review in the About dialog. The second time, the traceback occurred only after I used the Keypad-7, -8 and -9 keys a few times to move around the dialog.
Comment 2 Lynn Monsanto 2007-05-25 00:32:14 UTC
This is still an intermittant problem, even after the fix for null text objects (Bug 440238).
Comment 3 Lynn Monsanto 2007-06-05 21:46:25 UTC
TextZone have the attribute 'startOffset', but the Zone base class doesn't. The __getattr__ that's failing (line 180) is the Zone method, not the TextZone method. So, it appears that the flat-review code thinks it has a TextZone object, but really has a Zone object. That's why 'startOffset' is not defined. This might be due to flat-review not being able to handle Java text since the text bounds are wrong. Does this make sense? If so, maybe a sanity check is necessary at line 321 to verify to verify a (supposed) TextZone is really an instanceof TextZone. Then again, this would just mask the underlying problem 

Effectively, it appears this bug is a duplicate of Bug 436664.

Comment 4 Willie Walker 2007-06-06 12:53:41 UTC
(In reply to comment #3)
> TextZone have the attribute 'startOffset', but the Zone base class doesn't. The
> __getattr__ that's failing (line 180) is the Zone method, not the TextZone
> method. So, it appears that the flat-review code thinks it has a TextZone
> object, but really has a Zone object. That's why 'startOffset' is not defined.
> This might be due to flat-review not being able to handle Java text since the
> text bounds are wrong. Does this make sense? If so, maybe a sanity check is
> necessary at line 321 to verify to verify a (supposed) TextZone is really an
> instanceof TextZone. Then again, this would just mask the underlying problem 

That check sounds good to me.  Something like adding an is "instance(zone, TextZone)  and (the rest of the stuff for the if starting at line 321) seems like a good santiry check.

> Effectively, it appears this bug is a duplicate of Bug 436664.

Probably.  :-( 

Comment 5 Lynn Monsanto 2007-06-06 17:19:37 UTC
Created attachment 89494 [details] [review]
proposed patch

Added a sanity test to verify the zone really is a TextZone. I tested with the Java Control Panel and the patch appears to work around the Java text problems. The text is still not spoken or Brailled, but there are no more tracebacks. I also tested with OOo Writer, gnome-terminal and gtk-demo text. I found no regressions.
Comment 6 Willie Walker 2007-06-06 18:12:50 UTC
Looks great.  I like the comment referring to the bug as well.  :-)  Thanks!  Please commit and feel free to mark this as FIXED.