GW: 在点击“批准”按钮后出现空指针异常

huangapple go评论146阅读模式
英文:

GW: Null Pointer Exception after click on Approve button

问题

点击“批准”按钮后出现NPE(NullPointerException),也在“拒绝”按钮上出现NPE。尽管用户被授权批准该操作,但无法确定从哪一点开始抛出空值。

以下是日志记录:

错误:向用户显示一个不是UserDisplayableException的异常消息
java.lang.NullPointerException
在com.guidewire.pl.system.entity.proxy.AbstractKeyableBeanProxy.getFieldValue(AbstractKeyableBeanProxy.java:159)处
在com.guidewire.pl.system.entity.proxy.BeanProxy.getFieldValue(BeanProxy.java:593)处
在com.guidewire.pl.system.graph.AbstractForeignKeyLink.getSourceIdsFromBundleIfPossible(AbstractForeignKeyLink.java:32)处
在com.guidewire.pl.system.graph.Chain.getSourceIdsFromBundleIfPossible(Chain.java:139)处
在com.guidewire.pl.system.graph.Chain.getSourceIdsFromBundleIfPossible(Chain.java:135)处
在com.guidewire.pl.system.graph.Chain.getSourceIdsViaBundleIfPossible(Chain.java:44)处
在com.guidewire.pl.system.integration.messaging.events.TopLevelEntityGraph.processChainInBundle(TopLevelEntityGraph.java:79)处
在com.guidewire.pl.system.integration.messaging.events.TopLevelEntityGraph.getTopLevelObjectIdsReferringToUpdatedBean(TopLevelEntityGraph.java:43)处
在com.guidewire.pl.system.bundle.validation.GraphToValidatableBeansImpl.getTopLevelObjectIdsReferringToUpdatedBean(GraphToValidatableBeansImpl.java:63)处
在com.guidewire.pl.system.bundle.validation.RootValidatableBeansFinderImpl.findRootBeansToValidate(RootValidatableBeansFinderImpl.java:145)处
在com.guidewire.pl.system.preupdate.PreUpdateHelper.executePreUpdateRules(PreUpdateHelper.java:21)处
在com.guidewire.pl.system.database.DatabaseBundleWriter.prepareBundleForWritePreIDGeneration(DatabaseBundleWriter.java:73)处
在com.guidewire.pl.system.bundle.BundleWriter.commitBundle(BundleWriter.java:85)处
在com.guidewire.pl.system.transaction.SessionImpl.flush(SessionImpl.java:139)处
在com.guidewire.pl.system.transaction.SessionImpl.commit(SessionImpl.java:200)处
在com.guidewire.pl.system.transaction.TransactionManagerImpl.execute(TransactionManagerImpl.java:115)处
在com.guidewire.pl.system.transaction.TransactionManagerImpl.commitBundle(TransactionManagerImpl.java:59)处
在com.guidewire.pl.system.bundle.EntityBundleImpl.commitAndGetBeans(EntityBundleImpl.java:1669)处
在com.guidewire.pl.system.bundle.EntityBundleImpl.commit(EntityBundleImpl.java:1611)处
在com.guidewire.pl.web.navigation.EditControllerImpl.commitChanges(EditControllerImpl.java:63)处
在com.guidewire.pl.web.navigation.Location.innerCommitChanges(Location.java:476)处
在com.guidewire.pl.web.navigation.Location.commitChanges(Location.java:425)处
在com.guidewire.pl.web.navigation.LocationConfigCodeGen$6.handleCall(LocationConfigCodeGen.java:91)处
在gw.internal.gosu.runtime.GosuRuntimeMethods.invokeMethodInfo(GosuRuntimeMethods.java:252)处
在fragment_.pcffragment.ApprovalDetailWorksheet.ApprovalDetailScreen.ApprovalDetailWorksheet_ApproveButton.ToolbarButton_action_0_6.evaluate(Unknown Source)处
在gw.internal.gosu.parser.fragments.GosuFragment.evaluate(GosuFragment.java:485) - ({
beforeCommitAction = \ -> Activity.approve()
CurrentLocation.commit()
}) 处

英文:

Getting NPE after click on Approve button for the payment activity.And also, getting NPE for Reject button. Even though user is authorized to approve the activity but unable to figure it out from which point it throws null value.

Here are the below logs-

ERROR Displaying to the user an exception message that is not a UserDisplayableException
java.lang.NullPointerException
	at com.guidewire.pl.system.entity.proxy.AbstractKeyableBeanProxy.getFieldValue(AbstractKeyableBeanProxy.java:159)
	at com.guidewire.pl.system.entity.proxy.BeanProxy.getFieldValue(BeanProxy.java:593)
	at com.guidewire.pl.system.graph.AbstractForeignKeyLink.getSourceIdsFromBundleIfPossible(AbstractForeignKeyLink.java:32)
	at com.guidewire.pl.system.graph.Chain.getSourceIdsFromBundleIfPossible(Chain.java:139)
	at com.guidewire.pl.system.graph.Chain.getSourceIdsFromBundleIfPossible(Chain.java:135)
	at com.guidewire.pl.system.graph.Chain.getSourceIdsViaBundleIfPossible(Chain.java:44)
	at com.guidewire.pl.system.integration.messaging.events.TopLevelEntityGraph.processChainInBundle(TopLevelEntityGraph.java:79)
	at com.guidewire.pl.system.integration.messaging.events.TopLevelEntityGraph.getTopLevelObjectIdsReferringToUpdatedBean(TopLevelEntityGraph.java:43)
	at com.guidewire.pl.system.bundle.validation.GraphToValidatableBeansImpl.getTopLevelObjectIdsReferringToUpdatedBean(GraphToValidatableBeansImpl.java:63)
	at com.guidewire.pl.system.bundle.validation.RootValidatableBeansFinderImpl.findRootBeansToValidate(RootValidatableBeansFinderImpl.java:145)
	at com.guidewire.pl.system.preupdate.PreUpdateHelper.executePreUpdateRules(PreUpdateHelper.java:21)
	at com.guidewire.pl.system.database.DatabaseBundleWriter.prepareBundleForWritePreIDGeneration(DatabaseBundleWriter.java:73)
	at com.guidewire.pl.system.bundle.BundleWriter.commitBundle(BundleWriter.java:85)
	at com.guidewire.pl.system.transaction.SessionImpl.flush(SessionImpl.java:139)
	at com.guidewire.pl.system.transaction.SessionImpl.commit(SessionImpl.java:200)
	at com.guidewire.pl.system.transaction.TransactionManagerImpl.execute(TransactionManagerImpl.java:115)
	at com.guidewire.pl.system.transaction.TransactionManagerImpl.commitBundle(TransactionManagerImpl.java:59)
	at com.guidewire.pl.system.bundle.EntityBundleImpl.commitAndGetBeans(EntityBundleImpl.java:1669)
	at com.guidewire.pl.system.bundle.EntityBundleImpl.commit(EntityBundleImpl.java:1611)
	at com.guidewire.pl.web.navigation.EditControllerImpl.commitChanges(EditControllerImpl.java:63)
	at com.guidewire.pl.web.navigation.Location.innerCommitChanges(Location.java:476)
	at com.guidewire.pl.web.navigation.Location.commitChanges(Location.java:425)
	at com.guidewire.pl.web.navigation.LocationConfigCodeGen$6.handleCall(LocationConfigCodeGen.java:91)
	at gw.internal.gosu.runtime.GosuRuntimeMethods.invokeMethodInfo(GosuRuntimeMethods.java:252)
	at fragment_.pcffragment.ApprovalDetailWorksheet.ApprovalDetailScreen.ApprovalDetailWorksheet_ApproveButton.ToolbarButton_action_0_6.evaluate(Unknown Source)
	at gw.internal.gosu.parser.fragments.GosuFragment.evaluate(GosuFragment.java:485) - ({
  beforeCommitAction = \  -> Activity.approve()
  CurrentLocation.commit()

答案1

得分: 3

空指针错误不会发生在授权或权限问题存在的情况下。这是因为对象未被初始化或传递不正确。

要解决此问题,您需要找出哪个对象为空。查看日志,最有可能为空的对象是Activity或CurrentLocation对象。我建议进行调试以确认它们是否已初始化。

此外,Guidewire建议在PCF中使用捆绑时要谨慎。如果这不是对CurrentLocation.commit()的默认调用,我还建议在其他捆绑提交点上持久化Activity。

Guidewire的警告是:“只在适当的时候提交实体更改,否则可能会导致严重的数据完整性问题。在许多情况下,例如典型的规则集和PCF代码中,最好依赖默认行为,而不是手动显式提交实体数据。”

您可以在Guidewire文档中了解有关捆绑和数据库事务的更多信息,链接在这里:https://docs.guidewire.com/cloud/bc/202104/integration/gosu/topics/c_ku1456387.html

注意:您可能需要使用您的客户或合作伙伴凭据登录以访问该文档链接。

英文:

Null Pointer Errors would not occur if there is an authorization or permission issue. This is due to an object not being initialized or passed correctly.

To resolve, you'll need to figure out which object is null. Looking at the logs, the 2 most likely objects are the Activity or CurrentLocation objects. I recommend debugging to confirm if these are initialized.

Also, Guidewire recommends caution with bundles in PCFs. If this is not an OOTB call to CurrentLocation.commit(), I also recommend persisting the Activity at other bundle commit points.

The Guidewire warning is: "Only commit entity changes at appropriate times or you could cause serious data integrity issues. In many cases, such as typical Rule sets and PCF code, it is best to rely on default behavior and not explicitly commit entity data manually."

You can learn more about bundles and database transactions in the Guidewire Documentation here: https://docs.guidewire.com/cloud/bc/202104/integration/gosu/topics/c_ku1456387.html

Note: you may need to login with your customer or partner credentials to access that Documentation link.

huangapple
  • 本文由 发表于 2023年1月9日 18:05:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/75055691.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定