Step into method- call the same method (bermuda triangle)

I don't know why but I have:
step into method1-> call the same method1->step into method1-> call the same method1->step into method1-> call the same method1 and so on.
Off course, the result is error "stack over flow".
public Object getObject(Object o, String msg) {
          Object object = null;
          if (o instanceof Center) {
               object = this.getObject((Center) o, msg);
          if (o instanceof Student) {
               object = this.getObject((Student) o, msg);
          if (o instanceof Curriculumn) {
               object = this.getObject((Curriculumn) o, msg);
          if (o instanceof Course) {
                  System.out.println("YAHOO!");
            object = this.getObject((Course) o, msg);
               System.out.println("google");                                // no google
          return object;
public Object getObject(Curriculumn curriculumn, String msg) {
          Object object = null;
          if(msg.equals("Author")) {
               String s = new String();
               curriculumn.setAuthor(s);
               return s;
          if(msg.equals("CurriculumTitle")) {
               String s = new String();
               curriculumn.setTitle(s);
               return s;
          if(msg.equals("RevisionDate")) {
               String s = new String();
               curriculumn.setRevisionDate(this.stringToCalendar(s));
               return s;
          if(msg.equals("id")) {
               String s = new String();
               s ="0";                                     //dfsfsdfsd_____________0
               curriculumn.setId(Integer.parseInt(s));
               return s;
          if(msg.equals("Course")) {
               Course course = new Course();
               curriculumn.addCourse(course);
               return course;
          return object;
     public Object getObjest(Course course, String msg) {
          Object object = null;
          if(msg.equals("RevisionDate")) {
               String s = new String();
               course.setRevisionDate(this.stringToCalendar(s));
               return s;
          if(msg.equals("Author")) {
               String s = new String();
               course.setAuthor(s);
               return s;
          if(msg.equals("Task")) {
               Task task = new Task();
               course.addTask(task);
               return task;
          if(msg.equals("id")) {
               String s = new String();
               s = "0";                             //dfsdfffffffff______________________--3
               course.setId(Integer.parseInt(s));
               System.out.println("MESSAGE in id COurse"); ///9009090909
               return s;
     if(object==null) System.out.println("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");     
     return object;
     } The problem is that getObject((Curriculumn curriculumn,...) works well, but getObject((Course course, ) not.
The out put is
Yahoo
Yahoo
Yahoo
and so on... it does not print google

You forgot to use the @Overload
annotation.
Err.. @Override ?Won't work here :):-( Obviously I'm missing the point!There isn't one :)

Similar Messages

  • How do I call methods with the same name from different classes

    I have a user class which needs to make calls to methods with the same name but to ojects of a different type.
    My User class will create an object of type MyDAO or of type RemoteDAO.
    The RemoteDAO class is simply a wrapper class around a MyDAO object type to allow a MyDAO object to be accessed remotely. Note the interface MyInterface which MyDAO must implement cannot throw RemoteExceptions.
    Problem is I have ended up with 2 identical User classes which only differ in the type of object they make calls to, method names and functionality are identical.
    Is there any way I can get around this problem?
    Thanks ... J
    My classes are defined as followes
    interface MyInterface{
         //Does not and CANNOT declare to throw any exceptions
        public String sayHello();
    class MyDAO implements MyInterface{
       public String sayHello(){
              return ("Hello from DAO");
    interface RemoteDAO extends java.rmi.Remote{
         public String sayHello() throws java.rmi.RemoteException;
    class RemoteDAOImpl extends UnicastRemoteObject implements RemoteDAO{
         MyDAO dao = new MyDAO();
        public String sayHello() throws java.rmi.RemoteException{
              return dao.sayHello();
    class User{
       //MyDAO dao = new MyDAO();
       //OR
       RemoteDAO dao = new RemoteDAO();
       public void callDAO(){
              try{
              System.out.println( dao.sayHello() );
              catch( Exception e ){
    }

    >
    That's only a good idea if the semantics of sayHello
    as defined in MyInterface suggest that a
    RemoteException could occur. If not, then you're
    designing the interface to suit the way the
    implementing classes will be written, which smells.
    :-)But in practice you can't make a call which can be handled either remotely or locally without, at some point, dealing with the RemoteException.
    Therefore either RemoteException must be part of the interface or (an this is probably more satisfactory) you don't use the remote interface directly, but MyInterface is implemented by a wrapper class which deals with the exception.

  • Applet with 2 methods with the same name in ie

    Hi,
    I have a problem with the Java 1.5 plugin for Internet Explorer .
    When my Applet contains 2 methods with the same name but not the same return type, ie does not take the good return type.
    Here is an exemple :
    * Class TestApplet
    package test.applet;
    import java.applet.Applet;
    public class TestApplet extends Applet {
         public void init() {
              System.out.println("init()");
         public void start() {
              System.out.println("start()");
         public String test(String s) {
              System.out.println("test(String) :" + s);
              return s;
         public boolean test(int i) {
              System.out.println("test(int) :" + i);
              return true;
    }I have 2 methods test(), one returns a String and the other a boolean.
    I use the following html code :
    <html>
    <head>
    <script>
    function test() {
         alert(document.DataAccess.test("hello"));
    </script>
    </head>
    <body>
    <applet WIDTH="500" HEIGHT="200" ID="DataAccess" NAME="DataAccess" CODE="test.applet.TestApplet">
    </applet>
    <div onclick="test()">test</div>
    </body>
    </html>
    When I click on "test", the alert show "true" instead of "hello".
    The problem only occurs with a JVM 1.5. It work fine with JVM 1.4.
    Any idea ? Is it a bug ?
    Thanks.

    In your javascript method:
    function test() {
    alert(new String(document.DataAccess.test("hello")));
    MSJVM and SUN jre use different conversion from javaScript objects to Java.
    if you call from javaScript:
    document.getElementById("myApplet").myMethod(22);
    The method in MSJVM should look like this:
    public whatever myMethod(Double d);
    and SUN jre:
    public whatever myMethod(Integer i);
    The best thing to do is this:
    public whatever myMethod(Object o);
                   int col = 0;
                   if (o.getClass().getName().toLowerCase().indexOf("integer") != -1) {
                        col = ((Integer) o).intValue();
                   } else {
                        col = ((Double) o).intValue();
                   }

  • How does a method extend another method in the same class ??

    hi everybody, I want to know if it is possible to have such code as:
    void foo(){
    // foo process
    void bar <<extend>> foo{
    //foo process
    //bar process
    thanks for helping me

    Since you want different names for each of your so-called "child" methods, then neither overloading nor overriding in a subclass will work as each relies on the same method names. Perhaps the following will suffice:
    public class MyClass
       //some stuff
       private myMethodThatDoesSomeStuff()
          //do some stuff that all the other methods must also do
       private methodA(int q, byte z)
          myMethodThatDoesSomeStuff();
          // continue with this method.
       private methodL(short v, float g23)
          myMethodThatDoesSomeStuff();
          // continue with this method.
    }If not, you need to do some design work.

  • How to call the java method in java script function in a portal application

    Hi Friends,
    I am developing one application where i need to fetch the data from KM content and displaying it on the screen in regular interval. I wrote one method in JSPdynpage for fetching data from KM content now I need to call that java method in java script function.
    java method(IComponentRequest request)
    //Coode for fetching the KM content
    function()
    <b>//Need to call the java method</b>
    setTimeout(function, 5000);//setting the time interval for this function
    <<htmlb display code>>
    If anybody can help me in calling the java method in java script function that will be very helpful for me.
    Thanks in advance,
    Sandeep Bonam

    Hi,
    Pls see if the following links could help.
    http://www.rgagnon.com/javadetails/java-0170.html
    http://www-128.ibm.com/developerworks/library/wa-resc/?dwzone=web
    Regards

  • JSR 172: error while invoking methods with the same signature

    Hi
    I am facing a peculiar problem which is not making sense to me. This is what I have done:
    1. Written a simple web service that has two methods: sayHello and sayHellToMe. Both these methods have same signatures. They do not take in any parameter and return a string.
    2. Deployed this web service (document/literal) type on Axis 1.2
    3. Generated the stub classes from the wsdl file using Sun Wireless Toolkit's Stub Generator
    4. I have now written a MIDlet that uses this stub class to invoke both the methods one after the other.
    I enabled SOAPMonitor on Axis and saw the SOAP Request and SOAP Response messages. I observed the following:
    1. In the first method: sayHello - everything works fine (with a few tweaks in the Stub class)
    2. However, while invoking the second method sayHelloToMe, the SOAP Body tag in the SOAP Request does not contain any method name. I checked out the Stub class, the qnames and the types are all correct..
    I also realized that this behavior is seen only when I have methods with the same signature in the web service. Any idea why this might be happening? It seems like a very weird problem.
    Any help in this regard will be greatly appreciated.
    Thanks,
    Arati

    Hi, I'm closing this thread and opening the same in another as the content got pasted in reader un friendly format and i'm unable to change the format.
    Thanks,
    Ravi.

  • Accessing a private variable from a public method of the same class

    can anyone please tell me how to access a private variable, declared in a private method from a public method of the same class?
    here is the code, i'm trying to get the variable int[][][] grids.
    public static int[][] generateS(boolean[][] constraints)
      private static int[][][] sudokuGrids()
        int[][][] grids; // array of arrays!
        grids = new int[][][]
        {

    Are you sure that you want to have everything static here? You're possibly throwing away all the object-oriented goodness that java has to offer.
    Anyway, it seems to me that you can't get to that variable because it is buried within a method -- think scoping rules. I think that if you want to get at that variable your program design may be under the weather and may benefit from a significant refactoring in an OOP-manner.
    If you need more specific help, then ask away, but give us more information please about what you are trying to accomplish here and how you want to do this. Good luck.
    Pete
    Edited by: petes1234 on Nov 16, 2007 7:51 PM

  • Howto call the @Remove method of a stateful session bean after JSF page ...

    I use EJB3, JPA, JSF in my web application. There are 2 database tables: Teacher and Student. A teacher can have many (or none) students and a student can have at most 1 teacher.
    I have a JSF page to print the teacher info and all his students' info. I don't want to load the students' info eagerly because there's another JSF page I need to display the teacher info only. So I have a stateful session bean to retrieve the teacher info and all his students' info. The persistence context in that stateful session bean has the type of PersistenceContextType.EXTENDED. The reason I choose a stateful session bean and an extended persistence context is that I want to write something like this without facing the lazy initialization exception:
    <h:dataTable value="#{backingBean.teacher.students}" var="student">
        <h:outputText value="${student.name}"/>
    </h:dataTable>Because my session bean is stateful, I have a method with the @Remove annotation. This method is empty because I don't want to persist anything to the database.
    Now, my question is: How can I make the @Remove method of my stateful session bean be called automatically when my JSF page finishes being rendered?

    Philip Petersen wrote:
    I have a few questions concerning the EJB remove method.
    1) What is the purpose of calling the remove method on stateless session
    bean?There isn't one.
    >
    2) What action does the container take when this method is called?It checks that you were allowed to call remove (a security check) and then
    just returns.
    >
    3) What happens to the stateless session bean if you do not call the remove
    method?Nothing
    >
    4) Is it a good practice to call the remove method, or should the remove
    method be avoided in the case of stateless session beans?
    Personally, I never do it.
    -- Rob
    >
    >
    Thanks in advance for any insight that you may provide.
    Phil--
    AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
    by Michael Girdley, Rob Woollen, and Sandra Emerson
    http://learnWebLogic.com
    [att1.html]

  • Passing values between methods in the same class

    Hi,
    How to pass internal tables or values between methods in the same class.
    How to check if the internal method in another method is initial or not.
    How to see if the method has already been executed.
    Thanks.

    Just declare the internal table as an attribute in the class - that way every method in this class has access to it.
    Since any method has access to all class attributes you can easily check if the internal table is initial or not.
    I am not aware of any standard functionality if a method has already been executed or not, one way would be to declare a class attribute for each method and set it once the method has been executed. That way every method in that class would know which method has already been executed or not.
    Hope that helps,
    Michael

  • Display which method called the method (gives you a headache doesn't it)

    Hi,
    This question might sound a little weird, so maybe read it twice:
    I would like to see which method called the method.
    public void test1()
       test2();
    public void test2()
       System.out.println(....);
    The program output should be, test1 or classname.test1 or something like that. Is that possible?
    Thanx in advance, Yvo van Beek

    This should give you an idea:   public static void main (String args[]) {
          wereAreWe();
          caller2();
        public static void wereAreWe() {
          try {
            throw new RuntimeException("here we are");
          catch (Exception ex) {
            System.out.println("");       
            ex.printStackTrace(System.out);
        public static void caller1() {
          wereAreWe();
        public static void caller2() {
          caller1();
        }You can parse the result of printStackTrace() to get a more precise output.

  • L2 and L3 Forwarding Method in the Same WAE

          Hi Everyone,
          Is possible to use simultaneously L2 and L3 Forwarding Method (WCCPv2) in the same WAE.
          I wanna to design a cluster with 2 WAE using the same service group in a DC and I wanna support both the L2 and L3
          Forwarding Method at the same time..
          If yes, is there any link when I can get a documentation showing some example configuration
         Thanks in Advanced,
         My Best Regards,
             Andre Lomonaco

    Hi Andrej,
             If I understand this correctly, then your best option is to use G-GRE (Generic GRE) as egress method, and use GRE redirection and MASK assignment. See an Example below.
    wccp router-list 1 172.16.10.1
    wccp tcp-promiscuous service-pair 61 62 router-list-num 1 mask-assign
    wccp version 2
    egress-method generic-gre intercept-method wccp
    For more details, please follow below CCO URL.
    http://www.cisco.com/en/US/docs/app_ntwk_services/waas/waas/v441/configuration/guide/traffic.html#wp1041742
    Ahsan

  • Does setSelectionPath() method of JTree calls the treeValueChanged() method

    Hello,
    Just wanted to know whether setSelectionPath() method of JTree calls the treeValueChanged() method after selecting the path?
    Thanks.

    Hi SaucyMexican,
    Thank you for using Apple Support Communities. 
    It looks like PayPal is still an accepted form of payment for the Apple Store:
    Payment methods you can use in the iTunes Store, Mac App Store, App Store, and iBooks Store - Apple Support
    If you are still having difficulties you can take a look at this article for assistance.
    Change or remove your payment information from your iTunes Store account (Apple ID) - Apple Support
    Regards,
    Jeff D. 

  • JSP does not call the right method in controller class

    Hi all,
    I have a jsp file which loads a page at this address: http://localhost:8080/dir/list/
    I've added two checkboxes to the page; user can check both checkboxes, only one or none. Following is code I have in jsp file:
    <form class="checkboxForm">
    <c:choose>                                                                                                         
    <c:when test='${newItems==true}'>
    <input id="newItems" type="checkbox" value="#" name="newItems" class="checkbox2" checked="checked" /><strong> New Businesses   </strong>                                                                 
    </c:when>
    <c:otherwise>
    <input id="newItems" type="checkbox" value="#" name="newItems" class="checkbox2"/><strong> New Businesses   </strong>
    </c:otherwise>
    </c:choose>
    <c:choose>                                                                                                         
    <c:when test='${rejectedItems==true}'>
    <input id="rejectedItems" type="checkbox" value="#" name="rejectedItems" class="checkbox3" checked="checked"/><strong> Rejected Businesses   </strong>                                                                 
    </c:when>
    <c:otherwise>
    <input id="rejectedItems" type="checkbox" value="#" name="rejectedItems" class="checkbox3"/><strong> Rejected Businesses   </strong>
    </c:otherwise>
    </c:choose>
    <a href="#" onclick="apply();">
    <button name="apply" class="btn-primary" value="Apply" tabindex="4">Apply</button>
    </a>
    </form>
    <script type="text/javascript">
    function apply(){
         var newItems = document.getElementById("newItems").checked;
         var rejectedItems = document.getElementById("rejectedItems").checked;
         alert("Inside apply() method.");
         alert("newItems= " + newItems + ", rejectedItems: " + rejectedItems);     
         window.location = "<c:url value='/list/'/>" + newItems + "/" + rejectedItems;
         alert("window.location= " + window.location);
         alert("Add extra delay!");
         return false;
    </script>This is my Controller class:
    // Method1: this method gets called when the user loads the page for the first time.
    @RequestMapping(value="/list", method = RequestMethod.GET)
    public String list(Model model, HttpServletRequest request) {          
              System.out.println("Controller: method1: Passing through...");
              model.addAttribute("newItems", Boolean.TRUE);
              model.addAttribute("rejectedItems", Boolean.TRUE);
              // Does other things.
    // Method3: this method gets called when user checks/unchecks one of the checkboxes and clicks on Apply button.
    @RequestMapping(value="/list/{newItems}/{rejectedItems}", method = RequestMethod.GET)
    public String list(@PathVariable Boolean newItems, @PathVariable Boolean rejectedItems, Model model, HttpServletRequest request) {          
              System.out.println("Controller: method3: Passing through...");
              model.addAttribute("newItems", newItems);
              model.addAttribute("rejectedItems", rejectedItems);
    // Does other things.
         }The way my jsp code is written now, it calls the correct method and displays the correct url. When page loads for the first time, it calls method1 and the url is:
    http://localhost:8080/dir/list
    When the user checks/unchecks one or both checkboxes and clicks on apply button, method3 is called and this url is displayed:
    If both checkboxes are checked which both booleans are set to true:
    http://localhost:8080/dir/list/true/true
    Everything is fine... however, if I comment these two lines at the end of JavaScript apply() function,
    alert("window.location= " + window.location);
    alert("Add extra delay!");Then method3 will never gets called; only method1 gets called and I see this url:
    http://localhost:8080/url/list//?newItems=%23&rejectedItems=%23&apply=Apply
    I do not know why it gets confused bet. method1 and method3 and cannot pick the right method?
    I tried to use the POST method instead, but the page goes directly to our internal error page and it never reaches the method I wrote in my controller for POST:
    I don't really know what I'm doing wrong? Any help is greatly appraciated.
    Edited by: ronitt on Dec 13, 2011 2:35 PM

    I changed the <form> in the jsp to div and its working fine. I do not need to have comments in JavaScript funcion() anymore. I don't know why that made the difference though? According to:
    http://www.w3schools.com/tags/tag_form.asp
    The <form> tag is used to create an HTML form for user input.
    The <form> element can contain one or more of the following form elements:
    <input>
    <textarea>
    <button>
    <select>
    <option>
    <optgroup>
    <fieldset>
    <label>
    An HTML form is used to pass data to a server.
    I do have <button> and also send the data - the value of checkboxes - to server. So I think it should also work with <form>.
    Please let me know if you have any idea. Thanks.

  • How can I call the create method in BO from Application Service

    Hello!
    When I create a Business Object, CAF generates some methods automatically.
    How can I call the create method in the BO from Application Service logic?
    When i call the method then the entityManager and the sessionContext is NULL.
    How can I initialize this?
    Can anybody help me?
    Thanks, Thomas

    If you are using CE 7.11...
    1) In the Application Services, add the BO as dependant object in dependencies tab.
    2) In the implemention, add the following codes to call create method of the BO:
    this.get<BO>.createMethod();
    julius

  • I need to get photos off a water damaged iPhone 3GS. Can I take out the component that has the photos (is this the main board?) and put it into another of the same phone to retrieve the photos? Please help

    I need to get photos off a water damaged iPhone 3GS. It spent time underwater, saltwater. I let it dry for a week, turned it on, the apple symbol came on, then it died. I need to retrieve my photos off it. Can I take out the component that has the photos (is this the main board?) and put it into another of the same phone to retrieve the photos? Please help

    You're talking about the logic board. The two most likely things to get toasted, with water damage, are the battery(it shorts out), & the logic board. The worst water damage would be salt water. I'm afraid your logic board is toast.

Maybe you are looking for

  • GR and IR from different vendor??

    hi experts Can anybody give some idea to how to go about the below scenario. I have to create 1 PO to x vendor for 100/ea quantity. X vendor he 'll distribute the same some 50 vendors and advised to send materials and invoice to me with ref to 1 PO.

  • Changing the file name in the iPhoto Library

    I just recently converted from a pc to a iMac, which is very cool, however the pc file names are only unique inside an Event. Is there a utility that I can run to give each photo in iPhoto a unique file name?

  • Upgrading from 1gen mini to 30G video...

    Hi all, I'm currently awaiting the arrival of my new 30G video which will replace my old faithful mini. My husband is going to take the mini, so how do we do this painlessly? I would like to just disassociate the mini from my iTunes library somehow a

  • Change apple ID to apple ID

    how to change apple ID to another apple ID (using icloud.com not other domain)

  • Change Scenario Attribute

    I want to change Default View for the Budget Scenario from MTD to YTD. But when I change it, the "PhasedSubStartYear" always show up a "0" and I cannot load the updated metadata. Just a side note, we have not use the process management yet so the "Ph