influxdata / influxdata/influxdb-java

Error msg so obscure when connect url port miss

Open
#768 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.2k
Forks
469
PR merge metrics
No merged PRs in 30d

Description

Hi, the problem takes me some time:
when I init InfluxDB instance from `InfluxDBFactory.connect`, I miss a port, like:
~~~java
InfluxDBFactory.connect("127.0.0.1", "username", "password");
~~~
actually, the code should be
~~~java
InfluxDBFactory.connect("127.0.0.1:8086", "username", "password");
~~~
but I didn't notice it. then I query a table, the program throw exception and show stack trace:
~~~java
Exception in thread "main" org.influxdb.InfluxDBException:
at org.influxdb.InfluxDBException.buildExceptionForErrorState(InfluxDBException.java:175)
at org.influxdb.impl.InfluxDBImpl.execute(InfluxDBImpl.java:837)
at org.influxdb.impl.InfluxDBImpl.executeQuery(InfluxDBImpl.java:824)
at org.influxdb.impl.InfluxDBImpl.query(InfluxDBImpl.java:559)
~~~
I think its so obscure, the exception can throw early. For example, when init InfluxDB instance, it can throw `IllegalArugemntException: The port cannot be null`

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at InfluxDBFactory.connect, then trace the connection setup before the query path shown through InfluxDBImpl.execute and executeQuery. Reproduce the missing-port example and make the failure occur during initialization with a clear exception; the existing query path should no longer produce an obscure empty InfluxDBException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.