Skip to content

Commit

Permalink
#2498 OPC DA Data Source - disable validation for username and passwo…
Browse files Browse the repository at this point in the history
…rd; corrected error message
  • Loading branch information
Limraj committed Apr 5, 2023
1 parent ad9452d commit f73f6a6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
20 changes: 14 additions & 6 deletions src/br/org/scadabr/rt/dataSource/opc/OPCDataSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,17 @@ public void initialize() {
returnToNormal(DATA_SOURCE_EXCEPTION_EVENT,
System.currentTimeMillis());
} catch (Exception e) {
e.printStackTrace();
String message = e.getMessage();
if(e.getMessage() != null && e.getMessage().contains("Unknown Error")) {
message = "The OPC DA Server for the data source settings may not be found. ";
}
message = "Error while initializing data source: " + message;
LOG.error(message + e.getMessage(), e);
raiseEvent(
DATA_SOURCE_EXCEPTION_EVENT,
System.currentTimeMillis(),
true,
new LocalizableMessage("event.exception2", vo.getName(), e
.getMessage()));
LOG.debug("Error while initializing data source", e);
new LocalizableMessage("event.exception2", vo.getName(), message));
return;
}
super.initialize();
Expand All @@ -154,12 +157,17 @@ public void terminate() {
try {
opcMaster.terminate();
} catch (Exception e) {
String message = e.getMessage();
if(e instanceof NullPointerException) {
message = "The client may not have been properly initialized. ";
}
message = "Error while terminating data source: " + message;
LOG.error(message + e.getMessage(), e);
raiseEvent(
DATA_SOURCE_EXCEPTION_EVENT,
System.currentTimeMillis(),
true,
new LocalizableMessage("event.exception2", vo.getName(), e
.getMessage()));
new LocalizableMessage("event.exception2", vo.getName(), message));
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/br/org/scadabr/vo/dataSource/opc/OPCDataSourceVO.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ public void validate(DwrResponseI18n response) {
response.addContextualMessage("host", "validate.required");
// if (StringUtils.isEmpty(domain))
// response.addContextualMessage("domain", "validate.required");
if (StringUtils.isEmpty(user))
response.addContextualMessage("user", "validate.required");
if (StringUtils.isEmpty(password))
response.addContextualMessage("password", "validate.required");
//if (StringUtils.isEmpty(user))
// response.addContextualMessage("user", "validate.required");
//if (StringUtils.isEmpty(password))
// response.addContextualMessage("password", "validate.required");
if (StringUtils.isEmpty(server))
response.addContextualMessage("server", "validate.required");
if (updatePeriods <= 0)
Expand Down

0 comments on commit f73f6a6

Please sign in to comment.