← Back to team overview

dhis2-devs team mailing list archive

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

 

------------------------------------------------------------
revno: 1082
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2009-11-23 13:12:51 +0100
message:
  Fixed issues reported by FindBugs.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessConfiguration.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/databrowser/MetaValue.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitHierarchyVerifier.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/OrganisationUnitRelationshipRowHandler.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/completeness/DataSetCompletenessConfiguration.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessConfiguration.java	2009-04-27 13:27:32 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessConfiguration.java	2009-11-23 12:12:51 +0000
@@ -38,12 +38,7 @@
 {
     private Integer days;
     
-    private static transient Calendar cal;
-
-    static
-    {
-        cal = Calendar.getInstance();
-    }
+    private transient Calendar cal = Calendar.getInstance();
     
     // -------------------------------------------------------------------------
     // Constructors
@@ -70,10 +65,8 @@
         {
             if ( days != null )
             {
-                cal.clear();
-                
-                cal.setTime( period.getEndDate() );
-                                       
+                cal.clear();                
+                cal.setTime( period.getEndDate() );                                       
                 cal.add( Calendar.DAY_OF_MONTH, days );
                 
                 date = cal.getTime();

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/databrowser/MetaValue.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/databrowser/MetaValue.java	2009-08-24 13:55:25 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/databrowser/MetaValue.java	2009-11-23 12:12:51 +0000
@@ -1,5 +1,6 @@
 package org.hisp.dhis.databrowser;
 
+
 /*
  * Copyright (c) 2004-${year}, University of Oslo
  * All rights reserved.
@@ -113,7 +114,29 @@
     @Override
     public boolean equals( Object o )
     {
-        return o.equals( name );
-    }
-
+        if ( this == o )
+        {
+            return true;
+        }
+
+        if ( o == null )
+        {
+            return false;
+        }
+
+        if ( !(o instanceof MetaValue) )
+        {
+            return false;
+        }
+
+        final MetaValue other = (MetaValue) o;
+
+        return name.equals( other.getName() );
+    }
+    
+    @Override
+    public int hashCode()
+    {
+        return name.hashCode();
+    }
 }

=== 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-19 18:58:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java	2009-11-23 12:12:51 +0000
@@ -176,7 +176,7 @@
     // Dimension
     // -------------------------------------------------------------------------
 
-    public static Dimension DIMENSION = new DataElementDimension();
+    public static final Dimension DIMENSION = new DataElementDimension();
 
     public static class DataElementDimension
         extends Dimension

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java	2009-10-22 07:41:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java	2009-11-23 12:12:51 +0000
@@ -28,8 +28,6 @@
 
 import java.io.Serializable;
 
-import org.hisp.dhis.dataelement.DataElement;
-
 /**
  * @author Abyot Asalefew
  * @version $Id$
@@ -84,7 +82,7 @@
             return false;
         }
 
-        if ( !(o instanceof DataElement) )
+        if ( !(o instanceof PatientAttribute) )
         {
             return false;
         }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java	2009-11-06 10:43:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java	2009-11-23 12:12:51 +0000
@@ -83,7 +83,7 @@
     // Dimension
     // -------------------------------------------------------------------------
 
-    public static Dimension DIMENSION = new PeriodDimension();
+    public static final Dimension DIMENSION = new PeriodDimension();
     
     public static class PeriodDimension
         extends Dimension

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2009-11-23 11:40:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2009-11-23 12:12:51 +0000
@@ -232,7 +232,7 @@
     /**
      * The I18nFormat used for internationalization of ie. periods.
      */
-    private I18nFormat i18nFormat;
+    private transient I18nFormat i18nFormat;
     
     /**
      * The name of the reporting month.

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java	2009-11-06 10:43:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java	2009-11-23 12:12:51 +0000
@@ -50,7 +50,7 @@
     // Dimension
     // -------------------------------------------------------------------------
 
-    public static Dimension DIMENSION = new SourceDimension();
+    public static final Dimension DIMENSION = new SourceDimension();
     
     public static class SourceDimension
         extends Dimension

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitHierarchyVerifier.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitHierarchyVerifier.java	2009-11-03 14:25:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitHierarchyVerifier.java	2009-11-23 12:12:51 +0000
@@ -48,7 +48,7 @@
 {
     private static final Log log = LogFactory.getLog( OrganisationUnitHierarchyVerifier.class );
     
-    public static Date START_OF_TIME;
+    public static final Date START_OF_TIME;
     
     static
     {

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/OrganisationUnitRelationshipRowHandler.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/OrganisationUnitRelationshipRowHandler.java	2009-08-31 15:37:16 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/OrganisationUnitRelationshipRowHandler.java	2009-11-23 12:12:51 +0000
@@ -83,7 +83,7 @@
         final Integer parentId = organisationUnitMapping.get( dhis14Association.getGroupId() );
         final Integer childId = organisationUnitMapping.get( dhis14Association.getMemberId() );
         
-        if ( parentId != null && childId != null && parentId != childId ) // Parent id equals child id for root
+        if ( parentId != null && childId != null && parentId.equals( childId ) ) // Parent id equals child id for root
         {
             association.setGroupId( parentId );
             association.setMemberId( childId );