dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25121
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12379: fixed possible NPE error
------------------------------------------------------------
revno: 12379
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-10-02 13:02:41 +0200
message:
fixed possible NPE error
modified:
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementsAction.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-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementsAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementsAction.java 2013-10-02 11:02:41 +0000
@@ -28,11 +28,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
import org.apache.struts2.ServletActionContext;
+import org.hisp.dhis.common.IdentifiableObjectUtils;
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
@@ -47,7 +44,10 @@
import org.hisp.dhis.system.filter.AggregatableDataElementFilter;
import org.hisp.dhis.system.util.FilterUtils;
import org.hisp.dhis.util.ContextUtils;
-import org.hisp.dhis.common.IdentifiableObjectUtils;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
/**
* @author Lars Helge Overland
@@ -201,7 +201,7 @@
else
{
dataElements = new ArrayList<DataElement>( dataElementService.getAllDataElements() );
-
+
ContextUtils.clearIfNotModified( ServletActionContext.getRequest(), ServletActionContext.getResponse(), dataElements );
}
@@ -210,6 +210,11 @@
dataElements = IdentifiableObjectUtils.filterNameByKey( dataElements, key, true );
}
+ if ( dataElements == null )
+ {
+ dataElements = new ArrayList<DataElement>();
+ }
+
Collections.sort( dataElements, IdentifiableObjectNameComparator.INSTANCE );
if ( aggregate )