Validates the {@link FbBotMillResponse}.

@param response
the response
@return true if the response is valid, false otherwise.
198667
protected boolean validate(FbBotMillResponse response) {
		// If validations are not enabled, returns true.
		if (!FbBotMillContext.getInstance().isValidationEnabled()) {
			return true;
		}

		boolean valid = true;
		ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
		Validator validator = factory.getValidator();
		Set<ConstraintViolation<FbBotMillResponse>> violations = validator
				.validate(response);
		for (ConstraintViolation<FbBotMillResponse> v : violations) {
			valid = false;
			logger.error(
					"FbBotMillResponse validation error. Message: [{}] Value: [{}], Class: [{}], Field: [{}]",
					v.getMessage(), v.getInvalidValue(), v.getRootBean(),
					v.getPropertyPath());
		}

		if (valid == false) {
			// Sends the constraint violations through the callback.
			List<FbBotMillMonitor> registeredMonitors = FbBotMillContext
					.getInstance().getRegisteredMonitors();
			for (FbBotMillMonitor monitor : registeredMonitors) {
				monitor.onValidationError(response, violations);
			}
		}

		return valid;
	}
684467
private function validateResponse( $response ) {

		// Make sure WordPress errors are handled.
		if ( is_wp_error( $response ) ) {
			$this->error = $response->get_error_message();
			return false;
		}

		// Check for 200 response code from server.
		$responseCode = wp_remote_retrieve_response_code( $response );
		if ( false === strstr( $responseCode, '200' ) ) {
			$responseMessage = wp_remote_retrieve_response_message( $response );
			$this->error = "{$responseCode} {$responseMessage}";
			return false;
		}

		// Check for nested status code not being successful.
		if ( isset( $this->response->status ) && 200 !== $this->response->status ) {
			$this->error = $this->response->result->data;
			return false;
		}

		return true;
	}
7538
public Map<String, Object> evaluateVerifyCredentialsResponse(String responseBody) {
        String endpoint = TwitterConstants.TWITTER_ENDPOINT_VERIFY_CREDENTIALS;

        Map<String, Object> responseValues = null;
        try {
            responseValues = populateJsonResponse(responseBody);
        } catch (JoseException e) {
            return createErrorResponse("TWITTER_RESPONSE_NOT_JSON", new Object[] { endpoint, e.getLocalizedMessage(), responseBody });
        }

        Map<String, Object> result = checkForEmptyResponse(endpoint, responseBody, responseValues);
        if (result != null) {
            return result;
        }

        // Ensure response contains email
        result = checkForRequiredParameters(endpoint, responseValues, TwitterConstants.RESPONSE_EMAIL);
        if (result != null) {
            return result;
        }

        responseValues.put(TwitterConstants.RESULT_RESPONSE_STATUS, TwitterConstants.RESULT_SUCCESS);
        return responseValues;
    }
1069110
private boolean hasBody(Response response) {
        int status;

        status = response.getStatusLine().code;
        if ("HEAD".equals(method)) {
            return false;
        } else {
            return status >= StatusCode.OK && status != StatusCode.NO_CONTENT && status != StatusCode.NOT_MODIFIED && status != StatusCode.RESET_CONTENT;
        }
    }
1074134
public void reply(MessageEnvelope envelope) {
		FbBotMillResponse response = createResponse(envelope);
		if (response != null) {
			// If the response is valid, replies to it.
			if (validate(response)) {
				FbBotMillNetworkController.postJsonMessage(response);
			}
		}
	}
1017958
public static void validatePromotionSuccessful(HttpResponse response, boolean dryRun, boolean failFast, TaskListener listener) throws IOException {
        StatusLine status = response.getStatusLine();
        String content;

        try {
            content = ExtractorUtils.entityToString(response.getEntity());
        } catch (IOException e) {
            throw new IOException("Failed parsing promotion response.", e);
        }

        if (failOnResponseStatus(dryRun, failFast, listener, status, content)) {
            throw new IOException("Promotion failed due to Artifactory response.");
        }

        listener.getLogger().println(content);
    }
844289
public boolean validate()
  {
    boolean correct = true;
    if (population() > 1)
    {
      java.util.Comparator comp = index().insertComparator();
      int xcc = 0;
      for (int i = 0; i < population()-1; i++)
      {
        xcc = comp.compare(_nodeKey[i], _nodeKey[i+1]);
        if ( !(xcc < 0) )
          {
            System.out.println("Entry " + i + " not less than entry " + i+1);
            correct = false;
          }
      }
    }
    return correct;
  }
319224
private boolean validateMinDecimal(Object validationObject, Annotation annotate)
    {

        if (validationObject != null)
        {
            try
            {
                if (checkvalidDeciDigitTypes(validationObject.getClass()))
                {
                    BigDecimal minValue = NumberUtils.createBigDecimal(((DecimalMin) annotate).value());
                    BigDecimal actualValue = NumberUtils.createBigDecimal(toString(validationObject));
                    int res = actualValue.compareTo(minValue);
                    if (res < 0)
                    {
                        throwValidationException(((DecimalMin) annotate).message());
                    }

                }
            }
            catch (NumberFormatException nfe)
            {
                throw new RuleValidationException(nfe.getMessage());
            }

        }

        return true;
    }
700586
def _validate_response(response):
        
        try:
            response.raise_for_status()
        except requests.RequestException:
            raise RequestException(
                code=response.status_code,
                url=response.url,
                description=response.text)
        else:
            return response
565325
private static boolean checkSuccess(HttpResponse response, boolean dryRun, TaskListener listener) {
        StatusLine status = response.getStatusLine();
        String content = "";
        try {
            content = ExtractorUtils.entityToString(response.getEntity());
            ExtractorUtils.validateStringNotBlank(content);
            JSONObject json = JSONObject.fromObject(content);
            String message = json.getString("message");
            if (assertResponseStatus(dryRun, listener, status, message)) {
                listener.getLogger().println(message);
                return true;
            }
        } catch (IOException e) {
            String parsingErrorStr = "Failed parsing distribution response";
            if (StringUtils.isNotBlank(content)) {
                parsingErrorStr = ": " + content;
            }
            e.printStackTrace(listener.error(parsingErrorStr));
        }
        return false;
    }
395491
private boolean isInvalidatingHEADResponse(HTTPRequest request, CacheItem item, HTTPResponse resolvedResponse) {
        return request.getMethod() == HTTPMethod.HEAD && item != null && resolvedResponse.getStatus() != Status.NOT_MODIFIED;
    }
635999
protected boolean isLoggingIn(final Request request, final Response response)
    {
        return this.isInterceptingLogin()
                && this.getLoginPath().equals(request.getResourceRef().getRemainingPart(false, false))
                && Method.POST.equals(request.getMethod());
    }
989010
protected int validateProxyResponse(WsByteBuffer[] buffers) {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "validateProxyResponse");
        }

        int status = STATUS_NOT_DONE;
        // Drain the proxy response
        for (int i = 0; i < buffers.length; i++) {

            buffers[i].flip();
            byte[] data = new byte[buffers[i].limit()];
            buffers[i].get(data);
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "buffer: [" + new String(data) + "]");
            }

            // exit if the first buffer does not contain the "HTTP   200"
            // We assume that the first buffer contains the first line of the
            // HTTPResponse
            if (!this.isProxyResponseValid) {
                this.isProxyResponseValid = containsHTTP200(data);
                if (!this.isProxyResponseValid) {
                    // top level methods will call connectFailed
                    status = STATUS_ERROR;
                    break;
                }
            }

            // exit if the end of the response was found
            if (containsEOLDelimiters(data)) {
                status = STATUS_DONE;
                break;
            }

            // we are going to need to do another read, clear this buffer
            buffers[i].clear();
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "validateProxyResponse, rc=" + status);
        }
        return status;
    }
436764
private boolean checkAndRespond(Request request) {
        if (!URIBean.checkUri(request.getUrl())) {
            ServerResponseBean responseBean = new ServerResponseBean();
            responseBean.setMsgId(request.getMsgId());
            responseBean.setHttpContentType(HttpContentType.APPLICATION_JSON);
            responseBean.setResponseBody(UnitResponse.createError(Group.CODE_BAD_REQUEST, null, String.format("URI %s is illegal.", request.getUrl()))
                    .toVoJSONString());
            IServerResponder.singleton.response(responseBean);
            return false;
        }
        return true;
    }
786460
private function _isValidResponse($response)
    {
        if (is_null($response)) {
            return self::ERROR_EMPTY;
        }

        if (!isset($response->result) or ($response->result != 'error')) {
            return true;
        }

        return $response->message;
    }
976940
protected boolean isSuccessfulResult(@Sensitive Map<String, Object> result, String endpoint) {
        if (result == null) {
            Tr.error(tc, "TWITTER_ERROR_OBTAINING_ENDPOINT_RESULT", new Object[] { endpoint });
            return false;
        }
        String responseStatus = result.containsKey(TwitterConstants.RESULT_RESPONSE_STATUS) ? (String) result.get(TwitterConstants.RESULT_RESPONSE_STATUS) : null;
        String responseMsg = result.containsKey(TwitterConstants.RESULT_MESSAGE) ? (String) result.get(TwitterConstants.RESULT_MESSAGE) : null;

        if (responseStatus == null) {
            Tr.error(tc, "TWITTER_RESPONSE_STATUS_MISSING", new Object[] { endpoint });
            return false;
        }

        if (!responseStatus.equals(TwitterConstants.RESULT_SUCCESS)) {
            Tr.error(tc, "TWITTER_RESPONSE_FAILURE", new Object[] { endpoint, (responseMsg == null) ? "" : responseMsg });
            return false;
        }

        return true;
    }
970728
public static void validateResults(Map<Integer, Object> results) {
        for (Object result : results.values()) {
            if (result != null && result instanceof CacheClearResponse) {
                Object response = ((CacheClearResponse) result).getResponse();
                if (response instanceof Throwable) {
                    ExceptionUtil.sneakyThrow((Throwable) response);
                }
            }
        }
    }