This is an automated email from the ASF dual-hosted git repository.

kgyrtkirk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new ec6c1bf  HIVE-23686: Fix spotbugs issues in hive-shims (#1104)
ec6c1bf is described below

commit ec6c1bff84527c5f70d23b954d1f30d8ffa7a1d2
Author: Mustafa İman <mustafai...@gmail.com>
AuthorDate: Sat Jun 13 04:01:19 2020 -0700

    HIVE-23686: Fix spotbugs issues in hive-shims (#1104)
---
 Jenkinsfile                                               |  3 +--
 pom.xml                                                   |  9 ++++++++-
 .../java/org/apache/hadoop/hive/shims/Hadoop23Shims.java  | 15 +++++++++------
 3 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 1d82b11..fceddb1 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -170,8 +170,7 @@ jobWrappers {
       }
       stage('Prechecks') {
         def spotbugsProjects = [
-            ":hive-shims-aggregator",
-            ":hive-shims-common",
+            ":hive-shims",
             ":hive-storage-api"
         ]
         buildHive("-Pspotbugs -pl " + spotbugsProjects.join(",") + " -am 
compile com.github.spotbugs:spotbugs-maven-plugin:4.0.0:check")
diff --git a/pom.xml b/pom.xml
index 3536533..eaadad0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -216,6 +216,7 @@
     <json-path.version>2.4.0</json-path.version>
     <janino.version>3.0.11</janino.version>
     <datasketches.version>1.0.0-incubating</datasketches.version>
+    <spotbugs.version>4.0.3</spotbugs.version>
   </properties>
 
   <repositories>
@@ -1107,6 +1108,12 @@
         </exclusion>
       </exclusions>
     </dependency>
+    <dependency>
+      <groupId>com.github.spotbugs</groupId>
+      <artifactId>spotbugs-annotations</artifactId>
+      <version>${spotbugs.version}</version>
+      <scope>provided</scope>
+    </dependency>
   </dependencies>
 
   <build>
@@ -1617,7 +1624,7 @@
               <dependency>
                 <groupId>com.github.spotbugs</groupId>
                 <artifactId>spotbugs</artifactId>
-                <version>4.0.3</version>
+                <version>${spotbugs.version}</version>
               </dependency>
             </dependencies>
             <configuration>
diff --git 
a/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java 
b/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java
index 2eafef0..acdc5f6 100644
--- a/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java
+++ b/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java
@@ -39,6 +39,7 @@ import java.util.Set;
 import java.util.TreeMap;
 import javax.security.auth.Subject;
 
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.crypto.CipherSuite;
@@ -618,7 +619,7 @@ public class Hadoop23Shims extends HadoopShimsSecure {
    * MiniDFSShim.
    *
    */
-  public class MiniDFSShim implements HadoopShims.MiniDFSShim {
+  public static class MiniDFSShim implements HadoopShims.MiniDFSShim {
     private final MiniDFSCluster cluster;
 
     public MiniDFSShim(MiniDFSCluster cluster) {
@@ -643,7 +644,8 @@ public class Hadoop23Shims extends HadoopShimsSecure {
     }
     return hcatShimInstance;
   }
-  private final class HCatHadoopShims23 implements HCatHadoopShims {
+
+  private static final class HCatHadoopShims23 implements HCatHadoopShims {
     @Override
     public TaskID createTaskID() {
       return new TaskID("", 0, TaskType.MAP, 0);
@@ -827,7 +829,7 @@ public class Hadoop23Shims extends HadoopShimsSecure {
     stream.hflush();
   }
 
-  class ProxyFileSystem23 extends ProxyFileSystem {
+  static class ProxyFileSystem23 extends ProxyFileSystem {
     public ProxyFileSystem23(FileSystem fs) {
       super(fs);
     }
@@ -1029,7 +1031,7 @@ public class Hadoop23Shims extends HadoopShimsSecure {
   /**
    * Shim for KerberosName
    */
-  public class KerberosNameShim implements HadoopShimsSecure.KerberosNameShim {
+  public static class KerberosNameShim implements 
HadoopShimsSecure.KerberosNameShim {
 
     private final KerberosName kerberosName;
 
@@ -1187,6 +1189,7 @@ public class Hadoop23Shims extends HadoopShimsSecure {
 
   private static Boolean hdfsEncryptionSupport;
 
+  @SuppressFBWarnings(value = "LI_LAZY_INIT_STATIC", justification = "All 
threads set the same value despite data race")
   public static boolean isHdfsEncryptionSupported() {
     if (hdfsEncryptionSupport == null) {
       Method m = null;
@@ -1204,8 +1207,8 @@ public class Hadoop23Shims extends HadoopShimsSecure {
     return hdfsEncryptionSupport;
   }
 
-  public class HdfsEncryptionShim implements HadoopShims.HdfsEncryptionShim {
-    private final String HDFS_SECURITY_DEFAULT_CIPHER = "AES/CTR/NoPadding";
+  public static class HdfsEncryptionShim implements 
HadoopShims.HdfsEncryptionShim {
+    private static final String HDFS_SECURITY_DEFAULT_CIPHER = 
"AES/CTR/NoPadding";
 
     /**
      * Gets information about HDFS encryption zones

Reply via email to