IBM WebSphere 上运行的意外异常 java.math.BigDecimal
在 IBM WebSphere 上运行 Java 应用程序导致了这样的异常:
Caused by: java.lang.NullPointerException
at java.math.BigDecimal.add2DFP(BigDecimal.java:1946)
at java.math.BigDecimal.add(BigDecimal.java:1881)
at com.somepackage.components.view.PremiumSummaryViewModel.setPremiums(PremiumSummaryViewModel.java:101)
空检查已完成。正如我所评论的,java.math.BigDecimal类没有这样的方法add2DFP,也没有调用它。也许这是 IBM 的 JDK 特有的。
任何对此的评论将不胜感激。
提供与异常实例有关的代码
BigDecimal annualPremiumAmt = nwtPremium != null && nwtPremium.getAnnualAmt() != null ? nwtPremium.getAnnualAmt() : BigDecimal.ZERO;
if (nwtPremium != null) {
BigDecimal formPremiumAmt = nwtPremium.getAnnualAmt();
if (formPremiumAmt != null) {
policyFormTotal = policyFormTotal.add(annualPremiumAmt); //Bigdecimal
formList.setFormPremiumAmt(formList.getFormPremiumAmt().add(annualPremiumAmt)); //101 line
}
}
,该实例正在 IBM JDK 1.6 上运行。
Running Java application on IBM WebSphere caused such exception:
Caused by: java.lang.NullPointerException
at java.math.BigDecimal.add2DFP(BigDecimal.java:1946)
at java.math.BigDecimal.add(BigDecimal.java:1881)
at com.somepackage.components.view.PremiumSummaryViewModel.setPremiums(PremiumSummaryViewModel.java:101)
Null check is done. As I reviewed java.math.BigDecimal class has no such method add2DFP and does not call one either. Maybe it's specific to IBM's JDK.
Any comment on this would be appreciated.
Providing code regarding to exception
BigDecimal annualPremiumAmt = nwtPremium != null && nwtPremium.getAnnualAmt() != null ? nwtPremium.getAnnualAmt() : BigDecimal.ZERO;
if (nwtPremium != null) {
BigDecimal formPremiumAmt = nwtPremium.getAnnualAmt();
if (formPremiumAmt != null) {
policyFormTotal = policyFormTotal.add(annualPremiumAmt); //Bigdecimal
formList.setFormPremiumAmt(formList.getFormPremiumAmt().add(annualPremiumAmt)); //101 line
}
}
Instance is running on IBM JDK 1.6.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我会将您的问题提交给 IBM 软件支持。他们不按实例收费,只要您有支持协议,请求的数量就不受限制。
I would submit your issues to IBM Software Support. They don't charge per instance, it's unlimited amount of requests as long as you have a support agreement.
已修复:
实际上整个表达式都在循环内,我认为没有必要提及。我在循环之前移动了 BigDecimal AnnualPremiumAmt 的声明并重新组织了代码:
Fixed:
Actually this whole expression is inside the loop that I thought was unnecessary to mention. I have moved declaration of BigDecimal annualPremiumAmt before the loop and reorganized code:
policyFormTotal 是否为 NULL? formList.getFormPremiumAmt()的结果怎么样?
您永远不会检查此代码块中的那些内容。
Is policyFormTotal NULL? How about the result of formList.getFormPremiumAmt()?
You never check those in this code block.