lhotari commented on code in PR #2030:
URL: https://github.com/apache/zookeeper/pull/2030#discussion_r1262093857
##########
zookeeper-server/src/main/java/org/apache/zookeeper/server/Request.java:
##########
@@ -164,6 +169,26 @@ public boolean isThrottlable() {
&& this.type != OpCode.createSession;
}
+ private transient byte[] serializeData;
+
+ @SuppressFBWarnings(value = "EI_EXPOSE_REP")
+ public byte[] getSerializeData() {
+ if (this.hdr == null) {
+ return null;
+ }
+
+ if (this.serializeData == null) {
+ try {
+ this.serializeData = Util.marshallTxnEntry(this.hdr, this.txn,
this.txnDigest);
+ } catch (IOException e) {
+ LOG.error("This really should be impossible.", e);
+ this.serializeData = new byte[32];
Review Comment:
I think this is a bad idea even if it shouldn't happen. For unhandled
IOExceptions, I think that a good approach is to wrap them with
`java.io.UncheckedIOException`.
For example, in this case:
`throw new UncheckedIOException(e);` (also add `import
java.io.UncheckedIOException`)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]