Commit 4c03e99a authored by Cole Neubauer's avatar Cole Neubauer Committed by Makayla Shepherd
Browse files

Changed Nomenclature Tool to use latest URL and added error checking for 301 response. Fixes #4963

parent 348f3688
Loading
Loading
Loading
Loading
+21 −15
Original line number Original line Diff line number Diff line
@@ -37,7 +37,7 @@ namespace Isis {


    m_request = new QNetworkRequest;
    m_request = new QNetworkRequest;
    m_request->setUrl(
    m_request->setUrl(
        QUrl("http://planetarynames.wr.usgs.gov/nomenclature/SearchResults"));
        QUrl("https://planetarynames.wr.usgs.gov/nomenclature/SearchResults"));
    m_request->setRawHeader("User-Agent",
    m_request->setRawHeader("User-Agent",
                            "Mozilla/5.0 (X11; Linux i686; rv:6.0) "
                            "Mozilla/5.0 (X11; Linux i686; rv:6.0) "
                            "Gecko/20100101 Firefox/6.0");
                            "Gecko/20100101 Firefox/6.0");
@@ -817,6 +817,12 @@ namespace Isis {
          }
          }
        }
        }
      }
      }
      else if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 301) {
        IString msg = "The URL has been permanently moved to " +
                      reply->attribute(QNetworkRequest::RedirectionTargetAttribute)
                      .toUrl().toString();
        throw IException(IException::Programmer, msg, _FILEINFO_);
      }
      else {
      else {
      QMessageBox::warning(NULL, "Failed to read nomenclature database result",
      QMessageBox::warning(NULL, "Failed to read nomenclature database result",
                           "An error occurred when parsing the data sent back "
                           "An error occurred when parsing the data sent back "
+7 −4
Original line number Original line Diff line number Diff line
@@ -44,6 +44,9 @@ namespace Isis {
   *                           1) queryFeatures(), which makes sure the longitude range is between
   *                           1) queryFeatures(), which makes sure the longitude range is between
   *                           0 and 360 and that it is in the 360 domain, and calls the request
   *                           0 and 360 and that it is in the 360 domain, and calls the request
   *                           method, and 2) runQuery(), which makes the request. Fixes #958.
   *                           method, and 2) runQuery(), which makes the request. Fixes #958.
   *   @history 2018-01-05 Cole Neubauer - The URL for request was moved. Updated the URL to the
   *                           new URL and added an error to be thrown if it is moved again
   *                           Fixes #4963.
   */
   */
  class FeatureNomenclature : public QObject {
  class FeatureNomenclature : public QObject {
      Q_OBJECT
      Q_OBJECT