summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/manager
diff options
context:
space:
mode:
authorFabrice Bacchella <fbacchella@spamcop.net>2015-05-26 10:48:40 +0200
committerFabrice Bacchella <fbacchella@spamcop.net>2015-05-26 10:48:40 +0200
commit3286926d2ec11445f76cd170e4c2fcff597a0754 (patch)
tree6fa70e2f071c0b7e30b48a619df86093005ebb42 /src/main/java/com/gitblit/manager
parent79922557bf5a716fcb758e2437b36714e51368e5 (diff)
downloadgitblit-3286926d2ec11445f76cd170e4c2fcff597a0754.tar.gz
gitblit-3286926d2ec11445f76cd170e4c2fcff597a0754.zip
Two slight improvement for custom UserService:
- try userRealm as a file only if class is not found, other exeptions are real error - log userService only after setup, for better logging, as it can use gitblit.properties for custom .toString
Diffstat (limited to 'src/main/java/com/gitblit/manager')
-rw-r--r--src/main/java/com/gitblit/manager/UserManager.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/com/gitblit/manager/UserManager.java b/src/main/java/com/gitblit/manager/UserManager.java
index 86be8bcd..0d7ee9a5 100644
--- a/src/main/java/com/gitblit/manager/UserManager.java
+++ b/src/main/java/com/gitblit/manager/UserManager.java
@@ -83,9 +83,9 @@ public class UserManager implements IUserManager {
* @param userService
*/
public void setUserService(IUserService userService) {
- logger.info(userService.toString());
this.userService = userService;
this.userService.setup(runtimeManager);
+ logger.info(userService.toString());
}
@Override
@@ -115,10 +115,12 @@ public class UserManager implements IUserManager {
// check to see if this "file" is a custom user service class
Class<?> realmClass = Class.forName(realm);
service = (IUserService) realmClass.newInstance();
- } catch (Throwable t) {
+ } catch (ClassNotFoundException t) {
// typical file path configuration
File realmFile = runtimeManager.getFileOrFolder(Keys.realm.userService, "${baseFolder}/users.conf");
service = createUserService(realmFile);
+ } catch (InstantiationException | IllegalAccessException e) {
+ logger.error("failed to instanciate user service {}: {}", realm, e.getMessage());
}
}
setUserService(service);