#vulnerable code 
                             @Override
	public BranchStatus branchRollback(BranchType branchType, String xid, long branchId, String resourceId, String applicationData) throws TransactionException {
		TCCResource tccResource = (TCCResource) tccResourceCache.get(resourceId);
		if (tccResource == null) {
			throw new ShouldNeverHappenException("TCC resource is not exist, resourceId:" + resourceId);
		}
		Object targetTCCBean = tccResource.getTargetBean();
		Method rollbackMethod = tccResource.getRollbackMethod();
		if (targetTCCBean == null || rollbackMethod == null) {
			throw new ShouldNeverHappenException("TCC resource is not available, resourceId:" + resourceId);
		}
		try {
			boolean result = false;
			//BusinessActionContext
			BusinessActionContext businessActionContext = getBusinessActionContext(xid, branchId, resourceId, applicationData);
			Object ret = rollbackMethod.invoke(targetTCCBean, businessActionContext);
			LOGGER.info("TCC resource rollback result :" + ret + ", xid:" + xid + ", branchId:" + branchId + ", resourceId:" + resourceId);
			if (ret != null && ret instanceof TwoPhaseResult) {
				result = ((TwoPhaseResult) ret).isSuccess();
			} else {
				result = (boolean) ret;
			}
			return result ? BranchStatus.PhaseTwo_Rollbacked : BranchStatus.PhaseTwo_RollbackFailed_Retryable;
		} catch (Throwable t) {
			String msg = String.format("rollback TCC resource error, resourceId: %s, xid: %s.", resourceId, xid);
			LOGGER.error(msg, t);
			throw new FrameworkException(t, msg);
		}
	} 
                            #location 21 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                             @Override
	public BranchStatus branchRollback(BranchType branchType, String xid, long branchId, String resourceId, String applicationData) throws TransactionException {
		TCCResource tccResource = (TCCResource) tccResourceCache.get(resourceId);
		if (tccResource == null) {
			throw new ShouldNeverHappenException("TCC resource is not exist, resourceId:" + resourceId);
		}
		Object targetTCCBean = tccResource.getTargetBean();
		Method rollbackMethod = tccResource.getRollbackMethod();
		if (targetTCCBean == null || rollbackMethod == null) {
			throw new ShouldNeverHappenException("TCC resource is not available, resourceId:" + resourceId);
		}
		try {
			boolean result = false;
			//BusinessActionContext
			BusinessActionContext businessActionContext = getBusinessActionContext(xid, branchId, resourceId, applicationData);
			Object ret = rollbackMethod.invoke(targetTCCBean, businessActionContext);
			LOGGER.info("TCC resource rollback result :" + ret + ", xid:" + xid + ", branchId:" + branchId + ", resourceId:" + resourceId);
            if (ret != null) {
                if (ret instanceof TwoPhaseResult) {
                    result = ((TwoPhaseResult) ret).isSuccess();
                } else {
                    result = (boolean) ret;
                }
            }
			return result ? BranchStatus.PhaseTwo_Rollbacked : BranchStatus.PhaseTwo_RollbackFailed_Retryable;
		} catch (Throwable t) {
			String msg = String.format("rollback TCC resource error, resourceId: %s, xid: %s.", resourceId, xid);
			LOGGER.error(msg, t);
			throw new FrameworkException(t, msg);
		}
	}