Package com.betfair.cougar.core.api.fault

Examples of com.betfair.cougar.core.api.fault.FaultDetail


    }


  private void writeFaultDetail(CougarFault cougarFault, XMLStreamWriter xmlWriter) throws XMLStreamException, JAXBException {
      xmlWriter.writeStartElement("detail");
      FaultDetail detail = cougarFault.getDetail();
      if(detail != null ) {

          List<String[]> faultMessages = detail.getFaultMessages();
          if (faultMessages != null) {
                writeElement("exceptionname", detail.getFaultName(), xmlWriter);
            xmlWriter.writeStartElement(detail.getFaultName());
            for (String[] msg: faultMessages) {
                    writeElement(msg[0],msg[1],xmlWriter);
            }
            xmlWriter.writeEndElement();
          }
          if (FaultController.getInstance().isDetailedFaults()) {
                writeElement("trace",detail.getStackTrace(),xmlWriter);
                writeElement("message",detail.getDetailMessage(),xmlWriter);
          }
      }
      xmlWriter.writeEndElement();
  }
View Full Code Here


                String[] nvpair=new String[] { (String)e.getKey(), e.getValue().toString() };
                faultParams.add(nvpair);
            }
        }

        final FaultDetail fd=new FaultDetail(faultString, faultParams);

        return new CougarFault() {
            @Override
            public String getErrorCode() {
                return faultString;
View Full Code Here

                String[] nvpair=new String[] { (String)e.getKey(), (String)e.getValue().toString() };
                faultParams.add(nvpair);
            }
        }

        final FaultDetail fd=new FaultDetail(faultString, faultParams);

        return new CougarFault() {
            @Override
            public String getErrorCode() {
                return faultString;
View Full Code Here

    HashMap<String,Object> detailMap = new HashMap<String,Object>();
    faultMap.put("faultcode", fault.getFaultCode().name());
    faultMap.put("faultstring", fault.getErrorCode());
    faultMap.put("detail", detailMap);
   
    FaultDetail detail = fault.getDetail();
      if (FaultController.getInstance().isDetailedFaults()) {
        detailMap.put("trace", detail.getStackTrace());
        detailMap.put("message", detail.getDetailMessage());
      }
        List<String[]> faultMessages = detail.getFaultMessages();
        if (faultMessages != null) {
            detailMap.put("exceptionname", detail.getFaultName());
          HashMap<String,Object> paramMap = new HashMap<String,Object>();
          detailMap.put(detail.getFaultName(), paramMap);
          for (String[] msg: faultMessages) {
              paramMap.put(msg[0], msg[1]);
          }           
        }
View Full Code Here

        if (executionResult.getResultType() == ExecutionResult.ResultType.Success) {
            response = JsonRpcSuccessResponse.buildSuccessResponse(rpc, executionResult.getResult());
        } else if (executionResult.getResultType() == ExecutionResult.ResultType.Fault) {
            Fault fault = executionResult.getFault().getFault();
            HashMap<String,Object> detailMap = new HashMap<String,Object>();
            FaultDetail detail = fault.getDetail();
            if (FaultController.getInstance().isDetailedFaults()) {
                detailMap.put("trace", detail.getStackTrace());
                detailMap.put("message", detail.getDetailMessage());
            }
            List<String[]> faultMessages = detail.getFaultMessages();
            if (faultMessages != null) {
                detailMap.put("exceptionname", detail.getFaultName());
                HashMap<String,Object> paramMap = new HashMap<String,Object>();
                detailMap.put(detail.getFaultName(), paramMap);
                for (String[] msg: faultMessages) {
                    paramMap.put(msg[0], msg[1]);
                }
            }
View Full Code Here

        reason.setText(fault.getErrorCode());
    }

    private void createFaultDetail(SOAPFactory factory, SOAPFault soapFault, CougarFault fault, SoapOperationBinding binding) throws Exception {
        SOAPFaultDetail soapFaultDetail = factory.createSOAPFaultDetail(soapFault);
        FaultDetail detail = fault.getDetail();
        if (detail != null) {
            List<String[]> faultMessages = detail.getFaultMessages();

            if (faultMessages != null && faultMessages.size() > 0) {
                OMNamespace ns = factory.createOMNamespace(binding
                        .getServiceBindingDescriptor().getNamespaceURI(), binding
                        .getServiceBindingDescriptor().getNamespacePrefix());


                OMElement faultNode = factory.createOMElement(detail.getFaultName(), ns);
                for (String[] msg : faultMessages) {
                    OMElement messageNode = factory.createOMElement(msg[0], ns);
                    messageNode.setText(msg[1]);
                    faultNode.addChild(messageNode);
                }
                soapFaultDetail.addChild(faultNode);
            }

            if (FaultController.getInstance().isDetailedFaults()) {
                OMElement stackTrace = factory.createOMElement(new QName("trace"));
                stackTrace.setText(detail.getStackTrace());
                soapFaultDetail.addChild(stackTrace);

                OMElement detailedMessage = factory.createOMElement(new QName("message"));
                detailedMessage.setText(detail.getDetailMessage());
                soapFaultDetail.addChild(detailedMessage);
            }

        }
    }
View Full Code Here

        }
      };

      int ref = in.addRef(null);

            FaultDetail o = transcribe(ti);
            in.setRef(ref, o);

      return o;
    }
    catch (Exception e) {
View Full Code Here

        Throwable exception = null;
        if (className != null) {
            ParameterType type = new ParameterType(Class.forName(ClassnameCompatibilityMapper.toMajorOnlyPackaging(className)), null);
            exception = (Throwable)in.readObject(new Parameter("exception", type, false), true);
        }
        return new FaultDetail(detailMessage, exception);
    }
View Full Code Here

    if (out.addRef(obj)) {
      return;
    }


        FaultDetail transcribableException = (FaultDetail) obj;
    TranscriptionOutput to = new TranscriptionOutput() {
      @Override
      public void writeObject(Object obj, Parameter param, boolean client) throws Exception {
        out.writeObject(obj);
View Full Code Here

              //TranscriptionStreamFactoryImpl for details
        Object result = in.readObject();
        return new InvocationResponseImpl(result);
      } else {
        ServerFaultCode code = (ServerFaultCode)in.readObject();
        FaultDetail faultDetail = (FaultDetail) in.readObject();
        if (faultDetail != null) {
                  if (faultDetail.getCause() != null) {
                      if (faultDetail.getCause() instanceof CougarApplicationException) {
                          return new InvocationResponseImpl(null, new CougarClientException(code, faultDetail.getDetailMessage(), (CougarApplicationException)faultDetail.getCause()));
                      } else {
                          return new InvocationResponseImpl(null, new CougarClientException(code, faultDetail.getDetailMessage(), faultDetail.getCause()));
                      }
                  }
                  else {
                        FaultCode faultCode = code == ServerFaultCode.ServiceCheckedException ? FaultCode.Server : code.getResponseCode().getFaultCode();
                      return new InvocationResponseImpl(null, new CougarClientException(code, faultCode + " fault received from remote server: "+code,
                                new CougarClientException(code, faultDetail.getDetailMessage())
                        ));
                  }
        }
              else {
            return new InvocationResponseImpl(null, new CougarClientException(code, "No detailed message available"));
View Full Code Here

TOP

Related Classes of com.betfair.cougar.core.api.fault.FaultDetail

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.