Issue Details (XML | Word | Printable)

Key: CODEC-10
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Reggie Riser
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons Codec

[codec] Using US_ENGLISH static in Soundex causes NPE

Created: 14/Dec/05 07:29 AM   Updated: 27/Oct/07 06:49 AM
Return to search
Component/s: None
Affects Version/s: 1.3
Fix Version/s: 1.4

Time Tracking:
Not Specified

File Attachments:
  Size
Java Source File SoundexStaticTest.java 2005-12-14 07:31 AM Reggie Riser 0.4 kB
Environment:
Operating System: Windows XP
Platform: PC

Bugzilla Id: 37894


 Description  « Hide
If I generate a soundex like so:
Soundex.US_ENGLISH.soundex( "Williams" )
I get a NullPointerException.

But if I use the following:
new Soundex().soundex( "Williams" )
everything works fine.

I think the order of initialization of statics may be to blame. I'll attach a
test case.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Reggie Riser added a comment - 14/Dec/05 07:31 AM
Created an attachment (id=17213)
JUnit test case

Tim O'Brien added a comment - 08/Jan/06 04:59 AM
Yes, you are correct, if you move the static variables around, your test cases
pass. I've added you test case to the mix and changed the order of the static
variables. US_ENGLISH now works.

Thanks

(In reply to comment #0)
> If I generate a soundex like so:
> Soundex.US_ENGLISH.soundex( "Williams" )
> I get a NullPointerException.
>
> But if I use the following:
> new Soundex().soundex( "Williams" )
> everything works fine.
>
> I think the order of initialization of statics may be to blame. I'll attach a
> test case.


Tim O'Brien added a comment - 08/Jan/06 04:59 AM
Commit'd fix for issue 37894, the order of the static variable has been changed.
The static US_ENGLISH is now last, test cases added