sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject sqoop git commit: SQOOP-2532: Sqoop2: Findbugs: Fix SIC_INNER_SHOULD_BE_STATIC_ANON problem in ConfigValidationRunner
Date Thu, 27 Aug 2015 19:35:21 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 e0fbca7fa -> 583c42e60


SQOOP-2532: Sqoop2: Findbugs: Fix SIC_INNER_SHOULD_BE_STATIC_ANON problem in ConfigValidationRunner

(Colin Ma via Jarek Jarcec Cecho)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/583c42e6
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/583c42e6
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/583c42e6

Branch: refs/heads/sqoop2
Commit: 583c42e60217d91727dc87fd1ea409269846b754
Parents: e0fbca7
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Thu Aug 27 12:34:38 2015 -0700
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Thu Aug 27 12:34:38 2015 -0700

----------------------------------------------------------------------
 .../java/org/apache/sqoop/json/VersionBean.java     |  1 +
 .../sqoop/validation/ConfigValidationRunner.java    | 16 +++++++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/583c42e6/common/src/main/java/org/apache/sqoop/json/VersionBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/VersionBean.java b/common/src/main/java/org/apache/sqoop/json/VersionBean.java
index 2d5327a..5e33b28 100644
--- a/common/src/main/java/org/apache/sqoop/json/VersionBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/VersionBean.java
@@ -25,6 +25,7 @@ import org.json.simple.JSONObject;
 @InterfaceAudience.Private
 @InterfaceStability.Unstable
 public class VersionBean implements JsonBean, java.io.Serializable {
+  private static final long serialVersionUID = 1L;
 
   public static final String BUILD_VERSION = "build-version";
   public static final String SOURCE_REVISION = "source-revision";

http://git-wip-us.apache.org/repos/asf/sqoop/blob/583c42e6/common/src/main/java/org/apache/sqoop/validation/ConfigValidationRunner.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/validation/ConfigValidationRunner.java
b/common/src/main/java/org/apache/sqoop/validation/ConfigValidationRunner.java
index 26c8a7f..3e01397 100644
--- a/common/src/main/java/org/apache/sqoop/validation/ConfigValidationRunner.java
+++ b/common/src/main/java/org/apache/sqoop/validation/ConfigValidationRunner.java
@@ -30,6 +30,8 @@ import org.apache.sqoop.utils.ClassUtils;
 import org.apache.sqoop.validation.validators.AbstractValidator;
 
 import java.lang.reflect.Field;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -75,7 +77,7 @@ public class ConfigValidationRunner {
 
     // Iterate over all declared config and call their validators
     for (Field field : config.getClass().getDeclaredFields()) {
-      field.setAccessible(true);
+      AccessController.doPrivileged(new CVRPrivilegeAction(field));
 
       Config configAnnotation = ConfigUtils.getConfigAnnotation(field, false);
       if(configAnnotation == null) {
@@ -177,5 +179,17 @@ public class ConfigValidationRunner {
     return instance;
   }
 
+  private static class CVRPrivilegeAction implements PrivilegedAction {
+    Field field;
+
+    CVRPrivilegeAction(Field field) {
+      this.field = field;
+    }
 
+    @Override
+    public Object run() {
+      field.setAccessible(true);
+      return null;
+    }
+  }
 }


Mime
View raw message