Linked Questions

129 votes
6 answers
193k views

I need to catch two exceptions because they require the same handling logic. I would like to do something like: catch (Exception e, ExtendsRuntimeException re) { // common logic to handle both ...
user710818's user avatar
  • 24.4k
13 votes
1 answer
13k views

I have the following code: try { //do some } catch (NumberFormatException e) { return DynamicFilterErrorCode.INVALID_VALUE; } catch (ClassCastException e) { return DynamicFilterErrorCode....
St.Antario's user avatar
  • 27.7k
2 votes
4 answers
3k views

I have the following code try { // code } catch (Exception1 e1) { if (condition) { //code } else { throw e1; } } catch (Exception2 ...
Sairam Sankaran's user avatar
-1 votes
5 answers
6k views

i have below piece of code which in my spring boot applicatin. This piece of code does email validation, class EmailValidation { public static void validate(List<String> s){ try { ...
Jeena's user avatar
  • 17
1 vote
3 answers
260 views

I know it is a probable duplicate of this question. But the answer to that question includes the | inside the catch (..|..) which is unsupported in the earlier Java versions. I am bound to use an old ...
Buras's user avatar
  • 3,109
0 votes
2 answers
220 views

If I have a try/catch block which catches an IndexOutOfBounds exception, but in the same code, I want to access a file, is it possible to do a general excepction which could catch an IOException too? ...
Ronnie Lightweightbaby Coleman's user avatar
0 votes
2 answers
505 views

public void run() { final V value; try { value = getDone(future); } catch (ExecutionException e) { callback.onFailure(e.getCause()); return; } catch (...
lai nan's user avatar
  • 91
77 votes
16 answers
70k views

Whilst analysing some legacy code with FXCop, it occurred to me is it really that bad to catch a general exception error within a try block or should you be looking for a specific exception. Thoughts ...
Triss's user avatar
  • 847
97 votes
8 answers
120k views

What new features in java 7 is going to be implemented? And what are they doing now?
user avatar
24 votes
3 answers
88k views

I know JDK 1.5 pretty well. As we all know, besides new API (such as AtomicInteger, for example), there were major language changes such as providing support for generic, adding enum, prividing auto-...
alexsmail's user avatar
  • 5,823
15 votes
3 answers
22k views

Faced this java.lang.VerifyError with code snippet as below during JVM loading bytecode. try{ ----- } catch (NumberFormatException|CalculationException e) { } Here CalculationException is custom ...
tarunk's user avatar
  • 609
2 votes
6 answers
2k views

I am trying to handle the exceptions that are a part of the java.net package. I went through the documentation and I saw 12 exceptions belonging to that package, but I couldn't find the parent class ...
Prasanth G's user avatar
2 votes
3 answers
6k views

I want to make sample to play an audio file in android ,i want to play music from internal memory of phone .how to give path please suggest. I am writing this,but facing java.io.IOException:prepare ...
Uzeeta Siloth's user avatar
1 vote
4 answers
3k views

im trying to handle exceptions on my code and at the same time without repeating it. I have lots of method on the "System" Class and i would prefer not to write "Try Catch" in all of them as i ...
Laurenzanoster's user avatar
0 votes
1 answer
3k views

how can i catch 2 or more exception in same time ? Should i use trycatch-block for each all issue ? For example, i couldn t catch b.charAt() to "Null Pointer Exception" after ...
Harchi's user avatar
  • 1

15 30 50 per page