Yes, catching any RuntimeException
is almost always a code smell. The C2 Wiki seems to agree.
An exception would probably be some specially defensive pieces of code which run pretty much random code from other modules. Examples for such defensive structures would be the EDT, ThreadPools/Executors and plugin system.
More Related Contents:
- Android, NullPointerException
- What is a NullPointerException, and how do I fix it?
- Loading resources like images while running project distributed as JAR archive
- Which @NotNull Java annotation should I use?
- NullPointerException in Java with no StackTrace
- Why comparing Integer with int can throw NullPointerException in Java?
- java.lang.NullPointerException is thrown using a method-reference but not a lambda expression
- Error invoke virtual method ‘double android.location.Location.getLatitude()’ on a null object reference
- JavaFX Location is not set error message [duplicate]
- Filter values only if not null using lambda in Java8
- Why does int num = Integer.getInteger(“123”) throw NullPointerException?
- How do you tell if a checkbox is selected in Selenium for Java?
- Android: Pass data(extras) to a fragment
- Why static fields are not initialized in time?
- When is it OK to catch NullPointerException?
- Why does null reference print as “null”
- Why should one use Objects.requireNonNull()?
- Java conditional operator ?: result type
- JPA/Hibernate Static Metamodel Attributes not Populated — NullPointerException
- Apache POI – FileInputStream works, File object fails (NullPointerException)
- Spring Boot – Environment @Autowired throws NullPointerException
- Why can I throw null in Java? [duplicate]
- java.lang.NullPointerException: Attempt to invoke virtual method on a null object reference [duplicate]
- NullPointerException stack trace not available without debug agent
- Gracefully avoiding NullPointerException in Java
- Attempt to invoke virtual method ‘void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)’ on a null object reference
- Which @NonNull Java annotation to use [duplicate]
- Why ternary operation gives nullpointer while its ifelse counterpart doesn’t? [duplicate]
- Android: java.lang.NullPointerException: Attempt to invoke virtual method ‘java.lang.String java.lang.Object.toString()’ on a null object reference
- How do I avoid checking for nulls in Java?