← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1085: Fixed issues reported by FindBugs.

 

------------------------------------------------------------
revno: 1085
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2009-11-23 14:26:45 +0100
message:
  Fixed issues reported by FindBugs.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/comparator/DataElementGroupSetNameComparator.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierService.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/tallysheet/DefaultTallySheetPdfService.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-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java	2009-11-23 12:12:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java	2009-11-23 13:26:45 +0000
@@ -354,15 +354,7 @@
 
     public String getDomainTypeNullSafe()
     {
-        if ( domainType == null )
-        {
-            return DataElement.DOMAIN_TYPE_AGGREGATE;
-        }
-
-        else
-        {
-            return domainType;
-        }
+        return domainType != null ? domainType : DOMAIN_TYPE_AGGREGATE;
     }
     
     public Set<DataElement> getDataElements()

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/comparator/DataElementGroupSetNameComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/comparator/DataElementGroupSetNameComparator.java	2009-11-07 21:25:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/comparator/DataElementGroupSetNameComparator.java	2009-11-23 13:26:45 +0000
@@ -1,9 +1,5 @@
 package org.hisp.dhis.dataelement.comparator;
 
-import java.util.Comparator;
-
-import org.hisp.dhis.dataelement.DataElementGroupSet;
-
 /*
  * Copyright (c) 2004-2007, University of Oslo
  * All rights reserved.
@@ -30,6 +26,11 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
+import java.util.Comparator;
+
+import org.hisp.dhis.dataelement.DataElementGroupSet;
+
 /**
  * @author Tran Thanh Tri
  * @version $Id$
@@ -37,10 +38,8 @@
 public class DataElementGroupSetNameComparator
     implements Comparator<DataElementGroupSet>
 {
-
     public int compare( DataElementGroupSet o1, DataElementGroupSet o2 )
     {
         return o1.getName().compareTo( o2.getName() );
     }
-
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierService.java	2009-11-20 07:45:12 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierService.java	2009-11-23 13:26:45 +0000
@@ -148,11 +148,11 @@
 
         if ( nextIdentifierIndex.length() < PatientIdentifier.IDENTIFIER_INDEX_LENGTH )
         {
-            String prefix = "0";
+            StringBuilder prefix = new StringBuilder( "0" );
 
             for ( int i = 1; i < PatientIdentifier.IDENTIFIER_INDEX_LENGTH - nextIdentifierIndex.length(); i++ )
             {
-                prefix += "0";
+                prefix.append( "0" );
             }
 
             nextIdentifier = orgUnit.getShortName() + "." + prefix + nextIdentifierIndex;

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/tallysheet/DefaultTallySheetPdfService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/tallysheet/DefaultTallySheetPdfService.java	2009-11-23 12:22:51 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/tallysheet/DefaultTallySheetPdfService.java	2009-11-23 13:26:45 +0000
@@ -171,32 +171,32 @@
 
     private PdfPCell createCellsCell( int rows, Font font, int rowWidth )
     {
-        String cellRows = "";
+        StringBuilder cellRows = new StringBuilder();
 
         for ( int i = 0; i < rows; i++ )
         {
             if ( i > 0 )
             {
-                cellRows += "\n";
+                cellRows.append( "\n" );
             }
             
             for ( int j = 0; j < rowWidth; j++ )
             {
                 if ( j % 5 == 0 )
                 {
-                    cellRows += " ";
+                    cellRows.append( " " );
                 }
                 
                 if ( j != 0 && j % 25 == 0 )
                 {
-                    cellRows += "    ";
+                    cellRows.append( "    " );
                 }
                 
-                cellRows += "0";
+                cellRows.append( "0" );
             }
         }
 
-        Paragraph cellParagraph = new Paragraph( cellRows, font );
+        Paragraph cellParagraph = new Paragraph( cellRows.toString(), font );
         PdfPCell cellCell = new PdfPCell( cellParagraph );
         cellCell.setBorderWidth( 0 );
         cellCell.setBorderWidthTop( (float) 0.5 );