Skip to content

Commit 0bfbb55

Browse files
committed
Resolve comments
1 parent 7f5a713 commit 0bfbb55

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

polaris-core/src/main/java/org/apache/polaris/core/persistence/resolver/PolarisResolutionManifest.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ public class PolarisResolutionManifest implements PolarisResolutionManifestCatal
6868
// Set when resolveAll is called
6969
private ResolverStatus primaryResolverStatus = null;
7070

71-
private ResolverStatus requirePrimaryResolverStatus() {
71+
private boolean isResolveAllSucceeded() {
7272
diagnostics.checkNotNull(
7373
primaryResolverStatus,
7474
"resolver_not_run_before_access",
7575
"resolveAll() must be called before reading resolution results");
76-
return primaryResolverStatus;
76+
return primaryResolverStatus.getStatus() == ResolverStatus.StatusEnum.SUCCESS;
7777
}
7878

7979
public PolarisResolutionManifest(
@@ -264,7 +264,7 @@ public Set<PolarisBaseEntity> getAllActivatedPrincipalRoleEntities() {
264264
}
265265

266266
private @Nullable ResolvedPolarisEntity getResolvedRootContainerEntity() {
267-
if (requirePrimaryResolverStatus().getStatus() != ResolverStatus.StatusEnum.SUCCESS) {
267+
if (!isResolveAllSucceeded()) {
268268
return null;
269269
}
270270
ResolvedPolarisEntity resolvedEntity =
@@ -285,7 +285,6 @@ public PolarisResolvedPathWrapper getResolvedRootContainerEntityAsPath() {
285285

286286
public PolarisResolvedPathWrapper getResolvedReferenceCatalogEntity(
287287
boolean prependRootContainer) {
288-
requirePrimaryResolverStatus();
289288
// This is a server error instead of being able to legitimately return null, since this means
290289
// a callsite failed to incorporate a reference catalog into its authorization flow but is
291290
// still trying to perform operations on the (nonexistence) reference catalog.
@@ -307,7 +306,6 @@ public PolarisResolvedPathWrapper getResolvedReferenceCatalogEntity(
307306
}
308307

309308
public PolarisEntitySubType getLeafSubType(Object key) {
310-
requirePrimaryResolverStatus();
311309
diagnostics.check(
312310
pathLookup.containsKey(key),
313311
"never_registered_key_for_resolved_path",
@@ -330,15 +328,14 @@ public PolarisEntitySubType getLeafSubType(Object key) {
330328
* "optional"
331329
*/
332330
public PolarisResolvedPathWrapper getResolvedPath(Object key, boolean prependRootContainer) {
333-
requirePrimaryResolverStatus();
334331
diagnostics.check(
335332
pathLookup.containsKey(key),
336333
"never_registered_key_for_resolved_path",
337334
"key={} pathLookup={}",
338335
key,
339336
pathLookup);
340337

341-
if (primaryResolverStatus.getStatus() != ResolverStatus.StatusEnum.SUCCESS) {
338+
if (!isResolveAllSucceeded()) {
342339
return null;
343340
}
344341
int index = pathLookup.get(key);
@@ -395,7 +392,6 @@ public PolarisResolvedPathWrapper getResolvedPath(
395392

396393
public PolarisResolvedPathWrapper getResolvedTopLevelEntity(
397394
String entityName, PolarisEntityType entityType) {
398-
requirePrimaryResolverStatus();
399395
// For now, all top-level entities will have the root container prepended so we don't have
400396
// a variation of this method that allows specifying whether to prepend the root container.
401397
diagnostics.check(
@@ -406,7 +402,7 @@ public PolarisResolvedPathWrapper getResolvedTopLevelEntity(
406402
entityType,
407403
addedTopLevelNames);
408404

409-
if (primaryResolverStatus.getStatus() != ResolverStatus.StatusEnum.SUCCESS) {
405+
if (!isResolveAllSucceeded()) {
410406
return null;
411407
}
412408

0 commit comments

Comments
 (0)