Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

589 npe when getting pooltype #590

Merged
merged 3 commits into from
Nov 23, 2023
Merged
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 @@ -335,23 +335,26 @@ public void init(Long pliID, String... args) throws PersistenceLayerException {
} else {
String poolname = handleParams(args);
regularPoolDefinition = poolMgmt.getConnectionPoolDefinition(poolname);
if (!regularPoolDefinition.getType().equals(MySQLPoolType.POOLTYPE_IDENTIFIER)) {
if (regularPoolDefinition == null) {
throw new XNWH_GeneralPersistenceLayerException("Pool '" + poolname + "' for pliID " + String.valueOf(this.pliID) + " does not exist!");
}
if (!MySQLPoolType.POOLTYPE_IDENTIFIER.equals(regularPoolDefinition.getType())) {
// only warn as it might be a custom poolType made for MySQL-PL usage
logger.warn("PoolType does not match the expected identifier!");
logger.warn("PoolType '" + regularPoolDefinition.getType() + "' for pool '" + poolname + "' does not match the expected identifier '" + MySQLPoolType.POOLTYPE_IDENTIFIER + "'!");
}
TypedConnectionPoolParameter tcpp = regularPoolDefinition.toCreationParameter();
tcpp.size(0).name(tcpp.getName() + "_dedicated");
try {
poolMgmt.startAndAddConnectionPool(tcpp);
} catch (NoConnectionAvailableException e) {
// mimics behavior of @deprecated getInstance call
throw new RuntimeException(e);
throw new RuntimeException("No connection for pool '" + poolname + "' available.", e);
}
dedicatedPoolDefinition = poolMgmt.getConnectionPoolDefinition(tcpp.getName());
}

if (regularPoolDefinition == null) {
throw new XNWH_GeneralPersistenceLayerException("Pool does not exist!");
throw new XNWH_GeneralPersistenceLayerException("Pool for pliID " + String.valueOf(this.pliID) + " does not exist!");
}


Expand All @@ -362,7 +365,7 @@ public void init(Long pliID, String... args) throws PersistenceLayerException {
// TODO echtes Pattern f�r den connect string benutzen
int i = url.lastIndexOf("/");
if (i < 0 || i + 1 == url.length()) {
throw new XNWH_GeneralPersistenceLayerException("Connect string must contain a schema name.");
throw new XNWH_GeneralPersistenceLayerException("Connect string '" + url + "' for pliID " + String.valueOf(this.pliID) + " must contain a schema name.");
}
schemaName = url.substring(i + 1);
if (schemaName.contains("?")) {
Expand Down