Skip to content

Commit f010368

Browse files
committed
Polishing
1 parent 3ec4538 commit f010368

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

spring-beans/src/main/java/org/springframework/beans/propertyeditors/URIEditor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -119,7 +119,7 @@ public void setAsText(String text) throws IllegalArgumentException {
119119
setValue(createURI(uri));
120120
}
121121
catch (URISyntaxException ex) {
122-
throw new IllegalArgumentException("Invalid URI syntax: " + ex);
122+
throw new IllegalArgumentException("Invalid URI syntax: " + ex.getMessage());
123123
}
124124
}
125125
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,18 +235,18 @@ else if (logger.isDebugEnabled()) {
235235
}
236236

237237
@Override
238-
protected Object readInternal(Class<?> clazz, HttpInputMessage inputMessage)
238+
public Object read(Type type, @Nullable Class<?> contextClass, HttpInputMessage inputMessage)
239239
throws IOException, HttpMessageNotReadableException {
240240

241-
JavaType javaType = getJavaType(clazz, null);
241+
JavaType javaType = getJavaType(type, contextClass);
242242
return readJavaType(javaType, inputMessage);
243243
}
244244

245245
@Override
246-
public Object read(Type type, @Nullable Class<?> contextClass, HttpInputMessage inputMessage)
246+
protected Object readInternal(Class<?> clazz, HttpInputMessage inputMessage)
247247
throws IOException, HttpMessageNotReadableException {
248248

249-
JavaType javaType = getJavaType(type, contextClass);
249+
JavaType javaType = getJavaType(clazz, null);
250250
return readJavaType(javaType, inputMessage);
251251
}
252252

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -114,15 +114,15 @@ private Object readResolved(Type resolvedType, HttpInputMessage inputMessage)
114114
}
115115

116116
@Override
117-
protected final void writeInternal(Object o, @Nullable Type type, HttpOutputMessage outputMessage)
117+
protected final void writeInternal(Object object, @Nullable Type type, HttpOutputMessage outputMessage)
118118
throws IOException, HttpMessageNotWritableException {
119119

120120
Writer writer = getWriter(outputMessage);
121121
if (this.jsonPrefix != null) {
122122
writer.append(this.jsonPrefix);
123123
}
124124
try {
125-
writeInternal(o, type, writer);
125+
writeInternal(object, type, writer);
126126
}
127127
catch (Exception ex) {
128128
throw new HttpMessageNotWritableException("Could not write JSON: " + ex.getMessage(), ex);
@@ -142,12 +142,12 @@ protected final void writeInternal(Object o, @Nullable Type type, HttpOutputMess
142142

143143
/**
144144
* Template method that writes the JSON-bound object to the given {@link Writer}.
145-
* @param o the object to write to the output message
145+
* @param object the object to write to the output message
146146
* @param type the type of object to write (may be {@code null})
147147
* @param writer the {@code} Writer to use
148148
* @throws Exception in case of write failures
149149
*/
150-
protected abstract void writeInternal(Object o, @Nullable Type type, Writer writer) throws Exception;
150+
protected abstract void writeInternal(Object object, @Nullable Type type, Writer writer) throws Exception;
151151

152152

153153
private static Reader getReader(HttpInputMessage inputMessage) throws IOException {

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -93,17 +93,17 @@ protected Object readInternal(Type resolvedType, Reader reader) throws Exception
9393
}
9494

9595
@Override
96-
protected void writeInternal(Object o, @Nullable Type type, Writer writer) throws Exception {
96+
protected void writeInternal(Object object, @Nullable Type type, Writer writer) throws Exception {
9797
// In Gson, toJson with a type argument will exclusively use that given type,
9898
// ignoring the actual type of the object... which might be more specific,
9999
// e.g. a subclass of the specified type which includes additional fields.
100100
// As a consequence, we're only passing in parameterized type declarations
101101
// which might contain extra generics that the object instance doesn't retain.
102102
if (type instanceof ParameterizedType) {
103-
getGson().toJson(o, type, writer);
103+
getGson().toJson(object, type, writer);
104104
}
105105
else {
106-
getGson().toJson(o, writer);
106+
getGson().toJson(object, writer);
107107
}
108108
}
109109

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -101,12 +101,12 @@ protected Object readInternal(Type resolvedType, Reader reader) throws Exception
101101
}
102102

103103
@Override
104-
protected void writeInternal(Object o, @Nullable Type type, Writer writer) throws Exception {
104+
protected void writeInternal(Object object, @Nullable Type type, Writer writer) throws Exception {
105105
if (type instanceof ParameterizedType) {
106-
getJsonb().toJson(o, type, writer);
106+
getJsonb().toJson(object, type, writer);
107107
}
108108
else {
109-
getJsonb().toJson(o, writer);
109+
getJsonb().toJson(object, writer);
110110
}
111111
}
112112

0 commit comments

Comments
 (0)