Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-4576

Concept Dictionary CSV download - looping issue causes incorrect output

    Details

    • Complexity:
      Low

      Description

      I just installed OpenMRS off of github master, went to Dictionary, and clicked the "Download the concept dictionary in CSV format" link. There are only 1164 non-retired concepts in the test data set but the CSV produced 679,195 rows because for each concept the DownloadDictionaryServlet loops through, it re-prints all of the concepts up to that point. In other words the output looks like:
      headerline
      headerline
      concept1
      headerline
      concept1
      concept2
      ...
      The reason for this appears to be the change in DownloadDictionaryServlet in https://github.com/dszafranek/openmrs-core/commit/c648131d4cfed7e33b122212ec20e9fe8cd289f9 to go from using string concatenation using + to string concatenation using StringBuilder. The previous implementation using + re-initialized the 'line' variable each time through the loop, but the StringBuilder implementation just keeps appending to the previous line. Resetting the line in DownloadDictionaryServlet:78 ought to fix the issue.

      If verified, the ticket can be assigned to me and I can make the fix, and look at adding a unit test.

      Also, since I am new to the OpenMRS project, I'm not sure exactly how to determine the version this affects. The StringBuilder commit happened in Jan 2014 and is tagged with 1.11.0-alpha and beta so that's my best guess.

        Attachments

          Activity

            People

            • Assignee:
              kristopherschmidt Kristopher Schmidt
              Reporter:
              kristopherschmidt Kristopher Schmidt
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 hour
                1h
                Remaining:
                Remaining Estimate - 1 hour
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified