mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 03:25:19 +01:00
Throw a more detailed error when database connection info is missing
This commit is contained in:
parent
ab8b675bae
commit
d8a7d8de4a
@ -44,7 +44,7 @@ public class IsolatedClassLoader extends URLClassLoader {
|
||||
* ClassLoader#getSystemClassLoader returns the AppClassLoader
|
||||
*
|
||||
* Calling #getParent on this returns the ExtClassLoader (Java 8) or
|
||||
* the PlatformClassLoader (Java 8). Since we want this classloader to
|
||||
* the PlatformClassLoader (Java 9). Since we want this classloader to
|
||||
* be isolated from the Minecraft server (the app), we set the parent
|
||||
* to be the platform class loader.
|
||||
*/
|
||||
|
@ -26,6 +26,7 @@
|
||||
package me.lucko.luckperms.common.storage;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class StorageCredentials {
|
||||
|
||||
@ -52,19 +53,19 @@ public class StorageCredentials {
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return this.address;
|
||||
return Objects.requireNonNull(this.address, "address");
|
||||
}
|
||||
|
||||
public String getDatabase() {
|
||||
return this.database;
|
||||
return Objects.requireNonNull(this.database, "database");
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return this.username;
|
||||
return Objects.requireNonNull(this.username, "username");
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return this.password;
|
||||
return Objects.requireNonNull(this.password, "password");
|
||||
}
|
||||
|
||||
public int getMaxPoolSize() {
|
||||
|
@ -111,7 +111,7 @@ public class PermissionRegistry extends RepeatingTask {
|
||||
// insert the permission into the node structure
|
||||
TreeNode current = this.rootNode;
|
||||
for (String part : parts) {
|
||||
current = current.getChildMap().computeIfAbsent(part, s -> new TreeNode());
|
||||
current = current.resolve(part);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,13 +38,17 @@ public class TreeNode {
|
||||
private Map<String, TreeNode> children = null;
|
||||
|
||||
// lazy init
|
||||
public synchronized Map<String, TreeNode> getChildMap() {
|
||||
private synchronized Map<String, TreeNode> getChildMap() {
|
||||
if (this.children == null) {
|
||||
this.children = new ConcurrentHashMap<>();
|
||||
}
|
||||
return this.children;
|
||||
}
|
||||
|
||||
public TreeNode resolve(String s) {
|
||||
return getChildMap().computeIfAbsent(s, x -> new TreeNode());
|
||||
}
|
||||
|
||||
public Optional<Map<String, TreeNode>> getChildren() {
|
||||
return Optional.ofNullable(this.children);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user