Copy link to clipboard
Copied
I just replaced my Intel Core 2 Duo Macbook Pro with the new i7. My site worked fine under the Core 2 Duo.
The installs are identicle: CF8, Apache2, Java 1.6.0_20
The problem is when I load my site I get an error:
String index out of range: 26824
in a custom fuction which has never occured on any system (dev or production sites on both windows and mac) before.
Here are the details:
This is the custom fuction:
<!--- Generates new stylesheet for a specific _BrandID NOTE: This function is only used by GenerateStylesheets function --->
<cffunction name="ReturnOneStylesheet" access="public" output="false" returntype="string">
<cfargument name="_FileData" type="string" required="true">
<cfargument name="_BrandID" type="string" required="true">
<cfargument name="_UsePreview" type="boolean" required="false" default="false">
<cfset var baseStylesheets = application.functions.GetAllBaseStylesheets()>
<cfset var stylesheet = GetStylesheets(_BrandID=arguments._BrandID,_UsePreview=arguments._UsePreview)>
<!--- Replace some of the [[variable]] labels with data from any existing stylesheet fields in DATABASE --->
<cfloop collection="#stylesheet[1]#" item="key">
<!--- Only replace [[variable]] if data from stylesheet table is not blank (blanks will be replaced by the base stylesheet values later) --->
<cfif stylesheet[1][key] NEQ "">
<cfset arguments._FileData = ReplaceNoCase(arguments._FileData,"[[#key#]]",stylesheet[1][key])>
</cfif>
</cfloop>
... some other code ...
<cfreturn arguments._FileData>
</cffunction>
Basically it takes a string _FileData as an argument which is the text of a stylesheet template. The value 'stylesheet' from the GetStylesheets() is an array of structs. The structs are key/value pairs of stylesheet values (ie [leftBorderColor][blue]). The loop loops over the struct and if the value of a key is not blank, replaces the string in the template with the proper value (ie in the generic template there would be a value like 'color: [[leftBorderColor]]' and the replace would replace the bracketed placeholder with 'blue'). The loop loops through all the keys, replaces the values and then returns the string which is then written to disk by other functions.
It always errors on the 'ReplaceNoCase(arguments._FileData,"[[#key#]]",stylesheet[1][key])>' with 'String index out of range: 26824'
I've tried scoping all these variables, setting them locally, changing the names. Nothing works. I've done similar string replaces on strings much
larger with CF. This code has been the backbone running flawlessly on dozens of production servers for years with the same CF and Java specs.
Any ideas on why it doesn't work now? It is the code, server, or the hardware? I've been pulling my hair out over this for days. It makes this machine useless. Any help would be awesome.
Thanks,
Anthony
java.lang.StringIndexOutOfBoundsException: String index out of range: 27040 at java.lang.String.substring(String.java:1934) at coldfusion.runtime.StringFunc.Replace(StringFunc.java:386) at coldfusion.runtime.CFPage.ReplaceNoCase(CFPage.java:2527) at cfStyleLoader2ecfc1657193658$funcRETURNONESTYLESHEET.runFunction(/Users/tony/Sites/timeclock_currentrelease/lib/functions/StyleLoader.cfc:47) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:418) at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:360) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:324) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:59) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:277) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:463) at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2436) at cfStyleLoader2ecfc1657193658$funcGENERATESTYLESHEETS.runFunction(/Users/tony/Sites/timeclock_currentrelease/lib/functions/StyleLoader.cfc:29) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:418) at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:360) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:324) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:59) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:277) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:192) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:448) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:308) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2272) at cfApplication2ecfc446914708$funcONAPPLICATIONSTART.runFunction(/Users/tony/Sites/timeclock_currentrelease/TimeclockOnline/Application.cfc:69) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:418) at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:360) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:324) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:59) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:277) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:192) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:448) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:308) at coldfusion.runtime.AppEventInvoker.invoke(AppEventInvoker.java:74) at coldfusion.runtime.AppEventInvoker.onApplicationStart(AppEventInvoker.java:174) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:196) at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at coldfusion.filter.PathFilter.invoke(PathFilter.java:86) at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27) at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70) at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38) at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.CfmServlet.service(CfmServlet.java:175) at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89) at jrun.servlet.FilterChain.doFilter(FilterChain.java:86) at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42) at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46) at jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at jrun.servlet.FilterChain.service(FilterChain.java:101) at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106) at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286) at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543) at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203) at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320) at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428) at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266) at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
Copy link to clipboard
Copied
Turns out is was a lemon machine. Bad logic board was causing all kinds of weird performance and calculation issues.
Exchanging it for a new machine solved the problem as well as a bunch of other ones.