/** * Returns a String representation of the exception. * * @return A String that represents the exception. */ public String toString() { return "ClientStatusException " + "\n\tmessage: " + getMessage() + "\n\tcode: " + code; } }
/** * Generates the HTTP response info for the server status exception. * * @return The HTTP response info for the server status exception. */ protected HttpResponseInfo generateHttpResponseInfo() { HttpResponseInfo httpResponseInfo = null; try { int responseCode = urlConnection.getResponseCode(); String responseMessage = urlConnection.getResponseMessage(); httpResponseInfo = new HttpResponseInfo(responseCode, responseMessage); } catch (IOException ignore) { } return httpResponseInfo; }
ClientStatusException exception = new ClientStatusException(e, ClientStatusException.AMF_CONNECT_FAILED_CODE); throw exception;
/** * Processes the AMF body. Note that this method won't work if batching of * AMF messages is supported at some point but for now we are guaranteed to * have a single message. */ protected Object processAmfBody(ArrayList<MessageBody> messages) throws ServerStatusException { for (MessageBody message : messages) { String targetURI = message.getTargetURI(); if (targetURI.endsWith(MessageIOConstants.RESULT_METHOD)) { return message.getData(); } else if (targetURI.endsWith(MessageIOConstants.STATUS_METHOD)) { String exMessage = "Server error"; HttpResponseInfo responseInfo = generateHttpResponseInfo(); ServerStatusException exception = new ServerStatusException(exMessage, message.getData(), responseInfo); throw exception; } } return null; // Should not happen. }
amfConnection.connect(endpoint); } catch (ClientStatusException eClient) { stdErr.println("[!] ClientStatusException - Connection: " + eClient.toString().trim());
ClientStatusException exception = new ClientStatusException(e, ClientStatusException.AMF_CONNECT_FAILED_CODE); throw exception;
/** * Returns a String representation of the exception. * * @return A String that represents the exception. */ @Override public String toString() { return "ClientStatusException " + "\n\tmessage: " + getMessage() + "\n\tcode: " + code; } }
/** * Processes the AMF body. Note that this method won't work if batching of * AMF messages is supported at some point but for now we are guaranteed to * have a single message. */ protected Object processAmfBody(ArrayList<MessageBody> messages) throws ServerStatusException { for (MessageBody message : messages) { String targetURI = message.getTargetURI(); if (targetURI.endsWith(MessageIOConstants.RESULT_METHOD)) { return message.getData(); } else if (targetURI.endsWith(MessageIOConstants.STATUS_METHOD)) { String exMessage = "Server error"; HttpResponseInfo responseInfo = generateHttpResponseInfo(); ServerStatusException exception = new ServerStatusException(exMessage, message.getData(), responseInfo); throw exception; } } return null; // Should not happen. }
/** * Connects to the URL provided. Any previous connections are closed. * * @param url The url to connect to. * * @throws ClientStatusException If there is a client side exception. */ public void connect(String url) throws ClientStatusException { if (connected) close(); this.url = url; try { urlObject = new URL(url); serializationContext = new SerializationContext(); serializationContext.createASObjectForMissingType = true; internalConnect(); } catch (IOException e) { ClientStatusException exception = new ClientStatusException(e, ClientStatusException.AMF_CONNECT_FAILED_CODE); throw exception; } }
/** * Returns a String representation of the exception. * * @return A String that represents the exception. */ @Override public String toString() { return "ClientStatusException " + "\n\tmessage: " + getMessage() + "\n\tcode: " + code; } }
/** * Processes the AMF body. Note that this method won't work if batching of * AMF messages is supported at some point but for now we are guaranteed to * have a single message. */ protected Object processAmfBody(ArrayList<MessageBody> messages) throws ServerStatusException { for (MessageBody message : messages) { String targetURI = message.getTargetURI(); if (targetURI.endsWith(MessageIOConstants.RESULT_METHOD)) { return message.getData(); } else if (targetURI.endsWith(MessageIOConstants.STATUS_METHOD)) { String exMessage = "Server error"; HttpResponseInfo responseInfo = generateHttpResponseInfo(); ServerStatusException exception = new ServerStatusException(exMessage, message.getData(), responseInfo); throw exception; } } return null; // Should not happen. }
throw new ClientStatusException(errorMessage, ClientStatusException.AMF_CALL_FAILED_CODE, generateHttpResponseInfo());
throw new ClientStatusException(errorMessage, ClientStatusException.AMF_CALL_FAILED_CODE, generateHttpResponseInfo());
ClientStatusException cse = new ClientStatusException(message, ClientStatusException.AMF_CALL_FAILED_CODE); throw cse; throw (ServerStatusException)e; throw new ClientStatusException(e, ClientStatusException.AMF_CALL_FAILED_CODE, generateHttpResponseInfo());
ClientStatusException cse = new ClientStatusException(message, ClientStatusException.AMF_CALL_FAILED_CODE); throw cse; throw (ServerStatusException)e; ClientStatusException exception = new ClientStatusException(e, ClientStatusException.AMF_CALL_FAILED_CODE); throw exception;
ClientStatusException cse = new ClientStatusException(message, ClientStatusException.AMF_CALL_FAILED_CODE); throw cse; throw (ServerStatusException)e; throw new ClientStatusException(e, ClientStatusException.AMF_CALL_FAILED_CODE, generateHttpResponseInfo());