File.readLine() broken, returns null on empty lines.
book
Article ID: KB0085876
calendar_today
Updated On:
Products
Versions
TIBCO BusinessEvents Enterprise Edition
-
Not Applicable
-
Description
Description: The catalog function File.readLine() returns null when it encounters the first empty line in a file. The file is terminated with CRLF (0x0D, 0x0A). This causes a for next loop break on the first empty line of the input file. File.readLine() should return null only when the end of file (EOF) is reached.
This terminates not when encountering the end-of-file as it should and
did with previous versions, but on the first empty line. Note that
checking line2==null is the only way to check if you encounter the
end-of-file, since there is no function like "File.isEOF()"
Symptoms: File.readLine() returns null when it encouters the first empty line in a file. Cause: Product issue (CR BE-21025)
Resolution
CR BE-21025 has been fixed in TIBCO BusinessEvents 5.1.3HF1
NOTE: Catalog function works in previous versions - issue occurs in 5.1.3 (base) only
As a workaround, use the catalog function File.readFileAsString().
Example:
String sFile= File.readFileAsString("<filename>"); String [] s1=split(sFile,"\n"); for (int i=0;i<s1@length;i++) { System.debugOut("### line[" + i +"]:"+ s1[i]); }
Issue/Introduction
File.readLine() broken, returns null on empty lines.