< prev index next >

make/data/characterdata/CharacterDataLatin1.java.template

Print this page
rev 48740 : [mq]: 8196740-Character-digit-returns-wrong-value-for-out-of-range-radix

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -23,12 +23,10 @@
  * questions.
  */
 
 package java.lang;
 
-import java.util.Arrays;
-
 /** The CharacterData class encapsulates the large tables found in
     Java.lang.Character. */
 
 class CharacterDataLatin1 extends CharacterData {
 

@@ -188,14 +186,12 @@
         -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
         -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
 
     int digit(int ch, int radix) {
         int value = DIGITS[ch];
-        if (value >= 0 && radix >= Character.MIN_RADIX && radix <= Character.MAX_RADIX) {
-            value = (value < radix) ? value : -1;
-        }
-        return value;
+        return (value >= 0 && value < radix && radix >= Character.MIN_RADIX
+                && radix <= Character.MAX_RADIX) ? value : -1;
     }
 
     int getNumericValue(int ch) {
         int val = getProperties(ch);
         int retval = -1;
< prev index next >