← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1051: Some cleanup (testing findbugs)

 

------------------------------------------------------------
revno: 1051
committer: Jo Størset <storset@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2009-11-18 16:19:26 +0100
message:
  Some cleanup (testing findbugs)
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dimension/DefaultDimensionService.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ConversionUtils.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/AddReportAction.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/dimension/DefaultDimensionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dimension/DefaultDimensionService.java	2009-11-16 10:32:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dimension/DefaultDimensionService.java	2009-11-18 15:19:26 +0000
@@ -106,28 +106,29 @@
     }
     
     public Collection<DataElement> getDataElements( DimensionSet dimensionSet )
-    {        
-        if ( dimensionSet != null )
-        {
-            if ( dimensionSet.getDimensionSetType().equals( TYPE_CATEGORY_COMBO ) )
-            {
-                Integer id = getDimensionSetIdentifiers( dimensionSet.getDimensionSetId() )[0];
-                
-                DataElementCategoryCombo categoryCombo = categoryService.getDataElementCategoryCombo( id );
-
-                return dataElementService.getDataElementByCategoryCombo( categoryCombo );
-            }
-            else // TYPE_GROUP_SET
-            {
-                Integer[] ids = getDimensionSetIdentifiers( dimensionSet.getDimensionSetId() );
-                
-                Set<DataElementGroupSet> groupSets = getDataElementDimensionSet( ids );
-                
-                return dataElementService.getDataElementsByGroupSets( groupSets );
-            }
-        }
-        
-        return null;
+    {
+        if ( dimensionSet == null )
+        {
+            return null;
+        }
+
+        if ( dimensionSet.getDimensionSetType().equals( TYPE_CATEGORY_COMBO ) )
+        {
+            Integer id = getDimensionSetIdentifiers( dimensionSet.getDimensionSetId() )[0];
+
+            DataElementCategoryCombo categoryCombo = categoryService.getDataElementCategoryCombo( id );
+
+            return dataElementService.getDataElementByCategoryCombo( categoryCombo );
+        }
+
+        // TYPE_GROUP_SET
+
+        Integer[] ids = getDimensionSetIdentifiers( dimensionSet.getDimensionSetId() );
+
+        Set<DataElementGroupSet> groupSets = getDataElementDimensionSet( ids );
+
+        return dataElementService.getDataElementsByGroupSets( groupSets );
+
     }
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ConversionUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ConversionUtils.java	2009-11-10 15:17:51 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ConversionUtils.java	2009-11-18 15:19:26 +0000
@@ -92,20 +92,22 @@
      * Creates an array of Integers out of an array of Strings.
      * 
      * @param strings the array of Strings.
-     * @return an array of Integers.
+     * @return an array of Integers, an empty array if input is null.
      */
     public static Integer[] getIntegerArray( String[] strings )
     {
+
+        if ( strings == null )
+        {
+            return new Integer[0];
+        }
+
         Integer[] integers = new Integer[strings.length];
         
-        if ( strings != null )
+        for ( int i = 0; i < strings.length; i++ )
         {
-            for ( int i = 0; i < strings.length; i++ )
-            {
-                integers[i] = Integer.valueOf( strings[i] );            
-            }
+            integers[i] = Integer.valueOf( strings[i] );
         }
-        
         return integers;
     }
     

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java	2009-08-20 08:17:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java	2009-11-18 15:19:26 +0000
@@ -176,7 +176,7 @@
 
         Date cDate = null;
 
-        if ( closedDate != null || closedDate.trim().length() != 0 )
+        if ( closedDate != null && closedDate.trim().length() != 0 )
         {
             cDate = format.parseDate( closedDate );
         }

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/AddReportAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/AddReportAction.java	2009-09-14 16:00:37 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/AddReportAction.java	2009-11-18 15:19:26 +0000
@@ -206,7 +206,7 @@
 
         log.info( "Upload file name: " + fileName + ", content type: " + contentType );
             
-        if ( ( type != null || type.equals( Report.TYPE_JASPER ) ) && file != null )
+        if ( ( type != null && type.equals( Report.TYPE_JASPER ) ) && file != null )
         {
             // -----------------------------------------------------------------
             // Design file upload