Skip to main content
2 of 3
deleted 54 characters in body
Jamal
  • 34.9k
  • 13
  • 133
  • 237
  1. Try to minimize the scope of local variables. It's not necessary to declare them at the beginning of the method, declare them where they are first used.

See Effective Java, Second Edition, Item 45: Minimize the scope of local variables. (Google for "minimize the scope of local variables", it's on Google Books too.))

  1. The m_ prefix is unnecessary and uncommon in the Java world. See Effective Java, 2nd edition, Item 56: Adhere to generally accepted naming conventions

  2. The sendMail method should validate its input parameters. Does it make sense if the form, to etc. is null or empty string? If not, check it and throw a NullPointerException or an IllegalArgumentException. (Effective Java, Second Edition, Item 38: Check parameters for validity)

palacsint
  • 29.9k
  • 9
  • 81
  • 156