Add an issue to an OperationOutcome

@param theCtx
The fhir context
@param theOperationOutcome
The OO resource to add to
@param theSeverity
The severity (fatal | error | warning | information)
@param theDetails
The details string
@param theCode
973236
public static void addIssue(FhirContext theCtx, IBaseOperationOutcome theOperationOutcome, String theSeverity, String theDetails, String theLocation, String theCode) {
		IBase issue = createIssue(theCtx, theOperationOutcome);
		populateDetails(theCtx, issue, theSeverity, theDetails, theLocation, theCode);
	}
73836
protected void doReportValidationProblem(String msg, Location loc)
        throws XMLStreamException
    {
        if (loc == null) {
            loc = getLocation();
        }
        XMLValidationProblem prob = new XMLValidationProblem(loc, msg, XMLValidationProblem.SEVERITY_ERROR);
        prob.setReporter(this);
        mContext.reportProblem(prob);
    }
48177
public CodeableConceptDt addCoding(CodingDt theValue) {
		if (theValue == null) {
			throw new NullPointerException("theValue must not be null");
		}
		getCoding().add(theValue);
		return this;
	}
126727
private CodeQualityAuditResponse codeQualityDetailsForMissingStatus(CollectorItem codeQualityCollectorItem ){
        CodeQualityAuditResponse detailsMissing =new CodeQualityAuditResponse();
        detailsMissing.addAuditStatus(CodeQualityAuditStatus.CODE_QUALITY_DETAIL_MISSING);
        detailsMissing.setLastUpdated(codeQualityCollectorItem.getLastUpdated());
        List<CodeQuality> codeQualities = codeQualityRepository.findByCollectorItemIdOrderByTimestampDesc(codeQualityCollectorItem.getId());
        for(CodeQuality returnCodeQuality:codeQualities) {
            detailsMissing.setUrl(returnCodeQuality.getUrl());
            detailsMissing.setName(returnCodeQuality.getName());
            detailsMissing.setLastExecutionTime(returnCodeQuality.getTimestamp());
        }
        return detailsMissing;
    }
46434
@Override
    public void reportValidationProblem(XMLValidationProblem prob)
        throws XMLStreamException
    {
        // !!! TBI: Fail-fast vs. deferred modes?
        /* For now let's implement basic functionality: warnings get
         * reported via XMLReporter, errors and fatal errors result in
         * immediate exceptions.
         */
        /* 27-May-2008, TSa: [WSTX-153] Above is incorrect: as per Stax
         *   javadocs for XMLReporter, both warnings and non-fatal errors
         *   (which includes all validation errors) should be reported via
         *   XMLReporter interface, and only fatals should cause an
         *   immediate stream exception (by-passing reporter)
         */
        if (prob.getSeverity() > XMLValidationProblem.SEVERITY_ERROR) {
            throw WstxValidationException.create(prob);
        }
        XMLReporter rep = mConfig.getXMLReporter();
        if (rep != null) {
            _reportProblem(rep, prob);
        } else {
            /* If no reporter, regular non-fatal errors are to be reported
             * as exceptions as well, for backwards compatibility
             */
            if (prob.getSeverity() >= XMLValidationProblem.SEVERITY_ERROR) {
                throw WstxValidationException.create(prob);
            }
        }
    }
938809
public void addAdditionalDetail(String key, String detail) {
        if (detail == null || detail.trim().isEmpty())
            return;

        if (this.additionalDetails == null) {
            this.additionalDetails = new HashMap<String, String>();
        }

        String additionalContent = this.additionalDetails.get(key);
        if (additionalContent != null && !additionalContent.trim().isEmpty())
            detail = additionalContent + "-" + detail;
        if (!detail.isEmpty())
            additionalDetails.put(key, detail);
    }
224631
public void addError(SyntaxException error, SourceUnit source) throws CompilationFailedException {
        addError(Message.create(error, source), error.isFatal());
    }
417772
public void addURIParticipantObject(String failedUri, String failureDescription)
	{
		List<TypeValuePairType> failureDescriptionValue = new LinkedList<>();
		if (!EventUtils.isEmptyOrNull(failureDescription)) {
			failureDescriptionValue.add(getTypeValuePair("Alert Description", failureDescription.getBytes()));
		}
		this.addParticipantObjectIdentification(
				new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.PatientNumber(), 
				null,
				null, 
				failureDescriptionValue,
				failedUri, 
				RFC3881ParticipantObjectTypeCodes.SYSTEM, 
				RFC3881ParticipantObjectTypeRoleCodes.MASTER_FILE, 
				null, 
				null);
	}
1096971
private void setHumaSubjectSupplementDetails(
			RROtherProjectInfo12Document.RROtherProjectInfo12 rrOtherProjectInfo,
			OrganizationContract organization,
			ProposalSpecialReviewContract proposalSpecialReview) {
		rrOtherProjectInfo.setHumanSubjectsIndicator(YesNoDataType.Y_YES);
		HumanSubjectsSupplement humanSubjectsSupplement = HumanSubjectsSupplement.Factory
				.newInstance();
		HumanSubjectsSupplement.ExemptionNumbers exemptionNumbers = HumanSubjectsSupplement.ExemptionNumbers.Factory
				.newInstance();

		if (proposalSpecialReview.getApprovalType() != null) {
			setExemptions(proposalSpecialReview, humanSubjectsSupplement,
					exemptionNumbers);
			setHumanSubjectIRBReviewIndicator(proposalSpecialReview,
					humanSubjectsSupplement);
		}
		if (organization != null && organization.getHumanSubAssurance() != null) {
			humanSubjectsSupplement.setHumanSubjectAssuranceNumber(organization
					.getHumanSubAssurance().substring(3));
		}
		if (humanSubjectsSupplement != null) {
			rrOtherProjectInfo
					.setHumanSubjectsSupplement(humanSubjectsSupplement);
		}
	}
1112783
public void writeDetailLine(Record registration, StreamOut out, boolean bResourceListBundle)
    {
        String strKey = registration.getField(Registration.KEY_VALUE).toString();
        String strValue = registration.getField(Registration.OBJECT_VALUE).toString();
        strValue = ResourcesUtilities.fixPropertyValue(strValue, bResourceListBundle);
        if (bResourceListBundle)
            out.writeit("\t{\"" + strKey + "\", " + strValue + "}");
        else
            out.writeit(ResourcesUtilities.fixPropertyKey(strKey) + "=" + strValue);
    }
9934
public void error(VirtualConnection vc, Throwable t) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "error() called: " + vc);
        }
        // can't do anything with a null VC
        if (null == vc) {
            return;
        }
        Object o = vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPICL);
        if (null == o) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "ERROR: null ICL in error()");
            }
            return;
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Error occurring while purging body: " + t);
        }
        // close the connection
        ((HttpInboundLink) o).close(vc, (Exception) t);
    }
239848
@Override
    public void error(VirtualConnection vc, TCPWriteRequestContext wsc, IOException ioe) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "error, vc=" + getVCHash());
        }
        // Nothing else needs to be done here. Report error up the chain.
        this.asyncBytesToWrite = 0L;
        this.callback.error(vc, this, ioe);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "error");
        }
    }
102097
public void aroundInvoke(final InvocationContext ctx) throws DevFailed {
        xlogger.entry();
        if (aroundInvokeMethod != null) {
            try {
                aroundInvokeMethod.invoke(businessObject, ctx);
            } catch (final IllegalArgumentException e) {
                throw DevFailedUtils.newDevFailed(e);
            } catch (final IllegalAccessException e) {
                throw DevFailedUtils.newDevFailed(e);
            } catch (final InvocationTargetException e) {
                if (e.getCause() instanceof DevFailed) {
                    throw (DevFailed) e.getCause();
                } else {
                    throw DevFailedUtils.newDevFailed(e.getCause());
                }
            }
        }
        xlogger.exit();
    }
647550
@Override
  protected void onMethodExit(int opcode) {
    if ((withPreconditions || withPostconditions || withInvariants)
        && opcode != ATHROW) {
      if (withPostconditions || withInvariants) {
        Label skip = enterBusySection();

        if (withPostconditions) {
          Type returnType = Type.getReturnType(methodDesc);
          int returnIndex = -1;
          if (returnType.getSort() != Type.VOID) {
            if (returnType.getSize() == 2) {
              dup2();
            } else {
              dup();
            }
            returnIndex = newLocal(returnType);
            storeLocal(returnIndex);
          }
          invokeCommonPostconditions(ContractKind.POST, oldValueLocals,
                                     returnIndex);
        }

        if (withInvariants && !statik) {
          invokeInvariants();
        }

        leaveBusySection(skip);
      }
      leaveContractedMethod();
    }
  }
729404
@Override
    @FFDCIgnore(IOException.class)
    public void error(VirtualConnection vc, TCPReadRequestContext rsc, IOException ioe) {
        boolean closing = false;
        boolean isFirstRead = false;
        synchronized(_srtUpgradeStream){
            closing = _upgradeStream.isClosing();
            isFirstRead = _upgradeStream.isFirstRead();
            _upgradeStream.setIsInitialRead(false);
        }
        if(!closing){
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Encountered an error during the initial read for data : " + ioe + ", " + _rl);
            }

            try{
                //Set the original Context Class Loader before calling the users onDataAvailable
                //Push the original thread's context onto the current thread, also save off the current thread's context
                _contextManager.pushContextData();

                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Error encountered while we are not closing : " + _rl);
                }

                if(!isFirstRead){
                    if(WCCustomProperties31.UPGRADE_READ_TIMEOUT != TCPReadRequestContext.NO_TIMEOUT && ioe instanceof SocketTimeoutException){
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "Other side did not send data within the timeout time, calling onError : " + _rl);
                        }
                        if(! _upgradeStream.isIsonErrorCalled()) {
                            _upgradeStream.setIsonErrorCalled(true);
                            _rl.onError(ioe);
                        }
                    } else {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "Other side must be closed, check if not called before call onAllDataRead : " + _rl);
                        }
                        if(! _upgradeStream.isAlldataReadCalled()) {
                            try{
                                //We will call onAllDataRead if we encounter the error because we assume the other side has closed the connection since there is no timeout currently
                                //The other side closing the connection means that we have read all the data
                                _upgradeStream.setAlldataReadCalled(true);
                                _rl.onAllDataRead();

                            } catch(Throwable onAllDataReadException){
                                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                    Tr.debug(tc, "Encountered an error during ReadListener.onAllDataRead : " + onAllDataReadException + ", " + _rl);
                                }
                                if(! _upgradeStream.isIsonErrorCalled()) {
                                    _upgradeStream.setIsonErrorCalled(true);                                
                                    _rl.onError(onAllDataReadException);
                                }
                            }
                        }
                    }
                } else {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Encountered an error during the first initialRead for data, calling the ReadListener.onError : " + _rl);
                    }
                    if (TraceComponent.isAnyTracingEnabled() && tc.isErrorEnabled())
                        Tr.error(tc, "setReadListener.initialread.failed");

                    if(! _upgradeStream.isIsonErrorCalled()) {
                        _upgradeStream.setIsonErrorCalled(true);
                        _rl.onError(ioe);
                    }
                }
            } finally {
                try {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "finally call close from ReadListener.onError : " + _rl);
                    }
                    _upgradeStream.getWebConn().close();
                } catch( Exception e ) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Caught exception during WebConnection.close : " + e + "," + _rl);
                    }
                }

                //Revert back to the thread's current context
                _contextManager.popContextData();
            }
        } else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "We are closing, skipping the call to onError");
            }
            synchronized(_srtUpgradeStream){
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Issuing the notify");
                }
                _srtUpgradeStream.notify();
            }
        }
    }
1007854
@Override
    public <R> OperationResult<R> executeWithFailover(Operation<CL, R> op, RetryPolicy retry)
            throws ConnectionException {
    	
    	//Tracing operation
    	OperationTracer opsTracer = config.getOperationTracer();
    	final AstyanaxContext context = opsTracer.getAstyanaxContext();
        if(context != null) {
        	opsTracer.onCall(context, op);
        }
    	
        retry.begin();
        ConnectionException lastException = null;
        do {
            try {
                OperationResult<R> result = newExecuteWithFailover(op).tryOperation(op);
                retry.success();
                if(context != null)  
                	opsTracer.onSuccess(context, op);
                
                return result;
            }
            catch (OperationException e) {
            	if(context != null)  
            		opsTracer.onException(context, op, e);
            	
                retry.failure(e);
                throw e;
            }
            catch (ConnectionException e) {
                lastException = e;
            } 
            
            if (retry.allowRetry()) {
            	LOG.debug("Retry policy[" + retry.toString() + "] will allow a subsequent retry for operation [" + op.getClass() + 
            			  "] on keyspace [" + op.getKeyspace() + "] on pinned host[" + op.getPinnedHost() + "]");
            }
        } while (retry.allowRetry());
        
        if(context != null && lastException != null)  
        	opsTracer.onException(context, op, lastException);
        
        retry.failure(lastException);
        throw lastException;
    }
744438
@Override
  public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) {
    final Channel channel = ctx.channel();

    LOG.log(Level.INFO, "Unexpected exception from downstream. channel: {0} local: {1} remote: {2}",
        new Object[]{channel, channel.localAddress(), channel.remoteAddress()});
    LOG.log(Level.WARNING, "Unexpected exception from downstream.", cause);
    channel.close();
    this.listener.exceptionCaught(ctx, cause);
  }