]> source.dussan.org Git - sonarqube.git/commitdiff
fix quality flaws
authorStephane Gamard <stephane.gamard@searchbox.com>
Tue, 1 Jul 2014 15:13:10 +0000 (17:13 +0200)
committerStephane Gamard <stephane.gamard@searchbox.com>
Tue, 1 Jul 2014 15:52:22 +0000 (17:52 +0200)
sonar-server/src/main/java/org/sonar/server/activity/index/ActivityNormalizer.java

index 96c2e6e7979867bad249e30a36e3905491d4bf36..06c53600382c15245cbfa7fc382aaac221824a91 100644 (file)
@@ -57,16 +57,16 @@ public class ActivityNormalizer extends BaseNormalizer<ActivityDto, String> {
     public static final IndexField DETAILS = addSearchable(IndexField.Type.OBJECT, "details");
     public static final IndexField MESSAGE = addSearchable(IndexField.Type.STRING, "message");
 
-    public static Set<IndexField> ALL_FIELDS = getAllFields();
+    public static final Set<IndexField> ALL_FIELDS = getAllFields();
 
-    private static Set<IndexField> getAllFields() {
+    private static final Set<IndexField> getAllFields() {
       Set<IndexField> fields = new HashSet<IndexField>();
       for (Field classField : LogFields.class.getDeclaredFields()) {
         if (Modifier.isFinal(classField.getModifiers()) && Modifier.isStatic(classField.getModifiers())) {
           try {
             fields.add(IndexField.class.cast(classField.get(null)));
           } catch (IllegalAccessException e) {
-            e.printStackTrace();
+            throw new IllegalStateException("Could not access Field '" + classField.getName() + "'");
           }
         }
       }
@@ -83,7 +83,7 @@ public class ActivityNormalizer extends BaseNormalizer<ActivityDto, String> {
     DbSession dbSession = db.openSession(false);
     List<UpdateRequest> requests = new ArrayList<UpdateRequest>();
     try {
-      requests.addAll(normalize(db.activityDao().getNullableByKey(dbSession, activityKey)));
+      requests.addAll(normalize(db.activityDao().getByKey(dbSession, activityKey)));
     } finally {
       dbSession.close();
     }