Trying to change center membership for a group with active accounts shows exception instead of clean error message

Description

repro steps:

On the test server, go to Suarez Group.
Click on Edit Centre Membership, and search for a different center - like Barangay 05.
Click on it to switch the center.
Click Submit.

Expected:

Red error message at the top indicating you cannot change a center with active accounts.

Actual:

Following http error

javax.servlet.ServletException: org.mifos.core.MifosRuntimeException: org.mifos.customers.exceptions.CustomerException: errors.Customer.hasActiveAccount
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
org.mifos.framework.struts.action.MifosRequestProcessor.processActionPerform(MifosRequestProcessor.java:233)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.mifos.security.util.LoginFilter.doFilter(LoginFilter.java:85)
org.mifos.framework.persistence.DatabaseInitFilter.doFilter(DatabaseInitFilter.java:51)

root cause

org.mifos.core.MifosRuntimeException: org.mifos.customers.exceptions.CustomerException: errors.Customer.hasActiveAccount
org.mifos.application.servicefacade.CustomerServiceFacadeWebTier.transferGroupToCenter(CustomerServiceFacadeWebTier.java:544)
org.mifos.customers.group.struts.action.GroupTransferAction.transferToCenter(GroupTransferAction.java:180)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
org.mifos.framework.struts.action.BaseAction.execute(BaseAction.java:105)
org.mifos.framework.struts.action.MifosRequestProcessor.processActionPerform(MifosRequestProcessor.java:204)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.mifos.security.util.LoginFilter.doFilter(LoginFilter.java:85)
org.mifos.framework.persistence.DatabaseInitFilter.doFilter(DatabaseInitFilter.java:51)

root cause

org.mifos.customers.exceptions.CustomerException: errors.Customer.hasActiveAccount
org.mifos.customers.group.business.GroupBO.validateForActiveAccounts(GroupBO.java:383)
org.mifos.customers.business.service.CustomerServiceImpl.transferGroupTo(CustomerServiceImpl.java:310)
org.mifos.application.servicefacade.CustomerServiceFacadeWebTier.transferGroupToCenter(CustomerServiceFacadeWebTier.java:540)
org.mifos.customers.group.struts.action.GroupTransferAction.transferToCenter(GroupTransferAction.java:180)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
org.mifos.framework.struts.action.BaseAction.execute(BaseAction.java:105)
org.mifos.framework.struts.action.MifosRequestProcessor.processActionPerform(MifosRequestProcessor.java:204)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.mifos.security.util.LoginFilter.doFilter(LoginFilter.java:85)
org.mifos.framework.persistence.DatabaseInitFilter.doFilter(DatabaseInitFilter.java:51)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.
Apache Tomcat/6.0.18

Environment

None

Activity

Show:
Jakub Sławiński
March 29, 2010, 2:42 PM

I cannot reproduce this exception in Gazelle C. However, I can do that using trunk.

Please check, if the Gazelle C is affected by this issue. If not, I will fix it only in the trunk.

Kay Chau
March 29, 2010, 4:34 PM

Good catch, yes this is only in Shamim D.

Kay Chau
March 30, 2010, 7:40 PM

I'm reassigning to Keith W since he is looking @ this code already

keithwoodlock
March 31, 2010, 1:58 AM

Resolved in trunk - https://ci.mifos.org:8843/hudson/job/trunk/1009/

Mifos has custom exeption handling for exceptions of type ApplicationException and this is used for display error messages to the user. This was broken after the refactoring an exception other than ApplicationException (or CustomerException) was returned.

Jeff Brewster
May 17, 2010, 11:01 PM

verified now see (in red):

  1. The membership cannot be changed since there are Active accounts present.

Fixed

Assignee

mifosqa

Reporter

Kay Chau

Labels

None

URL

None

Story Points

0.5

Team

Community

Scheduled For

Release

Epic

None

Notify

None

productboard URL

None

Man Day Estimate

None

Components

Fix versions

Affects versions

Priority

Major
Configure