Skip to content

Commit

Permalink
SAK-40791 Assignments add CRLF according to RFC 4180 for CSV output
Browse files Browse the repository at this point in the history
  • Loading branch information
ern authored and Miguel Pellicer committed Dec 13, 2018
1 parent 61cdb4b commit 9cbc1ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class CsvExporter extends SpreadsheetExporter {
} catch (IOException e) {
// tried
}
gradesBuffer = new CSVWriter(osw, csvSep.charAt(0));
gradesBuffer = new CSVWriter(osw, csvSep.charAt(0), CSVWriter.DEFAULT_QUOTE_CHARACTER, CSVWriter.DEFAULT_ESCAPE_CHARACTER, CSVWriter.RFC4180_LINE_END);
addRow(title, gradeType);
addRow("");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

import com.opencsv.CSVParser;
import com.opencsv.CSVParserBuilder;
import com.opencsv.CSVReader;
import com.opencsv.CSVReaderBuilder;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
Expand Down Expand Up @@ -13271,7 +13274,8 @@ private Map<String, UploadGradeWrapper> uploadAll_parseZipFile(SessionState stat
// read grades.cvs from zip

String csvSep = assignmentService.getCsvSeparator();
CSVReader reader = new CSVReader(new InputStreamReader(zipFile.getInputStream(entry)), csvSep.charAt(0));
CSVParser parser = new CSVParserBuilder().withSeparator(csvSep.charAt(0)).build();
CSVReader reader = new CSVReaderBuilder(new InputStreamReader(zipFile.getInputStream(entry))).withCSVParser(parser).build();

List<String[]> lines = reader.readAll();

Expand Down

0 comments on commit 9cbc1ab

Please sign in to comment.