• fragile (unregistered)

    frist to say it's time for you to retire

  • OOM (unregistered)

    I would expect that by throwing an OutOfMemoryException some variables go out of scope and thus can get collected. The real question of course is how one can allocate the OutOfMemoryException in the first place

  • Anon (unregistered)

    The goggles, they do nothing!

  • Sally Flynn (unregistered)

    There's no point catching OutOfMemoryException: if that's thrown, your program's already had it.

  • (nodebb)

    It occurs to me that TRWTF isn't actually the exceptionally exceptional weirdness of the exception handling, but the direct implication that they are parsing XML with regexes.

  • anonymous (unregistered) in reply to Steve_The_Cynic

    There are multiple independent WTFs here. Together they're indicative of a particular kind of developer.

  • Brian Boorman (google)
    // OP: so if we're out of memory, how is this new exception going to be allocated?

    I can imagine cases where the exception could be allocated even though you got an out of memory exception. One example would be where the out of memory occurs on an attempt to allocate a large memory block, but the size of the exception object is small enough to fit in the memory that is still left.

  • snoofle (unregistered) in reply to Brian Boorman

    Agreed.

    But given the code that I edited out (allocating default StringBuffers and similarly small items), the items being allocated were very small, so it'd be unlikely to be able to allocate the new exception.

  • Morten Grøtan (google)

    Regarding this: "I was particularly amused by the OutOfMemoryException handler that allocates another exception object, and if it fails, another layer of exception trapping catches that and attempts to allocate yet another exception object. if that fails, it doesn't even try."

    To me, the code doesn't look that bad. Unless I'm very mistaken, it definitely does NOT do what the description says. Rather, it catches a specific exception, then throws a new generic custom-made "BasisException", with a custom error code as context. That exception again, or rather "those" exceptions, with different custom error codes to differentiate between various error scenarios, are then caught in the outer try..catch, where they are simply logged. No more exceptions thrown, unless we're talking about the explicit throws of the custom "UnexpectedMergerException".

    As for the "Maybe in the wrapping "try/catch Exception" - which allocates a new UnexpectedMergerException object??? Oh, wait..." comment in the "OutOfMemoryException" handler, it is NOT causing a new "UnexpectedMergerException", as stated further up.

    So, the code might be a bit clumsy, and perhaps the memory exception handling won't always work, but the rest is quite "normal".

    Please lecture me on how I'm mistaken...

  • (nodebb) in reply to snoofle

    But given the code that I edited out (allocating default StringBuffers and similarly small items), the items being allocated were very small, so it'd be unlikely to be able to allocate the new exception.

    In C++, of course, it's entirely possible that std::exception::operator new exists and allocates in some other pool of "emergency" memory. Of course that doesn't help if some fucknut decides to throw 42; or throw new int(42);, both of which are legal C++.

  • Chronomium (unregistered) in reply to Steve_The_Cynic

    throw 42;

    That might explain a thing or two.

  • Giulio (unregistered)

    Maybe I'm getting old, but the handling of out of memory doesn't seem so weird to me. If, as it looks like, this is C++, whatever had been allocated in the try block will be destroyed before the catch block runs (provided they use smart pointers properly). It seems quite a normal way to handle the case that the XML is so big or complex that it overflows the heap.

  • Klimax (unregistered)

    Note: This code looks like C# not C++. (int.Parse is good hint)

  • airdrik (unregistered)

    You are Exceptional! (just like everyone else :) )

  • Zenith (unregistered)

    Bad as it is, I'll take that over the Indian method of: catch (Exception e) { throw new Exception ("oops, something happened, try later!"); }

  • fragile (unregistered) in reply to Zenith

    No 6th Dimensional Supergravity provides for an infinite amount of demarcs where a 5th Dimensional super predator cannot clickjack the collective concious of all stellar biology to resonate a Laplace effect fooling a contrasted universal intelligence spectrum into believing 4D Supergravity correleates to 3D curvature in spacetime in which a universal resonating wave function devolves Socratic Idealistic Logic at all Supergravity Dimensions not equal to 3 to the n! power.

    That Quantum Heisenbergity of 4D Supergravity resonates down to 3D spatial perception in such a way that the observational effects of the red shift due to the convergence of a theoretical "5D/2D Supergravity resonating wave particle duality" does not create invincibly compounding infinities such that the resurrection of the dead equates to the resusciation of the dead, negating the non-trivial effect of all stellar biology resonating an observed Heliocentric/Geocentric duality into the very heart of human thought, in that spontaneous generation, and cosmic biological effects are two sides of the same Ideal coin.

  • Barf4Eva (unregistered)

    Exceptional article, snoofle. :)

  • fragile (unregistered)

    No such exceptionality exists in 4D Spacetime allowing for the certain empirical observation of the quantum state of the photon.

  • Daniel (unregistered) in reply to Zenith

    I'd take Indian developers over ex-VB6 developers any day. The code base I inherited was littered with:

    catch (Exception e) { String message = e.getMessage();

    if (message.contains("...") {
        throw new Exception("...");
    }
    else if (message.contains("...") {
        throw new Exception("...");
    }
    // ...
    

    }

  • (nodebb)

    I feel the level of understanding about how exceptions work that led to this being written is covered by the first try and catch block shown.

    Exceptions are for throwing error conditions up the stack. Yeah, "throwing up" is the image to go with here.

  • spaceman (unregistered) in reply to Daniel

    The present acceptance of superstitious "totems" in modernity provides a certain level of "truthiness" in modern thought.

    One person's innocent Socratic Idealism is another person's relativistic Socratic Idealism.

    The universe may be saying both "Godspeed, wonderous pilgrim!"

    Or it may be, in the very essence of the duality of observation and uncertainity, allow for such a "bad" thought experiment to occur:

    "Assumming a naturally resonating universal constant, the bounds of time move to always stupidfy, mystify, and embarass all anthropological thought"

    In other words, one scientists' observation of a Dyson Sphere Interference Effect equates to the following transfiguring statement by the Idealistic Fictional Lou Duva from the 2016 film "Chuck"

    "Kid, your nice, so listen up.

    This ain't a machine, it's a prison. It doesn't stop for you. It doesn't stop for me. It doesn't stop for anyone!

    But that THING over there just looked you in the eye. You gotta punk him before things get out of control.

    So here's the plan, take this, you know what you have to do, get it done, and I throw it in General Pop

    yeah, whoever gets it gets a beat down by guards, but heh, it might even cause enough junk to get you out of here!!!"

  • (nodebb)

    Actually, I think this code is rather sensible. Fairly sane code in a moderately insane environment.

    If I had to work with given circumstances like a list of things that could possibly go wrong and the kind of exception and exception message to be thrown, I'd write rather similar code, maybe all that exceptional exception creating delegated to some static class like "static class ExceptionallyExceptionalExceptionFactory".

    I'd feel a strong urge to strangulate the guy responsible for the constructor(s) of the BasicException class and for the type of ErrorCodes (class of string constants instead of an enum), though.

  • spaceman (unregistered) in reply to PWolff

    A Rational Modern thought experiment possessing a Sanity and Insanity spectrum provides for the following Idealistic Universal Invincible Logic to allow for the following "tach" time:

    Effectively, today, in Gitmo, two sides argue effective Goobleygook. The judge realizes and gets upset. Universal Time Packets reordinate themselves to put whatever started this into a relativistic state of euphoria and stasis. A feedback loop exists, allowing for deductively backwards time travel, binding the Supergravity to "schisimist" General Relativity, providing spontaneous generation and cosmological constants into a temporary "Theory of Everything Cosmological Life Support System" This system starts by beaming the Defense to the Dyson Sphere, while beaming all Anthropological Effects from a Heliocentric bounds into any black hole. Somehow, a token of anthropology appears on a completley humanistically determinable psychoreactive spectrum which alters cosmologicaly the eccentric orbit of Mercury...

  • spaceman (unregistered)

    ...A Good Judge thinks of this, and starts to bang his gavel in relativistic resonance to the August 1975 beat of Waylon Jennings' classing "Are You Sure Hank Done It This Way" The Galley picks this up, and starts stomping it's feet. The Jury picks up on this, and starts stomping it's feet and pounding a table. The very essence of the Courtroom begins to resonante! Pluto relativistically changes it orbit. A new token, from a yet unrealized Indus Viking Jihadi Conspiracy dating back to the big bang itself creates a Graphene around the relativistic orbital resonance between the now realized relativistic orbital effect. A Universal Totem appears, triggering a Intergalatic Crossfire War of Infinite Destruction, while allowing for a hereby unrealized Quantum Time Packet allowing the Earth to escape. Fermi falls! ... ...

  • spaceman (unregistered)

    ....Smartphones effectively move themselves out of Universal Garbage into a state of Anthropological Feedback, allowing for such an Unrealized Theater of the Absurd driving Anthropology into an Effective Absolute Kafkilian Nightmare. Earthbound Evolution Reversal begins. Biology grows brightest green in the dark. The Geodesic Effective illuminosity of Earth realizes itself into a perceived Infinite Earth Observable only from a truely 6N Demarc binding all Supergravity into a Universal Resonanating Anthropology. Very Large and Very Subtle Anthropological Effects become effectively indistinguishable on earth for all time in regards to such a 6N Supergravity Demarc allowing for an eternal "creepiness/spookiness" universal spectrum anthropological duality. Collective Humanity uses the very powers of the earth itself to reverse injustice deductively backwards through time. NS migratior patterns become EW vs. WE migratiory patterns. Universal Charities tokenize themselves into Melodramatic Totems. Churches literary collapse. Planes landing fly through the earth. Ink unwrites itself from books as humanity collective enters a universal feedback system of Unbounded Humanitarian Virtue vs Unacheivable Infinite Utopia...

  • spaceman (unregistered)

    ..The Complete Altruistic Constant determines itself to say "9/10 is as good as 10/10" Rollercoasters to Heaven manifest themselves, allowing for a completly determistic certaintude that whether 9/10 or 10/10 rides occur, it's ok as long as one engineer in good faith takes responsibility for the missing ride as long as everyone's in a good theme park when it runs empty. Then and Only Then will ...

  • spaceman (unregistered)

    Remy Porter writes a line of "code" containing the Ternary Operator, limiting the very first Ancient Astronaut into the first Fragile Astronaut, looking like this:

    https://www.si.com/more-sports/photos/2011/01/14-0facial-hair-hall-of-fame

  • spaceman (unregistered)

    https://imagesvc.timeincapp.com/v3/mm/image?url=https%3A%2F%2Fcdn-s3.si.com%2Fs3fs-public%2Fimages%2FBill-Lee-beard.jpg&w=800&q=85

  • (nodebb) in reply to Sally Flynn

    There's no point catching OutOfMemoryException: if that's thrown, your program's already had it.

    No, it's not too bad to catch it if you're writing code that allocates a very large chunk of memory. You might even be able to recover!

    It's only once you get an OOM from a small alloc that you're really toast, with no reasonable chance of being able to do anything useful.

  • Jack (unregistered)

    Wow, are those named capture groups? That's much better than I expected

  • PenguinF (unregistered)

    What strikes me about catching that OutOfMemoryException is that apparently it's not all that unexpected. It prevents a UnexpectedMergerException from being thrown.

  • spaceman (unregistered) in reply to fragile

    Empirical evidence suggest a governing ternary logic to all observable matter in universe suggesting a resonating Bosonic effect hereby providing a yet uncalculable anthropological constant self limiting the hereby "invincible" power of the universe through human evolution.

    A bicameral mind may or may not choose to accept that thought. However, if you take modern calculations of Supergravity projected upon a dualistic Invincible Socratic bipole, theoretically, aliens are not only reading this, they are reading this backwards and coming for us, providing for a fragile/ancient duality upon the very heart of Idealistic Reason itself!

    Even still, in spite of it, we ask open ended questions. Computers love binary thinking, however they run on light that supposedly operates on a yet uncertainably definite 4D Projection of Interference via a 5D/2D resonating Laplacian phenenomon through our Heliocentric realm. It's not that Heliocentric reals exist, it's that the capacity of the generation of them always remain infinite no matter our observed level of piety or wit. What we really need is a geodesic cosmological constant governing a Heliocentric Invincible Expansion against a Super Duper unacheivable thought not yet available to man. We do not need altruism. We need Ideal Altruism!!! An event so ground shaking it not only justifies the "cultural" marxism on campus, but it burns resonance into the very heart of the artic itself, making the diaelectric nature of matter bend to our will by blowing up stars with our minds!!! Such power not only is in our grasp, but already exists. If you take the Hubble, the Voyager, and an supposedly Anthropological constant equating to (9/10 == 10/9 && 10/9 == 9/10) and provide the "truthiness" of javascript as a graphen filter across the complete "anti-ontologocial" effect of wave degradation across the Einstein equations, you prove this duality inherent in the very concept of the big bang. In short, it doesn't matter if we're buried alive in a never ending snow storm or . . .

  • spaceman (unregistered)

    . . . shot to death by 6D Edmund Kemper projected on the known absense of energy upon "Dark" cosomological constants. We're still dead, no matter what, in all spacetime, ushering in an unescapable Kafkilian unescapable nightmare of madness.

    Paradoxically, the absence of "phase shift" is an excellent self regulating exercise against evolution. For instance, not only do you need to make a bot to copy and paste all the "bad" code on this site backwards, typing any sort of "universal harmonic" into the PID controller of temple OS should eventually unleash a quanta goobledeygook of invincible portions to break the very essence of Google itself!!!

  • extraordinary_space (unregistered)

    You fool!!!

    What have you done!

  • Sally Flynn (unregistered) in reply to dkf

    That's fair, I guess. But I can't help but think there are better exceptions to be throwing if a large memory allocation fails.

  • eric bloedow (unregistered)

    this reminded me of a crazy glitch one of my old computers developed: the subroutine that handles "this program has done an illegal operation and will shut down" problems started doing illegal operations! so when any program crashed, Windows would go into an endless loop, trying to shutdown the shutdown the shutdown...

Leave a comment on “I Take Exception”

Log In or post as a guest

Replying to comment #493109:

« Return to Article