Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8184165

sun.security.provider.PolicyFile$PolicyEntry.toString() throws MissingResourceException

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b15
    • Verification:
      Not verified

      Description

      sun.security.provider.PolicyFile$PolicyEntry.toString() throws MissingResourceException because there is NO resource for "SPACE" in sun.security.util.Resources

      Exception is thrown when run below code, "java.util.MissingResourceException: Can't find resource for bundle sun.security.util.Resources, key SPACE"

          public static void printPolicy() throws Exception {
              Policy policy = Policy.getPolicy();
              System.out.println("should be PolicyFile: " + policy.getClass().getName());
              Class policyFileClass = Policy.getPolicy().getClass();

              // private AtomicReference<PolicyInfo> policyInfo = new AtomicReference<>();
              Field policyInfoField = policyFileClass.getDeclaredField("policyInfo");
              policyInfoField.setAccessible(true);

              Object policyInfo = ((AtomicReference)policyInfoField.get(policy)).get();
              Class policyInfoClass = policyInfo.getClass();
              System.out.println("should be PolicyInfo: " + policyInfoClass.getName());

              Field policyEntriesField = policyInfoClass.getDeclaredField("policyEntries");
              policyEntriesField.setAccessible(true);
              List policyEntries = (List)policyEntriesField.get(policyInfo);
              for (Object entry : policyEntries) {
                  System.out.println("**** PolicyEntry: " + entry);
              }
          }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mli Hamlin Li
              Reporter:
              mli Hamlin Li
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: