Skip to content

Commit 2af8916

Browse files
committed
Polishing
Issue: SPR-10752 Issue: SPR-10627 (cherry picked from commit ae0f23e)
1 parent 85c9ed0 commit 2af8916

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

spring-web/src/main/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverter.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
import java.lang.reflect.Type;
2121
import java.nio.charset.Charset;
2222

23+
import com.fasterxml.jackson.core.JsonEncoding;
24+
import com.fasterxml.jackson.core.JsonGenerator;
25+
import com.fasterxml.jackson.core.JsonProcessingException;
26+
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
27+
import com.fasterxml.jackson.databind.JavaType;
28+
import com.fasterxml.jackson.databind.ObjectMapper;
29+
import com.fasterxml.jackson.databind.SerializationFeature;
30+
2331
import org.springframework.http.HttpInputMessage;
2432
import org.springframework.http.HttpOutputMessage;
2533
import org.springframework.http.MediaType;
@@ -29,14 +37,6 @@
2937
import org.springframework.http.converter.HttpMessageNotWritableException;
3038
import org.springframework.util.Assert;
3139

32-
import com.fasterxml.jackson.core.JsonEncoding;
33-
import com.fasterxml.jackson.core.JsonGenerator;
34-
import com.fasterxml.jackson.core.JsonProcessingException;
35-
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
36-
import com.fasterxml.jackson.databind.JavaType;
37-
import com.fasterxml.jackson.databind.ObjectMapper;
38-
import com.fasterxml.jackson.databind.SerializationFeature;
39-
4040
/**
4141
* Implementation of {@link org.springframework.http.converter.HttpMessageConverter HttpMessageConverter} that
4242
* can read and write JSON using <a href="http://jackson.codehaus.org/">Jackson 2.x's</a> {@link ObjectMapper}.
@@ -115,7 +115,7 @@ public void setJsonPrefix(String jsonPrefix) {
115115
* @see #setJsonPrefix
116116
*/
117117
public void setPrefixJson(boolean prefixJson) {
118-
this.jsonPrefix = prefixJson ? "{} && " : null;
118+
this.jsonPrefix = (prefixJson ? "{} && " : null);
119119
}
120120

121121
/**

spring-web/src/main/java/org/springframework/http/converter/json/MappingJacksonHttpMessageConverter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.codehaus.jackson.map.ObjectMapper;
2727
import org.codehaus.jackson.map.SerializationConfig;
2828
import org.codehaus.jackson.type.JavaType;
29+
2930
import org.springframework.http.HttpInputMessage;
3031
import org.springframework.http.HttpOutputMessage;
3132
import org.springframework.http.MediaType;
@@ -112,7 +113,7 @@ public void setJsonPrefix(String jsonPrefix) {
112113
* @see #setJsonPrefix
113114
*/
114115
public void setPrefixJson(boolean prefixJson) {
115-
this.jsonPrefix = prefixJson ? "{} && " : null;
116+
this.jsonPrefix = (prefixJson ? "{} && " : null);
116117
}
117118

118119
/**

spring-webmvc/src/main/java/org/springframework/web/servlet/view/json/MappingJackson2JsonView.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,27 @@
2323
import java.util.HashMap;
2424
import java.util.Map;
2525
import java.util.Set;
26-
2726
import javax.servlet.http.HttpServletRequest;
2827
import javax.servlet.http.HttpServletResponse;
2928

29+
import com.fasterxml.jackson.core.JsonEncoding;
30+
import com.fasterxml.jackson.core.JsonGenerator;
31+
import com.fasterxml.jackson.databind.ObjectMapper;
32+
import com.fasterxml.jackson.databind.SerializationFeature;
33+
3034
import org.springframework.util.Assert;
3135
import org.springframework.util.CollectionUtils;
3236
import org.springframework.validation.BindingResult;
3337
import org.springframework.web.servlet.View;
3438
import org.springframework.web.servlet.view.AbstractView;
3539

36-
import com.fasterxml.jackson.core.JsonEncoding;
37-
import com.fasterxml.jackson.core.JsonGenerator;
38-
import com.fasterxml.jackson.databind.ObjectMapper;
39-
import com.fasterxml.jackson.databind.SerializationFeature;
40-
4140
/**
4241
* Spring MVC {@link View} that renders JSON content by serializing the model for the current request
43-
* using <a href="http://jackson.codehaus.org/">Jackson 2.x's</a> {@link ObjectMapper}.
42+
* using <a href="http://jackson.codehaus.org/">Jackson 2's</a> {@link ObjectMapper}.
4443
*
4544
* <p>By default, the entire contents of the model map (with the exception of framework-specific classes)
46-
* will be encoded as JSON. If the model contains only one key, you can have it extracted encoded as
47-
* JSON alone via {@link #setExtractValueFromSingleKeyModel}.
45+
* will be encoded as JSON. If the model contains only one key, you can have it extracted encoded as JSON
46+
* alone via {@link #setExtractValueFromSingleKeyModel}.
4847
*
4948
* @author Jeremy Grelle
5049
* @author Arjen Poutsma
@@ -142,7 +141,7 @@ public void setJsonPrefix(String jsonPrefix) {
142141
* @see #setJsonPrefix
143142
*/
144143
public void setPrefixJson(boolean prefixJson) {
145-
this.jsonPrefix = prefixJson ? "{} && " : null;
144+
this.jsonPrefix = (prefixJson ? "{} && " : null);
146145
}
147146

148147
/**

spring-webmvc/src/main/java/org/springframework/web/servlet/view/json/MappingJacksonJsonView.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
import java.util.HashMap;
2424
import java.util.Map;
2525
import java.util.Set;
26-
2726
import javax.servlet.http.HttpServletRequest;
2827
import javax.servlet.http.HttpServletResponse;
2928

3029
import org.codehaus.jackson.JsonEncoding;
3130
import org.codehaus.jackson.JsonGenerator;
3231
import org.codehaus.jackson.map.ObjectMapper;
3332
import org.codehaus.jackson.map.SerializationConfig;
33+
3434
import org.springframework.util.Assert;
3535
import org.springframework.util.CollectionUtils;
3636
import org.springframework.validation.BindingResult;
@@ -39,11 +39,11 @@
3939

4040
/**
4141
* Spring MVC {@link View} that renders JSON content by serializing the model for the current request
42-
* using <a href="http://jackson.codehaus.org/">Jackson 1.x's</a> {@link ObjectMapper}.
42+
* using <a href="http://jackson.codehaus.org/">Jackson's</a> {@link ObjectMapper}.
4343
*
4444
* <p>By default, the entire contents of the model map (with the exception of framework-specific classes)
45-
* will be encoded as JSON. If the model contains only one key, you can have it extracted encoded as
46-
* JSON alone via {@link #setExtractValueFromSingleKeyModel}.
45+
* will be encoded as JSON. If the model contains only one key, you can have it extracted encoded as JSON
46+
* alone via {@link #setExtractValueFromSingleKeyModel}.
4747
*
4848
* @author Jeremy Grelle
4949
* @author Arjen Poutsma
@@ -141,7 +141,7 @@ public void setJsonPrefix(String jsonPrefix) {
141141
* @see #setJsonPrefix
142142
*/
143143
public void setPrefixJson(boolean prefixJson) {
144-
this.jsonPrefix = prefixJson ? "{} && " : null;
144+
this.jsonPrefix = (prefixJson ? "{} && " : null);
145145
}
146146

147147
/**

0 commit comments

Comments
 (0)