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

gbellato
05.19.2007 6a463421b18317cc8a4e4b4d32eb1ab4cb38cf79
Fix for issue 1874, 1875

- remove one call to printStackTrace.
- clean error handling in the ReplicationDomain creator method
3 files modified
81 ■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/messages/ToolMessages.java 7 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java 12 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java 62 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/messages/ToolMessages.java
@@ -9263,8 +9263,11 @@
                    "None of the Directory Server backends are configured " +
                    "with the requested backend ID \"%s\"");
    registerMessage(MSGID_LDIFIMPORT_CANNOT_IMPORT,
                    "The Directory Server backend with backend ID %s does " +
                    "not provide a mechanism for performing LDIF imports");
                    "The Directory Server backend for base DN %s does " +
                    "not provide a mechanism for performing LDIF imports. " +
                    "The replication will proceed but it will not be " +
                    "possible to perform total update on this " +
                    "ReplicationDomain");
    registerMessage(MSGID_LDIFIMPORT_CANNOT_DECODE_EXCLUDE_BASE,
                    "Unable to decode exclude branch string \"%s\" as a " +
                    "valid distinguished name:  %s");
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java
@@ -176,10 +176,8 @@
   * Start the ReplicationBroker.
   *
   * @param servers list of servers used
   * @throws Exception : in case of errors
   */
  public void start(Collection<String> servers)
                    throws Exception
  {
    /*
     * Open Socket to the ReplicationServer
@@ -207,7 +205,7 @@
   * @throws NumberFormatException address was invalid
   * @throws IOException error during connection phase
   */
  private void connect() throws NumberFormatException, IOException
  private void connect()
  {
    ReplServerStartMessage startMsg;
@@ -399,7 +397,13 @@
            {
              if (session != null)
              {
                session.close();
                try
                {
                  session.close();
                } catch (IOException e)
                {
                  // The session was already closed, just ignore.
                }
                session = null;
              }
            }
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java
@@ -366,25 +366,22 @@
    /*
     * create the broker object used to publish and receive changes
     */
    broker = new ReplicationBroker(state, baseDN, serverId, maxReceiveQueue,
        maxReceiveDelay, maxSendQueue, maxSendDelay, window,
        heartbeatInterval);
    broker.start(replicationServers);
    // Retrieves the related backend and its config entry
    try
    {
      broker = new ReplicationBroker(state, baseDN, serverId, maxReceiveQueue,
          maxReceiveDelay, maxSendQueue, maxSendDelay, window,
          heartbeatInterval);
      synchronized (broker)
      {
        broker.start(replicationServers);
      }
      // Retrieves the related backend and its config entry
      retrievesBackendInfos(baseDN);
    } catch (Exception e)
    } catch (DirectoryException e)
    {
     /* TODO should mark that replicationServer service is
      * not available, log an error and retry upon timeout
      * should we stop the modifications ?
      */
      // The backend associated to this suffix is not able to
      // perform export and import.
      // The replication can continue but this replicationDomain
      // won't be able to use total update.
    }
    /*
@@ -2076,18 +2073,8 @@
    state.loadState();
    disabled = false;
    try
    {
      broker.start(replicationServers);
    } catch (Exception e)
    {
      /* TODO should mark that replicationServer service is
       * not available, log an error and retry upon timeout
       * should we stop the modifications ?
       */
      e.printStackTrace();
      return;
    }
    broker.start(replicationServers);
    createListeners();
  }
@@ -2394,23 +2381,22 @@
          ResultCode.OTHER, message, msgID, null);
    }
    if (! domainBackend.supportsLDIFExport())
    {
      int    msgID   = MSGID_LDIFIMPORT_CANNOT_IMPORT;
      String message = getMessage(msgID, domainBackend.getBackendID());
      logError(ErrorLogCategory.BACKEND,
          ErrorLogSeverity.SEVERE_ERROR, message, msgID);
      throw new DirectoryException(
          ResultCode.OTHER, message, msgID, null);
    }
    this.backend = domainBackend;
    this.branches = new ArrayList<DN>(backendCfg.getBackendBaseDN().size());
    for (DN dn : backendCfg.getBackendBaseDN())
    {
      this.branches.add(dn);
    }
    if (! domainBackend.supportsLDIFImport())
    {
      int    msgID   = MSGID_LDIFIMPORT_CANNOT_IMPORT;
      String message = getMessage(msgID, baseDN);
      logError(ErrorLogCategory.SYNCHRONIZATION,
          ErrorLogSeverity.NOTICE, message, msgID);
      throw new DirectoryException(
          ResultCode.OTHER, message, msgID, null);
    }
  }