throw new LdapLdifException( lide.getMessage() );
/** * Checks to see if a name has name complex name components in it. * * @param name The name to check * @return <code>true</code> if the name has composite components * @throws LdapInvalidDnException If the name is invalid */ public static boolean hasCompositeComponents( String name ) throws LdapInvalidDnException { for ( int ii = name.length() - 1; ii >= 0; ii-- ) { if ( name.charAt( ii ) == '+' ) { if ( ii == 0 ) { throw new LdapInvalidDnException( I18n.err( I18n.ERR_04418, name ) ); } if ( name.charAt( ii - 1 ) != '\\' ) { return true; } } } return false; } }
/** * Creates a new instance of LdapInvalidDnException. * * @param resultCode the ResultCodeEnum for this exception * @param message The exception message */ public LdapInvalidDnException( ResultCodeEnum resultCode, String message ) { super( message ); checkResultCode( resultCode ); this.resultCode = resultCode; }
/** * {@inheritDoc} */ public DN add( String comp ) throws LdapInvalidDnException { if ( comp.length() == 0 ) { return this; } //FIXME this try-catch block is for the time being, during removal of // java.naming.Name we have to remove this try { // We have to parse the nameComponent which is given as an argument RDN newRdn = new RDN( comp ); rdns.add( 0, newRdn ); } catch( LdapInvalidDnException le ) { throw new LdapInvalidDnException( le.getMessage() ); } normalizeInternal(); toUpName(); return this; }
/** * Parses an RDN. * * @param name the string representationof the relative distinguished name * @param rdn the (empty) RDN where parsed ATAVs are put to * * @throws LdapInvalidDnException the invalid name exception */ public void parseRdn( String name, RDN rdn ) throws LdapInvalidDnException { AntlrDnParser dnParser = new AntlrDnParser( new AntlrDnLexer( new StringReader( name ) ) ); try { dnParser.relativeDistinguishedName( rdn ); } catch ( Exception e ) { LdapInvalidDnException ine = new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, e.getMessage() ); ine.initCause( e ); throw ine; } }
String msg = I18n.err( I18n.ERR_04013, dnStr, StringTools.dumpBytes( dnBytes ), ine.getLocalizedMessage() ); log.error( msg ); throw new DecoderException( I18n.err( I18n.ERR_04014, ine.getLocalizedMessage() ) );
jdbmPartition.setSuffix(String.valueOf(dnMicromata)); } catch (LdapInvalidDnException e) { e.printStackTrace(); dnUsers.addAll(dnMicromata); } catch (LdapInvalidDnException e) { e.printStackTrace(); e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); jdbmPartition.setSuffix(String.valueOf(dnDeactivated)); } catch (LdapInvalidDnException e) { e.printStackTrace(); jdbmPartition.setSuffix(String.valueOf(dnRestricted)); } catch (LdapInvalidDnException e) { e.printStackTrace();
/** * {@inheritDoc} */ public DN add( int posn, String comp ) throws LdapInvalidDnException { if ( ( posn < 0 ) || ( posn > size() ) ) { String message = I18n.err( I18n.ERR_04206, posn, rdns.size() ); LOG.error( message ); throw new ArrayIndexOutOfBoundsException( message ); } //FIXME this try-catch block is for the time being, during removal of // java.naming.Name we have to remove this try { // We have to parse the nameComponent which is given as an argument RDN newRdn = new RDN( comp ); int realPos = size() - posn; rdns.add( realPos, newRdn ); } catch( LdapInvalidDnException le ) { throw new LdapInvalidDnException( le.getMessage() ); } normalizeInternal(); toUpName(); return this; }
/** * Parses an DN. * * @param name the string representation of the distinguished name * @param rdns the (empty) list where parsed RDNs are put to * * @throws LdapInvalidDnException the invalid name exception */ public void parseDn( String name, List<RDN> rdns ) throws LdapInvalidDnException { AntlrDnParser dnParser = new AntlrDnParser( new AntlrDnLexer( new StringReader( name ) ) ); try { dnParser.relativeDistinguishedNames( rdns ); } catch ( Exception e ) { LdapInvalidDnException ine = new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, e.getMessage() ); ine.initCause( e ); throw ine; } }
throw new XmlPullParserException( "" + e.getLocalizedMessage(), xpp, null );
throw new LdapLdifException( lide.getMessage() );
throw new LdapInvalidDnException( I18n.err( I18n.ERR_04418, compositeNameComponent ) );
ine.getLocalizedMessage() ); log.error( msg );
/** * Creates a new instance of LdapInvalidDnException. * * @param resultCode the ResultCodeEnum for this exception */ public LdapInvalidDnException( ResultCodeEnum resultCode ) { super( null ); checkResultCode( resultCode ); this.resultCode = resultCode; }
throw new IOException( ine.getMessage() );
/** * Matches the equals character. * * @param name the name * @param pos the pos * * @throws LdapInvalidDnException the invalid name exception */ private void matchEquals( String name, Position pos ) throws LdapInvalidDnException { char c = nextChar( name, pos, true ); if ( c != '=' ) { throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_04200, c, pos.start ) ); } }
throw new LdapLdifException( ine.getMessage() );
/** * Gets the next character. * * @param name the name * @param pos the pos * @param increment true to increment the position * * @return the character * @throws LdapInvalidDnException If no more characters are available */ private char nextChar( String name, Position pos, boolean increment ) throws LdapInvalidDnException { if ( !hasMoreChars( pos ) ) { throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_04201, pos.start ) ); } char c = name.charAt( pos.start ); if ( increment ) { pos.start++; } return c; }
+ ine.getMessage(); log.error( "{} : {}", msg, ine.getMessage() ); throw new DecoderException( msg, ine );
/** * Store the type, after having trimmed and lowercased it. * * @param type The AVA type */ public void setTypeNormalized( String type ) throws LdapInvalidDnException { if ( StringTools.isEmpty( type ) || StringTools.isEmpty( type.trim() ) ) { LOG.error( I18n.err( I18n.ERR_04191 ) ); throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_04191 ) ); } normType = type.trim().toLowerCase(); upType = type; upName = type + upName.substring( upName.indexOf( '=' ) ); start = -1; length = upName.length(); }