Github user varan123 commented on the issue:
https://github.com/apache/jmeter/pull/396
current_event is KeyEvent. action_event is ActionEvent. KeyEvent and
ActonEvent two different types, but both from AWTEvent. Line: String
propname = "gui.quick_" + actionEvent.getActionCommand(); tries to prepare
property name where last part it is pressed key with digit, and not working
with CTRL-6. I just replaced, with code, which take key text directly from
KeyEvent.
np. I will rename variables.
On Sun, Aug 26, 2018 at 3:30 PM Felix Schumacher <[email protected]>
wrote:
> *@FSchumacher* requested changes on this pull request.
>
> Thanks for your patch.
> I have one question and a few minor notes about code formatting.
> ------------------------------
>
> In src/core/org/apache/jmeter/gui/MainFrame.java
> <https://github.com/apache/jmeter/pull/396#discussion_r212836402>:
>
> > @@ -680,7 +683,15 @@ private void addQuickComponentHotkeys(JTree
treevar) {
>
> @Override
> public void actionPerformed(ActionEvent actionEvent) {
> - String propname = "gui.quick_" +
actionEvent.getActionCommand();
> + //Bug 62336
> + AWTEvent current_event = EventQueue.getCurrentEvent();
>
> Have you checked what actionEvent is here? If I read the Swing-API
> correctly, it should be the same object as current_event. If actionEvent
> is really null here, is it only sometimes null and the NPE stops the AWT
> thread?
> As a minor note: current_event should be written in camel case as
> currentEvent to match the other names.
> ------------------------------
>
> In src/core/org/apache/jmeter/gui/MainFrame.java
> <https://github.com/apache/jmeter/pull/396#discussion_r212836415>:
>
> > @@ -680,7 +683,15 @@ private void addQuickComponentHotkeys(JTree
treevar) {
>
> @Override
> public void actionPerformed(ActionEvent actionEvent) {
> - String propname = "gui.quick_" +
actionEvent.getActionCommand();
> + //Bug 62336
> + AWTEvent current_event = EventQueue.getCurrentEvent();
> + String key_text = "";
> + if(current_event instanceof KeyEvent) {
>
> I would place a space between if and the opening parenthesis as if is not
> a function call.
> ------------------------------
>
> In src/core/org/apache/jmeter/gui/MainFrame.java
> <https://github.com/apache/jmeter/pull/396#discussion_r212836472>:
>
> > @@ -680,7 +683,15 @@ private void addQuickComponentHotkeys(JTree
treevar) {
>
> @Override
> public void actionPerformed(ActionEvent actionEvent) {
> - String propname = "gui.quick_" +
actionEvent.getActionCommand();
> + //Bug 62336
> + AWTEvent current_event = EventQueue.getCurrentEvent();
> + String key_text = "";
> + if(current_event instanceof KeyEvent) {
> + KeyEvent key_event = (KeyEvent)current_event;
> + key_text = KeyEvent.getKeyText(
key_event.getKeyCode() );
>
> Again a minor nit: No space needed after the opening and before the
> closing parenthesis as this is a function call.
> And as above variable names should be written in camel case: keyEvent
> instead of key_event.
> ------------------------------
>
> In src/core/org/apache/jmeter/gui/MainFrame.java
> <https://github.com/apache/jmeter/pull/396#discussion_r212836512>:
>
> > @@ -680,7 +683,15 @@ private void addQuickComponentHotkeys(JTree
treevar) {
>
> @Override
> public void actionPerformed(ActionEvent actionEvent) {
> - String propname = "gui.quick_" +
actionEvent.getActionCommand();
> + //Bug 62336
> + AWTEvent current_event = EventQueue.getCurrentEvent();
> + String key_text = "";
> + if(current_event instanceof KeyEvent) {
> + KeyEvent key_event = (KeyEvent)current_event;
>
> Here I would put a space after the closing parenthesis as this is a cast.
>
> â
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/jmeter/pull/396#pullrequestreview-149548048>,
> or mute the thread
>
<https://github.com/notifications/unsubscribe-auth/AglOptrf5wGhMvsxG1TeD4dhKPCM5dU3ks5uUvdcgaJpZM4WM0kk>
> .
>
---