code: private List<ParsedPolicy> getJavaPolicies() {
          List<ParsedPolicy> list = new ArrayList<ParsedPolicy>();
  
          int counter = 1;
          String policyUrl = null;
          while ((policyUrl = SecurityActions.getSecurityProperty("policy.url." + counter)) != null) {
              try {
                  policyUrl = expandStringWithProperty(policyUrl);
              } catch (Exception ex) {
                  System.err.println("Expanding filepath in policy policy.url." + counter + "=" + policyUrl
                          + " failed. Exception message: " + ex.getMessage());
                  counter++;
                  continue;
              }
              ParsedPolicy p = null;
              InputStreamReader reader = null;
              try {
                  reader = new InputStreamReader(new URL(policyUrl).openStream(), "UTF-8");
                  p = new Parser(debug).parse(reader);
                  if (p != null) {
                      list.add(p);
                  } else {
                      System.err.println("Parsed policy policy.url." + counter + "=" + policyUrl + " is null");
                  }
              } catch (Exception ex) {
                  System.err.println("Policy policy.url." + counter + "=" + policyUrl
                          + " wasn't successfully parsed. Exception message: " + ex.getMessage());
              } finally {
                  if (reader != null) {
                      try {
                          reader.close();
                      } catch (IOException e) {
                          e.printStackTrace();
                      }
                  }
              }
              counter++;
          }
  
          return list;
      }
docs: Private method for gaining and parsing all policies defined in java.security file.
  
  @return Parsed policies in list of ParsedPolicy