Board index » jbuilder » Unable to step into ?

Unable to step into ?


2004-11-04 09:01:18 PM
jbuilder20
hi,ladies and gentlemen,
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? Moreover,when i put the class java.util.LinkedHashSet
into my project,it also can't step into? would you like to give me some
reasons?
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
 
 

Re:Unable to step into ?

On 11/4/2004 at 8:01:18 AM, JasonYang wrote:
Quote
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.
Quote
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.
Quote
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?
Quote
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:
www.JPMcGrath.net/newsgroups/e-mail.html