- 1
 - 2
 - 3
 - 4
 - 5
 - 6
 - 7
 - 8
 - 9
 
Maven
<dependency>
    <groupId>javax.validation</groupId>
    <artifactId>validation-api</artifactId>
    <version>1.0.0.GA</version>
    <classifier>sources</classifier>
    <scope>provided</scope>
</dependency>
                                    Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Всего: 2
−4
Maven
<dependency>
    <groupId>javax.validation</groupId>
    <artifactId>validation-api</artifactId>
    <version>1.0.0.GA</version>
    <classifier>sources</classifier>
    <scope>provided</scope>
</dependency>
                                    Кто-то изобретательный прицепил исходники библиотеки к проекту таким способом, чтобы переходить к ним при разработке.
−26
public String encrypt(String str) {
    try {
        CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
        ClassPathResource cpr = new ClassPathResource("beeline_cert.cer");
        FileInputStream certFile = new FileInputStream(cpr.getFile());
        java.security.cert.Certificate certificate = certificateFactory.generateCertificate(certFile);
        certFile.close();
        ecipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
        ecipher.init(Cipher.ENCRYPT_MODE, certificate);
        // Encode the string into bytes using utf-8
        byte[] utf8 = str.getBytes("UTF8");
        // Encrypt
        byte[] enc = ecipher.doFinal(utf8);
        // Encode bytes to base64 to get a string
        logger.debug("Base64.encodeBase64URLSafeString " + Base64.encodeBase64URLSafeString(enc));
        return Base64.encodeBase64URLSafeString(enc);
    } catch (FileNotFoundException e) {
        logger.error("FileNotFoundException", e);
    } catch (CertificateException e) {
        logger.error("CertificateException", e);
    } catch (NoSuchAlgorithmException e) {
        logger.error("NoSuchAlgorithmException", e);
    } catch (NoSuchPaddingException e) {
        logger.error("NoSuchPaddingException", e);
    } catch (BadPaddingException e) {
        logger.error("BadPaddingException", e);
    } catch (IllegalBlockSizeException e) {
        logger.error("IllegalBlockSizeException", e);
    } catch (InvalidKeyException e) {
        logger.error("InvalidKeyException", e);
    } catch (IOException e) {
        logger.error("IOException", e);
    }
    return null;
}
                                    Нашел такой кладезь в одном из legacy-проектов. Книжку можно писать с таких примеров.