Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If the system environment variables include kafka or KAFKA, the KafkaRuntimeConfigProducer throws an exception. #40677

Closed
shellj opened this issue May 16, 2024 · 3 comments · Fixed by #40741
Labels
area/config area/kafka env/windows Impacts Windows machines kind/bug Something isn't working
Milestone

Comments

@shellj
Copy link

shellj commented May 16, 2024

Describe the bug

If the system environment variables include kafka or KAFKA, the KafkaRuntimeConfigProducer throws an error.

Caused by: java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 5
	at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
	at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
	at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
	at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
	at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
	at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4861)
	at java.base/java.lang.String.substring(String.java:2830)
	at java.base/java.lang.String.substring(String.java:2803)
	at io.quarkus.kafka.client.runtime.KafkaRuntimeConfigProducer.createKafkaRuntimeConfig(KafkaRuntimeConfigProducer.java:40)
	at io.quarkus.kafka.client.runtime.KafkaRuntimeConfigProducer_ProducerMethod_createKafkaRuntimeConfig_VzcC8CdA4ZIN2S227pAbEVHVF_c_Bean.doCreate(Unknown Source)
	at io.quarkus.kafka.client.runtime.KafkaRuntimeConfigProducer_ProducerMethod_createKafkaRuntimeConfig_VzcC8CdA4ZIN2S227pAbEVHVF_c_Bean.create(Unknown Source)
	at io.quarkus.kafka.client.runtime.KafkaRuntimeConfigProducer_ProducerMethod_createKafkaRuntimeConfig_VzcC8CdA4ZIN2S227pAbEVHVF_c_Bean.create(Unknown Source)
	at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:119)

The substring here throws an exception:

String effectivePropertyName = propertyNameLowerCase.substring(CONFIG_PREFIX.length() + 1).toLowerCase()
.replace("_", ".");

Expected behavior

Work without throwing any error

Actual behavior

throw exception: Caused by: java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 5

How to Reproduce?

  1. Configuring the system environment variable KAFKA=xxx.xxx.xxx.xxx:9092.
  2. Start the kafka application

Output of uname -a or ver

Windows_NT minij 6.2 9200 x86_64 MS/Windows

Output of java -version

openjdk version "21" 2023-09-19 OpenJDK Runtime Environment (build 21+35-2513) OpenJDK 64-Bit Server VM (build 21+35-2513, mixed mode, sharing)

Quarkus version or git rev

3.10.1

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.1 (2e178502fcdbffc201671fb2537d0cb4b4cc58f8)

Additional information

No response

@shellj shellj added the kind/bug Something isn't working label May 16, 2024
@quarkus-bot quarkus-bot bot added area/config area/kafka env/windows Impacts Windows machines labels May 16, 2024
Copy link

quarkus-bot bot commented May 16, 2024

/cc @alesj (kafka), @cescoffier (kafka), @ozangunalp (kafka), @radcortez (config)

@gsmet
Copy link
Member

gsmet commented May 21, 2024

@shellj thanks for the detailed report. Does #40741 make sense for you?

@shellj
Copy link
Author

shellj commented May 22, 2024

@shellj thanks for the detailed report. Does #40741 make sense for you?

Yes, that's perfect

@shellj shellj closed this as completed May 22, 2024
@quarkus-bot quarkus-bot bot added this to the 3.12 - main milestone May 22, 2024
@gsmet gsmet modified the milestones: 3.12 - main, 3.8.5 May 22, 2024
gsmet added a commit to gsmet/quarkus that referenced this issue May 22, 2024
gsmet added a commit to gsmet/quarkus that referenced this issue May 22, 2024
gsmet added a commit to gsmet/quarkus that referenced this issue May 23, 2024
gsmet added a commit to gsmet/quarkus that referenced this issue May 23, 2024
gsmet added a commit to gsmet/quarkus that referenced this issue Jun 4, 2024
gsmet added a commit to gsmet/quarkus that referenced this issue Jun 4, 2024
gsmet added a commit to gsmet/quarkus that referenced this issue Jun 4, 2024
holly-cummins pushed a commit to holly-cummins/quarkus that referenced this issue Jul 31, 2024
danielsoro pushed a commit to danielsoro/quarkus that referenced this issue Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config area/kafka env/windows Impacts Windows machines kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants