File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Finding out the calling method?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Finding out the calling method??" Watch "Finding out the calling method??" New topic
Author

Finding out the calling method??

John Bartlett
Ranch Hand

Joined: Jan 25, 2006
Posts: 116
Hi,

I am currently having problems with an object that is being set incorrectly, the only problem im having is that it is being called by multiple methods. Is there a way to find out the actual method that is calling the object method?

I have used reflection to find out the calling class but the problem is that several methods within the same class make use of that function.

I have searched around and cant find a thing, if anyone has any ideas it would be really helpful.

Thanks in advance,

John
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3169
    
  10
Create a Throwable object in the method and then print its stack trace.


Joanne
John Bartlett
Ranch Hand

Joined: Jan 25, 2006
Posts: 116
Yeah good idea, worked just how i wanted it.

Shame it has led to more questions rather than an answer lol!

Thanks for the quick reply,

John
John Bartlett
Ranch Hand

Joined: Jan 25, 2006
Posts: 116
ok.....really confused by what is going on now!

I have a number of different JSF pages that are used as a kind of sign up feature, the user fills out one page and then presses and next button which links to the next page and so on.

My problem is that on one of my pages I have a SelectOneMenu that is changing the value of a variable within an object in the banking bean, this is all well and good when im pressing next on the current page and it carries out the lifecycle and updates the model but when i press next on the next page the components values on the previous page are all set to null?

This means that when i carry out the entire form no actual information from that page is carried through as it is all null values

Has anyone else come across this problem?

Thank you,

John

ps.

This post is probably best suited for the JSF section, but ill let the admins move the post rather than makin another post.
Jody Brown
Ranch Hand

Joined: Nov 09, 2005
Posts: 43
Without knowing the exact framework your application is using I can only offer a fairly generic suggestion. It sounds like you need to make sure all of the data is persisted by either using the session, or is sent backwards and forwards in the request/response each time. You may well be trying to do this, but you may want to check the scope of whatever it is that you are using to store the variables. They may well be getting reset/overwritten between each and every response, especially if you are creating new bean instances whenever a page loads.

A bit generalised, I know, but I hope it helps somewhat.
Jody Brown
Ranch Hand

Joined: Nov 09, 2005
Posts: 43
Without knowing the exact framework your application is using I can only offer a fairly generic suggestion. It sounds like you need to make sure all of the data is persisted by either using the session, or is sent backwards and forwards in the request/response each time. You may well be trying to do this, but you may want to check the scope of whatever it is that you are using to store the variables. They may well be getting reset/overwritten between each and every response, especially if you are creating new bean instances whenever a page loads.

A bit generalised, I know, but I hope it helps somewhat.
John Bartlett
Ranch Hand

Joined: Jan 25, 2006
Posts: 116
Hi

I am using JSF with Facelets. I am also using spring and hibernate but i dont believe the problem is anything to do with those.

My managed beans all have their scope set to session.

I have been debugging for well over an hour and have come to the conclusion that the values are not remaining in the jsf component tree...instead they are all being reset and this means that the old (good) values are being overwritten with the new (wrong) null value :-(!

But knowing this how can i got about fixing the problem, wot i dont understand is why the value (set using the previous page) is not persisting and is being overwritten on the next page...?

Excuse the poor descriptions I have only been learning JSF for a month and am still a tad rusty:S.

Thank you for the quick reply,

John
John Bartlett
Ranch Hand

Joined: Jan 25, 2006
Posts: 116
ok think i may no why it is doing it now, just need to think of a solution.

I think it is because all the components remain in the jsf tree, so when you are on a seperate page it trys to update the components previously used, this leads to them being set to null.

I am not sure how im gonna avoid this, but i think the rendered attribute within the component mite be a way to go....will have to give it some more thought.

Ne suggestions would be much appreciated.

Thank you,

John
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Finding out the calling method??
 
Similar Threads
Can a thread call a non-synchronized instance method of an Object when a synchronized
"A thread can aquire more than one lock"-K&B
Calling Which Method?
Rules of method overloading broken??
java.sql.SQLException: ORA-00020: maximum number of processes (%s) exceeded