tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject [2/3] tajo git commit: TAJO-1351: Resolve findbug warnings on Tajo Common Module
Date Sun, 22 Feb 2015 07:29:58 GMT
TAJO-1351: Resolve findbug warnings on Tajo Common Module

Closes #383


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/7ca1e73b
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/7ca1e73b
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/7ca1e73b

Branch: refs/heads/index_support
Commit: 7ca1e73bce7102d7bf84557cd785182c0383e7ef
Parents: 08f3034
Author: Jihun Kang <jihun@apache.org>
Authored: Sun Feb 22 08:47:52 2015 +0900
Committer: Jihun Kang <jihun@apache.org>
Committed: Sun Feb 22 08:47:52 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |  1 +
 .../java/org/apache/tajo/OverridableConf.java   | 18 +++++++
 .../main/java/org/apache/tajo/SessionVars.java  |  4 +-
 .../java/org/apache/tajo/datum/TextDatum.java   |  2 +-
 .../tajo/rule/SelfDiagnosisRuleEngine.java      | 56 ++++++++++++++++++--
 .../tajo/rule/SelfDiagnosisRuleSession.java     | 15 +++---
 .../org/apache/tajo/storage/EmptyTuple.java     |  2 +-
 .../java/org/apache/tajo/util/ClassUtil.java    |  7 +++
 .../java/org/apache/tajo/util/KeyValueSet.java  |  2 +-
 .../java/org/apache/tajo/util/MurmurHash.java   |  4 +-
 .../java/org/apache/tajo/util/NumberUtil.java   | 13 +++--
 .../main/java/org/apache/tajo/util/TUtil.java   |  2 +-
 .../tajo/util/datetime/DateTimeConstants.java   |  2 +-
 .../tajo/util/datetime/DateTimeFormat.java      |  9 ++--
 .../apache/tajo/util/datetime/DateTimeUtil.java | 10 ++--
 .../org/apache/tajo/util/datetime/TimeMeta.java | 18 +++++++
 .../ConstraintViolationException.java           | 10 ++--
 .../apache/tajo/validation/RangeValidator.java  |  2 +-
 .../org/apache/tajo/validation/Validator.java   |  3 +-
 19 files changed, 140 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/7ca1e73b/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 3f375a4..96b55e3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -10,6 +10,7 @@ Release 0.11.0 - unreleased
 
   BUG FIXES
 
+    TAJO-1351: Resolve findbug warnings on Tajo Common Module. (jihun)
   
   TASKS
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/7ca1e73b/tajo-common/src/main/java/org/apache/tajo/OverridableConf.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/OverridableConf.java b/tajo-common/src/main/java/org/apache/tajo/OverridableConf.java
index b7a5da7..61bbb5a 100644
--- a/tajo-common/src/main/java/org/apache/tajo/OverridableConf.java
+++ b/tajo-common/src/main/java/org/apache/tajo/OverridableConf.java
@@ -18,7 +18,10 @@
 
 package org.apache.tajo;
 
+import java.util.Arrays;
+
 import com.google.common.base.Preconditions;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.tajo.conf.TajoConf;
@@ -247,4 +250,19 @@ public class OverridableConf extends KeyValueSet {
       return false;
     }
   }
+  
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = super.hashCode();
+    result = prime * result + ((conf == null) ? 0 : conf.hashCode());
+    result = prime * result + Arrays.hashCode(configTypes);
+    return result;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    return super.equals(obj);
+  }
+  
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/7ca1e73b/tajo-common/src/main/java/org/apache/tajo/SessionVars.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/SessionVars.java b/tajo-common/src/main/java/org/apache/tajo/SessionVars.java
index d87bbef..b3233ed 100644
--- a/tajo-common/src/main/java/org/apache/tajo/SessionVars.java
+++ b/tajo-common/src/main/java/org/apache/tajo/SessionVars.java
@@ -141,8 +141,8 @@ public enum SessionVars implements ConfigKey {
   TEST_MIN_TASK_NUM(ConfVars.$TEST_MIN_TASK_NUM, "(test only) min task num", TEST_VAR),
   ;
 
-  public static Map<String, SessionVars> SESSION_VARS = Maps.newHashMap();
-  public static Map<String, SessionVars> DEPRECATED_SESSION_VARS = Maps.newHashMap();
+  public static final Map<String, SessionVars> SESSION_VARS = Maps.newHashMap();
+  public static final Map<String, SessionVars> DEPRECATED_SESSION_VARS = Maps.newHashMap();
 
   static {
     for (SessionVars var : SessionVars.values()) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/7ca1e73b/tajo-common/src/main/java/org/apache/tajo/datum/TextDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/datum/TextDatum.java b/tajo-common/src/main/java/org/apache/tajo/datum/TextDatum.java
index 8d8e3f8..ba45e71 100644
--- a/tajo-common/src/main/java/org/apache/tajo/datum/TextDatum.java
+++ b/tajo-common/src/main/java/org/apache/tajo/datum/TextDatum.java
@@ -31,7 +31,7 @@ import java.nio.charset.Charset;
 import java.util.Comparator;
 
 public class TextDatum extends Datum {
-  public static Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
+  public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
 
   @Expose private final int size;
   /* encoded in UTF-8 */

http://git-wip-us.apache.org/repos/asf/tajo/blob/7ca1e73b/tajo-common/src/main/java/org/apache/tajo/rule/SelfDiagnosisRuleEngine.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/rule/SelfDiagnosisRuleEngine.java b/tajo-common/src/main/java/org/apache/tajo/rule/SelfDiagnosisRuleEngine.java
index df0225d..763c23a 100644
--- a/tajo-common/src/main/java/org/apache/tajo/rule/SelfDiagnosisRuleEngine.java
+++ b/tajo-common/src/main/java/org/apache/tajo/rule/SelfDiagnosisRuleEngine.java
@@ -29,7 +29,7 @@ import org.apache.tajo.util.TUtil;
 public class SelfDiagnosisRuleEngine {
 
   private final Map<String, Map<String, RuleWrapper>> wrapperMap;
-  private static SelfDiagnosisRuleEngine instance;
+  private static volatile SelfDiagnosisRuleEngine instance;
   
   private SelfDiagnosisRuleEngine() {
     wrapperMap = TUtil.newHashMap();
@@ -90,7 +90,7 @@ public class SelfDiagnosisRuleEngine {
     }
   }
   
-  class RuleWrapper implements Comparable<RuleWrapper> {
+  static class RuleWrapper implements Comparable<RuleWrapper> {
     private final String categoryName;
     private final String ruleName;
     private final int priority;
@@ -147,15 +147,61 @@ public class SelfDiagnosisRuleEngine {
 
     @Override
     public int compareTo(RuleWrapper o) {
-      if (getPriority() == -1 && o.getPriority() == -1) {
+      if (getPriority() < 0 && o.getPriority() < 0) {
         return 0;
-      } else if (getPriority() == -1) {
+      } else if (getPriority() < 0) {
         return 1;
-      } else if (o.getPriority() == -1) {
+      } else if (o.getPriority() < 0) {
         return -1;
       }
       return (int) Math.signum(getPriority() - o.getPriority());
     }
+
+    @Override
+    public int hashCode() {
+      final int prime = 31;
+      int result = 1;
+      result = prime * result + Arrays.hashCode(acceptedCallers);
+      result = prime * result + ((categoryName == null) ? 0 : categoryName.hashCode());
+      result = prime * result + (enabled ? 1231 : 1237);
+      result = prime * result + priority;
+      result = prime * result + ((rule == null) ? 0 : rule.hashCode());
+      result = prime * result + ((ruleName == null) ? 0 : ruleName.hashCode());
+      return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+      if (this == obj)
+        return true;
+      if (obj == null)
+        return false;
+      if (getClass() != obj.getClass())
+        return false;
+      RuleWrapper other = (RuleWrapper) obj;
+      if (!Arrays.equals(acceptedCallers, other.acceptedCallers))
+        return false;
+      if (categoryName == null) {
+        if (other.categoryName != null)
+          return false;
+      } else if (!categoryName.equals(other.categoryName))
+        return false;
+      if (enabled != other.enabled)
+        return false;
+      if (priority != other.priority)
+        return false;
+      if (rule == null) {
+        if (other.rule != null)
+          return false;
+      } else if (!rule.equals(other.rule))
+        return false;
+      if (ruleName == null) {
+        if (other.ruleName != null)
+          return false;
+      } else if (!ruleName.equals(other.ruleName))
+        return false;
+      return true;
+    }
     
   }
   

http://git-wip-us.apache.org/repos/asf/tajo/blob/7ca1e73b/tajo-common/src/main/java/org/apache/tajo/rule/SelfDiagnosisRuleSession.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/rule/SelfDiagnosisRuleSession.java
b/tajo-common/src/main/java/org/apache/tajo/rule/SelfDiagnosisRuleSession.java
index a062974..b7fdc56 100644
--- a/tajo-common/src/main/java/org/apache/tajo/rule/SelfDiagnosisRuleSession.java
+++ b/tajo-common/src/main/java/org/apache/tajo/rule/SelfDiagnosisRuleSession.java
@@ -22,6 +22,7 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Set;
 
 import org.apache.tajo.rule.EvaluationResult.EvaluationResultCode;
@@ -75,19 +76,19 @@ public class SelfDiagnosisRuleSession {
     wrapperMap = ruleEngine.getRules();
     Class<?> callerClazz = getCallerClassName();
     
-    for (String categoryName: wrapperMap.keySet()) {
+    for (Entry<String, Map<String, RuleWrapper>> entry: wrapperMap.entrySet())
{
+      String categoryName = entry.getKey();
       if (categoryPredicate.size() > 0 && !categoryPredicate.contains(categoryName))
{
         continue;
       }
       
-      Map<String, RuleWrapper> ruleMap = wrapperMap.get(categoryName);
-      for (String ruleName: ruleMap.keySet()) {
-        if (rulePredicate.size() > 0 && !rulePredicate.contains(ruleName)) {
+      Map<String, RuleWrapper> ruleMap = entry.getValue();
+      for (Entry<String, RuleWrapper> wrapperEntry: ruleMap.entrySet()) {
+        if (rulePredicate.size() > 0 && !rulePredicate.contains(wrapperEntry.getKey()))
{
           continue;
         }
         
-        RuleWrapper ruleWrapper = ruleMap.get(ruleName);
-        
+        RuleWrapper ruleWrapper = wrapperEntry.getValue();        
         if (callerClazz != null && ruleWrapper.getAcceptedCallers().length > 0

             && !hasCallerClazz(callerClazz, ruleWrapper.getAcceptedCallers())) {
           continue;
@@ -119,7 +120,7 @@ public class SelfDiagnosisRuleSession {
     return new RuleSessionSecurityManager().getCallerClassName();
   }
   
-  class RuleSessionSecurityManager extends SecurityManager {
+  static class RuleSessionSecurityManager extends SecurityManager {
     public Class<?> getCallerClassName() {
       Class<?>[] clazzArray = getClassContext();
       int clazzIdx = 2;

http://git-wip-us.apache.org/repos/asf/tajo/blob/7ca1e73b/tajo-common/src/main/java/org/apache/tajo/storage/EmptyTuple.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/storage/EmptyTuple.java b/tajo-common/src/main/java/org/apache/tajo/storage/EmptyTuple.java
index ec0095b..89e72ed 100644
--- a/tajo-common/src/main/java/org/apache/tajo/storage/EmptyTuple.java
+++ b/tajo-common/src/main/java/org/apache/tajo/storage/EmptyTuple.java
@@ -166,7 +166,7 @@ public class EmptyTuple implements Tuple, Cloneable {
 
   @Override
   public Tuple clone() throws CloneNotSupportedException {
-    return this.clone();
+    throw new CloneNotSupportedException();
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/tajo/blob/7ca1e73b/tajo-common/src/main/java/org/apache/tajo/util/ClassUtil.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/ClassUtil.java b/tajo-common/src/main/java/org/apache/tajo/util/ClassUtil.java
index 6a42b64..3865ee9 100644
--- a/tajo-common/src/main/java/org/apache/tajo/util/ClassUtil.java
+++ b/tajo-common/src/main/java/org/apache/tajo/util/ClassUtil.java
@@ -24,6 +24,7 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.tajo.annotation.Nullable;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.Set;
@@ -88,6 +89,12 @@ public abstract class ClassUtil {
             }
           }
         }
+        
+        try {
+          jar.close();
+        } catch (IOException e) {
+          LOG.warn("Closing " + file.getName() + " was failed.");
+        }
       } else if (file.getName().toLowerCase().endsWith(".class")) {
         String qualifiedClassName = createClassName(root, file);
         if (qualifiedClassName.indexOf(packageFilter) >= 0 && !isTestClass(qualifiedClassName))
{

http://git-wip-us.apache.org/repos/asf/tajo/blob/7ca1e73b/tajo-common/src/main/java/org/apache/tajo/util/KeyValueSet.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/KeyValueSet.java b/tajo-common/src/main/java/org/apache/tajo/util/KeyValueSet.java
index 18d4f59..6af0c9e 100644
--- a/tajo-common/src/main/java/org/apache/tajo/util/KeyValueSet.java
+++ b/tajo-common/src/main/java/org/apache/tajo/util/KeyValueSet.java
@@ -205,7 +205,7 @@ public class KeyValueSet implements ProtoObject<KeyValueSetProto>,
Cloneable, Gs
 
   }
 
-    @Override
+  @Override
 	public boolean equals(Object object) {
 		if(object instanceof KeyValueSet) {
 			KeyValueSet other = (KeyValueSet)object;

http://git-wip-us.apache.org/repos/asf/tajo/blob/7ca1e73b/tajo-common/src/main/java/org/apache/tajo/util/MurmurHash.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/MurmurHash.java b/tajo-common/src/main/java/org/apache/tajo/util/MurmurHash.java
index b60df9c..4db4cf7 100644
--- a/tajo-common/src/main/java/org/apache/tajo/util/MurmurHash.java
+++ b/tajo-common/src/main/java/org/apache/tajo/util/MurmurHash.java
@@ -201,8 +201,10 @@ public class MurmurHash {
       case 1:
         h ^= (long) (data[length & ~7] & 0xff);
         h *= m;
+        break;
+      default:
+        break;
     }
-    ;
 
     h ^= h >>> r;
     h *= m;

http://git-wip-us.apache.org/repos/asf/tajo/blob/7ca1e73b/tajo-common/src/main/java/org/apache/tajo/util/NumberUtil.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/NumberUtil.java b/tajo-common/src/main/java/org/apache/tajo/util/NumberUtil.java
index e3dd956..9e16cec 100644
--- a/tajo-common/src/main/java/org/apache/tajo/util/NumberUtil.java
+++ b/tajo-common/src/main/java/org/apache/tajo/util/NumberUtil.java
@@ -1036,11 +1036,14 @@ public class NumberUtil {
     }
 
     if (Number.class.isAssignableFrom(numberClazz)) {
-      try {
-        Constructor<?> constructor = numberClazz.getConstructor(String.class);
-        returnNumber = (Number) constructor.newInstance(value);
-      } catch (Exception ignored) {
-      }
+        try {
+          Constructor<?> constructor = numberClazz.getConstructor(String.class);
+          returnNumber = (Number) constructor.newInstance(value);
+        } catch (RuntimeException e) {
+          throw e;
+        } catch (Exception ignored) {
+        }
+      
     }
 
     return returnNumber;

http://git-wip-us.apache.org/repos/asf/tajo/blob/7ca1e73b/tajo-common/src/main/java/org/apache/tajo/util/TUtil.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/TUtil.java b/tajo-common/src/main/java/org/apache/tajo/util/TUtil.java
index a1de860..30ad04f 100644
--- a/tajo-common/src/main/java/org/apache/tajo/util/TUtil.java
+++ b/tajo-common/src/main/java/org/apache/tajo/util/TUtil.java
@@ -50,7 +50,7 @@ public class TUtil {
    * @return true if they are equal or all null
    */
   public static boolean checkEquals(Collection<?> s1, Collection<?> s2) {
-    if (s1 == null ^ s2 == null) {
+    if (s1 == null || s2 == null) {
       return false;
     } else if (s1 == null && s2 == null) {
       return true;

http://git-wip-us.apache.org/repos/asf/tajo/blob/7ca1e73b/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeConstants.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeConstants.java
b/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeConstants.java
index e5a51ef..102bf95 100644
--- a/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeConstants.java
+++ b/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeConstants.java
@@ -610,7 +610,7 @@ public class DateTimeConstants {
       return valueType;
     }
   }
-  public static Map<String, DateToken> dateTokenMap = new HashMap<String, DateToken>();
+  public static final Map<String, DateToken> dateTokenMap = new HashMap<String,
DateToken>();
 
   static {
     for (Object[] eachToken: datetktbl) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/7ca1e73b/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeFormat.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeFormat.java b/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeFormat.java
index 8ce08b2..c3aa71e 100644
--- a/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeFormat.java
+++ b/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeFormat.java
@@ -482,7 +482,7 @@ public class DateTimeFormat {
       keyword.is_digit = ((Boolean)eachKeywordValue[3]).booleanValue();
       keyword.date_mode = (FromCharDateMode)eachKeywordValue[4];
 
-      Character c = new Character(keyword.name.charAt(0));
+      Character c = Character.valueOf(keyword.name.charAt(0));
       Integer pos = DCH_index.get(c);
       if (pos == null) {
         DCH_index.put(c, index);
@@ -1246,6 +1246,8 @@ public class DateTimeFormat {
           out.j = value.get();
           charIdx += SKIP_THth(node.suffix);
           break;
+        default:
+          break;
       }
     }
   }
@@ -2118,6 +2120,8 @@ public class DateTimeFormat {
             str_numth(out, out, S_TH_TYPE(node.suffix));
           }
           break;
+        default:
+          break;
       }
     }
   }
@@ -2141,8 +2145,7 @@ public class DateTimeFormat {
      * All "teens" (<x>1[0-9]) get 'TH/th', while <x>[02-9][123] still get
      * 'ST/st', 'ND/nd', 'RD/rd', respectively
      */
-    char seclast;
-    if ((len > 1) && ((seclast = num.charAt(len - 2)) == '1')) {
+    if ((len > 1) && (num.charAt(len - 2) == '1')) {
       last = 0;
     }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/7ca1e73b/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeUtil.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeUtil.java b/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeUtil.java
index 7acb544..f1c7970 100644
--- a/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeUtil.java
+++ b/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeUtil.java
@@ -623,7 +623,7 @@ public class DateTimeUtil {
       }
     } else if (cp.charAt(0) == '.') {
 		  /* always assume mm:ss.sss is MINUTE TO SECOND */
-      ParseFractionalSecond(cp, fsec);
+      parseFractionalSecond(cp, fsec);
       tm.secs = tm.minutes;
       tm.minutes = tm.hours;
       tm.hours = 0;
@@ -633,7 +633,7 @@ public class DateTimeUtil {
       if (cp.length() == 0){
         fsec.set(0);
       } else if (cp.charAt(0) == '.') {
-        ParseFractionalSecond(cp, fsec);
+        parseFractionalSecond(cp, fsec);
       } else{
         throw new IllegalArgumentException("BAD Format: " + str);
       }
@@ -889,7 +889,7 @@ public class DateTimeUtil {
    * @param cp
    * @param fsec
    */
-  public static void ParseFractionalSecond(StringBuilder cp, AtomicLong fsec) {
+  public static void parseFractionalSecond(StringBuilder cp, AtomicLong fsec) {
 	  /* Caller should always pass the start of the fraction part */
     double frac = strtod(cp.toString(), 1, cp);
     fsec.set(Math.round(frac * 1000000));
@@ -985,7 +985,7 @@ public class DateTimeUtil {
             fsec, is2digits);
         return;
       }
-      ParseFractionalSecond(cp, fsec);
+      parseFractionalSecond(cp, fsec);
     }
 
   	// Special case for day of year
@@ -1393,7 +1393,7 @@ public class DateTimeUtil {
                 tm.secs = val;
                 tmask.set(DateTimeConstants.DTK_M(TokenField.SECOND));
                 if (sb.charAt(0) == '.') {
-                  ParseFractionalSecond(sb, fsec);
+                  parseFractionalSecond(sb, fsec);
                   tmask.set(DateTimeConstants.DTK_ALL_SECS_M);
                 }
                 break;

http://git-wip-us.apache.org/repos/asf/tajo/blob/7ca1e73b/tajo-common/src/main/java/org/apache/tajo/util/datetime/TimeMeta.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/datetime/TimeMeta.java b/tajo-common/src/main/java/org/apache/tajo/util/datetime/TimeMeta.java
index 19bd814..30d4ce1 100644
--- a/tajo-common/src/main/java/org/apache/tajo/util/datetime/TimeMeta.java
+++ b/tajo-common/src/main/java/org/apache/tajo/util/datetime/TimeMeta.java
@@ -39,6 +39,24 @@ public class TimeMeta implements Comparable<TimeMeta> {
   }
 
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + dayOfMonth;
+    result = prime * result + dayOfWeek;
+    result = prime * result + dayOfYear;
+    result = prime * result + fsecs;
+    result = prime * result + hours;
+    result = prime * result + (isDST ? 1231 : 1237);
+    result = prime * result + minutes;
+    result = prime * result + monthOfYear;
+    result = prime * result + secs;
+    result = prime * result + timeZone;
+    result = prime * result + years;
+    return result;
+  }
+
+  @Override
   public boolean equals(Object o) {
     if (!(o instanceof TimeMeta)) {
       return false;

http://git-wip-us.apache.org/repos/asf/tajo/blob/7ca1e73b/tajo-common/src/main/java/org/apache/tajo/validation/ConstraintViolationException.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/validation/ConstraintViolationException.java
b/tajo-common/src/main/java/org/apache/tajo/validation/ConstraintViolationException.java
index 8fda81e..73aca67 100644
--- a/tajo-common/src/main/java/org/apache/tajo/validation/ConstraintViolationException.java
+++ b/tajo-common/src/main/java/org/apache/tajo/validation/ConstraintViolationException.java
@@ -37,17 +37,17 @@ public class ConstraintViolationException extends RuntimeException {
   @Override
   public String getMessage() {
     if (violations != null) {
-      String errorMessage = "ConstraintViolationException [";
+      StringBuilder stringBuilder = new StringBuilder("ConstraintViolationException [");
       int elemIdx = 1;
       int elemCount = violations.size();
       for (ConstraintViolation violation: violations) {
-        errorMessage += violation.getMessage();
+        stringBuilder.append(violation.getMessage());
         if (elemIdx++ > elemCount) {
-          errorMessage += ",";
+          stringBuilder.append(',');
         }
       }
-      errorMessage += "]";
-      return errorMessage;
+      stringBuilder.append(']');
+      return stringBuilder.toString();
     } else {
       return super.getMessage();
     }

http://git-wip-us.apache.org/repos/asf/tajo/blob/7ca1e73b/tajo-common/src/main/java/org/apache/tajo/validation/RangeValidator.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/validation/RangeValidator.java b/tajo-common/src/main/java/org/apache/tajo/validation/RangeValidator.java
index ae6fd76..8ff1af6 100644
--- a/tajo-common/src/main/java/org/apache/tajo/validation/RangeValidator.java
+++ b/tajo-common/src/main/java/org/apache/tajo/validation/RangeValidator.java
@@ -42,7 +42,7 @@ public class RangeValidator extends AbstractValidator {
 
   @Override
   protected <T> boolean validateInternal(T object) {
-    return this.minValidator.validateInternal(object) & this.maxValidator.validateInternal(object);
+    return this.minValidator.validateInternal(object) && this.maxValidator.validateInternal(object);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/tajo/blob/7ca1e73b/tajo-common/src/main/java/org/apache/tajo/validation/Validator.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/validation/Validator.java b/tajo-common/src/main/java/org/apache/tajo/validation/Validator.java
index 8f16fda..65a5582 100644
--- a/tajo-common/src/main/java/org/apache/tajo/validation/Validator.java
+++ b/tajo-common/src/main/java/org/apache/tajo/validation/Validator.java
@@ -18,9 +18,10 @@
 
 package org.apache.tajo.validation;
 
+import java.io.Serializable;
 import java.util.Collection;
 
-public interface Validator {
+public interface Validator extends Serializable {
 
   public <T> Collection<ConstraintViolation> validate(T object);
   


Mime
View raw message