@@ -596,7 +596,8 @@ public Connection getConnection(InterpreterContext context)
596596 return connection ;
597597 }
598598
599- private void validateConnectionUrl (String url ) {
599+ // package private for testing purposes
600+ static void validateConnectionUrl (String url ) {
600601 final String decodedUrl = urlDecode (url , url , 0 );
601602 final Map <String , String > params = parseUrlParameters (decodedUrl );
602603
@@ -655,7 +656,7 @@ private static Map<String, String> parseUrlParameters(final String url) {
655656 if (parts .length > 1 ) {
656657 // The first part is the base URL, so we start from the second part
657658 for (int i = 1 ; i < parts .length ; i ++) {
658- splitNameValue (parts [i ], parameters );
659+ splitNameValue (parts [i ], parameters , true );
659660 }
660661 }
661662 return parameters ;
@@ -691,7 +692,7 @@ private static int extractFromParens(final String input,
691692 String params = input .substring (startIndex + 1 , endIndex );
692693 String [] keyValuePairs = params .split ("," );
693694 for (String pair : keyValuePairs ) {
694- splitNameValue (pair , parameters );
695+ splitNameValue (pair , parameters , false );
695696 }
696697 }
697698 return endIndex ;
@@ -703,12 +704,14 @@ private static int extractFromParens(final String input,
703704 *
704705 * @param nameValue the name-value pair as a string
705706 * @param parameters the map to store the extracted key-value pair
707+ * @param allowEmptyValue whether to allow empty values
706708 */
707- private static void splitNameValue (String nameValue , Map <String , String > parameters ) {
709+ private static void splitNameValue (String nameValue , Map <String , String > parameters ,
710+ boolean allowEmptyValue ) {
708711 String [] keyValue = nameValue .split ("=" );
709712 if (keyValue .length >= 2 ) {
710713 parameters .put (keyValue [0 ].trim (), keyValue [1 ].trim ());
711- } else {
714+ } else if ( allowEmptyValue ) {
712715 // Handle cases where there might not be a value
713716 parameters .put (keyValue [0 ].trim (), "" );
714717 }
0 commit comments