Throw on unrecognized CRAM encoding tag. #593

Merged
merged 1 commit into from Aug 23, 2016
Jump to file or symbol
Failed to load files and symbols.
+3 −5
Split
@@ -56,9 +56,7 @@ public AbstractReader buildReader(final AbstractReader reader,
final DataSeries dataSeries = field.getAnnotation(DataSeries.class);
final EncodingKey key = dataSeries.key();
final DataSeriesType type = dataSeries.type();
- if (header.encodingMap.get(key) == null) {
- log.debug("Encoding not found for key: " + key);
- } else {
+ if (header.encodingMap.get(key) != null) {
try {
field.set(reader,
createReader(type, header.encodingMap.get(key), bitInputStream, inputMap));
@@ -17,6 +17,7 @@
*/
package htsjdk.samtools.cram.structure;
+import htsjdk.samtools.cram.CRAMException;
import htsjdk.samtools.cram.encoding.ExternalCompressor;
import htsjdk.samtools.cram.encoding.NullEncoding;
import htsjdk.samtools.cram.io.ITF8;
@@ -170,8 +171,7 @@ else if (TD_tagIdsDictionary.equals(key)) {
final String key = new String(new byte[]{buffer.get(), buffer.get()});
final EncodingKey encodingKey = EncodingKey.byFirstTwoChars(key);
if (encodingKey == null) {
- log.debug("Unknown encoding key: " + key);
- continue;
+ throw new CRAMException("Unknown encoding key: " + key);
}
final EncodingID id = EncodingID.values()[buffer.get()];