public AttachmentPart getAttachment(java.net.URI ref, Iterator iter) { if (iter == null || ref == null) { System.err.println("getAttachment: null Iterator for AttachmentPart"); return null; } while (iter.hasNext()) { AttachmentPart tempAttachment = (AttachmentPart) iter.next(); if (ref.isOpaque() && ref.getScheme().equals("cid")) { String refId = ref.getSchemeSpecificPart(); String cId = tempAttachment.getContentId(); if (cId.equals("<" + refId + ">") || cId.equals(refId)) { return tempAttachment; } } } return null; }