JCWDE : Exception from install() method

左心房为你撑大大i 提交于 2019-12-03 21:44:57
Michael Roland

As you already found out on your own, new BigNumber((short)100); raises an ArithmeticException. You can catch that exception with a try-catch block:

try {
    s = new BigNumber((short)100);
} catch (ArithmeticException e) {
    // TODO: handle exception
}

But that will neither solve the source of the problem nor allow you to use the BigNumber objects as they will never be created.

The constructor of BigNumber raises an ArithmeticException because 100 bytes capacity exceeds the supported maximum capacity of the JCWDE implementation. The API documentation states that implementations of BigNumber only need to support at least 8 bytes. Therefore, you may want to test smaller capacity values in order to find out what the maximum capacity of the JCWDE implementation is.

So, I finally solved my problem... The thing is that s = new BigNumber((short)100) throws an Exception, so I had to modify my code this way :

try {
  s = new BigNumber((short)100);
  x = new BigNumber((short)100);
} catch(ArithmeticException e){

}

And now I can test my applet without problems with JCWDE.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!