title: Exception in Base64 decoding?
body: <p>I encountered a problem decoding text files.</p>
  
  <p>Encryption works, but when the program is restarted, decryption throws an exception. The same similar <code>Exception</code> was thrown with <code>apache.common.Base64</code>.
  Maybe someone knows how to solve this?</p>
  
  <pre><code>private String decrypt(String encrypted) throws Exception {
      Cipher cipher = getCipher(Cipher.DECRYPT_MODE);
      //byte[] plainBytes = cipher.doFinal(Base64.decodeBase64(encrypted));
  
      /*this line throw an exception*/                                      
      byte[] plainBytes = cipher.doFinal(Base64.getDecoder().decode(encrypted));
  
      return new String(plainBytes);
  }
  
  private Cipher getCipher(int cipherMode) throws Exception {
      String encryptionAlgorithm = "AES";
      SecretKeySpec keySpecification = new SecretKeySpec(
              encryptionKey.getBytes("UTF-8"), encryptionAlgorithm);
      Cipher cipher = Cipher.getInstance(encryptionAlgorithm);
      cipher.init(cipherMode, keySpecification);
  
      return cipher;
  }
  
  
  
  
  Exception in thread "main" java.lang.NullPointerException
  at java.util.Base64$Decoder.decode(Base64.java:549)
  at edmaker.EdMaker.decrypt(EdMaker.java:148)
  </code></pre>
  
  <p>Listening on javadebug
  Not able to submit breakpoint MethodBreakpoint [fsiteratetest.FsIterateTest$1].visitFile '(Ljava/nio/file/Path;LBasicFileAttributes;)Ljava/nio/file/FileVisitResult;', reason: Breakpoint belongs to disabled source root 'C:\Users\win7p\Documents\NetBeansProjects\FsIterateTest\src'. See Window/Debugging/Sources.
  User program running
  User program stopped
  Debugger stopped on uncompilable source code.
  User program running
  User program finished</p>