• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Code beeing skipped.

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ALL
Im not sure if this is where this question belongs but if i made a mistake i apologise :-)
Im stumped by a problem thats occuring in the application im supporting.
part of the code is
=====================================
private MQFile __transform(TxFile file) throws Exception
{
SysLog.log(SysLog.DEBUG, this, "+++TRANFORM");
MQFile mqfile = new MQFile();

mqfile.setData(file.getData());
mqfile.setCid(file.getBasename());
mqfile.setQueues(queues);
mqfile.setTxName(ctx.getTxName());
//from here on the code is skipped ie not executed at all-----There
//is no exception thrown or anything.The code just returns the MQFile
//but withouth the filename property attached to it.
Properties props = new Properties();
props.setProperty("fileName", file.getName());
SysLog.log(SysLog.DEBUG, this, "+++FILENAME_IS-------- "
+ file.getName());
mqfile.setProperties(props);
return mqfile;
}
Can someone please tell me if they can think of anyreason why the code is beeing skipped here.Ive been thinking on it for a while but i would sure like to get some help on this.
Thanks a lot
Parth
 
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which part? All of it? Any exception will make it return prematurely...
 
parth jeevan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well like i mentioned there isnt any exception beeing thrown.The method thats calling this method didnt catch any exceptions.
The MQ file is actually turned into an mq message which is recieved on the other side.All the properties up until txName are beeing added properly.
Its after the line "mqfile.setTxName(ctx.getTxName());" that the problems starting.The properties object was found to be null on the recieving side.
The statement "SysLog.log(SysLog.DEBUG, this, "+++FILENAME_IS-------- "
+ file.getName());" is also not beeing logged.I believe that the code is beeing skipped and there isnt any exception to justify this skip.That is whats bothering me.Any ideas?
Thanks for looking into this.
Parth
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by parth jeevan:
Any ideas?



Yes. It is exceedingly likely that your problem is that the code that's actually being executed doesn't match this source. This might be due to a compile error or other problem that's preventing the new code from being deployed, or a classpath problem; or the app server may have multiple copies of this class installed and an older one is being loaded preferentially. Blow the old application completely away, delete every class file in sight, rebuild, and redeploy.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. Is "+++TRANFORM" being logged ?
2. Do you have another __transform overridden method ?
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think EFH has it right. One simple way to see if that's the case, before you spend time tracking down where this extra version of your code is, is to make a small visible modification to a portion of code that is executing. E.g. the "+++TRANFORM" message. Try changing this to "+++TRANFORM XXXX" or something, and see if you observe the change. If you do, EFH's suggestion is correct and you must fix the problem. Otherwise, it's some other cause.

If it's not the problem EFH describes, the other possibility that comes to mind is that maybe there really is an exception being thrown, but some evil person has written a catch block which catches the exception but does not report the problem in any way. If this is the case, the best solution is usually to beat that person with a stick. Oh, and put a log statement in the catch block, too.
 
parth jeevan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ernest.
I have already asked the people supporting this on the remote server to check if they indeed have the latest version of the Code.I hope this is the reason as it doesnt make any other sense why the code would be skipped like this.

Satou kurinosuke

1:Yes TRANSFORM+++ IS being logged

2:No there is no other _transform overridden method
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry I didn't notice the comment in the code. Speaking of which, please try and use code tags in the future, it makes things easier to read.
 
parth jeevan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All
I checked and confirmed that the code thats executing matches with the source code that ive been checking :-(
Also ive also checked the method thats calling the method in which code is beeing skipped.The error handling seems to be ok and would have logged an ERROR message had an exception been thrown.Heres the code together for easy reading.I thank you all for looking into this.If ive skipped some solution that any of you mentioned ...sorry :-)
======================================================================
private MQFile __transform(TxFile file) throws Exception
{
SysLog.log(SysLog.DEBUG, this, "+++TRANFORM");
MQFile mqfile = new MQFile();

mqfile.setData(file.getData());
mqfile.setCid(file.getBasename());
mqfile.setQueues(queues);
mqfile.setTxName(ctx.getTxName());
Properties props = new Properties();
props.setProperty("fileName", file.getName());
SysLog.log(SysLog.DEBUG, this, "+++FILENAME_IS-------- "
+ file.getName());
mqfile.setProperties(props);

return mqfile;
}
The code in bold is beeing skipped.
below is the method thats calling the one above.
=========================================================================
private void __onFile(TxFile file)
{
SysLog.log(SysLog.DEBUG, this, "+++NEW: file=" + file.getPath());
try
{

if (validateTxFile(file))
{
MQFile mqfile = _transform(file);
deliver(mqfile);
}
else
{
SysLog.log(SysLog.INFO, this, "MQFile should not be sent");
}

try
{
archive(file);
}
catch (Exception ex)
{
SysLog.log(SysLog.DEBUG, this, ex);
}
}
catch (Exception e)
{
try
{
error(file, e);
}
catch (Exception ex)
{
SysLog.log(SysLog.DEBUG, this, ex);
}
}
finally
{
try
{
commit(file);
}
catch (Exception ex)
{
SysLog.log(SysLog.DEBUG, this, ex);
}
}
}
The _transform method logs +++TRANSFORM in the logs and so does the deliver method...which logs +++DELIVER ...Im a little confused here.
Parth
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The code above looks like a real cut and paste, so perhaps it's significant that the definition of "__transform()" above uses two underscores at the beginning of the name, while the call to the method uses just one. Is there by chance also a "_transform()" method, with only one underscore?

Why all the leading underscores, anyway? Sure is an ugly way to write code...
 
parth jeevan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My apologies Ernest.
The code is a real cut and paste.I made a mistake while copying and typing.
The _transform is actually a __transform.
MQFile mqfile = _transform(file); is actually
MQFile mqfile = __transform(file);

And yes it is the dirtiest code ive ever seen in my life :-(
Parth
 
parth jeevan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Guys
It seems that the problem was exactly what EFH has suggested.The guys from the remote site thought they had the new files but when i went in and checked for myself it was old code.
The apps working ALRIGHT now.
Thanks a lot everyone for all your help.
parth
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by parth jeevan:
The guys from the remote site thought they had the new files but when i went in and checked for myself it was old code.



I'm glad you've got things working but I'm sorry you had to go through all this; it's a frustrating kind of experience to have.
 
reply
    Bookmark Topic Watch Topic
  • New Topic