Yep, try/catch was how I was getting the error message I showed, it just
was out in the main logic and not in the subroutine.

Thanks for finding the issue, that's exactly what I meant by obvious!

--
Howard Fore, howard.f...@hofo.com
“What people say, what people do, and what they say they do are entirely
different things.” - Margaret Mead



On Wed, Jun 27, 2012 at 12:14 AM, Troy Jones <t...@dynapp.com> wrote:

>  Howard,****
>
> ** **
>
> One thing I might suggest is to try/catch the logic and dump the cfcatch
> scope into an email. This will probably yield you a more robust error
> report than what you see here.****
>
> ** **
>
> I took your function and modified it just a bit to see if I could find
> something out. It looks like that, when you set the date as “31oct2012”,
>  the reason its yielding an error is because of your list being out of
> chronological order. Oct and Nov are switched. I fixed them up; the
> function returns the expected data. ****
>
> ** **
>
> ** **
>
> *From:* ad...@acfug.org [mailto:ad...@acfug.org] *On Behalf Of *Howard
> Fore
> *Sent:* Tuesday, June 26, 2012 9:25 PM
> *To:* ACFUG Discussion
> *Subject:* [ACFUG Discuss] Re: Odd CreateDate error****
>
> ** **
>
> Actually that date string works ok. But "31Oct2011" does not. "30Oct2011"
> is ok, Halloween isn't. Grr.****
>
>
> --
> Howard Fore, howard.f...@hofo.com****
>
> “What people say, what people do, and what they say they do are entirely
> different things.” - Margaret Mead****
>
>
>
> ****
>
> On Tue, Jun 26, 2012 at 9:04 PM, Howard Fore <howard.f...@hofo.com> wrote:
> ****
>
> I'm sure there's some blindingly obvious thing I'm doing wrong here, but I
> can't see it. Any ideas would be extremely helpful.****
>
> ** **
>
>  <cffunction name="dateConverter">****
>
> <cfargument name="strDate" required="yes">****
>
> <cfargument name="strFormat" required = "yes">****
>
> <cfset var rtnDate = createDate(1900,1,1)>****
>
> ** **
>
> <cfif arguments.strFormat is "ddmmmyyyy">****
>
> <!--- example: 31jan2012 --->****
>
> <cfset var dateParts =
> RefindNoCase('([0-9]{1,2})([a-z]{3,3})([0-9]{4,4})',arguments.strDate,1,true)>
> ****
>
> <cfif dateparts.pos[2] neq 0>****
>
> <cfset var theDate = {}>****
>
> ** **
>
> <cfset theDate.days =
> mid(arguments.strDate,dateParts.pos[2],dateParts.len[2])>****
>
> ** **
>
> <cfset theDate.month =
> mid(arguments.strDate,dateParts.pos[3],dateParts.len[3])>****
>
> <cfset var theMonthsList =
> 'jan,feb,mar,apr,may,jun,jul,aug,sep,nov,oct,dec'>****
>
> <cfset theDate.monthNumber = ListFind(theMonthsList,theDate.month)>****
>
> ** **
>
> <cfset theDate.year =
> mid(arguments.strDate,dateParts.pos[4],dateParts.len[4])>****
>
> ** **
>
> <cfset rtnDate = createDate(theDate.year, theDate.monthNumber,
> theDate.days)>****
>
> </cfif>****
>
> ** **
>
> </cfif>****
>
> <cfreturn rtnDate>****
>
> </cffunction>****
>
> ** **
>
> ** **
>
> <cfset theDate = "12oct2012">****
>
> <cfoutput>#dateConverter(theDate,'ddmmmyyyy')#</cfoutput>****
>
>  ** **
>
> gives me (in CF 9.0.1) an extremely unhelpful error (line 37 in the stack
> trace below is the cfset rtnDate line towards the end of the above function:
> ****
>
> ** **
>
> *struct*
>
> Message****
>
> MONTH****
>
> StackTrace****
>
> java.lang.IllegalArgumentException: MONTH at
> java.util.GregorianCalendar.computeTime(GregorianCalendar.java:2482) at
> java.util.Calendar.updateTime(Calendar.java:2469) at
> java.util.Calendar.getTimeInMillis(Calendar.java:1088) at
> java.util.Calendar.getTime(Calendar.java:1061) at
> coldfusion.util.DateUtils.createDate(DateUtils.java:959) at
> coldfusion.runtime.CFPage.CreateDate(CFPage.java:1009) at
> cfindex2ecfm2067856441$funcDATECONVERTER.runFunction(D:\frba\pages\research\inflationproject\dashboard\index.cfm:37)
> at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) 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:2582) at
> cfindex2ecfm2067856441._factor2(D:\frba\pages\research\inflationproject\dashboard\index.cfm:1251)
> at
> cfindex2ecfm2067856441._factor11(D:\frba\pages\research\inflationproject\dashboard\index.cfm:1242)
> at
> cfindex2ecfm2067856441._factor12(D:\frba\pages\research\inflationproject\dashboard\index.cfm:1156)
> at
> cfindex2ecfm2067856441._factor13(D:\frba\pages\research\inflationproject\dashboard\index.cfm:1154)
> at
> cfindex2ecfm2067856441._factor14(D:\frba\pages\research\inflationproject\dashboard\index.cfm:1146)
> at
> cfindex2ecfm2067856441._factor24(D:\frba\pages\research\inflationproject\dashboard\index.cfm:1137)
> at
> cfindex2ecfm2067856441._factor32(D:\frba\pages\research\inflationproject\dashboard\index.cfm:13)
> at
> cfindex2ecfm2067856441.runPage(D:\frba\pages\research\inflationproject\dashboard\index.cfm:12)
> at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:231) at
> coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:416) at
> coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65) at
> coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:360) at
> coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
> at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at
> coldfusion.filter.PathFilter.invoke(PathFilter.java:94) at
> coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70) at
> coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:79) 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.filter.CachingFilter.invoke(CachingFilter.java:62) at
> coldfusion.CfmServlet.service(CfmServlet.java:200) 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$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
> at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)****
>
>
> --
> Howard Fore, howard.f...@hofo.com****
>
> “What people say, what people do, and what they say they do are entirely
> different things.” - Margaret Mead****
>
> ** **
>
> ** **
>  ------------------------------
>
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2012.0.2178 / Virus Database: 2437/5095 - Release Date: 06/26/12*
> ***
>

Reply via email to