mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

kenneth_suter
31.21.2007 a259c7bd8cbbf53d179d99c5cfd51e1f6eebfdb4
throw exceptions for backend operations when initialization fails
2 files modified
99 ■■■■■ changed files
opendj-sdk/opends/src/messages/messages/backend.properties 3 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java 96 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/messages/messages/backend.properties
@@ -943,3 +943,6 @@
 to a file: %s
SEVERE_WARN_TRUSTSTORE_SET_PERMISSIONS_FAILED_328=Failed to set permissions \
 on trust store file %s
SEVERE_ERR_ROOT_CONTAINER_NOT_INITIALIZED_329=The root container for backend \
  %s has not been initialized preventing this backend from processing the \
  requested operation
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
@@ -623,7 +623,18 @@
   */
  public long numSubordinates(DN entryDN) throws DirectoryException
  {
    EntryContainer ec = rootContainer.getEntryContainer(entryDN);
    EntryContainer ec;
    if (rootContainer != null)
    {
      ec = rootContainer.getEntryContainer(entryDN);
    }
    else
    {
      Message message = ERR_ROOT_CONTAINER_NOT_INITIALIZED.get(getBackendID());
      throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
              message);
    }
    if(ec == null)
    {
      return -1;
@@ -669,7 +680,19 @@
  public Entry getEntry(DN entryDN) throws DirectoryException
  {
    readerBegin();
    EntryContainer ec = rootContainer.getEntryContainer(entryDN);
    EntryContainer ec;
    if (rootContainer != null)
    {
      ec = rootContainer.getEntryContainer(entryDN);
    }
    else
    {
      Message message = ERR_ROOT_CONTAINER_NOT_INITIALIZED.get(getBackendID());
      throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
              message);
    }
    ec.sharedLock.lock();
    Entry entry;
    try
@@ -721,7 +744,19 @@
  {
    writerBegin();
    DN entryDN = entry.getDN();
    EntryContainer ec = rootContainer.getEntryContainer(entryDN);
    EntryContainer ec;
    if (rootContainer != null)
    {
      ec = rootContainer.getEntryContainer(entryDN);
    }
    else
    {
      Message message = ERR_ROOT_CONTAINER_NOT_INITIALIZED.get(getBackendID());
      throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
              message);
    }
    ec.sharedLock.lock();
    try
    {
@@ -771,7 +806,18 @@
  {
    writerBegin();
    EntryContainer ec = rootContainer.getEntryContainer(entryDN);
    EntryContainer ec;
    if (rootContainer != null)
    {
      ec = rootContainer.getEntryContainer(entryDN);
    }
    else
    {
      Message message = ERR_ROOT_CONTAINER_NOT_INITIALIZED.get(getBackendID());
      throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
              message);
    }
    ec.sharedLock.lock();
    try
    {
@@ -822,7 +868,18 @@
    writerBegin();
    DN entryDN = entry.getDN();
    EntryContainer ec = rootContainer.getEntryContainer(entryDN);
    EntryContainer ec;
    if (rootContainer != null)
    {
      ec = rootContainer.getEntryContainer(entryDN);
    }
    else
    {
      Message message = ERR_ROOT_CONTAINER_NOT_INITIALIZED.get(getBackendID());
      throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
              message);
    }
    ec.sharedLock.lock();
    try
@@ -878,8 +935,19 @@
      throws DirectoryException, CancelledOperationException
  {
    writerBegin();
    EntryContainer currentContainer = rootContainer.getEntryContainer(
        currentDN);
    EntryContainer currentContainer;
    if (rootContainer != null)
    {
      currentContainer = rootContainer.getEntryContainer(currentDN);
    }
    else
    {
      Message message = ERR_ROOT_CONTAINER_NOT_INITIALIZED.get(getBackendID());
      throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
              message);
    }
    EntryContainer container = rootContainer.getEntryContainer(entry.getDN());
    if (currentContainer != container)
@@ -935,8 +1003,18 @@
      throws DirectoryException
  {
    readerBegin();
    EntryContainer ec = rootContainer.getEntryContainer(
        searchOperation.getBaseDN());
    EntryContainer ec;
    if (rootContainer != null)
    {
      ec = rootContainer.getEntryContainer(searchOperation.getBaseDN());
    }
    else
    {
      Message message = ERR_ROOT_CONTAINER_NOT_INITIALIZED.get(getBackendID());
      throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
              message);
    }
    ec.sharedLock.lock();
    try