99 if (field.isAnnotationPresent(Entry.class))
100 try {
101 info.defaultValue = field.get(null);
102 } catch (IllegalAccessException ignored) {103 }104 }
105 try (BufferedReader reader = Files.newBufferedReader(path)) {
106 gson.fromJson(reader, config);
113 try {
114 info.value = info.field.get(null);
115 info.tempValue = info.value.toString();
116 } catch (IllegalAccessException ignored) {117 }118 }
119 }
120
204 try {
205 info.colorButton.setMessage(new LiteralText("⬛")
206 .setStyle(Style.EMPTY.withColor(Color.decode(info.tempValue).getRGB())));
207 } catch (Exception ignored) {208 }209 }
210 return true;
211 };
249 for (EntryInfo info : entries) {
250 try {
251 info.field.set(null, info.value);
252 } catch (IllegalAccessException ignored) {253 }254 }
255 }
256
266 try {
267 info.value = info.field.get(null);
268 info.tempValue = info.value.toString();
269 } catch (IllegalAccessException ignored) {270 }271 }
272 }
273
When a catch
clause is empty, it essentially ignores any occurrences of the particular exception it handles. This could allow critical bugs to go undiagnosed because any relevant exceptions indicative of a bug would be discarded within this catch
block.
try {
// ...
} catch(Exception e) {
// Nothing here
}
Consider at least logging the exception to ensure that issues that may actually be bugs are not missed.
try {
// ...
} catch(Exception e) {
System.err.println(e.message); // It may be better to make use of a more robust logging solution like logback.
}