Fix DeltaTask infinite loop DeltaTask$Block.partitionTask was doing an infinite loop if number of threads was greater than the totalWeight. The weightPerThread was 0 which was causing the infinite loop. Set the weightPerThread to a minimal value of one. Bug: 420915 Change-Id: Ia8e3ad956d53d8193937b7fa1bc19aafde9767ff Signed-off-by: Hugo Arès <hugo.ares@ericsson.com>
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java index c4b0194..9534053 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java
@@ -121,7 +121,7 @@ void partitionTasks() { ArrayList<WeightedPath> topPaths = computeTopPaths(); Iterator<WeightedPath> topPathItr = topPaths.iterator(); int nextTop = 0; - long weightPerThread = totalWeight / threads; + long weightPerThread = Math.max(totalWeight / threads, 1); for (int i = beginIndex; i < endIndex;) { DeltaTask task = new DeltaTask(this); long w = 0;