summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorHugo Arès <hugo.ares@ericsson.com>2014-06-05 15:16:26 -0400
committerHugo Arès <hugo.ares@ericsson.com>2014-06-05 15:20:04 -0400
commitd439c8dfe5ec521fc0f66cf956d9a5c7e63cadd3 (patch)
tree970c510af81acce1d7e30dd011f8546947791d32 /org.eclipse.jgit
parent64b0531c35674df21ed02ab96d5f5bc6f5af7052 (diff)
downloadjgit-d439c8dfe5ec521fc0f66cf956d9a5c7e63cadd3.tar.gz
jgit-d439c8dfe5ec521fc0f66cf956d9a5c7e63cadd3.zip
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>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java2
1 files changed, 1 insertions, 1 deletions
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 c4b01949d1..9534053bfe 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 @@ final class DeltaTask implements Callable<Object> {
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;