Am 25. Februar 2017 23:42:44 MEZ schrieb sebb <[email protected]>: >On 25 February 2017 at 14:25, Felix Schumacher ><[email protected]> 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 <[email protected]> >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] >>>> >>> >>> >>
