Bugzilla importer can fail when comments have strings that look like bug ids but they fall outside the range of an Integer

XMLWordPrintable

    • 3.13

      The bugzilla importer scans comments for links to bug ids so we can create links to the newly created jira issues.

      However this can fail causing the entire import to fail. We had a customer whose bugzilla data had a comment "luck Bug 7777777777777...". We try to convert the 7777... to an integer, but it threw a number format exception because it is outside the rage of an Integer.

      The code in question is in BugzillaImportBean#rewriteBugLinkInText:

      public void appendSubstitution(StringBuffer appendBuffer, MatchResult match,
                                                 int substitutionCount,
                                                 PatternMatcherInput originalInput,
                                                 PatternMatcher matcher, Pattern pattern)
                  {
                      String bugId = match.group(1);
                      Long jiraIssueId = (Long) importedKeys.get(new Integer(bugId)); // this is where it blows up
                      if (jiraIssueId == null)
                      {
                          log("No imported issue found for bug reference " + bugId + " in " + parentIssueKey);
                          appendBuffer.append(originalInput);
                      } 
      

      We should check the bug id will actually fit into an Integer and fail in a similar manner to the case were a jira issue isn't found.

              Assignee:
              Pawel Niewiadomski (Inactive)
              Reporter:
              Andrew Myers [Atlassian]
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: