code: @Override
      public void permissionDenied(final ProtectionDomain pd, final Permission perm) {
          if (filePermissionToSkip.equals(perm)) {
              return;
          }
          final CodeSource codeSource = pd.getCodeSource();
          Set<Permission> permSet = missingPermissions.get(codeSource);
          if (permSet == null) {
              synchronized (missingPermissions) {
                  permSet = missingPermissions.get(codeSource);
                  if (permSet == null) {
                      permSet = Collections.synchronizedSet(new TreeSet<Permission>(new PermissionComparator()));
                      missingPermissions.put(codeSource, permSet);
                  }
              }
          }
          if (permSet.add(perm)) {
              AccessController.doPrivileged(WRITE_TO_FILE_ACTION);
          }
      }
docs: Writes the given permission under the grant entry with codesource from given {@link ProtectionDomain} into the generated
  policy file.
  
  @see net.sourceforge.prograde.generator.DeniedPermissionListener#permissionDenied(java.security.ProtectionDomain,
  java.security.Permission)