On 04/05/2016 10:48 AM, Emmanuel Lécharny wrote: > One more step ! > > Yesterday evening, I as able to work on the DeepTrimToLowerNormalizer > class, which is used to deal with the caseIgnoreMatch MatchingRule (the > most crequent Matching Rule), and I discovered that the java > Normalizer.normalize() method was already handling the combining > characters, which is otherwise a nightmare to handle (well, not that > much, but still). That will simplify the insignificantSpaceHandling > process a LOT. > > Here is what will look like the DeepTrimToLowerNormalizer.normalize( > Value ) method : > > public Value normalize( Value value, PrepareString.AssertionType > assertionType ) throws LdapException > { > if ( value == null ) > { > return null; > } > > try > { > // Transcoding > String transcoded = PrepareString.transcode( value.getBytes() ); > > // Map > String mapped = PrepareString.map( value, > PrepareString.IGNORE_CASE ); > > // Normalize > String normalized = PrepareString.normalize( mapped ); > > // Prohibit > PrepareString.checkProhibited( normalized ); > > // Bidi is ignored > > // Insignificant Characters Handling > String normValue = PrepareString.insignificantSpaceHandling( > normalized, assertionType ); > > return new Value( value.getAttributeType(), > value.getValue(), normalized ); > } > catch ( IOException ioe ) > { > throw new LdapInvalidAttributeValueException( > ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err( > I18n.ERR_04224, value ), ioe ); > } > } > > Note that this method work only for Values or non-substrings assertions > (ie, assertions used in a filter that is not a SubstringFilter). For > substrings assertions (Initial, Any or Final, like the strings in a > filter '(cn=test*abc*end)'), we have to add a new parameter to the > normalize method. I'll deal with that later. > > As you can see, this is all but simple... Making my way through the > jungle though ;-)
Thanks Emmanuel for the update and the effort. It makes totally sense to do it right, I'm sure we will benefit from it. Kind Regards, Stefan