Claus Ibsen created CAMEL-27827:
-----------------------------------

             Summary: camel-neo4j: a driver the endpoint creates is never 
closed, a missing dimension gives NullPointerException, createVector duplicates 
nodes
                 Key: CAMEL-27827
                 URL: https://issues.apache.org/jira/browse/CAMEL-27827
             Project: Camel
          Issue Type: Bug
          Components: camel-neo4j
            Reporter: Claus Ibsen
             Fix For: 4.25.0


Found while improving the option descriptions of camel-neo4j for CAMEL-23832 
(pull request https://github.com/apache/camel/pull/31141).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. The driver is never closed
When the endpoint created the Driver itself (from databaseUrl and the 
credentials), {{Neo4jEndpoint.doStop}} only sets the field to null and never 
calls driver.close(); the pool and its threads leak on every stop or restart.
Proposed change: close the driver in doStop when the endpoint created it (leave 
a driver from the option or the registry open).

h4. 2. A missing dimension gives NullPointerException
{{Neo4jProducer.createVectorIndex}} does final int dimension = 
getConfiguration().getDimension(), which unboxes a null Integer before the 
ObjectHelper.notNull check runs.
Proposed change: check the Integer before unboxing.

h4. 3. createVector duplicates a node
The Cypher is MERGE (e:Label {id: $id, text: $text}); the same id with another 
text creates a second node with the same id.
Proposed change: MERGE (e:Label {id: $id}) SET e.text = $text.

h4. 4. No way to connect without credentials
{{Neo4jEndpoint.createAuthToken}} returns null without credentials and the 
producer fails to start, so a server with auth disabled (AuthTokens.none()) 
needs a Driver of your own. Also, similaritySearch passes maxResults as a 
double to db.index.vector.queryNodes, whose k is an INTEGER.
Proposed change: use AuthTokens.none() when no credentials are set; pass k as 
an int.


_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to