This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
> Hi... > > the "equals()" method in DataSourceImpl is vulnerable to having a > "null" value of the parameter. While all other classes which I > checked (not all of them, mind you) do handle this correctly > (according to the "rule" in the Object.equals() method), this one does > not. > Tom, so I change the first line of this equals() api to: if ( o==null || !(getClass().equals(o.getClass()))) { return false; } I believe this can avoid the NPE. Yuan > Please make the change to test for null and return false. > > We have some users who are trying to use this from Jython, and because the > test: > > if (ret == None) > > actually calls the equals() method (or the __eq__() method), this > always creates an NPE. > > (I am aware that saying " if (ret is None) " does not cause this -- we > need to educate people separately...DataSourceImpl still should handle > the 'null' case.) > > Thanks. > > tom > > -- > Tom Whittaker > University of Wisconsin-Madison > Space Science & Engineering Center (SSEC) > Cooperative Institute for Meteorological Satellite Studies (CIMSS) > 1225 W. Dayton Street > Madison, WI 53706 USA > ph: +1 608 262 2759 > > Ticket Details =================== Ticket ID: IOT-739511 Department: Support IDV Priority: Normal Status: Closed