Community
Participate
Working Groups
I'm upgrading an Eclipse RCP application that has a perspective that has text editors (text, xml, etc) from Eclipse 4.6 to a newer version. We found that when you right click on the file and select "Replace With -> Previous from Local History" it now throws a NullPointerException, whereas with Eclipse 4.6 it worked. The stacktrace of the exception with Eclipse 2021-12 (4.22) is java.lang.NullPointerException: null at org.eclipse.compare.internal.CompareUIPlugin.getImage(CompareUIPlugin.java:739) at org.eclipse.compare.internal.EditionAction.doFromHistory(EditionAction.java:153) at org.eclipse.compare.internal.EditionAction.run(EditionAction.java:114) at org.eclipse.compare.internal.BaseCompareAction.run(BaseCompareAction.java:27) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:239) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:580) at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:414) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89) I traced the error to this code change, around line 742: https://git.eclipse.org/c/platform/eclipse.platform.team.git/commit/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java?id=16bb9ed654149328b54869c05526a5fdb9562b01 With the debugger I found with both older and newer Eclipse versions, the call to get the adapter returns null. However, with the older code the instanceof check prevents a NullPointerException while the newer code has no safety check. Therefore, I think this is a bug and the solution is to just add a check for if the adapter is null before calling getImageDescriptor(adaptable) on it.
Thanks. Would you please provide a patch? https://wiki.eclipse.org/Platform/How_to_Contribute
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.team/+/189864
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.team/+/189865
(In reply to Andrey Loskutov from comment #1) > Thanks. Would you please provide a patch? > https://wiki.eclipse.org/Platform/How_to_Contribute Too late now.
Gerrit change https://git.eclipse.org/r/c/platform/eclipse.platform.team/+/189864 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.team.git/commit/?id=2a735980f649f352a023aa29d66ce8136e02b3b0
Gerrit change https://git.eclipse.org/r/c/platform/eclipse.platform.team/+/189865 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.team.git/commit/?id=b96ecaa5ace2c6edd5e08c7cb6aa630992e5a461
Thank you! I was trying to do it but my Eclipse account seems messed up.