Details about the known misuse from the MUBench dataset.
Description: | Catches Throwable, which might supress Errors, like OutOfMemory, TheadDeath, ...
|
Fix Description: |
Catch specific exception.
|
Violation Types: |
- superfluous/exception handling
|
In File: | SupressError.java |
In Method: | misuse(Target) |
Code with Misuse: |
class SupressError {
public void misuse(Target target) {
byte[] data = null;
try {
data = target.loadData();
} catch (Throwable t) {
data = new byte[0];
}
// use data..
}
}
|
Code with Pattern(s): |
public class CatchSpecific {
public void pattern(Target target) {
byte[] data = null;
try {
data = target.loadData();
} catch (ParseException t) {
data = new byte[0];
}
// use data..
}
}
|