Commit b17b9ebcb47e625edfbf1a4b086718126b60af5a
1 parent
9fa4d66d
Exists in
master
and in
94 other branches
Another fix for #6497
Showing
1 changed file
with
23 additions
and
62 deletions
Show diff stats
src/ParamOutputImpl/Download/DownloadOutput.cc
... | ... | @@ -213,48 +213,34 @@ void DownloadOutput::applyOneFileStructure(bool separateInfoFile, bool isFirstIn |
213 | 213 | { |
214 | 214 | LOG4CXX_DEBUG(_logger,"DownloadOutput::applyOneFileStructure"); |
215 | 215 | //create a data file |
216 | - if (isFirstInterval) | |
217 | - createNewDataFile(); | |
216 | + if (isFirstInterval) { | |
217 | + if(separateInfoFile) { | |
218 | + //create info file | |
219 | + std::string filePath = getInfoFilePath(_fileWriter->getExtension()); | |
220 | + if (!_fileWriter->createNewFile(filePath)) | |
221 | + { | |
222 | + LOG4CXX_ERROR(_logger, "DownloadOutput::applyOneFilePerInterval : Cannot create info file " << filePath); | |
223 | + BOOST_THROW_EXCEPTION(AMDA::Parameters::ParamOutput_exception()); | |
224 | + } | |
225 | + _files.push_back(filePath); | |
226 | + | |
227 | + //write info | |
228 | + writeInfo(false,false,true); | |
229 | + } | |
230 | + | |
231 | + createNewDataFile(); | |
232 | + } | |
218 | 233 | //write data for each parameters |
219 | 234 | for (auto paramProperties : _downloadProperties.getParamPropertiesList()) |
220 | 235 | getParameterDataFromServer(paramProperties->getOutputId()); |
221 | 236 | //write info |
222 | 237 | if (isFirstInterval) |
223 | 238 | { |
224 | - if(separateInfoFile) | |
225 | - { | |
226 | - //write only interval info | |
227 | - writeInfo(false,true,false); | |
228 | - } | |
229 | - | |
230 | - else | |
231 | - { | |
232 | - //write all info | |
233 | - writeInfo(true,false,false); | |
234 | - } | |
239 | + if (!separateInfoFile) { | |
240 | + //write all info | |
241 | + writeInfo(false,false,false); | |
242 | + } | |
235 | 243 | } |
236 | - | |
237 | - //finalize data write | |
238 | - _fileWriter->finalize(); | |
239 | - | |
240 | - if (separateInfoFile && isFirstInterval) | |
241 | - { | |
242 | - //create info file | |
243 | - _currentParamId = ""; | |
244 | - std::string filePath = getInfoFilePath(_fileWriter->getExtension()); | |
245 | - if (!_fileWriter->createNewFile(filePath)) | |
246 | - { | |
247 | - LOG4CXX_ERROR(_logger, "DownloadOutput::applyOneFilePerParameterPerInterval : Cannot create info file " << filePath); | |
248 | - BOOST_THROW_EXCEPTION(AMDA::Parameters::ParamOutput_exception()); | |
249 | - } | |
250 | - _files.push_back(filePath); | |
251 | - | |
252 | - //write info | |
253 | - writeInfo(false,false,true); | |
254 | - } | |
255 | - | |
256 | - | |
257 | - | |
258 | 244 | } |
259 | 245 | |
260 | 246 | |
... | ... | @@ -295,34 +281,9 @@ void DownloadOutput::applyOneFilePerInterval(bool separateInfoFile, bool isFirst |
295 | 281 | } |
296 | 282 | _files.push_back(filePath); |
297 | 283 | |
298 | - if (separateInfoFile) | |
299 | - { | |
300 | - | |
301 | - //write info | |
302 | - writeInfo(false,false,false); | |
303 | - }else | |
304 | - { | |
305 | - writeInfo(false,false,false); | |
306 | - } | |
284 | + //write info | |
285 | + writeInfo(false,false,true); | |
307 | 286 | } |
308 | - _fileWriter->finalize(); | |
309 | - | |
310 | - if (separateInfoFile && isFirstInterval) | |
311 | - { | |
312 | - //create info file | |
313 | - std::string filePath = getInfoFilePath(_fileWriter->getExtension()); | |
314 | - if (!_fileWriter->createNewFile(filePath)) | |
315 | - { | |
316 | - LOG4CXX_ERROR(_logger, "DownloadOutput::applyOneFilePerParameterPerInterval : Cannot create info file " << filePath); | |
317 | - BOOST_THROW_EXCEPTION(AMDA::Parameters::ParamOutput_exception()); | |
318 | - } | |
319 | - _files.push_back(filePath); | |
320 | - | |
321 | - //write info | |
322 | - writeInfo(false,false,true); | |
323 | - | |
324 | - } | |
325 | - | |
326 | 287 | } |
327 | 288 | |
328 | 289 | /* | ... | ... |