From 9aa4895973b2ed3b932ce148d4a29359511b3e04 Mon Sep 17 00:00:00 2001
From: Sonia Minolli <sonia.minolli@synchrotron-soleil.fr>
Date: Wed, 19 Aug 2015 07:53:09 +0000
Subject: [PATCH] Created tag release_2_3_5.

---
 pom.xml           |  2 +-
 src/AIManager.cpp |  2 --
 src/AcqMode.cpp   | 29 +++++++++++++++++++++++++++--
 3 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/pom.xml b/pom.xml
index ff09b03..678864b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
 
    <groupId>fr.soleil.device</groupId>
    <artifactId>AIControllerV2-${aol}-${mode}</artifactId>
-   <version>2.3.6-SNAPSHOT</version>
+   <version>2.3.5</version>
 
    <packaging>nar</packaging>
    <name>AIControllerV2</name>
diff --git a/src/AIManager.cpp b/src/AIManager.cpp
index 3c185e0..0933948 100644
--- a/src/AIManager.cpp
+++ b/src/AIManager.cpp
@@ -626,7 +626,6 @@ void AIManager::start()
   }
   catch (Tango::DevFailed & df)
   {
-    this->m_initInError = true;
     ERROR_STREAM << "AIManager::start caught DevFailed while checking memory: " << df << std::endl;
     RETHROW_DEVFAILED(df,
                       _CPTC("COMMAND_FAILED"),
@@ -635,7 +634,6 @@ void AIManager::start()
   }
   catch (...)
   {
-    this->m_initInError = true;
     ERROR_STREAM << "AIManager::start caught [...] while checking memory" << std::endl;
     THROW_DEVFAILED(_CPTC("UNKNOWN_ERROR"),
                     _CPTC("Memory check failed (caught [...])!"),
diff --git a/src/AcqMode.cpp b/src/AcqMode.cpp
index 3bc4d73..cd1a784 100644
--- a/src/AcqMode.cpp
+++ b/src/AcqMode.cpp
@@ -807,10 +807,22 @@ void AcqMode::setSamplingRate(double rate)
                     _CPTC("AcqMode::setSamplingRate")); 
   }
 
-  this->m_daqConfig.set_sampling_rate(rate);
-
   // set new buffer size = integration time * sampling rate
   unsigned long depth = (unsigned long) (this->m_acquisitionParam.integrationTime * kMILLISECONDS_TO_SECONDS * rate);
+
+  // check that depth is not null before setting new sampling rate value
+  if (depth == 0)
+  {
+    this->m_errorMsg = "Set sampling rate failed.";
+    this->m_errorOccurred = true;
+    ERROR_STREAM << "AcqMode::setSamplingRate - new buffer depth is null!" << std::endl;
+    THROW_DEVFAILED(
+      _CPTC("CONFIGURATION_ERROR"),
+      _CPTC("Bad sampling rate value: new buffer depth is null!"),
+      _CPTC("AcqMode::setSamplingRate"));
+  }
+
+  this->m_daqConfig.set_sampling_rate(rate);
 	this->m_daqConfig.set_buffer_depth(depth);
 
   // re-allocate memory for raw & scaled data buffers
@@ -1131,6 +1143,19 @@ void AcqMode::setIntegrationTime(double it)
 
   // new buffer size = new integration time * sampling rate
   unsigned long depth = (unsigned long) (it * kMILLISECONDS_TO_SECONDS * this->m_daqConfig.get_sampling_rate());
+
+  // check that depth is not null before setting new integration time value
+  if (depth == 0)
+  {
+    this->m_errorMsg = "Set integration time failed.";
+    this->m_errorOccurred = true;
+    ERROR_STREAM << "AcqMode::setIntegrationTime - new buffer depth is null!" << std::endl;
+    THROW_DEVFAILED(
+      _CPTC("CONFIGURATION_ERROR"),
+      _CPTC("Bad integration time value: new buffer depth is null!"),
+      _CPTC("AcqMode::setIntegrationTime"));
+  }
+
 	this->m_daqConfig.set_buffer_depth(depth);
 
   // re-allocate memory for buffers
-- 
GitLab