tracker issue : CF-4010910

select a category, or use search below
(searches all categories and all time range)
Title:

expandPath() fails in Server.cfc onServerStart

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Brian Ghidinelli / Brian Ghidinelli (Brian Ghidinelli)

Created: 06/22/2015

Components: General Server

Versions: 10.0

Failure Type:

Found In Build/Fixed In Build: Final /

Priority/Frequency: Normal / All users will encounter

Locale/System: English / Windows 7

Vote Count: 1

Listed in the version 2016.0.0.297996 Issues Fixed doc
Verification notes: verified_fixed on February 18, 2019 using build 2016.0.01.298513
Problem Description:
Using expandPath() in OnServerStart throws an error.

Steps to Reproduce:
<cfcomponent output="false" persistent="false">
<cffunction name="OnServerStart" output="false" access="public" returntype="any">
<cflog file="application" text="#expandPath('.')#" />      
</cffunction>
</cfcomponent>


Actual Result:

Throws an error.  This is the dump: 

Message: String index out of range: -1
StackTrace: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(String.java:1955)
        at coldfusion.util.Utils.expandPath(Utils.java:456)
        at coldfusion.runtime.CFPage.ExpandPath(CFPage.java:3629)
        at cfServer2ecfc1204757337$funcCREATEEVENTGATEWAYS.runFunction(c:\users\brian\documents\web\motorsportreg\Server.cfc:65)
        at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
        at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
        at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
        at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
        at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
        at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
        at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
        at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2655)
        at cfServer2ecfc1204757337$funcONSERVERSTART.runFunction(c:\users\brian\documents\web\motorsportreg\Server.cfc:20)
        at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
        at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
        at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
        at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
        at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
        at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
        at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
        at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655)
        at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:601)
        at coldfusion.filter.ServerCFCFilter$OnSSLaunchThread.run(ServerCFCFilter.java:175)
Suppressed:
        [array]
TagContext:
        [array]
        1) [struct]
                COLUMN: 0
                ID: CF_CFPAGE
                LINE: 65
                RAW_TRACE: at cfServer2ecfc1204757337$funcCREATEEVENTGATEWAYS.runFunction(c:\users\brian\documents\web\motorsportreg\Server.cfc:65)
                TEMPLATE: c:\users\brian\documents\web\motorsportreg\Server.cfc
                TYPE: CFML
        2) [struct]
                COLUMN: 0
                ID: CF_UDFMETHOD
                LINE: 20
                RAW_TRACE: at cfServer2ecfc1204757337$funcONSERVERSTART.runFunction(c:\users\brian\documents\web\motorsportreg\Server.cfc:20)
                TEMPLATE: c:\users\brian\documents\web\motorsportreg\Server.cfc
                TYPE: CFML
Type: java.lang.StringIndexOutOfBoundsException


Expected Result:

A path name that I can work with.


Any Workarounds:

I understand that it doesn't make sense for expandPath() to be able to access mappings since applications don't exist yet, but surely we should be able to generate relatives paths to the server.cfc file? 

The only possible workaround is to use getDirectoryFromPath(getCurrentTemplatePath()) and append relative paths but this is clunky.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4010910

External Customer Info:
External Company:  
External Customer Name: Brian
External Customer Email:  
External Test Config: My Hardware and Environment details:



CF10 enterprise on Windows 7.  I suspect it happens elsewhere.

Attachments:

Comments:

[just "subscribing"] Vote must be between 25 and 4000 characters
Vote by External U.
7021 | June 22, 2015 04:31:13 PM GMT
Hi Adobe, Unable to repro issue on Windows 10, as CF11 Update 7 (11.0.07.296330) and CF2016 Update 1 (2016.0.01.298513) behave correctly (expanded path is written to application.log of both). Thanks!, -Aaron
Comment by Aaron N.
30298 | February 18, 2019 01:03:57 AM GMT