[
https://issues.apache.org/jira/browse/HADOOP-1887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12528199
]
Konstantin Shvachko commented on HADOOP-1887:
---------------------------------------------
getBlockLocations() can return null.
So you should either check for null value after calling it or return an empty
array if the file is empty.
By the way the same problem happens with fsck, when it examines empty files.
{code}
07/09/17 17:07:37 WARN /: /fsck?path=%2F:
java.lang.NullPointerException
at org.apache.hadoop.dfs.NamenodeFsck.check(NamenodeFsck.java:156)
at org.apache.hadoop.dfs.NamenodeFsck.check(NamenodeFsck.java:147)
at org.apache.hadoop.dfs.NamenodeFsck.check(NamenodeFsck.java:147)
at org.apache.hadoop.dfs.NamenodeFsck.check(NamenodeFsck.java:147)
at org.apache.hadoop.dfs.NamenodeFsck.fsck(NamenodeFsck.java:123)
at org.apache.hadoop.dfs.FsckServlet.doGet(FsckServlet.java:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
at
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:475)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1565)
at
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:635)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1517)
at org.mortbay.http.HttpServer.service(HttpServer.java:954)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
at
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
{code}
> ArrayIndexOutOfBoundsException with trunk
> -----------------------------------------
>
> Key: HADOOP-1887
> URL: https://issues.apache.org/jira/browse/HADOOP-1887
> Project: Hadoop
> Issue Type: Bug
> Components: dfs
> Reporter: Raghu Angadi
> Assignee: dhruba borthakur
> Attachments: zeroSizeFile3.patch, zeroSizeFile4.patch,
> zeroSizeFile5.patch
>
>
> How to reproduce :
> # Run a DFS cluster (single node is fine).
> # Start writing a file but do not close it : {{cat | bin/hadoop dfs
> -copyFromLocal - /dir/file}} does that.
> # goto /dir on Hadoop webui or do {{bin/hadoop fs -cat /dir/file}}.
> This is mostly related to HADOOP-1708.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.