Skip to content
This repository was archived by the owner on Jun 3, 2026. It is now read-only.

Commit 5e7945e

Browse files
committed
Last of the Checkstyle fixes.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1383758 13f79535-47bb-0310-9956-ffa450edef68
1 parent 57a1aef commit 5e7945e

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/main/java/org/apache/commons/csv/CSVFormat.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff 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

src/main/java/org/apache/commons/csv/CSVLexer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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);

src/main/java/org/apache/commons/csv/CSVParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)