Skip to content

Commit

Permalink
Bugfix: Avoid infinite loop in binary search
Browse files Browse the repository at this point in the history
The binary search function was missing the case,
when the value to be compared matches a value in the NCList.
This resulted in the thread to be stuck in an infinite loop
  • Loading branch information
timeu committed Jun 15, 2021
1 parent e64da72 commit 9fa6c9d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
hdf5server:
image: docker.artifactory.imp.ac.at/nordborglab/gwaportal/gwaportal-gwas-server:master
volumes:
- /net/gmi.oeaw.ac.at/gwasapp/DATA_NEW_BROWSER/:/mnt
- /mnt/gwasapp/DATA_NEW_BROWSER/:/mnt
ports:
- 8001:8000
environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,17 @@ private int binarySearch(List<NCListItem> list, Long value) {
NCListItem item = list.get(mid);

Long cmp = item.getEnd();
if (cmp > value)
if (cmp > value) {
high = mid;
else if (cmp < value)
}
else if (cmp < value) {
low = mid;
}
else {
high = mid;
break;
}
}
NCListItem valueToCompare = new NCListItem();
valueToCompare.setStart(value);
return high; // key not found
}

Expand Down

0 comments on commit 9fa6c9d

Please sign in to comment.