gocd/gocd — pull request #314 by sahilm (2014-07-07 13:50:50+00:00)
Title: Don't allow leading/trailing spaces in commands.

This is a followup of #269. I have changed the pattern of `commandType` to `\S+(.*\S+)*`.

Writing `73.xsl` to trim leading and trailing spaces from current configurations proved tricky. Since XSLT 1.0 doesn't have the convenient `replace` from XSLT 2.0. Migrating to XSLT 2.0 would have meant adding a dependency on Saxon. I adapted a XSLT from http://stackoverflow.com/a/13974710/237033 and would love a review because my XSLT skills are next to non-existent :).

I added relevant tests to `GoConfigMigrationIntegrationTest.java` and `MagicalGoConfigXmlLoaderTest.java` and both of these tests pass.

Interestingly enough, when manually testing this feature - I see an error the first time I try to save a command with leading/trailing whitespace. However, the command is trimmed when it is reloaded from the server and the save passes the next time. Any pointers on why this could be happening?

/cc @sachinsudheendra