Skip to content
This repository has been archived by the owner on Mar 15, 2022. It is now read-only.

[JBEAP-9251] Wrong error msg in datasource wizard for duplicate JNDI … #390

Open
wants to merge 1 commit into
base: 2.8.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ class DataSourceJndiItem<T extends DataSource> extends JndiNameItem {

private final List<T> existingDataSources;
private final String defaultErrMessage;
private String errMessage;

public DataSourceJndiItem(final List<T> existingDataSources) {
super("jndiName", "JNDI Name");
this.existingDataSources = existingDataSources;
this.defaultErrMessage = getErrMessage();
this.defaultErrMessage = super.getErrMessage();
}

@Override
Expand All @@ -46,13 +47,18 @@ public boolean validate(final String value) {
for (T dataSource : existingDataSources) {
if (dataSource.getJndiName().equals(value)) {
duplicateJndiName = true;
setErrMessage(Console.CONSTANTS.duplicate_data_source_jndi());
this.errMessage = Console.CONSTANTS.duplicate_data_source_jndi();
break;
}
}
} else {
setErrMessage(defaultErrMessage);
this.errMessage = defaultErrMessage;
}
return parentValid && !duplicateJndiName;
}

@Override
public String getErrMessage() {
return this.errMessage;
}
}