[errorprone] Suppress ByteBufferBackingArray
The byte buffers used here are created by wrapping a byte[]. See https://errorprone.info/bugpattern/ByteBufferBackingArray Change-Id: Idbc16d5ae4ff9f64b97be07a3cdf190716da191f
This commit is contained in:
parent
ac3794bf01
commit
4cfe27dd06
|
@ -63,6 +63,7 @@ public BasicAuthentication(InetSocketAddress proxy, String initialUser,
|
||||||
this.password = convert(initialPassword);
|
this.password = convert(initialPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("ByteBufferBackingArray")
|
||||||
private byte[] convert(char[] pass) {
|
private byte[] convert(char[] pass) {
|
||||||
if (pass == null) {
|
if (pass == null) {
|
||||||
return new byte[0];
|
return new byte[0];
|
||||||
|
|
|
@ -460,6 +460,7 @@ private void copyPackThroughCache(PackOutputStream out, DfsReader ctx,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("ByteBufferBackingArray")
|
||||||
private long copyPackBypassCache(PackOutputStream out, ReadableChannel rc)
|
private long copyPackBypassCache(PackOutputStream out, ReadableChannel rc)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
ByteBuffer buf = newCopyBuffer(out, rc);
|
ByteBuffer buf = newCopyBuffer(out, rc);
|
||||||
|
|
|
@ -863,6 +863,7 @@ private static class ContentStreamLoader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("ByteBufferBackingArray")
|
||||||
private @Nullable ContentStreamLoader applyText(RawText rt, FileHeader fh, Result result)
|
private @Nullable ContentStreamLoader applyText(RawText rt, FileHeader fh, Result result)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
List<ByteBuffer> oldLines = new ArrayList<>(rt.size());
|
List<ByteBuffer> oldLines = new ArrayList<>(rt.size());
|
||||||
|
@ -1023,6 +1024,7 @@ && canApplyAt(hunkLines, newLines, 0)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("ByteBufferBackingArray")
|
||||||
private boolean canApplyAt(List<ByteBuffer> hunkLines,
|
private boolean canApplyAt(List<ByteBuffer> hunkLines,
|
||||||
List<ByteBuffer> newLines, int line) {
|
List<ByteBuffer> newLines, int line) {
|
||||||
int sz = hunkLines.size();
|
int sz = hunkLines.size();
|
||||||
|
@ -1054,11 +1056,13 @@ private boolean canApplyAt(List<ByteBuffer> hunkLines,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("ByteBufferBackingArray")
|
||||||
private ByteBuffer slice(ByteBuffer b, int off) {
|
private ByteBuffer slice(ByteBuffer b, int off) {
|
||||||
int newOffset = b.position() + off;
|
int newOffset = b.position() + off;
|
||||||
return ByteBuffer.wrap(b.array(), newOffset, b.limit() - newOffset);
|
return ByteBuffer.wrap(b.array(), newOffset, b.limit() - newOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("ByteBufferBackingArray")
|
||||||
private boolean isNoNewlineAtEnd(ByteBuffer hunkLine) {
|
private boolean isNoNewlineAtEnd(ByteBuffer hunkLine) {
|
||||||
return Arrays.equals(NO_EOL, 0, NO_EOL.length, hunkLine.array(),
|
return Arrays.equals(NO_EOL, 0, NO_EOL.length, hunkLine.array(),
|
||||||
hunkLine.position(), hunkLine.limit());
|
hunkLine.position(), hunkLine.limit());
|
||||||
|
|
Loading…
Reference in New Issue