From 72c2061b6643eab1960aad871e8343ee366a884a Mon Sep 17 00:00:00 2001
From: Stuart Campbell <campbellsi@ornl.gov>
Date: Wed, 14 Dec 2011 17:29:48 -0500
Subject: [PATCH] refs #3868. catch exceptions by reference.

---
 Code/Mantid/Framework/Algorithms/src/CorrectToFile.cpp    | 2 +-
 .../Algorithms/src/CuboidGaugeVolumeAbsorption.cpp        | 2 +-
 .../Algorithms/src/FilterEventsHighFrequency.cpp          | 2 +-
 Code/Mantid/Framework/Algorithms/src/FlatBackground.cpp   | 2 +-
 .../Framework/Algorithms/src/HRPDSlabCanAbsorption.cpp    | 2 +-
 .../Framework/Algorithms/src/MedianDetectorTest.cpp       | 2 +-
 .../Framework/Algorithms/src/NormaliseToMonitor.cpp       | 2 +-
 Code/Mantid/Framework/Algorithms/src/Regroup.cpp          | 2 +-
 Code/Mantid/Framework/Algorithms/src/UnwrapSNS.cpp        | 2 +-
 Code/Mantid/Framework/Algorithms/test/AlphaCalcTest.h     | 4 ++--
 .../Framework/Algorithms/test/BinaryOperateMasksTest.h    | 6 +++---
 .../Framework/Algorithms/test/CalMuonDeadTimeTest.h       | 2 +-
 .../Framework/Algorithms/test/MuonAsymmetryCalcTest.h     | 2 +-
 .../Framework/Algorithms/test/MuonRemoveExpDecayTest.h    | 4 ++--
 Code/Mantid/Framework/Algorithms/test/RemoveBinsTest.h    | 8 ++++----
 15 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/Code/Mantid/Framework/Algorithms/src/CorrectToFile.cpp b/Code/Mantid/Framework/Algorithms/src/CorrectToFile.cpp
index 9c80708149f..601531cbb6a 100644
--- a/Code/Mantid/Framework/Algorithms/src/CorrectToFile.cpp
+++ b/Code/Mantid/Framework/Algorithms/src/CorrectToFile.cpp
@@ -201,7 +201,7 @@ void CorrectToFile::doWkspAlgebra(API::MatrixWorkspace_sptr lhs, API::MatrixWork
   {
     algebra->execute();
   }
-  catch(std::runtime_error)
+  catch(std::runtime_error &)
   {
     g_log.warning() << "Error encountered while running algorithm " << algName << std::endl;
     g_log.error() << "Correction file " << getPropertyValue("Filename") + " can't be used to correct workspace " << getPropertyValue("WorkspaceToCorrect") << std::endl;
diff --git a/Code/Mantid/Framework/Algorithms/src/CuboidGaugeVolumeAbsorption.cpp b/Code/Mantid/Framework/Algorithms/src/CuboidGaugeVolumeAbsorption.cpp
index 9bdf3157132..fdfd4a13cec 100644
--- a/Code/Mantid/Framework/Algorithms/src/CuboidGaugeVolumeAbsorption.cpp
+++ b/Code/Mantid/Framework/Algorithms/src/CuboidGaugeVolumeAbsorption.cpp
@@ -55,7 +55,7 @@ void CuboidGaugeVolumeAbsorption::initialiseCachedDistances()
   try
   {
     FlatPlateAbsorption::initialiseCachedDistances();
-  } catch (Exception::InstrumentDefinitionError) {
+  } catch (Exception::InstrumentDefinitionError &) {
     // Create and throw a new exception with a more specific message
     throw Exception::InstrumentDefinitionError(
         "This algorithm requires that the sample fully encloses the requested gauge volume.");
diff --git a/Code/Mantid/Framework/Algorithms/src/FilterEventsHighFrequency.cpp b/Code/Mantid/Framework/Algorithms/src/FilterEventsHighFrequency.cpp
index bbfc7fcba3b..de45719bd33 100644
--- a/Code/Mantid/Framework/Algorithms/src/FilterEventsHighFrequency.cpp
+++ b/Code/Mantid/Framework/Algorithms/src/FilterEventsHighFrequency.cpp
@@ -271,7 +271,7 @@ namespace Algorithms
 
       ifs.close();
 
-    } catch (std::ifstream::failure e){
+    } catch (std::ifstream::failure & e){
       // b. Using faking offset/calibration
       g_log.error() << "Open calibration/offset file " << calfilename << " error " << std::endl;
       g_log.notice() << "Using fake detector offset/calibration" << std::endl;
diff --git a/Code/Mantid/Framework/Algorithms/src/FlatBackground.cpp b/Code/Mantid/Framework/Algorithms/src/FlatBackground.cpp
index 68e3b14aa77..096cdc886b9 100644
--- a/Code/Mantid/Framework/Algorithms/src/FlatBackground.cpp
+++ b/Code/Mantid/Framework/Algorithms/src/FlatBackground.cpp
@@ -178,7 +178,7 @@ void FlatBackground::exec()
         }
       }
     }
-    catch (std::exception)
+    catch (std::exception &)
     {
       g_log.error() << "Error processing the spectrum with index " << currentSpec << std::endl;
       throw;
diff --git a/Code/Mantid/Framework/Algorithms/src/HRPDSlabCanAbsorption.cpp b/Code/Mantid/Framework/Algorithms/src/HRPDSlabCanAbsorption.cpp
index 21ffe483e5f..7f375a32582 100644
--- a/Code/Mantid/Framework/Algorithms/src/HRPDSlabCanAbsorption.cpp
+++ b/Code/Mantid/Framework/Algorithms/src/HRPDSlabCanAbsorption.cpp
@@ -124,7 +124,7 @@ void HRPDSlabCanAbsorption::exec()
     try
     {
       det = workspace->getDetector(i);
-    } catch (Exception::NotFoundError)
+    } catch (Exception::NotFoundError &)
     {
       // Catch when a spectrum doesn't have an attached detector and go to next one
       continue;
diff --git a/Code/Mantid/Framework/Algorithms/src/MedianDetectorTest.cpp b/Code/Mantid/Framework/Algorithms/src/MedianDetectorTest.cpp
index edcea7d80e2..dcb389a4751 100644
--- a/Code/Mantid/Framework/Algorithms/src/MedianDetectorTest.cpp
+++ b/Code/Mantid/Framework/Algorithms/src/MedianDetectorTest.cpp
@@ -203,7 +203,7 @@ namespace Mantid
         }
       }
       //catch all exceptions because the solid angle calculation is optional
-      catch(std::exception e)
+      catch(std::exception & e)
       {
         g_log.warning(
             "Precision warning:  Can't find detector geometry " + name() +
diff --git a/Code/Mantid/Framework/Algorithms/src/NormaliseToMonitor.cpp b/Code/Mantid/Framework/Algorithms/src/NormaliseToMonitor.cpp
index af8e3c78b1e..7580a51d646 100644
--- a/Code/Mantid/Framework/Algorithms/src/NormaliseToMonitor.cpp
+++ b/Code/Mantid/Framework/Algorithms/src/NormaliseToMonitor.cpp
@@ -260,7 +260,7 @@ void NormaliseToMonitor::checkProperties(API::MatrixWorkspace_sptr inputWorkspac
       g_log.warning("The spectrum in MonitorWorkspace does not refer to a monitor.\n"
                     "Continuing with normalisation regardless.");
     }
-  } catch (Kernel::Exception::NotFoundError) {
+  } catch (Kernel::Exception::NotFoundError &) {
     g_log.warning("Unable to check if the spectrum provided relates to a monitor - "
                   "the instrument is not fully specified.\n"
                   "Continuing with normalisation regardless.");
diff --git a/Code/Mantid/Framework/Algorithms/src/Regroup.cpp b/Code/Mantid/Framework/Algorithms/src/Regroup.cpp
index 3c34c1200af..adfb629a743 100644
--- a/Code/Mantid/Framework/Algorithms/src/Regroup.cpp
+++ b/Code/Mantid/Framework/Algorithms/src/Regroup.cpp
@@ -131,7 +131,7 @@ void Regroup::exec()
     if (inputW->getAxis(1)->unit().get())
       outputW->getAxis(1)->unit() = inputW->getAxis(1)->unit();
    }
-  catch(Exception::IndexError) {
+  catch(Exception::IndexError &) {
     // OK, so this isn't a Workspace2D
   }
 
diff --git a/Code/Mantid/Framework/Algorithms/src/UnwrapSNS.cpp b/Code/Mantid/Framework/Algorithms/src/UnwrapSNS.cpp
index 753bde0f609..e4071a111cb 100644
--- a/Code/Mantid/Framework/Algorithms/src/UnwrapSNS.cpp
+++ b/Code/Mantid/Framework/Algorithms/src/UnwrapSNS.cpp
@@ -309,7 +309,7 @@ double UnwrapSNS::calculateFlightpath(const int& spectrum, bool& isMonitor) cons
       Ld = det->getDistance(*(m_inputWS->getInstrument()->getSource()));
     }
   }
-  catch (Exception::NotFoundError)
+  catch (Exception::NotFoundError &)
   {
     // If the detector information is missing, return a negative number
   }
diff --git a/Code/Mantid/Framework/Algorithms/test/AlphaCalcTest.h b/Code/Mantid/Framework/Algorithms/test/AlphaCalcTest.h
index 28f8404a74f..80b2f9d2ac0 100644
--- a/Code/Mantid/Framework/Algorithms/test/AlphaCalcTest.h
+++ b/Code/Mantid/Framework/Algorithms/test/AlphaCalcTest.h
@@ -55,7 +55,7 @@ public:
     {
       TS_ASSERT_EQUALS(alphaCalc.execute(),true);
     }
-    catch(std::runtime_error e)
+    catch(std::runtime_error & e)
     {
       TS_FAIL(e.what());
     }
@@ -82,7 +82,7 @@ public:
     {
       TS_ASSERT_EQUALS(alphaCalc.execute(),true);
     }
-    catch(std::runtime_error e)
+    catch(std::runtime_error & e)
     {
       TS_FAIL(e.what());
     }
diff --git a/Code/Mantid/Framework/Algorithms/test/BinaryOperateMasksTest.h b/Code/Mantid/Framework/Algorithms/test/BinaryOperateMasksTest.h
index bc1866fbeae..ff05d52a73b 100644
--- a/Code/Mantid/Framework/Algorithms/test/BinaryOperateMasksTest.h
+++ b/Code/Mantid/Framework/Algorithms/test/BinaryOperateMasksTest.h
@@ -64,7 +64,7 @@ public:
       TS_ASSERT_EQUALS(ws3->getValue(2), 0);
 
     }
-    catch(std::runtime_error e)
+    catch(std::runtime_error & e)
     {
       TS_FAIL(e.what());
     }
@@ -114,7 +114,7 @@ public:
         // std::cout << ih << " - " << tempdetid << ": " << ws1->getValue(tempdetid) << " vs. " << ws4->getValue(tempdetid) << std::endl;
       }
     }
-    catch(std::runtime_error e)
+    catch(std::runtime_error & e)
     {
       TS_FAIL(e.what());
     }
@@ -133,7 +133,7 @@ public:
         TS_ASSERT_EQUALS(ws2->getValue(tempdetid), 1);
       }
     }
-    catch(std::runtime_error e)
+    catch(std::runtime_error & e)
     {
       TS_FAIL(e.what());
     }
diff --git a/Code/Mantid/Framework/Algorithms/test/CalMuonDeadTimeTest.h b/Code/Mantid/Framework/Algorithms/test/CalMuonDeadTimeTest.h
index 092044f6a89..dd59581c768 100644
--- a/Code/Mantid/Framework/Algorithms/test/CalMuonDeadTimeTest.h
+++ b/Code/Mantid/Framework/Algorithms/test/CalMuonDeadTimeTest.h
@@ -60,7 +60,7 @@ public:
     {
       TS_ASSERT_EQUALS(calDeadTime.execute(),true);
     }
-    catch(std::runtime_error e)
+    catch(std::runtime_error & e)
     {
       TS_FAIL(e.what());
     }
diff --git a/Code/Mantid/Framework/Algorithms/test/MuonAsymmetryCalcTest.h b/Code/Mantid/Framework/Algorithms/test/MuonAsymmetryCalcTest.h
index 75c3205b028..3ac55bb6c82 100644
--- a/Code/Mantid/Framework/Algorithms/test/MuonAsymmetryCalcTest.h
+++ b/Code/Mantid/Framework/Algorithms/test/MuonAsymmetryCalcTest.h
@@ -78,7 +78,7 @@ public:
     {
       TS_ASSERT_EQUALS(asymCalc.execute(),true);
     }
-    catch(std::runtime_error e)
+    catch(std::runtime_error & e)
     {
       TS_FAIL(e.what());
     }
diff --git a/Code/Mantid/Framework/Algorithms/test/MuonRemoveExpDecayTest.h b/Code/Mantid/Framework/Algorithms/test/MuonRemoveExpDecayTest.h
index e66f67291e3..a7b6d068e7d 100644
--- a/Code/Mantid/Framework/Algorithms/test/MuonRemoveExpDecayTest.h
+++ b/Code/Mantid/Framework/Algorithms/test/MuonRemoveExpDecayTest.h
@@ -62,7 +62,7 @@ public:
     {
       TS_ASSERT_EQUALS(alg.execute(),true);
     }
-    catch(std::runtime_error e)
+    catch(std::runtime_error & e)
     {
       TS_FAIL(e.what());
     }
@@ -84,7 +84,7 @@ public:
     {
       TS_ASSERT_EQUALS(alg2.execute(),true);
     }
-    catch(std::runtime_error e)
+    catch(std::runtime_error & e)
     {
       TS_FAIL(e.what());
     }
diff --git a/Code/Mantid/Framework/Algorithms/test/RemoveBinsTest.h b/Code/Mantid/Framework/Algorithms/test/RemoveBinsTest.h
index 5853aa9d443..f8725b88927 100644
--- a/Code/Mantid/Framework/Algorithms/test/RemoveBinsTest.h
+++ b/Code/Mantid/Framework/Algorithms/test/RemoveBinsTest.h
@@ -53,7 +53,7 @@ public:
 		{
 			TS_ASSERT_EQUALS(alg.execute(),true);
 		}
-		catch(std::runtime_error e)
+		catch(std::runtime_error & e)
 		{
 			TS_FAIL(e.what());
 		}
@@ -89,7 +89,7 @@ public:
 		{
 			TS_ASSERT_EQUALS(alg3.execute(),true);
 		}
-		catch(std::runtime_error e)
+		catch(std::runtime_error & e)
 		{
 			TS_FAIL(e.what());
 		}
@@ -126,7 +126,7 @@ public:
 		{
 			TS_ASSERT_EQUALS(alg4.execute(),true);
 		}
-		catch(std::runtime_error e)
+		catch(std::runtime_error & e)
 		{
 			TS_FAIL(e.what());
 		}
@@ -197,7 +197,7 @@ public:
 		{
 			TS_ASSERT_EQUALS(alg2.execute(),true);
 		}
-		catch(std::runtime_error e)
+		catch(std::runtime_error & e)
 		{
 			TS_FAIL(e.what());
 		}
-- 
GitLab