Odd ColdFusion Behavior--Abort Not Honored - coldfusion

Using ColdFusion 9.01, occasionally, we have observed an issue where an error may be occurring within a CFC function and when we attempt to add writeDump(foo); and abort; calls to debug the error ColdFusion does not honor those calls.
Example:
private void function index(Event)
{
var rc = Event.getCollection();
var prc = Event.getCollection(private=true);
/** NOT HONORED! **/
writeDump(var=rc);
abort;
prc.JSON = {};
prc.JSON.show = variables.APIProxy.call(
handler = 'shows'
,action = 'read'
,event = arguments.Event
/** THE ERROR IS OCCURING HERE **/
,params = { language=lcase(rc.language.getLanguage_Medium()), show=rc.show_name }
);
prc.JSON.showEpisodes = variables.APIProxy.call(
handler = 'episodes'
,action = 'index'
,event = arguments.Event
,params = { language=lcase(rc.language.getLanguage_Medium()), show=rc.show_name, detail=true }
);
prc.JSON.products = variables.APIProxy.call(
handler = 'products'
,action = 'index'
,event = arguments.Event
,params = { language=lcase(rc.language.getLanguage_Medium()), detail=true }
);
Event.addAssets(
'model/product.js
,model/show.js
,collection/product_mobile.js
,collection/show_mobile.js
,view/product_mobile.js
,view/productList.js
,view/show_mobile.js
,view/showList.js
,model/episode.js
,view/episode_mobile.js
,view/episodeList.js
,collection/episode_mobile.js
,collection/product_mobile.js
,mobile/episodeObject.css
,mobile/show.js
,mobile/show.css
,mobile/category.css
');
Event.setLayout('layout.mobile');
Event.setView("show/index_mobile");
return;
}
I believe we have successfully eliminated caching. I am curious if anyone else has encountered this.
Thank you.
Aaron

I'm guessing that the error is a parse error, not a true runtime error, so it gets thrown before the function actually executes. It's not actually skipping over your abort, it just fails to parse (or execute) the entire thing.
I'm not sure why you're getting a parse error there, but I do know the CF code that handles struct literals is somewhat flaky.

The issue was with the struct literals declared within the argument calls to a function.

i'm going to go out on a limb here and say that your issue might have something to do with this bug:
http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html#bugId=86960
is there anything in your app that executes in the onRequestEnd() method?
it would be helpful to tell us what exactly is happening and/or the output you're getting when the issue happens.

Related

how to solve a violation Error using a method

I am getting such a weird violation error by using the getAt() method.
I use the method in this order:
OdDbBlockTablePtr w_kOdBlockTablePtr ;
bool lbCreateDefaults = false;
OdDb::MeasurementValue lkMeasurement = OdDb::kEnglish;
OdDbDatabasePtr pDb;
// Datenbank initialisieren
pDb = g_ExSystemServices.createDatabase(lbCreateDefaults,
lkMeasurement);
// TABLE - Hold Ptr
w_kOdBlockTablePtr = pDb->getBlockTableId().openObject(OdDb::kForWrite);
const wchar_t AcadBlockModelSpace[] = L "*MODEL_SPACE";
wstring lsModelSpace(AcadBlockModelSpace);
w_kOdModelSpaceBlockRecPtr = GetTableRecordIdFromName(lsModelSpace, (OdDbSymbolTablePtr&)w_kOdBlockTablePtr).safeOpenObject(OdDb::kForWrite);
OdDbObjectId K_TeighaClass::GetTableRecordIdFromName(wstring& psName, OdDbSymbolTablePtr& pkTablePtr)
{
OdDbObjectId lkId;
try {
OdString lsOdName = psName.c_str();
lkId = pkTablePtr->getAt(lsOdName);
}
catch (OdError& err)
{
DoOdError(err, NULL, NULL);
}
return lkId;
}
I would really appreciate if someone could help me.
Thanks in advance
That's not weird at all. If you hover your mouse over pkTablePtr, you will almost certainly find that it is nullptr (or the debugger might report this as 0).
There's not enough information in your question to say why this might be, but since you are already running under the debugger you can walk through your code and find out.
try ... catch won't catch a hard error like this, by the way. For that, you need __try ... __except (supported on Windows only).

TaskDialogIndirect is returning an unusual error code

I'm using TaskDialogIndirect to display prompts to the user. Normally this works just fine, but sometimes, after the program has been running for a while, it begins returning an error code that the MSDN entry does not list as being one of the error codes this function can return.
0x80040001 OLE_E_ADVF "Invalid advise flags"
I have checked all the inputs to the function against previous successful calls in the same run. Aside from differences in the string to be displayed, they are identical. (the strings are even the same length.)
// create task dialog struct
TASKDIALOGCONFIG tdc;
ZeroMemory(&tdc, sizeof(TASKDIALOGCONFIG));
tdc.cbSize = sizeof(tdc);
tdc.dwFlags = (((dwMessageBoxFlags & MB_OKCANCEL) == MB_OKCANCEL) ? TDF_ALLOW_DIALOG_CANCELLATION : 0) | TDF_POSITION_RELATIVE_TO_WINDOW;
tdc.hwndParent = hwndOwner;
tdc.hInstance = LGetHInstance();
tdc.pszContent = usrText.wsz;
tdc.pButtons = _pButtons;
tdc.cButtons = nButtons;
tdc.pszMainIcon = pszTaskDialogIcon;
tdc.pszWindowTitle = usrCaption.wsz;
tdc.nDefaultButton = nDefaultButton;
// display it now
int iButton = 0;
BOOL b = 0;
HRESULT hResult = TaskDialogIndirect(&tdc, &iButton, NULL, &b);
NEW INFORMATION
At the same time that TaskDialogIndirect stops behaving correctly, ShellExecute also stops working, as does CreateFile.
This was actually caused by an event handle leak elsewhere. When the available handles ran out, no more API calls which needed to create a handle could succeed. They did return a rather odd set of error codes though, none of which was "out of handles".

ADO Recordset->EndOfFile giving me _com_error when Empty Recordset

I'm using ADO, and getting a very weird com error.
So I'm simply running a stored proc using ADO CommandPtr, and storing it in a Recordset.
Here is what I'm doing:
_ConnectionPtr Connptr;
//Instantiate ConnectionPtr...
_CommapndPtr CommPtr;
CommPtr.CreateInstance(__uuidof(Command));
CommPtr->CommandType = adCmdText;
CommPtr->ActiveConnection = ConnPtr;
CommPtr->CommandText = "Execute MyDb..MyStoredProc";
_RecordsetPtr RecPtr;
RecPtr.CreateInstance(__uuidof(Recordset));
RecPtr->CursorLocation = adUseClient;
RecPtr->CacheSize = 150;
RecPtr = CommPtr->Execute(NULL, NULL, adOptionUnspecified); //RecPtr = Empty Recordset
while (!RecPtr->EndOfFile) { //ERROR HAPPENS HERE!!!
//Do something
RecPtr->MoveNext();
}
So my stored procedure is supposed to returns an empty recordset (0 rows).
But then , when I check if the recordset has reached the end (which should simply return true if it is empty). I get a com error.
When I caught the com error and printed it out, I got this.
Code = -2147217849
Meaning = IDispatch error #3153
Source = NULL
Which doesn't tell me much.
I don't understand why RecPtr->EndofFile is throwing a com error, since it should simply return true/false.
I highly doubt that the error is caused because I'm doing something wrong when initializing Connection and Command objects. (If so, then I would have gotten the error when Executing the command.)
Any ideas on what might be causing this exception?

Unable to set Reporting Services Parameters

I'm generating a reporting services report from an ASP.NET (MVC) based application but am having problems setting the parameters for the report.
I believe the issue has only occurred since we upgraded SQL Server from 2005 to 2008 R2 (and Reporting Services along with it).
The original error encountered was from calling rsExec.Render:
Procedure or function 'pCommunication_ReturnRegistrationLetterDetails'
expects parameter '#guid', which was not supplied.
Debugging the code I noticed that rsExec.SetExecutionParameters is returning the following response:
Cannot call 'NameOfApp.SQLRSExec.ReportExecutionService.SetExecutionParameters(NameOfApp.SQLRSExec.ParameterValue[],
string)' because it is a web method.
Here is the function in it's entirety:
public static bool ProduceReportToFile(string reportname, string filename, string[,] reportparams,
string fileformat)
{
bool successful = false;
SQLRS.ReportingService2005 rs = new SQLRS.ReportingService2005();
SQLRSExec.ReportExecutionService rsExec = new NameOfApp.SQLRSExec.ReportExecutionService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials;
// Prepare Render arguments
string historyID = null;
string deviceInfo = null;
// Prepare format - available options are "PDF","Word","CSV","TIFF","XML","EXCEL"
string format = fileformat;
Byte[] results;
string encoding = String.Empty;
string mimeType = String.Empty;
string extension = String.Empty;
SQLRSExec.Warning[] warnings = null;
string[] streamIDs = null;
// Define variables needed for GetParameters() method
// Get the report name
string _reportName = reportname;
string _historyID = null;
bool _forRendering = false;
SQLRS.ParameterValue[] _values = null;
SQLRS.DataSourceCredentials[] _credentials = null;
SQLRS.ReportParameter[] _parameters = null;
// Get if any parameters needed.
_parameters = rs.GetReportParameters(_reportName, _historyID,
_forRendering, _values, _credentials);
// Load the selected report.
SQLRSExec.ExecutionInfo ei =
rsExec.LoadReport(_reportName, historyID);
// Prepare report parameter.
// Set the parameters for the report needed.
SQLRSExec.ParameterValue[] parameters =
new SQLRSExec.ParameterValue[1];
// Place to include the parameter.
if (_parameters.Length > 0)
{
for (int i = 0; i < _parameters.Length; i++)
{
parameters[i] = new SQLRSExec.ParameterValue();
parameters[i].Label = reportparams[i,0];
parameters[i].Name = reportparams[i, 0];
parameters[i].Value = reportparams[i, 1];
}
}
rsExec.SetExecutionParameters(parameters, "en-us");
results = rsExec.Render(format, deviceInfo,
out extension, out encoding,
out mimeType, out warnings, out streamIDs);
// Create a file stream and write the report to it
using (FileStream stream = System.IO.File.OpenWrite(filename))
{
stream.Write(results, 0, results.Length);
}
successful = true;
return successful;
}
Any ideas why I'm now unable to set parameters? The report generation works without issue if parameters aren't required.
Looks like it may have been an issue with how reporting services passes parameters through to the stored procedure providing the data. A string guid was being passed through to the report and the stored procedure expected a varchar guid. I suspect reporting services may have been noticing the string followed the guid format pattern and so passed it through as a uniqueidentifier to the stored procedure.
I changed the data source for the report from "stored procedure" to "text" and set the SQL as "EXEC pMyStoredOProcName #guid".
Please note the guid being passed in as a string to the stored procedure is probably not best practice... I was simply debugging an issue with another developers code.
Parameter _reportName cannot be null or empty. The [CLASSNAME].[METHODNAME]() reflection API could not create and return the SrsReportNameAttribute object
In this specific case it looks like an earlier full compile did not finish.
If you encounter this problem I would suggest that you first compile the class mentioned in the error message and see if this solves the problem.
go to AOT (get Ctrl+D)
in classes find CLASSNAME
3.compile it (F7)

How do you use a return value of true in Dart?

I get the following error when I try to execute the code below.
Uncaught TypeError: Object true has no method 'dartObjectLocalStorage$getter'
I started a Web Application in Dart Editor Version 0.1.0.201201150611 Build 3331. Here is the complete code for the lone dart file. The if statement that results in the error is commented below.
#import('dart:html');
class Test3D {
CanvasElement theCanvas;
WebGLRenderingContext gl;
static String vertexShaderSrc = """
attribute vec3 aVertexPosition;
void main(void) {
gl_Position = vec4(aVertexPosition, 1.0);
}
""";
Test3D() {
}
void run() {
write("Hello World!");
// Set up canvas
theCanvas = new Element.html("<canvas></canvas>");
theCanvas.width = 100;
theCanvas.height = 100;
document.body.nodes.add(theCanvas);
// Set up context
gl = theCanvas.getContext("experimental-webgl");
gl.clearColor(0.5, 0.5, 0.5, 1.0);
gl.clear(WebGLRenderingContext.COLOR_BUFFER_BIT);
WebGLShader vertexShader = gl.createShader(WebGLRenderingContext.VERTEX_SHADER);
gl.shaderSource(vertexShader, vertexShaderSrc);
gl.compileShader(vertexShader);
// Adding this line results in the error: Uncaught TypeError: Object true has no method 'dartObjectLocalStorage$getter
var wasSuccessful = gl.getShaderParameter(vertexShader, WebGLRenderingContext.COMPILE_STATUS);
}
void write(String message) {
// the HTML library defines a global "document" variable
document.query('#status').innerHTML = message;
}
}
void main() {
new Test3D().run();
}
I'm really keen on dart and would appreciate any help you could give me on this.
Here is the console output for the error:
Uncaught TypeError: Object true has no method 'dartObjectLocalStorage$getter'
htmlimpl0a8e4b$LevelDom$Dart.wrapObject$member
htmlimpl0a8e4b$WebGLRenderingContextWrappingImplementation$Dart.getShaderParameter$member
htmlimpl0a8e4b$WebGLRenderingContextWrappingImplementation$Dart.getShaderParameter$named
unnamedb54266$Test3D$Dart.run$member
unnamedb54266$Test3D$Dart.run$named
unnamedb54266$main$member
RunEntry.isolate$current
isolate$Isolate.run
isolate$IsolateEvent.process
isolate$doOneEventLoopIteration
next
isolate$doRunEventLoop
isolate$runEventLoop
RunEntry
(anonymous function)
The error indicates that somewhere in your code the field 'dartObjectLocalStorage' is accessed on the boolean true. The given code-snippet does not contain this identifier and is thus probably not responsible for the error.
It could be that the error-reporting gives the wrong line number (potentially even the wrong file).
To debug this:
try to find a reference to 'dartObjectLocalStorage' in your code.
try to find a reference to 'dartObjectLocalStorage$getter' in the generated code.
run on the VM or compile with a different compiler (frogc vs dartc).
good luck.
According to the documentation for WebGLRenderingContext the return type is Object, if you know the object is bool you can just use it as a bool or dynamic
var v=gl.getShaderParameter(vertexShader, WebGLRenderingContext.COMPILE_STATUS)
or more explicitly
var v=gl.getShaderParameter(vertexShader, WebGLRenderingContext.COMPILE_STATUS).dynamic
and then use it in your conditional statement. Also try compiling it with frogc rather than the build in JavaScript compiler, it usually results in better errors.