Bug #9058
NPE in NumberFormat with SMTP example procedure
0%
History
#1 Updated by Galya B almost 2 years ago
- File smtp-form.png added
The issue is reproducible with the procedure from the SMTP example in Email_Send. On F1 instead of submitting the form, the server gets the error:
24/08/15 13:45:21.690+0300 | SEVERE | com.goldencode.p2j.main.StandardServer [StandardServer.invoke()] | ThreadName:Conversation [00000040:bogus], Session:00000064, ThreadId:00000010, User:bogus | Abnormal end!
java.lang.RuntimeException: invoke() of class com.goldencode.testcases.galya.Smtp and method execute failed
at com.goldencode.p2j.util.ControlFlowOps.invokeError(ControlFlowOps.java:8434)
at com.goldencode.p2j.util.ControlFlowOps.invokeExternalProcedure(ControlFlowOps.java:6617)
at com.goldencode.p2j.util.ControlFlowOps.invokeExternalProcedure(ControlFlowOps.java:6386)
at com.goldencode.p2j.util.ControlFlowOps.invoke(ControlFlowOps.java:1321)
at com.goldencode.p2j.util.ControlFlowOps.invoke(ControlFlowOps.java:928)
at com.goldencode.p2j.main.StandardServer$LegacyInvoker.execute(StandardServer.java:2816)
at com.goldencode.p2j.main.StandardServer.invoke(StandardServer.java:2147)
at com.goldencode.p2j.main.StandardServer.invoke(StandardServer.java:2069)
at com.goldencode.p2j.main.StandardServer.standardEntry(StandardServer.java:691)
at com.goldencode.p2j.main.StandardServerMethodAccess.invoke(Unknown Source)
at com.goldencode.p2j.util.MethodInvoker.invoke(MethodInvoker.java:156)
at com.goldencode.p2j.net.Dispatcher.processInbound(Dispatcher.java:807)
at com.goldencode.p2j.net.Conversation.block(Conversation.java:422)
at com.goldencode.p2j.net.Conversation.run(Conversation.java:235)
at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.NullPointerException
at com.goldencode.p2j.ui.client.format.NumberFormat$NumberBuf.isAllDigitsFilled(NumberFormat.java:1644)
at com.goldencode.p2j.ui.client.format.NumberFormat$NumberBufGui.input(NumberFormat.java:3783)
at com.goldencode.p2j.ui.client.gui.FillInGuiImpl.processKeyEvent(FillInGuiImpl.java:1064)
at com.goldencode.p2j.ui.client.widget.TitledWindow.processKeyEvent(TitledWindow.java:310)
at com.goldencode.p2j.ui.client.widget.AbstractWidget.processEvent(AbstractWidget.java:2287)
at com.goldencode.p2j.ui.client.widget.TitledWindow.processEvent(TitledWindow.java:279)
at com.goldencode.p2j.ui.client.gui.WindowGuiImpl.processEvent(WindowGuiImpl.java:1660)
at com.goldencode.p2j.ui.chui.ThinClient.processEventsWorker(ThinClient.java:20703)
at com.goldencode.p2j.ui.chui.ThinClient.pop(ThinClient.java:19369)
at com.goldencode.p2j.ui.chui.ThinClient.eventBracket(ThinClient.java:19352)
at com.goldencode.p2j.ui.chui.ThinClient.eventDrawingBracket(ThinClient.java:19274)
at com.goldencode.p2j.ui.chui.ThinClient.applyWorker(ThinClient.java:19018)
at com.goldencode.p2j.ui.chui.ThinClient.waitForWorker(ThinClient.java:15077)
at com.goldencode.p2j.ui.chui.ThinClient.lambda$waitForWorker$72(ThinClient.java:14514)
at com.goldencode.p2j.ui.chui.ThinClient.lambda$doInteractive$92(ThinClient.java:20392)
at com.goldencode.p2j.ui.chui.ThinClient.doInteractive(ThinClient.java:20364)
at com.goldencode.p2j.ui.chui.ThinClient.doInteractive(ThinClient.java:20392)
at com.goldencode.p2j.ui.chui.ThinClient.waitForWorker(ThinClient.java:14513)
at com.goldencode.p2j.ui.chui.ThinClient.waitFor(ThinClient.java:14456)
at com.goldencode.p2j.ui.chui.ThinClient.promptFor(ThinClient.java:13084)
at com.goldencode.p2j.ui.ClientExportsMethodAccess.invoke(Unknown Source)
at com.goldencode.p2j.util.MethodInvoker.invoke(MethodInvoker.java:156)
at com.goldencode.p2j.net.Dispatcher.processInbound(Dispatcher.java:807)
at com.goldencode.p2j.net.Conversation.block(Conversation.java:422)
at com.goldencode.p2j.net.Conversation.waitMessage(Conversation.java:348)
at com.goldencode.p2j.net.Queue.transactImpl(Queue.java:1230)
at com.goldencode.p2j.net.Queue.transact(Queue.java:685)
at com.goldencode.p2j.net.BaseSession.transact(BaseSession.java:273)
at com.goldencode.p2j.net.HighLevelObject.transact(HighLevelObject.java:221)
at com.goldencode.p2j.net.RemoteObject$RemoteAccess.invokeCore(RemoteObject.java:1468)
at com.goldencode.p2j.net.InvocationStub.invoke(InvocationStub.java:144)
at com.sun.proxy.$Proxy3.standardEntry(Unknown Source)
at com.goldencode.p2j.main.ClientCore.start(ClientCore.java:502)
at com.goldencode.p2j.main.ClientDriver.start(ClientDriver.java:286)
at com.goldencode.p2j.main.CommonDriver.process(CommonDriver.java:522)
at com.goldencode.p2j.main.ClientDriver.process(ClientDriver.java:170)
at com.goldencode.p2j.main.ClientDriver.main(ClientDriver.java:329)
The client shows a warning that may or may not be related:
24/08/15 16:30:51.295+0300 | WARNING | com.goldencode.p2j.ui.client.event.EventManager | PID:83824, ThreadName:main, Session:00000066, User:bogus | The unicode codepoint '301' cannot be represented by this codeset 'ISO-8859-1'
Here is how the form looks:
#2 Updated by Galya B almost 2 years ago
Vladimir, I think you're familiar with the class NumberFormat. Can you help analyze what's going on?
#3 Updated by Vladimir Tsichevski almost 2 years ago
Galya B wrote:
Vladimir, I think you're familiar with the class
NumberFormat. Can you help analyze what's going on?
Looking into this... Where can I find the SMTP example?
#4 Updated by Galya B almost 2 years ago
See the first procedure in Email_Send.
#5 Updated by Vladimir Tsichevski almost 2 years ago
Which trunk version was used to get the stack trace?
#6 Updated by Vladimir Tsichevski almost 2 years ago
For me pressing F1 causes the No application help is available message emitted.
Is it the F2 key that should be used instead?
#7 Updated by Vladimir Tsichevski almost 2 years ago
Can this be related to #7646? Did you try to paste non-existing contents in the EDITOR area? This causes NPE for sure.
#8 Updated by Greg Shah almost 2 years ago
For me pressing
F1causes theNo application help is availablemessage emitted.
This seems broken as well. F2 is the HELP key by default in ChUI.
Is it the
F2key that should be used instead?
No. F1 should be GO (e.g. from ChuiLinuxKeyboard we have res.put(GO, new String[] {"F1", "CTRL-X", "PF1"});).
#9 Updated by Vladimir Tsichevski almost 2 years ago
Greg Shah wrote:
For me pressing
F1causes theNo application help is availablemessage emitted.This seems broken as well. F2 is the HELP key by default in ChUI.
We run this program in GUI.
#10 Updated by Greg Shah almost 2 years ago
It is designed to run in ChUI.
#11 Updated by Galya B almost 2 years ago
- File smtp-chui.png added
In ChUI I can't reproduce the issue, so the task will be closed as Rejected, but still I want to ask if this example is supposed to work with the gcd server? 
I get an error:
24/08/16 09:25:15.331+0300 | SEVERE | com.goldencode.p2j.util.ErrorManager | ThreadName:Conversation [00000041:bogus], Session:00000065, ThreadId:00000011, User:bogus | stack trace follows
com.goldencode.p2j.NumberedException: Failure during email send().
Caused by: org.apache.commons.mail.EmailException: Sending the email to the following server failed : localhost:2143
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1298)
at org.apache.commons.mail.Email.send(Email.java:1282)
at com.goldencode.email.Emailer.send(Emailer.java:101)
at com.goldencode.p2j.email.EmailDaemon.send(EmailDaemon.java:112)
at com.goldencode.p2j.email.RemoteEmailSenderMethodAccess.invoke(Unknown Source)
at com.goldencode.p2j.util.MethodInvoker.invoke(MethodInvoker.java:156)
at com.goldencode.p2j.net.Dispatcher.processInbound(Dispatcher.java:807)
at com.goldencode.p2j.net.Conversation.block(Conversation.java:422)
at com.goldencode.p2j.net.Conversation.waitMessage(Conversation.java:348)
at com.goldencode.p2j.net.Queue.transactImpl(Queue.java:1230)
at com.goldencode.p2j.net.Queue.transact(Queue.java:685)
at com.goldencode.p2j.net.BaseSession.transact(BaseSession.java:273)
at com.goldencode.p2j.net.HighLevelObject.transact(HighLevelObject.java:221)
at com.goldencode.p2j.net.RemoteObject$RemoteAccess.invokeCore(RemoteObject.java:1468)
at com.goldencode.p2j.net.InvocationStub.invoke(InvocationStub.java:144)
at com.sun.proxy.$Proxy3.standardEntry(Unknown Source)
at com.goldencode.p2j.main.ClientCore.start(ClientCore.java:502)
at com.goldencode.p2j.main.ClientDriver.start(ClientDriver.java:286)
at com.goldencode.p2j.main.CommonDriver.process(CommonDriver.java:522)
at com.goldencode.p2j.main.ClientDriver.process(ClientDriver.java:170)
at com.goldencode.p2j.main.ClientDriver.main(ClientDriver.java:329)
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 2143, response: -1
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1270)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
at javax.mail.Service.connect(Service.java:297)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1295)
... 20 more
#12 Updated by Greg Shah almost 2 years ago
I don't recall if I got it going via the internal email server. I definitely got it working with external servers like Gmail.
so the task will be closed as Rejected
The NPE is still an issue.
I may have designed and tested this in ChUI, but the core logic should still work in GUI. In GUI which is always Windows, F1 has an existing meaning as help, so that that is why they moved HELP to F1 there. And they must have thought, let's not change the other mappings, so GO will be F2 now in Windows GUI.
SO: In GUI, F2 should save the form and F1 should print a warning (or raise an error, I don't recall) that help is not available. Under no circumstances should either key result in an NPE.