From 4143b445d6328040e3697208ed3ac4a3a15cb2cb Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 8 Apr 2022 13:04:14 +0200 Subject: [PATCH] Polishing --- .../jmx/export/notificationPublisherTests.xml | 8 ++++---- .../org/springframework/core/convert/Property.java | 4 ++-- .../expression/spel/ast/ConstructorReference.java | 4 ++-- .../http/codec/json/Jackson2JsonEncoderTests.java | 11 ++++++----- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/spring-context/src/test/resources/org/springframework/jmx/export/notificationPublisherTests.xml b/spring-context/src/test/resources/org/springframework/jmx/export/notificationPublisherTests.xml index 8b8699a8e289..9e7c75135c21 100644 --- a/spring-context/src/test/resources/org/springframework/jmx/export/notificationPublisherTests.xml +++ b/spring-context/src/test/resources/org/springframework/jmx/export/notificationPublisherTests.xml @@ -5,16 +5,16 @@ - + - + - - + + diff --git a/spring-core/src/main/java/org/springframework/core/convert/Property.java b/spring-core/src/main/java/org/springframework/core/convert/Property.java index 5cddaea8769f..bf9ae585181a 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/Property.java +++ b/spring-core/src/main/java/org/springframework/core/convert/Property.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ */ public final class Property { - private static Map annotationCache = new ConcurrentReferenceHashMap<>(); + private static final Map annotationCache = new ConcurrentReferenceHashMap<>(); private final Class objectType; diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/ConstructorReference.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/ConstructorReference.java index 6f4f3c8c69cc..c425c84746ea 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/ConstructorReference.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/ConstructorReference.java @@ -288,8 +288,8 @@ private TypedValue createArray(ExpressionState state) throws EvaluationException else { // There is an initializer if (this.dimensions == null || this.dimensions.length > 1) { - // There is an initializer but this is a multi-dimensional array (e.g. new int[][]{{1,2},{3,4}}) - this - // is not currently supported + // There is an initializer but this is a multi-dimensional array (e.g. new int[][]{{1,2},{3,4}}) + // - this is not currently supported throw new SpelEvaluationException(getStartPosition(), SpelMessage.MULTIDIM_ARRAY_INITIALIZER_NOT_SUPPORTED); } diff --git a/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonEncoderTests.java b/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonEncoderTests.java index 2e589ac2a8f8..b66084e8299a 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonEncoderTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonEncoderTests.java @@ -103,7 +103,7 @@ public void encode() throws Exception { ); } - @Test // SPR-15866 + @Test // SPR-15866 public void canEncodeWithCustomMimeType() { MimeType textJavascript = new MimeType("text", "javascript", StandardCharsets.UTF_8); Jackson2JsonEncoder encoder = new Jackson2JsonEncoder(new ObjectMapper(), textJavascript); @@ -231,9 +231,8 @@ public void jacksonValue() { ); } - @Test // gh-28045 + @Test // gh-28045 public void jacksonValueUnwrappedBeforeObjectMapperSelection() { - JacksonViewBean bean = new JacksonViewBean(); bean.setWithView1("with"); bean.setWithView2("with"); @@ -248,13 +247,15 @@ public void jacksonValueUnwrappedBeforeObjectMapperSelection() { ObjectMapper mapper = new ObjectMapper().configure(SerializationFeature.INDENT_OUTPUT, true); this.encoder.registerObjectMappersForType(JacksonViewBean.class, map -> map.put(halMediaType, mapper)); + String ls = System.lineSeparator(); // output below is different between Unix and Windows testEncode(Mono.just(jacksonValue), type, halMediaType, Collections.emptyMap(), step -> step - .consumeNextWith(expectString("{\n \"withView1\" : \"with\"\n}").andThen(DataBufferUtils::release)) + .consumeNextWith(expectString("{" + ls + " \"withView1\" : \"with\"" + ls + "}") + .andThen(DataBufferUtils::release)) .verifyComplete() ); } - @Test // gh-22771 + @Test // gh-22771 public void encodeWithFlushAfterWriteOff() { ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.FLUSH_AFTER_WRITE_VALUE, false);