10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @bug 4068067 27 * @library /java/text/testlib 28 * @build DFSSerialization IntlTest HexDumpReader 29 * @run main DFSSerialization 30 * @summary Three different tests are done. 1.read from the object created using jdk1.4.2 2.create a valid DecimalFormatSymbols object with current JDK, then read the object 3.Try to create an valid DecimalFormatSymbols object by passing null to set null for the exponent separator symbol. Expect the NullPointerException. 31 */ 32 33 import java.awt.*; 34 import java.text.*; 35 import java.util.*; 36 import java.io.*; 37 38 public class DFSSerialization extends IntlTest{ 39 public static void main(String[] args) throws Exception { 40 new DFSSerialization().run(args); 41 } 42 public void TestDFSSerialization(){ 43 /* 44 * 1. read from the object created using jdk1.4.2 45 */ 46 File oldFile = new File(System.getProperty("test.src", "."), "DecimalFormatSymbols.142.txt"); 47 DecimalFormatSymbols dfs142 = readTestObject(oldFile); 48 if (dfs142 != null){ 49 if (dfs142.getExponentSeparator().equals("E") && dfs142.getCurrencySymbol().equals("*SpecialCurrencySymbol*")){ 50 System.out.println("\n Deserialization of JDK1.4.2 Object from the current JDK: Passed."); 51 logln(" Deserialization of JDK1.4.2 Object from the current JDK: Passed."); 52 } else { 53 errln(" Deserialization of JDK1.4.2 Object from the current JDK was Failed:" 54 +dfs142.getCurrencySymbol()+" "+dfs142.getExponentSeparator()); 55 /* 56 * logically should not throw this exception as errln throws exception | 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @bug 4068067 27 * @library /java/text/testlib 28 * @build DFSSerialization IntlTest HexDumpReader 29 * @run main DFSSerialization 30 * @summary Three different tests are done. 31 * 1. read from the object created using jdk1.4.2 32 * 2. create a valid DecimalFormatSymbols object with current JDK, then read the object 33 * 3. Try to create an valid DecimalFormatSymbols object by passing null to set null 34 * for the exponent separator symbol. Expect the NullPointerException. 35 */ 36 37 import java.io.File; 38 import java.io.FileInputStream; 39 import java.io.FileOutputStream; 40 import java.io.InputStream; 41 import java.io.ObjectInputStream; 42 import java.io.ObjectOutputStream; 43 import java.text.DecimalFormatSymbols; 44 import java.util.Locale; 45 46 public class DFSSerialization extends IntlTest{ 47 public static void main(String[] args) throws Exception { 48 new DFSSerialization().run(args); 49 } 50 public void TestDFSSerialization(){ 51 /* 52 * 1. read from the object created using jdk1.4.2 53 */ 54 File oldFile = new File(System.getProperty("test.src", "."), "DecimalFormatSymbols.142.txt"); 55 DecimalFormatSymbols dfs142 = readTestObject(oldFile); 56 if (dfs142 != null){ 57 if (dfs142.getExponentSeparator().equals("E") && dfs142.getCurrencySymbol().equals("*SpecialCurrencySymbol*")){ 58 System.out.println("\n Deserialization of JDK1.4.2 Object from the current JDK: Passed."); 59 logln(" Deserialization of JDK1.4.2 Object from the current JDK: Passed."); 60 } else { 61 errln(" Deserialization of JDK1.4.2 Object from the current JDK was Failed:" 62 +dfs142.getCurrencySymbol()+" "+dfs142.getExponentSeparator()); 63 /* 64 * logically should not throw this exception as errln throws exception |