如何解决狡猾的:在声纳未检查/未经证实的投?(how can resolve dodgy:unche

2019-09-21 10:51发布

IAM通过在本以下code.How声纳获取例外,我可以解决this.Suggest我。

    @Override 
     public boolean validate(BaseInfo infoObject) { 
     boolean isValid = true; 
     AckTransferPaymentInfo ackTransferPaymentInfo = (AckTransferPaymentInfo) infoObject; 

狡猾的 - 不选中/未确认的投
从com.vocalink.acsw.common.validation.info.BaseInfo到com.vocalink.acsw.common.validation.info.AckTransferPaymentInfo在com.vocalink.acsw.validation.rule.T170Rule.validate(BaseInfo)未检查/未确认投

AckTransferPaymentElement payment = ackTransferPaymentInfo.getTransferPayment();  
if(CreditDebitIndicator.CRDT.equals(ackTransferPaymentInfo.getCreditDebitIndicator()) 
&& ackTransferPaymentInfo.getOriginalPaymentAccount().getAccountName() != null 

Answer 1:

您可以检查的遍历infoObject类型是否正确,处理它正确时,它不是:

if (!(infoObject instanceof AckTransferPaymentInfo)) {
    throw new AssertionError("Unexpected type: " + infoObject);
}
AckTransferPaymentInfo ackTransferPaymentInfo = (AckTransferPaymentInfo) infoObject;

您应该验证这个你想要做什么的时候是遍历infoObject空。



文章来源: how can resolve dodgy:unchecked/unconfirmed cast in sonar?