Refine search
private void parseMonth() throws ParseException { if ( upGeneralizedTime.length() < 6 ) { throw new ParseException( I18n.err( I18n.ERR_17064_TIME_TO_SHORT_MISSING_MONTH ), 4 ); } try { int month = Strings.parseInt( upGeneralizedTime.substring( 4, 6 ) ); calendar.set( Calendar.MONTH, month - 1 ); } catch ( NumberFormatException e ) { throw new ParseException( I18n.err( I18n.ERR_17065_MONTH_NOT_NUM ), 4 ); } }
return sb.append( format( ERR_BUNDLE.getString( err.getErrorCode() ), args ) ).toString();
/** * Thread safe method parses an OpenLDAP schemaObject element/object. * * @param schemaObject the String image of a complete schema object * @return The list of parsed schema elements * @throws java.io.IOException If the schema file can't be processed * @throws java.text.ParseException If we weren't able to parse the schema */ public synchronized List<SchemaElement> parse( String schemaObject ) throws IOException, ParseException { if ( ( schemaObject == null ) || ( schemaObject.trim().equals( Strings.EMPTY_STRING ) ) ) { throw new ParseException( I18n.err( I18n.ERR_15002_EMPTY_OR_NULL_SCHEMA_OBJECT ), 0 ); } schemaIn = new ByteArrayInputStream( Strings.getBytesUtf8( schemaObject ) ); if ( producerThread == null ) { producerThread = new Thread( new DataProducer() ); } producerThread.start(); return invokeParser( schemaObject ); }
public Entry add( String upId, Value... values ) throws LdapException if ( Strings.isEmpty( upId ) ) String message = I18n.err( I18n.ERR_13204_NULL_ATTRIBUTE_ID ); LOG.error( message ); throw new IllegalArgumentException( message ); add( upId, schemaManager.lookupAttributeTypeRegistry( upId ), values ); attribute.add( values ); attribute.setUpId( upId );
private Dn getDn( Object obj ) throws LdapInvalidDnException { Dn dn; if ( obj instanceof Dn ) { dn = ( Dn ) obj; dn = dn.isSchemaAware() ? dn : new Dn( schemaManager, dn ); } else if ( obj instanceof String ) { dn = new Dn( schemaManager, ( String ) obj ); } else { throw new IllegalStateException( I18n.err( I18n.ERR_13720_CANNOT_HANDLE_DN_COMPARISONS, obj == null ? null : obj.getClass() ) ); } return dn; }
public void action( CertGenerationContainer container ) throws DecoderException { BerValue value = container.getCurrentTLV().getValue(); String issuerDN = Strings.utf8ToString( value.getData() ); if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_08207_ISSUER_DN, issuerDN ) ); } if ( ( issuerDN != null ) && ( issuerDN.trim().length() > 0 ) ) { if ( !Dn.isValid( issuerDN ) ) { String msg = I18n.err( I18n.ERR_08203_INVALID_ISSUER_DN, issuerDN ); LOG.error( msg ); throw new DecoderException( msg ); } container.getCertGenerationRequest().setIssuerDN( issuerDN ); } } } );
LOG.error( I18n.err( I18n.ERR_05301_INVALID_PREVIOUS_DN ) ); throw new DecoderException( I18n.err( I18n.ERR_05302_PREVIOUS_DN_NOT_ALLOWED ) ); previousDn = new Dn( Strings.utf8ToString( value.getData() ) ); LOG.error( I18n.err( I18n.ERR_05303_BAD_PREVIOUS_DN, Strings.dumpBytes( value.getData() ) ) ); throw new DecoderException( I18n.err( I18n.ERR_05304_FAILED_TO_DECODE_PREVIOUS_DN ), ine ); LOG.debug( I18n.msg( I18n.MSG_05301_PREVIOUS_DN, previousDn ) );
/** * {@inheritDoc} */ @Override public BindFuture bindAsync( Dn name, String credentials ) throws LdapException { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04102_BIND_REQUEST, name ) ); } // The password must not be empty or null if ( Strings.isEmpty( credentials ) && ( !Dn.EMPTY_DN.equals( name ) ) ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04105_MISSING_PASSWORD ) ); } throw new LdapAuthenticationException( I18n.msg( I18n.MSG_04105_MISSING_PASSWORD ) ); } // Create the BindRequest BindRequest bindRequest = createBindRequest( name, Strings.getBytesUtf8( credentials ) ); return bindAsync( bindRequest ); }
/** * Returns the attributeType from an Attribute ID. * * @param upId The ID we are looking for * @return The found attributeType * @throws LdapException If the lookup failed */ protected AttributeType getAttributeType( String upId ) throws LdapException { if ( Strings.isEmpty( Strings.trim( upId ) ) ) { String message = I18n.err( I18n.ERR_13204_NULL_ATTRIBUTE_ID ); LOG.error( message ); throw new IllegalArgumentException( message ); } return schemaManager.lookupAttributeTypeRegistry( upId ); }
LOG.debug( I18n.msg( I18n.MSG_05180_NULL_ATTRIBUTE_VALUE ) ); if ( container.isBinary( searchResultEntry.getCurrentAttribute().getId() ) ) LOG.debug( I18n.msg( I18n.MSG_05181_ATTRIBUTE_VALUE, Strings.dumpBytes( ( byte[] ) value ) ) ); value = Strings.utf8ToString( tlv.getValue().getData() ); LOG.debug( I18n.msg( I18n.MSG_05181_ATTRIBUTE_VALUE, value ) );
/** * {@inheritDoc} */ @Override public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException { if ( Strings.isEmpty( value ) ) { return value; } // if value is a numeric id then return it as is if ( checker.isValidSyntax( value ) ) { return value; } // if it is a name we need to do a lookup String oid = schemaManager.getRegistries().getOid( value ); if ( oid != null ) { return oid; } // if all else fails throw new LdapOtherException( I18n.err( I18n.ERR_13725_CANNOT_HANDLE_NAME_AND_OPTIONAL_UID_NORM, value ) ); }
throw new IllegalArgumentException( I18n.err( I18n.ERR_16016_NULL_ENTRY ) ); throw new IllegalArgumentException( I18n.err( I18n.ERR_16017_INVALID_CN_AT ) ); name = entry.get( SchemaConstants.CN_AT ).getString(); throw new IllegalArgumentException( I18n.err( I18n.ERR_16018_INVALID_AT, SchemaConstants.CREATORS_NAME_AT ) ); owner = entry.get( SchemaConstants.CREATORS_NAME_AT ).getString(); String value = entry.get( MetaSchemaConstants.M_DISABLED_AT ).getString(); value = Strings.upperCase( value ); isDisabled = "TRUE".equalsIgnoreCase( value );
public void action( AdDirSyncContainer container ) { BerValue value = container.getCurrentTLV().getValue(); byte[] cookie = value.getData(); if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_08000_COOKIE, Strings.dumpBytes( cookie ) ) ); } container.getAdDirSyncControl().setCookie( cookie ); container.setGrammarEndAllowed( true ); } } );
tmp.loadAllEnabled(); if ( !tmp.getErrors().isEmpty() && loader.isStrict() ) String msg = I18n.err( I18n.ERR_04115_ERROR_LOADING_SCHEMA ); LOG.error( I18n.err( I18n.ERR_05114_ERROR_MESSAGE, msg, Strings.listToString( tmp.getErrors() ) ) ); LOG.error( I18n.err( I18n.ERR_04116_FAIL_LOAD_SCHEMA ), e ); throw new LdapException( e );
/** * Default implementation for this method : just throw an exception. * * @param buf the buffer to append to. * @return The buffer in which the refinement has been appended * @throws UnsupportedOperationException if this node isn't a part of a refinement. */ @Override public StringBuilder printRefinementToBuffer( StringBuilder buf ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_13303_SCOPENODE_IN_REFINEMENT ) ); }
/** * Converts the specified string to byte array of ASCII characters. * * @param data the string to be encoded * @return The string as a byte array. */ private static byte[] getAsciiBytes( final String data ) { if ( data == null ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_17028_PARAMETER_CANT_BE_NULL ) ); } return Strings.getBytesUtf8( data ); }
@Override public void action( SortRequestContainer container ) throws DecoderException { BerValue value = container.getCurrentTLV().getValue(); String matchingRuleOid = Strings.utf8ToString( value.getData() ); if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_05309_MATCHING_RULE_OID, matchingRuleOid ) ); } container.getCurrentKey().setMatchingRuleId( matchingRuleOid ); container.setGrammarEndAllowed( true ); }
/** * Check that the Dn is not null * * @param dn The Dn to check * @throws LdapException If teh Dn is null or empty */ private void checkDn( Dn dn ) throws LdapException { if ( ( dn == null ) || dn.isEmpty() ) { String message = I18n.err( I18n.ERR_12000_CANNOT_PROCESS_EMPTY_DN ); LOG.error( message ); throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, message ); } }
public void checkServerTrusted( X509Certificate[] x509Certificates, String authType, Socket socket ) throws CertificateException { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04169_CHECK_SERVER_TRUSTED, x509Certificates[0] ) ); } }