Project

General

Profile

Bug #7742

NPE on LinuxKeyboardReader when pressing Escape in ChUI Swing application

Added by Vladimir Tsichevski 8 months ago. Updated 8 months ago.

Status:
WIP
Priority:
Normal
Assignee:
Target version:
-
Start date:
Due date:
% Done:

80%

billable:
No
vendor_id:
GCD
case_num:

History

#1 Updated by Vladimir Tsichevski 8 months ago

ChUI Swing: when I press Escape, the client crashes with NPE here:

Thread [AWT-EventQueue-1] (Suspended (exception NullPointerException))    
LinkedBlockingQueue<E>.offer(E) line: 411    
LinkedBlockingQueue<E>(AbstractQueue<E>).add(E) line: 95    
LinuxKeyboardReader.keyPressed(KeyEvent) line: 214    
ChuiClient(Component).processKeyEvent(KeyEvent) line: 6497    

The origin in this LinuxLeyboardReader, l. 214:

         queue.add(null);

The queue field is defined as

   /** Incoming keystroke buffer. */
   protected final LinkedBlockingQueue<KeyCode> queue = new LinkedBlockingQueue<>();

And the LinkedBlockingQueue explicitly does not support adding nulls:

    public boolean offer(E e) {
        if (e == null) throw new NullPointerException();

#2 Updated by Greg Shah 8 months ago

Are we sure we need to add a null keyboard event to the queue?

Tomasz: Have you encountered this issue in <large_chui_app> regression testing?

#3 Updated by Hynek Cihlar 8 months ago

Greg Shah wrote:

Are we sure we need to add a null keyboard event to the queue?

Yes, it is used to signal a modifier key in multiple places. I am just checking in a fix.

#4 Updated by Vladimir Tsichevski 8 months ago

Hynek Cihlar wrote:

Greg Shah wrote:

Are we sure we need to add a null keyboard event to the queue?

Yes, it is used to signal a modifier key in multiple places. I am just checking in a fix.

Have you created a branch for this issue?

#5 Updated by Hynek Cihlar 8 months ago

The issue is fixed in 7742a revision 14707. The problem only showed in Swing ChUI client. Please review.

#6 Updated by Hynek Cihlar 8 months ago

  • % Done changed from 0 to 100
  • Status changed from New to Review

#7 Updated by Hynek Cihlar 8 months ago

Vladimir, please also retest.

#8 Updated by Tomasz Domin 8 months ago

Greg Shah wrote:

Are we sure we need to add a null keyboard event to the queue?

Tomasz: Have you encountered this issue in <large_chui_app> regression testing?

No, it was a problem with limited taBuf Deque size causing IllegalStateException

#9 Updated by Hynek Cihlar 8 months ago

I added missing code comments in 7742a revision 14708.

#10 Updated by Vladimir Tsichevski 8 months ago

  • vendor_id deleted (GCD)
  • Assignee set to Eric Faulhaber

Hynek Cihlar wrote:

Vladimir, please also retest.

The NPE disappeared now, but it seems the code works incorrectly.

Pressing Escape has no visible effect, and the boolean escPressed just flips on and off.

#11 Updated by Vladimir Tsichevski 8 months ago

  • Subject changed from NPE on LinuxKeyboardReader when pressing Escape in ShUI Swing application to NPE on LinuxKeyboardReader when pressing Escape in ChUI Swing application

#12 Updated by Hynek Cihlar 8 months ago

Vladimir Tsichevski wrote:

Hynek Cihlar wrote:

Vladimir, please also retest.

The NPE disappeared now, but it seems the code works incorrectly.

Pressing Escape has no visible effect, and the boolean escPressed just flips on and off.

Please compare the behavior with the terminal client. If you find differences post your test case.

#13 Updated by Vladimir Tsichevski 8 months ago

Hynek Cihlar wrote:

Vladimir Tsichevski wrote:

Hynek Cihlar wrote:

Vladimir, please also retest.

The NPE disappeared now, but it seems the code works incorrectly.

Pressing Escape has no visible effect, and the boolean escPressed just flips on and off.

Please compare the behavior with the terminal client. If you find differences post your test case.

Do you mean I should compare two FWD ChUI native mode?

#14 Updated by Vladimir Tsichevski 8 months ago

Vladimir Tsichevski wrote:

Hynek Cihlar wrote:

Vladimir Tsichevski wrote:

Hynek Cihlar wrote:

Vladimir, please also retest.

The NPE disappeared now, but it seems the code works incorrectly.

Pressing Escape has no visible effect, and the boolean escPressed just flips on and off.

Please compare the behavior with the terminal client. If you find differences post your test case.

Do you mean I should compare two FWD ChUI native mode?

I see no differences.

Also: after the Escape was pressed, the new key press is ignored. This holds both for Swing and native modes.

#15 Updated by Hynek Cihlar 8 months ago

Vladimir Tsichevski wrote:

I see no differences.

Also: after the Escape was pressed, the new key press is ignored. This holds both for Swing and native modes.

How does native OE behave?

#16 Updated by Vladimir Tsichevski 8 months ago

Hynek Cihlar wrote:

Vladimir Tsichevski wrote:

I see no differences.

Also: after the Escape was pressed, the new key press is ignored. This holds both for Swing and native modes.

How does native OE behave?

Procedure complete. Press space bar to continue.

#17 Updated by Hynek Cihlar 8 months ago

Vladimir Tsichevski wrote:

Hynek Cihlar wrote:

Vladimir Tsichevski wrote:

I see no differences.

Also: after the Escape was pressed, the new key press is ignored. This holds both for Swing and native modes.

How does native OE behave?

Procedure complete. Press space bar to continue.

This is different from the original issue. I will check how 6667e behaves and how does it resolve this regression.

#18 Updated by Hynek Cihlar 8 months ago

  • Status changed from Review to WIP
  • % Done changed from 100 to 80

#19 Updated by Eric Faulhaber 8 months ago

  • vendor_id set to GCD
  • Assignee changed from Eric Faulhaber to Hynek Cihlar

Also available in: Atom PDF