ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arun Katkere <katk...@praja.com>
Subject [BUG] infinite loop with empty properties file
Date Thu, 03 Aug 2000 00:39:54 GMT
This bug didn't exist before (I have had an empty .ant.properties file in my
home directory for a while). With Ant 1.1, ant goes into an infinite loop if
it encounters an empty properties file. To reproduce:

foo.properties (empty):


test.xml:
<project name="test" default="main" basedir=".">
<target name="main">
  <property file=".foo"/>
</target>
</project>

Run ant on test.xml.

Looking at the code, Property.resolveProperties has a loop while(more) and
when there are no properties, more is never false since you never enter the
inner while. Seems like just a check for props.size() == 0 at the begining
will do, but not knowing what resolveProperties does I don't know if it
handles all cases. (Outer loop has no purpose since you can't break out of
inner loop until the enumeration is empty. After the inner loop runs once,
if "more" is still true, how would "more" ever become false? Seems like e =
props.keys() should move inside the loop. Even if you do that, as a rule I
hate any code that goes into an infinite loop upon bad input. What if the
properties is such that everything can never be completely resolved?
Shouldn't we signal an error instead of looping forever trying to resolve
it?)

-arun

Mime
View raw message