- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
new Comment.append(
Admin
Admin
Almost looks autogenerated.
Admin
Admin
Looks like it used to be a simple string concatenation, but the coder was told to use StringBuilder(/Buffer) instead. So he did.
Admin
Loos like a search/replace of "String" with "StringBuffer".
But yeah, if I saw that in some code I'd definitely say WTF?
Admin
Maybe copy&pasted from a decompilation. I've seen these constructs show up when decompiling Java classes. And it already happened that a source got lost so it was "reconstructed" by decompiling the class-file.
Admin
At least it's thread-safe.
Admin
Especially noteworthy is the actual chaining of 2 consecutive .append() calls to the same instance in the middle. Sort of breaks the flow, so to speak.
Admin
.append("Robert'); DROP TABLE students;--").ToString()
Admin
The real WTF is a language where they provide fast string concatenation -- but instead do it the stupid way by default
Admin
Sheesh. This isn't even dotnet. This is the ancient and honorable thread-safe Java StringBuffer class. Maybe this is a hardware diagnostic for interlocked thread-safe instructions.