title: Trying to parse CSV file in Grails
body: <p>I'm trying to parse a CSV file which has three fields.</p>
  
  <p>My method looks like this:</p>
  
  <pre><code>// this action is called when the user submits the upload form
  def handle() {
      CommonsMultipartFile file = request.getFile('filecsv')
      if(file.empty) {
          flash.error = g.message(code:'',default:'Empty cannot be uploaded')
      } else {
          InputStream fs = file.inputStream
          fs.splitEachLine(',') { row -&gt;
              new Connection(
                      randomizedID: row[0],
                      token1: row[1],
                      token2: row[2]
              ).save(flush: true)
  
              key++
  
              println("Connection added")
          }
      }
  }
  </code></pre>
  
  <p>Looking at the output, the line "Connection added" is printed multiple times.
  But when I go looking at my Connection list, there are none...</p>