Yi EungJun 2015-02-23
Make fields final if possible
findbugs says, "This static field public but not final, and could be
changed by malicious code or by accident from another package. The field
could be made final to avoid this vulnerability."
@a00946a84051036d82670eef4fef8912d9467470
app/models/IssueComment.java
--- app/models/IssueComment.java
+++ app/models/IssueComment.java
@@ -30,7 +30,7 @@
 @Entity
 public class IssueComment extends Comment {
     private static final long serialVersionUID = 1L;
-    public static Finder<Long, IssueComment> find = new Finder<>(Long.class, IssueComment.class);
+    public static final Finder<Long, IssueComment> find = new Finder<>(Long.class, IssueComment.class);
 
     @ManyToOne
     public Issue issue;
app/models/IssueEvent.java
--- app/models/IssueEvent.java
+++ app/models/IssueEvent.java
@@ -55,7 +55,7 @@
     private static final int DRAFT_TIME_IN_MILLIS = Configuration.root()
         .getMilliseconds("application.issue-event.draft-time", 30 * 1000L).intValue();
 
-    public static Finder<Long, IssueEvent> find = new Finder<>(Long.class,
+    public static final Finder<Long, IssueEvent> find = new Finder<>(Long.class,
             IssueEvent.class);
 
     /**
app/models/NotificationEvent.java
--- app/models/NotificationEvent.java
+++ app/models/NotificationEvent.java
@@ -66,7 +66,7 @@
     @Id
     public Long id;
 
-    public static Finder<Long, NotificationEvent> find = new Finder<>(Long.class, NotificationEvent.class);
+    public static final Finder<Long, NotificationEvent> find = new Finder<>(Long.class, NotificationEvent.class);
 
     public String title;
 
app/models/NotificationMail.java
--- app/models/NotificationMail.java
+++ app/models/NotificationMail.java
@@ -69,7 +69,7 @@
     @OneToOne
     public NotificationEvent notificationEvent;
 
-    public static Finder<Long, NotificationMail> find = new Finder<>(Long.class,
+    public static final Finder<Long, NotificationMail> find = new Finder<>(Long.class,
             NotificationMail.class);
 
     public static void onStart() {
app/models/PostingComment.java
--- app/models/PostingComment.java
+++ app/models/PostingComment.java
@@ -28,7 +28,7 @@
 @Entity
 public class PostingComment extends Comment {
     private static final long serialVersionUID = 1L;
-    public static Finder<Long, PostingComment> find = new Finder<>(Long.class, PostingComment.class);
+    public static final Finder<Long, PostingComment> find = new Finder<>(Long.class, PostingComment.class);
 
     @ManyToOne
     public Posting posting;
app/models/ProjectTransfer.java
--- app/models/ProjectTransfer.java
+++ app/models/ProjectTransfer.java
@@ -38,7 +38,7 @@
 
     private static final long serialVersionUID = 1L;
 
-    public static Finder<Long, ProjectTransfer> find = new Finder<>(Long.class, ProjectTransfer.class);
+    public static final Finder<Long, ProjectTransfer> find = new Finder<>(Long.class, ProjectTransfer.class);
 
     @Id
     public Long id;
app/models/PullRequestCommit.java
--- app/models/PullRequestCommit.java
+++ app/models/PullRequestCommit.java
@@ -36,12 +36,16 @@
 import playRepository.GitCommit;
 import utils.JodaDateUtil;
 
+import javax.persistence.*;
+import java.util.Date;
+import java.util.List;
+
 @Entity
 public class PullRequestCommit extends Model implements TimelineItem {
 
     private static final long serialVersionUID = -4343181252386722689L;
 
-    public static Finder<Long, PullRequestCommit> find = new Finder<>(Long.class, PullRequestCommit.class);
+    public static final Finder<Long, PullRequestCommit> find = new Finder<>(Long.class, PullRequestCommit.class);
 
     @Id
     public String id;
app/models/PullRequestEvent.java
--- app/models/PullRequestEvent.java
+++ app/models/PullRequestEvent.java
@@ -20,26 +20,25 @@
  */
 package models;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import javax.persistence.*;
-
-import org.apache.commons.lang3.StringUtils;
 import models.enumeration.EventType;
 import models.enumeration.State;
+import org.apache.commons.lang3.StringUtils;
 import org.joda.time.DateTime;
 import play.db.ebean.Model;
 import utils.EventConstants;
 import utils.JodaDateUtil;
 
+import javax.persistence.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
 @Entity
 public class PullRequestEvent extends Model implements TimelineItem {
 
     private static final long serialVersionUID = 1981361242582594128L;
-    public static Finder<Long, PullRequestEvent> finder = new Finder<>(Long.class, PullRequestEvent.class);
+    public static final Finder<Long, PullRequestEvent> finder = new Finder<>(Long.class, PullRequestEvent.class);
 
     @Id
     public Long id;
app/models/Role.java
--- app/models/Role.java
+++ app/models/Role.java
@@ -34,7 +34,7 @@
 @Entity
 public class Role extends Model {
     private static final long serialVersionUID = 1L;
-    public static Finder<Long, Role> find = new Finder<>(Long.class,
+    public static final Finder<Long, Role> find = new Finder<>(Long.class,
             Role.class);
 
     @Id
app/models/Unwatch.java
--- app/models/Unwatch.java
+++ app/models/Unwatch.java
@@ -29,7 +29,7 @@
 public class Unwatch extends UserAction {
     private static final long serialVersionUID = 1L;
 
-    public static Finder<Long, Unwatch> find = new Finder<>(Long.class, Unwatch.class);
+    public static final Finder<Long, Unwatch> find = new Finder<>(Long.class, Unwatch.class);
 
     public static List<Unwatch> findBy(ResourceType resourceType, String resourceId) {
         return findBy(find, resourceType, resourceId);
app/models/UserProjectNotification.java
--- app/models/UserProjectNotification.java
+++ app/models/UserProjectNotification.java
@@ -39,7 +39,7 @@
 
     private static final long serialVersionUID = 1L;
 
-    public static Finder<Long, UserProjectNotification> find = new Finder<>(Long.class, UserProjectNotification.class);
+    public static final Finder<Long, UserProjectNotification> find = new Finder<>(Long.class, UserProjectNotification.class);
 
     @Id
     public Long id;
app/models/Watch.java
--- app/models/Watch.java
+++ app/models/Watch.java
@@ -40,7 +40,7 @@
 public class Watch extends UserAction {
     private static final long serialVersionUID = 1L;
 
-    public static Finder<Long, Watch> find = new Finder<>(Long.class, Watch.class);
+    public static final Finder<Long, Watch> find = new Finder<>(Long.class, Watch.class);
 
     public static List<Watch> findBy(ResourceType resourceType, String resourceId) {
         return findBy(find, resourceType, resourceId);
app/utils/RouteUtil.java
--- app/utils/RouteUtil.java
+++ app/utils/RouteUtil.java
@@ -34,7 +34,7 @@
 import utils.TemplateHelper.DiffRenderer$;
 
 public class RouteUtil {
-    public static DiffRenderer$ diffRenderer = new DiffRenderer$();
+    public static final DiffRenderer$ diffRenderer = new DiffRenderer$();
 
     public static String getUrl(ResourceType resourceType, String resourceId) {
         Long longId = Long.valueOf(resourceId);
Add a comment
List