Return-Path: Delivered-To: apmail-jakarta-ant-user-archive@apache.org Received: (qmail 25241 invoked from network); 19 Aug 2002 11:59:12 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 19 Aug 2002 11:59:12 -0000 Received: (qmail 12024 invoked by uid 97); 19 Aug 2002 11:59:31 -0000 Delivered-To: qmlist-jakarta-archive-ant-user@jakarta.apache.org Received: (qmail 12008 invoked by uid 97); 19 Aug 2002 11:59:30 -0000 Mailing-List: contact ant-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list ant-user@jakarta.apache.org Received: (qmail 11996 invoked by uid 98); 19 Aug 2002 11:59:29 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Message-ID: <3D60DD5C.8040709@altern.org> Date: Mon, 19 Aug 2002 13:58:20 +0200 From: Jerome Lacoste User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.1) Gecko/20020811 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ant Users List Subject: [SOLVED] System.getProperties() returns an empty list when unit test run within Ant 1.4.1 References: <3D5D0AF1.8060802@altern.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Jerome Lacoste wrote: > Hi Anties, > > I've got this strange problem: one of my UnitTest fails when I run it > within Ant, while it doens't fail when I run it directly from the same VM. > I've had trouble like that before and they are usualy environment > related but this one is very strange: > Here's the code of my Unit Test: > > public void testSystemGetProperties() { > // Skip debug code to printout System.getProperties() > ... > if (System.getProperties().size() == 0) > { > fail("WARNING something is wrong in your environment. > System.getProperties().size() == 0"); > } > } > > As you can see, System.getProperties().size() == 0 fails when I run > this test within ant. According to the API this should never happen. > Even more strange is that if I try to access any single System > property within the same code, I will obtain it without problem! > I.e. System.getProperty("user.dir") works OK but > System.getProperties() still returns an empty list!! I have two ways of solving the problem: - either using fork="true" as advised by Erik Hatcher - either switch to Ant 1.5, which also solves the problem This was obvisouly a bug in Ant 1.4.1. It appears to be solved in Ant 1.5 but I can't say for sure. Perhaps the bug is still there but hidden by some side effects. Someone should perhaps confirm that this bug really disappeared. Cheers, Thanks all. -- To unsubscribe, e-mail: For additional commands, e-mail: