Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inscrutable differences

 
Chris Pat
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post some code. Paraphrasing loses much of the details that we need to be able to help you.

Layne
 
Chris Pat
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64975
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did the right(and not the expedient) thing


Doing the right thing most oftern turns out to be the most expedient thing.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic