LOG.warn( "Trying to add a bad attribute type '{}', error : ", upId, ne.getLocalizedMessage() ); continue;
/** * {@inheritDoc} */ public DITStructureRule lookup( int ruleId ) throws LdapException { DITStructureRule ditStructureRule = byRuleId.get( ruleId ); if ( ditStructureRule == null ) { String msg = I18n.err( I18n.ERR_04265, ruleId ); LOG.debug( msg ); throw new LdapException( msg ); } if ( DEBUG ) { LOG.debug( "Found {} with ruleId: {}", ditStructureRule, ruleId ); } return ditStructureRule; }
/** * {@inheritDoc} */ public boolean hasDescendants( String ancestorId ) throws LdapException { try { String oid = getOidByName( ancestorId ); Set<AttributeType> descendants = oidToDescendantSet.get( oid ); return ( descendants != null ) && !descendants.isEmpty(); } catch ( LdapException ne ) { throw new LdapNoSuchAttributeException( ne.getMessage() ); } }
le.printStackTrace(); throw new LdapLdifException( le.getMessage() );
String message = "Cannot normalize the value :" + ne.getLocalizedMessage(); LOG.warn( message ); normalized = false;
/** * {@inheritDoc} */ public String getSchemaName( int ruleId ) throws LdapException { DITStructureRule ditStructureRule = byRuleId.get( ruleId ); if ( ditStructureRule != null ) { return ditStructureRule.getSchemaName(); } String msg = I18n.err( I18n.ERR_04263, ruleId ); LOG.warn( msg ); throw new LdapException( msg ); }
/** * {@inheritDoc} */ public boolean hasDescendants( String ancestorId ) throws LdapException { try { String oid = getOidByName( ancestorId ); Set<ObjectClass> descendants = oidToDescendants.get( oid ); return (descendants != null) && !descendants.isEmpty(); } catch ( LdapException ne ) { throw new LdapNoSuchAttributeException( ne.getMessage() ); } }
/** * Unlink the SchemaObject references */ public void removeReference( List<Throwable> errors, SchemaObject schemaObject ) { try { schemaObject.removeFromRegistries( errors, this ); } catch ( LdapException ne ) { // Not allowed. String msg = I18n.err( I18n.ERR_04293, schemaObject.getName(), ne.getLocalizedMessage() ); Throwable error = new LdapSchemaViolationException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, msg ); errors.add( error ); LOG.info( msg ); } }
/** * Gets the SchemaObject associated with an OID. * * @param oid the object identifier * @return the associated SchemaObject * @throws LdapException if oid does not exist */ public SchemaObject getSchemaObject( String oid ) throws LdapException { SchemaObject schemaObject = byOid.get( oid ); if ( schemaObject != null ) { return schemaObject; } else { String msg = I18n.err( I18n.ERR_04287, oid ); LOG.error( msg ); throw new LdapException( msg ); } }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") public Iterator<AttributeType> descendants( String ancestorId ) throws LdapException { try { String oid = getOidByName( ancestorId ); Set<AttributeType> descendants = oidToDescendantSet.get( oid ); if ( descendants == null ) { return Collections.EMPTY_SET.iterator(); } return descendants.iterator(); } catch ( LdapException ne ) { throw new LdapNoSuchAttributeException( ne.getMessage() ); } }
String message = "Cannot normalize the value :" + ne.getLocalizedMessage(); LOG.info( message ); normalized = false;
/** * {@inheritDoc} */ public void register( DITStructureRule ditStructureRule ) throws LdapException { int ruleId = ditStructureRule.getRuleId(); if ( byRuleId.containsKey( ruleId ) ) { String msg = I18n.err( I18n.ERR_04264, ruleId ); LOG.warn( msg ); throw new LdapException( msg ); } byRuleId.put( ruleId, ditStructureRule ); if ( LOG.isDebugEnabled() ) { LOG.debug( "registered {} for OID {}", ditStructureRule, ruleId ); } }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") public Iterator<ObjectClass> descendants( String ancestorId ) throws LdapException { try { String oid = getOidByName( ancestorId ); Set<ObjectClass> descendants = oidToDescendants.get( oid ); if ( descendants == null ) { return Collections.EMPTY_SET.iterator(); } return descendants.iterator(); } catch ( LdapException ne ) { throw new LdapNoSuchAttributeException( ne.getMessage() ); } }
/** * <p> * Put an attribute (represented by its ID and some binary values) into an entry. * </p> * <p> * If the attribute already exists, the previous attribute will be * replaced and returned. * </p> * <p> * If the upId is not the ID of an existing AttributeType, an IllegalArgumentException is thrown. * </p> * * @param upId The attribute ID * @param values The list of binary values to put. It can be empty. * @return The replaced attribute */ public EntryAttribute put( String upId, byte[]... values ) { try { return put( upId, getAttributeType( upId ), values ); } catch ( LdapException ne ) { String message = I18n.err( I18n.ERR_04464, upId, ne.getLocalizedMessage() ); LOG.error( message ); throw new IllegalArgumentException( message ); } }
/** * {@inheritDoc} */ public String getOidByName( String name ) throws LdapException { T schemaObject = byName.get( name ); if ( schemaObject == null ) { // last resort before giving up check with lower cased version String lowerCased = name.toLowerCase(); schemaObject = byName.get( lowerCased ); // ok this name is not for a schema object in the registry if ( schemaObject == null ) { throw new LdapException( I18n.err( I18n.ERR_04274, name ) ); } } // we found the schema object by key on the first lookup attempt return schemaObject.getOid(); }
/** * {@inheritDoc} */ public AttributeType lookup( String oid ) throws LdapException { try { return super.lookup( oid ); } catch ( LdapException ne ) { throw new LdapNoSuchAttributeException( ne.getMessage() ); } }
/** * <p> * Put an attribute (represented by its ID and some String values) into an entry. * </p> * <p> * If the attribute already exists, the previous attribute will be * replaced and returned. * </p> * <p> * If the upId is not the ID of an existing AttributeType, an IllegalArgumentException is thrown. * </p> * * @param upId The attribute ID * @param values The list of String values to put. It can be empty. * @return The replaced attribute */ public EntryAttribute put( String upId, String... values ) { try { return put( upId, getAttributeType( upId ), values ); } catch ( LdapException ne ) { String message = I18n.err( I18n.ERR_04464, upId, ne.getLocalizedMessage() ); LOG.error( message ); throw new IllegalArgumentException( message ); } }
/** * {@inheritDoc} */ public String getSchemaName( String oid ) throws LdapException { if ( !OID.isOID( oid ) ) { String msg = I18n.err( I18n.ERR_04267 ); LOG.warn( msg ); throw new LdapException( msg ); } SchemaObject schemaObject = byName.get( oid ); if ( schemaObject != null ) { return schemaObject.getSchemaName(); } String msg = I18n.err( I18n.ERR_04268, oid ); LOG.warn( msg ); throw new LdapException( msg ); }
throw new LdapNoSuchAttributeException( ne.getMessage() );
/** * <p> * Put an attribute (represented by its ID and some values) into an entry. * </p> * <p> * If the attribute already exists, the previous attribute will be * replaced and returned. * </p> * <p> * If the upId is not the ID of an existing AttributeType, an IllegalArgumentException is thrown. * </p> * * @param upId The attribute ID * @param values The list of values to put. It can be empty. * @return The replaced attribute */ public EntryAttribute put( String upId, Value<?>... values ) { try { return put( upId, getAttributeType( upId ), values ); } catch ( LdapException ne ) { String message = I18n.err( I18n.ERR_04464, upId, ne.getLocalizedMessage() ); LOG.error( message ); throw new IllegalArgumentException( message ); } }