Skip to content

Commit 09e0ea6

Browse files
committed
Added static modifier to sl4j logger instance.
And also renamed it to upper case, due to its static nature. Reported by PMD. No functional changes.
1 parent 645ef47 commit 09e0ea6

File tree

6 files changed

+17
-16
lines changed

6 files changed

+17
-16
lines changed

src/main/java/ru/mystamps/web/controller/NotFoundErrorController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
@Controller
3838
@RequestMapping(Url.NOT_FOUND_PAGE)
3939
public class NotFoundErrorController {
40-
private final Logger log = LoggerFactory.getLogger(NotFoundErrorController.class);
40+
private static final Logger LOG = LoggerFactory.getLogger(NotFoundErrorController.class);
4141

4242
private final SiteService siteService;
4343

@@ -68,7 +68,7 @@ public void notFound(
6868
} catch (final Exception ex) {
6969
// intentionally ignored:
7070
// database error should not break showing of 404 page
71-
log.warn("Cannot log 404 error", ex);
71+
LOG.warn("Cannot log 404 error", ex);
7272
}
7373
}
7474

src/main/java/ru/mystamps/web/service/CronService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class CronService {
4444

4545
private static final long CHECK_UNACTIVATED_REQUESTS_PERIOD = 12 * DateUtils.MILLIS_PER_HOUR;
4646

47-
private final Logger log = LoggerFactory.getLogger(CronService.class);
47+
private static final Logger LOG = LoggerFactory.getLogger(CronService.class);
4848

4949
@Inject
5050
private UsersActivationDao usersActivationDao;
@@ -63,12 +63,12 @@ public void purgeUsersActivations() {
6363
checkState(expiredActivations != null, "Expired activations should be non null");
6464

6565
if (expiredActivations.isEmpty()) {
66-
log.info("Expired activations was not found.");
66+
LOG.info("Expired activations was not found.");
6767
return;
6868
}
6969

7070
for (final UsersActivation activation : expiredActivations) {
71-
log.info(
71+
LOG.info(
7272
"Delete expired activation (key: {}, email: {}, created: {})",
7373
new Object[] {
7474
activation.getActivationKey(),

src/main/java/ru/mystamps/web/service/SiteService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141

4242
@Service
4343
public class SiteService {
44-
private final Logger log = LoggerFactory.getLogger(SiteService.class);
44+
45+
private static final Logger LOG = LoggerFactory.getLogger(SiteService.class);
4546

4647
@Inject
4748
private UserDao users;
@@ -94,7 +95,7 @@ private void log(
9495
if (userId != null) {
9596
currentUser = users.findOne(userId);
9697
if (currentUser == null) {
97-
log.warn("Cannot find user with id {}", userId);
98+
LOG.warn("Cannot find user with id {}", userId);
9899
}
99100
}
100101
activity.setUser(currentUser);

src/main/java/ru/mystamps/web/service/UserService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
@Service
4444
public class UserService {
4545

46-
private final Logger log = LoggerFactory.getLogger(UserService.class);
46+
private static final Logger LOG = LoggerFactory.getLogger(UserService.class);
4747

4848
@Inject
4949
private UserDao users;
@@ -94,7 +94,7 @@ public void registerUser(final String login, final String password,
9494
final UsersActivation activation =
9595
usersActivation.findByActivationKey(activationKey);
9696
if (activation == null) {
97-
log.warn("Cannot find registration request for activation key '{}'", activationKey);
97+
LOG.warn("Cannot find registration request for activation key '{}'", activationKey);
9898
return;
9999
}
100100

@@ -120,7 +120,7 @@ public void registerUser(final String login, final String password,
120120
users.save(user);
121121
usersActivation.delete(activation);
122122

123-
log.info(
123+
LOG.info(
124124
"Added user (login='{}', name='{}', activation key='{}')",
125125
new Object[]{login, finalName, activationKey}
126126
);

src/main/java/ru/mystamps/web/support/spring/security/AuthenticationFailureListener.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
public class AuthenticationFailureListener
3535
implements ApplicationListener<AuthenticationFailureBadCredentialsEvent> {
3636

37-
private final Logger log = LoggerFactory.getLogger(AuthenticationFailureListener.class);
37+
private static final Logger LOG = LoggerFactory.getLogger(AuthenticationFailureListener.class);
3838

3939
@Inject
4040
private SiteService siteService;
@@ -43,7 +43,7 @@ public class AuthenticationFailureListener
4343
public void onApplicationEvent(final AuthenticationFailureBadCredentialsEvent event) {
4444
final HttpServletRequest request = getRequest();
4545
if (request == null) {
46-
log.warn("Can't get http request object");
46+
LOG.warn("Can't get http request object");
4747
return;
4848
}
4949

src/main/java/ru/mystamps/web/support/spring/security/CustomUserDetailsService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
*/
4444
public class CustomUserDetailsService implements UserDetailsService {
4545

46-
private final Logger log = LoggerFactory.getLogger(CustomUserDetailsService.class);
46+
private static final Logger LOG = LoggerFactory.getLogger(CustomUserDetailsService.class);
4747

4848
@Inject
4949
private UserService userService;
@@ -53,15 +53,15 @@ public class CustomUserDetailsService implements UserDetailsService {
5353
public UserDetails loadUserByUsername(final String login) {
5454
checkArgument(login != null, "Login should be non null");
5555

56-
log.debug("Find user by login '{}'", login);
56+
LOG.debug("Find user by login '{}'", login);
5757

5858
final User user = userService.findByLogin(login);
5959
if (user == null) {
60-
log.debug("User '{}' not found", login);
60+
LOG.debug("User '{}' not found", login);
6161
throw new UsernameNotFoundException("User not found");
6262
}
6363

64-
log.debug("User '{}' found", login);
64+
LOG.debug("User '{}' found", login);
6565

6666
return new CustomUserDetails(user, getAuthorities());
6767
}

0 commit comments

Comments
 (0)