http://git-wip-us.apache.org/repos/asf/hadoop/blob/7136e8c5/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/DataTransferSaslUtil.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/DataTransferSaslUtil.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/DataTransferSaslUtil.java
index 006d304..5e07550 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/DataTransferSaslUtil.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/DataTransferSaslUtil.java
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -69,7 +69,7 @@ import com.google.protobuf.ByteString;
 public final class DataTransferSaslUtil {
 
   private static final Logger LOG = LoggerFactory.getLogger(
-    DataTransferSaslUtil.class);
+      DataTransferSaslUtil.class);
 
   /**
    * Delimiter for the three-part SASL username string.
@@ -97,20 +97,20 @@ public final class DataTransferSaslUtil {
       throw new IOException("Failed to complete SASL handshake");
     }
     Set<String> requestedQop = ImmutableSet.copyOf(Arrays.asList(
-      saslProps.get(Sasl.QOP).split(",")));
+        saslProps.get(Sasl.QOP).split(",")));
     String negotiatedQop = sasl.getNegotiatedQop();
     LOG.debug("Verifying QOP, requested QOP = {}, negotiated QOP = {}",
-      requestedQop, negotiatedQop);
+        requestedQop, negotiatedQop);
     if (!requestedQop.contains(negotiatedQop)) {
       throw new IOException(String.format("SASL handshake completed, but " +
-        "channel does not have acceptable quality of protection, " +
-        "requested = %s, negotiated = %s", requestedQop, negotiatedQop));
+          "channel does not have acceptable quality of protection, " +
+          "requested = %s, negotiated = %s", requestedQop, negotiatedQop));
     }
   }
-  
+
   /**
    * Check whether requested SASL Qop contains privacy.
-   * 
+   *
    * @param saslProps properties of SASL negotiation
    * @return boolean true if privacy exists
    */
@@ -145,7 +145,7 @@ public final class DataTransferSaslUtil {
    */
   public static char[] encryptionKeyToPassword(byte[] encryptionKey) {
     return new String(Base64.encodeBase64(encryptionKey, false), 
Charsets.UTF_8)
-      .toCharArray();
+        .toCharArray();
   }
 
   /**
@@ -153,7 +153,6 @@ public final class DataTransferSaslUtil {
    * [host][/ip-address]:port.  The host may be missing.  The IP address (and
    * preceding '/') may be missing.  The port preceded by ':' is always 
present.
    *
-   * @param peer
    * @return InetAddress from peer
    */
   public static InetAddress getPeerAddress(Peer peer) {
@@ -181,23 +180,26 @@ public final class DataTransferSaslUtil {
     String qops = conf.get(DFS_DATA_TRANSFER_PROTECTION_KEY);
     if (qops == null || qops.isEmpty()) {
       LOG.debug("DataTransferProtocol not using SaslPropertiesResolver, no " +
-        "QOP found in configuration for {}", DFS_DATA_TRANSFER_PROTECTION_KEY);
+          "QOP found in configuration for {}",
+          DFS_DATA_TRANSFER_PROTECTION_KEY);
       return null;
     }
     Configuration saslPropsResolverConf = new Configuration(conf);
     saslPropsResolverConf.set(HADOOP_RPC_PROTECTION, qops);
     Class<? extends SaslPropertiesResolver> resolverClass = conf.getClass(
-      HADOOP_SECURITY_SASL_PROPS_RESOLVER_CLASS,
-      SaslPropertiesResolver.class, SaslPropertiesResolver.class);
-    resolverClass = 
conf.getClass(DFS_DATA_TRANSFER_SASL_PROPS_RESOLVER_CLASS_KEY,
-      resolverClass, SaslPropertiesResolver.class);
+        HADOOP_SECURITY_SASL_PROPS_RESOLVER_CLASS,
+        SaslPropertiesResolver.class, SaslPropertiesResolver.class);
+    resolverClass =
+        conf.getClass(DFS_DATA_TRANSFER_SASL_PROPS_RESOLVER_CLASS_KEY,
+        resolverClass, SaslPropertiesResolver.class);
     saslPropsResolverConf.setClass(HADOOP_SECURITY_SASL_PROPS_RESOLVER_CLASS,
-      resolverClass, SaslPropertiesResolver.class);
+        resolverClass, SaslPropertiesResolver.class);
     SaslPropertiesResolver resolver = SaslPropertiesResolver.getInstance(
-      saslPropsResolverConf);
+        saslPropsResolverConf);
     LOG.debug("DataTransferProtocol using SaslPropertiesResolver, configured " 
+
-      "QOP {} = {}, configured class {} = {}", 
DFS_DATA_TRANSFER_PROTECTION_KEY, qops, 
-      DFS_DATA_TRANSFER_SASL_PROPS_RESOLVER_CLASS_KEY, resolverClass);
+            "QOP {} = {}, configured class {} = {}",
+        DFS_DATA_TRANSFER_PROTECTION_KEY, qops,
+        DFS_DATA_TRANSFER_SASL_PROPS_RESOLVER_CLASS_KEY, resolverClass);
     return resolver;
   }
 
@@ -219,10 +221,10 @@ public final class DataTransferSaslUtil {
       return proto.getPayload().toByteArray();
     }
   }
-  
+
   /**
-   * Reads a SASL negotiation message and negotiation cipher options. 
-   * 
+   * Reads a SASL negotiation message and negotiation cipher options.
+   *
    * @param in stream to read
    * @param cipherOptions list to store negotiation cipher options
    * @return byte[] SASL negotiation message
@@ -246,10 +248,10 @@ public final class DataTransferSaslUtil {
       return proto.getPayload().toByteArray();
     }
   }
-  
+
   /**
    * Negotiate a cipher option which server supports.
-   * 
+   *
    * @param conf the configuration
    * @param options the cipher options which client supports
    * @return CipherOption negotiated cipher option
@@ -279,6 +281,7 @@ public final class DataTransferSaslUtil {
           byte[] inIv = new byte[suite.getAlgorithmBlockSize()];
           byte[] outKey = new byte[keyLen];
           byte[] outIv = new byte[suite.getAlgorithmBlockSize()];
+          assert codec != null;
           codec.generateSecureRandom(inKey);
           codec.generateSecureRandom(inIv);
           codec.generateSecureRandom(outKey);
@@ -289,21 +292,21 @@ public final class DataTransferSaslUtil {
     }
     return null;
   }
-  
+
   /**
    * Send SASL message and negotiated cipher option to client.
-   * 
+   *
    * @param out stream to receive message
    * @param payload to send
    * @param option negotiated cipher option
    * @throws IOException for any error
    */
   public static void sendSaslMessageAndNegotiatedCipherOption(
-      OutputStream out, byte[] payload, CipherOption option) 
-          throws IOException {
+      OutputStream out, byte[] payload, CipherOption option)
+      throws IOException {
     DataTransferEncryptorMessageProto.Builder builder =
         DataTransferEncryptorMessageProto.newBuilder();
-    
+
     builder.setStatus(DataTransferEncryptorStatus.SUCCESS);
     if (payload != null) {
       builder.setPayload(ByteString.copyFrom(payload));
@@ -311,16 +314,16 @@ public final class DataTransferSaslUtil {
     if (option != null) {
       builder.addCipherOption(PBHelperClient.convert(option));
     }
-    
+
     DataTransferEncryptorMessageProto proto = builder.build();
     proto.writeDelimitedTo(out);
     out.flush();
   }
-  
+
   /**
    * Create IOStreamPair of {@link org.apache.hadoop.crypto.CryptoInputStream}
    * and {@link org.apache.hadoop.crypto.CryptoOutputStream}
-   * 
+   *
    * @param conf the configuration
    * @param cipherOption negotiated cipher option
    * @param out underlying output stream
@@ -330,7 +333,7 @@ public final class DataTransferSaslUtil {
    * @throws IOException for any error
    */
   public static IOStreamPair createStreamPair(Configuration conf,
-      CipherOption cipherOption, OutputStream out, InputStream in, 
+      CipherOption cipherOption, OutputStream out, InputStream in,
       boolean isServer) throws IOException {
     LOG.debug("Creating IOStreamPair of CryptoInputStream and "
         + "CryptoOutputStream.");
@@ -340,9 +343,9 @@ public final class DataTransferSaslUtil {
     byte[] inIv = cipherOption.getInIv();
     byte[] outKey = cipherOption.getOutKey();
     byte[] outIv = cipherOption.getOutIv();
-    InputStream cIn = new CryptoInputStream(in, codec, 
+    InputStream cIn = new CryptoInputStream(in, codec,
         isServer ? inKey : outKey, isServer ? inIv : outIv);
-    OutputStream cOut = new CryptoOutputStream(out, codec, 
+    OutputStream cOut = new CryptoOutputStream(out, codec,
         isServer ? outKey : inKey, isServer ? outIv : inIv);
     return new IOStreamPair(cIn, cOut);
   }
@@ -370,10 +373,10 @@ public final class DataTransferSaslUtil {
       throws IOException {
     sendSaslMessage(out, DataTransferEncryptorStatus.SUCCESS, payload, null);
   }
-  
+
   /**
    * Send a SASL negotiation message and negotiation cipher options to server.
-   * 
+   *
    * @param out stream to receive message
    * @param payload to send
    * @param options cipher options to negotiate
@@ -381,10 +384,10 @@ public final class DataTransferSaslUtil {
    */
   public static void sendSaslMessageAndNegotiationCipherOptions(
       OutputStream out, byte[] payload, List<CipherOption> options)
-          throws IOException {
+      throws IOException {
     DataTransferEncryptorMessageProto.Builder builder =
         DataTransferEncryptorMessageProto.newBuilder();
-    
+
     builder.setStatus(DataTransferEncryptorStatus.SUCCESS);
     if (payload != null) {
       builder.setPayload(ByteString.copyFrom(payload));
@@ -392,23 +395,23 @@ public final class DataTransferSaslUtil {
     if (options != null) {
       builder.addAllCipherOption(PBHelperClient.convertCipherOptions(options));
     }
-    
+
     DataTransferEncryptorMessageProto proto = builder.build();
     proto.writeDelimitedTo(out);
     out.flush();
   }
-  
+
   /**
    * Read SASL message and negotiated cipher option from server.
-   * 
+   *
    * @param in stream to read
-   * @return SaslResponseWithNegotiatedCipherOption SASL message and 
+   * @return SaslResponseWithNegotiatedCipherOption SASL message and
    * negotiated cipher option
    * @throws IOException for any error
    */
   public static SaslResponseWithNegotiatedCipherOption
       readSaslMessageAndNegotiatedCipherOption(InputStream in)
-          throws IOException {
+      throws IOException {
     DataTransferEncryptorMessageProto proto =
         DataTransferEncryptorMessageProto.parseFrom(vintPrefixed(in));
     if (proto.getStatus() == DataTransferEncryptorStatus.ERROR_UNKNOWN_KEY) {
@@ -426,17 +429,17 @@ public final class DataTransferSaslUtil {
       return new SaslResponseWithNegotiatedCipherOption(response, option);
     }
   }
-  
+
   /**
    * Encrypt the key and iv of the negotiated cipher option.
-   * 
+   *
    * @param option negotiated cipher option
    * @param sasl SASL participant representing server
-   * @return CipherOption negotiated cipher option which contains the 
+   * @return CipherOption negotiated cipher option which contains the
    * encrypted key and iv
    * @throws IOException for any error
    */
-  public static CipherOption wrap(CipherOption option, SaslParticipant sasl) 
+  public static CipherOption wrap(CipherOption option, SaslParticipant sasl)
       throws IOException {
     if (option != null) {
       byte[] inKey = option.getInKey();
@@ -450,16 +453,16 @@ public final class DataTransferSaslUtil {
       return new CipherOption(option.getCipherSuite(), inKey, option.getInIv(),
           outKey, option.getOutIv());
     }
-    
+
     return null;
   }
-  
+
   /**
    * Decrypt the key and iv of the negotiated cipher option.
-   * 
+   *
    * @param option negotiated cipher option
    * @param sasl SASL participant representing client
-   * @return CipherOption negotiated cipher option which contains the 
+   * @return CipherOption negotiated cipher option which contains the
    * decrypted key and iv
    * @throws IOException for any error
    */
@@ -477,7 +480,7 @@ public final class DataTransferSaslUtil {
       return new CipherOption(option.getCipherSuite(), inKey, option.getInIv(),
           outKey, option.getOutIv());
     }
-    
+
     return null;
   }
 
@@ -492,10 +495,10 @@ public final class DataTransferSaslUtil {
    */
   public static void sendSaslMessage(OutputStream out,
       DataTransferEncryptorStatus status, byte[] payload, String message)
-          throws IOException {
+      throws IOException {
     DataTransferEncryptorMessageProto.Builder builder =
         DataTransferEncryptorMessageProto.newBuilder();
-    
+
     builder.setStatus(status);
     if (payload != null) {
       builder.setPayload(ByteString.copyFrom(payload));
@@ -503,7 +506,7 @@ public final class DataTransferSaslUtil {
     if (message != null) {
       builder.setMessage(message);
     }
-    
+
     DataTransferEncryptorMessageProto proto = builder.build();
     proto.writeDelimitedTo(out);
     out.flush();

http://git-wip-us.apache.org/repos/asf/hadoop/blob/7136e8c5/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslDataTransferClient.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslDataTransferClient.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslDataTransferClient.java
index 913203c..447d6e1 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslDataTransferClient.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslDataTransferClient.java
@@ -76,7 +76,7 @@ import com.google.common.collect.Lists;
 public class SaslDataTransferClient {
 
   private static final Logger LOG = LoggerFactory.getLogger(
-    SaslDataTransferClient.class);
+      SaslDataTransferClient.class);
 
   private final Configuration conf;
   private final AtomicBoolean fallbackToSimpleAuth;
@@ -94,7 +94,7 @@ public class SaslDataTransferClient {
    * @param trustedChannelResolver for identifying trusted connections that do
    *   not require SASL negotiation
    */
-  public SaslDataTransferClient(Configuration conf, 
+  public SaslDataTransferClient(Configuration conf,
       SaslPropertiesResolver saslPropsResolver,
       TrustedChannelResolver trustedChannelResolver) {
     this(conf, saslPropsResolver, trustedChannelResolver, null);
@@ -110,7 +110,7 @@ public class SaslDataTransferClient {
    * @param fallbackToSimpleAuth checked on each attempt at general SASL
    *   handshake, if true forces use of simple auth
    */
-  public SaslDataTransferClient(Configuration conf, 
+  public SaslDataTransferClient(Configuration conf,
       SaslPropertiesResolver saslPropsResolver,
       TrustedChannelResolver trustedChannelResolver,
       AtomicBoolean fallbackToSimpleAuth) {
@@ -138,9 +138,9 @@ public class SaslDataTransferClient {
       throws IOException {
     // The encryption key factory only returns a key if encryption is enabled.
     DataEncryptionKey encryptionKey = !trustedChannelResolver.isTrusted() ?
-      encryptionKeyFactory.newDataEncryptionKey() : null;
+        encryptionKeyFactory.newDataEncryptionKey() : null;
     IOStreamPair ios = send(socket.getInetAddress(), underlyingOut,
-      underlyingIn, encryptionKey, accessToken, datanodeId);
+        underlyingIn, encryptionKey, accessToken, datanodeId);
     return ios != null ? ios : new IOStreamPair(underlyingIn, underlyingOut);
   }
 
@@ -158,8 +158,8 @@ public class SaslDataTransferClient {
       Token<BlockTokenIdentifier> accessToken, DatanodeID datanodeId)
       throws IOException {
     IOStreamPair ios = checkTrustAndSend(getPeerAddress(peer),
-      peer.getOutputStream(), peer.getInputStream(), encryptionKeyFactory,
-      accessToken, datanodeId);
+        peer.getOutputStream(), peer.getInputStream(), encryptionKeyFactory,
+        accessToken, datanodeId);
     // TODO: Consider renaming EncryptedPeer to SaslPeer.
     return ios != null ? new EncryptedPeer(peer, ios) : peer;
   }
@@ -181,7 +181,7 @@ public class SaslDataTransferClient {
       Token<BlockTokenIdentifier> accessToken, DatanodeID datanodeId)
       throws IOException {
     IOStreamPair ios = checkTrustAndSend(socket.getInetAddress(), 
underlyingOut,
-      underlyingIn, encryptionKeyFactory, accessToken, datanodeId);
+        underlyingIn, encryptionKeyFactory, accessToken, datanodeId);
     return ios != null ? ios : new IOStreamPair(underlyingIn, underlyingOut);
   }
 
@@ -207,13 +207,13 @@ public class SaslDataTransferClient {
         !trustedChannelResolver.isTrusted(addr)) {
       // The encryption key factory only returns a key if encryption is 
enabled.
       DataEncryptionKey encryptionKey =
-        encryptionKeyFactory.newDataEncryptionKey();
+          encryptionKeyFactory.newDataEncryptionKey();
       return send(addr, underlyingOut, underlyingIn, encryptionKey, 
accessToken,
-        datanodeId);
+          datanodeId);
     } else {
       LOG.debug(
-        "SASL client skipping handshake on trusted connection for addr = {}, "
-        + "datanodeId = {}", addr, datanodeId);
+          "SASL client skipping handshake on trusted connection for addr = {}, 
"
+              + "datanodeId = {}", addr, datanodeId);
       return null;
     }
   }
@@ -236,40 +236,38 @@ public class SaslDataTransferClient {
       Token<BlockTokenIdentifier> accessToken, DatanodeID datanodeId)
       throws IOException {
     if (encryptionKey != null) {
-      LOG.debug(
-        "SASL client doing encrypted handshake for addr = {}, datanodeId = {}",
-        addr, datanodeId);
+      LOG.debug("SASL client doing encrypted handshake for addr = {}, "
+          + "datanodeId = {}", addr, datanodeId);
       return getEncryptedStreams(underlyingOut, underlyingIn,
-        encryptionKey);
+          encryptionKey);
     } else if (!UserGroupInformation.isSecurityEnabled()) {
-      LOG.debug(
-        "SASL client skipping handshake in unsecured configuration for "
-        + "addr = {}, datanodeId = {}", addr, datanodeId);
+      LOG.debug("SASL client skipping handshake in unsecured configuration for 
"
+          + "addr = {}, datanodeId = {}", addr, datanodeId);
       return null;
     } else if (SecurityUtil.isPrivilegedPort(datanodeId.getXferPort())) {
       LOG.debug(
-        "SASL client skipping handshake in secured configuration with "
-        + "privileged port for addr = {}, datanodeId = {}", addr, datanodeId);
+          "SASL client skipping handshake in secured configuration with "
+              + "privileged port for addr = {}, datanodeId = {}",
+          addr, datanodeId);
       return null;
     } else if (fallbackToSimpleAuth != null && fallbackToSimpleAuth.get()) {
       LOG.debug(
-        "SASL client skipping handshake in secured configuration with "
-        + "unsecured cluster for addr = {}, datanodeId = {}", addr, 
datanodeId);
+          "SASL client skipping handshake in secured configuration with "
+              + "unsecured cluster for addr = {}, datanodeId = {}",
+          addr, datanodeId);
       return null;
     } else if (saslPropsResolver != null) {
       LOG.debug(
-        "SASL client doing general handshake for addr = {}, datanodeId = {}",
-        addr, datanodeId);
-      return getSaslStreams(addr, underlyingOut, underlyingIn, accessToken,
-        datanodeId);
+          "SASL client doing general handshake for addr = {}, datanodeId = {}",
+          addr, datanodeId);
+      return getSaslStreams(addr, underlyingOut, underlyingIn, accessToken);
     } else {
       // It's a secured cluster using non-privileged ports, but no SASL.  The
       // only way this can happen is if the DataNode has
-      // ignore.secure.ports.for.testing configured, so this is a rare edge 
case.
-      LOG.debug(
-        "SASL client skipping handshake in secured configuration with no SASL "
-        + "protection configured for addr = {}, datanodeId = {}",
-        addr, datanodeId);
+      // ignore.secure.ports.for.testing configured so this is a rare edge 
case.
+      LOG.debug("SASL client skipping handshake in secured configuration with "
+              + "no SASL protection configured for addr = {}, datanodeId = {}",
+          addr, datanodeId);
       return null;
     }
   }
@@ -287,24 +285,24 @@ public class SaslDataTransferClient {
       InputStream underlyingIn, DataEncryptionKey encryptionKey)
       throws IOException {
     Map<String, String> saslProps = createSaslPropertiesForEncryption(
-      encryptionKey.encryptionAlgorithm);
+        encryptionKey.encryptionAlgorithm);
 
     LOG.debug("Client using encryption algorithm {}",
-      encryptionKey.encryptionAlgorithm);
+        encryptionKey.encryptionAlgorithm);
 
     String userName = getUserNameFromEncryptionKey(encryptionKey);
     char[] password = encryptionKeyToPassword(encryptionKey.encryptionKey);
     CallbackHandler callbackHandler = new SaslClientCallbackHandler(userName,
-      password);
+        password);
     return doSaslHandshake(underlyingOut, underlyingIn, userName, saslProps,
-      callbackHandler);
+        callbackHandler);
   }
 
   /**
    * The SASL username for an encrypted handshake consists of the keyId,
    * blockPoolId, and nonce with the first two encoded as Strings, and the 
third
    * encoded using Base64. The fields are each separated by a single space.
-   * 
+   *
    * @param encryptionKey the encryption key to encode as a SASL username.
    * @return encoded username containing keyId, blockPoolId, and nonce
    */
@@ -312,7 +310,8 @@ public class SaslDataTransferClient {
       DataEncryptionKey encryptionKey) {
     return encryptionKey.keyId + NAME_DELIMITER +
         encryptionKey.blockPoolId + NAME_DELIMITER +
-        new String(Base64.encodeBase64(encryptionKey.nonce, false), 
Charsets.UTF_8);
+        new String(Base64.encodeBase64(encryptionKey.nonce, false),
+            Charsets.UTF_8);
   }
 
   /**
@@ -328,7 +327,7 @@ public class SaslDataTransferClient {
      * Creates a new SaslClientCallbackHandler.
      *
      * @param userName SASL user name
-     * @Param password SASL password
+     * @param password SASL password
      */
     public SaslClientCallbackHandler(String userName, char[] password) {
       this.password = password;
@@ -342,15 +341,13 @@ public class SaslDataTransferClient {
       PasswordCallback pc = null;
       RealmCallback rc = null;
       for (Callback callback : callbacks) {
-        if (callback instanceof RealmChoiceCallback) {
-          continue;
-        } else if (callback instanceof NameCallback) {
+        if (callback instanceof NameCallback) {
           nc = (NameCallback) callback;
         } else if (callback instanceof PasswordCallback) {
           pc = (PasswordCallback) callback;
         } else if (callback instanceof RealmCallback) {
           rc = (RealmCallback) callback;
-        } else {
+        } else if (!(callback instanceof RealmChoiceCallback)) {
           throw new UnsupportedCallbackException(callback,
               "Unrecognized SASL client callback");
         }
@@ -374,22 +371,21 @@ public class SaslDataTransferClient {
    * @param underlyingOut connection output stream
    * @param underlyingIn connection input stream
    * @param accessToken connection block access token
-   * @param datanodeId ID of destination DataNode
    * @return new pair of streams, wrapped after SASL negotiation
    * @throws IOException for any error
    */
   private IOStreamPair getSaslStreams(InetAddress addr,
       OutputStream underlyingOut, InputStream underlyingIn,
-      Token<BlockTokenIdentifier> accessToken, DatanodeID datanodeId)
+      Token<BlockTokenIdentifier> accessToken)
       throws IOException {
     Map<String, String> saslProps = 
saslPropsResolver.getClientProperties(addr);
 
     String userName = buildUserName(accessToken);
     char[] password = buildClientPassword(accessToken);
     CallbackHandler callbackHandler = new SaslClientCallbackHandler(userName,
-      password);
+        password);
     return doSaslHandshake(underlyingOut, underlyingIn, userName, saslProps,
-      callbackHandler);
+        callbackHandler);
   }
 
   /**
@@ -404,7 +400,7 @@ public class SaslDataTransferClient {
    */
   private static String buildUserName(Token<BlockTokenIdentifier> blockToken) {
     return new String(Base64.encodeBase64(blockToken.getIdentifier(), false),
-      Charsets.UTF_8);
+        Charsets.UTF_8);
   }
 
   /**
@@ -413,10 +409,10 @@ public class SaslDataTransferClient {
    *
    * @param blockToken for block access
    * @return SASL password
-   */    
+   */
   private char[] buildClientPassword(Token<BlockTokenIdentifier> blockToken) {
     return new String(Base64.encodeBase64(blockToken.getPassword(), false),
-      Charsets.UTF_8).toCharArray();
+        Charsets.UTF_8).toCharArray();
   }
 
   /**
@@ -438,7 +434,7 @@ public class SaslDataTransferClient {
     DataInputStream in = new DataInputStream(underlyingIn);
 
     SaslParticipant sasl= SaslParticipant.createClientSaslParticipant(userName,
-      saslProps, callbackHandler);
+        saslProps, callbackHandler);
 
     out.writeInt(SASL_TRANSFER_MAGIC_NUMBER);
     out.flush();
@@ -467,11 +463,11 @@ public class SaslDataTransferClient {
           cipherOptions.add(option);
         }
       }
-      sendSaslMessageAndNegotiationCipherOptions(out, localResponse, 
+      sendSaslMessageAndNegotiationCipherOptions(out, localResponse,
           cipherOptions);
 
       // step 2 (client-side only)
-      SaslResponseWithNegotiatedCipherOption response = 
+      SaslResponseWithNegotiatedCipherOption response =
           readSaslMessageAndNegotiatedCipherOption(in);
       localResponse = sasl.evaluateChallengeOrResponse(response.payload);
       assert localResponse == null;
@@ -485,11 +481,11 @@ public class SaslDataTransferClient {
         cipherOption = unwrap(response.cipherOption, sasl);
       }
 
-      // If negotiated cipher option is not null, we will use it to create 
+      // If negotiated cipher option is not null, we will use it to create
       // stream pair.
       return cipherOption != null ? createStreamPair(
-          conf, cipherOption, underlyingOut, underlyingIn, false) : 
-            sasl.createStreamPair(out, in);
+          conf, cipherOption, underlyingOut, underlyingIn, false) :
+          sasl.createStreamPair(out, in);
     } catch (IOException ioe) {
       sendGenericSaslErrorMessage(out, ioe.getMessage());
       throw ioe;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/7136e8c5/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslParticipant.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslParticipant.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslParticipant.java
index f14a075..1db9f50 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslParticipant.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslParticipant.java
@@ -129,20 +129,20 @@ class SaslParticipant {
       return (String) saslServer.getNegotiatedProperty(Sasl.QOP);
     }
   }
-  
+
   /**
    * After successful SASL negotiation, returns whether it's QOP privacy
-   * 
+   *
    * @return boolean whether it's QOP privacy
    */
   public boolean isNegotiatedQopPrivacy() {
     String qop = getNegotiatedQop();
     return qop != null && "auth-conf".equalsIgnoreCase(qop);
   }
-  
+
   /**
    * Wraps a byte array.
-   * 
+   *
    * @param bytes The array containing the bytes to wrap.
    * @param off The starting position at the array
    * @param len The number of bytes to wrap
@@ -156,10 +156,10 @@ class SaslParticipant {
       return saslServer.wrap(bytes, off, len);
     }
   }
-  
+
   /**
    * Unwraps a byte array.
-   * 
+   *
    * @param bytes The array containing the bytes to unwrap.
    * @param off The starting position at the array
    * @param len The number of bytes to unwrap

http://git-wip-us.apache.org/repos/asf/hadoop/blob/7136e8c5/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslResponseWithNegotiatedCipherOption.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslResponseWithNegotiatedCipherOption.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslResponseWithNegotiatedCipherOption.java
index f69441b..c1eef4f 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslResponseWithNegotiatedCipherOption.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslResponseWithNegotiatedCipherOption.java
@@ -24,10 +24,10 @@ import org.apache.hadoop.crypto.CipherOption;
 public class SaslResponseWithNegotiatedCipherOption {
   final byte[] payload;
   final CipherOption cipherOption;
-  
-  public SaslResponseWithNegotiatedCipherOption(byte[] payload, 
+
+  public SaslResponseWithNegotiatedCipherOption(byte[] payload,
       CipherOption cipherOption) {
     this.payload = payload;
     this.cipherOption = cipherOption;
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/7136e8c5/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolPB.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolPB.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolPB.java
index 7e3f66b..5e6c919 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolPB.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolPB.java
@@ -28,7 +28,7 @@ import org.apache.hadoop.security.token.TokenInfo;
 @KerberosInfo(
     serverPrincipal = HdfsClientConfigKeys.DFS_DATANODE_KERBEROS_PRINCIPAL_KEY)
 @TokenInfo(BlockTokenSelector.class)
-@ProtocolInfo(protocolName = 
+@ProtocolInfo(protocolName =
     "org.apache.hadoop.hdfs.protocol.ClientDatanodeProtocol",
     protocolVersion = 1)
 @InterfaceAudience.Private

http://git-wip-us.apache.org/repos/asf/hadoop/blob/7136e8c5/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolTranslatorPB.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolTranslatorPB.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolTranslatorPB.java
index 24e1dd2..b9f7a4d 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolTranslatorPB.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolTranslatorPB.java
@@ -85,11 +85,11 @@ public class ClientDatanodeProtocolTranslatorPB implements
     ProtocolTranslator, Closeable {
   public static final Logger LOG = LoggerFactory
       .getLogger(ClientDatanodeProtocolTranslatorPB.class);
-  
+
   /** RpcController is not used and hence is set to null */
   private final static RpcController NULL_CONTROLLER = null;
   private final ClientDatanodeProtocolPB rpcProxy;
-  private final static RefreshNamenodesRequestProto VOID_REFRESH_NAMENODES = 
+  private final static RefreshNamenodesRequestProto VOID_REFRESH_NAMENODES =
       RefreshNamenodesRequestProto.newBuilder().build();
   private final static GetDatanodeInfoRequestProto VOID_GET_DATANODE_INFO =
       GetDatanodeInfoRequestProto.newBuilder().build();
@@ -107,16 +107,16 @@ public class ClientDatanodeProtocolTranslatorPB implements
   public ClientDatanodeProtocolTranslatorPB(DatanodeID datanodeid,
       Configuration conf, int socketTimeout, boolean connectToDnViaHostname,
       LocatedBlock locatedBlock) throws IOException {
-    rpcProxy = createClientDatanodeProtocolProxy( datanodeid, conf, 
-                  socketTimeout, connectToDnViaHostname, locatedBlock);
+    rpcProxy = createClientDatanodeProtocolProxy( datanodeid, conf,
+        socketTimeout, connectToDnViaHostname, locatedBlock);
   }
-  
+
   public ClientDatanodeProtocolTranslatorPB(InetSocketAddress addr,
       UserGroupInformation ticket, Configuration conf, SocketFactory factory)
       throws IOException {
     rpcProxy = createClientDatanodeProtocolProxy(addr, ticket, conf, factory, 
0);
   }
-  
+
   /**
    * Constructor.
    * @param datanodeid Datanode to connect to.
@@ -138,7 +138,8 @@ public class ClientDatanodeProtocolTranslatorPB implements
 
   static ClientDatanodeProtocolPB createClientDatanodeProtocolProxy(
       DatanodeID datanodeid, Configuration conf, int socketTimeout,
-      boolean connectToDnViaHostname, LocatedBlock locatedBlock) throws 
IOException {
+      boolean connectToDnViaHostname, LocatedBlock locatedBlock)
+      throws IOException {
     final String dnAddr = datanodeid.getIpcAddr(connectToDnViaHostname);
     InetSocketAddress addr = NetUtils.createSocketAddr(dnAddr);
     LOG.debug("Connecting to datanode {} addr={}", dnAddr, addr);
@@ -160,7 +161,7 @@ public class ClientDatanodeProtocolTranslatorPB implements
     return createClientDatanodeProtocolProxy(addr, ticket, confWithNoIpcIdle,
         NetUtils.getDefaultSocketFactory(conf), socketTimeout);
   }
-  
+
   static ClientDatanodeProtocolPB createClientDatanodeProtocolProxy(
       InetSocketAddress addr, UserGroupInformation ticket, Configuration conf,
       SocketFactory factory, int socketTimeout) throws IOException {
@@ -178,8 +179,9 @@ public class ClientDatanodeProtocolTranslatorPB implements
 
   @Override
   public long getReplicaVisibleLength(ExtendedBlock b) throws IOException {
-    GetReplicaVisibleLengthRequestProto req = 
GetReplicaVisibleLengthRequestProto
-        .newBuilder().setBlock(PBHelperClient.convert(b)).build();
+    GetReplicaVisibleLengthRequestProto req =
+        GetReplicaVisibleLengthRequestProto.newBuilder()
+            .setBlock(PBHelperClient.convert(b)).build();
     try {
       return rpcProxy.getReplicaVisibleLength(NULL_CONTROLLER, 
req).getLength();
     } catch (ServiceException e) {
@@ -212,8 +214,8 @@ public class ClientDatanodeProtocolTranslatorPB implements
       Token<BlockTokenIdentifier> token) throws IOException {
     GetBlockLocalPathInfoRequestProto req =
         GetBlockLocalPathInfoRequestProto.newBuilder()
-        .setBlock(PBHelperClient.convert(block))
-        .setToken(PBHelperClient.convert(token)).build();
+            .setBlock(PBHelperClient.convert(block))
+            .setToken(PBHelperClient.convert(token)).build();
     GetBlockLocalPathInfoResponseProto resp;
     try {
       resp = rpcProxy.getBlockLocalPathInfo(NULL_CONTROLLER, req);
@@ -251,7 +253,8 @@ public class ClientDatanodeProtocolTranslatorPB implements
   public DatanodeLocalInfo getDatanodeInfo() throws IOException {
     GetDatanodeInfoResponseProto response;
     try {
-      response = rpcProxy.getDatanodeInfo(NULL_CONTROLLER, 
VOID_GET_DATANODE_INFO);
+      response = rpcProxy.getDatanodeInfo(NULL_CONTROLLER,
+          VOID_GET_DATANODE_INFO);
       return PBHelperClient.convert(response.getLocalInfo());
     } catch (ServiceException e) {
       throw ProtobufHelper.getRemoteException(e);
@@ -268,7 +271,8 @@ public class ClientDatanodeProtocolTranslatorPB implements
   }
 
   @Override
-  public ReconfigurationTaskStatus getReconfigurationStatus() throws 
IOException {
+  public ReconfigurationTaskStatus getReconfigurationStatus()
+      throws IOException {
     GetReconfigurationStatusResponseProto response;
     Map<PropertyChange, Optional<String>> statusMap = null;
     long startTime;
@@ -318,8 +322,8 @@ public class ClientDatanodeProtocolTranslatorPB implements
     try {
       rpcProxy.triggerBlockReport(NULL_CONTROLLER,
           TriggerBlockReportRequestProto.newBuilder().
-            setIncremental(options.isIncremental()).
-            build());
+              setIncremental(options.isIncremental()).
+              build());
     } catch (ServiceException e) {
       throw ProtobufHelper.getRemoteException(e);
     }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/7136e8c5/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolPB.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolPB.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolPB.java
index e7ce44b..2e0603a 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolPB.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolPB.java
@@ -37,10 +37,10 @@ import org.apache.hadoop.security.token.TokenInfo;
     protocolVersion = 1)
 /**
  * Protocol that a clients use to communicate with the NameNode.
- * 
+ *
  * Note: This extends the protocolbuffer service based interface to
  * add annotations required for security.
  */
-public interface ClientNamenodeProtocolPB extends 
-  ClientNamenodeProtocol.BlockingInterface {
+public interface ClientNamenodeProtocolPB extends
+    ClientNamenodeProtocol.BlockingInterface {
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/7136e8c5/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java
index 7b02691..ff13b22 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java
@@ -18,7 +18,6 @@
 package org.apache.hadoop.hdfs.protocolPB;
 
 import java.io.Closeable;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.EnumSet;
@@ -33,12 +32,9 @@ import 
org.apache.hadoop.fs.BatchedRemoteIterator.BatchedEntries;
 import org.apache.hadoop.fs.CacheFlag;
 import org.apache.hadoop.fs.ContentSummary;
 import org.apache.hadoop.fs.CreateFlag;
-import org.apache.hadoop.fs.FileAlreadyExistsException;
 import org.apache.hadoop.fs.FsServerDefaults;
 import org.apache.hadoop.fs.Options.Rename;
-import org.apache.hadoop.fs.ParentNotDirectoryException;
 import org.apache.hadoop.fs.StorageType;
-import org.apache.hadoop.fs.UnresolvedLinkException;
 import org.apache.hadoop.fs.XAttr;
 import org.apache.hadoop.fs.XAttrSetFlag;
 import org.apache.hadoop.fs.permission.AclEntry;
@@ -46,7 +42,6 @@ import org.apache.hadoop.fs.permission.AclStatus;
 import org.apache.hadoop.fs.permission.FsAction;
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.hdfs.inotify.EventBatchList;
-import org.apache.hadoop.hdfs.protocol.AlreadyBeingCreatedException;
 import org.apache.hadoop.hdfs.protocol.BlockStoragePolicy;
 import org.apache.hadoop.hdfs.protocol.CacheDirectiveEntry;
 import org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo;
@@ -54,7 +49,6 @@ import org.apache.hadoop.hdfs.protocol.CachePoolEntry;
 import org.apache.hadoop.hdfs.protocol.CachePoolInfo;
 import org.apache.hadoop.hdfs.protocol.ClientProtocol;
 import org.apache.hadoop.hdfs.protocol.CorruptFileBlocks;
-import org.apache.hadoop.hdfs.protocol.DSQuotaExceededException;
 import org.apache.hadoop.hdfs.protocol.DatanodeID;
 import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
 import org.apache.hadoop.hdfs.protocol.DirectoryListing;
@@ -67,7 +61,6 @@ import org.apache.hadoop.hdfs.protocol.HdfsFileStatus;
 import org.apache.hadoop.hdfs.protocol.LastBlockWithStatus;
 import org.apache.hadoop.hdfs.protocol.LocatedBlock;
 import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
-import org.apache.hadoop.hdfs.protocol.NSQuotaExceededException;
 import org.apache.hadoop.hdfs.protocol.RollingUpgradeInfo;
 import org.apache.hadoop.hdfs.protocol.SnapshotDiffReport;
 import org.apache.hadoop.hdfs.protocol.SnapshottableDirectoryStatus;
@@ -177,8 +170,6 @@ import 
org.apache.hadoop.hdfs.protocol.proto.XAttrProtos.RemoveXAttrRequestProto
 import org.apache.hadoop.hdfs.protocol.proto.XAttrProtos.SetXAttrRequestProto;
 import org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey;
 import 
org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier;
-import org.apache.hadoop.hdfs.server.namenode.NotReplicatedYetException;
-import org.apache.hadoop.hdfs.server.namenode.SafeModeException;
 import org.apache.hadoop.hdfs.server.protocol.DatanodeStorageReport;
 import org.apache.hadoop.io.EnumSetWritable;
 import org.apache.hadoop.io.Text;
@@ -188,7 +179,6 @@ import org.apache.hadoop.ipc.ProtocolMetaInterface;
 import org.apache.hadoop.ipc.ProtocolTranslator;
 import org.apache.hadoop.ipc.RPC;
 import org.apache.hadoop.ipc.RpcClientUtil;
-import org.apache.hadoop.security.AccessControlException;
 import 
org.apache.hadoop.security.proto.SecurityProtos.CancelDelegationTokenRequestProto;
 import 
org.apache.hadoop.security.proto.SecurityProtos.GetDelegationTokenRequestProto;
 import 
org.apache.hadoop.security.proto.SecurityProtos.GetDelegationTokenResponseProto;
@@ -213,41 +203,38 @@ public class ClientNamenodeProtocolTranslatorPB implements
     ProtocolMetaInterface, ClientProtocol, Closeable, ProtocolTranslator {
   final private ClientNamenodeProtocolPB rpcProxy;
 
-  static final GetServerDefaultsRequestProto VOID_GET_SERVER_DEFAULT_REQUEST = 
-  GetServerDefaultsRequestProto.newBuilder().build();
+  static final GetServerDefaultsRequestProto VOID_GET_SERVER_DEFAULT_REQUEST =
+      GetServerDefaultsRequestProto.newBuilder().build();
 
   private final static GetFsStatusRequestProto VOID_GET_FSSTATUS_REQUEST =
-  GetFsStatusRequestProto.newBuilder().build();
+      GetFsStatusRequestProto.newBuilder().build();
 
-  private final static SaveNamespaceRequestProto VOID_SAVE_NAMESPACE_REQUEST =
-  SaveNamespaceRequestProto.newBuilder().build();
-
-  private final static RollEditsRequestProto VOID_ROLLEDITS_REQUEST = 
-  RollEditsRequestProto.getDefaultInstance();
+  private final static RollEditsRequestProto VOID_ROLLEDITS_REQUEST =
+      RollEditsRequestProto.getDefaultInstance();
 
   private final static RefreshNodesRequestProto VOID_REFRESH_NODES_REQUEST =
-  RefreshNodesRequestProto.newBuilder().build();
+      RefreshNodesRequestProto.newBuilder().build();
 
   private final static FinalizeUpgradeRequestProto
-  VOID_FINALIZE_UPGRADE_REQUEST =
+      VOID_FINALIZE_UPGRADE_REQUEST =
       FinalizeUpgradeRequestProto.newBuilder().build();
 
   private final static GetDataEncryptionKeyRequestProto
-  VOID_GET_DATA_ENCRYPTIONKEY_REQUEST =
+      VOID_GET_DATA_ENCRYPTIONKEY_REQUEST =
       GetDataEncryptionKeyRequestProto.newBuilder().build();
 
   private final static GetStoragePoliciesRequestProto
-  VOID_GET_STORAGE_POLICIES_REQUEST =
+      VOID_GET_STORAGE_POLICIES_REQUEST =
       GetStoragePoliciesRequestProto.newBuilder().build();
 
   private final static GetErasureCodingPoliciesRequestProto
-  VOID_GET_EC_POLICIES_REQUEST = GetErasureCodingPoliciesRequestProto
+      VOID_GET_EC_POLICIES_REQUEST = GetErasureCodingPoliciesRequestProto
       .newBuilder().build();
 
   public ClientNamenodeProtocolTranslatorPB(ClientNamenodeProtocolPB proxy) {
     rpcProxy = proxy;
   }
-  
+
   @Override
   public void close() {
     RPC.stopProxy(rpcProxy);
@@ -255,8 +242,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
 
   @Override
   public LocatedBlocks getBlockLocations(String src, long offset, long length)
-      throws AccessControlException, FileNotFoundException,
-      UnresolvedLinkException, IOException {
+      throws IOException {
     GetBlockLocationsRequestProto req = GetBlockLocationsRequestProto
         .newBuilder()
         .setSrc(src)
@@ -267,7 +253,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
       GetBlockLocationsResponseProto resp = rpcProxy.getBlockLocations(null,
           req);
       return resp.hasLocations() ?
-        PBHelperClient.convert(resp.getLocations()) : null;
+          PBHelperClient.convert(resp.getLocations()) : null;
     } catch (ServiceException e) {
       throw ProtobufHelper.getRemoteException(e);
     }
@@ -287,13 +273,9 @@ public class ClientNamenodeProtocolTranslatorPB implements
   @Override
   public HdfsFileStatus create(String src, FsPermission masked,
       String clientName, EnumSetWritable<CreateFlag> flag,
-      boolean createParent, short replication, long blockSize, 
+      boolean createParent, short replication, long blockSize,
       CryptoProtocolVersion[] supportedVersions)
-      throws AccessControlException, AlreadyBeingCreatedException,
-      DSQuotaExceededException, FileAlreadyExistsException,
-      FileNotFoundException, NSQuotaExceededException,
-      ParentNotDirectoryException, SafeModeException, UnresolvedLinkException,
-      IOException {
+      throws IOException {
     CreateRequestProto.Builder builder = CreateRequestProto.newBuilder()
         .setSrc(src)
         .setMasked(PBHelperClient.convert(masked))
@@ -302,7 +284,8 @@ public class ClientNamenodeProtocolTranslatorPB implements
         .setCreateParent(createParent)
         .setReplication(replication)
         .setBlockSize(blockSize);
-    
builder.addAllCryptoProtocolVersion(PBHelperClient.convert(supportedVersions));
+    builder.addAllCryptoProtocolVersion(
+        PBHelperClient.convert(supportedVersions));
     CreateRequestProto req = builder.build();
     try {
       CreateResponseProto res = rpcProxy.create(null, req);
@@ -315,7 +298,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
 
   @Override
   public boolean truncate(String src, long newLength, String clientName)
-      throws IOException, UnresolvedLinkException {
+      throws IOException {
     TruncateRequestProto req = TruncateRequestProto.newBuilder()
         .setSrc(src)
         .setNewLength(newLength)
@@ -330,18 +313,17 @@ public class ClientNamenodeProtocolTranslatorPB implements
 
   @Override
   public LastBlockWithStatus append(String src, String clientName,
-      EnumSetWritable<CreateFlag> flag) throws AccessControlException,
-      DSQuotaExceededException, FileNotFoundException, SafeModeException,
-      UnresolvedLinkException, IOException {
+      EnumSetWritable<CreateFlag> flag) throws IOException {
     AppendRequestProto req = AppendRequestProto.newBuilder().setSrc(src)
-        
.setClientName(clientName).setFlag(PBHelperClient.convertCreateFlag(flag))
+        .setClientName(clientName).setFlag(
+            PBHelperClient.convertCreateFlag(flag))
         .build();
     try {
       AppendResponseProto res = rpcProxy.append(null, req);
       LocatedBlock lastBlock = res.hasBlock() ? PBHelperClient
           .convertLocatedBlockProto(res.getBlock()) : null;
-      HdfsFileStatus stat = (res.hasStat()) ? 
PBHelperClient.convert(res.getStat())
-          : null;
+      HdfsFileStatus stat = (res.hasStat()) ?
+          PBHelperClient.convert(res.getStat()) : null;
       return new LastBlockWithStatus(lastBlock, stat);
     } catch (ServiceException e) {
       throw ProtobufHelper.getRemoteException(e);
@@ -350,9 +332,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
 
   @Override
   public boolean setReplication(String src, short replication)
-      throws AccessControlException, DSQuotaExceededException,
-      FileNotFoundException, SafeModeException, UnresolvedLinkException,
-      IOException {
+      throws IOException {
     SetReplicationRequestProto req = SetReplicationRequestProto.newBuilder()
         .setSrc(src)
         .setReplication(replication)
@@ -366,8 +346,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
 
   @Override
   public void setPermission(String src, FsPermission permission)
-      throws AccessControlException, FileNotFoundException, SafeModeException,
-      UnresolvedLinkException, IOException {
+      throws IOException {
     SetPermissionRequestProto req = SetPermissionRequestProto.newBuilder()
         .setSrc(src)
         .setPermission(PBHelperClient.convert(permission))
@@ -381,14 +360,13 @@ public class ClientNamenodeProtocolTranslatorPB implements
 
   @Override
   public void setOwner(String src, String username, String groupname)
-      throws AccessControlException, FileNotFoundException, SafeModeException,
-      UnresolvedLinkException, IOException {
+      throws IOException {
     SetOwnerRequestProto.Builder req = SetOwnerRequestProto.newBuilder()
         .setSrc(src);
     if (username != null)
-        req.setUsername(username);
+      req.setUsername(username);
     if (groupname != null)
-        req.setGroupname(groupname);
+      req.setGroupname(groupname);
     try {
       rpcProxy.setOwner(null, req.build());
     } catch (ServiceException e) {
@@ -398,28 +376,24 @@ public class ClientNamenodeProtocolTranslatorPB implements
 
   @Override
   public void abandonBlock(ExtendedBlock b, long fileId, String src,
-      String holder) throws AccessControlException, FileNotFoundException,
-        UnresolvedLinkException, IOException {
+      String holder) throws IOException {
     AbandonBlockRequestProto req = AbandonBlockRequestProto.newBuilder()
         .setB(PBHelperClient.convert(b)).setSrc(src).setHolder(holder)
-            .setFileId(fileId).build();
+        .setFileId(fileId).build();
     try {
       rpcProxy.abandonBlock(null, req);
     } catch (ServiceException e) {
       throw ProtobufHelper.getRemoteException(e);
     }
   }
-  
+
   @Override
   public LocatedBlock addBlock(String src, String clientName,
       ExtendedBlock previous, DatanodeInfo[] excludeNodes, long fileId,
-      String[] favoredNodes)
-      throws AccessControlException, FileNotFoundException,
-      NotReplicatedYetException, SafeModeException, UnresolvedLinkException,
-      IOException {
+      String[] favoredNodes) throws IOException {
     AddBlockRequestProto.Builder req = AddBlockRequestProto.newBuilder()
         .setSrc(src).setClientName(clientName).setFileId(fileId);
-    if (previous != null) 
+    if (previous != null)
       req.setPrevious(PBHelperClient.convert(previous));
     if (excludeNodes != null)
       req.addAllExcludeNodes(PBHelperClient.convert(excludeNodes));
@@ -437,10 +411,8 @@ public class ClientNamenodeProtocolTranslatorPB implements
   @Override
   public LocatedBlock getAdditionalDatanode(String src, long fileId,
       ExtendedBlock blk, DatanodeInfo[] existings, String[] existingStorageIDs,
-      DatanodeInfo[] excludes,
-      int numAdditionalNodes, String clientName) throws AccessControlException,
-      FileNotFoundException, SafeModeException, UnresolvedLinkException,
-      IOException {
+      DatanodeInfo[] excludes, int numAdditionalNodes, String clientName)
+      throws IOException {
     GetAdditionalDatanodeRequestProto req = GetAdditionalDatanodeRequestProto
         .newBuilder()
         .setSrc(src)
@@ -462,9 +434,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
 
   @Override
   public boolean complete(String src, String clientName,
-                          ExtendedBlock last, long fileId)
-      throws AccessControlException, FileNotFoundException, SafeModeException,
-      UnresolvedLinkException, IOException {
+      ExtendedBlock last, long fileId) throws IOException {
     CompleteRequestProto.Builder req = CompleteRequestProto.newBuilder()
         .setSrc(src)
         .setClientName(clientName)
@@ -481,7 +451,8 @@ public class ClientNamenodeProtocolTranslatorPB implements
   @Override
   public void reportBadBlocks(LocatedBlock[] blocks) throws IOException {
     ReportBadBlocksRequestProto req = ReportBadBlocksRequestProto.newBuilder()
-        
.addAllBlocks(Arrays.asList(PBHelperClient.convertLocatedBlocks(blocks)))
+        .addAllBlocks(Arrays.asList(
+            PBHelperClient.convertLocatedBlocks(blocks)))
         .build();
     try {
       rpcProxy.reportBadBlocks(null, req);
@@ -491,8 +462,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
   }
 
   @Override
-  public boolean rename(String src, String dst) throws UnresolvedLinkException,
-      IOException {
+  public boolean rename(String src, String dst) throws IOException {
     RenameRequestProto req = RenameRequestProto.newBuilder()
         .setSrc(src)
         .setDst(dst).build();
@@ -502,14 +472,11 @@ public class ClientNamenodeProtocolTranslatorPB implements
       throw ProtobufHelper.getRemoteException(e);
     }
   }
-  
+
 
   @Override
   public void rename2(String src, String dst, Rename... options)
-      throws AccessControlException, DSQuotaExceededException,
-      FileAlreadyExistsException, FileNotFoundException,
-      NSQuotaExceededException, ParentNotDirectoryException, SafeModeException,
-      UnresolvedLinkException, IOException {
+      throws IOException {
     boolean overwrite = false;
     if (options != null) {
       for (Rename option : options) {
@@ -531,8 +498,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
   }
 
   @Override
-  public void concat(String trg, String[] srcs) throws IOException,
-      UnresolvedLinkException {
+  public void concat(String trg, String[] srcs) throws IOException {
     ConcatRequestProto req = ConcatRequestProto.newBuilder().
         setTrg(trg).
         addAllSrcs(Arrays.asList(srcs)).build();
@@ -545,10 +511,9 @@ public class ClientNamenodeProtocolTranslatorPB implements
 
 
   @Override
-  public boolean delete(String src, boolean recursive)
-      throws AccessControlException, FileNotFoundException, SafeModeException,
-      UnresolvedLinkException, IOException {
-    DeleteRequestProto req = 
DeleteRequestProto.newBuilder().setSrc(src).setRecursive(recursive).build();
+  public boolean delete(String src, boolean recursive) throws IOException {
+    DeleteRequestProto req = DeleteRequestProto.newBuilder().setSrc(src)
+        .setRecursive(recursive).build();
     try {
       return rpcProxy.delete(null, req).getResult();
     } catch (ServiceException e) {
@@ -558,10 +523,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
 
   @Override
   public boolean mkdirs(String src, FsPermission masked, boolean createParent)
-      throws AccessControlException, FileAlreadyExistsException,
-      FileNotFoundException, NSQuotaExceededException,
-      ParentNotDirectoryException, SafeModeException, UnresolvedLinkException,
-      IOException {
+      throws IOException {
     MkdirsRequestProto req = MkdirsRequestProto.newBuilder()
         .setSrc(src)
         .setMasked(PBHelperClient.convert(masked))
@@ -576,15 +538,14 @@ public class ClientNamenodeProtocolTranslatorPB implements
 
   @Override
   public DirectoryListing getListing(String src, byte[] startAfter,
-      boolean needLocation) throws AccessControlException,
-      FileNotFoundException, UnresolvedLinkException, IOException {
+      boolean needLocation) throws IOException {
     GetListingRequestProto req = GetListingRequestProto.newBuilder()
         .setSrc(src)
         .setStartAfter(ByteString.copyFrom(startAfter))
         .setNeedLocation(needLocation).build();
     try {
       GetListingResponseProto result = rpcProxy.getListing(null, req);
-      
+
       if (result.hasDirList()) {
         return PBHelperClient.convert(result.getDirList());
       }
@@ -595,8 +556,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
   }
 
   @Override
-  public void renewLease(String clientName) throws AccessControlException,
-      IOException {
+  public void renewLease(String clientName) throws IOException {
     RenewLeaseRequestProto req = RenewLeaseRequestProto.newBuilder()
         .setClientName(clientName).build();
     try {
@@ -616,7 +576,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
       return rpcProxy.recoverLease(null, req).getResult();
     } catch (ServiceException e) {
       throw ProtobufHelper.getRemoteException(e);
-    }  
+    }
   }
 
   @Override
@@ -644,22 +604,22 @@ public class ClientNamenodeProtocolTranslatorPB implements
   }
 
   @Override
-  public DatanodeStorageReport[] getDatanodeStorageReport(DatanodeReportType 
type)
-      throws IOException {
+  public DatanodeStorageReport[] getDatanodeStorageReport(
+      DatanodeReportType type) throws IOException {
     final GetDatanodeStorageReportRequestProto req
         = GetDatanodeStorageReportRequestProto.newBuilder()
-            .setType(PBHelperClient.convert(type)).build();
+        .setType(PBHelperClient.convert(type)).build();
     try {
       return PBHelperClient.convertDatanodeStorageReports(
-          rpcProxy.getDatanodeStorageReport(null, 
req).getDatanodeStorageReportsList());
+          rpcProxy.getDatanodeStorageReport(null, req)
+              .getDatanodeStorageReportsList());
     } catch (ServiceException e) {
       throw ProtobufHelper.getRemoteException(e);
     }
   }
 
   @Override
-  public long getPreferredBlockSize(String filename) throws IOException,
-      UnresolvedLinkException {
+  public long getPreferredBlockSize(String filename) throws IOException {
     GetPreferredBlockSizeRequestProto req = GetPreferredBlockSizeRequestProto
         .newBuilder()
         .setFilename(filename)
@@ -672,9 +632,11 @@ public class ClientNamenodeProtocolTranslatorPB implements
   }
 
   @Override
-  public boolean setSafeMode(SafeModeAction action, boolean isChecked) throws 
IOException {
+  public boolean setSafeMode(SafeModeAction action, boolean isChecked)
+      throws IOException {
     SetSafeModeRequestProto req = SetSafeModeRequestProto.newBuilder()
-        
.setAction(PBHelperClient.convert(action)).setChecked(isChecked).build();
+        .setAction(PBHelperClient.convert(action))
+        .setChecked(isChecked).build();
     try {
       return rpcProxy.setSafeMode(null, req).getResult();
     } catch (ServiceException e) {
@@ -692,9 +654,9 @@ public class ClientNamenodeProtocolTranslatorPB implements
       throw ProtobufHelper.getRemoteException(e);
     }
   }
-  
+
   @Override
-  public long rollEdits() throws AccessControlException, IOException {
+  public long rollEdits() throws IOException {
     try {
       RollEditsResponseProto resp = rpcProxy.rollEdits(null,
           VOID_ROLLEDITS_REQUEST);
@@ -705,8 +667,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
   }
 
   @Override
-  public boolean restoreFailedStorage(String arg) 
-      throws AccessControlException, IOException{
+  public boolean restoreFailedStorage(String arg) throws IOException{
     RestoreFailedStorageRequestProto req = RestoreFailedStorageRequestProto
         .newBuilder()
         .setArg(arg).build();
@@ -736,11 +697,13 @@ public class ClientNamenodeProtocolTranslatorPB implements
   }
 
   @Override
-  public RollingUpgradeInfo rollingUpgrade(RollingUpgradeAction action) throws 
IOException {
+  public RollingUpgradeInfo rollingUpgrade(RollingUpgradeAction action)
+      throws IOException {
     final RollingUpgradeRequestProto r = 
RollingUpgradeRequestProto.newBuilder()
         .setAction(PBHelperClient.convert(action)).build();
     try {
-      final RollingUpgradeResponseProto proto = rpcProxy.rollingUpgrade(null, 
r);
+      final RollingUpgradeResponseProto proto =
+          rpcProxy.rollingUpgrade(null, r);
       if (proto.hasRollingUpgradeInfo()) {
         return PBHelperClient.convert(proto.getRollingUpgradeInfo());
       }
@@ -753,9 +716,9 @@ public class ClientNamenodeProtocolTranslatorPB implements
   @Override
   public CorruptFileBlocks listCorruptFileBlocks(String path, String cookie)
       throws IOException {
-    ListCorruptFileBlocksRequestProto.Builder req = 
-        ListCorruptFileBlocksRequestProto.newBuilder().setPath(path);   
-    if (cookie != null) 
+    ListCorruptFileBlocksRequestProto.Builder req =
+        ListCorruptFileBlocksRequestProto.newBuilder().setPath(path);
+    if (cookie != null)
       req.setCookie(cookie);
     try {
       return PBHelperClient.convert(
@@ -778,8 +741,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
   }
 
   @Override
-  public HdfsFileStatus getFileInfo(String src) throws AccessControlException,
-      FileNotFoundException, UnresolvedLinkException, IOException {
+  public HdfsFileStatus getFileInfo(String src) throws IOException {
     GetFileInfoRequestProto req = GetFileInfoRequestProto.newBuilder()
         .setSrc(src).build();
     try {
@@ -791,23 +753,21 @@ public class ClientNamenodeProtocolTranslatorPB implements
   }
 
   @Override
-  public HdfsFileStatus getFileLinkInfo(String src)
-      throws AccessControlException, UnresolvedLinkException, IOException {
+  public HdfsFileStatus getFileLinkInfo(String src) throws IOException {
     GetFileLinkInfoRequestProto req = GetFileLinkInfoRequestProto.newBuilder()
         .setSrc(src).build();
     try {
       GetFileLinkInfoResponseProto result = rpcProxy.getFileLinkInfo(null, 
req);
-      return result.hasFs() ?  
-          PBHelperClient.convert(rpcProxy.getFileLinkInfo(null, req).getFs()) 
: null;
+      return result.hasFs() ?
+          PBHelperClient.convert(rpcProxy.getFileLinkInfo(null, req).getFs()) :
+          null;
     } catch (ServiceException e) {
       throw ProtobufHelper.getRemoteException(e);
     }
   }
 
   @Override
-  public ContentSummary getContentSummary(String path)
-      throws AccessControlException, FileNotFoundException,
-      UnresolvedLinkException, IOException {
+  public ContentSummary getContentSummary(String path) throws IOException {
     GetContentSummaryRequestProto req = GetContentSummaryRequestProto
         .newBuilder()
         .setPath(path)
@@ -822,9 +782,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
 
   @Override
   public void setQuota(String path, long namespaceQuota, long 
storagespaceQuota,
-                       StorageType type)
-      throws AccessControlException, FileNotFoundException,
-      UnresolvedLinkException, IOException {
+      StorageType type) throws IOException {
     final SetQuotaRequestProto.Builder builder
         = SetQuotaRequestProto.newBuilder()
         .setPath(path)
@@ -843,12 +801,10 @@ public class ClientNamenodeProtocolTranslatorPB implements
 
   @Override
   public void fsync(String src, long fileId, String client,
-                    long lastBlockLength)
-      throws AccessControlException, FileNotFoundException,
-      UnresolvedLinkException, IOException {
+      long lastBlockLength) throws IOException {
     FsyncRequestProto req = FsyncRequestProto.newBuilder().setSrc(src)
         .setClient(client).setLastBlockLength(lastBlockLength)
-            .setFileId(fileId).build();
+        .setFileId(fileId).build();
     try {
       rpcProxy.fsync(null, req);
     } catch (ServiceException e) {
@@ -857,9 +813,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
   }
 
   @Override
-  public void setTimes(String src, long mtime, long atime)
-      throws AccessControlException, FileNotFoundException,
-      UnresolvedLinkException, IOException {
+  public void setTimes(String src, long mtime, long atime) throws IOException {
     SetTimesRequestProto req = SetTimesRequestProto.newBuilder()
         .setSrc(src)
         .setMtime(mtime)
@@ -874,10 +828,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
 
   @Override
   public void createSymlink(String target, String link, FsPermission dirPerm,
-      boolean createParent) throws AccessControlException,
-      FileAlreadyExistsException, FileNotFoundException,
-      ParentNotDirectoryException, SafeModeException, UnresolvedLinkException,
-      IOException {
+      boolean createParent) throws IOException {
     CreateSymlinkRequestProto req = CreateSymlinkRequestProto.newBuilder()
         .setTarget(target)
         .setLink(link)
@@ -892,8 +843,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
   }
 
   @Override
-  public String getLinkTarget(String path) throws AccessControlException,
-      FileNotFoundException, IOException {
+  public String getLinkTarget(String path) throws IOException {
     GetLinkTargetRequestProto req = GetLinkTargetRequestProto.newBuilder()
         .setPath(path).build();
     try {
@@ -922,7 +872,8 @@ public class ClientNamenodeProtocolTranslatorPB implements
 
   @Override
   public void updatePipeline(String clientName, ExtendedBlock oldBlock,
-      ExtendedBlock newBlock, DatanodeID[] newNodes, String[] storageIDs) 
throws IOException {
+      ExtendedBlock newBlock, DatanodeID[] newNodes, String[] storageIDs)
+      throws IOException {
     UpdatePipelineRequestProto req = UpdatePipelineRequestProto.newBuilder()
         .setClientName(clientName)
         .setOldBlock(PBHelperClient.convert(oldBlock))
@@ -945,9 +896,10 @@ public class ClientNamenodeProtocolTranslatorPB implements
         .setRenewer(renewer == null ? "" : renewer.toString())
         .build();
     try {
-      GetDelegationTokenResponseProto resp = rpcProxy.getDelegationToken(null, 
req);
-      return resp.hasToken() ? 
PBHelperClient.convertDelegationToken(resp.getToken())
-          : null;
+      GetDelegationTokenResponseProto resp =
+          rpcProxy.getDelegationToken(null, req);
+      return resp.hasToken() ?
+          PBHelperClient.convertDelegationToken(resp.getToken()) : null;
     } catch (ServiceException e) {
       throw ProtobufHelper.getRemoteException(e);
     }
@@ -956,9 +908,10 @@ public class ClientNamenodeProtocolTranslatorPB implements
   @Override
   public long renewDelegationToken(Token<DelegationTokenIdentifier> token)
       throws IOException {
-    RenewDelegationTokenRequestProto req = 
RenewDelegationTokenRequestProto.newBuilder().
-        setToken(PBHelperClient.convert(token)).
-        build();
+    RenewDelegationTokenRequestProto req =
+        RenewDelegationTokenRequestProto.newBuilder().
+            setToken(PBHelperClient.convert(token)).
+            build();
     try {
       return rpcProxy.renewDelegationToken(null, req).getNewExpiryTime();
     } catch (ServiceException e) {
@@ -982,9 +935,10 @@ public class ClientNamenodeProtocolTranslatorPB implements
 
   @Override
   public void setBalancerBandwidth(long bandwidth) throws IOException {
-    SetBalancerBandwidthRequestProto req = 
SetBalancerBandwidthRequestProto.newBuilder()
-        .setBandwidth(bandwidth)
-        .build();
+    SetBalancerBandwidthRequestProto req =
+        SetBalancerBandwidthRequestProto.newBuilder()
+            .setBandwidth(bandwidth)
+            .build();
     try {
       rpcProxy.setBalancerBandwidth(null, req);
     } catch (ServiceException e) {
@@ -998,23 +952,22 @@ public class ClientNamenodeProtocolTranslatorPB implements
         ClientNamenodeProtocolPB.class, RPC.RpcKind.RPC_PROTOCOL_BUFFER,
         RPC.getProtocolVersion(ClientNamenodeProtocolPB.class), methodName);
   }
-  
+
   @Override
   public DataEncryptionKey getDataEncryptionKey() throws IOException {
     try {
       GetDataEncryptionKeyResponseProto rsp = rpcProxy.getDataEncryptionKey(
           null, VOID_GET_DATA_ENCRYPTIONKEY_REQUEST);
-     return rsp.hasDataEncryptionKey() ? 
+      return rsp.hasDataEncryptionKey() ?
           PBHelperClient.convert(rsp.getDataEncryptionKey()) : null;
     } catch (ServiceException e) {
       throw ProtobufHelper.getRemoteException(e);
     }
   }
-  
+
 
   @Override
-  public boolean isFileClosed(String src) throws AccessControlException,
-      FileNotFoundException, UnresolvedLinkException, IOException {
+  public boolean isFileClosed(String src) throws IOException {
     IsFileClosedRequestProto req = IsFileClosedRequestProto.newBuilder()
         .setSrc(src).build();
     try {
@@ -1044,7 +997,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
       throw ProtobufHelper.getRemoteException(e);
     }
   }
-  
+
   @Override
   public void deleteSnapshot(String snapshotRoot, String snapshotName)
       throws IOException {
@@ -1056,7 +1009,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
       throw ProtobufHelper.getRemoteException(e);
     }
   }
-  
+
   @Override
   public void allowSnapshot(String snapshotRoot) throws IOException {
     AllowSnapshotRequestProto req = AllowSnapshotRequestProto.newBuilder()
@@ -1095,12 +1048,12 @@ public class ClientNamenodeProtocolTranslatorPB 
implements
   @Override
   public SnapshottableDirectoryStatus[] getSnapshottableDirListing()
       throws IOException {
-    GetSnapshottableDirListingRequestProto req = 
+    GetSnapshottableDirListingRequestProto req =
         GetSnapshottableDirListingRequestProto.newBuilder().build();
     try {
       GetSnapshottableDirListingResponseProto result = rpcProxy
           .getSnapshottableDirListing(null, req);
-      
+
       if (result.hasSnapshottableDirList()) {
         return PBHelperClient.convert(result.getSnapshottableDirList());
       }
@@ -1117,9 +1070,9 @@ public class ClientNamenodeProtocolTranslatorPB implements
         .newBuilder().setSnapshotRoot(snapshotRoot)
         .setFromSnapshot(fromSnapshot).setToSnapshot(toSnapshot).build();
     try {
-      GetSnapshotDiffReportResponseProto result = 
+      GetSnapshotDiffReportResponseProto result =
           rpcProxy.getSnapshotDiffReport(null, req);
-    
+
       return PBHelperClient.convert(result.getDiffReport());
     } catch (ServiceException e) {
       throw ProtobufHelper.getRemoteException(e);
@@ -1188,7 +1141,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
     public int size() {
       return response.getElementsCount();
     }
-    
+
     @Override
     public boolean hasMore() {
       return response.getHasMore();
@@ -1196,19 +1149,18 @@ public class ClientNamenodeProtocolTranslatorPB 
implements
   }
 
   @Override
-  public BatchedEntries<CacheDirectiveEntry>
-      listCacheDirectives(long prevId,
-          CacheDirectiveInfo filter) throws IOException {
+  public BatchedEntries<CacheDirectiveEntry> listCacheDirectives(long prevId,
+      CacheDirectiveInfo filter) throws IOException {
     if (filter == null) {
       filter = new CacheDirectiveInfo.Builder().build();
     }
     try {
       return new BatchedCacheEntries(
-        rpcProxy.listCacheDirectives(null,
-          ListCacheDirectivesRequestProto.newBuilder().
-            setPrevId(prevId).
-            setFilter(PBHelperClient.convert(filter)).
-            build()));
+          rpcProxy.listCacheDirectives(null,
+              ListCacheDirectivesRequestProto.newBuilder().
+                  setPrevId(prevId).
+                  setFilter(PBHelperClient.convert(filter)).
+                  build()));
     } catch (ServiceException e) {
       throw ProtobufHelper.getRemoteException(e);
     }
@@ -1216,7 +1168,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
 
   @Override
   public void addCachePool(CachePoolInfo info) throws IOException {
-    AddCachePoolRequestProto.Builder builder = 
+    AddCachePoolRequestProto.Builder builder =
         AddCachePoolRequestProto.newBuilder();
     builder.setInfo(PBHelperClient.convert(info));
     try {
@@ -1228,7 +1180,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
 
   @Override
   public void modifyCachePool(CachePoolInfo req) throws IOException {
-    ModifyCachePoolRequestProto.Builder builder = 
+    ModifyCachePoolRequestProto.Builder builder =
         ModifyCachePoolRequestProto.newBuilder();
     builder.setInfo(PBHelperClient.convert(req));
     try {
@@ -1241,22 +1193,22 @@ public class ClientNamenodeProtocolTranslatorPB 
implements
   @Override
   public void removeCachePool(String cachePoolName) throws IOException {
     try {
-      rpcProxy.removeCachePool(null, 
+      rpcProxy.removeCachePool(null,
           RemoveCachePoolRequestProto.newBuilder().
-            setPoolName(cachePoolName).build());
+              setPoolName(cachePoolName).build());
     } catch (ServiceException e) {
       throw ProtobufHelper.getRemoteException(e);
     }
   }
 
   private static class BatchedCachePoolEntries
-    implements BatchedEntries<CachePoolEntry> {
-      private final ListCachePoolsResponseProto proto;
-    
+      implements BatchedEntries<CachePoolEntry> {
+    private final ListCachePoolsResponseProto proto;
+
     public BatchedCachePoolEntries(ListCachePoolsResponseProto proto) {
       this.proto = proto;
     }
-      
+
     @Override
     public CachePoolEntry get(int i) {
       CachePoolEntryProto elem = proto.getEntries(i);
@@ -1267,7 +1219,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
     public int size() {
       return proto.getEntriesCount();
     }
-    
+
     @Override
     public boolean hasMore() {
       return proto.getHasMore();
@@ -1279,9 +1231,9 @@ public class ClientNamenodeProtocolTranslatorPB implements
       throws IOException {
     try {
       return new BatchedCachePoolEntries(
-        rpcProxy.listCachePools(null,
-          ListCachePoolsRequestProto.newBuilder().
-            setPrevPoolName(prevKey).build()));
+          rpcProxy.listCachePools(null,
+              ListCachePoolsRequestProto.newBuilder().
+                  setPrevPoolName(prevKey).build()));
     } catch (ServiceException e) {
       throw ProtobufHelper.getRemoteException(e);
     }
@@ -1361,9 +1313,9 @@ public class ClientNamenodeProtocolTranslatorPB implements
 
   @Override
   public void createEncryptionZone(String src, String keyName)
-    throws IOException {
+      throws IOException {
     final CreateEncryptionZoneRequestProto.Builder builder =
-      CreateEncryptionZoneRequestProto.newBuilder();
+        CreateEncryptionZoneRequestProto.newBuilder();
     builder.setSrc(src);
     if (keyName != null && !keyName.isEmpty()) {
       builder.setKeyName(keyName);
@@ -1377,8 +1329,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
   }
 
   @Override
-  public EncryptionZone getEZForPath(String src)
-      throws IOException {
+  public EncryptionZone getEZForPath(String src) throws IOException {
     final GetEZForPathRequestProto.Builder builder =
         GetEZForPathRequestProto.newBuilder();
     builder.setSrc(src);
@@ -1400,9 +1351,9 @@ public class ClientNamenodeProtocolTranslatorPB implements
   public BatchedEntries<EncryptionZone> listEncryptionZones(long id)
       throws IOException {
     final ListEncryptionZonesRequestProto req =
-      ListEncryptionZonesRequestProto.newBuilder()
-          .setId(id)
-          .build();
+        ListEncryptionZonesRequestProto.newBuilder()
+            .setId(id)
+            .build();
     try {
       EncryptionZonesProtos.ListEncryptionZonesResponseProto response =
           rpcProxy.listEncryptionZones(null, req);
@@ -1411,8 +1362,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
       for (EncryptionZoneProto p : response.getZonesList()) {
         elements.add(PBHelperClient.convert(p));
       }
-      return new BatchedListEntries<EncryptionZone>(elements,
-          response.getHasMore());
+      return new BatchedListEntries<>(elements, response.getHasMore());
     } catch (ServiceException e) {
       throw ProtobufHelper.getRemoteException(e);
     }
@@ -1449,7 +1399,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
       throw ProtobufHelper.getRemoteException(e);
     }
   }
-  
+
   @Override
   public List<XAttr> getXAttrs(String src, List<XAttr> xAttrs)
       throws IOException {
@@ -1465,11 +1415,11 @@ public class ClientNamenodeProtocolTranslatorPB 
implements
       throw ProtobufHelper.getRemoteException(e);
     }
   }
-  
+
   @Override
-  public List<XAttr> listXAttrs(String src)
-      throws IOException {
-    ListXAttrsRequestProto.Builder builder = 
ListXAttrsRequestProto.newBuilder();
+  public List<XAttr> listXAttrs(String src) throws IOException {
+    ListXAttrsRequestProto.Builder builder =
+        ListXAttrsRequestProto.newBuilder();
     builder.setSrc(src);
     ListXAttrsRequestProto req = builder.build();
     try {
@@ -1566,8 +1516,10 @@ public class ClientNamenodeProtocolTranslatorPB 
implements
       ErasureCodingPolicy[] ecPolicies =
           new ErasureCodingPolicy[response.getEcPoliciesCount()];
       int i = 0;
-      for (ErasureCodingPolicyProto ecPolicyProto : 
response.getEcPoliciesList()) {
-        ecPolicies[i++] = 
PBHelperClient.convertErasureCodingPolicy(ecPolicyProto);
+      for (ErasureCodingPolicyProto ecPolicyProto :
+          response.getEcPoliciesList()) {
+        ecPolicies[i++] =
+            PBHelperClient.convertErasureCodingPolicy(ecPolicyProto);
       }
       return ecPolicies;
     } catch (ServiceException e) {
@@ -1576,14 +1528,16 @@ public class ClientNamenodeProtocolTranslatorPB 
implements
   }
 
   @Override
-  public ErasureCodingPolicy getErasureCodingPolicy(String src) throws 
IOException {
-    GetErasureCodingPolicyRequestProto req = 
GetErasureCodingPolicyRequestProto.newBuilder()
-        .setSrc(src).build();
+  public ErasureCodingPolicy getErasureCodingPolicy(String src)
+      throws IOException {
+    GetErasureCodingPolicyRequestProto req =
+        GetErasureCodingPolicyRequestProto.newBuilder().setSrc(src).build();
     try {
-      GetErasureCodingPolicyResponseProto response = 
rpcProxy.getErasureCodingPolicy(
-          null, req);
+      GetErasureCodingPolicyResponseProto response =
+          rpcProxy.getErasureCodingPolicy(null, req);
       if (response.hasEcPolicy()) {
-        return 
PBHelperClient.convertErasureCodingPolicy(response.getEcPolicy());
+        return PBHelperClient.convertErasureCodingPolicy(
+            response.getEcPolicy());
       }
       return null;
     } catch (ServiceException e) {

Reply via email to