lhotari commented on code in PR #21966:
URL: https://github.com/apache/pulsar/pull/21966#discussion_r1466208284
##########
pulsar-functions/api-java/src/main/java/org/apache/pulsar/functions/api/state/StateValue.java:
##########
@@ -18,21 +18,19 @@
*/
package org.apache.pulsar.functions.api.state;
-import java.nio.ByteBuffer;
-
public class StateValue {
- private final ByteBuffer value;
+ private final byte[] value;
private final Long version;
private final Boolean isNumber;
- public StateValue(ByteBuffer value, Long version, Boolean isNumber) {
- this.value = value == null ? null : ByteBuffer.wrap(value.array());
+ public StateValue(byte[] value, Long version, Boolean isNumber) {
+ this.value = value == null ? null : value.clone();
this.version = version;
this.isNumber = isNumber;
}
- public ByteBuffer getValue() {
- return value == null ? null : ByteBuffer.wrap(value.array());
+ public byte[] getValue() {
+ return this.value == null ? null : this.value.clone();
Review Comment:
Yes, it's fine to omit the check. You can omit it with
`@SuppressFBWarnings({"EI_EXPOSE_REP"})` or by adding an entry to the
`src/main/resources/findbugsExclude.xml` file. I think that the latter approach
is better so that `SuppressFBWarnings` annotation doesn't leak into client API
classes.
--
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]