Welcome!

Craig Dewalt

Subscribe to Craig Dewalt: eMailAlertsEmail Alerts
Get Craig Dewalt via: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Top Stories by Craig Dewalt

Do you consider yourself a Java expert? Think you know everything about exception handling? Can you quickly spot the six exception handling problems below? 1: OutputStreamWriter out = ... 2: java.sql.Connection conn = ... 3: try { 5 4: Statement stat = conn.createStatement(); 5: ResultSet rs = stat.executeQuery( 6: "select uid, name from user"); 7: while (rs.next()) 8: { 9: out.println("User ID : " + rs.getString("uid") + 6 10: ", name : " + rs.getString("name")); 11: } 12: conn.close(); 3 13: out.close(); 14: } 15: catch(Exception ex) 2 16: { 17: ex.printStackTrace(); 1-4 18: } Every Java developer should be able to spot at least two. If you can't spot all six, read on. Rather than provide general guidelines (most of which are well known), we decided to reveal what we call anti-patterns: (unfortunately) common bad programming practices that we've seen time and again in Java... (more)