About 183,000 results
Open links in new tab
  1. Java 8: How do I work with exception throwing methods in streams?

    With the sneak exception handler, the compiler now doesn't allow you to wrap the forEach in a try block, and if you mark the method as throws <checked exception>, will warn that that exception isn't thrown …

  2. Handling exceptions from Java ExecutorService tasks

    252 I'm trying to use Java's ThreadPoolExecutor class to run a large number of heavy weight tasks with a fixed number of threads. Each of the tasks has many places during which it may fail due to …

  3. Java 8 Lambda function that throws exception? - Stack Overflow

    Disclaimer: I haven't used Java 8 yet, only read about it. Function<String, Integer> doesn't throw IOException, so you can't put any code in it that throws IOException. If you're calling a method that …

  4. Can I catch multiple Java exceptions in the same catch clause?

    In your Java 6 example shouldn't you be rethrowing the original exception instead of creating a new exception instance, i.e. throw exc instead of throw new RuntimeException(exc)?

  5. java - Throwing exception from CompletableFuture - Stack Overflow

    Jun 7, 2017 · This solution will re-throw all “unexpected” throwables in their wrapped form, but only throw the custom ServerException in its original form passed via the exception future.

  6. Order of catching exceptions in Java - Stack Overflow

    Jun 10, 2012 · So, when catching exceptions you want to always catch the most specific first and then the most generic (as RuntimeException or Exception). For instance, imagine you would like to catch …

  7. What Java exception class to use for HTTP errors?

    11 Check out the page on Exception Handling for HttpClient To answer your question though there appears to be an org.apache.commons.httpclient.HttpException class that is probably a good fit. If …

  8. How to create a custom exception type in Java? [duplicate]

    There is 1) creating a custom exception type/class (as shown so many times) and 2) raising the exception. To raise an exception, simply pass the appropriate instance to throw, normally: throw new …

  9. java - Exception handling : throw, throws and Throwable - Stack Overflow

    Oct 15, 2010 · Can any of you explain what the differences are between throw, throws and Throwable and when to use which?

  10. java - Exception handling through spring AOP - Stack Overflow

    1 Consider using global exception handler by @ExceptionHandler and @ControllerAdvice Create a CustomExceptionHandler. Add @ControllerAdvice annotation at class level. And add …