Skip to content

Commit b722b12

Browse files
committed
Fix formatting
Issue gh-1654
1 parent 29ff2e4 commit b722b12

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -461,16 +461,15 @@ public Map<String, JdbcSession> findByIndexNameAndIndexValue(String indexName, f
461461

462462
private void insertSessionAttributes(JdbcSession session, List<String> attributeNames) {
463463
Assert.notEmpty(attributeNames, "attributeNames must not be null or empty");
464-
try (LobCreator lobCreator = lobHandler.getLobCreator()) {
464+
try (LobCreator lobCreator = this.lobHandler.getLobCreator()) {
465465
if (attributeNames.size() > 1) {
466466
this.jdbcOperations.batchUpdate(this.createSessionAttributeQuery, new BatchPreparedStatementSetter() {
467467

468468
@Override
469469
public void setValues(PreparedStatement ps, int i) throws SQLException {
470470
String attributeName = attributeNames.get(i);
471471
ps.setString(1, attributeName);
472-
lobCreator.setBlobAsBytes(ps, 2,
473-
serialize(session.getAttribute(attributeName)));
472+
lobCreator.setBlobAsBytes(ps, 2, serialize(session.getAttribute(attributeName)));
474473
ps.setString(3, session.getId());
475474
}
476475

@@ -480,7 +479,8 @@ public int getBatchSize() {
480479
}
481480

482481
});
483-
} else {
482+
}
483+
else {
484484
this.jdbcOperations.update(this.createSessionAttributeQuery, (ps) -> {
485485
String attributeName = attributeNames.get(0);
486486
ps.setString(1, attributeName);
@@ -493,15 +493,14 @@ public int getBatchSize() {
493493

494494
private void updateSessionAttributes(JdbcSession session, List<String> attributeNames) {
495495
Assert.notEmpty(attributeNames, "attributeNames must not be null or empty");
496-
try (LobCreator lobCreator = lobHandler.getLobCreator()) {
496+
try (LobCreator lobCreator = this.lobHandler.getLobCreator()) {
497497
if (attributeNames.size() > 1) {
498498
this.jdbcOperations.batchUpdate(this.updateSessionAttributeQuery, new BatchPreparedStatementSetter() {
499499

500500
@Override
501501
public void setValues(PreparedStatement ps, int i) throws SQLException {
502502
String attributeName = attributeNames.get(i);
503-
lobCreator.setBlobAsBytes(ps, 1,
504-
serialize(session.getAttribute(attributeName)));
503+
lobCreator.setBlobAsBytes(ps, 1, serialize(session.getAttribute(attributeName)));
505504
ps.setString(2, session.primaryKey);
506505
ps.setString(3, attributeName);
507506
}
@@ -512,7 +511,8 @@ public int getBatchSize() {
512511
}
513512

514513
});
515-
} else {
514+
}
515+
else {
516516
this.jdbcOperations.update(this.updateSessionAttributeQuery, (ps) -> {
517517
String attributeName = attributeNames.get(0);
518518
lobCreator.setBlobAsBytes(ps, 1, serialize(session.getAttribute(attributeName)));

spring-session-jdbc/src/test/java/org/springframework/session/jdbc/JdbcIndexedSessionRepositoryTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
import static org.mockito.Mockito.times;
6161
import static org.mockito.Mockito.verify;
6262
import static org.mockito.Mockito.verifyNoMoreInteractions;
63-
import static org.mockito.Mockito.when;
6463

6564
/**
6665
* Tests for {@link JdbcIndexedSessionRepository}.
@@ -719,7 +718,7 @@ void flushModeSetLastAccessedTime() {
719718
void saveAndFreeTemporaryLob() {
720719
DefaultLobHandler lobHandler = mock(DefaultLobHandler.class);
721720
TemporaryLobCreator lobCreator = mock(TemporaryLobCreator.class);
722-
when(lobHandler.getLobCreator()).thenReturn(lobCreator);
721+
given(lobHandler.getLobCreator()).willReturn(lobCreator);
723722
lobHandler.setCreateTemporaryLob(true);
724723
this.repository.setLobHandler(lobHandler);
725724

0 commit comments

Comments
 (0)