25
25
import org .apache .commons .lang3 .Validate ;
26
26
27
27
import org .slf4j .Logger ;
28
- import org .slf4j .LoggerFactory ;
29
28
30
29
import org .springframework .scheduling .annotation .Async ;
31
30
import org .springframework .transaction .annotation .Transactional ;
@@ -50,8 +49,7 @@ public class SiteServiceImpl implements SiteService {
50
49
public static final String MISSING_CSRF_TOKEN = "MissingCsrfToken" ;
51
50
public static final String INVALID_CSRF_TOKEN = "InvalidCsrfToken" ;
52
51
53
- private static final Logger LOG = LoggerFactory .getLogger (SiteServiceImpl .class );
54
-
52
+ private final Logger log ;
55
53
private final SuspiciousActivityDao suspiciousActivities ;
56
54
57
55
@ Override
@@ -159,23 +157,23 @@ protected void logEvent(
159
157
* @return name of the method as-is or its abbreviation with three points at the end
160
158
* @author Aleksandr Zorin
161
159
*/
162
- private static String abbreviateMethod (String method ) {
160
+ private String abbreviateMethod (String method ) {
163
161
return abbreviateIfLengthGreaterThan (method , Db .SuspiciousActivity .METHOD_LENGTH , "method" );
164
162
}
165
163
166
- private static String abbreviatePage (String page ) {
164
+ private String abbreviatePage (String page ) {
167
165
return abbreviateIfLengthGreaterThan (page , Db .SuspiciousActivity .PAGE_URL_LENGTH , "page" );
168
166
}
169
167
170
- private static String abbreviateRefererPage (String referer ) {
168
+ private String abbreviateRefererPage (String referer ) {
171
169
return abbreviateIfLengthGreaterThan (
172
170
referer ,
173
171
Db .SuspiciousActivity .REFERER_PAGE_LENGTH ,
174
172
"referer_page"
175
173
);
176
174
}
177
175
178
- private static String abbreviateUserAgent (String agent ) {
176
+ private String abbreviateUserAgent (String agent ) {
179
177
return abbreviateIfLengthGreaterThan (
180
178
agent ,
181
179
Db .SuspiciousActivity .USER_AGENT_LENGTH ,
@@ -184,13 +182,13 @@ private static String abbreviateUserAgent(String agent) {
184
182
}
185
183
186
184
// CheckStyle: ignore LineLength for next 1 lines
187
- private static String abbreviateIfLengthGreaterThan (String text , int maxLength , String fieldName ) {
185
+ private String abbreviateIfLengthGreaterThan (String text , int maxLength , String fieldName ) {
188
186
if (text == null || text .length () <= maxLength ) {
189
187
return text ;
190
188
}
191
189
192
190
// TODO(security): fix possible log injection
193
- LOG .warn (
191
+ log .warn (
194
192
"Length of value for '{}' field ({}) exceeds max field size ({}): '{}'" ,
195
193
fieldName ,
196
194
text .length (),
0 commit comments