tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BugRat Mail System <tomcat-b...@cortexity.com>
Subject BugRat Report #15 - Infinite loop with empty properties file
Date Thu, 03 Aug 2000 14:00:31 GMT
----- Sender's Comment -----
ignore - just testing
----- End Of Sender's Comment ---------------------------
Report URL: <http://znutar.cortexity.com:8888/BugRatViewer/ShowReport/15>

Report #15 Details

Project: Ant
Category: Bug Report
SubCategory: New Bug Report
Class: swbug
State: received
Priority: medium
Severity: serious
Confidence: public
Environment: 
   Release: 1.1
   JVM Release: Any
   Operating System: Any
   OS Release: Any
   Platform: Any

Synopsis: 
Infinite loop with empty properties file

Description:
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?)

Mime
View raw message