CodeSOD: The Email Process

This post was originally published on this site

The Daily WTF

Today’s submission comes from Florian, and it starts with “this app processes important business transaction by email”, which is always a good way to start a WTF. I’ve seen a depressing number of applications in my life that use email as a means of data exchange. It’s common enough that even the industry standard EDI protocol supports email as one of its transports, but hoo boy is that a terrible abuse of email systems.

Let’s start in HtmlResponseParser.cs, which reads in HTML and “parses” it for certain structures so it can extract data.

public static Response createFromAscii(string r) { string regEx = “^” + RegExpMgr.getRegularExpression(“requestRefNum”) + RegExpMgr.getRegularExpression(“spaceTabSeparator”) + RegExpMgr.getRegularExpression(“bbTickerAndName”) // snip: 10 more lines + “).*?”; Match m = Regex.Match(r, regEx); if(m.Success) { // Let caller handle exceptions bool status = true; int id = parseID(m.Groups[1].Value); int type = parseType(m.Groups[1].Value); string ticker = m.Groups[2].Value; double quantity = parseQuantity(m.Groups[3].Value); DateTime

To read the full article click on the 'post' link at the top.