Modify DecodingTask: fix digest check
authorMaximilian Quellmalz <maximilian.quellmalz@mailbox.tu-dresden.de>
Fri, 24 Oct 2014 09:17:43 +0000 (11:17 +0200)
committerMaximilian Quellmalz <maximilian.quellmalz@mailbox.tu-dresden.de>
Fri, 24 Oct 2014 09:17:43 +0000 (11:17 +0200)
Splitter-ng/src/splitterng/DecodingTask.java

index 3f4c709..8898db5 100644 (file)
@@ -47,7 +47,9 @@ public class DecodingTask extends CodingTask {
                erased = new boolean[fragmentPathsMap.size()];
 
                readMetadataMap();
-               digestCheck(); // remove from fragmentPathsMap when not OK
+               if (digestFunction != null){
+                       digestCheck(); // remove from fragmentPathsMap when not OK
+               }
                
        }
 
@@ -242,7 +244,7 @@ public class DecodingTask extends CodingTask {
                        // Create FileInputStreams
                        fileInputStreamMap = new HashMap<Integer, InputStream>();
                        for (Entry<Integer, Path> p : fragmentPathsMap.entrySet()) {
-                               if (p.getValue() == null | (fragmentDigests_failed.containsKey(p.getKey()))) {
+                               if (p.getValue() == null || ((fragmentDigests_failed != null) && (fragmentDigests_failed.containsKey(p.getKey())))   ) {
                                        fileInputStreamMap.put(p.getKey(), null);
                                } else {
                                        fileInputStreamMap.put(p.getKey(),
@@ -279,7 +281,7 @@ public class DecodingTask extends CodingTask {
        public boolean[] getErased() {
                if (isFileTask) {
                        for (int i = 0; i < fragmentPathsMap.size(); i++) {
-                               if ((fragmentPathsMap.get(i) == null) | (fragmentDigests_failed.containsKey(i)) ) {
+                               if ((fragmentPathsMap.get(i) == null) || ((fragmentDigests_failed != null) && (fragmentDigests_failed.containsKey(i)))) {
                                        erased[i] = true;
                                } else {
                                        erased[i] = false;
@@ -287,7 +289,7 @@ public class DecodingTask extends CodingTask {
                        }
                } else {
                        for (int i = 0; i < dataFragmentMap.size(); i++) {
-                               if (dataFragmentMap.get(i) == null| (fragmentDigests_failed.containsKey(i))) {
+                               if (dataFragmentMap.get(i) == null|| ((fragmentDigests_failed != null) && (fragmentDigests_failed.containsKey(i)))) {
                                        erased[i] = true;
                                } else {
                                        erased[i] = false;