← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18372: Various fixes

 

------------------------------------------------------------
revno: 18372
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2015-02-22 21:02:00 +0100
message:
  Various fixes
modified:
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/DefaultSqlViewService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/node/serializers/CsvNodeSerializer.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/node/serializers/ExcelNodeSerializer.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/node/serializers/PdfNodeSerializer.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/DefaultSecurityService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/migration/SpringSecurityMigrationPasswordManager.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/vote/AllRequiredRoleVoter.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DefaultSmsSender.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/SmsMessageSender.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/AdvanceHttpPostGateWay.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/SimplisticHttpGetGateWay.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/outbound/DefaultOutboundSmsTransportService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/InternalMapLayer.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/comparator/IntervalLowValueAscComparator.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/eventchart/EventChartDeletionHandler.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/eventreport/EventReportDeletionHandler.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/CompositeCounter.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/DateUtils.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ExcelUtils.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PaginatedList.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/WeightedPaginatedList.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AppController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/FilteredMetaDataController.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-administration/src/main/java/org/hisp/dhis/sqlview/DefaultSqlViewService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/DefaultSqlViewService.java	2015-02-20 14:46:12 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/DefaultSqlViewService.java	2015-02-22 20:02:00 +0000
@@ -262,7 +262,7 @@
         
         if ( sqlView == null || sqlView.getSqlQuery() == null )
         {
-            violation = "SQL query is null";
+            throw new IllegalQueryException( "SQL query is null" );
         }
         
         final Set<String> sqlVars = getVariables( sqlView.getSqlQuery() );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java	2015-02-22 20:02:00 +0000
@@ -462,7 +462,7 @@
 
         int index = dataApprovalLevel.getLevel() - 1;
         
-        if ( index >= 0 & index < dataApprovalLevels.size() )
+        if ( index >= 0 && index < dataApprovalLevels.size() )
         {
             dataApprovalLevelStore.delete( dataApprovalLevel );
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalService.java	2015-02-20 07:42:23 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalService.java	2015-02-22 20:02:00 +0000
@@ -305,8 +305,7 @@
 
             if ( !status.getPermissions().isMayUnaccept() )
             {
-                log.warn( "unacceptData: data may not be unaccepted, state " + ( status == null ? "(null)" : status.getState().name() )
-                        + " " + da + " " + status.getPermissions() );
+                log.warn( "unacceptData: data may not be unaccepted, state " + status.getState().name() + " " + da + " " + status.getPermissions() );
 
                 throw new DataMayNotBeUnacceptedException();
             }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/node/serializers/CsvNodeSerializer.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/node/serializers/CsvNodeSerializer.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/node/serializers/CsvNodeSerializer.java	2015-02-22 20:02:00 +0000
@@ -56,7 +56,7 @@
 @Scope( value = "prototype", proxyMode = ScopedProxyMode.INTERFACES )
 public class CsvNodeSerializer extends AbstractNodeSerializer
 {
-    public static final String[] CONTENT_TYPES = { "application/csv", "text/csv" };
+    private static final String[] CONTENT_TYPES = { "application/csv", "text/csv" };
 
     private static CsvMapper csvMapper = new CsvMapper();
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/node/serializers/ExcelNodeSerializer.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/node/serializers/ExcelNodeSerializer.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/node/serializers/ExcelNodeSerializer.java	2015-02-22 20:02:00 +0000
@@ -62,7 +62,7 @@
 @Scope( value = "prototype", proxyMode = ScopedProxyMode.INTERFACES )
 public class ExcelNodeSerializer extends AbstractNodeSerializer
 {
-    public static final String[] CONTENT_TYPES = { "application/vnd.ms-excel" };
+    private static final String[] CONTENT_TYPES = { "application/vnd.ms-excel" };
 
     @Override
     public List<String> contentTypes()

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/node/serializers/PdfNodeSerializer.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/node/serializers/PdfNodeSerializer.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/node/serializers/PdfNodeSerializer.java	2015-02-22 20:02:00 +0000
@@ -55,7 +55,7 @@
 @Scope( value = "prototype", proxyMode = ScopedProxyMode.INTERFACES )
 public class PdfNodeSerializer extends AbstractNodeSerializer
 {
-    public static final String[] CONTENT_TYPES = { "application/pdf" };
+    private static final String[] CONTENT_TYPES = { "application/pdf" };
 
     private Document document;
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java	2015-02-22 20:02:00 +0000
@@ -239,11 +239,9 @@
 
         CalendarPeriodType periodType = (CalendarPeriodType) lastPeriod.getPeriodType();
 
-        Period p = new Period();
-
         for ( int i = 0; i < historyLength; ++i )
         {
-            p = getPeriodFromDates( lastPeriod.getStartDate(), lastPeriod.getEndDate(), periodType );
+            Period p = getPeriodFromDates( lastPeriod.getStartDate(), lastPeriod.getEndDate(), periodType );
 
             periods.add( p != null ? p : lastPeriod );
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/DefaultSecurityService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/DefaultSecurityService.java	2015-02-13 12:51:17 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/DefaultSecurityService.java	2015-02-22 20:02:00 +0000
@@ -187,7 +187,7 @@
     {
         if ( credentials == null )
         {
-            log.warn( "Could not send invite message as user does is null: " + credentials );
+            log.warn( "Could not send invite message as user does is null" );
             return "no_user_credentials";
         }
         

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/migration/SpringSecurityMigrationPasswordManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/migration/SpringSecurityMigrationPasswordManager.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/migration/SpringSecurityMigrationPasswordManager.java	2015-02-22 20:02:00 +0000
@@ -39,8 +39,6 @@
     extends SpringSecurityPasswordManager
     implements MigrationPasswordManager
 {
-    public static String legacyPasswordEncoderClassName;
-
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -50,7 +48,6 @@
     public void setLegacyPasswordEncoder( PasswordEncoder legacyPasswordEncoder )
     {
         this.legacyPasswordEncoder = legacyPasswordEncoder;
-        legacyPasswordEncoderClassName = legacyPasswordEncoder.getClass().getName();
     }
 
     private UsernameSaltSource usernameSaltSource;

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/vote/AllRequiredRoleVoter.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/vote/AllRequiredRoleVoter.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/vote/AllRequiredRoleVoter.java	2015-02-22 20:02:00 +0000
@@ -63,7 +63,7 @@
 
                 for ( GrantedAuthority authority : authentication.getAuthorities() )
                 {
-                    if ( attribute.getAttribute().equals( authority ) )
+                    if ( attribute.getAttribute().equals( authority.getAuthority() ) )
                     {
                         found = true;
                         break;

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DefaultSmsSender.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DefaultSmsSender.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DefaultSmsSender.java	2015-02-22 20:02:00 +0000
@@ -162,6 +162,8 @@
                 toSendList.addAll( users );
             }
 
+            int maxChar = MAX_CHAR;
+            
             Set<String> phoneNumbers = null;
 
             if ( transportService != null && transportService.isEnabled() )
@@ -180,11 +182,11 @@
                     {
                         if ( !Character.UnicodeBlock.of( each ).equals( UnicodeBlock.BASIC_LATIN ) )
                         {
-                            MAX_CHAR = 40;
+                            maxChar = 40;
                             break;
                         }
                     }
-                    if ( text.length() > MAX_CHAR )
+                    if ( text.length() > maxChar )
                     {
                         List<String> splitTextList = new ArrayList<>();
                         splitTextList = splitLongUnicodeString( text, splitTextList );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/SmsMessageSender.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/SmsMessageSender.java	2015-02-19 09:18:17 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/SmsMessageSender.java	2015-02-22 20:02:00 +0000
@@ -78,12 +78,18 @@
     {
         String message = null;
 
-        Map<String, String> gatewayMap = outboundSmsTransportService != null ? outboundSmsTransportService
-            .getGatewayMap() : null;
+        if ( outboundSmsTransportService == null )
+        {
+            return "No gateway";
+        }
+        
+        Map<String, String> gatewayMap = outboundSmsTransportService.getGatewayMap();
 
         String gatewayId = StringUtils.trimToNull( outboundSmsTransportService.getDefaultGateway() );
+        
+        boolean gatewayEnabled = outboundSmsTransportService.isEnabled();
 
-        if ( gatewayMap == null || gatewayId == null || !outboundSmsTransportService.isEnabled() )
+        if ( gatewayMap == null || gatewayId == null || !gatewayEnabled )
         {
             return "No gateway";
         }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/AdvanceHttpPostGateWay.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/AdvanceHttpPostGateWay.java	2015-02-19 09:18:17 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/AdvanceHttpPostGateWay.java	2015-02-22 20:02:00 +0000
@@ -86,44 +86,51 @@
                 log.debug( "Adding sender " + sender + " " + getGatewayId() );
                 requestParameters.put( SENDER, sender );
             }
+            
+            String urlString = urlTemplate;
+            
+            for ( String key : requestParameters.keySet() )
+            {
+                if ( requestParameters.get( key ) != null )
+                {
+                    urlString = StringUtils.replace( urlString, "{" + key + "}",
+                        URLEncoder.encode( requestParameters.get( key ), "UTF-8" ) );
+                }
+            }
+            
+            log.info( "RequestURL: " + urlString + " " + getGatewayId() );
+                        
+            String line, response = "";
+            BufferedReader reader = null;
+            
             try
             {
-                String urlString = urlTemplate;
-                
-                for ( String key : requestParameters.keySet() )
-                {
-                    if ( requestParameters.get( key ) != null )
-                    {
-                        urlString = StringUtils.replace( urlString, "{" + key + "}",
-                            URLEncoder.encode( requestParameters.get( key ), "UTF-8" ) );
-                    }
-                }
-                
-                log.info( "RequestURL: " + urlString + " " + getGatewayId() );
-                URL requestURL = new URL( urlString );
-                URLConnection conn = requestURL.openConnection();
-                BufferedReader reader = new BufferedReader( new InputStreamReader( conn.getInputStream() ) );
-                String line, response = "";
+                URL requestURL = new URL( urlString );                
+                URLConnection conn = requestURL.openConnection();                
+                reader = new BufferedReader( new InputStreamReader( conn.getInputStream() ) );
+                
                 while ( (line = reader.readLine()) != null )
                 {
                     response += line;
                 }
-
+                
                 HttpURLConnection httpConnection = (HttpURLConnection) conn;
+                
                 if ( httpConnection.getResponseCode() != HttpURLConnection.HTTP_OK )
                 {
                     log.warn( "Couldn't send message, got response " + response + " " + getGatewayId() );
                     return 0;
                 }
-
-                reader.close();
-
             }
-            catch ( Exception e )
+            catch ( IOException ex )
             {
                 log.warn( "Couldn't send message " + outboundMessage + " " + getGatewayId() );
                 return 0;
             }
+            finally
+            {
+                reader.close();
+            }
 
             return 1;
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/SimplisticHttpGetGateWay.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/SimplisticHttpGetGateWay.java	2015-02-19 09:18:17 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/SimplisticHttpGetGateWay.java	2015-02-22 20:02:00 +0000
@@ -132,24 +132,28 @@
             log.debug( "Adding sender " + sender + " " + getGatewayId() );
             requestParameters.put( SENDER, sender );
         }
+        
+        String urlString = urlTemplate;
+        
+        for ( String key : requestParameters.keySet() )
+        {
+            if ( requestParameters.get( key ) != null )
+            {
+                urlString = StringUtils.replace( urlString, "{" + key + "}",
+                    URLEncoder.encode( requestParameters.get( key ), "UTF-8" ) );
+            }
+        }
+        
+        log.info( "RequestURL: " + urlString + " " + getGatewayId() );
+
+        String line, response = "";
+        BufferedReader reader = null;
+        
         try
         {
-            String urlString = urlTemplate;
-            
-            for ( String key : requestParameters.keySet() )
-            {
-                if ( requestParameters.get( key ) != null )
-                {
-                    urlString = StringUtils.replace( urlString, "{" + key + "}",
-                        URLEncoder.encode( requestParameters.get( key ), "UTF-8" ) );
-                }
-            }
-            
-            log.info( "RequestURL: " + urlString + " " + getGatewayId() );
             URL requestURL = new URL( urlString );
             URLConnection conn = requestURL.openConnection();
-            BufferedReader reader = new BufferedReader( new InputStreamReader( conn.getInputStream() ) );
-            String line, response = "";
+            reader = new BufferedReader( new InputStreamReader( conn.getInputStream() ) );
             
             while ( (line = reader.readLine()) != null )
             {
@@ -166,11 +170,15 @@
             reader.close();
 
         }
-        catch ( Exception e )
+        catch ( IOException e )
         {
             log.warn( "Couldn't send message " + getGatewayId() );
             return false;
         }
+        finally
+        {
+            reader.close();
+        }
 
         return true;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/outbound/DefaultOutboundSmsTransportService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/outbound/DefaultOutboundSmsTransportService.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/outbound/DefaultOutboundSmsTransportService.java	2015-02-22 20:02:00 +0000
@@ -60,19 +60,13 @@
 {
     private static final Log log = LogFactory.getLog( DefaultOutboundSmsTransportService.class );
 
-    private final String BULK_GATEWAY = "bulk_gw";
-
-    private final String CLICKATELL_GATEWAY = "clickatell_gw";
-
-    private final String HTTP_GATEWAY = "generic_http_gw";
-
-    private final String MODEM_GATEWAY = "modem_gw";
-
-    private final String SMPP_GATEWAY = "smpp_gw";
-
-    public static Map<String, String> gatewayMap = new HashMap<>(); //TODO fix, poor solution
-
-    private GateWayFactory gatewayFactory = new GateWayFactory();
+    private static final String BULK_GATEWAY = "bulk_gw";
+    private static final String CLICKATELL_GATEWAY = "clickatell_gw";
+    private static final String HTTP_GATEWAY = "generic_http_gw";
+    private static final String MODEM_GATEWAY = "modem_gw";
+    private static final String SMPP_GATEWAY = "smpp_gw";
+    
+    public static final Map<String, String> gatewayMap = new HashMap<>(); //TODO fix, poor solution
 
     private SmsConfiguration config;
 
@@ -95,6 +89,7 @@
         {
             reloadConfig();
         }
+        
         return gatewayMap;
     }
 
@@ -200,10 +195,12 @@
         }
         else
         {
+            GateWayFactory gatewayFactory = new GateWayFactory();
+            
             for ( SmsGatewayConfig gatewayConfig : config.getGateways() )
             {
                 try
-                {
+                {                    
                     gateway = gatewayFactory.create( gatewayConfig );
 
                     service.addGateway( gateway );
@@ -493,7 +490,7 @@
         return Service.getInstance();
     }
 
-    private class OutboundNotification
+    private static class OutboundNotification
         implements IOutboundMessageNotification
     {
         @Override

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java	2015-02-22 20:02:00 +0000
@@ -102,6 +102,8 @@
                 "and a not in (:auths) ) ";
         }
         
+        // TODO handle users with no user roles
+        
         if ( params.isDisjointRoles() && params.getUser() != null )
         {
             hql += hlp.whereAnd() + " not exists (" +

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/InternalMapLayer.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/InternalMapLayer.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/InternalMapLayer.java	2015-02-22 20:02:00 +0000
@@ -299,11 +299,11 @@
      */
     public void setAutomaticIntervalSet( int length )
     {
-        if ( MapView.METHOD_EQUAL_INTERVALS == method )
+        if ( MapView.METHOD_EQUAL_INTERVALS.equals( method ) )
         {
             setEqualRangeIntervalSet( length );
         }
-        else if ( MapView.METHOD_EQUAL_COUNTS == method )
+        else if ( MapView.METHOD_EQUAL_COUNTS.equals( method ) )
         {
             setEqualCountIntervalSet( length );
         }

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/comparator/IntervalLowValueAscComparator.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/comparator/IntervalLowValueAscComparator.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/comparator/IntervalLowValueAscComparator.java	2015-02-22 20:02:00 +0000
@@ -38,7 +38,7 @@
 public class IntervalLowValueAscComparator
     implements Comparator<Interval>
 {
-    public static IntervalLowValueAscComparator INSTANCE = new IntervalLowValueAscComparator();
+    public static final IntervalLowValueAscComparator INSTANCE = new IntervalLowValueAscComparator();
     
     @Override
     public int compare( Interval i1, Interval i2 )

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/eventchart/EventChartDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/eventchart/EventChartDeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/eventchart/EventChartDeletionHandler.java	2015-02-22 20:02:00 +0000
@@ -34,7 +34,6 @@
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jdbc.core.JdbcTemplate;
 
 /**
  * @author Chau Thu Tran
@@ -50,9 +49,6 @@
     @Autowired
     private EventChartService eventChartService;
 
-    @Autowired
-    private JdbcTemplate jdbcTemplate;
-
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/eventreport/EventReportDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/eventreport/EventReportDeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/eventreport/EventReportDeletionHandler.java	2015-02-22 20:02:00 +0000
@@ -34,7 +34,6 @@
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jdbc.core.JdbcTemplate;
 
 /**
  * @author Chau Thu Tran
@@ -50,9 +49,6 @@
     @Autowired
     private EventReportService eventReportService;
 
-    @Autowired
-    private JdbcTemplate jdbcTemplate;
-
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java	2015-02-12 15:16:32 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java	2015-02-22 20:02:00 +0000
@@ -654,7 +654,7 @@
             return false;
         }
 
-        return instance.getRepresentative() == null || !(instance.getRepresentative().getUid() == representativeId);
+        return instance.getRepresentative() == null || !(instance.getRepresentative().getUid().equals( representativeId ) );
     }
     
     @Override

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java	2015-02-19 09:18:17 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java	2015-02-22 20:02:00 +0000
@@ -589,21 +589,21 @@
      */
     public static String getValue( TagNode cell )
     {
-        String value = EMPTY;
+        StringBuilder builder = new StringBuilder();
 
         for ( Node child : cell.getChildren().toNodeArray() )
         {
             if ( child instanceof CompositeTag )
             {
-                value += ((CompositeTag) child).getStringText();
+                builder.append( ((CompositeTag) child).getStringText() );
             }
             else
             {
-                value = value + child.getText();
+                builder.append( child.getText() );
             }
         }
         
-        return value.trim().replaceAll( "&nbsp;", EMPTY );
+        return builder.toString().trim().replaceAll( "&nbsp;", EMPTY );
     }
     
     /**

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/CompositeCounter.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/CompositeCounter.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/CompositeCounter.java	2015-02-22 20:02:00 +0000
@@ -55,13 +55,13 @@
     
     private String getKey( Object... objects )
     {
-        String key = "";
+        StringBuilder builder = new StringBuilder();
         
         for ( Object o : objects )
         {
-            key += o.hashCode() + SEPARATOR;
+            builder.append( o.hashCode() ).append( SEPARATOR );
         }
         
-        return key;
+        return builder.toString();
     }
 }

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/DateUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/DateUtils.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/DateUtils.java	2015-02-22 20:02:00 +0000
@@ -61,6 +61,8 @@
         new SimpleDateFormat( "yyyy" )
     };
 
+    //TODO replace with FastDateParser, SimpleDateFormat is not thead-safe
+    
     public static final SimpleDateFormat LONG_DATE_FORMAT = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss" );
     public static final SimpleDateFormat ACCESS_DATE_FORMAT = new SimpleDateFormat( "yyyy/MM/dd HH:mm:ss" );
     public static final SimpleDateFormat HTTP_DATE_FORMAT = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss" );

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ExcelUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ExcelUtils.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ExcelUtils.java	2015-02-22 20:02:00 +0000
@@ -257,7 +257,7 @@
             i++;
             MetaValue rowMeta = (MetaValue) rowIt.next();
 
-            cellFormat = (i % 2 == 1) ? parFormat : oddFormat;
+            cellFormat = (i % 2 != 0) ? parFormat : oddFormat;
 
             try
             {

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PaginatedList.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PaginatedList.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PaginatedList.java	2015-02-22 20:02:00 +0000
@@ -127,7 +127,7 @@
     {
         List<List<T>> pages = new ArrayList<>();
         
-        List<T> page = new ArrayList<>();
+        List<T> page = null;
         
         while ( ( page = nextPage() ) != null )
         {

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java	2015-02-12 09:17:36 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java	2015-02-22 20:02:00 +0000
@@ -28,11 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import javassist.util.proxy.ProxyFactory;
-import org.hibernate.collection.spi.PersistentCollection;
-import org.hisp.dhis.system.util.functional.Function1;
-import org.hisp.dhis.system.util.functional.Predicate;
-import org.springframework.util.StringUtils;
+import static org.hisp.dhis.system.util.PredicateUtils.alwaysTrue;
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
@@ -48,7 +44,12 @@
 import java.util.List;
 import java.util.Set;
 
-import static org.hisp.dhis.system.util.PredicateUtils.alwaysTrue;
+import javassist.util.proxy.ProxyFactory;
+
+import org.hibernate.collection.spi.PersistentCollection;
+import org.hisp.dhis.system.util.functional.Function1;
+import org.hisp.dhis.system.util.functional.Predicate;
+import org.springframework.util.StringUtils;
 
 /**
  * @author Lars Helge Overland
@@ -70,7 +71,15 @@
 
             return (Integer) method.invoke( object );
         }
-        catch ( Exception ex )
+        catch ( NoSuchMethodException ex )
+        {
+            return -1;
+        }
+        catch ( InvocationTargetException ex )
+        {
+            return -1;
+        }
+        catch ( IllegalAccessException ex )
         {
             return -1;
         }
@@ -93,7 +102,15 @@
 
             return (String) method.invoke( object );
         }
-        catch ( Exception ex )
+        catch ( NoSuchMethodException ex )
+        {
+            return null;
+        }
+        catch ( InvocationTargetException ex )
+        {
+            return null;
+        }
+        catch ( IllegalAccessException ex )
         {
             return null;
         }

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/WeightedPaginatedList.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/WeightedPaginatedList.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/WeightedPaginatedList.java	2015-02-22 20:02:00 +0000
@@ -103,7 +103,7 @@
     {
         List<List<T>> pages = new ArrayList<>();
         
-        List<T> page = new ArrayList<>();
+        List<T> page = null;
         
         while ( ( page = nextPage() ) != null )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AppController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AppController.java	2015-02-19 09:18:17 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AppController.java	2015-02-22 20:02:00 +0000
@@ -221,6 +221,7 @@
         if ( config == null )
         {
             ContextUtils.conflictResponse( response, "No config specified" );
+            return;
         }
         
         String appBaseUrl = StringUtils.trimToNull( config.get( AppManager.KEY_APP_BASE_URL ) );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/FilteredMetaDataController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/FilteredMetaDataController.java	2015-02-17 06:00:52 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/FilteredMetaDataController.java	2015-02-22 20:02:00 +0000
@@ -40,23 +40,22 @@
 
 import net.sf.json.JSONObject;
 
-import org.hisp.dhis.webapi.utils.ContextUtils;
 import org.hisp.dhis.common.view.ExportView;
-import org.hisp.dhis.dxf2.metadata.ExportService;
 import org.hisp.dhis.dxf2.common.FilterOptions;
 import org.hisp.dhis.dxf2.common.ImportOptions;
+import org.hisp.dhis.dxf2.common.JacksonUtils;
+import org.hisp.dhis.dxf2.metadata.ExportService;
 import org.hisp.dhis.dxf2.metadata.ImportService;
 import org.hisp.dhis.dxf2.metadata.MetaData;
 import org.hisp.dhis.dxf2.metadata.tasks.ImportMetaDataTask;
-import org.hisp.dhis.dxf2.common.JacksonUtils;
 import org.hisp.dhis.filter.MetaDataFilter;
 import org.hisp.dhis.importexport.ImportStrategy;
 import org.hisp.dhis.scheduling.TaskCategory;
 import org.hisp.dhis.scheduling.TaskId;
-import org.hisp.dhis.system.notification.Notifier;
 import org.hisp.dhis.system.scheduling.Scheduler;
 import org.hisp.dhis.user.CurrentUserService;
 import org.hisp.dhis.user.User;
+import org.hisp.dhis.webapi.utils.ContextUtils;
 import org.hisp.dhis.webapi.webdomain.WebOptions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
@@ -96,9 +95,6 @@
     @Autowired
     private CurrentUserService currentUserService;
 
-    @Autowired
-    private Notifier notifier;
-
     private boolean dryRun;
 
     private ImportStrategy strategy;