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

    +92.2

    1. 1
    UniqueNamesTableUtils.putPortletRequestIntoResourceRecordLazyLoadAdminTableModelInSession(portletrequest);

    Это IBM WebSphere Portal 6.0 - код является частью портлета, отвечающего за управление объектами портала (административный интерфейс).

    guest, 27 Февраля 2009

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

    +140.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
    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
    public String find(String request) {
        String result = "";
        status.setState(Status.STATUS_IN_PROGRESS);
        status.setMessage("search start");   
        buildTokens(request);
        if (buildWords()) {
            if (buildSynonyms()) {
                if (buildValues()) {
                    if (buildProperties()) {
                        if (buildParameters()) {
                            result = buildCondition();
                            status.setParameters(new ArrayList(parameters));
                            status.setState(Status.STATUS_SUCCESS);
                            status.setMessage("search done successfully");
                        } else {
                            status.setState(Status.STATUS_FAIL);
                            status.setMessage("can't build parameters");
                        }
                    } else {
                        status.setState(Status.STATUS_FAIL);
                        status.setMessage("can't build properties");
                    }
                } else {
                    status.setState(Status.STATUS_FAIL);
                    status.setMessage("can't build values");
                }
            } else {
                status.setState(Status.STATUS_FAIL);
                status.setMessage("can't build synonyms");
            }
        } else {
            status.setState(Status.STATUS_FAIL);
            status.setMessage("can't build words");
        }
        return result;
    }

    По мотивам http://www.govnokod.ru/593
    Ява суровей :)

    guest, 26 Февраля 2009

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

    +155

    1. 1
    2. 2
    3. 3
    if (!"list".equals(message.getString("response"))) {
        throw new IOException("Expected list response but got: " + message.toString());
    }

    принятие ответа от сервера

    guest, 20 Февраля 2009

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

    +139.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
    public enum TimePeriod {
    	
    	NONE,
    	DAILY,
    	WEEKLY,
    	MONTHLY,
    	YEARLY;
    	
    	public static TimePeriod getTimePeriod(String periodStr) {
    		if (null == periodStr) {
    			return null;
    		}
    		if (0 == periodStr.length()) {
    			return NONE;
    		}
    		if (0 == periodStr.compareToIgnoreCase("daily")) {
    			return DAILY;
    		}
    		if (0 == periodStr.compareToIgnoreCase("weekly")) {
    			return WEEKLY;
    		}
    		if (0 == periodStr.compareToIgnoreCase("monthly")) {
    			return MONTHLY;
    		}
    		if (0 == periodStr.compareToIgnoreCase("yearly")) {
    			return YEARLY;
    		}
    		return null;
    	}
    }

    а правильно будет так
    public static TimePeriod parse(String type) {
    return valueOf(type.toUpperCase());
    }

    guest, 20 Февраля 2009

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

    +140.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
    private String mPrimaryCorrelationKey;
     public String getPrimaryCorrelationKey()
      {
    	long current = System.currentTimeMillis();
    	current++;
    
    	return new Long(current).toString();
      }
    
      public void setPrimaryCorrelationKey(String mPrimaryCorrelationKey) {
    	  this.mPrimaryCorrelationKey = mPrimaryCorrelationKey;	  
      }

    соответствующий геттер для этой проперти должен возвращать всегда уникальный id

    guest, 19 Февраля 2009

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

    +143

    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
    public final class SqliteWrapper {
        private static final String SQLITE_EXCEPTION_DETAIL_MESSAGE
                    = "unable to open database file";
    
        ...
    
        // FIXME: need to optimize this method.
        private static boolean isLowMemory(SQLiteException e) {
            return e.getMessage().equals(SQLITE_EXCEPTION_DETAIL_MESSAGE);
        }
    
        ...
    }

    Android source

    guest, 19 Февраля 2009

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

    +145

    1. 1
    2. 2
    Field maxx, minx, maxy, miny = row.getFields().toArray(new Field[0])[0];
    minx = maxx = maxy = miny;

    Адская комбинация.

    guest, 10 Февраля 2009

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

    +64.6

    1. 1
    2. 2
    3. 3
    4. 4
    private static final int LENGHT255 = 255;
    private static final int LENGHT450 = 450;
    private static final int LENGHT3 = 3;
    private static final int LENGHT5 = 5;

    Константы для проставления длин в Entity.

    guest, 10 Февраля 2009

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

    +139

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    это твой щенок. теперь он твой навсегда.
    и ты не хочешь, но считаешь его дни и года.
    твоя любовь к нему огромна, с каждым днём она растёт.
    она станет бесконечной,
    когда он умрёт.

    для виолет_салмон

    guest, 09 Февраля 2009

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

    +81.3

    1. 1
    2. 2
    private final String zeroValueString="0";
    private final String sevenValueString="7";

    Если б можно, то ещё б и hundredElevenValueString = "111"; впиндюрили бы

    guest, 27 Января 2009

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