diff --git a/src/WFFM.ConversionTool.Extensions.SitecoreFormsExtensions/Properties/AssemblyInfo.cs b/src/WFFM.ConversionTool.Extensions.SitecoreFormsExtensions/Properties/AssemblyInfo.cs
index fd8bf8d..6107e0b 100644
--- a/src/WFFM.ConversionTool.Extensions.SitecoreFormsExtensions/Properties/AssemblyInfo.cs
+++ b/src/WFFM.ConversionTool.Extensions.SitecoreFormsExtensions/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.3.3.0")]
-[assembly: AssemblyFileVersion("1.3.3.0")]
+[assembly: AssemblyVersion("1.3.4.0")]
+[assembly: AssemblyFileVersion("1.3.4.0")]
diff --git a/src/WFFM.ConversionTool.Extensions.SitecoreFormsSendEmailSubmitAction/Converters/SendEmailConverter.cs b/src/WFFM.ConversionTool.Extensions.SitecoreFormsSendEmailSubmitAction/Converters/SendEmailConverter.cs
index 7c6b55f..70a0239 100644
--- a/src/WFFM.ConversionTool.Extensions.SitecoreFormsSendEmailSubmitAction/Converters/SendEmailConverter.cs
+++ b/src/WFFM.ConversionTool.Extensions.SitecoreFormsSendEmailSubmitAction/Converters/SendEmailConverter.cs
@@ -3,6 +3,7 @@
using System.Text.RegularExpressions;
using WFFM.ConversionTool.Library.Converters;
using WFFM.ConversionTool.Library.Helpers;
+using WFFM.ConversionTool.Library.Logging;
using WFFM.ConversionTool.Library.Repositories;
namespace WFFM.ConversionTool.Extensions.SitecoreFormsSendEmailSubmitAction.Converters
@@ -10,25 +11,27 @@ namespace WFFM.ConversionTool.Extensions.SitecoreFormsSendEmailSubmitAction.Conv
public class SendEmailConverter : BaseFieldConverter
{
private IDestMasterRepository _destMasterRepository;
+ private ILogger _logger;
- public SendEmailConverter(IDestMasterRepository destMasterRepository)
+ public SendEmailConverter(IDestMasterRepository destMasterRepository, ILogger logger)
{
_destMasterRepository = destMasterRepository;
+ _logger = logger;
}
public override string ConvertValue(string sourceValue)
{
// example of sourceValue
// example.hostexample@mail.nettrueto@example.comcc@example.combcc@example.comexample@mail.netThis is the subject of the email.
This is the body of the email.
[]
- var host = XmlHelper.GetXmlElementValue(sourceValue, "host");
- var from = XmlHelper.GetXmlElementValue(sourceValue, "from");
- var isbodyhtml = XmlHelper.GetXmlElementValue(sourceValue, "isbodyhtml");
- var to = XmlHelper.GetXmlElementValue(sourceValue, "to");
- var cc = XmlHelper.GetXmlElementValue(sourceValue, "cc");
- var bcc = XmlHelper.GetXmlElementValue(sourceValue, "bcc");
- var localfrom = XmlHelper.GetXmlElementValue(sourceValue, "localfrom");
- var subject = ConvertFieldTokens(XmlHelper.GetXmlElementValue(sourceValue, "subject"));
- var mail = ConvertFieldTokens(XmlHelper.GetXmlElementValue(sourceValue, "mail"));
+ var host = XmlHelper.GetXmlElementValue(sourceValue, "host", true);
+ var from = XmlHelper.GetXmlElementValue(sourceValue, "from", true);
+ var isbodyhtml = XmlHelper.GetXmlElementValue(sourceValue, "isbodyhtml", true);
+ var to = XmlHelper.GetXmlElementValue(sourceValue, "to", true);
+ var cc = XmlHelper.GetXmlElementValue(sourceValue, "cc", true);
+ var bcc = XmlHelper.GetXmlElementValue(sourceValue, "bcc", true);
+ var localfrom = XmlHelper.GetXmlElementValue(sourceValue, "localfrom", true);
+ var subject = ConvertFieldTokens(XmlHelper.GetXmlElementValue(sourceValue, "subject", true));
+ var mail = ConvertFieldTokens(XmlHelper.GetXmlElementValue(sourceValue, "mail", true));
var fromValue = !string.IsNullOrEmpty(from) ? from : localfrom;
@@ -63,7 +66,7 @@ private string ConvertFieldTokens(string fieldText)
else // case of token in message field
{
// get field label value
- fieldName = XmlHelper.GetXmlElementValue(matchValue, "label");
+ fieldName = XmlHelper.GetXmlElementValue(matchValue, "label", true);
}
if (!string.IsNullOrEmpty(fieldName))
diff --git a/src/WFFM.ConversionTool.Extensions.SitecoreFormsSendEmailSubmitAction/Properties/AssemblyInfo.cs b/src/WFFM.ConversionTool.Extensions.SitecoreFormsSendEmailSubmitAction/Properties/AssemblyInfo.cs
index 73b864d..f71c649 100644
--- a/src/WFFM.ConversionTool.Extensions.SitecoreFormsSendEmailSubmitAction/Properties/AssemblyInfo.cs
+++ b/src/WFFM.ConversionTool.Extensions.SitecoreFormsSendEmailSubmitAction/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.3.3.0")]
-[assembly: AssemblyFileVersion("1.3.3.0")]
+[assembly: AssemblyVersion("1.3.4.0")]
+[assembly: AssemblyFileVersion("1.3.4.0")]
diff --git a/src/WFFM.ConversionTool.Library/Converters/FieldConverters/DatasourceConverter.cs b/src/WFFM.ConversionTool.Library/Converters/FieldConverters/DatasourceConverter.cs
index abb89bf..257e577 100644
--- a/src/WFFM.ConversionTool.Library/Converters/FieldConverters/DatasourceConverter.cs
+++ b/src/WFFM.ConversionTool.Library/Converters/FieldConverters/DatasourceConverter.cs
@@ -7,6 +7,7 @@
using System.Xml;
using WFFM.ConversionTool.Library.Factories;
using WFFM.ConversionTool.Library.Helpers;
+using WFFM.ConversionTool.Library.Logging;
using WFFM.ConversionTool.Library.Models.Metadata;
using WFFM.ConversionTool.Library.Models.Sitecore;
using WFFM.ConversionTool.Library.Reporting;
@@ -17,11 +18,13 @@ public class DatasourceConverter : BaseFieldConverter
{
private IItemFactory _itemFactory;
private IReporter _analysisReporter;
+ private ILogger _logger;
- public DatasourceConverter(IItemFactory itemFactory, IReporter analysisReporter)
+ public DatasourceConverter(IItemFactory itemFactory, IReporter analysisReporter, ILogger logger)
{
_itemFactory = itemFactory;
_analysisReporter = analysisReporter;
+ _logger = logger;
}
public override List ConvertValueElementToItems(SCField scField, string elementValue, MetadataTemplate metadataTemplate, SCItem sourceItem)
@@ -30,7 +33,17 @@ public override List ConvertValueElementToItems(SCField scField, string
var decodedElementValue = Uri.UnescapeDataString(elementValue).Replace("+", " ");
- var queryElements = XmlHelper.GetXmlElementNodeList(decodedElementValue, "query");
+ XmlNodeList queryElements = null;
+ try
+ {
+ queryElements = XmlHelper.GetXmlElementNodeList(decodedElementValue, "query", true);
+ }
+ catch (Exception ex)
+ {
+ _logger.Log(new LogEntry(LoggingEventType.Error,
+ string.Format("ConvertValueElementToItems - Failed to parse Xml value. ItemID = {0} - FieldID = {1} - ElementName = {2} - ElementValue_Decoded = {3}",
+ scField.ItemId, scField.Id, "query", decodedElementValue), ex));
+ }
if (queryElements != null && queryElements.Count > 0)
{
foreach (XmlNode queryElement in queryElements)
@@ -88,7 +101,18 @@ public override List ConvertValueElementToFields(SCField scField, strin
var decodedElementValue = Uri.UnescapeDataString(elementValue).Replace("+"," ");
- var queryElement = XmlHelper.GetXmlElementNode(decodedElementValue, "query");
+ XmlNode queryElement = null;
+ try
+ {
+ queryElement = XmlHelper.GetXmlElementNode(decodedElementValue, "query", true);
+ }
+ catch (Exception ex)
+ {
+ _logger.Log(new LogEntry(LoggingEventType.Error,
+ string.Format("ConvertValueElementToFields - Failed to parse Xml value. ItemID = {0} - FieldID = {1} - ElementName = {2} - ElementValue_Decoded = {3}",
+ scField.ItemId, scField.Id, "query", decodedElementValue), ex));
+ }
+
if (queryElement != null)
{
if (queryElement.Attributes != null && queryElement.Attributes["t"] != null)
diff --git a/src/WFFM.ConversionTool.Library/Converters/SubmitConverter.cs b/src/WFFM.ConversionTool.Library/Converters/SubmitConverter.cs
index cd40943..07db195 100644
--- a/src/WFFM.ConversionTool.Library/Converters/SubmitConverter.cs
+++ b/src/WFFM.ConversionTool.Library/Converters/SubmitConverter.cs
@@ -28,8 +28,10 @@ public class SubmitConverter : ItemProcessor
private IFieldProvider _fieldProvider;
private AppSettings _appSettings;
private IReporter _analysisReporter;
+ private ILogger _logger;
- public SubmitConverter(IMetadataProvider metadataProvider, IDestMasterRepository destMasterRepository, IItemConverter itemConverter, IItemFactory itemFactory, IFieldProvider fieldProvider, AppSettings appSettings, IReporter analysisReporter)
+ public SubmitConverter(IMetadataProvider metadataProvider, IDestMasterRepository destMasterRepository, IItemConverter itemConverter, IItemFactory itemFactory,
+ IFieldProvider fieldProvider, AppSettings appSettings, IReporter analysisReporter, ILogger logger)
: base(destMasterRepository, itemConverter, itemFactory, appSettings)
{
_destMasterRepository = destMasterRepository;
@@ -37,6 +39,7 @@ public SubmitConverter(IMetadataProvider metadataProvider, IDestMasterRepository
_fieldProvider = fieldProvider;
_appSettings = appSettings;
_analysisReporter = analysisReporter;
+ _logger = logger;
}
public void Convert(SCItem form, SCItem pageItem)
@@ -262,8 +265,19 @@ private void ConvertSaveActions(SCItem form, string tracking, SCItem buttonItem,
var submitActionValues = new Dictionary();
submitActionValues.Add(new Guid(SubmitActionConstants.SubmitActionFieldId),
submitAction.destSubmitActionFieldValue);
- submitActionValues.Add(new Guid(SubmitActionConstants.ParametersFieldId),
- converter.ConvertValue(HttpUtility.HtmlDecode((saveActionItem.Parameters.Replace("&","&")))));
+ try
+ {
+ submitActionValues.Add(new Guid(SubmitActionConstants.ParametersFieldId),
+ converter.ConvertValue(
+ HttpUtility.HtmlDecode((saveActionItem.Parameters.Replace("&", "&")))));
+ }
+ catch (Exception ex)
+ {
+ _logger.Log(new LogEntry(LoggingEventType.Error,
+ string.Format("SubmitConverter - Failed to parse Xml value of Parameters field of Submit Action. FormID = {0} - FieldID = {1} - FieldValue = {2}",
+ form.ID, formSaveActionField.Id, saveActionItem.Parameters), ex));
+ }
+
ConvertFieldsToSubmitActionItem(submitAction.destSubmitActionItemName, submitActionValues, buttonItem);
}
else
diff --git a/src/WFFM.ConversionTool.Library/Helpers/XmlHelper.cs b/src/WFFM.ConversionTool.Library/Helpers/XmlHelper.cs
index 1eab6e0..3f34652 100644
--- a/src/WFFM.ConversionTool.Library/Helpers/XmlHelper.cs
+++ b/src/WFFM.ConversionTool.Library/Helpers/XmlHelper.cs
@@ -4,6 +4,7 @@
using System.Text;
using System.Threading.Tasks;
using System.Xml;
+using WFFM.ConversionTool.Library.Logging;
namespace WFFM.ConversionTool.Library.Helpers
{
@@ -37,7 +38,7 @@ public static List GetXmlElementNames(string fieldValue)
return elementNames;
}
- public static string GetXmlElementValue(string fieldValue, string elementName)
+ public static string GetXmlElementValue(string fieldValue, string elementName, bool throwOnError = false)
{
if (!string.IsNullOrEmpty(fieldValue) && !string.IsNullOrEmpty(elementName))
{
@@ -61,12 +62,18 @@ public static string GetXmlElementValue(string fieldValue, string elementName)
Console.WriteLine("XmlHelper - GetXmlElementValue - Failed to parse Xml value - Value = " + fieldValue);
Console.WriteLine(e);
Console.WriteLine();
+ if (throwOnError)
+ {
+ Console.WriteLine("See logs for more details in the logs folder.");
+ Console.WriteLine();
+ throw;
+ }
}
}
return string.Empty;
}
- public static XmlNode GetXmlElementNode(string fieldValue, string elementName)
+ public static XmlNode GetXmlElementNode(string fieldValue, string elementName, bool throwOnError = false)
{
if (!string.IsNullOrEmpty(fieldValue) && !string.IsNullOrEmpty(elementName))
{
@@ -89,12 +96,18 @@ public static XmlNode GetXmlElementNode(string fieldValue, string elementName)
Console.WriteLine("XmlHelper - GetXmlElementNode - Failed to parse Xml value - Value = " + fieldValue);
Console.WriteLine(e);
Console.WriteLine();
+ if (throwOnError)
+ {
+ Console.WriteLine("See logs for more details in the logs folder.");
+ Console.WriteLine();
+ throw;
+ }
}
}
return null;
}
- public static XmlNodeList GetXmlElementNodeList(string fieldValue, string elementName)
+ public static XmlNodeList GetXmlElementNodeList(string fieldValue, string elementName, bool throwOnError = false)
{
if (!string.IsNullOrEmpty(fieldValue) && !string.IsNullOrEmpty(elementName))
{
@@ -117,6 +130,12 @@ public static XmlNodeList GetXmlElementNodeList(string fieldValue, string elemen
Console.WriteLine("XmlHelper - GetXmlElementNodeList - Failed to parse Xml value - Value = " + fieldValue);
Console.WriteLine(e);
Console.WriteLine();
+ if (throwOnError)
+ {
+ Console.WriteLine("See logs for more details in the logs folder.");
+ Console.WriteLine();
+ throw;
+ }
}
}
return null;
diff --git a/src/WFFM.ConversionTool.Library/Properties/AssemblyInfo.cs b/src/WFFM.ConversionTool.Library/Properties/AssemblyInfo.cs
index 74cc817..a727b2d 100644
--- a/src/WFFM.ConversionTool.Library/Properties/AssemblyInfo.cs
+++ b/src/WFFM.ConversionTool.Library/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.3.3.0")]
-[assembly: AssemblyFileVersion("1.3.3.0")]
+[assembly: AssemblyVersion("1.3.4.0")]
+[assembly: AssemblyFileVersion("1.3.4.0")]
diff --git a/src/WFFM.ConversionTool/Program.cs b/src/WFFM.ConversionTool/Program.cs
index 351ca10..00ed22c 100644
--- a/src/WFFM.ConversionTool/Program.cs
+++ b/src/WFFM.ConversionTool/Program.cs
@@ -62,7 +62,7 @@ static void Main(string[] args)
System.Console.WriteLine();
System.Console.WriteLine(" ***********************************************************************");
System.Console.WriteLine(" * *");
- System.Console.WriteLine(" * WFFM Conversion Tool - v1.3.3 *");
+ System.Console.WriteLine(" * WFFM Conversion Tool - v1.3.4 *");
System.Console.WriteLine(" * *");
System.Console.WriteLine(" ***********************************************************************");
System.Console.WriteLine();
diff --git a/src/WFFM.ConversionTool/Properties/AssemblyInfo.cs b/src/WFFM.ConversionTool/Properties/AssemblyInfo.cs
index f0bd906..6a41ecf 100644
--- a/src/WFFM.ConversionTool/Properties/AssemblyInfo.cs
+++ b/src/WFFM.ConversionTool/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.3.3.0")]
-[assembly: AssemblyFileVersion("1.3.3.0")]
+[assembly: AssemblyVersion("1.3.4.0")]
+[assembly: AssemblyFileVersion("1.3.4.0")]