From 552e23b8c0d3f985963d727c417a363da22eacee Mon Sep 17 00:00:00 2001 From: Sergey Solovyev Date: Wed, 5 Dec 2012 12:31:49 +0400 Subject: [PATCH] user exceptions fixed --- .../android/calculator/CalculatorImpl.java | 2 +- .../android/calculator/CalculatorMessages.java | 18 ++++-------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorImpl.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorImpl.java index 9b0e0dee..efc6a788 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorImpl.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorImpl.java @@ -544,7 +544,7 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { varBuilder.setName(CalculatorVarsRegistry.ANS); varBuilder.setValue(result); - varBuilder.setDescription(CalculatorMessages.getBundle().getString("ans_description")); + varBuilder.setDescription(CalculatorMessages.getBundle().getString(CalculatorMessages.ans_description)); CalculatorVarsRegistry.saveVariable(varsRegistry, varBuilder, ansVar, this, false); } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorMessages.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorMessages.java index c7aca604..59ad99a7 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorMessages.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorMessages.java @@ -2,9 +2,7 @@ package org.solovyev.android.calculator; import org.jetbrains.annotations.NotNull; -import java.util.HashMap; import java.util.Locale; -import java.util.Map; import java.util.ResourceBundle; /** @@ -14,9 +12,6 @@ import java.util.ResourceBundle; */ public final class CalculatorMessages { - @NotNull - private static final Map bundlesByLocale = new HashMap(); - private CalculatorMessages() { throw new AssertionError(); @@ -29,15 +24,7 @@ public final class CalculatorMessages { @NotNull public static ResourceBundle getBundle(@NotNull Locale locale) { - synchronized (bundlesByLocale) { - ResourceBundle result = bundlesByLocale.get(locale); - if (result == null) { - result = ResourceBundle.getBundle("org/solovyev/android/calculator/messages", locale); - bundlesByLocale.put(locale, result); - } - - return result; - } + return ResourceBundle.getBundle("org/solovyev/android/calculator/messages", locale); } /* Arithmetic error occurred: {0} */ @@ -63,4 +50,7 @@ public final class CalculatorMessages { /* Result copied to clipboard! */ public static final String result_copied = "result_copied"; + + /* Last calculated value */ + public static final String ans_description = "ans_description"; }