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

View file

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

View file

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

View file

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

View file

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

View file

@ -133,7 +133,10 @@ public class StringConverter implements AttributeValueConverter {
// decrypt internally encrypted password and hash it for export // decrypt internally encrypted password and hash it for export
// NOTE: see special case description in ExamConfigXMLParser.createConfigurationValue // 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)) { if (plainText.endsWith(Constants.IMPORTED_PASSWORD_MARKER)) {
return plainText.replace(Constants.IMPORTED_PASSWORD_MARKER, StringUtils.EMPTY); return plainText.replace(Constants.IMPORTED_PASSWORD_MARKER, StringUtils.EMPTY);
} else { } else {

View file

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