Merge
authorchegar
Tue, 22 Mar 2016 16:02:25 +0000
changeset 36657 3b0dd9e3e474
parent 36656 a8cad521af47 (current diff)
parent 36653 3e045f3e778c (diff)
child 36658 e02dc1bb6aed
Merge
jdk/test/TEST.groups
jdk/test/sun/net/idn/TestStringPrep.java
--- a/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatter.java	Tue Mar 22 10:42:32 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatter.java	Tue Mar 22 16:02:25 2016 +0000
@@ -932,6 +932,7 @@
      * <li>The {@link #ISO_LOCAL_DATE_TIME}
      * <li>The {@link ZoneOffset#getId() offset ID}. If the offset has seconds then
      *  they will be handled even though this is not part of the ISO-8601 standard.
+     *  The offset parsing is lenient, which allows the minutes and seconds to be optional.
      *  Parsing is case insensitive.
      * </ul>
      * <p>
@@ -944,7 +945,9 @@
         ISO_OFFSET_DATE_TIME = new DateTimeFormatterBuilder()
                 .parseCaseInsensitive()
                 .append(ISO_LOCAL_DATE_TIME)
+                .parseLenient()
                 .appendOffsetId()
+                .parseStrict()
                 .toFormatter(ResolverStyle.STRICT, IsoChronology.INSTANCE);
     }
 
@@ -1169,6 +1172,7 @@
      * <li>If the offset is not available to format or parse then the format is complete.
      * <li>The {@link ZoneOffset#getId() offset ID} without colons. If the offset has
      *  seconds then they will be handled even though this is not part of the ISO-8601 standard.
+     *  The offset parsing is lenient, which allows the minutes and seconds to be optional.
      *  Parsing is case insensitive.
      * </ul>
      * <p>
@@ -1187,7 +1191,9 @@
                 .appendValue(MONTH_OF_YEAR, 2)
                 .appendValue(DAY_OF_MONTH, 2)
                 .optionalStart()
+                .parseLenient()
                 .appendOffset("+HHMMss", "Z")
+                .parseStrict()
                 .toFormatter(ResolverStyle.STRICT, IsoChronology.INSTANCE);
     }
 
--- a/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Tue Mar 22 10:42:32 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Tue Mar 22 16:02:25 2016 +0000
@@ -866,7 +866,9 @@
      * Appends the zone offset, such as '+01:00', to the formatter.
      * <p>
      * This appends an instruction to format/parse the offset ID to the builder.
-     * This is equivalent to calling {@code appendOffset("+HH:MM:ss", "Z")}.
+     * This is equivalent to calling {@code appendOffset("+HH:mm:ss", "Z")}.
+     * See {@link #appendOffset(String, String)} for details on formatting
+     * and parsing.
      *
      * @return this, for chaining, not null
      */
@@ -886,9 +888,18 @@
      * If the offset cannot be obtained then an exception is thrown unless the
      * section of the formatter is optional.
      * <p>
-     * During parsing, the offset is parsed using the format defined below.
-     * If the offset cannot be parsed then an exception is thrown unless the
-     * section of the formatter is optional.
+     * When parsing in strict mode, the input must contain the mandatory
+     * and optional elements are defined by the specified pattern.
+     * If the offset cannot be parsed then an exception is thrown unless
+     * the section of the formatter is optional.
+     * <p>
+     * When parsing in lenient mode, only the hours are mandatory - minutes
+     * and seconds are optional. The colons are required if the specified
+     * pattern contains a colon. If the specified pattern is "+HH", the
+     * presence of colons is determined by whether the character after the
+     * hour digits is a colon or not.
+     * If the offset cannot be parsed then an exception is thrown unless
+     * the section of the formatter is optional.
      * <p>
      * The format of the offset is controlled by a pattern which must be one
      * of the following:
@@ -902,6 +913,10 @@
      * <li>{@code +HH:MM:ss} - hour and minute, with second if non-zero, with colon
      * <li>{@code +HHMMSS} - hour, minute and second, no colon
      * <li>{@code +HH:MM:SS} - hour, minute and second, with colon
+     * <li>{@code +HHmmss} - hour, with minute if non-zero or with minute and
+     * second if non-zero, no colon
+     * <li>{@code +HH:mm:ss} - hour, with minute if non-zero or with minute and
+     * second if non-zero, with colon
      * </ul>
      * The "no offset" text controls what text is printed when the total amount of
      * the offset fields to be output is zero.
@@ -3318,7 +3333,7 @@
      */
     static final class OffsetIdPrinterParser implements DateTimePrinterParser {
         static final String[] PATTERNS = new String[] {
-            "+HH", "+HHmm", "+HH:mm", "+HHMM", "+HH:MM", "+HHMMss", "+HH:MM:ss", "+HHMMSS", "+HH:MM:SS",
+            "+HH", "+HHmm", "+HH:mm", "+HHMM", "+HH:MM", "+HHMMss", "+HH:MM:ss", "+HHMMSS", "+HH:MM:SS", "+HHmmss", "+HH:mm:ss",
         };  // order used in pattern builder
         static final OffsetIdPrinterParser INSTANCE_ID_Z = new OffsetIdPrinterParser("+HH:MM:ss", "Z");
         static final OffsetIdPrinterParser INSTANCE_ID_ZERO = new OffsetIdPrinterParser("+HH:MM:ss", "0");
@@ -3365,11 +3380,11 @@
                 int output = absHours;
                 buf.append(totalSecs < 0 ? "-" : "+")
                     .append((char) (absHours / 10 + '0')).append((char) (absHours % 10 + '0'));
-                if (type >= 3 || (type >= 1 && absMinutes > 0)) {
+                if ((type >= 3 && type < 9) || (type >= 9 && absSeconds > 0) || (type >= 1 && absMinutes > 0)) {
                     buf.append((type % 2) == 0 ? ":" : "")
                         .append((char) (absMinutes / 10 + '0')).append((char) (absMinutes % 10 + '0'));
                     output += absMinutes;
-                    if (type >= 7 || (type >= 5 && absSeconds > 0)) {
+                    if (type == 7  || type == 8 || (type >= 5 && absSeconds > 0)) {
                         buf.append((type % 2) == 0 ? ":" : "")
                             .append((char) (absSeconds / 10 + '0')).append((char) (absSeconds % 10 + '0'));
                         output += absSeconds;
@@ -3387,6 +3402,15 @@
         public int parse(DateTimeParseContext context, CharSequence text, int position) {
             int length = text.length();
             int noOffsetLen = noOffsetText.length();
+            int parseType = type;
+            if (context.isStrict() == false) {
+                if ((parseType > 0 && (parseType % 2) == 0) ||
+                    (parseType == 0 && length > position + 3 && text.charAt(position + 3) == ':')) {
+                    parseType = 10;
+                } else {
+                    parseType = 9;
+                }
+            }
             if (noOffsetLen == 0) {
                 if (position == length) {
                     return context.setParsedField(OFFSET_SECONDS, 0, position, position);
@@ -3407,9 +3431,9 @@
                 int negative = (sign == '-' ? -1 : 1);
                 int[] array = new int[4];
                 array[0] = position + 1;
-                if ((parseNumber(array, 1, text, true) ||
-                        parseNumber(array, 2, text, type >=3) ||
-                        parseNumber(array, 3, text, false)) == false) {
+                if ((parseNumber(array, 1, text, true, parseType) ||
+                        parseNumber(array, 2, text, parseType >= 3 && parseType < 9, parseType) ||
+                        parseNumber(array, 3, text, parseType == 7 || parseType == 8, parseType)) == false) {
                     // success
                     long offsetSecs = negative * (array[1] * 3600L + array[2] * 60L + array[3]);
                     return context.setParsedField(OFFSET_SECONDS, offsetSecs, position, array[0]);
@@ -3417,7 +3441,7 @@
             }
             // handle special case of empty no offset text
             if (noOffsetLen == 0) {
-                return context.setParsedField(OFFSET_SECONDS, 0, position, position + noOffsetLen);
+                return context.setParsedField(OFFSET_SECONDS, 0, position, position);
             }
             return ~position;
         }
@@ -3429,14 +3453,15 @@
          * @param arrayIndex  the index to parse the value into
          * @param parseText  the offset ID, not null
          * @param required  whether this number is required
+         * @param parseType the offset pattern type
          * @return true if an error occurred
          */
-        private boolean parseNumber(int[] array, int arrayIndex, CharSequence parseText, boolean required) {
-            if ((type + 3) / 2 < arrayIndex) {
+        private boolean parseNumber(int[] array, int arrayIndex, CharSequence parseText, boolean required, int parseType) {
+            if ((parseType + 3) / 2 < arrayIndex) {
                 return false;  // ignore seconds/minutes
             }
             int pos = array[0];
-            if ((type % 2) == 0 && arrayIndex > 1) {
+            if ((parseType % 2) == 0 && arrayIndex > 1) {
                 if (pos + 1 > parseText.length() || parseText.charAt(pos) != ':') {
                     return required;
                 }
--- a/jdk/src/java.base/share/native/libzip/zip_util.c	Tue Mar 22 10:42:32 2016 +0000
+++ b/jdk/src/java.base/share/native/libzip/zip_util.c	Tue Mar 22 16:02:25 2016 +0000
@@ -1408,7 +1408,7 @@
             case Z_OK:
                 break;
             case Z_STREAM_END:
-                if (count != 0 || strm.total_out != entry->size) {
+                if (count != 0 || strm.total_out != (uInt)entry->size) {
                     *msg = "inflateFully: Unexpected end of stream";
                     inflateEnd(&strm);
                     return JNI_FALSE;
@@ -1528,7 +1528,7 @@
             case Z_OK:
                 break;
             case Z_STREAM_END:
-                if (strm.total_out != outLen) {
+                if (strm.total_out != (uInt)outLen) {
                     *pmsg = "INFLATER_inflateFully: Unexpected end of stream";
                     inflateEnd(&strm);
                     return JNI_FALSE;
--- a/jdk/test/TEST.groups	Tue Mar 22 10:42:32 2016 +0000
+++ b/jdk/test/TEST.groups	Tue Mar 22 16:02:25 2016 +0000
@@ -494,7 +494,8 @@
   sun/reflect/CallerSensitive/MissingCallerSensitive.java \
   sun/security/util/Resources/NewNamesFormat.java \
   vm/verifier/defaultMethods/DefaultMethodRegressionTestsRun.java \
-  javax/xml/ws/clientjar/TestWsImport.java
+  javax/xml/ws/clientjar/TestWsImport.java \
+  javax/xml/bind/xjc/8145039/JaxbMarshallTest.java
 
 # JRE adds further tests to compact3
 #
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jdi/BadAgentPath.java	Tue Mar 22 16:02:25 2016 +0000
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.ProcessTools;
+import jdk.testlibrary.Utils;
+
+/* @test
+ * @bug 8147456
+ * @summary Check that providing a non-existing -agentpath gives a proper error.
+ * @author Sharath Ballal
+ *
+ * @library /lib/testlibrary
+ * @modules java.management
+ * @build jdk.testlibrary.*
+ * @build BadAgentPath
+ * @run driver BadAgentPath
+ */
+
+public class BadAgentPath {
+
+    public static void main(String[] args) throws Throwable {
+        OutputAnalyzer output = ProcessTools.executeTestJvm("-agentpath:/badAgent/agent", "-version");
+        output.shouldContain("Could not find agent library /badAgent/agent");
+    }
+}
--- a/jdk/test/java/time/tck/java/time/TCKZonedDateTime.java	Tue Mar 22 10:42:32 2016 +0000
+++ b/jdk/test/java/time/tck/java/time/TCKZonedDateTime.java	Tue Mar 22 16:02:25 2016 +0000
@@ -761,6 +761,7 @@
                 {"2012-06-30T12:30:40-01:00[UT-01:00]", 2012, 6, 30, 12, 30, 40, 0, "UT-01:00"},
                 {"2012-06-30T12:30:40-01:00[UTC-01:00]", 2012, 6, 30, 12, 30, 40, 0, "UTC-01:00"},
                 {"2012-06-30T12:30:40+01:00[Europe/London]", 2012, 6, 30, 12, 30, 40, 0, "Europe/London"},
+                {"2012-06-30T12:30:40+01", 2012, 6, 30, 12, 30, 40, 0, "+01:00"},
         };
     }
 
--- a/jdk/test/java/time/tck/java/time/format/TCKDateTimeFormatterBuilder.java	Tue Mar 22 10:42:32 2016 +0000
+++ b/jdk/test/java/time/tck/java/time/format/TCKDateTimeFormatterBuilder.java	Tue Mar 22 16:02:25 2016 +0000
@@ -59,11 +59,13 @@
  */
 package tck.java.time.format;
 
+import static java.time.format.DateTimeFormatter.BASIC_ISO_DATE;
 import static java.time.temporal.ChronoField.DAY_OF_MONTH;
 import static java.time.temporal.ChronoField.HOUR_OF_DAY;
 import static java.time.temporal.ChronoField.MINUTE_OF_HOUR;
 import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
 import static java.time.temporal.ChronoField.NANO_OF_SECOND;
+import static java.time.temporal.ChronoField.OFFSET_SECONDS;
 import static java.time.temporal.ChronoField.YEAR;
 import static org.testng.Assert.assertEquals;
 
@@ -73,6 +75,7 @@
 import java.time.ZoneOffset;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.DateTimeParseException;
 import java.time.format.SignStyle;
 import java.time.format.TextStyle;
 import java.time.temporal.Temporal;
@@ -339,6 +342,18 @@
                 {"+HH", 2, 0, 45, "+02"},
                 {"+HH", 2, 30, 45, "+02"},
 
+                {"+HHmm", 2, 0, 0, "+02"},
+                {"+HHmm", -2, 0, 0, "-02"},
+                {"+HHmm", 2, 30, 0, "+0230"},
+                {"+HHmm", 2, 0, 45, "+02"},
+                {"+HHmm", 2, 30, 45, "+0230"},
+
+                {"+HH:mm", 2, 0, 0, "+02"},
+                {"+HH:mm", -2, 0, 0, "-02"},
+                {"+HH:mm", 2, 30, 0, "+02:30"},
+                {"+HH:mm", 2, 0, 45, "+02"},
+                {"+HH:mm", 2, 30, 45, "+02:30"},
+
                 {"+HHMM", 2, 0, 0, "+0200"},
                 {"+HHMM", -2, 0, 0, "-0200"},
                 {"+HHMM", 2, 30, 0, "+0230"},
@@ -374,6 +389,20 @@
                 {"+HH:MM:SS", 2, 30, 0, "+02:30:00"},
                 {"+HH:MM:SS", 2, 0, 45, "+02:00:45"},
                 {"+HH:MM:SS", 2, 30, 45, "+02:30:45"},
+
+                {"+HHmmss", 2, 0, 0, "+02"},
+                {"+HHmmss", -2, 0, 0, "-02"},
+                {"+HHmmss", 2, 30, 0, "+0230"},
+                {"+HHmmss", 2, 0, 45, "+020045"},
+                {"+HHmmss", 2, 30, 45, "+023045"},
+
+                {"+HH:mm:ss", 2, 0, 0, "+02"},
+                {"+HH:mm:ss", -2, 0, 0, "-02"},
+                {"+HH:mm:ss", 2, 30, 0, "+02:30"},
+                {"+HH:mm:ss", 2, 0, 45, "+02:00:45"},
+                {"+HH:mm:ss", 2, 30, 45, "+02:30:45"},
+
+
         };
     }
 
@@ -878,4 +907,82 @@
         assertEquals(parsed.getLong(MINUTE_OF_HOUR), 30L);
     }
 
+    @DataProvider(name="lenientOffsetParseData")
+    Object[][] data_lenient_offset_parse() {
+        return new Object[][] {
+            {"+HH", "+01", 3600},
+            {"+HH", "+0101", 3660},
+            {"+HH", "+010101", 3661},
+            {"+HH", "+01", 3600},
+            {"+HH", "+01:01", 3660},
+            {"+HH", "+01:01:01", 3661},
+            {"+HHmm", "+01", 3600},
+            {"+HHmm", "+0101", 3660},
+            {"+HHmm", "+010101", 3661},
+            {"+HH:mm", "+01", 3600},
+            {"+HH:mm", "+01:01", 3660},
+            {"+HH:mm", "+01:01:01", 3661},
+            {"+HHMM", "+01", 3600},
+            {"+HHMM", "+0101", 3660},
+            {"+HHMM", "+010101", 3661},
+            {"+HH:MM", "+01", 3600},
+            {"+HH:MM", "+01:01", 3660},
+            {"+HH:MM", "+01:01:01", 3661},
+            {"+HHMMss", "+01", 3600},
+            {"+HHMMss", "+0101", 3660},
+            {"+HHMMss", "+010101", 3661},
+            {"+HH:MM:ss", "+01", 3600},
+            {"+HH:MM:ss", "+01:01", 3660},
+            {"+HH:MM:ss", "+01:01:01", 3661},
+            {"+HHMMSS", "+01", 3600},
+            {"+HHMMSS", "+0101", 3660},
+            {"+HHMMSS", "+010101", 3661},
+            {"+HH:MM:SS", "+01", 3600},
+            {"+HH:MM:SS", "+01:01", 3660},
+            {"+HH:MM:SS", "+01:01:01", 3661},
+            {"+HHmmss", "+01", 3600},
+            {"+HHmmss", "+0101", 3660},
+            {"+HHmmss", "+010101", 3661},
+            {"+HH:mm:ss", "+01", 3600},
+            {"+HH:mm:ss", "+01:01", 3660},
+            {"+HH:mm:ss", "+01:01:01", 3661},
+        };
+    }
+
+    @Test(dataProvider="lenientOffsetParseData")
+    public void test_lenient_offset_parse_1(String pattern, String offset, int offsetSeconds) {
+        assertEquals(new DateTimeFormatterBuilder().parseLenient().appendOffset(pattern, "Z").toFormatter().parse(offset).get(OFFSET_SECONDS),
+                     offsetSeconds);
+    }
+
+    @Test
+    public void test_lenient_offset_parse_2() {
+        assertEquals(new DateTimeFormatterBuilder().parseLenient().appendOffsetId().toFormatter().parse("+01").get(OFFSET_SECONDS),
+                     3600);
+    }
+
+    @Test(expectedExceptions=DateTimeParseException.class)
+    public void test_strict_appendOffsetId() {
+        assertEquals(new DateTimeFormatterBuilder().appendOffsetId().toFormatter().parse("+01").get(OFFSET_SECONDS),
+                     3600);
+    }
+
+    @Test(expectedExceptions=DateTimeParseException.class)
+    public void test_strict_appendOffset_1() {
+        assertEquals(new DateTimeFormatterBuilder().appendOffset("+HH:MM:ss", "Z").toFormatter().parse("+01").get(OFFSET_SECONDS),
+                     3600);
+    }
+
+    @Test(expectedExceptions=DateTimeParseException.class)
+    public void test_strict_appendOffset_2() {
+        assertEquals(new DateTimeFormatterBuilder().appendOffset("+HHMMss", "Z").toFormatter().parse("+01").get(OFFSET_SECONDS),
+                     3600);
+    }
+
+    @Test
+    public void test_basic_iso_date() {
+        assertEquals(BASIC_ISO_DATE.parse("20021231+01").get(OFFSET_SECONDS), 3600);
+        assertEquals(BASIC_ISO_DATE.parse("20021231+0101").get(OFFSET_SECONDS), 3660);
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/format/TCKOffsetPrinterParser.java	Tue Mar 22 10:42:32 2016 +0000
+++ b/jdk/test/java/time/tck/java/time/format/TCKOffsetPrinterParser.java	Tue Mar 22 16:02:25 2016 +0000
@@ -199,6 +199,30 @@
                 {"+HH:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-00:23:00"},
                 {"+HH:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-01:23:45"},
                 {"+HH:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-00:00:45"},
+
+                {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+                {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+01"},
+                {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+01:23"},
+                {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+00:23"},
+                {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+01:23:45"},
+                {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-00:00:45"},
+                {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-01"},
+                {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-01:23"},
+                {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-00:23"},
+                {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-01:23:45"},
+                {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-00:00:45"},
+
+                {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+                {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+01"},
+                {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+0123"},
+                {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+0023"},
+                {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+012345"},
+                {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P000045, "+000045"},
+                {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-01"},
+                {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-0123"},
+                {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-0023"},
+                {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-012345"},
+                {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-000045"},
         };
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/bind/xjc/8145039/JaxbMarshallTest.java	Tue Mar 22 16:02:25 2016 +0000
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8145039
+ * @summary Check that marshalling of xjc generated class doesn't throw
+ *          ClassCast exception.
+ * @modules javax.xml.bind
+ * @library /lib/testlibrary
+ * @run testng/othervm JaxbMarshallTest
+ */
+
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+import java.util.Arrays;
+import java.util.List;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import jdk.testlibrary.JDKToolLauncher;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+public class JaxbMarshallTest {
+
+    @BeforeTest
+    public void setUp() throws IOException {
+        // Create test directory inside scratch
+        testWorkDir = Paths.get(System.getProperty("user.dir", "."));
+        // Save its URL
+        testWorkDirUrl = testWorkDir.toUri().toURL();
+        // Get test source directory path
+        testSrcDir = Paths.get(System.getProperty("test.src", "."));
+        // Get path of xjc result folder
+        xjcResultDir = testWorkDir.resolve(TEST_PACKAGE);
+        // Copy schema document file to scratch directory
+        Files.copy(testSrcDir.resolve(XSD_FILENAME), testWorkDir.resolve(XSD_FILENAME), REPLACE_EXISTING);
+    }
+
+
+    /*
+     * Test does the following steps to reproduce problem reported by 8145039:
+     * 1. Copy test schema to JTREG scratch folder
+     * 2. Run xjc on test schema file
+     * 3. Compile generated java files with test javac
+     * 4. Marshall the new list instance to ensure that
+     *    ClassCastException is not thrown
+     */
+    @Test
+    public void marshallClassCastExceptionTest() throws Exception {
+        JAXBContext jaxbContext;
+        Marshaller marshaller;
+        URLClassLoader jaxbContextClassLoader;
+        // Generate java classes by xjc
+        runXjc(XSD_FILENAME);
+        // Compile xjc generated java files
+        compileXjcGeneratedClasses();
+
+        // Create JAXB context based on xjc generated package.
+        // Need to create URL class loader ot make compiled classes discoverable
+        // by JAXB context
+        jaxbContextClassLoader = URLClassLoader.newInstance(new URL[] {testWorkDirUrl});
+        jaxbContext = JAXBContext.newInstance( TEST_PACKAGE, jaxbContextClassLoader);
+
+        // Create instance of Xjc generated data type.
+        // Java classes were compiled during the test execution hence reflection
+        // is needed here
+        Class classLongListClass = jaxbContextClassLoader.loadClass(TEST_CLASS);
+        Object objectLongListClass = classLongListClass.newInstance();
+        // Get 'getIn' method object
+        Method getInMethod = classLongListClass.getMethod( GET_LIST_METHOD, (Class [])null );
+        // Invoke 'getIn' method
+        List<Long> inList = (List<Long>)getInMethod.invoke(objectLongListClass);
+        // Add values into the jaxb object list
+        inList.add(Long.valueOf(0));
+        inList.add(Long.valueOf(43));
+        inList.add(Long.valueOf(1000000123));
+
+        // Marshall constructed complex type variable to standard output.
+        // In case of failure the ClassCastException will be thrown
+        marshaller = jaxbContext.createMarshaller();
+        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+        marshaller.marshal(objectLongListClass, System.out);
+    }
+
+    // Compile schema file into java classes definitions
+    void runXjc(String xsdFileName) throws Exception {
+        // Prepare process builder to run schemagen tool and save its output
+        JDKToolLauncher xjcLauncher = JDKToolLauncher.createUsingTestJDK("xjc");
+        xjcLauncher.addToolArg(xsdFileName);
+        System.out.println("Executing xjc command: " + Arrays.asList(xjcLauncher.getCommand()));
+        ProcessBuilder pb = new ProcessBuilder(xjcLauncher.getCommand());
+        // Set xjc work directory with the input java file
+        pb.directory(testWorkDir.toFile());
+        pb.inheritIO();
+        Process p = pb.start();
+        p.waitFor();
+        p.destroy();
+    }
+
+    // Compile java classes with javac tool
+    void compileXjcGeneratedClasses() throws Exception {
+        JDKToolLauncher javacLauncher = JDKToolLauncher.createUsingTestJDK("javac");
+        javacLauncher.addToolArg(xjcResultDir.resolve("ObjectFactory.java").toString());
+        javacLauncher.addToolArg(xjcResultDir.resolve("TypesLongList.java").toString());
+        javacLauncher.addToolArg(xjcResultDir.resolve("package-info.java").toString());
+        System.out.println("Compiling xjc generated classes: " + Arrays.asList(javacLauncher.getCommand()));
+        ProcessBuilder pb = new ProcessBuilder(javacLauncher.getCommand());
+        pb.inheritIO();
+        pb.directory(testWorkDir.toFile());
+        Process p = pb.start();
+        p.waitFor();
+        p.destroy();
+    }
+
+    // Test schema filename
+    static final String XSD_FILENAME = "testSchema.xsd";
+    // Package of java classes generated by xjc
+    static final String TEST_PACKAGE = "testns_package";
+    // Name of generated java class
+    static final String TEST_CLASS = TEST_PACKAGE+".TypesLongList";
+    // Method to get the list from xjc generated class
+    static final String GET_LIST_METHOD = "getIn";
+    // Test working directory
+    Path testWorkDir;
+    // Test working directory URL
+    URL testWorkDirUrl;
+    // Directory with test src
+    Path testSrcDir;
+    // Directory with java files generated by xjc
+    Path xjcResultDir;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/bind/xjc/8145039/testSchema.xsd	Tue Mar 22 16:02:25 2016 +0000
@@ -0,0 +1,21 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            xmlns:tns="http://testns_package"
+            xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"
+            targetNamespace="http://testns_package">
+    <!-- Simple type list -->
+    <xsd:simpleType name="LongList">
+        <xsd:list>
+            <xsd:simpleType>
+                <xsd:restriction base="xsd:unsignedInt"/>
+            </xsd:simpleType>
+        </xsd:list>
+    </xsd:simpleType>
+    <!--- Complex test type -->
+    <xsd:element name="typesLongList">
+        <xsd:complexType>
+            <xsd:sequence>
+                <xsd:element name="in" type="tns:LongList"/>
+            </xsd:sequence>
+        </xsd:complexType>
+    </xsd:element>
+</xsd:schema>
--- a/jdk/test/sun/net/idn/TestStringPrep.java	Tue Mar 22 10:42:32 2016 +0000
+++ b/jdk/test/sun/net/idn/TestStringPrep.java	Tue Mar 22 16:02:25 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 /*
  * @test
  * @summary Unit test for sun.net.idn.Punycode
- * @bug 4737170
+ * @bug 4737170 8060097
  * @modules java.base/sun.net.idn java.base/sun.text.normalizer
  * @library .
  * @compile -XDignore.symbol.file TestStringPrep.java NFS4StringPrep.java
@@ -41,6 +41,7 @@
 
 import java.text.ParseException;
 import java.io.InputStream;
+import java.util.Locale;
 
 import sun.net.idn.StringPrep;
 import sun.text.normalizer.UCharacterIterator;
@@ -209,7 +210,7 @@
             src = "THISISATEST";
             byte[] dest = NFS4StringPrep.cs_prepare(src.getBytes("UTF-8"), false);
             String destStr = new String(dest, "UTF-8");
-            if(!src.toLowerCase().equals(destStr)){
+            if(!src.toLowerCase(Locale.ROOT).equals(destStr)){
                 fail("Did not get expected output. Expected: "+ prettify(src)+
                       " Got: " + prettify(destStr));
             }
@@ -275,7 +276,7 @@
 
     private static String hex(char ch) {
         StringBuffer result = new StringBuffer();
-        String foo = Integer.toString(ch,16).toUpperCase();
+        String foo = Integer.toString(ch,16).toUpperCase(Locale.ROOT);
         for (int i = foo.length(); i < 4; ++i) {
             result.append('0');
         }
--- a/jdk/test/sun/security/jca/PreferredProviderNegativeTest.java	Tue Mar 22 10:42:32 2016 +0000
+++ b/jdk/test/sun/security/jca/PreferredProviderNegativeTest.java	Tue Mar 22 16:02:25 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,55 +21,52 @@
  * questions.
  */
 
-/**
- * @test
- * @bug 8076359 8133151
- * @summary Test for jdk.security.provider.preferred security property
- * @requires os.name == "SunOS"
- * @run main/othervm  PreferredProviderNegativeTest preJCESet AES:OracleUcrypto false
- * @run main/othervm  PreferredProviderNegativeTest preJCESet AES:SunNegative true
- * @run main/othervm  PreferredProviderNegativeTest afterJCESet AES:SunJGSS
- * @run main/othervm  PreferredProviderNegativeTest afterJCESet AES:SunECNegative
- * @run main/othervm  PreferredProviderNegativeTest invalidAlg AESNegative:SunJCE
- */
-
 import java.security.Security;
 import java.security.NoSuchAlgorithmException;
 import javax.crypto.Cipher;
 import javax.crypto.NoSuchPaddingException;
 
+/**
+ * @test
+ * @bug 8076359 8133151 8150512
+ * @summary Test for jdk.security.provider.preferred security property
+ * @run main/othervm  PreferredProviderNegativeTest preSet AES false
+ * @run main/othervm  PreferredProviderNegativeTest preSet AES:SunNegative true
+ * @run main/othervm  PreferredProviderNegativeTest afterSet AES:SunJGSS
+ * @run main/othervm  PreferredProviderNegativeTest afterSet AES:SunECNegative
+ * @run main/othervm  PreferredProviderNegativeTest invalidAlg AESInvalid:SunJCE
+ */
 public class PreferredProviderNegativeTest {
 
+    static final String SEC_PREF_PROP = "jdk.security.provider.preferred";
+
     /*
      * Test security property could be set by valid and invalid provider
      * before JCE was loaded
      */
     public static void preJCESet(String value, boolean negativeProvider)
             throws NoSuchAlgorithmException, NoSuchPaddingException {
-        Security.setProperty("jdk.security.provider.preferred", value);
+
+        Security.setProperty(SEC_PREF_PROP, value);
 
-        if (!Security.getProperty("jdk.security.provider.preferred")
-                .equals(value)) {
-            throw new RuntimeException(
-                    "Test Failed:The property wasn't set");
+        if (!Security.getProperty(SEC_PREF_PROP).equals(value)) {
+            throw new RuntimeException("Test Failed:The property wasn't set");
         }
 
         String[] arrays = value.split(":");
         Cipher cipher = Cipher.getInstance(arrays[0]);
-
         if (negativeProvider) {
             if (cipher.getProvider().getName().equals(arrays[1])) {
                 throw new RuntimeException(
-                        "Test Failed:The provider shouldn't be set");
+                        "Test Failed:The provider shouldn't be set.");
             }
         } else {
             if (!cipher.getProvider().getName().equals(arrays[1])) {
-                throw new RuntimeException(
-                        "Test Faild:The provider could be set "
-                                + "by valid provider ");
+                throw new RuntimeException("Test Faild:The provider could be "
+                        + "set by valid provider.");
             }
         }
-        System.out.println("Test Pass");
+        System.out.println("Test Pass.");
     }
 
     /*
@@ -81,10 +78,10 @@
         String[] arrays = value.split(":");
         Cipher cipher = Cipher.getInstance(arrays[0]);
 
-        Security.setProperty("jdk.security.provider.preferred", value);
+        Security.setProperty(SEC_PREF_PROP, value);
         if (!cipher.getProvider().getName().equals("SunJCE")) {
-            throw new RuntimeException(
-                    "Test Failed:The security property can't be updated after JCE load.");
+            throw new RuntimeException("Test Failed:The security property can't"
+                    + " be updated after JCE load.");
         }
         System.out.println("Test Pass");
     }
@@ -94,10 +91,11 @@
         String[] arrays = value.split(":");
 
         try {
-            Security.setProperty("jdk.security.provider.preferred", value);
+            Security.setProperty(SEC_PREF_PROP, value);
             Cipher.getInstance(arrays[0]);
         } catch (NoSuchAlgorithmException e) {
-            System.out.println("Test Pass:Got NoSuchAlgorithmException as expired");
+            System.out.println(
+                    "Test Pass:Got NoSuchAlgorithmException as expired");
             return;
         }
         throw new RuntimeException(
@@ -106,15 +104,25 @@
 
     public static void main(String[] args)
             throws NoSuchAlgorithmException, NoSuchPaddingException {
-        boolean negativeProvider;
 
         if (args.length >= 2) {
             switch (args[0]) {
-                case "preJCESet":
-                    negativeProvider = Boolean.valueOf(args[2]);
-                    PreferredProviderNegativeTest.preJCESet(args[1], negativeProvider);
+                case "preSet":
+                    boolean negativeProvider = Boolean.valueOf(args[2]);
+                    boolean solaris = System.getProperty("os.name")
+                            .toLowerCase().contains("sun");
+                    String value = args[1];
+                    if (args[1].split(":").length < 2) {
+                        if (solaris) {
+                            value += ":OracleUcrypto";
+                        } else {
+                            value += ":SunJCE";
+                        }
+                    }
+                    PreferredProviderNegativeTest.preJCESet(
+                            value, negativeProvider);
                     break;
-                case "afterJCESet":
+                case "afterSet":
                     PreferredProviderNegativeTest.afterJCESet(args[1]);
                     break;
                 case "invalidAlg":
@@ -127,4 +135,3 @@
         }
     }
 }
-
--- a/jdk/test/sun/security/jca/PreferredProviderTest.java	Tue Mar 22 10:42:32 2016 +0000
+++ b/jdk/test/sun/security/jca/PreferredProviderTest.java	Tue Mar 22 16:02:25 2016 +0000
@@ -21,97 +21,131 @@
  * questions.
  */
 
-/**
- * @test
- * @bug 8076359 8133151 8145344
- * @summary Test the value for new jdk.security.provider.preferred security property
- * @requires os.name == "SunOS"
- */
-
+import java.security.MessageDigest;
 import java.security.KeyFactory;
-import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.security.Security;
+import java.security.Provider;
 import java.util.Arrays;
 import java.util.List;
 import javax.crypto.Cipher;
 import javax.crypto.NoSuchPaddingException;
 
+/**
+ * @test
+ * @bug 8076359 8133151 8145344 8150512
+ * @summary Test the value for new jdk.security.provider.preferred
+ *          security property
+ */
 public class PreferredProviderTest {
 
-    private static final List<DataTuple> SPARC_DATA = Arrays.asList(
-            new DataTuple("SHA1", "SUN"), new DataTuple("SHA-1", "SUN"),
-            new DataTuple("SHA-224", "SUN"), new DataTuple("SHA-256", "SUN"),
-            new DataTuple("SHA-384", "SUN"), new DataTuple("SHA-512", "SUN"));
-    private static final List<DataTuple> X86_DATA = Arrays
-            .asList(new DataTuple("RSA", "SunRsaSign"));
-
-    public void RunTest(String type)
+    public void RunTest(String type, String os)
             throws NoSuchAlgorithmException, NoSuchPaddingException {
-        String preferredProvider = Security
-                .getProperty("jdk.security.provider.preferred");
+
         String actualProvider = null;
-        if (type.equals("sparcv9")) {
-            if (!preferredProvider.equals(
-                    "AES:SunJCE, SHA1:SUN, SHA-224:SUN, SHA-256:SUN, SHA-384:SUN, SHA-512:SUN")) {
-                throw new RuntimeException(
-                        "Test Failed: wrong jdk.security.provider.preferred "
-                                + "value on solaris-sparcv9");
+        boolean solaris = os.contains("sun");
+        String preferredProp
+                = "AES/GCM/NoPadding:SunJCE, MessageDigest.SHA-256:SUN";
+        System.out.printf("%nExecuting test for the platform '%s'%n", os);
+        if (!solaris) {
+            //For other platform it will try to set the preferred algorithm and
+            //Provider and verify the usage of it.
+            Security.setProperty(
+                    "jdk.security.provider.preferred", preferredProp);
+            verifyPreferredProviderProperty(os, type, preferredProp);
+
+            verifyDigestProvider(os, type, Arrays.asList(
+                    new DataTuple("SHA-256", "SUN")));
+        } else {
+            //For solaris the preferred algorithm/provider is already set in
+            //java.security file which will be verified.
+            switch (type) {
+                case "sparcv9":
+                    preferredProp = "AES:SunJCE, SHA1:SUN, SHA-224:SUN,"
+                            + " SHA-256:SUN, SHA-384:SUN, SHA-512:SUN";
+                    verifyPreferredProviderProperty(os, type, preferredProp);
+
+                    verifyDigestProvider(os, type, Arrays.asList(
+                            new DataTuple("SHA1", "SUN"),
+                            new DataTuple("SHA-1", "SUN"),
+                            new DataTuple("SHA-224", "SUN"),
+                            new DataTuple("SHA-256", "SUN"),
+                            new DataTuple("SHA-384", "SUN"),
+                            new DataTuple("SHA-512", "SUN")));
+                    break;
+                case "amd64":
+                    preferredProp = "AES:SunJCE, RSA:SunRsaSign";
+                    verifyPreferredProviderProperty(os, type, preferredProp);
+
+                    verifyKeyFactoryProvider(os, type, Arrays.asList(
+                            new DataTuple("RSA", "SunRsaSign")));
+                    break;
             }
-            for (DataTuple dataTuple : SPARC_DATA) {
-                MessageDigest md = MessageDigest
-                        .getInstance(dataTuple.algorithm);
-                actualProvider = md.getProvider().getName();
-                if (!actualProvider.equals(dataTuple.provider)) {
-                    throw new RuntimeException(String.format(
-                            "Test Failed:Got wrong "
-                                    + "provider from Solaris-sparcv9 platform,"
-                                    + "Expected Provider: %s, Returned Provider: %s",
-                            dataTuple.provider, actualProvider));
-                }
-            }
-        } else if (type.equals("amd64")) {
-            if (!preferredProvider.equals("AES:SunJCE, RSA:SunRsaSign")) {
-                throw new RuntimeException(
-                        "Test Failed: wrong jdk.security.provider.preferred "
-                                + "value on solaris-x86");
-            }
-            for (DataTuple dataTuple : X86_DATA) {
-                KeyFactory keyFactory = KeyFactory
-                        .getInstance(dataTuple.algorithm);
-                actualProvider = keyFactory.getProvider().getName();
-                if (!actualProvider.equals(dataTuple.provider)) {
-                    throw new RuntimeException(String.format(
-                            "Test Failed:Got wrong "
-                                    + "provider from Solaris-x86 platform,"
-                                    + "Expected Provider: %s, Returned Provider: %s",
-                            dataTuple.provider, actualProvider));
-                }
-            }
-        } else {
-            throw new RuntimeException("Test Failed: wrong platform value");
+            verifyDigestProvider(os, type, Arrays.asList(
+                    new DataTuple("MD5", "OracleUcrypto")));
         }
 
         Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
         actualProvider = cipher.getProvider().getName();
         if (!actualProvider.equals("SunJCE")) {
+            throw new RuntimeException(String.format("Test Failed:Got wrong "
+                    + "provider from %s-%s platform, Expected Provider: SunJCE,"
+                    + " Returned Provider: %s", os, type, actualProvider));
+        }
+    }
+
+    private static void verifyPreferredProviderProperty(String os, String arch,
+            String preferred) {
+        String preferredProvider
+                = Security.getProperty("jdk.security.provider.preferred");
+        if (!preferredProvider.equals(preferred)) {
             throw new RuntimeException(String.format(
-                    "Test Failed:Got wrong provider from Solaris-%s platform, "
-                            + "Expected Provider: SunJCE, Returned Provider: %s",
-                    type, actualProvider));
+                    "Test Failed: wrong jdk.security.provider.preferred value "
+                    + "on %s-%s", os, arch));
         }
+        System.out.println(
+                "Preferred provider security property verification complete.");
+    }
 
-        MessageDigest md = MessageDigest.getInstance("MD5");
-        actualProvider = md.getProvider().getName();
-        if (!actualProvider.equals("OracleUcrypto")) {
+    private static void verifyDigestProvider(String os, String arch,
+            List<DataTuple> algoProviders) throws NoSuchAlgorithmException {
+        for (DataTuple dataTuple : algoProviders) {
+            System.out.printf(
+                    "Verifying MessageDigest for '%s'%n", dataTuple.algorithm);
+            MessageDigest md = MessageDigest.getInstance(dataTuple.algorithm);
+            matchProvider(md.getProvider(), dataTuple.provider,
+                    dataTuple.algorithm, os, arch);
+        }
+        System.out.println(
+                "Preferred MessageDigest algorithm verification successful.");
+    }
+
+    private static void verifyKeyFactoryProvider(String os, String arch,
+            List<DataTuple> algoProviders) throws NoSuchAlgorithmException {
+        for (DataTuple dataTuple : algoProviders) {
+            System.out.printf(
+                    "Verifying KeyFactory for '%s'%n", dataTuple.algorithm);
+            KeyFactory kf = KeyFactory.getInstance(dataTuple.algorithm);
+            matchProvider(kf.getProvider(), dataTuple.provider,
+                    dataTuple.algorithm, os, arch);
+        }
+        System.out.println(
+                "Preferred KeyFactory algorithm verification successful.");
+    }
+
+    private static void matchProvider(Provider provider, String expected,
+            String algo, String os, String arch) {
+        if (!provider.getName().equals(expected)) {
             throw new RuntimeException(String.format(
-                    "Test Failed:Got wrong provider from Solaris-%s platform,"
-                            + "Expected Provider: OracleUcrypto, Returned Provider: %s",
-                    type, actualProvider));
+                    "Test Failed:Got wrong provider from %s-%s platform, "
+                    + "for algorithm %s. Expected Provider: %s,"
+                    + " Returned Provider: %s", os, arch, algo,
+                    expected, provider.getName()));
         }
     }
 
     private static class DataTuple {
+
         private final String provider;
         private final String algorithm;
 
@@ -123,10 +157,9 @@
 
     public static void main(String[] args)
             throws NoSuchAlgorithmException, NoSuchPaddingException {
-
-        String arch = System.getProperty("os.arch");
+        String os = System.getProperty("os.name").toLowerCase();
+        String arch = System.getProperty("os.arch").toLowerCase();
         PreferredProviderTest pp = new PreferredProviderTest();
-        pp.RunTest(arch);
+        pp.RunTest(arch, os);
     }
 }
-