From d534f1e1a13cf5182820202aae65688e01aa6182 Mon Sep 17 00:00:00 2001 From: Jacobus Martinus Kruithof Date: Sat, 31 Jan 2009 16:26:41 +0000 Subject: [PATCH] Math.abs(rand.nextInt()) may yield negative value. rand.nextInt(Integer.MAX_VALUE) seems to be what was meant. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@739575 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/util/FileUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/org/apache/tools/ant/util/FileUtils.java b/src/main/org/apache/tools/ant/util/FileUtils.java index 98bd7d921..093d5b915 100644 --- a/src/main/org/apache/tools/ant/util/FileUtils.java +++ b/src/main/org/apache/tools/ant/util/FileUtils.java @@ -891,7 +891,7 @@ public class FileUtils { synchronized (rand) { do { result = new File(parent, prefix - + fmt.format(Math.abs(rand.nextInt())) + suffix); + + fmt.format(rand.nextInt(Integer.MAX_VALUE)) + suffix); } while (result.exists()); } }