HBASE-22649: Encode StoreFile path URLs in the UI to handle scenarios where CF contains special characters (like # etc.)
Signed-off-by: Sakthi<sakthi@apache.org>
This commit is contained in:
parent
0ec0a9403f
commit
49718b8b46
|
@ -19,6 +19,8 @@
|
|||
package org.apache.hadoop.hbase.regionserver;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
@ -33,6 +35,7 @@ import org.apache.hadoop.fs.FileSystem;
|
|||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.hbase.Cell;
|
||||
import org.apache.hadoop.hbase.CellComparator;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.HDFSBlocksDistribution;
|
||||
import org.apache.hadoop.hbase.io.TimeRange;
|
||||
import org.apache.hadoop.hbase.io.hfile.BlockType;
|
||||
|
@ -263,6 +266,15 @@ public class HStoreFile implements StoreFile {
|
|||
return this.fileInfo.getPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getEncodedPath() {
|
||||
try {
|
||||
return new Path(URLEncoder.encode(fileInfo.getPath().toString(), HConstants.UTF8_ENCODING));
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
throw new RuntimeException("URLEncoder doesn't support UTF-8", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getQualifiedPath() {
|
||||
return this.fileInfo.getPath().makeQualified(fs.getUri(), fs.getWorkingDirectory());
|
||||
|
|
|
@ -65,6 +65,11 @@ public interface StoreFile {
|
|||
*/
|
||||
Path getPath();
|
||||
|
||||
/**
|
||||
* @return Encoded Path if this StoreFile was made with a Stream.
|
||||
*/
|
||||
Path getEncodedPath();
|
||||
|
||||
/**
|
||||
* @return Returns the qualified path of this StoreFile
|
||||
*/
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
</tr>
|
||||
<% for(StoreFile sf : storeFiles) { %>
|
||||
<tr>
|
||||
<td><a href="storeFile.jsp?name=<%= sf.getPath() %>"><%= sf.getPath() %></a></td>
|
||||
<td><a href="storeFile.jsp?name=<%= sf.getEncodedPath() %>"><%= sf.getPath() %></a></td>
|
||||
<td><%= (int) (rs.getFileSystem().getLength(sf.getPath()) / 1024 / 1024) %></td>
|
||||
<td><%= new Date(sf.getModificationTimestamp()) %></td>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in New Issue