you know what I really hate?

A

Andy Fish

it's stuff like this:

try {
...
...
} catch (Exception ex) {
System.out.println("An Exception happened");
throw new Exception("an exception happened")
}
 
J

Joona I Palaste

Andy Fish said:
it's stuff like this:
try {
...
...
} catch (Exception ex) {
System.out.println("An Exception happened");
throw new Exception("an exception happened")
}

I suspect it's good for debugging, but even then it could be like this:

try {
...
...
}
catch (Exception ex) {
System.out.println("An Exception happened");
throw ex;
}

Note that the stack trace of an exception starts at where the exception
object was constructed, not where it was thrown.
 
P

Peter Kirk

Andy Fish said:
it's stuff like this:

try {
...
...
} catch (Exception ex) {
System.out.println("An Exception happened");
throw new Exception("an exception happened")
}

Writing to System.out?
Catching "Exception"?
Catching Exception and then throwing a new Exception?
Not logging/displaying/using the actual exception message?
Not putting the curly braces on new lines?
Not putting a semicolon at the end of throw new Exception?
Dots inside a try block?

Having a bad day?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top