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

okumin 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 733d4f09011 HIVE-28891: Fix spotbugs issues in hive-shims with 
spotbugs-maven-plugin 4.8.6.6 (#5776)
733d4f09011 is described below

commit 733d4f09011f27bea17a5301537a9c6174f28874
Author: ramitg254 <[email protected]>
AuthorDate: Wed Apr 23 05:25:08 2025 +0530

    HIVE-28891: Fix spotbugs issues in hive-shims with spotbugs-maven-plugin 
4.8.6.6 (#5776)
---
 Jenkinsfile                                        |  1 +
 .../mapreduce/FileOutputCommitterContainer.java    |  2 +-
 .../hadoop/hive/io/TestHadoopFileStatus.java       |  2 +-
 .../ql/metadata/SessionHiveMetaStoreClient.java    |  2 +-
 .../apache/hadoop/hive/shims/Hadoop23Shims.java    | 47 ++++++++++++----------
 .../org/apache/hadoop/mapred/WebHCatJTShim23.java  | 27 ++++++++-----
 .../java/org/apache/hadoop/fs/ProxyFileSystem.java | 12 +-----
 .../org/apache/hadoop/fs/ProxyLocalFileSystem.java |  7 +---
 .../java/org/apache/hadoop/hive/io/HdfsUtils.java  | 10 ++++-
 .../hadoop/hive/shims/HadoopShimsSecure.java       | 44 ++++++++++----------
 .../org/apache/hadoop/hive/shims/ShimLoader.java   |  2 +
 .../hadoop/hive/thrift/TFilterTransport.java       |  2 +
 .../hive/thrift/TUGIContainingTransport.java       |  3 ++
 .../hive/thrift/client/TUGIAssumingTransport.java  |  2 +
 .../org/apache/hadoop/util/SuppressFBWarnings.java |  0
 15 files changed, 88 insertions(+), 75 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 88164aaf452..143fba57514 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -251,6 +251,7 @@ git merge origin/target
       }
       stage('Prechecks') {
         def spotbugsProjects = [
+            ":hive-shims",
             ":hive-storage-api",
             ":hive-service-rpc"
         ]
diff --git 
a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/FileOutputCommitterContainer.java
 
b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/FileOutputCommitterContainer.java
index e585b5b08c5..8fb821d3712 100644
--- 
a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/FileOutputCommitterContainer.java
+++ 
b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/FileOutputCommitterContainer.java
@@ -803,7 +803,7 @@ private void registerPartitions(JobContext context) throws 
IOException{
       StorerInfo storer = 
InternalUtil.extractStorerInfo(table.getTTable().getSd(),
           table.getParameters());
 
-      HdfsUtils.HadoopFileStatus status = new HdfsUtils.HadoopFileStatus(conf, 
fs, tblPath);
+      HdfsUtils.HadoopFileStatus status = 
HdfsUtils.HadoopFileStatus.createInstance(conf, fs, tblPath);
 
       List<Partition> partitionsToAdd = new ArrayList<Partition>();
       if (!dynamicPartitioningUsed) {
diff --git 
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/io/TestHadoopFileStatus.java
 
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/io/TestHadoopFileStatus.java
index 55877bea15c..20f8d1539dd 100644
--- 
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/io/TestHadoopFileStatus.java
+++ 
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/io/TestHadoopFileStatus.java
@@ -75,7 +75,7 @@ public void testHadoopFileStatusAclEntries() throws 
IOException {
     FileStatus mockFileStatus = Mockito.mock(FileStatus.class);
     Mockito.when(mockDfs.getAclStatus(mockPath)).thenReturn(aclStatus);
     Mockito.when(mockDfs.getFileStatus(mockPath)).thenReturn(mockFileStatus);
-    sourceStatus = new HadoopFileStatus(hiveConf, mockDfs, mockPath);
+    sourceStatus = HadoopFileStatus.createInstance(hiveConf, mockDfs, 
mockPath);
     Assert.assertNotNull(sourceStatus.getAclEntries());
     Assert.assertTrue(sourceStatus.getAclEntries().size() == 3);
     Iterables.removeIf(sourceStatus.getAclEntries(), new Predicate<AclEntry>() 
{
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java
index 5f5972da777..9f78e7fb33a 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java
@@ -796,7 +796,7 @@ private void 
truncateTempTable(org.apache.hadoop.hive.metastore.api.Table table)
       HadoopShims.HdfsEncryptionShim shim
               = ShimLoader.getHadoopShims().createHdfsEncryptionShim(fs, conf);
       if (!shim.isPathEncrypted(location)) {
-        HdfsUtils.HadoopFileStatus status = new 
HdfsUtils.HadoopFileStatus(conf, fs, location);
+        HdfsUtils.HadoopFileStatus status = 
HdfsUtils.HadoopFileStatus.createInstance(conf, fs, location);
         FileStatus targetStatus = fs.getFileStatus(location);
         String targetGroup = targetStatus == null ? null : 
targetStatus.getGroup();
         FileUtils.moveToTrash(fs, location, conf, isSkipTrash);
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 d4d6235d832..9d3672ec20c 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
@@ -288,7 +288,7 @@ public MiniMrShim getMiniMrCluster(Configuration conf, int 
numberOfTaskTrackers,
   /**
    * Shim for MiniMrCluster
    */
-  public class MiniMrShim implements HadoopShims.MiniMrShim {
+  public static class MiniMrShim implements HadoopShims.MiniMrShim {
 
     private final MiniMRCluster mr;
     private final Configuration conf;
@@ -300,7 +300,7 @@ public MiniMrShim() {
 
     public MiniMrShim(Configuration conf, int numberOfTaskTrackers,
                       String nameNode, int numDir) throws IOException {
-      this.conf = conf;
+      this.conf = new Configuration(conf);
 
       JobConf jConf = new JobConf(conf);
       jConf.set("yarn.scheduler.capacity.root.queues", "default");
@@ -349,12 +349,12 @@ public HadoopShims.MiniMrShim 
getLocalMiniTezCluster(Configuration conf, boolean
     return new MiniTezLocalShim(conf, usingLlap);
   }
 
-  public class MiniTezLocalShim extends Hadoop23Shims.MiniMrShim {
+  public static class MiniTezLocalShim extends Hadoop23Shims.MiniMrShim {
     private final Configuration conf;
     private final boolean isLlap;
 
     public MiniTezLocalShim(Configuration conf, boolean usingLlap) {
-      this.conf = conf;
+      this.conf = new Configuration(conf);
       this.isLlap = usingLlap;
       setupConfiguration(conf);
     }
@@ -401,7 +401,7 @@ public MiniMrShim getMiniTezCluster(Configuration conf, int 
numberOfTaskTrackers
   /**
    * Shim for MiniTezCluster
    */
-  public class MiniTezShim extends Hadoop23Shims.MiniMrShim {
+  public static class MiniTezShim extends Hadoop23Shims.MiniMrShim {
 
     private final MiniTezCluster mr;
     private final Configuration conf;
@@ -553,6 +553,7 @@ private static void setKeyProvider(DFSClient dfsClient, 
KeyProviderCryptoExtensi
   public static class MiniDFSShim implements HadoopShims.MiniDFSShim {
     private final MiniDFSCluster cluster;
 
+    @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "intended")
     public MiniDFSShim(MiniDFSCluster cluster) {
       this.cluster = cluster;
     }
@@ -670,7 +671,7 @@ public boolean isFileInHDFS(FileSystem fs, Path path) 
throws IOException {
   }
   @Override
   public WebHCatJTShim getWebHCatShim(Configuration conf, UserGroupInformation 
ugi) throws IOException {
-    return new WebHCatJTShim23(conf, ugi);//this has state, so can't be cached
+    return WebHCatJTShim23.createInstance(conf, ugi);//this has state, so 
can't be cached
   }
 
   private static final class HdfsFileStatusWithIdImpl implements 
HdfsFileStatusWithId {
@@ -761,9 +762,6 @@ public void hflush(FSDataOutputStream stream) throws 
IOException {
   }
 
   static class ProxyFileSystem23 extends ProxyFileSystem {
-    public ProxyFileSystem23(FileSystem fs) {
-      super(fs);
-    }
     public ProxyFileSystem23(FileSystem fs, URI uri) {
       super(fs, uri);
     }
@@ -774,12 +772,11 @@ public FutureDataInputStreamBuilder openFile(Path path) 
throws IOException, Unsu
     }
 
     @Override
-    public RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f)
-      throws FileNotFoundException, IOException {
+    public RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f) 
throws FileNotFoundException, IOException {
+      final RemoteIterator<LocatedFileStatus> remoteIterator =
+          
ProxyFileSystem23.super.listLocatedStatus(ProxyFileSystem23.super.swizzleParamPath(f));
       return new RemoteIterator<LocatedFileStatus>() {
-        private final RemoteIterator<LocatedFileStatus> stats =
-            ProxyFileSystem23.super.listLocatedStatus(
-                ProxyFileSystem23.super.swizzleParamPath(f));
+        private final RemoteIterator<LocatedFileStatus> stats = remoteIterator;
 
         @Override
         public boolean hasNext() throws IOException {
@@ -789,8 +786,7 @@ public boolean hasNext() throws IOException {
         @Override
         public LocatedFileStatus next() throws IOException {
           LocatedFileStatus result = stats.next();
-          return new LocatedFileStatus(
-              ProxyFileSystem23.super.swizzleFileStatus(result, false),
+          return new 
LocatedFileStatus(ProxyFileSystem23.super.swizzleFileStatus(result, false),
               result.getBlockLocations());
         }
       };
@@ -1005,6 +1001,7 @@ public static class StoragePolicyShim implements 
HadoopShims.StoragePolicyShim {
 
     private final DistributedFileSystem dfs;
 
+    @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "intended")
     public StoragePolicyShim(DistributedFileSystem fs) {
       this.dfs = fs;
     }
@@ -1334,10 +1331,17 @@ public static class HdfsEncryptionShim implements 
HadoopShims.HdfsEncryptionShim
 
     private final Configuration conf;
 
-    public HdfsEncryptionShim(URI uri, Configuration conf) throws IOException {
+    public static HdfsEncryptionShim createInstance(URI uri, Configuration 
conf) throws IOException {
+      HdfsAdmin hadmin = new HdfsAdmin(uri, conf);
+      KeyProvider keyP = hadmin.getKeyProvider();
+      HdfsEncryptionShim hdfsEncryptionShim = new HdfsEncryptionShim(conf);
+      hdfsEncryptionShim.hdfsAdmin = hadmin;
+      hdfsEncryptionShim.keyProvider = keyP;
+      return hdfsEncryptionShim;
+    }
+
+    private HdfsEncryptionShim(Configuration conf) {
       this.conf = conf;
-      this.hdfsAdmin = new HdfsAdmin(uri, conf);
-      this.keyProvider = this.hdfsAdmin.getKeyProvider();
     }
 
     @Override
@@ -1527,7 +1531,7 @@ public HadoopShims.HdfsEncryptionShim 
createHdfsEncryptionShim(FileSystem fs, Co
     if (isHdfsEncryptionSupported()) {
       URI uri = fs.getUri();
       if ("hdfs".equals(uri.getScheme()) && fs instanceof 
DistributedFileSystem) {
-        return new HdfsEncryptionShim(uri, conf);
+        return HdfsEncryptionShim.createInstance(uri, conf);
       }
     }
 
@@ -1598,7 +1602,6 @@ public UserGroupInformation cloneUgi(UserGroupInformation 
baseUgi) throws IOExce
     }
     try {
       Subject origSubject = (Subject) getSubjectMethod.invoke(baseUgi);
-      
       Subject subject = new Subject(false, origSubject.getPrincipals(),
           cloneCredentials(origSubject.getPublicCredentials()),
           cloneCredentials(origSubject.getPrivateCredentials()));
@@ -1616,7 +1619,7 @@ private static Set<Object> cloneCredentials(Set<Object> 
old) {
     }
     return set;
   }
-  
+
   private static Boolean hdfsErasureCodingSupport;
 
   /**
diff --git 
a/shims/0.23/src/main/java/org/apache/hadoop/mapred/WebHCatJTShim23.java 
b/shims/0.23/src/main/java/org/apache/hadoop/mapred/WebHCatJTShim23.java
index 5e40fdb7e5c..cfe47b8f3e9 100644
--- a/shims/0.23/src/main/java/org/apache/hadoop/mapred/WebHCatJTShim23.java
+++ b/shims/0.23/src/main/java/org/apache/hadoop/mapred/WebHCatJTShim23.java
@@ -51,20 +51,25 @@ public class WebHCatJTShim23 implements WebHCatJTShim {
   /**
    * Create a connection to the Job Tracker.
    */
-  public WebHCatJTShim23(final Configuration conf, final UserGroupInformation 
ugi)
-          throws IOException {
+  public static WebHCatJTShim createInstance(final Configuration conf, final 
UserGroupInformation ugi)
+      throws IOException {
+    JobClient jc;
     try {
-    this.conf = conf;
-    jc = ugi.doAs(new PrivilegedExceptionAction<JobClient>() {
-      public JobClient run() throws IOException, InterruptedException  {
-        //create this in doAs() so that it gets a security context based 
passed in 'ugi'
-        return new JobClient(conf);
-      }
-    });
-    }
-    catch(InterruptedException ex) {
+      jc = ugi.doAs(new PrivilegedExceptionAction<JobClient>() {
+        public JobClient run() throws IOException, InterruptedException {
+          //create this in doAs() so that it gets a security context based 
passed in 'ugi'
+          return new JobClient(conf);
+        }
+      });
+    } catch (InterruptedException ex) {
       throw new RuntimeException("Failed to create JobClient", ex);
     }
+    return new WebHCatJTShim23(conf, jc);
+  }
+
+  private WebHCatJTShim23(final Configuration conf, final JobClient jc) {
+    this.conf = new Configuration(conf);
+    this.jc = jc;
   }
 
   /**
diff --git 
a/shims/common/src/main/java/org/apache/hadoop/fs/ProxyFileSystem.java 
b/shims/common/src/main/java/org/apache/hadoop/fs/ProxyFileSystem.java
index d748590cdc0..88fdbbf4ab8 100644
--- a/shims/common/src/main/java/org/apache/hadoop/fs/ProxyFileSystem.java
+++ b/shims/common/src/main/java/org/apache/hadoop/fs/ProxyFileSystem.java
@@ -68,14 +68,6 @@ protected FileStatus swizzleFileStatus(FileStatus orig, 
boolean isParam) {
     return ret;
   }
 
-  public ProxyFileSystem() {
-    throw new RuntimeException ("Unsupported constructor");
-  }
-
-  public ProxyFileSystem(FileSystem fs) {
-    throw new RuntimeException ("Unsupported constructor");
-  }
-
   /**
    *
    * @param p
@@ -207,9 +199,9 @@ public FileStatus[] listStatus(Path f) throws IOException {
 
   @Override //ref. HADOOP-12502
   public RemoteIterator<FileStatus> listStatusIterator(Path f) throws 
IOException {
+    final RemoteIterator<FileStatus> remoteIterator = 
ProxyFileSystem.super.listStatusIterator(swizzleParamPath(f));
     return new RemoteIterator<FileStatus>() {
-      private final RemoteIterator<FileStatus> orig =
-              ProxyFileSystem.super.listStatusIterator(swizzleParamPath(f));
+      private final RemoteIterator<FileStatus> orig = remoteIterator;
 
       @Override
       public boolean hasNext() throws IOException {
diff --git 
a/shims/common/src/main/java/org/apache/hadoop/fs/ProxyLocalFileSystem.java 
b/shims/common/src/main/java/org/apache/hadoop/fs/ProxyLocalFileSystem.java
index 83bb39b4924..bcb060edd16 100644
--- a/shims/common/src/main/java/org/apache/hadoop/fs/ProxyLocalFileSystem.java
+++ b/shims/common/src/main/java/org/apache/hadoop/fs/ProxyLocalFileSystem.java
@@ -48,10 +48,6 @@ public ProxyLocalFileSystem() {
     localFs = new LocalFileSystem();
   }
 
-  public ProxyLocalFileSystem(FileSystem fs) {
-    throw new RuntimeException("Unsupported Constructor");
-  }
-
   @Override
   public void initialize(URI name, Configuration conf) throws IOException {
     // create a proxy for the local filesystem
@@ -120,7 +116,8 @@ public static class PFileChecksum extends FileChecksum {
     private String algorithmName;
 
     public PFileChecksum(MD5Hash md5, String algorithmName) {
-      this.md5 = md5;
+      this.md5 = new MD5Hash();
+      this.md5.set(md5);
       this.algorithmName = algorithmName;
     }
 
diff --git 
a/shims/common/src/main/java/org/apache/hadoop/hive/io/HdfsUtils.java 
b/shims/common/src/main/java/org/apache/hadoop/hive/io/HdfsUtils.java
index adf4d41e5e1..754bb26cd2c 100644
--- a/shims/common/src/main/java/org/apache/hadoop/hive/io/HdfsUtils.java
+++ b/shims/common/src/main/java/org/apache/hadoop/hive/io/HdfsUtils.java
@@ -39,6 +39,7 @@
 import org.apache.hadoop.fs.permission.FsAction;
 import org.apache.hadoop.fs.permission.FsPermission;
 
+import org.apache.hadoop.util.SuppressFBWarnings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -194,9 +195,8 @@ public static class HadoopFileStatus {
   private final FileStatus fileStatus;
   private final AclStatus aclStatus;
 
-  public HadoopFileStatus(Configuration conf, FileSystem fs, Path file) throws 
IOException {
+  private HadoopFileStatus(Configuration conf, FileSystem fs, FileStatus 
fileStatus, Path file) {
 
-    FileStatus fileStatus = fs.getFileStatus(file);
     AclStatus aclStatus = null;
     if (Objects.equal(conf.get("dfs.namenode.acls.enabled"), "true")) {
       //Attempt extended Acl operations only if its enabled, but don't fail 
the operation regardless.
@@ -211,6 +211,12 @@ public HadoopFileStatus(Configuration conf, FileSystem fs, 
Path file) throws IOE
     this.aclStatus = aclStatus;
   }
 
+  public static HadoopFileStatus createInstance(Configuration conf, FileSystem 
fs, Path file) throws IOException {
+    FileStatus fileStatus = fs.getFileStatus(file);
+    return new HadoopFileStatus(conf, fs, fileStatus, file);
+  }
+
+  @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "intended")
   public FileStatus getFileStatus() {
     return fileStatus;
   }
diff --git 
a/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShimsSecure.java
 
b/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShimsSecure.java
index 9567a3d735f..2a92304fc11 100644
--- 
a/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShimsSecure.java
+++ 
b/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShimsSecure.java
@@ -71,7 +71,7 @@ public InputSplitShim() {
     }
 
     public InputSplitShim(JobConf conf, Path[] paths, long[] startOffsets,
-      long[] lengths, String[] locations) throws IOException {
+      long[] lengths, String[] locations) {
       super(conf, paths, startOffsets, lengths, dedup(locations));
       _isShrinked = false;
     }
@@ -185,10 +185,25 @@ public float getProgress() throws IOException {
      * A generic RecordReader that can hand out different recordReaders
      * for each chunk in the CombineFileSplit.
      */
-    public CombineFileRecordReader(JobConf job, CombineFileSplit split,
-        Reporter reporter,
-        Class<RecordReader<K, V>> rrClass)
-        throws IOException {
+    public static <K, V> CombineFileRecordReader<K, V> createInstance(JobConf 
job, CombineFileSplit split,
+        Reporter reporter, Class<RecordReader<K, V>> rrClass) throws 
IOException {
+      CombineFileRecordReader<K, V> cfrr = new CombineFileRecordReader<>(job, 
split, reporter);
+      assert (split instanceof InputSplitShim);
+      if (((InputSplitShim) split).isShrinked()) {
+        cfrr.isShrinked = true;
+        cfrr.shrinkedLength = ((InputSplitShim) split).getShrinkedLength();
+      }
+      try {
+        cfrr.rrConstructor = 
rrClass.getDeclaredConstructor(constructorSignature);
+        cfrr.rrConstructor.setAccessible(true);
+      } catch (Exception e) {
+        throw new RuntimeException(rrClass.getName() + " does not have valid 
constructor", e);
+      }
+      cfrr.initNextRecordReader(null);
+      return cfrr;
+    }
+
+    private CombineFileRecordReader(JobConf job, CombineFileSplit split, 
Reporter reporter) {
       this.split = split;
       this.jc = job;
       this.reporter = reporter;
@@ -197,21 +212,6 @@ public CombineFileRecordReader(JobConf job, 
CombineFileSplit split,
       this.progress = 0;
 
       isShrinked = false;
-
-      assert (split instanceof InputSplitShim);
-      if (((InputSplitShim) split).isShrinked()) {
-        isShrinked = true;
-        shrinkedLength = ((InputSplitShim) split).getShrinkedLength();
-      }
-
-      try {
-        rrConstructor = rrClass.getDeclaredConstructor(constructorSignature);
-        rrConstructor.setAccessible(true);
-      } catch (Exception e) {
-        throw new RuntimeException(rrClass.getName() +
-            " does not have valid constructor", e);
-      }
-      initNextRecordReader(null);
     }
 
     /**
@@ -339,7 +339,7 @@ public RecordReader getRecordReader(JobConf job, 
CombineFileSplit split,
         Class<RecordReader<K, V>> rrClass)
         throws IOException {
       CombineFileSplit cfSplit = split;
-      return new CombineFileRecordReader(job, cfSplit, reporter, rrClass);
+      return CombineFileRecordReader.createInstance(job, cfSplit, reporter, 
rrClass);
     }
   }
 
@@ -377,7 +377,7 @@ abstract public 
org.apache.hadoop.mapreduce.TaskAttemptContext newTaskAttemptCon
   @Override
   abstract public FileSystem getNonCachedFileSystem(URI uri, Configuration 
conf) throws IOException;
 
-  private static String[] dedup(String[] locations) throws IOException {
+  private static String[] dedup(String[] locations) {
     Set<String> dedup = new HashSet<String>();
     Collections.addAll(dedup, locations);
     return dedup.toArray(new String[dedup.size()]);
diff --git 
a/shims/common/src/main/java/org/apache/hadoop/hive/shims/ShimLoader.java 
b/shims/common/src/main/java/org/apache/hadoop/hive/shims/ShimLoader.java
index 20b0f60581f..76744dbd21f 100644
--- a/shims/common/src/main/java/org/apache/hadoop/hive/shims/ShimLoader.java
+++ b/shims/common/src/main/java/org/apache/hadoop/hive/shims/ShimLoader.java
@@ -21,6 +21,7 @@
 import java.util.Map;
 
 import org.apache.hadoop.util.VersionInfo;
+import org.apache.hadoop.util.SuppressFBWarnings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -74,6 +75,7 @@ public abstract class ShimLoader {
    * Factory method to get an instance of HadoopShims based on the
    * version of Hadoop on the classpath.
    */
+  @SuppressFBWarnings(value = "MS_EXPOSE_REP", justification = "intended")
   public static HadoopShims getHadoopShims() {
     if (hadoopShims == null) {
       synchronized (ShimLoader.class) {
diff --git 
a/shims/common/src/main/java/org/apache/hadoop/hive/thrift/TFilterTransport.java
 
b/shims/common/src/main/java/org/apache/hadoop/hive/thrift/TFilterTransport.java
index 29b13fb83ae..85359814d49 100644
--- 
a/shims/common/src/main/java/org/apache/hadoop/hive/thrift/TFilterTransport.java
+++ 
b/shims/common/src/main/java/org/apache/hadoop/hive/thrift/TFilterTransport.java
@@ -18,6 +18,7 @@
 
 package org.apache.hadoop.hive.thrift;
 
+import org.apache.hadoop.util.SuppressFBWarnings;
 import org.apache.thrift.TConfiguration;
 import org.apache.thrift.transport.TTransport;
 import org.apache.thrift.transport.TTransportException;
@@ -29,6 +30,7 @@
  public class TFilterTransport extends TTransport {
    protected final TTransport wrapped;
 
+   @SuppressFBWarnings(value= "EI_EXPOSE_REP2", justification = "intended")
    public TFilterTransport(TTransport wrapped) {
      this.wrapped = wrapped;
    }
diff --git 
a/shims/common/src/main/java/org/apache/hadoop/hive/thrift/TUGIContainingTransport.java
 
b/shims/common/src/main/java/org/apache/hadoop/hive/thrift/TUGIContainingTransport.java
index 0936354580d..79659f09787 100644
--- 
a/shims/common/src/main/java/org/apache/hadoop/hive/thrift/TUGIContainingTransport.java
+++ 
b/shims/common/src/main/java/org/apache/hadoop/hive/thrift/TUGIContainingTransport.java
@@ -22,6 +22,7 @@
 import java.util.concurrent.ConcurrentMap;
 
 import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.util.SuppressFBWarnings;
 import org.apache.thrift.transport.TSocket;
 import org.apache.thrift.transport.TTransport;
 import org.apache.thrift.transport.TTransportFactory;
@@ -40,10 +41,12 @@ public TUGIContainingTransport(TTransport wrapped) {
     super(wrapped);
   }
 
+  @SuppressFBWarnings(value= "EI_EXPOSE_REP", justification = "intended")
   public UserGroupInformation getClientUGI(){
     return ugi;
   }
 
+  @SuppressFBWarnings(value= "EI_EXPOSE_REP2", justification = "intended")
   public void setClientUGI(UserGroupInformation ugi){
     this.ugi = ugi;
   }
diff --git 
a/shims/common/src/main/java/org/apache/hadoop/hive/thrift/client/TUGIAssumingTransport.java
 
b/shims/common/src/main/java/org/apache/hadoop/hive/thrift/client/TUGIAssumingTransport.java
index 0c9f81c37aa..5a9535cb814 100644
--- 
a/shims/common/src/main/java/org/apache/hadoop/hive/thrift/client/TUGIAssumingTransport.java
+++ 
b/shims/common/src/main/java/org/apache/hadoop/hive/thrift/client/TUGIAssumingTransport.java
@@ -23,6 +23,7 @@
 
 import org.apache.hadoop.hive.thrift.TFilterTransport;
 import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.util.SuppressFBWarnings;
 import org.apache.thrift.transport.TTransport;
 import org.apache.thrift.transport.TTransportException;
 
@@ -38,6 +39,7 @@
  public class TUGIAssumingTransport extends TFilterTransport {
    protected UserGroupInformation ugi;
 
+   @SuppressFBWarnings(value= "EI_EXPOSE_REP2", justification = "intended")
    public TUGIAssumingTransport(TTransport wrapped, UserGroupInformation ugi) {
      super(wrapped);
      this.ugi = ugi;
diff --git 
a/shims/0.23/src/main/java/org/apache/hadoop/util/SuppressFBWarnings.java 
b/shims/common/src/main/java/org/apache/hadoop/util/SuppressFBWarnings.java
similarity index 100%
rename from 
shims/0.23/src/main/java/org/apache/hadoop/util/SuppressFBWarnings.java
rename to 
shims/common/src/main/java/org/apache/hadoop/util/SuppressFBWarnings.java

Reply via email to