File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change 3838@ InterfaceStability .Stable
3939public class BytesWritable extends BinaryComparable
4040 implements WritableComparable <BinaryComparable > {
41+ private static final int MAX_ARRAY_SIZE = Integer .MAX_VALUE - 8 ;
4142 private static final int LENGTH_BYTES = 4 ;
4243
4344 private static final byte [] EMPTY_BYTES = new byte [0 ];
@@ -126,7 +127,7 @@ public int getSize() {
126127 public void setSize (int size ) {
127128 if (size > getCapacity ()) {
128129 // Avoid overflowing the int too early by casting to a long.
129- long newSize = Math .min (Integer . MAX_VALUE , (3L * size ) / 2L );
130+ long newSize = Math .min (MAX_ARRAY_SIZE , (3L * size ) / 2L );
130131 setCapacity ((int ) newSize );
131132 }
132133 this .size = size ;
You can’t perform that action at this time.
0 commit comments