Revision | 2118 (tree) |
---|---|
Zeit | 2020-08-16 18:27:23 |
Autor | t_nakayama1971 |
(empty log message)
@@ -1,6 +1,7 @@ | ||
1 | 1 | package online.filter; |
2 | 2 | |
3 | 3 | import java.io.IOException; |
4 | +import java.io.Serializable; | |
4 | 5 | import java.time.LocalDateTime; |
5 | 6 | import java.time.temporal.ChronoUnit; |
6 | 7 | import java.util.List; |
@@ -128,7 +129,7 @@ | ||
128 | 129 | private boolean setResponseForGet(final HttpServletResponse response, |
129 | 130 | final HttpSession session, final String location, final List<String> list) { |
130 | 131 | |
131 | - final Consumer<Object[]> consumer = pair -> { | |
132 | + final Consumer<Serializable[]> consumer = pair -> { | |
132 | 133 | final DuplicateBodyResponse body = (DuplicateBodyResponse) pair[1]; |
133 | 134 | body.copyResponse(response); |
134 | 135 | if (0 != body.getHeader().getStatus()) { |
@@ -139,7 +140,7 @@ | ||
139 | 140 | } |
140 | 141 | }; |
141 | 142 | |
142 | - final var opt = Optional.<Object[]>ofNullable(Factory.cast(session.getAttribute(location))); | |
143 | + final var opt = Optional.ofNullable((Serializable[]) session.getAttribute(location)); | |
143 | 144 | opt.ifPresent(consumer); |
144 | 145 | return opt.isPresent(); |
145 | 146 | } |
@@ -160,7 +161,7 @@ | ||
160 | 161 | if (list != null) { |
161 | 162 | final var ldt = LocalDateTime.now(); |
162 | 163 | for (final var loc : list) { |
163 | - final Object[] pair = Factory.cast(session.getAttribute(loc)); | |
164 | + final Serializable[] pair = Factory.cast(session.getAttribute(loc)); | |
164 | 165 | if (pair != null) { |
165 | 166 | if (isSameRequest((DuplicateBodyResponse) pair[1], location, request)) { |
166 | 167 | final var until = ((LocalDateTime) pair[0]).until(ldt, ChronoUnit.SECONDS); |
@@ -198,7 +199,8 @@ | ||
198 | 199 | final var session = request.getSession(false); |
199 | 200 | if (session != null && location != null) { |
200 | 201 | synchronized (SessionMutexListener.getMutex(session)) { |
201 | - final Object[] pair = {LocalDateTime.now(), request.getAttribute(location)}; | |
202 | + final Serializable[] pair = | |
203 | + {LocalDateTime.now(), (Serializable) request.getAttribute(location)}; | |
202 | 204 | session.setAttribute(location, pair); |
203 | 205 | |
204 | 206 | final CopyOnWriteArrayList<String> list = Objects.requireNonNullElseGet( |