dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14436
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4902: Improved coordinate validation, thanks Jason
------------------------------------------------------------
revno: 4902
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-10-12 09:51:57 +0200
message:
Improved coordinate validation, thanks Jason
modified:
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java
dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ValidationUtilsTest.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/exp/ExportDataMartAction.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-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java 2011-10-06 18:31:41 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java 2011-10-12 07:51:57 +0000
@@ -41,7 +41,7 @@
*/
public class ValidationUtils
{
- private static Pattern COORDINATE_PATTERN = Pattern.compile( "\\[([\\+\\-]*\\d+\\.*\\d*),([\\+\\-]*\\d+\\.*\\d*)\\]" );
+ private static Pattern COORDINATE_PATTERN = Pattern.compile( "\\[([+-]?\\d+\\.?\\d*),([+-]?\\d+\\.?\\d*)\\]" );
/**
* Validates whether an email string is valid.
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ValidationUtilsTest.java'
--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ValidationUtilsTest.java 2011-10-06 17:27:11 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ValidationUtilsTest.java 2011-10-12 07:51:57 +0000
@@ -51,7 +51,9 @@
assertFalse( coordinateIsValid( "23.34343 56.3232" ) );
assertFalse( coordinateIsValid( "[23.34f43,56.3232]" ) );
assertFalse( coordinateIsValid( "23.34343,56.323.2" ) );
- assertFalse( coordinateIsValid( "S-0.27726 E37.08472" ) );
+ assertFalse( coordinateIsValid( "[23.34343,56..3232]" ) );
+ assertFalse( coordinateIsValid( "[++37,-28.94221]" ) );
+ assertFalse( coordinateIsValid( "S-0.27726 E37.08472" ) );
assertFalse( coordinateIsValid( null ) );
}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/exp/ExportDataMartAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/exp/ExportDataMartAction.java 2011-03-22 17:29:14 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/exp/ExportDataMartAction.java 2011-10-12 07:51:57 +0000
@@ -71,23 +71,18 @@
private static final DateFormat dateFormat = new SimpleDateFormat( "yyyyMMdd" );
- // parameter errors
private static final String NO_STARTDATE = "The request is missing a startDate parameter";
-
private static final String NO_ENDDATE = "The request is missing an endDate parameter";
-
private static final String BAD_STARTDATE = "The request has a bad startDate parameter. Required format is YYYMMDD";
-
private static final String BAD_ENDDATE = "The request has a bad endDate parameter. Required format is YYYMMDD";
-
private static final String NO_ROOT = "The request is missing a non-zero dataSourceRoot parameter";
-
private static final String NO_LEVEL = "The request is missing a non-zero dataSourceLevel parameter";
// http header result type
private static final String CLIENT_ERROR = "client-error";
private static final int HTTP_ERROR = 400;
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -155,9 +150,9 @@
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
+
public String execute() throws IOException
{
- // do a basic audit log
HttpServletRequest request = ServletActionContext.getRequest();
log.info( "DataMart export request from " + currentUserService.getCurrentUsername() +