• Join/Login
  • Business Software
  • Open Source Software
  • For Vendors
  • Blog
  • About
  • More
    • Articles
    • Create
    • SourceForge Podcast
    • Site Documentation
    • Subscribe to our Newsletter
    • Support Request
SourceForge logo
For Vendors Help Create Join Login
SourceForge logo
Business Software
Open Source Software
SourceForge Podcast
Resources
  • Articles
  • Case Studies
  • Blog
Menu
  • Help
  • Create
  • Join
  • Login
  • Home
  • Browse
  • OpenRocket
  • Bug reports
OpenRocket

third potential bug I found while running findBugs

Brought to you by: hcraigmiller, jjpfeifferjr, kruland2607, plaa, and 2 others
This project can now be found here.
  • Summary
  • Files
  • Reviews
  • Support
  • Mailing Lists
  • Tickets ▾
    • Feature requests
    • Bug reports
  • News
  • Code
Menu ▾ ▴
  • Create Ticket
  • View Stats

Group

  • Bug
  • Enhancement

Searches

  • Changes
  • Closed Tickets
  • Open Tickets

Help

  • Formatting Help

#22 third potential bug I found while running findBugs

Bug
open
nobody
Other (11)
5
2011-12-14
2011-12-14
Anonymous
No

OpenRocket Version: 1.1.9
I used a program called findBugs to look for potential bugs in the openRocket program. FindBugs looks for bugs in Java programs. It is based on the concept of bug patterns. A bug pattern is a code idiom that is often an error. Bug patterns arise for a variety of reasons:

Difficult language features
Misunderstood API methods
Misunderstood invariants when code is modified during maintenance
Garden variety mistakes: typos, use of the wrong boolean operator

Bug: Random object created and used only once in new net.sf.openrocket.simulation.SimulationOptions(Rocket)

private int randomSeed = new Random().nextInt();

and

public void randomizeSeed() {
this.randomSeed = new Random().nextInt();
//fireChangeEvent();
}

This code creates a java.util.Random object, uses it to generate one random number, and then discards the Random object. This produces mediocre quality random numbers and is inefficient. If possible, rewrite the code so that the Random objects is created once and saved, and each time a new random number is required.

Corrected by placing a Random object named randomObject at the top of the file and changed the randomizeSeed() method to use the object instead like so:
public void randomizeSeed() {
this.randomSeed = randomObject.nextInt();
// fireChangeEvent();
}

Discussion

  • Nobody/Anonymous

    Nobody/Anonymous - 2011-12-14
     
    openRocket patch 3.txt
    If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
SourceForge
  • Create a Project
  • Open Source Software
  • Business Software
  • Top Downloaded Projects
Company
  • About
  • Team
  • SourceForge Headquarters
    1320 Columbia Street Suite 310
    San Diego, CA 92101
    +1 (858) 422-6466
Resources
  • Support
  • Site Documentation
  • Site Status
  • SourceForge Reviews
SourceForge logo
© 2026 Slashdot Media. All Rights Reserved.
Terms Privacy Privacy Choices Advertise
Perplexity Logo perplexity computer
MongoDB Logo MongoDB