NullPointerException in Charset.java:493
Kurt Miller
lists at intricatesoftware.com
Fri Feb 24 08:10:10 PST 2006
Hi,
This will be fixed with patchset 3 in a few weeks.
-Kurt
On Thursday 23 February 2006 7:47 pm, Serge Baranov wrote:
> Hello All,
>
> The following exception is thrown when calling:
> Charset.availableCharsets() JDK method.
>
> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> at java.nio.charset.Charset.put(Charset.java:493)
> at java.nio.charset.Charset.access$300(Charset.java:240)
> at java.nio.charset.Charset$4.run(Charset.java:529)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.nio.charset.Charset.availableCharsets(Charset.java:525)
>
> It has been already discussed:
> http://lists.freebsd.org/mailman/htdig/freebsd-java/2005-September/004339.html
> but the problem still exists.
>
> Here is the test case that will reproduce the problem:
>
> import java.nio.charset.Charset;
> import java.util.Iterator;
> import java.util.Set;
>
> public class TestCase {
> public static void main(String[] args) {
> Set set = Charset.availableCharsets().keySet();
> for (Iterator iterator = set.iterator(); iterator.hasNext();) {
> String s = (String) iterator.next();
> System.out.println(s);
> }
> }
> }
>
> Save into TestCase.java
> Compile: javac TestCase.java
> Run: java TestCase
>
> Expected result: list of available charsets printed.
> Actual result: NPE is thrown at java.nio.charset.Charset.put(Charset.java:493)
>
> For some reason there is null charset returned at this point:
> Charset cs = (Charset)i.next();
>
> Suggested fix: either add a null check as per Dan Cojocar reply or
> investigate why null appears there and fix it on the earlier stage.
>
> Fixing this bug is very important, since it breaks functionality of
> almost any Java application that operates charsets (like IntelliJ IDEA).
>
> System information:
>
> $ java -version
> java version "1.5.0-p2"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-p2-root_23_feb_2006_08_02)
> Java HotSpot(TM) Client VM (build 1.5.0-p2-root_23_feb_2006_08_02, mixed mode)
> 6.1-PRERELEASE i386
>
> P.S. I'm not subscribed to this list, put my address in CC field when
> replying.
>
>
> Serge Baranov
> JetBrains, Inc
> http://www.jetbrains.com
> "Develop with pleasure!"
>
> _______________________________________________
> freebsd-java at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-java
> To unsubscribe, send any mail to "freebsd-java-unsubscribe at freebsd.org"
>
More information about the freebsd-java
mailing list