Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-12604

Exception may be swallowed in KMSClientProvider

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      In KMSClientProvider# createConnection

            try {
              is = conn.getInputStream();
              ret = mapper.readValue(is, klass);
            } catch (IOException ex) {
              if (is != null) {
                is.close(); <== close may throw exception
              }
              throw ex;
            } finally {
              if (is != null) {
                is.close();
              }
            }
          }
      

      ex may be swallowed when close highlighted in the code throws exception. Thanks qwertymaniac for pointing this out.

      BTW, I think we should be able to consolidate the two is.close() in the above code, so we don't close the same stream twice. The one in the finally block may be called after an exception is thrown or not, and it may throw exception too, we need to be careful not to swallow exception here too.

      Attachments

        1. HADOOP-12604.001.patch
          1 kB
          Yongjun Zhang
        2. HADOOP-12604.002.patch
          2 kB
          Yongjun Zhang

        Activity

          People

            yzhangal Yongjun Zhang
            yzhangal Yongjun Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: