File tree Expand file tree Collapse file tree
src/main/java/org/apache/commons/csv Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -182,18 +182,18 @@ private static boolean isLineBreak(char c) {
182182 */
183183 void validate () throws IllegalArgumentException {
184184 if (delimiter == encapsulator ) {
185- throw new IllegalArgumentException ("The encapsulator character and the delimiter cannot be the same (\" "
186- + encapsulator + "\" )" );
185+ throw new IllegalArgumentException ("The encapsulator character and the delimiter cannot be the same (\" " +
186+ encapsulator + "\" )" );
187187 }
188188
189189 if (delimiter == escape ) {
190- throw new IllegalArgumentException ("The escape character and the delimiter cannot be the same (\" "
191- + escape + "\" )" );
190+ throw new IllegalArgumentException ("The escape character and the delimiter cannot be the same (\" " +
191+ escape + "\" )" );
192192 }
193193
194194 if (delimiter == commentStart ) {
195- throw new IllegalArgumentException ("The comment start character and the delimiter cannot be the same (\" "
196- + commentStart + "\" )" );
195+ throw new IllegalArgumentException ("The comment start character and the delimiter cannot be the same (\" " +
196+ commentStart + "\" )" );
197197 }
198198
199199 if (encapsulator != DISABLED && encapsulator == commentStart ) {
@@ -202,8 +202,8 @@ void validate() throws IllegalArgumentException {
202202 }
203203
204204 if (escape != DISABLED && escape == commentStart ) {
205- throw new IllegalArgumentException ("The comment start and the escape character cannot be the same (\" "
206- + commentStart + "\" )" );
205+ throw new IllegalArgumentException ("The comment start and the escape character cannot be the same (\" " +
206+ commentStart + "\" )" );
207207 }
208208 }
209209
Original file line number Diff line number Diff line change @@ -216,15 +216,15 @@ private Token encapsulatedTokenLexer(Token tkn) throws IOException {
216216 return tkn ;
217217 } else if (!isWhitespace (c )) {
218218 // error invalid char between token and next delimiter
219- throw new IOException ("(line " + getLineNumber ()
220- + ") invalid char between encapsulated token and delimiter" );
219+ throw new IOException ("(line " + getLineNumber () +
220+ ") invalid char between encapsulated token and delimiter" );
221221 }
222222 }
223223 }
224224 } else if (isEndOfFile (c )) {
225225 // error condition (end of file before end of token)
226- throw new IOException ("(startline " + startLineNumber
227- + ") EOF reached before encapsulated token finished" );
226+ throw new IOException ("(startline " + startLineNumber +
227+ ") EOF reached before encapsulated token finished" );
228228 } else {
229229 // consume character
230230 tkn .content .append ((char ) c );
Original file line number Diff line number Diff line change @@ -183,8 +183,8 @@ CSVRecord getRecord() throws IOException {
183183 } while (reusableToken .type == TOKEN );
184184
185185 if (!record .isEmpty ()) {
186- result = new CSVRecord ( record . toArray ( new String [ record . size ()]), headerMapping , sb == null ? null
187- : sb . toString () );
186+ final String comment = sb == null ? null : sb . toString ();
187+ result = new CSVRecord ( record . toArray ( new String [ record . size ()]), headerMapping , comment );
188188 }
189189 return result ;
190190 }
You can’t perform that action at this time.
0 commit comments