Source:
<code>public boolean shareResourceWithUsers(AuthzToken authzToken, String resourceId, ResourceType resourceType, Map<String, ResourcePermissionType> userPermissionList) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { RegistryService.Client regClient = registryClientPool.getResource(); SharingRegistryService.Client sharingClient = sharingClientPool.getResource(); try { for(Map.Entry<String, ResourcePermissionType> userPermission : userPermissionList.entrySet()){ String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); if(userPermission.getValue().equals(ResourcePermissionType.WRITE)) sharingClient.shareEntityWithUsers(gatewayId, resourceId, Arrays.asList(userPermission.getKey()), authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + ":" + "WRITE", true); else if(userPermission.getValue().equals(ResourcePermissionType.READ)) sharingClient.shareEntityWithUsers(gatewayId, resourceId, Arrays.asList(userPermission.getKey()), authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + ":" + "READ", true); <START> else <END> sharingClient.shareEntityWithUsers(gatewayId, resourceId, Arrays.asList(userPermission.getKey()), authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + ":" + "EXEC", true); } registryClientPool.returnResource(regClient); sharingClientPool.returnResource(sharingClient); return true; } catch (Exception e) { String msg = "Error in sharing resource with users. Resource ID : " + resourceId + " Resource Type : " + resourceType.toString() ; logger.error(msg, e); AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); exception.setMessage(msg + " More info : " + e.getMessage()); sharingClientPool.returnBrokenResource(sharingClient); registryClientPool.returnBrokenResource(regClient); throw exception; } }</code><technical_language>check for EXEC permission throw exception in else block? line 5004 well</technical_language>

Target:
public boolean shareResourceWithUsers(AuthzToken authzToken, String resourceId, ResourceType resourceType, Map<String, ResourcePermissionType> userPermissionList) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { RegistryService.Client regClient = registryClientPool.getResource(); SharingRegistryService.Client sharingClient = sharingClientPool.getResource(); try { for(Map.Entry<String, ResourcePermissionType> userPermission : userPermissionList.entrySet()){ String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); if(userPermission.getValue().equals(ResourcePermissionType.WRITE)) sharingClient.shareEntityWithUsers(gatewayId, resourceId, Arrays.asList(userPermission.getKey()), authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + ":" + "WRITE", true); else if(userPermission.getValue().equals(ResourcePermissionType.READ)) sharingClient.shareEntityWithUsers(gatewayId, resourceId, Arrays.asList(userPermission.getKey()), authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + ":" + "READ", true); else if(userPermission.getValue().equals(ResourcePermissionType.EXEC)) sharingClient.shareEntityWithUsers(gatewayId, resourceId, Arrays.asList(userPermission.getKey()), authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + ":" + "EXEC", true); else { logger.error("Invalid ResourcePermissionType : " + userPermission.getValue().toString()); throw new AiravataClientException(AiravataErrorType.UNSUPPORTED_OPERATION); } } registryClientPool.returnResource(regClient); sharingClientPool.returnResource(sharingClient); return true; } catch (Exception e) { String msg = "Error in sharing resource with users. Resource ID : " + resourceId + " Resource Type : " + resourceType.toString() ; logger.error(msg, e); AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); exception.setMessage(msg + " More info : " + e.getMessage()); sharingClientPool.returnBrokenResource(sharingClient); registryClientPool.returnBrokenResource(regClient); throw exception; } }