I've always put JNotify.addWatch and JNotify.removeWatch into a try-catch clause, however I recently noticed that JNotify can, under certain circumstances, throw a JNotifyException_linux that somehow seems to be able to bypass my try-catch clause.
These certain circumstances are as follows:
- Program runs on Linux
- Watch folder F
- Move subfolders around inside F
- Remove watch from F
- Program crashes with the following stacktrace:
inotify_rm_watch: Invalid argument
net.contentobjects.jnotify.linux.JNotifyException_linux: Error removing watch 331
at net.contentobjects.jnotify.linux.JNotify_linux.removeWatch(Unknown Source)
at net.contentobjects.jnotify.linux.JNotifyAdapterLinux.unwatch(Unknown Source)
at net.contentobjects.jnotify.linux.JNotifyAdapterLinux.removeWatch(Unknown Source)
at net.contentobjects.jnotify.JNotify.removeWatch(Unknown Source)
at net.sourceforge.docfetcher.model.FSEventHandler.removeWatch(FSEventHandler.java:298)
at net.sourceforge.docfetcher.model.FSEventHandler.setWatchEnabled(FSEventHandler.java:252)
at net.sourceforge.docfetcher.view.ScopeGroup.insertFromClipboard(ScopeGroup.java:491)
at net.sourceforge.docfetcher.view.ScopeGroup.access$4(ScopeGroup.java:443)
at net.sourceforge.docfetcher.view.ScopeGroup$InsertFromClipboardAction.run(ScopeGroup.java:686)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:583)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:500)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at net.sourceforge.docfetcher.DocFetcher.main(DocFetcher.java:92)