Uploaded image for project: 'Commons CSV'
  1. Commons CSV
  2. CSV-150

Escaping is not disableable

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.1
    • Review
    • Parser
    • None

    Description

      Problem

      If escaping is disabled the Lexer maps the NULL Character to the magic char '\ufffe'. I currently hit this char randomly with data. This leads to a RuntimeException inside of org.apache.commons.csv.Lexer.parseEncapsulatedToken(Token) with the message "invalid char between encapsulated token and delimiter".

      Solution

      Don't map the Character object and use it.

      Lexer.java
          Lexer(final CSVFormat format, final ExtendedBufferedReader reader) {
              this.reader = reader;
              this.delimiter = format.getDelimiter();
              this.escape = format.getEscapeCharacter();
              .
              .
              .
          }
      
          boolean isEscape(final int ch) {
              return null != this.escape && escape.charValue() == ch;
          }
      
      Hint

      This pattern is used in other cases to. It seem to be a systematic error. This cases should be refactored also.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            geo Georg Tsakumagos

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 10m
                1h 10m

                Slack

                  Issue deployment