Skip to content

Commit dbc8583

Browse files
Update VaultConnectionStringProvider for early parameter validation and clarify required parameters in documentation
1 parent 55c281b commit dbc8583

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

ojdbc-provider-oci/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ It supports both plain text and Base64-encoded `tnsnames.ora` files.
525525

526526
This enables flexible and secure configuration for database connections using the alias names defined in your `tnsnames.ora` file.
527527

528-
In addition to the set of common parameters, this provider also supports the parameters listed below:
528+
In addition to the set of common parameters, this provider also requires the parameters listed below:
529529

530530
<table>
531531
<thead>

ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/resource/VaultConnectionStringProvider.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,15 @@ public VaultConnectionStringProvider() {
106106
@Override
107107
public String getConnectionString(Map<Parameter, CharSequence> parameterValues) {
108108

109+
String alias;
110+
try {
111+
alias = parseParameterValues(parameterValues).getRequired(TNS_ALIAS);
112+
} catch (IllegalStateException e) {
113+
throw new IllegalArgumentException(
114+
"Required parameter 'tnAlias' is missing", e
115+
);
116+
}
117+
109118
// Retrieve the secret containing tnsnames.ora content from OCI Vault
110119
String secretValue = getVaultSecret(parameterValues)
111120
.getBase64Secret();
@@ -119,15 +128,6 @@ public String getConnectionString(Map<Parameter, CharSequence> parameterValues)
119128
throw new IllegalStateException("Failed to read tnsnames.ora content", e);
120129
}
121130

122-
String alias;
123-
try {
124-
alias = parseParameterValues(parameterValues).getRequired(TNS_ALIAS);
125-
} catch (IllegalStateException e) {
126-
throw new IllegalArgumentException(
127-
"Required parameter 'tnAlias' is missing", e
128-
);
129-
}
130-
131131
String connectionString = tnsNames.getConnectionStringByAlias(alias);
132132
if (connectionString == null) {
133133
throw new IllegalArgumentException(

0 commit comments

Comments
 (0)