1. Java / Говнокод #2124

    +86.5

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    /**
     * константы платежей
     *
     * @author eav
     */
    public interface PaymentsConstants {
    	// какие-то цифры %)
    	static final String _25 = "25";
    	static final String _21 = "21";
    	static final String _27 = "27";
    	static final String _26 = "26";
    	static final String _93 = "93";
    	static final String _78 = "78";
    	static final String _80 = "80";
    	static final String _98 = "98";
    	static final String _81 = "81";
    	static final String _13 = "13";
    	static final String _12 = "12";
    	static final String _95 = "95";
    	static final String _20 = "20";
    	static final String _23 = "23";
    	static final String _53 = "53";
    	static final String _112 = "112";
    
    	static final String _270900 = "270900";
    	static final String _2710 = "2710";
    	static final String _2711210000 = "2711210000";
    	static final String _4907001010 = "4907001010";
    	static final String _4820409000 = "4820409000";
    	static final String _4907009000 = "4907009000";
    
    	// страны
    	static final String TM = "TM";
    	static final String AM = "AM";
    	static final String TJ = "TJ";
    	static final String UZ = "UZ";
    	static final String KG = "KG";
    	static final String AZ = "AZ";
    	static final String GE = "GE";
    	static final String UA = "UA";
    	static final String MD = "MD";
    	static final String BY = "BY";
    	static final String KZ = "KZ";
    
    	static final String ВРЕМ = "Врем";
    	static final String КОМП = "Комп";
    	static final String ДЕМП = "Демп";
    	static final String АКЦИЗ = "Акциз";
    
    	static final String УН = "УН";
    	static final String ИП = "ИП";
    
    	// импорт/экспорт
    	static final String ЭК = "ЭК";
    	static final String ИМ = "ИМ";
    }

    Тихий ужас...

    ctepx, 11 Ноября 2009

    Комментарии (13)
  2. Java / Говнокод #2101

    +77.2

    1. 1
    2. 2
    3. 3
    4. 4
    public static long hash(URL url) {
    	FNV1 fnv; (fnv = new FNV1a32()).init(url.toExternalForm());
    	return fnv.getHash();
    }

    Какой читаемый код... :)

    ShadowX, 05 Ноября 2009

    Комментарии (16)
  3. Java / Говнокод #2100

    +75.4

    1. 1
    <many-to-one name="nurseSex" entity-ref="sex" title="Пол ухаживающего"/>

    Атрибут "title" развеял все мои фантазии о сексе с медсестрой :)

    eveel, 05 Ноября 2009

    Комментарии (3)
  4. Java / Говнокод #2050

    +77.3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    // Год и месяц редактируются как Double, а хранятся в  базе как два инта
                    if (aValue == null) {
                        current.setStartMonth(0);
                        current.setStartMonth(0);
                    } else {
                        current.setStartMonth(Integer.parseInt(aValue.toString().split(".")[0]));
                        current.setStartMonth(Integer.parseInt(aValue.toString().split(".")[1]));
                    }

    Программисты клиента и базы стоят один другого

    Jk, 27 Октября 2009

    Комментарии (2)
  5. Java / Говнокод #2036

    +79.8

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    String _desc = postParams.get( "description" );
    
    if (_desc == null)
        _desc = "Merchant payment";
    
    _desc = _desc.replace("%20", " ");
    _desc = _desc.replace("%21", "!");
    _desc = _desc.replace("%22", "\"");
    _desc = _desc.replace("%23", "#");
    _desc = _desc.replace("%24", "$");
    _desc = _desc.replace("%25", "%");
    _desc = _desc.replace("%26", "&");
    _desc = _desc.replace("%27", "'");
    _desc = _desc.replace("%28", "(");
    _desc = _desc.replace("%29", ")");
    _desc = _desc.replace("%2A", "*");
    _desc = _desc.replace("%2B", "+");
    _desc = _desc.replace("%2C", ",");
    _desc = _desc.replace("%2D", "-");
    _desc = _desc.replace("%2E", ".");
    _desc = _desc.replace("%2F", "/");
    _desc = _desc.replace("%3A", ":");
    _desc = _desc.replace("%3B", ";");
    _desc = _desc.replace("%3C", "<");
    _desc = _desc.replace("%3D", "=");
    _desc = _desc.replace("%3E", ">");
    _desc = _desc.replace("%3F", "?");
    _desc = _desc.replace("%40", "@");
    _desc = _desc.replace("%5B", "[");
    _desc = _desc.replace("%5C", "\\");
    _desc = _desc.replace("%5D", "]");
    _desc = _desc.replace("%5E", "^");
    _desc = _desc.replace("%5F", "_");
    _desc = _desc.replace("%60", "`");
    _desc = _desc.replace("%7B", "{");
    _desc = _desc.replace("%7C", "|");
    _desc = _desc.replace("%7D", "}");
    _desc = _desc.replace("%7E", "~");

    Разработчики java.net.URLDecoder были идиотами. Напишем КРУЧЕ!

    spbAngel, 24 Октября 2009

    Комментарии (8)
  6. Java / Говнокод #2035

    +72.6

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    TransferInfo info = new QiwiTransferInfo();
    
    if( command.equalsIgnoreCase( "pay" ) )
    {
        ( ( QiwiTransferInfo ) info ).setCommand( QiwiCommand.PAY );
        ( ( QiwiTransferInfo ) info ).setTxnDate( request.getParameter( "txn_date" ) );
    }
    else
    {
        ( ( QiwiTransferInfo ) info ).setCommand( QiwiCommand.CKECK );
    }
    
    ( ( QiwiTransferInfo ) info ).setAmout( Double.parseDouble( amount ) );
    ( ( QiwiTransferInfo ) info ).setTxnId( txn_id );
    ( ( QiwiTransferInfo ) info ).setAccount( account );
    ( ( QiwiTransferInfo ) info ).setCurrency( Currency.getInstance( "RUB" ) );

    C другой стороны, я никогда не могу предсказать что же вернет конструктор...

    spbAngel, 24 Октября 2009

    Комментарии (0)
  7. Java / Говнокод #2031

    +72.2

    1. 1
    assert ( false );

    Найдено в глубинах кода :)

    generalgda, 23 Октября 2009

    Комментарии (4)
  8. Java / Говнокод #2016

    +75.2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    boolean isCustomerWMIDExists = containParameterWithName( request, CUSTOMER_WMID_PARAM_NAME );
    boolean isSellerWMIDExists = containParameterWithName( request, SELLER_WMID_PARAM_NAME );
    boolean isPurseExists = containParameterWithName( request, PURSE_PARAM_NAME );
    boolean isDescriptionExists = containParameterWithName( request, BasePaymentSystem.DESCRIPTION_PARAM_NAME );
    boolean isInvAddressExists = containParameterWithName( request, INVADDRESS_PARAM_NAME );
    boolean isPeriodExists = containParameterWithName( request, PERIOD_PARAM_NAME );
    boolean isExperationExists = containParameterWithName( request, EXPERATION_PARAM_NAME );
    boolean isDateCrtExists = containParameterWithName( request, DATECRT_PARAM_NAME );
    boolean isDateUpdExists = containParameterWithName( request, DATEUPD_PARAM_NAME );
    boolean isWmInvIdExists = containParameterWithName( request, INVID_PARAM_NAME );
    boolean isRequestNExists = containParameterWithName( request, REQUESTN_PARAM_NAME );
    boolean isProjectIdExists = containParameterWithName( request, BasePaymentSystem.PROJECTID_PARAM_NAME );
    boolean isUserIdExists = containParameterWithName( request, BasePaymentSystem.USERID_PARAM_NAME );
    boolean isCurrencyExists = containParameterWithName( request, CURRENCY_PARAM_NAME );
    
    if (isCustomerWMIDExists && isSellerWMIDExists && isPurseExists && isDescriptionExists && isInvAddressExists && isPeriodExists
    		&& isExperationExists && isDateCrtExists && isDateUpdExists && isWmInvIdExists && isRequestNExists && isProjectIdExists
    		&& isUserIdExists && isCurrencyExists)
    {
    	wminfo.setCustomerWMID( request.getParameter( CUSTOMER_WMID_PARAM_NAME ) );
    	wminfo.setSellerWMID( request.getParameter( SELLER_WMID_PARAM_NAME ) );
    	wminfo.setPurse( request.getParameter( PURSE_PARAM_NAME ) );
    	wminfo.setDescription( request.getParameter( BasePaymentSystem.DESCRIPTION_PARAM_NAME ) );
    	wminfo.setInvAddress( request.getParameter( INVADDRESS_PARAM_NAME ) );
    	wminfo.setPeriod( Byte.parseByte( request.getParameter( PERIOD_PARAM_NAME ) ) );
    	wminfo.setExperation( Byte.parseByte( request.getParameter( EXPERATION_PARAM_NAME ) ) );
    	wminfo.setDateCrt( ( getWebMoneyDateString( Long.parseLong( request.getParameter( DATECRT_PARAM_NAME ) ) ) ) );
    	wminfo.setDateUpd( ( getWebMoneyDateString( Long.parseLong( request.getParameter( DATEUPD_PARAM_NAME ) ) ) ) );
    
    	wminfo.setWmInvID( request.getParameter( INVID_PARAM_NAME ) );
    	wminfo.setRequestN( Long.parseLong( request.getParameter( REQUESTN_PARAM_NAME ) ) );
    	wminfo.setCurrency( Currency.getInstance( request.getParameter( CURRENCY_PARAM_NAME ) ) );
    	...
    }

    Разбор параметров GET-запроса, переданных из http://govnokod.ru/2015
    // не дай бог, начальство заметит, что я рабочий код публикую

    spbAngel, 21 Октября 2009

    Комментарии (13)
  9. Java / Говнокод #2015

    +80.4

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    StringBuilder sb = new StringBuilder();
    
    sb.append( "?" + BasePaymentSystem.CHECKPAYMENT_PARAM_NAME + "=true&" + WebMoneyXmlSystem.CUSTOMER_WMID_PARAM_NAME + "="
    		+ getCustomerWMID() + "&" + WebMoneyXmlSystem.CURRENCY_PARAM_NAME + "=" + getCurrency().toString() + "&"
    		+ WebMoneyXmlSystem.SELLER_WMID_PARAM_NAME + "=" + _sellerWMID + "&" + WebMoneyXmlSystem.PURSE_PARAM_NAME + "=" + _purse
    		+ "&" + WebMoneyXmlSystem.DESCRIPTION_PARAM_NAME + "=" + getDescription() + "&" + WebMoneyXmlSystem.INVADDRESS_PARAM_NAME
    		+ "=" + _invAddress + "&" + WebMoneyXmlSystem.PERIOD_PARAM_NAME + "=" + _period + "&"
    		+ WebMoneyXmlSystem.EXPERATION_PARAM_NAME + "=" + _experation + "&" + WebMoneyXmlSystem.DATECRT_PARAM_NAME + "="
    		+ dateCreateMills.toString() + "&" + WebMoneyXmlSystem.DATEUPD_PARAM_NAME + "=" + dateUpdateMills.toString() + "&wmInvId="
    		+ _wmInvId + "&requestN=" + String.valueOf( _requestn ) + "&" + BasePaymentSystem.PROJECTID_PARAM_NAME + "="
    		+ _projectId.toString() + "&" + BasePaymentSystem.USERID_PARAM_NAME + "=" + _userId.toString() );
    
    return new String( sb );

    Формирование строки GET запроса.

    spbAngel, 21 Октября 2009

    Комментарии (9)
  10. Java / Говнокод #2013

    +77.5

    1. 1
    2. 2
    3. 3
    4. 4
    //devPin и pin - массивы байт, а сравниваем мы их так :
    
    if (Utils.bytesToHex(devPin).equals(Utils.bytesToHex(pin))) {
    ....

    :)))

    tuba.linux, 21 Октября 2009

    Комментарии (2)