HBASE-602 HBase Crash when network card has a IPv6 address

URL encode IPV6 address instead of just changing ':' to '.'

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/branches/0.18@713491 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jim Kellerman 2008-11-12 20:17:27 +00:00
parent d86e9a58b2
commit 38b5c1f5c1
1 changed files with 9 additions and 1 deletions

View File

@ -22,6 +22,8 @@ package org.apache.hadoop.hbase.regionserver;
import java.io.EOFException;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Collections;
import java.util.Map;
import java.util.SortedMap;
@ -726,7 +728,13 @@ public class HLog implements HConstants {
*/
public static String getHLogDirectoryName(HServerInfo info) {
StringBuilder dirName = new StringBuilder("log_");
dirName.append(info.getServerAddress().getBindAddress().replaceAll(":", "."));
try {
dirName.append(URLEncoder.encode(
info.getServerAddress().getBindAddress(), UTF8_ENCODING));
} catch (UnsupportedEncodingException e) {
LOG.error("Error encoding '" + info.getServerAddress().getBindAddress()
+ "'", e);
}
dirName.append("_");
dirName.append(info.getStartCode());
dirName.append("_");