瀏覽代碼

catch block for writeBytes

Renato Golin 13 年之前
父節點
當前提交
b18cb39707
共有 2 個文件被更改,包括 8 次插入2 次删除
  1. 7 1
      roxie/roxieclient/roxieclient.cpp
  2. 1 1
      system/jlib/jstream.cpp

+ 7 - 1
roxie/roxieclient/roxieclient.cpp

@@ -95,7 +95,13 @@ int CDataOutputCache::writeOutput()
             finger = strchr(obuf+9, '\0') + 1;
             len -= (finger-obuf);
         }
-        outputstream->writeBytes(finger, len);
+        try {
+            outputstream->writeBytes(finger, len);
+        }
+        catch (IException *e) {
+            delete mb;
+            throw;
+        }
 
 #ifdef DEBUG_ROXIECLIENT_
         DBGLOG("Written %d bytes to output %s", len, name.str());

+ 1 - 1
system/jlib/jstream.cpp

@@ -229,7 +229,7 @@ void CFileOutputStream::writeBytes(const void *b, int len)
     if (written < 0)
         throw MakeStringException(-1, "Error while writing %d bytes\n", len);
     if (written != len)
-        throw MakeStringException(-1, "Truncated (%d) while writing %d bytes\n", written, len);
+        throw MakeStringException(-1, "Truncated (%d) while writing %d bytes\n", written, (int)len);
 }
 
 extern jlib_decl IByteOutputStream *createOutputStream(int handle)