Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Exporters/AssemblyExporter.cs =================================================================== diff -u -ref362ecdfec2d2c0efb1696ba1bba1d731a66256 -rd02c0e92e16c65e49297f00418e0d4650d08cc46 --- Ringtoets/Integration/src/Ringtoets.Integration.IO/Exporters/AssemblyExporter.cs (.../AssemblyExporter.cs) (revision ef362ecdfec2d2c0efb1696ba1bba1d731a66256) +++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Exporters/AssemblyExporter.cs (.../AssemblyExporter.cs) (revision d02c0e92e16c65e49297f00418e0d4650d08cc46) @@ -66,28 +66,17 @@ public bool Export() { - ExportableAssessmentSection exportableAssessmentSection; - try - { - exportableAssessmentSection = ExportableAssessmentSectionFactory.CreateExportableAssessmentSection(assessmentSection); - } - catch (AssemblyException) - { - LogErrorMessage(); - return false; - } - + ExportableAssessmentSection exportableAssessmentSection = CreateExportableAssessmentSection(); if (!ValidateExportableAssessmentSection(exportableAssessmentSection)) { LogErrorMessage(); return false; } - SerializableAssembly serializableAssembly = SerializableAssemblyCreator.Create(exportableAssessmentSection); - try { - SerializableAssemblyWriter.WriteAssembly(serializableAssembly, filePath); + SerializableAssemblyWriter.WriteAssembly(SerializableAssemblyCreator.Create(exportableAssessmentSection), + filePath); } catch (CriticalFileWriteException e) { @@ -98,10 +87,23 @@ return true; } + private ExportableAssessmentSection CreateExportableAssessmentSection() + { + try + { + return ExportableAssessmentSectionFactory.CreateExportableAssessmentSection(assessmentSection); + } + catch (AssemblyException) + { + return null; + } + } + private static bool ValidateExportableAssessmentSection(ExportableAssessmentSection exportableAssessmentSection) { - return !(exportableAssessmentSection.AssessmentSectionAssembly.AssemblyCategory == AssessmentSectionAssemblyCategoryGroup.None || - exportableAssessmentSection.AssessmentSectionAssembly.AssemblyCategory == AssessmentSectionAssemblyCategoryGroup.NotApplicable); + return exportableAssessmentSection != null + && exportableAssessmentSection.AssessmentSectionAssembly.AssemblyCategory != AssessmentSectionAssemblyCategoryGroup.None + && exportableAssessmentSection.AssessmentSectionAssembly.AssemblyCategory != AssessmentSectionAssemblyCategoryGroup.NotApplicable; } private static void LogErrorMessage()