Skip to content

Commit 5df555c

Browse files
committed
Polish
1 parent 6f05c84 commit 5df555c

File tree

16 files changed

+25
-39
lines changed

16 files changed

+25
-39
lines changed

samples/boot/findbyusername/src/test/java/sample/session/SessionDetailsFilterTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.junit.Before;
2121
import org.junit.Test;
2222
import org.junit.runner.RunWith;
23-
2423
import sample.config.GeoConfig;
2524

2625
import org.springframework.beans.factory.annotation.Autowired;

samples/javaconfig/hazelcast/src/main/java/sample/SecurityConfig.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@
1616

1717
package sample;
1818

19-
/**
20-
* @author Rob Winch
21-
*/
22-
2319
import org.springframework.beans.factory.annotation.Autowired;
2420
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
2521
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
2622

23+
/**
24+
* @author Rob Winch
25+
*/
2726
@EnableWebSecurity
2827
public class SecurityConfig {
2928
@Autowired

samples/javaconfig/security/src/main/java/sample/SecurityConfig.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@
1616

1717
package sample;
1818

19-
/**
20-
* @author Rob Winch
21-
*/
22-
2319
import org.springframework.beans.factory.annotation.Autowired;
2420
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
2521
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
2622

23+
/**
24+
* @author Rob Winch
25+
*/
2726
@EnableWebSecurity
2827
public class SecurityConfig {
2928
@Autowired

settings.gradle

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
rootProject.name = 'spring-session-build'
22

3-
43
FileTree buildFiles = fileTree(rootDir) {
54
include '**/*.gradle'
65
exclude '**/gradle', 'settings.gradle', 'buildSrc', '/build.gradle', '.*'
@@ -9,15 +8,14 @@ FileTree buildFiles = fileTree(rootDir) {
98

109
String rootDirPath = rootDir.absolutePath + File.separator
1110
buildFiles.each { File buildFile ->
12-
13-
boolean isDefaultName = 'build.gradle'.equals(buildFile.name)
14-
if(isDefaultName) {
11+
if (buildFile.name == 'build.gradle') {
1512
String buildFilePath = buildFile.parentFile.absolutePath
1613
String projectPath = buildFilePath.replace(rootDirPath, '').replaceAll(File.separator, ':')
1714
include projectPath
18-
} else {
19-
String projectName = buildFile.name.replace('.gradle', '');
20-
String projectPath = ':' + projectName;
15+
}
16+
else {
17+
String projectName = buildFile.name.replace('.gradle', '')
18+
String projectPath = ':' + projectName
2119
include projectPath
2220
def project = findProject("${projectPath}")
2321
project.name = projectName

spring-session-core/src/main/java/org/springframework/session/MapReactiveSessionRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public MapReactiveSessionRepository(Map<String, Session> sessions) {
6868
* should be kept alive between client requests.
6969
*/
7070
public void setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval) {
71-
this.defaultMaxInactiveInterval = Integer.valueOf(defaultMaxInactiveInterval);
71+
this.defaultMaxInactiveInterval = defaultMaxInactiveInterval;
7272
}
7373

7474
public Mono<Void> save(MapSession session) {

spring-session-core/src/main/java/org/springframework/session/MapSessionRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public MapSessionRepository(Map<String, Session> sessions) {
6666
* should be kept alive between client requests.
6767
*/
6868
public void setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval) {
69-
this.defaultMaxInactiveInterval = Integer.valueOf(defaultMaxInactiveInterval);
69+
this.defaultMaxInactiveInterval = defaultMaxInactiveInterval;
7070
}
7171

7272
public void save(MapSession session) {

spring-session-core/src/main/java/org/springframework/session/web/http/SessionEventHttpSessionListenerAdapter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ private HttpSessionEvent createHttpSessionEvent(AbstractSessionEvent event) {
7676
Session session = event.getSession();
7777
HttpSession httpSession = new HttpSessionAdapter<>(session,
7878
this.context);
79-
HttpSessionEvent httpSessionEvent = new HttpSessionEvent(httpSession);
80-
return httpSessionEvent;
79+
return new HttpSessionEvent(httpSession);
8180
}
8281

8382
/*

spring-session-core/src/test/java/org/springframework/session/web/http/SessionEventHttpSessionListenerAdapterTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ public void setup() {
7575
// none)
7676
@Test
7777
public void constructorEmptyWorks() {
78-
new SessionEventHttpSessionListenerAdapter(
79-
Collections.<HttpSessionListener>emptyList());
78+
new SessionEventHttpSessionListenerAdapter(Collections.emptyList());
8079
}
8180

8281
/**
@@ -86,7 +85,7 @@ public void constructorEmptyWorks() {
8685
@Test
8786
public void onApplicationEventEmptyListenersDoesNotUseEvent() {
8887
this.listener = new SessionEventHttpSessionListenerAdapter(
89-
Collections.<HttpSessionListener>emptyList());
88+
Collections.emptyList());
9089
this.destroyed = mock(SessionDestroyedEvent.class);
9190

9291
this.listener.onApplicationEvent(this.destroyed);

spring-session-core/src/test/java/org/springframework/session/web/socket/server/SessionRepositoryMessageInterceptorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public void setMatchingMessageTypesNull() {
136136

137137
@Test(expected = IllegalArgumentException.class)
138138
public void setMatchingMessageTypesEmpty() {
139-
this.interceptor.setMatchingMessageTypes(Collections.<SimpMessageType>emptySet());
139+
this.interceptor.setMatchingMessageTypes(Collections.emptySet());
140140
}
141141

142142
@Test

spring-session-data-redis/src/main/java/org/springframework/session/data/redis/RedisOperationsSessionRepository.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,6 @@ public RedisSession createSession() {
497497
public void onMessage(Message message, byte[] pattern) {
498498
byte[] messageChannel = message.getChannel();
499499
byte[] messageBody = message.getBody();
500-
if (messageChannel == null || messageBody == null) {
501-
return;
502-
}
503500

504501
String channel = new String(messageChannel);
505502

@@ -536,8 +533,6 @@ public void onMessage(Message message, byte[] pattern) {
536533
else {
537534
handleExpired(sessionId, session);
538535
}
539-
540-
return;
541536
}
542537
}
543538

spring-session-data-redis/src/test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ public void findByPrincipalNameExpired() {
433433
given(this.redisOperations.boundSetOps(anyString()))
434434
.willReturn(this.boundSetOperations);
435435
given(this.boundSetOperations.members())
436-
.willReturn(Collections.<Object>singleton(expiredId));
436+
.willReturn(Collections.singleton(expiredId));
437437
given(this.redisOperations.boundHashOps(getKey(expiredId)))
438438
.willReturn(this.boundHashOperations);
439439
Map map = map(RedisOperationsSessionRepository.MAX_INACTIVE_ATTR, 1,
@@ -455,7 +455,7 @@ public void findByPrincipalName() {
455455
given(this.redisOperations.boundSetOps(anyString()))
456456
.willReturn(this.boundSetOperations);
457457
given(this.boundSetOperations.members())
458-
.willReturn(Collections.<Object>singleton(sessionId));
458+
.willReturn(Collections.singleton(sessionId));
459459
given(this.redisOperations.boundHashOps(getKey(sessionId)))
460460
.willReturn(this.boundHashOperations);
461461
Map map = map(RedisOperationsSessionRepository.CREATION_TIME_ATTR, createdTime.toEpochMilli(),

spring-session-hazelcast/src/main/java/org/springframework/session/hazelcast/HazelcastSessionRepository.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,7 @@ public String getId() {
320320

321321
public String changeSessionId() {
322322
this.changed = true;
323-
String result = this.delegate.changeSessionId();
324-
return result;
323+
return this.delegate.changeSessionId();
325324
}
326325

327326
public Instant getLastAccessedTime() {

spring-session-hazelcast/src/main/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfiguration.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,9 @@ public void setImportMetadata(AnnotationMetadata importMetadata) {
7575
.getAnnotationAttributes(EnableHazelcastHttpSession.class.getName());
7676
AnnotationAttributes enableAttrs = AnnotationAttributes.fromMap(enableAttrMap);
7777
setMaxInactiveIntervalInSeconds(
78-
(Integer) enableAttrs.getNumber("maxInactiveIntervalInSeconds"));
78+
enableAttrs.getNumber("maxInactiveIntervalInSeconds"));
7979
setSessionMapName(enableAttrs.getString("sessionMapName"));
80-
setHazelcastFlushMode(
81-
(HazelcastFlushMode) enableAttrs.getEnum("hazelcastFlushMode"));
80+
setHazelcastFlushMode(enableAttrs.getEnum("hazelcastFlushMode"));
8281
}
8382

8483
public void setMaxInactiveIntervalInSeconds(int maxInactiveIntervalInSeconds) {

spring-session-hazelcast/src/test/resources/org/springframework/session/hazelcast/config/annotation/web/http/hazelcast-custom-idle-time-map-name.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<hazelcast xmlns="http://www.hazelcast.com/schema/config"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.6.xsd">
4+
xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.8.xsd">
55

66
<group>
77
<name>spring-session-it-test-idle-time-map-name</name>

spring-session-hazelcast/src/test/resources/org/springframework/session/hazelcast/config/annotation/web/http/hazelcast-custom-map-name.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<hazelcast xmlns="http://www.hazelcast.com/schema/config"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.6.xsd">
4+
xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.8.xsd">
55

66
<group>
77
<name>spring-session-it-test-map-name</name>

spring-session-jdbc/src/main/java/org/springframework/session/jdbc/JdbcOperationsSessionRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ public Map<String, JdbcSession> findByIndexNameAndIndexValue(String indexName,
527527

528528
@Scheduled(cron = "${spring.session.cleanup.cron.expression:0 * * * * *}")
529529
public void cleanUpExpiredSessions() {
530-
int deletedCount = this.transactionOperations.execute(transactionStatus ->
530+
Integer deletedCount = this.transactionOperations.execute(transactionStatus ->
531531
JdbcOperationsSessionRepository.this.jdbcOperations.update(
532532
JdbcOperationsSessionRepository.this.deleteSessionsByExpiryTimeQuery,
533533
System.currentTimeMillis()));

0 commit comments

Comments
 (0)