Skip to content

Commit 6f2b24a

Browse files
author
Rob Winch
committed
Polish JSON warnings / javadoc
Issue gh-3736
1 parent 6d20037 commit 6f2b24a

File tree

9 files changed

+20
-23
lines changed

9 files changed

+20
-23
lines changed

cas/src/main/java/org/springframework/security/cas/jackson2/CasJackson2Module.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* ObjectMapper mapper = new ObjectMapper();
3535
* mapper.registerModule(new CasJackson2Module());
3636
* </pre>
37-
* <b>Note: use {@link SecurityJacksonModules#getModules()} to get list of all security modules.</b>
37+
* <b>Note: use {@link SecurityJacksonModules#getModules(ClassLoader)} to get list of all security modules on the classpath.</b>
3838
*
3939
* @author Jitendra Singh.
4040
* @see org.springframework.security.jackson2.SecurityJacksonModules

core/src/main/java/org/springframework/security/jackson2/CoreJackson2Module.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* ObjectMapper mapper = new ObjectMapper();
3939
* mapper.registerModule(new CoreJackson2Module());
4040
* </pre>
41-
* <b>Note: use {@link SecurityJacksonModules#getModules()} to get list of all security modules.</b>
41+
* <b>Note: use {@link SecurityJacksonModules#getModules(ClassLoader)} to get list of all security modules.</b>
4242
*
4343
* @author Jitendra Singh.
4444
* @see SecurityJacksonModules
@@ -56,7 +56,7 @@ public void setupModule(SetupContext context) {
5656
context.setMixInAnnotations(AnonymousAuthenticationToken.class, AnonymousAuthenticationTokenMixin.class);
5757
context.setMixInAnnotations(RememberMeAuthenticationToken.class, RememberMeAuthenticationTokenMixin.class);
5858
context.setMixInAnnotations(SimpleGrantedAuthority.class, SimpleGrantedAuthorityMixin.class);
59-
context.setMixInAnnotations(Collections.unmodifiableSet(Collections.EMPTY_SET).getClass(), UnmodifiableSetMixin.class);
59+
context.setMixInAnnotations(Collections.<Object>unmodifiableSet(Collections.emptySet()).getClass(), UnmodifiableSetMixin.class);
6060
context.setMixInAnnotations(User.class, UserMixin.class);
6161
context.setMixInAnnotations(UsernamePasswordAuthenticationToken.class, UsernamePasswordAuthenticationTokenMixin.class);
6262
}

core/src/main/java/org/springframework/security/jackson2/UnmodifiableSetMixin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class UnmodifiableSetMixin {
4040

4141
/**
4242
* Mixin Constructor
43-
* @param s
43+
* @param s the Set
4444
*/
4545
@JsonCreator
46-
UnmodifiableSetMixin(Set s) {}
46+
UnmodifiableSetMixin(Set<?> s) {}
4747
}

core/src/main/java/org/springframework/security/jackson2/UserDeserializer.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ class UserDeserializer extends JsonDeserializer<User> {
4646
* serialized json, because credentials may be removed from the {@link User} by invoking {@link User#eraseCredentials()}.
4747
* In that case there won't be any password key in serialized json.
4848
*
49-
* @param jp
50-
* @param ctxt
51-
* @return
52-
* @throws IOException
53-
* @throws JsonProcessingException
49+
* @param jp the JsonParser
50+
* @param ctxt the DeserializationContext
51+
* @return the user
52+
* @throws IOException if a exception during IO occurs
53+
* @throws JsonProcessingException if an error during JSON processing occurs
5454
*/
5555
@Override
5656
public User deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {

core/src/main/java/org/springframework/security/jackson2/UsernamePasswordAuthenticationTokenDeserializer.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ class UsernamePasswordAuthenticationTokenDeserializer extends JsonDeserializer<U
4747

4848
/**
4949
* This method construct {@link UsernamePasswordAuthenticationToken} object from serialized json.
50-
* @param jp
51-
* @param ctxt
52-
* @return
53-
* @throws IOException
54-
* @throws JsonProcessingException
50+
* @param jp the JsonParser
51+
* @param ctxt the DeserializationContext
52+
* @return the user
53+
* @throws IOException if a exception during IO occurs
54+
* @throws JsonProcessingException if an error during JSON processing occurs
5555
*/
5656
@Override
5757
public UsernamePasswordAuthenticationToken deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {

core/src/test/java/org/springframework/security/jackson2/SimpleGrantedAuthorityMixinTests.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,8 @@
1818

1919
import com.fasterxml.jackson.core.JsonProcessingException;
2020
import com.fasterxml.jackson.databind.JsonMappingException;
21-
import com.fasterxml.jackson.databind.ObjectMapper;
2221
import org.json.JSONException;
23-
import org.junit.Before;
2422
import org.junit.Test;
25-
import org.junit.runner.RunWith;
26-
import org.mockito.runners.MockitoJUnitRunner;
2723
import org.skyscreamer.jsonassert.JSONAssert;
2824
import org.springframework.security.core.authority.SimpleGrantedAuthority;
2925

web/src/main/java/org/springframework/security/web/jackson2/CookieDeserializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
/**
3232
* Jackson deserializer for {@link Cookie}. This is needed because in most cases we don't
33-
* set {@link Cookie#domain} property. So when jackson deserialize that json {@link Cookie#setDomain(String)}
33+
* set {@link Cookie#getDomain()} property. So when jackson deserialize that json {@link Cookie#setDomain(String)}
3434
* throws {@link NullPointerException}. This is registered with {@link CookieMixin} but you can also use it with
3535
* your own mixin.
3636
*

web/src/main/java/org/springframework/security/web/jackson2/DefaultCsrfTokenMixin.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ class DefaultCsrfTokenMixin {
4343
* JsonCreator constructor needed by Jackson to create {@link org.springframework.security.web.csrf.DefaultCsrfToken}
4444
* object.
4545
*
46-
* @param headerName
47-
* @param parameterName
48-
* @param token
46+
* @param headerName the name of the header
47+
* @param parameterName the parameter name
48+
* @param token the CSRF token value
4949
*/
5050
@JsonCreator
5151
public DefaultCsrfTokenMixin(@JsonProperty("headerName") String headerName,

web/src/test/java/org/springframework/security/web/jackson2/SavedCookieMixinTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public void serializeSavedCookieWithList() throws JsonProcessingException, JSONE
7575
}
7676

7777
@Test
78+
@SuppressWarnings("unchecked")
7879
public void deserializeSavedCookieWithList() throws IOException, JSONException {
7980
String expectedJson = String.format("[\"java.util.ArrayList\", [%s]]", expectedSavedCookieJson);
8081
List<SavedCookie> savedCookies = (List<SavedCookie>)buildObjectMapper().readValue(expectedJson, Object.class);

0 commit comments

Comments
 (0)