Package com.persistit.exception

Examples of com.persistit.exception.ConversionException


                if (context == _secondaryKeyTupleList.get(index)) {
                    return (Builder) context;
                }
            }
        }
        throw new ConversionException("No such Builder " + context);
    }
View Full Code Here


        throw new ConversionException("No such Builder " + context);
    }

    private void checkKeyAccessors() {
        if (_keyBuilder.getSize() == 0) {
            throw new ConversionException("ObjectCoder for class " + getClientClass().getName()
                    + " has no Key fields or properties");
        }
    }
View Full Code Here

        }

        @Override
        public void defaultReadObject() {
            if (_value._currentCoder == null || _value._currentObject == null) {
                throw new ConversionException("not in call to readObject");
            }
            _value._currentCoder.renderDefaultFields(_value, _value._currentObject);
        }
View Full Code Here

        ObjectStreamClass _classDescriptor;

        private OldValueInputStream(final Value value, final ObjectStreamClass classDescriptor) throws IOException {
            this(value);
            if (classDescriptor == null) {
                throw new ConversionException("Null class descriptor");
            }
            _value = value;
            _classDescriptor = classDescriptor;
        }
View Full Code Here

                ObjectStreamClass classDescriptor = null;
                if (classInfo != null) {
                    classDescriptor = classInfo.getClassDescriptor();
                }
                if (classDescriptor == null) {
                    throw new ConversionException("Unknown class handle " + handle);
                }
                return classDescriptor;
            } else {
                _innerClassDescriptor = true;
                return _classDescriptor;
View Full Code Here

        boolean _innerClassDescriptor;

        OldValueOutputStream(final Value value, final ObjectStreamClass classDescriptor) throws IOException {
            this(value);
            if (classDescriptor == null) {
                throw new ConversionException("Null class descriptor");
            }
            _classDescriptor = classDescriptor;
        }
View Full Code Here

                try {
                    ex.clear().append(BY_HANDLE).append(handle).fetch();
                    txn.commit();
                } catch (final Exception e) {
                    _persistit.getLogBase().exception.log(e);
                    throw new ConversionException(e);
                } finally {
                    txn.end();
                }
                final Value value = ex.getValue();
                if (value.isDefined()) {
                    value.setStreamMode(true);
                    final int storedId = value.getInt();
                    final String storedName = value.getString();
                    final long storedSuid = value.getLong();
                    if (storedId != handle) {
                        throw new IllegalStateException("ClassInfo stored for handle=" + handle
                                + " has invalid stored handle=" + storedId);
                    }
                    final Class<?> cl = Class
                            .forName(storedName, false, Thread.currentThread().getContextClassLoader());

                    long suid = 0;
                    final ObjectStreamClass osc = ObjectStreamClass.lookupAny(cl);
                    if (osc != null)
                        suid = osc.getSerialVersionUID();
                    if (storedSuid != suid) {
                        throw new ConversionException("Class " + cl.getName() + " persistent SUID=" + storedSuid
                                + " does not match current class SUID=" + suid);
                    }
                    final ClassInfo ci = new ClassInfo(cl, suid, handle, osc);
                    hashClassInfo(ci);
                    return ci;
                } else {
                    final ClassInfo ci = new ClassInfo(null, 0, handle, null);
                    hashClassInfo(ci);
                    return ci;
                }
            } catch (final ClassNotFoundException cnfe) {
                throw new ConversionException(cnfe);
            } catch (final PersistitException pe) {
                throw new ConversionException(pe);
            } finally {
                if (ex != null) {
                    releaseExchange(ex);
                }
            }
View Full Code Here

                        handle = value.getInt();
                        final String storedName = value.getString();
                        final long storedSuid = value.getLong();

                        if (storedSuid != suid || !clazz.getName().equals(storedName)) {
                            throw new ConversionException("Class " + clazz.getName() + " persistent SUID=" + storedSuid
                                    + " does not match current class SUID=" + suid);
                        }
                        ci = new ClassInfo(clazz, suid, handle, osc);
                    } else {
                        //
                        // Store a new ClassInfo record
                        //
                        ex.clear().append(NEXT_ID).fetch();
                        handle = Math.max(_testIdFloor, value.isDefined() ? value.getInt() : HANDLE_BASE) + 1;
                        value.clear().put(handle);
                        ex.store();

                        value.clear();
                        value.setStreamMode(true);
                        value.put(handle);
                        value.put(clazz.getName());
                        value.put(suid);

                        ex.clear().append(BY_NAME).append(clazz.getName()).append(suid).store();

                        ex.clear().append(BY_HANDLE).append(handle).store();

                        ci = new ClassInfo(clazz, suid, handle, osc);
                    }
                    txn.commit();
                    hashClassInfo(ci);
                    return ci;
                } finally {
                    txn.end();
                }
            } catch (final PersistitException pe) {
                throw new ConversionException(pe);
            } finally {
                if (ex != null) {
                    releaseExchange(ex);
                }
                _persistit.setSessionId(saveSessionId);
View Full Code Here

    private Exchange getExchange() throws PersistitException {
        try {
            final Volume volume = _persistit.getSystemVolume();
            return _persistit.getExchange(volume, CLASS_INDEX_TREE_NAME, true);
        } catch (final PersistitException pe) {
            throw new ConversionException(pe);
        }
    }
View Full Code Here

        final KeyCoder coder = _persistit.lookupKeyCoder(cl);
        if (coder != null) {
            return appendByKeyCoder(object, cl, coder, context);
        }

        throw new ConversionException("Object class " + object.getClass().getName() + " can't be used in a Key");
    }
View Full Code Here

TOP

Related Classes of com.persistit.exception.ConversionException

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.