Skip to content
Snippets Groups Projects
Commit 51ec6042 authored by Paul-Christian Volkmer's avatar Paul-Christian Volkmer
Browse files

Fixed some issues introduced in last changesets

This patch should increase findbugs report and solve some issues that
will occure:

* Doing operation on NULL object
* Using wrong object type in hope of magic object casting ;-)
parent 03aa25d5
No related merge requests found
......@@ -1071,15 +1071,14 @@ public class CouchDBDao implements IDatabaseDao {
public Question getInterposedQuestion(String sessionKey, String documentId) {
try {
Document document = this.getDatabase().getDocument(documentId);
LOGGER.error("bla test" + document.toString());
if(document != null) {
Question question = (Question) JSONObject.toBean(document.getJSONObject(), Question.class);
question.setQuestionType("interposed_question");
return question;
if (document == null) {
LOGGER.error("Document is NULL");
return null;
}
Question question = (Question) JSONObject.toBean(document.getJSONObject(), Question.class);
question.setQuestionType("interposed_question");
return question;
} catch (IOException e) {
LOGGER.error("Error while retrieving interposed question", e);
}
......
......@@ -134,9 +134,12 @@ public class UserService implements IUserService, InitializingBean, DisposableBe
@Override
public String getSessionForUser(String username) {
return user2session.get(username);
for (Entry<User, String> entry : user2session.entrySet()) {
if (entry.getKey().getUsername().equals(username)) return entry.getValue();
}
return null;
}
@Override
public void afterPropertiesSet() {
try {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment