Bug 473316 - Infinite loop in images renderer when few images
Take the max of 1 and the division of threads among images so that, if
the number of images is fewer than half the number of threads, a batch
size of 1 (not 0) is used.
Avoid infinite loop when few images.
Change-Id: Id284414fc2f929ec1875109206799e87db1c36b9
Signed-off-by: Ben Cox <benjamin.cox@uk.ibm.com>
diff --git a/bundles/org.eclipse.ui.images.renderer/pom.xml b/bundles/org.eclipse.ui.images.renderer/pom.xml
index 199af54..a147e68 100644
--- a/bundles/org.eclipse.ui.images.renderer/pom.xml
+++ b/bundles/org.eclipse.ui.images.renderer/pom.xml
@@ -14,7 +14,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.ui</groupId>
<artifactId>org.eclipse.ui.images.renderer</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.100-SNAPSHOT</version>
<name>Eclipse Platform SVG Renderer Plugin</name>
<packaging>maven-plugin</packaging>
diff --git a/bundles/org.eclipse.ui.images.renderer/src/main/java/org/eclipse/ui/images/renderer/RenderMojo.java b/bundles/org.eclipse.ui.images.renderer/src/main/java/org/eclipse/ui/images/renderer/RenderMojo.java
index d0b7d30..b0cffe0 100644
--- a/bundles/org.eclipse.ui.images.renderer/src/main/java/org/eclipse/ui/images/renderer/RenderMojo.java
+++ b/bundles/org.eclipse.ui.images.renderer/src/main/java/org/eclipse/ui/images/renderer/RenderMojo.java
@@ -284,7 +284,7 @@
int remainingIcons = icons.size();
// The number of icons to distribute to a rendering callable
- final int threadExecSize = icons.size() / this.threads;
+ final int threadExecSize = Math.max(1, icons.size() / this.threads);
// The current offset to start a batch, as they're distributed
// between rendering callables