Package com.dyuproject.protostuff

Examples of com.dyuproject.protostuff.ProtostuffException


                value = ObjectSchema.getArrayClass(input, schema,
                        strategy.resolveClassFrom(input, true, true));
                break;
               
            default:
                throw new ProtostuffException("Corrupt input.");
        }
       
        if(input instanceof GraphInput)
        {
            // update the actual reference.
            ((GraphInput)input).updateLast(value, owner);
        }
       
        if(0 != input.readFieldNumber(schema))
            throw new ProtostuffException("Corrupt input.");
       
        return value;
    }
View Full Code Here


                ObjectSchema.transferClass(pipe, input, output, number, pipeSchema,
                        true, true, strategy);
                break;
               
            default:
                throw new ProtostuffException("Corrupt input.");
        }
       
        if(0 != input.readFieldNumber(pipeSchema.wrappedSchema))
            throw new ProtostuffException("Corrupt input.");
    }
View Full Code Here

     */
    public void mergeFrom(Input input, final Object owner) throws IOException
    {
        final int first = input.readFieldNumber(this);
        if(first != ID_POJO)
            throw new ProtostuffException("order not preserved.");
       
        doMergeFrom(input,
                strategy.resolvePojoFrom(input, ID_POJO).getSchema(),
                owner);
    }
View Full Code Here

                break;
            case ID_BIGINTEGER:
                value = BIGINTEGER.readFrom(input);
                break;
            default:
                throw new ProtostuffException("Corrupt input.");
        }
       
        if(input instanceof GraphInput)
        {
            // update the actual reference.
            ((GraphInput)input).updateLast(value, owner);
        }
       
        if(0 != input.readFieldNumber(schema))
            throw new ProtostuffException("Corrupt input.");
       
        return value;
    }
View Full Code Here

                    // update the actual reference.
                    ((GraphInput)input).updateLast(Collections.EMPTY_MAP, owner);
                }
               
                if(0 != input.readUInt32())
                    throw new ProtostuffException("Corrupt input.");
               
                ret = Collections.EMPTY_MAP;
                break;
               
            case ID_SINGLETON_MAP:
            {
                final Object map = iSingletonMap.newInstance();
                if(graph)
                {
                    // update the actual reference.
                    ((GraphInput)input).updateLast(map, owner);
                }
               
                if(0 != input.readUInt32())
                    throw new ProtostuffException("Corrupt input.");
               
                return fillSingletonMapFrom(input, schema, owner, strategy, graph, map);
            }
               
            case ID_UNMODIFIABLE_MAP:
                ret = readUnmodifiableMapFrom(input, schema, owner, strategy, graph,
                        iUnmodifiableMap.newInstance(), false);
                break;
               
            case ID_UNMODIFIABLE_SORTED_MAP:
                ret = readUnmodifiableMapFrom(input, schema, owner, strategy, graph,
                        iUnmodifiableSortedMap.newInstance(), true);
                break;
               
            case ID_SYNCHRONIZED_MAP:
                ret = readSynchronizedMapFrom(input, schema, owner, strategy, graph,
                        iSynchronizedMap.newInstance(), false);
                break;
               
            case ID_SYNCHRONIZED_SORTED_MAP:
                ret = readSynchronizedMapFrom(input, schema, owner, strategy, graph,
                        iSynchronizedSortedMap.newInstance(), true);
                break;
               
            case ID_CHECKED_MAP:
                ret = readCheckedMapFrom(input, schema, owner, strategy, graph,
                        iCheckedMap.newInstance(), false);
                break;
               
            case ID_CHECKED_SORTED_MAP:
                ret = readCheckedMapFrom(input, schema, owner, strategy, graph,
                        iCheckedSortedMap.newInstance(), true);
                break;
               
            case ID_ENUM_MAP:
            {
                final Map<?,Object> em = strategy.resolveEnumFrom(input).newEnumMap();
               
                if(input instanceof GraphInput)
                {
                    // update the actual reference.
                    ((GraphInput)input).updateLast(em, owner);
                }
               
                strategy.MAP_SCHEMA.mergeFrom(input, (Map<Object, Object>)em);
               
                return em;
            }
            case ID_MAP:
            {
                final Map<Object,Object> map =
                    strategy.resolveMapFrom(input).newMessage();
               
                if(input instanceof GraphInput)
                {
                    // update the actual reference.
                    ((GraphInput)input).updateLast(map, owner);
                }
               
                strategy.MAP_SCHEMA.mergeFrom(input, map);
               
                return map;
            }
           
            default:
                throw new ProtostuffException("Corrupt input.");
        }
       
        if(0 != input.readFieldNumber(schema))
            throw new ProtostuffException("Corrupt input.");
       
        return ret;
    }
View Full Code Here

                {
                    throw new RuntimeException(e);
                }
               
                if(0 != input.readFieldNumber(schema))
                    throw new ProtostuffException("Corrupt input.");
               
                return map;
            }
            default:
                throw new ProtostuffException("Corrupt input.");
        }
       
        final Wrapper wrapper = new Wrapper();
        Object k = input.mergeObject(wrapper, strategy.OBJECT_SCHEMA);
        if(!graph || !((GraphInput)input).isCurrentMessageReference())
            k = wrapper.value;
       
        switch(input.readFieldNumber(schema))
        {
            case 0:
                // key exists but null value
                try
                {
                    fSingletonMap_k.set(map, k);
                }
                catch (IllegalArgumentException e)
                {
                    throw new RuntimeException(e);
                }
                catch (IllegalAccessException e)
                {
                    throw new RuntimeException(e);
                }
               
                return map;
            case 3:
                // key and value exist
                break;
            default:
                throw new ProtostuffException("Corrupt input.");
        }
       
        Object v = input.mergeObject(wrapper, strategy.OBJECT_SCHEMA);
        if(!graph || !((GraphInput)input).isCurrentMessageReference())
            v = wrapper.value;
       
        try
        {
            fSingletonMap_k.set(map, k);
            fSingletonMap_v.set(map, v);
        }
        catch (IllegalArgumentException e)
        {
            throw new RuntimeException(e);
        }
        catch (IllegalAccessException e)
        {
            throw new RuntimeException(e);
        }
       
        if(0 != input.readFieldNumber(schema))
            throw new ProtostuffException("Corrupt input.");
       
        return map;
    }
View Full Code Here

        Object m = input.mergeObject(wrapper, strategy.POLYMORPHIC_MAP_SCHEMA);
        if(!graph || !((GraphInput)input).isCurrentMessageReference())
            m = wrapper.value;
       
        if(1 != input.readFieldNumber(schema))
            throw new ProtostuffException("Corrupt input.");
       
        Object keyType = input.mergeObject(wrapper, strategy.CLASS_SCHEMA);
        if(!graph || !((GraphInput)input).isCurrentMessageReference())
            keyType = wrapper.value;
       
        if(2 != input.readFieldNumber(schema))
            throw new ProtostuffException("Corrupt input.");
       
        Object valueType = input.mergeObject(wrapper, strategy.CLASS_SCHEMA);
        if(!graph || !((GraphInput)input).isCurrentMessageReference())
            valueType = wrapper.value;
       
View Full Code Here

                output.writeUInt32(number, input.readUInt32(), false);
                break;
               
            case ID_SINGLETON_MAP:
                if(0 != input.readUInt32())
                    throw new ProtostuffException("Corrupt input.");
               
                output.writeUInt32(number, 0, false);
               
                transferSingletonMap(pipeSchema, pipe, input, output, strategy);
                return;
               
            case ID_UNMODIFIABLE_MAP:
                output.writeObject(number, pipe, strategy.POLYMORPHIC_MAP_PIPE_SCHEMA, false);
                break;
               
            case ID_UNMODIFIABLE_SORTED_MAP:
                output.writeObject(number, pipe, strategy.POLYMORPHIC_MAP_PIPE_SCHEMA, false);
                break;
               
            case ID_SYNCHRONIZED_MAP:
                output.writeObject(number, pipe, strategy.POLYMORPHIC_MAP_PIPE_SCHEMA, false);
                break;
               
            case ID_SYNCHRONIZED_SORTED_MAP:
                output.writeObject(number, pipe, strategy.POLYMORPHIC_MAP_PIPE_SCHEMA, false);
                break;
               
            case ID_CHECKED_MAP:
                output.writeObject(number, pipe, strategy.POLYMORPHIC_MAP_PIPE_SCHEMA, false);
               
                if(1 != input.readFieldNumber(pipeSchema.wrappedSchema))
                    throw new ProtostuffException("Corrupt input.");
               
                output.writeObject(1, pipe, strategy.CLASS_PIPE_SCHEMA, false);
               
                if(2 != input.readFieldNumber(pipeSchema.wrappedSchema))
                    throw new ProtostuffException("Corrupt input.");
               
                output.writeObject(2, pipe, strategy.CLASS_PIPE_SCHEMA, false);
                break;
               
            case ID_CHECKED_SORTED_MAP:
                output.writeObject(number, pipe, strategy.POLYMORPHIC_MAP_PIPE_SCHEMA, false);
               
                if(1 != input.readFieldNumber(pipeSchema.wrappedSchema))
                    throw new ProtostuffException("Corrupt input.");
               
                output.writeObject(1, pipe, strategy.CLASS_PIPE_SCHEMA, false);
               
                if(2 != input.readFieldNumber(pipeSchema.wrappedSchema))
                    throw new ProtostuffException("Corrupt input.");
               
                output.writeObject(2, pipe, strategy.CLASS_PIPE_SCHEMA, false);
                break;
               
            case ID_ENUM_MAP:
                strategy.transferEnumId(input, output, number);
               
                if(output instanceof StatefulOutput)
                {
                    // update using the derived schema.
                    ((StatefulOutput)output).updateLast(strategy.MAP_PIPE_SCHEMA, pipeSchema);
                }
               
                Pipe.transferDirect(strategy.MAP_PIPE_SCHEMA, pipe, input, output);
                return;
            case ID_MAP:
                strategy.transferMapId(input, output, number);
               
                if(output instanceof StatefulOutput)
                {
                    // update using the derived schema.
                    ((StatefulOutput)output).updateLast(strategy.MAP_PIPE_SCHEMA, pipeSchema);
                }
               
                Pipe.transferDirect(strategy.MAP_PIPE_SCHEMA, pipe, input, output);
                return;
               
            default:
                throw new ProtostuffException("Corrupt input.");
        }
       
        if(0 != input.readFieldNumber(pipeSchema.wrappedSchema))
            throw new ProtostuffException("Corrupt input.");
    }
View Full Code Here

            {
                // key is null
                output.writeObject(3, pipe, strategy.OBJECT_PIPE_SCHEMA, false);
               
                if(0 != input.readFieldNumber(pipeSchema.wrappedSchema))
                    throw new ProtostuffException("Corrupt input.");
               
                return;
            }
            default:
                throw new ProtostuffException("Corrupt input.");
        }
       
        output.writeObject(1, pipe, strategy.OBJECT_PIPE_SCHEMA, false);
       
        switch(input.readFieldNumber(pipeSchema.wrappedSchema))
        {
            case 0:
                // key exists but null value
                return;
            case 3:
                // key and value exist
                break;
            default:
                throw new ProtostuffException("Corrupt input.");
        }
       
        output.writeObject(3, pipe, strategy.OBJECT_PIPE_SCHEMA, false);

        if(0 != input.readFieldNumber(pipeSchema.wrappedSchema))
            throw new ProtostuffException("Corrupt input.");
    }
View Full Code Here

    {
        final Class<?> componentType = strategy.resolveArrayComponentTypeFrom(
                input, mapped);
       
        if(input.readFieldNumber(schema) != ID_ARRAY_LEN)
            throw new ProtostuffException("Corrupt input.");
        final int len = input.readUInt32();
       
        if(input.readFieldNumber(schema) != ID_ARRAY_DIMENSION)
            throw new ProtostuffException("Corrupt input.");
        final int dimensions = input.readUInt32();
       
        if(dimensions == 1)
            return new ArrayWrapper(Array.newInstance(componentType, len));
       
View Full Code Here

TOP

Related Classes of com.dyuproject.protostuff.ProtostuffException

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.