Buggy code:
public class Email { private Recipient fromRecipient ; private Recipient replyToRecipient ; private String text ; private String textHTML ; private String subject ; private final List < Recipient > recipients ; private final List < AttachmentResource > embeddedImages ; private final List < AttachmentResource > attachments ; private final Map < String , String > headers ; private boolean applyDKIMSignature = false ; private InputStream dkimPrivateKeyInputStream ; private String signingDomain ; private String selector ; public Email ( ) { } public void signWithDomainKey ( final byte [ ] dkimPrivateKey , final String signingDomain , final String selector ) { signWithDomainKey ( new ByteArrayInputStream ( dkimPrivateKey ) , signingDomain , selector ) ; } public void signWithDomainKey ( final File dkimPrivateKeyFile , final String signingDomain , final String selector ) { } public void signWithDomainKey ( final InputStream dkimPrivateKeyInputStream , final String signingDomain , final String selector ) { } public void setFromAddress ( final String name , final String fromAddress ) { } public void setReplyToAddress ( final String name , final String replyToAddress ) { } public void setSubject ( final String subject ) { } public void setText ( final String text ) { } public void setTextHTML ( final String textHTML ) { } public void addRecipient ( final String name , final String address , final RecipientType type ) { } public void addEmbeddedImage ( final String name , final byte [ ] data , final String mimetype ) { } public void addEmbeddedImage ( final String name , final DataSource imagedata ) { } public void addHeader ( final String name , final Object value ) { } public void addAttachment ( final String name , final byte [ ] data , final String mimetype ) { } public void addAttachment ( final String name , final DataSource filedata ) { } public Recipient getFromRecipient ( ) { } public Recipient getReplyToRecipient ( ) { } public String getSubject ( ) { } public String getText ( ) { } public String getTextHTML ( ) { } public List < AttachmentResource > getAttachments ( ) { } public List < AttachmentResource > getEmbeddedImages ( ) { } public List < Recipient > getRecipients ( ) { } public Map < String , String > getHeaders ( ) { } public boolean isApplyDKIMSignature ( ) { } public InputStream getDkimPrivateKeyInputStream ( ) { } public String getSigningDomain ( ) { } public String getSelector ( ) { } @ Override public int hashCode ( ) { } @ Override public boolean equals ( Object o ) { } @ Override public String toString ( ) { } public static class Builder { private Recipient fromRecipient ; private Recipient replyToRecipient ; private String text ; private String textHTML ; private String subject ; private final List < Recipient > recipients ; private final List < AttachmentResource > embeddedImages ; private final List < AttachmentResource > attachments ; private final Map < String , String > headers ; private File dkimPrivateKeyFile ; private InputStream dkimPrivateKeyInputStream ; private byte [ ] dkimPrivateKey ; private String signingDomain ; private String selector ; public Builder ( ) { } public Email build ( ) { } public Email . Builder from ( final String name , final String fromAddress ) { } public Email . Builder replyTo ( final String name , final String replyToAddress ) { } public Email . Builder subject ( final String subject ) { } public Email . Builder text ( final String text ) { } public Email . Builder textHTML ( final String textHTML ) { } public Email . Builder to ( final String name , final String address ) { } public Email . Builder to ( final Recipient recipient ) { } public Email . Builder cc ( final String name , final String address ) { } public Email . Builder cc ( final Recipient recipient ) { } public Email . Builder bcc ( final String name , final String address ) { } public Email . Builder bcc ( final Recipient recipient ) { } public Email . Builder embedImage ( final String name , final byte [ ] data , final String mimetype ) { } public Email . Builder embedImage ( final String name , final DataSource imagedata ) { } public Email . Builder addHeader ( final String name , final Object value ) { } public Email . Builder addAttachment ( final String name , final byte [ ] data , final String mimetype ) { } public Email . Builder addAttachment ( final String name , final DataSource filedata ) { } public Email . Builder signWithDomainKey ( final byte [ ] dkimPrivateKey , final String signingDomain , final String selector ) { <START_BUG> this . dkimPrivateKey = dkimPrivateKey ; <END_BUG> this . signingDomain = signingDomain ; this . selector = selector ; return this ; } public Email . Builder signWithDomainKey ( final File dkimPrivateKeyFile , final String signingDomain , final String selector ) { } public Email . Builder signWithDomainKey ( final InputStream dkimPrivateKeyInputStream , final String signingDomain , final String selector ) { } } private Email ( Email . Builder builder ) { } public Email ( MimeMessage mimeMessage ) { } private void fillEmailFromMimeMessage ( MimeMessageParser parser ) throws MessagingException { } protected static String extractCID ( String cid ) { } No newline ; at end ; of file ; }

Fix:
this . dkimPrivateKey = dkimPrivateKey . clone ( ) ;