Package javax.websocket

Examples of javax.websocket.DecodeException


        {
            return new SimpleDateFormat("yyyy.MM.dd G 'at' HH:mm:ss z").parse(s);
        }
        catch (ParseException e)
        {
            throw new DecodeException(s,e.getMessage(),e);
        }
    }
View Full Code Here


        {
            return new SimpleDateFormat("yyyy.MM.dd").parse(s);
        }
        catch (ParseException e)
        {
            throw new DecodeException(s,e.getMessage(),e);
        }
    }
View Full Code Here

        {
            return new SimpleDateFormat("HH:mm:ss z").parse(s);
        }
        catch (ParseException e)
        {
            throw new DecodeException(s,e.getMessage(),e);
        }
    }
View Full Code Here

                    }
                } else {
                    try {
                        return ((Decoder.TextStream) decoder).decode(new StringReader(message));
                    } catch (IOException e) {
                        throw new DecodeException(message, "Could not decode string", e);
                    }
                }
            }
        }
        throw new DecodeException(message, "Could not decode string");
    }
View Full Code Here

    private Object decodePrimitive(final Class<?> targetType, final String message) throws DecodeException {
        if (targetType == Boolean.class || targetType == boolean.class) {
            return Boolean.valueOf(message);
        } else if (targetType == Character.class || targetType == char.class) {
            if (message.length() > 1) {
                throw new DecodeException(message, "Character message larger than 1 character");
            }
            return Character.valueOf(message.charAt(0));
        } else if (targetType == Byte.class || targetType == byte.class) {
            return Byte.valueOf(message);
        } else if (targetType == Short.class || targetType == short.class) {
View Full Code Here

                    }
                } else {
                    try {
                        return ((Decoder.BinaryStream) decoder).decode(new ByteArrayInputStream(bytes));
                    } catch (IOException e) {
                        throw new DecodeException(ByteBuffer.wrap(bytes), "Could not decode binary", e);
                    }
                }
            }
        }
        throw new DecodeException(ByteBuffer.wrap(bytes), "Could not decode binary");
    }
View Full Code Here

        HashExchange he = null;
        try {
            he = this.decoder.fromJson(s, HashExchange.class);
        } catch (JsonSyntaxException jse) {
            System.err.printf(">> Cannot decode JSON representation provided: %s%n", jse.getMessage());
            throw new DecodeException(s, "Cannot decode JSON representation provided !", jse);
            //If an DecodeException is throw by this method then the endpoint handler is not called even the 'error' method...
            //It's strange because, according to Javadoc of the error method, for a WebSocket Endpoint it must be the case:
            //http://docs.oracle.com/javaee/7/api/javax/websocket/Endpoint.html
            //"... conversion errors encoding incoming messages before any message handler has been called. These are modeled as DecodeExceptions"
            //http://docs.oracle.com/javaee/7/tutorial/doc/websocket009.htm
View Full Code Here

                    msg.setAction("patch");
                break;
            }
        } else {
          logger.severe(string);
            throw new DecodeException(string, "[Message] Can't decode.");
        }
        return msg;
    }
View Full Code Here

            } else {
                StringReader r = new StringReader(message);
                try {
                    return ((TextStream<?>) decoder).decode(r);
                } catch (IOException ioe) {
                    throw new DecodeException(message, sm.getString(
                            "pojoMessageHandlerWhole.decodeIoFail"), ioe);
                }
            }
        }
        return null;
View Full Code Here

                String name = pathParams[i].getName();
                String value = pathParameters.get(name);
                try {
                    result[i] = Util.coerceToType(type, value);
                } catch (Exception e) {
                    throw new DecodeException(value, sm.getString(
                            "pojoMethodMapping.decodePathParamFail",
                            value, type), e);
                }
            }
        }
View Full Code Here

TOP

Related Classes of javax.websocket.DecodeException

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.