How to trap null return values from getters when using Method.invoke()?

Hi,
I am using Method.invoke() to access getters in an Object. I need to know which getters return a value and which return null. However, irrespective of the actual return value, I am always getting non-null return value when using Method.invoke().
Unfortunately, the API documentation of Method.invoke() does not specify how it treats null return values.
Can someone help?
Thanks

What do you get as a result?I think I know what the problem is.
I tested this using following and it worked fine:
public class TestMethodInvoke {
public String getName() {
return null;
public static void main(String args[]) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
Object o = new TestMethodInvoke();
Class cls = o.getClass();
Method m = cls.getMethod("getName", (Class[]) null);
Object result = m.invoke(o, (Object[])null);
if (result == null) {
System.err.println("OK: Return value was null as expected");
else {
System.err.println("FAILED: Return value was NOT null as expected");
However, when I use the same technique with an EJB 3.0 Entity class, the null return value is not returned. Instead, I get a String() object. Clearly, the problem is the the EJB 3.0 implementation (Glassfish/Toplink) which is manipulating the getters.
Regards
Dibyendu

Similar Messages

  • From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    Hi,
    Use NVL or COALESCE:
    NVL (col_a, col_b)
    Returns col_a if col_a is not NULL; otherwise, it returns col_b.
    Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
    For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • How to get the return values from a web page

    Hi all :
       how to get the return values from a web page ?  I mean how pass values betwen webflow and web page ?
    thank you very much
    Edited by: jingying Sony on Apr 15, 2010 6:15 AM
    Edited by: jingying Sony on Apr 15, 2010 6:18 AM

    Hi,
    What kind of web page do you have? Do you have possibility to for example make RFCs? Then you could trigger events (with parameters that could "return" the values) and the workflow could react to those events. For example your task can have terminating events.
    Regards,
    Karri

  • Capture Return Value from Contextual Events Subscriber Method

    Hi
    I was wondering if anyone knew whether you could capture the return value from a method exposed as  a subscriber for a contextual event?
    Requirement: We have 2 bounded task flows (parent-child) with the child task flow embedded as a region in a view activity in the parent task flow.  Based on an action in the parent task flow we raise a contextual event which calls an application module method exposed as a data control within the child task flow.  We need to be able to capture the return value from the method on the managed bean.
    Example method within child task flow application module:
    public String contextualEventSub(){
      Return "Y";
    So here we would like to capture String value when the event is raised by the event producer (parent task flow action).
    Within the Event Map on the page definition of the parent task flow view activity it is possible to set parameters to pass to the subscriber but it’s not obvious where you can capture the return value.
    Many thanks!
    Technology:
    ADF 11.1.1.7 – ADFbc with ADF task flows and page fragments

    Check this URL it may help you
    One size doesn't fit all: JDev 11g: Programmatic Contextual Events

  • How to get 2 return values from a single SelectInputText?

    Hi,
    I am using the std Search form,
    The table I am using has fields like ID,Name,Status, and a few more
    I use a SelectInputText(pop up the ID and Name list) and populate the result back on the Search page
    What I am looking for is to have another output-text box on the search page which will show the Name corresponding the above selected ID.
    Can I have more than 1 returnActionListener for the SelectInputText to return more than one value??
    OR should I use something else?
    Regards,
    Zoheb

    But Frank, the SelectInputText automatically displays the returnEvent.getReturnValue() and I can't do anything about it. My ReturnListener method parses values from the hash table and assigns them to multiple fields on the screen. But the SelectInputText overwrites the value that I assign and displays the entire hashmap as the value of that field. The actual value displayed in the SelectInputText item ends up looking like this:
    {KEY1=Key1Value, KEY2=Key2Value}
    My ReturnListener method assigns the value Key2Value to field #2 (which is an InputText, not a SelectInputText) and it displays correctly.
    My ReturnListener method assigns the value Key1Value to field #1 (which is the SelectInputText that launched the dialog) but instead of displaying Key1Value in the field, the page displays the entire hashmap in that field.
    How can I force the SelectInputText to display "Key1Value" instead of "{KEY1=Key1Value, KEY2=Key2Value}"?

  • How to store the return value from a select list in page item ?

    I'm sorry, I'm sure you will all flame me for this (and its long too :-(. I'm still trying to pick this up and havn't had time to read manual and this forum and up against the clock (as usual), but this must be something thats simple to do, otherwise why have 2 cols on LOV (display text and return value.
    normal kind of thing - master /detail, a master table and a detail table, master.id is PK in master, master.name is the name of the master item. detail.id is pk in detail, detail.mid is foreign key to master.id. I have a tabular report that displays a join of cols from master and detail, with 2 cols being links, one is a link on master.name, that passes master.id to page P1 and it displays a row from master. The other col displays detail.name and passes detail.id to page P3, P3 displays a row of the detail table.
    I want to populate a LOV with possible master.name values, but display the name of the current P3_MID value (from detail.mid). Then a user can pick a different master and it needs to update P3_MID so on submit it updates the row.
    I just can't seem to see in the manual how you can specify where the return value on a LOV goes?
    As I said, sorry for long post and not having had time to read docs correctly - someone just point me at the subject matter somewhere, please.

    Sorry, I was trying to be to complex and obviously APEX is just too damn cleaver - I figured out how this works - basically APEX pulls the LOV and then matchs the mid to it to display the correct name - simple and easy - just me making it difficult

  • How to get current row value from table when press the submit button

    Hi,
    I want to get the current row value of SuccessionPlanId which is one of the column in a advanced table.
    I created one button (created using personalization, action fired thru CO)in the table as column, so each row having one button, if i press the first row's button means then i want to fetch the first row's SuccessionPlanId and if it is 3rd means then i want to get the value of third row's value.
    How to do it in controller extension?
    Please reply soon, its urgent.
    Thanks in advance,
    SAN

    Pratap,
    Yes, I tried with 'delete' button which is seeded one.
    For this, our code using row reference is working too fine. it throws exact SuccessionPlanId value of corresponding row.
    I created MessageStyledText, but here i need to give text value right, then only it 'll appear in the page.
    Instead i created one image and fired explicitly from the controller processRequest method.
    But the same problem remains..
    here my code:
    public void processRequest(OAPageContext pageContext, OAWebBean webBean){
    super.processRequest(pageContext, webBean);
    OAButtonBean oabb = (OAButtonBean)webBean.findChildRecursive("XXSubmit");
    FireAction action = new FireAction("XXSubmit");
    oabb.setAttributeValue(UIConstants.PRIMARY_CLIENT_ACTION_ATTR, action);
    OAImageBean oaib=(OAImageBean)webBean.findChildRecursive("XXSubmitImage");
    oaib.setFireActionForSubmit("XXSubmitImage", null, null, true);
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean){
    if("XXSubmitImage".equals(pageContext.getParameter("event"))){
    String succIdI="";
    String rowRefI = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
    if(rowRefI != null && !("".equalsIgnoreCase(rowRefI ))){
    PerSuccPlanSearchVORowImpl rowI = (PerSuccPlanSearchVORowImpl)oaam.findRowByRef(rowRefI);
    if(rowI != null)
    succIdI=rowI.getAttribute("SuccessionPlanId").toString();
    }else{
    throw new OAException("Row is null");
    throw new OAException(succIdI, OAException.INFORMATION);
    }else{
    super.processFormRequest(pageContext, webBean);
    If i run the page using this controller, it throws exception without any value, because for 'succIdI' i initialized without any string.
    Can you please suggest me how to solve?

  • How to get values from resultset when using subquery???

    Hi ,
    I have a problem in executing sql query from java.
    I am executing an sql query which return a intersection of values from 3 tables.
    Here is the query I am using
    select id from dps_user where id in (select b.id from dps_user b,laserlink c
    where c.userid='univ.'||b.login and c.status in(1,3,8,9,10)
    intersect
    select b.id from dps_user b,laserlink c
    where c.userid=b.login and c.status in(1,3,8,9,10)).
    this query is working fine from sql .
    when I am trying to excute the same query from java nothing is coming into resultset.
    String ISP_AND_EMAIL="select id "+
                             " from dps_user where id in (select b.id from dps_user b,laserlink c "+
                                  "where c.userid='"+"univ.'"+" ||b.login and c.status in(1,3,8,9,10)"+
                                  " intersect "+
                                  " select b.id from dps_user b,laserlink c"+
                                  " where c.userid=b.login and c.status in(1,3,8,9,10))";
              System.out.println(ISP_AND_EMAIL);
              rs=stmt.executeQuery(ISP_AND_EMAIL);
    How to use concatinate string (|| ) in java.
    can anyone help to retrieve the values from this resultset...
    Thanks

    concatnation is done using + in java.
    I am doubtful about the following line where there may be error
    "where c.userid='"+"univ.'"+" ||b.login and c.status in(1,3,8,9,10)"+
    I don't know if the univ. is a string or some variable.I need more clarification on this line,then i may help u.
    thx

  • How to get the returned value from Functions with Callable statement?

    I was glad to find that stored procedures can be invoke with Java class code by the object of Callable statement like :
    String stmt = "BEGIN departments_pkg.do_select(?,?,?); END;";
    and getting the output variables by
    populateAttribute(DEPARTMENTNAME,st.getString(2),true,false);
    But i would like to get values returned from FUNCTION other than stored procedure, how can i achieve it? Thanks a lot!

    Here is  my code
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_1202.
      MODULE subscreen_find.
      CALL SUBSCREEN SUBSEARCH INCLUDING sy-cprog dynnr.
    PROCESS AFTER INPUT.
      MODULE USER_COMMAND_1202.
      CALL SUBSCREEN SUBSEARCH.
    MODULE subscreen_find.
      case sy-ucomm.
        when 'SELECTED'.             "fcode
          case 'ZSKILL_SEARCH'.     "data element
            when '01'.                       " value range
              dynnr = 0110.
            when '02'.
              dynnr = 0111.
          endcase.
      endcase.
    ENDMODULE.
    kindly tell me what is wrong
    Edited by: Raji Thomas on Feb 8, 2010 10:20 AM

  • How to read the Key value from the Message using the text value.. Urgent

    I need to read the Key valuefrom the message pool using the text value for the Key.. Is it possible.. Please help me with sample code..
    Thanks and Regards
    Avijit

    Avijit,
    I got your requirement. I really dont know the scenario your working on but its possible to do it. There is no direct way to do so, but complexity is in getting to know the Keys dynamically from interface.
    Here you go..
         try
              Class msgClass      = IMessageTestWDApps.class;
    //Replace IMessageTestWDApps with IMessage<Your WD Component name>
              Field keys[]      = msgClass.getFields();
              IWDTextAccessor textAccessor = wdComponentAPI.getTextAccessor();
              if(keys != null)
                   String key = "";
                   for(int index=0;index<keys.length;index++)
                        key = keys[index].getName();
                        wdComponentAPI.getMessageManager().reportSuccess("Key= "+key);
                        if(textAccessor.getText(key).equals("My message text"))
                             //your logic.
         catch(Exception cnfe)
              wdComponentAPI.getMessageManager().reportException("Exe "+cnfe.getMessage(),false);
    Regards
    Abhilash
    Message was edited by:
            Abhilash Gampa

  • How to retrieve line Item values from an object using groovy

    def RevenueObject = nvl(ChildRevenue,0);
    println('revenueItems==='+revenueItems.size());
    while(RevenueObject.hasNext())
    def revenueLine = RevenueObject.next();
    revenueLine.setAttribute('Test_c', 'Hello');
    } Groovy Scripting
    Error : Getting null value for Revenue object
    Exception in expression "OpportunityEO" trigger "getRevenueItems" : groovy.lang.MissingMethodException : No signature of method: oracle.jbo.server.ViewRowSetIteratorImpl.size() is applicable for argument types: () values: [] Possible solutions: is(java.lang.Object), find(), use([Ljava.lang.Object;), with(groovy.lang.Closure), sleep(long), find(groovy.lang.Closure)
    at "OpportunityEO" trigger "getRevenueItems" line 7
    No signature of method: oracle.jbo.server.ViewRowSetIteratorImpl.size() is applicable for argument types: () values: [] Possible solutions: is(java.lang.Object), find(), use([Ljava.lang.Object;), with(groovy.lang.Closure), sleep(long), find(groovy.lang.Closure)

    Depending on the message the line number might be in one of the fields:
    MESSAGE_V1
    MESSAGE_V2
    MESSAGE_V3
    MESSAGE_V4
    Although if the message simply is not meant to include the line number, it won't be there. That's the way it is. If there is a user exit available, you may add your custom messages with the line number. In some user exits (in sales order for sure) there is a special variable (flag), which is set when the BAPI runs the transaction.

  • How we can delete the songs from mobile when using ios 7

    yesterday i have installed ios 7, now i am not able to delete the songs from my mobile. Previously i can do the same for just swipe from left to right... any solution for the same..??

    when you double tap home button and the app and a screen shot on the app comes up place your finfer on the screen shot of pageand swipe it  up to top of screen

  • How to get return value from java and read by other application?

    i want to read return value from java and the other application read it.
    for example:
    public class test_return {
        test_return(){
        public int check(){
            return 1;
        public static void main(String args[]){
           new test_return().check();
    }from that class i make as jar file. How to read the return value (1) by other application?
    thx..

    If your installer is requiring some process it invokes to return a particular value on failure, then the installer is seriously broken. There are a bazillion commands your installer could invoke, and any of them could fail, which in turn could invalidate the entire install process, and any of them could return any value on failure. The only value that's consistent (in my experience) is that zero means success and non-zero means failure, with specific non-zero values being different in different programs.
    About the only control you have over the JVM's exit code is that if your main method completes without throwing an exception, the JVM will have an exit code of 0, and if main throws an exception (either explicitly or by not catching one thrown from below), it will be non-zero. I'm not even sure if that's guaranteed, but I would guess that's the case.
    EDIT: I'm kind of full of crap here. If you're writing the Java code, you can call System.exit(whatever). But nonetheless, if your installer requires certain exit codes from any app--java or otherwise--you have a problem.
    Edited by: jverd on Oct 29, 2009 1:27 AM

  • How to get return value from Java runtime.getRuntime.exec?

    I'm running shell commands from an Oracle db (11gr2) on aix.
    But, I would like to get a return value from a shell comand... like you get with "echo $?"
    I use a code like
    CREATE OR REPLACE JAVA SOURCE NAMED common."Host" AS
    import java.io.*;
    public class Host {
      public static int executeCommand(String command) {
        int retval=0;
        try {
            String[] finalCommand;
            finalCommand = new String[3];
            finalCommand[0] = "/bin/sh";
            finalCommand[1] = "-c";
            finalCommand[2] = command;
          final Process pr = Runtime.getRuntime().exec(finalCommand);
          pr.waitFor();
       catch (Exception ex) {
          System.out.println(ex.getLocalizedMessage());
          retval=-1;
        return retval;
    /but I do not get a return value... because I don't know how to get return value..
    Edited by: user9158455 on 22-Sep-2010 07:33

    Hi,
    Have your tried pr.exitValue() ?
    I think you also need a finally block that destroys the subprocess
    Regards
    Peter

  • How to get return values from region?

    I add a page flow as region into a page. The page flow has a return parameter. How to get the return value in parent page?

    I have been also intrigued by this question.
    There is however a workaround that you can set the values in requestScope.
    We can have a regionNavigationListener on the region and catch the end of taskflow if viewid is null.
    regionNavigationEvent.getNewViewId() == null
    Here we can read the request values and set wherever to be used.
    maniesh (sid)

Maybe you are looking for

  • Can't open a published Word document - Captivate 5

    When I publish a Word document from within Captivate 5.  The dialogue box opens upon completion as asks if you want to preview the output.  When I click yes, I get the following error.  It does open if I manually open from within Word.

  • Do we have HDMI to thunderbolt  converters currently

    Do we have HDMI to thunderbolt  converters currently in market for 27" iMac

  • Photoshop CS5 and Epson 9900, Win 7, 64bits

    Hi, I recently upgraded from photoshop cs3 to cs5 and now all of my prints on epson 9900 large format printer come out too dark. The same pictures printed with cs3 look good but not on cs5. How can I fix it? Is there a patch for this issue on Adobe w

  • Fifth Third Bancorp to Consolidate Up to 100 Branches

    Fifth Third Bancorp FITB -0.43 % said it plans to consolidate or sell about 100 of its branches and about 30 other properties, a move that comes as mobile and electronic banking grow in popularity. http://www.wsj.com/articles/fifth-third-bancorp-to-c

  • "CREATE ACCOUNTING"프로그램이 INVOICE나 PAYMENT등을 SELECT하지 못할때

    제품 : FIN_AP 작성날짜 : 2003-04-07 "CREATE ACCOUNTING"프로그램이 INVOICE나 PAYMENT등을 SELECT하지 못할때 ======================================================== PURPOSE Invoice나 Payment정보에 대해 Account정보를 생성한 다음 GL로 그 정보를 transfer해야 한다. 그렇게 Account정보를 생성하기 위해 "Create A