Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

jdk1.5.0p2 nio NPE

0 views
Skip to first unread message

Dan Cojocar

unread,
Sep 21, 2005, 10:34:53 AM9/21/05
to
Hello all,

I just tried the new patchset and i receive the following exception when i
want to start Intellij's idea:

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)
at com.intellij.openapi.vfs.CharsetToolkit.getAvailableCharsets(
CharsetToolkit.java:414)
at
com.intellij.cvsSupport2.config.CvsApplicationLevelConfiguration.encodingEx=
ists
(CvsApplicationLevelConfiguration.java:85)
at
com.intellij.cvsSupport2.config.CvsApplicationLevelConfiguration.readExtern=
al
(CvsApplicationLevelConfiguration.java:78)
at
com.intellij.openapi.components.impl.ComponentManagerImpl.doInitJdomExterna=
lizable
(ComponentManagerImpl.java:292)
at
com.intellij.openapi.components.impl.ComponentManagerImpl.initJdomExternali=
zable
(ComponentManagerImpl.java:225)
at com.intellij.openapi.components.impl.ComponentManagerImpl.a(
ComponentManagerImpl.java:46)
at com.intellij.openapi.components.impl.ComponentManagerImpl.access$000(
ComponentManagerImpl.java:115)
at
com.intellij.openapi.components.impl.ComponentManagerImpl$MyComponentAdapte=
rFactory$1.getComponentInstance
(ComponentManagerImpl.java:1)
at
org.picocontainer.defaults.DecoratingComponentAdapter.getComponentInstance(
DecoratingComponentAdapter.java:44)
at org.picocontainer.defaults.CachingComponentAdapter.getComponentInstance(
CachingComponentAdapter.java:38)
at org.picocontainer.defaults.DefaultPicoContainer.getInstance(
DefaultPicoContainer.java:322)
at org.picocontainer.defaults.DefaultPicoContainer.getComponentInstance(
DefaultPicoContainer.java:305)
at
com.intellij.openapi.extensions.impl.AreaPicoContainerImpl$4.visitContainer=
(
AreaPicoContainerImpl.java:120)
at org.picocontainer.defaults.DefaultPicoContainer.accept(
DefaultPicoContainer.java:416)
at
org.picocontainer.alternatives.AbstractDelegatingMutablePicoContainer.accep=
t
(AbstractDelegatingMutablePicoContainer.java:134)
at
com.intellij.openapi.extensions.impl.AreaPicoContainerImpl.getComponentInst=
ance
(AreaPicoContainerImpl.java:107)
at
com.intellij.openapi.components.impl.ComponentManagerImpl.instantiateCompon=
ent
(ComponentManagerImpl.java:152)
at com.intellij.openapi.components.impl.ComponentManagerImpl.a(
ComponentManagerImpl.java:194)
at com.intellij.openapi.components.impl.ComponentManagerImpl.a(
ComponentManagerImpl.java:73)
at com.intellij.openapi.components.impl.ComponentManagerImpl.initComponents=
(
ComponentManagerImpl.java:79)
at com.intellij.openapi.application.impl.ApplicationImpl.initComponents(
ApplicationImpl.java:102)
at com.intellij.openapi.application.impl.ApplicationImpl.load(
ApplicationImpl.java:227)
at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:6)
at com.intellij.idea.Main$3.run(Main.java:1)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java
:128)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:89)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:146)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(
EventDispatchThread.java:234)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

Thanks,

Dan
_______________________________________________
freebs...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "freebsd-java...@freebsd.org"

Greg Lewis

unread,
Sep 22, 2005, 4:13:54 PM9/22/05
to
On Wed, Sep 21, 2005 at 05:34:32PM +0300, Dan Cojocar wrote:
> I just tried the new patchset and i receive the following exception when i
> want to start Intellij's idea:
>
> java.lang.NullPointerException
> at java.nio.charset.Charset.put(Charset.java:493)
[snip]

Is this a regression, i.e., did it work with patchset 1? Not knowing
how Intellij works, is it possible to run this under jdb and get some
more information on this (there are two variables on that line which
could cause a NullPointerException).

--
Greg Lewis Email : gle...@eyesbeyond.com
Eyes Beyond Web : http://www.eyesbeyond.com
Information Technology FreeBSD : gle...@FreeBSD.org

Maxim Sidnin

unread,
Sep 23, 2005, 2:37:42 AM9/23/05
to
> Is this a regression, i.e., did it work with patchset 1? Not knowing
> how Intellij works, is it possible to run this under jdb and get some
> more information on this (there are two variables on that line which
> could cause a NullPointerException).

Hi all, I have the same problem.
No, this doesn't work with patchset 1, only with jdk14 (any patch
level).

Here sample of code which throws that exception:
-----------------------------------------------------------------------------
import java.nio.charset.Charset;
import java.util.SortedMap;

public class ResearchCharsets {

public static void main(String[] args) {
System.out.println("START");
SortedMap<String, Charset> charsets =
Charset.availableCharsets(); // Here throwNullPointerException
for (String name : charsets.keySet()) {
System.out.println(name + "=" + charsets.get(name));
}
System.out.println("FINISH");
}
}
-----------------------------------------------------------------------------


Charset.availableCharsets() calls in some way:
-----------------------------------------------------------------------------
490 private static void put(Iterator i, Map m) {
491 while (i.hasNext()) {
492 Charset cs = (Charset)i.next();
493 if (!m.containsKey(cs.name()))
494 m.put(cs.name(), cs);
495 }
496 }
-----------------------------------------------------------------------------

NullPointerException is on 493 string.
NULL here is 'Charset cs'. I can't debug values here, but iteration
process in debug going normally before NullPointerException, so this is
not the 'Map m'

I reported this to freebs...@FreeBSD.org at 26 Aug 2005

Maxim Sidnin

unread,
Sep 23, 2005, 8:26:57 AM9/23/05
to
I have a solution, maybe this is not right but it works, with IntelliJ
Idea also.

1) Backup your ${JDK}/jre/lib/rt.jar to safely place
2) Unpack it to some temp directory (unzip rt.jar)
3) Add string before 493 in java.nio.charset.Charset.java (you have
src.zip):
if (cs == null) continue;
Some wrong (null) charset will not be added to list of systems
charsets.
4) Compile it with jdk1.5.0 javac
5) Replace 5 classes (4 inners) in unzipped rt.jar
6) Zip it back (in root of sources:> zip -r0 rt.jar .)
7) Replace jar in JRE for new one

Dan Cojocar

unread,
Sep 23, 2005, 4:41:15 PM9/23/05
to
On 9/22/05, Greg Lewis <gle...@eyesbeyond.com> wrote:
>
> On Wed, Sep 21, 2005 at 05:34:32PM +0300, Dan Cojocar wrote:
> > I just tried the new patchset and i receive the following exception whe=
n

> i
> > want to start Intellij's idea:
> >
> > java.lang.NullPointerException
> > at java.nio.charset.Charset.put(Charset.java:493)
> [snip]
>
> Is this a regression, i.e., did it work with patchset 1? Not knowing
> how Intellij works, is it possible to run this under jdb and get some
> more information on this (there are two variables on that line which
> could cause a NullPointerException).


Hello Greg,
I didn't noticed this on patchset 1 until now because I didn't have the new
eap from intellij, it seems that only with this last eap i get this NPE. Bu=
t
now i can confirm that patchset 1 is affected too :(

But if I modify line 493 in Charset.java to check if cs is not null,
intellij's idea is working properly.

--- Charset.java.orig Fri Sep 23 23:29:08 2005
+++ Charset.java Fri Sep 23 23:23:43 2005
@@ -490,7 +490,7 @@


private static void put(Iterator i, Map m) {

while (i.hasNext()) {
Charset cs =3D (Charset)i.next();
- if (!m.containsKey(cs.name()))
+ if (cs!=3Dnull&&!m.containsKey(cs.name()))
m.put(cs.name(), cs);
}
}


Thanks,
Dan

0 new messages