Codename One - ToastBar NullPointerException

时间:2017-09-12 09:39:38

标签: nullpointerexception codenameone toast

如果用户在显示Button - ToastBar ToastBar NullPointerException的{​​{1}}上多次快速点击多次。

堆栈

java.lang.NullPointerException
    (Code 1) at com.codename1.components.ToastBar.updateStatus(ToastBar.java:602)
    at com.codename1.components.ToastBar.access$300(ToastBar.java:84)
    at com.codename1.components.ToastBar$2.run(ToastBar.java:638)
    at com.codename1.ui.Display.processSerialCalls(Display.java:1101)
    at com.codename1.ui.Display.edtLoopImpl(Display.java:1045)
    at com.codename1.ui.Display.invokeAndBlock(Display.java:1154)
    at com.codename1.ui.Display.invokeAndBlock(Display.java:1191)
    at com.codename1.ui.AnimationManager.addAnimationAndBlock(AnimationManager.java:105)
    at com.codename1.ui.ComponentSelector.animateUnlayoutAndWait(ComponentSelector.java:3584)
    at com.codename1.ui.ComponentSelector.slideUpAndWait(ComponentSelector.java:1036)
    at com.codename1.components.ToastBar.setVisible(ToastBar.java:787)
    at com.codename1.components.ToastBar.updateStatus(ToastBar.java:502)
    at com.codename1.components.ToastBar.access$300(ToastBar.java:84)
    at com.codename1.components.ToastBar$2.run(ToastBar.java:638)
    at com.codename1.ui.Display.processSerialCalls(Display.java:1101)
    at com.codename1.ui.Display.edtLoopImpl(Display.java:1045)
    at com.codename1.ui.Display.invokeAndBlock(Display.java:1154)
    at com.codename1.ui.Display.invokeAndBlock(Display.java:1191)
    at com.codename1.ui.AnimationManager.addAnimationAndBlock(AnimationManager.java:105)
    at com.codename1.ui.Container.replaceComponents(Container.java:869)
    at com.codename1.ui.Container.replaceAndWait(Container.java:744)
    at com.codename1.components.ToastBar.updateStatus(ToastBar.java:602)
    at com.codename1.components.ToastBar.access$300(ToastBar.java:84)
    at com.codename1.components.ToastBar$2.run(ToastBar.java:638)
    at com.codename1.ui.Display.processSerialCalls(Display.java:1101)
    at com.codename1.ui.Display.edtLoopImpl(Display.java:1045)
    at com.codename1.ui.Display.invokeAndBlock(Display.java:1154)
    at com.codename1.ui.Display.invokeAndBlock(Display.java:1191)
    at com.codename1.ui.AnimationManager.addAnimationAndBlock(AnimationManager.java:105)
    at com.codename1.ui.Container.replaceComponents(Container.java:869)
    at com.codename1.ui.Container.replaceAndWait(Container.java:744)
    at com.codename1.components.ToastBar.updateStatus(ToastBar.java:602)
    at com.codename1.components.ToastBar.access$300(ToastBar.java:84)
    at com.codename1.components.ToastBar$Status.show(ToastBar.java:325)
    at com.codename1.components.ToastBar.showMessage(ToastBar.java:820)
    at com.codename1.components.ToastBar.showMessage(ToastBar.java:830)
    at com.codename1.components.ToastBar.showErrorMessage(ToastBar.java:858)
    (Code 2) at com.somesite.someapp.somepackage.DigitRoller.copyToClipboard(DigitRoller.java:122)

(代码1) ToastBar.java ,第602行

c.label.getParent().replaceAndWait(c.label, newLabel, CommonTransitions.createCover(CommonTransitions.SLIDE_VERTICAL, true, 300));

(代码2) DigitRoller.java

protected void copyToClipboard () {
        Clipboard.copyString(sToken);
        ToastBar.showErrorMessage("Copied " + sToken, 1000);
    }
copyToClipboard()

会调用

ActionListener

btnCopy.addActionListener((e)-> {
            this.copyToClipboard();
        });

Exception中显示Dialog个详细信息后,应用会根据自己的决定冻结或停止动画。 崩溃应用程序的极其简单的方法。

1 个答案:

答案 0 :(得分:1)

这似乎是一个错误,我为它添加了一个潜在的解决方法here