[CSV-248] CSVRecord is not Serializable.
Make field transient.
This commit is contained in:
parent
07101a99bc
commit
e3eca25d13
|
@ -48,6 +48,7 @@
|
||||||
<action issue="CSV-245" type="fix" dev="ggregory" due-to="Alex Herbert">Post 1.7 release fixes.</action>
|
<action issue="CSV-245" type="fix" dev="ggregory" due-to="Alex Herbert">Post 1.7 release fixes.</action>
|
||||||
<action issue="CSV-252" type="fix" dev="ggregory" due-to= "Alex Herbert">Upgrade test framework to JUnit 5 Jupiter #49, #50.</action>
|
<action issue="CSV-252" type="fix" dev="ggregory" due-to= "Alex Herbert">Upgrade test framework to JUnit 5 Jupiter #49, #50.</action>
|
||||||
<action issue="CSV-247" type="fix" dev="ggregory" due-to="Alex Herbert, Gary Gregory">A single empty header is allowed when not allowing empty column headers. #47.</action>
|
<action issue="CSV-247" type="fix" dev="ggregory" due-to="Alex Herbert, Gary Gregory">A single empty header is allowed when not allowing empty column headers. #47.</action>
|
||||||
|
<action issue="CSV-248" type="fix" dev="ggregory" due-to="Alex Herbert">CSVRecord is not Serializable.</action>
|
||||||
<action type="fix" dev="ggregory" due-to="Alex Herbert">Use test scope for supercsv #48.</action>
|
<action type="fix" dev="ggregory" due-to="Alex Herbert">Use test scope for supercsv #48.</action>
|
||||||
<action type="update" dev="ggregory" due-to="Gary Gregory">Update tests from H2 1.4.199 to 1.4.200.</action>
|
<action type="update" dev="ggregory" due-to="Gary Gregory">Update tests from H2 1.4.199 to 1.4.200.</action>
|
||||||
<action type="update" dev="ggregory" due-to="Gary Gregory">Update tests from Hamcrest 2.1 to 2.2.</action>
|
<action type="update" dev="ggregory" due-to="Gary Gregory">Update tests from Hamcrest 2.1 to 2.2.</action>
|
||||||
|
|
|
@ -46,7 +46,7 @@ public final class CSVRecord implements Serializable, Iterable<String> {
|
||||||
private final String[] values;
|
private final String[] values;
|
||||||
|
|
||||||
/** The parser that originates this record. */
|
/** The parser that originates this record. */
|
||||||
private final CSVParser parser;
|
private final transient CSVParser parser;
|
||||||
|
|
||||||
CSVRecord(final CSVParser parser, final String[] values, final String comment, final long recordNumber,
|
CSVRecord(final CSVParser parser, final String[] values, final String comment, final long recordNumber,
|
||||||
final long characterPosition) {
|
final long characterPosition) {
|
||||||
|
|
|
@ -23,7 +23,9 @@ import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -58,7 +60,7 @@ public class CSVRecordTest {
|
||||||
headerMap = parser.getHeaderMap();
|
headerMap = parser.getHeaderMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetInt() {
|
public void testGetInt() {
|
||||||
assertEquals(values[0], record.get(0));
|
assertEquals(values[0], record.get(0));
|
||||||
|
@ -184,6 +186,18 @@ public class CSVRecordTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSerialization() throws IOException {
|
||||||
|
CSVRecord shortRec;
|
||||||
|
try (final CSVParser parser = CSVParser.parse("a,b", CSVFormat.newFormat(','))) {
|
||||||
|
shortRec = parser.iterator().next();
|
||||||
|
}
|
||||||
|
final ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
|
try (ObjectOutputStream oos = new ObjectOutputStream(out)) {
|
||||||
|
oos.writeObject(shortRec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testToMap() {
|
public void testToMap() {
|
||||||
final Map<String, String> map = this.recordWithHeader.toMap();
|
final Map<String, String> map = this.recordWithHeader.toMap();
|
||||||
|
|
Loading…
Reference in New Issue