@@ -267,8 +267,8 @@ public CsvDecoder(CsvParser owner, IOContext ctxt, Reader r, CsvSchema schema,
267267 _inputSource = r ;
268268 _textBuffer = textBuffer ;
269269 _autoCloseInput = JsonParser .Feature .AUTO_CLOSE_SOURCE .enabledIn (stdFeatures );
270- final boolean legacy = JsonParser .Feature .ALLOW_YAML_COMMENTS .enabledIn (stdFeatures );
271- _allowComments = legacy | CsvParser .Feature .ALLOW_COMMENTS .enabledIn (csvFeatures );
270+ final boolean oldComments = JsonParser .Feature .ALLOW_YAML_COMMENTS .enabledIn (stdFeatures );
271+ _allowComments = oldComments | CsvParser .Feature .ALLOW_COMMENTS .enabledIn (csvFeatures );
272272 _trimSpaces = CsvParser .Feature .TRIM_SPACES .enabledIn (csvFeatures );
273273 _skipBlankLines = CsvParser .Feature .SKIP_EMPTY_LINES .enabledIn (csvFeatures );
274274 _inputBuffer = ctxt .allocTokenBuffer ();
@@ -284,7 +284,9 @@ public void setSchema(CsvSchema schema)
284284 _separatorChar = schema .getColumnSeparator ();
285285 _quoteChar = schema .getQuoteChar ();
286286 _escapeChar = schema .getEscapeChar ();
287- _allowComments = _allowComments | schema .allowsComments ();
287+ if (!_allowComments ) {
288+ _allowComments = schema .allowsComments ();
289+ }
288290 int max = Math .max (_separatorChar , _quoteChar );
289291 max = Math .max (max , _escapeChar );
290292 max = Math .max (max , '\r' );
@@ -298,6 +300,12 @@ public void setSchema(CsvSchema schema)
298300 public void overrideFormatFeatures (int csvFeatures ) {
299301 _trimSpaces = CsvParser .Feature .TRIM_SPACES .enabledIn (csvFeatures );
300302 _skipBlankLines = CsvParser .Feature .SKIP_EMPTY_LINES .enabledIn (csvFeatures );
303+
304+ // 07-Oct-2019, tatu: not 100% accurate, as we have no access to legacy
305+ // setting. But close enough, fixed in 3.0
306+ if (CsvParser .Feature .ALLOW_COMMENTS .enabledIn (csvFeatures )) {
307+ _allowComments = true ;
308+ }
301309 }
302310
303311 /*
0 commit comments