[ https://issues.apache.org/jira/browse/TEZ-3753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16102256#comment-16102256 ]
Jonathan Eagles commented on TEZ-3753: -------------------------------------- {code:title=IFile.java} + // Not final for testing + protected static int MAX_BUFFER_SIZE = Integer.MAX_VALUE - 8; // Based on + // https://stackoverflow.com/questions/3038392/do-java-arrays-have-a-maximum-size. {code} Let's add a findbugs exception for this case to stop the findbugs warning. In addition, let's document the MAX_VALUE - 8 directly so the readers of the code don't have to lookup the reference. Then we can get rid of the url to stackoverflow. {code:title=IFile#readRawKey} if (currentKeyLength > MAX_BUFFER_SIZE) { throw new NegativeArraySizeException( String.format(REQ_BUFFER_SIZE_TOO_LARGE, currentKeyLength, MAX_BUFFER_SIZE)); } {code} The we should throw a different exception here. IOException would be fine or perhaps better is IllegalArgumentException to indicate that the user is at fault. Same for nextRawValue. Test will have to have a corresponding change. > Improve error message in IFile for buffer length overflow > --------------------------------------------------------- > > Key: TEZ-3753 > URL: https://issues.apache.org/jira/browse/TEZ-3753 > Project: Apache Tez > Issue Type: Bug > Affects Versions: 0.7.1 > Reporter: Muhammad Samir Khan > Assignee: Muhammad Samir Khan > Attachments: tez-3753.001.patch, tez-3753.002.patch > > > When a record size is too big and the byte array doubling expansion crosses > 2G the array size overflows and becomes negative. It would be good to fail > the code paths saying record is too big so that error is easy to understand > for users. -- This message was sent by Atlassian JIRA (v6.4.14#64029)