Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

[Solved] String becomes null

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm posting this here instead of the JDBC forum (sorry if that is the wrong guess!), because I don't think the JDBC portion of this is the cause of the problem.

I have a String (tName) that is part of a data structure that is becoming null for some reason that I don't understand. Here is what happens:

1) I have a server that pulls a data structure class from a database (see first code block). The print lines in the code show that the server returns the data structure with correct value for the String tName.

2) A separate program calls the getPlayer method via RMI. The first subsequent line of this second program prints out the value of tName to be null. The only hint I have is that tName is null before it is set at the end of the try block.
---

Figured out the problem. It was in how I used externizable. I had intentionally skipped writing/reading tName with externizable since I didn't want it written to the data structure's binary in the database. What I hadn't realized is that RMI was using externizable instead of serializable to pass the data structure. Hence the tName was lost in transit.
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Congrats,
But you should write the updates like this at the start of the post OR at least change the subject line to this:
[SOLVED]String becomes null
 
Joel Sander
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sagar Rohankar wrote:Congrats,
But you should write the updates like this at the start of the post OR at least change the subject line to this:
[SOLVED]String becomes null



Thanks for the gentle instruction. I've followed it.
 
Do Re Mi Fa So La Tiny Ad
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic