Skip to main content
elisabethf82215657
Inspiring
July 12, 2022
Answered

cfprogressbar - bind problem - not well formed html

  • July 12, 2022
  • 1 reply
  • 495 views

In our application (Coldfusion 2018, Update 14) on some pages we use cfprogressbar to show the progress of long running actions to the user. The progress bar is bound to a cfc which returns status and message from out of the session of the user.

This coding has been used since many years and always worked well.


For 2-3 months we are now sporadically getting an error of the meaning that the cfc cannot be bound:


java.lang.NullPointerException at coldfusion.tagext.html.ajax.AjaxProxyTag.getCFCInvocationPath(AjaxProxyTag.java:520) at coldfusion.tagext.html.ajax.AjaxProxyTag.getCallParameters(AjaxProxyTag.java:386) at coldfusion.tagext.html.ajax.BindProcessor.parseBind(BindProcessor.java:558) at coldfusion.tagext.html.ajax.BindProcessor.processBind(BindProcessor.java:325) at coldfusion.tagext.html.ajax.ProgressBarTag.generateBindFunction(ProgressBarTag.java:335) at coldfusion.tagext.html.ajax.ProgressBarTag.doEndTag(ProgressBarTag.java:273) at cfplpButtons2ecfm1713680839._factor0(G:\Websites\icmms\farcry\tags\plp\plpButtons.cfm:148)

...


Thie problem is not reproducable, if the same users call the pages once again they work.


So in order to hide this problem from the users we wanted to use try/catch to either display the page without the progressbar in case of the error or better to try x times to get a working progress bar.

But unfortunately this did not work, because after an exception of the cfprogressbar call the code added to the header of the page is not well formed any more!

 

Here is an example:

 

<cfsetting enablecfoutputonly="no" requesttimeout="12000">
<cfprocessingdirective pageencoding="utf-8">


	
<cfoutput>
	<!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>Test script</title>
	</head>

<body style="font-family:Verdana, Geneva, sans-serif; font-size:12px;">
</cfoutput>

<cftry>
	<cfprogressbar name="mydataProgressbar"
		autoDisplay="false" 
		bind="cfc:remote.services.progress.getProgressNew()" 
		interval="1000"  
		width="634" 
		style="font-size:10px; font-weight:bold; line-height:normal; bgcolor:dddddd; textcolor:666666; progresscolor:FFFF99;"
		/> 
<cfcatch>
	<cfprogressbar name="mydataProgressbarCatch"
		autoDisplay="false" 
		bind="cfc:remote.services.progress.getProgress()" 
		interval="1000"  
		width="634" 
		style="font-size:10px; font-weight:bold; line-height:normal; bgcolor:dddddd; textcolor:666666; progresscolor:FFFF99;"
		/> 
</cfcatch>
</cftry>

<cfoutput>
	<script language="javascript">
	
		var callBackConfirm = function(btn){ 
		}
		
	</script>
</cfoutput>

<cfoutput>DONE!</cfoutput>
	
<cfoutput>
	</body>
	</html>
</cfoutput>

Function getProgressNew() does not exist, function getProgress() does. This is the html output:

 

<!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><script type="text/javascript">/* <![CDATA[ */_cf_loadingtexthtml="<img alt=' ' src='/cf_scripts/scripts/ajax/resources/cf/images/loading.gif'/>";
_cf_contextpath="";
_cf_ajaxscriptsrc="/cf_scripts/scripts/ajax";
_cf_jsonprefix='//SMT';
_cf_websocket_port=8581;
_cf_flash_policy_port=1243;
_cf_clientid='584785C7EDB651EE44944006D90A26D2';/* ]]> */</script><script type="text/javascript" src="/cf_scripts/scripts/ajax/messages/cfmessage.js"></script>
<script type="text/javascript" src="/cf_scripts/scripts/ajax/package/cfajax.js"></script>
<script type="text/javascript" src="/cf_scripts/scripts/ajax/ext/ext-all.js"></script>
<script type="text/javascript" src="/cf_scripts/scripts/ajax/package/cfprogressbar.js"></script>
<link rel="stylesheet" type="text/css" href="/cf_scripts/scripts/ajax/resources/ext/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="/cf_scripts/scripts/ajax/resources/cf/cf.css" />

<style>#mydataProgressbar  .x-progress-default { background-image: none; background-color: #dddddd;}#mydataProgressbar  .x-progress-text { color: #666666;} #mydataProgressbar  .x-progress-bar { background-image: none; background-color: #FFFF99;}
</style>
	<style>#mydataProgressbarCatch  .x-progress-default { background-image: none; background-color: #dddddd;}#mydataProgressbarCatch  .x-progress-text { color: #666666;} #mydataProgressbarCatch  .x-progress-bar { background-image: none; background-color: #FFFF99;}
	</style>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>Test script</title>
	
<script type="text/javascript">/* <![CDATA[ */
	ColdFusion.Ajax.importTag('CFPROGRESSBAR');
/* ]]> */</script>

<script type="text/javascript">/* <![CDATA[ */
	var <div  id="mydataProgressbarCatch">
		
	 </div>var _cf_cf_progressbar_getStatus_2339053404795101=function(_cf_progressBarId)
	{
		
		ColdFusion.Bind.cfcBindHandler(null, {'bindTo':ColdFusion.ProgressBar.loadStatus,'bindToAttr':'true','errorHandler':ColdFusion.ProgressBar.errorHandler,'cfc':'/remote/services/progress.cfc','cfcFunction':'getProgress','_cf_ajaxproxytoken':'625A88A9','bindExpr':[], 'bindToParams': { '_cf_progressbarid':'mydataProgressbarCatch' }});
	};
	_cf_progressbar_init_2339053404795102=function()
	{
		var _cf_progressbar=ColdFusion.ProgressBar.create('mydataProgressbarCatch',_cf_cf_progressbar_getStatus_2339053404795101,null,1000,null,634,false,null,'mydataProgressbarCatch',null);
	};ColdFusion.Event.registerOnLoad(_cf_progressbar_init_2339053404795102);</head>

<body style="font-family:Verdana, Geneva, sans-serif; font-size:12px;">
<div  id="mydataProgressbar">
	
 </div>
	<script language="javascript">
	
		var callBackConfirm = function(btn){ 
		}
		
	</script>
DONE!
	</body>
	</html>

The important fact is, that the </script> tag before </head> to close the block containing the progress bar javascripts is missing here.

If I just leave the progress bar from the page if the exception occurs I get the same script error if any message boxes (cfmessagebox) are used on the page.

 

Has anybody expierienced the same problems? What can I do for a workaround if this exception happens? And what can be reasons for cfc binding not working (only sporadically)?

 

    This topic has been closed for replies.
    Correct answer elisabethf82215657

    I reported it.
    I also implemented a workaround. We now bind a javascript function with cfajaxproxy for the cfc call.

    1 reply

    BKBK
    Community Expert
    Community Expert
    July 13, 2022

    Looks like a bug. Report it.

    elisabethf82215657
    elisabethf82215657AuthorCorrect answer
    Inspiring
    August 1, 2022

    I reported it.
    I also implemented a workaround. We now bind a javascript function with cfajaxproxy for the cfc call.

    elisabethf82215657
    Inspiring
    August 1, 2022