fix:domain 为空

This commit is contained in:
2024-08-29 19:26:26 +08:00
parent ca8c658cd7
commit be0cecd66e

View File

@@ -222,6 +222,9 @@ public class OpcUtl {
throws BadRequestException { throws BadRequestException {
checkTimeout(); checkTimeout();
Server server = null; Server server = null;
if (domain==null){
domain="";
}
try { try {
server = new Server(getConnection(host, clsid, user, password, domain), server = new Server(getConnection(host, clsid, user, password, domain),
@@ -233,19 +236,13 @@ public class OpcUtl {
} }
} }
public static Server getAutoServer(String host, String clsid, String user, String password, String domain) throws
BadRequestException {
checkTimeout();
Server server = null;
server = new Server(getConnection(host, clsid, user, password, domain), Executors.newSingleThreadScheduledExecutor());
AutoReconnectController autoReconnectController = new AutoReconnectController(server);
autoReconnectController.connect();
return server;
}
public static ConnectionInformation getConnection(String host, String clsid, String user, String password, public static ConnectionInformation getConnection(String host, String clsid, String user, String password,
String domain) { String domain) {
ConnectionInformation connection = new ConnectionInformation(); ConnectionInformation connection = new ConnectionInformation();
if (domain==null){
domain="";
}
connection.setHost(host); connection.setHost(host);
connection.setClsid(clsid); connection.setClsid(clsid);
connection.setUser(user); connection.setUser(user);