ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r537876 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/ResourceContains.java
Date Mon, 14 May 2007 15:24:46 GMT
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


Mime
View raw message