Skip to content

Commit fd1b8b0

Browse files
committed
HIVE-28892: Fix spotbugs issues in hive-standalone-metastore-common with spotbugs-maven-plugin 4.8.6.6
1 parent 98c0a1a commit fd1b8b0

File tree

81 files changed

+520
-246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+520
-246
lines changed

Jenkinsfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@ git merge origin/target
254254
def spotbugsProjects = [
255255
":hive-shims",
256256
":hive-storage-api",
257-
":hive-service-rpc"
257+
":hive-service-rpc",
258+
":hive-standalone-metastore-common"
258259
]
259260
sh '''#!/bin/bash
260261
set -e

hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/HCatDriver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ private int setFSPermsNGrp(SessionState ss, HiveConf conf) {
124124
} else {
125125
try {
126126
Hive db = Hive.get();
127-
Path dbPath = new Warehouse(conf).getDatabasePath(db.getDatabase(dbName));
127+
Path dbPath = Warehouse.create(conf).getDatabasePath(db.getDatabase(dbName));
128128
FileSystem fs = dbPath.getFileSystem(conf);
129129
if (perms != null) {
130130
fs.setPermission(dbPath, perms);

hcatalog/core/src/test/java/org/apache/hive/hcatalog/cli/TestPermsGrp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public void setUp() throws Exception {
110110
MetastoreConf.getVar(hcatConf, MetastoreConf.ConfVars.CONNECT_URL_KEY));
111111
hcatConf.set(HiveConf.ConfVars.METASTORE_URIS.varname,
112112
MetastoreConf.getVar(hcatConf, MetastoreConf.ConfVars.THRIFT_URIS));
113-
clientWH = new Warehouse(hcatConf);
113+
clientWH = Warehouse.create(hcatConf);
114114
msc = new HiveMetaStoreClient(hcatConf);
115115
}
116116

itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/MetastoreHousekeepingLeaderTestBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void internalSetup(final String leaderHostName, boolean configuredLeader) throws
6565

6666
addHouseKeepingThreadConfigs();
6767

68-
warehouse = new Warehouse(conf);
68+
warehouse = Warehouse.create(conf);
6969

7070
if (isServerStarted) {
7171
Assert.assertNotNull("Unable to connect to the MetaStore server", client);

itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetastoreTransformer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,7 @@ public void testTransformerDatabase() throws Exception {
14501450
db.getLocationUri().contains(conf.get(MetastoreConf.ConfVars.WAREHOUSE_EXTERNAL.getVarname())));
14511451
resetHMSClient();
14521452

1453-
Warehouse wh = new Warehouse(conf);
1453+
Warehouse wh = Warehouse.create(conf);
14541454
String mgdPath = wh.getDefaultDatabasePath(dbWithLocation, false).toString();
14551455
new DatabaseBuilder()
14561456
.setName(dbWithLocation)
@@ -1830,7 +1830,7 @@ private Table createTableWithCapabilities(Map<String, Object> props) throws Exce
18301830
if (cat == null) {
18311831
cat = new Catalog();
18321832
cat.setName(catalog.toLowerCase());
1833-
Warehouse wh = new Warehouse(conf);
1833+
Warehouse wh = Warehouse.create(conf);
18341834
cat.setLocationUri(wh.getWhRootExternal().toString() + File.separator + catalog);
18351835
cat.setDescription("Non-hive catalog");
18361836
client.createCatalog(cat);

itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetaStoreAuthorization.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public void testIsWritable() throws Exception {
5858
try {
5959
fs.mkdirs(top);
6060

61-
Warehouse wh = new Warehouse(conf);
61+
Warehouse wh = Warehouse.create(conf);
6262
FsPermission writePerm = FsPermission.createImmutable((short)0777);
6363
FsPermission noWritePerm = FsPermission.createImmutable((short)0555);
6464

itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetaStoreMultipleEncryptionZones.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public static void setUp() throws Exception {
108108
}
109109

110110
private static void initReplChangeManager() throws Exception{
111-
warehouse = new Warehouse(hiveConf);
111+
warehouse = Warehouse.create(hiveConf);
112112
warehouseFs = warehouse.getWhRoot().getFileSystem(hiveConf);
113113
fs = new Path(cmroot).getFileSystem(hiveConf);
114114
fs.mkdirs(warehouse.getWhRoot());
@@ -1261,7 +1261,7 @@ public void testClearerEncrypted() throws Exception {
12611261

12621262
String cmrootCmClearer = "hdfs://" + miniDFSCluster.getNameNode().getHostAndPort() + "/cmrootClearer";
12631263
hiveConfCmClearer.set(HiveConf.ConfVars.REPL_CM_DIR.varname, cmrootCmClearer);
1264-
Warehouse warehouseCmClearer = new Warehouse(hiveConfCmClearer);
1264+
Warehouse warehouseCmClearer = Warehouse.create(hiveConfCmClearer);
12651265
FileSystem cmfs = new Path(cmrootCmClearer).getFileSystem(hiveConfCmClearer);
12661266
cmfs.mkdirs(warehouseCmClearer.getWhRoot());
12671267

@@ -1367,7 +1367,7 @@ public void testCmRootAclPermissions() throws Exception {
13671367

13681368
String cmRootAclPermissions = "hdfs://" + miniDFSCluster.getNameNode().getHostAndPort() + "/cmRootAclPermissions";
13691369
hiveConfAclPermissions.set(HiveConf.ConfVars.REPL_CM_DIR.varname, cmRootAclPermissions);
1370-
Warehouse warehouseCmPermissions = new Warehouse(hiveConfAclPermissions);
1370+
Warehouse warehouseCmPermissions = Warehouse.create(hiveConfAclPermissions);
13711371
FileSystem cmfs = new Path(cmRootAclPermissions).getFileSystem(hiveConfAclPermissions);
13721372
cmfs.mkdirs(warehouseCmPermissions.getWhRoot());
13731373

@@ -1516,7 +1516,7 @@ public void testCmrootEncrypted() throws Exception {
15161516
//Create cm in encrypted zone
15171517
EncryptionZoneUtils.createEncryptionZone(new Path(cmrootdirEncrypted), "test_key_db", conf);
15181518
ReplChangeManager.resetReplChangeManagerInstance();
1519-
Warehouse warehouseEncrypted = new Warehouse(encryptedHiveConf);
1519+
Warehouse warehouseEncrypted = Warehouse.create(encryptedHiveConf);
15201520
FileSystem warehouseFsEncrypted = warehouseEncrypted.getWhRoot().getFileSystem(encryptedHiveConf);
15211521
FileSystem fsCmEncrypted = new Path(cmrootdirEncrypted).getFileSystem(encryptedHiveConf);
15221522
fsCmEncrypted.mkdirs(warehouseEncrypted.getWhRoot());
@@ -1583,7 +1583,7 @@ public void testCmrootFallbackEncrypted() throws Exception {
15831583
ReplChangeManager.resetReplChangeManagerInstance();
15841584
boolean exceptionThrown = false;
15851585
try {
1586-
new Warehouse(encryptedHiveConf);
1586+
Warehouse.create(encryptedHiveConf);
15871587
} catch (MetaException e) {
15881588
exceptionThrown = true;
15891589
assertTrue(e.getMessage().contains("should not be encrypted"));
@@ -1620,7 +1620,7 @@ public void testCmrootFallbackRelative() throws Exception {
16201620
ReplChangeManager.resetReplChangeManagerInstance();
16211621
boolean exceptionThrown = false;
16221622
try {
1623-
new Warehouse(encryptedHiveConf);
1623+
Warehouse.create(encryptedHiveConf);
16241624
} catch (MetaException e) {
16251625
exceptionThrown = true;
16261626
assertTrue(e.getMessage().contains("should be absolute"));

itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestReplChangeManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private static void internalSetUpProvidePerm() throws Exception {
104104
permCmroot = "hdfs://" + permDdfs.getNameNode().getHostAndPort() + "/cmroot";
105105
permhiveConf.set(HiveConf.ConfVars.REPL_CM_DIR.varname, permCmroot);
106106
permhiveConf.setInt(CommonConfigurationKeysPublic.FS_TRASH_INTERVAL_KEY, 60);
107-
permWarehouse = new Warehouse(permhiveConf);
107+
permWarehouse = Warehouse.create(permhiveConf);
108108
}
109109

110110
private static void internalSetUp() throws Exception {
@@ -116,7 +116,7 @@ private static void internalSetUp() throws Exception {
116116
cmroot = "hdfs://" + m_dfs.getNameNode().getHostAndPort() + "/cmroot";
117117
hiveConf.set(HiveConf.ConfVars.REPL_CM_DIR.varname, cmroot);
118118
hiveConf.setInt(CommonConfigurationKeysPublic.FS_TRASH_INTERVAL_KEY, 60);
119-
warehouse = new Warehouse(hiveConf);
119+
warehouse = Warehouse.create(hiveConf);
120120
fs = new Path(cmroot).getFileSystem(hiveConf);
121121
}
122122

itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestTenantBasedStorageHierarchy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ private Table createTableWithCapabilities(Map<String, Object> props) throws Exce
478478
if (cat == null) {
479479
cat = new Catalog();
480480
cat.setName(catalog.toLowerCase());
481-
Warehouse wh = new Warehouse(conf);
481+
Warehouse wh = Warehouse.create(conf);
482482
cat.setLocationUri(wh.getWhRootExternal().toString() + File.separator + catalog);
483483
cat.setDescription("Non-hive catalog");
484484
client.createCatalog(cat);

itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/cache/TestCachedStoreUpdateUsingEvents.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void setUp() throws Exception {
9393
CachedStore.stopCacheUpdateService(1);
9494

9595
// Create the 'hive' catalog with new warehouse directory
96-
HMSHandler.createDefaultCatalog(rawStore, new Warehouse(conf));
96+
HMSHandler.createDefaultCatalog(rawStore, Warehouse.create(conf));
9797
}
9898

9999
private Database createTestDb(String dbName, String dbOwner) throws IOException {

itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosExternalTables.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ public void differentCatalogIncrementalReplication() throws Throwable {
13551355
//Create the catalog
13561356
Catalog catalog = new Catalog();
13571357
catalog.setName("spark");
1358-
Warehouse wh = new Warehouse(conf);
1358+
Warehouse wh = Warehouse.create(conf);
13591359
catalog.setLocationUri(wh.getWhRootExternal().toString() + File.separator + catalog);
13601360
catalog.setDescription("Non-hive catalog");
13611361
Hive.get(primary.hiveConf).getMSC().createCatalog(catalog);

ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/archive/AlterTableArchiveUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static Path getInterMediateDir(Path dir, Configuration conf, ConfVars suffixConf
9696

9797
static void deleteDir(Path dir, boolean shouldEnableCm, Configuration conf) throws HiveException {
9898
try {
99-
Warehouse wh = new Warehouse(conf);
99+
Warehouse wh = Warehouse.create(conf);
100100
wh.deleteDir(dir, true, false, shouldEnableCm);
101101
} catch (MetaException e) {
102102
throw new HiveException(e);

ql/src/java/org/apache/hadoop/hive/ql/ddl/view/create/CreateMaterializedViewOperation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public int execute() throws HiveException {
8787
Map<String, String> tblProps = tbl.getTTable().getParameters();
8888
Path tlocation = null;
8989
try {
90-
Warehouse wh = new Warehouse(context.getConf());
90+
Warehouse wh = Warehouse.create(context.getConf());
9191
tlocation = wh.getDefaultTablePath(context.getDb().getDatabase(tbl.getDbName()), tbl.getTableName(),
9292
tblProps == null || !AcidUtils.isTablePropertyTransactional(tblProps));
9393
} catch (MetaException e) {

ql/src/java/org/apache/hadoop/hive/ql/exec/repl/bootstrap/load/util/Context.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public Context(String dumpDirectory, HiveConf hiveConf, Hive hiveDb,
4545
this.dumpDirectory = dumpDirectory;
4646
this.hiveConf = hiveConf;
4747
this.hiveDb = hiveDb;
48-
this.warehouse = new Warehouse(hiveConf);
48+
this.warehouse = Warehouse.create(hiveConf);
4949
this.pathInfo = new PathInfo(hiveConf);
5050
sessionStateLineageState = lineageState;
5151
this.nestedContext = nestedContext;

ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4077,7 +4077,7 @@ public List<Partition> dropPartitions(String dbName, String tableName,
40774077
PartitionDropOptions dropOptions) throws HiveException {
40784078
try {
40794079
Table table = getTable(dbName, tableName);
4080-
if (!dropOptions.deleteData) {
4080+
if (!dropOptions.isDeleteData()) {
40814081
AcidUtils.TableSnapshot snapshot = AcidUtils.getTableSnapshot(conf, table, true);
40824082
if (snapshot != null) {
40834083
dropOptions.setWriteId(snapshot.getWriteId());

ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public class SessionHiveMetaStoreClient extends HiveMetaStoreClientWithLocalCach
158158

159159
private Warehouse getWh() throws MetaException {
160160
if (wh == null) {
161-
wh = new Warehouse(conf);
161+
wh = Warehouse.create(conf);
162162
}
163163
return wh;
164164
}
@@ -1428,8 +1428,8 @@ public boolean dropPartition(String catName, String dbName, String tblName, List
14281428
}
14291429
Partition droppedPartition = tt.dropPartition(partVals);
14301430
boolean result = droppedPartition != null ? true : false;
1431-
boolean purgeData = options != null ? options.purgeData : true;
1432-
boolean deleteData = options != null ? options.deleteData : true;
1431+
boolean purgeData = options != null ? options.isPurgeData() : true;
1432+
boolean deleteData = options != null ? options.isDeleteData() : true;
14331433
if (deleteData && !tt.isExternal()) {
14341434
result &= deletePartitionLocation(droppedPartition, purgeData);
14351435
}
@@ -1470,8 +1470,8 @@ public List<Partition> dropPartitions(String catName, String dbName, String tblN
14701470
Partition droppedPartition = tt.dropPartition(p.getValues());
14711471
if (droppedPartition != null) {
14721472
result.add(droppedPartition);
1473-
boolean purgeData = options != null ? options.purgeData : true;
1474-
boolean deleteData = options != null ? options.deleteData : true;
1473+
boolean purgeData = options != null ? options.isPurgeData() : true;
1474+
boolean deleteData = options != null ? options.isDeleteData() : true;
14751475
if (deleteData && !tt.isExternal()) {
14761476
deletePartitionLocation(droppedPartition, purgeData);
14771477
}

ql/src/java/org/apache/hadoop/hive/ql/parse/ImportSemanticAnalyzer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ public static boolean prepareImport(boolean isImportCmd,
347347
}
348348
}
349349

350-
Warehouse wh = new Warehouse(x.getConf());
350+
Warehouse wh = Warehouse.create(x.getConf());
351351
Table table = tableIfExists(tblDesc, x.getHive());
352352
boolean tableExists = false;
353353

ql/src/java/org/apache/hadoop/hive/ql/parse/MetaDataExportListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private void export_meta_data(PreDropTableEvent tableEvent) throws MetaException
6161
tbl);
6262
IHMSHandler handler = tableEvent.getHandler();
6363
Configuration conf = handler.getConf();
64-
Warehouse wh = new Warehouse(conf);
64+
Warehouse wh = Warehouse.create(conf);
6565
Path tblPath = new Path(tbl.getSd().getLocation());
6666
fs = wh.getFs(tblPath);
6767
Date now = new Date();

ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,7 +2632,7 @@ private void getMetaData(QB qb, ReadEntity parentInput)
26322632
String tableName = getUnescapedName((ASTNode) ast.getChild(0));
26332633
String[] names = Utilities.getDbTableName(tableName);
26342634
try {
2635-
Warehouse wh = new Warehouse(conf);
2635+
Warehouse wh = Warehouse.create(conf);
26362636
//Use destination table's db location.
26372637
String destTableDb = qb.getTableDesc() != null ? qb.getTableDesc().getDatabaseName() : null;
26382638
if (destTableDb == null) {
@@ -8263,7 +8263,7 @@ private Path getCtasOrCMVLocation(CreateTableDesc tblDesc, CreateMaterializedVie
82638263
}
82648264

82658265
String[] names = Utilities.getDbTableName(protoName);
8266-
Warehouse wh = new Warehouse(conf);
8266+
Warehouse wh = Warehouse.create(conf);
82678267
if (tbl.getSd() == null || tbl.getSd().getLocation() == null) {
82688268
location = wh.getDefaultTablePath(db.getDatabase(names[0]), names[1], false);
82698269
} else {
@@ -8584,7 +8584,7 @@ private void handleLineage(Table destinationTable, LoadTableDesc ltd, Operator o
85848584
try {
85858585
String suffix = Utilities.getTableOrMVSuffix(ctx,
85868586
AcidUtils.isTableSoftDeleteEnabled(destinationTable, conf));
8587-
Warehouse wh = new Warehouse(conf);
8587+
Warehouse wh = Warehouse.create(conf);
85888588
tlocation = wh.getDefaultTablePath(db.getDatabase(tableDesc.getDatabaseName()),
85898589
tName + suffix, tableDesc.isExternal());
85908590

@@ -8602,7 +8602,7 @@ private void handleLineage(Table destinationTable, LoadTableDesc ltd, Operator o
86028602
Path tlocation;
86038603
String [] dbTable = Utilities.getDbTableName(createVwDesc.getViewName());
86048604
try {
8605-
Warehouse wh = new Warehouse(conf);
8605+
Warehouse wh = Warehouse.create(conf);
86068606
Map<String, String> tblProps = createVwDesc.getTblProps();
86078607
tlocation = wh.getDefaultTablePath(db.getDatabase(dbTable[0]), dbTable[1],
86088608
tblProps == null || !AcidUtils.isTablePropertyTransactional(tblProps));
@@ -14456,7 +14456,7 @@ ASTNode analyzeCreateTable(
1445614456
private String getDefaultLocation(String dbName, String tableName, boolean isExt) throws SemanticException {
1445714457
String tblLocation;
1445814458
try {
14459-
Warehouse wh = new Warehouse(conf);
14459+
Warehouse wh = Warehouse.create(conf);
1446014460
tblLocation = wh.getDefaultTablePath(db.getDatabase(dbName), tableName, isExt).toUri().getPath();
1446114461
} catch (MetaException | HiveException e) {
1446214462
throw new SemanticException(e);

ql/src/java/org/apache/hadoop/hive/ql/parse/TaskCompiler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ private Path getDefaultCtasOrCMVLocation(final ParseContext pCtx) throws Semanti
560560
if (!db.databaseExists(names[0])) {
561561
throw new SemanticException("ERROR: The database " + names[0] + " does not exist.");
562562
}
563-
Warehouse wh = new Warehouse(conf);
563+
Warehouse wh = Warehouse.create(conf);
564564
return wh.getDefaultTablePath(db.getDatabase(names[0]), names[1] + suffix, isExternal);
565565
} catch (HiveException | MetaException e) {
566566
throw new SemanticException(e);

ql/src/java/org/apache/hadoop/hive/ql/queryhistory/repository/AbstractRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void init(HiveConf conf, Schema schema) {
5151
this.conf = conf;
5252
this.schema = schema;
5353
try {
54-
this.warehouse = new Warehouse(conf);
54+
this.warehouse = Warehouse.create(conf);
5555
} catch (MetaException e) {
5656
throw new RuntimeException(e);
5757
}

ql/src/java/org/apache/hadoop/hive/ql/security/authorization/StorageBasedAuthorizationProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private void initWh() throws MetaException, HiveException {
9191
// chicken-and-egg problem. So, we now track whether or not we're running from client-side
9292
// in the SBAP itself.
9393
hive_db = new HiveProxy(Hive.get(getConf(), StorageBasedAuthorizationProvider.class));
94-
this.wh = new Warehouse(getConf());
94+
this.wh = Warehouse.create(getConf());
9595
if (this.wh == null){
9696
// If wh is still null after just having initialized it, bail out - something's very wrong.
9797
throw new IllegalStateException("Unable to initialize Warehouse from clientside.");

ql/src/java/org/apache/hadoop/hive/ql/stats/BasicStatsTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ private int aggregateStats(Hive db, Table tbl) {
277277

278278
try {
279279
// Stats setup:
280-
final Warehouse wh = new Warehouse(conf);
280+
final Warehouse wh = Warehouse.create(conf);
281281
if (!getWork().getNoStatsAggregator() && !getWork().isNoScanAnalyzeCommand()) {
282282
try {
283283
scc = getContext();

ql/src/java/org/apache/hadoop/hive/ql/util/HiveStrictManagedMigration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ private void readControlConfigs(FileSystem fs, Path path) {
567567
}, runOptions.tablePoolSize);
568568
wh = ThreadLocal.withInitial(() -> {
569569
try {
570-
return new Warehouse(conf);
570+
return Warehouse.create(conf);
571571
} catch (MetaException e) {
572572
throw new RuntimeException(e);
573573
}
@@ -578,7 +578,7 @@ private void readControlConfigs(FileSystem fs, Path path) {
578578

579579
oldWh = ThreadLocal.withInitial(() -> {
580580
try {
581-
return new Warehouse(oldConf);
581+
return Warehouse.create(oldConf);
582582
} catch (MetaException e) {
583583
throw new RuntimeException(e);
584584
}

ql/src/test/org/apache/hadoop/hive/ql/metadata/TestHive.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ public void testMetaStoreApiTiming() throws Throwable {
344344
* @throws MetaException
345345
*/
346346
private void validateTable(Table tbl, String tableName) throws MetaException {
347-
Warehouse wh = new Warehouse(hiveConf);
347+
Warehouse wh = Warehouse.create(hiveConf);
348348
Table ft = null;
349349
try {
350350
// hm.getTable result will not have privileges set (it does not retrieve

ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientExchangePartitionsTempTable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public TestSessionHiveMetastoreClientExchangePartitionsTempTable(String name, Ab
6161
@Override
6262
public void setUp() throws Exception {
6363
initHiveConf();
64-
wh = new Warehouse(conf);
64+
wh = Warehouse.create(conf);
6565
SessionState.start(conf);
6666
setClient(Hive.get(conf).getMSC());
6767
getClient().dropDatabase(DB_NAME, true, true, true);

ql/src/test/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/TestHiveMetaStoreAuthorizer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public void setUp() throws Exception {
9999
rawStore = new ObjectStore();
100100
rawStore.setConf(hmsHandler.getConf());
101101
// Create the 'hive' catalog with new warehouse directory
102-
HMSHandler.createDefaultCatalog(rawStore, new Warehouse(conf));
102+
HMSHandler.createDefaultCatalog(rawStore, Warehouse.create(conf));
103103
try {
104104
DropDataConnectorRequest dropDcReq = new DropDataConnectorRequest(dcName);
105105
dropDcReq.setIfNotExists(true);

standalone-metastore/metastore-common/spotbugs/spotbugs-exclude.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,16 @@
2121
<Match>
2222
<Class name="~org.apache.hadoop.hive.metastore.api.*" />
2323
</Match>
24+
<Match>
25+
<Class name="org.apache.hadoop.hive.common.metrics.metrics2.JsonFileMetricsReporter"/>
26+
<Bug pattern="EI_EXPOSE_REP2"/>
27+
</Match>
28+
<Match>
29+
<Class name="org.apache.hadoop.hive.metastore.security.TUGIAssumingTransport"/>
30+
<Bug pattern="EI_EXPOSE_REP2"/>
31+
</Match>
32+
<Match>
33+
<Class name="org.apache.hadoop.hive.metastore.security.TFilterTransport"/>
34+
<Bug pattern="EI_EXPOSE_REP2"/>
35+
</Match>
2436
</FindBugsFilter>

0 commit comments

Comments
 (0)