Code Fix for DVPL-2678 and add unittest

fix DVPL-2678: unhandled exception when reading result stream