You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/12/31 17:01:52 UTC

[commons-bsf] 02/02: Use Character cache.

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bsf.git

commit 93426b3c11eec612f64af4806e542c6c960fb0b4
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Dec 31 12:01:46 2020 -0500

    Use Character cache.
---
 src/main/java/org/apache/bsf/util/type/TypeConvertorRegistry.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/bsf/util/type/TypeConvertorRegistry.java b/src/main/java/org/apache/bsf/util/type/TypeConvertorRegistry.java
index abe552a..a750c9b 100644
--- a/src/main/java/org/apache/bsf/util/type/TypeConvertorRegistry.java
+++ b/src/main/java/org/apache/bsf/util/type/TypeConvertorRegistry.java
@@ -91,7 +91,7 @@ public class TypeConvertorRegistry {
         } else if (to == Byte.class || to == byte.class) {
           return Byte.valueOf (str);
         } else if (to == Character.class || to == char.class) {
-          return new Character (str.charAt (0));
+          return Character.valueOf (str.charAt (0));
         } else if (to == Short.class || to == short.class) {
           return Short.valueOf (str);
         } else if (to == Integer.class || to == int.class) {
@@ -115,7 +115,7 @@ public class TypeConvertorRegistry {
                "} else if (to == Byte.class || to == byte.class) {\n" +
                "return Byte.valueOf (str);\n" +
                "} else if (to == Character.class || to == char.class) {\n" +
-               "return new Character (str.charAt (0));\n" +
+               "return Character.valueOf (str.charAt (0));\n" +
                "} else if (to == Short.class || to == short.class) {\n" +
                "return Short.valueOf (str);\n" +
                "} else if (to == Integer.class || to == int.class) {\n" +