Uploaded image for project: 'Sqoop (Retired)'
  1. Sqoop (Retired)
  2. SQOOP-1784

Sqoop2: Sending POST request to link or job end-point might end up with NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.99.4
    • 1.99.5
    • None
    • None

    Description

      I was testing few patches on real cluster and noticed that creating link on current head of sqoop2 branch can lead to NPE in LinkBean. I've traced the code and found out that ctx.getRequest().getReader() is returning empty buffer and as a result the subsequent call to JSONValue.parse returns null and we hit NullPointerException later in LInkBean.

      This one was quite hard to crack, but I believe that I've isolated the problem. In SQOOP-1774 we've changed the way to get username from header to URL parameter and we're using ServletRequest.getParameter() method for that. Carefully reading it's javadoc I found out that:

      If the parameter data was sent in the request body, such as occurs with an HTTP POST request, then reading the body directly via getInputStream() or getReader() can interfere with the execution of this method

      And hence I'm assuming that getting the username has processed the request body already and thus we got the eventual NullPointerException.

      Attachments

        1. SQOOP-1784.patch
          2 kB
          Jarek Jarcec Cecho

        Activity

          People

            jarcec Jarek Jarcec Cecho
            jarcec Jarek Jarcec Cecho
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: