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);
}
}