=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java' --- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java 2014-03-31 08:21:01 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java 2014-04-14 09:15:35 +0000 @@ -43,6 +43,7 @@ import static org.hisp.dhis.common.DimensionalObject.DIMENSION_SEP; import static org.hisp.dhis.common.IdentifiableObjectUtils.getUids; import static org.hisp.dhis.system.util.TextUtils.getQuotedCommaDelimitedString; +import static org.hisp.dhis.system.util.TextUtils.removeLastOr; import static org.hisp.dhis.system.util.TextUtils.trimEnd; import java.util.Collection; @@ -296,7 +297,7 @@ } } - sql = trimEnd( sql, " or ".length() ) + ") "; + sql = removeLastOr( sql ) + ") "; } return sql; === modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java' --- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java 2014-04-07 13:58:32 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java 2014-04-14 09:15:35 +0000 @@ -33,7 +33,8 @@ import static org.hisp.dhis.common.IdentifiableObjectUtils.getUids; import static org.hisp.dhis.system.util.DateUtils.getMediumDateString; import static org.hisp.dhis.system.util.TextUtils.getQuotedCommaDelimitedString; -import static org.hisp.dhis.system.util.TextUtils.removeLast; +import static org.hisp.dhis.system.util.TextUtils.removeLastComma; +import static org.hisp.dhis.system.util.TextUtils.removeLastOr; import static org.hisp.dhis.system.util.TextUtils.trimEnd; import java.util.Arrays; @@ -54,7 +55,6 @@ import org.hisp.dhis.jdbc.StatementBuilder; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.program.Program; -import org.hisp.dhis.system.util.TextUtils; import org.hisp.dhis.system.util.Timer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.BadSqlGrammarException; @@ -211,7 +211,7 @@ sql += statementBuilder.columnQuote( item ) + " desc,"; } - sql = removeLast( sql, 1 ) + " "; + sql = removeLastComma( sql ) + " "; } // --------------------------------------------------------------------- @@ -333,7 +333,7 @@ sql += statementBuilder.columnQuote( item.getUid() ) + ","; } - return removeLast( sql, 1 ); + return removeLastComma( sql ); } private String getFromWhereMultiplePartitionsClause( EventQueryParams params, List fixedColumns ) @@ -388,7 +388,7 @@ sql += "uidlevel" + unit.getLevel() + " = '" + unit.getUid() + "' or "; } - sql = TextUtils.removeLast( sql, 3 ) + ") "; + sql = removeLastOr( sql ) + ") "; } if ( params.getProgramStage() != null )