Fix various FindBugs warnings.
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap; |
| | |
| | | } else { |
| | | try { |
| | | ruleUse = schema.getMatchingRuleUse(rule); |
| | | if (!ruleUse.hasAttribute(ad.getAttributeType())) { |
| | | if (DEBUG_LOG.isLoggable(Level.WARNING)) { |
| | | DEBUG_LOG.warning("The matching rule " + matchingRule |
| | | + " is not valid for attribute type " |
| | | + attributeDescription); |
| | | } |
| | | return UNDEFINED; |
| | | } |
| | | } catch (final UnknownSchemaElementException e) { |
| | | if (DEBUG_LOG.isLoggable(Level.WARNING)) { |
| | | DEBUG_LOG.warning("No matching rule use is defined for " |
| | |
| | | return UNDEFINED; |
| | | } |
| | | } |
| | | if (!ruleUse.hasAttribute(ad.getAttributeType())) { |
| | | if (DEBUG_LOG.isLoggable(Level.WARNING)) { |
| | | DEBUG_LOG.warning("The matching rule " + matchingRule |
| | | + " is not valid for attribute type " + attributeDescription); |
| | | } |
| | | return UNDEFINED; |
| | | } |
| | | } |
| | | } else { |
| | | try { |
| | |
| | | builder.append(getReferralURIs()); |
| | | if (password != null) { |
| | | builder.append(", genPassword="); |
| | | builder.append(password); |
| | | builder.append(ByteString.valueOf(password)); |
| | | } |
| | | builder.append(", controls="); |
| | | builder.append(getControls()); |
| | |
| | | * If the value contains a null, newline, or return character, then it |
| | | * needs to be base64 encoded. |
| | | */ |
| | | byte b; |
| | | for (int i = 0; i < bytes.length(); i++) { |
| | | b = bytes.byteAt(i); |
| | | if (b > 127 || b < 0) { |
| | | final byte b = bytes.byteAt(i); |
| | | if (b < 0) { |
| | | return true; |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2012 ForgeRock AS |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | */ |
| | | |
| | | package com.forgerock.opendj.ldap.tools; |
| | |
| | | import static com.forgerock.opendj.ldap.tools.Utils.filterExitCode; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.Connection; |
| | | import org.forgerock.opendj.ldap.ConnectionFactory; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | |
| | | |
| | | if (result.getGeneratedPassword() != null) { |
| | | message = |
| | | INFO_LDAPPWMOD_GENERATED_PASSWORD.get(result.getGeneratedPassword().toString()); |
| | | INFO_LDAPPWMOD_GENERATED_PASSWORD.get(ByteString.valueOf( |
| | | result.getGeneratedPassword()).toString()); |
| | | println(message); |
| | | } |
| | | |
| | |
| | | private AttributeNameStrategy(final AttributeType dnAttribute, |
| | | final AttributeDescription idAttribute, final boolean isServerProvided) { |
| | | this.dnAttribute = AttributeDescription.create(dnAttribute); |
| | | if (dnAttribute.equals(idAttribute)) { |
| | | if (this.dnAttribute.equals(idAttribute)) { |
| | | throw new IllegalArgumentException("DN and ID attributes must be different"); |
| | | } |
| | | this.idAttribute = ensureNotNull(idAttribute); |
| | |
| | | * @return Anonymous connection factories. |
| | | */ |
| | | @DataProvider |
| | | private Object[][] anonymousConnectionFactories() { |
| | | public Object[][] anonymousConnectionFactories() { |
| | | return new Object[][] { |
| | | { new LDAPConnectionFactory("localhost", Integer.valueOf(CONFIG_PROPERTIES |
| | | .getProperty("listen-port"))) }, { Adapters.newAnonymousConnectionFactory() } }; |
| | |
| | | * @return Root connection factories. |
| | | */ |
| | | @DataProvider |
| | | private Object[][] rootConnectionFactories() { |
| | | public Object[][] rootConnectionFactories() { |
| | | return new Object[][] { |
| | | { Connections.newAuthenticatedConnectionFactory(new LDAPConnectionFactory("localhost", |
| | | Integer.valueOf(CONFIG_PROPERTIES.getProperty("listen-port"))), Requests |
| | |
| | | assertThat(connection.isValid()).isTrue(); |
| | | assertThat(connection.isClosed()).isFalse(); |
| | | } finally { |
| | | connection.close(); |
| | | if (connection != null) { |
| | | connection.close(); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @DataProvider(name = "operation result type") |
| | | private Object[][] getOperationResultTypes() { |
| | | public Object[][] getOperationResultTypes() { |
| | | return new Object[][] { |
| | | { BindOperation.class, BindResult.class }, |
| | | { CompareOperation.class, CompareResult.class }, |