Package org.helidb.lang

Examples of org.helidb.lang.DatabaseException


        break;
      }

      if (recordLen < 1L)
      {
        throw new DatabaseException("Invalid record length " + recordLen + " at position " + curPos);
      }
      curPos += recordLen;
      if (curPos > fileLen)
      {
        // An incomplete last entry. If the database crashed while
View Full Code Here


      {
        m_updateOperation.rollback(recLen);
      }
      else
      {
        throw new DatabaseException("Unknown database operation " + opCode);
      }
    }
    clearAndCloseFile();
  }
View Full Code Here

        throw new IllegalStateException("The database is closed");
      }

      if (m_cannotCommit)
      {
        throw new DatabaseException("This should only be seen during unit test runs");
      }

      m_backend.commit();
    }
    finally
View Full Code Here

    {
      return NodeHeader.valueOf((byte) b);
    }
    catch (IllegalArgumentException e)
    {
      throw new DatabaseException("At position " + pos, e);
    }
  }
View Full Code Here

    }

    BPlusTreeNode<K, ?> res = readNodeOrNull(pos, keyForFirstPointer).getSecond();
    if (res == null)
    {
      throw new DatabaseException("The node at position " + pos + " is deleted");
    }
    return res;
  }
View Full Code Here

{
  @Test
  public void testSerializeAndInterpret()
  {
    Serializer<Exception> ser = new SerializableSerializer<Exception>();
    byte[] barr = ser.serialize(new DatabaseException("foo"));
    assertEquals("foo", ser.interpret(barr).getMessage());
  }
View Full Code Here

    assertNotClosed();
    NodeSearchResult<K, V> nsr = findNodeFor(key, m_rootNodePosition, null, new LinkedList<BPlusTreeNonLeafNode<K>>());
    if (nsr == null)
    {
      // Empty file. Should not happen on writing operations.
      throw new DatabaseException("The B+ Tree index file was empty");
    }

    if (findRecord(key, nsr.m_node.getRecords()) >= 0)
    {
      throw new KeyExistsException("The key " + key + " already exists in the tree");
View Full Code Here

    assertNotClosed();
    NodeSearchResult<K, V> nsr = findNodeFor(key, m_rootNodePosition, null, new LinkedList<BPlusTreeNonLeafNode<K>>());
    if (nsr == null)
    {
      // Empty file. Should not happen on writing operations.
      throw new DatabaseException("The B+ Tree index file was empty");
    }
    List<KeyAndValue<K, V>> records = nsr.m_node.getRecords();
    int pos = findRecord(key, records);
    if (pos < 0)
    {
View Full Code Here

    NodeSearchResult<K, V> nsr = findNodeFor(key, m_rootNodePosition, null, new LinkedList<BPlusTreeNonLeafNode<K>>());
    if (nsr == null)
    {
      // Empty file. Should not happen on writing operations.
      throw new DatabaseException("The B+ Tree index file was empty");
    }
    List<KeyAndValue<K, V>> records = nsr.m_node.getRecords();
    int pos = findRecord(key, records);
    if (pos < 0)
    {
View Full Code Here

    assertNotClosed();
    NodeSearchResult<K, V> nsr = findNodeFor(key, m_rootNodePosition, null, new LinkedList<BPlusTreeNonLeafNode<K>>());
    if (nsr == null)
    {
      // Empty file. Should not happen on writing operations.
      throw new DatabaseException("The B+ Tree index file was empty");
    }
    BPlusTreeLeafNode<K, V> node = nsr.m_node;
    int pos = findRecord(key, node.getRecords());
    if (pos < 0)
    {
View Full Code Here

TOP

Related Classes of org.helidb.lang.DatabaseException

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.