I'm not exactly sure what the conditions are,
but I occasionally see the attached exception when closing a project or opening a different one.
06:50:00.751: Info: Click on 'projectOpenRecentMenuItem' menu item (LOG_MENU_CLICK)
06:50:05.086: Info: Project saving start (LOG_DATAENGINE_SAVE_START)
06:50:05.086: Info: No need to save project, because no changes were made (LOG_DATAENGINE_SAVE_NONEED)
06:50:05.091: Info: Project saving end (LOG_DATAENGINE_SAVE_END)
06:50:05.091: Info: Project closed (LOG_DATAENGINE_CLOSE)
06:50:05.091: Info: Event: new entry activated (LOG_INFO_EVENT_ENTRY_ACTIVATED)
06:50:05.092: Error: java.lang.NullPointerException
06:50:05.092: Error: at org.omegat.util.BiDiUtils.getTargetLanguage(BiDiUtils.java:161)
06:50:05.092: Error: at org.omegat.util.BiDiUtils.isTargetLangRtl(BiDiUtils.java:153)
06:50:05.092: Error: at org.omegat.gui.properties.SegmentPropertiesArea$1.onEntryActivated(SegmentPropertiesArea.java:120)
06:50:05.092: Error: at org.omegat.core.CoreEvents.lambda$fireEntryActivated$3(CoreEvents.java:176)
06:50:05.092: Error: at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
06:50:05.092: Error: at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
06:50:05.092: Error: at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
06:50:05.092: Error: at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
06:50:05.092: Error: at java.base/java.security.AccessController.doPrivileged(Native Method)
06:50:05.092: Error: at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
06:50:05.092: Error: at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
06:50:05.092: Error: at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
06:50:05.092: Error: at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
06:50:05.092: Error: at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
06:50:05.092: Error: at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
06:50:05.092: Error: at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
06:50:05.092: Error: at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
06:50:05.104: Info: Event: project change - "SAVE" (LOG_INFO_EVENT_PROJECT_CHANGE)
06:50:05.104: Info: Event: project change - "CLOSE" (LOG_INFO_EVENT_PROJECT_CHANGE)
From the log, it looks like CoreEvents.fireEntryActivated triggers SegmentPropertiesArea.onEntryActivated unexpectedly even after the project has been closed.
I suggest adding a Core.getProject().isProjectLoaded() check in SegmentPropertiesArea.onEntryActivated to prevent this.
@Override
public void onEntryActivated(SourceTextEntry newEntry) {
if (!Core.getProject().isProjectLoaded()) {
return;
}
scrollPane.stopNotifying();
isTargetRtl = BiDiUtils.isTargetLangRtl();
setProperties(newEntry);
doNotify(getKeysToNotify());
}
Thank you.
I have pushed the fix as https://github.com/omegat-org/omegat/pull/1357
PR is merged.
I have pushed the backport PR for releases/6.0 branch
https://github.com/omegat-org/omegat/pull/1386