You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lens.apache.org by "Deepak Barr (JIRA)" <ji...@apache.org> on 2015/09/16 14:37:47 UTC
[jira] [Updated] (LENS-775) NPE on closing HadoopFileFormatter
[ https://issues.apache.org/jira/browse/LENS-775?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Deepak Barr updated LENS-775:
-----------------------------
Status: Patch Available (was: In Progress)
> NPE on closing HadoopFileFormatter
> ----------------------------------
>
> Key: LENS-775
> URL: https://issues.apache.org/jira/browse/LENS-775
> Project: Apache Lens
> Issue Type: Bug
> Reporter: Deepak Barr
> Assignee: Deepak Barr
> Priority: Minor
> Attachments: LENS-775.patch
>
>
> 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);
> }
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)