You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by mb...@apache.org on 2007/05/14 17:24:46 UTC

svn commit: r537876 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/ResourceContains.java

Author: mbenson
Date: Mon May 14 08:24:44 2007
New Revision: 537876

URL: http://svn.apache.org/viewvc?view=rev&rev=537876
Log:
fix failing test

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/ResourceContains.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/ResourceContains.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/ResourceContains.java?view=diff&rev=537876&r1=537875&r2=537876
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/ResourceContains.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/ResourceContains.java Mon May 14 08:24:44 2007
@@ -80,18 +80,14 @@
         try {
             reader = new BufferedReader(new InputStreamReader(resource.getInputStream()));
             String contents = FileUtils.readFully(reader);
-            if (casesensitive) {
-                if (contents.indexOf(substring) > -1) {
-                    return true;
-                }
-            } else {
-                if (contents.toLowerCase().indexOf(substring) > -1) {
-                    return true;
-                }
+            String sub = substring;
+            if (!casesensitive) {
+                contents = contents.toLowerCase();
+                sub = sub.toLowerCase();
             }
-            return false;
+            return contents.indexOf(sub) >= 0;
         } catch (IOException e) {
-            throw new BuildException("There was a problem accessing resource : "+resource);
+            throw new BuildException("There was a problem accessing resource : " + resource);
         } finally {
             FileUtils.close(reader);
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org