bharathv commented on a change in pull request #1879:
URL: https://github.com/apache/hbase/pull/1879#discussion_r437681253
##########
File path:
hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/HQuorumPeer.java
##########
@@ -85,14 +85,20 @@ public static void main(String[] args) {
}
private static void runZKServer(QuorumPeerConfig zkConfig) throws
UnknownHostException, IOException {
Review comment:
UnknownHostException is also an IOE, so I think you can just remove
UnknownHostException from the method signature and all is good? no need to
try/catch/wrap blocks?
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServer.java
##########
@@ -66,8 +66,14 @@ public HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain(String[] args)
* @throws IOException
* @throws InterruptedException
*/
- void runCmdLine() throws KeeperException, IOException,
InterruptedException {
- processCmd(this.cl);
+ void runCmdLine() throws IOException, InterruptedException {
+ try {
+ processCmd(this.cl);
+ } catch (IOException | InterruptedException e) {
+ throw e;
+ } catch (Exception e) {
Review comment:
Why this? Any un-checked exception is propagated as-is?
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestHQuorumPeer.java
##########
@@ -111,25 +115,39 @@
QuorumPeerConfig config = new QuorumPeerConfig();
config.parseProperties(properties);
- assertEquals(this.dataDir.toString(), config.getDataDir());
+ assertEquals(this.dataDir.toString(), config.getDataDir().toString());
assertEquals(2181, config.getClientPortAddress().getPort());
Map<Long,QuorumServer> servers = config.getServers();
assertEquals(3, servers.size());
assertTrue(servers.containsKey(Long.valueOf(0)));
QuorumServer server = servers.get(Long.valueOf(0));
- assertEquals("localhost", server.addr.getHostName());
+ assertEquals("localhost", getHostName(server));
// Override with system property.
System.setProperty("hbase.master.hostname", "foo.bar");
is = new ByteArrayInputStream(s.getBytes());
properties = ZKConfig.parseZooCfg(conf, is);
assertEquals("foo.bar:2888:3888", properties.get("server.0"));
-
config.parseProperties(properties);
servers = config.getServers();
server = servers.get(Long.valueOf(0));
- assertEquals("foo.bar", server.addr.getHostName());
+ assertEquals("foo.bar", getHostName(server));
+ }
+
+ private static String getHostName(QuorumServer server) throws Exception {
+ String hostname;
+ switch (server.addr.getClass().getName()) {
Review comment:
nit: I think this for cross-version compatibility, a quick comment would
be nice.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]