Sunday, 13 August 2017

Yet another WTF moment ~ foundjava

1
2
3
4
5
6
7
8
9
10
boolean found = false;
for (int pr=0; pr<promotions.length; pr++) {
    Promotion promotion = promotions[pr];
    if (promotion!=null && promotion.getName().equals(""+availablePromotions[pr][a1].getPackageId())) {
        externalPromotions[pr] = externalPromotions[pr];    // WTF!!! Assigning a value to itself.
        found = true// Not sure what this is
        break;
    }
}
found = false// As soon as the loop exits this goes back to false again. WTF!!!
The above is an actual snippet of code from a production system (the comments are mine). And yes, I am serious.

No comments:

Post a Comment