Satisfy nullness checker correctness by using local variable
This commit is contained in:
parent
c4c4ef9670
commit
58d8850b21
@ -59,15 +59,15 @@ public class SimpleDecoderOutputBuffer extends DecoderOutputBuffer {
|
|||||||
* @return The {@link #data} buffer, for convenience.
|
* @return The {@link #data} buffer, for convenience.
|
||||||
*/
|
*/
|
||||||
public ByteBuffer grow(int newSize) {
|
public ByteBuffer grow(int newSize) {
|
||||||
Assertions.checkNotNull(data);
|
ByteBuffer oldData = Assertions.checkNotNull(this.data);
|
||||||
Assertions.checkArgument(newSize >= data.limit());
|
Assertions.checkArgument(newSize >= oldData.limit());
|
||||||
final ByteBuffer newData = ByteBuffer.allocateDirect(newSize).order(ByteOrder.nativeOrder());
|
ByteBuffer newData = ByteBuffer.allocateDirect(newSize).order(ByteOrder.nativeOrder());
|
||||||
final int restorePosition = data.position();
|
int restorePosition = oldData.position();
|
||||||
data.position(0);
|
oldData.position(0);
|
||||||
newData.put(data);
|
newData.put(oldData);
|
||||||
newData.position(restorePosition);
|
newData.position(restorePosition);
|
||||||
newData.limit(newSize);
|
newData.limit(newSize);
|
||||||
data = newData;
|
this.data = newData;
|
||||||
return newData;
|
return newData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user