Article View: borland.public.jbuilder.debugger
Article #126Re: Unable to step into ?
From: John McGrath [TeamB]
Date: Thu, 04 Nov 2004 17:25
Date: Thu, 04 Nov 2004 17:25
57 lines
3192 bytes
3192 bytes
On 11/4/2004 at 8:01:18 AM, JasonYang wrote:
> 1 i want to step into the method toArray(Object[]) of class
> java.util.LinkedHashSet ,but when i clicked the button "Step into",it
> just stepped over it,why?
See "Classes with tracing disabled" on the "Run" menu.
> Moreover,when i put the class java.util.LinkedHashSet into my project,
> it also can't step into?
What do you mean when you say you put this class in your project? Do you
mean that you referenced the class, or that you copied the source to your
project? If the latter, hat probably will not work, due to package
sealing issues.
> 2 My codes is as follows:
> ArrayList al=new ArrayList();
> al.add("a");
> al.add("b");
> al.add("c");
> LinkedHashSet lset=new LinkedHashSet(al);
> String[] ss=new String[1];//array ss has a element
> lset.toArray(ss);//please see the source of method toArray(Object[] a) in
> the class java.util.LinkedHashSet
> //it annouces that it can enlarge the size of array a
> ,but when the size of array of real
> //parameter is less than the size of set,it will throw an exception,why?
> for(int i=0;i<ss.length();i++)
> System.out.print(ss[i]); // there's an nullpointer exception
This is pretty hard to read. It would help if you would describe the
problem in a separate text block and then show the problem code using
relatively short lines. I cannot tell if the text "lset.toArray(ss);" is
part of your comment or part of the code.
You ask us to look at the source code for LinkedHashSet, but you do not
say JDK you are using, so it is difficult to find the source you are
referring to. The source does change between versions. I looked at
several JDK versions, and none of the different implementations of
LinkedHashSet defines a toArray(Object[]) method. That method is
inherited from one of its superclasses. Can you be more specific about
which class / method / version you are talking about?
> System.out.print(ss[i]); // there's an nullpointer exception
If this is getting a NullPointerException on this line, then the only
explanation is that "ss" is null.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<xn0dpd5pd4ve9lh001@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<418a294b@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: ff5c5,a60b699c9e3e6de1 X-Google-Attributes: gidff5c5,public X-Google-Language: ENGLISH,ASCII-7-bit From: "John McGrath [TeamB]" <ng-b@JPMcGrath.net> Subject: Re: Unable to step into ? Newsgroups: borland.public.jbuilder.debugger References: <418a294b@newsgroups.borland.com> User-Agent: XanaNews/1.16.4.6 Message-ID: <xn0dpd5pd4ve9lh001@newsgroups.borland.com> X-Ref: newsgroups.borland.com ~XNS:00000024 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 NNTP-Posting-Host: 151.197.59.148 Date: 4 Nov 2004 10:25:02 -0700 X-Trace: newsgroups.borland.com 1099592702 151.197.59.148 (4 Nov 2004 10:25:02 -0700) Lines: 57 X-Authenticated-User: jpmcgrath Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail