#vulnerable code 
                             @Override
	public BranchStatus branchCommit(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 commitMethod = tccResource.getCommitMethod();
		if(targetTCCBean == null || commitMethod == 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 = commitMethod.invoke(targetTCCBean, businessActionContext);
			LOGGER.info("TCC resource commit 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_Committed:BranchStatus.PhaseTwo_CommitFailed_Retryable;
		}catch (Throwable t){
			String msg = String.format("commit 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 branchCommit(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 commitMethod = tccResource.getCommitMethod();
		if(targetTCCBean == null || commitMethod == 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 = commitMethod.invoke(targetTCCBean, businessActionContext);
			LOGGER.info("TCC resource commit 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_Committed:BranchStatus.PhaseTwo_CommitFailed_Retryable;
		}catch (Throwable t){
			String msg = String.format("commit TCC resource error, resourceId: %s, xid: %s.", resourceId, xid);
			LOGGER.error(msg , t);
			throw new FrameworkException(t, msg);
		}
	}