0

次のコードは Adob​​e ColdFusion で機能しましたが、Railo に移行すると次のエラーが発生します。

エラー メッセージ: 配列のインデックス [0] が無効です。インデックスは正の整数 (1、2、3、...) でなければなりません

エラーは行頭にあります: local.arrChartDataResult=addPercentageData(local.arrChartDataResult)

これが事実である理由は何ですか?

   <cffunction name="getAverageChartData" hint="I return the data required to render an average chart." returntype="array" output="false">
        <cfargument name="surveyList" hint="I am a record set of Surveys." required="true" type="query" />
        <cfargument name="filter" hint="I am the optional filter which is to be applied to all results." required="false" default="" type="string" />

        <cfset var local=structNew() />

        <cfset var rstChartData="" />
        <cfset var rstChartDataTotal="" />
        <cfset var rstCombinedChartData=queryNew("itemColumn,valueColumn,label","varchar,integer,varchar") />

        <cfset local.objQuestion=objQuestionService.get(arguments.surveyList.question_ID[1]) />
        <cfset local.intQuestionTypeID = local.objQuestion.getTypeID() />

        <cfset local.strSubQuestionList=local.objQuestion.getAnswer() />
        <cfset local.strPossibleAnswerList=local.objQuestion.getPossibleAnswer() />

        <cfset local.arrChartDataResult=arrayNew(1) />

<!--- loop over each school's survey --->
        <cfloop query="arguments.surveyList">
            <cfset local.arrChartData = getChartData(arguments.surveyList.survey_id, arguments.surveyList.question_id, arguments.filter) />

<!--- loop over each sub question and append (union) it to a running total --->
            <cfloop array="#local.arrChartData#" index="rstChartData">
                <cfquery name="rstCombinedChartData" dbtype="query">
                    SELECT
                         itemColumn
                        ,valueColumn
                        ,label
                    FROM
                        rstCombinedChartData

                    UNION ALL

                    SELECT
                         itemColumn
                        ,CAST(valueColumn AS INTEGER) AS valueColumn
                        ,label
                    FROM
                        rstChartData
                </cfquery>
            </cfloop>
        </cfloop>

        <cfif local.intQuestionTypeID EQ 17>
            <cfquery name="rstChartDataTotal" dbtype="query">
                SELECT
                     itemColumn
                    ,AVG(valueColumn) AS valueColumn
                    ,label
                FROM
                    rstCombinedChartData
                GROUP BY
                     label
                    ,itemColumn
                ORDER BY
                     label DESC
                    <!---,itemColumn DESC--->
            </cfquery>
        <cfelse>
<!--- get the totals for each itemColumn --->
            <cfquery name="rstChartDataTotal" dbtype="query">
                SELECT
                     itemColumn
                    ,SUM(valueColumn) AS valueColumn
                    ,label
                FROM
                    rstCombinedChartData
                GROUP BY
                     label
                    ,itemColumn
                ORDER BY
                     label DESC
                    ,itemColumn DESC
            </cfquery>
        </cfif>

<!--- add sort order column to query and populate it with the order in which the sub questions are asked --->
        <cfset rstChartDataTotal=orderByQuestion(rstChartDataTotal, local.strSubQuestionList) />

<!--- if this is a one-dimensional question --->
        <cfif arrayLen(local.arrChartData) EQ 1>
            <cfset local.arrChartDataResult[1]=addPercentageData_Old(rstChartDataTotal) />
        <cfelse>
            <cfset arrayResize(local.arrChartDataResult, listLen(local.strPossibleAnswerList)) />

            <cfoutput query="rstChartDataTotal" group="label">
                <cfset local.intPositionInArray=listFindNoCase(local.strPossibleAnswerList, rstChartDataTotal.label, True) />

                <cfoutput>
                    <cfquery name="local.rstChartData" dbtype="query">
                        SELECT
                             itemColumn
                            ,valueColumn
                            ,label
                            ,sortOrder
                        FROM
                            rstChartDataTotal
                        WHERE
                            label = '#rstChartDataTotal.label#'
                        ORDER BY
                            sortOrder
                    </cfquery>
                </cfoutput>


                <cfset local.arrChartDataResult[local.intPositionInArray]=local.rstChartData>
            </cfoutput>

            <cfset local.arrChartDataResult=addPercentageData(local.arrChartDataResult) />
        </cfif>

        <cfreturn local.arrChartDataResult />
    </cffunction>

完全なエラー:

Application Execution Exception
Error Type: expression : 0
Error Messages: Invalid index [0] for array. Index must be a positive integer (1, 2, 3, ...)


Template:   /srv/www/testapp/admin/model/response/ResponseService.cfc



Current Event:  pdf.createPDF
Current Layout:     N/A
Current View:   N/A
Bug Date:   07/29/2013 10:53:19 AM
Coldfusion ID:  CFID=c07b7b4e-d79e-4688-950d-20f0192a27ca ; CFToken=0 ; JSessionID=4A3B1BC689B4C438DAAF1088A42A6481_c07b7b4e-d79e-4688-950d-20f0192a27ca_0
Template Path :     /srv/www/testapp/admin/index.cfm
Path Info :     /pdf/createPDF
Host & Server:  management.testapp.co.uk:8888 ip-172-31-24-53
Query String:   
Referrer:   http://management.testapp.co.uk:8888/index.cfm/home?fwreinit=1
Browser:    Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:22.0) Gecko/20100101 Firefox/22.0



Invalid index [0] for array. Index must be a positive integer (1, 2, 3, ...)
    at railo.runtime.type.ArrayImpl.setE(ArrayImpl.java:226):226
    at railo.runtime.type.ArrayImpl.set(ArrayImpl.java:205):205
    at railo.runtime.type.util.ArraySupport.set(ArraySupport.java:360):360
    at railo.runtime.util.VariableUtilImpl.set(VariableUtilImpl.java:437):437
    at railo.runtime.PageContextImpl.set(PageContextImpl.java:1266):1266
    at model.response.responseservice_cfc$cf._1(/srv/www/testapp/admin/model/response/ResponseService.cfc:268):268
    at model.response.responseservice_cfc$cf.udfCall(/srv/www/testapp/admin/model/response/ResponseService.cfc):-1
    at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
    at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
    at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284
    at railo.runtime.ComponentImpl._call(ComponentImpl.java:607):607
    at railo.runtime.ComponentImpl._call(ComponentImpl.java:490):490
    at railo.runtime.ComponentImpl.call(ComponentImpl.java:1781):1781
    at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723
    at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506
    at handlers.pdf_cfc$cf.udfCall(/srv/www/testapp/admin/handlers/pdf.cfc:289):289
    at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
    at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
    at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:275):275
    at railo.runtime.ComponentImpl._call(ComponentImpl.java:608):608
    at railo.runtime.ComponentImpl._call(ComponentImpl.java:490):490
    at railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1796):1796
    at railo.runtime.tag.Invoke.doComponent(Invoke.java:209):209
    at railo.runtime.tag.Invoke.doEndTag(Invoke.java:182):182
    at system.web.controller_cfc$cf._6(/srv/www/testapp/admin/framework/coldbox_standalone_3.0.0.RC1/system/web/Controller.cfc:662):662
    at system.web.controller_cfc$cf.udfCall(/srv/www/testapp/admin/framework/coldbox_standalone_3.0.0.RC1/system/web/Controller.cfc):-1
    at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
    at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
    at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284
    at railo.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:775):775
    at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723
    at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506
    at system.web.controller_cfc$cf._5(/srv/www/testapp/admin/framework/coldbox_standalone_3.0.0.RC1/system/web/Controller.cfc:553):553
    at system.web.controller_cfc$cf.udfCall(/srv/www/testapp/admin/framework/coldbox_standalone_3.0.0.RC1/system/web/Controller.cfc):-1
    at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
    at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
    at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:275):275
    at railo.runtime.ComponentImpl._call(ComponentImpl.java:608):608
    at railo.runtime.ComponentImpl._call(ComponentImpl.java:490):490
    at railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1800):1800
    at railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:749):749
    at railo.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1521):1521
    at system.coldbox_cfc$cf._1(/srv/www/testapp/admin/framework/coldbox_standalone_3.0.0.RC1/system/Coldbox.cfc:226):226
    at system.coldbox_cfc$cf.udfCall(/srv/www/testapp/admin/framework/coldbox_standalone_3.0.0.RC1/system/Coldbox.cfc):-1
    at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
    at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
    at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284
    at railo.runtime.ComponentImpl._call(ComponentImpl.java:607):607
    at railo.runtime.ComponentImpl._call(ComponentImpl.java:490):490
    at railo.runtime.ComponentImpl.call(ComponentImpl.java:1781):1781
    at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723
    at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506
    at application_cfc$cf.udfCall(/srv/www/rudifferent/admin/Application.cfc:54):54
    at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
    at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
    at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284
    at railo.runtime.ComponentImpl._call(ComponentImpl.java:607):607
    at railo.runtime.ComponentImpl._call(ComponentImpl.java:490):490
    at railo.runtime.ComponentImpl.call(ComponentImpl.java:1781):1781
    at railo.runtime.listener.ModernAppListener.call(ModernAppListener.java:346):346
    at railo.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:107):107
    at railo.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:18):18
    at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2255):2255
    at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2222):2222
    at railo.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:315):315
    at railo.loader.servlet.CFMLServlet.service(CFMLServlet.java:29):29
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728):728
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305):305
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210):210
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222):222
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123):123
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472):472
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171):171
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99):99
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118):118
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407):407
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004):1004
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589):589
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312):312
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source):-1
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source):-1
    at java.lang.Thread.run(Unknown Source):-1
4

1 に答える 1