Package org.apache.directory.shared.ldap.exception

Examples of org.apache.directory.shared.ldap.exception.LdapException


            throw new IllegalArgumentException( I18n.err( I18n.ERR_295 ) );
        }
       
        if ( !( node instanceof EqualityNode ) )
        {
            throw new LdapException( I18n.err( I18n.ERR_301, node ) );
        }
       
        if ( !node.getAttribute().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
        {
            throw new LdapException( I18n.err( I18n.ERR_302, node.getAttribute() ) );
        }

        if ( null == objectClasses )
        {
            throw new IllegalArgumentException( I18n.err( I18n.ERR_303 ) );
View Full Code Here


        }
        catch ( IOException e )
        {
            String message = I18n.err( I18n.ERR_77, revision );
            LOG.error( message );
            throw new LdapException( message );
        }

        return changeLog.getCurrentRevision();
    }
View Full Code Here

            out.writeObject( obj );
            return bytesOut.toByteArray();
        }
        catch ( Exception e )
        {
            LdapException ne = new LdapException( I18n.err( I18n.ERR_481, obj, e.getLocalizedMessage() ) );
            //ne.setRootCause( e );
            throw ne;
        }
        finally
        {
            try
            {
                if ( out != null )
                {
                    out.close();
                }
            }
            catch ( IOException e )
            {
                throw new LdapException( I18n.err( I18n.ERR_482 ) );
            }
        }
    }
View Full Code Here

            case ( ORDERING_MATCH ):
                mrule = type.getOrdering();
                break;

            default:
                throw new LdapException( I18n.err( I18n.ERR_246, matchType ) );
        }

        if ( ( mrule == null ) && ( matchType != EQUALITY_MATCH ) )
        {
            mrule = type.getEquality();
View Full Code Here

                {
                    engine = engineType.newInstance();
                }
                catch ( InstantiationException e )
                {
                    LdapException ne = new LdapException( e.getMessage() );
                    ne.initCause( e );
                    throw ne;
                }
                catch ( IllegalAccessException e )
                {
                    LdapException ne = new LdapException( e.getMessage() );
                    ne.initCause( e );
                    throw ne;
                }
               
                engine.setSPUnitEntry( (ServerEntry)spUnitEntry.getOriginalEntry() );
                return engine;
            }

        }

        throw new LdapException( I18n.err( I18n.ERR_294, spLangId ) );

    }
View Full Code Here

            {
                val = new StringValue( attributeType, StringTools.utf8ToString( (byte[])value ) );
            }
            else
            {
                throw new LdapException( I18n.err( I18n.ERR_309, oid ) );
            }
        }
        else
        {
            if ( value instanceof String )
            {
                val = new BinaryValue( attributeType, StringTools.getBytesUtf8( (String)value ) );
            }
            else if ( value instanceof byte[] )
            {
                val = new BinaryValue( attributeType, (byte[])value );
            }
            else
            {
                throw new LdapException( I18n.err( I18n.ERR_309, oid ) );
            }
        }
       
        return val;
    }
View Full Code Here

                }
                catch ( UnsupportedEncodingException uee )
                {
                    String message = I18n.err( I18n.ERR_47 );
                    LOG.error( message );
                    throw new LdapException( message );
                }
            }
        }
        else
        {
            if ( value instanceof String )
            {
                try
                {
                    return new BinaryValue( ( ( String ) value ).getBytes( "UTF-8" ) );
                }
                catch ( UnsupportedEncodingException uee )
                {
                    String message = I18n.err( I18n.ERR_48 );
                    LOG.error( message );
                    throw new LdapException( message );
                }
            }
        }

        return null;
View Full Code Here

    {
        if ( filter == null )
        {
            String message = I18n.err( I18n.ERR_49 );
            LOG.error( message );
            throw new LdapException( message );
        }

        if ( filter.isLeaf() )
        {
            if ( filter instanceof EqualityNode )
            {
                EqualityNode node = ( ( EqualityNode ) filter );
                Object value = node.getValue();

                Value<?> newValue = convert( node.getAttribute(), value );

                if ( newValue != null )
                {
                    node.setValue( newValue );
                }
            }
            else if ( filter instanceof SubstringNode )
            {
                SubstringNode node = ( ( SubstringNode ) filter );

                if ( !schemaManager.lookupAttributeTypeRegistry( node.getAttribute() ).getSyntax().isHumanReadable() )
                {
                    String message = I18n.err( I18n.ERR_50 );
                    LOG.error( message );
                    throw new LdapException( message );
                }
            }
            else if ( filter instanceof PresenceNode )
            {
                // Nothing to do
            }
            else if ( filter instanceof GreaterEqNode )
            {
                GreaterEqNode node = ( ( GreaterEqNode ) filter );
                Object value = node.getValue();

                Value<?> newValue = convert( node.getAttribute(), value );

                if ( newValue != null )
                {
                    node.setValue( newValue );
                }

            }
            else if ( filter instanceof LessEqNode )
            {
                LessEqNode node = ( ( LessEqNode ) filter );
                Object value = node.getValue();

                Value<?> newValue = convert( node.getAttribute(), value );

                if ( newValue != null )
                {
                    node.setValue( newValue );
                }
            }
            else if ( filter instanceof ExtensibleNode )
            {
                ExtensibleNode node = ( ( ExtensibleNode ) filter );

                if ( !schemaManager.lookupAttributeTypeRegistry( node.getAttribute() ).getSyntax().isHumanReadable() )
                {
                    String message = I18n.err( I18n.ERR_51 );
                    LOG.error( message );
                    throw new LdapException( message );
                }
            }
            else if ( filter instanceof ApproximateNode )
            {
                ApproximateNode node = ( ( ApproximateNode ) filter );
View Full Code Here

   
    private String getSchemaName( DN dn ) throws LdapException
    {
        if ( dn.size() < 2 )
        {
            throw new LdapException( I18n.err( I18n.ERR_276 ) );
        }
       
        RDN rdn = dn.getRdn( 1 );
        return ( String ) rdn.getNormValue();
    }
View Full Code Here

                    attribute.add( valStr );
                    isModified = true;
                }
                catch ( UnsupportedEncodingException uee )
                {
                    throw new LdapException( I18n.err( I18n.ERR_281 ) );
                }
            }
            else
            {
                throw new LdapException( I18n.err( I18n.ERR_282 ) );
            }
        }

        return isModified;
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.exception.LdapException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.