A Teoria da Janela Quebrada

Achei um artigo interessante: http://www.codinghorror.com/blog/2005/06/the-broken-window-theory.html

Don’t leave “broken windows” (bad designs, wrong decisions, or poor code) unrepaired. Fix each one as soon as it is discovered. If there is insufficient time to fix it properly, then board it up. Perhaps you can comment out the offending code, or display a “Not Implemented” message, or substitute dummy data instead. Take some action to prevent further damage and to show that you’re on top of the situation.

We’ve seen clean, functional systems deteriorate pretty quickly once windows start breaking. There are other factors that can contribute to software rot, and we’ll touch on some of them elsewhere, but neglect accelerates the rot faster than any other factor.


Java – SQLServerException: Connection reset by peer

Hoje encontrei problemas ao conectar no SQL Server, sem motivos aparentes. Testei a conexão no SQL Server Management Studio e funcionou normalmente.

Depurando a aplicação encontrei as seguintes exceções:

  • com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset by peer: socket write error
  • java.security.NoSuchAlgorithmException: Could not create cipher AES/256
  • java.security.InvalidKeyException: Illegal key size
  • O driver não pôde estabelecer uma conexão segura com o SQL Server usando a criptografia SSL

Para corrigir o problema, baixe o Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. Copie os arquivos local_policy.jar e US_export_policy.jar para a pasta jre\lib\security. No meu caso, são duas:

  • C:\Program Files\Java\jdk1.7.0_17\jre\lib\security
  • C:\Program Files (x86)\Java\jre7\lib\security

Fonte: http://stackoverflow.com/questions/6900542/java-security-invalidkeyexception-illegal-key-size