Commit Graph

1806 Commits

Author SHA1 Message Date
Gary D. Gregory 50b7f79338 CSVRecord.get(String) throws IAE if the column is not mapped (does not exist). This is similar to what JDBC does in ResultSet. Add getBoolean(String) API and tests.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1509431 13f79535-47bb-0310-9956-ffa450edef68
2013-08-01 21:11:10 +00:00
Benedikt Ritter 412d05d166 Better throw a NoSuchElementException if no more elements are available because parser has been closed
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1509395 13f79535-47bb-0310-9956-ffa450edef68
2013-08-01 19:41:10 +00:00
Gary D. Gregory 7e63096d47 Javadoc.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1509368 13f79535-47bb-0310-9956-ffa450edef68
2013-08-01 18:24:37 +00:00
Gary D. Gregory 7aca6adc4c [LEGAL-175] Distribute sample files from www.ferc.gov for unit tests.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1509328 13f79535-47bb-0310-9956-ffa450edef68
2013-08-01 16:58:31 +00:00
Sebastian Bazley 86d488407b Ensure Closeable is closed
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1509264 13f79535-47bb-0310-9956-ffa450edef68
2013-08-01 14:42:35 +00:00
Sebastian Bazley efdcb376e8 Don't split ternary expression over two lines
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1509261 13f79535-47bb-0310-9956-ffa450edef68
2013-08-01 14:39:29 +00:00
Sebastian Bazley 4b57058ebb Remove doc for non-existent parameter
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1509260 13f79535-47bb-0310-9956-ffa450edef68
2013-08-01 14:38:17 +00:00
Sebastian Bazley 105f907767 CSV-78 Use Character instead of char for char fields except delimiter
Already done as part of CSV-99 etc.
Updated Javadoc to clarify that null can be used to disable settings

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1509239 13f79535-47bb-0310-9956-ffa450edef68
2013-08-01 14:02:20 +00:00
Sebastian Bazley cf764bc9ae Doc tweak
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1509232 13f79535-47bb-0310-9956-ffa450edef68
2013-08-01 13:45:35 +00:00
Gary D. Gregory 1d767ad946 Sort members.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1509231 13f79535-47bb-0310-9956-ffa450edef68
2013-08-01 13:43:17 +00:00
Gary D. Gregory f69ddb394a [CSV-99] Revert Builder implementation in CSVFormat. Update Javadoc.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1509216 13f79535-47bb-0310-9956-ffa450edef68
2013-08-01 13:05:25 +00:00
Gary D. Gregory fcc0d15c7b - Remove trailing spaces.
- Add missing final keywords.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1509069 13f79535-47bb-0310-9956-ffa450edef68
2013-08-01 02:04:27 +00:00
Gary D. Gregory 316a51f520 - Add some real world CSV files.
- Add a record API to get column values using an Enum.
- Throw a better exception when a resource is not found in a class loader for the parser.
- Replace some tabs with spaces.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1509068 13f79535-47bb-0310-9956-ffa450edef68
2013-08-01 02:03:33 +00:00
Gary D. Gregory 816c652997 Better example.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1509012 13f79535-47bb-0310-9956-ffa450edef68
2013-07-31 20:03:02 +00:00
Benedikt Ritter c0d91d205d Remove copy method. It is not needed since every withXxx() method returns a copy
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508966 13f79535-47bb-0310-9956-ffa450edef68
2013-07-31 17:43:14 +00:00
Gary D. Gregory 55eff9dcfa Use ch instead of c as a character var name.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508943 13f79535-47bb-0310-9956-ffa450edef68
2013-07-31 15:53:05 +00:00
Gary D. Gregory 7909a7c386 Fix boxing and unboxing warnings.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508940 13f79535-47bb-0310-9956-ffa450edef68
2013-07-31 15:51:20 +00:00
Gary D. Gregory 2b14b16d4b Fix NPE when format is null.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508938 13f79535-47bb-0310-9956-ffa450edef68
2013-07-31 15:48:54 +00:00
Gary D. Gregory a062477946 Use ch instead of c as a character var name.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508937 13f79535-47bb-0310-9956-ffa450edef68
2013-07-31 15:46:05 +00:00
Gary D. Gregory 9599bfe743 Document empty block. Formatting.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508936 13f79535-47bb-0310-9956-ffa450edef68
2013-07-31 15:43:33 +00:00
Gary D. Gregory e33dced746 Document empty block.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508935 13f79535-47bb-0310-9956-ffa450edef68
2013-07-31 15:42:36 +00:00
Gary D. Gregory 97d34575a1 Revert back to NOT skipping a record when withHeader is called with a non-empty array. Add skipHeaderRecord setting to CSVFormat and use when headers are initialized.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508933 13f79535-47bb-0310-9956-ffa450edef68
2013-07-31 15:39:57 +00:00
Gary D. Gregory e6759b8c10 Sort members.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508635 13f79535-47bb-0310-9956-ffa450edef68
2013-07-30 21:24:52 +00:00
Gary D. Gregory f881372d92 Validate that headers do not contain duplicates.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508618 13f79535-47bb-0310-9956-ffa450edef68
2013-07-30 20:44:15 +00:00
Gary D. Gregory 3320c53e27 Sort members.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508613 13f79535-47bb-0310-9956-ffa450edef68
2013-07-30 20:37:17 +00:00
Gary D. Gregory 1533facb19 When withHeader is set to any non-null value, the first record is the first <em>data</em> record, not the header record.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508612 13f79535-47bb-0310-9956-ffa450edef68
2013-07-30 20:36:12 +00:00
Gary D. Gregory 390800f288 Make org.apache.commons.csv.CSVFormat.getHeader() public and make it return a clone.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508585 13f79535-47bb-0310-9956-ffa450edef68
2013-07-30 19:32:40 +00:00
Gary D. Gregory 69997467d4 Refactor to only have minimal CSVParser constructors in favor of CSVParser factory methods for String, resource path, URL, and File. Update some tests to use the APIs.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508544 13f79535-47bb-0310-9956-ffa450edef68
2013-07-30 17:36:34 +00:00
Gary D. Gregory 61fdb7a03a Sort members.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508511 13f79535-47bb-0310-9956-ffa450edef68
2013-07-30 16:26:43 +00:00
Gary D. Gregory 21ed5b135c Better lvar name.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508510 13f79535-47bb-0310-9956-ffa450edef68
2013-07-30 16:25:30 +00:00
Gary D. Gregory f78b5a14ca Change CSVFormat#Iterable<CSVRecord> parse(final Reader in) to return a CSVParser, which is compatible since CSVParser implements Iterable<CSVRecord>. This allows a caller to end the parsing by calling CSVParser#close() or to use CSVParser in a Java 7 try-with-resources, without tracking a reader or input stream.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508509 13f79535-47bb-0310-9956-ffa450edef68
2013-07-30 16:22:07 +00:00
Gary D. Gregory 7af334d7d5 Allow a caller to close the parser before reading all records and free resources. The parser and lexer now implement java.io.Closeable.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508475 13f79535-47bb-0310-9956-ffa450edef68
2013-07-30 14:50:42 +00:00
Gary D. Gregory ee7335a2fc [CSV-99] Revert Builder implementation in CSVFormat.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508472 13f79535-47bb-0310-9956-ffa450edef68
2013-07-30 14:44:48 +00:00
Gary D. Gregory 75f39a81a7 [CSV-99] Revert Builder implementation in CSVFormat.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1508470 13f79535-47bb-0310-9956-ffa450edef68
2013-07-30 14:42:32 +00:00
Benedikt Ritter 7dbc976992 Better use maven.compiler.target instead of the old property (maven.compile.target)
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1504978 13f79535-47bb-0310-9956-ffa450edef68
2013-07-19 19:40:59 +00:00
Sebastian Bazley e2f4016729 downdate H2 database to version that supports Java 1.5
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1500492 13f79535-47bb-0310-9956-ffa450edef68
2013-07-07 17:37:33 +00:00
Benedikt Ritter 951f6d495e Update to latest commons parent pom
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1499858 13f79535-47bb-0310-9956-ffa450edef68
2013-07-04 20:23:07 +00:00
Benedikt Ritter db2594f404 Update to latest parent (although CP 32 is on the way :)
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1498005 13f79535-47bb-0310-9956-ffa450edef68
2013-06-29 19:04:41 +00:00
Benedikt Ritter 20721c5a3d Make sure an unmapped header returns null
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1498003 13f79535-47bb-0310-9956-ffa450edef68
2013-06-29 19:04:01 +00:00
Gary D. Gregory 1579c1786a Fix formatting.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1496236 13f79535-47bb-0310-9956-ffa450edef68
2013-06-24 22:18:23 +00:00
Sebastian Bazley d045a45f57 Clarify (hopefully) the Javadoc
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1496064 13f79535-47bb-0310-9956-ffa450edef68
2013-06-24 14:22:56 +00:00
Gary D. Gregory df4bd36e7b Javadoc.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1496024 13f79535-47bb-0310-9956-ffa450edef68
2013-06-24 13:13:57 +00:00
Sebastian Bazley ad0acc17e1 Javadoc fix
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1495965 13f79535-47bb-0310-9956-ffa450edef68
2013-06-24 09:15:27 +00:00
Gary D. Gregory b460ef6200 Add contants for [CSV-51] Support Unicode line separators.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1495914 13f79535-47bb-0310-9956-ffa450edef68
2013-06-24 03:27:03 +00:00
Gary D. Gregory d5cc0d8a7c Replace magic String with constant from Constants.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1495912 13f79535-47bb-0310-9956-ffa450edef68
2013-06-24 03:17:29 +00:00
Gary D. Gregory 5a0894f9e0 [CSV-93] Allow the handling of NULL values. Use a single property 'nullString' for both input and output processing. No substitutions occur if null. For reading, nullString is used to convert field values to null. For writing, nullString is used to output the given string instead of the empty string.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1495911 13f79535-47bb-0310-9956-ffa450edef68
2013-06-24 03:06:05 +00:00
Gary D. Gregory 530b038269 Fix possible NPE reported by FindBugs.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1495269 13f79535-47bb-0310-9956-ffa450edef68
2013-06-21 01:49:03 +00:00
Gary D. Gregory 93a07b9b8f Better param name.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1495268 13f79535-47bb-0310-9956-ffa450edef68
2013-06-21 01:46:26 +00:00
Gary D. Gregory 30579102f6 Update H2 used for tests to 1.3.172 from 1.3.168.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1495264 13f79535-47bb-0310-9956-ffa450edef68
2013-06-21 01:23:30 +00:00
Gary D. Gregory ab2e7eb504 - Add final modifier to method parameters.
- Add final modifier to local variables.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1495203 13f79535-47bb-0310-9956-ffa450edef68
2013-06-20 21:39:53 +00:00