GNOME Bugzilla – Bug 435553
KeyError: 'startOffset' during Java Control Panel flat-review
Last modified: 2008-07-22 19:27:40 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):
+ Trace 132140
consumed = self._function(script, inputEvent)
self._reviewCurrentLine(inputEvent)
self.updateBrailleReview()
[regions, regionWithFocus] = context.getCurrentBrailleRegions()
regions = line.getBrailleRegions()
zone.startOffset,
return self.__dict__[attr]
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.
This is still an intermittant problem, even after the fix for null text objects (Bug 440238).
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.
(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. :-(
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.
Looks great. I like the comment referring to the bug as well. :-) Thanks! Please commit and feel free to mark this as FIXED.