Exception in rendering component error

Hi,
just been using my mobile UI on iOS (& local Mac Safari) in a pilot and got the following error if an invalid value is entered into a field

2012-03-09 12:19	http-8080-6	ERROR	com.servoy.j2db.util.Debug	Error rendering the page esw_stock_item_usage	9E221F6D-F7B2-4BC1-A219-0D00927BC442	eStockWeb
org.apache.wicket.WicketRuntimeException: Exception in rendering component: TEXT_FIELD[name:esw_patient,x:5,y:165,width:300,height:80,value:] 
    	at org.apache.wicket.Component.renderComponent(Component.java:2764) 
    	at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1559) 
    	at com.servoy.j2db.server.headlessclient.dataui.WebDataField.onRender(WebDataField.java:466) 
    	at org.apache.wicket.Component.render(Component.java:2525) 
    	at org.apache.wicket.Component.renderComponent(Component.java:2666) 
    	at org.apache.wicket.ajax.AjaxRequestTarget.respondComponent(AjaxRequestTarget.java:876) 
    	at org.apache.wicket.ajax.AjaxRequestTarget.respondComponents(AjaxRequestTarget.java:680) 
    	at org.apache.wicket.ajax.AjaxRequestTarget.respond(AjaxRequestTarget.java:590) 
    	at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105) 
    	at com.servoy.j2db.server.headlessclient.WebClientsApplication$5.respond(WebClientsApplication.java:411) 
    	at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1287) 
    	at org.apache.wicket.RequestCycle.step(RequestCycle.java:1358) 
    	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1465) 
    	at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) 
    	at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486) 
    	at com.servoy.j2db.server.servlets.Zl.doGet(Zl.java:9) 
    	at org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:160) 
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) 
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
    	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:554) 
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) 
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) 
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) 
    	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) 
    	at java.lang.Thread.run(Thread.java:680) 
    Caused by: java.lang.NullPointerException 
    	at com.servoy.j2db.server.headlessclient.dataui.FocusIfInvalidAttributeModifier$1.getObject(FocusIfInvalidAttributeModifier.java:55) 
    	at com.servoy.j2db.server.headlessclient.dataui.FocusIfInvalidAttributeModifier$1.getObject(FocusIfInvalidAttributeModifier.java:1) 
    	at org.apache.wicket.model.Model.getObject(Model.java:1) 
    	at org.apache.wicket.AttributeModifier.getReplacementOrNull(AttributeModifier.java:378) 
    	at org.apache.wicket.AttributeModifier.replaceAttributeValue(AttributeModifier.java:280) 
    	at org.apache.wicket.AttributeModifier.onComponentTag(AttributeModifier.java:243) 
    	at org.apache.wicket.Component.renderComponentTag(Component.java:4305) 
    	at org.apache.wicket.Component.renderComponent(Component.java:2716) 
    	... 31 more

The field in question (esw_patient) is a global text field that the user is meant to enter a patient number into (either by typing or scanning a bar code)
I have an onDataChange method attached to it (the patient number can be either an NHS no, or a hospital no)
[the relationships are based on the globals.esw_patient to either of the above numbers]

function onDataChangePT ( oldValue, newValue, event )
{
	var $pt_name = '';
	try 
	{
		if ( databaseManager.hasRecords ( esw_to_patients_nhs_no ) )
		{
			globals.esw_patient_id = esw_to_patients_nhs_no.id_patient ;
			$pt_name = esw_to_patients_nhs_no.forename_1st + ' ' + esw_to_patients_nhs_no.surname ;
		}
		else if ( databaseManager.hasRecords ( esw_to_patients_rm_pt_no ) )
		{
			globals.esw_patient_id = esw_to_patients_rm_pt_no.id_patient ;
			$pt_name = esw_to_patients_rm_pt_no.forename_1st + ' ' + esw_to_patients_rm_pt_no.surname;
		}
		else
		{
			//no match error on pt'
			globals.esw_patient = oldValue ;
			elements.esw_patient.requestFocus() ;
			return false;
		}

		if ( $pt_name != '' )
		{
			checkRequired ( );
			return true;
		}
		else
			return false;
	}
	 catch(e) 
	{
		globals.esw_error_msg = 'Error ' + e ;
	}
}

The error only gets thrown if there isn’t a match on the patient and doesn’t always happen (i.e. sometimes my code correctly highlights same box in red putting original value back in), but it has happened on iOS & Mac (both using webkit browsers)
Under normal (i.e. not test/pilot) usage, the patient number should always be found if scanning, but if user is entering by hand and enters an incorrect value, there might not be a match.

Please can anyone advise me what is going wrong, as when system goes live (hopefully in a couple of weeks :shock: ), we can’t have the solution crashing out…

[One more thing, the overall system is running in the Servoy Framework by Sanneke, which handles the login to solution, but as soon as they go into it, I check if they are running web client and if so switch them to my mobile UI in a module ‘eStockWeb’ which is why things are prefixed by esw)

Thanks

Rafi
[Servoy 6.0.5]

[BUMP]
(please, does anyone have any idea [Servoy guys??])
Thanks
Rafi

somehow something some data input is null that we don’t expect to happen.
I fixed the

Caused by: java.lang.NullPointerException
at com.servoy.j2db.server.headlessclient.dataui.FocusIfInvalidAttributeModifier$1.getObject(FocusIfInvalidAttributeModifier.java:55)

happening there by making it more null save, will be in 6.0.7 (6.0.6 is already build and being tested so it won’t make it into that one)

Thanks.
Any idea now when 6.0.7 will be out as this system is meant to go live in just under two weeks time, and the Web UI (with that part) is a big part of my solution…??
(and I had posted this issue the day it happened & had to bump it…)
Thanks

Rafi

We just released 6.0.6 so 6.0.7 will be a while.
If you really need a build, please contact support and we could generate a intermediate build next week or something.

Hi

jcompagner:
We just released 6.0.6 so 6.0.7 will be a while.
If you really need a build, please contact support and we could generate a intermediate build next week or something.

just updated to 6.0.6 and there (obviously) is still an issue, so I will contact support (support@servoy.com?? not used to contacting them directly…)
Is there anything I can do with my current code to reduce this happening in 6.0.6 in the mean time??
Thanks
Rafi

what kind of data does “esw_patient” display? a String?
then make sure that the value in the records is not null but an empty string or something like that
I don’t get how it is possible that you get a nul pointer there in the first place because you should get the data of the user in the client when the left the field
and i think that is always at least an empty string… not null…

Hi,

jcompagner:
what kind of data does “esw_patient” display? a String?
then make sure that the value in the records is not null but an empty string or something like that
I don’t get how it is possible that you get a nul pointer there in the first place because you should get the data of the user in the client when the left the field
and i think that is always at least an empty string… not null…

esw_patient is a global string.
I had defaulted it to NULL, but following your post, I tried changing it to default to “” (empty string) and it seems to be ok now, so thanks!
I will test it again tomorrow in the real environment, instead of on my local developer & LAN & confirm again.

Thanks

Rafi