2 Attachment(s)
Null value coming from Database
Code Java:
Installed_optionsHome inopthome = (Installed_optionsHome)jndiContext.lookup("installed_optionsCFY.Installed_optionsHome");
Enumeration installed_options = inopthome.findBySiteId(siteId);
while (installed_options.hasMoreElements()) {
installedOptionsObject = (Installed_options)installed_options.nextElement();
insOpt=installedOptionsObject;
-----The below code worked earlier
Code Java:
if (installedOptionsObject.getService_options_name().equals("Self Install")) {
OptionsName = installedOptionsObject.getService_options_name();
instStatus = installedOptionsObject.getStatus();
Logging.log("OptionsName " + OptionsName , Logging.DEBUG);
}
if ((installedOptionsObject.getStatus()).equals("ADD")) {
//Update IP Count if found
if ((installedOptionsObject.getService_options_name()).equals("Addl IPs")) {
}
Code Java:
//Update Mail Count if found
if ((installedOptionsObject.getService_options_name()).equals("Mail")) {
// Update Mail Count
if (mailCount != -1) {
Logging.log(method + "Mail Count = " + mailCount, Logging.DEBUG);
installedOptionsObject.setQuantity(mailCount);
mailFound = true;
} else {
Logging.log(method + "Mail Count not received", Logging.DEBUG);
}
The scenario is like when I am trying to get the value from a field in a record from the database, I am getting null value. Which is in turn causing me to create a new record with a null value in a field. Basically this code was working for about 6 years. And now there is no code change to this particular file. There is value in DB field say "Service_Options_Name" ,yet it is taking the null value and when I change the code as mentioned below, its working.
Now the change is as follows:
Code Java:
while (installed_options.hasMoreElements()) {
installedOptionsObject = (Installed_options)installed_options.nextElement();
insOpt=installedOptionsObject;
if ( (new Integer(installedOptionsObject.getAccess_seq()).toString()).equals(accessSeq)) {
//following condition was added for IP Letter Validation
String serviceOptionName="";
if(installedOptionsObject.getService_options_name()!=null)
serviceOptionName=installedOptionsObject.getService_options_name();
if (serviceOptionName.equals("Self Install")) {
OptionsName = installedOptionsObject.getService_options_name();
instStatus = installedOptionsObject.getStatus();
Logging.log("OptionsName " + OptionsName , Logging.DEBUG);
}
if ((installedOptionsObject.getStatus()).equals("ADD")) {
//Update IP Count if found
if (serviceOptionName.equals("Addl IPs")) {
// Update IP Count
Code Java:
//Update Mail Count if found
if (serviceOptionName.equals("Mail")) {
// Update Mail Count
if (mailCount != -1) {
Logging.log(method + "Mail Count = " + mailCount, Logging.DEBUG);
installedOptionsObject.setQuantity(mailCount);
mailFound = true;
} else {
Logging.log(method + "Mail Count not received", Logging.DEBUG);
}
}
I think the problem behind this issue is when I assign the options name from DB to another string object, it is working. Else it is not working.
Can someone pls let me know what is wrong here?