diff --git a/src/main/java/de/thm/arsnova/controller/CourseController.java b/src/main/java/de/thm/arsnova/controller/CourseController.java index 48e4ece77443ef4d12ec17c9f9eb5083f18d8b47..e8919bc4328b9b8f96daba68863b5770b5eac614 100644 --- a/src/main/java/de/thm/arsnova/controller/CourseController.java +++ b/src/main/java/de/thm/arsnova/controller/CourseController.java @@ -25,8 +25,6 @@ import de.thm.arsnova.exceptions.NotImplementedException; import de.thm.arsnova.exceptions.UnauthorizedException; import de.thm.arsnova.services.IUserService; import io.swagger.annotations.ApiParam; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -44,9 +42,6 @@ import java.util.List; */ @RestController public class CourseController extends AbstractController { - - private static final Logger logger = LoggerFactory.getLogger(CourseController.class); - @Autowired(required = false) private ConnectorClient connectorClient; diff --git a/src/main/java/de/thm/arsnova/controller/FeedbackController.java b/src/main/java/de/thm/arsnova/controller/FeedbackController.java index d0e77fdda10508be1d3fe1ff951296a3392396b4..4e8b4f79d419619d612a7bd8e1d8add12d26cf68 100644 --- a/src/main/java/de/thm/arsnova/controller/FeedbackController.java +++ b/src/main/java/de/thm/arsnova/controller/FeedbackController.java @@ -23,8 +23,6 @@ import de.thm.arsnova.exceptions.NotFoundException; import de.thm.arsnova.services.IFeedbackService; import de.thm.arsnova.services.IUserService; import de.thm.arsnova.web.DeprecatedApi; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.PathVariable; @@ -42,9 +40,6 @@ import org.springframework.web.bind.annotation.RestController; */ @RestController public class FeedbackController extends AbstractController { - - private static final Logger logger = LoggerFactory.getLogger(FeedbackController.class); - @Autowired private IFeedbackService feedbackService; diff --git a/src/main/java/de/thm/arsnova/controller/LecturerQuestionController.java b/src/main/java/de/thm/arsnova/controller/LecturerQuestionController.java index 40674a0e88e135e8e2650e3f67c25f85b972035e..85ee7c9c57380a1bd5dd757c4d97c5c440c527fd 100644 --- a/src/main/java/de/thm/arsnova/controller/LecturerQuestionController.java +++ b/src/main/java/de/thm/arsnova/controller/LecturerQuestionController.java @@ -31,8 +31,6 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.PathVariable; @@ -55,9 +53,6 @@ import java.util.List; @RequestMapping("/lecturerquestion") @Api(value = "/lecturerquestion", description = "Operations for Lecture Questions") public class LecturerQuestionController extends PaginationController { - - private static final Logger logger = LoggerFactory.getLogger(LecturerQuestionController.class); - @Autowired private IQuestionService questionService; diff --git a/src/main/java/de/thm/arsnova/controller/LoginController.java b/src/main/java/de/thm/arsnova/controller/LoginController.java index 0420a72400fa12dc7954ba8a93c052b927755a90..090ac606741cb563d060e8d92f60b6f4da1bb490 100644 --- a/src/main/java/de/thm/arsnova/controller/LoginController.java +++ b/src/main/java/de/thm/arsnova/controller/LoginController.java @@ -174,7 +174,7 @@ public class LoginController extends AbstractController { return; } } catch (AuthenticationException e) { - logger.info("Authentication failed: {}", e.getMessage()); + logger.info("Database authentication failed.", e); } userService.increaseFailedLoginCount(addr); @@ -197,9 +197,9 @@ public class LoginController extends AbstractController { return; } - logger.info("LDAPLOGIN: {}", auth.isAuthenticated()); + logger.info("LDAP authentication failed."); } catch (AuthenticationException e) { - logger.info("No LDAP login: {}", e); + logger.info("LDAP authentication failed.", e); } userService.increaseFailedLoginCount(addr); diff --git a/src/main/java/de/thm/arsnova/controller/SessionController.java b/src/main/java/de/thm/arsnova/controller/SessionController.java index fb5ad95f66c81cb3d7ba9104da0fe541974957ff..1c1c6599bd3873f1a4519561d905a69faac235f3 100644 --- a/src/main/java/de/thm/arsnova/controller/SessionController.java +++ b/src/main/java/de/thm/arsnova/controller/SessionController.java @@ -37,8 +37,6 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.security.access.AccessDeniedException; @@ -62,9 +60,6 @@ import java.util.List; @RequestMapping("/session") @Api(value = "/session", description = "the Session Controller API") public class SessionController extends PaginationController { - - private static final Logger logger = LoggerFactory.getLogger(SessionController.class); - @Autowired private ISessionService sessionService; diff --git a/src/main/java/de/thm/arsnova/controller/SocketController.java b/src/main/java/de/thm/arsnova/controller/SocketController.java index 63c9fb35a683f991710b8d57b3af9b811fcafb86..685d1ff7dccd6432aff1348e63c924ee76ef5576 100644 --- a/src/main/java/de/thm/arsnova/controller/SocketController.java +++ b/src/main/java/de/thm/arsnova/controller/SocketController.java @@ -70,13 +70,13 @@ public class SocketController extends AbstractController { public void authorize(@ApiParam(value = "sessionMap", required = true) @RequestBody final Map <String, String> sessionMap, @ApiParam(value = "response", required = true) final HttpServletResponse response) { String socketid = sessionMap.get("session"); if (null == socketid) { - logger.debug("Expected property 'session' missing"); + logger.debug("Expected property 'session' missing."); response.setStatus(HttpStatus.BAD_REQUEST.value()); return; } User u = userService.getCurrentUser(); if (null == u) { - logger.debug("Client {} requested to assign Websocket session but has not authenticated", socketid); + logger.debug("Client {} requested to assign Websocket session but has not authenticated.", socketid); response.setStatus(HttpStatus.FORBIDDEN.value()); return; } diff --git a/src/main/java/de/thm/arsnova/controller/UserController.java b/src/main/java/de/thm/arsnova/controller/UserController.java index 6f955b5a8e10c17c637ac95cc90ae95301fe643b..df9237599b782733210c06f11fb39edb4c9ec10c 100644 --- a/src/main/java/de/thm/arsnova/controller/UserController.java +++ b/src/main/java/de/thm/arsnova/controller/UserController.java @@ -20,8 +20,6 @@ package de.thm.arsnova.controller; import de.thm.arsnova.entities.DbUser; import de.thm.arsnova.services.IUserService; import de.thm.arsnova.services.UserSessionService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.dao.DaoAuthenticationProvider; import org.springframework.stereotype.Controller; @@ -48,9 +46,6 @@ public class UserController extends AbstractController { @Autowired private UserSessionService userSessionService; - private static final Logger logger = LoggerFactory - .getLogger(UserController.class); - @RequestMapping(value = "/register", method = RequestMethod.POST) public void register(@RequestParam final String username, @RequestParam final String password, diff --git a/src/main/java/de/thm/arsnova/dao/CouchDBDao.java b/src/main/java/de/thm/arsnova/dao/CouchDBDao.java index 3a4f898471fd058a6f25dea64a660fc08691a1a1..31f43a468c359f39f1d745accc976bf433b16b10 100644 --- a/src/main/java/de/thm/arsnova/dao/CouchDBDao.java +++ b/src/main/java/de/thm/arsnova/dao/CouchDBDao.java @@ -143,7 +143,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware try { database.saveDocument(d); } catch (final IOException e) { - logger.error("Logging of '{}' event to database failed.", event); + logger.error("Logging of '{}' event to database failed.", event, e); } } @@ -535,7 +535,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware if (document.has("keyword")) { return (String) document.get("keyword"); } - logger.error("No session found for internal id: {}", internalSessionId); + logger.error("No session found for internal id {}.", internalSessionId); return null; } @@ -548,11 +548,8 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware ); database = session.getDatabase(databaseName); } catch (final Exception e) { - logger.error( - "Cannot connect to CouchDB database '" + databaseName - + "' on host '" + databaseHost - + "' using port " + databasePort - ); + logger.error("Cannot connect to CouchDB database '{}' on host '{}' using port {}.", + databaseName, databaseHost, databasePort, e); } } @@ -573,7 +570,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware question.set_rev(q.getRev()); return question; } catch (final IOException e) { - logger.error("Could not save question {}", question); + logger.error("Could not save question {}.", question, e); } return null; } @@ -704,7 +701,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware return question; } catch (final IOException e) { - logger.error("Could not update question {}", question); + logger.error("Could not update question {}.", question, e); } return null; @@ -731,7 +728,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware return question; } catch (final IOException e) { - logger.error("Could not save interposed question {}", question); + logger.error("Could not save interposed question {}.", question, e); } return null; @@ -755,7 +752,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware question.setSessionKeyword(getSessionKeyword(question.getSessionId())); return question; } catch (final IOException e) { - logger.error("Could not get question with id {}", id); + logger.error("Could not get question {}.", id, e); } return null; } @@ -829,7 +826,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware getDatabase().saveDocument(new Document(json)); return session; } catch (final IOException e) { - logger.error("Failed to update lastOwnerActivity for Session {}", session); + logger.error("Failed to update lastOwnerActivity for session {}.", session, e); return session; } } @@ -856,7 +853,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware return count; } catch (final IOException e) { - logger.error("IOException: Could not delete question {}", question.get_id()); + logger.error("Could not delete question {}.", question.get_id(), e); } return 0; @@ -919,14 +916,14 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware if (database.bulkSaveDocuments(answersToDelete.toArray(new Document[answersToDelete.size()]))) { count += partition.size(); } else { - logger.error("Could not bulk delete answers"); + logger.error("Could not bulk delete answers."); } } log("delete", "type", "answer", "answerCount", count); return count; } catch (final IOException e) { - logger.error("IOException: Could not delete answers for question {}", question.get_id()); + logger.error("Could not delete answers for question {}.", question.get_id(), e); } return 0; @@ -1348,7 +1345,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware } return stats; } catch (final Exception e) { - logger.error("Error while retrieving session count", e); + logger.error("Could not retrieve session count.", e); } return stats; } @@ -1362,7 +1359,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware question.setSessionId(getSessionKeyword(question.getSessionId())); return question; } catch (final IOException e) { - logger.error("Could not load interposed question {}", questionId); + logger.error("Could not load interposed question {}.", questionId, e); } return null; } @@ -1375,7 +1372,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware document.put("read", question.isRead()); getDatabase().saveDocument(document); } catch (final IOException e) { - logger.error("Could not mark interposed question as read {}", question.get_id()); + logger.error("Could not mark interposed question as read {}.", question.get_id(), e); } } @@ -1440,7 +1437,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware final Document doc = new Document(json); getDatabase().saveDocument(doc); } catch (IOException e) { - logger.error("Could not clean up logged_in document of {}", user.getUsername()); + logger.error("Could not clean up logged_in document of {}.", user.getUsername(), e); } return result; } @@ -1506,7 +1503,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware final Document doc = new Document(json); getDatabase().saveDocument(doc); } catch (IOException e) { - logger.error("Could not clean up logged_in document of {}", username); + logger.error("Could not clean up logged_in document of {}.", username, e); } return result; } @@ -1573,7 +1570,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware this.publisher.publishEvent(new NewAnswerEvent(this, e.getSession(), e.getAnswer(), e.getUser(), e.getQuestion())); } } catch (IOException e) { - logger.error("Could not bulk save answers from queue"); + logger.error("Could not bulk save answers from queue.", e); } } @@ -1597,7 +1594,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware answer.set_rev(a.getRev()); return answer; } catch (final IOException e) { - logger.error("Could not save answer {}", answer); + logger.error("Could not update answer {}.", answer, e); } return null; } @@ -1610,7 +1607,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware database.deleteDocument(database.getDocument(answerId)); log("delete", "type", "answer"); } catch (final IOException e) { - logger.error("Could not delete answer {} because of {}", answerId, e.getMessage()); + logger.error("Could not delete answer {}.", answerId, e); } } @@ -1620,7 +1617,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware deleteDocument(question.get_id()); log("delete", "type", "comment"); } catch (final IOException e) { - logger.error("Could not delete interposed question {} because of {}", question.get_id(), e.getMessage()); + logger.error("Could not delete interposed question {}.", question.get_id(), e); } } @@ -1693,7 +1690,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware return session; } catch (final IOException e) { - logger.error("Could not lock session {}", session); + logger.error("Could not update session {}.", session, e); } return null; @@ -1708,7 +1705,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware database.saveDocument(s); session.set_rev(s.getRev()); } catch (final IOException e) { - logger.error("Could not lock session {}", session); + logger.error("Could not update creator for session {}.", session, e); } return session; @@ -1724,7 +1721,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware logger.debug("Deleted session document {} and related data.", session.get_id()); log("delete", "type", "session", "id", session.get_id()); } catch (final IOException e) { - logger.error("Could not delete session {}", session); + logger.error("Could not delete session {}.", session, e); } return count; @@ -1781,7 +1778,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware if (getDatabase().bulkSaveDocuments(newDocs.toArray(new Document[newDocs.size()]))) { count += newDocs.size(); } else { - logger.error("Could not bulk delete visited session lists"); + logger.error("Could not bulk delete visited session lists."); } } } @@ -1793,7 +1790,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware return count; } catch (IOException e) { - logger.error("Could not delete visited session lists of inactive users."); + logger.error("Could not delete visited session lists of inactive users.", e); } return 0; @@ -2054,7 +2051,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware try { deleteDocument(document.getId()); } catch (final IOException e) { - logger.error("Could not delete all interposed questions {}", session); + logger.error("Could not delete all interposed questions {}.", session, e); } } @@ -2091,7 +2088,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware try { database.bulkSaveDocuments(documents.toArray(new Document[documents.size()])); } catch (final IOException e) { - logger.error("Could not bulk publish all questions: {}", e.getMessage()); + logger.error("Could not bulk publish all questions.", e); } } @@ -2125,7 +2122,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware try { database.bulkSaveDocuments(documents.toArray(new Document[documents.size()])); } catch (final IOException e) { - logger.error("Could not bulk set voting admission for all questions: {}", e.getMessage()); + logger.error("Could not bulk set voting admission for all questions.", e); } } @@ -2179,7 +2176,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware try { database.bulkSaveDocuments(documents.toArray(new Document[documents.size()])); } catch (final IOException e) { - logger.error("Could not bulk reset all questions round state: {}", e.getMessage()); + logger.error("Could not bulk reset all questions round state.", e); } } @@ -2203,7 +2200,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware return allAnswers.size(); } catch (IOException e) { - logger.error("Could not bulk delete answers: {}", e.getMessage()); + logger.error("Could not bulk delete answers.", e); } return 0; @@ -2239,7 +2236,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware return new int[] {deleteList.size(), result.size()}; } catch (IOException e) { - logger.error("Could not bulk delete questions and answers: {}", e.getMessage()); + logger.error("Could not bulk delete questions and answers.", e); } return new int[] {0, 0}; @@ -2312,7 +2309,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware return user; } catch (IOException e) { - logger.error("Could not save user {}", user); + logger.error("Could not save user {}.", user, e); } return null; @@ -2342,7 +2339,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware return true; } catch (IOException e) { - logger.error("Could not delete user {}", dbUser.getId()); + logger.error("Could not delete user {}.", dbUser.getId(), e); } return false; @@ -2382,7 +2379,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware return count; } catch (IOException e) { - logger.error("Could not delete inactive users."); + logger.error("Could not delete inactive users.", e); } return 0; @@ -2467,7 +2464,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware database.bulkSaveDocuments(motds.toArray(new Document[motds.size()])); database.bulkSaveDocuments(documents.toArray(new Document[documents.size()])); } catch (IOException e) { - logger.error("Could not import this session: {}", e.getMessage()); + logger.error("Could not import session.", e); // Something went wrong, delete this session since we do not want a partial import this.deleteSession(session); return null; @@ -2753,7 +2750,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware return motd; } catch (IOException e) { - logger.error("Could not save motd {}", motd); + logger.error("Could not save MotD {}.", motd, e); } return null; @@ -2765,7 +2762,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware try { this.deleteDocument(motd.get_id()); } catch (IOException e) { - logger.error("Could not delete Motd {}", motd.get_id()); + logger.error("Could not delete MotD {}.", motd.get_id(), e); } } @@ -2808,7 +2805,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware return motdlist; } catch (IOException e) { - logger.error("Could not save motdlist {}", motdlist); + logger.error("Could not save MotD list {}.", motdlist, e); } return null; diff --git a/src/main/java/de/thm/arsnova/services/QuestionService.java b/src/main/java/de/thm/arsnova/services/QuestionService.java index 275adfedb352fec8660d4101285c27f0abfad2f8..aa1e999c4db651d3d0345bb4aaad80e61c5e208d 100644 --- a/src/main/java/de/thm/arsnova/services/QuestionService.java +++ b/src/main/java/de/thm/arsnova/services/QuestionService.java @@ -112,7 +112,7 @@ public class QuestionService implements IQuestionService, ApplicationEventPublis // base64 adds offset to filesize, formula taken from: http://en.wikipedia.org/wiki/Base64#MIME final int fileSize = (int) ((question.getImage().length() - 814) / 1.37); if (fileSize > uploadFileSizeByte) { - logger.error("Could not save file. File is too large with " + fileSize + " Byte."); + logger.error("Could not save file. File is too large with {} Byte.", fileSize); throw new BadRequestException(); } } diff --git a/src/main/java/de/thm/arsnova/services/SessionService.java b/src/main/java/de/thm/arsnova/services/SessionService.java index 7ea54a72eabbf8781455a06639e139927835c10a..5da25855f1136c4d30db90e2125d8cdbf0da8acf 100644 --- a/src/main/java/de/thm/arsnova/services/SessionService.java +++ b/src/main/java/de/thm/arsnova/services/SessionService.java @@ -374,7 +374,7 @@ public class SessionService implements ISessionService, ApplicationEventPublishe public Session changeSessionCreator(String sessionkey, String newCreator) { final Session existingSession = databaseDao.getSessionFromKeyword(sessionkey); if (existingSession == null) { - throw new RuntimeException("Error while trying to get the session with sessionkey: " + sessionkey); + throw new RuntimeException("Could not load session " + sessionkey + "."); } return databaseDao.changeSessionCreator(existingSession, newCreator); } @@ -424,7 +424,7 @@ public class SessionService implements ISessionService, ApplicationEventPublishe final User user = userService.getCurrentUser(); final SessionInfo info = databaseDao.importSession(user, importSession); if (info == null) { - throw new RuntimeException("Error while importing the session."); + throw new RuntimeException("Could not import session."); } return info; } @@ -508,7 +508,7 @@ public class SessionService implements ISessionService, ApplicationEventPublishe // base64 adds offset to filesize, formula taken from: http://en.wikipedia.org/wiki/Base64#MIME final int fileSize = (int) ((session.getPpLogo().length() - 814) / 1.37); if (fileSize > uploadFileSizeByte) { - logger.error("Could not save file. File is too large with " + fileSize + " Byte."); + logger.error("Could not save file. File is too large with {} Byte.", fileSize); throw new PayloadTooLargeException(); } } diff --git a/src/main/java/de/thm/arsnova/services/UserService.java b/src/main/java/de/thm/arsnova/services/UserService.java index 9df1adffdeec7400e11a17dd9f10133f005a53f1..804ab96cc878e40b0200bf13b78e9587f060b623 100644 --- a/src/main/java/de/thm/arsnova/services/UserService.java +++ b/src/main/java/de/thm/arsnova/services/UserService.java @@ -241,7 +241,7 @@ public class UserService implements IUserService { if (tries < loginTryLimit) { loginTries.put(addr, ++tries); if (loginTryLimit == tries) { - logger.info("Temporarily banned {} from login.", new Object[] {addr}); + logger.info("Temporarily banned {} from login.", addr); loginBans.add(addr); } } @@ -301,7 +301,7 @@ public class UserService implements IUserService { public void removeUserFromSessionBySocketId(final UUID socketId) { final User user = socketid2user.get(socketId); if (null == user) { - logger.warn("null == user for socket {}", socketId); + logger.warn("No user exists for socket {}.", socketId); return; } @@ -401,8 +401,8 @@ public class UserService implements IUserService { UriUtils.encodeQueryParam(dbUser.getUsername(), "UTF-8"), dbUser.getActivationKey() ); - } catch (UnsupportedEncodingException e1) { - logger.error(e1.getMessage()); + } catch (UnsupportedEncodingException e) { + logger.error("Sending of activation mail failed.", e); return; } @@ -429,7 +429,7 @@ public class UserService implements IUserService { } mailPattern = Pattern.compile("[a-z0-9._-]+?@(" + StringUtils.join(patterns, "|") + ")", Pattern.CASE_INSENSITIVE); - logger.info("Allowed e-mail addresses (pattern) for registration: " + mailPattern.pattern()); + logger.info("Allowed e-mail addresses (pattern) for registration: '{}'.", mailPattern.pattern()); } } @@ -492,8 +492,8 @@ public class UserService implements IUserService { UriUtils.encodeQueryParam(dbUser.getUsername(), "UTF-8"), dbUser.getPasswordResetKey() ); - } catch (UnsupportedEncodingException e1) { - logger.error(e1.getMessage()); + } catch (UnsupportedEncodingException e) { + logger.error("Sending of password reset mail failed.", e); return; } @@ -539,7 +539,7 @@ public class UserService implements IUserService { logger.info("Sending mail \"{}\" from \"{}\" to \"{}\"", subject, msg.getFrom(), dbUser.getUsername()); mailSender.send(msg); } catch (MailException | MessagingException e) { - logger.warn("Mail \"{}\" could not be sent: {}", subject, e); + logger.warn("Mail \"{}\" could not be sent.", subject, e); } } }