You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by Graham Russell <gr...@ham1.co.uk> on 2017/02/25 13:42:24 UTC

NPE during GUI launch on latest trunk

Hi all

I just tried to run `ant run_gui` on the latest (github) trunk but
this results in an NPE - specifically when trying to create the
JMeterTreeModel.

Any ideas?

Thanks

Graham

The JMeter log is:

2017-02-25 13:26:50,223 INFO o.a.j.u.JMeterUtils: Setting Locale to en_GB
2017-02-25 13:26:50,246 INFO o.a.j.JMeter: Loading user properties
from: /home/coding/jmeter/bin/user.properties
2017-02-25 13:26:50,247 INFO o.a.j.JMeter: Loading system properties
from: /home/coding/jmeter/bin/system.properties
2017-02-25 13:26:50,317 INFO o.a.j.JMeter: Copyright (c) 1998-2017 The
Apache Software Foundation
2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Version 3.2-SNAPSHOT.20170225
2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.version=1.8.0_121
2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.vm.name=Java
HotSpot(TM) 64-Bit Server VM
2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.name=Linux
2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.arch=amd64
2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.version=4.4.0-59-generic
2017-02-25 13:26:50,318 INFO o.a.j.JMeter: file.encoding=UTF-8
2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Max memory     =1342177280
2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Available Processors =4
2017-02-25 13:26:50,323 INFO o.a.j.JMeter: Default Locale=English
(United Kingdom)
2017-02-25 13:26:50,323 INFO o.a.j.JMeter: JMeter  Locale=English
(United Kingdom)
2017-02-25 13:26:50,323 INFO o.a.j.JMeter: JMeterHome=/home/coding/jmeter
2017-02-25 13:26:50,323 INFO o.a.j.JMeter: user.dir  =/home/coding/jmeter
2017-02-25 13:26:50,323 INFO o.a.j.JMeter: PWD       =/home/coding/jmeter
2017-02-25 13:26:50,324 INFO o.a.j.JMeter: IP: 127.0.1.1 Name:
EliteBook FullName: EliteBook
2017-02-25 13:26:50,607 INFO o.a.j.g.a.LookAndFeelCommand: Using look
and feel: com.sun.java.swing.plaf.gtk.GTKLookAndFeel [GTK+, System]
2017-02-25 13:26:50,805 INFO o.a.j.JMeter: Loaded icon properties from
org/apache/jmeter/images/icon.properties
2017-02-25 13:26:50,842 ERROR o.a.j.JMeter: An error occurred:
java.lang.NullPointerException: null
        at org.apache.jmeter.gui.NamePanel.getName(NamePanel.java:75)
~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
        at com.sun.java.swing.plaf.gtk.GTKStyle.getInsets(GTKStyle.java:316)
~[?:1.8.0_121]
        at javax.swing.plaf.synth.SynthStyle.installDefaults(SynthStyle.java:913)
~[?:1.8.0_121]
        at javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(SynthLookAndFeel.java:265)
~[?:1.8.0_121]
        at javax.swing.plaf.synth.SynthPanelUI.updateStyle(SynthPanelUI.java:117)
~[?:1.8.0_121]
        at javax.swing.plaf.synth.SynthPanelUI.installDefaults(SynthPanelUI.java:100)
~[?:1.8.0_121]
        at javax.swing.plaf.basic.BasicPanelUI.installUI(BasicPanelUI.java:56)
~[?:1.8.0_121]
        at javax.swing.plaf.synth.SynthPanelUI.installUI(SynthPanelUI.java:62)
~[?:1.8.0_121]
        at javax.swing.JComponent.setUI(JComponent.java:666) ~[?:1.8.0_121]
        at javax.swing.JPanel.setUI(JPanel.java:153) ~[?:1.8.0_121]
        at javax.swing.JPanel.updateUI(JPanel.java:126) ~[?:1.8.0_121]
        at javax.swing.JPanel.<init>(JPanel.java:86) ~[?:1.8.0_121]
        at javax.swing.JPanel.<init>(JPanel.java:109) ~[?:1.8.0_121]
        at javax.swing.JPanel.<init>(JPanel.java:117) ~[?:1.8.0_121]
        at org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:44)
~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
        at org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(AbstractJMeterGuiComponent.java:78)
~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
        at org.apache.jmeter.control.gui.TestPlanGui.<init>(TestPlanGui.java:68)
~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
        at org.apache.jmeter.gui.tree.JMeterTreeModel.<init>(JMeterTreeModel.java:49)
~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
        at org.apache.jmeter.JMeter.startGui(JMeter.java:366)
~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
        at org.apache.jmeter.JMeter.start(JMeter.java:519)
[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
~[?:1.8.0_121]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
~[?:1.8.0_121]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[?:1.8.0_121]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
        at org.apache.jmeter.NewDriver.main(NewDriver.java:256)
[ApacheJMeter.jar:3.2-SNAPSHOT.20170225]

Re: NPE during GUI launch on latest trunk

Posted by Felix Schumacher <fe...@internetallee.de>.
Am 25.02.2017 um 14:42 schrieb Graham Russell:
> Hi all
>
> I just tried to run `ant run_gui` on the latest (github) trunk but
> this results in an NPE - specifically when trying to create the
> JMeterTreeModel.
I get the same, after I switched to gtk+ in the menu and restarting jmeter.

Felix
>
> Any ideas?
>
> Thanks
>
> Graham
>
> The JMeter log is:
>
> 2017-02-25 13:26:50,223 INFO o.a.j.u.JMeterUtils: Setting Locale to en_GB
> 2017-02-25 13:26:50,246 INFO o.a.j.JMeter: Loading user properties
> from: /home/coding/jmeter/bin/user.properties
> 2017-02-25 13:26:50,247 INFO o.a.j.JMeter: Loading system properties
> from: /home/coding/jmeter/bin/system.properties
> 2017-02-25 13:26:50,317 INFO o.a.j.JMeter: Copyright (c) 1998-2017 The
> Apache Software Foundation
> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Version 3.2-SNAPSHOT.20170225
> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.version=1.8.0_121
> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.vm.name=Java
> HotSpot(TM) 64-Bit Server VM
> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.name=Linux
> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.arch=amd64
> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.version=4.4.0-59-generic
> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: file.encoding=UTF-8
> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Max memory     =1342177280
> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Available Processors =4
> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: Default Locale=English
> (United Kingdom)
> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: JMeter  Locale=English
> (United Kingdom)
> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: JMeterHome=/home/coding/jmeter
> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: user.dir  =/home/coding/jmeter
> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: PWD       =/home/coding/jmeter
> 2017-02-25 13:26:50,324 INFO o.a.j.JMeter: IP: 127.0.1.1 Name:
> EliteBook FullName: EliteBook
> 2017-02-25 13:26:50,607 INFO o.a.j.g.a.LookAndFeelCommand: Using look
> and feel: com.sun.java.swing.plaf.gtk.GTKLookAndFeel [GTK+, System]
> 2017-02-25 13:26:50,805 INFO o.a.j.JMeter: Loaded icon properties from
> org/apache/jmeter/images/icon.properties
> 2017-02-25 13:26:50,842 ERROR o.a.j.JMeter: An error occurred:
> java.lang.NullPointerException: null
>          at org.apache.jmeter.gui.NamePanel.getName(NamePanel.java:75)
> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>          at com.sun.java.swing.plaf.gtk.GTKStyle.getInsets(GTKStyle.java:316)
> ~[?:1.8.0_121]
>          at javax.swing.plaf.synth.SynthStyle.installDefaults(SynthStyle.java:913)
> ~[?:1.8.0_121]
>          at javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(SynthLookAndFeel.java:265)
> ~[?:1.8.0_121]
>          at javax.swing.plaf.synth.SynthPanelUI.updateStyle(SynthPanelUI.java:117)
> ~[?:1.8.0_121]
>          at javax.swing.plaf.synth.SynthPanelUI.installDefaults(SynthPanelUI.java:100)
> ~[?:1.8.0_121]
>          at javax.swing.plaf.basic.BasicPanelUI.installUI(BasicPanelUI.java:56)
> ~[?:1.8.0_121]
>          at javax.swing.plaf.synth.SynthPanelUI.installUI(SynthPanelUI.java:62)
> ~[?:1.8.0_121]
>          at javax.swing.JComponent.setUI(JComponent.java:666) ~[?:1.8.0_121]
>          at javax.swing.JPanel.setUI(JPanel.java:153) ~[?:1.8.0_121]
>          at javax.swing.JPanel.updateUI(JPanel.java:126) ~[?:1.8.0_121]
>          at javax.swing.JPanel.<init>(JPanel.java:86) ~[?:1.8.0_121]
>          at javax.swing.JPanel.<init>(JPanel.java:109) ~[?:1.8.0_121]
>          at javax.swing.JPanel.<init>(JPanel.java:117) ~[?:1.8.0_121]
>          at org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:44)
> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>          at org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(AbstractJMeterGuiComponent.java:78)
> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>          at org.apache.jmeter.control.gui.TestPlanGui.<init>(TestPlanGui.java:68)
> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>          at org.apache.jmeter.gui.tree.JMeterTreeModel.<init>(JMeterTreeModel.java:49)
> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>          at org.apache.jmeter.JMeter.startGui(JMeter.java:366)
> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>          at org.apache.jmeter.JMeter.start(JMeter.java:519)
> [ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> ~[?:1.8.0_121]
>          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> ~[?:1.8.0_121]
>          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> ~[?:1.8.0_121]
>          at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
>          at org.apache.jmeter.NewDriver.main(NewDriver.java:256)
> [ApacheJMeter.jar:3.2-SNAPSHOT.20170225]



Re: NPE during GUI launch on latest trunk

Posted by Felix Schumacher <fe...@internetallee.de>.
Am 25.02.2017 um 15:01 schrieb Philippe Mouawad:
> Hi Graham,
> It could be coming from a Sonar error I fixed in r1783482
>
>      @Override
>      public String getName() {
>          if (nameField != null) {
>              return nameField.getText();
>          }
>          return ""; // $NON-NLS-1$
>      }
>
> Could you try it ?

Hadn't seen, that you fixed that, but it is indeed the culprit. The 
field seems to be not initialized, when that method is called. Strange.

It happens on nimbus, too.

Felix
> Thanks
>
> On Sat, Feb 25, 2017 at 2:42 PM, Graham Russell <gr...@ham1.co.uk> wrote:
>
>> Hi all
>>
>> I just tried to run `ant run_gui` on the latest (github) trunk but
>> this results in an NPE - specifically when trying to create the
>> JMeterTreeModel.
>>
>> Any ideas?
>>
>> Thanks
>>
>> Graham
>>
>> The JMeter log is:
>>
>> 2017-02-25 13:26:50,223 INFO o.a.j.u.JMeterUtils: Setting Locale to en_GB
>> 2017-02-25 13:26:50,246 INFO o.a.j.JMeter: Loading user properties
>> from: /home/coding/jmeter/bin/user.properties
>> 2017-02-25 13:26:50,247 INFO o.a.j.JMeter: Loading system properties
>> from: /home/coding/jmeter/bin/system.properties
>> 2017-02-25 13:26:50,317 INFO o.a.j.JMeter: Copyright (c) 1998-2017 The
>> Apache Software Foundation
>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Version 3.2-SNAPSHOT.20170225
>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.version=1.8.0_121
>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.vm.name=Java
>> HotSpot(TM) 64-Bit Server VM
>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.name=Linux
>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.arch=amd64
>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.version=4.4.0-59-generic
>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: file.encoding=UTF-8
>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Max memory     =1342177280
>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Available Processors =4
>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: Default Locale=English
>> (United Kingdom)
>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: JMeter  Locale=English
>> (United Kingdom)
>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: JMeterHome=/home/coding/jmeter
>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: user.dir  =/home/coding/jmeter
>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: PWD       =/home/coding/jmeter
>> 2017-02-25 13:26:50,324 INFO o.a.j.JMeter: IP: 127.0.1.1 Name:
>> EliteBook FullName: EliteBook
>> 2017-02-25 13:26:50,607 INFO o.a.j.g.a.LookAndFeelCommand: Using look
>> and feel: com.sun.java.swing.plaf.gtk.GTKLookAndFeel [GTK+, System]
>> 2017-02-25 13:26:50,805 INFO o.a.j.JMeter: Loaded icon properties from
>> org/apache/jmeter/images/icon.properties
>> 2017-02-25 13:26:50,842 ERROR o.a.j.JMeter: An error occurred:
>> java.lang.NullPointerException: null
>>          at org.apache.jmeter.gui.NamePanel.getName(NamePanel.java:75)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>          at com.sun.java.swing.plaf.gtk.GTKStyle.getInsets(GTKStyle.
>> java:316)
>> ~[?:1.8.0_121]
>>          at javax.swing.plaf.synth.SynthStyle.installDefaults(
>> SynthStyle.java:913)
>> ~[?:1.8.0_121]
>>          at javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(
>> SynthLookAndFeel.java:265)
>> ~[?:1.8.0_121]
>>          at javax.swing.plaf.synth.SynthPanelUI.updateStyle(
>> SynthPanelUI.java:117)
>> ~[?:1.8.0_121]
>>          at javax.swing.plaf.synth.SynthPanelUI.installDefaults(
>> SynthPanelUI.java:100)
>> ~[?:1.8.0_121]
>>          at javax.swing.plaf.basic.BasicPanelUI.installUI(
>> BasicPanelUI.java:56)
>> ~[?:1.8.0_121]
>>          at javax.swing.plaf.synth.SynthPanelUI.installUI(
>> SynthPanelUI.java:62)
>> ~[?:1.8.0_121]
>>          at javax.swing.JComponent.setUI(JComponent.java:666)
>> ~[?:1.8.0_121]
>>          at javax.swing.JPanel.setUI(JPanel.java:153) ~[?:1.8.0_121]
>>          at javax.swing.JPanel.updateUI(JPanel.java:126) ~[?:1.8.0_121]
>>          at javax.swing.JPanel.<init>(JPanel.java:86) ~[?:1.8.0_121]
>>          at javax.swing.JPanel.<init>(JPanel.java:109) ~[?:1.8.0_121]
>>          at javax.swing.JPanel.<init>(JPanel.java:117) ~[?:1.8.0_121]
>>          at org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:44)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>          at org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(
>> AbstractJMeterGuiComponent.java:78)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>          at org.apache.jmeter.control.gui.TestPlanGui.<init>(
>> TestPlanGui.java:68)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>          at org.apache.jmeter.gui.tree.JMeterTreeModel.<init>(
>> JMeterTreeModel.java:49)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>          at org.apache.jmeter.JMeter.startGui(JMeter.java:366)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>          at org.apache.jmeter.JMeter.start(JMeter.java:519)
>> [ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> ~[?:1.8.0_121]
>>          at sun.reflect.NativeMethodAccessorImpl.invoke(
>> NativeMethodAccessorImpl.java:62)
>> ~[?:1.8.0_121]
>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>> DelegatingMethodAccessorImpl.java:43)
>> ~[?:1.8.0_121]
>>          at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
>>          at org.apache.jmeter.NewDriver.main(NewDriver.java:256)
>> [ApacheJMeter.jar:3.2-SNAPSHOT.20170225]
>>
>
>


Re: NPE during GUI launch on latest trunk

Posted by sebb <se...@gmail.com>.
On 27 February 2017 at 10:39, Felix Schumacher
<fe...@internetallee.de> wrote:
>
>
> Am 26. Februar 2017 13:05:20 MEZ schrieb sebb <se...@gmail.com>:
>>On 26 February 2017 at 08:41, Felix Schumacher
>><fe...@internetallee.de> wrote:
>>> Am 26.02.2017 um 09:06 schrieb Felix Schumacher:
>>>>
>>>>
>>>> Am 25. Februar 2017 23:42:44 MEZ schrieb sebb <se...@gmail.com>:
>>>>>
>>>>> On 25 February 2017 at 14:25, Felix Schumacher
>>>>> <fe...@internetallee.de> wrote:
>>>>>>
>>>>>> Am 25.02.2017 um 15:01 schrieb Philippe Mouawad:
>>>>>>>
>>>>>>> Hi Graham,
>>>>>>> It could be coming from a Sonar error I fixed in r1783482
>>>>>>>
>>>>>>>       @Override
>>>>>>>       public String getName() {
>>>>>>>           if (nameField != null) {
>>>>>>>               return nameField.getText();
>>>>>>>           }
>>>>>>>           return ""; // $NON-NLS-1$
>>>>>>>       }
>>>>>>>
>>>>>>> Could you try it ?
>>>>>>
>>>>>> I reverted the fix and added a sonar hint, to not nag us about
>>this.
>>>>>
>>>>> I doubt that this is the full solution.
>>>>> If the nameField can be null here then it can perhaps be null in
>>>>> setName.
>>>>>
>>>>> The underlying cause of the issue needs to be found.
>>>>>
>>>>> One problem I notice is that the NamePanel ctor calls setName()
>>which
>>>>> can be overridden - that can cause issues because the object won't
>>be
>>>>> fully constructed until the ctor completes.
>>>>> This is why init() is private.
>>>>> The setName() code either needs to be duplicated in init(), or it
>>>>> could be put into a private method called by the ctor and the
>>public
>>>>> setName.
>>>>
>>>> Your analysis is correct, that setName should not be used in the
>>ctor as
>>>> it could be modified in subclasses.
>>>>
>>>> I tried a variant first, where I inlined the functionality of
>>setName into
>>>> the ctor.
>>>>
>>>> That didn't help.
>>
>>Yeah, I realise now that will only help sub-classes of NamePanel.
>>But it still needs to be fixed.
>>
>>I had not considered that the JVM would have the same fault.
>>
>>>>
>>>> We could add a safe guard into setName just in case and for
>>symmetry.
>>
>>Not necessary unless setName() is called by the JPanel ctor directly
>>or indirectly.
>>
>>> Btw, the stacktrace is:
>>>
>>> java.lang.NullPointerException: null
>>>     at org.apache.jmeter.gui.NamePanel.getName(NamePanel.java:78)
>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>>     at
>>com.sun.java.swing.plaf.gtk.GTKStyle.getInsets(GTKStyle.java:316)
>>> ~[?:1.8.0_121]
>>>     at
>>>
>>javax.swing.plaf.synth.SynthStyle.installDefaults(SynthStyle.java:913)
>>> ~[?:1.8.0_121]
>>>     at
>>>
>>javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(SynthLookAndFeel.java:265)
>>> ~[?:1.8.0_121]
>>>     at
>>>
>>javax.swing.plaf.synth.SynthPanelUI.updateStyle(SynthPanelUI.java:117)
>>> ~[?:1.8.0_121]
>>>     at
>>>
>>javax.swing.plaf.synth.SynthPanelUI.installDefaults(SynthPanelUI.java:100)
>>> ~[?:1.8.0_121]
>>>     at
>>javax.swing.plaf.basic.BasicPanelUI.installUI(BasicPanelUI.java:56)
>>> ~[?:1.8.0_121]
>>>     at
>>javax.swing.plaf.synth.SynthPanelUI.installUI(SynthPanelUI.java:62)
>>> ~[?:1.8.0_121]
>>>     at javax.swing.JComponent.setUI(JComponent.java:666)
>>~[?:1.8.0_121]
>>>     at javax.swing.JPanel.setUI(JPanel.java:153) ~[?:1.8.0_121]
>>>     at javax.swing.JPanel.updateUI(JPanel.java:126) ~[?:1.8.0_121]
>>>     at javax.swing.JPanel.<init>(JPanel.java:86) ~[?:1.8.0_121]
>>>     at javax.swing.JPanel.<init>(JPanel.java:109) ~[?:1.8.0_121]
>>>     at javax.swing.JPanel.<init>(JPanel.java:117) ~[?:1.8.0_121]
>>>     at org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:44)
>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>>     at
>>>
>>org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(AbstractJMeterGuiComponent.java:78)
>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>>     at
>>org.apache.jmeter.control.gui.TestPlanGui.<init>(TestPlanGui.java:68)
>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>>     at
>>>
>>org.apache.jmeter.gui.tree.JMeterTreeModel.<init>(JMeterTreeModel.java:49)
>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>>     at org.apache.jmeter.JMeter.startGui(JMeter.java:366)
>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>>     at org.apache.jmeter.JMeter.start(JMeter.java:519)
>>> [ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> ~[?:1.8.0_121]
>>>     at
>>>
>>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>> ~[?:1.8.0_121]
>>>     at
>>>
>>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>> ~[?:1.8.0_121]
>>>     at java.lang.reflect.Method.invoke(Method.java:498)
>>~[?:1.8.0_121]
>>>     at org.apache.jmeter.NewDriver.main(NewDriver.java:256)
>>> [ApacheJMeter.jar:3.2-SNAPSHOT.20170226]
>>>
>>> So, if I understand it correctly. The superclass will get initialized
>>before
>>> ourselves and that ctor will call into the laf system, which calls
>>the
>>> getName method (which we have overridden). At that time (init of ctor
>>of
>>> super) our fields will not have initialized, which leads to the NPE.
>>
>>That seems to be the case here.
>>
>>However I'm not sure that there any guarantees of the order of
>>initialisation.
>>What is guaranteed is that initialisation will be completed when the
>>ctor exits.
>>Whilst the ctor is still being executed there's not telling what state
>>classes will be in.
>>
>>> So, I think the problem lies in the gtk+ implementation of laf, which
>>is
>>> calling an overridable method in the ctor.
>>
>>It does look as though the GTK+ ctor calls an overrideable method.
>>So it is broken; the problem needs to be reported and fixed as it
>>won't only affect JMeter.
>
> I have submitted a bug report. It can be found at http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8175888

Thanks!

I found the following references:

https://www.securecoding.cert.org/confluence/display/java/MET05-J.+Ensure+that+constructors+do+not+call+overridable+methods

https://dev.eclipse.org/sonar/coding_rules#rule_key=squid%3AS1699|s=createdAt|asc=false

Might be an idea to add those to the bug report.

> Regards,
> Felix
>
>>
>>It's not possible for subclasses of JPanel to reliably fix the problem
>>since there's no knowing what parts of the class have been initialised
>>and which have not.
>>
>>The best subclasses can do is add protection against some failures,
>>such as the NPE here.
>>
>>But that is a hack, and should not be released unless absolutely
>>necessary.
>>And in that case the code must be carefully documented to explain why
>>the code does what it does and when the work-round can be removed.
>>
>>Also, the fact that the ctor calls getName presumably means it needs
>>to obtain the value in order to complete its own init.
>>How does the subclass return the correct value?
>>
>>> Regards,
>>>  Felix
>>>
>>>
>>>>
>>>> Felix
>>>>
>>>>>> Felix
>>>>>>
>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>> On Sat, Feb 25, 2017 at 2:42 PM, Graham Russell
>><gr...@ham1.co.uk>
>>>>>
>>>>> wrote:
>>>>>>>>
>>>>>>>> Hi all
>>>>>>>>
>>>>>>>> I just tried to run `ant run_gui` on the latest (github) trunk
>>but
>>>>>>>> this results in an NPE - specifically when trying to create the
>>>>>>>> JMeterTreeModel.
>>>>>>>>
>>>>>>>> Any ideas?
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>>
>>>>>>>> Graham
>>>>>>>>
>>>>>>>> The JMeter log is:
>>>>>>>>
>>>>>>>> 2017-02-25 13:26:50,223 INFO o.a.j.u.JMeterUtils: Setting Locale
>>to
>>>>>
>>>>> en_GB
>>>>>>>>
>>>>>>>> 2017-02-25 13:26:50,246 INFO o.a.j.JMeter: Loading user
>>properties
>>>>>>>> from: /home/coding/jmeter/bin/user.properties
>>>>>>>> 2017-02-25 13:26:50,247 INFO o.a.j.JMeter: Loading system
>>>>>
>>>>> properties
>>>>>>>>
>>>>>>>> from: /home/coding/jmeter/bin/system.properties
>>>>>>>> 2017-02-25 13:26:50,317 INFO o.a.j.JMeter: Copyright (c)
>>1998-2017
>>>>>
>>>>> The
>>>>>>>>
>>>>>>>> Apache Software Foundation
>>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Version
>>>>>
>>>>> 3.2-SNAPSHOT.20170225
>>>>>>>>
>>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter:
>>java.version=1.8.0_121
>>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.vm.name=Java
>>>>>>>> HotSpot(TM) 64-Bit Server VM
>>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.name=Linux
>>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.arch=amd64
>>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter:
>>>>>
>>>>> os.version=4.4.0-59-generic
>>>>>>>>
>>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: file.encoding=UTF-8
>>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Max memory
>>>>>
>>>>> =1342177280
>>>>>>>>
>>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Available Processors
>>=4
>>>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: Default
>>Locale=English
>>>>>>>> (United Kingdom)
>>>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: JMeter
>>Locale=English
>>>>>>>> (United Kingdom)
>>>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter:
>>>>>
>>>>> JMeterHome=/home/coding/jmeter
>>>>>>>>
>>>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: user.dir
>>>>>
>>>>> =/home/coding/jmeter
>>>>>>>>
>>>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: PWD
>>>>>
>>>>> =/home/coding/jmeter
>>>>>>>>
>>>>>>>> 2017-02-25 13:26:50,324 INFO o.a.j.JMeter: IP: 127.0.1.1 Name:
>>>>>>>> EliteBook FullName: EliteBook
>>>>>>>> 2017-02-25 13:26:50,607 INFO o.a.j.g.a.LookAndFeelCommand: Using
>>>>>
>>>>> look
>>>>>>>>
>>>>>>>> and feel: com.sun.java.swing.plaf.gtk.GTKLookAndFeel [GTK+,
>>System]
>>>>>>>> 2017-02-25 13:26:50,805 INFO o.a.j.JMeter: Loaded icon
>>properties
>>>>>
>>>>> from
>>>>>>>>
>>>>>>>> org/apache/jmeter/images/icon.properties
>>>>>>>> 2017-02-25 13:26:50,842 ERROR o.a.j.JMeter: An error occurred:
>>>>>>>> java.lang.NullPointerException: null
>>>>>>>>           at
>>>>>
>>>>> org.apache.jmeter.gui.NamePanel.getName(NamePanel.java:75)
>>>>>>>>
>>>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>>           at
>>>>>
>>>>> com.sun.java.swing.plaf.gtk.GTKStyle.getInsets(GTKStyle.
>>>>>>>>
>>>>>>>> java:316)
>>>>>>>> ~[?:1.8.0_121]
>>>>>>>>           at javax.swing.plaf.synth.SynthStyle.installDefaults(
>>>>>>>> SynthStyle.java:913)
>>>>>>>> ~[?:1.8.0_121]
>>>>>>>>           at
>>javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(
>>>>>>>> SynthLookAndFeel.java:265)
>>>>>>>> ~[?:1.8.0_121]
>>>>>>>>           at javax.swing.plaf.synth.SynthPanelUI.updateStyle(
>>>>>>>> SynthPanelUI.java:117)
>>>>>>>> ~[?:1.8.0_121]
>>>>>>>>           at
>>javax.swing.plaf.synth.SynthPanelUI.installDefaults(
>>>>>>>> SynthPanelUI.java:100)
>>>>>>>> ~[?:1.8.0_121]
>>>>>>>>           at javax.swing.plaf.basic.BasicPanelUI.installUI(
>>>>>>>> BasicPanelUI.java:56)
>>>>>>>> ~[?:1.8.0_121]
>>>>>>>>           at javax.swing.plaf.synth.SynthPanelUI.installUI(
>>>>>>>> SynthPanelUI.java:62)
>>>>>>>> ~[?:1.8.0_121]
>>>>>>>>           at javax.swing.JComponent.setUI(JComponent.java:666)
>>>>>>>> ~[?:1.8.0_121]
>>>>>>>>           at javax.swing.JPanel.setUI(JPanel.java:153)
>>>>>
>>>>> ~[?:1.8.0_121]
>>>>>>>>
>>>>>>>>           at javax.swing.JPanel.updateUI(JPanel.java:126)
>>>>>
>>>>> ~[?:1.8.0_121]
>>>>>>>>
>>>>>>>>           at javax.swing.JPanel.<init>(JPanel.java:86)
>>>>>
>>>>> ~[?:1.8.0_121]
>>>>>>>>
>>>>>>>>           at javax.swing.JPanel.<init>(JPanel.java:109)
>>>>>
>>>>> ~[?:1.8.0_121]
>>>>>>>>
>>>>>>>>           at javax.swing.JPanel.<init>(JPanel.java:117)
>>>>>
>>>>> ~[?:1.8.0_121]
>>>>>>>>
>>>>>>>>           at
>>>>>
>>>>> org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:44)
>>>>>>>>
>>>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>>           at
>>>>>
>>>>> org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(
>>>>>>>>
>>>>>>>> AbstractJMeterGuiComponent.java:78)
>>>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>>           at org.apache.jmeter.control.gui.TestPlanGui.<init>(
>>>>>>>> TestPlanGui.java:68)
>>>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>>           at org.apache.jmeter.gui.tree.JMeterTreeModel.<init>(
>>>>>>>> JMeterTreeModel.java:49)
>>>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>>           at org.apache.jmeter.JMeter.startGui(JMeter.java:366)
>>>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>>           at org.apache.jmeter.JMeter.start(JMeter.java:519)
>>>>>>>> [ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>>           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>>>
>>>>> Method)
>>>>>>>>
>>>>>>>> ~[?:1.8.0_121]
>>>>>>>>           at sun.reflect.NativeMethodAccessorImpl.invoke(
>>>>>>>> NativeMethodAccessorImpl.java:62)
>>>>>>>> ~[?:1.8.0_121]
>>>>>>>>           at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>>>>>>>> DelegatingMethodAccessorImpl.java:43)
>>>>>>>> ~[?:1.8.0_121]
>>>>>>>>           at java.lang.reflect.Method.invoke(Method.java:498)
>>>>>>>> ~[?:1.8.0_121]
>>>>>>>>           at
>>org.apache.jmeter.NewDriver.main(NewDriver.java:256)
>>>>>>>> [ApacheJMeter.jar:3.2-SNAPSHOT.20170225]
>>>>>>>>
>>>>>>>
>>>

Re: Fwd: NPE during GUI launch on latest trunk

Posted by Rory O'Donnell <ro...@oracle.com>.
Thanks Philippe, will keep an eye on it.

Rgds,Rory


On 27/02/2017 11:27, Philippe Mouawad wrote:
> Hello Rory,
> For information.
>
> Regards
> ---------- Forwarded message ----------
> From: *Felix Schumacher* <felix.schumacher@internetallee.de 
> <ma...@internetallee.de>>
> Date: Mon, Feb 27, 2017 at 11:39 AM
> Subject: Re: NPE during GUI launch on latest trunk
> To: dev@jmeter.apache.org <ma...@jmeter.apache.org>
>
>
>
>
> Am 26. Februar 2017 13:05:20 MEZ schrieb sebb <sebbaz@gmail.com 
> <ma...@gmail.com>>:
> >On 26 February 2017 at 08:41, Felix Schumacher
> ><felix.schumacher@internetallee.de 
> <ma...@internetallee.de>> wrote:
> >> Am 26.02.2017 um 09:06 schrieb Felix Schumacher:
> >>>
> >>>
> >>> Am 25. Februar 2017 23:42:44 MEZ schrieb sebb <sebbaz@gmail.com 
> <ma...@gmail.com>>:
> >>>>
> >>>> On 25 February 2017 at 14:25, Felix Schumacher
> >>>> <felix.schumacher@internetallee.de 
> <ma...@internetallee.de>> wrote:
> >>>>>
> >>>>> Am 25.02.2017 um 15:01 schrieb Philippe Mouawad:
> >>>>>>
> >>>>>> Hi Graham,
> >>>>>> It could be coming from a Sonar error I fixed in r1783482
> >>>>>>
> >>>>>>       @Override
> >>>>>>       public String getName() {
> >>>>>>           if (nameField != null) {
> >>>>>>               return nameField.getText();
> >>>>>>           }
> >>>>>>           return ""; // $NON-NLS-1$
> >>>>>>       }
> >>>>>>
> >>>>>> Could you try it ?
> >>>>>
> >>>>> I reverted the fix and added a sonar hint, to not nag us about
> >this.
> >>>>
> >>>> I doubt that this is the full solution.
> >>>> If the nameField can be null here then it can perhaps be null in
> >>>> setName.
> >>>>
> >>>> The underlying cause of the issue needs to be found.
> >>>>
> >>>> One problem I notice is that the NamePanel ctor calls setName()
> >which
> >>>> can be overridden - that can cause issues because the object won't
> >be
> >>>> fully constructed until the ctor completes.
> >>>> This is why init() is private.
> >>>> The setName() code either needs to be duplicated in init(), or it
> >>>> could be put into a private method called by the ctor and the
> >public
> >>>> setName.
> >>>
> >>> Your analysis is correct, that setName should not be used in the
> >ctor as
> >>> it could be modified in subclasses.
> >>>
> >>> I tried a variant first, where I inlined the functionality of
> >setName into
> >>> the ctor.
> >>>
> >>> That didn't help.
> >
> >Yeah, I realise now that will only help sub-classes of NamePanel.
> >But it still needs to be fixed.
> >
> >I had not considered that the JVM would have the same fault.
> >
> >>>
> >>> We could add a safe guard into setName just in case and for
> >symmetry.
> >
> >Not necessary unless setName() is called by the JPanel ctor directly
> >or indirectly.
> >
> >> Btw, the stacktrace is:
> >>
> >> java.lang.NullPointerException: null
> >>     at org.apache.jmeter.gui.NamePanel.getName(NamePanel.java:78)
> >> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
> >>     at
> >com.sun.java.swing.plaf.gtk.GTKStyle.getInsets(GTKStyle.java:316)
> >> ~[?:1.8.0_121]
> >>     at
> >>
> >javax.swing.plaf.synth.SynthStyle.installDefaults(SynthStyle.java:913)
> >> ~[?:1.8.0_121]
> >>     at
> >>
> >javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(SynthLookAndFeel.java:265)
> >> ~[?:1.8.0_121]
> >>     at
> >>
> >javax.swing.plaf.synth.SynthPanelUI.updateStyle(SynthPanelUI.java:117)
> >> ~[?:1.8.0_121]
> >>     at
> >>
> >javax.swing.plaf.synth.SynthPanelUI.installDefaults(SynthPanelUI.java:100)
> >> ~[?:1.8.0_121]
> >>     at
> >javax.swing.plaf.basic.BasicPanelUI.installUI(BasicPanelUI.java:56)
> >> ~[?:1.8.0_121]
> >>     at
> >javax.swing.plaf.synth.SynthPanelUI.installUI(SynthPanelUI.java:62)
> >> ~[?:1.8.0_121]
> >>     at javax.swing.JComponent.setUI(JComponent.java:666)
> >~[?:1.8.0_121]
> >>     at javax.swing.JPanel.setUI(JPanel.java:153) ~[?:1.8.0_121]
> >>     at javax.swing.JPanel.updateUI(JPanel.java:126) ~[?:1.8.0_121]
> >>     at javax.swing.JPanel.<init>(JPanel.java:86) ~[?:1.8.0_121]
> >>     at javax.swing.JPanel.<init>(JPanel.java:109) ~[?:1.8.0_121]
> >>     at javax.swing.JPanel.<init>(JPanel.java:117) ~[?:1.8.0_121]
> >>     at org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:44)
> >> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
> >>     at
> >>
> >org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(AbstractJMeterGuiComponent.java:78)
> >> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
> >>     at
> >org.apache.jmeter.control.gui.TestPlanGui.<init>(TestPlanGui.java:68)
> >> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
> >>     at
> >>
> >org.apache.jmeter.gui.tree.JMeterTreeModel.<init>(JMeterTreeModel.java:49)
> >> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
> >>     at org.apache.jmeter.JMeter.startGui(JMeter.java:366)
> >> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
> >>     at org.apache.jmeter.JMeter.start(JMeter.java:519)
> >> [ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
> >>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> ~[?:1.8.0_121]
> >>     at
> >>
> >sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> >> ~[?:1.8.0_121]
> >>     at
> >>
> >sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >> ~[?:1.8.0_121]
> >>     at java.lang.reflect.Method.invoke(Method.java:498)
> >~[?:1.8.0_121]
> >>     at org.apache.jmeter.NewDriver.main(NewDriver.java:256)
> >> [ApacheJMeter.jar:3.2-SNAPSHOT.20170226]
> >>
> >> So, if I understand it correctly. The superclass will get initialized
> >before
> >> ourselves and that ctor will call into the laf system, which calls
> >the
> >> getName method (which we have overridden). At that time (init of ctor
> >of
> >> super) our fields will not have initialized, which leads to the NPE.
> >
> >That seems to be the case here.
> >
> >However I'm not sure that there any guarantees of the order of
> >initialisation.
> >What is guaranteed is that initialisation will be completed when the
> >ctor exits.
> >Whilst the ctor is still being executed there's not telling what state
> >classes will be in.
> >
> >> So, I think the problem lies in the gtk+ implementation of laf, which
> >is
> >> calling an overridable method in the ctor.
> >
> >It does look as though the GTK+ ctor calls an overrideable method.
> >So it is broken; the problem needs to be reported and fixed as it
> >won't only affect JMeter.
>
> I have submitted a bug report. It can be found at 
> http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8175888 
> <http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8175888>
>
> Regards,
> Felix
>
> >
> >It's not possible for subclasses of JPanel to reliably fix the problem
> >since there's no knowing what parts of the class have been initialised
> >and which have not.
> >
> >The best subclasses can do is add protection against some failures,
> >such as the NPE here.
> >
> >But that is a hack, and should not be released unless absolutely
> >necessary.
> >And in that case the code must be carefully documented to explain why
> >the code does what it does and when the work-round can be removed.
> >
> >Also, the fact that the ctor calls getName presumably means it needs
> >to obtain the value in order to complete its own init.
> >How does the subclass return the correct value?
> >
> >> Regards,
> >>  Felix
> >>
> >>
> >>>
> >>> Felix
> >>>
> >>>>> Felix
> >>>>>
> >>>>>
> >>>>>> Thanks
> >>>>>>
> >>>>>> On Sat, Feb 25, 2017 at 2:42 PM, Graham Russell
> ><graham@ham1.co.uk <ma...@ham1.co.uk>>
> >>>>
> >>>> wrote:
> >>>>>>>
> >>>>>>> Hi all
> >>>>>>>
> >>>>>>> I just tried to run `ant run_gui` on the latest (github) trunk
> >but
> >>>>>>> this results in an NPE - specifically when trying to create the
> >>>>>>> JMeterTreeModel.
> >>>>>>>
> >>>>>>> Any ideas?
> >>>>>>>
> >>>>>>> Thanks
> >>>>>>>
> >>>>>>> Graham
> >>>>>>>
> >>>>>>> The JMeter log is:
> >>>>>>>
> >>>>>>> 2017-02-25 13:26:50,223 INFO o.a.j.u.JMeterUtils: Setting Locale
> >to
> >>>>
> >>>> en_GB
> >>>>>>>
> >>>>>>> 2017-02-25 13:26:50,246 INFO o.a.j.JMeter: Loading user
> >properties
> >>>>>>> from: /home/coding/jmeter/bin/user.properties
> >>>>>>> 2017-02-25 13:26:50,247 INFO o.a.j.JMeter: Loading system
> >>>>
> >>>> properties
> >>>>>>>
> >>>>>>> from: /home/coding/jmeter/bin/system.properties
> >>>>>>> 2017-02-25 13:26:50,317 INFO o.a.j.JMeter: Copyright (c)
> >1998-2017
> >>>>
> >>>> The
> >>>>>>>
> >>>>>>> Apache Software Foundation
> >>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Version
> >>>>
> >>>> 3.2-SNAPSHOT.20170225
> >>>>>>>
> >>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter:
> >java.version=1.8.0_121
> >>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.vm.name 
> <http://java.vm.name>=Java
> >>>>>>> HotSpot(TM) 64-Bit Server VM
> >>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.name 
> <http://os.name>=Linux
> >>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.arch=amd64
> >>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter:
> >>>>
> >>>> os.version=4.4.0-59-generic
> >>>>>>>
> >>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: file.encoding=UTF-8
> >>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Max memory
> >>>>
> >>>> =1342177280
> >>>>>>>
> >>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Available Processors
> >=4
> >>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: Default
> >Locale=English
> >>>>>>> (United Kingdom)
> >>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: JMeter
> >Locale=English
> >>>>>>> (United Kingdom)
> >>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter:
> >>>>
> >>>> JMeterHome=/home/coding/jmeter
> >>>>>>>
> >>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: user.dir
> >>>>
> >>>> =/home/coding/jmeter
> >>>>>>>
> >>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: PWD
> >>>>
> >>>> =/home/coding/jmeter
> >>>>>>>
> >>>>>>> 2017-02-25 13:26:50,324 INFO o.a.j.JMeter: IP: 127.0.1.1 Name:
> >>>>>>> EliteBook FullName: EliteBook
> >>>>>>> 2017-02-25 13:26:50,607 INFO o.a.j.g.a.LookAndFeelCommand: Using
> >>>>
> >>>> look
> >>>>>>>
> >>>>>>> and feel: com.sun.java.swing.plaf.gtk.GTKLookAndFeel [GTK+,
> >System]
> >>>>>>> 2017-02-25 13:26:50,805 INFO o.a.j.JMeter: Loaded icon
> >properties
> >>>>
> >>>> from
> >>>>>>>
> >>>>>>> org/apache/jmeter/images/icon.properties
> >>>>>>> 2017-02-25 13:26:50,842 ERROR o.a.j.JMeter: An error occurred:
> >>>>>>> java.lang.NullPointerException: null
> >>>>>>>           at
> >>>>
> >>>> org.apache.jmeter.gui.NamePanel.getName(NamePanel.java:75)
> >>>>>>>
> >>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
> >>>>>>>           at
> >>>>
> >>>> com.sun.java.swing.plaf.gtk.GTKStyle.getInsets(GTKStyle.
> >>>>>>>
> >>>>>>> java:316)
> >>>>>>> ~[?:1.8.0_121]
> >>>>>>>           at javax.swing.plaf.synth.SynthStyle.installDefaults(
> >>>>>>> SynthStyle.java:913)
> >>>>>>> ~[?:1.8.0_121]
> >>>>>>>           at
> >javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(
> >>>>>>> SynthLookAndFeel.java:265)
> >>>>>>> ~[?:1.8.0_121]
> >>>>>>>           at javax.swing.plaf.synth.SynthPanelUI.updateStyle(
> >>>>>>> SynthPanelUI.java:117)
> >>>>>>> ~[?:1.8.0_121]
> >>>>>>>           at
> >javax.swing.plaf.synth.SynthPanelUI.installDefaults(
> >>>>>>> SynthPanelUI.java:100)
> >>>>>>> ~[?:1.8.0_121]
> >>>>>>>           at javax.swing.plaf.basic.BasicPanelUI.installUI(
> >>>>>>> BasicPanelUI.java:56)
> >>>>>>> ~[?:1.8.0_121]
> >>>>>>>           at javax.swing.plaf.synth.SynthPanelUI.installUI(
> >>>>>>> SynthPanelUI.java:62)
> >>>>>>> ~[?:1.8.0_121]
> >>>>>>>           at javax.swing.JComponent.setUI(JComponent.java:666)
> >>>>>>> ~[?:1.8.0_121]
> >>>>>>>           at javax.swing.JPanel.setUI(JPanel.java:153)
> >>>>
> >>>> ~[?:1.8.0_121]
> >>>>>>>
> >>>>>>>           at javax.swing.JPanel.updateUI(JPanel.java:126)
> >>>>
> >>>> ~[?:1.8.0_121]
> >>>>>>>
> >>>>>>>           at javax.swing.JPanel.<init>(JPanel.java:86)
> >>>>
> >>>> ~[?:1.8.0_121]
> >>>>>>>
> >>>>>>>           at javax.swing.JPanel.<init>(JPanel.java:109)
> >>>>
> >>>> ~[?:1.8.0_121]
> >>>>>>>
> >>>>>>>           at javax.swing.JPanel.<init>(JPanel.java:117)
> >>>>
> >>>> ~[?:1.8.0_121]
> >>>>>>>
> >>>>>>>           at
> >>>>
> >>>> org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:44)
> >>>>>>>
> >>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
> >>>>>>>           at
> >>>>
> >>>> org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(
> >>>>>>>
> >>>>>>> AbstractJMeterGuiComponent.java:78)
> >>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
> >>>>>>>           at org.apache.jmeter.control.gui.TestPlanGui.<init>(
> >>>>>>> TestPlanGui.java:68)
> >>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
> >>>>>>>           at org.apache.jmeter.gui.tree.JMeterTreeModel.<init>(
> >>>>>>> JMeterTreeModel.java:49)
> >>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
> >>>>>>>           at org.apache.jmeter.JMeter.startGui(JMeter.java:366)
> >>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
> >>>>>>>           at org.apache.jmeter.JMeter.start(JMeter.java:519)
> >>>>>>> [ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
> >>>>>>>           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> >>>>
> >>>> Method)
> >>>>>>>
> >>>>>>> ~[?:1.8.0_121]
> >>>>>>>           at sun.reflect.NativeMethodAccessorImpl.invoke(
> >>>>>>> NativeMethodAccessorImpl.java:62)
> >>>>>>> ~[?:1.8.0_121]
> >>>>>>>           at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> >>>>>>> DelegatingMethodAccessorImpl.java:43)
> >>>>>>> ~[?:1.8.0_121]
> >>>>>>>           at java.lang.reflect.Method.invoke(Method.java:498)
> >>>>>>> ~[?:1.8.0_121]
> >>>>>>>           at
> >org.apache.jmeter.NewDriver.main(NewDriver.java:256)
> >>>>>>> [ApacheJMeter.jar:3.2-SNAPSHOT.20170225]
> >>>>>>>
> >>>>>>
> >>
>

-- 
Rgds,Rory O'Donnell
Quality Engineering Manager
Oracle EMEA , Dublin, Ireland


Fwd: NPE during GUI launch on latest trunk

Posted by Philippe Mouawad <pm...@apache.org>.
Hello Rory,
For information.

Regards
---------- Forwarded message ----------
From: Felix Schumacher <fe...@internetallee.de>
Date: Mon, Feb 27, 2017 at 11:39 AM
Subject: Re: NPE during GUI launch on latest trunk
To: dev@jmeter.apache.org




Am 26. Februar 2017 13:05:20 MEZ schrieb sebb <se...@gmail.com>:
>On 26 February 2017 at 08:41, Felix Schumacher
><fe...@internetallee.de> wrote:
>> Am 26.02.2017 um 09:06 schrieb Felix Schumacher:
>>>
>>>
>>> Am 25. Februar 2017 23:42:44 MEZ schrieb sebb <se...@gmail.com>:
>>>>
>>>> On 25 February 2017 at 14:25, Felix Schumacher
>>>> <fe...@internetallee.de> wrote:
>>>>>
>>>>> Am 25.02.2017 um 15:01 schrieb Philippe Mouawad:
>>>>>>
>>>>>> Hi Graham,
>>>>>> It could be coming from a Sonar error I fixed in r1783482
>>>>>>
>>>>>>       @Override
>>>>>>       public String getName() {
>>>>>>           if (nameField != null) {
>>>>>>               return nameField.getText();
>>>>>>           }
>>>>>>           return ""; // $NON-NLS-1$
>>>>>>       }
>>>>>>
>>>>>> Could you try it ?
>>>>>
>>>>> I reverted the fix and added a sonar hint, to not nag us about
>this.
>>>>
>>>> I doubt that this is the full solution.
>>>> If the nameField can be null here then it can perhaps be null in
>>>> setName.
>>>>
>>>> The underlying cause of the issue needs to be found.
>>>>
>>>> One problem I notice is that the NamePanel ctor calls setName()
>which
>>>> can be overridden - that can cause issues because the object won't
>be
>>>> fully constructed until the ctor completes.
>>>> This is why init() is private.
>>>> The setName() code either needs to be duplicated in init(), or it
>>>> could be put into a private method called by the ctor and the
>public
>>>> setName.
>>>
>>> Your analysis is correct, that setName should not be used in the
>ctor as
>>> it could be modified in subclasses.
>>>
>>> I tried a variant first, where I inlined the functionality of
>setName into
>>> the ctor.
>>>
>>> That didn't help.
>
>Yeah, I realise now that will only help sub-classes of NamePanel.
>But it still needs to be fixed.
>
>I had not considered that the JVM would have the same fault.
>
>>>
>>> We could add a safe guard into setName just in case and for
>symmetry.
>
>Not necessary unless setName() is called by the JPanel ctor directly
>or indirectly.
>
>> Btw, the stacktrace is:
>>
>> java.lang.NullPointerException: null
>>     at org.apache.jmeter.gui.NamePanel.getName(NamePanel.java:78)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>     at
>com.sun.java.swing.plaf.gtk.GTKStyle.getInsets(GTKStyle.java:316)
>> ~[?:1.8.0_121]
>>     at
>>
>javax.swing.plaf.synth.SynthStyle.installDefaults(SynthStyle.java:913)
>> ~[?:1.8.0_121]
>>     at
>>
>javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(
SynthLookAndFeel.java:265)
>> ~[?:1.8.0_121]
>>     at
>>
>javax.swing.plaf.synth.SynthPanelUI.updateStyle(SynthPanelUI.java:117)
>> ~[?:1.8.0_121]
>>     at
>>
>javax.swing.plaf.synth.SynthPanelUI.installDefaults(SynthPanelUI.java:100)
>> ~[?:1.8.0_121]
>>     at
>javax.swing.plaf.basic.BasicPanelUI.installUI(BasicPanelUI.java:56)
>> ~[?:1.8.0_121]
>>     at
>javax.swing.plaf.synth.SynthPanelUI.installUI(SynthPanelUI.java:62)
>> ~[?:1.8.0_121]
>>     at javax.swing.JComponent.setUI(JComponent.java:666)
>~[?:1.8.0_121]
>>     at javax.swing.JPanel.setUI(JPanel.java:153) ~[?:1.8.0_121]
>>     at javax.swing.JPanel.updateUI(JPanel.java:126) ~[?:1.8.0_121]
>>     at javax.swing.JPanel.<init>(JPanel.java:86) ~[?:1.8.0_121]
>>     at javax.swing.JPanel.<init>(JPanel.java:109) ~[?:1.8.0_121]
>>     at javax.swing.JPanel.<init>(JPanel.java:117) ~[?:1.8.0_121]
>>     at org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:44)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>     at
>>
>org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(
AbstractJMeterGuiComponent.java:78)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>     at
>org.apache.jmeter.control.gui.TestPlanGui.<init>(TestPlanGui.java:68)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>     at
>>
>org.apache.jmeter.gui.tree.JMeterTreeModel.<init>(JMeterTreeModel.java:49)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>     at org.apache.jmeter.JMeter.startGui(JMeter.java:366)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>     at org.apache.jmeter.JMeter.start(JMeter.java:519)
>> [ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> ~[?:1.8.0_121]
>>     at
>>
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
62)
>> ~[?:1.8.0_121]
>>     at
>>
>sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
>> ~[?:1.8.0_121]
>>     at java.lang.reflect.Method.invoke(Method.java:498)
>~[?:1.8.0_121]
>>     at org.apache.jmeter.NewDriver.main(NewDriver.java:256)
>> [ApacheJMeter.jar:3.2-SNAPSHOT.20170226]
>>
>> So, if I understand it correctly. The superclass will get initialized
>before
>> ourselves and that ctor will call into the laf system, which calls
>the
>> getName method (which we have overridden). At that time (init of ctor
>of
>> super) our fields will not have initialized, which leads to the NPE.
>
>That seems to be the case here.
>
>However I'm not sure that there any guarantees of the order of
>initialisation.
>What is guaranteed is that initialisation will be completed when the
>ctor exits.
>Whilst the ctor is still being executed there's not telling what state
>classes will be in.
>
>> So, I think the problem lies in the gtk+ implementation of laf, which
>is
>> calling an overridable method in the ctor.
>
>It does look as though the GTK+ ctor calls an overrideable method.
>So it is broken; the problem needs to be reported and fixed as it
>won't only affect JMeter.

I have submitted a bug report. It can be found at http://bugs.java.com/
bugdatabase/view_bug.do?bug_id=JDK-8175888

Regards,
Felix

>
>It's not possible for subclasses of JPanel to reliably fix the problem
>since there's no knowing what parts of the class have been initialised
>and which have not.
>
>The best subclasses can do is add protection against some failures,
>such as the NPE here.
>
>But that is a hack, and should not be released unless absolutely
>necessary.
>And in that case the code must be carefully documented to explain why
>the code does what it does and when the work-round can be removed.
>
>Also, the fact that the ctor calls getName presumably means it needs
>to obtain the value in order to complete its own init.
>How does the subclass return the correct value?
>
>> Regards,
>>  Felix
>>
>>
>>>
>>> Felix
>>>
>>>>> Felix
>>>>>
>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> On Sat, Feb 25, 2017 at 2:42 PM, Graham Russell
><gr...@ham1.co.uk>
>>>>
>>>> wrote:
>>>>>>>
>>>>>>> Hi all
>>>>>>>
>>>>>>> I just tried to run `ant run_gui` on the latest (github) trunk
>but
>>>>>>> this results in an NPE - specifically when trying to create the
>>>>>>> JMeterTreeModel.
>>>>>>>
>>>>>>> Any ideas?
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>> Graham
>>>>>>>
>>>>>>> The JMeter log is:
>>>>>>>
>>>>>>> 2017-02-25 13:26:50,223 INFO o.a.j.u.JMeterUtils: Setting Locale
>to
>>>>
>>>> en_GB
>>>>>>>
>>>>>>> 2017-02-25 13:26:50,246 INFO o.a.j.JMeter: Loading user
>properties
>>>>>>> from: /home/coding/jmeter/bin/user.properties
>>>>>>> 2017-02-25 13:26:50,247 INFO o.a.j.JMeter: Loading system
>>>>
>>>> properties
>>>>>>>
>>>>>>> from: /home/coding/jmeter/bin/system.properties
>>>>>>> 2017-02-25 13:26:50,317 INFO o.a.j.JMeter: Copyright (c)
>1998-2017
>>>>
>>>> The
>>>>>>>
>>>>>>> Apache Software Foundation
>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Version
>>>>
>>>> 3.2-SNAPSHOT.20170225
>>>>>>>
>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter:
>java.version=1.8.0_121
>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.vm.name=Java
>>>>>>> HotSpot(TM) 64-Bit Server VM
>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.name=Linux
>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.arch=amd64
>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter:
>>>>
>>>> os.version=4.4.0-59-generic
>>>>>>>
>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: file.encoding=UTF-8
>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Max memory
>>>>
>>>> =1342177280
>>>>>>>
>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Available Processors
>=4
>>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: Default
>Locale=English
>>>>>>> (United Kingdom)
>>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: JMeter
>Locale=English
>>>>>>> (United Kingdom)
>>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter:
>>>>
>>>> JMeterHome=/home/coding/jmeter
>>>>>>>
>>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: user.dir
>>>>
>>>> =/home/coding/jmeter
>>>>>>>
>>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: PWD
>>>>
>>>> =/home/coding/jmeter
>>>>>>>
>>>>>>> 2017-02-25 13:26:50,324 INFO o.a.j.JMeter: IP: 127.0.1.1 Name:
>>>>>>> EliteBook FullName: EliteBook
>>>>>>> 2017-02-25 13:26:50,607 INFO o.a.j.g.a.LookAndFeelCommand: Using
>>>>
>>>> look
>>>>>>>
>>>>>>> and feel: com.sun.java.swing.plaf.gtk.GTKLookAndFeel [GTK+,
>System]
>>>>>>> 2017-02-25 13:26:50,805 INFO o.a.j.JMeter: Loaded icon
>properties
>>>>
>>>> from
>>>>>>>
>>>>>>> org/apache/jmeter/images/icon.properties
>>>>>>> 2017-02-25 13:26:50,842 ERROR o.a.j.JMeter: An error occurred:
>>>>>>> java.lang.NullPointerException: null
>>>>>>>           at
>>>>
>>>> org.apache.jmeter.gui.NamePanel.getName(NamePanel.java:75)
>>>>>>>
>>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>           at
>>>>
>>>> com.sun.java.swing.plaf.gtk.GTKStyle.getInsets(GTKStyle.
>>>>>>>
>>>>>>> java:316)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at javax.swing.plaf.synth.SynthStyle.installDefaults(
>>>>>>> SynthStyle.java:913)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at
>javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(
>>>>>>> SynthLookAndFeel.java:265)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at javax.swing.plaf.synth.SynthPanelUI.updateStyle(
>>>>>>> SynthPanelUI.java:117)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at
>javax.swing.plaf.synth.SynthPanelUI.installDefaults(
>>>>>>> SynthPanelUI.java:100)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at javax.swing.plaf.basic.BasicPanelUI.installUI(
>>>>>>> BasicPanelUI.java:56)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at javax.swing.plaf.synth.SynthPanelUI.installUI(
>>>>>>> SynthPanelUI.java:62)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at javax.swing.JComponent.setUI(JComponent.java:666)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at javax.swing.JPanel.setUI(JPanel.java:153)
>>>>
>>>> ~[?:1.8.0_121]
>>>>>>>
>>>>>>>           at javax.swing.JPanel.updateUI(JPanel.java:126)
>>>>
>>>> ~[?:1.8.0_121]
>>>>>>>
>>>>>>>           at javax.swing.JPanel.<init>(JPanel.java:86)
>>>>
>>>> ~[?:1.8.0_121]
>>>>>>>
>>>>>>>           at javax.swing.JPanel.<init>(JPanel.java:109)
>>>>
>>>> ~[?:1.8.0_121]
>>>>>>>
>>>>>>>           at javax.swing.JPanel.<init>(JPanel.java:117)
>>>>
>>>> ~[?:1.8.0_121]
>>>>>>>
>>>>>>>           at
>>>>
>>>> org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:44)
>>>>>>>
>>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>           at
>>>>
>>>> org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(
>>>>>>>
>>>>>>> AbstractJMeterGuiComponent.java:78)
>>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>           at org.apache.jmeter.control.gui.TestPlanGui.<init>(
>>>>>>> TestPlanGui.java:68)
>>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>           at org.apache.jmeter.gui.tree.JMeterTreeModel.<init>(
>>>>>>> JMeterTreeModel.java:49)
>>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>           at org.apache.jmeter.JMeter.startGui(JMeter.java:366)
>>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>           at org.apache.jmeter.JMeter.start(JMeter.java:519)
>>>>>>> [ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>>
>>>> Method)
>>>>>>>
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at sun.reflect.NativeMethodAccessorImpl.invoke(
>>>>>>> NativeMethodAccessorImpl.java:62)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>>>>>>> DelegatingMethodAccessorImpl.java:43)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at java.lang.reflect.Method.invoke(Method.java:498)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at
>org.apache.jmeter.NewDriver.main(NewDriver.java:256)
>>>>>>> [ApacheJMeter.jar:3.2-SNAPSHOT.20170225]
>>>>>>>
>>>>>>
>>

Re: NPE during GUI launch on latest trunk

Posted by Felix Schumacher <fe...@internetallee.de>.

Am 26. Februar 2017 13:05:20 MEZ schrieb sebb <se...@gmail.com>:
>On 26 February 2017 at 08:41, Felix Schumacher
><fe...@internetallee.de> wrote:
>> Am 26.02.2017 um 09:06 schrieb Felix Schumacher:
>>>
>>>
>>> Am 25. Februar 2017 23:42:44 MEZ schrieb sebb <se...@gmail.com>:
>>>>
>>>> On 25 February 2017 at 14:25, Felix Schumacher
>>>> <fe...@internetallee.de> wrote:
>>>>>
>>>>> Am 25.02.2017 um 15:01 schrieb Philippe Mouawad:
>>>>>>
>>>>>> Hi Graham,
>>>>>> It could be coming from a Sonar error I fixed in r1783482
>>>>>>
>>>>>>       @Override
>>>>>>       public String getName() {
>>>>>>           if (nameField != null) {
>>>>>>               return nameField.getText();
>>>>>>           }
>>>>>>           return ""; // $NON-NLS-1$
>>>>>>       }
>>>>>>
>>>>>> Could you try it ?
>>>>>
>>>>> I reverted the fix and added a sonar hint, to not nag us about
>this.
>>>>
>>>> I doubt that this is the full solution.
>>>> If the nameField can be null here then it can perhaps be null in
>>>> setName.
>>>>
>>>> The underlying cause of the issue needs to be found.
>>>>
>>>> One problem I notice is that the NamePanel ctor calls setName()
>which
>>>> can be overridden - that can cause issues because the object won't
>be
>>>> fully constructed until the ctor completes.
>>>> This is why init() is private.
>>>> The setName() code either needs to be duplicated in init(), or it
>>>> could be put into a private method called by the ctor and the
>public
>>>> setName.
>>>
>>> Your analysis is correct, that setName should not be used in the
>ctor as
>>> it could be modified in subclasses.
>>>
>>> I tried a variant first, where I inlined the functionality of
>setName into
>>> the ctor.
>>>
>>> That didn't help.
>
>Yeah, I realise now that will only help sub-classes of NamePanel.
>But it still needs to be fixed.
>
>I had not considered that the JVM would have the same fault.
>
>>>
>>> We could add a safe guard into setName just in case and for
>symmetry.
>
>Not necessary unless setName() is called by the JPanel ctor directly
>or indirectly.
>
>> Btw, the stacktrace is:
>>
>> java.lang.NullPointerException: null
>>     at org.apache.jmeter.gui.NamePanel.getName(NamePanel.java:78)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>     at
>com.sun.java.swing.plaf.gtk.GTKStyle.getInsets(GTKStyle.java:316)
>> ~[?:1.8.0_121]
>>     at
>>
>javax.swing.plaf.synth.SynthStyle.installDefaults(SynthStyle.java:913)
>> ~[?:1.8.0_121]
>>     at
>>
>javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(SynthLookAndFeel.java:265)
>> ~[?:1.8.0_121]
>>     at
>>
>javax.swing.plaf.synth.SynthPanelUI.updateStyle(SynthPanelUI.java:117)
>> ~[?:1.8.0_121]
>>     at
>>
>javax.swing.plaf.synth.SynthPanelUI.installDefaults(SynthPanelUI.java:100)
>> ~[?:1.8.0_121]
>>     at
>javax.swing.plaf.basic.BasicPanelUI.installUI(BasicPanelUI.java:56)
>> ~[?:1.8.0_121]
>>     at
>javax.swing.plaf.synth.SynthPanelUI.installUI(SynthPanelUI.java:62)
>> ~[?:1.8.0_121]
>>     at javax.swing.JComponent.setUI(JComponent.java:666)
>~[?:1.8.0_121]
>>     at javax.swing.JPanel.setUI(JPanel.java:153) ~[?:1.8.0_121]
>>     at javax.swing.JPanel.updateUI(JPanel.java:126) ~[?:1.8.0_121]
>>     at javax.swing.JPanel.<init>(JPanel.java:86) ~[?:1.8.0_121]
>>     at javax.swing.JPanel.<init>(JPanel.java:109) ~[?:1.8.0_121]
>>     at javax.swing.JPanel.<init>(JPanel.java:117) ~[?:1.8.0_121]
>>     at org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:44)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>     at
>>
>org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(AbstractJMeterGuiComponent.java:78)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>     at
>org.apache.jmeter.control.gui.TestPlanGui.<init>(TestPlanGui.java:68)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>     at
>>
>org.apache.jmeter.gui.tree.JMeterTreeModel.<init>(JMeterTreeModel.java:49)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>     at org.apache.jmeter.JMeter.startGui(JMeter.java:366)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>     at org.apache.jmeter.JMeter.start(JMeter.java:519)
>> [ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> ~[?:1.8.0_121]
>>     at
>>
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> ~[?:1.8.0_121]
>>     at
>>
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> ~[?:1.8.0_121]
>>     at java.lang.reflect.Method.invoke(Method.java:498)
>~[?:1.8.0_121]
>>     at org.apache.jmeter.NewDriver.main(NewDriver.java:256)
>> [ApacheJMeter.jar:3.2-SNAPSHOT.20170226]
>>
>> So, if I understand it correctly. The superclass will get initialized
>before
>> ourselves and that ctor will call into the laf system, which calls
>the
>> getName method (which we have overridden). At that time (init of ctor
>of
>> super) our fields will not have initialized, which leads to the NPE.
>
>That seems to be the case here.
>
>However I'm not sure that there any guarantees of the order of
>initialisation.
>What is guaranteed is that initialisation will be completed when the
>ctor exits.
>Whilst the ctor is still being executed there's not telling what state
>classes will be in.
>
>> So, I think the problem lies in the gtk+ implementation of laf, which
>is
>> calling an overridable method in the ctor.
>
>It does look as though the GTK+ ctor calls an overrideable method.
>So it is broken; the problem needs to be reported and fixed as it
>won't only affect JMeter.

I have submitted a bug report. It can be found at http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8175888

Regards,
Felix

>
>It's not possible for subclasses of JPanel to reliably fix the problem
>since there's no knowing what parts of the class have been initialised
>and which have not.
>
>The best subclasses can do is add protection against some failures,
>such as the NPE here.
>
>But that is a hack, and should not be released unless absolutely
>necessary.
>And in that case the code must be carefully documented to explain why
>the code does what it does and when the work-round can be removed.
>
>Also, the fact that the ctor calls getName presumably means it needs
>to obtain the value in order to complete its own init.
>How does the subclass return the correct value?
>
>> Regards,
>>  Felix
>>
>>
>>>
>>> Felix
>>>
>>>>> Felix
>>>>>
>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> On Sat, Feb 25, 2017 at 2:42 PM, Graham Russell
><gr...@ham1.co.uk>
>>>>
>>>> wrote:
>>>>>>>
>>>>>>> Hi all
>>>>>>>
>>>>>>> I just tried to run `ant run_gui` on the latest (github) trunk
>but
>>>>>>> this results in an NPE - specifically when trying to create the
>>>>>>> JMeterTreeModel.
>>>>>>>
>>>>>>> Any ideas?
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>> Graham
>>>>>>>
>>>>>>> The JMeter log is:
>>>>>>>
>>>>>>> 2017-02-25 13:26:50,223 INFO o.a.j.u.JMeterUtils: Setting Locale
>to
>>>>
>>>> en_GB
>>>>>>>
>>>>>>> 2017-02-25 13:26:50,246 INFO o.a.j.JMeter: Loading user
>properties
>>>>>>> from: /home/coding/jmeter/bin/user.properties
>>>>>>> 2017-02-25 13:26:50,247 INFO o.a.j.JMeter: Loading system
>>>>
>>>> properties
>>>>>>>
>>>>>>> from: /home/coding/jmeter/bin/system.properties
>>>>>>> 2017-02-25 13:26:50,317 INFO o.a.j.JMeter: Copyright (c)
>1998-2017
>>>>
>>>> The
>>>>>>>
>>>>>>> Apache Software Foundation
>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Version
>>>>
>>>> 3.2-SNAPSHOT.20170225
>>>>>>>
>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter:
>java.version=1.8.0_121
>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.vm.name=Java
>>>>>>> HotSpot(TM) 64-Bit Server VM
>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.name=Linux
>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.arch=amd64
>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter:
>>>>
>>>> os.version=4.4.0-59-generic
>>>>>>>
>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: file.encoding=UTF-8
>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Max memory
>>>>
>>>> =1342177280
>>>>>>>
>>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Available Processors
>=4
>>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: Default
>Locale=English
>>>>>>> (United Kingdom)
>>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: JMeter 
>Locale=English
>>>>>>> (United Kingdom)
>>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter:
>>>>
>>>> JMeterHome=/home/coding/jmeter
>>>>>>>
>>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: user.dir
>>>>
>>>> =/home/coding/jmeter
>>>>>>>
>>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: PWD
>>>>
>>>> =/home/coding/jmeter
>>>>>>>
>>>>>>> 2017-02-25 13:26:50,324 INFO o.a.j.JMeter: IP: 127.0.1.1 Name:
>>>>>>> EliteBook FullName: EliteBook
>>>>>>> 2017-02-25 13:26:50,607 INFO o.a.j.g.a.LookAndFeelCommand: Using
>>>>
>>>> look
>>>>>>>
>>>>>>> and feel: com.sun.java.swing.plaf.gtk.GTKLookAndFeel [GTK+,
>System]
>>>>>>> 2017-02-25 13:26:50,805 INFO o.a.j.JMeter: Loaded icon
>properties
>>>>
>>>> from
>>>>>>>
>>>>>>> org/apache/jmeter/images/icon.properties
>>>>>>> 2017-02-25 13:26:50,842 ERROR o.a.j.JMeter: An error occurred:
>>>>>>> java.lang.NullPointerException: null
>>>>>>>           at
>>>>
>>>> org.apache.jmeter.gui.NamePanel.getName(NamePanel.java:75)
>>>>>>>
>>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>           at
>>>>
>>>> com.sun.java.swing.plaf.gtk.GTKStyle.getInsets(GTKStyle.
>>>>>>>
>>>>>>> java:316)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at javax.swing.plaf.synth.SynthStyle.installDefaults(
>>>>>>> SynthStyle.java:913)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at
>javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(
>>>>>>> SynthLookAndFeel.java:265)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at javax.swing.plaf.synth.SynthPanelUI.updateStyle(
>>>>>>> SynthPanelUI.java:117)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at
>javax.swing.plaf.synth.SynthPanelUI.installDefaults(
>>>>>>> SynthPanelUI.java:100)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at javax.swing.plaf.basic.BasicPanelUI.installUI(
>>>>>>> BasicPanelUI.java:56)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at javax.swing.plaf.synth.SynthPanelUI.installUI(
>>>>>>> SynthPanelUI.java:62)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at javax.swing.JComponent.setUI(JComponent.java:666)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at javax.swing.JPanel.setUI(JPanel.java:153)
>>>>
>>>> ~[?:1.8.0_121]
>>>>>>>
>>>>>>>           at javax.swing.JPanel.updateUI(JPanel.java:126)
>>>>
>>>> ~[?:1.8.0_121]
>>>>>>>
>>>>>>>           at javax.swing.JPanel.<init>(JPanel.java:86)
>>>>
>>>> ~[?:1.8.0_121]
>>>>>>>
>>>>>>>           at javax.swing.JPanel.<init>(JPanel.java:109)
>>>>
>>>> ~[?:1.8.0_121]
>>>>>>>
>>>>>>>           at javax.swing.JPanel.<init>(JPanel.java:117)
>>>>
>>>> ~[?:1.8.0_121]
>>>>>>>
>>>>>>>           at
>>>>
>>>> org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:44)
>>>>>>>
>>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>           at
>>>>
>>>> org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(
>>>>>>>
>>>>>>> AbstractJMeterGuiComponent.java:78)
>>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>           at org.apache.jmeter.control.gui.TestPlanGui.<init>(
>>>>>>> TestPlanGui.java:68)
>>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>           at org.apache.jmeter.gui.tree.JMeterTreeModel.<init>(
>>>>>>> JMeterTreeModel.java:49)
>>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>           at org.apache.jmeter.JMeter.startGui(JMeter.java:366)
>>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>           at org.apache.jmeter.JMeter.start(JMeter.java:519)
>>>>>>> [ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>>           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>>
>>>> Method)
>>>>>>>
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at sun.reflect.NativeMethodAccessorImpl.invoke(
>>>>>>> NativeMethodAccessorImpl.java:62)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>>>>>>> DelegatingMethodAccessorImpl.java:43)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at java.lang.reflect.Method.invoke(Method.java:498)
>>>>>>> ~[?:1.8.0_121]
>>>>>>>           at
>org.apache.jmeter.NewDriver.main(NewDriver.java:256)
>>>>>>> [ApacheJMeter.jar:3.2-SNAPSHOT.20170225]
>>>>>>>
>>>>>>
>>

Re: NPE during GUI launch on latest trunk

Posted by sebb <se...@gmail.com>.
On 26 February 2017 at 08:41, Felix Schumacher
<fe...@internetallee.de> wrote:
> Am 26.02.2017 um 09:06 schrieb Felix Schumacher:
>>
>>
>> Am 25. Februar 2017 23:42:44 MEZ schrieb sebb <se...@gmail.com>:
>>>
>>> On 25 February 2017 at 14:25, Felix Schumacher
>>> <fe...@internetallee.de> wrote:
>>>>
>>>> Am 25.02.2017 um 15:01 schrieb Philippe Mouawad:
>>>>>
>>>>> Hi Graham,
>>>>> It could be coming from a Sonar error I fixed in r1783482
>>>>>
>>>>>       @Override
>>>>>       public String getName() {
>>>>>           if (nameField != null) {
>>>>>               return nameField.getText();
>>>>>           }
>>>>>           return ""; // $NON-NLS-1$
>>>>>       }
>>>>>
>>>>> Could you try it ?
>>>>
>>>> I reverted the fix and added a sonar hint, to not nag us about this.
>>>
>>> I doubt that this is the full solution.
>>> If the nameField can be null here then it can perhaps be null in
>>> setName.
>>>
>>> The underlying cause of the issue needs to be found.
>>>
>>> One problem I notice is that the NamePanel ctor calls setName() which
>>> can be overridden - that can cause issues because the object won't be
>>> fully constructed until the ctor completes.
>>> This is why init() is private.
>>> The setName() code either needs to be duplicated in init(), or it
>>> could be put into a private method called by the ctor and the public
>>> setName.
>>
>> Your analysis is correct, that setName should not be used in the ctor as
>> it could be modified in subclasses.
>>
>> I tried a variant first, where I inlined the functionality of setName into
>> the ctor.
>>
>> That didn't help.

Yeah, I realise now that will only help sub-classes of NamePanel.
But it still needs to be fixed.

I had not considered that the JVM would have the same fault.

>>
>> We could add a safe guard into setName just in case and for symmetry.

Not necessary unless setName() is called by the JPanel ctor directly
or indirectly.

> Btw, the stacktrace is:
>
> java.lang.NullPointerException: null
>     at org.apache.jmeter.gui.NamePanel.getName(NamePanel.java:78)
> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>     at com.sun.java.swing.plaf.gtk.GTKStyle.getInsets(GTKStyle.java:316)
> ~[?:1.8.0_121]
>     at
> javax.swing.plaf.synth.SynthStyle.installDefaults(SynthStyle.java:913)
> ~[?:1.8.0_121]
>     at
> javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(SynthLookAndFeel.java:265)
> ~[?:1.8.0_121]
>     at
> javax.swing.plaf.synth.SynthPanelUI.updateStyle(SynthPanelUI.java:117)
> ~[?:1.8.0_121]
>     at
> javax.swing.plaf.synth.SynthPanelUI.installDefaults(SynthPanelUI.java:100)
> ~[?:1.8.0_121]
>     at javax.swing.plaf.basic.BasicPanelUI.installUI(BasicPanelUI.java:56)
> ~[?:1.8.0_121]
>     at javax.swing.plaf.synth.SynthPanelUI.installUI(SynthPanelUI.java:62)
> ~[?:1.8.0_121]
>     at javax.swing.JComponent.setUI(JComponent.java:666) ~[?:1.8.0_121]
>     at javax.swing.JPanel.setUI(JPanel.java:153) ~[?:1.8.0_121]
>     at javax.swing.JPanel.updateUI(JPanel.java:126) ~[?:1.8.0_121]
>     at javax.swing.JPanel.<init>(JPanel.java:86) ~[?:1.8.0_121]
>     at javax.swing.JPanel.<init>(JPanel.java:109) ~[?:1.8.0_121]
>     at javax.swing.JPanel.<init>(JPanel.java:117) ~[?:1.8.0_121]
>     at org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:44)
> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>     at
> org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(AbstractJMeterGuiComponent.java:78)
> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>     at org.apache.jmeter.control.gui.TestPlanGui.<init>(TestPlanGui.java:68)
> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>     at
> org.apache.jmeter.gui.tree.JMeterTreeModel.<init>(JMeterTreeModel.java:49)
> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>     at org.apache.jmeter.JMeter.startGui(JMeter.java:366)
> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>     at org.apache.jmeter.JMeter.start(JMeter.java:519)
> [ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> ~[?:1.8.0_121]
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> ~[?:1.8.0_121]
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> ~[?:1.8.0_121]
>     at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
>     at org.apache.jmeter.NewDriver.main(NewDriver.java:256)
> [ApacheJMeter.jar:3.2-SNAPSHOT.20170226]
>
> So, if I understand it correctly. The superclass will get initialized before
> ourselves and that ctor will call into the laf system, which calls the
> getName method (which we have overridden). At that time (init of ctor of
> super) our fields will not have initialized, which leads to the NPE.

That seems to be the case here.

However I'm not sure that there any guarantees of the order of initialisation.
What is guaranteed is that initialisation will be completed when the ctor exits.
Whilst the ctor is still being executed there's not telling what state
classes will be in.

> So, I think the problem lies in the gtk+ implementation of laf, which is
> calling an overridable method in the ctor.

It does look as though the GTK+ ctor calls an overrideable method.
So it is broken; the problem needs to be reported and fixed as it
won't only affect JMeter.

It's not possible for subclasses of JPanel to reliably fix the problem
since there's no knowing what parts of the class have been initialised
and which have not.

The best subclasses can do is add protection against some failures,
such as the NPE here.

But that is a hack, and should not be released unless absolutely necessary.
And in that case the code must be carefully documented to explain why
the code does what it does and when the work-round can be removed.

Also, the fact that the ctor calls getName presumably means it needs
to obtain the value in order to complete its own init.
How does the subclass return the correct value?

> Regards,
>  Felix
>
>
>>
>> Felix
>>
>>>> Felix
>>>>
>>>>
>>>>> Thanks
>>>>>
>>>>> On Sat, Feb 25, 2017 at 2:42 PM, Graham Russell <gr...@ham1.co.uk>
>>>
>>> wrote:
>>>>>>
>>>>>> Hi all
>>>>>>
>>>>>> I just tried to run `ant run_gui` on the latest (github) trunk but
>>>>>> this results in an NPE - specifically when trying to create the
>>>>>> JMeterTreeModel.
>>>>>>
>>>>>> Any ideas?
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Graham
>>>>>>
>>>>>> The JMeter log is:
>>>>>>
>>>>>> 2017-02-25 13:26:50,223 INFO o.a.j.u.JMeterUtils: Setting Locale to
>>>
>>> en_GB
>>>>>>
>>>>>> 2017-02-25 13:26:50,246 INFO o.a.j.JMeter: Loading user properties
>>>>>> from: /home/coding/jmeter/bin/user.properties
>>>>>> 2017-02-25 13:26:50,247 INFO o.a.j.JMeter: Loading system
>>>
>>> properties
>>>>>>
>>>>>> from: /home/coding/jmeter/bin/system.properties
>>>>>> 2017-02-25 13:26:50,317 INFO o.a.j.JMeter: Copyright (c) 1998-2017
>>>
>>> The
>>>>>>
>>>>>> Apache Software Foundation
>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Version
>>>
>>> 3.2-SNAPSHOT.20170225
>>>>>>
>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.version=1.8.0_121
>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.vm.name=Java
>>>>>> HotSpot(TM) 64-Bit Server VM
>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.name=Linux
>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.arch=amd64
>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter:
>>>
>>> os.version=4.4.0-59-generic
>>>>>>
>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: file.encoding=UTF-8
>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Max memory
>>>
>>> =1342177280
>>>>>>
>>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Available Processors =4
>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: Default Locale=English
>>>>>> (United Kingdom)
>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: JMeter  Locale=English
>>>>>> (United Kingdom)
>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter:
>>>
>>> JMeterHome=/home/coding/jmeter
>>>>>>
>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: user.dir
>>>
>>> =/home/coding/jmeter
>>>>>>
>>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: PWD
>>>
>>> =/home/coding/jmeter
>>>>>>
>>>>>> 2017-02-25 13:26:50,324 INFO o.a.j.JMeter: IP: 127.0.1.1 Name:
>>>>>> EliteBook FullName: EliteBook
>>>>>> 2017-02-25 13:26:50,607 INFO o.a.j.g.a.LookAndFeelCommand: Using
>>>
>>> look
>>>>>>
>>>>>> and feel: com.sun.java.swing.plaf.gtk.GTKLookAndFeel [GTK+, System]
>>>>>> 2017-02-25 13:26:50,805 INFO o.a.j.JMeter: Loaded icon properties
>>>
>>> from
>>>>>>
>>>>>> org/apache/jmeter/images/icon.properties
>>>>>> 2017-02-25 13:26:50,842 ERROR o.a.j.JMeter: An error occurred:
>>>>>> java.lang.NullPointerException: null
>>>>>>           at
>>>
>>> org.apache.jmeter.gui.NamePanel.getName(NamePanel.java:75)
>>>>>>
>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>           at
>>>
>>> com.sun.java.swing.plaf.gtk.GTKStyle.getInsets(GTKStyle.
>>>>>>
>>>>>> java:316)
>>>>>> ~[?:1.8.0_121]
>>>>>>           at javax.swing.plaf.synth.SynthStyle.installDefaults(
>>>>>> SynthStyle.java:913)
>>>>>> ~[?:1.8.0_121]
>>>>>>           at javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(
>>>>>> SynthLookAndFeel.java:265)
>>>>>> ~[?:1.8.0_121]
>>>>>>           at javax.swing.plaf.synth.SynthPanelUI.updateStyle(
>>>>>> SynthPanelUI.java:117)
>>>>>> ~[?:1.8.0_121]
>>>>>>           at javax.swing.plaf.synth.SynthPanelUI.installDefaults(
>>>>>> SynthPanelUI.java:100)
>>>>>> ~[?:1.8.0_121]
>>>>>>           at javax.swing.plaf.basic.BasicPanelUI.installUI(
>>>>>> BasicPanelUI.java:56)
>>>>>> ~[?:1.8.0_121]
>>>>>>           at javax.swing.plaf.synth.SynthPanelUI.installUI(
>>>>>> SynthPanelUI.java:62)
>>>>>> ~[?:1.8.0_121]
>>>>>>           at javax.swing.JComponent.setUI(JComponent.java:666)
>>>>>> ~[?:1.8.0_121]
>>>>>>           at javax.swing.JPanel.setUI(JPanel.java:153)
>>>
>>> ~[?:1.8.0_121]
>>>>>>
>>>>>>           at javax.swing.JPanel.updateUI(JPanel.java:126)
>>>
>>> ~[?:1.8.0_121]
>>>>>>
>>>>>>           at javax.swing.JPanel.<init>(JPanel.java:86)
>>>
>>> ~[?:1.8.0_121]
>>>>>>
>>>>>>           at javax.swing.JPanel.<init>(JPanel.java:109)
>>>
>>> ~[?:1.8.0_121]
>>>>>>
>>>>>>           at javax.swing.JPanel.<init>(JPanel.java:117)
>>>
>>> ~[?:1.8.0_121]
>>>>>>
>>>>>>           at
>>>
>>> org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:44)
>>>>>>
>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>           at
>>>
>>> org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(
>>>>>>
>>>>>> AbstractJMeterGuiComponent.java:78)
>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>           at org.apache.jmeter.control.gui.TestPlanGui.<init>(
>>>>>> TestPlanGui.java:68)
>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>           at org.apache.jmeter.gui.tree.JMeterTreeModel.<init>(
>>>>>> JMeterTreeModel.java:49)
>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>           at org.apache.jmeter.JMeter.startGui(JMeter.java:366)
>>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>           at org.apache.jmeter.JMeter.start(JMeter.java:519)
>>>>>> [ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>>           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>
>>> Method)
>>>>>>
>>>>>> ~[?:1.8.0_121]
>>>>>>           at sun.reflect.NativeMethodAccessorImpl.invoke(
>>>>>> NativeMethodAccessorImpl.java:62)
>>>>>> ~[?:1.8.0_121]
>>>>>>           at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>>>>>> DelegatingMethodAccessorImpl.java:43)
>>>>>> ~[?:1.8.0_121]
>>>>>>           at java.lang.reflect.Method.invoke(Method.java:498)
>>>>>> ~[?:1.8.0_121]
>>>>>>           at org.apache.jmeter.NewDriver.main(NewDriver.java:256)
>>>>>> [ApacheJMeter.jar:3.2-SNAPSHOT.20170225]
>>>>>>
>>>>>
>

Re: NPE during GUI launch on latest trunk

Posted by Felix Schumacher <fe...@internetallee.de>.
Am 26.02.2017 um 09:06 schrieb Felix Schumacher:
>
> Am 25. Februar 2017 23:42:44 MEZ schrieb sebb <se...@gmail.com>:
>> On 25 February 2017 at 14:25, Felix Schumacher
>> <fe...@internetallee.de> wrote:
>>> Am 25.02.2017 um 15:01 schrieb Philippe Mouawad:
>>>> Hi Graham,
>>>> It could be coming from a Sonar error I fixed in r1783482
>>>>
>>>>       @Override
>>>>       public String getName() {
>>>>           if (nameField != null) {
>>>>               return nameField.getText();
>>>>           }
>>>>           return ""; // $NON-NLS-1$
>>>>       }
>>>>
>>>> Could you try it ?
>>> I reverted the fix and added a sonar hint, to not nag us about this.
>> I doubt that this is the full solution.
>> If the nameField can be null here then it can perhaps be null in
>> setName.
>>
>> The underlying cause of the issue needs to be found.
>>
>> One problem I notice is that the NamePanel ctor calls setName() which
>> can be overridden - that can cause issues because the object won't be
>> fully constructed until the ctor completes.
>> This is why init() is private.
>> The setName() code either needs to be duplicated in init(), or it
>> could be put into a private method called by the ctor and the public
>> setName.
> Your analysis is correct, that setName should not be used in the ctor as it could be modified in subclasses.
>
> I tried a variant first, where I inlined the functionality of setName into the ctor.
>
> That didn't help.
>
> We could add a safe guard into setName just in case and for symmetry.
Btw, the stacktrace is:

java.lang.NullPointerException: null
     at org.apache.jmeter.gui.NamePanel.getName(NamePanel.java:78) 
~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
     at 
com.sun.java.swing.plaf.gtk.GTKStyle.getInsets(GTKStyle.java:316) 
~[?:1.8.0_121]
     at 
javax.swing.plaf.synth.SynthStyle.installDefaults(SynthStyle.java:913) 
~[?:1.8.0_121]
     at 
javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(SynthLookAndFeel.java:265) 
~[?:1.8.0_121]
     at 
javax.swing.plaf.synth.SynthPanelUI.updateStyle(SynthPanelUI.java:117) 
~[?:1.8.0_121]
     at 
javax.swing.plaf.synth.SynthPanelUI.installDefaults(SynthPanelUI.java:100) 
~[?:1.8.0_121]
     at 
javax.swing.plaf.basic.BasicPanelUI.installUI(BasicPanelUI.java:56) 
~[?:1.8.0_121]
     at 
javax.swing.plaf.synth.SynthPanelUI.installUI(SynthPanelUI.java:62) 
~[?:1.8.0_121]
     at javax.swing.JComponent.setUI(JComponent.java:666) ~[?:1.8.0_121]
     at javax.swing.JPanel.setUI(JPanel.java:153) ~[?:1.8.0_121]
     at javax.swing.JPanel.updateUI(JPanel.java:126) ~[?:1.8.0_121]
     at javax.swing.JPanel.<init>(JPanel.java:86) ~[?:1.8.0_121]
     at javax.swing.JPanel.<init>(JPanel.java:109) ~[?:1.8.0_121]
     at javax.swing.JPanel.<init>(JPanel.java:117) ~[?:1.8.0_121]
     at org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:44) 
~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
     at 
org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(AbstractJMeterGuiComponent.java:78) 
~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
     at 
org.apache.jmeter.control.gui.TestPlanGui.<init>(TestPlanGui.java:68) 
~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
     at 
org.apache.jmeter.gui.tree.JMeterTreeModel.<init>(JMeterTreeModel.java:49) 
~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
     at org.apache.jmeter.JMeter.startGui(JMeter.java:366) 
~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
     at org.apache.jmeter.JMeter.start(JMeter.java:519) 
[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170226]
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
~[?:1.8.0_121]
     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
~[?:1.8.0_121]
     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
~[?:1.8.0_121]
     at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
     at org.apache.jmeter.NewDriver.main(NewDriver.java:256) 
[ApacheJMeter.jar:3.2-SNAPSHOT.20170226]

So, if I understand it correctly. The superclass will get initialized 
before ourselves and that ctor will call into the laf system, which 
calls the getName method (which we have overridden). At that time (init 
of ctor of super) our fields will not have initialized, which leads to 
the NPE.

So, I think the problem lies in the gtk+ implementation of laf, which is 
calling an overridable method in the ctor.

Regards,
  Felix

>
> Felix
>
>>> Felix
>>>
>>>
>>>> Thanks
>>>>
>>>> On Sat, Feb 25, 2017 at 2:42 PM, Graham Russell <gr...@ham1.co.uk>
>> wrote:
>>>>> Hi all
>>>>>
>>>>> I just tried to run `ant run_gui` on the latest (github) trunk but
>>>>> this results in an NPE - specifically when trying to create the
>>>>> JMeterTreeModel.
>>>>>
>>>>> Any ideas?
>>>>>
>>>>> Thanks
>>>>>
>>>>> Graham
>>>>>
>>>>> The JMeter log is:
>>>>>
>>>>> 2017-02-25 13:26:50,223 INFO o.a.j.u.JMeterUtils: Setting Locale to
>> en_GB
>>>>> 2017-02-25 13:26:50,246 INFO o.a.j.JMeter: Loading user properties
>>>>> from: /home/coding/jmeter/bin/user.properties
>>>>> 2017-02-25 13:26:50,247 INFO o.a.j.JMeter: Loading system
>> properties
>>>>> from: /home/coding/jmeter/bin/system.properties
>>>>> 2017-02-25 13:26:50,317 INFO o.a.j.JMeter: Copyright (c) 1998-2017
>> The
>>>>> Apache Software Foundation
>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Version
>> 3.2-SNAPSHOT.20170225
>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.version=1.8.0_121
>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.vm.name=Java
>>>>> HotSpot(TM) 64-Bit Server VM
>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.name=Linux
>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.arch=amd64
>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter:
>> os.version=4.4.0-59-generic
>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: file.encoding=UTF-8
>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Max memory
>> =1342177280
>>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Available Processors =4
>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: Default Locale=English
>>>>> (United Kingdom)
>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: JMeter  Locale=English
>>>>> (United Kingdom)
>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter:
>> JMeterHome=/home/coding/jmeter
>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: user.dir
>> =/home/coding/jmeter
>>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: PWD
>> =/home/coding/jmeter
>>>>> 2017-02-25 13:26:50,324 INFO o.a.j.JMeter: IP: 127.0.1.1 Name:
>>>>> EliteBook FullName: EliteBook
>>>>> 2017-02-25 13:26:50,607 INFO o.a.j.g.a.LookAndFeelCommand: Using
>> look
>>>>> and feel: com.sun.java.swing.plaf.gtk.GTKLookAndFeel [GTK+, System]
>>>>> 2017-02-25 13:26:50,805 INFO o.a.j.JMeter: Loaded icon properties
>> from
>>>>> org/apache/jmeter/images/icon.properties
>>>>> 2017-02-25 13:26:50,842 ERROR o.a.j.JMeter: An error occurred:
>>>>> java.lang.NullPointerException: null
>>>>>           at
>> org.apache.jmeter.gui.NamePanel.getName(NamePanel.java:75)
>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>           at
>> com.sun.java.swing.plaf.gtk.GTKStyle.getInsets(GTKStyle.
>>>>> java:316)
>>>>> ~[?:1.8.0_121]
>>>>>           at javax.swing.plaf.synth.SynthStyle.installDefaults(
>>>>> SynthStyle.java:913)
>>>>> ~[?:1.8.0_121]
>>>>>           at javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(
>>>>> SynthLookAndFeel.java:265)
>>>>> ~[?:1.8.0_121]
>>>>>           at javax.swing.plaf.synth.SynthPanelUI.updateStyle(
>>>>> SynthPanelUI.java:117)
>>>>> ~[?:1.8.0_121]
>>>>>           at javax.swing.plaf.synth.SynthPanelUI.installDefaults(
>>>>> SynthPanelUI.java:100)
>>>>> ~[?:1.8.0_121]
>>>>>           at javax.swing.plaf.basic.BasicPanelUI.installUI(
>>>>> BasicPanelUI.java:56)
>>>>> ~[?:1.8.0_121]
>>>>>           at javax.swing.plaf.synth.SynthPanelUI.installUI(
>>>>> SynthPanelUI.java:62)
>>>>> ~[?:1.8.0_121]
>>>>>           at javax.swing.JComponent.setUI(JComponent.java:666)
>>>>> ~[?:1.8.0_121]
>>>>>           at javax.swing.JPanel.setUI(JPanel.java:153)
>> ~[?:1.8.0_121]
>>>>>           at javax.swing.JPanel.updateUI(JPanel.java:126)
>> ~[?:1.8.0_121]
>>>>>           at javax.swing.JPanel.<init>(JPanel.java:86)
>> ~[?:1.8.0_121]
>>>>>           at javax.swing.JPanel.<init>(JPanel.java:109)
>> ~[?:1.8.0_121]
>>>>>           at javax.swing.JPanel.<init>(JPanel.java:117)
>> ~[?:1.8.0_121]
>>>>>           at
>> org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:44)
>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>           at
>> org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(
>>>>> AbstractJMeterGuiComponent.java:78)
>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>           at org.apache.jmeter.control.gui.TestPlanGui.<init>(
>>>>> TestPlanGui.java:68)
>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>           at org.apache.jmeter.gui.tree.JMeterTreeModel.<init>(
>>>>> JMeterTreeModel.java:49)
>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>           at org.apache.jmeter.JMeter.startGui(JMeter.java:366)
>>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>           at org.apache.jmeter.JMeter.start(JMeter.java:519)
>>>>> [ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>>           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)
>>>>> ~[?:1.8.0_121]
>>>>>           at sun.reflect.NativeMethodAccessorImpl.invoke(
>>>>> NativeMethodAccessorImpl.java:62)
>>>>> ~[?:1.8.0_121]
>>>>>           at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>>>>> DelegatingMethodAccessorImpl.java:43)
>>>>> ~[?:1.8.0_121]
>>>>>           at java.lang.reflect.Method.invoke(Method.java:498)
>>>>> ~[?:1.8.0_121]
>>>>>           at org.apache.jmeter.NewDriver.main(NewDriver.java:256)
>>>>> [ApacheJMeter.jar:3.2-SNAPSHOT.20170225]
>>>>>
>>>>


Re: NPE during GUI launch on latest trunk

Posted by Felix Schumacher <fe...@internetallee.de>.

Am 25. Februar 2017 23:42:44 MEZ schrieb sebb <se...@gmail.com>:
>On 25 February 2017 at 14:25, Felix Schumacher
><fe...@internetallee.de> wrote:
>> Am 25.02.2017 um 15:01 schrieb Philippe Mouawad:
>>>
>>> Hi Graham,
>>> It could be coming from a Sonar error I fixed in r1783482
>>>
>>>      @Override
>>>      public String getName() {
>>>          if (nameField != null) {
>>>              return nameField.getText();
>>>          }
>>>          return ""; // $NON-NLS-1$
>>>      }
>>>
>>> Could you try it ?
>>
>> I reverted the fix and added a sonar hint, to not nag us about this.
>
>I doubt that this is the full solution.
>If the nameField can be null here then it can perhaps be null in
>setName.
>
>The underlying cause of the issue needs to be found.
>
>One problem I notice is that the NamePanel ctor calls setName() which
>can be overridden - that can cause issues because the object won't be
>fully constructed until the ctor completes.
>This is why init() is private.
>The setName() code either needs to be duplicated in init(), or it
>could be put into a private method called by the ctor and the public
>setName.

Your analysis is correct, that setName should not be used in the ctor as it could be modified in subclasses.

I tried a variant first, where I inlined the functionality of setName into the ctor. 

That didn't help.

We could add a safe guard into setName just in case and for symmetry.

Felix

>
>> Felix
>>
>>
>>> Thanks
>>>
>>> On Sat, Feb 25, 2017 at 2:42 PM, Graham Russell <gr...@ham1.co.uk>
>wrote:
>>>
>>>> Hi all
>>>>
>>>> I just tried to run `ant run_gui` on the latest (github) trunk but
>>>> this results in an NPE - specifically when trying to create the
>>>> JMeterTreeModel.
>>>>
>>>> Any ideas?
>>>>
>>>> Thanks
>>>>
>>>> Graham
>>>>
>>>> The JMeter log is:
>>>>
>>>> 2017-02-25 13:26:50,223 INFO o.a.j.u.JMeterUtils: Setting Locale to
>en_GB
>>>> 2017-02-25 13:26:50,246 INFO o.a.j.JMeter: Loading user properties
>>>> from: /home/coding/jmeter/bin/user.properties
>>>> 2017-02-25 13:26:50,247 INFO o.a.j.JMeter: Loading system
>properties
>>>> from: /home/coding/jmeter/bin/system.properties
>>>> 2017-02-25 13:26:50,317 INFO o.a.j.JMeter: Copyright (c) 1998-2017
>The
>>>> Apache Software Foundation
>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Version
>3.2-SNAPSHOT.20170225
>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.version=1.8.0_121
>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.vm.name=Java
>>>> HotSpot(TM) 64-Bit Server VM
>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.name=Linux
>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.arch=amd64
>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter:
>os.version=4.4.0-59-generic
>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: file.encoding=UTF-8
>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Max memory    
>=1342177280
>>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Available Processors =4
>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: Default Locale=English
>>>> (United Kingdom)
>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: JMeter  Locale=English
>>>> (United Kingdom)
>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter:
>JMeterHome=/home/coding/jmeter
>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: user.dir 
>=/home/coding/jmeter
>>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: PWD      
>=/home/coding/jmeter
>>>> 2017-02-25 13:26:50,324 INFO o.a.j.JMeter: IP: 127.0.1.1 Name:
>>>> EliteBook FullName: EliteBook
>>>> 2017-02-25 13:26:50,607 INFO o.a.j.g.a.LookAndFeelCommand: Using
>look
>>>> and feel: com.sun.java.swing.plaf.gtk.GTKLookAndFeel [GTK+, System]
>>>> 2017-02-25 13:26:50,805 INFO o.a.j.JMeter: Loaded icon properties
>from
>>>> org/apache/jmeter/images/icon.properties
>>>> 2017-02-25 13:26:50,842 ERROR o.a.j.JMeter: An error occurred:
>>>> java.lang.NullPointerException: null
>>>>          at
>org.apache.jmeter.gui.NamePanel.getName(NamePanel.java:75)
>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>          at
>com.sun.java.swing.plaf.gtk.GTKStyle.getInsets(GTKStyle.
>>>> java:316)
>>>> ~[?:1.8.0_121]
>>>>          at javax.swing.plaf.synth.SynthStyle.installDefaults(
>>>> SynthStyle.java:913)
>>>> ~[?:1.8.0_121]
>>>>          at javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(
>>>> SynthLookAndFeel.java:265)
>>>> ~[?:1.8.0_121]
>>>>          at javax.swing.plaf.synth.SynthPanelUI.updateStyle(
>>>> SynthPanelUI.java:117)
>>>> ~[?:1.8.0_121]
>>>>          at javax.swing.plaf.synth.SynthPanelUI.installDefaults(
>>>> SynthPanelUI.java:100)
>>>> ~[?:1.8.0_121]
>>>>          at javax.swing.plaf.basic.BasicPanelUI.installUI(
>>>> BasicPanelUI.java:56)
>>>> ~[?:1.8.0_121]
>>>>          at javax.swing.plaf.synth.SynthPanelUI.installUI(
>>>> SynthPanelUI.java:62)
>>>> ~[?:1.8.0_121]
>>>>          at javax.swing.JComponent.setUI(JComponent.java:666)
>>>> ~[?:1.8.0_121]
>>>>          at javax.swing.JPanel.setUI(JPanel.java:153)
>~[?:1.8.0_121]
>>>>          at javax.swing.JPanel.updateUI(JPanel.java:126)
>~[?:1.8.0_121]
>>>>          at javax.swing.JPanel.<init>(JPanel.java:86)
>~[?:1.8.0_121]
>>>>          at javax.swing.JPanel.<init>(JPanel.java:109)
>~[?:1.8.0_121]
>>>>          at javax.swing.JPanel.<init>(JPanel.java:117)
>~[?:1.8.0_121]
>>>>          at
>org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:44)
>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>          at
>org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(
>>>> AbstractJMeterGuiComponent.java:78)
>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>          at org.apache.jmeter.control.gui.TestPlanGui.<init>(
>>>> TestPlanGui.java:68)
>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>          at org.apache.jmeter.gui.tree.JMeterTreeModel.<init>(
>>>> JMeterTreeModel.java:49)
>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>          at org.apache.jmeter.JMeter.startGui(JMeter.java:366)
>>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>          at org.apache.jmeter.JMeter.start(JMeter.java:519)
>>>> [ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>Method)
>>>> ~[?:1.8.0_121]
>>>>          at sun.reflect.NativeMethodAccessorImpl.invoke(
>>>> NativeMethodAccessorImpl.java:62)
>>>> ~[?:1.8.0_121]
>>>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>>>> DelegatingMethodAccessorImpl.java:43)
>>>> ~[?:1.8.0_121]
>>>>          at java.lang.reflect.Method.invoke(Method.java:498)
>>>> ~[?:1.8.0_121]
>>>>          at org.apache.jmeter.NewDriver.main(NewDriver.java:256)
>>>> [ApacheJMeter.jar:3.2-SNAPSHOT.20170225]
>>>>
>>>
>>>
>>

Re: NPE during GUI launch on latest trunk

Posted by sebb <se...@gmail.com>.
On 25 February 2017 at 14:25, Felix Schumacher
<fe...@internetallee.de> wrote:
> Am 25.02.2017 um 15:01 schrieb Philippe Mouawad:
>>
>> Hi Graham,
>> It could be coming from a Sonar error I fixed in r1783482
>>
>>      @Override
>>      public String getName() {
>>          if (nameField != null) {
>>              return nameField.getText();
>>          }
>>          return ""; // $NON-NLS-1$
>>      }
>>
>> Could you try it ?
>
> I reverted the fix and added a sonar hint, to not nag us about this.

I doubt that this is the full solution.
If the nameField can be null here then it can perhaps be null in setName.

The underlying cause of the issue needs to be found.

One problem I notice is that the NamePanel ctor calls setName() which
can be overridden - that can cause issues because the object won't be
fully constructed until the ctor completes.
This is why init() is private.
The setName() code either needs to be duplicated in init(), or it
could be put into a private method called by the ctor and the public
setName.

> Felix
>
>
>> Thanks
>>
>> On Sat, Feb 25, 2017 at 2:42 PM, Graham Russell <gr...@ham1.co.uk> wrote:
>>
>>> Hi all
>>>
>>> I just tried to run `ant run_gui` on the latest (github) trunk but
>>> this results in an NPE - specifically when trying to create the
>>> JMeterTreeModel.
>>>
>>> Any ideas?
>>>
>>> Thanks
>>>
>>> Graham
>>>
>>> The JMeter log is:
>>>
>>> 2017-02-25 13:26:50,223 INFO o.a.j.u.JMeterUtils: Setting Locale to en_GB
>>> 2017-02-25 13:26:50,246 INFO o.a.j.JMeter: Loading user properties
>>> from: /home/coding/jmeter/bin/user.properties
>>> 2017-02-25 13:26:50,247 INFO o.a.j.JMeter: Loading system properties
>>> from: /home/coding/jmeter/bin/system.properties
>>> 2017-02-25 13:26:50,317 INFO o.a.j.JMeter: Copyright (c) 1998-2017 The
>>> Apache Software Foundation
>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Version 3.2-SNAPSHOT.20170225
>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.version=1.8.0_121
>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.vm.name=Java
>>> HotSpot(TM) 64-Bit Server VM
>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.name=Linux
>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.arch=amd64
>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.version=4.4.0-59-generic
>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: file.encoding=UTF-8
>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Max memory     =1342177280
>>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Available Processors =4
>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: Default Locale=English
>>> (United Kingdom)
>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: JMeter  Locale=English
>>> (United Kingdom)
>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: JMeterHome=/home/coding/jmeter
>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: user.dir  =/home/coding/jmeter
>>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: PWD       =/home/coding/jmeter
>>> 2017-02-25 13:26:50,324 INFO o.a.j.JMeter: IP: 127.0.1.1 Name:
>>> EliteBook FullName: EliteBook
>>> 2017-02-25 13:26:50,607 INFO o.a.j.g.a.LookAndFeelCommand: Using look
>>> and feel: com.sun.java.swing.plaf.gtk.GTKLookAndFeel [GTK+, System]
>>> 2017-02-25 13:26:50,805 INFO o.a.j.JMeter: Loaded icon properties from
>>> org/apache/jmeter/images/icon.properties
>>> 2017-02-25 13:26:50,842 ERROR o.a.j.JMeter: An error occurred:
>>> java.lang.NullPointerException: null
>>>          at org.apache.jmeter.gui.NamePanel.getName(NamePanel.java:75)
>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>          at com.sun.java.swing.plaf.gtk.GTKStyle.getInsets(GTKStyle.
>>> java:316)
>>> ~[?:1.8.0_121]
>>>          at javax.swing.plaf.synth.SynthStyle.installDefaults(
>>> SynthStyle.java:913)
>>> ~[?:1.8.0_121]
>>>          at javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(
>>> SynthLookAndFeel.java:265)
>>> ~[?:1.8.0_121]
>>>          at javax.swing.plaf.synth.SynthPanelUI.updateStyle(
>>> SynthPanelUI.java:117)
>>> ~[?:1.8.0_121]
>>>          at javax.swing.plaf.synth.SynthPanelUI.installDefaults(
>>> SynthPanelUI.java:100)
>>> ~[?:1.8.0_121]
>>>          at javax.swing.plaf.basic.BasicPanelUI.installUI(
>>> BasicPanelUI.java:56)
>>> ~[?:1.8.0_121]
>>>          at javax.swing.plaf.synth.SynthPanelUI.installUI(
>>> SynthPanelUI.java:62)
>>> ~[?:1.8.0_121]
>>>          at javax.swing.JComponent.setUI(JComponent.java:666)
>>> ~[?:1.8.0_121]
>>>          at javax.swing.JPanel.setUI(JPanel.java:153) ~[?:1.8.0_121]
>>>          at javax.swing.JPanel.updateUI(JPanel.java:126) ~[?:1.8.0_121]
>>>          at javax.swing.JPanel.<init>(JPanel.java:86) ~[?:1.8.0_121]
>>>          at javax.swing.JPanel.<init>(JPanel.java:109) ~[?:1.8.0_121]
>>>          at javax.swing.JPanel.<init>(JPanel.java:117) ~[?:1.8.0_121]
>>>          at org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:44)
>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>          at org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(
>>> AbstractJMeterGuiComponent.java:78)
>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>          at org.apache.jmeter.control.gui.TestPlanGui.<init>(
>>> TestPlanGui.java:68)
>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>          at org.apache.jmeter.gui.tree.JMeterTreeModel.<init>(
>>> JMeterTreeModel.java:49)
>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>          at org.apache.jmeter.JMeter.startGui(JMeter.java:366)
>>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>          at org.apache.jmeter.JMeter.start(JMeter.java:519)
>>> [ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> ~[?:1.8.0_121]
>>>          at sun.reflect.NativeMethodAccessorImpl.invoke(
>>> NativeMethodAccessorImpl.java:62)
>>> ~[?:1.8.0_121]
>>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>>> DelegatingMethodAccessorImpl.java:43)
>>> ~[?:1.8.0_121]
>>>          at java.lang.reflect.Method.invoke(Method.java:498)
>>> ~[?:1.8.0_121]
>>>          at org.apache.jmeter.NewDriver.main(NewDriver.java:256)
>>> [ApacheJMeter.jar:3.2-SNAPSHOT.20170225]
>>>
>>
>>
>

Re: NPE during GUI launch on latest trunk

Posted by Felix Schumacher <fe...@internetallee.de>.
Am 25.02.2017 um 15:01 schrieb Philippe Mouawad:
> Hi Graham,
> It could be coming from a Sonar error I fixed in r1783482
>
>      @Override
>      public String getName() {
>          if (nameField != null) {
>              return nameField.getText();
>          }
>          return ""; // $NON-NLS-1$
>      }
>
> Could you try it ?
I reverted the fix and added a sonar hint, to not nag us about this.

Felix

> Thanks
>
> On Sat, Feb 25, 2017 at 2:42 PM, Graham Russell <gr...@ham1.co.uk> wrote:
>
>> Hi all
>>
>> I just tried to run `ant run_gui` on the latest (github) trunk but
>> this results in an NPE - specifically when trying to create the
>> JMeterTreeModel.
>>
>> Any ideas?
>>
>> Thanks
>>
>> Graham
>>
>> The JMeter log is:
>>
>> 2017-02-25 13:26:50,223 INFO o.a.j.u.JMeterUtils: Setting Locale to en_GB
>> 2017-02-25 13:26:50,246 INFO o.a.j.JMeter: Loading user properties
>> from: /home/coding/jmeter/bin/user.properties
>> 2017-02-25 13:26:50,247 INFO o.a.j.JMeter: Loading system properties
>> from: /home/coding/jmeter/bin/system.properties
>> 2017-02-25 13:26:50,317 INFO o.a.j.JMeter: Copyright (c) 1998-2017 The
>> Apache Software Foundation
>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Version 3.2-SNAPSHOT.20170225
>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.version=1.8.0_121
>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.vm.name=Java
>> HotSpot(TM) 64-Bit Server VM
>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.name=Linux
>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.arch=amd64
>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.version=4.4.0-59-generic
>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: file.encoding=UTF-8
>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Max memory     =1342177280
>> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Available Processors =4
>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: Default Locale=English
>> (United Kingdom)
>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: JMeter  Locale=English
>> (United Kingdom)
>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: JMeterHome=/home/coding/jmeter
>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: user.dir  =/home/coding/jmeter
>> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: PWD       =/home/coding/jmeter
>> 2017-02-25 13:26:50,324 INFO o.a.j.JMeter: IP: 127.0.1.1 Name:
>> EliteBook FullName: EliteBook
>> 2017-02-25 13:26:50,607 INFO o.a.j.g.a.LookAndFeelCommand: Using look
>> and feel: com.sun.java.swing.plaf.gtk.GTKLookAndFeel [GTK+, System]
>> 2017-02-25 13:26:50,805 INFO o.a.j.JMeter: Loaded icon properties from
>> org/apache/jmeter/images/icon.properties
>> 2017-02-25 13:26:50,842 ERROR o.a.j.JMeter: An error occurred:
>> java.lang.NullPointerException: null
>>          at org.apache.jmeter.gui.NamePanel.getName(NamePanel.java:75)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>          at com.sun.java.swing.plaf.gtk.GTKStyle.getInsets(GTKStyle.
>> java:316)
>> ~[?:1.8.0_121]
>>          at javax.swing.plaf.synth.SynthStyle.installDefaults(
>> SynthStyle.java:913)
>> ~[?:1.8.0_121]
>>          at javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(
>> SynthLookAndFeel.java:265)
>> ~[?:1.8.0_121]
>>          at javax.swing.plaf.synth.SynthPanelUI.updateStyle(
>> SynthPanelUI.java:117)
>> ~[?:1.8.0_121]
>>          at javax.swing.plaf.synth.SynthPanelUI.installDefaults(
>> SynthPanelUI.java:100)
>> ~[?:1.8.0_121]
>>          at javax.swing.plaf.basic.BasicPanelUI.installUI(
>> BasicPanelUI.java:56)
>> ~[?:1.8.0_121]
>>          at javax.swing.plaf.synth.SynthPanelUI.installUI(
>> SynthPanelUI.java:62)
>> ~[?:1.8.0_121]
>>          at javax.swing.JComponent.setUI(JComponent.java:666)
>> ~[?:1.8.0_121]
>>          at javax.swing.JPanel.setUI(JPanel.java:153) ~[?:1.8.0_121]
>>          at javax.swing.JPanel.updateUI(JPanel.java:126) ~[?:1.8.0_121]
>>          at javax.swing.JPanel.<init>(JPanel.java:86) ~[?:1.8.0_121]
>>          at javax.swing.JPanel.<init>(JPanel.java:109) ~[?:1.8.0_121]
>>          at javax.swing.JPanel.<init>(JPanel.java:117) ~[?:1.8.0_121]
>>          at org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:44)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>          at org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(
>> AbstractJMeterGuiComponent.java:78)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>          at org.apache.jmeter.control.gui.TestPlanGui.<init>(
>> TestPlanGui.java:68)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>          at org.apache.jmeter.gui.tree.JMeterTreeModel.<init>(
>> JMeterTreeModel.java:49)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>          at org.apache.jmeter.JMeter.startGui(JMeter.java:366)
>> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>          at org.apache.jmeter.JMeter.start(JMeter.java:519)
>> [ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> ~[?:1.8.0_121]
>>          at sun.reflect.NativeMethodAccessorImpl.invoke(
>> NativeMethodAccessorImpl.java:62)
>> ~[?:1.8.0_121]
>>          at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>> DelegatingMethodAccessorImpl.java:43)
>> ~[?:1.8.0_121]
>>          at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
>>          at org.apache.jmeter.NewDriver.main(NewDriver.java:256)
>> [ApacheJMeter.jar:3.2-SNAPSHOT.20170225]
>>
>
>


Re: NPE during GUI launch on latest trunk

Posted by Philippe Mouawad <ph...@gmail.com>.
Hi Graham,
It could be coming from a Sonar error I fixed in r1783482

    @Override
    public String getName() {
        if (nameField != null) {
            return nameField.getText();
        }
        return ""; // $NON-NLS-1$
    }

Could you try it ?
Thanks

On Sat, Feb 25, 2017 at 2:42 PM, Graham Russell <gr...@ham1.co.uk> wrote:

> Hi all
>
> I just tried to run `ant run_gui` on the latest (github) trunk but
> this results in an NPE - specifically when trying to create the
> JMeterTreeModel.
>
> Any ideas?
>
> Thanks
>
> Graham
>
> The JMeter log is:
>
> 2017-02-25 13:26:50,223 INFO o.a.j.u.JMeterUtils: Setting Locale to en_GB
> 2017-02-25 13:26:50,246 INFO o.a.j.JMeter: Loading user properties
> from: /home/coding/jmeter/bin/user.properties
> 2017-02-25 13:26:50,247 INFO o.a.j.JMeter: Loading system properties
> from: /home/coding/jmeter/bin/system.properties
> 2017-02-25 13:26:50,317 INFO o.a.j.JMeter: Copyright (c) 1998-2017 The
> Apache Software Foundation
> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Version 3.2-SNAPSHOT.20170225
> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.version=1.8.0_121
> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: java.vm.name=Java
> HotSpot(TM) 64-Bit Server VM
> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.name=Linux
> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.arch=amd64
> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: os.version=4.4.0-59-generic
> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: file.encoding=UTF-8
> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Max memory     =1342177280
> 2017-02-25 13:26:50,318 INFO o.a.j.JMeter: Available Processors =4
> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: Default Locale=English
> (United Kingdom)
> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: JMeter  Locale=English
> (United Kingdom)
> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: JMeterHome=/home/coding/jmeter
> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: user.dir  =/home/coding/jmeter
> 2017-02-25 13:26:50,323 INFO o.a.j.JMeter: PWD       =/home/coding/jmeter
> 2017-02-25 13:26:50,324 INFO o.a.j.JMeter: IP: 127.0.1.1 Name:
> EliteBook FullName: EliteBook
> 2017-02-25 13:26:50,607 INFO o.a.j.g.a.LookAndFeelCommand: Using look
> and feel: com.sun.java.swing.plaf.gtk.GTKLookAndFeel [GTK+, System]
> 2017-02-25 13:26:50,805 INFO o.a.j.JMeter: Loaded icon properties from
> org/apache/jmeter/images/icon.properties
> 2017-02-25 13:26:50,842 ERROR o.a.j.JMeter: An error occurred:
> java.lang.NullPointerException: null
>         at org.apache.jmeter.gui.NamePanel.getName(NamePanel.java:75)
> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>         at com.sun.java.swing.plaf.gtk.GTKStyle.getInsets(GTKStyle.
> java:316)
> ~[?:1.8.0_121]
>         at javax.swing.plaf.synth.SynthStyle.installDefaults(
> SynthStyle.java:913)
> ~[?:1.8.0_121]
>         at javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(
> SynthLookAndFeel.java:265)
> ~[?:1.8.0_121]
>         at javax.swing.plaf.synth.SynthPanelUI.updateStyle(
> SynthPanelUI.java:117)
> ~[?:1.8.0_121]
>         at javax.swing.plaf.synth.SynthPanelUI.installDefaults(
> SynthPanelUI.java:100)
> ~[?:1.8.0_121]
>         at javax.swing.plaf.basic.BasicPanelUI.installUI(
> BasicPanelUI.java:56)
> ~[?:1.8.0_121]
>         at javax.swing.plaf.synth.SynthPanelUI.installUI(
> SynthPanelUI.java:62)
> ~[?:1.8.0_121]
>         at javax.swing.JComponent.setUI(JComponent.java:666)
> ~[?:1.8.0_121]
>         at javax.swing.JPanel.setUI(JPanel.java:153) ~[?:1.8.0_121]
>         at javax.swing.JPanel.updateUI(JPanel.java:126) ~[?:1.8.0_121]
>         at javax.swing.JPanel.<init>(JPanel.java:86) ~[?:1.8.0_121]
>         at javax.swing.JPanel.<init>(JPanel.java:109) ~[?:1.8.0_121]
>         at javax.swing.JPanel.<init>(JPanel.java:117) ~[?:1.8.0_121]
>         at org.apache.jmeter.gui.NamePanel.<init>(NamePanel.java:44)
> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>         at org.apache.jmeter.gui.AbstractJMeterGuiComponent.<init>(
> AbstractJMeterGuiComponent.java:78)
> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>         at org.apache.jmeter.control.gui.TestPlanGui.<init>(
> TestPlanGui.java:68)
> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>         at org.apache.jmeter.gui.tree.JMeterTreeModel.<init>(
> JMeterTreeModel.java:49)
> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>         at org.apache.jmeter.JMeter.startGui(JMeter.java:366)
> ~[ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>         at org.apache.jmeter.JMeter.start(JMeter.java:519)
> [ApacheJMeter_core.jar:3.2-SNAPSHOT.20170225]
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> ~[?:1.8.0_121]
>         at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:62)
> ~[?:1.8.0_121]
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
> ~[?:1.8.0_121]
>         at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
>         at org.apache.jmeter.NewDriver.main(NewDriver.java:256)
> [ApacheJMeter.jar:3.2-SNAPSHOT.20170225]
>



-- 
Cordialement.
Philippe Mouawad.