WTF in javax.sql.rowset.serial.SerialRef
Sometimes, a bug report will point you to some code that just elicits a WTF response.
FindBugs generated a null pointer warning in javax.sql.rowset.serial.SerialRef, complaining about the call
if (!object.equals(null))
:/**
* Returns anObject
representing the SQL structured type
* to which thisSerialRef
object refers. The attributes
* of the structured type are mapped according to the given type map.
*
* @param map ajava.util.Map
object containing zero or
* more entries, with each entry consisting of 1) aString
* giving the fully qualified name of a UDT and 2) the
*Class
object for theSQLData
implementation
* that defines how the UDT is to be mapped
* @return an object instance resolved from the Ref reference and mapped
* according to the supplied type map
* @throws SerialException if an error is encountered in the reference
* resolution
*/
public Object getObject(java.util.Map<String,Class<?>> map)
throws SerialException
{
map = new Hashtable(map);
if (!object.equals(null)) {
return map.get(object);
} else {
throw new SerialException("The object is not set");
}
}
But when you look at that code, that seems to be the least of the problems.
Why is the map being converted into a new Hashtable, and what is this method intended to do?
Since the return type of this isn't Class, I'm guessing that it should
return something other than Class objects. I'm guessing it should create an instance of the class found in the Map. Does anyone know?
This is one of the places where using a generic type would have been very useful in documenting the specification of the method, even if it wasn't that useful to users of the method. If the method had been declared as:
public <T> T getObject(java.util.Map<String,Class<? extends T>> map)then the relationship between the map and the return value would have been exceptionally clear. Of course, I don't know if this is the intended specification of the class.
P.S. Thanks to Sun's open sourcing of Java, I no longer have to worry about posting examples with source code from Sun's JDK.
16 Comments:
I'm a student form China and I have use Findbugs for some days. Recently I just want to use your Eclipse-plugin on my works, but you see because the west Pacific Ocean's earthquake I can't open findbugs.sourceforge.net. So would you mind to e-mail it as an accessory to me?
My e-mail is: wgxwg1985@gmail.com
Thanks a lot.
The feller took the money and started away; and when he was going out at the door, he sorter jerked his thumb over his shoulder--so--at Dan'l, and says again, very deliberate, Well, he says, hydrocodone I don't see no p'ints about that frog that's any better'n any other frog.. But the ostracized woman, as though she felt the deep humiliation of her position, turned sharply away, lortab and opened her parasol to shield her eyes from the sun.. Finding myself often in his vacant seat at these times, I watched the proceedings with a good deal allegra of care; and once was so much excited that I delivered my somewhat celebrated speech on the Central School District question, a speech of which the State of Maine printed some extra copies...
Your blog is very unique and interesting. It makes reader to come back and visit again.
Selenium Training in Chennai
Thanks for sharing these information. It’s a very nice topic. We are providing online training classes
Best Linux training in Noida
Linux Training Institute in Noida
Thank you for your post, I look for such article along time, today i find it finally. this post give me lots of advise it is very useful for me.
Best bca college in noida
Top bca colleges in noida
best article best bless from my side
6 weeks CCNA Summer Internship
Best 6 weeks MCSE summer internship
great and useful blog
java training in Bangalore
spring training in Bangalore
java training institute in Bangalore
spring and hibernate training in Bangalore
Really it's a very unique and interesting. It makes reader to come back and visit again.
DOT NET training in Marathahalli
dot net training institute in Marathahalli
dot net course in Marathahalli
best dot net training institute in Marathahalli
nice blog..
iot courses in Bangalore
internet of things training course in Bangalore
internet of things course in Bangalore
nice article
very useful information.
keep sharing.
Best Java training in bengaluru
I really love your site.. Pleasant colors & theme. Did you create this web site yourself? Please reply back as I’m trying to create my own personal blog and would love to learn where you got this from or exactly what the theme is named. Cheers! onsite mobile repair bangalore I really like it when people come together and share views. Great blog, stick with it! asus display replacement Great information. Lucky me I recently found your site by chance (stumbleupon). I've saved as a favorite for later! huawei display repair bangalore
This website was... how do you say it? Relevant!! Finally I've found something that helped me. Cheers! vivo charging port replacement Everything is very open with a very clear clarification of the challenges. It was really informative. Your site is very helpful. Thank you for sharing! lg service center Bangalore I must thank you for the efforts you have put in penning this website. I really hope to view the same high-grade content by you later on as well. In truth, your creative writing abilities has motivated me to get my very own blog now ;) motorola display repair bangalore
Acadecraft, an optimum content quality checker online service, has a team of Content Quality Analysts who possess ultimate subject-matter knowledge. We have experienced writers who have worked on multiple challenging projects. Our QC consultants aptly identify the risk areas and rectify them.
check content quality online
video solutions development companies
Thank you for sharing such a nice blog.Astroswamig is the famous online astrology prediction portal.here you can talk to best astrologer of India.and you know your horoscope and kundali.
Taurus Horoscope 2021
Aries Horoscope 2021
Talk To Astrologer
Aaj ka Rashifal
Online Astrologer
Such a wonderful information blog post on this topic. Do you want to accelerate your studying stuffs and thus looking for some free alternatives to Chegg? Then definitely opt for Crazy For Study website.
Their subject wise courses are curated interestingly to interact with the learners. They also have complete solution manuals to all your textbooks which make your homework easier.
So, if you want hassle-free access to free answers, then opt for Crazy For Study website. They provide you an easy access to download all study stuffs free of cost.
nice article
gcp data engineer training
Post a Comment
<< Home