Align with spring-javaformat 0.0.15

This commit is contained in:
Vedran Pavic
2019-09-27 13:23:08 +02:00
parent ec82336477
commit bd36e115a8
53 changed files with 140 additions and 160 deletions

View File

@@ -65,11 +65,7 @@ class HttpSessionAdapter<S extends Session> implements HttpSession {
this.servletContext = servletContext;
}
public void setSession(S session) {
this.session = session;
}
public S getSession() {
S getSession() {
return this.session;
}
@@ -191,16 +187,16 @@ class HttpSessionAdapter<S extends Session> implements HttpSession {
this.invalidated = true;
}
public void setNew(boolean isNew) {
this.old = !isNew;
}
@Override
public boolean isNew() {
checkState();
return !this.old;
}
void markNotNew() {
this.old = true;
}
private void checkState() {
if (this.invalidated) {
throw new IllegalStateException("The HttpSession has already be invalidated.");

View File

@@ -25,9 +25,6 @@ import javax.servlet.WriteListener;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Base class for response wrappers which encapsulate the logic for handling an event when
* the {@link javax.servlet.http.HttpServletResponse} is committed.
@@ -37,8 +34,6 @@ import org.apache.commons.logging.LogFactory;
*/
abstract class OnCommittedResponseWrapper extends HttpServletResponseWrapper {
private final Log logger = LogFactory.getLog(getClass());
private boolean disableOnCommitted;
/**
@@ -92,7 +87,7 @@ abstract class OnCommittedResponseWrapper extends HttpServletResponseWrapper {
* {@link javax.servlet.http.HttpServletResponse} is committed. This can be useful in
* the event that Async Web Requests are made.
*/
public void disableOnResponseCommitted() {
private void disableOnResponseCommitted() {
this.disableOnCommitted = true;
}

View File

@@ -292,7 +292,7 @@ public class SessionRepositoryFilter<S extends Session> extends OncePerRequestFi
requestedSession.setLastAccessedTime(Instant.now());
this.requestedSessionIdValid = true;
currentSession = new HttpSessionWrapper(requestedSession, getServletContext());
currentSession.setNew(false);
currentSession.markNotNew();
setCurrentSession(currentSession);
return currentSession;
}

View File

@@ -57,6 +57,7 @@ class DelegatingIndexResolverTests {
this.supportedIndex = supportedIndex;
}
@Override
public Map<String, String> resolveIndexesFor(MapSession session) {
return Collections.singletonMap(this.supportedIndex, session.getAttribute(this.supportedIndex));
}

View File

@@ -126,12 +126,12 @@ class EnableSpringHttpSessionCustomCookieSerializerTests {
static class Config {
@Bean
public SessionRepository sessionRepository() {
SessionRepository sessionRepository() {
return mock(SessionRepository.class);
}
@Bean
public CookieSerializer cookieSerializer() {
CookieSerializer cookieSerializer() {
return mock(CookieSerializer.class);
}

View File

@@ -120,7 +120,7 @@ class SpringHttpSessionConfigurationTests {
static class BaseConfiguration {
@Bean
public MapSessionRepository sessionRepository() {
MapSessionRepository sessionRepository() {
return new MapSessionRepository(new ConcurrentHashMap<>());
}
@@ -137,7 +137,7 @@ class SpringHttpSessionConfigurationTests {
static class SessionCookieConfigConfiguration extends BaseConfiguration {
@Bean
public ServletContext servletContext() {
ServletContext servletContext() {
MockServletContext servletContext = new MockServletContext();
servletContext.getSessionCookieConfig().setName("test-name");
servletContext.getSessionCookieConfig().setDomain("test-domain");
@@ -153,7 +153,7 @@ class SpringHttpSessionConfigurationTests {
static class RememberMeServicesConfiguration extends BaseConfiguration {
@Bean
public SpringSessionRememberMeServices rememberMeServices() {
SpringSessionRememberMeServices rememberMeServices() {
return new SpringSessionRememberMeServices();
}

View File

@@ -499,7 +499,7 @@ class DefaultCookieSerializerTests {
assertThat(getCookie().getSameSite()).isNull();
}
public void setCookieName(String cookieName) {
void setCookieName(String cookieName) {
this.cookieName = cookieName;
this.serializer.setCookieName(cookieName);
}

View File

@@ -1331,11 +1331,8 @@ class SessionRepositoryFilterTests {
// We want the filter to work without any dependencies on Spring
@Test
@SuppressWarnings("unused")
void doesNotImplementOrdered() {
assertThatExceptionOfType(ClassCastException.class).isThrownBy(() -> {
Ordered o = (Ordered) this.filter;
});
assertThatExceptionOfType(ClassCastException.class).isThrownBy(() -> Ordered.class.cast(this.filter));
}
@Test