Deepak Barr created LENS-775:
--------------------------------
Summary: 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
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)