{"action":"closed","issue":{"url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues/4399","repository_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang","labels_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues/4399/labels{/name}","comments_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues/4399/comments","events_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues/4399/events","html_url":"https://github.com/ballerina-platform/ballerina-lang/issues/4399","id":287188685,"number":4399,"title":"Empty string returned after the last record is read","user":{"login":"pamod","id":3785198,"avatar_url":"https://avatars2.githubusercontent.com/u/3785198?v=4","gravatar_id":"","url":"https://api.github.com/users/pamod","html_url":"https://github.com/pamod","followers_url":"https://api.github.com/users/pamod/followers","following_url":"https://api.github.com/users/pamod/following{/other_user}","gists_url":"https://api.github.com/users/pamod/gists{/gist_id}","starred_url":"https://api.github.com/users/pamod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pamod/subscriptions","organizations_url":"https://api.github.com/users/pamod/orgs","repos_url":"https://api.github.com/users/pamod/repos","events_url":"https://api.github.com/users/pamod/events{/privacy}","received_events_url":"https://api.github.com/users/pamod/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-01-09T18:38:50Z","updated_at":"2018-04-12T03:01:08Z","closed_at":"2018-04-12T03:01:08Z","author_association":"CONTRIBUTOR","body":"**Description:**\r\nOnce the final record is read, when querying the I/O record API an empty string is returned\r\n\r\n**Steps to reproduce:**\r\n\r\nRunning the below function will result in returning a record with an empty string.\r\n\r\n```\r\nfunction main (string[] args) {\r\n    io:TextRecordChannel recordChannel = getFileRecordChannel(\"./sample.csv\", \"rw\", \"UTF-8\", \"\\n\", \",\");\r\n\r\n    int numberOfFields = -1;\r\n    while (numberOfFields != 0) {\r\n        string[] fields = recordChannel.readTextRecord();\r\n        numberOfFields = lengthof fields;\r\n        println(fields);\r\n    }\r\n}\r\n\r\nfunction getFileRecordChannel (string filePath, string permission, string encoding,\r\n                               string rs, string fs) (io:TextRecordChannel) {\r\n    file:File src = {path:filePath};\r\n    io:ByteChannel channel = src.openChannel(permission);\r\n    io:CharacterChannel characterChannel = channel.toCharacterChannel(encoding);\r\n    io:TextRecordChannel textRecordChannel = characterChannel.toTextRecordChannel(rs, fs);\r\n    return textRecordChannel;\r\n}\r\n```\r\n\r\n\r\n**Suggested Labels (optional):**\r\ntype/bug\r\n\r\n**Suggested Assignees (optional):**\r\npamod\r\n"}}
{"actor":{"display_login":"pamod"}}