From 68662778cfafc194eb20e50fc7091967f1347d1b Mon Sep 17 00:00:00 2001 From: Mattias Arthursson Date: Wed, 7 Mar 2007 19:57:11 +0000 Subject: [PATCH] Fixed failing test. --- .../ldap/core/LdapEncoder.java | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/spring-ldap/src/main/java/org/springframework/ldap/core/LdapEncoder.java b/spring-ldap/src/main/java/org/springframework/ldap/core/LdapEncoder.java index 16cd6e41..adcf31a3 100644 --- a/spring-ldap/src/main/java/org/springframework/ldap/core/LdapEncoder.java +++ b/spring-ldap/src/main/java/org/springframework/ldap/core/LdapEncoder.java @@ -206,26 +206,22 @@ public class LdapEncoder { if (nextChar == ',' | nextChar == '=' | nextChar == '+' | nextChar == '<' | nextChar == '>' | nextChar == '#' | nextChar == ';' - | nextChar == '\\' | nextChar == '\"') { + | nextChar == '\\' | nextChar == '\"' + | nextChar == ' ') { decoded.append(nextChar); i += 2; } else { if (value.length() <= i + 2) { - // This is the last char, so it should be a space - if (nextChar == ' ') { - decoded.append(nextChar); - i += 2; - } else { - throw new BadLdapGrammarException( - "Unexpected end of value " - + "expected special or hex, found '" - + nextChar + "'"); - } + throw new BadLdapGrammarException( + "Unexpected end of value " + + "expected special or hex, found '" + + nextChar + "'"); } else { // This should be a hex value String hexString = "" + nextChar + value.charAt(i + 2); - decoded.append(Integer.parseInt(hexString, 16)); + decoded.append((char) Integer.parseInt(hexString, + 16)); i += 3; } }