public boolean sendDeviceEvent() {
boolean status = false;
try {
device.sendEvent("blah...blah");
status = true;
} catch (Exception e) {
log.error("Failed to send NodeLowBattery Event - {} {}", createNodeLowBatteryNotification(), e.getCause());
} finally {
return status;
}
}
Run Code Online (Sandbox Code Playgroud)
我想知道上面的代码如何被认为是不好的做法,因为它从最后返回.根据字节码信息,最后不会突然返回,最后没有设置值.怎么会被认为是坏事?