The Daily WTF
Kate inherited a system where Java code generates JavaScript (by good old fashioned string concatenation) and embeds it into an output template. The Java code was written by someone who didn’t fully understand Java, but JavaScript was also a language they didn’t understand, and the resulting unholy mess was buggy and difficult to maintain.
Why trying to debug the JavaScript, Kate had to dig through the generated code, which led to this little representative line:
dojo.byId(‘html;——sites——fileadmin——en——fileadmin——index.html;;12’).setAttribute(‘isLocked’,’true’);
The byId function is an alias to the browser’s document.getElementById function. The ID on display here is clearly generated by the Java code, resulting in an absolutely cursed ID for an element in the page. The semicolons are field separators, which means you can parse the ID to get other information about it. I have no idea what the 12 means, but it clearly means something. Then there’s that long kebab-looking string. It
To read the full article click on the 'post' link at the top.