aspose file tools*
The moose likes Beginning Java and the fly likes inscrutable differences Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "inscrutable differences" Watch "inscrutable differences" New topic
Author

inscrutable differences

Chris Pat
Ranch Hand

Joined: Aug 27, 2005
Posts: 156
Hello
I have two objects with the EXACT same method, commonMethod.
For objectA I call commonMethod from objectA.start.
for objectB I call commonMethod as objectB.commonMethod.

commonMethod iterates a collection. Outside of the loop it prints the a member of the last object processed.

objectA works perfectly and prints the member. objectB errors w/NPE on the println.

The method is to obscure and I normalized the details by copying it from objectA into objectB. All the variables are local to commonMethod and it just returns an object; again same in both. Any insight would be helpful. tia.
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Please post some code. Paraphrasing loses much of the details that we need to be able to help you.

Layne


Java API Documentation
The Java Tutorial
Chris Pat
Ranch Hand

Joined: Aug 27, 2005
Posts: 156
Originally posted by Layne Lund:
Please post some code. Paraphrasing loses much of the details that we need to be able to help you.

Layne


Thank you Layne. I solved it. It was my design problem in JDO. I tried to access an enhanced class' member variable. I did the right(and not the expedient) thing and made s/g/etters and it worked fine.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

I did the right(and not the expedient) thing


Doing the right thing most oftern turns out to be the most expedient thing.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: inscrutable differences