Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.smstool
- import org.springframework.dao.DataIntegrityViolationException
- class UploadController {
- def index() {
- redirect(action: "upload", params: params)
- }
- def upload() {
- }
- }
- <g:form action="upload" method="post" enctype="multipart/form-data">
- <label for="file">File:</label>
- <input type="file" name="file" id="file"/>
- <input class="save" type="submit" value="Upload"/>
- </g:form>
- @Grab('com.xlson.groovycsv:groovycsv:1.0')
- import static com.xlson.groovycsv.CsvParser.parseCsv
- import org.springframework.dao.DataIntegrityViolationException
- class UploadController {
- def index() {
- redirect(action: "upload", params: params)
- }
- def upload() {
- }
- def batchUpload() {
- def csv = new File('file')
- //def csv = '''Name,Lastname
- //Mark,Andersson
- //Pete,Hansen'''
- def data = parseCsv(csv)
- for(line in data) {
- println "$line.Number"
- }
- }
- }
- Error 500: Internal Server Error
- URI
- /upload/batchUpload
- Class
- groovy.lang.MissingMethodException
- Message
- No signature of method: static com.xlson.groovycsv.CsvParser.parseCsv() is applicable for argument types: (java.io.File) values: [file] Possible solutions: parseCsv(java.io.Reader), parseCsv(java.lang.String), parseCsv(java.util.Map, java.io.Reader), parseCsv(java.util.Map, java.lang.String), parse(java.io.Reader), parse(java.lang.String)
- Around line 28 of grails-app/controllers/com/tool/UploadController.groovy
- 25: //Mark,Andersson26: //Pete,Hansen'''27: 28: def data = parseCsv(csv)29: 30: for(line in data) {31: println "$line.Number"
- Around line 195 of PageFragmentCachingFilter.java
- 192: if (CollectionUtils.isEmpty(cacheOperations)) {193: log.debug("No cacheable annotation found for {}:{} {}",194: new Object[] { request.getMethod(), request.getRequestURI(), getContext() });195: chain.doFilter(request, response);196: return;197: }198:
- Around line 63 of AbstractFilter.java
- 60: try {61: // NO_FILTER set for RequestDispatcher forwards to avoid double gzipping62: if (filterNotDisabled(request)) {63: doFilter(request, response, chain);64: }65: else {66: chain.doFilter(req, res);
- Trace
- Line | Method
- ->> 28 | batchUpload in UploadController.groovy
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- | 195 | doFilter in PageFragmentCachingFilter.java
- | 63 | doFilter . in AbstractFilter.java
- | 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
- | 603 | run . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
- ^ 679 | run in java.lang.Thread
- <g:uploadForm action="upload">
- <input type="file" name="file">
- <g:submitButton name="upload" value="Upload"/>
- </g:uploadForm>
- def upload() {
- def file = request.getFile('file')
- def allLines = file.inputStream.toCsvReader().readAll()
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement