Смотритель: hubert
  • ,

Говнокод #6

private void setTims( String project )
{
    int endIndex = project.indexOf( "-" );
    boolean isNumber = false;
    if ( endIndex != -1 )
    {
        try
        {
            Integer.parseInt( project.substring( 0, endIndex ) );
            isNumber = true;
        }
        catch ( NumberFormatException e )
        {
            //ignore
        }
    }
    if ( isNumber )
    {
        runtimeContext.put( RuntimeContext.TIMS_NUMBER, project.substring( 0, endIndex ) );
    }
    else
    {
        runtimeContext.put( RuntimeContext.TIMS_NUMBER, project );
    }
}
  • ,

Говнокод #3

public static Date createDate(Integer iYear, Integer iMonth, Integer iDay) throws Exception
    {
        if ((!(iYear instanceof Integer))
                || (!(iMonth instanceof Integer))
                || (!(iDay instanceof Integer))
                )
        {
            throw new Exception();
        }

        Date date = null;
        String year, month, day;

        year = iYear.toString();
        month = iMonth.toString();
        day = iDay.toString();
        try
        {
            date = new SimpleDateFormat("yyyy/MM/dd").parse(year + "/" + month + "/" + day);

        } catch (ParseException e)
        {
            log.warn("Date transformation failed for year, month, day:  " + iYear + ", " + iMonth + ", " + iDay);
        }
        return date;
    }