From 29d93b9c9204621ca7f9436f6daf07936ae3f04e Mon Sep 17 00:00:00 2001 From: Vladimir Weinstein Date: Fri, 16 Jun 2006 05:45:50 +0000 Subject: [PATCH] ICU-5231 More robust reading of UCA test file for threading test X-SVN-Rev: 19728 --- icu4c/source/test/intltest/tsmthred.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/icu4c/source/test/intltest/tsmthred.cpp b/icu4c/source/test/intltest/tsmthred.cpp index 35dd739910..58f6356e75 100644 --- a/icu4c/source/test/intltest/tsmthred.cpp +++ b/icu4c/source/test/intltest/tsmthred.cpp @@ -1321,7 +1321,7 @@ void MultithreadTest::TestCollators() while (fgets(buffer, 1024, testFile) != NULL) { offset = 0; - if(*buffer == 0 || buffer[0] == '#') { + if(*buffer == 0 || strlen(buffer) < 3 || buffer[0] == '#') { continue; } offset = u_parseString(buffer, bufferU, 1024, &first, &status); @@ -1333,8 +1333,10 @@ void MultithreadTest::TestCollators() lineNum++; } fclose(testFile); - - + if(U_FAILURE(status)) { + errln("Couldn't read the test file!"); + return; + } UCollator *coll = ucol_open("root", &status); if(U_FAILURE(status)) {