Author: coheigea
Date: Thu Nov 14 14:34:55 2013
New Revision: 1541916

URL: http://svn.apache.org/r1541916
Log:
Doing the same for encryption

Modified:
    
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncrypt.java
    
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java

Modified: 
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncrypt.java
URL: 
http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncrypt.java?rev=1541916&r1=1541915&r2=1541916&view=diff
==============================================================================
--- 
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncrypt.java
 (original)
+++ 
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncrypt.java
 Thu Nov 14 14:34:55 2013
@@ -434,14 +434,6 @@ public class WSSecEncrypt extends WSSecE
                             WSSecurityException.ErrorCode.FAILED_ENCRYPTION, e
                     );
                 }
-                List<Attachment> attachments = 
attachmentRequestCallback.getAttachments();
-                if (attachments == null || attachments.isEmpty()) {
-                    throw new WSSecurityException(
-                            WSSecurityException.ErrorCode.FAILURE,
-                            "noEncElement"
-                    );
-                }
-
                 String attachmentEncryptedDataType;
                 if ("Element".equals(encPart.getEncModifier())) {
                     attachmentEncryptedDataType = 
WSConstants.SWA_ATTACHMENT_ENCRYPTED_DATA_TYPE_COMPLETE;
@@ -449,6 +441,7 @@ public class WSSecEncrypt extends WSSecE
                     attachmentEncryptedDataType = 
WSConstants.SWA_ATTACHMENT_ENCRYPTED_DATA_TYPE_CONTENT_ONLY;
                 }
 
+                List<Attachment> attachments = 
attachmentRequestCallback.getAttachments();
                 for (int i = 0; i < attachments.size(); i++) {
                     Attachment attachment = attachments.get(i);
 
@@ -744,4 +737,9 @@ public class WSSecEncrypt extends WSSecE
     public boolean isEmbedEncryptedKey() {
         return embedEncryptedKey;
     }
+
+    public List<Element> getAttachmentEncryptedDataElements() {
+        return attachmentEncryptedDataElements;
+    }
+
 }

Modified: 
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java
URL: 
http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java?rev=1541916&r1=1541915&r2=1541916&view=diff
==============================================================================
--- 
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java
 (original)
+++ 
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java
 Thu Nov 14 14:34:55 2013
@@ -173,14 +173,8 @@ public class EncryptOutputProcessor exte
                     WSSecurityException.ErrorCode.FAILURE, e
             );
         }
+        
         List<Attachment> attachments = 
attachmentRequestCallback.getAttachments();
-        if (attachments == null || attachments.isEmpty()) {
-            throw new WSSecurityException(
-                    WSSecurityException.ErrorCode.FAILURE,
-                    "noEncElement"
-            );
-        }
-
         for (int i = 0; i < attachments.size(); i++) {
             final Attachment attachment = attachments.get(i);
             final String attachmentId = attachment.getId();


Reply via email to