Uploaded image for project: 'Nuxeo Studio'
  1. Nuxeo Studio
  2. NXS-3990

Potential Infinite loop in version suggestion

    XMLWordPrintable

    Details

      Description

      Currently, the class com.nuxeo.studio.core.VersionServiceImpl.java#innerGetSuggestedVersion has the following logic:

          private SuggestedVersions innerGetSuggestedVersion(String original, String version) {
              ...
              try {
                  Matcher matcher = Pattern.compile(VERSION_MATCHER).matcher(version);
                  matcher.find();
                  versionS = matcher.group(VERSION_PART);
                  majorS = matcher.group(MAJOR_PART);
                  minorS = matcher.group(MINOR_PART);
                  revisionS = matcher.group(REVISION_PART);
                  qualifier = matcher.group(QUALIFIER_PART);
              } catch (Exception e) {
                  return innerGetSuggestedVersion(original, Version.INITIAL_VERSION);
              }
              ...
          }
      

      It use a try-catch block handle the regex match error. If there's any fail to match, then the method recall itself recursively with another argument. We need to investigate if it would introduces an infinite loop. And ideally, avoid using recursive call + try-catch when providing a fall back solution.

      See https://github.com/nuxeo/nuxeo-studio/blob/304897937d5c774dac1c40a8636e67d53f167c00/nuxeo-studio-core/src/main/java/com/nuxeo/studio/core/VersionServiceImpl.java#L591-L601

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mhuang Mincong Huang
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                PagerDuty

                Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.