• Post Reply Bookmark Topic Watch Topic
  • New Topic

Control does not enter try block  RSS feed

 
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code runs upto first statement in execute() and prints "In execute method". But it does not enter try block. What can be the reason for that ? How to fix this ?

Thanks
 
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why do you think it doesn't enter the try block?
 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am checking log file, I can see "In execute method" printed there. But none of the lines in Try block after that. Also, not the line from catch block.

So, its obvious that code is not entering try block.

Can there be anything else than that ? Please let me know, how to debug this code ?

Thanks
 
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nirjari patel wrote:Can there be anything else than that ?

Recompile the code, you probably are not running the most up to date version.
 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
code has been recompiled , but still it try block does not run

thanks
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you running in a debugger? Do you have a break point defined?
 
Ranch Hand
Posts: 3090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure that there is no older copy of the code lying around on you system somewhere, such that you're accidentally executing that instead?

Try this: replace the message "In execute method" with "Begin execute method" or some other trivial change. Compile and run again. Do you see the change in the output? If not, then there's another copy of Test.class somewhere on your system. Find it and kill it.
 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I add code before try-catch block, that is being executed and message is printed. But everything in try-catch block does not get executed.
So thats the proof that latest code is being executed.

If my code does not have main(), how can I test it as standalone. This current code is executed by application, when I start a workflow.
I want to test this code as standalone, is there a way to do this ?

Thanks
 
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nirjari patel wrote: . . . is there a way to do this ?

Thanks
Try adding a main method to that class. But you may have dependencies which you cannot provide, in which case that will be impossible.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!