| | |
| | | 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; |
| | |
| | | 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.*; |
| | |
| | | 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"; |
| | |
| | | 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()); |
| | |
| | | } |
| | | 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)); |
| | |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | | } |
| | |
| | | } |
| | | } 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 |