Examples of MessageTypeException


Examples of org.marian.core.exceptions.MessageTypeException

            e = UtlXML.xSearchElement(this.root, expr);
        } catch (XPathExpressionException ex) {
            throw new RuntimeException("Internal error", ex);
        }
        if (e == null)
          throw new MessageTypeException("Unknown message type: "+messageType);
       
        // Instantiate the class
        String class_name = e.getAttribute(MessageTypesXML.ATTR_PROCESSOR);
        MessageProcessor mp;
        try {
          mp = (MessageProcessor) Class.forName(class_name).newInstance();
        } catch (Exception ex)
        {
          throw new MessageTypeException("Error instantiating the class: "+e.toString());
        }
        if (mp == null)
          throw new MessageTypeException("It's not a processor: "+class_name);
       
        // Return the processor
        return mp;
    }
View Full Code Here

Examples of org.msgpack.MessageTypeException

    private LongTemplate() { }

    public void write(Packer pk, Long target, boolean required) throws IOException {
        if (target == null) {
            if (required) {
                throw new MessageTypeException("Attempted to write null");
            }
            pk.writeNil();
            return;
        }
        pk.writeLong(target);
View Full Code Here

Examples of org.msgpack.MessageTypeException

        } else if(d.bitLength() == 64 && d.signum() == 1) {
            // unsigned 64
            out.writeByteAndLong((byte)0xcf, d.longValue());
            stack.reduceCount();
        } else {
            throw new MessageTypeException("MessagePack can't serialize BigInteger larger than (2^64)-1");
        }
    }
View Full Code Here

Examples of org.msgpack.MessageTypeException

        // TODO encoding error
        byte[] b;
        try {
            b = s.getBytes("UTF-8");
        } catch (UnsupportedEncodingException ex) {
            throw new MessageTypeException();
        }
        writeByteArray(b, 0, b.length);
        stack.reduceCount();
    }
View Full Code Here

Examples of org.msgpack.MessageTypeException

    }

    @Override
    public void writeArrayEnd(boolean check) throws IOException {
        if(!stack.topIsArray()) {
            throw new MessageTypeException("writeArrayEnd() is called but writeArrayBegin() is not called");
        }

        int remain = stack.getTopCount();
        if(remain > 0) {
            if(check) {
                throw new MessageTypeException("writeArrayEnd(check=true) is called but the array is not end: "+remain);
            }
            for(int i=0; i < remain; i++) {
                writeNil();
            }
        }
View Full Code Here

Examples of org.msgpack.MessageTypeException

    }

    @Override
    public void writeMapEnd(boolean check) throws IOException {
        if(!stack.topIsMap()) {
            throw new MessageTypeException("writeMapEnd() is called but writeMapBegin() is not called");
        }

        int remain = stack.getTopCount();
        if(remain > 0) {
            if(check) {
                throw new MessageTypeException("writeMapEnd(check=true) is called but the map is not end: "+remain);
            }
            for(int i=0; i < remain; i++) {
                writeNil();
            }
        }
View Full Code Here

Examples of org.msgpack.MessageTypeException

    public void write(Packer pk, List<E> target, boolean required) throws IOException {
        if (! (target instanceof List)) {
            if (target == null) {
                if (required) {
                    throw new MessageTypeException("Attempted to write null");
                }
                pk.writeNil();
                return;
            }
            throw new MessageTypeException("Target is not a List but " + target.getClass());
        }
        pk.writeArrayBegin(target.size());
        for (E e : target) {
            elementTemplate.write(pk, e);
        }
View Full Code Here

Examples of org.msgpack.MessageTypeException

    private IntegerArrayTemplate() { }

    public void write(Packer pk, int[] target, boolean required) throws IOException {
        if (target == null) {
            if (required) {
                throw new MessageTypeException("Attempted to write null");
            }
            pk.writeNil();
            return;
        }
        pk.writeArrayBegin(target.length);
View Full Code Here

Examples of org.msgpack.MessageTypeException

    protected Value nextValue() {
        try {
            Object obj = parser.parse(in);
            return objectToValue(obj);
        } catch (ParseException e) { // FIXME exception
            throw new MessageTypeException(e);
        } catch (IOException e) { // FIXME exception
            throw new MessageTypeException(e);
        }
    }
View Full Code Here

Examples of org.msgpack.MessageTypeException

            ((MessagePackable) target).writeTo(pk);
            return;
        }
        Template<Object> tmpl = registry.tryLookup(lookupType);
        if (tmpl == this || tmpl == null) {
            throw new MessageTypeException("Template lookup fail: " + lookupType);
        }
        tmpl.write(pk, target);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.