just curious. java.util.List would be a better fit here. any specific reason
why you want an array.

regards
Ashok

On 7/24/07, Chris Lamey <[EMAIL PROTECTED]> wrote:

Hello,

As Ashok said on Sunday, the RowBeheer[] array is never initialized.
When you try to assign a value into an uninitialized array, you get a
null pointer exception.

You need something like this after you get the resultList back from the
selectByExample call:

rowBeheer = new RowBeheer[resultList.size()];

Cheers,
Chris

On Tue, 2007-07-24 at 18:22 +0200, Jdev wrote:
> In my stacktrace I get an error on the line:
>
> rowBeheer[i] = new RowBeheer();
>
> In my logfile I get this as result =
>
> Error resultList : Cause : java.lang.NullPointerException
>
> I think that I have gone wrong somewhere; this block of code is loaded
> only in the memory and is not visible for the user. The systems looks
> up the user of he has permission to access the system. I think I do
> something wrong with []
>
>
>
> public RowBeheer[] readBeheerList1(String ondnr) {
>
>  RowBeheer[] rowBeheer = null;
>
>  try {
>
>  dao.BeheerDAO beheerDao = (dao.BeheerDAO)
>
>  DaoManagerRequester.getDaoManager().getDao(dao.BeheerDAO.class);
>
>  model.BeheerExample beheerExample = new model.BeheerExample();
>
>  beheerExample.createCriteria().andReferentienummerLike(likesleutel);
>
>  List resultList = beheerDao.selectByExample(beheerExample);
>
>  if (resultList.size() > 0) {
>
>  for(int i = 0; i < resultList.size(); i++) {
>
>  rowBeheer[i] = new RowBeheer(); error in the in stacktrace
>
>  model.Beheer beheer = (model.Beheer) resultList.get(i);
>
>  rowBeheer[i].setReferentienummer(beheer.getReferentienummer());
>
>  rowBeheer[i].setVolgnr(beheer.getVolgnr());
>
>  rowBeheer[i].setRowdatumbegin(String.valueOf(beheer.getRowdatumbegin
()));
>
>  rowBeheer[i].setRowdatumeinde(String.valueOf(beheer.getRowdatumeinde
()));
>
>  rowBeheer[i].setKantoorcode(beheer.getKantoorcode());
>
>  rowBeheer[i].setDossierstatus(beheer.getDossierstatus());
>
>  return rowBeheer;
>
>  }
>
> }
>
> } catch (Exception e) {
>
>   e.printStackTrace();
>
>  }
>
>  return null;
>
>  }
>
>
>
>
>
>
>
>
>
>
>
>
> -----Original Message-----
>
> From: Richard Yee [mailto:[EMAIL PROTECTED]
>
> Sent: zondag 22 juli 2007 21:46
>
> To: user-java@ibatis.apache.org
>
> Subject: Re: Problem with nullpointerException.
>
> What line is it occurring on?
>
> Did you initialize the DaoManager with the sqlMapConfig file?
>
> This code:
>
> dao.BeheerDAO beheerDao = (dao.BeheerDAO)
>
> DaoManagerRequester.getDaoManager().getDao(dao.BeheerDAO.class);
>
> could be put somewhere else b/c it only has to run once. You could
> store
>
> the DAO in application scope.
>
> -Richard
>
> Davy wrote:
>
> >
>
> > Can someone explain me how I get the code mentioned below running?
>
> >
>
> > The problem is that it concerns a list and I don't know correct how
> I
>
> > get it to work, the code that I developed gives me each time a
>
> > nullpointerexception when I run it.
>
> >
>
> > Can someone give me some information about what I do wrong?
>
> >
>
> > public RowBeheer[] readBeheerList1(String ondnr) {
>
> >
>
> > RowBeheer[] rowBeheer = null;
>
> >
>
> > try {
>
> >
>
> > dao.BeheerDAO beheerDao = (dao.BeheerDAO)
>
> > DaoManagerRequester.getDaoManager().getDao(dao.BeheerDAO.class);
>
> >
>
> > model.BeheerExample beheerExample = new model.BeheerExample();
>
> >
>
> > beheerExample.createCriteria().andReferentienummerLike(likesleutel);
>
> >
>
> > List resultList = beheerDao.selectByExample(beheerExample);
>
> >
>
> > if (resultList.size() > 0) {
>
> >
>
> > for(int i = 0; i < resultList.size(); i++) {
>
> >
>
> > rowBeheer[i] = new RowBeheer();
>
> >
>
> > model.Beheer beheer = (model.Beheer) resultList.get(i);
>
> >
>
> > rowBeheer[i].setReferentienummer(beheer.getReferentienummer());
>
> >
>
> > rowBeheer[i].setVolgnr(beheer.getVolgnr());
>
> >
>
> >
> rowBeheer[i].setRowdatumbegin(String.valueOf(beheer.getRowdatumbegin
()));
>
> >
>
> >
> rowBeheer[i].setRowdatumeinde(String.valueOf(beheer.getRowdatumeinde
()));
>
> >
>
> > rowBeheer[i].setKantoorcode(beheer.getKantoorcode());
>
> >
>
> > rowBeheer[i].setDossierstatus(beheer.getDossierstatus());
>
> >
>
> > return rowBeheer;
>
> >
>
> > }
>
> >
>
> > }
>
> >
>
> > } catch (Exception e) {
>
> >
>
> > e.printStackTrace();
>
> >
>
> > }
>
> >
>
> > return null;
>
> >
>
> > }
>
> >
>

Reply via email to