public void loadHamNSpam(Connection conn) throws java.sql.SQLException {
  PreparedStatement pstmt=null;
  ResultSet rs=null;
  try {
    pstmt=conn.prepareStatement(sqlQueries.getSqlString("selectHamTokens",true));
    rs=pstmt.executeQuery();
    Map<String,Integer> ham=getHamTokenCounts();
    while (rs.next()) {
      String token=rs.getString(1);
      int count=rs.getInt(2);
      if (count > 1) {
        ham.put(token,count);
      }
    }
    delegatedLog("Ham tokens count: " + ham.size());
    rs.close();
    pstmt.close();
    pstmt=conn.prepareStatement(sqlQueries.getSqlString("selectSpamTokens",true));
    rs=pstmt.executeQuery();
    Map<String,Integer> spam=getSpamTokenCounts();
    while (rs.next()) {
      String token=rs.getString(1);
      int count=rs.getInt(2);
      if (count > 1) {
        spam.put(token,count);
      }
    }
    delegatedLog("Spam tokens count: " + spam.size());
    rs.close();
    pstmt.close();
    pstmt=conn.prepareStatement(sqlQueries.getSqlString("selectMessageCounts",true));
    rs=pstmt.executeQuery();
    if (rs.next()) {
      setHamMessageCount(rs.getInt(1));
      setSpamMessageCount(rs.getInt(2));
    }
    rs.close();
    pstmt.close();
  }
  finally {
    if (rs != null) {
      try {
        rs.close();
      }
 catch (      java.sql.SQLException se) {
      }
      rs=null;
    }
    if (pstmt != null) {
      try {
        pstmt.close();
      }
 catch (      java.sql.SQLException se) {
      }
      pstmt=null;
    }
  }
}

public void loadHamNSpam ( Connection conn ) throws java . sql . SQLException { PreparedStatement pstmt = null ; ResultSet rs = null ; try { pstmt = conn . prepareStatement ( sqlQueries . getSqlString ( "selectHamTokens" , true ) ) ; rs = pstmt . executeQuery ( ) ; Map < String , Integer > ham = getHamTokenCounts ( ) ; while ( rs . next ( ) ) { String token = rs . getString ( 1 ) ; int count = rs . getInt ( 2 ) ; if ( count > 1 ) { ham . put ( token , count ) ; } } delegatedLog ( "Ham tokens count: " + ham . size ( ) ) ; rs . close ( ) ; pstmt . close ( ) ; pstmt = conn . prepareStatement ( sqlQueries . getSqlString ( "selectSpamTokens" , true ) ) ; rs = pstmt . executeQuery ( ) ; Map < String , Integer > spam = getSpamTokenCounts ( ) ; while ( rs . next ( ) ) { String token = rs . getString ( 1 ) ; int count = rs . getInt ( 2 ) ; if ( count > 1 ) { spam . put ( token , count ) ; } } delegatedLog ( "Spam tokens count: " + spam . size ( ) ) ; rs . close ( ) ; pstmt . close ( ) ; pstmt = conn . prepareStatement ( sqlQueries . getSqlString ( "selectMessageCounts" , true ) ) ; rs = pstmt . executeQuery ( ) ; if ( rs . next ( ) ) { setHamMessageCount ( rs . getInt ( 1 ) ) ; setSpamMessageCount ( rs . getInt ( 2 ) ) ; } rs . close ( ) ; pstmt . close ( ) ; } finally { if ( rs != null ) { try { rs . close ( ) ; } catch ( java . sql . SQLException se ) { } rs = null ; } if ( pstmt != null ) { try { pstmt . close ( ) ; } catch ( java . sql . SQLException se ) { } pstmt = null ; } } }
loads the token frequencies from the database .
