<commit_before>package com.dreamoval.motech.core.dao.hibernate;

import com.dreamoval.motech.core.dao.MessageRequestDAO;
import com.dreamoval.motech.core.model.MStatus;
import com.dreamoval.motech.core.model.MessageRequest;
import com.dreamoval.motech.core.model.MessageRequestImpl;
import java.util.Date;
import java.util.List;
import org.apache.log4j.Logger;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.LogicalExpression;
import org.hibernate.criterion.Restrictions;

/**
 *  MessageRequestDAOImpl is the implementation class of the MessageRequestDAO interface
 * This Class implements only MessageRequestDAO specific persistent operation to the MessageRequest F model.
 *  Date : Sep 25, 2009
 * @author <NAME> (<EMAIL>)
 */
public class MessageRequestDAOImpl extends HibernateGenericDAOImpl<MessageRequestImpl> implements MessageRequestDAO<MessageRequestImpl> {

    private static Logger logger = Logger.getLogger(MessageRequestDAOImpl.class);

    public MessageRequestDAOImpl() {
    }

    /**
     * @see  {@link com.dreamoval.motech.core.dao.MessageRequestDAO#getMsgRequestByStatusAndSchedule(com.dreamoval.motech.core.model.MStatus, java.util.Date)  }
     */
    public List getMsgRequestByStatusAndSchedule(MStatus status, Date schedule) {
        logger.info("getMsgRequestByStatusAndSchedule");
        logger.debug(status);
        logger.debug(schedule);

        try {
            Session sess = this.getDBSession().getSession();
            List msgRequest = sess.createCriteria(this.getPersistentClass())
                    .add(Restrictions.eq("status", status))
                    .add(Restrictions.lt("dateFrom", schedule))
                    .add(Restrictions.gt("dateTo", schedule))
                    .list();
            logger.debug(msgRequest);
            return msgRequest;

        } catch (HibernateException he) {
            logger.debug("Persistence or JDBC Exception in Method getMsgRequestByStatusAndSchedule", he);
            return null;
        } catch (Exception ex) {
            logger.debug("Exception in Method getMsgRequestByStatusAndSchedule", ex);
            return null;
        }

    }

    /**
     * @see  {@link com.dreamoval.motech.core.dao.MessageRequestDAO#getMsgRequestByStatusAndTryNumber(com.dreamoval.motech.core.model.MStatus, int)   }
     */
    public List getMsgRequestByStatusAndTryNumber(MStatus status, int tryNumber) {
        logger.info("getMsgRequestByStatusAndTryNumber");
        logger.debug(status);
        logger.debug(tryNumber);
        try {

            Session session = this.getDBSession().getSession();
            Criterion eqStatus = Restrictions.eq("status", status);
            Criterion leTrynumb = Restrictions.le("tryNumber", tryNumber);
            LogicalExpression exp = Restrictions.and(eqStatus, leTrynumb);
            List msgRequest = session.createCriteria(this.getPersistentClass()).add(exp).list();

            logger.debug(msgRequest);
            return msgRequest;
        } catch (HibernateException he) {
            logger.debug("Persistence or JDBC Exception in Method getMsgRequestByStatusAndTryNumber", he);
            return null;
        } catch (Exception ex) {
            logger.debug("Exception in Method getMsgRequestByStatusAndTryNumber", ex);
            return null;
        }

    }

    public List<MessageRequest> getMsgByStatus(MStatus status) {
         logger.info("getMsgRequestByStatusAndTryNumber");
        logger.debug(status);

//        try {

            Session session = this.getDBSession().getSession();
            Criterion eqStatus = Restrictions.eq("status", status);
            List msgRequest = session.createCriteria(this.getPersistentClass()).add(eqStatus).list();

            logger.debug(msgRequest);
            return msgRequest;
//        } catch (HibernateException he) {
//            logger.debug("Persistence or JDBC Exception in Method getMsgRequestByStatusAndTryNumber", he);
//            return null;
//        } catch (Exception ex) {
//            logger.debug("Exception in Method getMsgRequestByStatusAndTryNumber", ex);
//            return null;
//        }

    }
}
<commit_msg>Formated MessageRequestDAOImpl and added try and catch block and appropriate logging features<commit_after>package com.dreamoval.motech.core.dao.hibernate;

import com.dreamoval.motech.core.dao.MessageRequestDAO;
import com.dreamoval.motech.core.model.MStatus;
import com.dreamoval.motech.core.model.MessageRequest;
import com.dreamoval.motech.core.model.MessageRequestImpl;
import java.util.Date;
import java.util.List;
import org.apache.log4j.Logger;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.LogicalExpression;
import org.hibernate.criterion.Restrictions;

/**
 *  MessageRequestDAOImpl is the implementation class of the MessageRequestDAO interface
 * This Class implements only MessageRequestDAO specific persistent operation to the MessageRequest F model.
 *  Date : Sep 25, 2009
 * @author <NAME> (<EMAIL>)
 */
public class MessageRequestDAOImpl extends HibernateGenericDAOImpl<MessageRequestImpl> implements MessageRequestDAO<MessageRequestImpl> {

    private static Logger logger = Logger.getLogger(MessageRequestDAOImpl.class);

    public MessageRequestDAOImpl() {
    }

    /**
     * @see  {@link com.dreamoval.motech.core.dao.MessageRequestDAO#getMsgRequestByStatusAndSchedule(com.dreamoval.motech.core.model.MStatus, java.util.Date)  }
     */
    public List getMsgRequestByStatusAndSchedule(MStatus status, Date schedule) {
        logger.debug("variables passed to getMsgRequestByStatusAndSchedule. status: " + status + "And schedule: " + schedule);


        try {
            Session sess = this.getDBSession().getSession();
            List msgRequest = sess.createCriteria(this.getPersistentClass())
                    .add(Restrictions.eq("status", status))
                    .add(Restrictions.lt("dateFrom", schedule))
                    .add(Restrictions.gt("dateTo", schedule))
                    .list();
            logger.debug(msgRequest);
            return msgRequest;

        } catch (HibernateException he) {
            logger.error("Persistence or JDBC Exception in Method getMsgRequestByStatusAndSchedule", he);
            return null;
        } catch (Exception ex) {
            logger.error("Exception in Method getMsgRequestByStatusAndSchedule", ex);
            return null;
        }

    }

    /**
     * @see  {@link com.dreamoval.motech.core.dao.MessageRequestDAO#getMsgRequestByStatusAndTryNumber(com.dreamoval.motech.core.model.MStatus, int)   }
     */
    public List getMsgRequestByStatusAndTryNumber(MStatus status, int tryNumber) {
   
        logger.debug("variables passed to getMsgRequestByStatusAndTryNumber.status " + status + "And tryNumber: " + tryNumber);

        try {

            Session session = this.getDBSession().getSession();
            Criterion eqStatus = Restrictions.eq("status", status);
            Criterion leTrynumb = Restrictions.le("tryNumber", tryNumber);
            LogicalExpression exp = Restrictions.and(eqStatus, leTrynumb);
            List msgRequest = session.createCriteria(this.getPersistentClass()).add(exp).list();

            logger.debug(msgRequest);
            return msgRequest;
        } catch (HibernateException he) {
            logger.error("Persistence or JDBC Exception in Method getMsgRequestByStatusAndTryNumber", he);
            return null;
        } catch (Exception ex) {
            logger.error("Exception in Method getMsgRequestByStatusAndTryNumber", ex);
            return null;
        }

    }

    public List<MessageRequest> getMsgByStatus(MStatus status) {
   
        logger.debug("variable passed to getMsgRequestByStatusAndTryNumber. status: " + status);

        try {

            Session session = this.getDBSession().getSession();
            Criterion eqStatus = Restrictions.eq("status", status);
            List msgRequest = session.createCriteria(this.getPersistentClass())
                    .add(eqStatus)
                    .list();

            logger.debug(msgRequest);
            return msgRequest;
        } catch (HibernateException he) {
            logger.error("Persistence or JDBC Exception in Method getMsgRequestByStatusAndTryNumber", he);
            return null;
        } catch (Exception ex) {
            logger.error("Exception in Method getMsgRequestByStatusAndTryNumber", ex);
            return null;
        }

    }
}

{'fraction_non_alphanumeric': 0.09705372616984402, 'fraction_numerical': 0.0016175621028307336, 'mean_word_length': 2.9381255686988172, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4560798', 'n_tokens_mistral': 2394, 'n_tokens_neox': 2278, 'n_words': 474}