wangbowen1024 opened a new issue #7268:
URL: https://github.com/apache/dolphinscheduler/issues/7268


   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   
![image](https://user-images.githubusercontent.com/48642743/145181755-d25953d5-8ece-4b69-a732-be5039329481.png)
   
   
   ### What you expected to happen
   
   
![image](https://user-images.githubusercontent.com/48642743/145181942-e7ed5b78-f418-446e-ac89-c8e01b914688.png)
   
   
   ### How to reproduce
   
   when i use url with multi zookeeper hosts like 
(jdbc:hive2://xxx.master:2181,xxx.slave01:2181,xxx.slave02:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2)
 is not supported
   
   i find hosts check in this code:
   ```java
    public abstract class AbstractDatasourceProcessor implements 
DatasourceProcessor {
   
       private static final Pattern IPV4_PATTERN = 
Pattern.compile("^[a-zA-Z0-9\\_\\-\\.]+$");
   
       private static final Pattern IPV6_PATTERN = 
Pattern.compile("^[a-zA-Z0-9\\_\\-\\.\\:\\[\\]]+$");
   
       // other code ......
   
       /**
        * Check the host is valid
        *
        * @param host datasource host
        */
       protected void checkHost(String host) {
           if (!IPV4_PATTERN.matcher(host).matches() || 
!IPV6_PATTERN.matcher(host).matches()) {
               throw new IllegalArgumentException("datasource host illegal");
           }
       }
       // other code ......
   }
   ```
   
   and then i solve it, like this:
   ```java
   public class HiveDatasourceProcessor extends AbstractDatasourceProcessor {
       // other code ......
   
       @Override
       public void checkDatasourceParam(BaseDataSourceParamDTO 
baseDataSourceParamDTO) {
           String[] hosts = 
baseDataSourceParamDTO.getHost().split(Constants.COMMA);
           for (String host : hosts) {
               checkHost(host);
           }
           checkDatasourcePatter(baseDataSourceParamDTO.getDatabase());
           checkOther(baseDataSourceParamDTO.getOther());
       }
   }
   ```
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   2.0.0
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to