001 package edu.harvard.deas.hyperenc; 002 003 import java.util.Collections; 004 import java.util.List; 005 006 /** 007 * Thrown when a hyper-encryption operation cannot proceed because a required 008 * block is not available. 009 */ 010 public class BlockMissingException extends EncryptionException { 011 private static final long serialVersionUID = 1L; 012 private final List<Integer> missingIDList; 013 014 /** 015 * Constructs a new BlockMissingException. 016 * 017 * @param missingIDs 018 * a list of one or more of the missing IDs that caused this exception 019 * to be thrown 020 * @param message 021 * the detail message 022 */ 023 public BlockMissingException(List<Integer> missingIDs, String message) { 024 this(missingIDs, message, null); 025 } 026 027 /** 028 * Constructs a new BlockMissingException. 029 * 030 * @param missingIDs 031 * a list of one or more of the missing IDs that caused this exception 032 * to be thrown 033 * @param message 034 * the detail message 035 * @param cause 036 * the cause (which is saved for later retrieval by the 037 * <code>Throwable.getCause()</code> method). (A null value is 038 * permitted, and indicates that the cause is nonexistent or unknown.) 039 */ 040 public BlockMissingException(List<Integer> missingIDs, String message, 041 Throwable cause) { 042 super(message, cause); 043 this.missingIDList = Collections.unmodifiableList(missingIDs); 044 } 045 046 /** 047 * Returns an unmodifiable copy of the list of missing block IDs. 048 * @return the list of missing block IDs 049 */ 050 public List<Integer> getMissingIDList() { 051 return missingIDList; 052 } 053 }