Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] [swt] proposal to replace some Errors with runtime Exceptions

To address bug http://bugs.eclipse.org/bugs/show_bug.cgi?id=8507 swt has
identified places where an Error is being thrown instead of a more
appropriate runtime Exception.  We would like to change these places to
throw runtime Exceptions, unless there is an objection from the community.
Making these changes would not break clients w.r.t. compilation since
runtime Exceptions are unchecked, and it is the expectation that there is
only one place where clients could be affected:

1.  JPEGFileFormat.loadFromStream(LEDataInputSteam) should throw an
SWTException instead of SWTError if the input stream is of invalid format.
If we make this change then any clients that are directly/indirectly
invoking this method and are currently catching SWTError would need to
catch SWTException instead.

2.  The following methods should throw an InvalidArgumentException instead
of SWTError if invalid arguments are provided by the client.  Making these
changes will not affect client code unless the client is invoking these
methods with values that are invalid (eg.- trying to add a null
TreeListener to a TableTree) and then catching the inevitable error.
      org.eclipse.swt.custom.PopupList:
            setMinimumWidth(int)
      org.eclipse.swt.custom.TableTree:
            addItem (TableTreeItem, int)
            addSelectionListener (SelectionListener)
            addTreeListener (TreeListener)
            removeSelectionListener (SelectionListener)
            removeTreeListener (TreeListener)
            setSelection (TableTreeItem [])
            showItem (TableTreeItem)
      org.eclipse.swt.custom.TableTreeItem:
            addItem (TableTreeItem, int)
            getDisplay ()
      org.eclipse.swt.ole.win32.OleControlSite:
            addPropertyListener (int, OleListener)
            removeEventListener (int, GUID, int, OleListener)
            removeEventListener (int, OleListener)
            removeEventListener (OleAutomation, GUID, int, OleListener)
            removeEventListener (OleAutomation, int, OleListener)
            removeEventListener (int, OleListener)

Please post any questions or objections.  We would like to release these
changes in ~ 1 week if there are no concerns.




Back to the top