Exception Rabbit Hole



  • Hi all. First post... be gentle!

    I was performing some desperately needed refactoring in one of our larger and more spaghettified web-based systems. More often than not the only error handling in the system is to just catch 'Exception' at the controller level, rethrow it, and let the application container return an HTTP 500.

    In a specific example of this, there is a bit of logic that says a photo for an item can only be modified either if the item's sale date is more than a pre-set cut-off period away, or by an administrator. The code was seemingly rather simple, and didn't seem to need to throw a generic exception...

    String PHOTO_FLAG = null;
    try {
    PHOTO_FLAG = setPhotoFlag(session, item);
    } catch (Exception e) {
    logger.error("An error has occurred setting the Photo flag.", e);
    throw new SystemRuntimeException(e);
    }
    returnModelAndView.addObject(PHOTOSTATUS, PHOTO_FLAG);

    Why does setPhotoFlag() throw Exception, and why dont we bother trying to recover from this? I dug a little deeper...

    private String setPhotoFlag(HttpSession session, Item item) throws Exception {
    UserDetailsForm userDetailsForm = (UserDetailsForm) session.getAttribute(SystemWebConstants.USERPROFILE);
    boolean allowUpdate = candidateManager.doAllowUpdate(item.getSaleDate(), userDetailsForm.getImper());
    if (!allowUpdate) {
    return "YES";
    } else {
    return "NO";
    }
    }

    Ok, even disregarding the many WTFs here, including the fact that a method named 'setSomething' changes no state whatsoever, why does it even need to throw an exception at all, let alone Exception? Following the trail I found this...

    public boolean doAllowUpdate(Date date, String impersonatingUserFlag) throws Exception {
    int cutOffLimit = Integer.valueOf(resourceDataCache.getResourceProps().get(SystemConstants.PHOTO_CUT_LIMIT_PROPERTY));

        return SystemGeneralUtils.addOrSubstractDaysFromDate(date, cutOffLimit).after(new Date()) || isAdminUser(impersonatingUserFlag);
    }</code>
    

    We're way past the controller level now... what kind of horrific, unrecoverable error condition could justify throwing Exception all the way up to the app server...

    private boolean isAdminUser(String impersonatingUserFlag) throws Exception {
    return ((null != impersonatingUserFlag) && SystemConstants.STR_YES.equals(impersonatingUserFlag));
    }

    WTF?! So not only does the method signature throw a generic exception, it throws that exception despite the fact that there aren't any checked exceptions in the code! Delightful. What exactly was the point of all this?

    I suppose TRWTF is that for this extremely simple bit of logic there are 24 lines of code and 4 method calls.



  •  @Zutty said:

    What exactly was the point of all this?

    My guess would be that some large number of revisions ago, this method did actually throw a checked Exception, and no one bothered to remove the throws clauses because the code still compiled with them in there.



  • @Zutty said:

    Hi all. First post... be gentle!
    What the hell is wrong with you?



  • @belgariontheking said:

    @Zutty said:

    Hi all. First post... be gentle!
    What the hell is wrong with you?

    I've learned, through personal experiece mind you, that some people don't liked to be raped and violated their first time.  I've heard that there are even some people that never come around to the tender delights of prison romance. Silly as that might be.



  • @SteamBoat said:

    @belgariontheking said:

    @Zutty said:

    Hi all. First post... be gentle!
    What the hell is wrong with you?

    I've learned, through personal experiece mind you, that some people don't liked to be raped and violated their first time.  I've heard that there are even some people that never come around to the tender delights of prison romance. Silly as that might be.

    You need to learn how to read tags.


  • @SteamBoat said:

    I've learned, through personal experiece mind you, that some people don't liked to be raped and violated their first time.  I've heard that there are even some people that never come around to the tender delights of prison romance. Silly as that might be.
    Methinks you haven't been in enough prison romances. 



  • @belgariontheking said:

    @SteamBoat said:

    I've learned, through personal experiece mind you, that some people don't liked to be raped and violated their first time.  I've heard that there are even some people that never come around to the tender delights of prison romance. Silly as that might be.
    Methinks you haven't been in enough prison romances. 

    Speaking of which, how is Biff these days? Still got you dropping the soap?



  • So an overly convoluted instruction flow is a "rabbit hole"? Whoa, gives new meaning to the whole red pill thing.


  • Discourse touched me in a no-no place

    @Seahen said:

    Whoa, gives new meaning to the whole red pill thing.
    You do realise that the original reference to rabbit holes comes from Alice's Adventures in Wonderland (c. 1865), and not The Matrix(c. 1999)?



  • I do, but Alice never had to deal with a computer program in need of a redesign.



  • @PJH said:

    @Seahen said:
    Whoa, gives new meaning to the whole red pill thing.
    You do realise that the original reference to rabbit holes comes from Alice's Adventures in Wonderland (c. 1865), and not The Matrix(c. 1999)?
    Bullshit.  Alice in Wonderland just came out this year. The Matrix has been out for years.  Air go, it came from The Matrix, stupid.



  •  @bstorer said:

    Filed
    under: I'm not even sure where that "air go" phrase came from or
    what it originally meant. English is a funny language like that.
    What's the air there for? To go! Therefore, air go.  If you studied airgonomics, you'd know this.



  • @bstorer said:

    Alice in Wonderland just came out this year.

    How does Alice being a lesbian have any bearing on the matter ?

    Oh, and regarding 'air go - I'm bald, you insensitive clod !



  • @galgorah said:

    @belgariontheking said:

    @SteamBoat said:

    I've learned, through personal experiece mind you, that some people don't liked to be raped and violated their first time.  I've heard that there are even some people that never come around to the tender delights of prison romance. Silly as that might be.
    Methinks you haven't been in enough prison romances. 

    Speaking of which, how is Biff these days? Still got you dropping the soap?
    SHHHHHHHHHH Bruno doesn't know about Biff.  You've ruined my relationship.

    Jerk.



  • @belgariontheking said:

    @galgorah said:

    @belgariontheking said:

    @SteamBoat said:

    I've learned, through personal experiece mind you, that some people don't liked to be raped and violated their first time.  I've heard that there are even some people that never come around to the tender delights of prison romance. Silly as that might be.
    Methinks you haven't been in enough prison romances. 

    Speaking of which, how is Biff these days? Still got you dropping the soap?
    SHHHHHHHHHH Bruno doesn't know about Biff.  You've ruined my relationship.

    Jerk.

    No worries.  If you play your cards right, you might be able to get a 3 way.



  • The air go. Go is to the rabbit hole. The air put Alice. Grunt. Alice in what? wonderland.



  • It's not 'air go,' it's 'ergo'

    Latin. Means 'therefore'



  • @crwcomposer said:

    It's not 'air go,' it's 'ergo'

    Latin. Means 'therefore'

    What's Latin for "fuck, you're fucking stupid"?



  • @bstorer said:

    @crwcomposer said:

    It's not 'air go,' it's 'ergo'

    Latin. Means 'therefore'

    What's Latin for "fuck, you're fucking stupid"?

    Something like "Futuis, vos es fututiones bardus."



  • @crwcomposer said:

    @bstorer said:

    @crwcomposer said:

    It's not 'air go,' it's 'ergo'

    Latin. Means 'therefore'

    What's Latin for "fuck, you're fucking stupid"?

    Something like "Futuis, vos es fututiones bardus."


    Whoosh



  • @Lingerance said:

    @crwcomposer said:
    @bstorer said:

    @crwcomposer said:

    It's not 'air go,' it's 'ergo'

    Latin. Means 'therefore'

    What's Latin for "fuck, you're fucking stupid"?

    Something like "Futuis, vos es fututiones bardus."


    Whoosh

    Jesus, I'm not that dense. I was being facetious. bstorer said "I'm not even sure where that "air go" phrase came from or what it originally meant." I was just clarifying. You guys are dicks.



  • @crwcomposer said:

    @Lingerance said:
    @crwcomposer said:
    @bstorer said:

    @crwcomposer said:

    It's not 'air go,' it's 'ergo'

    Latin. Means 'therefore'

    What's Latin for "fuck, you're fucking stupid"?

    Something like "Futuis, vos es fututiones bardus."


    Whoosh

    Jesus, I'm not that dense. I was being facetious. bstorer said "I'm not even sure where that "air go" phrase came from or what it originally meant."  I was just clarifying.

    @Lingerance said:
    Whoosh

     

    @crwcomposer said:

    You guys are dicks.
      That's why dhromed likes us.



  • @crwcomposer said:

    Jesus, I'm not that dense. I was being facetious. bstorer said "I'm not even sure where that "air go" phrase came from or what it originally meant." I was just clarifying.

    See, the "Whoosh" means "that joke went right over your head, and this is the sound it made".  pstorer was making a joke.  You responded to his joke with a "clarification", meaning you thought he was serious, meaning the joke went right over your head.



  • No, YOU see, I responded to his insult with a JOKE (an obvious joke, at that). Then when somebody thought I was being serious and that it went over my head, "whoosh," (seriously, you think I translated 'fuck' into Latin with a straight face?), I explained that my REPLY was a joke, and that I only made my ORIGINAL comment to clarify the term 'ergo,' because bstorer was wondering about it. It's not a hard concept, people. You guys are your own wtf. (edited to make it clearer so morbius can understand)



  • @morbiuswilters said:

    pstorer was making a joke.  You
    responded to his joke with a "clarification", meaning you thought he was
    serious,
     

    @Lingerance said:

    Whoosh

    You just wooshed yourselves, my dear men.

    Unless you, too Brutes, were facetiating, in cwhich case I I I really bzt quickly lose track of these things bzrt klunk :care :care :care :care



  • @crwcomposer said:

    You guys are your own wtf.
     

    +1

    I really liked your jocular rebuttal!



  • @crwcomposer said:

    I explained that my REPLY was a joke, and that I only made my ORIGINAL comment to clarify the term 'ergo,' because bstorer was wondering about it. It's not a hard concept, people. You guys are your own wtf.
    Wow, you still don't get it.  The "air go" was a joke, you 'tard.  Everyone here knows what "ergo" means, and that I misused it in jest.  You are the only one who didn't pick up on this -- rather blatant, I think -- fact, hence:

    @Lingerance said:

    Whoosh



  • @crwcomposer said:

    ...and that I only made my ORIGINAL comment to clarify the term 'ergo,' because bstorer was wondering about it.

    Which is why you got whooshed.  You completely missed the original joke and then turned into a little bitch over it.

     

    @crwcomposer said:

    It's not a hard concept, people.

    Then why are you struggling with it?



  • @bstorer said:

    Wow, you still don't get it.  The "air go" was a joke, you 'tard.  Everyone here knows what "ergo" means, and that I misused it in jest.  You are the only one who didn't pick up on this -- rather blatant, I think -- fact, hence:

    @Lingerance said:

    Whoosh

    Actually, a search of the forum shows that you have NEVER used the term 'ergo' before (except when quoting Morbius).

    Since you fucked it up the first time you attempted to use it, it's pretty obvious what happened here. You can pretend like you knew what it meant, though, I won't tell anybody.


  • Discourse touched me in a no-no place

    @crwcomposer said:

    Actually, a search of the forum shows that you have NEVER used the term 'ergo'
    before (except when quoting Morbius).
    Are you still here? Either stop being pedantic and post stuff worth reading, or stop posting.



  • @crwcomposer said:

    ...it's pretty obvious what happened here.

     

    Yeah. It's pretty obvious. 

    Seriously, just stop. If someone accuses you of missing a joke, then continually insisting that you didn't, even if you really didn't, is not going to improve people's opinion of you.



  • @crwcomposer said:

    @bstorer said:

    Wow, you still don't get it.  The "air go" was a joke, you 'tard.  Everyone here knows what "ergo" means, and that I misused it in jest.  You are the only one who didn't pick up on this -- rather blatant, I think -- fact, hence:

    @Lingerance said:

    Whoosh

    Actually, a search of the forum shows that you have NEVER used the term 'ergo' before (except when quoting Morbius).

    Since you fucked it up the first time you attempted to use it, it's pretty obvious what happened here. You can pretend like you knew what it meant, though, I won't tell anybody.

    Oh, drats!  You found me out!  I don't understand the phrase "ergo", and I actually think The Matrix predates Alice in Wonderland.  And the tag definitely wasn't a wink and nudge about my misuse of "ergo", but a genuine inquiry into the history of this befuddling phrase.  My previous history of knowing Latin was all just a clever smokescreen set up years in advance, so that one day I'd have a way to respond to somebody who was so excited to use his knowledge of Latin (which isn't actually that rare 'round these parts) that he overlooked the tone of the post.

    What a great introduction you've made for yourself on this forum.  I look forward to your future contributions, such as explaining to morbs that Obama doesn't, in fact, hold the title of emperor, or revealing to a shocked crowd that some snippet of code is not "brillant" and that it's actually spelled "brilliant".



  • I feel like I should yell OH SNAP but I'm not sure if it would have to be ironic, sarcastic, sincere, projected, self-inflicted or applied to a team.



  • Obama isn't emperor and 'brilliant' has an 'i' in it

    </trolling>



  • @crwcomposer said:

    </trolling>

    This is not a valid HTML tag.  In addition, your post was not well-formed because there was no opening <trolling> tag.



  • @bstorer said:

    ...such as explaining to morbs that Obama doesn't, in fact, hold the title of emperor...

    Whaaa??  Glenn Beck told me otherwise, air go you are wrong.



  • @morbiuswilters said:

    @crwcomposer said:

    </trolling>

    This is not a valid HTML tag.

    I think it's supposed to be XML, but it still needs to proper namespace.@morbiuswilters said:
    In addition, your post was not well-formed because there was no opening <trolling> tag.
    Perhaps he means to put an end to all trolling?  If so, he's failed miserably, because the trolling is nested many levels deep.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.