mlopatkin / andlogview

Tool for viewing application logs from Android devices.
https://andlogview.mlopatkin.name/
Apache License 2.0
43 stars 6 forks source link

Unhandled exception when disabling a filter where there exists a duplicate filter #389

Open DanielJochem opened 3 months ago

DanielJochem commented 3 months ago

Version: AndLogView 0.23-SNAPSHOT (rev f80834881e10666637aebeba4d8c1fdd6dba5b87) (I am unsure if other versions are affected as I have not tested)

When there is a filter that has a duplicate, an Unhandled Exception message is shown when trying to disable the duplicate when it's original is already disabled (unsure if the same behavior would occur when enabling the duplicate filter instead). The full log is shown below:

2024-07-22 11:06:05,933 [main] INFO  andlogview.Main - AndLogView 0.23-SNAPSHOT (rev f80834881e10666637aebeba4d8c1fdd6dba5b87)
2024-07-22 11:06:05,933 [main] INFO  andlogview.Main - Revision f80834881e10666637aebeba4d8c1fdd6dba5b87
2024-07-22 11:06:06,996 [file-thread-0] INFO  device.AdbServerImpl - Starting ADB server
2024-07-22 11:06:07,776 [AWT-EventQueue-0] INFO  device.AdbServicesBridge - Initialized adb server in 804ms
2024-07-22 11:06:52,707 [AWT-EventQueue-0] ERROR andlogview.Main - Uncaught exception in AWT-EventQueue-0
java.lang.IllegalArgumentException: Filter FilterFromDialogImpl{enabled=false, data=FilterFromDialogData{mode=HIDE, tags=[PxrCompositor], messagePattern=null, pids=null, apps=null, priority=null, highlightColor=null}} is already in the model
    at name.mlopatkin.andlogview.filters.FilterModelImpl.replaceFilter(FilterModelImpl.java:73)
    at name.mlopatkin.andlogview.ui.filters.BaseFilterPresenter.setEnabled(BaseFilterPresenter.java:46)
    at name.mlopatkin.andlogview.ui.filters.FilterPanelModelAdapter.setFilterEnabled(FilterPanelModelAdapter.java:75)
    at name.mlopatkin.andlogview.ui.filters.FilterPanelModelAdapter.setFilterEnabled(FilterPanelModelAdapter.java:33)
    at name.mlopatkin.andlogview.ui.filterpanel.FilterPanel$FilterButton.actionPerformed(FilterPanel.java:178)
    at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
    at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
    at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
    at java.desktop/javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:411)
    at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
    at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
    at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
    at java.desktop/java.awt.Component.processMouseEvent(Component.java:6657)
    at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3385)
    at java.desktop/java.awt.Component.processEvent(Component.java:6422)
    at java.desktop/java.awt.Container.processEvent(Container.java:2266)
    at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5027)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4855)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4969)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4583)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4524)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
    at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2809)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4855)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:794)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:766)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:764)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:763)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

I was not aware that I had a duplicate filter, but now that I know I do, I have deleted the duplicate and it does not crash anymore.

Some other information that is unlikely useful and may just be a coincidence, but adding it here just in case:

In a way, this is related to issue https://github.com/mlopatkin/andlogview/issues/372 but is not silent