← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20357: Test fix

 

------------------------------------------------------------
revno: 20357
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-24 23:48:20 +0200
message:
  Test fix
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java
  dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/TextUtils.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java	2015-09-24 21:35:11 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java	2015-09-24 21:48:20 +0000
@@ -66,7 +66,6 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
-import com.google.common.base.CharMatcher;
 import com.google.common.collect.ImmutableMap;
 
 /**
@@ -476,7 +475,7 @@
             return null;
         }
 
-        expression = CharMatcher.BREAKING_WHITESPACE.removeFrom( expression );
+        expression = TextUtils.removeNewlines( expression );
         
         expression = getSubstitutedVariablesForAnalyticsSql( expression );
         

=== modified file 'dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/TextUtils.java'
--- dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/TextUtils.java	2015-09-03 03:11:47 +0000
+++ dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/TextUtils.java	2015-09-24 21:48:20 +0000
@@ -249,6 +249,17 @@
     }
     
     /**
+     * Removes line breaks form the given string.
+     * 
+     * @param string the string.
+     * @return the chopped string.
+     */
+    public static String removeNewlines( String string )
+    {
+        return string.replaceAll( "\r", EMPTY ).replaceAll( "\n", EMPTY );
+    }
+    
+    /**
      * Trims the given string from the end.
      * 
      * @param value the value to trim.