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

boli
01.27.2007 455897cc245b67d929f409a93cfa7106e835cc1f
opends/src/server/org/opends/server/tools/LDAPCompare.java
@@ -51,6 +51,7 @@
import org.opends.server.protocols.ldap.ProtocolOp;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.NullOutputStream;
import org.opends.server.types.DebugLogLevel;
import org.opends.server.util.Base64;
import org.opends.server.util.PasswordReader;
import org.opends.server.util.args.ArgumentException;
@@ -60,7 +61,8 @@
import org.opends.server.util.args.IntegerArgument;
import org.opends.server.util.args.StringArgument;
import static org.opends.server.loggers.Debug.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCought;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.ToolMessages.*;
import static org.opends.server.protocols.ldap.LDAPResultCode.*;
@@ -75,7 +77,7 @@
public class LDAPCompare
{
  /**
   * The fully-qualified name of this class for debugging purposes.
   * The fully-qualified name of this class.
   */
  private static final String CLASS_NAME =
      "org.opends.server.tools.LDAPCompare";
@@ -208,11 +210,15 @@
             LDAPMessage.decode(ASN1Sequence.decodeAsSequence(element));
      } catch(ASN1Exception ae)
      {
        assert debugException(CLASS_NAME, "executeCompare", ae);
        if(!compareOptions.continueOnError())
        if (debugEnabled())
        {
          debugCought(DebugLogLevel.ERROR, ae);
        }
        if (!compareOptions.continueOnError())
        {
          throw new IOException(ae.getMessage());
        } else
        }
        else
        {
          msgID = MSGID_OPERATION_FAILED;
          String msg = getMessage(msgID, "COMPARE", line, ae.getMessage());
@@ -594,7 +600,10 @@
        }
        catch (ParseException e)
        {
          assert debugException(CLASS_NAME, "main", e);
          if (debugEnabled())
          {
            debugCought(DebugLogLevel.ERROR, e);
          }
          int msgID = MSGID_COMPARE_CANNOT_BASE64_DECODE_ASSERTION_VALUE;
          err.println(wrapText(getMessage(msgID), MAX_LINE_WIDTH));
@@ -631,7 +640,10 @@
      portNumber = port.getIntValue();
    } catch (ArgumentException ae)
    {
      assert debugException(CLASS_NAME, "main", ae);
      if (debugEnabled())
      {
        debugCought(DebugLogLevel.ERROR, ae);
      }
      err.println(wrapText(ae.getMessage(), MAX_LINE_WIDTH));
      return 1;
    }
@@ -648,7 +660,10 @@
      connectionOptions.setVersionNumber(versionNumber);
    } catch(ArgumentException ae)
    {
      assert debugException(CLASS_NAME, "main", ae);
      if (debugEnabled())
      {
        debugCought(DebugLogLevel.ERROR, ae);
      }
      err.println(wrapText(ae.getMessage(), MAX_LINE_WIDTH));
      return 1;
    }
@@ -667,7 +682,10 @@
        bindPasswordValue = new String(pwChars);
      } catch(Exception ex)
      {
        assert debugException(CLASS_NAME, "main", ex);
        if (debugEnabled())
        {
          debugCought(DebugLogLevel.ERROR, ex);
        }
        err.println(wrapText(ex.getMessage(), MAX_LINE_WIDTH));
        return 1;
      }
@@ -845,19 +863,28 @@
      }
    } catch(LDAPException le)
    {
      assert debugException(CLASS_NAME, "main", le);
      if (debugEnabled())
      {
        debugCought(DebugLogLevel.ERROR, le);
      }
      err.println(wrapText(le.getMessage(), MAX_LINE_WIDTH));
      int code = le.getResultCode();
      return code;
    } catch(LDAPConnectionException lce)
    {
        assert debugException(CLASS_NAME, "main", lce);
        err.println(wrapText(lce.getMessage(), MAX_LINE_WIDTH));
        int code = lce.getErrorCode();
        return code;
      if (debugEnabled())
      {
        debugCought(DebugLogLevel.ERROR, lce);
      }
      err.println(wrapText(lce.getMessage(), MAX_LINE_WIDTH));
      int code = lce.getErrorCode();
      return code;
    } catch(Exception e)
    {
      assert debugException(CLASS_NAME, "main", e);
      if (debugEnabled())
      {
        debugCought(DebugLogLevel.ERROR, e);
      }
      err.println(wrapText(e.getMessage(), MAX_LINE_WIDTH));
      return 1;
    } finally