Changeset 164

Show
Ignore:
Timestamp:
05/28/06 15:58:43 (3 years ago)
Author:
scorfield
Message:

Addresses #41 by validating plugin declarations in fusebox.xml more thoroughly.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • fusebox5/fuseboxApplication.cfc

    r163 r164  
    783783                 
    784784                <cfloop from="1" to="#n#" index="i"> 
     785                        <cfif not structKeyExists(children[i].xmlAttributes,"name")> 
     786                                <cfthrow type="fusebox.badGrammar.requiredAttributeMissing" 
     787                                                message="Required attribute is missing" 
     788                                                detail="The attribute 'name' is required, for a 'plugin' declaration in fusebox.xml." /> 
     789                        </cfif> 
    785790                        <cfset phase = children[i].xmlAttributes.name /> 
     791                        <cfif this.strictMode and structCount(children[i].xmlAttributes) neq 1> 
     792                                <cfthrow type="fusebox.badGrammar.unexpectedAttributes" 
     793                                                message="Unexpected attributes" 
     794                                                detail="Unexpected attributes were found in the '#phase#' plugin declaration in fusebox.xml." /> 
     795                        </cfif> 
    786796                        <cfset nn = arrayLen(children[i].xmlChildren) /> 
    787797                        <cfloop from="1" to="#nn#" index="j"> 
     
    808818                 
    809819                <cfloop from="1" to="#n#" index="i"> 
     820                        <cfif not structKeyExists(children[i].xmlAttributes,"name")> 
     821                                <cfthrow type="fusebox.badGrammar.requiredAttributeMissing" 
     822                                                message="Required attribute is missing" 
     823                                                detail="The attribute 'name' is required, for a 'parameter' declaration in fusebox.xml." /> 
     824                        </cfif> 
    810825                        <cfset p = children[i].xmlAttributes.name /> 
     826                        <cfif not structKeyExists(children[i].xmlAttributes,"value")> 
     827                                <cfthrow type="fusebox.badGrammar.requiredAttributeMissing" 
     828                                                message="Required attribute is missing" 
     829                                                detail="The attribute 'value' is required, for the '#p#' parameter declaration in fusebox.xml." /> 
     830                        </cfif> 
     831                        <cfif this.strictMode and structCount(children[i].xmlAttributes) neq 2> 
     832                                <cfthrow type="fusebox.badGrammar.unexpectedAttributes" 
     833                                                message="Unexpected attributes" 
     834                                                detail="Unexpected attributes were found in the '#p#' parameter declaration in fusebox.xml." /> 
     835                        </cfif> 
    811836                        <cfif structKeyExists(this,p) and isCustomFunction(this[p])> 
    812837                                <cfthrow type="fusebox.badGrammar.reservedName"