=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageBoolAggregator.java' --- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageBoolAggregator.java 2012-01-09 20:03:56 +0000 +++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageBoolAggregator.java 2012-04-17 14:57:04 +0000 @@ -105,7 +105,7 @@ return values; } - public Map getAggregate( final Collection crossTabValues, + private Map getAggregate( final Collection crossTabValues, final Date startDate, final Date endDate, final Date aggregationStartDate, final Date aggregationEndDate, int unitLevel ) { final Map totalSums = new HashMap(); // === modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntAggregator.java' --- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntAggregator.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntAggregator.java 2012-04-17 14:57:04 +0000 @@ -112,7 +112,7 @@ return values; } - public Map getAggregate( final Collection crossTabValues, + private Map getAggregate( final Collection crossTabValues, final Date startDate, final Date endDate, final Date aggregationStartDate, final Date aggregationEndDate, int unitLevel ) { final Map totalSums = new HashMap(); // === 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 2012-04-17 08:04:52 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java 2012-04-17 14:57:04 +0000 @@ -27,14 +27,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import org.apache.commons.lang.Validate; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.Collection; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.util.StringUtils; -import java.lang.reflect.*; -import java.util.Collection; - /** * @author Lars Helge Overland */ @@ -45,7 +48,7 @@ /** * Invokes method getId() for this object and returns the return value. An * int return type is expected. If the operation fails -1 is returned. - * + * * @param object object to call getId() on. * @return The identifier. */ @@ -56,7 +59,8 @@ Method method = object.getClass().getMethod( "getId" ); return (Integer) method.invoke( object ); - } catch ( Exception ex ) + } + catch ( Exception ex ) { return -1; } @@ -64,8 +68,8 @@ /** * Fetch a property off the object. Returns null if the operation fails. - * - * @param object the object. + * + * @param object the object. * @param property name of the property to get. * @return the value of the property or null. */ @@ -78,7 +82,8 @@ Method method = object.getClass().getMethod( "get" + property ); return (String) method.invoke( object ); - } catch ( Exception ex ) + } + catch ( Exception ex ) { return null; } @@ -87,16 +92,16 @@ /** * Sets a property for the supplied object. Throws an * UnsupportedOperationException if the operation fails. - * + * * @param object Object to modify - * @param name Name of property to set - * @param value Value the property will be set to + * @param name Name of property to set + * @param value Value the property will be set to */ public static void setProperty( Object object, String name, String value ) { - Object[] arguments = new Object[]{value}; + Object[] arguments = new Object[] { value }; - Class[] parameterTypes = new Class[]{String.class}; + Class[] parameterTypes = new Class[] { String.class }; if ( name.length() > 0 ) { @@ -107,7 +112,8 @@ Method concatMethod = object.getClass().getMethod( name, parameterTypes ); concatMethod.invoke( object, arguments ); - } catch ( Exception ex ) + } + catch ( Exception ex ) { throw new UnsupportedOperationException( "Failed to set property", ex ); } @@ -117,11 +123,11 @@ /** * Sets a property for the supplied object. Throws an * UnsupportedOperationException if the operation fails. - * - * @param object Object to modify + * + * @param object Object to modify * @param namePrefix prefix of the property name to set - * @param name Name of property to set - * @param value Value the property will be set to + * @param name Name of property to set + * @param value Value the property will be set to */ public static void setProperty( Object object, String namePrefix, String name, String value ) { @@ -133,7 +139,7 @@ /** * Returns the name of the class that the object is an instance of * org.hisp.dhis.indicator.Indicactor returns Indicator. - * + * * @param object object to determine className for. * @return String containing the class name. */ @@ -144,7 +150,7 @@ /** * Test whether the object is an array or a Collection. - * + * * @param value the object. * @return true if the object is an array or a Collection, false otherwise. */ @@ -168,7 +174,8 @@ try { field = object.getClass().getDeclaredField( fieldName ); - } catch ( NoSuchFieldException e ) + } + catch ( NoSuchFieldException e ) { return false; } @@ -189,7 +196,8 @@ } } - } catch ( ClassCastException e ) + } + catch ( ClassCastException e ) { return false; } @@ -202,7 +210,8 @@ try { return object.getClass().getMethod( "get" + StringUtils.capitalize( fieldName ), classes ); - } catch ( NoSuchMethodException e ) + } + catch ( NoSuchMethodException e ) { log.info( "Getter method was not found for fieldName: " + fieldName ); return null; @@ -216,18 +225,21 @@ try { method = object.getClass().getMethod( "set" + StringUtils.capitalize( fieldName ), classes ); - } catch ( NoSuchMethodException e ) + } + catch ( NoSuchMethodException e ) { } - // if parameter classes was not given, we will retry using the type of the field + // If parameter classes was not given, we will retry using the field type + if ( method == null && classes.length == 0 ) { try { Field field = object.getClass().getDeclaredField( fieldName ); method = findSetterMethod( fieldName, object, field.getType() ); - } catch ( NoSuchFieldException ignored ) + } + catch ( NoSuchFieldException ignored ) { } } @@ -253,11 +265,13 @@ try { return (T) method.invoke( object ); - } catch ( InvocationTargetException e ) + } + catch ( InvocationTargetException e ) { log.info( "InvocationTargetException for fieldName: " + fieldName ); return null; - } catch ( IllegalAccessException e ) + } + catch ( IllegalAccessException e ) { log.info( "IllegalAccessException for fieldName: " + fieldName ); return null; @@ -277,11 +291,13 @@ try { return (T) method.invoke( object, objects ); - } catch ( InvocationTargetException e ) + } + catch ( InvocationTargetException e ) { log.info( "InvocationTargetException for fieldName: " + fieldName ); return null; - } catch ( IllegalAccessException e ) + } + catch ( IllegalAccessException e ) { log.info( "IllegalAccessException for fieldName: " + fieldName ); return null; === modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/StreamUtils.java' --- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/StreamUtils.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/StreamUtils.java 2012-04-17 14:57:04 +0000 @@ -400,15 +400,14 @@ /** * Test for zip stream signature. * + * Signature of zip stream from + * http://www.pkware.com/documents/casestudies/APPNOTE.TXT Local file + * header: local file header signature 4 bytes (0x04034b50) + * * @param instream the BufferedInputStream to test. */ public static boolean isZip( BufferedInputStream instream ) { - /* - * Signature of zip stream from - * http://www.pkware.com/documents/casestudies/APPNOTE.TXT Local file - * header: local file header signature 4 bytes (0x04034b50) - */ instream.mark( 4 ); byte[] b = new byte[4]; byte[] zipSig = new byte[4]; @@ -439,16 +438,15 @@ /** * Test for Gzip stream signature. + * + * Signature of gzip stream from RFC 1952: ID1 (IDentification 1) ID2 + * (IDentification 2) These have the fixed values ID1 = 31 (0x1f, \037), + * ID2 = 139 (0x8b, \213), to identify the file as being in gzip format. * * @param instream the BufferedInputStream to test. */ public static boolean isGZip( BufferedInputStream instream ) { - /* - * Signature of gzip stream from RFC 1952: ID1 (IDentification 1) ID2 - * (IDentification 2) These have the fixed values ID1 = 31 (0x1f, \037), - * ID2 = 139 (0x8b, \213), to identify the file as being in gzip format. - */ instream.mark( 2 ); byte[] b = new byte[2];