java.lang.NullPointerException on loadStyleForForm(Flattened

Hi guys,
I get a NullPointerException when loading a form. Please give me a hint on where to look to identify the problem. It seems to me that it tries to load a style that is not specified. I don’t have any errors/warnings in the “problems” tab, so every element has a correct style specified.

I’m running Servoy 5.2.7 on Windows, both server and client.

Here is the error:

ERROR - Debug                      - Throwable
java.lang.NullPointerException
	at com.servoy.j2db.FlattenedSolution.loadStyleForForm(FlattenedSolution.java:1464)
	at com.servoy.j2db.FlattenedSolution.getStyleForForm(FlattenedSolution.java:1423)
	at com.servoy.j2db.component.ComponentFactory.getStyleForForm(ComponentFactory.java:538)
	at com.servoy.j2db.component.ComponentFactory.getStyleForBasicComponent(ComponentFactory.java:551)
	at com.servoy.j2db.component.ComponentFactory.getStyleForBasicComponent(ComponentFactory.java:631)
	at com.servoy.j2db.component.ComponentFactory.createTabPanel(ComponentFactory.java:1929)
	at com.servoy.j2db.component.ComponentFactory.createComponentEx(ComponentFactory.java:462)
	at com.servoy.j2db.component.ComponentFactory.createComponent(ComponentFactory.java:358)
	at com.servoy.j2db.smart.dataui.DataRendererFactory.placeElements(DataRendererFactory.java:248)
	at com.servoy.j2db.smart.dataui.DataRendererFactory.completeRenderers(DataRendererFactory.java:212)
	at com.servoy.j2db.FormController.createDataRenderers(FormController.java:1676)
	at com.servoy.j2db.FormController.init(FormController.java:1522)
	at com.servoy.j2db.FormManager.leaseFormPanel(FormManager.java:900)
	at com.servoy.j2db.FormManager.getFormController(FormManager.java:803)
	at com.servoy.j2db.smart.dataui.FormLookupPanel.createFormPanel(FormLookupPanel.java:122)
	at com.servoy.j2db.smart.dataui.FormLookupPanel.getFormPanel(FormLookupPanel.java:184)
	at com.servoy.j2db.smart.dataui.FormLookupPanel.getDefaultSort(FormLookupPanel.java:163)
	at com.servoy.j2db.smart.dataui.SpecialTabPanel.getDefaultSort(SpecialTabPanel.java:331)
	at com.servoy.j2db.smart.dataui.SpecialTabPanel.setRecord(SpecialTabPanel.java:207)
	at com.servoy.j2db.dataprocessing.DataAdapterList.setRecord(DataAdapterList.java:377)
	at com.servoy.j2db.smart.dataui.DataRenderer.getListCellRendererComponent(DataRenderer.java:423)
	at com.servoy.j2db.smart.RecordView.syncSliderAndRefresh(RecordView.java:209)
	at com.servoy.j2db.smart.RecordView.valueChanged(RecordView.java:332)
	at com.servoy.j2db.smart.RecordView.setModelInternal(RecordView.java:101)
	at com.servoy.j2db.smart.RecordView.setModel(RecordView.java:307)
	at com.servoy.j2db.FormController.notifyVisible(FormController.java:3003)
	at com.servoy.j2db.smart.dataui.FormLookupPanel.notifyVisible(FormLookupPanel.java:215)
	at com.servoy.j2db.smart.dataui.SpecialTabPanel.notifyVisible(SpecialTabPanel.java:197)
	at com.servoy.j2db.dataprocessing.DataAdapterList.notifyVisible(DataAdapterList.java:499)
	at com.servoy.j2db.smart.dataui.DataRenderer.notifyVisible(DataRenderer.java:266)
	at com.servoy.j2db.FormController.notifyVisible(FormController.java:3078)
	at com.servoy.j2db.smart.dataui.FormLookupPanel.notifyVisible(FormLookupPanel.java:215)
	at com.servoy.j2db.smart.dataui.SpecialTabPanel.stateChanged(SpecialTabPanel.java:383)
	at com.servoy.j2db.smart.dataui.TablessPanel.setSelectedIndex(TablessPanel.java:199)
	at com.servoy.j2db.smart.dataui.SpecialTabPanel.js_setTabIndex(SpecialTabPanel.java:871)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:179)
	at org.mozilla.javascript.JavaMembers.put(JavaMembers.java:178)
	at org.mozilla.javascript.NativeJavaObject.put(NativeJavaObject.java:141)
	at org.mozilla.javascript.ScriptableObject.putProperty(ScriptableObject.java:1768)
	at org.mozilla.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1532)
	at org.mozilla.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1520)
	at org.mozilla.javascript.gen.c60._c0(core_project_link:417)
	at org.mozilla.javascript.gen.c60.call(core_project_link)
	at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:65)
	at org.mozilla.javascript.gen.c59._c0(goToProject:740)
	at org.mozilla.javascript.gen.c59.call(goToProject)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:387)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3127)
	at org.mozilla.javascript.gen.c59.call(goToProject)
	at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:458)
	at com.servoy.j2db.FormController.executeFunction(FormController.java:3972)
	at com.servoy.j2db.FormController.executeFunction(FormController.java:3860)
	at com.servoy.j2db.FormController.executeFunction(FormController.java:3782)
	at com.servoy.j2db.FormController$ScriptExecuter.executeFunction(FormController.java:3637)
	at com.servoy.j2db.ui.BaseEventExecutor.fireEventCommand(BaseEventExecutor.java:270)
	at com.servoy.j2db.ui.BaseEventExecutor.fireActionCommand(BaseEventExecutor.java:217)
	at com.servoy.j2db.smart.dataui.AbstractScriptLabel$5.mouseReleased(AbstractScriptLabel.java:1023)
	at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at javax.swing.plaf.basic.BasicTableUI$Handler.repostEvent(Unknown Source)
	at javax.swing.plaf.basic.BasicTableUI$Handler.mouseReleased(Unknown Source)
	at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
	at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at com.servoy.j2db.gui.FixedJTable.processMouseEvent(FixedJTable.java:133)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$000(Unknown Source)
	at java.awt.EventQueue$1.run(Unknown Source)
	at java.awt.EventQueue$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$2.run(Unknown Source)
	at java.awt.EventQueue$2.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

If I preload it after solution starts I get:

java.lang.NullPointerException
	at com.servoy.j2db.FlattenedSolution.loadStyleForForm(FlattenedSolution.java:1464)
	at com.servoy.j2db.FlattenedSolution.getStyleForForm(FlattenedSolution.java:1423)
	at com.servoy.j2db.component.ComponentFactory.getStyleForForm(ComponentFactory.java:538)
	at com.servoy.j2db.component.ComponentFactory.getStyleForBasicComponent(ComponentFactory.java:551)
	at com.servoy.j2db.component.ComponentFactory.getStyleForBasicComponent(ComponentFactory.java:631)
	at com.servoy.j2db.component.ComponentFactory.createTabPanel(ComponentFactory.java:1929)
	at com.servoy.j2db.component.ComponentFactory.createComponentEx(ComponentFactory.java:462)
	at com.servoy.j2db.component.ComponentFactory.createComponent(ComponentFactory.java:358)
	at com.servoy.j2db.smart.dataui.DataRendererFactory.placeElements(DataRendererFactory.java:248)
	at com.servoy.j2db.smart.dataui.DataRendererFactory.completeRenderers(DataRendererFactory.java:212)
	at com.servoy.j2db.FormController.createDataRenderers(FormController.java:1676)
	at com.servoy.j2db.FormController.init(FormController.java:1522)
	at com.servoy.j2db.FormManager.leaseFormPanel(FormManager.java:900)
	at com.servoy.j2db.scripting.CreationalPrototype.get(CreationalPrototype.java:172)
	at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1641)
	at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1429)
	at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1418)
	at org.mozilla.javascript.gen.c17._c0(preLoadFormsAndRecords:176)
	at org.mozilla.javascript.gen.c17.call(preLoadFormsAndRecords)
	at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:111)
	at org.mozilla.javascript.gen.c6._c0(on_solution_open:166)
	at org.mozilla.javascript.gen.c6.call(on_solution_open)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:387)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3127)
	at org.mozilla.javascript.gen.c6.call(on_solution_open)
	at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:458)
	at com.servoy.j2db.FormManager.makeSolutionSettings(FormManager.java:323)
	at com.servoy.j2db.smart.SwingFormManager.makeSolutionSettings(SwingFormManager.java:189)
	at com.servoy.j2db.FormManager$1.run(FormManager.java:158)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$000(Unknown Source)
	at java.awt.EventQueue$1.run(Unknown Source)
	at java.awt.EventQueue$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

Thanks!

I made a mistake. The server is running 5.2.2 -build 1002, while on the developer I have 5.2.7 - build 1013 and I don’t get the exception in developer.
Is anything changed from 5.2.2 to 5.2.7 that I should pay attention to?

Thanks,
Gabriel

A nullPointer exception should never occur. If it does, it’s something in under lying Java code, so most likely something inside Servoy or in a 3rd party plugin.

Between Servoy 5.2.2. and Servoy 5.2.8 there are basically a lot of fixes, as they are maintenance releases, so the first step would be to upgrade.

Paul

Thanks Paul,

the update to 5.2.8 fixed the problem.

Bye,
Gabriel

Actually, the upgrade didn’t fix it after all.

The error was caused by two tabpanels on a form, which had the style set on DEFAULT. Once I’ve change that to something else, the error went away.

I suppose that instead of using the default settings for the tabpanels, Servoy was looking for a style called “DEFAULT”.

This form is upgraded from 4 to 5, so maybe after the upgrade the “DEFAULT” setting was still there, instead of being deleted, it that was the desired behavior.

Even if I change the style to something else, and then back to DEFAULT the error appears again.

Have a nice day!
Gabriel

Gabriel,

If you can reproduce that in a small sample, then please file a case with that.

Rob