File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
src/main/java/org/utplsql/cli Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -10,16 +10,26 @@ public class ConnectionConfig {
10
10
private final String connect ;
11
11
12
12
public ConnectionConfig ( String connectString ) {
13
- Matcher m = Pattern .compile ("^([^/]+)/([^@]+)@(.*)$" ).matcher (connectString );
13
+ Matcher m = Pattern .compile ("^(\" .+ \" | [^/]+)/(\" .+ \" | [^@]+)@(.*)$" ).matcher (connectString );
14
14
if ( m .find () ) {
15
- user = m .group (1 );
16
- password = m .group (2 );
15
+ user = stripEnclosingQuotes ( m .group (1 ) );
16
+ password = stripEnclosingQuotes ( m .group (2 ) );
17
17
connect = m .group (3 );
18
18
}
19
19
else
20
20
throw new IllegalArgumentException ("Not a valid connectString: '" + connectString + "'" );
21
21
}
22
22
23
+ private String stripEnclosingQuotes ( String value ) {
24
+ if ( value .length () > 1
25
+ && value .startsWith ("\" " )
26
+ && value .endsWith ("\" " )) {
27
+ return value .substring (1 , value .length ()-1 );
28
+ } else {
29
+ return value ;
30
+ }
31
+ }
32
+
23
33
public String getConnect () {
24
34
return connect ;
25
35
}
You can’t perform that action at this time.
0 commit comments