runtime-exception

Equivalent of IllegalArgumentException of Java in C++

In Java if an input argument to a method is invalid, we can throw an IllegalArgumentException (which is of type RuntimeException). In C++, there is no notion of checked and unchecked exceptions. Is there a similar exception in standard C++ which can be used to indicate a runtime exception? Or is there a common style not in the standard b...

Wrap exceptions by runtime exceptions with an annotation

Is there a way to annotate a method so all exceptions thrown are converted to runtime exception automagically? @MagicAnnotation // no throws clause! void foo() { throw new Exception("bar")' } ...

How to properly catch RuntimeExceptions from Executors?

Say that I have the following code: ExecutorService executor = Executors.newSingleThreadExecutor(); executor.execute(myRunnable); Now, if myRunnable throws a RuntimeExcpetion, how can I catch it? One way would be to supply my own ThreadFactory implementation to newSingleThreadExecutor() and set custom uncaughtExceptionHandlers for the...

Handling runtime exceptions in Java

HiAll, Can anyone explain how to handle the runtime exceptions in Java? Thanks, Ravi ...

Runtime Java Class extension not working.

Good day, I have the following problem: class B extends class A and methods of both are called by another method in another class after instantiating class B (example follows): public class A{ //fields //constructors //methods } public class B extends A{ //fields //constructors //methods } public class CALLER{ ...

Why NullPointerException is a runtime exception and RemoteException not?

A possible reason because a NullPointerException is a runtime exception is because every method can throw it, so every method would need to have a "throws NullPointerException", and would be ugly. But this happens with RemoteException. And a possible reason because RemoteException is not a runtime exception, is to tell it client to trea...

Cascading runtime errors in Java Swing

I'm currently integrating some new classes into an existing application. I have a JDialog which, when clicked, throws a number of runtime exceptions. I'm new to Java debugging - why would all of these Swing/AWT library functions be 'unavailable'? SO forbids me from posting images, so here's a link to a capture of the eclipse debugger:...