Uploaded image for project: 'Apache Lens (Retired)'
  1. Apache Lens (Retired)
  2. LENS-775

NPE on closing HadoopFileFormatter

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 2.4
    • None
    • None

    Description

      In HadoopFileFormatter, If rowWriter intialization fails because of,say, HDFS permission issue. The close() method (called in finally block in ResultFormatter class) throws an NPE.

      Code snippet -

      public void setupOutputs() throws IOException {
      String pathStr = ctx.getResultSetParentDir();
      if (StringUtils.isBlank(pathStr))

      { throw new IllegalArgumentException("No output path specified"); }

      String outputPathStr = Strings.isNullOrEmpty(ctx.getQueryName()) ? ""
      : LensFileOutputFormat.getValidOutputFileName(ctx.getQueryName()) + "-";
      outputPath = new Path(pathStr, outputPathStr + ctx.getQueryHandle().toString());
      Path tmpWorkPath = new Path(pathStr, ctx.getQueryHandle().toString() + ".tmp");
      try

      { rowWriter = LensFileOutputFormat.createRecordWriter(ctx.getConf(), tmpWorkPath, Reporter.NULL, ctx.getCompressOutput(), ctx.getOuptutFileExtn(), ctx.getResultEncoding()); numRows=0; }

      catch (IOException e)

      { throw new IllegalArgumentException("Could not create tmp path"); }

      }

      @Override
      public void close() throws IOException

      { rowWriter.close(Reporter.NULL); }

      Attachments

        1. LENS-775.patch
          0.6 kB
          Deepak Barr

        Activity

          People

            deepak.barr Deepak Barr
            deepak.barr Deepak Barr
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: