Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-19265

Potential NPE and hiding actual exception in Hive#copyFiles

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.0
    • Component/s: None
    • Labels:
      None

      Description

      In Hive#copyFiles we have such code

      if (src.isDirectory()) {
              try {
                files = srcFs.listStatus(src.getPath(), FileUtils.HIDDEN_FILES_PATH_FILTER);
              } catch (IOException e) {
                pool.shutdownNow();
                throw new HiveException(e);
              }
            }
      

      If pool is null we will get NPE and actual cause will be lost.

      Initializing of pool

          final ExecutorService pool = conf.getInt(ConfVars.HIVE_MOVE_FILES_THREAD_COUNT.varname, 25) > 0 ?
              Executors.newFixedThreadPool(conf.getInt(ConfVars.HIVE_MOVE_FILES_THREAD_COUNT.varname, 25),
              new ThreadFactoryBuilder().setDaemon(true).setNameFormat("Move-Thread-%d").build()) : null;
      

      So in the case when the pool is not created we can get potential NPE and swallow an actual exception

        Attachments

          Activity

            People

            • Assignee:
              ikryvenko Igor Kryvenko
              Reporter:
              ikryvenko Igor Kryvenko
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: