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

    +143.6

    1. 1
    2. 2
    3. 3
    4. 4
    if ("MOCK_CATEGORY".equals(esbCategoryName) && "MOCK_SERVICE".equals(esbServiceName)) 
    { 
       response = request; 
    }

    Исходник Jboss Jpdl

    guest, 05 Августа 2009

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

    +145.5

    1. 1
    2. 2
    String labOrderOrMrnParam = (null == order)
             ? order.getMayoAccessNumber() : order.getOrderNumber();

    Что же делать если объект - null

    guest, 26 Июля 2009

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

    +154

    1. 1
    return !( Pattern.compile("['\"`]+").matcher(query.subSequence(0, query.length())).matches());

    Шедевр проверки на запретные символы в запросе

    guest, 21 Июля 2009

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

    +134.9

    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
    // Объявлен класс GOSTDocument extends TechDocument ( ввожу в курс дела:) )
    
    public class TechDocument
    {
    
      protected TechDocument(){} //Ибо нефиг
    
      public TechDocument getDocumentA ( Type DocType )
    {
    
            TechDocument tmpl = null;
      switch (DocType)
      {
          case DOCTYPE_GOST : tmpl = (GOSTDocument) new GOSTDocument();
          break;
    // ... Тут еще CASE всякие
          default: tmpl = new TechDocument();
          break;
      }
      return tmpl;
    
    }
    
    }

    Как бы кастинг.:)

    guest, 21 Июля 2009

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

    +78.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
    if (choice==0)
                new Browser(null, display, this, this, false);
            
            if (choice==1)
                new Browser(null, display, this, this, true);
            
            if (choice==2)
                new Browser(null, display, this, this, false);
            
            if (choice==3)
                new Browser(null, display, this, this, true);
            
            if (choice==4)
                new Browser(null, display, this, this, false);
            
            if (choice==5)
                new Browser(null, display, this, this, true);
            
            if (choice==6)
                new Browser(null, display, this, this, false);
            
            if (choice==7)
                new Browser(null, display, this, this, true);

    Сохранить, загрузить, сохранить, загрузить...

    guest, 19 Июля 2009

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

    +146

    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
    /**
             * @see java.lang.Comparable#compareTo(java.lang.Object)
             */
            public int compareTo( HandValue pValue ) throws NullPointerException
            {
                    if(getCategory() == null || pValue.getCategory() == null || mTopCards == null)                
                            throw new NullPointerException();
                    
                    int toReturn = getCategory().compareTo(pValue.getCategory());
                    
                    if(toReturn != 0)
                            return toReturn;
                   
                    for(int i = 0; getCard(i) != null; i++)
                    {
                            toReturn = getCard(i).compareTo(pValue.getCard(i));
                            
                            if(toReturn != 0)
                                    return toReturn;
                    }
                    
                    return 0;
            }

    очень долго смеялся, увидев этот код.

    guest, 12 Июля 2009

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

    +89.1

    1. 1
    2. 2
    3. 3
    4. 4
    public boolean equals(Object o) {
        ErrorCode errorCode = (ErrorCode) o;
        return !(code != null ? !code.equals(errorCode.code) : errorCode.code != null);
    }

    бля. голову поломать можно

    guest, 10 Июля 2009

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

    +145.9

    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
    double dotProduct(double vec[]) {
            int k, m, v;
            double rtn;
    
            rtn = 0.0;
            k = vec.length / 4;
            m = vec.length % 4;
    
            v = 0;
            while ((k--) > 0) {
                rtn += vec[v];
                rtn += vec[v + 1];
                rtn += vec[v + 2];
                rtn += vec[v + 3];
                v += 4;
            }
    
            while ((m--) > 0) {
                rtn += vec[v];
                v++;
            }
    
            return rtn;}

    разбираю ocr-апплетик.. нашел вот такой интересный метод.. для лучшего восприятия говнокода, убрал одну переменную(было типа "+=vec1[v]*vec2[v]")

    guest, 09 Июля 2009

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

    +121.3

    1. 1
    2. 2
    3. 3
    public SaveOpenTemplate getThis() {
            return this;
        }

    Они это сделали!

    guest, 01 Июля 2009

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

    +145

    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
    /**
    	 * public static final int ARRAY 2003 public static final int BIGINT -5
    	 * public static final int BINARY -2 public static final int BIT -7 public
    	 * static final int BLOB 2004 public static final int BOOLEAN 16 public
    	 * static final int CHAR 1 public static final int CLOB 2005 public static
    	 * final int DATALINK 70 public static final int DATE 91 public static final
    	 * int DECIMAL 3 public static final int DISTINCT 2001 public static final
    	 * int DOUBLE 8 public static final int FLOAT 6 public static final int
    	 * INTEGER 4 public static final int JAVA_OBJECT 2000 public static final
    	 * int LONGVARBINARY -4 public static final int LONGVARCHAR -1 public static
    	 * final int NULL 0 public static final int NUMERIC 2 public static final
    	 * int OTHER 1111 public static final int REAL 7 public static final int REF
    	 * 2006 public static final int SMALLINT 5 public static final int STRUCT
    	 * 2002 public static final int TIME 92 public static final int TIMESTAMP 93
    	 * public static final int TINYINT -6 public static final int VARBINARY -3
    	 * public static final int VARCHAR 12
    	 */

    guest, 30 Июня 2009

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