Skip to Content
avatar image
Former Member

Exception thrown at modifyView

Hi Experts,

I am getting the following exception

java.lang.NullPointerException

when i try to execute the following code:

int i = wdContext.nodeOutput().currentOutputElement().getO_Text().length();

Can anybody please help me solve this

Regards,

Abdullah

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

8 Answers

  • avatar image
    Former Member
    May 03, 2007 at 09:46 AM

    Hi ,

    Ensure that the Output element is created before accessing it as current element.

    Or make the cardinality as 1..n and work on it.

    You are trying to access the leadselected element .. but there is none created in the node. so it returns a null and hence a nullpointer exception..

    And do search forum for similar queries.. !

    Regards

    Bharathwaj

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 03, 2007 at 09:48 AM

    Hi,

    nodeOutput().currentOutputElement(). is a node element that u get after executing one RFC.

    Might be doModifyview is been called befor eyou execute the RFC and store all the information in the particular noew..

    Yoy try to exceute the method in doint itself so that you dont get this error

    Thanks

    AM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      after changing bapi , if it is not returning the values then that is a cause.

      okay, have you re-imported models and restarted J2EE server?

      do it

      hope it helps

      regards

  • avatar image
    Former Member
    May 03, 2007 at 09:49 AM

    Abdullah,

    here ,

    <i>

    int i = wdContext.nodeOutput().currentOutputElement().getO_Text().length();</i>

    only one thing can be ,

    The Output element must not be created , better thing is make the cardinality to 1.1 or 1.n.

    and why are you writing this code in WdDoModify(), it is certainly not preferable

    hope it helps

    regards

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 03, 2007 at 10:06 AM

    put all the code in domodify view in try catch..

    put a print statement before int i = wdContext.nodeOutput().currentOutputElement().getO_Text().length();

    like wdThis,wdgetapi.getcomponet.getmessagemanager.reportsuccess()wdContext.nodeOutput().currentOutputElement().getO_Text());

    and check teh value that u are getting...

    AM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 03, 2007 at 10:08 AM

    if ur RFC is not returning the values.., that is the reason

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      Why do you invalidate the 'Output' node after executing the model?

      That's the reason for the NullPointerException. Invalidate before executing the model.

      Hope it helps.

      Regards,

      M.Subathra

  • avatar image
    Former Member
    May 03, 2007 at 10:53 AM

    are you sure that that the RFC is not returning any values?

    Did you print that and check?

    AM

    Add comment
    10|10000 characters needed characters exceeded

  • May 03, 2007 at 11:20 AM

    Abdulla,

    Please check these,

    • Ensure that your node/attribute is null

    • You can write the code inside the exception block.

    Regards,

    <b>Ramganesan K</b>

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 05, 2008 at 05:17 AM

    answered

    Add comment
    10|10000 characters needed characters exceeded