Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » NPE while saving State (with Filters
NPE while saving State (with Filters [message #1818752] Fri, 27 December 2019 07:24 Go to next message
Ludwig Moser is currently offline Ludwig MoserFriend
Messages: 476
Registered: July 2009
Senior Member
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 08:06 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
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 09:35 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig MoserFriend
Messages: 476
Registered: July 2009
Senior Member
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 09:54]

Report message to a moderator

Re: NPE while saving State (with Filters [message #1818756 is a reply to message #1818755] Fri, 27 December 2019 09:42 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
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 16:20 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig MoserFriend
Messages: 476
Registered: July 2009
Senior Member
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 18:41 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
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 07:53 Go to previous message
Ludwig Moser is currently offline Ludwig MoserFriend
Messages: 476
Registered: July 2009
Senior Member
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 Apr 26 16:19:21 GMT 2024

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

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

Back to the top