OPENDJ-2339 Avoid double escaping RDN values
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS. |
| | | * Portions copyright 2011-2015 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap; |
| | |
| | | } |
| | | |
| | | /** |
| | | * Test escaping of single space values. |
| | | * |
| | | * @throws Exception |
| | | * If the test failed unexpectedly. |
| | | */ |
| | | @Test |
| | | public void testEscaping() { |
| | | RDN rdn = new RDN(ATTR_TYPE_DC, ByteString.valueOf(" ")); |
| | | assertEquals(rdn.toString(), "dc=\\ "); |
| | | } |
| | | |
| | | /** |
| | | * Test RDN hashCode |
| | | * |
| | | * @param first |
| | |
| | | if (c == ' ' || c == '#') { |
| | | buffer.append('\\'); |
| | | buffer.append(c); |
| | | if (length == 1) { |
| | | return buffer.toString(); |
| | | } |
| | | start = 1; |
| | | } |
| | | |
| | |
| | | private ByteString AV_CN; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Set up the environment for performing the tests in this suite. |
| | | * |
| | |
| | | |
| | | |
| | | /** |
| | | * Test escaping of single space values. |
| | | * |
| | | * @throws Exception If the test failed unexpectedly. |
| | | */ |
| | | @Test |
| | | public void testEscaping() { |
| | | RDN rdn = new RDN(AT_DC, ByteString.valueOf(" ")); |
| | | assertEquals(rdn.toString(), "dc=\\ "); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * RDN test data provider. |
| | | * |
| | | * @return The array of test RDN strings. |