JDK-5101626 : Unexpected NPE from toLowerCase
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 5.0
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,windows_xp
  • CPU: generic,x86
  • Submitted: 2004-09-14
  • Updated: 2012-10-09
  • Resolved: 2004-09-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6
5.0u1 01Fixed 6Fixed
Related Reports
Duplicate :  
toLowerCase(Locale.ENGLISH) failes with NPE for some strings.
This behavior is unspecified and different from 1.4.2

Use following testcase to reproduce:

import java.util.Locale;
public class LC {
 public static void main(String[] args) {

###@###.### 2004-09-14

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.5.0_01 mustang FIXED IN: 1.5.0_01 mustang INTEGRATED IN: 1.5.0_01

EVALUATION Name: nl37777 Date: 09/14/2004 The implementation of the toLowerCase and toUpperCase methods in Character and String uses a constant CHAR_ERROR to indicate a variety of special conditions (not necessarily errors). The value of this constant is \uffff. Now, while \uffff is not a valid character, it is a valid code point, and the JRE does nothing to prevent this value from being used as input to the toLowerCase and toUpperCase methods. By using \uffff as the value of the error constant, the implementation gets confused between (marginally) valid input and the error constant and runs into the wrong code branch, which causes the exception. ======================================================================