org.apache.directory.api.ldap.model.exception.LdapInvalidDnException Java Examples

The following examples show how to use org.apache.directory.api.ldap.model.exception.LdapInvalidDnException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LdapUrlTest.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * test the setFilter() method
 */
@Test
public void testDnSetFilter() throws LdapURLEncodingException, LdapInvalidDnException
{
    LdapUrl url = new LdapUrl();
    assertNull( url.getFilter() );

    url.setDn( new Dn( "dc=example,dc=com" ) );

    url.setFilter( "(objectClass=person)" );
    assertEquals( "(objectClass=person)", url.getFilter() );
    assertEquals( "ldap:///dc=example,dc=com???(objectClass=person)", url.toString() );

    url.setFilter( "(cn=Babs Jensen)" );
    assertEquals( "(cn=Babs Jensen)", url.getFilter() );
    assertEquals( "ldap:///dc=example,dc=com???(cn=Babs%20Jensen)", url.toString() );

    url.setFilter( null );
    assertNull( url.getFilter() );
    assertEquals( "ldap:///dc=example,dc=com", url.toString() );
}
 
Example #2
Source File: AvaTest.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
@Test
public void testSortAva() throws LdapInvalidDnException
{
    Ava atav1 = new Ava( schemaManager, "cn", "  B  " );
    Ava atav2 = new Ava( schemaManager, "sn", "  c" );
    Ava atav3 = new Ava( schemaManager, "2.5.4.3", "A " );
    Ava atav4 = new Ava( schemaManager, "2.5.4.11", " C  " );
    Ava atav5 = new Ava( schemaManager, "ou", "B " );
    Ava atav6 = new Ava( schemaManager, "ou", "D " );
    Ava atav7 = new Ava( schemaManager, "CN", " " );

    Ava[] avas = new Ava[] { atav1, atav2, atav3, atav4, atav5, atav6, atav7 };
    
    Arrays.sort( avas );
    
    assertEquals( atav5, avas[0] );
    assertEquals( atav4, avas[1] );
    assertEquals( atav6, avas[2] );
    assertEquals( atav7, avas[3] );
    assertEquals( atav3, avas[4] );
    assertEquals( atav1, avas[5] );
    assertEquals( atav2, avas[6] );
}
 
Example #3
Source File: DefaultEntry.java    From MyVirtualDirectory with Apache License 2.0 6 votes vote down vote up
/**
 * <p>
 * Creates a new instance of DefaultEntry, schema aware.
 * </p>
 * <p>
 * No attributes will be created.
 * </p>
 *
 * @param schemaManager The reference to the schemaManager
 * @param dn The String Dn for this serverEntry. Can be null.
 * @throws LdapInvalidDnException If the Dn is invalid
 */
public DefaultEntry( SchemaManager schemaManager, String dn ) throws LdapInvalidDnException
{
    this.schemaManager = schemaManager;

    if ( Strings.isEmpty( dn ) )
    {
        this.dn = Dn.EMPTY_DN;
    }
    else
    {
        this.dn = new Dn( dn );
        normalizeDN( this.dn );
    }

    // Initialize the ObjectClass object
    initObjectClassAT();
}
 
Example #4
Source File: UserClass_NameTest.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * Initialize name instances
 */
@BeforeEach
public void initNames() throws LdapInvalidDnException
{
    Set<String> dnSetA = new HashSet<>();
    dnSetA.add( new Dn( "a=aa" ).getNormName() );
    dnSetA.add( new Dn( "b=bb" ).getNormName() );

    Set<String> dnSetB = new HashSet<>();
    dnSetB.add( new Dn( "b=bb" ).getNormName() );
    dnSetB.add( new Dn( "a=aa" ).getNormName() );

    Set<String> dnSetC = new HashSet<>();
    dnSetC.add( new Dn( "a=aa" ).getNormName() );
    dnSetC.add( new Dn( "b=bb" ).getNormName() );

    Set<String> dnSetD = new HashSet<>();
    dnSetD.add( new Dn( "b=bb" ).getNormName() );
    dnSetD.add( new Dn( "c=cc" ).getNormName() );

    nameA = new Name( dnSetA );
    nameACopy = new Name( dnSetB );
    nameB = new Name( dnSetC );
    nameC = new Name( dnSetD );
}
 
Example #5
Source File: Dn.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a Schema aware Dn from a list of Rdns.
 *
 * @param schemaManager The SchemaManager to use
 * @param rdns the list of Rdns to be used for the Dn
 * @throws LdapInvalidDnException If the resulting Dn is invalid
 */
public Dn( SchemaManager schemaManager, Rdn... rdns ) throws LdapInvalidDnException
{
    this.schemaManager = schemaManager;

    if ( rdns == null )
    {
        return;
    }

    for ( Rdn rdn : rdns )
    {
        if ( rdn.isSchemaAware() )
        {
            this.rdns.add( rdn );
        }
        else
        {
            this.rdns.add( new Rdn( schemaManager, rdn ) );
        }
    }

    toUpName();
}
 
Example #6
Source File: Rdn.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * Validate a NameComponent : <br>
 * <p>
 * &lt;name-component&gt; ::= &lt;attributeType&gt; &lt;spaces&gt; '='
 * &lt;spaces&gt; &lt;attributeValue&gt; &lt;nameComponents&gt;
 * </p>
 *
 * @param schemaManager The Schemamanager to use
 * @param dn The string to parse
 * @return <code>true</code> if the Rdn is valid
 */
public static boolean isValid( SchemaManager schemaManager, String dn )
{
    Rdn rdn = new Rdn( schemaManager );

    try
    {
        parse( schemaManager, dn, rdn );

        return true;
    }
    catch ( LdapInvalidDnException e )
    {
        return false;
    }
}
 
Example #7
Source File: OpaqueExtendedResponseTest.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * Tests for equality using different stub implementations.
 * @throws LdapInvalidDnException 
 */
@Test
public void testEqualsDiffImpl() throws LdapInvalidDnException
{
    ExtendedResponse resp0 = createStub();
    ExtendedResponse resp1 = new OpaqueExtendedResponse( 45, "1.1.1.1" );
    resp1.getLdapResult().setMatchedDn( new Dn( "dc=example,dc=com" ) );
    resp1.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
    ReferralImpl refs = new ReferralImpl();
    refs.addLdapUrl( "ldap://someserver.com" );
    refs.addLdapUrl( "ldap://apache.org" );
    refs.addLdapUrl( "ldap://another.net" );
    resp1.getLdapResult().setReferral( refs );

    assertTrue( resp0.equals( resp1 ) );
    assertTrue( resp1.equals( resp0 ) );
}
 
Example #8
Source File: LdapUrlTest.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * test the setDn() method
 */
@Test
public void testDnSetDn() throws LdapURLEncodingException, LdapInvalidDnException
{
    LdapUrl url = new LdapUrl();
    assertNull( url.getDn() );

    Dn dn = new Dn( "dc=example,dc=com" );
    url.setDn( dn );
    assertEquals( dn, url.getDn() );
    assertEquals( "ldap:///dc=example,dc=com", url.toString() );

    url.setDn( null );
    assertNull( url.getDn() );
    assertEquals( "ldap:///", url.toString() );
}
 
Example #9
Source File: Dn.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * Add a suffix to the Dn. For instance, if the current Dn is "ou=people",
 * and the suffix "dc=example,dc=com", then the resulting Dn will be
 * "ou=people,dc=example,dc=com"
 *
 * @param comp the suffix to add
 * @return The resulting Dn with the additional suffix
 * @throws LdapInvalidDnException If the resulting Dn is not valid
 */
public Dn add( String comp ) throws LdapInvalidDnException
{
    if ( comp.length() == 0 )
    {
        return this;
    }

    Dn clonedDn = copy();

    // We have to parse the nameComponent which is given as an argument
    Rdn newRdn = new Rdn( schemaManager, comp );

    clonedDn.rdns.add( 0, newRdn );

    clonedDn.toUpName();

    return clonedDn;
}
 
Example #10
Source File: Dn.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * Construct an empty Schema aware Dn object
 *
 *  @param schemaManager The SchemaManager to use
 *  @param dn The Dn to use
 *  @throws LdapInvalidDnException If the Dn is invalid
 */
public Dn( SchemaManager schemaManager, Dn dn ) throws LdapInvalidDnException
{
    this.schemaManager = schemaManager;

    if ( dn == null )
    {
        return;
    }

    for ( Rdn rdn : dn.rdns )
    {
        this.rdns.add( new Rdn( schemaManager, rdn ) );
    }

    toUpName();
}
 
Example #11
Source File: ComplexDnParser.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Parses an Dn.
 * 
 * @param schemaManager The SchemaManager
 * @param name the string representation of the distinguished name
 * @param rdns the (empty) list where parsed RDNs are put to
 * @return The normalized Dn
 * 
 * @throws LdapInvalidDnException the invalid name exception
 */
/* No protection*/String parseDn( SchemaManager schemaManager, String name, List<Rdn> rdns ) throws LdapInvalidDnException
{
    AntlrDnParser dnParser = new AntlrDnParser( new AntlrDnLexer( new StringReader( name ) ) );

    try
    {
        return dnParser.relativeDistinguishedNames( schemaManager, rdns );
    }
    catch ( Exception e )
    {
        throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, e.getMessage(), e );
    }
}
 
Example #12
Source File: LdifRevertorTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Test a AddRequest reverse
 *
 * @throws LdapInvalidDnException
 */
@Test
public void testReverseAdd() throws LdapInvalidDnException
{
    Dn dn = new Dn( "dc=apache, dc=com" );
    LdifEntry reversed = LdifRevertor.reverseAdd( dn );

    assertNotNull( reversed );
    assertEquals( dn.getName(), reversed.getDn().getName() );
    assertEquals( ChangeType.Delete, reversed.getChangeType() );
    assertNull( reversed.getEntry() );
}
 
Example #13
Source File: StoreSearchResultEntryObjectName.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void action( LdapMessageContainer<SearchResultEntry> container ) throws DecoderException
{
    SearchResultEntry searchResultEntry = container.getMessage();

    TLV tlv = container.getCurrentTLV();

    // Store the value.
    if ( tlv.getLength() == 0 )
    {
        searchResultEntry.setObjectName( Dn.EMPTY_DN );
    }
    else
    {
        byte[] dnBytes = tlv.getValue().getData();
        String dnStr = Strings.utf8ToString( dnBytes );

        try
        {
            Dn objectName = new Dn( dnStr );
            searchResultEntry.setObjectName( objectName );
        }
        catch ( LdapInvalidDnException ine )
        {
            // This is for the client side. We will never decode LdapResult on the server
            String msg = I18n.err( I18n.ERR_05157_INVALID_DN, Strings.dumpBytes( dnBytes ), ine.getMessage() );
            LOG.error( I18n.err( I18n.ERR_05114_ERROR_MESSAGE, msg, ine.getMessage() ) );
            throw new DecoderException( msg, ine );
        }
    }

    if ( LOG.isDebugEnabled() )
    {
        LOG.debug( I18n.msg( I18n.MSG_05182_SEARCH_RESULT_ENTRY_DN, searchResultEntry.getObjectName() ) );
    }
}
 
Example #14
Source File: LdapUrlTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * test the setAttributes() method
 */
@Test
public void testDnSetAttributes() throws LdapURLEncodingException, LdapInvalidDnException
{
    LdapUrl url = new LdapUrl();
    assertNotNull( url.getAttributes() );
    assertTrue( url.getAttributes().isEmpty() );

    List<String> attributes = new ArrayList<String>();
    url.setDn( new Dn( "dc=example,dc=com" ) );

    url.setAttributes( null );
    assertNotNull( url.getAttributes() );
    assertTrue( url.getAttributes().isEmpty() );
    assertEquals( "ldap:///dc=example,dc=com", url.toString() );

    attributes.add( "cn" );
    url.setAttributes( attributes );
    assertNotNull( url.getAttributes() );
    assertEquals( 1, url.getAttributes().size() );
    assertEquals( "ldap:///dc=example,dc=com?cn", url.toString() );

    attributes.add( "userPassword;binary" );
    url.setAttributes( attributes );
    assertNotNull( url.getAttributes() );
    assertEquals( 2, url.getAttributes().size() );
    assertEquals( "ldap:///dc=example,dc=com?cn,userPassword;binary", url.toString() );
}
 
Example #15
Source File: RdnTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * test that a RDN with two AVAs throws an exception
 */
@Test
public void testWrongRdn() throws LdapException
{
    assertThrows( LdapInvalidDnException.class, () -> 
    {
        new Rdn( " A = b, C = d " );
    } );
}
 
Example #16
Source File: DnTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Get the prefix out of bound
 */
@Test
public void testDnGetPrefixPos4() throws LdapException
{
    Dn dn = new Dn( "a=b, c=d,e = f" );

    assertThrows( LdapInvalidDnException.class, () ->
    {
        dn.getAncestorOf( "a=z" );
    } );
}
 
Example #17
Source File: BooleanNormalizer.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapInvalidDnException
{
    if ( value == null )
    {
        return null;
    }

    return Strings.upperCase( value.trim() );
}
 
Example #18
Source File: Dn.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Parse a Dn.
 *
 * @param schemaManager The SchemaManager
 * @param name The Dn to be parsed
 * @param rdns The list that will contain the RDNs
 * @return The nromalized Dn
 * @throws LdapInvalidDnException If the Dn is invalid
 */
private static String parseInternal( SchemaManager schemaManager, String name, List<Rdn> rdns ) throws LdapInvalidDnException
{
    try
    {
        return FastDnParser.parseDn( schemaManager, name, rdns );
    }
    catch ( TooComplexDnException e )
    {
        rdns.clear();
        return new ComplexDnParser().parseDn( schemaManager, name, rdns );
    }
}
 
Example #19
Source File: Dn.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Check if a DistinguishedName is syntactically valid.
 *
 * @param schemaManager The SchemaManager to use
 * @param name The Dn to validate
 * @return <code>true</code> if the Dn is valid, <code>false</code>
 * otherwise
 */
public static boolean isValid( SchemaManager schemaManager, String name )
{
    Dn dn = new Dn();

    try
    {
        parseInternal( schemaManager, name, dn.rdns );
        return true;
    }
    catch ( LdapInvalidDnException e )
    {
        return false;
    }
}
 
Example #20
Source File: AuditMgrConsole.java    From directory-fortress-core with Apache License 2.0 5 votes vote down vote up
/**
 * Break the authZ eqDn attribute into 1. permission object name, 2. op name and 3. object id (optional).
 *
 * @param authZ contains the raw dn format from openldap slapo access log data
 * @return Permisison containing objName, opName and optionally the objId populated from the raw data.
 */
public static Permission getAuthZPerm(AuthZ authZ) throws LdapInvalidDnException
{
    // This will be returned to the caller:
    Permission pOp = new Permission();
    // Break dn into rdns for leaf and parent.  Use the 'type' field in rdn.
    // The objId value is optional.  If present it will be part of the parent's relative distinguished name..
    // Here the sample reqDN=ftOpNm=TOP2_2+ftObjId=002,ftObjNm=TOB2_1,ou=Permissions,ou=RBAC,dc=example,dc=com
    // Will be mapped to objName=TOB2_1, opName=TOP2_2, objId=002, in the returned permission object.
    Dn dn = new Dn( authZ.getReqDN() );
    if( dn.getRdns() != null && CollectionUtils.isNotEmpty( dn.getRdns() ) )
    {
        for( Rdn rdn : dn.getRdns() )
        {
            // The rdn type attribute will be mapped to objName, opName and objId fields.
            switch ( rdn.getType() )
            {
                case GlobalIds.POP_NAME:
                    pOp.setOpName( rdn.getType() );
                    break;
                case GlobalIds.POBJ_NAME:
                    pOp.setObjName( rdn.getType() );
                    break;
                case GlobalIds.POBJ_ID:
                    pOp.setObjId( rdn.getType() );
                    break;
            }
        }
    }
    return pOp;
}
 
Example #21
Source File: Dn.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a single Rdn to the (leaf) end of this name.
 *
 * @param newRdn the Rdn to add
 * @return the updated cloned Dn
 * @throws LdapInvalidDnException If the Dn is invalid
 */
public Dn add( Rdn newRdn ) throws LdapInvalidDnException
{
    if ( ( newRdn == null ) || ( newRdn.size() == 0 ) )
    {
        return this;
    }

    Dn clonedDn = copy();

    clonedDn.rdns.add( 0, new Rdn( schemaManager, newRdn ) );
    clonedDn.toUpName();

    return clonedDn;
}
 
Example #22
Source File: DnTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
@Test
@Disabled
public void testDnParsingOneRdnPerf() throws LdapInvalidDnException
{
    long t0 = System.currentTimeMillis();
    
    for ( int i = 0; i < 1000000; i++ )
    {
        new Dn( "dc=example" + i );
    }
    
    long t1 = System.currentTimeMillis();
    System.out.println( "delta new 1 RDN : " + ( t1 - t0 ) );
}
 
Example #23
Source File: Dn.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Add a suffix to the Dn. For instance, if the current Dn is "ou=people",
 * and the suffix "dc=example,dc=com", then the resulting Dn will be
 * "ou=people,dc=example,dc=com"
 *
 * @param suffix the suffix to add
 * @return The resulting Dn with the additional suffix
 * @throws LdapInvalidDnException If the resulting Dn is not valid
 */
public Dn add( Dn suffix ) throws LdapInvalidDnException
{
    if ( ( suffix == null ) || ( suffix.size() == 0 ) )
    {
        return this;
    }

    Dn clonedDn = copy();

    // Concatenate the rdns
    clonedDn.rdns.addAll( 0, suffix.rdns );

    // Regenerate the normalized name and the original string
    if ( clonedDn.isSchemaAware() && suffix.isSchemaAware() )
    {
        if ( clonedDn.size() != 0 )
        {
            clonedDn.upName = suffix.getName() + "," + upName;
        }
    }
    else
    {
        clonedDn.toUpName();
    }

    return clonedDn;
}
 
Example #24
Source File: Dn.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Tells if a Dn is a child of another Dn.<br>
 * For instance, <b>dc=example, dc=com</b> is a descendant
 * of <b>dc=com</b>
 *
 * @param dn The parent
 * @return true if the current Dn is a child of the given Dn
 */
public boolean isDescendantOf( String dn )
{
    try
    {
        return isDescendantOf( new Dn( schemaManager, dn ) );
    }
    catch ( LdapInvalidDnException lide )
    {
        return false;
    }
}
 
Example #25
Source File: Dn.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Tells if the current Dn is a parent of another Dn.<br>
 * For instance, <b>dc=com</b> is a ancestor
 * of <b>dc=example, dc=com</b>
 *
 * @param dn The child
 * @return true if the current Dn is a parent of the given Dn
 */
public boolean isAncestorOf( String dn )
{
    try
    {
        return isAncestorOf( new Dn( dn ) );
    }
    catch ( LdapInvalidDnException lide )
    {
        return false;
    }
}
 
Example #26
Source File: AvaTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
@Test
public void testCompareToSameAva() throws LdapInvalidDnException
{
    Ava atav1 = new Ava( schemaManager, "cn", "b" );
    Ava atav2 = new Ava( schemaManager, "cn", "b" );
    Ava atav3 = new Ava( schemaManager, "commonName", "b" );
    Ava atav4 = new Ava( schemaManager, "2.5.4.3", "  B  " );

    // 1 with others
    assertEquals( 0, atav1.compareTo( atav1 ) );
    assertEquals( 0, atav1.compareTo( atav2 ) );
    assertEquals( 0, atav1.compareTo( atav3 ) );
    assertEquals( 0, atav1.compareTo( atav4 ) );
    
    // 2 with others
    assertEquals( 0, atav2.compareTo( atav1 ) );
    assertEquals( 0, atav2.compareTo( atav2 ) );
    assertEquals( 0, atav2.compareTo( atav3 ) );
    assertEquals( 0, atav2.compareTo( atav4 ) );
    
    // 3 with others
    assertEquals( 0, atav3.compareTo( atav1 ) );
    assertEquals( 0, atav3.compareTo( atav2 ) );
    assertEquals( 0, atav3.compareTo( atav3 ) );
    assertEquals( 0, atav3.compareTo( atav4 ) );
    
    // 4 with others
    assertEquals( 0, atav4.compareTo( atav1 ) );
    assertEquals( 0, atav4.compareTo( atav2 ) );
    assertEquals( 0, atav4.compareTo( atav3 ) );
    assertEquals( 0, atav4.compareTo( atav4 ) );
}
 
Example #27
Source File: Dn.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a Dn from a list of Rdns.
 *
 * @param rdns the list of Rdns to be used for the Dn
 * @throws LdapInvalidDnException If the resulting Dn is invalid
 */
public Dn( Rdn... rdns ) throws LdapInvalidDnException
{
    if ( rdns == null )
    {
        return;
    }

    for ( Rdn rdn : rdns )
    {
        this.rdns.add( rdn );
    }

    toUpName();
}
 
Example #28
Source File: RdnTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * test that a RDN with an attributeType used twice with the same value
 * throws an exception
 */
@Test
public void testWrongRdnAtUsedTwiceSameValue() throws LdapException
{
    assertThrows( LdapInvalidDnException.class, () ->
    {
        new Rdn( schemaManager, " cn = b + cn = b " );
    } );
}
 
Example #29
Source File: Ava.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Construct an Ava. The type and value are normalized :
 * <ul>
 *   <li> the type is trimmed and lowercased </li>
 *   <li> the value is trimmed </li>
 * </ul>
 * <p>
 * Note that the upValue should <b>not</b> be null or empty, or resolved
 * to an empty string after having trimmed it.
 *
 * @param schemaManager The SchemaManager
 * @param upType The User Provided type
 * @param normType The normalized type
 * @param value The value
 * 
 * @throws LdapInvalidDnException If the given type or value are invalid
 */
// WARNING : The protection level is left unspecified intentionally.
// We need this method to be visible from the DnParser class, but not
// from outside this package.
/* Unspecified protection */Ava( SchemaManager schemaManager, String upType, String normType, Value value )
    throws LdapInvalidDnException
{
    StringBuilder sb = new StringBuilder();

    this.upType = upType;
    this.normType = normType;
    this.value = value;
    
    sb.append( upType );
    sb.append( '=' );
    
    if ( ( value != null ) && ( value.getString() != null ) )
    {
        sb.append( value.getString() );
    }
    
    upName = sb.toString();

    if ( schemaManager != null )
    {
        apply( schemaManager );
    }

    hashCode();
}
 
Example #30
Source File: LdapDnGuacamoleProperty.java    From guacamole-client with Apache License 2.0 5 votes vote down vote up
@Override
public Dn parseValue(String value) throws GuacamoleException {

    if (value == null)
        return null;

    try {
        return new Dn(value);
    }
    catch (LdapInvalidDnException e) {
        throw new GuacamoleServerException("The DN \"" + value + "\" is invalid.", e);
    }

}