opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicy.java
@@ -24,10 +24,14 @@ import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.ldap.ByteString; import org.opends.server.core.DirectoryServer; import org.forgerock.opendj.ldap.schema.AttributeType; import org.opends.server.types.*; import org.forgerock.opendj.ldap.ResultCode; import org.forgerock.opendj.ldap.schema.AttributeType; import org.opends.server.core.DirectoryServer; import org.opends.server.types.Attribute; import org.opends.server.types.DN; import org.opends.server.types.DirectoryException; import org.opends.server.types.Entry; import org.opends.server.types.SubEntry; import org.opends.server.util.TimeThread; /** @@ -77,9 +81,9 @@ DN subentryDN; try { subentryDN = DN.decode(v); subentryDN = DN.valueOf(v); } catch (Exception e) catch (DirectoryException e) { logger.traceException(e); opendj-server-legacy/src/main/java/org/opends/server/controls/ProxiedAuthV1Control.java
@@ -12,7 +12,7 @@ * information: "Portions Copyright [year] [name of copyright owner]". * * Copyright 2006-2008 Sun Microsystems, Inc. * Portions Copyright 2011-2015 ForgeRock AS. * Portions Copyright 2011-2016 ForgeRock AS. */ package org.opends.server.controls; @@ -72,7 +72,7 @@ try { reader.readStartSequence(); authorizationDN = DN.decode(reader.readOctetString()); authorizationDN = DN.valueOf(reader.readOctetString()); reader.readEndSequence(); } catch (Exception e) @@ -230,7 +230,7 @@ { if (authorizationDN == null) { authorizationDN = DN.decode(rawAuthorizationDN); authorizationDN = DN.valueOf(rawAuthorizationDN); } return authorizationDN; opendj-server-legacy/src/main/java/org/opends/server/core/AddOperationBasis.java
@@ -193,7 +193,7 @@ { if (entryDN == null) { entryDN = DN.decode(rawEntryDN); entryDN = DN.valueOf(rawEntryDN); } } catch (DirectoryException de) opendj-server-legacy/src/main/java/org/opends/server/core/BindOperationBasis.java
@@ -12,7 +12,7 @@ * information: "Portions Copyright [year] [name of copyright owner]". * * Copyright 2007-2010 Sun Microsystems, Inc. * Portions Copyright 2013-2015 ForgeRock AS. * Portions Copyright 2013-2016 ForgeRock AS. */ package org.opends.server.core; @@ -295,7 +295,7 @@ { if (bindDN == null) { bindDN = DN.decode(rawBindDN); bindDN = DN.valueOf(rawBindDN); } } catch (DirectoryException de) opendj-server-legacy/src/main/java/org/opends/server/core/CompareOperationBasis.java
@@ -170,7 +170,7 @@ if (entryDN == null) { try { entryDN = DN.decode(rawEntryDN); entryDN = DN.valueOf(rawEntryDN); } catch (DirectoryException de) { @@ -336,7 +336,7 @@ { if (entryDN == null) { entryDN = DN.decode(rawEntryDN); entryDN = DN.valueOf(rawEntryDN); } } catch (DirectoryException de) opendj-server-legacy/src/main/java/org/opends/server/core/DeleteOperationBasis.java
@@ -12,7 +12,7 @@ * information: "Portions Copyright [year] [name of copyright owner]". * * Copyright 2007-2010 Sun Microsystems, Inc. * Portions Copyright 2013-2015 ForgeRock AS. * Portions Copyright 2013-2016 ForgeRock AS. */ package org.opends.server.core; @@ -121,7 +121,7 @@ { if (entryDN == null) { entryDN = DN.decode(rawEntryDN); entryDN = DN.valueOf(rawEntryDN); } } catch (DirectoryException de) opendj-server-legacy/src/main/java/org/opends/server/core/ModifyDNOperationBasis.java
@@ -209,7 +209,7 @@ { if (entryDN == null) { entryDN = DN.decode(rawEntryDN); entryDN = DN.valueOf(rawEntryDN); } } catch (DirectoryException de) @@ -304,7 +304,7 @@ { if (newSuperior == null) { newSuperior = DN.decode(rawNewSuperior); newSuperior = DN.valueOf(rawNewSuperior); } } catch (DirectoryException de) opendj-server-legacy/src/main/java/org/opends/server/core/ModifyOperationBasis.java
@@ -158,7 +158,7 @@ { if (entryDN == null){ try { entryDN = DN.decode(rawEntryDN); entryDN = DN.valueOf(rawEntryDN); } catch (DirectoryException de) { logger.traceException(de); opendj-server-legacy/src/main/java/org/opends/server/core/SearchOperationBasis.java
@@ -305,7 +305,7 @@ { if (baseDN == null) { baseDN = DN.decode(rawBaseDN); baseDN = DN.valueOf(rawBaseDN); } } catch (DirectoryException de) opendj-server-legacy/src/main/java/org/opends/server/core/SubentryPasswordPolicy.java
@@ -256,7 +256,7 @@ { for (ByteString val : attr) { DN validatorDN = DN.decode(val); DN validatorDN = DN.valueOf(val); if (DirectoryServer.getPasswordValidator(validatorDN) == null) { throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, opendj-server-legacy/src/main/java/org/opends/server/extensions/EntryDNVirtualAttributeProvider.java
@@ -16,20 +16,28 @@ */ package org.opends.server.extensions; import java.util.*; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.ldap.ByteString; import org.forgerock.opendj.ldap.ConditionResult; import org.forgerock.opendj.ldap.DecodeException; import org.forgerock.opendj.ldap.SearchScope; import org.opends.server.admin.std.server.EntryDNVirtualAttributeCfg; import org.forgerock.opendj.ldap.schema.AttributeType; import org.forgerock.opendj.ldap.schema.MatchingRule; import org.opends.server.admin.std.server.EntryDNVirtualAttributeCfg; import org.opends.server.api.VirtualAttributeProvider; import org.opends.server.core.DirectoryServer; import org.opends.server.core.SearchOperation; import org.forgerock.opendj.ldap.schema.AttributeType; import org.opends.server.types.*; import org.opends.server.types.Attribute; import org.opends.server.types.Attributes; import org.opends.server.types.DN; import org.opends.server.types.DirectoryException; import org.opends.server.types.Entry; import org.opends.server.types.SearchFilter; import org.opends.server.types.VirtualAttributeRule; import static org.opends.server.util.ServerConstants.*; @@ -225,7 +233,7 @@ SearchOperation searchOperation) { SearchFilter filter = searchOperation.getFilter(); LinkedHashSet<DN> dnSet = new LinkedHashSet<>(); Set<DN> dnSet = new LinkedHashSet<>(); extractDNs(rule.getAttributeType(), filter, dnSet); if (dnSet.isEmpty()) @@ -268,8 +276,7 @@ * @param dnSet The set into which the identified DNs should be * placed. */ private void extractDNs(AttributeType attributeType, SearchFilter filter, LinkedHashSet<DN> dnSet) private void extractDNs(AttributeType attributeType, SearchFilter filter, Set<DN> dnSet) { switch (filter.getFilterType()) { @@ -286,9 +293,9 @@ { try { dnSet.add(DN.decode(filter.getAssertionValue())); dnSet.add(DN.valueOf(filter.getAssertionValue())); } catch (Exception e) catch (DirectoryException e) { logger.traceException(e); } @@ -297,4 +304,3 @@ } } } opendj-server-legacy/src/main/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProvider.java
@@ -115,7 +115,7 @@ { try { DN groupDN = DN.decode(value); DN groupDN = DN.valueOf(value); Group<?> g = DirectoryServer.getGroupManager().getGroupInstance(groupDN); return g != null && g.isMember(entry); } @@ -352,7 +352,7 @@ { try { DN dn = DN.decode(filter.getAssertionValue()); DN dn = DN.valueOf(filter.getAssertionValue()); return DirectoryServer.getGroupManager().getGroupInstance(dn); } catch (Exception e) opendj-server-legacy/src/main/java/org/opends/server/extensions/MemberVirtualAttributeProvider.java
@@ -12,7 +12,7 @@ * information: "Portions Copyright [year] [name of copyright owner]". * * Copyright 2008-2009 Sun Microsystems, Inc. * Portions Copyright 2011-2015 ForgeRock AS. * Portions Copyright 2011-2016 ForgeRock AS. */ package org.opends.server.extensions; @@ -197,7 +197,7 @@ try { return g.isMember(DN.decode(value)); return g.isMember(DN.valueOf(value)); } catch (Exception e) { opendj-server-legacy/src/main/java/org/opends/server/extensions/PasswordPolicyStateExtendedOperation.java
@@ -12,7 +12,7 @@ * information: "Portions Copyright [year] [name of copyright owner]". * * Copyright 2006-2009 Sun Microsystems, Inc. * Portions Copyright 2011-2015 ForgeRock AS. * Portions Copyright 2011-2016 ForgeRock AS. */ package org.opends.server.extensions; @@ -338,7 +338,7 @@ DN targetDN; try { targetDN = DN.decode(dnString); targetDN = DN.valueOf(dnString); } catch (DirectoryException de) { opendj-server-legacy/src/main/java/org/opends/server/extensions/StaticGroup.java
@@ -552,7 +552,7 @@ case ADD: for (ByteString v : attribute) { DN member = DN.decode(v); DN member = DN.valueOf(v); memberDNs.add(toCompactDn(member)); if (DirectoryServer.getGroupManager().getGroupInstance(member) != null) { @@ -570,7 +570,7 @@ { for (ByteString v : attribute) { DN member = DN.decode(v); DN member = DN.valueOf(v); memberDNs.remove(toCompactDn(member)); nestedGroups.remove(member); } @@ -581,7 +581,7 @@ nestedGroups.clear(); for (ByteString v : attribute) { DN member = DN.decode(v); DN member = DN.valueOf(v); memberDNs.add(toCompactDn(member)); if (DirectoryServer.getGroupManager().getGroupInstance(member) != null) { opendj-server-legacy/src/main/java/org/opends/server/extensions/VirtualStaticGroup.java
@@ -132,7 +132,7 @@ try { targetDN = DN.decode(v); targetDN = DN.valueOf(v); } catch (DirectoryException de) { opendj-server-legacy/src/main/java/org/opends/server/loggers/AbstractTextAccessLogPublisher.java
@@ -11,7 +11,7 @@ * Header, with the fields enclosed by brackets [] replaced by your own identifying * information: "Portions Copyright [year] [name of copyright owner]". * * Copyright 2011-2015 ForgeRock AS. * Copyright 2011-2016 ForgeRock AS. */ package org.opends.server.loggers; @@ -391,7 +391,7 @@ { try { targetDN = DN.decode(rawTargetDN); targetDN = DN.valueOf(rawTargetDN); } catch (final DirectoryException e) { opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java
@@ -308,7 +308,7 @@ { try { policyDN = DN.decode(v); policyDN = DN.valueOf(v); AuthenticationPolicy authPolicy = DirectoryServer .getAuthenticationPolicy(policyDN); if (authPolicy == null) opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java
@@ -1150,7 +1150,7 @@ { for (ByteString attrVal : attr) { DN valueEntryDN = DN.decode(attrVal); DN valueEntryDN = DN.valueOf(attrVal); final Entry valueEntry; if (currentConfiguration.getCheckReferencesScopeCriteria() == CheckReferencesScopeCriteria.NAMING_CONTEXT opendj-server-legacy/src/main/java/org/opends/server/plugins/SevenBitCleanPlugin.java
@@ -175,7 +175,7 @@ DN entryDN; try { entryDN = DN.decode(addOperation.getRawEntryDN()); entryDN = DN.valueOf(addOperation.getRawEntryDN()); } catch (DirectoryException de) { @@ -239,7 +239,7 @@ DN entryDN; try { entryDN = DN.decode(modifyOperation.getRawEntryDN()); entryDN = DN.valueOf(modifyOperation.getRawEntryDN()); } catch (DirectoryException de) { @@ -315,7 +315,7 @@ DN entryDN; try { entryDN = DN.decode(modifyDNOperation.getRawEntryDN()); entryDN = DN.valueOf(modifyDNOperation.getRawEntryDN()); } catch (DirectoryException de) { opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/ExternalChangelogDomain.java
@@ -104,7 +104,7 @@ if (domain==null) { RDN rdn = configuration.dn().parent().rdn(); DN rdns = DN.decode(rdn.getFirstAVA().getAttributeValue()); DN rdns = DN.valueOf(rdn.getFirstAVA().getAttributeValue()); domain = MultimasterReplication.findDomain(rdns, null); } return null; opendj-server-legacy/src/main/java/org/opends/server/types/DN.java
@@ -502,7 +502,7 @@ * decode the provided ASN.1 octet * string as a DN. */ public static DN decode(ByteSequence dnString) public static DN valueOf(ByteSequence dnString) throws DirectoryException { // A null or empty DN is acceptable. opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
@@ -2867,7 +2867,7 @@ { for (ByteString value : attr) { inheritFromDN = DN.decode(value); inheritFromDN = DN.valueOf(value); // Respect subentry root scope. if (!inheritFromDN.isSubordinateOrEqualTo( subEntry.getDN().parent())) @@ -3372,7 +3372,7 @@ // Next is the DN itself. ByteSequence dnBytes = entryBuffer.readByteSequence(dnLength); dn = DN.decode(dnBytes.toByteString()); dn = DN.valueOf(dnBytes.toByteString()); } opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java
@@ -221,7 +221,7 @@ { // Has to have a parent since subentry itself // cannot be a suffix entry within the server. this.inheritFromBaseDN = getDN().parent().child(DN.decode(value)); this.inheritFromBaseDN = getDN().parent().child(DN.valueOf(value)); break; } } opendj-server-legacy/src/test/java/org/opends/server/types/TestDN.java
@@ -298,7 +298,7 @@ /** * Tests the <CODE>decode</CODE> method which takes a ByteString * Tests the <CODE>valueOf</CODE> method which takes a ByteString * argument. * * @param rawDN @@ -311,8 +311,8 @@ * If the test failed unexpectedly. */ @Test(dataProvider = "testDNs") public void testDecodeByteString(String rawDN, String normDN, String unused) throws Exception { DN dn = DN.decode(ByteString.valueOfUtf8(rawDN)); public void testValueOfByteString(String rawDN, String normDN, String unused) throws Exception { DN dn = DN.valueOf(ByteString.valueOfUtf8(rawDN)); assertEquals(dn.toNormalizedUrlSafeString(), normDN); } @@ -357,14 +357,14 @@ /** * Tests both variants of the {@code decode} method with null arguments. * Tests both variants of the {@code valueOf} method with null arguments. * * @throws Exception * If the test failed unexpectedly. */ @Test public void testDecodeNull() throws Exception { assertEquals(DN.decode((ByteString) null), DN.rootDN()); public void testValueOfNull() throws Exception { assertEquals(DN.valueOf((ByteString) null), DN.rootDN()); assertEquals(DN.valueOf((String) null), DN.rootDN()); } @@ -397,7 +397,7 @@ @Test(dataProvider = "illegalDNs", expectedExceptions = DirectoryException.class) public void testIllegalOctetStringDNs(String dn) throws Exception { ByteString octetString = ByteString.valueOfUtf8(dn); DN.decode(octetString); DN.valueOf(octetString); }