Skip to content

Commit c43e8fa

Browse files
committed
Remove fallback logic for charset parameter
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1519269 13f79535-47bb-0310-9956-ffa450edef68
1 parent 724c88d commit c43e8fa

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,18 @@ public static CSVParser parse(String string, final CSVFormat format) throws IOEx
143143
* @param url
144144
* a URL. Must not be null.
145145
* @param charset
146-
* the charset for the resource, if {@code null}, uses {@code UTF-8}. UTF-8 is one of the encodings
147-
* required by the Java specification.
146+
* the charset for the resource. Must not be null.
148147
* @param format
149148
* the CSVFormat used for CSV parsing. Must not be null.
150149
* @return a new parser
151150
* @throws IllegalArgumentException
152-
* If the parameters of the format are inconsistent or if either url or format are null.
151+
* If the parameters of the format are inconsistent or if either url, charset or format are null.
153152
* @throws IOException
154153
* If an I/O error occurs
155154
*/
156155
public static CSVParser parse(URL url, Charset charset, final CSVFormat format) throws IOException {
157156
Assertions.notNull(url, "url");
157+
Assertions.notNull(charset, "charset");
158158
Assertions.notNull(format, "format");
159159

160160
return new CSVParser(new InputStreamReader(url.openStream(),

src/test/java/org/apache/commons/csv/CSVParserTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,11 @@ public void testParseNullUrlCharsetFormat() throws Exception {
749749
CSVParser.parse(null, Charset.defaultCharset(), CSVFormat.DEFAULT);
750750
}
751751

752+
@Test(expected = IllegalArgumentException.class)
753+
public void testParserUrlNullCharsetFormat() throws Exception {
754+
CSVParser.parse(new URL("http://commons.apache.org"), null, CSVFormat.DEFAULT);
755+
}
756+
752757
@Test(expected = IllegalArgumentException.class)
753758
public void testParseUrlCharsetNullFormat() throws Exception {
754759
CSVParser.parse(new URL("http://commons.apache.org"), Charset.defaultCharset(), null);

0 commit comments

Comments
 (0)