Commit d15ef976 authored by Summer Stapleton's avatar Summer Stapleton
Browse files

Reconfigured exception handling of an invalid control network entered into Jigsaw. Fixes #5068.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@7967 41f8697f-d340-4b68-9986-7bafba869bb8
parent 277c4684
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
 *   http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on
 *   http://www.usgs.gov/privacy.html.
 */

#include <ostream>
#include <cfloat>
#include <cmath>
@@ -36,6 +37,7 @@
#include "Application.h"
#include "CnetSuppression.h"
#include "CnetManager.h"
#include "IException.h"
#include "Progress.h"

#include "tnt/tnt_array2d.h"
@@ -70,11 +72,11 @@ namespace Isis {
                                   m_area() {

    Progress progress;
    try {
    m_cnet.reset(new ControlNet(cnetfile, &progress));

    if (!m_cnet->IsValid()) {
      QString msg = QString("Control Net filename [%1] is invalid.").arg(cnetfile);
      throw IException(IException::User, msg, _FILEINFO_);
    }
    catch (IException &e) {
      throw e;
    }

    m_points = m_cnet->take(); 
+2 −0
Original line number Diff line number Diff line
@@ -51,6 +51,8 @@ namespace Isis {
 * @internal 
 *   @history 2016-09-30 Kris Becker - Original Version
 *   @history 2016-12-28 Kristin Berry - Added documentation and tests for checkin
 *   @history 2017-08-09 Summer Stapleton - Added a try-catch in constructor to throw proper
 *                         error for invalid control net. Fixes #5068.
 * 
 */
  class CnetSuppression : public CnetManager {
+14 −8
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ void IsisMain() {
  
  BundleSettingsQsp settings = bundleSettings(ui);
  BundleAdjust *bundleAdjustment = NULL;
  try {
    // Get the held list if entered and prep for bundle adjustment
    if (ui.WasEntered("HELDLIST")) {
      QString heldList = ui.GetFileName("HELDLIST");
@@ -68,6 +69,11 @@ void IsisMain() {
    else {
      bundleAdjustment = new BundleAdjust(settings, cnetFile, cubeList);
    }
  }
  catch (IException &e) {
    throw;
  }


  // Bundle adjust the network
  try {
+3 −0
Original line number Diff line number Diff line
@@ -249,6 +249,9 @@
    <change name="Ken Edmundson" date="2017-01-17">
      Updated description and brief for SOLVETARGETBODY and TBPARAMETERS.
    </change>
    <change name="Summer Stapleton" date="2017-08-09">
      Fixed bug where an invalid control net was not throwing exception. Fixes #5068.
    </change>
  </history>

  <groups>
+17 −0
Original line number Diff line number Diff line
@@ -55,3 +55,20 @@ commands:
	then \
	  true; \
	fi;
# TEST F: CNET=[invalid control net file]
	echo -e "Error Test F:" >> $(OUTPUT)/error.txt;
	if [[ `$(APPNAME) \
	  fromlist=$(INPUT)/empty.lis \
	  cnet=$(INPUT)/notacnet.net \
	  onet=$(output)/out.net \
	  radius=yes \
	  spsolve=positions \
	  point_radius_sigma=500 \
	  spacecraft_position_sigma=500 \
	  camera_angles_sigma=2 \
	  2>> $(OUTPUT)/error.txt \
	  > /dev/null` ]]; \
	then \
	  true; \
	fi;
	
Loading