以下是代码:-您能告诉我为什么它会抛出异常以及如何避免这种情况,谢谢您的帮助..
public Collection getBeansFilteredByAuthorityAndApproach(ITaskContext context)throws CEAppException
{ Collection regApprAuthMapColl = this.getRegulatoryAuthorityApproachMap(context);//Collection of All approach combos
Collection finalAuthApprMapColl = new ArrayList();
ParameterSet pSets = context.getExecutionThread().getParameterSet();
//<RuntimeParameterSet> or list of <RuntimeParameters>
ArrayList apAR =pSets.getRuntimeParameterSet().getRuntimeParametersList();
int apSize = apAR.size() ;
for (int j = 0; j < apSize; j++)
{//1
//Individual <RuntimeParameterSet> or list of <RuntimeParameters>
RuntimeParameters rps = (RuntimeParameters) apAR.get(j);
if (Constants.CLONE_TYPE.equalsIgnoreCase(rps.getType())) //TODO :check if it required or not
{//2
//obtain a list of <RuntimeParameter> or indiviual <RuntimeParameters>
ArrayList rtParams = rps.getRuntimeParameterList();
int rtSize = rtParams.size();
for (int k = 0; k < rtSize; k++)
{//3 FOR EACH RUNTIME PARAMETER , i.e Approach & Authority
//Individual <RuntimeParameter>
Integer inputAuthority = null;
Integer inputApproach = null;
RuntimeParameter rtp = (RuntimeParameter) rtParams.get(k);
logger.debug("========== RuntimeParameter rtp="+rtp);
if (Constants.REGAUTHORITY.equals(rtp.getName()))
{
Integer regAuthority = ReferenceData.getRegAuthority(context,rtp.getValue());
inputAuthority = regAuthority;
} else if (Constants.REGAPPROACH.equals(rtp.getName()))
{
Integer regApproach = ReferenceData.getRegApproach(context,rtp.getValue()) ;
inputApproach = regApproach;
}
//FOR EACH RUNTIME PARAMETER FILTER THE COLLECTIONS
//FILTERING DATA
logger.debug("inputApproach :"+inputApproach);
logger.debug("inputAuthority :"+inputAuthority);
if(inputApproach == null)// if APPROACH IS NOT specified in the notification
{
if( inputAuthority == null)// if AUTHORITY IS NOT specified & APPROACH IS NOT specified
{ //Then run for all auhorities and approaches
finalAuthApprMapColl = regApprAuthMapColl;//returning all possible beans
}//end of if
else// if AUTHORITY IS specified & APPROACH IS NOT specified
{ //Then for the given authority, run for all approaches: B1,STD,IRB,AIRB
for (Iterator itr = regApprAuthMapColl.iterator(); itr.hasNext();)
{//looping through all possible values to select
RegulatoryAuthorityApproachMap raaMap = (RegulatoryAuthorityApproachMap)itr.next();
Integer fullAuthorityId = raaMap.getRegulatoryAuthorityId();
if(inputAuthority.intValue() == fullAuthorityId.intValue())// for a given authority
{
finalAuthApprMapColl.add(raaMap);//returning a list of all approaches for a given authority
}
}//end of for loop
}//end of else
}//end of if approach is null
else//if APPROACH IS specified in the notification
{
if(inputAuthority == null)// if AUTHORITY IS NOT specified && APPROACH IS specified
{//Then for the given approach, run for all authorities: FSA,EBK,BIS
for (Iterator itr = regApprAuthMapColl.iterator(); itr.hasNext();)
{//looping through all possible combos to select
RegulatoryAuthorityApproachMap raaMap = (RegulatoryAuthorityApproachMap)itr.next();
Integer fullApproachId = raaMap.getRegulatoryApproachId();
if(inputApproach.intValue() == fullApproachId.intValue())// for a given approach
{
finalAuthApprMapColl.add(raaMap);//returning a list of all authorities for a given approach
}
} //end of for loop
}//end of if
else// if AUTHORITY IS specified & APPROACH IS specified
{
for (Iterator itr = regApprAuthMapColl.iterator(); itr.hasNext();)
{//looping through all possible combos to select
RegulatoryAuthorityApproachMap raaMap = (RegulatoryAuthorityApproachMap)itr.next();
Integer fullApproachId = raaMap.getRegulatoryApproachId();
Integer fullAuthorityId = raaMap.getRegulatoryAuthorityId();
if((inputApproach.intValue() == fullApproachId.intValue()) && (inputAuthority.intValue() == fullAuthorityId.intValue()))// for a given approach
{
finalAuthApprMapColl.add(raaMap);//returning a list of all authorities for a given approach
}
} //end of for loop
}
}//end of else
}//3
}//2
}//1
if(finalAuthApprMapColl.size() == 0){throw new CEAppException("The Authority/Approach mapping is null"); }
else
return finalAuthApprMapColl;
}//end of method