From 666c3730bc9ada96823aaef5008618121675cd62 Mon Sep 17 00:00:00 2001 From: serso Date: Sun, 10 Jan 2016 12:29:05 +0100 Subject: [PATCH] Unnecessary try/finally removed --- .../android/calculator/EditorView.java | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/org/solovyev/android/calculator/EditorView.java b/app/src/main/java/org/solovyev/android/calculator/EditorView.java index b95682fc..b2e32fc4 100644 --- a/app/src/main/java/org/solovyev/android/calculator/EditorView.java +++ b/app/src/main/java/org/solovyev/android/calculator/EditorView.java @@ -31,14 +31,12 @@ import android.util.AttributeSet; import android.util.Log; import android.view.ContextMenu; import android.widget.EditText; - import org.solovyev.android.Check; import org.solovyev.android.calculator.onscreen.CalculatorOnscreenService; -import java.lang.reflect.Method; - import javax.annotation.Nonnull; import javax.annotation.Nullable; +import java.lang.reflect.Method; public class EditorView extends EditText { @@ -85,20 +83,16 @@ public class EditorView extends EditText { public void setState(@Nonnull final EditorState state) { Check.isMainThread(); - try { - // we don't want to be notified about changes we make ourselves - reportChanges = false; - if (App.getTheme().light && getContext() instanceof CalculatorOnscreenService) { - // don't need formatting - setText(state.getTextString()); - } else { - setText(state.text, BufferType.EDITABLE); - } - final int selection = Editor.clamp(state.selection, length()); - setSelection(selection); - } finally { - reportChanges = true; + // we don't want to be notified about changes we make ourselves + reportChanges = false; + if (App.getTheme().light && getContext() instanceof CalculatorOnscreenService) { + // don't need formatting + setText(state.getTextString()); + } else { + setText(state.text, BufferType.EDITABLE); } + setSelection(Editor.clamp(state.selection, length())); + reportChanges = true; } @Override