We are moving soon to ColdFusion 2016 from ColdFusion 10 and have noticed that we are getting some errors in our existing code base that we find confusing.
We have several components with methods that are expected to return a specific type. In versions of ColdFusion prior to 2016, we would specify the full path to the component containing the type in order to get it to work.
For example, this does not work in ColdFusion 2016:
public root.model.beans.MyObject function CreateMyObject()
{
// blah blah...
}
Running the same code under ColdFusion 2016 produces the error "The value returned from the CreateMyObject function is not of type root.model.beans.MyObject" (it is).
This does work in ColdFusion 2016:
public MyObject function CreateMyObject()
{
// blah blah...
}
The reverse is true in ColdFusion 10 - the first example works and the second doesn't.
My question is why is this? Is there some setting that controls this behavior? I am concerned about what the upshot will be when trying to reference components with the same name, but different paths. How can I differentiate between a component named Service.cfc found in /root/model/beans/ and one found in in /root/widget/api/?
I suppose we could change all the affected return types to "any", but why should we have to?
I'm sure I'm missing something really simple and would appreciate help in determining what it is. Thanks.
Related
Request contains an invalid argument.
The query pattern '$SchemaOrg_Date:date' contains an undefined parameter (name: 'date' type: 'SchemaOrg_Date')
No idea what happened to my dialogflow.It gives me the error and no idea where to look for SchemaOrg_Date and date
Any help is appreciated.
Found it within one of 200 Intents!
The intent had a parameter #date-period
As User says, we had Yesterday which dialogflow did not select it as #date-period but #date
Do not look on your Json(s), you need to manually find it on your Intents.
I was setting an entity slot to a 'required' value, which caused it to fail, if I didn't provide a hard coded Response in Dialogflow for the required value.
This might help sombody :
In your dialogflow, if you have different langages, be careful to chose the good one in your api and for this problem, to check the intents of the other langages versions, the intents you created are not the same everywhere !
for exemple : if you created intents in the langage en-us and en-gb, you need to check the intents on both.
Took the night to find that out. and i don't agree with user2793508, you can find the entity by doing a research on your json files, that's how i knew where to look and when i didn't see it, i checked the other langages just per curiosity, that saved me, lol.
Hope i was clear, see ya
I had the same problem but it is resolved now.
There was a problem in the intent as the Training phrases was not assigned to the given
Action and parameters
there the multiple copies of the same Parameter was created.
Example : John wants a flower
name - "John"
name - " "
two parameters with same name will create the error
remove the one without any use or self created one and the error will be removed.
or assign the keyword by double clicking them to the preferred parameter in Training phrases .
(I'm using Sitecore 8.1 Update 3 with Glass Mapper.Sc version 4.1.1.66)
I've run into an issue where some of the properties of a Sitecore item are not being populated in code through Glass Mapper. The values in our Content Base item (Id, Name, Display Name, typical Sitecore fields) seem to be getting populated correctly, but the child item's fields (I'll call it Overview) aren't mapped at all. They're all strings but they all end up null, even though the Content Base's values look to be correct. We also have child class maps working in other areas of the same, so that may not be the cause here.
Earlier in this project, we had an issue with Glass Mapper where field names that included spaces were not being read. However, I've made sure to leave out any spaces in field names, but this doesn't solve the issue.
Another possible contributor to the issue is that we have multiple languages on the site, so it's conceivable that language fallback may be complicating things. However, we have fallback enabled and working properly across the site without issues.
I can post code if needed, but for the most part, it's just POCO's and mapping classes.
Any ideas on what other parts I should be looking into?
You need to use the VersionCountDisabler(), you can find more details about it in this previous question and this blog post.
The use of the disabler is not supposed to be required on Sitecore 8.1 and when using Language Fallback, but I can confirm that this is an issue and using the VersionCountDisabler() solved the issue for us.
Internally Glass will check if a version of an item exists, if not it returns null. It seems that Sitecore will return a version count for Items with Layout, but not for datasource Items.
We have wired out the disabler slightly different than using the global.asax file, instead patching into the http request pipelines:
using Glass.Mapper.Sc;
using Sitecore.Pipelines.HttpRequest;
namespace MyProject.Custom.Pipelines.HttpRequest
{
public class ItemVersionCountDisablerBegin : HttpRequestProcessor
{
public override void Process(HttpRequestArgs args)
{
Sitecore.Context.Items["Glass::VersionCountDisabler"] = new VersionCountDisabler();
}
}
public class ItemVersionCountDisablerEnd : HttpRequestProcessor
{
public override void Process(HttpRequestArgs args)
{
VersionCountDisabler disabler = Sitecore.Context.Items["Glass::VersionCountDisabler"] as VersionCountDisabler;
Sitecore.Context.Items["Glass::VersionCountDisabler"] = null;
disabler?.Dispose();
}
}
}
And then patch this into http request begin and end pipelines:
<pipelines>
<httpRequestBegin>
<processor type="MyProject.Custom.Pipelines.HttpRequest.ItemVersionCountDisablerBegin, MyProject.Custom" patch:before="*[1]"/>
</httpRequestBegin>
<httpRequestEnd>
<processor type="MyProject.Custom.Pipelines.HttpRequest.ItemVersionCountDisablerEnd, MyProject.Custom" />
</httpRequestEnd>
</pipelines>
After some experimentation, I found the cause of the issue.
In my mapping class, you'll see this line:
config.Field(f => f.HeaderPrefix).FieldName("AssetOverviewContentHeaderPrefix");
The field name seems kinda long, right? We were prepending the category name onto the field name in order to avoid any duplicate names in items since we do a fair amount of inheritance.
That's where the problem lies. When I removed the "AssetOverviewContent" from the field names, everything worked fine. Based on this, I did some more experimentation.
I found that field names up to 23 characters long worked just fine. 24 or more and they won't map. I have no idea why this number in particular is the limit, but my guess is that there's some other mapping going on somewhere that's hitting a limit.
A little more experimentation also found that mapping using FieldId also doesn't work. Guids are going to be more than 23 characters long, so that makes some sense. However, you can't really do a guid in less than 23 characters so I can't confirm.
I may end up looking at the Glass Mapper code sometime soon to see if I can track down the answer. But now that I know there's a problem, I can avoid it.
I have been trying to use isSafeHTML() to tell users whether the HTML they have submitted is allowed or not. The documentation at both CFDocs.org and Adobe.com show the function requires three parameters: inputString, policyFile, throwOnError. However, when I supply all three parameters, I get an error saying it only accepts 1 or 2 parameters.
After some testing, I have come to the conclusion that throwOnError is not a valid parameter for this function. Can anyone else confirm this? If so, is there any way to update the documentation so others do not run into the same issue?
You are correct, I just tested it on ColdFusion 2016 update 2 (2016,0,02,299200) and it threw:
Parameter validation error for the ISSAFEHTML function.
The function accepts 1 to 2 parameters.
Using this code:
<cfoutput>
#isSafeHTML("html", server.coldfusion.rootdir & "/lib/antisamy-basic.xml", true)#
</cfoutput>
I have updated the cfdocs.org site to remove the throwOnError argument. For future reference you can fix docs on cfdocs.org by clicking on the Edit button, or if you just want to point out an issue you can click on the Issue button.
For Adobe docs, you can file a bug report here: https://bugbase.adobe.com/
I am trying to create global functions in Lucee. I have followed the directions here and have it "Kind of" working. Inside of Application.cfc I placed the following code:
public void function onRequest() {
URL.IsInternalUser = function() { return (SESSION.user.ID ?: 0); };
}
This seems to work fine in some cases but if we need to access this function in a subdirectory that contains an Application.cfc that does not have the function re-defined it will error out saying the function doesn't exist.
The ultimate goal I am trying to achive is to have a cfc file that contains several user defined functions and then have them accessible throughout the entire application without redefining things over and over again.
Is there a better way to accomplish what we want? I ask this because on the page I referenced earlier in the comments section there is a quote:
I concur. Wouldn't surprise me to see it somewhere else in the future.
What I like about Railo's method is that it is completely sandboxed.
Host A's tags & functions libraries never cross/conflict with Host B's
libraries unless they're put into the global server folders. It's the
same way for the virtual file system too and pretty much everything
else (datasources, etc).
It specifically mentions Railo having a way to create UDF but I can not find any documentaion on this anywhere. Since we are using Lucee which is a fork of Railo I figure it must have what Railo has for creating UDF. Hoping someone that reads this can help me out and point me in the right direction.
Railo/Lucee support custom functions. You can declare them in /WEB-INF/{railo|lucee}/library/function/ of the site. Save the function in a .cfm file and name the file the same as the function. The server needs a restart after creating new functions. Here is Railo's blog post about it.
Adobe ColdFusion doesn't support this AFAIK. So you have to store your functions in the SERVER scope here.
I have adopted the CFScript syntax for most of the work with ColdFusion now, since with the new version of ColdFusion v11(codenamed Splender), almost all the short-comings of the script style syntax has been given serious thoughts. Thought suprisingly, I came across a requirement where I needed to iterate throught the list with variable delimiter. So I choose the list.each function in CF11 and not any other option would do since I also need the current index value along the way as well.
list.each(function(element,index,list){
writeOutput("#index#:#element#;");
}, ";")
The problem is that this function surprisingly does not seem to support a custom delimiter.
To save the time, I would like to mention that I already tried the for (element in...) with a count variable for my needs.
var idx=1;
for (element in "a,b,c,d,e"){
writeOutput(element);
LOCAL.idx++;
}
But I would appreciate some help with the original list.each function in CF11, is it even possible somehow to implement? or is it what I think a shortcoming.
I'm not using CF11, but i would point you to this bug report, which seems to say the HF3 does exactly what you want.
If that doesn't work, or in the meantime, you could convert it to an array and use ArrayEach().