소스 검색

HPCC-8000 Improve error message when cannot open a file.

It appears to be possible for file->exists() to succeed, but file->size()
to return -1.  This patch changes the error message to indicate the file
couldn't e read instead of complaining it was > 4Gb.

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 12 년 전
부모
커밋
9323d5cd9c
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      ecl/hql/hqlexpr.cpp

+ 3 - 0
ecl/hql/hqlexpr.cpp

@@ -7161,6 +7161,9 @@ void CFileContents::ensureLoaded()
         throw MakeStringException(1, "File %s could not be opened", file->queryFilename());
         throw MakeStringException(1, "File %s could not be opened", file->queryFilename());
 
 
     offset_t size = io->size();
     offset_t size = io->size();
+    if (size == (offset_t)-1)
+        throw MakeStringException(1, "File %s could not be read", file->queryFilename());
+
     size32_t sizeToRead = (size32_t)size;
     size32_t sizeToRead = (size32_t)size;
     if (sizeToRead != size)
     if (sizeToRead != size)
         throw MakeStringException(1, "File %s is larger than 4Gb", file->queryFilename());
         throw MakeStringException(1, "File %s is larger than 4Gb", file->queryFilename());