Code example for NoSuchPaddingException

Methods: printStackTrace

0
        } catch (NoSuchAlgorithmException e) {
            // TODO Auto-generated catch block 
            e.printStackTrace();
        } catch (NoSuchPaddingException e) {
            // TODO Auto-generated catch block 
            e.printStackTrace();
        } 
    } 
 
    public byte[] encrypt(String text) throws Exception
    { 
        if(text == null || text.length() == 0)
            throw new Exception("Empty string");
 
        byte[] encrypted = null;
 
        try { 
            cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec);
 
            encrypted = cipher.doFinal(padString(text).getBytes());
        } catch (Exception e)