[Filesystem] Method read() fixed 15/98715/1
authorSzymon Jastrzebski <s.jastrzebsk@partner.samsung.com>
Fri, 18 Nov 2016 10:11:53 +0000 (11:11 +0100)
committerSzymon Jastrzebski <s.jastrzebsk@partner.samsung.com>
Fri, 18 Nov 2016 10:11:53 +0000 (11:11 +0100)
[Feature] read() should throw an exception after reaching EOF
[Verification] TCT tests passed on wearable and mobile

Change-Id: I6d91c5fd7c40ed11ad4cefbd29eb753179eac925
Signed-off-by: Szymon Jastrzebski <s.jastrzebsk@partner.samsung.com>
src/filesystem/js/file_stream.js

index 2abc68ff83b557e5a466cad3f069af595ffbce4a..1d3f708b74d09b183ad55150bc65692422a2bf6b 100644 (file)
@@ -121,6 +121,9 @@ function read() {
     throw new WebAPIException(WebAPIException.INVALID_VALUES_ERR,
         'Argument "charCount" must be greater than 0');
   }
+  if(this.eof) {
+      throw new WebAPIException(WebAPIException.IO_ERR, 'Stream is marked as EOF.');
+  }
 
   var _count = this.bytesAvailable;