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) {
|
if (escape != null && escape == commentStart) {
|
||||||
throw new IllegalStateException("The comment start and the escape character cannot be the same ('" + 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,7 +153,14 @@ public class CSVFormatTest {
|
||||||
} catch (final IllegalStateException e) {
|
} catch (final IllegalStateException e) {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
try {
|
||||||
|
format.withQuoteChar('!').withQuotePolicy(Quote.NONE).validate();
|
||||||
|
fail();
|
||||||
|
} catch (final IllegalStateException e) {
|
||||||
|
// expected
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("boxing") // no need to worry about boxing here
|
@SuppressWarnings("boxing") // no need to worry about boxing here
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue