Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-9261

Improve comment handling in ResourceDatabasePopulator

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 3.1.1
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      The ResourceDatabasePopulator currently strips comments from an SQL file, but only if they start at the beginning of the line. If they are indented, or if they are placed on the same line after an SQL statement, they are left in the script and can be wrapped in with the following SQL statement, depending on the statement separator used.
      E.g. in the following script, the comments at lines 2 and 3 would both be wrapped in with the insert statement on line 4, causing it to not be executed properly.

      -- leading comment
      insert into T_TEST (NAME) values ('Keith'); -- comment at EOL
      	-- indented comment
      insert into T_TEST (NAME) values ('Dave');
      

      With the attached patch the ResourceDatabasePopulator removes all comments from an SQL file. A unit test illustrating the behaviour is included.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sbrannen Sam Brannen
              Reporter:
              koschder Lukas Kuster
              Last updater:
              Spring Issues Spring Issues
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                3 years, 23 weeks, 6 days ago