Skip to content

Commit

Permalink
RANGER-5046: remove IntelliJ warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaab committed Dec 10, 2024
1 parent e8cd1a2 commit ceeaee9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public boolean checkAccess(IOzoneObj ozoneObject, RequestContext context) {
boolean returnValue = false;
if (ozoneObject == null) {
LOG.error("Ozone object is null!!");
return returnValue;
return false;
}
OzoneObj ozoneObj = (OzoneObj) ozoneObject;
UserGroupInformation ugi = context.getClientUgi();
Expand All @@ -92,7 +92,7 @@ public boolean checkAccess(IOzoneObj ozoneObject, RequestContext context) {

if (rangerPlugin == null) {
MiscUtil.logErrorMessageByInterval(LOG, "Authorizer is still not initialized");
return returnValue;
return false;
}

//TODO: If source type is S3 and resource is volume, then allow it by default
Expand All @@ -116,9 +116,8 @@ public boolean checkAccess(IOzoneObj ozoneObject, RequestContext context) {
String message = String.format("Unsupported access type. operation = %s", operation);
MiscUtil.logErrorMessageByInterval(LOG, message);
LOG.error("{}, resource = {}", message, resource);
return returnValue;
return false;
}
String action = accessType;
String clusterName = rangerPlugin.getClusterName();

RangerAccessRequestImpl rangerRequest = new RangerAccessRequestImpl();
Expand All @@ -133,7 +132,7 @@ public boolean checkAccess(IOzoneObj ozoneObject, RequestContext context) {

rangerRequest.setResource(rangerResource);
rangerRequest.setAccessType(accessType);
rangerRequest.setAction(action);
rangerRequest.setAction(accessType);
rangerRequest.setRequestData(resource);
rangerRequest.setClusterName(clusterName);

Expand All @@ -153,7 +152,7 @@ public boolean checkAccess(IOzoneObj ozoneObject, RequestContext context) {
LOG.error("Unsupported resource = {}", resource);
String message = String.format("Unsupported resource type = %s for resource = %s, request = %s", ozoneObj.getResourceType(), resource, rangerRequest);
MiscUtil.logErrorMessageByInterval(LOG, message);
return returnValue;
return false;
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void init(RangerServiceDef serviceDef, RangerService service) {

@Override
public Map<String, Object> validateConfig() throws Exception {
Map<String, Object> ret = new HashMap<String, Object>();
Map<String, Object> ret = new HashMap<>();
String serviceName = getServiceName();
if (LOG.isDebugEnabled()) {
LOG.debug("<== RangerServiceOzone.validateConfig Service: ({})", serviceName);
Expand All @@ -85,7 +85,7 @@ public Map<String, Object> validateConfig() throws Exception {

@Override
public List<String> lookupResource(ResourceLookupContext context) throws Exception {
List<String> ret = new ArrayList<String>();
List<String> ret = new ArrayList<>();
String serviceName = getServiceName();
String serviceType = getServiceType();
Map<String, String> configs = getConfigs();
Expand Down Expand Up @@ -124,7 +124,7 @@ public List<RangerPolicy> getDefaultRangerPolicies() throws Exception {

if (StringUtils.isNotBlank(lookUpUser)) {
RangerPolicyItem policyItemForLookupUser = new RangerPolicyItem();
List<RangerPolicy.RangerPolicyItemAccess> accessListForLookupUser = new ArrayList<RangerPolicy.RangerPolicyItemAccess>();
List<RangerPolicy.RangerPolicyItemAccess> accessListForLookupUser = new ArrayList<>();
accessListForLookupUser.add(new RangerPolicyItemAccess(ACCESS_TYPE_READ));
accessListForLookupUser.add(new RangerPolicyItemAccess(ACCESS_TYPE_WRITE));
accessListForLookupUser.add(new RangerPolicyItemAccess(ACCESS_TYPE_CREATE));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public class OzoneConnectionMgr {
protected ConcurrentMap<String, Boolean> repoConnectStatusMap;

public OzoneConnectionMgr() {
ozoneConnectionCache = new ConcurrentHashMap<String, OzoneClient>();
repoConnectStatusMap = new ConcurrentHashMap<String, Boolean>();
ozoneConnectionCache = new ConcurrentHashMap<>();
repoConnectStatusMap = new ConcurrentHashMap<>();
}

public OzoneClient getOzoneConnection(final String serviceName, final String serviceType, final Map<String, String> configs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,32 +116,14 @@ public static List<String> getOzoneResources(String serviceName, String serviceT

if (ozoneClient != null) {
if (volumePrefix != null && !volumePrefix.isEmpty()) {
// get the DBList for given Input
finalVolPrefix = volumePrefix;
callableObj = new Callable<List<String>>() {
@Override
public List<String> call() {
return ozoneClient.getVolumeList(finalVolPrefix);
}
};
callableObj = () -> ozoneClient.getVolumeList(finalVolPrefix);
} else if (bucketPrefix != null && !bucketPrefix.isEmpty()) {
// get ColumnList for given Input
finalBucketPrefix = bucketPrefix;
callableObj = new Callable<List<String>>() {
@Override
public List<String> call() {
return ozoneClient.getBucketList(finalBucketPrefix, finalvolumeList);
}
};
callableObj = () -> ozoneClient.getBucketList(finalBucketPrefix, finalvolumeList);
} else if (keyPrefix != null && !keyPrefix.isEmpty()) {
// get ColumnList for given Input
finalKeyPrefix = keyPrefix;
callableObj = new Callable<List<String>>() {
@Override
public List<String> call() {
return ozoneClient.getKeyList(finalKeyPrefix, finalvolumeList, finalbucketList);
}
};
callableObj = () -> ozoneClient.getKeyList(finalKeyPrefix, finalvolumeList, finalbucketList);
}
if (callableObj != null) {
synchronized (ozoneClient) {
Expand Down

0 comments on commit ceeaee9

Please sign in to comment.