Skip to main content



      Home
Home » Eclipse Projects » NatTable » NPE while saving State (with Filters
NPE while saving State (with Filters [message #1818752] Fri, 27 December 2019 02:24 Go to next message
Eclipse UserFriend
Hello,

i am experiencing a NPE when i try to save the state of a Nattable.
i have a filter set then call

Properties properties = new Properties();
natTable.saveState("test", properties);


i am using version 1.6 of NatTable
with sorting, filter, grouping etc...


can you reproduce this issue? if not how can i find out whats causing this?

java.lang.NullPointerException
	at org.eclipse.nebula.widgets.nattable.filterrow.FilterRowDataProvider.getFilterStringRepresentation(FilterRowDataProvider.java:273)
	at org.eclipse.nebula.widgets.nattable.filterrow.FilterRowDataProvider.saveState(FilterRowDataProvider.java:201)
	at org.eclipse.nebula.widgets.nattable.layer.AbstractLayer.saveState(AbstractLayer.java:131)
	at org.eclipse.nebula.widgets.nattable.layer.DataLayer.saveState(DataLayer.java:90)
	at org.eclipse.nebula.widgets.nattable.layer.CompositeLayer.saveState(CompositeLayer.java:94)
	at org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform.saveState(AbstractLayerTransform.java:70)
	at org.eclipse.nebula.widgets.nattable.layer.CompositeLayer.saveState(CompositeLayer.java:94)
	at org.eclipse.nebula.widgets.nattable.layer.CompositeLayer.saveState(CompositeLayer.java:94)
	at org.eclipse.nebula.widgets.nattable.NatTable$9.run(NatTable.java:785)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.nebula.widgets.nattable.NatTable.saveState(NatTable.java:781)
Re: NPE while saving State (with Filters [message #1818754 is a reply to message #1818752] Fri, 27 December 2019 03:06 Go to previous messageGo to next message
Eclipse UserFriend
Quote:
how can i find out whats causing this?


Typically by debugging and checking the sources

It seems to be because there is no converter for the column. Not sure if this is a regression or was always like this. But a NPE is always a bug, so please create a ticket.
Re: NPE while saving State (with Filters [message #1818755 is a reply to message #1818754] Fri, 27 December 2019 04:35 Go to previous messageGo to next message
Eclipse UserFriend
Quote:
It seems to be because there is no converter for the column.

well i tested on a text column - which should not need any converters -> so a default Converter that simply calls Object.toString() would be enough

ticket created: https://bugs.eclipse.org/bugs/show_bug.cgi?id=558643

[Updated on: Fri, 27 December 2019 04:54] by Moderator

Re: NPE while saving State (with Filters [message #1818756 is a reply to message #1818755] Fri, 27 December 2019 04:42 Go to previous messageGo to next message
Eclipse UserFriend
Like said before it could be a regression. Need to check in more detail.

Please create a ticket so I don't forget to check.
Re: NPE while saving State (with Filters [message #1818762 is a reply to message #1818756] Fri, 27 December 2019 11:20 Go to previous messageGo to next message
Eclipse UserFriend
https://bugs.eclipse.org/bugs/show_bug.cgi?id=558643
Re: NPE while saving State (with Filters [message #1818768 is a reply to message #1818762] Fri, 27 December 2019 13:41 Go to previous messageGo to next message
Eclipse UserFriend
OK, this is not a regression. That code exists for years without a reported issue.

My best guess is that you are not using the DefaultNatTableStyleConfiguration and additionally have not registered the necessary basic default configurations. One configuration is the DefaultDisplayConverter that is registered without a DisplayMode and without a label, which means it is used as fallback if nothing else is registered.

        configRegistry.registerConfigAttribute(
                CellConfigAttributes.DISPLAY_CONVERTER,
                new DefaultDisplayConverter());


If that configuration is missing it can happen that NPEs occur where a display converter is expected.

That said, of course a NPE is a programming error that needs to be fixed. But if you have the basic configuration correctly applied, it should never happen. So the criticality is low, but I will have a look.
You can fix this simply by adding the above configuration.
Re: NPE while saving State (with Filters [message #1818783 is a reply to message #1818768] Sat, 28 December 2019 02:53 Go to previous message
Eclipse UserFriend
Dirk Fauth wrote on Fri, 27 December 2019 13:41

        configRegistry.registerConfigAttribute(
                CellConfigAttributes.DISPLAY_CONVERTER,
                new DefaultDisplayConverter());


Thanks Dirk, this fixed the issue!
Previous Topic:how to create a custom filter
Next Topic:Instances of NatTable are beeing kept in memory after composite is disposed
Goto Forum:
  


Current Time: Fri May 16 14:15:30 EDT 2025

Powered by FUDForum. Page generated in 0.24712 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top