docs: private ProtectionDomain getProtectionDomain(Container rarContainer) throws UnableToAdaptException, MalformedURLException {
          PermissionCollection perms = new Permissions();
  
          CodeSource codeSource;
          try {
              // codesource must start file:///
              // assume loc starts with 0 or 1 /
              String loc = rarFilePath;
              codeSource = new CodeSource(new URL("file://" + (loc.startsWith("/") ? "" : "/") + loc), (java.security.cert.Certificate[]) null);
          } catch (MalformedURLException e) {
              if (tc.isDebugEnabled()) {
                  Tr.debug(tc, "CodeSource could not be created for RA file path of: rarFilePath", e);
              }
              throw e;
          }
  
          if (!java2SecurityEnabled()) {
              perms.add(new AllPermission());
          } else {
  
              PermissionsConfig permissionsConfig = null;
              try {
                  permissionsConfig = rarContainer.adapt(PermissionsConfig.class);
              } catch (UnableToAdaptException ex) {
                  //J2CA8817E: Resource adapter {0} encountered a parse error when processing deployment descriptor {1}: {2}
                  Tr.error(tc, "J2CA8817.parse.deployment.descriptor.failed", rarContainer.getName(), "META-INF/permissions.xml", ex);
                  throw ex;
              }
  
              if (permissionsConfig != null) {
                  List<com.ibm.ws.javaee.dd.permissions.Permission> configuredPermissions = permissionsConfig.getPermissions();
                  addPermissions(codeSource, configuredPermissions);
              }
  
              ArrayList<Permission> mergedPermissions = permissionManager.getEffectivePermissions(rarFilePath);
              int count = mergedPermissions.size();
              for (int i = 0; i < count; i++)
                  perms.add(mergedPermissions.get(i));
          }
  
          return new ProtectionDomain(codeSource, perms);
      }