-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AVRO-4068: Java Code Cleanup #3192
base: main
Are you sure you want to change the base?
Conversation
@@ -192,7 +192,7 @@ public BigDecimal fromBytes(final ByteBuffer value, final Schema schema, final L | |||
BigInteger bg = null; | |||
ByteBuffer buffer = decoder.readBytes(null); | |||
byte[] array = buffer.array(); | |||
if (array != null && array.length > 0) { | |||
if (array.length > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cannot be null
@@ -206,7 +206,7 @@ public int size() { | |||
this.reserved = reserved; | |||
for (Entry<String, ?> a : propMap.entrySet()) { | |||
Object v = a.getValue(); | |||
JsonNode json = null; | |||
JsonNode json; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This always gets overwritten
@@ -71,11 +70,9 @@ public class Protocol extends JsonProperties { | |||
public static final long VERSION = 1; | |||
|
|||
// Support properties for both Protocol and Message objects | |||
private static final Set<String> MESSAGE_RESERVED = Collections | |||
.unmodifiableSet(new HashSet<>(Arrays.asList("doc", "response", "request", "errors", "one-way"))); | |||
private static final Set<String> MESSAGE_RESERVED = Set.of("doc", "response", "request", "errors", "one-way"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use new Set.of(xxx)
@@ -27,7 +27,6 @@ private DataFileConstants() { | |||
|
|||
public static final byte VERSION = 1; | |||
public static final byte[] MAGIC = new byte[] { (byte) 'O', (byte) 'b', (byte) 'j', VERSION }; | |||
public static final long FOOTER_BLOCK = -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never used
byte[] getData() { | ||
return data; | ||
} | ||
|
||
long getNumEntries() { | ||
return numEntries; | ||
} | ||
|
||
int getBlockSize() { | ||
return blockSize; | ||
} | ||
|
||
boolean isFlushOnWrite() { | ||
return flushOnWrite; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never used
@@ -26,15 +26,14 @@ | |||
import org.apache.avro.util.NonCopyingByteArrayOutputStream; | |||
import org.apache.commons.compress.compressors.xz.XZCompressorInputStream; | |||
import org.apache.commons.compress.compressors.xz.XZCompressorOutputStream; | |||
import org.apache.commons.compress.utils.IOUtils; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecated
@@ -72,7 +71,7 @@ public ByteBuffer decompress(ByteBuffer data) throws IOException { | |||
InputStream bytesIn = new ByteArrayInputStream(data.array(), computeOffset(data), data.remaining()); | |||
|
|||
try (InputStream ios = new XZCompressorInputStream(bytesIn)) { | |||
IOUtils.copy(ios, baos); | |||
ios.transferTo(baos); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new JDK9+ syntax
@Override | ||
public boolean markSupported() { | ||
return false; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same implementation as parent/super class
83f23c8
to
39e70ac
Compare
What is the purpose of the change
Verifying this change
This change is a trivial rework / code cleanup without any test coverage.