← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5409: added basic error report for /api/reportTables/uid/data*

 

------------------------------------------------------------
revno: 5409
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-12-14 12:51:10 +0100
message:
  added basic error report for /api/reportTables/uid/data*
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.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-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java	2011-12-14 11:29:43 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java	2011-12-14 11:51:10 +0000
@@ -51,6 +51,7 @@
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Date;
 
@@ -129,6 +130,12 @@
         if ( organisationUnitUid == null && period == null )
         {
             response.setStatus( HttpServletResponse.SC_BAD_REQUEST );
+            response.setContentType( "text/plain" );
+
+            PrintWriter writer = new PrintWriter( response.getOutputStream() );
+            writer.println( "PDF needs either organisationUnit or period parameter." );
+            writer.flush();
+
             return;
         }
 
@@ -151,6 +158,12 @@
         if ( organisationUnitUid == null && period == null )
         {
             response.setStatus( HttpServletResponse.SC_BAD_REQUEST );
+            response.setContentType( "text/plain" );
+
+            PrintWriter writer = new PrintWriter( response.getOutputStream() );
+            writer.println( "XLS needs either organisationUnit or period parameter." );
+            writer.flush();
+
             return;
         }
 
@@ -173,6 +186,12 @@
         if ( organisationUnitUid == null && period == null )
         {
             response.setStatus( HttpServletResponse.SC_BAD_REQUEST );
+            response.setContentType( "text/plain" );
+
+            PrintWriter writer = new PrintWriter( response.getOutputStream() );
+            writer.println( "CSV needs either organisationUnit or period parameter." );
+            writer.flush();
+
             return;
         }