The FindBugs Blog

Monday, May 14, 2007

A closed source WTF: the longest second

OK, since I've pointed out a number of times that open source code contains a number of embarrassing bugs, I want to just emphasize that I've seen embarrassing code in every code base I've examined, including some propriatary closed source code bases.

I just want to share the following code, found in the code base of a highly respected tech company.

private static final String SECOND = "second";

public static String getTimeDelayStr(long delay) {

double roundDelay = 0;

// seconds
if (delay == 1)
return String.valueOf(new Double(Math.ceil(delay)).intValue()) + " " + SECOND;
....

26 Comments:

At 1:52 AM, Blogger Deepak said...

Hi,
I started using FindBugs and came up with this error
"Usage of GetResource may be unsafe if class is extended
Calling this.getClass().getResource(...) could give results other than expected if this class is extended by a class in another package."
I tried a lot to understand it but I could not understand. Can anyone please give more details and as to why this is a bug?

Sorry I was not able to post to this blog so i had to make a comment. If you dont mind please add me to the blog so that i can post questions.[deepujain@gmail.com]
Thanks
Deepak

 
At 7:23 AM, Blogger Deepak said...

I have another question.
Please answer:
After running findBugs() i had an error that describes. I understood the solution that inner class must be made static but i did not fully understand the solution. Can anyone please explain this.

Should be a static inner class
This class is an inner class, but does not use its embedded reference to the object which created it.  This reference makes the instances of the class larger, and may keep the reference to the creator object alive longer than necessary.  If possible, the class should be made static.
Thanks
Deepak

 
At 9:02 AM, Blogger Unknown said...


I have been following you for a couple of months now but this is my first time commenting on a blog post. Thank you for sharing your knowledge and experience with us. Keep up the good work. Already bookmarked for future reference.

SAP training in Chennai

 
At 8:11 AM, Blogger Unknown said...

This article creates a new hope and inspiration with in me. Thanks for sharing article like this. The way you have stated everything above is quite awesome. Keep blogging like this. Thanks.


SAP training in Chennai

 
At 7:53 AM, Blogger Unknown said...

I have been following you for a couple of months now but this is my first time commenting on a blog post. Thank you for sharing your knowledge and experience with us. Keep up the good work. Already bookmarked for future reference.

SAP training in Chennai

 
At 10:26 AM, Blogger Unknown said...

Thanks for the good words! Really appreciated. Great post. I ve been commenting a lot on a few blogs recently, but I had nt thought about my approach until you brought it up.

SAP training in Chennai

 
At 6:55 AM, Blogger Unknown said...


It’s really amazing that we can record what our visitors do on our site. Thanks for sharing this awesome guide. I’m happy that I came across with your site this article is on point,thanks again and have a great day. Keep update more information..

iOS App Development Company

 
At 2:18 AM, Blogger ciitnoida said...

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

 
At 4:57 AM, Blogger jenifer90 said...

It is this type of interesting thing with this post of yours. I had been interested with all the topic along with the flow in the story. Keep up to date the truly amazing work.

Ringer for PC

 
At 1:58 PM, Blogger sammer mark said...

Thanks for sharing this post. The correct printer setup is the key to good printouts. On the off chance that your printer isn't appropriately setup, at that point, you may confront usefulness or specialized issues with the printer. Now a days this type of problem are common like.
Fix Your Wireless Printer Problems
Install Canon Pixma ip2820 Printer Setup

 
At 4:13 AM, Blogger HHHK said...

I have my website https://treesinfo.xyz/
Check the bugs

 
At 4:14 AM, Blogger HHHK said...

https://treesinfo.xyz/

 
At 6:33 AM, Blogger Best Assignment Help said...

Assignment help
do my accounting homework
accounting homework
accounting homework service
accounting homework solver
C Programming Assignment Help
c assignment help
c programming homework
c programming homework help
C++ Programming Help
c++ homework help
c++ programming homework help
c++ programming assignment
c++ programming assignment help
c++ homework
c++ homework assignments
c++ assignment help
do my c++ homework
HTML ASSIGNMENT HELP
html homework help

Computer Science Assignment Help

 
At 1:27 AM, Blogger harryparker0123 said...

When I plan to use QuickBooks in various modes, QuickBooks error h202 is happening. This error code indicates that the multi-user connection to the server is fully blocked. This error code warning message indicates that the corporate file is on another computing system and QB requires some assistance connecting. i'm passing through this error code from an extended time. When this error code happens, A QuickBooks fails to open a corporation file placed on another computing system . I don’t have resolutions for this error code. are you able to provide the permanent solutions for fixing this error code?

 
At 6:49 AM, Blogger Maya Bansal said...

Hello, guys, I am Maya Bansal a 23 years old young Escort in City. I graduated from Mumbai University and nowadays I am single staying in my apartment and seeking nearby a best earning part-time job also I work professionally as City Escorts Sevice. I have all good qualities and perfect shape attractive figure that gives you extra enjoyment in during physical relationship. Book me anytime from Escorts Agency in City.
Panipat Escorts Agency ##
Ambala Escorts Agency ##
Sonipat Escorts Agency ##
Yamunanagar Escorts Agency ##
Rohtak Escorts Agency ##
Karnal Escorts Agency ##
Bhiwani Escorts Agency ##
Sirsa Escorts Agency ##

 
At 5:29 AM, Blogger jordan said...

Thanks for shearing such a nice article.your writing skill are impressive.Free astrology predictions from top astrologers in India as per your Birth Chart. astrology Prediction life report utilizes your birth chart to see what your future life looks like. The birth chart can reveal so many things about you,Talk to astrologer on call or chat, and get the benefits of free astrology services and products with more than 30 years of experiences astrologer online.

Gemini horoscope 2021
Taurus Horoscope 2021
Aries Horoscope 2021
Talk To Astrologer
Aaj ka Rashifal
Online Astrologer

 
At 6:12 AM, Blogger Steven Luke said...

The Global Electric Cargo Bikes Market is estimated to be valued at US$ 402.7 Mn by the end of 2018 and reach US$ 1,095.2 Mn by the end of 2026, registering a CAGR of 13.3% over the forecast period. The global electric cargo bikes market is anticipated to represent an incremental opportunity of US$ 692.5 Mn between 2018 and 2026.

 
At 2:21 AM, Anonymous Anonymous said...

Excellent thread, I have to thank you for this. It helps me a lot to enhance my knowledge. I truly like your way of blogging. I bookmarked it to my bookmark website list and will be checking back soon. Please check out my website polynomial assignment as well and let me know what you think.
psychology assignment
medical science assignment
spss assignment
perdisco assignment

 
At 12:04 AM, Blogger Quicken Error Support | Quicken Customer Service said...

Are you fed up with continuously receiving Quicken Error Cc-555? Have you decided to wag off from this problematic situation? Just relax! Here you will be guided.

 
At 9:55 AM, Blogger alex said...

When the QuickBooks program is utilized, a utility called the QuickBooks refresher tool runs in the background. It's more of a mini-repair tool that kicks in anytime QuickBooks encounters a glitch. QuickBooks Refresher may fix a variety of technical problems with the program. It may help in the following situations. When QuickBooks freezes and does not reply. QB has slowed down and is playing poorly. The program was shut off after just a few seconds of being opened. 6XXX error codes include 6123 and 0 among others.

 
At 7:10 AM, Blogger aria315addison said...

This comment has been removed by the author.

 
At 11:36 AM, Blogger Goodtime said...

This is a very useful and important information, it was so useful to me and other readers, thank you for always feeding the readers with interesting and useful information, your blog is indeed doing very well, kudos, meanwhile you can checkout this unijos cut off mark for agriculture

 
At 5:32 PM, Blogger Rian said...

virtual event Since that 2019 interview with Kipman, the technology has only been gaining further popularity. Google’s 2012 prototype might have been widely panned as a failure, but fast forward less than a decade later, and the technology may finally be delivering on its initial promise. presenter biography example, how can i sell concert tickets and event registration management software

 
At 4:23 PM, Blogger Leo Oliver said...


Assignments in Computer Science might be challenging at times. Our knowledgeable experts computer assignment assistance, computer science instructor, and computer science experts provide the best Computer Science Assignment Help for your Technology field study. They can be trusted to deliver the most accurate solutions to any of their essential assignments for college students.

 
At 3:51 PM, Blogger Leo Oliver said...

Our Programming Assignment Help professionals do a detailed review. Programming is the process of creating or developing an executable computer programme to execute on a certain computer. You may turn to us for all of our programming assignment help, and our professionals are available here all the time.

 
At 5:05 AM, Blogger خدمات منزلية said...

شركة صيانة افران بالمدينة المنورة
شركة تنظيف افران بالمدينة المنورة

 

Post a Comment

<< Home