Package voldemort.serialization

Examples of voldemort.serialization.SerializationException


    private void writeDate(DataOutputStream output, Date d) throws IOException {
        if(d == null)
            output.writeLong(Long.MIN_VALUE);
        else if(d.getTime() == Long.MIN_VALUE)
            throw new SerializationException("Underflow: attempt to store "
                                             + new Date(Long.MIN_VALUE)
                                             + " in date, but that value is reserved for null.");
        else
            output.writeLong(d.getTime());
    }
View Full Code Here


            output.writeByte(-1);
            return;
        } else {
            output.writeByte(1);
            if(object.size() != type.size())
                throw new SerializationException("Invalid map for serialization, expected: " + type
                                                 + " but got " + object);
            for(Map.Entry<String, Object> entry: type.entrySet()) {
                if(!object.containsKey(entry.getKey()))
                    throw new SerializationException("Missing property: " + entry.getKey()
                                                     + " that is required by the type (" + type
                                                     + ")");
                try {
                    write(output, object.get(entry.getKey()), entry.getValue());
                } catch(SerializationException e) {
                    throw new SerializationException("Fail to write property: " + entry.getKey(), e);
                }
            }
        }
    }
View Full Code Here

    }

    private void writeList(DataOutputStream output, List<Object> objects, List<Object> type)
            throws IOException {
        if(type.size() != 1)
            throw new SerializationException("Invalid type: expected single value type in list: "
                                             + type);
        Object entryType = type.get(0);
        if(objects == null) {
            writeLength(output, -1);
        } else {
View Full Code Here

        if(size < Short.MAX_VALUE) {
            stream.writeShort(size);
        } else if(size <= MAX_SEQ_LENGTH) {
            stream.writeInt(size | 0xC0000000);
        } else {
            throw new SerializationException("Invalid length: maximum is " + MAX_SEQ_LENGTH);
        }
    }
View Full Code Here

                throw new EndOfFileException();
            default:
                if(Character.isDigit(current()) || current() == '-') {
                    o = readNumber();
                } else {
                    throw new SerializationException("Unacceptable initial character "
                                                     + currentChar()
                                                     + " found when parsing object at line "
                                                     + getCurrentLineNumber() + " character "
                                                     + getCurrentLineOffset());
                }
View Full Code Here

                next();
                skipWhitespace();
            } else if(current() == '}') {
                break;
            } else {
                throw new SerializationException("Unexpected character '"
                                                 + currentChar()
                                                 + "' in object definition, expected '}' or ',' but found: "
                                                 + getCurrentContext());
            }
        }
View Full Code Here

                break;
            case 'u':
                buffer.append(readUnicodeLiteral());
                break;
            default:
                throw new SerializationException("Unrecognized control sequence on line "
                                                 + getCurrentLineNumber() + ": '\\" + currentChar()
                                                 + "'.");
        }
    }
View Full Code Here

            else if('a' <= current() && 'f' >= current())
                value += 10 + current() - 'a';
            else if('A' <= current() && 'F' >= current())
                value += 10 + current() - 'A';
            else
                throw new SerializationException("Invalid character in unicode sequence on line "
                                                 + getCurrentLineNumber() + ": " + currentChar());
        }

        return (char) value;
    }
View Full Code Here

            doublePiece *= Math.pow(10, frac);
        }
        if(isTerminator(current()))
            return doublePiece;
        else
            throw new SerializationException("Invalid number format for number on line "
                                             + lineOffset + ": " + getCurrentContext());
    }
View Full Code Here

        } else {
            isPositive = true;
        }
        skipWhitespace();
        if(!Character.isDigit(current()))
            throw new SerializationException("Expected a digit while trying to parse number, but got '"
                                             + currentChar()
                                             + "' at line "
                                             + getCurrentLineNumber()
                                             + " character "
                                             + getCurrentLineOffset() + ": " + getCurrentContext());
View Full Code Here

TOP

Related Classes of voldemort.serialization.SerializationException

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.