Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.
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;
}
}