Solved

Coldfusion 8 CFSWITCH error

Posted on 2009-05-06
11
649 Views
Last Modified: 2013-12-24
Please see the test case...for some reason the string 2f generates an error here for CF8 that it did not generate in CF7 (see below)...we have this type of setup all through out our application so of course our move to CF8 broke it in many places...Any thought as to why this error comes up? Any help is appreciated..Thanks in advance

ERROR:
Context validation error for the cfcase tag.  
The cfswitch tag has a duplicate cfcase tag for value {ts '1900-01-01 00:00:00'}.  
 
ColdFusion cannot determine the line of the template that caused this error. This is often caused by an error in the exception handling subsystem.  

<cfset x = "2f">
 
<cfswitch expression="#x#">
 
	<cfcase value="2a">2a</cfcase>
	<cfcase value="2b">2b</cfcase>
	<cfcase value="2c">2c</cfcase>
	<cfcase value="2d">2d</cfcase>         
	<cfcase value="2e">2e</cfcase>         
	<cfcase value="2f">2f</cfcase>                
 
</cfswitch>

Open in new window

0
Comment
Question by:tboykin
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 16

Expert Comment

by:duncancumming
ID: 24318410
It must be mis-recognising the hex value as a date!  Maybe try using the ToString() function to prevent that.

 
<cfswitch expression="#ToString(x)#">

0
 
LVL 52

Expert Comment

by:_agx_
ID: 24318426
The code above does not seem related to the error described:   Can you post the correct code?

ERROR:
Context validation error for the cfcase tag.  
The cfswitch tag has a duplicate cfcase tag for value {ts '1900-01-01 00:00:00'}.  
0
 
LVL 16

Expert Comment

by:duncancumming
ID: 24318474
Also you may want to try putting a cfdefaultcase in there too.  That shouldn't fix your problem, but is probably a good idea anyway (some languages force you to specify the default in a switch; CFML doesn't)
0
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 
LVL 52

Expert Comment

by:_agx_
ID: 24318506
> It must be mis-recognising the hex value as a date!

Possibly.  For what is worth, the example code works fine for me with CF8.
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 24319006
agree with agx

"The cfswitch tag has a duplicate cfcase tag for value {ts '1900-01-01 00:00:00'}.  "

doesn't relate to the code posted...the error must be somewhere else

that error message means

<cfswitch expression="#x#">
 
        <cfcase value="AVALUE">2a</cfcase>
        <cfcase value="AVALUE">2b</cfcase>
      <cfcase value="ADIFFERENTVALUE">2b</cfcase>
</cfswitch>

somewhere in your code you've got 2 cfcases with the same  value=""


0
 

Author Comment

by:tboykin
ID: 24319117
Thanks for taking a look at this everyone....

My CF file has EXACTLY what you see in the code snippet....I agree it doesn't make sense, but that is the error it generates....however, if I remove "<cfcase value="2f">2f</cfcase>" from the code it doesn't throw the error...its as if its looking at the value "2F" and trying to convert it to a date OR when it deciphers value="2F" it is coming back with the same value as one of the other options???

Here is something else I found on the web:
here is the reason: ColdFusion 8: Changed the way ColdFusion parses cfcase values. Previously, cfcase tags with numeric value dates did not return expected results. For example, <cfcase value="00"> and <cfcase value="0A> were both evaluated to 0. The value "0A" was treated as a date and converted to 0 number of days from 12/30/1899. The value "00" was also evaluated to the value 0. This caused the exception "Context validation error for tag CFCASE. The CFSWITCH has a duplicate CFCASE for value "0.0"." The cfswitch tag now returns the expected result.
0
 

Author Comment

by:tboykin
ID: 24319193
An example of the exact error message is here:

http://dev.projects.uxgroup.com/cfcase.cfm

The snippet attached is exactly whats at the URL above


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
 
<body>
 
<cfset x = "2f">
 
<cfswitch expression="#ToString(x)#">
 
	<cfcase value="2a">2a</cfcase>
	<cfcase value="2b">2b</cfcase>
	<cfcase value="2c">2c</cfcase>
	<cfcase value="2d">2d</cfcase>         
	<cfcase value="2e">2e</cfcase>         
	<cfcase value="2f">2f</cfcase>                
 
</cfswitch>
 
 
</body>
</html>

Open in new window

0
 
LVL 36

Accepted Solution

by:
SidFishes earned 125 total points
ID: 24319201
that a hot fix technote?

I'm fully patched & agx must be since it works for him as well...

patch up and you should be fine

(duncan...are we behind on our patch schedule??? tsk tsk ;)

0
 
LVL 36

Expert Comment

by:SidFishes
ID: 24319457
hmmm... that's very weird... doesn't appear that it -is- a cf8 early release issue (bug)

my reading of http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_c_03.html is that -by default- this shouldn't be a problem -at all- in cf8

so my first question is are you sure you're parsing against cf8 ? what does this return #server.coldfusion.productversion#

(and second...how did this work in cf7 (maybe that was a hotfix item???)
0
 

Author Comment

by:tboykin
ID: 24319728
#server.coldfusion.productversion#
rendered the following:
8,0,0,176276 2d

I am going through the 8.0.1 updater later tonight and will see if that helps at all as suggested
0
 

Author Closing Comment

by:tboykin
ID: 31578659
I ran the 8.0.1 updater...Once patched the issue was resolved and the code rendered correctly without an error...You guys are all great and I appreciate your help and quick response!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question