------------------------------------------------------------ revno: 5742 committer: Jason P. Pickering <jason.p.picker...@gmail.com> branch nick: dhis2 timestamp: Wed 2012-01-18 06:58:32 +0200 message: Altered i18n.formatPeriod to handle bad date formats in property files. modified: dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/I18nFormat.java dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_es_ES.properties dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_fr_FR.properties
-- 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/i18n/I18nFormat.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/I18nFormat.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/I18nFormat.java 2012-01-18 04:58:32 +0000 @@ -48,6 +48,7 @@ private static final DecimalFormat FORMAT_VALUE = new DecimalFormat( "#.#;#.#" ); // Fixed for now private static final String EMPTY = ""; private static final String NAN = "NaN"; + private static final String INVALID_DATE="Invalid date format"; private ResourceBundle resourceBundle; @@ -167,6 +168,12 @@ return commonFormatting( date, resourceBundle.getString( "format.datetime" ) ); } + /** + * Formats a period. Returns null if value is null. Returns INVALID_DATE if formatting string is invalid. + * + * + * @param period the value to format. + */ public String formatPeriod( Period period ) { if ( period == null ) @@ -187,7 +194,14 @@ String startDate = commonFormatting( period.getStartDate(), resourceBundle.getString( keyStartDate ) ); String endDate = commonFormatting( period.getEndDate(), resourceBundle.getString( keyEndDate ) ); - return Character.toUpperCase( startDate.charAt( 0 ) ) + startDate.substring( 1 ) + endDate; + try + { + return Character.toUpperCase( startDate.charAt( 0 ) ) + startDate.substring( 1 ) + endDate; + } + catch ( IllegalArgumentException ex ) + { + return INVALID_DATE; + } } /** === modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_es_ES.properties' --- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_es_ES.properties 2011-12-14 08:10:22 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_es_ES.properties 2012-01-18 04:58:32 +0000 @@ -63,10 +63,10 @@ first_name=Nombre format.BiMonthly.endDate=MMM aaaa format.BiMonthly.startDate=MMM 'hasta ' -format.date.label.jquery=aa-mm-dd -format.FinancialApril.endDate=dd MMM aaaa +format.date.label.jquery=yy-mm-dd +format.FinancialApril.endDate=dd MMM yyyy format.FinancialApril.startDate=dd MMM aaaa 'hasta ' -format.FinancialJuly.endDate=dd MMM aaaa +format.FinancialJuly.endDate=dd MMM yyyy format.FinancialJuly.startDate=dd MMM aaaa 'hasta ' format.FinancialOct.endDate=aaaa format.FinancialOct.startDate=A\u00f1o Fiscal @@ -247,14 +247,14 @@ current_user=Usuario actual format.time=HH\:mm format.Monthly.startDate=MMMM yyyy -format.Weekly.startDate='Week' w' ' +format.Weekly.startDate=yyyy 'S' w translation_languagecode=C\u00f3digo del idioma dhis-web-maintenance-user=Usuarios translation_translate=Traducir weekday.short.saturday=S\u00e1b help_contents=Contenido de la Ayuda format.date=yyyy-MM-dd -"exception_explanation_text=El sistema ha fallado en ejecutar la operaci\u00f3n. Normalmente no se pierden los datos y se puede continuar trabajando yendo atras. Si se desea reportar el incidente se puede guardar esta pagina seleccionando ""Fichero -> Guardar como"" en el navegador e " +exception_explanation_text=El sistema ha fallado en ejecutar la operaci\u00f3n. Normalmente no se pierden los datos y se puede continuar trabajando yendo atras. Si se desea reportar el incidente se puede guardar esta pagina seleccionando ""Fichero -> Guardar como"" en el navegador e " send_feedback=Enviar retroalimentaci\u00f3n dhis2_issue_tracking=Seguimiento de problemas del DHIS 2 weekday.tuesday=Martes === modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_fr_FR.properties' --- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_fr_FR.properties 2012-01-16 06:35:50 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_fr_FR.properties 2012-01-18 04:58:32 +0000 @@ -86,7 +86,6 @@ start_date=Date de d\u00e9but end_date=Date de fin entry=Entr\u00e9e -comment=Commentaire operations=Op\u00e9rations add_new=Ajouter nouveau rename=Renommer @@ -127,15 +126,15 @@ format.Weekly.endDate= format.Monthly.startDate=MMMM yyyy format.Monthly.endDate= -format.BiMonthly.startDate=MMM '\u00e0 ' +format.BiMonthly.startDate=MMM \u00e0 format.BiMonthly.endDate=MMM yyyy -format.Quarterly.startDate=MMM '\u00e0 '' +format.Quarterly.startDate=MMM 'u00e0 ' format.Quarterly.endDate=MMM yyyy -format.SixMonthly.startDate=MMM '\u00e0 ' +format.SixMonthly.startDate=MMM 'u00e0 ' format.SixMonthly.endDate=MMM yyyy format.Yearly.startDate=yyyy format.Yearly.endDate= -format.TwoYearly.startDate=yyyy 'et' +format.TwoYearly.startDate=yyyy 'et ' format.TwoYearly.endDate=yyyy format.OnChange.startDate=yyyy-MM-dd '- ' format.OnChange.endDate=yyyy-MM-dd
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp