Gyeongtae Park created ZEPPELIN-6242:
----------------------------------------
Summary: Refactor initAuth in Neo4jConnectionManager for safer
enum parsing and default handling
Key: ZEPPELIN-6242
URL: https://issues.apache.org/jira/browse/ZEPPELIN-6242
Project: Zeppelin
Issue Type: Task
Reporter: Gyeongtae Park
Fix For: 1.0.0, 0.12.1, 0.13.0
The current {{initAuth(Properties properties)}} method in
*Neo4jConnectionManager* calls
{code:java}
Neo4jAuthType.valueOf(authType.toUpperCase()) {code}
without any null-check or validation. This leads to several problems:
* *NullPointerException* if {{neo4j.auth.type}} is missing from the
interpreter properties
* *IllegalArgumentException* with an unclear stack trace when an unsupported
value is provided
* Reduced readability and maintainability due to inline exception handling
inside the {{switch}} statement
h4. Proposed Changes
* Provide a *default value of {{NONE}}* when {{neo4j.auth.type}} is absent
* Parse the enum inside a {{try-catch}} block to deliver *explicit,
user-friendly error messages* for unsupported values
* Keep the {{switch}} statement focused on authentication logic once the enum
is safely parsed
* Add a defensive branch ({{{}default{}}}) that should not be reached but
satisfies the compiler
--
This message was sent by Atlassian Jira
(v8.20.10#820010)