Skip to content
Snippets Groups Projects
Commit 5b8c4c69 authored by Raphael GIRARDOT's avatar Raphael GIRARDOT
Browse files

Don't throw exception when a database is declared as unavailable (TANGOARCH-880)

parent 7458549b
No related branches found
No related tags found
No related merge requests found
......@@ -169,15 +169,17 @@ public class DbConnectionManager implements ApiConstants {
if (api == null) {
String msg;
if (historic == null) {
msg = "connection to TTS impossible";
msg = DbConnectionParameters.isTtsAvailable() ? "connection to TTS impossible" : null;
} else if (historic.booleanValue()) {
msg = "connection to HDB impossible";
msg = DbConnectionParameters.isHdbAvailable() ? "connection to HDB impossible" : null;
} else {
msg = "connection to TDB impossible";
msg = DbConnectionParameters.isTdbAvailable() ? "connection to TDB impossible" : null;
}
if (msg != null) {
throw new ArchivingException(msg);
}
return api.getDataBase();
}
return api == null ? null : api.getDataBase();
}
private ArchivingException connectDB(String name, Supplier<Boolean> method, Boolean historic) {
......
......@@ -151,6 +151,9 @@ public class BasicAttributeManager extends DbConnectionManager implements IAttri
final Domains domains = new Domains();
final IDataBaseAcess database = getDataBaseApi(historic);
if (database == null) {
ret = new ArrayList<>();
} else {
final String completeNames[] = database.getAttributesCompleteNames();
if (completeNames == null || (cancelable != null && cancelable.isCanceled())) {
ret = new ArrayList<>();
......@@ -171,6 +174,7 @@ public class BasicAttributeManager extends DbConnectionManager implements IAttri
ret = domains.getList();
}
}
return ret;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment