Hi:
Given the following snip of code:
-------------------------------------------------------------
function validateWoodyForm(form) {
var empId = parseInt(cocoon.request.emp_id);
var messageNoSelect = new String("Please select an Employee from the list");
....
try {
factory = cocoon.getComponent(Packages.o.a.c.ojb...JdoPMF.ROLE);
bean = handler.retrieve(empId, factory);
if (bean instanceof Packages.test.Employee) {
validateDataPerYear = employeeHandler.validateDataPerYear(bean);
} else {
form.getWidget("errorMessages").addMessage(messageNoSelect);
return false;
}
} finally {
cocoon.releaseComponent(factory);
}
.... (more code in the function) ...
-------------------------------------------------------------
The snip is part of a function that validate Woody input. In this snip,
the function in the line:
***** if (bean instanceof Packages.test.Employee) {
First verify we are able to got a correct bean, because the user can
"hack" the request and send back an EmpId that does not exist in the DB at
all (we already did this).
For this reasons, we use this line.
As you can note if the bean is not an instance of Packages.test.Employee,
then we fill an error message and return (wich cause the function to end).
My question is:
In this case the finally block is executed or not? As I understand if the
finally is not executed, then the factory will never be released and it
will mean a memory leak.
Please help.
Best Regards,
Antonio Gallardo
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]