Logging method calls

Hi all!
I'm working on a complex java system and have problems debugging it. One of the problems is, that sometimes the program stops with a NullPointerException. Unfortunately this happens in third party code, which I do not have as source. However, I'm sure that the bug is caused by a module developed by my as exchanging this module with another implementation stops the problem.
Is there an easy way to generate a list of method calls for an entire run of a program? At the time the exception is raised, none of my methods remains in the call stack, i.e. the exception is triggered by the foreign code, but probably caused by a value returned earlier from one of my methods. I would therefore like to see what methods have been called before the exception is triggered.
I'm currently working with JBuilder 6. It offers a debugger, but this debugger is terrible slow and very bad when the code that is to debug is not available. You could set a method breakpoint for every method I have implemented, but this would take ages. Even with only one such exception defined, the programm takes several minutes in debug mode, while it usually takes only a fraction of a second. This seems to be completely unworkable. Another thing I have tried was the built-in profiler of the JVM, but it shows results in an aggregated and messy way, not much of a help either.
Any better tools/techniques out there?
Thanx in advance,
Mathias

A method for writing to a log file is not a problem, but I would need to add at least one line of code for every
of my methods and, more important, a meaningful log message like the method name and arguments.
One of the reasons I decided not to implement this, was the impossibility to determine the name or signature
of the current method automatically.Below the code I wrote for my dissertation project. I assert my authorship and copyright of this code, and hereby grant anyone who wants it permission to reproduce this and to create derivatives. It determines the name of the current method automatically, and runs under Java 1.1 (Microsoft machine - I think the Sun machine dislikes using null as the argument for the StringStream constructor, but I wasn't worried about fixing that so haven't investigated too closely). The Tracer.enter() method appends the method name and "{" to the log file. It's proof of concept - I may write an improved version after my exams. Comments cut short to avoid annoying people who don't want to scroll too far.
import java.io.*;
public abstract class Tracer
    static File trace_file;
    static FileWriter fw;
    static final int METHOD = 0;
    static final int FLOW = 2;
    static final int MAJOR = 4;
    static final int MINOR = 6;
    static final int trace_level = 7;
    /* Params:    IN  filename    - a String containing the desired name for */
    /*                              the trace file.                          */
    public static void open(String filename)
        try
            trace_file = new File(filename);
            fw = new FileWriter(trace_file);
        catch (IOException ioe)
            System.out.println("IOException in Tracer.open()");  
    /* Params:    IN  s           - the String containing the trace message  */
    /*            IN  level       - the level of detail of the message       */
    /* Operation: If the specified level is sufficiently low, this method    */
    /*            constructs a Throwable and processes its stack trace to    */
    /*            find the name of the method which called trace.  It then   */
    /*            writes this method name and the trace message to the trace */
    /*            file, terminating the line with a Microsoft EOL (LF-CR).   */
    private static void trace(String s, int level)
        if (level <= trace_level)
            StringStream stringStream = new StringStream(null);
            Throwable bomb = new Throwable();
            bomb.printStackTrace(stringStream);
            String method = stringStream.getMethod();
            try
                fw.write(method+"  "+s + "\015\012");
                fw.flush();
            catch (IOException ioe)
                System.out.println("IOException in Tracer.trace()");  
    /* Operation: Closes the FileWriter and sets the File and FileWriter to  */
    /*            null.                                                      */
    public static void close()
        try
            fw.close();
        catch (IOException ioe)
            System.out.println("IOException in Tracer.close()");  
        trace_file = null;
        fw = null;
    /* Operation: Calls trace with message "{" and trace level METHOD.  This */
    /*                method should be called whenever a method is entered.  */
    public static void enter(String method)
        trace("{", METHOD);
    /* Operation: Calls trace with message "}" and trace level METHOD.  This */
    /*            method should be called just before any return statement,  */
    /*            or before the final } of a method with return type void.   */
    public static void exit()
        trace("}", METHOD);
    /* Params:    IN  flow_statement                                         */
    /*                            - a description of the branch just taken   */
    /* Operation: Calls trace with message flow_statement and trace level    */
    /*            FLOW.  NB This method should be called at the start of any */
    /*            block except a method body, when enter should be called.   */
    public static void flow(String flow_statement)
        trace(flow_statement, FLOW);  
    /* Operation: Calls trace with message major_statement and trace level   */
    /*            MAJOR.  This method should be used for displaying the      */
    /*            results of important steps.                                */
    public static void major(String major_statement)
        trace(major_statement, MAJOR);
    /* Operation: Calls trace with message minor_statement and trace level   */
    /*            MINOR.  This method should be used for displaying the      */
    /*            results of minor steps.  It would probably be overkill to  */
    /*            call minor after every single statement.                   */
    public static void minor(String minor_statement)
        trace(minor_statement, MINOR);
import java.io.*;
/* This class, which extends PrintStream, exists to allow me to get the   */
/* name of the method invoking trace by creating a Throwable and          */
/* examining its stack trace.  This is more reliable than tracking the    */
/* stack myself.                                                          */
class StringStream extends PrintStream
    StringBuffer sb = new StringBuffer();
    int state = 0;
    public StringStream(OutputStream out)
        super(out);
    public StringStream(OutputStream out,
                        boolean autoFlush)
        super(out, autoFlush);
    String getMethod()
        String return_value = sb.toString();
        sb = new StringBuffer();
        state = 0;
        return return_value;
    public void print(char[] chars)
        for (int j = 0; j < chars.length; j++)
            print(chars[j]);
    public void print(char ch)
        switch (state)
            case 0:
            case 1:
            case 2:
                if (ch == '\t')
                    state++;
                break;
            case 3:
                if (ch == ' ')
                    state++;
                break;
            case 4:
                if (ch == ' ')
                    state++;
                else if (ch == '/')
                    sb.append('.');
                else
                    sb.append(ch);
                break;
            default:
                // do nothing
}

Similar Messages

  • Oracle.apps.fnd.framework.OAException: Illegal method call because there is

    I am working on R12.1.3 multi node shared appltop installtion on OEL 5.4. installations were successful and running fine since 10 days , today suddnly i have got the error stack on login screen. please help.
    Error Page
    Exception Details.
    oracle.apps.fnd.framework.OAException: Illegal method call because there is no database connection.
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1251)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:2195)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:543)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:431)
         at OA.jspService(_OA.java:212)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259)
         at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51)
         at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193)
         at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:284)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198)
         at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:395)
         at OA.jspService(_OA.java:221)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259)
         at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51)
         at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193)
         at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:284)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198)
         at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:395)
         at OA.jspService(_OA.java:221)
    if any one got same issue pls help.
    Thx
    RB

    Hussain,
    No Errors found in Db alert log files.
    same issue in all client systems.
    only Apache service is showing as down in adopmnctl stattus
    You are running adopmnctl.sh version 120.6.12010000.5
    Checking status of OPMN managed processes...
    --------------------------------------------------------------+---------
    ias-component | process-type | pid | status
    --------------------------------------------------------------+---------
    OC4JGroup:default_group | OC4J:oafm | 3839 | Alive
    OC4JGroup:default_group | OC4J:forms | 3770 | Alive
    OC4JGroup:default_group | OC4J:oacore | 3623 | Alive
    HTTP_Server | HTTP_Server | 1802 | Stop
    Thx
    RB

  • OAException: Illegal method call because there is no database connection.

    We are gertting this error while login
    Exception Details.
    oracle.apps.fnd.framework.OAException: Illegal method call because there is no database connection.
    at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1251)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:2195)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:543)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:431)
    +at OA.jspService(_OA.java:212)+
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
    Database version : 11.2.0.2.0
    Application version : 12.1.3
    Edited by: Vicky-DBA on Feb 7, 2011 5:23 AM

    Hi;
    What is your EBS and OS?Db version? how you get this error,what is your steps?
    It was working before?Any log in alert log and apache log?
    Check those note:
    Manage Tax On Purchase Order Results In Java.Lang.Nullpointerexception [ID 1277384.1]
    Create a Customer In AR, Attempt To Remove Empty Business Purpose Errors Out [ID 1178665.1]
    Regard
    Helios

  • Time method calls

    What is the best way to time method calls? In my app it is taking a long time to do one specific operation and I wanted to pinpoint what method is holding everything up. Currently I am just using System.currentTimeMillis()...is that the way to go?

    well, i have made a separate utility class called PerformanceLog. it has two methods. start, and stop.
    these methods should be used in pair, and cannot be overlapped.
    when u call start, it records the system.currentTimeInMillis in a private member. then u call stop, it again records the current millis, finds the different and logs it in a separate file, along with a message, indicating whether it was a success, or a failure (a fialure message is usually logged inside a catch statement).
    u can use utility in all ur future projects. dunno for sure, but it should exist in sourceforge.net
    even otherwise, hope this info gives u enuff info to develop ur own.
    regards

  • Taskflow Method call receiving null parameter.

    Hi all,
    I am using 11.1.1.6. I have created in my application an extra project which is pure Java objects and exposed a master class as a POJO DC. In my application, I have a taskflow where I have dragged and dropped one method from my POJO DC - 2 of the parameters of this methods are coming from an application scope bean. I have debugged the application, and made sure that the object being returned by the getter of my app scope bean is not null. So basically, when the breakpoint is in the return statement of my getter the oject is not null and it has been correctly initialized. Just after that, the next breakpoint is in the class receiving the parameter in my POJO DC class. In there, the object is NULL.
    Does anyone knows wat could be the reason??

    Hi Frank Nimphius-Oracle,
    That is precisely the problem.  The object is being passed as to the taskflow as an input parameter (getting it from my application scope bean). If I access the pageFlowScope inside my taskflow I see it and its there, correctely intialized. However, when I call a method call activity that consumes that object as parameter, all what it gets is null.
    The method that consumes this object is in a separate project, and its exposed in a POJO DC. I don't know if it has to be with the complexity of the object I am passing or what but I don't understand why its not being passed correctly to the DC Method.

  • Closing an anonymous stream in method call

    Will an anonymous stream in a method call be closed in the same manner an anonymous stream that is created in an object instantiation will be?
    I know this will close the anonymous FileInputStream:
    DataInputStream in =
    new DataInputStream(new FileInputStream("filename.txt"));
    /* ... code ... */
    in.close();But will this?
    MyPropertiesClass myPropertiesClass = new MyPropertiesClass();
    myPropertiesClass.store(new FileOutputStream("file.txt"));MyPropertiesClass extends Properties, and uses its store().
    I know the JavaDoc for Properties says:
    "After the entries have been written, the output stream is flushed. The output stream remains open after this method returns."
    My question is will the FileOutputStream("file.txt") be closed and garbage collected eventually after this method call because I don't have a reference to it? myPropertiesClass sticks around for a long time afterwards, will the FileOutputStream as well?
    Thanks for any insight,
    KJ

    My question is will the FileOutputStream("file.txt") be closed and garbage collected eventually after this method call because I don't have a reference to it? > myPropertiesClass sticks around for a long time afterwards, will the FileOutputStream as well?Your only hope would be if FileOutputStream overrode finalize and closed the stream there -- but it doesn't (check the API -- finalize isn't overridden). I doubt if Properties retains a reference to the OutputStream you pass to store -- why would it need to? In any case, the bottom line is that output stream isn't being closed until your process exits.
    Why not bite the bullet and rewrite that line of code so that you can explicitly close the stream?
    OutputStream out = new FileOutputStream("file.txt");
    try {
        myPropertiesClass.store(out);
    } finally {
        out.close();
    }It's not one line, but who cares? You could wrap it up in a short utility method:
    static void storeProperties(Properties properties, String path) {...}

  • Using a dynamic variable in the Import command of a Method call

    Hi,
    I am trying to make a Method call fully dynamic.
    I have found out how to make the Method name dynamic, but I am having trouble figuring out how to make the Importing statement dynamic.
    in my code below:
          CALL METHOD o_main->(v_call)
            IMPORTING
              it_ekko = i_ekko.
    I would like to know if it's possible to make both "it_ekko" AND "i_ekko" dynamic so I can use this same call for various tables.
    Hope that makes sense...thanks for your help.
    Andy

    Hi Andrew,
    The method call is fully dynamic; not only the parameters can be specified dynamically but also the method name.
    This is a help extract:
    DATA: line     TYPE c LENGTH 80,
          text_tab LIKE STANDARD TABLE OF line,
          filename TYPE string,
          filetype TYPE c LENGTH 10,
          fleng    TYPE i.
    DATA: meth  TYPE string,
          class TYPE string,
          ptab TYPE abap_parmbind_tab,
          ptab_line TYPE abap_parmbind,
          etab TYPE abap_excpbind_tab,
          etab_line TYPE abap_excpbind.
    DATA: exc_ref TYPE REF TO cx_sy_dyn_call_error,
          exc_text TYPE string.
    class    = 'CL_GUI_FRONTEND_SERVICES'.
    meth     = 'GUI_DOWNLOAD'.
    filename = 'c:\temp\text.txt'.
    filetype = 'ASC'.
    ptab_line-name = 'FILENAME'.
    ptab_line-kind = cl_abap_objectdescr=>exporting.
    GET REFERENCE OF filename INTO ptab_line-value.
    INSERT ptab_line INTO TABLE ptab.
    ptab_line-name = 'FILETYPE'.
    ptab_line-kind = cl_abap_objectdescr=>exporting.
    GET REFERENCE OF filetype INTO ptab_line-value.
    INSERT ptab_line INTO TABLE ptab.
    ptab_line-name = 'DATA_TAB'.
    ptab_line-kind = cl_abap_objectdescr=>changing.
    GET REFERENCE OF text_tab INTO ptab_line-value.
    INSERT ptab_line INTO TABLE ptab.
    ptab_line-name = 'FILELENGTH'.
    ptab_line-kind = cl_abap_objectdescr=>importing.
    GET REFERENCE OF fleng INTO ptab_line-value.
    INSERT ptab_line INTO TABLE ptab.
    etab_line-name = 'OTHERS'.
    etab_line-value = 4.
    INSERT etab_line INTO TABLE etab.
    TRY.
        CALL METHOD (class)=>(meth)
          PARAMETER-TABLE
            ptab
          EXCEPTION-TABLE
            etab.
        CASE sy-subrc.
          WHEN 1.
        ENDCASE.
      CATCH cx_sy_dyn_call_error INTO exc_ref.
        exc_text = exc_ref->get_text( ).
        MESSAGE exc_text TYPE 'I'.
    ENDTRY.
    BR,
    Valentin

  • Error on /SafeMode: error while trying to run project uncaught exception thrown by method called

    i try run VS 2012 with /SafeMode. I create new empty Winform. When I start debug, I got:
    "error while trying to run project uncaught exception thrown by method called through reflection"

    Hi Matanya Zac,
    Did you restart your machine? How about installing the VS2012 update 4?
    >>error while trying to run project uncaught exception thrown by method
    Did you install the VS update in your VS IDE? I met this issue before which was related to the VS update:
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/5ead8ee9-ea09-4060-88b0-ee2e2044ff82/error-while-trying-to-run-a-project-uncaught-exception-thrown-by-method-called-through-reflection?forum=vsdebug
    If still no help, I suggest you repair your VS, and then restart your machine, test the result.
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • AcquireConnection method call to the connection manager Excel connection Manager failed

    I used VS Studio 2008 (BIDS version 10.50.2500.0) on an WinXp machine (v 5.1.2600 SP3 Build 2600) to create a package that writes multiple query results to different tabbed sheets of a single excel spreadsheet. The package was working just fine and has run
    successfully multiple times, but all of a sudden when opening the project, every single Data Flow task with an Excel Connection Manager displayed error icons. Each raises the following error message when attempting to open the Advanced Editor:
    SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005 Description: "Unspecified error". Error at DataFlow task name: SSIS error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method
    call to the connection manager Excel connection Manager failed with error code 0xC0202009. There may be error messages posted before this with more information on why the Acquire Connection method call failed. Exception from HRESULT: 0Xc020801c (Microsoft.SQlServer.DTSPipelineWrap)
    From the time I created the original package (when it worked fine) until now:
     1) I have been using the same computer, the same login account and the same permissions.
     2) I have been writing to the same (32 bit) 2010 Excel file (which I created) in a folder on my local machine.
     3) The filename and location have not changed; a template file is used each time to move and overwrite the previous file. Both are in the same locations.
     4) I can independently open the target Excel file and the template Excel files with no errors.
     6) The ConnectionString has not changed. The Connnection String I am using is
      Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Conversion\Conversion\Results_dt01.xlsx;Extended Properties="EXCEL 12.0 XML;HDR=YES;".
     7) Run64BitRuntime is set to False.
    8)  Delay Validation is set to true
    9) This is not running under a SQL job  
    10) There are no child packages being run
    I CAN create a NEW Excel Connection Manager, assigning it the exact same target Excel spreadsheet, successfully, but when I attempt to assign it to the Data Flow destination this error occurs:
    "Test connection failed because of an error in initializing provider. Unspecified error."
    Thinking that the driver might be corrupt, I opened a second SSIS package, which also uses the Excel Connection Manager (same driver) and this package continues to work fine on the same workstation with no errors.
    I have searched online for causes of this error for many hours and found nothing that helps me to solve this issue.
    Does anyone have any suggestions for me?

    Yes, I have verified that the Excel file is not in use or opened by anyone, including me. It has been two months since I opened this particular package, although I have been working with other packages in this project. I just discovered that another
    package in the same project has the same problem - all Data Flows that output to an Excel Destination now have the same error icons. This second packages outputs to an entirely different Excel file than in the first package.  A summay:
    Package #1 has error on every Excel Destination and uses templateA to overwrite fileA and then writes to fileA
    Package #2 has error on every Excel Desintation and uses templateB to overwrite fileB and then writes to fileB
    Package #3 has no error on any Excel Destination and is linked to multiple files (none are A or B)
    Package #1 and #2 are in the same project, but Package #3 is in a separate project .
    I will try replacing the Excel files with new ones for Package 1 and 2.

  • [Load data from excel file [1]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0202009. There may be error messa

    Error
    [Load data from excel file [1]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0202009.  There
    may be error message
    I am using BIDS Microsoft Visual Studio 2008 and running the package to load the data from excel .
    My machine has 32 bit excel hence have set property to RUN64BITRUNTIME AS FALSE.
    But the error still occurs .
    I checked on Google and  many have used Delay validation property at Data flow task level to true but even using it at both excel connection manager and DFT level it doesnt work
    Mudassar

    Thats my connection string
    Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\SrcData\Feeds\Utilization.xlsx;Extended Properties="Excel 12.0;HDR=NO";
    Excel 2010 installed and its 32 bit edition
    Are you referring to install this component -AccessDatabaseEngine_x64.exe?
    http://www.microsoft.com/en-us/download/details.aspx?id=13255
    Mudassar
    You can try an OLEDB provider in that case
    see
    http://dataintegrity.wordpress.com/2009/10/16/xlsx/
    you might need to download and install ms access redistributable
    http://www.microsoft.com/en-in/download/details.aspx?id=13255
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • What are the methods called while navigating from one applet to another one

    Hi All,
    Could any one brief me about "When you navigate from one applet to another what are the methods called ?".
    Thanks in advance.
    Best Regards,
    N.Madhusudhanan.

    http://forum.java.sun.com/thread.jsp?forum=421&thread=426771&tstart=0&trange=100

  • Issue with a method call in a TaskFlow (works 2 times instead of 1)

    Hi guys,
    i'm using jdev11.1.1.1.2.0 and the integrated weblo or remote weblo 10.3.2.0.
    I'm encountering a problem with a method call which is invoked inside a Task Flow.
    Let me tell us the details of :
    I'm invoking a method call which is part of a Task Flow from the backingbean of the view which is placed before the method call in the taskFlow diagram.
    AN outcome String from the method of the backing bean allows to navigate to the method of the Task flow.
    The method call is called and works normally BUT MY PROBLEM IS THAT THE METHOD IS CALLED TWO TIMES SO THE RESULT IS FALSE.
    For information, the second time the method is called it takes care of the result when it is invoked the first time. So its parameters are updated and are a little different from the first time to the second time.
    NB : This method consists of inserting a row in the database. My result is 2 rows inserted instead of one.
    Thanks for help for this strange behaviour

    Hi
    create a temp calculated column
    =IF(ISBLANK([Duration]),"",[Item Start Date]+([Duration])
    and check if it's working OK
    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

  • Abstract method called in an abstract class

    Hello,
    I am writing some code that I'd like to be as generic as possible.
    I created an abstract class called Chromozome. This abstract class has a protected abstract method called initialize().
    I also created an abstract class called Algorithm which contains a protected ArrayList<Chromozome>.
    I would like to create a non abstract method (called initializePopulation()) which would create instances of Chromozome, call their method initialize() and full the ArrayList with them.
    In a practical matter, only subclass of Algorithm will be used, using an ArrayList of a subclass of Chromozome implementing their own version of initialize.
    I have been thinking of that and concluded it was impossible to do. But I'd like to ask more talented peaple before forgetting it !
    Thanks,
    Vincent

    Ok, let's it is not impossible, juste that I had no idea of how doing it :-)
    The difficulty is that Algorithm will never have to deal with Chromozome itself, but always with subclass of Chromozome. This is usually not an issue, but in that case, Algorithm is required to create instances of the desired subclass of Chromozome, but without knowing in advance wich subclass will be used (I hope what I say makes any sense).
    Actually I may have found a way in the meantime, but maybe not the best one.
    I created in Algorithm an abstract method :
    protected abstract Chromozome createChromozome()The method initializePopulation will call createChromozome instead of calling directly the constructor and the initialize() method of Chromozome.
    Then subclass of Algorithm will implement the method createChromozome using the desired subclass of Chromozome.

  • Ecatt script fails due "Error in OLE API method Call"  error

    Hi ,
    Ecatt scripts fails due to "Error in OLE API method Call" error, this error message occurs once a while.
    We are calling testpartner scripts from Ecatt using REFEXT command. At times this ECATT script fails due to above issue.
    Please help in solving this issue.
    Thanks,
    Asha

    >
    Asha Nagaraj wrote:
    > Hi ,
    >
    > Ecatt scripts fails due to "Error in OLE API method Call" error, this error message occurs once a while.
    >
    > We are calling testpartner scripts from Ecatt using REFEXT command. At times this ECATT script fails due to above issue.
    >
    > Please help in solving this issue.
    >
    > Thanks,
    > Asha
    Hi Asha,
    Are those components are connected and the necessay settings has been done?
    Regards,
    SSN.

  • *ERROR IN OLE CALL - METHOD CALL ERROR...*

    HI ..
    When trying to Upload a file using BDC with Vista OS, we are getting the following error..
    ERROR IN OLE CALL - METHOD CALL ERROR...
    There is no problem with BDC as its working fine with XP & other OS.
    Pls help!!

    Seems that you are working with microsoft files.
    Maybe you are using deprecated functions like WS_EXCEL

Maybe you are looking for

  • Can I set up 2 IDs on one iPad?

    Can I set up 2 IDs on one iPad so we can both keep track of stats on games.  If so, how do we do it?

  • Batch number maangement , Attribute1 & 2

    Hi, Experts, Pls advise where to find the manual for batch managment in how to operate this function. The attribute 1 and attribute 2, what're those for? Thanks. Emily

  • Multiple Select option in Module pool

    Hi, I wanna add a field for 'Delivery number' in the screen of a mod pool prgm.I created a subscreen area in the main screen and did the coding needed.now the problem i am having is if i giv a single value in the from field or  values in the 'From' a

  • Saving problem with trial version

    I have a trial version. How can I save a file as an mp3 file. I only seem to be able to save as an sesx file. I cannot "save selection as." Does the trial version not allow me to do this?

  • I'm having trouble with my airport express continually disconnecting from my network.

    I have my airport express set up to extend my network wirelessly from my Airport Time Capsule base station.  My base station is setup in the basement connected to my Comcast internet router (Motorola Surfboard SB6141).  My Airport Express is on the m