diff --git a/src/main/java/de/thm/arsnova/dao/CouchDBDao.java b/src/main/java/de/thm/arsnova/dao/CouchDBDao.java index 4eb971a99b7f4709d6eee07e655f5342b9b925a7..d44832092d425a1109c932d1280ed09cb2699dcc 100644 --- a/src/main/java/de/thm/arsnova/dao/CouchDBDao.java +++ b/src/main/java/de/thm/arsnova/dao/CouchDBDao.java @@ -109,7 +109,7 @@ public class CouchDBDao implements IDatabaseDao { */ @Override public void cleanFeedbackVotes(int cleanupFeedbackDelay) { - final long timelimitInMillis = 60000 * cleanupFeedbackDelay; + final long timelimitInMillis = 60000 * (long) cleanupFeedbackDelay; final long maxAllowedTimeInMillis = System.currentTimeMillis() - timelimitInMillis; Map<String, Set<String>> affectedUsers = new HashMap<String, Set<String>>(); @@ -535,7 +535,7 @@ public class CouchDBDao implements IDatabaseDao { JSONObject json = JSONObject.fromObject(loggedIn); Document doc = new Document(json); - if (doc.getId() == "") { + if (doc.getId().isEmpty()) { // If this is a new user without a logged_in document, we have to remove the following // pre-filled fields. Otherwise, CouchDB will take these empty fields as genuine // identifiers, and will throw errors afterwards. diff --git a/src/main/java/de/thm/arsnova/entities/User.java b/src/main/java/de/thm/arsnova/entities/User.java index 997b22078f2e7ddbce0fe1503b5ff181f309680d..542dd4fbb0beb40d966431d720b30b9d6702b4a0 100644 --- a/src/main/java/de/thm/arsnova/entities/User.java +++ b/src/main/java/de/thm/arsnova/entities/User.java @@ -56,6 +56,7 @@ public class User implements Serializable { @Override public boolean equals(Object obj) { + if (obj == null || ! obj.getClass().equals(this.getClass())) return false; User other = (User) obj; return this.username.equals(other.username); }