From 3286926d2ec11445f76cd170e4c2fcff597a0754 Mon Sep 17 00:00:00 2001
From: Fabrice Bacchella <fbacchella@spamcop.net>
Date: Tue, 26 May 2015 04:48:40 -0400
Subject: [PATCH] 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
---
src/main/java/com/gitblit/transport/ssh/keys/BaseKeyCommand.java | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/main/java/com/gitblit/transport/ssh/keys/BaseKeyCommand.java b/src/main/java/com/gitblit/transport/ssh/keys/BaseKeyCommand.java
index 588770f..4b1d6b8 100644
--- a/src/main/java/com/gitblit/transport/ssh/keys/BaseKeyCommand.java
+++ b/src/main/java/com/gitblit/transport/ssh/keys/BaseKeyCommand.java
@@ -37,17 +37,20 @@
throws UnsupportedEncodingException, IOException {
int idx = -1;
if (sshKeys.isEmpty() || (idx = sshKeys.indexOf("-")) >= 0) {
- String sshKey = "";
+ String content = "";
BufferedReader br = new BufferedReader(new InputStreamReader(
in, Charsets.UTF_8));
String line;
while ((line = br.readLine()) != null) {
- sshKey += line + "\n";
+ content += line + "\n";
}
- if (idx == -1) {
- sshKeys.add(sshKey.trim());
- } else {
- sshKeys.set(idx, sshKey.trim());
+ final String sshKey = content.trim();
+ if (!sshKey.isEmpty()) {
+ if (idx == -1) {
+ sshKeys.add(sshKey);
+ } else {
+ sshKeys.set(idx, sshKey);
+ }
}
}
return sshKeys;
--
Gitblit v1.9.1