Java Null Pointer Exception - with arraycopy method.

Hi all,
I have been trying to fix this for a while now, but I think I've been staring at the screen for too long to fix it!
Basically I am trying to 'crossover' some arrays (evolutionary technique) but I keep getting a null pointer exception.
Here is my customised class: class ChromosomeDetails {
     double[] chromosomePrices;
     int[] chromosomePoints;
     int[] chromosomePlayerIDs;
     int chromosomeFitness;
       ChromosomeDetails(double[] chromosomePrices, int[] chromosomePoints, int[] chromosomePlayerIDs, int chromosomeFitness) {
          this.chromosomePrices = chromosomePrices;
          this.chromosomePoints = chromosomePoints;
          this.chromosomePlayerIDs = chromosomePlayerIDs;
          this.chromosomeFitness = chromosomeFitness;     
       public ChromosomeDetails () {  
            chromosomePrices = null;
          chromosomePoints = null;
          chromosomePlayerIDs = null;
          chromosomeFitness = 0;
     public double[] getPrices() {
          return chromosomePrices;
     public int[] getPoints() {
          return chromosomePoints;
     public int[] getPlayerIDs() {
          return chromosomePlayerIDs;
     public int getFitness() {
          return chromosomeFitness;
}  In my main method I create 2 instances of this class like so:ChromosomeDetails parentChromosomeADetails = new ChromosomeDetails();          
ChromosomeDetails parentChromosomeBDetails = new ChromosomeDetails();...and 2 other instances that are left empty:ChromosomeDetails childChromosomeCDetails = new ChromosomeDetails();     
ChromosomeDetails childChromosomeDDetails = new ChromosomeDetails();     I then try to 'crossover' the values in the arrays like so: int randomCrossoverPoint = new Random().nextInt(parentChromosomeADetails.chromosomePoints.length-1);
System.arraycopy(parentChromosomeADetails.chromosomePrices, 0, childChromosomeCDetails.chromosomePrices, 0, randomCrossoverPoint);
System.arraycopy(parentChromosomeBDetails.chromosomePrices, randomCrossoverPoint, childChromosomeCDetails.chromosomePrices, randomCrossoverPoint, (childChromosomeCDetails.chromosomePrices.length-randomCrossoverPoint));
System.arraycopy(parentChromosomeADetails.chromosomePoints, 0, childChromosomeCDetails.chromosomePoints, 0, randomCrossoverPoint);
System.arraycopy(parentChromosomeBDetails.chromosomePoints, randomCrossoverPoint, childChromosomeCDetails.chromosomePoints, randomCrossoverPoint, (childChromosomeCDetails.chromosomePoints.length-randomCrossoverPoint));
System.arraycopy(parentChromosomeADetails.chromosomePlayerIDs, 0, childChromosomeCDetails.chromosomePlayerIDs, 0, randomCrossoverPoint);
System.arraycopy(parentChromosomeBDetails.chromosomePlayerIDs, randomCrossoverPoint, childChromosomeCDetails.chromosomePlayerIDs, randomCrossoverPoint, (childChromosomeCDetails.chromosomePlayerIDs.length-randomCrossoverPoint));
                    However it gives me this error, relating to the first arraycopy method: Exception in thread "main" java.lang.NullPointerException
     at java.lang.System.arraycopy(Native Method)Please note that in this program, parentChromosomeADetails and parentChromosomeBDetails already hold data when I try to use the arraycopy method, whereas the childChromosomeCDetails and childChromosomeDDetails objects are empty, waiting for the data from the arraycopy methods. Any help would be immensely appreciated.

it was learning very well yesterday, but that was before I introduced my customised class. I need my class as I need to be able to keep hold of all of the data, rather than just the chromosome points, so that I can see the exact strategy that the algorithm uses.
It is indeed the child chromosome that is null, and I suppose that it because I had to initialise the int[] chromosomePoints, double[] chromosomePrices and int[] chromosomePlayerIDs as null. What is the best solution to this? using loops to initialise all values in the arrays as 0 before the arraycopy?!

Similar Messages

  • Null pointer Exception with removeRowWithKey operation

    Hii experts,,,
    I am using JDevelepor 11.1.2.1.0 Version
    I Am new in ADF ,
    In My sample application i select row in iterator by findIterator() method
    then get the specified row by getCurrentRow();
    then i get the rowKey By row.getKey() method..
    I put rowKey as parameter to removeRowWithKey operation
    I have get null pointer Exception with removeRowWithKey operation
    java.lang.NullPointerException
         at oracle.jbo.server.ViewRowSetImpl.prepKeyForFind(ViewRowSetImpl.java:5352)
         at oracle.jbo.server.ViewRowSetImpl.findByKey(ViewRowSetImpl.java:5394)
         at oracle.jbo.server.ViewRowSetImpl.findByKey(ViewRowSetImpl.java:5296)
         at oracle.jbo.server.ViewRowSetImpl.findByKey(ViewRowSetImpl.java:5290)
         at oracle.jbo.server.ViewObjectImpl.findByKey(ViewObjectImpl.java:11536)
         at oracle.adf.model.binding.DCIteratorBinding.removeRowWithKey(DCIteratorBinding.java:3748)
         at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1598)
    how can solve this???

    thanks Timo
    through this URL i get possible deletion methods...
    pls give more Information about the concept of removeRowWithKey, setCurrentRowWithKey, setCurrentRowWithKeyValue operation.... Just For Knowledge....
    Edited by: NZL on Mar 2, 2012 9:37 AM
    Edited by: NZL on Mar 2, 2012 9:42 AM

  • Java Null Pointer Exception- Business Validation In AM

    Hi, I have been tried cracking this validation issue, tried several combinations. But does not work and throw java null pointer exception. I would appreciate if somebody can point where I am going wrong on the code. Thanks ahead.
    Below is the issue:-
    I have a page with PO (blanket purchase order) header info, and a PO line info with additional empty columns (related to Blanket Release). When the user fills in one of the columns (release amount, rls_amt_i), then I need to validate this against remaining blanket amount ie.{ PO_amt - (po_rls_amt1 + po_rls_amt2+..)}. If rls_amt_i is <= remaining amount, then the release needs to get created, otherwise shouldn't. I know, this is a pretty normal requirement. Please check my code to see where I could be wrong.
    ReleaseCO (in PFR):-
    if (pageContext.getParameter("Apply") != null)
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    OAViewObject vo = (OAViewObject)am.findViewObject("CxPoReleaseVO1");
    Number poHeaderId = (Number)vo.getCurrentRow().getAttribute("PoHeaderId");
    String poNumber = (String)vo.getCurrentRow().getAttribute("PoNumber");
    OAViewObject linesVO = (OAViewObject)am.findViewObject("CxPoReleaseLinesVO1");
    Number lineAmt = (Number)linesVO.getCurrentRow().getAttribute("Amount");
    Serializable [] params = {poHeaderId.toString(), poNumber, lineAmt.toString()};
    am.invokeMethod("apply", params);
    ReleaseAM:-
    public void apply(String poheaderId, String poNumber, String lineAmt)
    Number blanketAmt, totalreleasesAmt, lineRlsAmt;
    try
    { lineRlsAmt = new Number(lineAmt.trim());}
    catch(Exception e) { throw new OAException("AK", "FWK_TBX_INVALID_EMP_NUMBER"); }
    totalreleasesAmt = getReleasesAmt(poheaderId);
    blanketAmt = getBlanketAmt(poNumber);
    if ((lineRlsAmt.intValue() - (blanketAmt.intValue()-totalreleasesAmt.intValue())) <= 0)
    getTransaction().commit();
    approve();
    throw new OAException("The amount is less than the remaining release amt", OAException.INFORMATION);
    } // end apply()
    public Number getReleasesAmt (String poHeaderId)
    CxTotalReleaseQuantityVVOImpl totalreleaseqtyVO = getCxTotalReleaseQuantityVVO1(); //vo to get TotalReleased Amount
    Number poHeadNum = null;
    Number totalqty;
    try { poHeadNum = new Number(poHeaderId); }
    catch (Exception e) { throw OAException.wrapperException(e); }
    totalreleaseqtyVO.initQuery(poHeadNum);
    CxTotalReleaseQuantityVVORowImpl row = null;
    row = (CxTotalReleaseQuantityVVORowImpl)totalreleaseqtyVO.getCurrentRow();
    try { totalqty = (Number)row.getQuantityReleased();}
    catch (Exception e) { throw new OAException(e.getMessage()); }
    if(totalqty != null)
    { return totalqty;  }
    else
    { throw new OAException ("exception occurred", OAException.ERROR);  }
    public Number getBlanketAmt (String poNumber)
    Number blanketAmt;
    CxBlanketAmtVOImpl blanketVO = (CxBlanketAmtVOImpl) getCxBlanketAmtVO1(); //VO to get total amount on the BlanketPO.
    blanketVO.initQuery(poNumber);
    Row row = blanketVO.getCurrentRow();
    blanketAmt = (Number)row.getAttribute("Quantity"); //gets the blanket amt
    if( blanketAmt != null ) {
    return blanketAmt ; }
    else { throw new OAException ("exception occurred", OAException.ERROR);   }
    ---------The code breaks at the line where I try to get "totalqty" or "blanketAmt" .. It throws a java nullpointer exception.
    Thanks for helping me out.
    -Vikram

    Hi Sumit,
    Thanks for replying. Here is the error stack.
    Exception Details.
    oracle.apps.fnd.framework.OAException: java.lang.NullPointerException
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:891)
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:865)
         at oracle.apps.fnd.framework.OAException.wrapperInvocationTargetException(OAException.java:988)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:211)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:153)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:749)
         at netflix.oracle.apps.nflix.p2p.po.webui.NfCreateReleaseCO.processFormRequest(NfCreateReleaseCO.java:115)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:810)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1159)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1022)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:988)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:843)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1022)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:988)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:843)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2675)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1682)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:508)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:429)
         at OA.jspService(OA.jsp:34)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    ## Detail 0 ##
    java.lang.NullPointerException
         at netflix.oracle.apps.nflix.p2p.po.server.NfReleaseCreateAMImpl.getReleasesAmt(NfReleaseCreateAMImpl.java:642)
         at netflix.oracle.apps.nflix.p2p.po.server.NfReleaseCreateAMImpl.apply(NfReleaseCreateAMImpl.java:302)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:190)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:153)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:749)
         at netflix.oracle.apps.nflix.p2p.po.webui.NfCreateReleaseCO.processFormRequest(NfCreateReleaseCO.java:115)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:810)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1159)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1022)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:988)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:843)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1022)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:988)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:843)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2675)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1682)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:508)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:429)
         at OA.jspService(OA.jsp:34)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    java.lang.NullPointerException
         at netflix.oracle.apps.nflix.p2p.po.server.NfReleaseCreateAMImpl.getReleasesAmt(NfReleaseCreateAMImpl.java:642)
         at netflix.oracle.apps.nflix.p2p.po.server.NfReleaseCreateAMImpl.apply(NfReleaseCreateAMImpl.java:302)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:190)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:153)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:749)
         at netflix.oracle.apps.nflix.p2p.po.webui.NfCreateReleaseCO.processFormRequest(NfCreateReleaseCO.java:115)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:810)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1159)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1022)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:988)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:843)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1022)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:988)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:843)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2675)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1682)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:508)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:429)
         at OA.jspService(OA.jsp:34)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    The code breaks at the line 642: totalqty = (Number)row.getQuantityReleased();
    I had already taken care of the null value in the VO sql query by using nvl(sum(release_amount), 0).. .so it should return atleast 0, if its null. But it returns "null" all the time.
    I dont understand why its doing that. When I run the sql backend the query works fine and returns 0,even when there are no prior releases on the PO.
    Thanks,
    Vikram

  • Java Null Pointer Exception while Importing a Table to IS

    Hello All,
    I am trying to import a table into IS and receiving a JAVA Null Pointer Exception. The table is in a Teradata database and I am able to import other tables belonging to the same schema.I get the Java error only while trying to import this one particular table. The DBA has confirmed that the table belongs to the schema/owner I am using. In any case, it seems more of a application error than a database level error. Can anyone provide any insight? Thank you in advance.

    hi Keerthi,
    thank you.
    i tried with below code but still unsuccesfully
         +     oaDFF = (OADescriptiveFlexBean)oawebbean.findIndexedChildRecursive("ActFlexField");+
    oapagecontext.writeDiagnostics(this, "Niccal: i got DFF handle", 1);
    OAMessageTextInputBean mtib = (OAMessageTextInputBean)oaDFF.findChildRecursive("ActFlexField0");
    oapagecontext.writeDiagnostics(this, "Niccal: before if", 1);
    i am able to print 1° comment line but not second. so i think it's something wrong getting the segment handle.
    anyway i'm not able to reach your suggested if statement because execution stops before.
    Infact, if i comment line :OAMessageTextInputBean mtib = (OAMessageTextInputBean)oaDFF.findChildRecursive("ActFlexField0");
    page doesn't give error and saves data.
    any suggestion appreciated,
    thanx,
    N

  • Java null pointer exception while getting a segment DFF handle

    Hi,
    my requirement is to make a field mandatory based upon a dff segment value (Y/N). i override PFR since segment is a poplist on the page (and poplists don't fire any event)
    i searched in the "view source" of the page and found that segment id is ActFlexField0
    when i click on save button i got "java null pointer exception"
    here is code:
    public void processFormRequest(OAPageContext oapagecontext, OAWebBean oawebbean) throws OAException
    +{+
    +//get a handle to AM+
    OAApplicationModule am;
    am = oapagecontext.getRootApplicationModule();
    oapagecontext.writeDiagnostics(this,"Root AM=>"oapagecontext.getApplicationModule(oawebbean).getName() ,1);+
    if(oapagecontext.getParameter("applyCreActBut") != null || oapagecontext.getParameter("saveDtlBut") != null)
    +{+
    +/*Conditional mandatoryness of IdContribuente field*/+
    +// first, find the flexfield's handle+
    OADescriptiveFlexBean oaDFF;
    oaDFF = (OADescriptiveFlexBean)oawebbean.findIndexedChildRecursive("ActFlexField");
    +//oaDFF.processFlex(oapagecontext);+
    oapagecontext.writeDiagnostics(this, "Niccal: i got DFF handle", 1);
    +//oapagecontext.writeDiagnostics(this, "Niccal: oamcb value is:"+oaDFF.getAttributeValue(), 1);+
    +/*+
    RenderingContext con = (RenderingContext) oapagecontext.getRenderingContext();
    Enumeration x= null;
    x= oaDFF.getChildNames(con);
    oapagecontext.writeDiagnostics(this, "After getChild", 1);
    while(x.hasMoreElements())
    +{+
    String aParamName = (String)x.nextElement();
    oapagecontext.writeDiagnostics(this, "Niccal: DFF segment names are:"aParamName, 1);+
    +//OAWebBean dffbeans=(OAWebBean)oaDFF.findChildRecursive(aParamName);+
    +}+
    +//oaDFF.mergeSegmentsWithParent(oapagecontext);+
    OAMessageChoiceBean oamcb = (OAMessageChoiceBean)oaDFF.findChildRecursive("ActFlexField0");
    +//String sIsForeign = (String)oaDFF.getAttributeValue("Attribute1");+
    +//oapagecontext.writeDiagnostics(this, "Niccal: Attribute1 is:"+sIsForeign, 1);+
    oapagecontext.writeDiagnostics(this, "Niccal: before if", 1);it's urgent
    any help appreciated
    thanx
    N

    hi Keerthi,
    thank you.
    i tried with below code but still unsuccesfully
         +     oaDFF = (OADescriptiveFlexBean)oawebbean.findIndexedChildRecursive("ActFlexField");+
    oapagecontext.writeDiagnostics(this, "Niccal: i got DFF handle", 1);
    OAMessageTextInputBean mtib = (OAMessageTextInputBean)oaDFF.findChildRecursive("ActFlexField0");
    oapagecontext.writeDiagnostics(this, "Niccal: before if", 1);
    i am able to print 1° comment line but not second. so i think it's something wrong getting the segment handle.
    anyway i'm not able to reach your suggested if statement because execution stops before.
    Infact, if i comment line :OAMessageTextInputBean mtib = (OAMessageTextInputBean)oaDFF.findChildRecursive("ActFlexField0");
    page doesn't give error and saves data.
    any suggestion appreciated,
    thanx,
    N

  • Java null pointer exception setting new preferences on a project

    Using thw Warehouse Builder Client 9.0.3 with Oracle 9i 9.0.1, I tried to change the Naming option on the Naming Tab to the "logical name mode". Then i pressed the Ok button and this caused a crash with a Java Null Pointer Exception. At this time, All commands on project generated the same error responce. I shut down the machine, restarted the Oracle Instance and all related services, an as a result, I am not able to re-open no Warehouse Builder project. The system seems to be in an infinite loop while trying to open the currently selected project. Can anybody help me?
    Thanks.
    Marco

    This seems to be a bug. Can you open a TAR on this?
    Regards:
    Igor

  • Xi 3.1 SP3 giving java null pointer exception error on scheduling webi

    after we have the system uptime running for a few days and have schedule webi jobs successfully for a few days, we constant get the message java null pointer exception error on scheduling webi.
    This only have days after restarting the environment.
    Seems to be coming up after scheduling a certain amount of webi reports.
    Only doing a stop all services and restart resolves the issue.
    XI 3.1 SP3
    SAP IK Sp3
    Tomcat55
    HPUX-IA64 (Hpunix) platform.

    Hello, I have the same issue.  If someone gives you an answer please let me know how to fix it.

  • Null pointer Exception with Custom EventQueue

    I created a simple class customEventQueue which is extended from EventQueue class and pushed it using
    Toolkit.getDefaultToolkit().getSystemEventQueue().push(customEventQueue);
    Now, whenever there are three modal dialogs on top of a frame and if I click on top dialog that closes all three dialog boxes, I get nullpointer exception in console. The custom event class does not have any method in it. It just extends from EventQueue.
    I checked it in different JRE and it happens only in JRE1.3.1.
    Has anybody tried the same thing with custom event queue? Any help is most welcome. Thanks...
    java.lang.NullPointerException
    at sun.awt.windows.WInputMethod.dispatchEvent(Unknown Source)
    at sun.awt.im.InputContext.dispatchEvent(Unknown Source)
    at sun.awt.im.InputMethodContext.dispatchEvent(Unknown Source)

    Hi Chandel me having the same problem
    java.lang.NullPointerException
    at sun.awt.windows.WInputMethod.dispatchEvent(Unknown Source)
    at sun.awt.im.InputContext.dispatchEvent(Unknown Source)
    at sun.awt.im.InputMethodContext.dispatchEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
    at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown
    Source)
    at
    java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Sour
    ce)
    at
    java.awt.DefaultKeyboardFocusManager.pumpApprovedKeyEvents(Unknown So
    urce)
    at
    java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Sour
    ce)
    at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown
    Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.SequencedEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
    Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
    Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Th bigger problem is that i don't know what is causing this exception, cause the stack trace doesn't mention the line of code where the exception occurred.
    In earlier version of java we had pData null pointer exception. This bug manifests when the pull down menu doesn't fit completely into the frame's bounds and swing has to create a seaprate window for the pull-down.
    The problem is that WInputMethod caches a reference to peer and that that reference becomes stale when peer is destroyed and recreated.
    In this bug cached peer reference becomes stale as the Window for the menu is hidden (and its peer is destroyed) and shown again (with new peer this time).
    WInputMethod have a cached reference to the old peer but that old peer is not connected to the underlying native window used to display the menu.
    But it's been fixed. I want to know if our problem is in some way related to this pData bug.
    Thanx.

  • Null pointer Exception in findusersfiltered method

    Hi,
    I am using Findusersfiltered method to fetch the userkey . But it is throwing a null pointer exception, Findusersfiltered(Unknown source). Please let me know the workaround to solve this issue. Will changing the method to findallusers or any other method to fetch the user key will solve this?
    Thanks.

    Still getting this error after using findallusers method... Any possible solution?
    java.lang.NullPointerException
         at Thor.API.Operations.tcUserOperationsClient.findAllUsers(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at Thor.API.Base.SecurityInvocationHandler$1.run(Unknown Source)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(Unknown Source)
         at weblogic.security.Security.runAs(Security.java:41)
         at Thor.API.Security.LoginHandler.weblogicLoginSession.runAs(Unknown Source)
         at Thor.API.Base.SecurityInvocationHandler.invoke(Unknown Source)
         at $Proxy59.findAllUsers(Unknown Source)
         at com.bofa.email.RequestKeyGenerator.getRequestKey(RequestKeyGenerator.java:201)
         at com.bofa.email.ExcelReader.printDatabase(ExcelReader.java:303)
         at com.bofa.email.ExcelReader.showExelData(ExcelReader.java:279)
         at com.bofa.email.ExcelReader.Parser(ExcelReader.java:137)
         at com.bofa.email.FilenameReader.getPath(FilenameReader.java:53)
         at com.bofa.email.InboxReader.retrieveUnreadMails(InboxReader.java:183)
         at com.bofa.email.AutoRequestGenerator.executed(AutoRequestGenerator.java:77)
         at com.bofa.email.AutoRequestGenerator.setup(AutoRequestGenerator.java:56)
         at com.bofa.email.AutoRequestGenerator.execute(AutoRequestGenerator.java:29)
         at com.thortech.xl.scheduler.tasks.SchedulerBaseTask.run(Unknown Source)
         at com.thortech.xl.scheduler.core.quartz.QuartzWrapper$TaskExecutionAction.run(Unknown Source)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(Unknown Source)
         at weblogic.security.Security.runAs(Security.java:41)
         at Thor.API.Security.LoginHandler.weblogicLoginSession.runAs(Unknown Source)
         at com.thortech.xl.scheduler.core.quartz.QuartzWrapper.execute(Unknown Source)
         at org.quartz.core.JobRunShell.run(JobRunShell.java:178)
         at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:477)

  • Null pointer exception with Lists

    Hi,
    I have got a problem with java.util.List. It is giving Null pointer exception whenever I try to add after extracting from my XML file.I have written the code like this:
    List year; //Global variable
    List loaddatas; //Global variable
    Element e1; //Global
    loaddatas=root.getChild("Load").getChildren("LoadData");
    int k=loaddatas.size();
    for(int i=0;i<loaddatas.size();i++)
    e1=(Element)loaddatas.get(i);
    year.add(i,Integer.valueOf(e1.getChildText("Year"))); // I am getting exception here.....
    root is root element in XML file.
    I am able to display "Integer.valueOf(e1.getChildText("Year"))" correctly.
    Anybody please tell me how to solve this.
    Thanks,
    Sai Ram

    Looks like somebody forgot to learn to program before starting to write code....
    List list = new ArrayList();

  • Java null pointer exception

    Hey guys,
    Im having a problem with the following code:
        public void testVariable(Object a, Object b)
            if(a!=null || b!=null)
                Object reta = null;
                Object retb = null;
                String tempa = null;
                String tempb = null;
                if(a.toString() !=null && b.toString() !=null)    <---- Null pointer exception
                    tempa = a.toString();
                    tempb = b.toString();
                    tempa = tempa.toLowerCase();
                    tempb = tempb.toLowerCase();
                }Im getting a null pointer exception when i do that if statement, ive narrowed it down and found that that was the problem but I have no idea why?
    any suggestions ?

    if (a!=null || b!=null)...If a is not null, OR b is not null, do the following statements.
    if( a.toString() !=null && b.toString() !=null ) ...Perform an operation on a, converting it to a string. This will throw a null pointer exception if a is null. If we survive that, see if the resulting string is null (toString methods should never return null here in fact).
    Perform an operation b, converting it to a a string. This will throw a null pointer exception if b is null. If we survive that, see if the resulting string is null (toString methods should never return null here in fact).
    So if either a or b is null, but the other one isn't, you will get a null pointer exception.
    Edited by: dcminter on 27-Apr-2008 17:51

  • Null Pointer Exception with Oracle Transformer

    Hi all,
    I'm getting a NullPointerException after building a DOM tree and feeding it to a stream via the Oracle JAXP transformer. I am trying to convert the data in DOMSource to PDF file. The following code:
    TransformerFactory transFact = TransformerFactory.newInstance();
    Transformer transForm = transFact.newTransformer();
    ByteArrayOutputStream pdfOutStream = new ByteArrayOutputStream();
    DOMSource pdfInput = new DOMSource(doc);
    StreamResult pdfOutput = new StreamResult(pdfOutStream);
    transForm.transform(pdfInput,pdfOutput);
    int pdfByteSize = pdfOutStream.size();
    System.out.println("Size of pdfByteSize : "+ pdfByteSize);
    pdfByte = new byte[pdfByteSize];
    pdfByte = pdfOutStream.toByteArray();
    InputStream formInputStream = new ByteArrayInputStream(pdfByte);
    Iam getting error at "transForm.transform(pdfInput,pdfOutput);".
    Here the StackTrace :
    07/05/24 10:59:40 XML-22900: (Fatal Error) An internal error condition occurred.
    javax.xml.transform.TransformerException: XML-22900: (Fatal Error) An internal error condition occurred.
         at oracle.xml.jaxp.JXTransformer.reportException(JXTransformer.java:775)
         at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:374)
    Caused by: java.lang.NullPointerException
         at oracle.xml.parser.v2.XMLText.reportSAXEvents(XMLText.java:402)
         at oracle.xml.parser.v2.XMLElement.reportChildSAXEvents(XMLElement.java:3072)
         at oracle.xml.parser.v2.XMLElement.reportSAXEvents(XMLElement.java:3061)
         at oracle.xml.parser.v2.XMLElement.reportChildSAXEvents(XMLElement.java:3072)
         at oracle.xml.parser.v2.XMLElement.reportSAXEvents(XMLElement.java:3061)
         at oracle.xml.parser.v2.XMLElement.reportChildSAXEvents(XMLElement.java:3072)
         at oracle.xml.parser.v2.XMLElement.reportSAXEvents(XMLElement.java:2165)
         at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:337)
    Environment we are using is Sun JDK 1.4.2_06 on Windows, running JDeveloper 10 g with OC4j as Application Server.
    Can any one please explain me in this regard?
    Thanks
    Manoj

    Thanks for the Reply.
    Before Null Pointer Exception I am getting another Fatal error:
    javax.xml.transform.TransformerException: XML-22900: (Fatal Error) An internal error condition occurred.
         at oracle.xml.jaxp.JXTransformer.reportException(JXTransformer.java:775)
         at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:374)
    Please Help

  • Help please I get Null Pointer Exception with my SQL query

    The following statement gives me a null pointer exception when executed
    from the doPost of my servlet.
    rs=stmt.executeQuery(sqlQuery);
    The error message reads:
    java.lang.NullPointerException
         at stockserv.Servlet1.doPost(Servlet1.java:142)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    ===etc.
    when I execute the same statement and query (same DB and table) from a standard java
    program I do not get the error and get the propper result.
    Any obvious thing I should check?
    Thanks

    Yes line 142 is as follows
    rs=stmt.executeQuery(sqlQuery);
    I also tried it with the folowing literal statement and get the same error.
    rs=stmt.executeQuery("select * from table1 Where symbol= 'brt' ");
    Does null pointer mean I am sending a null query or something else?
    Again this same statment works from a regular java (non-server)program.
    Thanks Again

  • Null pointer Exception with Float.parseFloat

    I need to assign a float value from a database to a variable recurrently throughout a while loop. but i am getting a null pointer exception error:
    while ( rs.next() )
         out.println("<TR>");
              float corr = Float.parseFloat((String) request.getParameter("echo"));
              out.println("<center><TD><b><font color = #990000>" + rs.getString("race_number") + "</b></TD>");
              out.println("<center><TD><b><font color = #990000>" + rs.getString("sail_number") + "</b></TD>");
              out.println("<center><TD><b><font color = #990000>" + rs.getString("finish_time_elapsed") + "</b></TD>");
              out.println("<center><TD><b><font color = #990000>" + rs.getString("echo") + "</b></TD>");
              out.println("</TR>");
    I've also tried:
    float corr = Float.parseFloat( String request.getParameter("echo"));
    float corr = 0;
    corr Float.parseFloat((String) request.getParameter("echo"));
    corr = echo;
    corr = request.getParameter("echo");
    corr = rs.getString("echo");
    corr = Float.parseFloat(request.getParameter("echo"));
    temp = rs.getFloat("Problem_Description");
    Any ideas Please!!!

    Null pointer exception means that the value you are trying to turn into a Float is null. Probably request.getParameter("echo") returns null.
    Is "echo" a request parameter, or a field you want to get from the database?
    request.getParameter() has nothing to do with a database query.
    That is your http request coming from the form submission. It won't change.
    If "echo" is meant to be a request parameter, then make sure the parameter is actually present.
    If its a database field (stored as a number) then
    float corr = rs.getFloat("echo");
    should do the trick.
    Can the value be null in the database?
    Cheers,
    evnafets

  • Null pointer exception with thread

    ok,
    When i try to start a thread i get a null pointer exception:
    Exception in thread "Thread-2" java.lang.NullPointerException
            at MainWindow$8.run(MainWindow.java:274)
            at java.lang.Thread.run(Thread.java:619)Here is the thread code:
    t = new Thread(new Runnable(){
             public void run(){
                 for (int i = 100; i > 0; i--){
                     blockArray = p.physicsPass(blockArray);
                     repaintCanvas();
        t.start();After stepping through it it would appear the exception is thrown before physicsPass() gets called...
    blockArray is not empty so im not sure what the null pointer is.
    Its probably something obvious im missing, any ideas?
    Cheers
    J

    JamesBarnes wrote:
    look for the dots?
    I dont understand, care to elaborate?In your code there was two dots:
    blockArray = p.physicsPass(blockArray);
    t.start();So either p was null or t was null.

Maybe you are looking for

  • Compatability

    Folks, first post.  Is 5 year old Cinema Display monitors and XServe Raid compatable with new Intel MAC Pro?

  • Problem in material superstation

    HI all Problem in material superstation when A material is get supersicate by  material in that case all manual conduction is not coming for eg if I create sales order by a A material system will supercirtate that material to B material and I will ad

  • Email from report

    Hi,   Could any body tell me the how to send an e-mail from a report . Is there any Function Module which serve the same purpose. Regards,   Satya

  • When the printer dialog shows up is there a way to print by pressing enter instead of using the mouse?

    Right now, I have to click with the mouse: I don't have to do in in Firefox: Just press enter!

  • Question on OID Security Provider?

    1. I find two offical documents on config OID security provider, which one is correct? http://download.oracle.com/docs/cd/E15523_01/webcenter.1111/e12405/wcadm_security.htm#BGBBHAGJ http://download.oracle.com/docs/cd/E12839_01/apirefs.1111/e13952/tas