| | |
| | | import org.opends.admin.ads.util.ConnectionUtils; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.controls.LDAPAssertionRequestControl; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.ldap.CompareRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.CompareResponseProtocolOp; |
| | |
| | | import org.opends.server.util.Base64; |
| | | import org.opends.server.util.EmbeddedUtils; |
| | | import org.opends.server.util.PasswordReader; |
| | | |
| | | import com.forgerock.opendj.cli.ArgumentException; |
| | | import com.forgerock.opendj.cli.ArgumentParser; |
| | | import com.forgerock.opendj.cli.BooleanArgument; |
| | |
| | | */ |
| | | public class LDAPCompare |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * The fully-qualified name of this class. |
| | | */ |
| | |
| | | responseMessage = connection.getLDAPReader().readMessage(); |
| | | } catch(DecodeException ae) |
| | | { |
| | | logger.traceException(ae); |
| | | if (!compareOptions.continueOnError()) |
| | | { |
| | | String message = LDAPToolUtils.getMessageForConnectionException(ae); |
| | |
| | | } |
| | | catch (ParseException e) |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | err.println(wrapText( |
| | | INFO_COMPARE_CANNOT_BASE64_DECODE_ASSERTION_VALUE.get(), |
| | | MAX_LINE_WIDTH)); |
| | | err.println(wrapText(e.getLocalizedMessage(), MAX_LINE_WIDTH)); |
| | | return CLIENT_SIDE_PARAM_ERROR; |
| | | } |
| | | } else if(nextChar == '<') |
| | |
| | | portNumber = port.getIntValue(); |
| | | } catch (ArgumentException ae) |
| | | { |
| | | logger.traceException(ae); |
| | | err.println(wrapText(ae.getMessage(), MAX_LINE_WIDTH)); |
| | | return CLIENT_SIDE_PARAM_ERROR; |
| | | } |
| | |
| | | connectionOptions.setVersionNumber(versionNumber); |
| | | } catch(ArgumentException ae) |
| | | { |
| | | logger.traceException(ae); |
| | | err.println(wrapText(ae.getMessage(), MAX_LINE_WIDTH)); |
| | | return CLIENT_SIDE_PARAM_ERROR; |
| | | } |
| | |
| | | bindPasswordValue = new String(pwChars); |
| | | } catch(Exception ex) |
| | | { |
| | | logger.traceException(ex); |
| | | err.println(wrapText(ex.getMessage(), MAX_LINE_WIDTH)); |
| | | return CLIENT_SIDE_PARAM_ERROR; |
| | | } |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | logger.traceException(t); |
| | | String details = t.getMessage(); |
| | | if (details == null) |
| | | { |
| | |
| | | return SUCCESS; |
| | | } catch(LDAPException le) |
| | | { |
| | | logger.traceException(le); |
| | | LDAPToolUtils.printErrorMessage( |
| | | err, le.getMessageObject(), |
| | | le.getResultCode(), |
| | |
| | | return code; |
| | | } catch(LDAPConnectionException lce) |
| | | { |
| | | logger.traceException(lce); |
| | | LDAPToolUtils.printErrorMessage(err, |
| | | lce.getMessageObject(), |
| | | lce.getResultCode(), |
| | |
| | | return code; |
| | | } catch(Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | err.println(wrapText(e.getMessage(), MAX_LINE_WIDTH)); |
| | | return OPERATIONS_ERROR; |
| | | } finally |