Chris Snowden created CALCITE-4119:
--------------------------------------

             Summary: Connection Id on NoSuchConnectionException
                 Key: CALCITE-4119
                 URL: https://issues.apache.org/jira/browse/CALCITE-4119
             Project: Calcite
          Issue Type: Bug
            Reporter: Chris Snowden


NoSuchConnectionException expects a connection id as an argument.

[https://github.com/apache/calcite-avatica/blob/master/core/src/main/java/org/apache/calcite/avatica/NoSuchConnectionException.java]
{code:java}
public NoSuchConnectionException(String connectionId) {    
    this.connectionId = connectionId;  
}
{code}
However the JdbcMeta is using it as a message. 

 

[https://github.com/apache/calcite-avatica/blob/master/server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java]

 
{code:java}
protected Connection getConnection(String id) throws SQLException 
    if (id == null) {
      throw new NullPointerException("Connection id is null.");
    }
    Connection conn = connectionCache.getIfPresent(id);
    if (conn == null) {
        throw new NoSuchConnectionException("Connection not found: invalid id, 
closed, or expired: " + id);
    }
    return conn;
}
{code}
 

Recommend:
 * Updating NoSuchConnectionException to pass an exception message to parent
 * Or removing the message.

 
{code:java}
public NoSuchConnectionException(String connectionId) {
 this(connectionId, "Connection not found: invalid id, closed, or expired: " + 
connectionId);
}

public NoSuchConnectionException(String connectionId, String message) {
    super(message);
    this.connectionId = connectionId;
}
{code}
 

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to