Buggy code:
public class UserManager { private LayoutControl control ; private User actualUser ; public UserManager ( LayoutControl p_control ) { } public boolean checkForLogin ( String [ ] arg ) { } public boolean login ( String [ ] arg ) { boolean toReturn = false ; String name = arg [ 0 ] ; String surname = arg [ 1 ] ; String password = arg [ 2 ] ; String code = arg [ 3 ] ; for ( String t : arg ) { System . out . print ( ( t + "<seq2seq4repair_space>" ) ) ; } System . out . println ( "" ) ; if ( checkForLogin ( arg ) ) { String dbPath = "" ; String hash_password = "" ; String hash_code = "" ; try { hash_password = CryptoUtility . hash ( SHA1 , password ) ; hash_code = CryptoUtility . hash ( SHA1 , code ) ; } catch ( Exception e1 ) { e1 . printStackTrace ( ) ; } if ( control . IsSettingsPathNull ( ) ) { JFileChooser chooser = new JFileChooser ( ) ; chooser . setFileSelectionMode ( JFileChooser . DIRECTORIES_ONLY ) ; chooser . showOpenDialog ( null ) ; dbPath = chooser . getSelectedFile ( ) . getAbsolutePath ( ) ; control . setActualDbPath ( dbPath ) ; } else { control . setActualSettings ( control . getSettingsByCode ( hash_code ) ) ; dbPath = control . getActualDbPath ( ) ; } if ( ! ( HibernateUtil . isCreated ( ) ) ) { HibernateUtil . setDbPath ( dbPath ) ; <START_BUG> HibernateUtil . encryptDb ( password ) ; <END_BUG> HibernateUtil . createSession ( ) ; } Session session = HibernateUtil . getSessionFactory ( ) . openSession ( ) ; Transaction tx = null ; try { tx = session . beginTransaction ( ) ; String hql = "from<seq2seq4repair_space>User<seq2seq4repair_space>where<seq2seq4repair_space>name<seq2seq4repair_space>=<seq2seq4repair_space>:p_name<seq2seq4repair_space>and<seq2seq4repair_space>surname<seq2seq4repair_space>=<seq2seq4repair_space>:p_surname" ; Query query = session . createQuery ( hql ) ; query . setParameter ( "p_name" , name ) ; query . setParameter ( "p_surname" , surname ) ; List < User > result = query . list ( ) ; tx . commit ( ) ; if ( result . isEmpty ( ) ) { control . setErrorLayout ( "user<seq2seq4repair_space>doesn't<seq2seq4repair_space>exist" , "HOME" ) ; } else { for ( User u : result ) { System . out . println ( ( ( ( "check<seq2seq4repair_space>user<seq2seq4repair_space>code<seq2seq4repair_space>" + ( u . getCode ( ) ) ) + "<seq2seq4repair_space>equal<seq2seq4repair_space>insert<seq2seq4repair_space>code<seq2seq4repair_space>" ) + hash_code ) ) ; if ( u . getCode ( ) . equals ( hash_code ) ) { System . out . println ( ( ( ( "check<seq2seq4repair_space>user<seq2seq4repair_space>pwd<seq2seq4repair_space>" + ( u . getPassword ( ) ) ) + "<seq2seq4repair_space>equal<seq2seq4repair_space>insert<seq2seq4repair_space>pwd<seq2seq4repair_space>" ) + hash_password ) ) ; if ( u . getPassword ( ) . equals ( hash_password ) ) { System . out . println ( ( ( ( name + "<seq2seq4repair_space>" ) + surname ) + "<seq2seq4repair_space>is<seq2seq4repair_space>logging<seq2seq4repair_space>in." ) ) ; control . setActualSettings ( u . getDir_def ( ) , u . getDir_in ( ) , u . getDir_out ( ) , u . getDir_def ( ) ) ; actualUser = u ; toReturn = true ; } else System . out . println ( "password<seq2seq4repair_space>sbagliata." ) ; break ; } else System . out . println ( "codice<seq2seq4repair_space>sbagliato" ) ; } } } catch ( Exception e ) { if ( tx != null ) tx . rollback ( ) ; e . printStackTrace ( ) ; } finally { session . close ( ) ; HibernateUtil . shutdown ( ) ; HibernateUtil . encryptDb ( hash_password ) ; } } return toReturn ; } public void registration ( String [ ] registration_value ) { } private KeyPair getKey ( ) throws NoSuchAlgorithmException , NoSuchProviderException { } public boolean confirmPassword ( String password , String confirm_password ) { } public boolean checkPassword ( String password ) { } public boolean containsNumbers ( String password ) { } public boolean containsUppercase ( String password ) { } public boolean confirmMail ( String mail , String confirm_mail ) { } public static String generateCode ( Session session , String pbc_key ) { } public static boolean codeIsPresent ( String paramCode , Session session ) { } public User getActualUser ( ) { } public void setActualUser ( User actualUser ) { } public void printActualUser ( ) { } }

Fix:
HibernateUtil . decryptDb ( hash_password ) ;