Package com.stimulus.archiva.exception

Examples of com.stimulus.archiva.exception.MessageStoreException


     * @param decrypt Should decrypt message
     * @return An inputstream containing the message
     */ 
   public InputStream getRawMessageInputStream(File messageFile, boolean decompress, boolean decryptthrows IOException,MessageStoreException {
       if (messageFile==null )
           throw new MessageStoreException("assertion failure: null messageFileName",logger);

       InputStream is = new BufferedInputStream(new FileInputStream(messageFile));
       Cipher dcipher = null;
       if(decrypt) {
           try {
             
               dcipher = Cipher.getInstance(key.getAlgorithm());
               dcipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
         } catch (Exception e) {
               throw new MessageStoreException("failed to initialize cipher. cause:",e,logger);
           }
           is = new CipherInputStream(is,dcipher);
       }

       if(decompress)
View Full Code Here


     * @return An outputstream directed to the message
     */ 
  
   public OutputStream getRawMessageOutputStream(File messageFile,boolean compress, boolean encrypt) throws IOException,MessageStoreException {
       if (messageFile==null)
           throw new MessageStoreException("assertion failure: null messageFileName",logger);

       OutputStream os = new BufferedOutputStream(new FileOutputStream(messageFile));
       Cipher ecipher = null;
       if (encrypt) {
           try {
               ecipher = Cipher.getInstance(key.getAlgorithm());
               ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);
           } catch (Exception e) {
                logger.fatal("Please ensure you have the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files installed.");
                logger.fatal("Visit http://java.sun.com2/javase/downloads/index.jsp to download them.");
                throw new MessageStoreException("failed to initalize cipher. Cause:",e,logger);
           }
           os = new CipherOutputStream(os,ecipher);
       }


View Full Code Here

            try {
        if (os != null) os.close();
        if (is != null) is.close();
      } catch (Exception e) {}
    } catch (Exception ex) {
      throw new MessageStoreException("failed to write corrupted email to quarantine:"+ex.getMessage(),ex,logger);
    }
   
  }
View Full Code Here

    logger.debug("getAttachmentFilePath() {"+volume+",hash='"+hash+"'}");
    File attachFile = getFileFromHashValue(volume, hash,attachmentFileExtension);
    if (!attachFile.exists()) {
      attachFile = getLegacyFileFromHashValue(volume,hash,3,attachmentFileExtension);
      if (!attachFile.exists()) {
        throw new MessageStoreException("attachment does not exist {attachFile='"+attachFile.getAbsolutePath()+"'}",logger,Level.DEBUG);
      }
    }
    return attachFile;
  }
View Full Code Here

               file.renameTo(File.createTempFile("ma", "tmp"));
               Config.getFileSystem().getTempFiles().markForDeletion(file);
             } catch (Exception e3) {}
              }
      }
      throw new MessageStoreException("failed to write email {filename='"+file.getAbsolutePath()+"'",e,logger);
    }
    /*
    try {
      //System.out.println("WRITEMAIL:"+message.getContent()+"XXXXXXXXXXXXXXXXXXXXXX"); 
      FileOutputStream fos2 = new FileOutputStream("c:\\test.eml");
View Full Code Here

               Cipher cipher = Cipher.getInstance(key.getAlgorithm());
               cipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);
               byte[] outputBytes = cipher.doFinal(password.getBytes("UTF-8"));
               return Base64.encodeToString(outputBytes,false);
          } catch (java.security.NoSuchAlgorithmException e)  {
              throw new MessageStoreException("failed to locate desired encryption algorithm {algorithm='"+Config.getConfig().getPBEAlgorithm()+"'",logger);
          } catch (Exception e) {
              throw new MessageStoreException(e.toString(),e,logger);
          }
   }
View Full Code Here

            cipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
            byte[] base64DecodedData = Base64.decodeFast(password);
            byte[] outputBytes = cipher.doFinal(base64DecodedData);
            return new String(outputBytes);
       } catch (java.security.NoSuchAlgorithmException e)  {
           throw new MessageStoreException("failed to locate desired encryption algorithm {algorithm='"+Config.getConfig().getPBEAlgorithm()+"'",logger);
       } catch (Exception e) {
           throw new MessageStoreException(e.toString(),e,logger);
      
     }
View Full Code Here

TOP

Related Classes of com.stimulus.archiva.exception.MessageStoreException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.