summaryrefslogtreecommitdiffstats
path: root/base/util
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2012-09-20 10:11:22 -0500
committerEndi Sukma Dewata <edewata@redhat.com>2012-09-27 21:22:18 -0500
commit1726794341e9e58256004f040b276fa579161b6b (patch)
treead199a7948f12591902fa34289bcb57c290ad2f5 /base/util
parentf4ecf488c402c8aac9334eb8a27c98dfcd5041f6 (diff)
downloadpki-1726794341e9e58256004f040b276fa579161b6b.tar.gz
pki-1726794341e9e58256004f040b276fa579161b6b.tar.xz
pki-1726794341e9e58256004f040b276fa579161b6b.zip
Renamed escapeDN() into escapeRDNValue().
The escapeDN() has been renamed into escapeRDNValue() for better clarity. Ticket #193
Diffstat (limited to 'base/util')
-rw-r--r--base/util/src/com/netscape/cmsutil/ldap/LDAPUtil.java34
1 files changed, 17 insertions, 17 deletions
diff --git a/base/util/src/com/netscape/cmsutil/ldap/LDAPUtil.java b/base/util/src/com/netscape/cmsutil/ldap/LDAPUtil.java
index ca894d87c..b02ffee78 100644
--- a/base/util/src/com/netscape/cmsutil/ldap/LDAPUtil.java
+++ b/base/util/src/com/netscape/cmsutil/ldap/LDAPUtil.java
@@ -63,47 +63,47 @@ public class LDAPUtil {
/**
* This method escapes special characters for LDAP DN (RFC 1779).
*/
- public static String escapeDN(Object value) {
- return LDAPUtil.escapeDN(value.toString(), false);
+ public static String escapeRDNValue(Object value) {
+ return LDAPUtil.escapeRDNValue(value.toString(), false);
}
- public static String escapeDN(String v, boolean doubleEscape) {
- StringBuffer result = new StringBuffer();
+ public static String escapeRDNValue(String value, boolean doubleEscape) {
+ StringBuilder sb = new StringBuilder();
// Do we need to escape any characters
- for (int i = 0; i < v.length(); i++) {
- int c = v.charAt(i);
+ for (int i = 0; i < value.length(); i++) {
+ int c = value.charAt(i);
if (c == ',' || c == '=' || c == '+' || c == '<' ||
c == '>' || c == '#' || c == ';' || c == '\r' ||
c == '\n' || c == '\\' || c == '"') {
- if ((c == 0x5c) && ((i + 1) < v.length())) {
- int nextC = v.charAt(i + 1);
+ if ((c == 0x5c) && ((i + 1) < value.length())) {
+ int nextC = value.charAt(i + 1);
if ((c == 0x5c) && (nextC == ',' || nextC == '=' || nextC == '+' ||
nextC == '<' || nextC == '>' || nextC == '#' ||
nextC == ';' || nextC == '\r' || nextC == '\n' ||
nextC == '\\' || nextC == '"')) {
if (doubleEscape)
- result.append('\\');
+ sb.append('\\');
} else {
- result.append('\\');
+ sb.append('\\');
if (doubleEscape)
- result.append('\\');
+ sb.append('\\');
}
} else {
- result.append('\\');
+ sb.append('\\');
if (doubleEscape)
- result.append('\\');
+ sb.append('\\');
}
}
if (c == '\r') {
- result.append("0D");
+ sb.append("0D");
} else if (c == '\n') {
- result.append("0A");
+ sb.append("0A");
} else {
- result.append((char) c);
+ sb.append((char) c);
}
}
- return result.toString();
+ return sb.toString();
}
public static void importLDIF(LDAPConnection conn, String filename, ArrayList<String> errors) throws IOException {