Skip to content

Commit 6fb4de0

Browse files
mtopolnikclaude
andcommitted
Replace CharSequence.isEmpty() with length check
CharSequence.isEmpty() is a default method added in Java 15, but the client module targets Java 11. Replace all four call sites with the equivalent length() == 0 check to avoid NoSuchMethodError at runtime on Java 11. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 893841b commit 6fb4de0

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

core/src/main/java/io/questdb/client/cutlass/qwp/client/QwpUdpSender.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ private void beginColumnWrite(QwpTableBuffer.ColumnBuffer column, CharSequence c
778778
int columnIndex = column.getIndex();
779779
ensureStagedColumnMarkCapacity(columnIndex + 1);
780780
if (stagedColumnMarks[columnIndex] == currentRowMark) {
781-
if (columnName != null && columnName.isEmpty()) {
781+
if (columnName != null && columnName.length() == 0) {
782782
throw new LineSenderException("designated timestamp already set for current row");
783783
}
784784
throw new LineSenderException("column '" + columnName + "' already set for current row");

core/src/main/java/io/questdb/client/cutlass/qwp/client/QwpWebSocketSender.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ public Sender decimalColumn(CharSequence name, Decimal256 value) {
486486

487487
@Override
488488
public Sender decimalColumn(CharSequence name, CharSequence value) {
489-
if (value == null || value.isEmpty()) return this;
489+
if (value == null || value.length() == 0) return this;
490490
checkNotClosed();
491491
checkTableSelected();
492492
try {
@@ -903,7 +903,7 @@ private void checkTableSelected() {
903903

904904
private String checkedColumnName(CharSequence name) {
905905
if (name == null || !TableUtils.isValidColumnName(name, DEFAULT_MAX_NAME_LENGTH)) {
906-
if (name == null || name.isEmpty()) {
906+
if (name == null || name.length() == 0) {
907907
throw new LineSenderException("column name cannot be empty");
908908
}
909909
if (name.length() > DEFAULT_MAX_NAME_LENGTH) {

core/src/main/java/io/questdb/client/cutlass/qwp/protocol/OffHeapAppendMemory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public void putShort(short value) {
150150
* Pre-ensures worst-case capacity to avoid per-byte checks.
151151
*/
152152
public void putUtf8(CharSequence value) {
153-
if (value == null || value.isEmpty()) {
153+
if (value == null || value.length() == 0) {
154154
return;
155155
}
156156
int len = value.length();

0 commit comments

Comments
 (0)