Skip to content
This repository has been archived by the owner on Jan 22, 2019. It is now read-only.

Commit

Permalink
Fix #33
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Mar 21, 2014
1 parent a4e7690 commit e7803a9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
2 changes: 2 additions & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Project: jackson-dataformat-csv
Version: 2.3.3 (xx-xxx-2014)

#33: CSV is written without column separators if first column is null
(reported by Paul M)
- Fix a minor problem with `CsvSchema` defaults: was setting default
escape char to be same as default quote (i.e. double-quote)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ public Version version() {
* (should we throw an exception instead?)
*/
@Override
public CsvGenerator useDefaultPrettyPrinter()
{
public CsvGenerator useDefaultPrettyPrinter() {
return this;
}

Expand Down Expand Up @@ -597,8 +596,7 @@ protected final void _verifyValueWrite(String typeMsg)
}

@Override
protected void _releaseBuffers()
{
protected void _releaseBuffers() {
_writer._releaseBuffers();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,10 @@ public void endRow() throws IOException
_lastBuffered = -1;
for (int i = _nextColumnToWrite; i <= last; ++i) {
BufferedValue value = _buffered[i];
if (value == null) { // missing value still needs separator
if (i > _nextColumnToWrite) {
appendColumnSeparator();
} else {
}
if (value != null) {
_buffered[i] = null;
value.write(this);
}
Expand Down Expand Up @@ -304,7 +305,7 @@ protected void appendValue(String value) throws IOException
_flushBuffer();
}
if (_nextColumnToWrite > 0) {
_outputBuffer[_outputTail++] = _cfgColumnSeparator;
appendColumnSeparator();
}
/* First: determine if we need quotes; simple heuristics;
* only check for short Strings, stop if something found
Expand Down Expand Up @@ -382,14 +383,11 @@ protected void appendValue(boolean value) throws IOException
_outputTail += len;
}

protected void appendColumnSeparator() throws IOException
{
if (_nextColumnToWrite > 0) {
if (_outputTail >= _outputTail) {
_flushBuffer();
}
_outputBuffer[_outputTail++] = _cfgColumnSeparator;
protected void appendColumnSeparator() throws IOException {
if (_outputTail >= _outputTail) {
_flushBuffer();
}
_outputBuffer[_outputTail++] = _cfgColumnSeparator;
}

/*
Expand Down

0 comments on commit e7803a9

Please sign in to comment.