Yongjun Zhang created HDFS-13100:
------------------------------------

             Summary: Handle IllegalArgumentException in when GETSERVERDEFAULTS 
is not implemented in webhdfs.
                 Key: HDFS-13100
                 URL: https://issues.apache.org/jira/browse/HDFS-13100
             Project: Hadoop HDFS
          Issue Type: Improvement
          Components: hdfs, webhdfs
            Reporter: Yongjun Zhang
            Assignee: Yongjun Zhang


HDFS-12386 added getserverdefaults call to webhdfs, and expect clusters that 
don't support this to throw UnsupportedOperationException.  However, in that 
case, the following handler is called, and IllegalArgumentException instead of 
UnsupportedOperationException is thrown, and the client side would fail to deal 
with IllegalArgumentException.

{code}
  public void handle(ChannelHandlerContext ctx, HttpRequest req)
    throws IOException, URISyntaxException {
    String op = params.op();
    HttpMethod method = req.getMethod();
    if (PutOpParam.Op.CREATE.name().equalsIgnoreCase(op)
      && method == PUT) {
      onCreate(ctx);
    } else if (PostOpParam.Op.APPEND.name().equalsIgnoreCase(op)
      && method == POST) {
      onAppend(ctx);
    } else if (GetOpParam.Op.OPEN.name().equalsIgnoreCase(op)
      && method == GET) {
      onOpen(ctx);
    } else if(GetOpParam.Op.GETFILECHECKSUM.name().equalsIgnoreCase(op)
      && method == GET) {
      onGetFileChecksum(ctx);
    } else if(PutOpParam.Op.CREATE.name().equalsIgnoreCase(op)
        && method == OPTIONS) {
      allowCORSOnCreate(ctx);
    } else {
      throw new IllegalArgumentException("Invalid operation " + op);
    }
}
{code}

We either need to make the server throw UnsupportedOperationException, or make 
the client to handle IllegalArgumentException. For backward compatibility and 
easier operation in the field, the latter is preferred.




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to