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

ResourcePoolManager.findEntry has a bug in startsWith call

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b131
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description


              @Override
              public Optional<ResourcePoolEntry> findEntry(String path) {
                  if (!path.startsWith("/")) {
                      path = "/" + path;
                  }
                  if (!path.startsWith("/" + name)) {
                      path = "/" + name + path;
                  }
                  return Optional.ofNullable(moduleContent.get(path));
              }

      For findEntry("module-info.class") and module name "m" it will first change path to "/module-info.class" and then see that path.startsWith("/m") is true and not append "/m".

                  if (!path.startsWith("/" + name + "/")) {
                      path = "/" + name + path; // path must start with "/" already
                  }

        Attachments

          Activity

            People

            Assignee:
            sundar Sundararajan Athijegannathan
            Reporter:
            sundar Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: