Package com.orientechnologies.orient.core.exception

Examples of com.orientechnologies.orient.core.exception.OSerializationException


  public byte[] toStream(final ODatabaseRecord iDatabase, Object iObject) throws IOException {
    if (iObject == null)
      return null;

    if (((ORecord<?>) iObject).getIdentity() == null)
      throw new OSerializationException("Can't serialize record without identity. Store it before to serialize.");

    final StringBuilder buffer = OStreamSerializerHelper.writeRecordType(iObject.getClass(), new StringBuilder());
    buffer.append(((ORecord<?>) iObject).getIdentity().toString());

    return OBinaryProtocol.string2bytes(buffer.toString());
View Full Code Here


  public byte[] toStream(final ODatabaseRecord iDatabase, final Object iObject) throws IOException {
    if (iObject == null)
      return null;

    if (!(iObject instanceof OSerializableStream))
      throw new OSerializationException("Can't serialize the object [" + iObject.getClass() + ":" + iObject
          + "] since it not implements the OSerializableStream interface");

    OSerializableStream stream = (OSerializableStream) iObject;

    // SERIALIZE THE CLASS NAME
View Full Code Here

  @Override
  protected StringBuilder toString(ORecordInternal<?> iRecord, final StringBuilder iOutput, final String iFormat,
      final OUserObject2RecordHandler iObjHandler, final Set<Integer> iMarshalledRecords, final boolean iOnlyDelta) {
    if (!(iRecord instanceof ODocument))
      throw new OSerializationException("Can't marshall a record of type " + iRecord.getClass().getSimpleName() + " to CSV");

    final ODocument record = (ODocument) iRecord;

    // CHECK IF THE RECORD IS PENDING TO BE MARSHALLED
    final Integer identityRecord = System.identityHashCode(record);
View Full Code Here

          else
            parameters.put(p.getKey(), p.getValue());
        }
      }
    } catch (IOException e) {
      throw new OSerializationException("Error while unmarshalling OCommandRequestTextAbstract impl", e);
    }
    return this;
  }
View Full Code Here

        param.field("params", parameters);
        buffer.add(param.toStream());
      }

    } catch (IOException e) {
      throw new OSerializationException("Error while marshalling OCommandRequestTextAbstract impl", e);
    }

    return buffer.toByteArray();
  }
View Full Code Here

   * @param iValue
   */
  public StringBuilder toStream(final ODatabaseComplex<?> iDatabase, final StringBuilder iOutput, Object iValue) {
    if (iValue != null) {
            if (!(iValue instanceof OSerializableStream))
                throw new OSerializationException("Can't serialize the object since it's not implements the OSerializableStream interface");

      OSerializableStream stream = (OSerializableStream) iValue;
      iOutput.append(iValue.getClass().getName());
      iOutput.append(OStreamSerializerHelper.SEPARATOR);
      iOutput.append(OBinaryProtocol.bytes2string(stream.toStream()));
View Full Code Here

          // DETERMINE TYPE BY REFLECTION
          type = getFieldType(iUserObject, iFieldName);
        }

        if (type == null)
          throw new OSerializationException("Linked type of field " + iFieldName + " in class " + iRoot.getClassName() + " is null");

        Object fieldValue = null;
        Class<?> fieldClass;
        boolean propagate = false;
View Full Code Here

          iFieldValue = toStream(iFieldValue, linkedDocument, iEntityManager, linkedDocument.getSchemaClass(), iObj2RecHandler, db,
              iSaveOnlyDirty);

        } else
          throw new OSerializationException("Linked type [" + iFieldValue.getClass() + ":" + iFieldValue
              + "] can't be serialized because is not part of registered entities. To fix this error register this class");
      }
    }
    return iFieldValue;
  }
View Full Code Here

      // VALUES WILL BE LOADED LAZY
      values = (V[]) new Object[pageSize];

      return this;
    } catch (IOException e) {
      throw new OSerializationException("Can't unmarshall RB+Tree node", e);
    } finally {
      OProfiler.getInstance().stopChrono("OMVRBTreeEntryP.fromStream", timer);
    }
  }
View Full Code Here

      record.fromStream(buffer);
      return buffer;

    } catch (IOException e) {
      throw new OSerializationException("Can't marshall RB+Tree node", e);
    } finally {
      marshalledRecords.remove(identityRecord);

      checkEntryStructure();
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.exception.OSerializationException

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.