Last week's Friday Smorgasbord seemed to work out fairly well, so here's another go at it. But unlike last week, this all comes from one person (Koumynyka) who has collected these Java snippets from code reviewes and by purising the source tree. Names changed to protect the guilty and wrapped in a class for fun ...

-- begin Horror.java  ---
/**
 * All code include in this class is REAL!
 */
public class Horror {

 public boolean compareObjects(Object obj1 , Object obj2) {
  if (obj1.equals(obj2) == true)
   return true;
  else
   return false;
 }
 
 public horribleBreakingLoops() {
  try {
   for (int i = 0; i < 100; i++) {
    if (i == 98) {
     // Yes, java does have 'break' to exit loops
     throw new Exception();
    }
   }
  } catch (Exception e) {}
 }

 public stringsHorror(String lastName) {
  if (lastName.charAt(0) == new String("*").charAt(0)
    || lastName.charAt(0) == new String("%").charAt(0)) {
   // here goes the code ;)
  }
 }
 
 protected int myHorrorIndex = new Integer("1").intValue();
  
 public long fearOfCastingHorror() {
  return System.currentTimeMillis() + new Double(Math.random()).longValue();
  //instead of return System.currentTimeMillis() + (long)Math.random();
 }
 
  /**
   * Does something
   *
   * @return Nothing
   */
  public void imTooBusyToAddJavadoc() {
  /**
   * The method 'imTooBusyToAddJavadoc' was written by my former subordinate. 
   * His code was comment-free, so I asked him to document his code with 
   * javadoc, which is used to build documentation of the class library. 
   * Obviously he added too-much javadoc ;)
   * /
  }
  
  public boolean checkIsNull(Object a) {
    if( !a.equals(null) ) {
      /// it's really kilin' me ;)
    }
  }
  
  int getHttpPort() throws IllegalArgumentException {
    /// and which is the illegal argument?
  }
}
-- end Horror.java  ---

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!