Loading isis/src/base/apps/ascii2isis/ascii2isis.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -116,11 +116,24 @@ void ascii2isis(Buffer &out) { } fin >> out[i]; // If we've reached the end of file and stream is bad, we didn't find enough numerical data if (!fin && fin.eof()) { QString msg = "End of file reached. There is not enough data in [" + from; msg += "] to fill the output cube."; throw IException(IException::User, msg, _FILEINFO_); } // Check if there was an issue extracting a double if (!fin) { // Clean stream to get the position and invalid data that broke the stream fin.clear(); QString msg = "Could not extract non-numerical data [" + QString(fin.peek()) + "] "; msg += "at byte position [" + QString::number(fin.tellg()) + "]. "; msg += "Please make sure to skip any header data in [" + from + "]."; throw IException(IException::User, msg, _FILEINFO_); } out[i] = TestSpecial(out[i]); } } Loading isis/src/base/apps/ascii2isis/ascii2isis.xml +6 −2 Original line number Diff line number Diff line Loading @@ -26,10 +26,14 @@ <change name="Steven Koechle" date="2008-08-30"> Added ability to change special pixel ranges. Added example. </change> <change name="Makayla Shepherd" data="2015-07-15"> Fixed a problem with non-numeric cahracters in the file which resulted ascii2isis <change name="Makayla Shepherd" date="2015-07-15"> Fixed a problem with non-numeric characters in the file which resulted ascii2isis hanging. Fixes #2066. </change> <change name="Ian Humphrey" date="2017-03-16"> Added an error message when the reading fails if the file header isn't skipped. Fixes #4596. </change> </history> Loading isis/src/base/apps/ascii2isis/tsts/errors/Makefile 0 → 100644 +21 −0 Original line number Diff line number Diff line APPNAME = ascii2isis include $(ISISROOT)/make/isismake.tsts commands: # TEST A: Broken stream when not skipping header. echo -e "Error Test A: " > $(OUTPUT)/error_temp.txt; if [[ `$(APPNAME) \ from=$(INPUT)/input.txt \ to=$(OUTPUT)/output.cub \ lines=3 \ samples=3 \ 2>> $(OUTPUT)/error_temp.txt \ > /dev/null` ]]; \ then \ true; \ fi; $(SED) 's+\[/.*/input/+\[input/+' $(OUTPUT)/error_temp.txt > $(OUTPUT)/error.txt; $(RM) $(OUTPUT)/error_temp.txt; $(RM) $(OUTPUT)/output.cub; Loading
isis/src/base/apps/ascii2isis/ascii2isis.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -116,11 +116,24 @@ void ascii2isis(Buffer &out) { } fin >> out[i]; // If we've reached the end of file and stream is bad, we didn't find enough numerical data if (!fin && fin.eof()) { QString msg = "End of file reached. There is not enough data in [" + from; msg += "] to fill the output cube."; throw IException(IException::User, msg, _FILEINFO_); } // Check if there was an issue extracting a double if (!fin) { // Clean stream to get the position and invalid data that broke the stream fin.clear(); QString msg = "Could not extract non-numerical data [" + QString(fin.peek()) + "] "; msg += "at byte position [" + QString::number(fin.tellg()) + "]. "; msg += "Please make sure to skip any header data in [" + from + "]."; throw IException(IException::User, msg, _FILEINFO_); } out[i] = TestSpecial(out[i]); } } Loading
isis/src/base/apps/ascii2isis/ascii2isis.xml +6 −2 Original line number Diff line number Diff line Loading @@ -26,10 +26,14 @@ <change name="Steven Koechle" date="2008-08-30"> Added ability to change special pixel ranges. Added example. </change> <change name="Makayla Shepherd" data="2015-07-15"> Fixed a problem with non-numeric cahracters in the file which resulted ascii2isis <change name="Makayla Shepherd" date="2015-07-15"> Fixed a problem with non-numeric characters in the file which resulted ascii2isis hanging. Fixes #2066. </change> <change name="Ian Humphrey" date="2017-03-16"> Added an error message when the reading fails if the file header isn't skipped. Fixes #4596. </change> </history> Loading
isis/src/base/apps/ascii2isis/tsts/errors/Makefile 0 → 100644 +21 −0 Original line number Diff line number Diff line APPNAME = ascii2isis include $(ISISROOT)/make/isismake.tsts commands: # TEST A: Broken stream when not skipping header. echo -e "Error Test A: " > $(OUTPUT)/error_temp.txt; if [[ `$(APPNAME) \ from=$(INPUT)/input.txt \ to=$(OUTPUT)/output.cub \ lines=3 \ samples=3 \ 2>> $(OUTPUT)/error_temp.txt \ > /dev/null` ]]; \ then \ true; \ fi; $(SED) 's+\[/.*/input/+\[input/+' $(OUTPUT)/error_temp.txt > $(OUTPUT)/error.txt; $(RM) $(OUTPUT)/error_temp.txt; $(RM) $(OUTPUT)/output.cub;