From 7601049275e0e81d8f494ccb22bdb8b06bfcd806 Mon Sep 17 00:00:00 2001 From: Ray Essick Date: Thu, 3 Nov 2016 14:45:56 -0700 Subject: [PATCH] Stop using return within finally Refactor code to avoid a return statement inside a finally block. Such constructs interfere with exception propagation in non-obvious ways and are therefore considered bad practice. Bug: 32586420 Test: manual code walk --- core/java/android/hardware/radio/RadioMetadata.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/core/java/android/hardware/radio/RadioMetadata.java b/core/java/android/hardware/radio/RadioMetadata.java index b7715da5ff611..d07b40759be7e 100644 --- a/core/java/android/hardware/radio/RadioMetadata.java +++ b/core/java/android/hardware/radio/RadioMetadata.java @@ -530,14 +530,13 @@ public final class RadioMetadata implements Parcelable { Bitmap bmp = null; try { bmp = BitmapFactory.decodeByteArray(value, 0, value.length); - } catch (Exception e) { - } finally { - if (bmp == null) { - return -1; + if (bmp != null) { + mBundle.putParcelable(key, bmp); + return 0; } - mBundle.putParcelable(key, bmp); - return 0; + } catch (Exception e) { } + return -1; } int putClockFromNative(int nativeKey, long utcEpochSeconds, int timezoneOffsetInMinutes) {