Package com.orientechnologies.orient.core.exception

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


      record.fromStream(buffer);
      return buffer;

    } catch (IOException e) {
      throw new OSerializationException("Cannot marshall RB+Tree node", e);
    } finally {
      PROFILER.stopChrono(PROFILER.getProcessMetric("mvrbtree.entry.toStream"), "Serialize a MVRBTree entry", timer);
    }
  }
View Full Code Here


    int currentVersion = OIntegerSerializer.INSTANCE.deserializeLiteral(inBuffer, offset);
    offset += OIntegerSerializer.INT_SIZE;

    if (currentVersion != CURRENT_VERSION)
      throw new OSerializationException("MVRBTree node is stored using " + currentVersion
          + " version of serialization format but current version is " + CURRENT_VERSION + ".");

    pageSize = OIntegerSerializer.INSTANCE.deserializeLiteral(inBuffer, offset);
    offset += OIntegerSerializer.INT_SIZE;
View Full Code Here

      byte[] buffer = new byte[size];
      segment.getFile().read(OBinaryProtocol.SIZE_INT, buffer, size);

      fromStream(buffer);
    } catch (Exception e) {
      throw new OSerializationException("Cannot load database's configuration. The database seems to be corrupted.", e);
    }
    return this;
  }
View Full Code Here

      f.write(OBinaryProtocol.SIZE_INT, buffer);
      if (OGlobalConfiguration.STORAGE_CONFIGURATION_SYNC_ON_UPDATE.getValueAsBoolean())
        f.synch();

    } catch (Exception e) {
      throw new OSerializationException("Error on update storage configuration", e);
    }
  }
View Full Code Here

      return (OBinarySerializer<K>) new OSimpleKeySerializer();

    if (streamKeySerializer instanceof OStreamSerializerLong)
      return (OBinarySerializer<K>) OLongSerializer.INSTANCE;

    throw new OSerializationException("Given serializer " + streamKeySerializer.getClass().getName()
        + " can not be converted into " + OBinarySerializer.class.getName() + ".");
  }
View Full Code Here

          if (uncertainType)
            record.setFieldType(fieldName, null);
        }
      } catch (Exception e) {
        throw new OSerializationException("Error on unmarshalling field '" + fieldName + "' in record " + iRecord.getIdentity()
            + " with value: " + fieldEntry, e);
      }
    }

    return iRecord;
View Full Code Here

  @Override
  protected StringBuilder toString(ORecord iRecord, final StringBuilder iOutput, final String iFormat,
      OUserObject2RecordHandler iObjHandler, final Set<ODocument> iMarshalledRecords, final boolean iOnlyDelta,
      final boolean autoDetectCollectionType) {
    if (iRecord == null)
      throw new OSerializationException("Expected a record but was null");

    if (!(iRecord instanceof ODocument))
      throw new OSerializationException("Cannot marshall a record of type " + iRecord.getClass().getSimpleName());

    final ODocument record = (ODocument) iRecord;

    // CHECK IF THE RECORD IS PENDING TO BE MARSHALLED
    if (iMarshalledRecords != null)
View Full Code Here

            if (i < iMinPosSeparatorAreValid || insideParenthesis > 0 || insideList > 0 || !isCharPresent(c, iSeparator))
              insideList++;
          } else if (c == LIST_END) {
            if (i < iMinPosSeparatorAreValid || insideParenthesis > 0 || insideList > 0 || !isCharPresent(c, iSeparator)) {
              if (insideList == 0)
                throw new OSerializationException("Found invalid " + LIST_END + " character at position " + i + " of text "
                    + new String(iSource) + ". Ensure it is opened and closed correctly.");
              insideList--;
            }
          } else if (c == EMBEDDED_BEGIN) {
            insideParenthesis++;
          } else if (c == EMBEDDED_END) {
            // if (!isCharPresent(c, iRecordSeparator)) {
            if (insideParenthesis == 0)
              throw new OSerializationException("Found invalid " + EMBEDDED_END + " character at position " + i + " of text "
                  + new String(iSource) + ". Ensure it is opened and closed correctly.");
            // }
            insideParenthesis--;

          } else if (c == MAP_BEGIN) {
            insideMap++;
          } else if (c == MAP_END) {
            if (i < iMinPosSeparatorAreValid || !isCharPresent(c, iSeparator)) {
              if (insideMap == 0)
                throw new OSerializationException("Found invalid " + MAP_END + " character at position " + i + " of text "
                    + new String(iSource) + ". Ensure it is opened and closed correctly.");
              insideMap--;
            }
          } else if (c == LINK)
            // FIRST PART OF LINK
            insideLinkPart = 1;
          else if (insideLinkPart == 1 && c == ORID.SEPARATOR)
            // SECOND PART OF LINK
            insideLinkPart = 2;
          else {
            if (iConsiderSets)
              if (c == SET_BEGIN)
                insideSet++;
              else if (c == SET_END) {
                if (i < iMinPosSeparatorAreValid || !isCharPresent(c, iSeparator)) {
                  if (insideSet == 0)
                    throw new OSerializationException("Found invalid " + SET_END + " character at position " + i + " of text "
                        + new String(iSource) + ". Ensure it is opened and closed correctly.");
                  insideSet--;
                }
              }
            if (considerBags) {
              if (c == BAG_BEGIN)
                insideBag++;
              else if (c == BAG_END)
                if (!isCharPresent(c, iSeparator)) {
                  if (insideBag == 0)
                    throw new OSerializationException("Found invalid " + BAG_BEGIN
                        + " character. Ensure it is opened and closed correctly.");
                  insideBag--;
                }
            }
          }
View Full Code Here

        docClone.removeField(ODocumentSerializable.CLASS_NAME);
        documentSerializable.fromDocument(docClone);

        return documentSerializable;
      } catch (InstantiationException e) {
        throw new OSerializationException("Cannot serialize the object", e);
      } catch (IllegalAccessException e) {
        throw new OSerializationException("Cannot serialize the object", e);
      }
    }

    return instance;
  }
View Full Code Here

    if (iValue != null) {
      if (iValue instanceof ODocumentSerializable)
        iValue = ((ODocumentSerializable) iValue).toDocument();

      if (!(iValue instanceof OSerializableStream))
        throw new OSerializationException("Cannot 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

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.