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

Consolidate duplicated classpath parsing code in classLoader.cpp

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 14
    • 14
    • hotspot
    • b12

      This pattern of code is duplicated 3 times and should be consolidated

      http://hg.openjdk.java.net/jdk/jdk/file/8c73d2a46ba9/src/hotspot/share/classfile/classLoader.cpp#l567

        Thread* THREAD = Thread::current();
        int len = (int)strlen(class_path);
        int end = 0;

        // Iterate over class path entries
        for (int start = 0; start < len; start = end) {
          while (class_path[end] && class_path[end] != os::path_separator()[0]) {
            end++;
          }
          EXCEPTION_MARK;
          ResourceMark rm(THREAD);
          char* path = NEW_RESOURCE_ARRAY(char, end - start + 1);
          strncpy(path, &class_path[start], end - start);
          path[end - start] = '\0';

            iklam Ioi Lam
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: