Package com.betfair.cougar.core.api.exception

Examples of com.betfair.cougar.core.api.exception.CougarValidationException


      if (argIndex < args.length) {
        currentArgument = args[argIndex++];
      }

      if (param.isMandatory() && currentArgument == null) {
        throw new CougarValidationException(ServerFaultCode.MandatoryNotDefined,"MANDATORY parameter cannot be null: " + parameterName);
      }

            switch (parameterSource) {

                case BODY:
View Full Code Here


        }.start();
    }

    private boolean validateCTX(ExecutionContext ctx, ExecutionObserver observer) {
        // Ensure that the context passed is valid
        CougarValidationException ex = null;
        if (ctx == null) {
            ex = new CougarValidationException(ServerFaultCode.MandatoryNotDefined, "Execution Context must not be null");
        } else if (ctx.getLocation() == null) {
            ex = new CougarValidationException(ServerFaultCode.MandatoryNotDefined, "Geolocation details must not be null");
        }
        if (ex != null) {
            observer.onResult(new ExecutionResult(ex));
            return false;
        }
View Full Code Here

                    ServerFaultCode sfc = faultCodes.get(key);
                    if (sfc == null && deserialisationFailures.contains(key)) {
                        return CougarMarshallingException.unmarshallingException(format, spe.getMessage(), spe, client);
                    }
                    if (sfc != null) {
                        return new CougarValidationException(sfc, spe);
                    }
                    return null;
                }
            } catch (ParseException e) {
                // no match
View Full Code Here

                TransformerException te = (TransformerException) e.getException();
                if (te.getException() instanceof XMLStreamException) {
                    XMLStreamException se = (XMLStreamException) te.getException();
                    if (se.getCause() instanceof SAXParseException) {
                        SAXParseException spe = (SAXParseException) se.getCause();
                        CougarValidationException cve = schemaValidationFailureParser.parse(spe, SchemaValidationFailureParser.XmlSource.SOAP);
                        if (cve != null) {
                            throw cve;
                        }
                    }
                }
            }
            throw new CougarValidationException(ServerFaultCode.SOAPDeserialisationFailure, e);
        } catch (Exception e) {
            throw new CougarValidationException(ServerFaultCode.SOAPDeserialisationFailure, e);
        } finally {
            try {
                if (in != null) in.close();
            } catch (IOException ie) {
                throw new CougarValidationException(ServerFaultCode.SOAPDeserialisationFailure, ie);
            }
        }

        throw new CougarValidationException(ServerFaultCode.NoSuchOperation,
                "The SOAP request could not be resolved to an operation");
    }
View Full Code Here

                    try {
                        return Base64Utils.decode(node.getText());
                    } catch (Exception e) {
                        String message = "Unable to parse " + node.getText() + " as type " + paramType;
                        logger.log(Level.FINER, message, e);
                        throw new CougarValidationException(ServerFaultCode.SOAPDeserialisationFailure, message,e
                        );
                    }
                } else {
                    List list = new ArrayList();
                    for (Iterator i = node.getChildElements(); i.hasNext();) {
View Full Code Here

        logBuffer.append(" for parameter: ");
        logBuffer.append(paramName);
        String message = logBuffer.toString();

        logger.log(Level.FINER, message , e);
        return new CougarValidationException(ServerFaultCode.SOAPDeserialisationFailure, message,e);

    }
View Full Code Here

        RescriptBody body = null;
        if (bindingDescriptor.containsBodyData()) {
            //If the request contains body data, then it must be a post request
            if (!request.getMethod().equals("POST")) {
                throw new CougarValidationException(ServerFaultCode.RescriptDeserialisationFailure, "Bad body data");
            }
            body = resolveBody(inputStream, mediaType, encoding);
        }

        // jetty 9 handily gives back null when you specify a header with no value, whereas jetty 7 treated this as an empty string.. which we rely on
View Full Code Here

                command,
                resolveExecutionContext());
          }
          return executionCommand;
        }
        throw new CougarValidationException(ServerFaultCode.NoSuchOperation,
            "The request could not be resolved to an operation");
      }
    };

  }
View Full Code Here

        public String extractVersion(String uri) {
            Matcher m = regex.matcher(uri);
            if (m.matches()) {
                return m.group(1).toLowerCase();
            }
            throw new CougarValidationException(ServerFaultCode.NoSuchService, "Uri [" + uri + "] did not contain a version");
        }
View Full Code Here

        try {
            List<MediaType> acceptMT = MediaTypeUtils.parseMediaTypes(responseFormat);

            responseMediaType = MediaTypeUtils.getResponseMediaType(allContentTypes, acceptMT);
            if (responseMediaType == null) {
                throw new CougarValidationException(ServerFaultCode.AcceptTypeNotValid, "Could not agree a response media type");
            } else if (responseMediaType.isWildcardType() || responseMediaType.isWildcardSubtype()) {
                throw new CougarServiceException(ServerFaultCode.ResponseContentTypeNotValid,
                        "Service configuration error - response media type must not be a wildcard - " + responseMediaType);
            }

        } catch (IllegalArgumentException e) {
            throw new CougarValidationException(ServerFaultCode.MediaTypeParseFailure, "Unable to parse supplied media types (" + responseFormat + ")",e);
        }
        return responseMediaType;
    }
View Full Code Here

TOP

Related Classes of com.betfair.cougar.core.api.exception.CougarValidationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.