Program: 57781
Project: 57781
Buggy source:
@Override public void updatedTransactions(SKPaymentQueue queue,NSArray<SKPaymentTransaction> transactions){
  for (  SKPaymentTransaction transaction : transactions) {
    SKPaymentTransactionState state=transaction.getTransactionState();
switch (state) {
case Purchased:
      observer.handlePurchase(transaction(transaction));
    SKPaymentQueue.getDefaultQueue().finishTransaction(transaction);
  break;
case Failed:
NSError error=transaction.getError();
if (error.getCode() == SKErrorCode.PaymentCancelled.value()) {
observer.handlePurchaseCanceled();
}
 else {
observer.handlePurchaseError(new RuntimeException("String_Node_Str" + error.toString()));
}
SKPaymentQueue.getDefaultQueue().finishTransaction(transaction);
break;
case Restored:
restoredTransactions.add(transaction(transaction));
SKPaymentQueue.getDefaultQueue().finishTransaction(transaction);
break;
default :
break;
}
}
}

Fixed version (ground truth):
@Override public void updatedTransactions(SKPaymentQueue queue,NSArray<SKPaymentTransaction> transactions){
  for (  final SKPaymentTransaction transaction : transactions) {
    SKPaymentTransactionState state=transaction.getTransactionState();
switch (state) {
case Purchased:
      final Transaction t=transaction(transaction);
    if (Foundation.getMajorSystemVersion() >= 7) {
      NSURL receiptURL=NSBundle.getMainBundle().getAppStoreReceiptURL();
      NSData receipt=NSData.read(receiptURL);
      if (receipt == null) {
        log(LOGTYPELOG,"String_Node_Str");
        final SKReceiptRefreshRequest request=new SKReceiptRefreshRequest();
        request.setDelegate(new SKRequestDelegateAdapter(){
          @Override public void didFinish(          SKRequest r){
            if (r.equals(request)) {
              NSURL receiptURL=NSBundle.getMainBundle().getAppStoreReceiptURL();
              NSData receipt=NSData.read(receiptURL);
              String encodedReceipt=receipt.toBase64EncodedString(NSDataBase64EncodingOptions.None);
              t.setTransactionDataSignature(encodedReceipt);
              log(LOGTYPELOG,"String_Node_Str");
            }
 else {
              log(LOGTYPEERROR,"String_Node_Str");
            }
            log(LOGTYPELOG,"String_Node_Str" + transaction.getTransactionIdentifier());
            observer.handlePurchase(t);
            SKPaymentQueue.getDefaultQueue().finishTransaction(transaction);
          }
          @Override public void didFail(          SKRequest request,          NSError error){
            log(LOGTYPEERROR,"String_Node_Str" + error.toString());
            log(LOGTYPELOG,"String_Node_Str" + transaction.getTransactionIdentifier());
            observer.handlePurchase(t);
            SKPaymentQueue.getDefaultQueue().finishTransaction(transaction);
          }
        }
);
        request.start();
      }
 else {
        String encodedReceipt=receipt.toBase64EncodedString(NSDataBase64EncodingOptions.None);
        t.setTransactionDataSignature(encodedReceipt);
        log(LOGTYPELOG,"String_Node_Str" + transaction.getTransactionIdentifier());
        observer.handlePurchase(t);
        SKPaymentQueue.getDefaultQueue().finishTransaction(transaction);
      }
    }
 else {
      t.setTransactionDataSignature(transaction.getTransactionReceipt().toBase64EncodedString(NSDataBase64EncodingOptions.None));
      log(LOGTYPELOG,"String_Node_Str" + transaction.getTransactionIdentifier());
      observer.handlePurchase(t);
      SKPaymentQueue.getDefaultQueue().finishTransaction(transaction);
    }
  break;
case Failed:
NSError error=transaction.getError();
if (error.getCode() == SKErrorCode.PaymentCancelled.value()) {
log(LOGTYPEERROR,"String_Node_Str");
observer.handlePurchaseCanceled();
}
 else {
log(LOGTYPEERROR,"String_Node_Str" + error.toString());
observer.handlePurchaseError(new RuntimeException("String_Node_Str" + error.toString()));
}
SKPaymentQueue.getDefaultQueue().finishTransaction(transaction);
break;
case Restored:
restoredTransactions.add(transaction(transaction));
SKPaymentQueue.getDefaultQueue().finishTransaction(transaction);
log(LOGTYPELOG,"String_Node_Str" + transaction.getTransactionIdentifier());
break;
default :
break;
}
}
}