mirror of
https://github.com/apache/commons-csv.git
synced 2025-02-17 15:35:46 +00:00
Validation fails if no quotes mode set but no escape character is set.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1398148 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f51f43d184
commit
bdb5842eef
@ -199,6 +199,10 @@ public class CSVFormat implements Serializable {
|
||||
if (escape != null && escape == commentStart) {
|
||||
throw new IllegalStateException("The comment start and the escape character cannot be the same ('" + commentStart + "')");
|
||||
}
|
||||
|
||||
if (escape == null && quotePolicy == Quote.NONE) {
|
||||
throw new IllegalStateException("No quotes mode set but no escape character is set");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -153,6 +153,13 @@ public class CSVFormatTest {
|
||||
} catch (final IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
format.withQuoteChar('!').withQuotePolicy(Quote.NONE).validate();
|
||||
fail();
|
||||
} catch (final IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("boxing") // no need to worry about boxing here
|
||||
|
Loading…
x
Reference in New Issue
Block a user