@@ -128,6 +128,7 @@ public class Client implements AutoCloseable {
128128 private static final Charset CHARSET = StandardCharsets .UTF_8 ;
129129 public static final int DEFAULT_PORT = 5552 ;
130130 public static final int DEFAULT_TLS_PORT = 5551 ;
131+ static final int MAX_REFERENCE_SIZE = 256 ;
131132 static final OutboundEntityWriteCallback OUTBOUND_MESSAGE_WRITE_CALLBACK =
132133 new OutboundMessageWriteCallback ();
133134 static final OutboundEntityWriteCallback OUTBOUND_MESSAGE_BATCH_WRITE_CALLBACK =
@@ -892,7 +893,7 @@ public Response declarePublisher(byte publisherId, String publisherReference, St
892893 (publisherReference == null || publisherReference .isEmpty ()
893894 ? 0
894895 : publisherReference .length ());
895- if (publisherReferenceSize >= 256 ) {
896+ if (publisherReferenceSize >= MAX_REFERENCE_SIZE ) {
896897 throw new IllegalArgumentException (
897898 "If specified, publisher reference must less than 256 characters" );
898899 }
@@ -1290,7 +1291,7 @@ public Response subscribe(
12901291 }
12911292
12921293 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 ) {
12941295 throw new IllegalArgumentException (
12951296 "Reference must a non-empty string of less than 256 characters" );
12961297 }
0 commit comments