An exception is a rarely occurring (exceptional!) condition that requires deviation from the program's normal flow. Normally, an exception should not result in total failure, but instead be attended by an exception handler. Exception handling is a built-in construct in many programming languages. ...
456
votes
26answers
369k views
Dealing with “java.lang.OutOfMemoryError: PermGen space” error
Recently I ran into this error in my web application:
java.lang.OutOfMemoryError: PermGen space
It's a typical Hibernate/JPA + IceFaces/JSF application running on Tomcat 6 and JDK 1.6.
Apparently ...
140
votes
35answers
30k views
When to throw an exception [closed]
I have exceptions created for every condition that my application does not expect. UserNameNotValidException, PasswordNotCorrectException etc.
However I was told I should not create exceptions for ...
22
votes
2answers
5k views
Deciphering the .NET clr20r3 exception parameters P1..P10
i'm trying to decipher the meaning on the P1...P10 parameters associated with a clr20r3 that is written to the event log when my application experiences an exception.
The best i've been able to find ...
59
votes
21answers
7k views
Why not use exceptions as regular flow of control?
My question boils down to : “Why not use exception (or error- for that matter) handling for regular program flow?
To avoid all standard-answers I could have googled on, I will provide an example you ...
51
votes
11answers
13k views
When to choose checked and unchecked exceptions
In Java (or any other language with checked exceptions), when creating your own exception class, how do you decide whether it should be checked or unchecked?
My instinct is to say that a checked ...
52
votes
12answers
65k views
Reasons of getting a java.lang.VerifyError
I'm investigating the following java.lang.VerifyError
java.lang.VerifyError: (class: be/post/ehr/wfm/application/serviceorganization/report/DisplayReportServlet, method: getMonthData signature: ...
68
votes
16answers
14k views
Best practices for exception management in Java or C#
I'm stuck deciding how to handle exceptions in my application.
Much if my issues with exceptions comes from 1) accessing data via a remote service or 2) deserializing a JSON object. Unfortunately I ...
70
votes
12answers
21k views
throwing exceptions out of a destructor
Most people say never throw an exception out of a destructor - doing so results in undefined behavior. Stroustrup makes the point that "the vector destructor explicitly invokes the destructor for ...
64
votes
7answers
25k views
Java: checked vs unchecked exception explanation
I have read multiple posts on StackOverFlow about checked vs unchecked exceptions. I'm honestly still not quite sure how to use them properly.
Joshua Bloch in "Effective Java" said that
Use ...
3
votes
2answers
424 views
How to generate exceptions from RepaintManager
in connection with my question (may be) I found another exception type that I not able to catch and print-out from SwingWorker thread,
how can I to generate RepaintManager exceptions
EDIT: I read ...
22
votes
7answers
23k views
How to grant MODIFY_PHONE_STATE permission for apps ran on Gingerbread
I write an application that attempts to modify phone call state. It works well on Android 2.2 or less, but throw an exception on Android 2.3 because of the lack of permission on ...
80
votes
13answers
10k views
How slow are .NET exceptions?
I don't want a discussion about when to and not to throw exceptions. I wish to resolve a simple issue. 99% of the time the argument for not throwing exceptions revolves around them being slow while ...
30
votes
2answers
3k views
Object destruction in C++
When exactly are objects destroyed in C++, and what does that mean? Do I have to destroy them manually, since there is no Garbage Collector? How do exceptions come into play?
(Note: This is meant to ...
26
votes
7answers
3k views
Puzzling Enumerable.Cast InvalidCastException
The following throws an InvalidCastException.
IEnumerable<int> list = new List<int>() { 1 };
IEnumerable<long> castedList = list.Cast<long>();
...
412
votes
12answers
84k views
Catch multiple Exceptions at once?
It is discouraged to simply catch System.Exception, instead only the "known" Exceptions should be caught.
Now, this sometimes leads to unneccessary repetetive code, for example:
try
{
WebId = ...