-1

I have a problem with my code. I am using Oracle JDeveloper 12c and I can't deal with my code. I have a method called deactivate:

   public void deactivate() {
    DeesconfViewImpl deak = getDeesconfView();
    RowSetIterator rowSetIterator = deak.createRowSetIterator("New");
    if (rowSetIterator != null) {
        rowSetIterator.reset();
        while (rowSetIterator.hasNext()) {
          Row currentRow = rowSetIterator.next();
            currentRow.setAttribute("Active", 0);
        }
        rowSetIterator.closeRowSetIterator();
    }
} 

which has a problem in line: DeesconfViewImpl deak = getDeesconfView();

He doesn't see that getDeesconfView, JDeveloper gives me a hint to insert a method

private DeesconfViewImpl getDeesconfView() {
    return null;
}

And code compiles succesfully, but I have nullPointerException in my method, which is supposed to set all rows to inactive, and this one I selected to active:

public void activeYear() {
        deactivate(); 

    this.getCurrentRow().setAttribute("Active", 1);
}

I am sure that the problem is DeesconfViewImpl deak = getDeesconfView(); but I have no idea what could go in this code. If I remove this line, I have an error with:

public class DeesconfViewImpl extends ViewObjectImpl implements DeesconfView {
        private static DeesconfView getDeesconfView;
}

That he doesn't see getDeesconfView. Seems like he just doesn't use it.

Yes I debugged it and I found out already which line causes this error.

pnuts
  • 58,317
  • 11
  • 87
  • 139

2 Answers2

0

The first line

DeesconfViewImpl deak = getDeesconfView();

will call the function getDeesconfView() which will return a null value. Thus the Second line

 RowSetIterator rowSetIterator = deak.createRowSetIterator("New");

will make a

RowSetIterator rowSetIterator = null.createRowSetIterator("New");

which will make the NullPointerException .

Dileep
  • 5,362
  • 3
  • 22
  • 38
0

Your getDeesconfView() method will always returns null.That's why you are getting NPE.

Gundamaiah
  • 780
  • 2
  • 6
  • 30