0N/A/*
157N/A * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
157N/A * published by the Free Software Foundation.
0N/A *
157N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
0N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0N/A * or visit www.oracle.com if you need additional information or have any
157N/A * questions.
157N/A */
157N/A
0N/A/*
0N/A *@test
0N/A *@bug 4518811
0N/A *@summary Verifies the minimum days of the week for euro locales
0N/A */
0N/A
0N/A// this code is a bit brute-force, but I've been coding in nothing but Shell for the last year, so I'm rusty.
0N/A
0N/Aimport java.util.Locale;
0N/Aimport java.util.Calendar;
0N/A
0N/Apublic class Bug4518811 {
0N/A public static void main(String [] args) {
0N/A
0N/A int totalErrors=0;
0N/A
0N/A // go through the locales
0N/A totalErrors += getDays("ca", "ES");
0N/A totalErrors += getDays("cs", "CZ");
0N/A totalErrors += getDays("da", "DK");
totalErrors += getDays("de", "AT");
totalErrors += getDays("el", "GR");
totalErrors += getDays("en", "GB");
totalErrors += getDays("en", "IE");
totalErrors += getDays("es", "ES");
totalErrors += getDays("et", "EE");
totalErrors += getDays("fi", "FI");
totalErrors += getDays("fr", "BE");
totalErrors += getDays("fr", "FR");
totalErrors += getDays("is", "IS");
totalErrors += getDays("lt", "LT");
totalErrors += getDays("nl", "BE");
totalErrors += getDays("pl", "PL");
totalErrors += getDays("pt", "PT");
if (totalErrors > 0)
throw new RuntimeException();
//System.err.println("Minimal Days in First Week: "+c.getMinimalDaysInFirstWeek());
}
static int getDays(String lang, String loc){
int errors=0;
Locale newlocale = new Locale(lang, loc);
Calendar newCal = Calendar.getInstance(newlocale);
int minDays = newCal.getMinimalDaysInFirstWeek();
System.out.println("The Min Days in First Week for "+ lang +"_" + loc + " is " + minDays);
if (minDays != 4){
System.out.println("Warning! Should be 4, not " + minDays +"!");
errors++;
}
return errors;
}
}