@@ -128,6 +128,7 @@ public class Client implements AutoCloseable {
128
128
private static final Charset CHARSET = StandardCharsets .UTF_8 ;
129
129
public static final int DEFAULT_PORT = 5552 ;
130
130
public static final int DEFAULT_TLS_PORT = 5551 ;
131
+ static final int MAX_REFERENCE_SIZE = 256 ;
131
132
static final OutboundEntityWriteCallback OUTBOUND_MESSAGE_WRITE_CALLBACK =
132
133
new OutboundMessageWriteCallback ();
133
134
static final OutboundEntityWriteCallback OUTBOUND_MESSAGE_BATCH_WRITE_CALLBACK =
@@ -892,7 +893,7 @@ public Response declarePublisher(byte publisherId, String publisherReference, St
892
893
(publisherReference == null || publisherReference .isEmpty ()
893
894
? 0
894
895
: publisherReference .length ());
895
- if (publisherReferenceSize >= 256 ) {
896
+ if (publisherReferenceSize >= MAX_REFERENCE_SIZE ) {
896
897
throw new IllegalArgumentException (
897
898
"If specified, publisher reference must less than 256 characters" );
898
899
}
@@ -1290,7 +1291,7 @@ public Response subscribe(
1290
1291
}
1291
1292
1292
1293
public void storeOffset (String reference , String stream , long offset ) {
1293
- if (reference == null || reference .isEmpty () || reference .length () > 256 ) {
1294
+ if (reference == null || reference .isEmpty () || reference .length () >= MAX_REFERENCE_SIZE ) {
1294
1295
throw new IllegalArgumentException (
1295
1296
"Reference must a non-empty string of less than 256 characters" );
1296
1297
}
0 commit comments