3 ms·
> HttpURLConnection.rememberedException Something must be quite bad with the design if he ends up having to remember exceptions...
by bjarneh 6y ago
> HttpURLConnection.rememberedException
Something must be quite bad with the design if he ends up having to remember exceptions...
- kleiba 6y agoAgreed. This design deserves a moment of leaning back in your chair with your jaw dropped: as if exception handling wasn't awful enough to begin with, this construct completely undermines the whole purpose of it and on top of it adds another layer of complication. I feel for the poor guy who had to figure out the bug that was caused by this -- the waste of his time was completely predictable by this idiotic design.
- nitrogen 6y agoI feel like Java('s libraries) forces this kind of exception inception sometimes. But there's a useful way to do it at least: set the original exception as the cause of any new exception thrown, and make sure your exception logger walks the cause chain. You'll have an insanely long stack trace in your logs, but at least it'll be accurate.
- bjarneh 6y ago> set the original exception as the cause of any new exception thrown 100%, not only did this person make a pretty strange design, he has completely misunderstood how exceptions are to be used. even when he remembers exceptions, he fails to make them the root cause of the new exceptions he throws. truly a remarkable design, in all the wrong ways.
- bjarneh 6y ago> this construct completely undermines the whole purpose of it Absolutely, a bad design that says more about the designer of that piece of code, than the language (Java). Error handling can and should be discussed, but I hope people don't use this as an example to illustrate how bad Java checked exceptions are. This is just some nonsense that can be constructed when you misunderstand underlying concepts, which is possible in any language.
- fxtentacle 6y agoYes. But sadly, that (in retrospect bad) decision has been part of the Java standard library for 20 years now. Here's a bug report from 2001 where the rememberedException had accidentally changed its behaviour: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4523989 https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4523989
- bjarneh 6y agoIncredible. It looks like much of the early Java web stuff was so poorly designed, it's baffling that it ever got accepted as part of anything. * Java Server Faces * Tag libraries * Portlets How did any of this become official Java technology.
- willtim 6y agoMy jaw dropped the first time I learned that JSF was translated (not sure compiled is the right word) into Servlets full of print statements. And of course no JSF-based application has ever managed to produce valid well-formed HTML ever since.
- bjarneh 6y agoIt should be noted that you are now referring to the sanest part of Java Server Faces, i.e. its first template system: Java Server Pages or JSP. If think JSP that compiles to a bunch of Servlets filled with print statements is bad, you really have to look at the rest of that stuff; because it gets a lot worse :-) The stateful design, which fills up templates with a bunch of hidden html-input fields, in order to open web-pages in the same "state" as you left them and all sorts of other crap. You also need to look into Portlets, which "splits" up a web-pages into seemingly stand-alone components. These are then combined into horribly complicated Servlets as you deploy, where http paramters are namespaced with some random _portletId=lsøjfksjo1920 things in order to figure out which parameters goes to which "part of the web-page". Again, all of this is so bad, you'd think it was a joke; but it was Java's offering for web-development, and a huge number of people CHOOSE that technology in the early 2000's.