Compare commits

..

3 Commits

Author SHA1 Message Date
Michael Hoennig
e934726c4b revert convert Object->String, causes NPE problems 2024-11-14 16:38:14 +01:00
Michael Hoennig
880b2aa99a fix new BigDecimal("6,400.00") 2024-11-14 16:22:00 +01:00
Michael Hoennig
38c51cbf7b fix a FIXME regarding Object->String 2024-11-14 16:09:27 +01:00
3 changed files with 8 additions and 10 deletions

View File

@ -3,7 +3,6 @@ package net.hostsharing.hsadminng.config;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.openapitools.jackson.nullable.JsonNullableModule;
import org.springframework.context.annotation.Bean;
@ -11,7 +10,6 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import java.math.BigDecimal;
@Configuration
public class JsonObjectMapperConfiguration {

View File

@ -69,7 +69,7 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase
final var newCoopAssetsTransaction = HsOfficeCoopAssetsTransactionEntity.builder()
.membership(givenMembership)
.transactionType(HsOfficeCoopAssetsTransactionType.DEPOSIT)
.assetValue(new BigDecimal("6,400.00"))
.assetValue(new BigDecimal("6400.00"))
.valueDate(LocalDate.parse("2022-10-18"))
.reference("temp ref A")
.build();

View File

@ -59,7 +59,7 @@ public class TemplateResolver {
return Arrays.stream(values()).filter(p -> p.prefixChar == givenChar).findFirst().orElseThrow();
}
abstract String convert(final Object value, final Resolver resolver); // FIXME: why Object and not String?
abstract String convert(final Object value, final Resolver resolver);
}
private final static Pattern pattern = Pattern.compile(",(\\s*})", Pattern.MULTILINE);
@ -150,12 +150,12 @@ public class TemplateResolver {
} else if (nameExpression.contains(IF_NOT_FOUND_SYMBOL)) {
final var parts = StringUtils.split(nameExpression, IF_NOT_FOUND_SYMBOL);
return Arrays.stream(parts).filter(Objects::nonNull).findFirst().orElseGet(() -> {
if ( parts[parts.length-1].isEmpty() ) {
// => whole expression ends with IF_NOT_FOUND_SYMBOL, thus last null element was optional
return null;
}
// => last alternative element in expression was null and not optional
throw new IllegalStateException("Missing required value in property-chain: " + nameExpression);
if ( parts[parts.length-1].isEmpty() ) {
// => whole expression ends with IF_NOT_FOUND_SYMBOL, thus last null element was optional
return null;
}
// => last alternative element in expression was null and not optional
throw new IllegalStateException("Missing required value in property-chain: " + nameExpression);
});
} else {
final var val = properties.get(nameExpression);