SEBSERV-216 fixed

This commit is contained in:
anhefti 2021-07-15 13:42:14 +02:00
parent 7df04cddc6
commit 494c6a08ec
7 changed files with 22 additions and 8 deletions

View file

@ -383,7 +383,6 @@ public final class Result<T> {
@Override
public String toString() {
throw new RuntimeException("Result.toString is probably called by mistake !!!");
//return "Result [value=" + this.value + ", error=" + this.error + "]";
}
public interface TryCatchSupplier<T> {

View file

@ -277,7 +277,7 @@ public class QuizLookupList implements TemplateComposer {
.map(key -> Long.valueOf(key.modelId))
.collect(Collectors.toList());
if (existingImports != null && !existingImports.contains(institutionId)) {
if (existingImports != null && !existingImports.isEmpty() && !existingImports.contains(institutionId)) {
return TEXT_KEY_CONFIRM_EXISTING;
} else {
return null;

View file

@ -169,7 +169,10 @@ public class PasswordFieldBuilder implements InputFieldBuilder {
public String getValue() {
final CharSequence pwd = this.control.getValue();
if (StringUtils.isNotBlank(pwd)) {
return this.cryptor.encrypt(pwd).toString();
return this.cryptor
.encrypt(pwd)
.getOrThrow()
.toString();
}
return StringUtils.EMPTY;

View file

@ -577,7 +577,10 @@ public class SEBClientConfigDAOImpl implements SEBClientConfigDAO {
EntityType.SEB_CLIENT_CONFIGURATION,
configId,
SEBClientConfig.ATTR_FALLBACK_PASSWORD,
this.clientCredentialService.encrypt(sebClientConfig.fallbackPassword).toString());
this.clientCredentialService
.encrypt(sebClientConfig.fallbackPassword)
.getOrThrow()
.toString());
} else {
this.additionalAttributesDAO.delete(
EntityType.SEB_CLIENT_CONFIGURATION,
@ -590,7 +593,10 @@ public class SEBClientConfigDAOImpl implements SEBClientConfigDAO {
EntityType.SEB_CLIENT_CONFIGURATION,
configId,
SEBClientConfig.ATTR_QUIT_PASSWORD,
this.clientCredentialService.encrypt(sebClientConfig.quitPassword).toString());
this.clientCredentialService
.encrypt(sebClientConfig.quitPassword)
.getOrThrow()
.toString());
} else {
this.additionalAttributesDAO.delete(
EntityType.SEB_CLIENT_CONFIGURATION,

View file

@ -517,7 +517,10 @@ public class ExamConfigXMLParser extends DefaultHandler {
attribute.id,
listIndex,
StringUtils.isNotBlank(value)
? this.cryptor.encrypt(value + Constants.IMPORTED_PASSWORD_MARKER).toString()
? this.cryptor
.encrypt(value + Constants.IMPORTED_PASSWORD_MARKER)
.getOrThrow()
.toString()
: value);
}

View file

@ -133,7 +133,10 @@ public class StringConverter implements AttributeValueConverter {
// decrypt internally encrypted password and hash it for export
// NOTE: see special case description in ExamConfigXMLParser.createConfigurationValue
final String plainText = this.clientCredentialService.decrypt(value).toString();
final String plainText = this.clientCredentialService
.decrypt(value)
.getOrThrow()
.toString();
if (plainText.endsWith(Constants.IMPORTED_PASSWORD_MARKER)) {
return plainText.replace(Constants.IMPORTED_PASSWORD_MARKER, StringUtils.EMPTY);
} else {

View file

@ -134,7 +134,7 @@ public final class PingIntervalClientIndicator extends AbstractPingIndicator {
.getLastPing(super.pingRecord.getId());
if (!lastPing.hasError()) {
return lastPing.get();
return Math.max(this.currentValue, lastPing.get().doubleValue());
} else {
log.error("Failed to get last ping from persistent: {}", lastPing.getError().getMessage());
}