protected void tagLoadingComplete() throws cfmBadFileException { cfTag tagList[] = getTagList(); for (int i = 0; i < tagList.length; i++) { cfTag tag = tagList[i]; if (caseMap != null && tag instanceof cfCASE) { String[] values = ((cfCASE) tag).getValues(); for (int j = 0; j < values.length; j++) { if (caseMap.containsKey(values[j])) { caseMap = null; cfCatchData catchData = new cfCatchData(); catchData.setType(cfCatchData.TYPE_TEMPLATE); catchData.setTagname(tag.getTagName()); catchData.setLine(tag.posLine); catchData.setColumn(tag.posColumn); catchData.setMessage("CFSWITCH has duplicate CFCASE values"); catchData.setDetail("Duplicate CFCASE value: \"" + values[j] + "\""); throw new cfmBadFileException(catchData); } caseMap.put(values[j], tag); } } else { if (tag instanceof cfDEFAULTCASE) { defaultCase = (cfDEFAULTCASE) tag; } } } }
private cfTagReturnType renderOptimzedSwitch(String expr, cfSession _Session) throws cfmRunTimeException { cfCASE thisCase = (cfCASE) caseMap.get(expr); cfTagReturnType rt = null; if (thisCase != null) { _Session.pushTag(thisCase); rt = thisCase.render(_Session); } else if (defaultCase != null) { _Session.pushTag(defaultCase); rt = defaultCase.render(_Session); } else { // we didn't do anything, so don't invoke _Session.popTag() or return rt return cfTagReturnType.NORMAL; } _Session.popTag(); return rt; }