1.1 --- a/make/com/oracle/Makefile Thu Sep 01 13:54:38 2011 -0700
1.2 +++ b/make/com/oracle/Makefile Mon Sep 05 23:58:19 2011 -0700
1.3 @@ -1,5 +1,5 @@
1.4 #
1.5 -# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
1.6 +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
1.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1.8 #
1.9 # This code is free software; you can redistribute it and/or modify it
1.10 @@ -27,8 +27,13 @@
1.11 PRODUCT = oracle
1.12 include $(BUILDDIR)/common/Defs.gmk
1.13
1.14 -SUBDIRS = net
1.15 -include $(BUILDDIR)/common/Subdirs.gmk
1.16 +#
1.17 +# Files to compile
1.18 +#
1.19 +AUTO_FILES_JAVA_DIRS = com/oracle
1.20
1.21 -all build clean clobber::
1.22 - $(SUBDIRS-loop)
1.23 +#
1.24 +# Rules
1.25 +#
1.26 +include $(BUILDDIR)/common/Classes.gmk
1.27 +
2.1 --- a/make/com/oracle/net/Makefile Thu Sep 01 13:54:38 2011 -0700
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,39 +0,0 @@
2.4 -#
2.5 -# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2.6 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2.7 -#
2.8 -# This code is free software; you can redistribute it and/or modify it
2.9 -# under the terms of the GNU General Public License version 2 only, as
2.10 -# published by the Free Software Foundation. Oracle designates this
2.11 -# particular file as subject to the "Classpath" exception as provided
2.12 -# by Oracle in the LICENSE file that accompanied this code.
2.13 -#
2.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
2.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2.16 -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2.17 -# version 2 for more details (a copy is included in the LICENSE file that
2.18 -# accompanied this code).
2.19 -#
2.20 -# You should have received a copy of the GNU General Public License version
2.21 -# 2 along with this work; if not, write to the Free Software Foundation,
2.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2.23 -#
2.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2.25 -# or visit www.oracle.com if you need additional information or have any
2.26 -# questions.
2.27 -#
2.28 -
2.29 -BUILDDIR = ../../..
2.30 -PRODUCT = oracle
2.31 -include $(BUILDDIR)/common/Defs.gmk
2.32 -
2.33 -#
2.34 -# Files to compile
2.35 -#
2.36 -AUTO_FILES_JAVA_DIRS = com/oracle/net
2.37 -
2.38 -#
2.39 -# Rules
2.40 -#
2.41 -include $(BUILDDIR)/common/Classes.gmk
2.42 -
3.1 --- a/make/com/sun/crypto/provider/Makefile Thu Sep 01 13:54:38 2011 -0700
3.2 +++ b/make/com/sun/crypto/provider/Makefile Mon Sep 05 23:58:19 2011 -0700
3.3 @@ -113,6 +113,9 @@
3.4 endif
3.5 endif
3.6
3.7 +JAVAC_MAX_WARNINGS = false
3.8 +JAVAC_LINT_OPTIONS = -Xlint:all,-deprecation
3.9 +JAVAC_WARNINGS_FATAL = true
3.10 include $(BUILDDIR)/common/Defs.gmk
3.11
3.12 #
4.1 --- a/make/com/sun/jndi/Makefile Thu Sep 01 13:54:38 2011 -0700
4.2 +++ b/make/com/sun/jndi/Makefile Mon Sep 05 23:58:19 2011 -0700
4.3 @@ -1,5 +1,5 @@
4.4 #
4.5 -# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
4.6 +# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
4.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4.8 #
4.9 # This code is free software; you can redistribute it and/or modify it
4.10 @@ -28,6 +28,8 @@
4.11 #
4.12
4.13 BUILDDIR = ../../..
4.14 +SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
4.15 +SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
4.16 include $(BUILDDIR)/common/Defs.gmk
4.17
4.18 SUBDIRS = toolkit cosnaming ldap rmi dns
5.1 --- a/make/com/sun/security/Makefile Thu Sep 01 13:54:38 2011 -0700
5.2 +++ b/make/com/sun/security/Makefile Mon Sep 05 23:58:19 2011 -0700
5.3 @@ -1,5 +1,5 @@
5.4 #
5.5 -# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
5.6 +# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
5.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5.8 #
5.9 # This code is free software; you can redistribute it and/or modify it
5.10 @@ -28,6 +28,10 @@
5.11 #
5.12
5.13 BUILDDIR = ../../..
5.14 +SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=false
5.15 +# TODO: Workaround for CR 7063027. Remove -path eventually.
5.16 +SUBDIRS_MAKEFLAGS += JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation,-path
5.17 +SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
5.18 include $(BUILDDIR)/common/Defs.gmk
5.19
5.20 SUBDIRS = auth
6.1 --- a/make/common/Release.gmk Thu Sep 01 13:54:38 2011 -0700
6.2 +++ b/make/common/Release.gmk Mon Sep 05 23:58:19 2011 -0700
6.3 @@ -60,7 +60,8 @@
6.4 # with a new module system (being discussed for JDK 8).
6.5 #
6.6 EXPORTED_PRIVATE_PKGS = com.sun.servicetag \
6.7 - com.oracle.net
6.8 + com.oracle.net \
6.9 + com.oracle.nio
6.10
6.11 # 64-bit solaris has a few special cases. We define the variable
6.12 # SOLARIS64 for use in this Makefile to easily test those cases
7.1 --- a/make/java/java/Makefile Thu Sep 01 13:54:38 2011 -0700
7.2 +++ b/make/java/java/Makefile Mon Sep 05 23:58:19 2011 -0700
7.3 @@ -34,6 +34,7 @@
7.4 PRODUCT = java
7.5 SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
7.6 SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
7.7 +JAVAC_MAX_WARNINGS=true
7.8 include $(BUILDDIR)/common/Defs.gmk
7.9
7.10 # windows compiler flags
8.1 --- a/make/java/security/Makefile Thu Sep 01 13:54:38 2011 -0700
8.2 +++ b/make/java/security/Makefile Mon Sep 05 23:58:19 2011 -0700
8.3 @@ -26,6 +26,9 @@
8.4 BUILDDIR = ../..
8.5 PACKAGE = java.security
8.6 PRODUCT = sun
8.7 +JAVAC_MAX_WARNINGS = false
8.8 +JAVAC_LINT_OPTIONS = -Xlint:all,-deprecation
8.9 +JAVAC_WARNINGS_FATAL = true
8.10 include $(BUILDDIR)/common/Defs.gmk
8.11
8.12 #
9.1 --- a/make/java/sun_nio/FILES_java.gmk Thu Sep 01 13:54:38 2011 -0700
9.2 +++ b/make/java/sun_nio/FILES_java.gmk Mon Sep 05 23:58:19 2011 -0700
9.3 @@ -76,63 +76,3 @@
9.4 sun/nio/cs/UTF_32BE_BOM.java \
9.5 sun/nio/cs/UTF_32LE_BOM.java
9.6
9.7 -
9.8 -FILES_java += \
9.9 - sun/io/Converters.java \
9.10 - sun/io/ByteToCharConverter.java \
9.11 - sun/io/ByteToCharASCII.java \
9.12 - sun/io/ByteToCharUTF8.java \
9.13 - sun/io/ByteToCharUTF16.java \
9.14 - sun/io/ByteToCharUnicode.java \
9.15 - sun/io/ByteToCharUnicodeBig.java \
9.16 - sun/io/ByteToCharUnicodeBigUnmarked.java \
9.17 - sun/io/ByteToCharUnicodeLittle.java \
9.18 - sun/io/ByteToCharUnicodeLittleUnmarked.java \
9.19 - sun/io/CharToByteConverter.java \
9.20 - sun/io/CharToByteASCII.java \
9.21 - sun/io/CharToByteUTF8.java \
9.22 - sun/io/CharToByteUTF16.java \
9.23 - sun/io/CharToByteUnicode.java \
9.24 - sun/io/CharToByteUnicodeBig.java \
9.25 - sun/io/CharToByteUnicodeBigUnmarked.java \
9.26 - sun/io/CharToByteUnicodeLittle.java \
9.27 - sun/io/CharToByteUnicodeLittleUnmarked.java \
9.28 - sun/io/CharacterEncoding.java \
9.29 - sun/io/ConversionBufferFullException.java \
9.30 - sun/io/MalformedInputException.java \
9.31 - sun/io/UnknownCharacterException.java \
9.32 - sun/io/ByteToCharISO8859_1.java \
9.33 - sun/io/CharToByteISO8859_1.java \
9.34 - sun/io/ByteToCharISO8859_2.java \
9.35 - sun/io/CharToByteISO8859_2.java \
9.36 - sun/io/ByteToCharISO8859_4.java \
9.37 - sun/io/CharToByteISO8859_4.java \
9.38 - sun/io/ByteToCharISO8859_5.java \
9.39 - sun/io/CharToByteISO8859_5.java \
9.40 - sun/io/ByteToCharISO8859_7.java \
9.41 - sun/io/CharToByteISO8859_7.java \
9.42 - sun/io/ByteToCharISO8859_9.java \
9.43 - sun/io/CharToByteISO8859_9.java \
9.44 - sun/io/ByteToCharISO8859_13.java \
9.45 - sun/io/CharToByteISO8859_13.java \
9.46 - sun/io/ByteToCharISO8859_15.java \
9.47 - sun/io/CharToByteISO8859_15.java \
9.48 - sun/io/ByteToCharCp1250.java \
9.49 - sun/io/CharToByteCp1250.java \
9.50 - sun/io/ByteToCharCp1251.java \
9.51 - sun/io/CharToByteCp1251.java \
9.52 - sun/io/ByteToCharCp1252.java \
9.53 - sun/io/CharToByteCp1252.java \
9.54 - sun/io/ByteToCharCp1253.java \
9.55 - sun/io/CharToByteCp1253.java \
9.56 - sun/io/ByteToCharCp1254.java \
9.57 - sun/io/CharToByteCp1254.java \
9.58 - sun/io/ByteToCharCp1257.java \
9.59 - sun/io/CharToByteCp1257.java \
9.60 - sun/io/ByteToCharKOI8_R.java \
9.61 - sun/io/CharToByteKOI8_R.java \
9.62 - sun/io/ByteToCharSingleByte.java \
9.63 - sun/io/CharToByteSingleByte.java
9.64 -
9.65 -
9.66 -
10.1 --- a/make/java/sun_nio/Makefile Thu Sep 01 13:54:38 2011 -0700
10.2 +++ b/make/java/sun_nio/Makefile Mon Sep 05 23:58:19 2011 -0700
10.3 @@ -31,8 +31,7 @@
10.4 PACKAGE = sun.nio
10.5 PRODUCT = sun
10.6
10.7 -JAVAC_MAX_WARNINGS = false
10.8 -JAVAC_LINT_OPTIONS = -Xlint:all,-deprecation
10.9 +JAVAC_MAX_WARNINGS = true
10.10 JAVAC_WARNINGS_FATAL = true
10.11 include $(BUILDDIR)/common/Defs.gmk
10.12
11.1 --- a/make/javax/crypto/Makefile Thu Sep 01 13:54:38 2011 -0700
11.2 +++ b/make/javax/crypto/Makefile Mon Sep 05 23:58:19 2011 -0700
11.3 @@ -128,6 +128,8 @@
11.4 endif
11.5 endif
11.6
11.7 +JAVAC_MAX_WARNINGS = true
11.8 +JAVAC_WARNINGS_FATAL = true
11.9 include $(BUILDDIR)/common/Defs.gmk
11.10
11.11 #
12.1 --- a/make/javax/others/Makefile Thu Sep 01 13:54:38 2011 -0700
12.2 +++ b/make/javax/others/Makefile Mon Sep 05 23:58:19 2011 -0700
12.3 @@ -1,5 +1,5 @@
12.4 #
12.5 -# Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
12.6 +# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
12.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
12.8 #
12.9 # This code is free software; you can redistribute it and/or modify it
12.10 @@ -28,6 +28,7 @@
12.11 #
12.12
12.13 BUILDDIR = ../..
12.14 +JAVAC_MAX_WARNINGS = true
12.15 include $(BUILDDIR)/common/Defs.gmk
12.16
12.17 #
13.1 --- a/make/sun/nio/cs/FILES_java.gmk Thu Sep 01 13:54:38 2011 -0700
13.2 +++ b/make/sun/nio/cs/FILES_java.gmk Mon Sep 05 23:58:19 2011 -0700
13.3 @@ -29,277 +29,6 @@
13.4 # Core character converters are built from make/java/java.
13.5 #
13.6
13.7 -FILES_src = \
13.8 - sun/io/ByteToCharDoubleByte.java \
13.9 - sun/io/ByteToCharDBCS_ASCII.java \
13.10 - sun/io/ByteToCharDBCS_EBCDIC.java \
13.11 - sun/io/ByteToCharEUC.java \
13.12 - sun/io/CharToByteDoubleByte.java \
13.13 - sun/io/CharToByteDBCS_ASCII.java \
13.14 - sun/io/CharToByteDBCS_EBCDIC.java \
13.15 - sun/io/CharToByteEUC.java \
13.16 - sun/io/ByteToCharBig5.java \
13.17 - sun/io/ByteToCharBig5_Solaris.java \
13.18 - sun/io/ByteToCharBig5_HKSCS.java \
13.19 - sun/io/ByteToCharMS950_HKSCS.java \
13.20 - sun/io/ByteToCharGB18030.java \
13.21 - sun/io/ByteToCharGB18030DB.java \
13.22 - sun/io/ByteToCharCp037.java \
13.23 - sun/io/ByteToCharCp1006.java \
13.24 - sun/io/ByteToCharCp1025.java \
13.25 - sun/io/ByteToCharCp1026.java \
13.26 - sun/io/ByteToCharCp1046.java \
13.27 - sun/io/ByteToCharCp1047.java \
13.28 - sun/io/ByteToCharCp1097.java \
13.29 - sun/io/ByteToCharCp1098.java \
13.30 - sun/io/ByteToCharCp1112.java \
13.31 - sun/io/ByteToCharCp1122.java \
13.32 - sun/io/ByteToCharCp1123.java \
13.33 - sun/io/ByteToCharCp1124.java \
13.34 - sun/io/ByteToCharCp1140.java \
13.35 - sun/io/ByteToCharCp1141.java \
13.36 - sun/io/ByteToCharCp1142.java \
13.37 - sun/io/ByteToCharCp1143.java \
13.38 - sun/io/ByteToCharCp1144.java \
13.39 - sun/io/ByteToCharCp1145.java \
13.40 - sun/io/ByteToCharCp1146.java \
13.41 - sun/io/ByteToCharCp1147.java \
13.42 - sun/io/ByteToCharCp1148.java \
13.43 - sun/io/ByteToCharCp1149.java \
13.44 - sun/io/ByteToCharCp1255.java \
13.45 - sun/io/ByteToCharCp1256.java \
13.46 - sun/io/ByteToCharCp1258.java \
13.47 - sun/io/ByteToCharCp1381.java \
13.48 - sun/io/ByteToCharCp1383.java \
13.49 - sun/io/ByteToCharCp273.java \
13.50 - sun/io/ByteToCharCp277.java \
13.51 - sun/io/ByteToCharCp278.java \
13.52 - sun/io/ByteToCharCp280.java \
13.53 - sun/io/ByteToCharCp284.java \
13.54 - sun/io/ByteToCharCp285.java \
13.55 - sun/io/ByteToCharCp297.java \
13.56 - sun/io/ByteToCharCp33722.java \
13.57 - sun/io/ByteToCharCp420.java \
13.58 - sun/io/ByteToCharCp424.java \
13.59 - sun/io/ByteToCharCp437.java \
13.60 - sun/io/ByteToCharCp500.java \
13.61 - sun/io/ByteToCharCp737.java \
13.62 - sun/io/ByteToCharCp775.java \
13.63 - sun/io/ByteToCharCp833.java \
13.64 - sun/io/ByteToCharCp834.java \
13.65 - sun/io/ByteToCharCp838.java \
13.66 - sun/io/ByteToCharCp850.java \
13.67 - sun/io/ByteToCharCp852.java \
13.68 - sun/io/ByteToCharCp855.java \
13.69 - sun/io/ByteToCharCp856.java \
13.70 - sun/io/ByteToCharCp857.java \
13.71 - sun/io/ByteToCharCp858.java \
13.72 - sun/io/ByteToCharCp860.java \
13.73 - sun/io/ByteToCharCp861.java \
13.74 - sun/io/ByteToCharCp862.java \
13.75 - sun/io/ByteToCharCp863.java \
13.76 - sun/io/ByteToCharCp864.java \
13.77 - sun/io/ByteToCharCp865.java \
13.78 - sun/io/ByteToCharCp866.java \
13.79 - sun/io/ByteToCharCp868.java \
13.80 - sun/io/ByteToCharCp869.java \
13.81 - sun/io/ByteToCharCp870.java \
13.82 - sun/io/ByteToCharCp871.java \
13.83 - sun/io/ByteToCharCp874.java \
13.84 - sun/io/ByteToCharCp875.java \
13.85 - sun/io/ByteToCharCp918.java \
13.86 - sun/io/ByteToCharCp921.java \
13.87 - sun/io/ByteToCharCp922.java \
13.88 - sun/io/ByteToCharCp930.java \
13.89 - sun/io/ByteToCharCp933.java \
13.90 - sun/io/ByteToCharCp935.java \
13.91 - sun/io/ByteToCharCp937.java \
13.92 - sun/io/ByteToCharCp939.java \
13.93 - sun/io/ByteToCharCp942.java \
13.94 - sun/io/ByteToCharCp942C.java \
13.95 - sun/io/ByteToCharCp943.java \
13.96 - sun/io/ByteToCharCp943C.java \
13.97 - sun/io/ByteToCharCp948.java \
13.98 - sun/io/ByteToCharCp949.java \
13.99 - sun/io/ByteToCharCp949C.java \
13.100 - sun/io/ByteToCharCp950.java \
13.101 - sun/io/ByteToCharCp964.java \
13.102 - sun/io/ByteToCharCp970.java \
13.103 - sun/io/ByteToCharJIS0201.java \
13.104 - sun/io/ByteToCharJIS0208.java \
13.105 - sun/io/ByteToCharJIS0208_Solaris.java \
13.106 - sun/io/ByteToCharJIS0212.java \
13.107 - sun/io/ByteToCharJIS0212_Solaris.java \
13.108 - sun/io/ByteToCharEUC_CN.java \
13.109 - sun/io/ByteToCharEUC_JP.java \
13.110 - sun/io/ByteToCharEUC_JP_LINUX.java \
13.111 - sun/io/ByteToCharEUC_JP_Solaris.java \
13.112 - sun/io/ByteToCharEUC_KR.java \
13.113 - sun/io/ByteToCharEUC_TW.java \
13.114 - sun/io/ByteToCharSJIS.java \
13.115 - sun/io/ByteToCharPCK.java \
13.116 - sun/io/ByteToCharGBK.java \
13.117 - sun/io/ByteToCharISCII91.java \
13.118 - sun/io/ByteToCharISO2022.java \
13.119 - sun/io/ByteToCharISO2022CN.java \
13.120 - sun/io/ByteToCharISO2022JP.java \
13.121 - sun/io/ByteToCharISO2022KR.java \
13.122 - sun/io/ByteToCharISO8859_3.java \
13.123 - sun/io/ByteToCharISO8859_6.java \
13.124 - sun/io/ByteToCharISO8859_8.java \
13.125 - sun/io/ByteToCharJISAutoDetect.java \
13.126 - sun/io/ByteToCharJohab.java \
13.127 - sun/io/ByteToCharMS874.java \
13.128 - sun/io/ByteToCharMS932.java \
13.129 - sun/io/ByteToCharMS936.java \
13.130 - sun/io/ByteToCharMS949.java \
13.131 - sun/io/ByteToCharMS950.java \
13.132 - sun/io/ByteToCharMacArabic.java \
13.133 - sun/io/ByteToCharMacCentralEurope.java \
13.134 - sun/io/ByteToCharMacCroatian.java \
13.135 - sun/io/ByteToCharMacCyrillic.java \
13.136 - sun/io/ByteToCharMacDingbat.java \
13.137 - sun/io/ByteToCharMacGreek.java \
13.138 - sun/io/ByteToCharMacHebrew.java \
13.139 - sun/io/ByteToCharMacIceland.java \
13.140 - sun/io/ByteToCharMacRoman.java \
13.141 - sun/io/ByteToCharMacRomania.java \
13.142 - sun/io/ByteToCharMacSymbol.java \
13.143 - sun/io/ByteToCharMacThai.java \
13.144 - sun/io/ByteToCharMacTurkish.java \
13.145 - sun/io/ByteToCharMacUkraine.java \
13.146 - sun/io/ByteToCharTIS620.java \
13.147 - sun/io/CharToByteBig5.java \
13.148 - sun/io/CharToByteBig5_Solaris.java \
13.149 - sun/io/CharToByteBig5_HKSCS.java \
13.150 - sun/io/CharToByteMS950_HKSCS.java \
13.151 - sun/io/CharToByteGB18030.java \
13.152 - sun/io/CharToByteCp037.java \
13.153 - sun/io/CharToByteCp1006.java \
13.154 - sun/io/CharToByteCp1025.java \
13.155 - sun/io/CharToByteCp1026.java \
13.156 - sun/io/CharToByteCp1046.java \
13.157 - sun/io/CharToByteCp1047.java \
13.158 - sun/io/CharToByteCp1097.java \
13.159 - sun/io/CharToByteCp1098.java \
13.160 - sun/io/CharToByteCp1112.java \
13.161 - sun/io/CharToByteCp1122.java \
13.162 - sun/io/CharToByteCp1123.java \
13.163 - sun/io/CharToByteCp1124.java \
13.164 - sun/io/CharToByteCp1140.java \
13.165 - sun/io/CharToByteCp1141.java \
13.166 - sun/io/CharToByteCp1142.java \
13.167 - sun/io/CharToByteCp1143.java \
13.168 - sun/io/CharToByteCp1144.java \
13.169 - sun/io/CharToByteCp1145.java \
13.170 - sun/io/CharToByteCp1146.java \
13.171 - sun/io/CharToByteCp1147.java \
13.172 - sun/io/CharToByteCp1148.java \
13.173 - sun/io/CharToByteCp1149.java \
13.174 - sun/io/CharToByteCp1255.java \
13.175 - sun/io/CharToByteCp1256.java \
13.176 - sun/io/CharToByteCp1258.java \
13.177 - sun/io/CharToByteCp1381.java \
13.178 - sun/io/CharToByteCp1383.java \
13.179 - sun/io/CharToByteCp273.java \
13.180 - sun/io/CharToByteCp277.java \
13.181 - sun/io/CharToByteCp278.java \
13.182 - sun/io/CharToByteCp280.java \
13.183 - sun/io/CharToByteCp284.java \
13.184 - sun/io/CharToByteCp285.java \
13.185 - sun/io/CharToByteCp297.java \
13.186 - sun/io/CharToByteCp33722.java \
13.187 - sun/io/CharToByteCp420.java \
13.188 - sun/io/CharToByteCp424.java \
13.189 - sun/io/CharToByteCp437.java \
13.190 - sun/io/CharToByteCp500.java \
13.191 - sun/io/CharToByteCp737.java \
13.192 - sun/io/CharToByteCp775.java \
13.193 - sun/io/CharToByteCp833.java \
13.194 - sun/io/CharToByteCp834.java \
13.195 - sun/io/CharToByteCp838.java \
13.196 - sun/io/CharToByteCp850.java \
13.197 - sun/io/CharToByteCp852.java \
13.198 - sun/io/CharToByteCp855.java \
13.199 - sun/io/CharToByteCp856.java \
13.200 - sun/io/CharToByteCp857.java \
13.201 - sun/io/CharToByteCp858.java \
13.202 - sun/io/CharToByteCp860.java \
13.203 - sun/io/CharToByteCp861.java \
13.204 - sun/io/CharToByteCp862.java \
13.205 - sun/io/CharToByteCp863.java \
13.206 - sun/io/CharToByteCp864.java \
13.207 - sun/io/CharToByteCp865.java \
13.208 - sun/io/CharToByteCp866.java \
13.209 - sun/io/CharToByteCp868.java \
13.210 - sun/io/CharToByteCp869.java \
13.211 - sun/io/CharToByteCp870.java \
13.212 - sun/io/CharToByteCp871.java \
13.213 - sun/io/CharToByteCp874.java \
13.214 - sun/io/CharToByteCp875.java \
13.215 - sun/io/CharToByteCp918.java \
13.216 - sun/io/CharToByteCp921.java \
13.217 - sun/io/CharToByteCp922.java \
13.218 - sun/io/CharToByteCp930.java \
13.219 - sun/io/CharToByteCp933.java \
13.220 - sun/io/CharToByteCp935.java \
13.221 - sun/io/CharToByteCp937.java \
13.222 - sun/io/CharToByteCp939.java \
13.223 - sun/io/CharToByteCp942.java \
13.224 - sun/io/CharToByteCp942C.java \
13.225 - sun/io/CharToByteCp943.java \
13.226 - sun/io/CharToByteCp943C.java \
13.227 - sun/io/CharToByteCp948.java \
13.228 - sun/io/CharToByteCp949.java \
13.229 - sun/io/CharToByteCp949C.java \
13.230 - sun/io/CharToByteCp950.java \
13.231 - sun/io/CharToByteCp964.java \
13.232 - sun/io/CharToByteCp970.java \
13.233 - sun/io/CharToByteJIS0201.java \
13.234 - sun/io/CharToByteJIS0208.java \
13.235 - sun/io/CharToByteJIS0208_Solaris.java \
13.236 - sun/io/CharToByteJIS0212.java \
13.237 - sun/io/CharToByteJIS0212_Solaris.java \
13.238 - sun/io/CharToByteEUC_CN.java \
13.239 - sun/io/CharToByteEUC_JP.java \
13.240 - sun/io/CharToByteEUC_JP_LINUX.java \
13.241 - sun/io/CharToByteEUC_JP_Solaris.java \
13.242 - sun/io/CharToByteEUC_KR.java \
13.243 - sun/io/CharToByteEUC_TW.java \
13.244 - sun/io/CharToByteSJIS.java \
13.245 - sun/io/CharToBytePCK.java \
13.246 - sun/io/CharToByteGBK.java \
13.247 - sun/io/CharToByteISCII91.java \
13.248 - sun/io/CharToByteISO2022.java \
13.249 - sun/io/CharToByteISO2022CN_CNS.java \
13.250 - sun/io/CharToByteISO2022CN_GB.java \
13.251 - sun/io/CharToByteISO2022JP.java \
13.252 - sun/io/CharToByteISO2022KR.java \
13.253 - sun/io/CharToByteISO8859_3.java \
13.254 - sun/io/CharToByteISO8859_6.java \
13.255 - sun/io/CharToByteISO8859_8.java \
13.256 - sun/io/CharToByteJohab.java \
13.257 - sun/io/CharToByteMS874.java \
13.258 - sun/io/CharToByteMS932.java \
13.259 - sun/io/CharToByteMS936.java \
13.260 - sun/io/CharToByteMS949.java \
13.261 - sun/io/CharToByteMS950.java \
13.262 - sun/io/CharToByteMacArabic.java \
13.263 - sun/io/CharToByteMacCentralEurope.java \
13.264 - sun/io/CharToByteMacCroatian.java \
13.265 - sun/io/CharToByteMacCyrillic.java \
13.266 - sun/io/CharToByteMacDingbat.java \
13.267 - sun/io/CharToByteMacGreek.java \
13.268 - sun/io/CharToByteMacHebrew.java \
13.269 - sun/io/CharToByteMacIceland.java \
13.270 - sun/io/CharToByteMacRoman.java \
13.271 - sun/io/CharToByteMacRomania.java \
13.272 - sun/io/CharToByteMacSymbol.java \
13.273 - sun/io/CharToByteMacThai.java \
13.274 - sun/io/CharToByteMacTurkish.java \
13.275 - sun/io/CharToByteMacUkraine.java \
13.276 - sun/io/CharToByteTIS620.java
13.277 -
13.278 FILES_gen_extcs = \
13.279 sun/nio/cs/ext/IBM037.java \
13.280 sun/nio/cs/ext/IBM1006.java \
14.1 --- a/make/sun/security/Makefile Thu Sep 01 13:54:38 2011 -0700
14.2 +++ b/make/sun/security/Makefile Mon Sep 05 23:58:19 2011 -0700
14.3 @@ -34,6 +34,8 @@
14.4 #
14.5
14.6 BUILDDIR = ../..
14.7 +SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
14.8 +SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
14.9 include $(BUILDDIR)/common/Defs.gmk
14.10
14.11 # build sun/security/jgss/wrapper on non-windows platform
15.1 --- a/make/sun/security/ec/Makefile Thu Sep 01 13:54:38 2011 -0700
15.2 +++ b/make/sun/security/ec/Makefile Mon Sep 05 23:58:19 2011 -0700
15.3 @@ -109,6 +109,9 @@
15.4 endif
15.5 endif
15.6
15.7 +JAVAC_MAX_WARNINGS=false
15.8 +JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation
15.9 +JAVAC_WARNINGS_FATAL=true
15.10 include $(BUILDDIR)/common/Defs.gmk
15.11
15.12 #
16.1 --- a/make/sun/security/other/Makefile Thu Sep 01 13:54:38 2011 -0700
16.2 +++ b/make/sun/security/other/Makefile Mon Sep 05 23:58:19 2011 -0700
16.3 @@ -1,5 +1,5 @@
16.4 #
16.5 -# Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
16.6 +# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
16.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
16.8 #
16.9 # This code is free software; you can redistribute it and/or modify it
16.10 @@ -26,6 +26,9 @@
16.11 BUILDDIR = ../../..
16.12 PACKAGE = sun.security.other
16.13 PRODUCT = sun
16.14 +JAVAC_MAX_WARNINGS=false
16.15 +JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation
16.16 +JAVAC_WARNINGS_FATAL=true
16.17 include $(BUILDDIR)/common/Defs.gmk
16.18
16.19 #
17.1 --- a/make/sun/security/pkcs11/Makefile Thu Sep 01 13:54:38 2011 -0700
17.2 +++ b/make/sun/security/pkcs11/Makefile Mon Sep 05 23:58:19 2011 -0700
17.3 @@ -110,6 +110,9 @@
17.4 endif
17.5 endif
17.6
17.7 +JAVAC_MAX_WARNINGS=false
17.8 +JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation
17.9 +JAVAC_WARNINGS_FATAL=true
17.10 include $(BUILDDIR)/common/Defs.gmk
17.11
17.12 #
18.1 --- a/make/tools/CharsetMapping/SingleByte-X.java.template Thu Sep 01 13:54:38 2011 -0700
18.2 +++ b/make/tools/CharsetMapping/SingleByte-X.java.template Mon Sep 05 23:58:19 2011 -0700
18.3 @@ -55,18 +55,6 @@
18.4 return new SingleByte.Encoder(this, c2b, c2bIndex);
18.5 }
18.6
18.7 - public String getDecoderSingleByteMappings() {
18.8 - return b2cTable;
18.9 - }
18.10 -
18.11 - public char[] getEncoderIndex2() {
18.12 - return c2b;
18.13 - }
18.14 -
18.15 - public char[] getEncoderIndex1() {
18.16 - return c2bIndex;
18.17 - }
18.18 -
18.19 private final static String b2cTable = $B2CTABLE$
18.20
18.21 private final static char[] b2c = b2cTable.toCharArray();
19.1 --- a/src/share/classes/com/sun/crypto/provider/AESCrypt.java Thu Sep 01 13:54:38 2011 -0700
19.2 +++ b/src/share/classes/com/sun/crypto/provider/AESCrypt.java Mon Sep 05 23:58:19 2011 -0700
19.3 @@ -1,5 +1,5 @@
19.4 /*
19.5 - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
19.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
19.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
19.8 *
19.9 * This code is free software; you can redistribute it and/or modify it
19.10 @@ -245,7 +245,7 @@
19.11 for (j = 0; j < 8; j++) {
19.12 tmp = AA[i][j];
19.13 AA[i][j] = AA[t][j];
19.14 - AA[t][j] = (byte) tmp;
19.15 + AA[t][j] = tmp;
19.16 }
19.17 pivot = AA[i][i];
19.18 }
20.1 --- a/src/share/classes/com/sun/crypto/provider/AESParameters.java Thu Sep 01 13:54:38 2011 -0700
20.2 +++ b/src/share/classes/com/sun/crypto/provider/AESParameters.java Mon Sep 05 23:58:19 2011 -0700
20.3 @@ -1,5 +1,5 @@
20.4 /*
20.5 - * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
20.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
20.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
20.8 *
20.9 * This code is free software; you can redistribute it and/or modify it
20.10 @@ -25,13 +25,10 @@
20.11
20.12 package com.sun.crypto.provider;
20.13
20.14 -import java.util.*;
20.15 import java.io.*;
20.16 -import sun.security.util.*;
20.17 import java.security.AlgorithmParametersSpi;
20.18 import java.security.spec.AlgorithmParameterSpec;
20.19 import java.security.spec.InvalidParameterSpecException;
20.20 -import javax.crypto.spec.IvParameterSpec;
20.21
20.22 /**
20.23 * This class implements the parameter (IV) used with the AES algorithm
20.24 @@ -67,9 +64,15 @@
20.25 core.init(encoded, decodingMethod);
20.26 }
20.27
20.28 - protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
20.29 + protected <T extends AlgorithmParameterSpec>
20.30 + T engineGetParameterSpec(Class<T> paramSpec)
20.31 throws InvalidParameterSpecException {
20.32 - return core.getParameterSpec(paramSpec);
20.33 + if (AlgorithmParameterSpec.class.isAssignableFrom(paramSpec)) {
20.34 + return core.getParameterSpec(paramSpec);
20.35 + } else {
20.36 + throw new InvalidParameterSpecException
20.37 + ("Inappropriate parameter Specification");
20.38 + }
20.39 }
20.40
20.41 protected byte[] engineGetEncoded() throws IOException {
21.1 --- a/src/share/classes/com/sun/crypto/provider/BlockCipherParamsCore.java Thu Sep 01 13:54:38 2011 -0700
21.2 +++ b/src/share/classes/com/sun/crypto/provider/BlockCipherParamsCore.java Mon Sep 05 23:58:19 2011 -0700
21.3 @@ -1,5 +1,5 @@
21.4 /*
21.5 - * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
21.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
21.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
21.8 *
21.9 * This code is free software; you can redistribute it and/or modify it
21.10 @@ -25,7 +25,6 @@
21.11
21.12 package com.sun.crypto.provider;
21.13
21.14 -import java.util.*;
21.15 import java.io.*;
21.16 import sun.security.util.*;
21.17 import sun.misc.HexDumpEncoder;
21.18 @@ -64,7 +63,7 @@
21.19 throw new InvalidParameterSpecException("IV not " +
21.20 block_size + " bytes long");
21.21 }
21.22 - iv = (byte[]) tmpIv.clone();
21.23 + iv = tmpIv.clone();
21.24 }
21.25
21.26 void init(byte[] encoded) throws IOException {
21.27 @@ -90,11 +89,11 @@
21.28 init(encoded);
21.29 }
21.30
21.31 - AlgorithmParameterSpec getParameterSpec(Class paramSpec)
21.32 + <T extends AlgorithmParameterSpec> T getParameterSpec(Class<T> paramSpec)
21.33 throws InvalidParameterSpecException
21.34 {
21.35 if (IvParameterSpec.class.isAssignableFrom(paramSpec)) {
21.36 - return new IvParameterSpec(this.iv);
21.37 + return paramSpec.cast(new IvParameterSpec(this.iv));
21.38 } else {
21.39 throw new InvalidParameterSpecException
21.40 ("Inappropriate parameter specification");
22.1 --- a/src/share/classes/com/sun/crypto/provider/BlowfishParameters.java Thu Sep 01 13:54:38 2011 -0700
22.2 +++ b/src/share/classes/com/sun/crypto/provider/BlowfishParameters.java Mon Sep 05 23:58:19 2011 -0700
22.3 @@ -1,5 +1,5 @@
22.4 /*
22.5 - * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
22.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
22.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
22.8 *
22.9 * This code is free software; you can redistribute it and/or modify it
22.10 @@ -25,13 +25,10 @@
22.11
22.12 package com.sun.crypto.provider;
22.13
22.14 -import java.util.*;
22.15 import java.io.*;
22.16 -import sun.security.util.*;
22.17 import java.security.AlgorithmParametersSpi;
22.18 import java.security.spec.AlgorithmParameterSpec;
22.19 import java.security.spec.InvalidParameterSpecException;
22.20 -import javax.crypto.spec.IvParameterSpec;
22.21
22.22 /**
22.23 * This class implements the parameter (IV) used with the Blowfish algorithm in
22.24 @@ -68,9 +65,15 @@
22.25 core.init(encoded, decodingMethod);
22.26 }
22.27
22.28 - protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
22.29 + protected <T extends AlgorithmParameterSpec>
22.30 + T engineGetParameterSpec(Class<T> paramSpec)
22.31 throws InvalidParameterSpecException {
22.32 - return core.getParameterSpec(paramSpec);
22.33 + if (AlgorithmParameterSpec.class.isAssignableFrom(paramSpec)) {
22.34 + return core.getParameterSpec(paramSpec);
22.35 + } else {
22.36 + throw new InvalidParameterSpecException
22.37 + ("Inappropriate parameter Specification");
22.38 + }
22.39 }
22.40
22.41 protected byte[] engineGetEncoded() throws IOException {
23.1 --- a/src/share/classes/com/sun/crypto/provider/CipherBlockChaining.java Thu Sep 01 13:54:38 2011 -0700
23.2 +++ b/src/share/classes/com/sun/crypto/provider/CipherBlockChaining.java Mon Sep 05 23:58:19 2011 -0700
23.3 @@ -1,5 +1,5 @@
23.4 /*
23.5 - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
23.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
23.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
23.8 *
23.9 * This code is free software; you can redistribute it and/or modify it
23.10 @@ -193,7 +193,7 @@
23.11 // This is necessary because in this constellation, a
23.12 // ciphertext block (or parts of it) will be overridden by
23.13 // the plaintext result.
23.14 - cipherOrig = (byte[])cipher.clone();
23.15 + cipherOrig = cipher.clone();
23.16 }
23.17
23.18 for (; cipherOffset < endIndex;
24.1 --- a/src/share/classes/com/sun/crypto/provider/CipherCore.java Thu Sep 01 13:54:38 2011 -0700
24.2 +++ b/src/share/classes/com/sun/crypto/provider/CipherCore.java Mon Sep 05 23:58:19 2011 -0700
24.3 @@ -1,5 +1,5 @@
24.4 /*
24.5 - * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
24.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
24.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
24.8 *
24.9 * This code is free software; you can redistribute it and/or modify it
24.10 @@ -301,7 +301,7 @@
24.11 */
24.12 byte[] getIV() {
24.13 byte[] iv = cipher.getIV();
24.14 - return (iv == null) ? null : (byte[])iv.clone();
24.15 + return (iv == null) ? null : iv.clone();
24.16 }
24.17
24.18 /**
24.19 @@ -475,8 +475,7 @@
24.20 IvParameterSpec ivSpec = null;
24.21 if (params != null) {
24.22 try {
24.23 - ivSpec = (IvParameterSpec)params.getParameterSpec
24.24 - (IvParameterSpec.class);
24.25 + ivSpec = params.getParameterSpec(IvParameterSpec.class);
24.26 } catch (InvalidParameterSpecException ipse) {
24.27 throw new InvalidAlgorithmParameterException("Wrong parameter "
24.28 + "type: IV "
24.29 @@ -832,7 +831,7 @@
24.30 buffered = 0;
24.31 diffBlocksize = blockSize;
24.32 if (cipherMode != ECB_MODE) {
24.33 - ((FeedbackCipher)cipher).reset();
24.34 + cipher.reset();
24.35 }
24.36 return totalLen;
24.37 }
25.1 --- a/src/share/classes/com/sun/crypto/provider/DESCrypt.java Thu Sep 01 13:54:38 2011 -0700
25.2 +++ b/src/share/classes/com/sun/crypto/provider/DESCrypt.java Mon Sep 05 23:58:19 2011 -0700
25.3 @@ -1,5 +1,5 @@
25.4 /*
25.5 - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
25.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
25.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
25.8 *
25.9 * This code is free software; you can redistribute it and/or modify it
25.10 @@ -622,17 +622,17 @@
25.11 // mangler function:
25.12 // every 6 bit is fed into the sbox, which
25.13 // produces 4-bit output
25.14 - left ^= s0p[(int)((temp & 0x3f) ^ key[j+0])]
25.15 - ^ s1p[(int)(((temp >> 4) & 0x3f) ^ key[j+1])]
25.16 - ^ s2p[(int)(((temp >> 8) & 0x3f) ^ key[j+2])]
25.17 - ^ s3p[(int)(((temp >> 12) & 0x3f) ^ key[j+3])]
25.18 - ^ s4p[(int)(((temp >> 16) & 0x3f) ^ key[j+4])]
25.19 - ^ s5p[(int)(((temp >> 20) & 0x3f) ^ key[j+5])]
25.20 - ^ s6p[(int)(((temp >> 24) & 0x3f) ^ key[j+6])];
25.21 + left ^= s0p[(temp & 0x3f) ^ key[j+0]]
25.22 + ^ s1p[((temp >> 4) & 0x3f) ^ key[j+1]]
25.23 + ^ s2p[((temp >> 8) & 0x3f) ^ key[j+2]]
25.24 + ^ s3p[((temp >> 12) & 0x3f) ^ key[j+3]]
25.25 + ^ s4p[((temp >> 16) & 0x3f) ^ key[j+4]]
25.26 + ^ s5p[((temp >> 20) & 0x3f) ^ key[j+5]]
25.27 + ^ s6p[((temp >> 24) & 0x3f) ^ key[j+6]];
25.28
25.29 // make the last sbox input the last bit from right[0]
25.30 temp = ((right & 1) << 5) | ((right >> 27) & 0x1f);
25.31 - left ^= s7p[(int)(temp ^ key[j+7])];
25.32 + left ^= s7p[temp ^ key[j+7]];
25.33 temp = left;
25.34 left = right;
25.35 right = temp;
26.1 --- a/src/share/classes/com/sun/crypto/provider/DESKey.java Thu Sep 01 13:54:38 2011 -0700
26.2 +++ b/src/share/classes/com/sun/crypto/provider/DESKey.java Mon Sep 05 23:58:19 2011 -0700
26.3 @@ -1,5 +1,5 @@
26.4 /*
26.5 - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
26.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
26.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
26.8 *
26.9 * This code is free software; you can redistribute it and/or modify it
26.10 @@ -78,7 +78,7 @@
26.11 public byte[] getEncoded() {
26.12 // Return a copy of the key, rather than a reference,
26.13 // so that the key data cannot be modified from outside
26.14 - return (byte[])this.key.clone();
26.15 + return this.key.clone();
26.16 }
26.17
26.18 public String getAlgorithm() {
26.19 @@ -126,7 +126,7 @@
26.20 throws java.io.IOException, ClassNotFoundException
26.21 {
26.22 s.defaultReadObject();
26.23 - key = (byte[])key.clone();
26.24 + key = key.clone();
26.25 }
26.26
26.27 /**
27.1 --- a/src/share/classes/com/sun/crypto/provider/DESKeyFactory.java Thu Sep 01 13:54:38 2011 -0700
27.2 +++ b/src/share/classes/com/sun/crypto/provider/DESKeyFactory.java Mon Sep 05 23:58:19 2011 -0700
27.3 @@ -1,5 +1,5 @@
27.4 /*
27.5 - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
27.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
27.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
27.8 *
27.9 * This code is free software; you can redistribute it and/or modify it
27.10 @@ -92,7 +92,7 @@
27.11 * inappropriate for the given key, or the given key cannot be processed
27.12 * (e.g., the given key has an unrecognized algorithm or format).
27.13 */
27.14 - protected KeySpec engineGetKeySpec(SecretKey key, Class keySpec)
27.15 + protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpec)
27.16 throws InvalidKeySpecException {
27.17
27.18 try {
28.1 --- a/src/share/classes/com/sun/crypto/provider/DESParameters.java Thu Sep 01 13:54:38 2011 -0700
28.2 +++ b/src/share/classes/com/sun/crypto/provider/DESParameters.java Mon Sep 05 23:58:19 2011 -0700
28.3 @@ -1,5 +1,5 @@
28.4 /*
28.5 - * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
28.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
28.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
28.8 *
28.9 * This code is free software; you can redistribute it and/or modify it
28.10 @@ -25,13 +25,10 @@
28.11
28.12 package com.sun.crypto.provider;
28.13
28.14 -import java.util.*;
28.15 import java.io.*;
28.16 -import sun.security.util.*;
28.17 import java.security.AlgorithmParametersSpi;
28.18 import java.security.spec.AlgorithmParameterSpec;
28.19 import java.security.spec.InvalidParameterSpecException;
28.20 -import javax.crypto.spec.IvParameterSpec;
28.21
28.22 /**
28.23 * This class implements the parameter (IV) used with the DES algorithm in
28.24 @@ -68,9 +65,15 @@
28.25 core.init(encoded, decodingMethod);
28.26 }
28.27
28.28 - protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
28.29 + protected <T extends AlgorithmParameterSpec>
28.30 + T engineGetParameterSpec(Class<T> paramSpec)
28.31 throws InvalidParameterSpecException {
28.32 - return core.getParameterSpec(paramSpec);
28.33 + if (AlgorithmParameterSpec.class.isAssignableFrom(paramSpec)) {
28.34 + return core.getParameterSpec(paramSpec);
28.35 + } else {
28.36 + throw new InvalidParameterSpecException
28.37 + ("Inappropriate parameter Specification");
28.38 + }
28.39 }
28.40
28.41 protected byte[] engineGetEncoded() throws IOException {
29.1 --- a/src/share/classes/com/sun/crypto/provider/DESedeKey.java Thu Sep 01 13:54:38 2011 -0700
29.2 +++ b/src/share/classes/com/sun/crypto/provider/DESedeKey.java Mon Sep 05 23:58:19 2011 -0700
29.3 @@ -1,5 +1,5 @@
29.4 /*
29.5 - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
29.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
29.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
29.8 *
29.9 * This code is free software; you can redistribute it and/or modify it
29.10 @@ -78,7 +78,7 @@
29.11 }
29.12
29.13 public byte[] getEncoded() {
29.14 - return (byte[])this.key.clone();
29.15 + return this.key.clone();
29.16 }
29.17
29.18 public String getAlgorithm() {
29.19 @@ -127,7 +127,7 @@
29.20 throws java.io.IOException, ClassNotFoundException
29.21 {
29.22 s.defaultReadObject();
29.23 - key = (byte[])key.clone();
29.24 + key = key.clone();
29.25 }
29.26
29.27 /**
30.1 --- a/src/share/classes/com/sun/crypto/provider/DESedeKeyFactory.java Thu Sep 01 13:54:38 2011 -0700
30.2 +++ b/src/share/classes/com/sun/crypto/provider/DESedeKeyFactory.java Mon Sep 05 23:58:19 2011 -0700
30.3 @@ -1,5 +1,5 @@
30.4 /*
30.5 - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
30.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
30.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
30.8 *
30.9 * This code is free software; you can redistribute it and/or modify it
30.10 @@ -92,7 +92,7 @@
30.11 * inappropriate for the given key, or the given key cannot be processed
30.12 * (e.g., the given key has an unrecognized algorithm or format).
30.13 */
30.14 - protected KeySpec engineGetKeySpec(SecretKey key, Class keySpec)
30.15 + protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpec)
30.16 throws InvalidKeySpecException {
30.17
30.18 try {
31.1 --- a/src/share/classes/com/sun/crypto/provider/DESedeParameters.java Thu Sep 01 13:54:38 2011 -0700
31.2 +++ b/src/share/classes/com/sun/crypto/provider/DESedeParameters.java Mon Sep 05 23:58:19 2011 -0700
31.3 @@ -1,5 +1,5 @@
31.4 /*
31.5 - * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
31.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
31.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
31.8 *
31.9 * This code is free software; you can redistribute it and/or modify it
31.10 @@ -25,13 +25,10 @@
31.11
31.12 package com.sun.crypto.provider;
31.13
31.14 -import java.util.*;
31.15 import java.io.*;
31.16 -import sun.security.util.*;
31.17 import java.security.AlgorithmParametersSpi;
31.18 import java.security.spec.AlgorithmParameterSpec;
31.19 import java.security.spec.InvalidParameterSpecException;
31.20 -import javax.crypto.spec.IvParameterSpec;
31.21
31.22 /**
31.23 * This class implements the parameter (IV) used with the Triple DES algorithm
31.24 @@ -67,9 +64,15 @@
31.25 core.init(encoded, decodingMethod);
31.26 }
31.27
31.28 - protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
31.29 + protected <T extends AlgorithmParameterSpec>
31.30 + T engineGetParameterSpec(Class<T> paramSpec)
31.31 throws InvalidParameterSpecException {
31.32 - return core.getParameterSpec(paramSpec);
31.33 + if (AlgorithmParameterSpec.class.isAssignableFrom(paramSpec)) {
31.34 + return core.getParameterSpec(paramSpec);
31.35 + } else {
31.36 + throw new InvalidParameterSpecException
31.37 + ("Inappropriate parameter Specification");
31.38 + }
31.39 }
31.40
31.41 protected byte[] engineGetEncoded() throws IOException {
32.1 --- a/src/share/classes/com/sun/crypto/provider/DESedeWrapCipher.java Thu Sep 01 13:54:38 2011 -0700
32.2 +++ b/src/share/classes/com/sun/crypto/provider/DESedeWrapCipher.java Mon Sep 05 23:58:19 2011 -0700
32.3 @@ -1,5 +1,5 @@
32.4 /*
32.5 - * Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
32.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
32.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
32.8 *
32.9 * This code is free software; you can redistribute it and/or modify it
32.10 @@ -25,7 +25,6 @@
32.11
32.12 package com.sun.crypto.provider;
32.13
32.14 -import java.util.Arrays;
32.15 import java.security.*;
32.16 import java.security.spec.*;
32.17 import javax.crypto.*;
32.18 @@ -151,7 +150,7 @@
32.19 * been set.
32.20 */
32.21 protected byte[] engineGetIV() {
32.22 - return (iv == null? null:(byte[]) iv.clone());
32.23 + return (iv == null) ? null : iv.clone();
32.24 }
32.25
32.26 /**
32.27 @@ -277,8 +276,7 @@
32.28 try {
32.29 DESedeParameters paramsEng = new DESedeParameters();
32.30 paramsEng.engineInit(params.getEncoded());
32.31 - ivSpec = (IvParameterSpec)
32.32 - paramsEng.engineGetParameterSpec(IvParameterSpec.class);
32.33 + ivSpec = paramsEng.engineGetParameterSpec(IvParameterSpec.class);
32.34 } catch (Exception ex) {
32.35 InvalidAlgorithmParameterException iape =
32.36 new InvalidAlgorithmParameterException
33.1 --- a/src/share/classes/com/sun/crypto/provider/DHKeyFactory.java Thu Sep 01 13:54:38 2011 -0700
33.2 +++ b/src/share/classes/com/sun/crypto/provider/DHKeyFactory.java Mon Sep 05 23:58:19 2011 -0700
33.3 @@ -1,5 +1,5 @@
33.4 /*
33.5 - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
33.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
33.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
33.8 *
33.9 * This code is free software; you can redistribute it and/or modify it
33.10 @@ -25,8 +25,6 @@
33.11
33.12 package com.sun.crypto.provider;
33.13
33.14 -import java.util.*;
33.15 -import java.lang.*;
33.16 import java.security.Key;
33.17 import java.security.PublicKey;
33.18 import java.security.PrivateKey;
33.19 @@ -140,7 +138,8 @@
33.20 * inappropriate for the given key, or the given key cannot be processed
33.21 * (e.g., the given key has an unrecognized algorithm or format).
33.22 */
33.23 - protected KeySpec engineGetKeySpec(Key key, Class keySpec)
33.24 + protected <T extends KeySpec>
33.25 + T engineGetKeySpec(Key key, Class<T> keySpec)
33.26 throws InvalidKeySpecException {
33.27 DHParameterSpec params;
33.28
33.29 @@ -150,12 +149,12 @@
33.30 javax.crypto.interfaces.DHPublicKey dhPubKey
33.31 = (javax.crypto.interfaces.DHPublicKey) key;
33.32 params = dhPubKey.getParams();
33.33 - return new DHPublicKeySpec(dhPubKey.getY(),
33.34 - params.getP(),
33.35 - params.getG());
33.36 + return keySpec.cast(new DHPublicKeySpec(dhPubKey.getY(),
33.37 + params.getP(),
33.38 + params.getG()));
33.39
33.40 } else if (X509EncodedKeySpec.class.isAssignableFrom(keySpec)) {
33.41 - return new X509EncodedKeySpec(key.getEncoded());
33.42 + return keySpec.cast(new X509EncodedKeySpec(key.getEncoded()));
33.43
33.44 } else {
33.45 throw new InvalidKeySpecException
33.46 @@ -168,12 +167,12 @@
33.47 javax.crypto.interfaces.DHPrivateKey dhPrivKey
33.48 = (javax.crypto.interfaces.DHPrivateKey)key;
33.49 params = dhPrivKey.getParams();
33.50 - return new DHPrivateKeySpec(dhPrivKey.getX(),
33.51 - params.getP(),
33.52 - params.getG());
33.53 + return keySpec.cast(new DHPrivateKeySpec(dhPrivKey.getX(),
33.54 + params.getP(),
33.55 + params.getG()));
33.56
33.57 } else if (PKCS8EncodedKeySpec.class.isAssignableFrom(keySpec)) {
33.58 - return new PKCS8EncodedKeySpec(key.getEncoded());
33.59 + return keySpec.cast(new PKCS8EncodedKeySpec(key.getEncoded()));
33.60
33.61 } else {
33.62 throw new InvalidKeySpecException
33.63 @@ -208,8 +207,7 @@
33.64 }
33.65 // Convert key to spec
33.66 DHPublicKeySpec dhPubKeySpec
33.67 - = (DHPublicKeySpec)engineGetKeySpec
33.68 - (key, DHPublicKeySpec.class);
33.69 + = engineGetKeySpec(key, DHPublicKeySpec.class);
33.70 // Create key from spec, and return it
33.71 return engineGeneratePublic(dhPubKeySpec);
33.72
33.73 @@ -220,8 +218,7 @@
33.74 }
33.75 // Convert key to spec
33.76 DHPrivateKeySpec dhPrivKeySpec
33.77 - = (DHPrivateKeySpec)engineGetKeySpec
33.78 - (key, DHPrivateKeySpec.class);
33.79 + = engineGetKeySpec(key, DHPrivateKeySpec.class);
33.80 // Create key from spec, and return it
33.81 return engineGeneratePrivate(dhPrivKeySpec);
33.82
34.1 --- a/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java Thu Sep 01 13:54:38 2011 -0700
34.2 +++ b/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java Mon Sep 05 23:58:19 2011 -0700
34.3 @@ -1,5 +1,5 @@
34.4 /*
34.5 - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
34.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
34.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
34.8 *
34.9 * This code is free software; you can redistribute it and/or modify it
34.10 @@ -25,7 +25,6 @@
34.11
34.12 package com.sun.crypto.provider;
34.13
34.14 -import java.math.BigInteger;
34.15 import java.security.*;
34.16 import java.security.spec.*;
34.17 import javax.crypto.spec.DHParameterSpec;
34.18 @@ -141,8 +140,7 @@
34.19 paramGen = AlgorithmParameterGenerator.getInstance("DSA");
34.20 paramGen.init(this.primeSize, random);
34.21 algParams = paramGen.generateParameters();
34.22 - dsaParamSpec = (DSAParameterSpec)
34.23 - algParams.getParameterSpec(DSAParameterSpec.class);
34.24 + dsaParamSpec = algParams.getParameterSpec(DSAParameterSpec.class);
34.25
34.26 DHParameterSpec dhParamSpec;
34.27 if (this.exponentSize > 0) {
35.1 --- a/src/share/classes/com/sun/crypto/provider/DHParameters.java Thu Sep 01 13:54:38 2011 -0700
35.2 +++ b/src/share/classes/com/sun/crypto/provider/DHParameters.java Mon Sep 05 23:58:19 2011 -0700
35.3 @@ -1,5 +1,5 @@
35.4 /*
35.5 - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
35.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
35.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
35.8 *
35.9 * This code is free software; you can redistribute it and/or modify it
35.10 @@ -25,7 +25,6 @@
35.11
35.12 package com.sun.crypto.provider;
35.13
35.14 -import java.util.*;
35.15 import java.io.*;
35.16 import sun.security.util.*;
35.17 import java.math.BigInteger;
35.18 @@ -95,11 +94,12 @@
35.19 engineInit(params);
35.20 }
35.21
35.22 - protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
35.23 + protected <T extends AlgorithmParameterSpec>
35.24 + T engineGetParameterSpec(Class<T> paramSpec)
35.25 throws InvalidParameterSpecException {
35.26
35.27 if (DHParameterSpec.class.isAssignableFrom(paramSpec)) {
35.28 - return new DHParameterSpec(this.p, this.g, this.l);
35.29 + return paramSpec.cast(new DHParameterSpec(this.p, this.g, this.l));
35.30 } else {
35.31 throw new InvalidParameterSpecException
35.32 ("Inappropriate parameter Specification");
36.1 --- a/src/share/classes/com/sun/crypto/provider/DHPrivateKey.java Thu Sep 01 13:54:38 2011 -0700
36.2 +++ b/src/share/classes/com/sun/crypto/provider/DHPrivateKey.java Mon Sep 05 23:58:19 2011 -0700
36.3 @@ -1,5 +1,5 @@
36.4 /*
36.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
36.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
36.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
36.8 *
36.9 * This code is free software; you can redistribute it and/or modify it
36.10 @@ -31,7 +31,6 @@
36.11 import java.security.PrivateKey;
36.12 import java.security.InvalidKeyException;
36.13 import java.security.ProviderException;
36.14 -import javax.crypto.*;
36.15 import javax.crypto.spec.DHParameterSpec;
36.16 import sun.security.util.*;
36.17
36.18 @@ -182,7 +181,7 @@
36.19
36.20 // ignore OPTIONAL attributes
36.21
36.22 - this.encodedKey = (byte[])encodedKey.clone();
36.23 + this.encodedKey = encodedKey.clone();
36.24
36.25 } catch (NumberFormatException e) {
36.26 InvalidKeyException ike = new InvalidKeyException(
36.27 @@ -256,7 +255,7 @@
36.28 return null;
36.29 }
36.30 }
36.31 - return (byte[])this.encodedKey.clone();
36.32 + return this.encodedKey.clone();
36.33 }
36.34
36.35 /**
37.1 --- a/src/share/classes/com/sun/crypto/provider/DHPublicKey.java Thu Sep 01 13:54:38 2011 -0700
37.2 +++ b/src/share/classes/com/sun/crypto/provider/DHPublicKey.java Mon Sep 05 23:58:19 2011 -0700
37.3 @@ -1,5 +1,5 @@
37.4 /*
37.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
37.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
37.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
37.8 *
37.9 * This code is free software; you can redistribute it and/or modify it
37.10 @@ -29,10 +29,8 @@
37.11 import java.math.BigInteger;
37.12 import java.security.KeyRep;
37.13 import java.security.InvalidKeyException;
37.14 -import java.security.InvalidAlgorithmParameterException;
37.15 import java.security.ProviderException;
37.16 import java.security.PublicKey;
37.17 -import javax.crypto.*;
37.18 import javax.crypto.spec.DHParameterSpec;
37.19 import sun.security.util.*;
37.20
37.21 @@ -174,7 +172,7 @@
37.22 throw new InvalidKeyException("Excess key data");
37.23 }
37.24
37.25 - this.encodedKey = (byte[])encodedKey.clone();
37.26 + this.encodedKey = encodedKey.clone();
37.27
37.28 } catch (NumberFormatException e) {
37.29 throw new InvalidKeyException("Private-value length too big");
37.30 @@ -237,7 +235,7 @@
37.31 return null;
37.32 }
37.33 }
37.34 - return (byte[])this.encodedKey.clone();
37.35 + return this.encodedKey.clone();
37.36 }
37.37
37.38 /**
38.1 --- a/src/share/classes/com/sun/crypto/provider/EncryptedPrivateKeyInfo.java Thu Sep 01 13:54:38 2011 -0700
38.2 +++ b/src/share/classes/com/sun/crypto/provider/EncryptedPrivateKeyInfo.java Mon Sep 05 23:58:19 2011 -0700
38.3 @@ -1,5 +1,5 @@
38.4 /*
38.5 - * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
38.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
38.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
38.8 *
38.9 * This code is free software; you can redistribute it and/or modify it
38.10 @@ -77,7 +77,7 @@
38.11 if (seq[1].data.available() != 0)
38.12 throw new IOException("encryptedData field overrun");
38.13
38.14 - this.encoded = (byte[])encoded.clone();
38.15 + this.encoded = encoded.clone();
38.16 }
38.17
38.18 /**
38.19 @@ -86,7 +86,7 @@
38.20 */
38.21 EncryptedPrivateKeyInfo(AlgorithmId algid, byte[] encryptedData) {
38.22 this.algid = algid;
38.23 - this.encryptedData = (byte[])encryptedData.clone();
38.24 + this.encryptedData = encryptedData.clone();
38.25 this.encoded = null; // lazy generation of encoding
38.26 }
38.27
38.28 @@ -101,7 +101,7 @@
38.29 * Returns the encrypted data.
38.30 */
38.31 byte[] getEncryptedData() {
38.32 - return (byte[])this.encryptedData.clone();
38.33 + return this.encryptedData.clone();
38.34 }
38.35
38.36 /**
38.37 @@ -110,7 +110,7 @@
38.38 byte[] getEncoded()
38.39 throws IOException
38.40 {
38.41 - if (this.encoded != null) return (byte[])this.encoded.clone();
38.42 + if (this.encoded != null) return this.encoded.clone();
38.43
38.44 DerOutputStream out = new DerOutputStream();
38.45 DerOutputStream tmp = new DerOutputStream();
38.46 @@ -125,6 +125,6 @@
38.47 out.write(DerValue.tag_Sequence, tmp);
38.48 this.encoded = out.toByteArray();
38.49
38.50 - return (byte[])this.encoded.clone();
38.51 + return this.encoded.clone();
38.52 }
38.53 }
39.1 --- a/src/share/classes/com/sun/crypto/provider/HmacCore.java Thu Sep 01 13:54:38 2011 -0700
39.2 +++ b/src/share/classes/com/sun/crypto/provider/HmacCore.java Mon Sep 05 23:58:19 2011 -0700
39.3 @@ -1,5 +1,5 @@
39.4 /*
39.5 - * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
39.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
39.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
39.8 *
39.9 * This code is free software; you can redistribute it and/or modify it
39.10 @@ -78,8 +78,8 @@
39.11 private HmacCore(HmacCore other) throws CloneNotSupportedException {
39.12 this.md = (MessageDigest)other.md.clone();
39.13 this.blockLen = other.blockLen;
39.14 - this.k_ipad = (byte[])other.k_ipad.clone();
39.15 - this.k_opad = (byte[])other.k_opad.clone();
39.16 + this.k_ipad = other.k_ipad.clone();
39.17 + this.k_opad = other.k_opad.clone();
39.18 this.first = other.first;
39.19 }
39.20
40.1 --- a/src/share/classes/com/sun/crypto/provider/JceKeyStore.java Thu Sep 01 13:54:38 2011 -0700
40.2 +++ b/src/share/classes/com/sun/crypto/provider/JceKeyStore.java Mon Sep 05 23:58:19 2011 -0700
40.3 @@ -1,5 +1,5 @@
40.4 /*
40.5 - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
40.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
40.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
40.8 *
40.9 * This code is free software; you can redistribute it and/or modify it
40.10 @@ -38,9 +38,7 @@
40.11 import java.security.UnrecoverableKeyException;
40.12 import java.security.cert.Certificate;
40.13 import java.security.cert.CertificateFactory;
40.14 -import java.security.cert.X509Certificate;
40.15 import java.security.cert.CertificateException;
40.16 -import java.security.spec.InvalidKeySpecException;
40.17 import javax.crypto.SealedObject;
40.18
40.19 /**
40.20 @@ -87,7 +85,7 @@
40.21 * Private keys and certificates are stored in a hashtable.
40.22 * Hash entries are keyed by alias names.
40.23 */
40.24 - private Hashtable entries = new Hashtable();
40.25 + private Hashtable<String, Object> entries = new Hashtable<String, Object>();
40.26
40.27 /**
40.28 * Returns the key associated with the given alias, using the given
40.29 @@ -156,7 +154,7 @@
40.30
40.31 if ((entry instanceof PrivateKeyEntry)
40.32 && (((PrivateKeyEntry)entry).chain != null)) {
40.33 - chain = (Certificate[])((PrivateKeyEntry)entry).chain.clone();
40.34 + chain = ((PrivateKeyEntry)entry).chain.clone();
40.35 }
40.36
40.37 return chain;
40.38 @@ -262,7 +260,7 @@
40.39 // clone the chain
40.40 if ((chain != null) &&
40.41 (chain.length !=0)) {
40.42 - entry.chain = (Certificate[])chain.clone();
40.43 + entry.chain = chain.clone();
40.44 } else {
40.45 entry.chain = null;
40.46 }
40.47 @@ -316,10 +314,10 @@
40.48 PrivateKeyEntry entry = new PrivateKeyEntry();
40.49 entry.date = new Date();
40.50
40.51 - entry.protectedKey = (byte[])key.clone();
40.52 + entry.protectedKey = key.clone();
40.53 if ((chain != null) &&
40.54 (chain.length != 0)) {
40.55 - entry.chain = (Certificate[])chain.clone();
40.56 + entry.chain = chain.clone();
40.57 } else {
40.58 entry.chain = null;
40.59 }
40.60 @@ -384,7 +382,7 @@
40.61 *
40.62 * @return enumeration of the alias names
40.63 */
40.64 - public Enumeration engineAliases() {
40.65 + public Enumeration<String> engineAliases() {
40.66 return entries.keys();
40.67 }
40.68
40.69 @@ -462,9 +460,9 @@
40.70 public String engineGetCertificateAlias(Certificate cert) {
40.71 Certificate certElem;
40.72
40.73 - Enumeration e = entries.keys();
40.74 + Enumeration<String> e = entries.keys();
40.75 while (e.hasMoreElements()) {
40.76 - String alias = (String)e.nextElement();
40.77 + String alias = e.nextElement();
40.78 Object entry = entries.get(alias);
40.79 if (entry instanceof TrustedCertEntry) {
40.80 certElem = ((TrustedCertEntry)entry).cert;
40.81 @@ -560,10 +558,10 @@
40.82
40.83 dos.writeInt(entries.size());
40.84
40.85 - Enumeration e = entries.keys();
40.86 + Enumeration<String> e = entries.keys();
40.87 while (e.hasMoreElements()) {
40.88
40.89 - String alias = (String)e.nextElement();
40.90 + String alias = e.nextElement();
40.91 Object entry = entries.get(alias);
40.92
40.93 if (entry instanceof PrivateKeyEntry) {
40.94 @@ -677,7 +675,7 @@
40.95 DataInputStream dis;
40.96 MessageDigest md = null;
40.97 CertificateFactory cf = null;
40.98 - Hashtable cfs = null;
40.99 + Hashtable<String, CertificateFactory> cfs = null;
40.100 ByteArrayInputStream bais = null;
40.101 byte[] encoded = null;
40.102
40.103 @@ -713,7 +711,7 @@
40.104 cf = CertificateFactory.getInstance("X509");
40.105 } else {
40.106 // version 2
40.107 - cfs = new Hashtable(3);
40.108 + cfs = new Hashtable<String, CertificateFactory>(3);
40.109 }
40.110
40.111 entries.clear();
40.112 @@ -761,7 +759,7 @@
40.113 String certType = dis.readUTF();
40.114 if (cfs.containsKey(certType)) {
40.115 // reuse certificate factory
40.116 - cf = (CertificateFactory)cfs.get(certType);
40.117 + cf = cfs.get(certType);
40.118 } else {
40.119 // create new certificate factory
40.120 cf = CertificateFactory.getInstance(
40.121 @@ -803,7 +801,7 @@
40.122 String certType = dis.readUTF();
40.123 if (cfs.containsKey(certType)) {
40.124 // reuse certificate factory
40.125 - cf = (CertificateFactory)cfs.get(certType);
40.126 + cf = cfs.get(certType);
40.127 } else {
40.128 // create new certificate factory
40.129 cf = CertificateFactory.getInstance(certType);
41.1 --- a/src/share/classes/com/sun/crypto/provider/KeyProtector.java Thu Sep 01 13:54:38 2011 -0700
41.2 +++ b/src/share/classes/com/sun/crypto/provider/KeyProtector.java Mon Sep 05 23:58:19 2011 -0700
41.3 @@ -1,5 +1,5 @@
41.4 /*
41.5 - * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
41.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
41.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
41.8 *
41.9 * This code is free software; you can redistribute it and/or modify it
41.10 @@ -25,14 +25,8 @@
41.11
41.12 package com.sun.crypto.provider;
41.13
41.14 -import java.io.UnsupportedEncodingException;
41.15 import java.io.IOException;
41.16 import java.io.Serializable;
41.17 -import java.io.ByteArrayInputStream;
41.18 -import java.io.ByteArrayOutputStream;
41.19 -import java.io.ObjectInputStream;
41.20 -import java.io.ObjectOutputStream;
41.21 -import java.io.ObjectInputStream.GetField;
41.22 import java.security.Security;
41.23 import java.security.Key;
41.24 import java.security.PrivateKey;
41.25 @@ -42,22 +36,14 @@
41.26 import java.security.GeneralSecurityException;
41.27 import java.security.NoSuchAlgorithmException;
41.28 import java.security.NoSuchProviderException;
41.29 -import java.security.SecureRandom;
41.30 import java.security.UnrecoverableKeyException;
41.31 -import java.security.InvalidParameterException;
41.32 -import java.security.InvalidAlgorithmParameterException;
41.33 -import java.security.InvalidKeyException;
41.34 import java.security.AlgorithmParameters;
41.35 -import java.security.spec.InvalidParameterSpecException;
41.36 -import java.security.spec.InvalidKeySpecException;
41.37 import java.security.spec.PKCS8EncodedKeySpec;
41.38
41.39 import javax.crypto.Cipher;
41.40 import javax.crypto.CipherSpi;
41.41 import javax.crypto.SecretKey;
41.42 -import javax.crypto.NoSuchPaddingException;
41.43 import javax.crypto.IllegalBlockSizeException;
41.44 -import javax.crypto.BadPaddingException;
41.45 import javax.crypto.SealedObject;
41.46 import javax.crypto.spec.*;
41.47 import sun.security.x509.AlgorithmId;
41.48 @@ -127,7 +113,7 @@
41.49 PBEWithMD5AndTripleDESCipher cipher;
41.50 cipher = new PBEWithMD5AndTripleDESCipher();
41.51 cipher.engineInit(Cipher.ENCRYPT_MODE, sKey, pbeSpec, null);
41.52 - byte[] plain = (byte[])key.getEncoded();
41.53 + byte[] plain = key.getEncoded();
41.54 byte[] encrKey = cipher.engineDoFinal(plain, 0, plain.length);
41.55
41.56 // wrap encrypted private key in EncryptedPrivateKeyInfo
41.57 @@ -169,8 +155,8 @@
41.58 AlgorithmParameters pbeParams =
41.59 AlgorithmParameters.getInstance("PBE");
41.60 pbeParams.init(encodedParams);
41.61 - PBEParameterSpec pbeSpec = (PBEParameterSpec)
41.62 - pbeParams.getParameterSpec(PBEParameterSpec.class);
41.63 + PBEParameterSpec pbeSpec =
41.64 + pbeParams.getParameterSpec(PBEParameterSpec.class);
41.65
41.66 // create PBE key from password
41.67 PBEKeySpec pbeKeySpec = new PBEKeySpec(this.password);
42.1 --- a/src/share/classes/com/sun/crypto/provider/OAEPParameters.java Thu Sep 01 13:54:38 2011 -0700
42.2 +++ b/src/share/classes/com/sun/crypto/provider/OAEPParameters.java Mon Sep 05 23:58:19 2011 -0700
42.3 @@ -1,5 +1,5 @@
42.4 /*
42.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
42.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
42.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
42.8 *
42.9 * This code is free software; you can redistribute it and/or modify it
42.10 @@ -26,7 +26,6 @@
42.11 package com.sun.crypto.provider;
42.12
42.13 import java.math.BigInteger;
42.14 -import java.util.*;
42.15 import java.io.*;
42.16 import sun.security.util.*;
42.17 import sun.security.x509.*;
42.18 @@ -180,11 +179,13 @@
42.19 engineInit(encoded);
42.20 }
42.21
42.22 - protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
42.23 + protected <T extends AlgorithmParameterSpec>
42.24 + T engineGetParameterSpec(Class<T> paramSpec)
42.25 throws InvalidParameterSpecException {
42.26 if (OAEPParameterSpec.class.isAssignableFrom(paramSpec)) {
42.27 - return new OAEPParameterSpec(mdName, "MGF1", mgfSpec,
42.28 - new PSource.PSpecified(p));
42.29 + return paramSpec.cast(
42.30 + new OAEPParameterSpec(mdName, "MGF1", mgfSpec,
42.31 + new PSource.PSpecified(p)));
42.32 } else {
42.33 throw new InvalidParameterSpecException
42.34 ("Inappropriate parameter specification");
43.1 --- a/src/share/classes/com/sun/crypto/provider/PBECipherCore.java Thu Sep 01 13:54:38 2011 -0700
43.2 +++ b/src/share/classes/com/sun/crypto/provider/PBECipherCore.java Mon Sep 05 23:58:19 2011 -0700
43.3 @@ -1,5 +1,5 @@
43.4 /*
43.5 - * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
43.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
43.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
43.8 *
43.9 * This code is free software; you can redistribute it and/or modify it
43.10 @@ -25,7 +25,6 @@
43.11
43.12 package com.sun.crypto.provider;
43.13
43.14 -import java.io.UnsupportedEncodingException;
43.15 import java.security.*;
43.16 import java.security.spec.*;
43.17 import javax.crypto.*;
43.18 @@ -326,8 +325,7 @@
43.19 PBEParameterSpec pbeSpec = null;
43.20 if (params != null) {
43.21 try {
43.22 - pbeSpec = (PBEParameterSpec) params.getParameterSpec
43.23 - (PBEParameterSpec.class);
43.24 + pbeSpec = params.getParameterSpec(PBEParameterSpec.class);
43.25 } catch (InvalidParameterSpecException ipse) {
43.26 throw new InvalidAlgorithmParameterException("Wrong parameter "
43.27 + "type: PBE "
44.1 --- a/src/share/classes/com/sun/crypto/provider/PBEKey.java Thu Sep 01 13:54:38 2011 -0700
44.2 +++ b/src/share/classes/com/sun/crypto/provider/PBEKey.java Mon Sep 05 23:58:19 2011 -0700
44.3 @@ -1,5 +1,5 @@
44.4 /*
44.5 - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
44.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
44.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44.8 *
44.9 * This code is free software; you can redistribute it and/or modify it
44.10 @@ -25,7 +25,6 @@
44.11
44.12 package com.sun.crypto.provider;
44.13
44.14 -import java.io.UnsupportedEncodingException;
44.15 import java.security.KeyRep;
44.16 import java.security.spec.InvalidKeySpecException;
44.17 import javax.crypto.SecretKey;
44.18 @@ -69,7 +68,7 @@
44.19 }
44.20
44.21 public byte[] getEncoded() {
44.22 - return (byte[])this.key.clone();
44.23 + return this.key.clone();
44.24 }
44.25
44.26 public String getAlgorithm() {
44.27 @@ -118,7 +117,7 @@
44.28 throws java.io.IOException, ClassNotFoundException
44.29 {
44.30 s.defaultReadObject();
44.31 - key = (byte[])key.clone();
44.32 + key = key.clone();
44.33 }
44.34
44.35
45.1 --- a/src/share/classes/com/sun/crypto/provider/PBEKeyFactory.java Thu Sep 01 13:54:38 2011 -0700
45.2 +++ b/src/share/classes/com/sun/crypto/provider/PBEKeyFactory.java Mon Sep 05 23:58:19 2011 -0700
45.3 @@ -1,5 +1,5 @@
45.4 /*
45.5 - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
45.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
45.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
45.8 *
45.9 * This code is free software; you can redistribute it and/or modify it
45.10 @@ -25,7 +25,6 @@
45.11
45.12 package com.sun.crypto.provider;
45.13
45.14 -import java.io.UnsupportedEncodingException;
45.15 import java.security.InvalidKeyException;
45.16 import java.security.spec.KeySpec;
45.17 import java.security.spec.InvalidKeySpecException;
45.18 @@ -132,7 +131,7 @@
45.19 * inappropriate for the given key, or the given key cannot be processed
45.20 * (e.g., the given key has an unrecognized algorithm or format).
45.21 */
45.22 - protected KeySpec engineGetKeySpec(SecretKey key, Class keySpecCl)
45.23 + protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpecCl)
45.24 throws InvalidKeySpecException {
45.25 if ((key instanceof SecretKey)
45.26 && (validTypes.contains(key.getAlgorithm().toUpperCase()))
46.1 --- a/src/share/classes/com/sun/crypto/provider/PBEParameters.java Thu Sep 01 13:54:38 2011 -0700
46.2 +++ b/src/share/classes/com/sun/crypto/provider/PBEParameters.java Mon Sep 05 23:58:19 2011 -0700
46.3 @@ -1,5 +1,5 @@
46.4 /*
46.5 - * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
46.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
46.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
46.8 *
46.9 * This code is free software; you can redistribute it and/or modify it
46.10 @@ -25,7 +25,6 @@
46.11
46.12 package com.sun.crypto.provider;
46.13
46.14 -import java.util.*;
46.15 import java.io.*;
46.16 import java.math.BigInteger;
46.17 import java.security.AlgorithmParametersSpi;
46.18 @@ -65,7 +64,7 @@
46.19 throw new InvalidParameterSpecException
46.20 ("Inappropriate parameter specification");
46.21 }
46.22 - this.salt = (byte[])((PBEParameterSpec)paramSpec).getSalt().clone();
46.23 + this.salt = ((PBEParameterSpec)paramSpec).getSalt().clone();
46.24 this.iCount = ((PBEParameterSpec)paramSpec).getIterationCount();
46.25 }
46.26
46.27 @@ -98,11 +97,12 @@
46.28 engineInit(encoded);
46.29 }
46.30
46.31 - protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
46.32 + protected <T extends AlgorithmParameterSpec>
46.33 + T engineGetParameterSpec(Class<T> paramSpec)
46.34 throws InvalidParameterSpecException
46.35 {
46.36 if (PBEParameterSpec.class.isAssignableFrom(paramSpec)) {
46.37 - return new PBEParameterSpec(this.salt, this.iCount);
46.38 + return paramSpec.cast(new PBEParameterSpec(this.salt, this.iCount));
46.39 } else {
46.40 throw new InvalidParameterSpecException
46.41 ("Inappropriate parameter specification");
47.1 --- a/src/share/classes/com/sun/crypto/provider/PBKDF2HmacSHA1Factory.java Thu Sep 01 13:54:38 2011 -0700
47.2 +++ b/src/share/classes/com/sun/crypto/provider/PBKDF2HmacSHA1Factory.java Mon Sep 05 23:58:19 2011 -0700
47.3 @@ -1,5 +1,5 @@
47.4 /*
47.5 - * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
47.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
47.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
47.8 *
47.9 * This code is free software; you can redistribute it and/or modify it
47.10 @@ -25,14 +25,12 @@
47.11
47.12 package com.sun.crypto.provider;
47.13
47.14 -import java.io.*;
47.15 import java.security.InvalidKeyException;
47.16 import java.security.spec.KeySpec;
47.17 import java.security.spec.InvalidKeySpecException;
47.18 import javax.crypto.SecretKey;
47.19 import javax.crypto.SecretKeyFactorySpi;
47.20 import javax.crypto.spec.PBEKeySpec;
47.21 -import javax.crypto.spec.SecretKeySpec;
47.22
47.23 /**
47.24 * This class implements a key factory for PBE keys derived using
47.25 @@ -88,7 +86,7 @@
47.26 * given key cannot be processed (e.g., the given key has an
47.27 * unrecognized algorithm or format).
47.28 */
47.29 - protected KeySpec engineGetKeySpec(SecretKey key, Class keySpecCl)
47.30 + protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpecCl)
47.31 throws InvalidKeySpecException {
47.32 if (key instanceof javax.crypto.interfaces.PBEKey) {
47.33 // Check if requested key spec is amongst the valid ones
48.1 --- a/src/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java Thu Sep 01 13:54:38 2011 -0700
48.2 +++ b/src/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java Mon Sep 05 23:58:19 2011 -0700
48.3 @@ -1,5 +1,5 @@
48.4 /*
48.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
48.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
48.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
48.8 *
48.9 * This code is free software; you can redistribute it and/or modify it
48.10 @@ -133,6 +133,7 @@
48.11 byte[] ti = new byte[hlen];
48.12 // SecretKeySpec cannot be used, since password can be empty here.
48.13 SecretKey macKey = new SecretKey() {
48.14 + private static final long serialVersionUID = 7874493593505141603L;
48.15 @Override
48.16 public String getAlgorithm() {
48.17 return prf.getAlgorithm();
48.18 @@ -194,7 +195,7 @@
48.19 }
48.20
48.21 public byte[] getEncoded() {
48.22 - return (byte[]) key.clone();
48.23 + return key.clone();
48.24 }
48.25
48.26 public String getAlgorithm() {
48.27 @@ -206,7 +207,7 @@
48.28 }
48.29
48.30 public char[] getPassword() {
48.31 - return (char[]) passwd.clone();
48.32 + return passwd.clone();
48.33 }
48.34
48.35 public byte[] getSalt() {
48.36 @@ -268,7 +269,7 @@
48.37 protected void finalize() throws Throwable {
48.38 try {
48.39 if (this.passwd != null) {
48.40 - java.util.Arrays.fill(this.passwd, (char) '0');
48.41 + java.util.Arrays.fill(this.passwd, '0');
48.42 this.passwd = null;
48.43 }
48.44 if (this.key != null) {
49.1 --- a/src/share/classes/com/sun/crypto/provider/PCBC.java Thu Sep 01 13:54:38 2011 -0700
49.2 +++ b/src/share/classes/com/sun/crypto/provider/PCBC.java Mon Sep 05 23:58:19 2011 -0700
49.3 @@ -1,5 +1,5 @@
49.4 /*
49.5 - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
49.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
49.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
49.8 *
49.9 * This code is free software; you can redistribute it and/or modify it
49.10 @@ -145,7 +145,7 @@
49.11 for (; plainOffset < endIndex;
49.12 plainOffset += blockSize, cipherOffset += blockSize) {
49.13 for (i=0; i<blockSize; i++) {
49.14 - k[i] ^= (byte)(plain[i+plainOffset]);
49.15 + k[i] ^= plain[i+plainOffset];
49.16 }
49.17 embeddedCipher.encryptBlock(k, 0, cipher, cipherOffset);
49.18 for (i = 0; i < blockSize; i++) {
50.1 --- a/src/share/classes/com/sun/crypto/provider/RC2Cipher.java Thu Sep 01 13:54:38 2011 -0700
50.2 +++ b/src/share/classes/com/sun/crypto/provider/RC2Cipher.java Mon Sep 05 23:58:19 2011 -0700
50.3 @@ -1,5 +1,5 @@
50.4 /*
50.5 - * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
50.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
50.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
50.8 *
50.9 * This code is free software; you can redistribute it and/or modify it
50.10 @@ -98,8 +98,8 @@
50.11 throws InvalidKeyException, InvalidAlgorithmParameterException {
50.12 if (params != null && params.getAlgorithm().equals("RC2")) {
50.13 try {
50.14 - RC2ParameterSpec rc2Params = (RC2ParameterSpec)
50.15 - params.getParameterSpec(RC2ParameterSpec.class);
50.16 + RC2ParameterSpec rc2Params =
50.17 + params.getParameterSpec(RC2ParameterSpec.class);
50.18 engineInit(opmode, key, rc2Params, random);
50.19 } catch (InvalidParameterSpecException ipse) {
50.20 throw new InvalidAlgorithmParameterException
51.1 --- a/src/share/classes/com/sun/crypto/provider/RC2Parameters.java Thu Sep 01 13:54:38 2011 -0700
51.2 +++ b/src/share/classes/com/sun/crypto/provider/RC2Parameters.java Mon Sep 05 23:58:19 2011 -0700
51.3 @@ -1,5 +1,5 @@
51.4 /*
51.5 - * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
51.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
51.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
51.8 *
51.9 * This code is free software; you can redistribute it and/or modify it
51.10 @@ -55,7 +55,6 @@
51.11 * @author Sean Mullan
51.12 * @since 1.5
51.13 */
51.14 -
51.15 public final class RC2Parameters extends AlgorithmParametersSpi {
51.16
51.17 // TABLE[EKB] from section 6 of RFC 2268, used to convert effective key
51.18 @@ -177,13 +176,14 @@
51.19 engineInit(encoded);
51.20 }
51.21
51.22 - protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
51.23 + protected <T extends AlgorithmParameterSpec>
51.24 + T engineGetParameterSpec(Class<T> paramSpec)
51.25 throws InvalidParameterSpecException {
51.26
51.27 if (RC2ParameterSpec.class.isAssignableFrom(paramSpec)) {
51.28 - return (iv == null ?
51.29 - new RC2ParameterSpec(effectiveKeySize) :
51.30 - new RC2ParameterSpec(effectiveKeySize, iv));
51.31 + return paramSpec.cast((iv == null ?
51.32 + new RC2ParameterSpec(effectiveKeySize) :
51.33 + new RC2ParameterSpec(effectiveKeySize, iv)));
51.34 } else {
51.35 throw new InvalidParameterSpecException
51.36 ("Inappropriate parameter specification");
52.1 --- a/src/share/classes/com/sun/crypto/provider/RSACipher.java Thu Sep 01 13:54:38 2011 -0700
52.2 +++ b/src/share/classes/com/sun/crypto/provider/RSACipher.java Mon Sep 05 23:58:19 2011 -0700
52.3 @@ -1,5 +1,5 @@
52.4 /*
52.5 - * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
52.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
52.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
52.8 *
52.9 * This code is free software; you can redistribute it and/or modify it
52.10 @@ -227,8 +227,8 @@
52.11 init(opmode, key, random, null);
52.12 } else {
52.13 try {
52.14 - OAEPParameterSpec spec = (OAEPParameterSpec)
52.15 - params.getParameterSpec(OAEPParameterSpec.class);
52.16 + OAEPParameterSpec spec =
52.17 + params.getParameterSpec(OAEPParameterSpec.class);
52.18 init(opmode, key, random, spec);
52.19 } catch (InvalidParameterSpecException ipse) {
52.20 InvalidAlgorithmParameterException iape =
53.1 --- a/src/share/classes/com/sun/crypto/provider/SunJCE.java Thu Sep 01 13:54:38 2011 -0700
53.2 +++ b/src/share/classes/com/sun/crypto/provider/SunJCE.java Mon Sep 05 23:58:19 2011 -0700
53.3 @@ -1,5 +1,5 @@
53.4 /*
53.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
53.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
53.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
53.8 *
53.9 * This code is free software; you can redistribute it and/or modify it
53.10 @@ -27,11 +27,6 @@
53.11
53.12 import java.security.AccessController;
53.13 import java.security.Provider;
53.14 -import java.security.PrivilegedAction;
53.15 -import java.security.cert.*;
53.16 -import java.net.URL;
53.17 -import java.io.ByteArrayInputStream;
53.18 -import java.security.CodeSource;
53.19 import java.security.SecureRandom;
53.20
53.21
53.22 @@ -105,352 +100,353 @@
53.23 "|OFB72|OFB80|OFB88|OFB96|OFB104|OFB112|OFB120|OFB128";
53.24 final String BLOCK_PADS = "NOPADDING|PKCS5PADDING|ISO10126PADDING";
53.25
53.26 - AccessController.doPrivileged(new java.security.PrivilegedAction() {
53.27 + AccessController.doPrivileged(
53.28 + new java.security.PrivilegedAction<Object>() {
53.29 public Object run() {
53.30
53.31 - /*
53.32 - * Cipher engines
53.33 - */
53.34 - put("Cipher.RSA", "com.sun.crypto.provider.RSACipher");
53.35 - put("Cipher.RSA SupportedModes", "ECB");
53.36 - put("Cipher.RSA SupportedPaddings",
53.37 - "NOPADDING|PKCS1PADDING|OAEPWITHMD5ANDMGF1PADDING"
53.38 - + "|OAEPWITHSHA1ANDMGF1PADDING"
53.39 - + "|OAEPWITHSHA-1ANDMGF1PADDING"
53.40 - + "|OAEPWITHSHA-256ANDMGF1PADDING"
53.41 - + "|OAEPWITHSHA-384ANDMGF1PADDING"
53.42 - + "|OAEPWITHSHA-512ANDMGF1PADDING");
53.43 - put("Cipher.RSA SupportedKeyClasses",
53.44 - "java.security.interfaces.RSAPublicKey" +
53.45 - "|java.security.interfaces.RSAPrivateKey");
53.46 + /*
53.47 + * Cipher engines
53.48 + */
53.49 + put("Cipher.RSA", "com.sun.crypto.provider.RSACipher");
53.50 + put("Cipher.RSA SupportedModes", "ECB");
53.51 + put("Cipher.RSA SupportedPaddings",
53.52 + "NOPADDING|PKCS1PADDING|OAEPWITHMD5ANDMGF1PADDING"
53.53 + + "|OAEPWITHSHA1ANDMGF1PADDING"
53.54 + + "|OAEPWITHSHA-1ANDMGF1PADDING"
53.55 + + "|OAEPWITHSHA-256ANDMGF1PADDING"
53.56 + + "|OAEPWITHSHA-384ANDMGF1PADDING"
53.57 + + "|OAEPWITHSHA-512ANDMGF1PADDING");
53.58 + put("Cipher.RSA SupportedKeyClasses",
53.59 + "java.security.interfaces.RSAPublicKey" +
53.60 + "|java.security.interfaces.RSAPrivateKey");
53.61
53.62 - put("Cipher.DES", "com.sun.crypto.provider.DESCipher");
53.63 - put("Cipher.DES SupportedModes", BLOCK_MODES);
53.64 - put("Cipher.DES SupportedPaddings", BLOCK_PADS);
53.65 - put("Cipher.DES SupportedKeyFormats", "RAW");
53.66 + put("Cipher.DES", "com.sun.crypto.provider.DESCipher");
53.67 + put("Cipher.DES SupportedModes", BLOCK_MODES);
53.68 + put("Cipher.DES SupportedPaddings", BLOCK_PADS);
53.69 + put("Cipher.DES SupportedKeyFormats", "RAW");
53.70
53.71 - put("Cipher.DESede", "com.sun.crypto.provider.DESedeCipher");
53.72 - put("Alg.Alias.Cipher.TripleDES", "DESede");
53.73 - put("Cipher.DESede SupportedModes", BLOCK_MODES);
53.74 - put("Cipher.DESede SupportedPaddings", BLOCK_PADS);
53.75 - put("Cipher.DESede SupportedKeyFormats", "RAW");
53.76 + put("Cipher.DESede", "com.sun.crypto.provider.DESedeCipher");
53.77 + put("Alg.Alias.Cipher.TripleDES", "DESede");
53.78 + put("Cipher.DESede SupportedModes", BLOCK_MODES);
53.79 + put("Cipher.DESede SupportedPaddings", BLOCK_PADS);
53.80 + put("Cipher.DESede SupportedKeyFormats", "RAW");
53.81
53.82 - put("Cipher.DESedeWrap",
53.83 - "com.sun.crypto.provider.DESedeWrapCipher");
53.84 - put("Cipher.DESedeWrap SupportedModes", "CBC");
53.85 - put("Cipher.DESedeWrap SupportedPaddings", "NOPADDING");
53.86 - put("Cipher.DESedeWrap SupportedKeyFormats", "RAW");
53.87 + put("Cipher.DESedeWrap",
53.88 + "com.sun.crypto.provider.DESedeWrapCipher");
53.89 + put("Cipher.DESedeWrap SupportedModes", "CBC");
53.90 + put("Cipher.DESedeWrap SupportedPaddings", "NOPADDING");
53.91 + put("Cipher.DESedeWrap SupportedKeyFormats", "RAW");
53.92
53.93 - put("Cipher.PBEWithMD5AndDES",
53.94 - "com.sun.crypto.provider.PBEWithMD5AndDESCipher");
53.95 - put("Alg.Alias.Cipher.OID."+OID_PKCS5_MD5_DES,
53.96 - "PBEWithMD5AndDES");
53.97 - put("Alg.Alias.Cipher."+OID_PKCS5_MD5_DES,
53.98 - "PBEWithMD5AndDES");
53.99 - put("Cipher.PBEWithMD5AndTripleDES",
53.100 - "com.sun.crypto.provider.PBEWithMD5AndTripleDESCipher");
53.101 - put("Cipher.PBEWithSHA1AndRC2_40",
53.102 - "com.sun.crypto.provider.PKCS12PBECipherCore$" +
53.103 - "PBEWithSHA1AndRC2_40");
53.104 - put("Alg.Alias.Cipher.OID." + OID_PKCS12_RC2_40,
53.105 - "PBEWithSHA1AndRC2_40");
53.106 - put("Alg.Alias.Cipher." + OID_PKCS12_RC2_40,
53.107 - "PBEWithSHA1AndRC2_40");
53.108 - put("Cipher.PBEWithSHA1AndDESede",
53.109 - "com.sun.crypto.provider.PKCS12PBECipherCore$" +
53.110 - "PBEWithSHA1AndDESede");
53.111 - put("Alg.Alias.Cipher.OID." + OID_PKCS12_DESede,
53.112 - "PBEWithSHA1AndDESede");
53.113 - put("Alg.Alias.Cipher." + OID_PKCS12_DESede,
53.114 - "PBEWithSHA1AndDESede");
53.115 + put("Cipher.PBEWithMD5AndDES",
53.116 + "com.sun.crypto.provider.PBEWithMD5AndDESCipher");
53.117 + put("Alg.Alias.Cipher.OID."+OID_PKCS5_MD5_DES,
53.118 + "PBEWithMD5AndDES");
53.119 + put("Alg.Alias.Cipher."+OID_PKCS5_MD5_DES,
53.120 + "PBEWithMD5AndDES");
53.121 + put("Cipher.PBEWithMD5AndTripleDES",
53.122 + "com.sun.crypto.provider.PBEWithMD5AndTripleDESCipher");
53.123 + put("Cipher.PBEWithSHA1AndRC2_40",
53.124 + "com.sun.crypto.provider.PKCS12PBECipherCore$" +
53.125 + "PBEWithSHA1AndRC2_40");
53.126 + put("Alg.Alias.Cipher.OID." + OID_PKCS12_RC2_40,
53.127 + "PBEWithSHA1AndRC2_40");
53.128 + put("Alg.Alias.Cipher." + OID_PKCS12_RC2_40,
53.129 + "PBEWithSHA1AndRC2_40");
53.130 + put("Cipher.PBEWithSHA1AndDESede",
53.131 + "com.sun.crypto.provider.PKCS12PBECipherCore$" +
53.132 + "PBEWithSHA1AndDESede");
53.133 + put("Alg.Alias.Cipher.OID." + OID_PKCS12_DESede,
53.134 + "PBEWithSHA1AndDESede");
53.135 + put("Alg.Alias.Cipher." + OID_PKCS12_DESede,
53.136 + "PBEWithSHA1AndDESede");
53.137
53.138 - put("Cipher.Blowfish",
53.139 - "com.sun.crypto.provider.BlowfishCipher");
53.140 - put("Cipher.Blowfish SupportedModes", BLOCK_MODES);
53.141 - put("Cipher.Blowfish SupportedPaddings", BLOCK_PADS);
53.142 - put("Cipher.Blowfish SupportedKeyFormats", "RAW");
53.143 + put("Cipher.Blowfish",
53.144 + "com.sun.crypto.provider.BlowfishCipher");
53.145 + put("Cipher.Blowfish SupportedModes", BLOCK_MODES);
53.146 + put("Cipher.Blowfish SupportedPaddings", BLOCK_PADS);
53.147 + put("Cipher.Blowfish SupportedKeyFormats", "RAW");
53.148
53.149 - put("Cipher.AES", "com.sun.crypto.provider.AESCipher");
53.150 - put("Alg.Alias.Cipher.Rijndael", "AES");
53.151 - put("Cipher.AES SupportedModes", BLOCK_MODES128);
53.152 - put("Cipher.AES SupportedPaddings", BLOCK_PADS);
53.153 - put("Cipher.AES SupportedKeyFormats", "RAW");
53.154 + put("Cipher.AES", "com.sun.crypto.provider.AESCipher");
53.155 + put("Alg.Alias.Cipher.Rijndael", "AES");
53.156 + put("Cipher.AES SupportedModes", BLOCK_MODES128);
53.157 + put("Cipher.AES SupportedPaddings", BLOCK_PADS);
53.158 + put("Cipher.AES SupportedKeyFormats", "RAW");
53.159
53.160 - put("Cipher.AESWrap", "com.sun.crypto.provider.AESWrapCipher");
53.161 - put("Cipher.AESWrap SupportedModes", "ECB");
53.162 - put("Cipher.AESWrap SupportedPaddings", "NOPADDING");
53.163 - put("Cipher.AESWrap SupportedKeyFormats", "RAW");
53.164 + put("Cipher.AESWrap", "com.sun.crypto.provider.AESWrapCipher");
53.165 + put("Cipher.AESWrap SupportedModes", "ECB");
53.166 + put("Cipher.AESWrap SupportedPaddings", "NOPADDING");
53.167 + put("Cipher.AESWrap SupportedKeyFormats", "RAW");
53.168
53.169 - put("Cipher.RC2",
53.170 - "com.sun.crypto.provider.RC2Cipher");
53.171 - put("Cipher.RC2 SupportedModes", BLOCK_MODES);
53.172 - put("Cipher.RC2 SupportedPaddings", BLOCK_PADS);
53.173 - put("Cipher.RC2 SupportedKeyFormats", "RAW");
53.174 + put("Cipher.RC2",
53.175 + "com.sun.crypto.provider.RC2Cipher");
53.176 + put("Cipher.RC2 SupportedModes", BLOCK_MODES);
53.177 + put("Cipher.RC2 SupportedPaddings", BLOCK_PADS);
53.178 + put("Cipher.RC2 SupportedKeyFormats", "RAW");
53.179
53.180 - put("Cipher.ARCFOUR",
53.181 - "com.sun.crypto.provider.ARCFOURCipher");
53.182 - put("Alg.Alias.Cipher.RC4", "ARCFOUR");
53.183 - put("Cipher.ARCFOUR SupportedModes", "ECB");
53.184 - put("Cipher.ARCFOUR SupportedPaddings", "NOPADDING");
53.185 - put("Cipher.ARCFOUR SupportedKeyFormats", "RAW");
53.186 + put("Cipher.ARCFOUR",
53.187 + "com.sun.crypto.provider.ARCFOURCipher");
53.188 + put("Alg.Alias.Cipher.RC4", "ARCFOUR");
53.189 + put("Cipher.ARCFOUR SupportedModes", "ECB");
53.190 + put("Cipher.ARCFOUR SupportedPaddings", "NOPADDING");
53.191 + put("Cipher.ARCFOUR SupportedKeyFormats", "RAW");
53.192
53.193 - /*
53.194 - * Key(pair) Generator engines
53.195 - */
53.196 - put("KeyGenerator.DES",
53.197 - "com.sun.crypto.provider.DESKeyGenerator");
53.198 + /*
53.199 + * Key(pair) Generator engines
53.200 + */
53.201 + put("KeyGenerator.DES",
53.202 + "com.sun.crypto.provider.DESKeyGenerator");
53.203
53.204 - put("KeyGenerator.DESede",
53.205 - "com.sun.crypto.provider.DESedeKeyGenerator");
53.206 - put("Alg.Alias.KeyGenerator.TripleDES", "DESede");
53.207 + put("KeyGenerator.DESede",
53.208 + "com.sun.crypto.provider.DESedeKeyGenerator");
53.209 + put("Alg.Alias.KeyGenerator.TripleDES", "DESede");
53.210
53.211 - put("KeyGenerator.Blowfish",
53.212 - "com.sun.crypto.provider.BlowfishKeyGenerator");
53.213 + put("KeyGenerator.Blowfish",
53.214 + "com.sun.crypto.provider.BlowfishKeyGenerator");
53.215
53.216 - put("KeyGenerator.AES",
53.217 - "com.sun.crypto.provider.AESKeyGenerator");
53.218 - put("Alg.Alias.KeyGenerator.Rijndael", "AES");
53.219 + put("KeyGenerator.AES",
53.220 + "com.sun.crypto.provider.AESKeyGenerator");
53.221 + put("Alg.Alias.KeyGenerator.Rijndael", "AES");
53.222
53.223 - put("KeyGenerator.RC2",
53.224 - "com.sun.crypto.provider.KeyGeneratorCore$" +
53.225 - "RC2KeyGenerator");
53.226 - put("KeyGenerator.ARCFOUR",
53.227 - "com.sun.crypto.provider.KeyGeneratorCore$" +
53.228 - "ARCFOURKeyGenerator");
53.229 - put("Alg.Alias.KeyGenerator.RC4", "ARCFOUR");
53.230 + put("KeyGenerator.RC2",
53.231 + "com.sun.crypto.provider.KeyGeneratorCore$" +
53.232 + "RC2KeyGenerator");
53.233 + put("KeyGenerator.ARCFOUR",
53.234 + "com.sun.crypto.provider.KeyGeneratorCore$" +
53.235 + "ARCFOURKeyGenerator");
53.236 + put("Alg.Alias.KeyGenerator.RC4", "ARCFOUR");
53.237
53.238 - put("KeyGenerator.HmacMD5",
53.239 - "com.sun.crypto.provider.HmacMD5KeyGenerator");
53.240 + put("KeyGenerator.HmacMD5",
53.241 + "com.sun.crypto.provider.HmacMD5KeyGenerator");
53.242
53.243 - put("KeyGenerator.HmacSHA1",
53.244 - "com.sun.crypto.provider.HmacSHA1KeyGenerator");
53.245 + put("KeyGenerator.HmacSHA1",
53.246 + "com.sun.crypto.provider.HmacSHA1KeyGenerator");
53.247
53.248 - put("KeyGenerator.HmacSHA256",
53.249 - "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA256KG");
53.250 - put("KeyGenerator.HmacSHA384",
53.251 - "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA384KG");
53.252 - put("KeyGenerator.HmacSHA512",
53.253 - "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA512KG");
53.254 + put("KeyGenerator.HmacSHA256",
53.255 + "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA256KG");
53.256 + put("KeyGenerator.HmacSHA384",
53.257 + "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA384KG");
53.258 + put("KeyGenerator.HmacSHA512",
53.259 + "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA512KG");
53.260
53.261 - put("KeyPairGenerator.DiffieHellman",
53.262 - "com.sun.crypto.provider.DHKeyPairGenerator");
53.263 - put("Alg.Alias.KeyPairGenerator.DH", "DiffieHellman");
53.264 - put("Alg.Alias.KeyPairGenerator.OID."+OID_PKCS3,
53.265 - "DiffieHellman");
53.266 - put("Alg.Alias.KeyPairGenerator."+OID_PKCS3,
53.267 - "DiffieHellman");
53.268 - /*
53.269 - * Algorithm parameter generation engines
53.270 - */
53.271 - put("AlgorithmParameterGenerator.DiffieHellman",
53.272 - "com.sun.crypto.provider.DHParameterGenerator");
53.273 - put("Alg.Alias.AlgorithmParameterGenerator.DH",
53.274 - "DiffieHellman");
53.275 - put("Alg.Alias.AlgorithmParameterGenerator.OID."+OID_PKCS3,
53.276 - "DiffieHellman");
53.277 - put("Alg.Alias.AlgorithmParameterGenerator."+OID_PKCS3,
53.278 - "DiffieHellman");
53.279 + put("KeyPairGenerator.DiffieHellman",
53.280 + "com.sun.crypto.provider.DHKeyPairGenerator");
53.281 + put("Alg.Alias.KeyPairGenerator.DH", "DiffieHellman");
53.282 + put("Alg.Alias.KeyPairGenerator.OID."+OID_PKCS3,
53.283 + "DiffieHellman");
53.284 + put("Alg.Alias.KeyPairGenerator."+OID_PKCS3,
53.285 + "DiffieHellman");
53.286 + /*
53.287 + * Algorithm parameter generation engines
53.288 + */
53.289 + put("AlgorithmParameterGenerator.DiffieHellman",
53.290 + "com.sun.crypto.provider.DHParameterGenerator");
53.291 + put("Alg.Alias.AlgorithmParameterGenerator.DH",
53.292 + "DiffieHellman");
53.293 + put("Alg.Alias.AlgorithmParameterGenerator.OID."+OID_PKCS3,
53.294 + "DiffieHellman");
53.295 + put("Alg.Alias.AlgorithmParameterGenerator."+OID_PKCS3,
53.296 + "DiffieHellman");
53.297
53.298 - /*
53.299 - * Key Agreement engines
53.300 - */
53.301 - put("KeyAgreement.DiffieHellman",
53.302 - "com.sun.crypto.provider.DHKeyAgreement");
53.303 - put("Alg.Alias.KeyAgreement.DH", "DiffieHellman");
53.304 - put("Alg.Alias.KeyAgreement.OID."+OID_PKCS3, "DiffieHellman");
53.305 - put("Alg.Alias.KeyAgreement."+OID_PKCS3, "DiffieHellman");
53.306 + /*
53.307 + * Key Agreement engines
53.308 + */
53.309 + put("KeyAgreement.DiffieHellman",
53.310 + "com.sun.crypto.provider.DHKeyAgreement");
53.311 + put("Alg.Alias.KeyAgreement.DH", "DiffieHellman");
53.312 + put("Alg.Alias.KeyAgreement.OID."+OID_PKCS3, "DiffieHellman");
53.313 + put("Alg.Alias.KeyAgreement."+OID_PKCS3, "DiffieHellman");
53.314
53.315 - put("KeyAgreement.DiffieHellman SupportedKeyClasses",
53.316 - "javax.crypto.interfaces.DHPublicKey" +
53.317 - "|javax.crypto.interfaces.DHPrivateKey");
53.318 + put("KeyAgreement.DiffieHellman SupportedKeyClasses",
53.319 + "javax.crypto.interfaces.DHPublicKey" +
53.320 + "|javax.crypto.interfaces.DHPrivateKey");
53.321
53.322 - /*
53.323 - * Algorithm Parameter engines
53.324 - */
53.325 - put("AlgorithmParameters.DiffieHellman",
53.326 - "com.sun.crypto.provider.DHParameters");
53.327 - put("Alg.Alias.AlgorithmParameters.DH", "DiffieHellman");
53.328 - put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS3,
53.329 - "DiffieHellman");
53.330 - put("Alg.Alias.AlgorithmParameters."+OID_PKCS3,
53.331 - "DiffieHellman");
53.332 + /*
53.333 + * Algorithm Parameter engines
53.334 + */
53.335 + put("AlgorithmParameters.DiffieHellman",
53.336 + "com.sun.crypto.provider.DHParameters");
53.337 + put("Alg.Alias.AlgorithmParameters.DH", "DiffieHellman");
53.338 + put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS3,
53.339 + "DiffieHellman");
53.340 + put("Alg.Alias.AlgorithmParameters."+OID_PKCS3,
53.341 + "DiffieHellman");
53.342
53.343 - put("AlgorithmParameters.DES",
53.344 - "com.sun.crypto.provider.DESParameters");
53.345 + put("AlgorithmParameters.DES",
53.346 + "com.sun.crypto.provider.DESParameters");
53.347
53.348 - put("AlgorithmParameters.DESede",
53.349 - "com.sun.crypto.provider.DESedeParameters");
53.350 - put("Alg.Alias.AlgorithmParameters.TripleDES", "DESede");
53.351 + put("AlgorithmParameters.DESede",
53.352 + "com.sun.crypto.provider.DESedeParameters");
53.353 + put("Alg.Alias.AlgorithmParameters.TripleDES", "DESede");
53.354
53.355 - put("AlgorithmParameters.PBE",
53.356 - "com.sun.crypto.provider.PBEParameters");
53.357 + put("AlgorithmParameters.PBE",
53.358 + "com.sun.crypto.provider.PBEParameters");
53.359
53.360 - put("AlgorithmParameters.PBEWithMD5AndDES",
53.361 - "com.sun.crypto.provider.PBEParameters");
53.362 - put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS5_MD5_DES,
53.363 - "PBEWithMD5AndDES");
53.364 - put("Alg.Alias.AlgorithmParameters."+OID_PKCS5_MD5_DES,
53.365 - "PBEWithMD5AndDES");
53.366 + put("AlgorithmParameters.PBEWithMD5AndDES",
53.367 + "com.sun.crypto.provider.PBEParameters");
53.368 + put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS5_MD5_DES,
53.369 + "PBEWithMD5AndDES");
53.370 + put("Alg.Alias.AlgorithmParameters."+OID_PKCS5_MD5_DES,
53.371 + "PBEWithMD5AndDES");
53.372
53.373 - put("AlgorithmParameters.PBEWithMD5AndTripleDES",
53.374 - "com.sun.crypto.provider.PBEParameters");
53.375 + put("AlgorithmParameters.PBEWithMD5AndTripleDES",
53.376 + "com.sun.crypto.provider.PBEParameters");
53.377
53.378 - put("AlgorithmParameters.PBEWithSHA1AndDESede",
53.379 - "com.sun.crypto.provider.PBEParameters");
53.380 - put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS12_DESede,
53.381 - "PBEWithSHA1AndDESede");
53.382 - put("Alg.Alias.AlgorithmParameters."+OID_PKCS12_DESede,
53.383 - "PBEWithSHA1AndDESede");
53.384 + put("AlgorithmParameters.PBEWithSHA1AndDESede",
53.385 + "com.sun.crypto.provider.PBEParameters");
53.386 + put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS12_DESede,
53.387 + "PBEWithSHA1AndDESede");
53.388 + put("Alg.Alias.AlgorithmParameters."+OID_PKCS12_DESede,
53.389 + "PBEWithSHA1AndDESede");
53.390
53.391 - put("AlgorithmParameters.PBEWithSHA1AndRC2_40",
53.392 - "com.sun.crypto.provider.PBEParameters");
53.393 - put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS12_RC2_40,
53.394 - "PBEWithSHA1AndRC2_40");
53.395 - put("Alg.Alias.AlgorithmParameters." + OID_PKCS12_RC2_40,
53.396 - "PBEWithSHA1AndRC2_40");
53.397 + put("AlgorithmParameters.PBEWithSHA1AndRC2_40",
53.398 + "com.sun.crypto.provider.PBEParameters");
53.399 + put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS12_RC2_40,
53.400 + "PBEWithSHA1AndRC2_40");
53.401 + put("Alg.Alias.AlgorithmParameters." + OID_PKCS12_RC2_40,
53.402 + "PBEWithSHA1AndRC2_40");
53.403
53.404 - put("AlgorithmParameters.Blowfish",
53.405 - "com.sun.crypto.provider.BlowfishParameters");
53.406 + put("AlgorithmParameters.Blowfish",
53.407 + "com.sun.crypto.provider.BlowfishParameters");
53.408
53.409 - put("AlgorithmParameters.AES",
53.410 - "com.sun.crypto.provider.AESParameters");
53.411 - put("Alg.Alias.AlgorithmParameters.Rijndael", "AES");
53.412 + put("AlgorithmParameters.AES",
53.413 + "com.sun.crypto.provider.AESParameters");
53.414 + put("Alg.Alias.AlgorithmParameters.Rijndael", "AES");
53.415
53.416
53.417 - put("AlgorithmParameters.RC2",
53.418 - "com.sun.crypto.provider.RC2Parameters");
53.419 + put("AlgorithmParameters.RC2",
53.420 + "com.sun.crypto.provider.RC2Parameters");
53.421
53.422 - put("AlgorithmParameters.OAEP",
53.423 - "com.sun.crypto.provider.OAEPParameters");
53.424 + put("AlgorithmParameters.OAEP",
53.425 + "com.sun.crypto.provider.OAEPParameters");
53.426
53.427
53.428 - /*
53.429 - * Key factories
53.430 - */
53.431 - put("KeyFactory.DiffieHellman",
53.432 - "com.sun.crypto.provider.DHKeyFactory");
53.433 - put("Alg.Alias.KeyFactory.DH", "DiffieHellman");
53.434 - put("Alg.Alias.KeyFactory.OID."+OID_PKCS3,
53.435 - "DiffieHellman");
53.436 - put("Alg.Alias.KeyFactory."+OID_PKCS3, "DiffieHellman");
53.437 - /*
53.438 - * Secret-key factories
53.439 - */
53.440 - put("SecretKeyFactory.DES",
53.441 - "com.sun.crypto.provider.DESKeyFactory");
53.442 + /*
53.443 + * Key factories
53.444 + */
53.445 + put("KeyFactory.DiffieHellman",
53.446 + "com.sun.crypto.provider.DHKeyFactory");
53.447 + put("Alg.Alias.KeyFactory.DH", "DiffieHellman");
53.448 + put("Alg.Alias.KeyFactory.OID."+OID_PKCS3,
53.449 + "DiffieHellman");
53.450 + put("Alg.Alias.KeyFactory."+OID_PKCS3, "DiffieHellman");
53.451 + /*
53.452 + * Secret-key factories
53.453 + */
53.454 + put("SecretKeyFactory.DES",
53.455 + "com.sun.crypto.provider.DESKeyFactory");
53.456
53.457 - put("SecretKeyFactory.DESede",
53.458 - "com.sun.crypto.provider.DESedeKeyFactory");
53.459 - put("Alg.Alias.SecretKeyFactory.TripleDES", "DESede");
53.460 + put("SecretKeyFactory.DESede",
53.461 + "com.sun.crypto.provider.DESedeKeyFactory");
53.462 + put("Alg.Alias.SecretKeyFactory.TripleDES", "DESede");
53.463
53.464 - put("SecretKeyFactory.PBEWithMD5AndDES",
53.465 - "com.sun.crypto.provider.PBEKeyFactory$PBEWithMD5AndDES"
53.466 - );
53.467 - put("Alg.Alias.SecretKeyFactory.OID."+OID_PKCS5_MD5_DES,
53.468 - "PBEWithMD5AndDES");
53.469 - put("Alg.Alias.SecretKeyFactory."+OID_PKCS5_MD5_DES,
53.470 - "PBEWithMD5AndDES");
53.471 + put("SecretKeyFactory.PBEWithMD5AndDES",
53.472 + "com.sun.crypto.provider.PBEKeyFactory$PBEWithMD5AndDES"
53.473 + );
53.474 + put("Alg.Alias.SecretKeyFactory.OID."+OID_PKCS5_MD5_DES,
53.475 + "PBEWithMD5AndDES");
53.476 + put("Alg.Alias.SecretKeyFactory."+OID_PKCS5_MD5_DES,
53.477 + "PBEWithMD5AndDES");
53.478
53.479 - put("Alg.Alias.SecretKeyFactory.PBE",
53.480 - "PBEWithMD5AndDES");
53.481 + put("Alg.Alias.SecretKeyFactory.PBE",
53.482 + "PBEWithMD5AndDES");
53.483
53.484 - /*
53.485 - * Internal in-house crypto algorithm used for
53.486 - * the JCEKS keystore type. Since this was developed
53.487 - * internally, there isn't an OID corresponding to this
53.488 - * algorithm.
53.489 - */
53.490 - put("SecretKeyFactory.PBEWithMD5AndTripleDES",
53.491 - "com.sun.crypto.provider.PBEKeyFactory$" +
53.492 - "PBEWithMD5AndTripleDES"
53.493 - );
53.494 + /*
53.495 + * Internal in-house crypto algorithm used for
53.496 + * the JCEKS keystore type. Since this was developed
53.497 + * internally, there isn't an OID corresponding to this
53.498 + * algorithm.
53.499 + */
53.500 + put("SecretKeyFactory.PBEWithMD5AndTripleDES",
53.501 + "com.sun.crypto.provider.PBEKeyFactory$" +
53.502 + "PBEWithMD5AndTripleDES"
53.503 + );
53.504
53.505 - put("SecretKeyFactory.PBEWithSHA1AndDESede",
53.506 - "com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndDESede"
53.507 - );
53.508 - put("Alg.Alias.SecretKeyFactory.OID."+OID_PKCS12_DESede,
53.509 - "PBEWithSHA1AndDESede");
53.510 - put("Alg.Alias.SecretKeyFactory." + OID_PKCS12_DESede,
53.511 - "PBEWithSHA1AndDESede");
53.512 + put("SecretKeyFactory.PBEWithSHA1AndDESede",
53.513 + "com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndDESede"
53.514 + );
53.515 + put("Alg.Alias.SecretKeyFactory.OID."+OID_PKCS12_DESede,
53.516 + "PBEWithSHA1AndDESede");
53.517 + put("Alg.Alias.SecretKeyFactory." + OID_PKCS12_DESede,
53.518 + "PBEWithSHA1AndDESede");
53.519
53.520 - put("SecretKeyFactory.PBEWithSHA1AndRC2_40",
53.521 - "com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndRC2_40"
53.522 - );
53.523 - put("Alg.Alias.SecretKeyFactory.OID." + OID_PKCS12_RC2_40,
53.524 - "PBEWithSHA1AndRC2_40");
53.525 - put("Alg.Alias.SecretKeyFactory." + OID_PKCS12_RC2_40,
53.526 - "PBEWithSHA1AndRC2_40");
53.527 + put("SecretKeyFactory.PBEWithSHA1AndRC2_40",
53.528 + "com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndRC2_40"
53.529 + );
53.530 + put("Alg.Alias.SecretKeyFactory.OID." + OID_PKCS12_RC2_40,
53.531 + "PBEWithSHA1AndRC2_40");
53.532 + put("Alg.Alias.SecretKeyFactory." + OID_PKCS12_RC2_40,
53.533 + "PBEWithSHA1AndRC2_40");
53.534
53.535 - put("SecretKeyFactory.PBKDF2WithHmacSHA1",
53.536 - "com.sun.crypto.provider.PBKDF2HmacSHA1Factory");
53.537 - put("Alg.Alias.SecretKeyFactory.OID." + OID_PKCS5_PBKDF2,
53.538 - "PBKDF2WithHmacSHA1");
53.539 - put("Alg.Alias.SecretKeyFactory." + OID_PKCS5_PBKDF2,
53.540 - "PBKDF2WithHmacSHA1");
53.541 + put("SecretKeyFactory.PBKDF2WithHmacSHA1",
53.542 + "com.sun.crypto.provider.PBKDF2HmacSHA1Factory");
53.543 + put("Alg.Alias.SecretKeyFactory.OID." + OID_PKCS5_PBKDF2,
53.544 + "PBKDF2WithHmacSHA1");
53.545 + put("Alg.Alias.SecretKeyFactory." + OID_PKCS5_PBKDF2,
53.546 + "PBKDF2WithHmacSHA1");
53.547
53.548 - /*
53.549 - * MAC
53.550 - */
53.551 - put("Mac.HmacMD5", "com.sun.crypto.provider.HmacMD5");
53.552 - put("Mac.HmacSHA1", "com.sun.crypto.provider.HmacSHA1");
53.553 - put("Mac.HmacSHA256",
53.554 - "com.sun.crypto.provider.HmacCore$HmacSHA256");
53.555 - put("Mac.HmacSHA384",
53.556 - "com.sun.crypto.provider.HmacCore$HmacSHA384");
53.557 - put("Mac.HmacSHA512",
53.558 - "com.sun.crypto.provider.HmacCore$HmacSHA512");
53.559 - put("Mac.HmacPBESHA1",
53.560 - "com.sun.crypto.provider.HmacPKCS12PBESHA1");
53.561 + /*
53.562 + * MAC
53.563 + */
53.564 + put("Mac.HmacMD5", "com.sun.crypto.provider.HmacMD5");
53.565 + put("Mac.HmacSHA1", "com.sun.crypto.provider.HmacSHA1");
53.566 + put("Mac.HmacSHA256",
53.567 + "com.sun.crypto.provider.HmacCore$HmacSHA256");
53.568 + put("Mac.HmacSHA384",
53.569 + "com.sun.crypto.provider.HmacCore$HmacSHA384");
53.570 + put("Mac.HmacSHA512",
53.571 + "com.sun.crypto.provider.HmacCore$HmacSHA512");
53.572 + put("Mac.HmacPBESHA1",
53.573 + "com.sun.crypto.provider.HmacPKCS12PBESHA1");
53.574
53.575 - put("Mac.SslMacMD5",
53.576 - "com.sun.crypto.provider.SslMacCore$SslMacMD5");
53.577 - put("Mac.SslMacSHA1",
53.578 - "com.sun.crypto.provider.SslMacCore$SslMacSHA1");
53.579 + put("Mac.SslMacMD5",
53.580 + "com.sun.crypto.provider.SslMacCore$SslMacMD5");
53.581 + put("Mac.SslMacSHA1",
53.582 + "com.sun.crypto.provider.SslMacCore$SslMacSHA1");
53.583
53.584 - put("Mac.HmacMD5 SupportedKeyFormats", "RAW");
53.585 - put("Mac.HmacSHA1 SupportedKeyFormats", "RAW");
53.586 - put("Mac.HmacSHA256 SupportedKeyFormats", "RAW");
53.587 - put("Mac.HmacSHA384 SupportedKeyFormats", "RAW");
53.588 - put("Mac.HmacSHA512 SupportedKeyFormats", "RAW");
53.589 - put("Mac.HmacPBESHA1 SupportedKeyFormats", "RAW");
53.590 - put("Mac.SslMacMD5 SupportedKeyFormats", "RAW");
53.591 - put("Mac.SslMacSHA1 SupportedKeyFormats", "RAW");
53.592 + put("Mac.HmacMD5 SupportedKeyFormats", "RAW");
53.593 + put("Mac.HmacSHA1 SupportedKeyFormats", "RAW");
53.594 + put("Mac.HmacSHA256 SupportedKeyFormats", "RAW");
53.595 + put("Mac.HmacSHA384 SupportedKeyFormats", "RAW");
53.596 + put("Mac.HmacSHA512 SupportedKeyFormats", "RAW");
53.597 + put("Mac.HmacPBESHA1 SupportedKeyFormats", "RAW");
53.598 + put("Mac.SslMacMD5 SupportedKeyFormats", "RAW");
53.599 + put("Mac.SslMacSHA1 SupportedKeyFormats", "RAW");
53.600
53.601 - /*
53.602 - * KeyStore
53.603 - */
53.604 - put("KeyStore.JCEKS", "com.sun.crypto.provider.JceKeyStore");
53.605 + /*
53.606 + * KeyStore
53.607 + */
53.608 + put("KeyStore.JCEKS", "com.sun.crypto.provider.JceKeyStore");
53.609
53.610 - /*
53.611 - * SSL/TLS mechanisms
53.612 - *
53.613 - * These are strictly internal implementations and may
53.614 - * be changed at any time. These names were chosen
53.615 - * because PKCS11/SunPKCS11 does not yet have TLS1.2
53.616 - * mechanisms, and it will cause calls to come here.
53.617 - */
53.618 - put("KeyGenerator.SunTlsPrf",
53.619 - "com.sun.crypto.provider.TlsPrfGenerator$V10");
53.620 - put("KeyGenerator.SunTls12Prf",
53.621 - "com.sun.crypto.provider.TlsPrfGenerator$V12");
53.622 + /*
53.623 + * SSL/TLS mechanisms
53.624 + *
53.625 + * These are strictly internal implementations and may
53.626 + * be changed at any time. These names were chosen
53.627 + * because PKCS11/SunPKCS11 does not yet have TLS1.2
53.628 + * mechanisms, and it will cause calls to come here.
53.629 + */
53.630 + put("KeyGenerator.SunTlsPrf",
53.631 + "com.sun.crypto.provider.TlsPrfGenerator$V10");
53.632 + put("KeyGenerator.SunTls12Prf",
53.633 + "com.sun.crypto.provider.TlsPrfGenerator$V12");
53.634
53.635 - put("KeyGenerator.SunTlsMasterSecret",
53.636 - "com.sun.crypto.provider.TlsMasterSecretGenerator");
53.637 - put("Alg.Alias.KeyGenerator.SunTls12MasterSecret",
53.638 - "SunTlsMasterSecret");
53.639 + put("KeyGenerator.SunTlsMasterSecret",
53.640 + "com.sun.crypto.provider.TlsMasterSecretGenerator");
53.641 + put("Alg.Alias.KeyGenerator.SunTls12MasterSecret",
53.642 + "SunTlsMasterSecret");
53.643
53.644 - put("KeyGenerator.SunTlsKeyMaterial",
53.645 - "com.sun.crypto.provider.TlsKeyMaterialGenerator");
53.646 - put("Alg.Alias.KeyGenerator.SunTls12KeyMaterial",
53.647 - "SunTlsKeyMaterial");
53.648 + put("KeyGenerator.SunTlsKeyMaterial",
53.649 + "com.sun.crypto.provider.TlsKeyMaterialGenerator");
53.650 + put("Alg.Alias.KeyGenerator.SunTls12KeyMaterial",
53.651 + "SunTlsKeyMaterial");
53.652
53.653 - put("KeyGenerator.SunTlsRsaPremasterSecret",
53.654 - "com.sun.crypto.provider.TlsRsaPremasterSecretGenerator");
53.655 - put("Alg.Alias.KeyGenerator.SunTls12RsaPremasterSecret",
53.656 - "SunTlsRsaPremasterSecret");
53.657 + put("KeyGenerator.SunTlsRsaPremasterSecret",
53.658 + "com.sun.crypto.provider.TlsRsaPremasterSecretGenerator");
53.659 + put("Alg.Alias.KeyGenerator.SunTls12RsaPremasterSecret",
53.660 + "SunTlsRsaPremasterSecret");
53.661
53.662 - return null;
53.663 - }
53.664 - });
53.665 + return null;
53.666 + }
53.667 + });
53.668 }
53.669 }
54.1 --- a/src/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java Thu Sep 01 13:54:38 2011 -0700
54.2 +++ b/src/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java Mon Sep 05 23:58:19 2011 -0700
54.3 @@ -1,5 +1,5 @@
54.4 /*
54.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
54.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
54.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
54.8 *
54.9 * This code is free software; you can redistribute it and/or modify it
54.10 @@ -31,7 +31,6 @@
54.11 import javax.crypto.*;
54.12 import javax.crypto.spec.*;
54.13
54.14 -import sun.security.internal.interfaces.TlsMasterSecret;
54.15 import sun.security.internal.spec.*;
54.16
54.17 import static com.sun.crypto.provider.TlsPrfGenerator.*;
55.1 --- a/src/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java Thu Sep 01 13:54:38 2011 -0700
55.2 +++ b/src/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java Mon Sep 05 23:58:19 2011 -0700
55.3 @@ -1,5 +1,5 @@
55.4 /*
55.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
55.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
55.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55.8 *
55.9 * This code is free software; you can redistribute it and/or modify it
55.10 @@ -140,6 +140,7 @@
55.11 }
55.12
55.13 private static final class TlsMasterSecretKey implements TlsMasterSecret {
55.14 + private static final long serialVersionUID = 1019571680375368880L;
55.15
55.16 private byte[] key;
55.17 private final int majorVersion, minorVersion;
56.1 --- a/src/share/classes/com/sun/jndi/cosnaming/CNBindingEnumeration.java Thu Sep 01 13:54:38 2011 -0700
56.2 +++ b/src/share/classes/com/sun/jndi/cosnaming/CNBindingEnumeration.java Mon Sep 05 23:58:19 2011 -0700
56.3 @@ -1,5 +1,5 @@
56.4 /*
56.5 - * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
56.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
56.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
56.8 *
56.9 * This code is free software; you can redistribute it and/or modify it
56.10 @@ -32,8 +32,6 @@
56.11 import java.util.Hashtable;
56.12
56.13 import org.omg.CosNaming.*;
56.14 -import org.omg.CosNaming.NamingContextPackage.*;
56.15 -import org.omg.CORBA.*;
56.16
56.17 /**
56.18 * Implements the JNDI NamingEnumeration interface for COS
56.19 @@ -44,7 +42,8 @@
56.20 * @author Rosanna Lee
56.21 */
56.22
56.23 -final class CNBindingEnumeration implements NamingEnumeration {
56.24 +final class CNBindingEnumeration
56.25 + implements NamingEnumeration<javax.naming.Binding> {
56.26
56.27 private static final int DEFAULT_BATCHSIZE = 100;
56.28 private BindingListHolder _bindingList; // list of bindings
56.29 @@ -52,105 +51,105 @@
56.30 private int counter; // pointer in _bindingList
56.31 private int batchsize = DEFAULT_BATCHSIZE; // how many to ask for each time
56.32 private CNCtx _ctx; // ctx to list
56.33 - private Hashtable _env; // environment for getObjectInstance
56.34 + private Hashtable<?,?> _env; // environment for getObjectInstance
56.35 private boolean more = false; // iterator done?
56.36 private boolean isLookedUpCtx = false; // iterating on a context beneath this context ?
56.37
56.38 - /**
56.39 - * Creates a CNBindingEnumeration object.
56.40 - * @param ctx Context to enumerate
56.41 - */
56.42 - CNBindingEnumeration(CNCtx ctx, boolean isLookedUpCtx, Hashtable env) {
56.43 - // Get batch size to use
56.44 - String batch = (env != null ?
56.45 - (String)env.get(javax.naming.Context.BATCHSIZE) : null);
56.46 - if (batch != null) {
56.47 - try {
56.48 - batchsize = Integer.parseInt(batch);
56.49 - } catch (NumberFormatException e) {
56.50 - throw new IllegalArgumentException("Batch size not numeric: " + batch);
56.51 + /**
56.52 + * Creates a CNBindingEnumeration object.
56.53 + * @param ctx Context to enumerate
56.54 + */
56.55 + CNBindingEnumeration(CNCtx ctx, boolean isLookedUpCtx, Hashtable<?,?> env) {
56.56 + // Get batch size to use
56.57 + String batch = (env != null ?
56.58 + (String)env.get(javax.naming.Context.BATCHSIZE) : null);
56.59 + if (batch != null) {
56.60 + try {
56.61 + batchsize = Integer.parseInt(batch);
56.62 + } catch (NumberFormatException e) {
56.63 + throw new IllegalArgumentException("Batch size not numeric: " + batch);
56.64 + }
56.65 + }
56.66 + _ctx = ctx;
56.67 + _ctx.incEnumCount();
56.68 + this.isLookedUpCtx = isLookedUpCtx;
56.69 + _env = env;
56.70 + _bindingList = new BindingListHolder();
56.71 + BindingIteratorHolder _bindingIterH = new BindingIteratorHolder();
56.72 +
56.73 + // Perform listing and request that bindings be returned in _bindingIter
56.74 + // Upon return,_bindingList returns a zero length list
56.75 + _ctx._nc.list(0, _bindingList, _bindingIterH);
56.76 +
56.77 + _bindingIter = _bindingIterH.value;
56.78 +
56.79 + // Get first batch using _bindingIter
56.80 + if (_bindingIter != null) {
56.81 + more = _bindingIter.next_n(batchsize, _bindingList);
56.82 + } else {
56.83 + more = false;
56.84 + }
56.85 + counter = 0;
56.86 + }
56.87 +
56.88 + /**
56.89 + * Returns the next binding in the list.
56.90 + * @exception NamingException any naming exception.
56.91 + */
56.92 +
56.93 + public javax.naming.Binding next() throws NamingException {
56.94 + if (more && counter >= _bindingList.value.length) {
56.95 + getMore();
56.96 + }
56.97 + if (more && counter < _bindingList.value.length) {
56.98 + org.omg.CosNaming.Binding bndg = _bindingList.value[counter];
56.99 + counter++;
56.100 + return mapBinding(bndg);
56.101 + } else {
56.102 + throw new NoSuchElementException();
56.103 }
56.104 }
56.105 - _ctx = ctx;
56.106 - _ctx.incEnumCount();
56.107 - this.isLookedUpCtx = isLookedUpCtx;
56.108 - _env = env;
56.109 - _bindingList = new BindingListHolder();
56.110 - BindingIteratorHolder _bindingIterH = new BindingIteratorHolder();
56.111
56.112 - // Perform listing and request that bindings be returned in _bindingIter
56.113 - // Upon return,_bindingList returns a zero length list
56.114 - _ctx._nc.list(0, _bindingList, _bindingIterH);
56.115
56.116 - _bindingIter = _bindingIterH.value;
56.117 -
56.118 - // Get first batch using _bindingIter
56.119 - if (_bindingIter != null) {
56.120 - more = _bindingIter.next_n(batchsize, _bindingList);
56.121 - } else {
56.122 - more = false;
56.123 - }
56.124 - counter = 0;
56.125 - }
56.126 -
56.127 - /**
56.128 - * Returns the next binding in the list.
56.129 - * @exception NamingException any naming exception.
56.130 - */
56.131 -
56.132 - public java.lang.Object next() throws NamingException {
56.133 - if (more && counter >= _bindingList.value.length) {
56.134 - getMore();
56.135 - }
56.136 - if (more && counter < _bindingList.value.length) {
56.137 - org.omg.CosNaming.Binding bndg = _bindingList.value[counter];
56.138 - counter++;
56.139 - return mapBinding(bndg);
56.140 - } else {
56.141 - throw new NoSuchElementException();
56.142 - }
56.143 - }
56.144 -
56.145 -
56.146 - /**
56.147 + /**
56.148 * Returns true or false depending on whether there are more bindings.
56.149 * @return boolean value
56.150 */
56.151
56.152 - public boolean hasMore() throws NamingException {
56.153 - // If there's more, check whether current bindingList has been exhausted,
56.154 - // and if so, try to get more.
56.155 - // If no more, just say so.
56.156 - return more ? (counter < _bindingList.value.length || getMore()) : false;
56.157 - }
56.158 + public boolean hasMore() throws NamingException {
56.159 + // If there's more, check whether current bindingList has been exhausted,
56.160 + // and if so, try to get more.
56.161 + // If no more, just say so.
56.162 + return more ? (counter < _bindingList.value.length || getMore()) : false;
56.163 + }
56.164
56.165 - /**
56.166 - * Returns true or false depending on whether there are more bindings.
56.167 - * Need to define this to satisfy the Enumeration api requirement.
56.168 - * @return boolean value
56.169 - */
56.170 + /**
56.171 + * Returns true or false depending on whether there are more bindings.
56.172 + * Need to define this to satisfy the Enumeration api requirement.
56.173 + * @return boolean value
56.174 + */
56.175
56.176 - public boolean hasMoreElements() {
56.177 - try {
56.178 - return hasMore();
56.179 - } catch (NamingException e) {
56.180 - return false;
56.181 - }
56.182 - }
56.183 + public boolean hasMoreElements() {
56.184 + try {
56.185 + return hasMore();
56.186 + } catch (NamingException e) {
56.187 + return false;
56.188 + }
56.189 + }
56.190
56.191 - /**
56.192 + /**
56.193 * Returns the next binding in the list.
56.194 * @exception NoSuchElementException Thrown when the end of the
56.195 * list is reached.
56.196 */
56.197
56.198 - public java.lang.Object nextElement() {
56.199 + public javax.naming.Binding nextElement() {
56.200 try {
56.201 return next();
56.202 } catch (NamingException ne) {
56.203 throw new NoSuchElementException();
56.204 }
56.205 - }
56.206 + }
56.207
56.208 public void close() throws NamingException {
56.209 more = false;
56.210 @@ -197,7 +196,7 @@
56.211 return more;
56.212 }
56.213
56.214 - /**
56.215 + /**
56.216 * Constructs a JNDI Binding object from the COS Naming binding
56.217 * object.
56.218 * @exception NameNotFound No objects under the name.
56.219 @@ -232,5 +231,5 @@
56.220 String fullName = CNNameParser.cosNameToInsString(comps);
56.221 jbndg.setNameInNamespace(fullName);
56.222 return jbndg;
56.223 - }
56.224 + }
56.225 }
57.1 --- a/src/share/classes/com/sun/jndi/cosnaming/CNCtx.java Thu Sep 01 13:54:38 2011 -0700
57.2 +++ b/src/share/classes/com/sun/jndi/cosnaming/CNCtx.java Mon Sep 05 23:58:19 2011 -0700
57.3 @@ -1,5 +1,5 @@
57.4 /*
57.5 - * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
57.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
57.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
57.8 *
57.9 * This code is free software; you can redistribute it and/or modify it
57.10 @@ -30,7 +30,6 @@
57.11 import javax.naming.spi.ResolveResult;
57.12
57.13 import java.util.Hashtable;
57.14 -import java.util.Vector;
57.15 import java.net.MalformedURLException;
57.16 import java.net.URL;
57.17 import java.io.InputStream;
57.18 @@ -63,7 +62,7 @@
57.19 public NamingContext _nc; // public for accessing underlying NamingContext
57.20 private NameComponent[] _name = null;
57.21
57.22 - Hashtable _env; // used by ExceptionMapper
57.23 + Hashtable<String, java.lang.Object> _env; // used by ExceptionMapper
57.24 static final CNNameParser parser = new CNNameParser();
57.25
57.26 private static final String FED_PROP = "com.sun.jndi.cosnaming.federation";
57.27 @@ -82,11 +81,12 @@
57.28 * @param env Environment properties for initializing name service.
57.29 * @exception NamingException Cannot initialize ORB or naming context.
57.30 */
57.31 - CNCtx(Hashtable env) throws NamingException {
57.32 + @SuppressWarnings("unchecked")
57.33 + CNCtx(Hashtable<?,?> env) throws NamingException {
57.34 if (env != null) {
57.35 - env = (Hashtable) env.clone();
57.36 + env = (Hashtable<?,?>)env.clone();
57.37 }
57.38 - _env = env;
57.39 + _env = (Hashtable<String, java.lang.Object>)env;
57.40 federation = "true".equals(env != null ? env.get(FED_PROP) : null);
57.41 initOrbAndRootContext(env);
57.42 }
57.43 @@ -97,13 +97,14 @@
57.44 /**
57.45 * This method is used by the iiop and iiopname URL Context factories.
57.46 */
57.47 - public static ResolveResult createUsingURL(String url, Hashtable env)
57.48 + @SuppressWarnings("unchecked")
57.49 + public static ResolveResult createUsingURL(String url, Hashtable<?,?> env)
57.50 throws NamingException {
57.51 CNCtx ctx = new CNCtx();
57.52 if (env != null) {
57.53 - env = (Hashtable) env.clone();
57.54 + env = (Hashtable<?,?>) env.clone();
57.55 }
57.56 - ctx._env = env;
57.57 + ctx._env = (Hashtable<String, java.lang.Object>)env;
57.58 String rest = ctx.initUsingUrl(
57.59 env != null ?
57.60 (org.omg.CORBA.ORB) env.get("java.naming.corba.orb")
57.61 @@ -128,8 +129,8 @@
57.62 * @param name The name of this context relative to the root
57.63 */
57.64
57.65 - CNCtx(ORB orb, OrbReuseTracker tracker, NamingContext nctx, Hashtable env,
57.66 - NameComponent[]name)
57.67 + CNCtx(ORB orb, OrbReuseTracker tracker, NamingContext nctx,
57.68 + Hashtable<String, java.lang.Object> env, NameComponent[]name)
57.69 throws NamingException {
57.70 if (orb == null || nctx == null)
57.71 throw new ConfigurationException(
57.72 @@ -207,7 +208,7 @@
57.73 * @exception NamingException When an error occurs while initializing the
57.74 * ORB or the naming context.
57.75 */
57.76 - private void initOrbAndRootContext(Hashtable env) throws NamingException {
57.77 + private void initOrbAndRootContext(Hashtable<?,?> env) throws NamingException {
57.78 org.omg.CORBA.ORB inOrb = null;
57.79 String ncIor = null;
57.80
57.81 @@ -240,7 +241,7 @@
57.82
57.83 // If name supplied in URL, resolve it to a NamingContext
57.84 if (insName.length() > 0) {
57.85 - _name = parser.nameToCosName(parser.parse(insName));
57.86 + _name = CNNameParser.nameToCosName(parser.parse(insName));
57.87 try {
57.88 org.omg.CORBA.Object obj = _nc.resolve(_name);
57.89 _nc = NamingContextHelper.narrow(obj);
57.90 @@ -271,7 +272,7 @@
57.91 }
57.92
57.93
57.94 - private String initUsingUrl(ORB orb, String url, Hashtable env)
57.95 + private String initUsingUrl(ORB orb, String url, Hashtable<?,?> env)
57.96 throws NamingException {
57.97 if (url.startsWith("iiop://") || url.startsWith("iiopname://")) {
57.98 return initUsingIiopUrl(orb, url, env);
57.99 @@ -283,17 +284,14 @@
57.100 /**
57.101 * Handles "iiop" and "iiopname" URLs (INS 98-10-11)
57.102 */
57.103 - private String initUsingIiopUrl(ORB defOrb, String url, Hashtable env)
57.104 + private String initUsingIiopUrl(ORB defOrb, String url, Hashtable<?,?> env)
57.105 throws NamingException {
57.106 try {
57.107 IiopUrl parsedUrl = new IiopUrl(url);
57.108
57.109 - Vector addrs = parsedUrl.getAddresses();
57.110 - IiopUrl.Address addr;
57.111 NamingException savedException = null;
57.112
57.113 - for (int i = 0; i < addrs.size(); i++) {
57.114 - addr = (IiopUrl.Address)addrs.elementAt(i);
57.115 + for (IiopUrl.Address addr : parsedUrl.getAddresses()) {
57.116
57.117 try {
57.118 if (defOrb != null) {
57.119 @@ -341,7 +339,7 @@
57.120 /**
57.121 * Initializes using "corbaname" URL (INS 99-12-03)
57.122 */
57.123 - private String initUsingCorbanameUrl(ORB orb, String url, Hashtable env)
57.124 + private String initUsingCorbanameUrl(ORB orb, String url, Hashtable<?,?> env)
57.125 throws NamingException {
57.126 try {
57.127 CorbanameUrl parsedUrl = new CorbanameUrl(url);
57.128 @@ -731,7 +729,7 @@
57.129 // as per JNDI spec
57.130
57.131 if (leafNotFound(e, path[path.length-1])) {
57.132 - ; // do nothing
57.133 + // do nothing
57.134 } else {
57.135 throw ExceptionMapper.mapException(e, this, path);
57.136 }
57.137 @@ -829,7 +827,7 @@
57.138 * with a non-null argument
57.139 * @return a list of name-class objects as a NameClassEnumeration.
57.140 */
57.141 - public NamingEnumeration list(String name) throws NamingException {
57.142 + public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
57.143 return list(new CompositeName(name));
57.144 }
57.145
57.146 @@ -840,9 +838,10 @@
57.147 * @exception NamingException All exceptions thrown by lookup
57.148 * @return a list of name-class objects as a NameClassEnumeration.
57.149 */
57.150 - public NamingEnumeration list(Name name)
57.151 + @SuppressWarnings("unchecked")
57.152 + public NamingEnumeration<NameClassPair> list(Name name)
57.153 throws NamingException {
57.154 - return listBindings(name);
57.155 + return (NamingEnumeration)listBindings(name);
57.156 }
57.157
57.158 /**
57.159 @@ -852,7 +851,7 @@
57.160 * @exception NamingException all exceptions returned by lookup
57.161 * @return a list of bindings as a BindingEnumeration.
57.162 */
57.163 - public NamingEnumeration listBindings(String name)
57.164 + public NamingEnumeration<javax.naming.Binding> listBindings(String name)
57.165 throws NamingException {
57.166 return listBindings(new CompositeName(name));
57.167 }
57.168 @@ -864,7 +863,7 @@
57.169 * @exception NamingException all exceptions returned by lookup.
57.170 * @return a list of bindings as a BindingEnumeration.
57.171 */
57.172 - public NamingEnumeration listBindings(Name name)
57.173 + public NamingEnumeration<javax.naming.Binding> listBindings(Name name)
57.174 throws NamingException {
57.175 if (_nc == null)
57.176 throw new ConfigurationException(
57.177 @@ -1064,11 +1063,12 @@
57.178 * Returns the current environment.
57.179 * @return Environment.
57.180 */
57.181 - public Hashtable getEnvironment() throws NamingException {
57.182 + @SuppressWarnings("unchecked")
57.183 + public Hashtable<String, java.lang.Object> getEnvironment() throws NamingException {
57.184 if (_env == null) {
57.185 - return new Hashtable(5, 0.75f);
57.186 + return new Hashtable<>(5, 0.75f);
57.187 } else {
57.188 - return (Hashtable)_env.clone();
57.189 + return (Hashtable<String, java.lang.Object>)_env.clone();
57.190 }
57.191 }
57.192
57.193 @@ -1090,25 +1090,27 @@
57.194 * @param propVal The ORB.
57.195 * @return the previous value of this property if any.
57.196 */
57.197 + @SuppressWarnings("unchecked")
57.198 public java.lang.Object addToEnvironment(String propName,
57.199 java.lang.Object propValue)
57.200 throws NamingException {
57.201 if (_env == null) {
57.202 - _env = new Hashtable(7, 0.75f);
57.203 + _env = new Hashtable<>(7, 0.75f);
57.204 } else {
57.205 // copy-on-write
57.206 - _env = (Hashtable)_env.clone();
57.207 + _env = (Hashtable<String, java.lang.Object>)_env.clone();
57.208 }
57.209
57.210 return _env.put(propName, propValue);
57.211 }
57.212
57.213 // Record change but do not reinitialize ORB
57.214 + @SuppressWarnings("unchecked")
57.215 public java.lang.Object removeFromEnvironment(String propName)
57.216 throws NamingException {
57.217 if (_env != null && _env.get(propName) != null) {
57.218 // copy-on-write
57.219 - _env = (Hashtable)_env.clone();
57.220 + _env = (Hashtable<String, java.lang.Object>)_env.clone();
57.221 return _env.remove(propName);
57.222 }
57.223 return null;
58.1 --- a/src/share/classes/com/sun/jndi/cosnaming/CNNameParser.java Thu Sep 01 13:54:38 2011 -0700
58.2 +++ b/src/share/classes/com/sun/jndi/cosnaming/CNNameParser.java Mon Sep 05 23:58:19 2011 -0700
58.3 @@ -1,5 +1,5 @@
58.4 /*
58.5 - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
58.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
58.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
58.8 *
58.9 * This code is free software; you can redistribute it and/or modify it
58.10 @@ -67,7 +67,7 @@
58.11 * @return a non-null CompoundName
58.12 */
58.13 public Name parse(String name) throws NamingException {
58.14 - Vector comps = insStringToStringifiedComps(name);
58.15 + Vector<String> comps = insStringToStringifiedComps(name);
58.16 return new CNCompoundName(comps.elements());
58.17 }
58.18
58.19 @@ -128,11 +128,11 @@
58.20 * each element of the vector contains a stringified form of
58.21 * a NameComponent.
58.22 */
58.23 - private static Vector insStringToStringifiedComps(String str)
58.24 + private static Vector<String> insStringToStringifiedComps(String str)
58.25 throws InvalidNameException {
58.26
58.27 int len = str.length();
58.28 - Vector components = new Vector(10);
58.29 + Vector<String> components = new Vector<>(10);
58.30 char[] id = new char[len];
58.31 char[] kind = new char[len];
58.32 int idCount, kindCount;
58.33 @@ -306,7 +306,7 @@
58.34 * and stringifying code of the default CompoundName.
58.35 */
58.36 static final class CNCompoundName extends CompoundName {
58.37 - CNCompoundName(Enumeration enum_) {
58.38 + CNCompoundName(Enumeration<String> enum_) {
58.39 super(enum_, CNNameParser.mySyntax);
58.40 }
58.41
58.42 @@ -315,12 +315,12 @@
58.43 }
58.44
58.45 public Name getPrefix(int posn) {
58.46 - Enumeration comps = super.getPrefix(posn).getAll();
58.47 + Enumeration<String> comps = super.getPrefix(posn).getAll();
58.48 return new CNCompoundName(comps);
58.49 }
58.50
58.51 public Name getSuffix(int posn) {
58.52 - Enumeration comps = super.getSuffix(posn).getAll();
58.53 + Enumeration<String> comps = super.getSuffix(posn).getAll();
58.54 return new CNCompoundName(comps);
58.55 }
58.56
59.1 --- a/src/share/classes/com/sun/jndi/cosnaming/ExceptionMapper.java Thu Sep 01 13:54:38 2011 -0700
59.2 +++ b/src/share/classes/com/sun/jndi/cosnaming/ExceptionMapper.java Mon Sep 05 23:58:19 2011 -0700
59.3 @@ -1,5 +1,5 @@
59.4 /*
59.5 - * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
59.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
59.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
59.8 *
59.9 * This code is free software; you can redistribute it and/or modify it
59.10 @@ -102,10 +102,10 @@
59.11
59.12 private static final NamingException tryFed(NotFound e, CNCtx ctx,
59.13 NameComponent[] inputName) throws NamingException {
59.14 - NameComponent[] rest = ((NotFound) e).rest_of_name;
59.15 + NameComponent[] rest = e.rest_of_name;
59.16
59.17 if (debug) {
59.18 - System.out.println(((NotFound)e).why.value());
59.19 + System.out.println(e.why.value());
59.20 System.out.println(rest.length);
59.21 }
59.22
60.1 --- a/src/share/classes/com/sun/jndi/cosnaming/IiopUrl.java Thu Sep 01 13:54:38 2011 -0700
60.2 +++ b/src/share/classes/com/sun/jndi/cosnaming/IiopUrl.java Mon Sep 05 23:58:19 2011 -0700
60.3 @@ -1,5 +1,5 @@
60.4 /*
60.5 - * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
60.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
60.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
60.8 *
60.9 * This code is free software; you can redistribute it and/or modify it
60.10 @@ -68,7 +68,7 @@
60.11 static final private int DEFAULT_IIOPNAME_PORT = 9999;
60.12 static final private int DEFAULT_IIOP_PORT = 900;
60.13 static final private String DEFAULT_HOST = "localhost";
60.14 - private Vector addresses;
60.15 + private Vector<Address> addresses;
60.16 private String stringName;
60.17
60.18 public static class Address {
60.19 @@ -149,7 +149,7 @@
60.20 }
60.21 }
60.22
60.23 - public Vector getAddresses() {
60.24 + public Vector<Address> getAddresses() {
60.25 return addresses;
60.26 }
60.27
60.28 @@ -185,7 +185,7 @@
60.29 } else {
60.30 stringName = UrlUtil.decode(url.substring(addrEnd+1));
60.31 }
60.32 - addresses = new Vector(3);
60.33 + addresses = new Vector<>(3);
60.34 if (oldFormat) {
60.35 // Only one host:port part, not multiple
60.36 addresses.addElement(
61.1 --- a/src/share/classes/com/sun/jndi/dns/DnsClient.java Thu Sep 01 13:54:38 2011 -0700
61.2 +++ b/src/share/classes/com/sun/jndi/dns/DnsClient.java Mon Sep 05 23:58:19 2011 -0700
61.3 @@ -1,5 +1,5 @@
61.4 /*
61.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
61.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
61.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
61.8 *
61.9 * This code is free software; you can redistribute it and/or modify it
61.10 @@ -524,7 +524,7 @@
61.11 "\tResponse Q:" + resps);
61.12 }
61.13 byte[] pkt;
61.14 - if ((pkt = (byte[]) resps.get(xid)) != null) {
61.15 + if ((pkt = resps.get(xid)) != null) {
61.16 checkResponseCode(new Header(pkt, pkt.length));
61.17 synchronized (queuesLock) {
61.18 resps.remove(xid);
62.1 --- a/src/share/classes/com/sun/jndi/dns/DnsContext.java Thu Sep 01 13:54:38 2011 -0700
62.2 +++ b/src/share/classes/com/sun/jndi/dns/DnsContext.java Mon Sep 05 23:58:19 2011 -0700
62.3 @@ -1,5 +1,5 @@
62.4 /*
62.5 - * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
62.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
62.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
62.8 *
62.9 * This code is free software; you can redistribute it and/or modify it
62.10 @@ -47,7 +47,7 @@
62.11
62.12 DnsName domain; // fully-qualified domain name of this context,
62.13 // with a root (empty) label at position 0
62.14 - Hashtable environment;
62.15 + Hashtable<Object,Object> environment;
62.16 private boolean envShared; // true if environment is possibly shared
62.17 // and so must be copied on write
62.18 private boolean parentIsDns; // was this DnsContext created by
62.19 @@ -95,14 +95,15 @@
62.20 * There must be at least one server.
62.21 * The environment must not be null; it is cloned before being stored.
62.22 */
62.23 - public DnsContext(String domain, String[] servers, Hashtable environment)
62.24 + @SuppressWarnings("unchecked")
62.25 + public DnsContext(String domain, String[] servers, Hashtable<?,?> environment)
62.26 throws NamingException {
62.27
62.28 this.domain = new DnsName(domain.endsWith(".")
62.29 ? domain
62.30 : domain + ".");
62.31 this.servers = servers;
62.32 - this.environment = (Hashtable) environment.clone();
62.33 + this.environment = (Hashtable<Object,Object>) environment.clone();
62.34 envShared = false;
62.35 parentIsDns = false;
62.36 resolver = null;
62.37 @@ -154,14 +155,15 @@
62.38 /*
62.39 * Override default with a noncloning version.
62.40 */
62.41 - protected Hashtable p_getEnvironment() {
62.42 + protected Hashtable<?,?> p_getEnvironment() {
62.43 return environment;
62.44 }
62.45
62.46 - public Hashtable getEnvironment() throws NamingException {
62.47 - return (Hashtable) environment.clone();
62.48 + public Hashtable<?,?> getEnvironment() throws NamingException {
62.49 + return (Hashtable<?,?>) environment.clone();
62.50 }
62.51
62.52 + @SuppressWarnings("unchecked")
62.53 public Object addToEnvironment(String propName, Object propVal)
62.54 throws NamingException {
62.55
62.56 @@ -189,7 +191,7 @@
62.57 return environment.put(propName, propVal);
62.58 } else if (environment.get(propName) != propVal) {
62.59 // copy on write
62.60 - environment = (Hashtable) environment.clone();
62.61 + environment = (Hashtable<Object,Object>) environment.clone();
62.62 envShared = false;
62.63 return environment.put(propName, propVal);
62.64 } else {
62.65 @@ -197,6 +199,7 @@
62.66 }
62.67 }
62.68
62.69 + @SuppressWarnings("unchecked")
62.70 public Object removeFromEnvironment(String propName)
62.71 throws NamingException {
62.72
62.73 @@ -222,7 +225,7 @@
62.74 return environment.remove(propName);
62.75 } else if (environment.get(propName) != null) {
62.76 // copy-on-write
62.77 - environment = (Hashtable) environment.clone();
62.78 + environment = (Hashtable<Object,Object>) environment.clone();
62.79 envShared = false;
62.80 return environment.remove(propName);
62.81 } else {
62.82 @@ -307,7 +310,7 @@
62.83 return c_lookup(name, cont);
62.84 }
62.85
62.86 - public NamingEnumeration c_list(Name name, Continuation cont)
62.87 + public NamingEnumeration<NameClassPair> c_list(Name name, Continuation cont)
62.88 throws NamingException {
62.89 cont.setSuccess();
62.90 try {
62.91 @@ -322,7 +325,7 @@
62.92 }
62.93 }
62.94
62.95 - public NamingEnumeration c_listBindings(Name name, Continuation cont)
62.96 + public NamingEnumeration<Binding> c_listBindings(Name name, Continuation cont)
62.97 throws NamingException {
62.98 cont.setSuccess();
62.99 try {
62.100 @@ -457,7 +460,7 @@
62.101 new OperationNotSupportedException());
62.102 }
62.103
62.104 - public NamingEnumeration c_search(Name name,
62.105 + public NamingEnumeration<SearchResult> c_search(Name name,
62.106 Attributes matchingAttributes,
62.107 String[] attributesToReturn,
62.108 Continuation cont)
62.109 @@ -465,7 +468,7 @@
62.110 throw new OperationNotSupportedException();
62.111 }
62.112
62.113 - public NamingEnumeration c_search(Name name,
62.114 + public NamingEnumeration<SearchResult> c_search(Name name,
62.115 String filter,
62.116 SearchControls cons,
62.117 Continuation cont)
62.118 @@ -473,7 +476,7 @@
62.119 throw new OperationNotSupportedException();
62.120 }
62.121
62.122 - public NamingEnumeration c_search(Name name,
62.123 + public NamingEnumeration<SearchResult> c_search(Name name,
62.124 String filterExpr,
62.125 Object[] filterArgs,
62.126 SearchControls cons,
62.127 @@ -608,7 +611,7 @@
62.128 BasicAttributes attrs = new BasicAttributes(true);
62.129
62.130 for (int i = 0; i < rrs.answer.size(); i++) {
62.131 - ResourceRecord rr = (ResourceRecord) rrs.answer.elementAt(i);
62.132 + ResourceRecord rr = rrs.answer.elementAt(i);
62.133 int rrtype = rr.getType();
62.134 int rrclass = rr.getRrclass();
62.135
62.136 @@ -952,19 +955,14 @@
62.137 //----------
62.138
62.139 /*
62.140 - * An enumeration of name/classname pairs.
62.141 - *
62.142 - * Nodes that have children or that are zone cuts are returned with
62.143 - * classname DirContext. Other nodes are returned with classname
62.144 - * Object even though they are DirContexts as well, since this might
62.145 - * make the namespace easier to browse.
62.146 + * Common base class for NameClassPairEnumeration and BindingEnumeration.
62.147 */
62.148 -class NameClassPairEnumeration implements NamingEnumeration {
62.149 +abstract class BaseNameClassPairEnumeration<T> implements NamingEnumeration<T> {
62.150
62.151 - protected Enumeration nodes; // nodes to be enumerated, or null if none
62.152 + protected Enumeration<NameNode> nodes; // nodes to be enumerated, or null if none
62.153 protected DnsContext ctx; // context being enumerated
62.154
62.155 - NameClassPairEnumeration(DnsContext ctx, Hashtable nodes) {
62.156 + BaseNameClassPairEnumeration(DnsContext ctx, Hashtable<String,NameNode> nodes) {
62.157 this.ctx = ctx;
62.158 this.nodes = (nodes != null)
62.159 ? nodes.elements()
62.160 @@ -974,12 +972,12 @@
62.161 /*
62.162 * ctx will be set to null when no longer needed by the enumeration.
62.163 */
62.164 - public void close() {
62.165 + public final void close() {
62.166 nodes = null;
62.167 ctx = null;
62.168 }
62.169
62.170 - public boolean hasMore() {
62.171 + public final boolean hasMore() {
62.172 boolean more = ((nodes != null) && nodes.hasMoreElements());
62.173 if (!more) {
62.174 close();
62.175 @@ -987,11 +985,46 @@
62.176 return more;
62.177 }
62.178
62.179 - public Object next() throws NamingException {
62.180 + public final boolean hasMoreElements() {
62.181 + return hasMore();
62.182 + }
62.183 +
62.184 + abstract public T next() throws NamingException;
62.185 +
62.186 + public final T nextElement() {
62.187 + try {
62.188 + return next();
62.189 + } catch (NamingException e) {
62.190 + java.util.NoSuchElementException nsee =
62.191 + new java.util.NoSuchElementException();
62.192 + nsee.initCause(e);
62.193 + throw nsee;
62.194 + }
62.195 + }
62.196 +}
62.197 +
62.198 +/*
62.199 + * An enumeration of name/classname pairs.
62.200 + *
62.201 + * Nodes that have children or that are zone cuts are returned with
62.202 + * classname DirContext. Other nodes are returned with classname
62.203 + * Object even though they are DirContexts as well, since this might
62.204 + * make the namespace easier to browse.
62.205 + */
62.206 +final class NameClassPairEnumeration
62.207 + extends BaseNameClassPairEnumeration<NameClassPair>
62.208 + implements NamingEnumeration<NameClassPair> {
62.209 +
62.210 + NameClassPairEnumeration(DnsContext ctx, Hashtable<String,NameNode> nodes) {
62.211 + super(ctx, nodes);
62.212 + }
62.213 +
62.214 + @Override
62.215 + public NameClassPair next() throws NamingException {
62.216 if (!hasMore()) {
62.217 throw new java.util.NoSuchElementException();
62.218 }
62.219 - NameNode nnode = (NameNode) nodes.nextElement();
62.220 + NameNode nnode = nodes.nextElement();
62.221 String className = (nnode.isZoneCut() ||
62.222 (nnode.getChildren() != null))
62.223 ? "javax.naming.directory.DirContext"
62.224 @@ -1005,28 +1038,15 @@
62.225 ncp.setNameInNamespace(ctx.fullyQualify(cname).toString());
62.226 return ncp;
62.227 }
62.228 -
62.229 - public boolean hasMoreElements() {
62.230 - return hasMore();
62.231 - }
62.232 -
62.233 - public Object nextElement() {
62.234 - try {
62.235 - return next();
62.236 - } catch (NamingException e) {
62.237 - throw (new java.util.NoSuchElementException(
62.238 - "javax.naming.NamingException was thrown: " +
62.239 - e.getMessage()));
62.240 - }
62.241 - }
62.242 }
62.243
62.244 /*
62.245 * An enumeration of Bindings.
62.246 */
62.247 -class BindingEnumeration extends NameClassPairEnumeration {
62.248 +final class BindingEnumeration extends BaseNameClassPairEnumeration<Binding>
62.249 + implements NamingEnumeration<Binding> {
62.250
62.251 - BindingEnumeration(DnsContext ctx, Hashtable nodes) {
62.252 + BindingEnumeration(DnsContext ctx, Hashtable<String,NameNode> nodes) {
62.253 super(ctx, nodes);
62.254 }
62.255
62.256 @@ -1035,11 +1055,12 @@
62.257 // close();
62.258 // }
62.259
62.260 - public Object next() throws NamingException {
62.261 + @Override
62.262 + public Binding next() throws NamingException {
62.263 if (!hasMore()) {
62.264 throw (new java.util.NoSuchElementException());
62.265 }
62.266 - NameNode nnode = (NameNode) nodes.nextElement();
62.267 + NameNode nnode = nodes.nextElement();
62.268
62.269 String label = nnode.getLabel();
62.270 Name compName = (new DnsName()).add(label);
63.1 --- a/src/share/classes/com/sun/jndi/dns/DnsContextFactory.java Thu Sep 01 13:54:38 2011 -0700
63.2 +++ b/src/share/classes/com/sun/jndi/dns/DnsContextFactory.java Mon Sep 05 23:58:19 2011 -0700
63.3 @@ -1,5 +1,5 @@
63.4 /*
63.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
63.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
63.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
63.8 *
63.9 * This code is free software; you can redistribute it and/or modify it
63.10 @@ -59,7 +59,7 @@
63.11
63.12 public Context getInitialContext(Hashtable<?,?> env) throws NamingException {
63.13 if (env == null) {
63.14 - env = new Hashtable(5);
63.15 + env = new Hashtable<>(5);
63.16 }
63.17 return urlToContext(getInitCtxUrl(env), env);
63.18 }
63.19 @@ -75,7 +75,7 @@
63.20 * components are overridden by "domain".
63.21 */
63.22 public static DnsContext getContext(String domain,
63.23 - DnsUrl[] urls, Hashtable env)
63.24 + DnsUrl[] urls, Hashtable<?,?> env)
63.25 throws NamingException {
63.26
63.27 String[] servers = serversForUrls(urls);
63.28 @@ -95,7 +95,7 @@
63.29 ).isEmpty();
63.30 }
63.31
63.32 - private static Context urlToContext(String url, Hashtable env)
63.33 + private static Context urlToContext(String url, Hashtable<?,?> env)
63.34 throws NamingException {
63.35
63.36 DnsUrl[] urls;
63.37 @@ -212,7 +212,7 @@
63.38 * Reads environment to find URL(s) of initial context.
63.39 * Default URL is "dns:".
63.40 */
63.41 - private static String getInitCtxUrl(Hashtable env) {
63.42 + private static String getInitCtxUrl(Hashtable<?,?> env) {
63.43 String url = (String) env.get(Context.PROVIDER_URL);
63.44 return ((url != null) ? url : DEFAULT_URL);
63.45 }
63.46 @@ -223,34 +223,31 @@
63.47 * @param oneIsEnough return output once there exists one ok
63.48 * @return the filtered list, all non-permitted input removed
63.49 */
63.50 - private static List filterNameServers(List input, boolean oneIsEnough) {
63.51 + private static List<String> filterNameServers(List<String> input, boolean oneIsEnough) {
63.52 SecurityManager security = System.getSecurityManager();
63.53 if (security == null || input == null || input.isEmpty()) {
63.54 return input;
63.55 } else {
63.56 - List output = new ArrayList();
63.57 - for (Object o: input) {
63.58 - if (o instanceof String) {
63.59 - String platformServer = (String)o;
63.60 - int colon = platformServer.indexOf(':',
63.61 - platformServer.indexOf(']') + 1);
63.62 + List<String> output = new ArrayList<>();
63.63 + for (String platformServer: input) {
63.64 + int colon = platformServer.indexOf(':',
63.65 + platformServer.indexOf(']') + 1);
63.66
63.67 - int p = (colon < 0)
63.68 - ? DEFAULT_PORT
63.69 - : Integer.parseInt(
63.70 - platformServer.substring(colon + 1));
63.71 - String s = (colon < 0)
63.72 - ? platformServer
63.73 - : platformServer.substring(0, colon);
63.74 - try {
63.75 - security.checkConnect(s, p);
63.76 - output.add(platformServer);
63.77 - if (oneIsEnough) {
63.78 - return output;
63.79 - }
63.80 - } catch (SecurityException se) {
63.81 - continue;
63.82 + int p = (colon < 0)
63.83 + ? DEFAULT_PORT
63.84 + : Integer.parseInt(
63.85 + platformServer.substring(colon + 1));
63.86 + String s = (colon < 0)
63.87 + ? platformServer
63.88 + : platformServer.substring(0, colon);
63.89 + try {
63.90 + security.checkConnect(s, p);
63.91 + output.add(platformServer);
63.92 + if (oneIsEnough) {
63.93 + return output;
63.94 }
63.95 + } catch (SecurityException se) {
63.96 + continue;
63.97 }
63.98 }
63.99 return output;
64.1 --- a/src/share/classes/com/sun/jndi/dns/DnsName.java Thu Sep 01 13:54:38 2011 -0700
64.2 +++ b/src/share/classes/com/sun/jndi/dns/DnsName.java Mon Sep 05 23:58:19 2011 -0700
64.3 @@ -1,5 +1,5 @@
64.4 /*
64.5 - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
64.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
64.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
64.8 *
64.9 * This code is free software; you can redistribute it and/or modify it
64.10 @@ -29,7 +29,6 @@
64.11 import java.util.ArrayList;
64.12 import java.util.Comparator;
64.13 import java.util.Enumeration;
64.14 -import java.util.Iterator;
64.15
64.16 import javax.naming.*;
64.17
64.18 @@ -111,7 +110,7 @@
64.19 // The labels of this domain name, as a list of strings. Index 0
64.20 // corresponds to the leftmost (least significant) label: note that
64.21 // this is the reverse of the ordering used by the Name interface.
64.22 - private ArrayList labels = new ArrayList();
64.23 + private ArrayList<String> labels = new ArrayList<>();
64.24
64.25 // The number of octets needed to carry this domain name in a DNS
64.26 // packet. Equal to the sum of the lengths of each label, plus the
64.27 @@ -152,9 +151,7 @@
64.28 domain = n.domain;
64.29 octets = n.octets;
64.30 } else {
64.31 - Iterator iter = labels.iterator();
64.32 - while (iter.hasNext()) {
64.33 - String label = (String) iter.next();
64.34 + for (String label: labels) {
64.35 if (label.length() > 0) {
64.36 octets += (short) (label.length() + 1);
64.37 }
64.38 @@ -165,10 +162,8 @@
64.39
64.40 public String toString() {
64.41 if (domain == null) {
64.42 - StringBuffer buf = new StringBuffer();
64.43 - Iterator iter = labels.iterator();
64.44 - while (iter.hasNext()) {
64.45 - String label = (String) iter.next();
64.46 + StringBuilder buf = new StringBuilder();
64.47 + for (String label: labels) {
64.48 if (buf.length() > 0 || label.length() == 0) {
64.49 buf.append('.');
64.50 }
64.51 @@ -183,9 +178,8 @@
64.52 * Does this domain name follow <em>host name</em> syntax?
64.53 */
64.54 public boolean isHostName() {
64.55 - Iterator iter = labels.iterator();
64.56 - while (iter.hasNext()) {
64.57 - if (!isHostNameLabel((String) iter.next())) {
64.58 + for (String label: labels) {
64.59 + if (!isHostNameLabel(label)) {
64.60 return false;
64.61 }
64.62 }
64.63 @@ -241,16 +235,16 @@
64.64 throw new ArrayIndexOutOfBoundsException();
64.65 }
64.66 int i = size() - pos - 1; // index of "pos" component in "labels"
64.67 - return (String) labels.get(i);
64.68 + return labels.get(i);
64.69 }
64.70
64.71 - public Enumeration getAll() {
64.72 - return new Enumeration() {
64.73 + public Enumeration<String> getAll() {
64.74 + return new Enumeration<String>() {
64.75 int pos = 0;
64.76 public boolean hasMoreElements() {
64.77 return (pos < size());
64.78 }
64.79 - public Object nextElement() {
64.80 + public String nextElement() {
64.81 if (pos < size()) {
64.82 return get(pos++);
64.83 }
64.84 @@ -276,7 +270,7 @@
64.85 throw new ArrayIndexOutOfBoundsException();
64.86 }
64.87 int i = size() - pos - 1; // index of element to remove in "labels"
64.88 - String label = (String) labels.remove(i);
64.89 + String label = labels.remove(i);
64.90 int len = label.length();
64.91 if (len > 0) {
64.92 octets -= (short) (len + 1);
64.93 @@ -530,7 +524,7 @@
64.94 /*
64.95 * Append a label to buf, escaping as needed.
64.96 */
64.97 - private static void escape(StringBuffer buf, String label) {
64.98 + private static void escape(StringBuilder buf, String label) {
64.99 for (int i = 0; i < label.length(); i++) {
64.100 char c = label.charAt(i);
64.101 if (c == '.' || c == '\\') {
65.1 --- a/src/share/classes/com/sun/jndi/dns/NameNode.java Thu Sep 01 13:54:38 2011 -0700
65.2 +++ b/src/share/classes/com/sun/jndi/dns/NameNode.java Mon Sep 05 23:58:19 2011 -0700
65.3 @@ -1,5 +1,5 @@
65.4 /*
65.5 - * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
65.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
65.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
65.8 *
65.9 * This code is free software; you can redistribute it and/or modify it
65.10 @@ -52,7 +52,7 @@
65.11
65.12 private String label; // name of this node relative to its
65.13 // parent, or null for root of a tree
65.14 - private Hashtable children = null; // child nodes
65.15 + private Hashtable<String,NameNode> children = null; // child nodes
65.16 private boolean isZoneCut = false; // true if this node is a zone cut
65.17 private int depth = 0; // depth in tree (0 for root)
65.18
65.19 @@ -97,7 +97,7 @@
65.20 * Returns the children of this node, or null if there are none.
65.21 * The caller must not modify the Hashtable returned.
65.22 */
65.23 - Hashtable getChildren() {
65.24 + Hashtable<String,NameNode> getChildren() {
65.25 return children;
65.26 }
65.27
65.28 @@ -108,7 +108,7 @@
65.29 */
65.30 NameNode get(String key) {
65.31 return (children != null)
65.32 - ? (NameNode) children.get(key)
65.33 + ? children.get(key)
65.34 : null;
65.35 }
65.36
65.37 @@ -140,9 +140,9 @@
65.38
65.39 NameNode child = null;
65.40 if (node.children == null) {
65.41 - node.children = new Hashtable();
65.42 + node.children = new Hashtable<>();
65.43 } else {
65.44 - child = (NameNode) node.children.get(key);
65.45 + child = node.children.get(key);
65.46 }
65.47 if (child == null) {
65.48 child = newNameNode(label);
66.1 --- a/src/share/classes/com/sun/jndi/dns/Resolver.java Thu Sep 01 13:54:38 2011 -0700
66.2 +++ b/src/share/classes/com/sun/jndi/dns/Resolver.java Mon Sep 05 23:58:19 2011 -0700
66.3 @@ -1,5 +1,5 @@
66.4 /*
66.5 - * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
66.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
66.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
66.8 *
66.9 * This code is free software; you can redistribute it and/or modify it
66.10 @@ -125,8 +125,7 @@
66.11 }
66.12 // Look for an SOA record giving the zone's top node.
66.13 for (int i = 0; i < rrs.authority.size(); i++) {
66.14 - ResourceRecord rr = (ResourceRecord)
66.15 - rrs.authority.elementAt(i);
66.16 + ResourceRecord rr = rrs.authority.elementAt(i);
66.17 if (rr.getType() == ResourceRecord.TYPE_SOA) {
66.18 DnsName zone = rr.getName();
66.19 if (fqdn.endsWith(zone)) {
66.20 @@ -152,7 +151,7 @@
66.21 ResourceRecords rrs = query(zone, rrclass, ResourceRecord.TYPE_SOA,
66.22 recursion, false);
66.23 for (int i = 0; i < rrs.answer.size(); i++) {
66.24 - ResourceRecord rr = (ResourceRecord) rrs.answer.elementAt(i);
66.25 + ResourceRecord rr = rrs.answer.elementAt(i);
66.26 if (rr.getType() == ResourceRecord.TYPE_SOA) {
66.27 return rr;
66.28 }
66.29 @@ -175,8 +174,7 @@
66.30 recursion, false);
66.31 String[] ns = new String[rrs.answer.size()];
66.32 for (int i = 0; i < ns.length; i++) {
66.33 - ResourceRecord rr = (ResourceRecord)
66.34 - rrs.answer.elementAt(i);
66.35 + ResourceRecord rr = rrs.answer.elementAt(i);
66.36 if (rr.getType() != ResourceRecord.TYPE_NS) {
66.37 throw new CommunicationException("Corrupted DNS message");
66.38 }
67.1 --- a/src/share/classes/com/sun/jndi/dns/ResourceRecords.java Thu Sep 01 13:54:38 2011 -0700
67.2 +++ b/src/share/classes/com/sun/jndi/dns/ResourceRecords.java Mon Sep 05 23:58:19 2011 -0700
67.3 @@ -1,5 +1,5 @@
67.4 /*
67.5 - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
67.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
67.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
67.8 *
67.9 * This code is free software; you can redistribute it and/or modify it
67.10 @@ -45,10 +45,10 @@
67.11 // Four sections: question, answer, authority, additional.
67.12 // The question section is treated as being made up of (shortened)
67.13 // resource records, although this isn't technically how it's defined.
67.14 - Vector question = new Vector();
67.15 - Vector answer = new Vector();
67.16 - Vector authority = new Vector();
67.17 - Vector additional = new Vector();
67.18 + Vector<ResourceRecord> question = new Vector<>();
67.19 + Vector<ResourceRecord> answer = new Vector<>();
67.20 + Vector<ResourceRecord> authority = new Vector<>();
67.21 + Vector<ResourceRecord> additional = new Vector<>();
67.22
67.23 /*
67.24 * True if these resource records are from a zone transfer. In
67.25 @@ -80,7 +80,7 @@
67.26 if (answer.size() == 0) {
67.27 return -1;
67.28 }
67.29 - return ((ResourceRecord) answer.firstElement()).getType();
67.30 + return answer.firstElement().getType();
67.31 }
67.32
67.33 /*
67.34 @@ -91,7 +91,7 @@
67.35 if (answer.size() == 0) {
67.36 return -1;
67.37 }
67.38 - return ((ResourceRecord) answer.lastElement()).getType();
67.39 + return answer.lastElement().getType();
67.40 }
67.41
67.42 /*
68.1 --- a/src/share/classes/com/sun/jndi/dns/ZoneNode.java Thu Sep 01 13:54:38 2011 -0700
68.2 +++ b/src/share/classes/com/sun/jndi/dns/ZoneNode.java Mon Sep 05 23:58:19 2011 -0700
68.3 @@ -1,5 +1,5 @@
68.4 /*
68.5 - * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
68.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
68.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
68.8 *
68.9 * This code is free software; you can redistribute it and/or modify it
68.10 @@ -55,7 +55,7 @@
68.11
68.12 class ZoneNode extends NameNode {
68.13
68.14 - private SoftReference contentsRef = null; // the zone's namespace
68.15 + private SoftReference<NameNode> contentsRef = null; // the zone's namespace
68.16 private long serialNumber = -1; // the zone data's serial number
68.17 private Date expiration = null; // time when the zone's data expires
68.18
68.19 @@ -88,7 +88,7 @@
68.20 */
68.21 synchronized NameNode getContents() {
68.22 return (contentsRef != null)
68.23 - ? (NameNode) contentsRef.get()
68.24 + ? contentsRef.get()
68.25 : null;
68.26 }
68.27
68.28 @@ -130,7 +130,7 @@
68.29 NameNode newContents = new NameNode(null);
68.30
68.31 for (int i = 0; i < rrs.answer.size(); i++) {
68.32 - ResourceRecord rr = (ResourceRecord) rrs.answer.elementAt(i);
68.33 + ResourceRecord rr = rrs.answer.elementAt(i);
68.34 DnsName n = rr.getName();
68.35
68.36 // Ignore resource records whose names aren't within the zone's
68.37 @@ -144,9 +144,9 @@
68.38 }
68.39 }
68.40 // The zone's SOA record is the first record in the answer section.
68.41 - ResourceRecord soa = (ResourceRecord) rrs.answer.firstElement();
68.42 + ResourceRecord soa = rrs.answer.firstElement();
68.43 synchronized (this) {
68.44 - contentsRef = new SoftReference(newContents);
68.45 + contentsRef = new SoftReference<NameNode>(newContents);
68.46 serialNumber = getSerialNumber(soa);
68.47 setExpiration(getMinimumTtl(soa));
68.48 return newContents;
69.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
69.2 +++ b/src/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java Mon Sep 05 23:58:19 2011 -0700
69.3 @@ -0,0 +1,408 @@
69.4 +/*
69.5 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
69.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
69.7 + *
69.8 + * This code is free software; you can redistribute it and/or modify it
69.9 + * under the terms of the GNU General Public License version 2 only, as
69.10 + * published by the Free Software Foundation. Oracle designates this
69.11 + * particular file as subject to the "Classpath" exception as provided
69.12 + * by Oracle in the LICENSE file that accompanied this code.
69.13 + *
69.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
69.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
69.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
69.17 + * version 2 for more details (a copy is included in the LICENSE file that
69.18 + * accompanied this code).
69.19 + *
69.20 + * You should have received a copy of the GNU General Public License version
69.21 + * 2 along with this work; if not, write to the Free Software Foundation,
69.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
69.23 + *
69.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
69.25 + * or visit www.oracle.com if you need additional information or have any
69.26 + * questions.
69.27 + */
69.28 +
69.29 +package com.sun.jndi.ldap;
69.30 +
69.31 +import com.sun.jndi.toolkit.ctx.Continuation;
69.32 +import java.util.NoSuchElementException;
69.33 +import java.util.Vector;
69.34 +
69.35 +import javax.naming.*;
69.36 +import javax.naming.directory.Attributes;
69.37 +import javax.naming.ldap.Control;
69.38 +
69.39 +/**
69.40 + * Basic enumeration for NameClassPair, Binding, and SearchResults.
69.41 + */
69.42 +
69.43 +abstract class AbstractLdapNamingEnumeration<T extends NameClassPair>
69.44 + implements NamingEnumeration<T>, ReferralEnumeration<T> {
69.45 +
69.46 + protected Name listArg;
69.47 +
69.48 + private boolean cleaned = false;
69.49 + private LdapResult res;
69.50 + private LdapClient enumClnt;
69.51 + private Continuation cont; // used to fill in exceptions
69.52 + private Vector<LdapEntry> entries = null;
69.53 + private int limit = 0;
69.54 + private int posn = 0;
69.55 + protected LdapCtx homeCtx;
69.56 + private LdapReferralException refEx = null;
69.57 + private NamingException errEx = null;
69.58 +
69.59 + /*
69.60 + * Record the next set of entries and/or referrals.
69.61 + */
69.62 + AbstractLdapNamingEnumeration(LdapCtx homeCtx, LdapResult answer, Name listArg,
69.63 + Continuation cont) throws NamingException {
69.64 +
69.65 + // These checks are to accommodate referrals and limit exceptions
69.66 + // which will generate an enumeration and defer the exception
69.67 + // to be thrown at the end of the enumeration.
69.68 + // All other exceptions are thrown immediately.
69.69 + // Exceptions shouldn't be thrown here anyhow because
69.70 + // process_return_code() is called before the constructor
69.71 + // is called, so these are just safety checks.
69.72 +
69.73 + if ((answer.status != LdapClient.LDAP_SUCCESS) &&
69.74 + (answer.status != LdapClient.LDAP_SIZE_LIMIT_EXCEEDED) &&
69.75 + (answer.status != LdapClient.LDAP_TIME_LIMIT_EXCEEDED) &&
69.76 + (answer.status != LdapClient.LDAP_ADMIN_LIMIT_EXCEEDED) &&
69.77 + (answer.status != LdapClient.LDAP_REFERRAL) &&
69.78 + (answer.status != LdapClient.LDAP_PARTIAL_RESULTS)) {
69.79 +
69.80 + // %%% need to deal with referral
69.81 + NamingException e = new NamingException(
69.82 + LdapClient.getErrorMessage(
69.83 + answer.status, answer.errorMessage));
69.84 +
69.85 + throw cont.fillInException(e);
69.86 + }
69.87 +
69.88 + // otherwise continue
69.89 +
69.90 + res = answer;
69.91 + entries = answer.entries;
69.92 + limit = (entries == null) ? 0 : entries.size(); // handle empty set
69.93 + this.listArg = listArg;
69.94 + this.cont = cont;
69.95 +
69.96 + if (answer.refEx != null) {
69.97 + refEx = answer.refEx;
69.98 + }
69.99 +
69.100 + // Ensures that context won't get closed from underneath us
69.101 + this.homeCtx = homeCtx;
69.102 + homeCtx.incEnumCount();
69.103 + enumClnt = homeCtx.clnt; // remember
69.104 + }
69.105 +
69.106 + @Override
69.107 + public final T nextElement() {
69.108 + try {
69.109 + return next();
69.110 + } catch (NamingException e) {
69.111 + // can't throw exception
69.112 + cleanup();
69.113 + return null;
69.114 + }
69.115 + }
69.116 +
69.117 + @Override
69.118 + public final boolean hasMoreElements() {
69.119 + try {
69.120 + return hasMore();
69.121 + } catch (NamingException e) {
69.122 + // can't throw exception
69.123 + cleanup();
69.124 + return false;
69.125 + }
69.126 + }
69.127 +
69.128 + /*
69.129 + * Retrieve the next set of entries and/or referrals.
69.130 + */
69.131 + private void getNextBatch() throws NamingException {
69.132 +
69.133 + res = homeCtx.getSearchReply(enumClnt, res);
69.134 + if (res == null) {
69.135 + limit = posn = 0;
69.136 + return;
69.137 + }
69.138 +
69.139 + entries = res.entries;
69.140 + limit = (entries == null) ? 0 : entries.size(); // handle empty set
69.141 + posn = 0; // reset
69.142 +
69.143 + // mimimize the number of calls to processReturnCode()
69.144 + // (expensive when batchSize is small and there are many results)
69.145 + if ((res.status != LdapClient.LDAP_SUCCESS) ||
69.146 + ((res.status == LdapClient.LDAP_SUCCESS) &&
69.147 + (res.referrals != null))) {
69.148 +
69.149 + try {
69.150 + // convert referrals into a chain of LdapReferralException
69.151 + homeCtx.processReturnCode(res, listArg);
69.152 +
69.153 + } catch (LimitExceededException | PartialResultException e) {
69.154 + setNamingException(e);
69.155 +
69.156 + }
69.157 + }
69.158 +
69.159 + // merge any newly received referrals with any current referrals
69.160 + if (res.refEx != null) {
69.161 + if (refEx == null) {
69.162 + refEx = res.refEx;
69.163 + } else {
69.164 + refEx = refEx.appendUnprocessedReferrals(res.refEx);
69.165 + }
69.166 + res.refEx = null; // reset
69.167 + }
69.168 +
69.169 + if (res.resControls != null) {
69.170 + homeCtx.respCtls = res.resControls;
69.171 + }
69.172 + }
69.173 +
69.174 + private boolean more = true; // assume we have something to start with
69.175 + private boolean hasMoreCalled = false;
69.176 +
69.177 + /*
69.178 + * Test if unprocessed entries or referrals exist.
69.179 + */
69.180 + @Override
69.181 + public final boolean hasMore() throws NamingException {
69.182 +
69.183 + if (hasMoreCalled) {
69.184 + return more;
69.185 + }
69.186 +
69.187 + hasMoreCalled = true;
69.188 +
69.189 + if (!more) {
69.190 + return false;
69.191 + } else {
69.192 + return (more = hasMoreImpl());
69.193 + }
69.194 + }
69.195 +
69.196 + /*
69.197 + * Retrieve the next entry.
69.198 + */
69.199 + @Override
69.200 + public final T next() throws NamingException {
69.201 +
69.202 + if (!hasMoreCalled) {
69.203 + hasMore();
69.204 + }
69.205 + hasMoreCalled = false;
69.206 + return nextImpl();
69.207 + }
69.208 +
69.209 + /*
69.210 + * Test if unprocessed entries or referrals exist.
69.211 + */
69.212 + private boolean hasMoreImpl() throws NamingException {
69.213 + // when page size is supported, this
69.214 + // might generate an exception while attempting
69.215 + // to fetch the next batch to determine
69.216 + // whether there are any more elements
69.217 +
69.218 + // test if the current set of entries has been processed
69.219 + if (posn == limit) {
69.220 + getNextBatch();
69.221 + }
69.222 +
69.223 + // test if any unprocessed entries exist
69.224 + if (posn < limit) {
69.225 + return true;
69.226 + } else {
69.227 +
69.228 + try {
69.229 + // try to process another referral
69.230 + return hasMoreReferrals();
69.231 +
69.232 + } catch (LdapReferralException |
69.233 + LimitExceededException |
69.234 + PartialResultException e) {
69.235 + cleanup();
69.236 + throw e;
69.237 +
69.238 + } catch (NamingException e) {
69.239 + cleanup();
69.240 + PartialResultException pre = new PartialResultException();
69.241 + pre.setRootCause(e);
69.242 + throw pre;
69.243 + }
69.244 + }
69.245 + }
69.246 +
69.247 + /*
69.248 + * Retrieve the next entry.
69.249 + */
69.250 + private T nextImpl() throws NamingException {
69.251 + try {
69.252 + return nextAux();
69.253 + } catch (NamingException e) {
69.254 + cleanup();
69.255 + throw cont.fillInException(e);
69.256 + }
69.257 + }
69.258 +
69.259 + private T nextAux() throws NamingException {
69.260 + if (posn == limit) {
69.261 + getNextBatch(); // updates posn and limit
69.262 + }
69.263 +
69.264 + if (posn >= limit) {
69.265 + cleanup();
69.266 + throw new NoSuchElementException("invalid enumeration handle");
69.267 + }
69.268 +
69.269 + LdapEntry result = entries.elementAt(posn++);
69.270 +
69.271 + // gets and outputs DN from the entry
69.272 + return createItem(result.DN, result.attributes, result.respCtls);
69.273 + }
69.274 +
69.275 + protected final String getAtom(String dn) {
69.276 + // need to strip off all but lowest component of dn
69.277 + // so that is relative to current context (currentDN)
69.278 + try {
69.279 + Name parsed = new LdapName(dn);
69.280 + return parsed.get(parsed.size() - 1);
69.281 + } catch (NamingException e) {
69.282 + return dn;
69.283 + }
69.284 + }
69.285 +
69.286 + protected abstract T createItem(String dn, Attributes attrs,
69.287 + Vector<Control> respCtls) throws NamingException;
69.288 +
69.289 + /*
69.290 + * Append the supplied (chain of) referrals onto the
69.291 + * end of the current (chain of) referrals.
69.292 + */
69.293 + @Override
69.294 + public void appendUnprocessedReferrals(LdapReferralException ex) {
69.295 + if (refEx != null) {
69.296 + refEx = refEx.appendUnprocessedReferrals(ex);
69.297 + } else {
69.298 + refEx = ex.appendUnprocessedReferrals(refEx);
69.299 + }
69.300 + }
69.301 +
69.302 + final void setNamingException(NamingException e) {
69.303 + errEx = e;
69.304 + }
69.305 +
69.306 + protected abstract AbstractLdapNamingEnumeration<T> getReferredResults(
69.307 + LdapReferralContext refCtx) throws NamingException;
69.308 +
69.309 + /*
69.310 + * Iterate through the URLs of a referral. If successful then perform
69.311 + * a search operation and merge the received results with the current
69.312 + * results.
69.313 + */
69.314 + protected final boolean hasMoreReferrals() throws NamingException {
69.315 +
69.316 + if ((refEx != null) &&
69.317 + (refEx.hasMoreReferrals() ||
69.318 + refEx.hasMoreReferralExceptions())) {
69.319 +
69.320 + if (homeCtx.handleReferrals == LdapClient.LDAP_REF_THROW) {
69.321 + throw (NamingException)(refEx.fillInStackTrace());
69.322 + }
69.323 +
69.324 + // process the referrals sequentially
69.325 + while (true) {
69.326 +
69.327 + LdapReferralContext refCtx =
69.328 + (LdapReferralContext)refEx.getReferralContext(
69.329 + homeCtx.envprops, homeCtx.reqCtls);
69.330 +
69.331 + try {
69.332 +
69.333 + update(getReferredResults(refCtx));
69.334 + break;
69.335 +
69.336 + } catch (LdapReferralException re) {
69.337 +
69.338 + // record a previous exception
69.339 + if (errEx == null) {
69.340 + errEx = re.getNamingException();
69.341 + }
69.342 + refEx = re;
69.343 + continue;
69.344 +
69.345 + } finally {
69.346 + // Make sure we close referral context
69.347 + refCtx.close();
69.348 + }
69.349 + }
69.350 + return hasMoreImpl();
69.351 +
69.352 + } else {
69.353 + cleanup();
69.354 +
69.355 + if (errEx != null) {
69.356 + throw errEx;
69.357 + }
69.358 + return (false);
69.359 + }
69.360 + }
69.361 +
69.362 + /*
69.363 + * Merge the entries and/or referrals from the supplied enumeration
69.364 + * with those of the current enumeration.
69.365 + */
69.366 + protected void update(AbstractLdapNamingEnumeration<T> ne) {
69.367 + // Cleanup previous context first
69.368 + homeCtx.decEnumCount();
69.369 +
69.370 + // New enum will have already incremented enum count and recorded clnt
69.371 + homeCtx = ne.homeCtx;
69.372 + enumClnt = ne.enumClnt;
69.373 +
69.374 + // Do this to prevent referral enumeration (ne) from decrementing
69.375 + // enum count because we'll be doing that here from this
69.376 + // enumeration.
69.377 + ne.homeCtx = null;
69.378 +
69.379 + // Record rest of information from new enum
69.380 + posn = ne.posn;
69.381 + limit = ne.limit;
69.382 + res = ne.res;
69.383 + entries = ne.entries;
69.384 + refEx = ne.refEx;
69.385 + listArg = ne.listArg;
69.386 + }
69.387 +
69.388 + protected final void finalize() {
69.389 + cleanup();
69.390 + }
69.391 +
69.392 + protected final void cleanup() {
69.393 + if (cleaned) return; // been there; done that
69.394 +
69.395 + if(enumClnt != null) {
69.396 + enumClnt.clearSearchReply(res, homeCtx.reqCtls);
69.397 + }
69.398 +
69.399 + enumClnt = null;
69.400 + cleaned = true;
69.401 + if (homeCtx != null) {
69.402 + homeCtx.decEnumCount();
69.403 + homeCtx = null;
69.404 + }
69.405 + }
69.406 +
69.407 + @Override
69.408 + public final void close() {
69.409 + cleanup();
69.410 + }
69.411 +}
70.1 --- a/src/share/classes/com/sun/jndi/ldap/Ber.java Thu Sep 01 13:54:38 2011 -0700
70.2 +++ b/src/share/classes/com/sun/jndi/ldap/Ber.java Mon Sep 05 23:58:19 2011 -0700
70.3 @@ -1,5 +1,5 @@
70.4 /*
70.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
70.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
70.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
70.8 *
70.9 * This code is free software; you can redistribute it and/or modify it
70.10 @@ -94,12 +94,14 @@
70.11 public static final int ASN_ENUMERATED = 0x0a;
70.12
70.13 final static class EncodeException extends IOException {
70.14 + private static final long serialVersionUID = -5247359637775781768L;
70.15 EncodeException(String msg) {
70.16 super(msg);
70.17 }
70.18 }
70.19
70.20 final static class DecodeException extends IOException {
70.21 + private static final long serialVersionUID = 8735036969244425583L;
70.22 DecodeException(String msg) {
70.23 super(msg);
70.24 }
71.1 --- a/src/share/classes/com/sun/jndi/ldap/ClientId.java Thu Sep 01 13:54:38 2011 -0700
71.2 +++ b/src/share/classes/com/sun/jndi/ldap/ClientId.java Mon Sep 05 23:58:19 2011 -0700
71.3 @@ -1,5 +1,5 @@
71.4 /*
71.5 - * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
71.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
71.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
71.8 *
71.9 * This code is free software; you can redistribute it and/or modify it
71.10 @@ -25,6 +25,7 @@
71.11
71.12 package com.sun.jndi.ldap;
71.13
71.14 +import java.util.Locale;
71.15 import java.util.Arrays; // JDK 1.2
71.16 import java.io.OutputStream;
71.17 import javax.naming.ldap.Control;
71.18 @@ -71,10 +72,10 @@
71.19 ClientId(int version, String hostname, int port, String protocol,
71.20 Control[] bindCtls, OutputStream trace, String socketFactory) {
71.21 this.version = version;
71.22 - this.hostname = hostname.toLowerCase(); // ignore case
71.23 + this.hostname = hostname.toLowerCase(Locale.ENGLISH); // ignore case
71.24 this.port = port;
71.25 this.protocol = protocol;
71.26 - this.bindCtls = (bindCtls != null ? (Control[]) bindCtls.clone() : null);
71.27 + this.bindCtls = (bindCtls != null ? bindCtls.clone() : null);
71.28 this.trace = trace;
71.29 //
71.30 // Needed for custom socket factory pooling
71.31 @@ -83,13 +84,15 @@
71.32 if ((socketFactory != null) &&
71.33 !socketFactory.equals(LdapCtx.DEFAULT_SSL_FACTORY)) {
71.34 try {
71.35 - Class socketFactoryClass = Obj.helper.loadClass(socketFactory);
71.36 - Class objClass = Class.forName("java.lang.Object");
71.37 + Class<?> socketFactoryClass =
71.38 + Obj.helper.loadClass(socketFactory);
71.39 + Class<?> objClass = Class.forName("java.lang.Object");
71.40 this.sockComparator = socketFactoryClass.getMethod(
71.41 - "compare", new Class[]{objClass, objClass});
71.42 - Method getDefault =
71.43 - socketFactoryClass.getMethod("getDefault", new Class[]{});
71.44 - this.factory = (SocketFactory) getDefault.invoke(null, new Object[]{});
71.45 + "compare", new Class<?>[]{objClass, objClass});
71.46 + Method getDefault = socketFactoryClass.getMethod(
71.47 + "getDefault", new Class<?>[]{});
71.48 + this.factory =
71.49 + (SocketFactory)getDefault.invoke(null, new Object[]{});
71.50 } catch (Exception e) {
71.51 // Ignore it here, the same exceptions are/will be handled by
71.52 // LdapPoolManager and Connection classes.
72.1 --- a/src/share/classes/com/sun/jndi/ldap/Connection.java Thu Sep 01 13:54:38 2011 -0700
72.2 +++ b/src/share/classes/com/sun/jndi/ldap/Connection.java Mon Sep 05 23:58:19 2011 -0700
72.3 @@ -238,27 +238,22 @@
72.4 throws NoSuchMethodException {
72.5
72.6 try {
72.7 - Class inetSocketAddressClass =
72.8 + Class<?> inetSocketAddressClass =
72.9 Class.forName("java.net.InetSocketAddress");
72.10
72.11 - Constructor inetSocketAddressCons =
72.12 - inetSocketAddressClass.getConstructor(new Class[]{
72.13 + Constructor<?> inetSocketAddressCons =
72.14 + inetSocketAddressClass.getConstructor(new Class<?>[]{
72.15 String.class, int.class});
72.16
72.17 return inetSocketAddressCons.newInstance(new Object[]{
72.18 host, new Integer(port)});
72.19
72.20 - } catch (ClassNotFoundException e) {
72.21 + } catch (ClassNotFoundException |
72.22 + InstantiationException |
72.23 + InvocationTargetException |
72.24 + IllegalAccessException e) {
72.25 throw new NoSuchMethodException();
72.26
72.27 - } catch (InstantiationException e) {
72.28 - throw new NoSuchMethodException();
72.29 -
72.30 - } catch (InvocationTargetException e) {
72.31 - throw new NoSuchMethodException();
72.32 -
72.33 - } catch (IllegalAccessException e) {
72.34 - throw new NoSuchMethodException();
72.35 }
72.36 }
72.37
72.38 @@ -280,9 +275,9 @@
72.39
72.40 // create the factory
72.41
72.42 - Class socketFactoryClass = Obj.helper.loadClass(socketFactory);
72.43 + Class<?> socketFactoryClass = Obj.helper.loadClass(socketFactory);
72.44 Method getDefault =
72.45 - socketFactoryClass.getMethod("getDefault", new Class[]{});
72.46 + socketFactoryClass.getMethod("getDefault", new Class<?>[]{});
72.47 Object factory = getDefault.invoke(null, new Object[]{});
72.48
72.49 // create the socket
72.50 @@ -293,10 +288,10 @@
72.51
72.52 try {
72.53 createSocket = socketFactoryClass.getMethod("createSocket",
72.54 - new Class[]{});
72.55 + new Class<?>[]{});
72.56
72.57 Method connect = Socket.class.getMethod("connect",
72.58 - new Class[]{Class.forName("java.net.SocketAddress"),
72.59 + new Class<?>[]{Class.forName("java.net.SocketAddress"),
72.60 int.class});
72.61 Object endpoint = createInetSocketAddress(host, port);
72.62
72.63 @@ -320,7 +315,7 @@
72.64
72.65 if (socket == null) {
72.66 createSocket = socketFactoryClass.getMethod("createSocket",
72.67 - new Class[]{String.class, int.class});
72.68 + new Class<?>[]{String.class, int.class});
72.69
72.70 if (debug) {
72.71 System.err.println("Connection: creating socket using " +
72.72 @@ -335,15 +330,15 @@
72.73 if (connectTimeout > 0) {
72.74
72.75 try {
72.76 - Constructor socketCons =
72.77 - Socket.class.getConstructor(new Class[]{});
72.78 + Constructor<Socket> socketCons =
72.79 + Socket.class.getConstructor(new Class<?>[]{});
72.80
72.81 Method connect = Socket.class.getMethod("connect",
72.82 - new Class[]{Class.forName("java.net.SocketAddress"),
72.83 + new Class<?>[]{Class.forName("java.net.SocketAddress"),
72.84 int.class});
72.85 Object endpoint = createInetSocketAddress(host, port);
72.86
72.87 - socket = (Socket) socketCons.newInstance(new Object[]{});
72.88 + socket = socketCons.newInstance(new Object[]{});
72.89
72.90 if (debug) {
72.91 System.err.println("Connection: creating socket with " +
73.1 --- a/src/share/classes/com/sun/jndi/ldap/DigestClientId.java Thu Sep 01 13:54:38 2011 -0700
73.2 +++ b/src/share/classes/com/sun/jndi/ldap/DigestClientId.java Mon Sep 05 23:58:19 2011 -0700
73.3 @@ -1,5 +1,5 @@
73.4 /*
73.5 - * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
73.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
73.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
73.8 *
73.9 * This code is free software; you can redistribute it and/or modify it
73.10 @@ -65,7 +65,7 @@
73.11 DigestClientId(int version, String hostname, int port,
73.12 String protocol, Control[] bindCtls, OutputStream trace,
73.13 String socketFactory, String username,
73.14 - Object passwd, Hashtable env) {
73.15 + Object passwd, Hashtable<?,?> env) {
73.16
73.17 super(version, hostname, port, protocol, bindCtls, trace,
73.18 socketFactory, username, passwd);
74.1 --- a/src/share/classes/com/sun/jndi/ldap/EventQueue.java Thu Sep 01 13:54:38 2011 -0700
74.2 +++ b/src/share/classes/com/sun/jndi/ldap/EventQueue.java Mon Sep 05 23:58:19 2011 -0700
74.3 @@ -1,5 +1,5 @@
74.4 /*
74.5 - * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
74.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
74.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
74.8 *
74.9 * This code is free software; you can redistribute it and/or modify it
74.10 @@ -25,7 +25,6 @@
74.11
74.12 package com.sun.jndi.ldap;
74.13
74.14 -import java.io.*;
74.15 import java.util.Vector;
74.16 import java.util.EventObject;
74.17
74.18 @@ -52,9 +51,9 @@
74.19 QueueElement next = null;
74.20 QueueElement prev = null;
74.21 EventObject event = null;
74.22 - Vector vector = null;
74.23 + Vector<NamingListener> vector = null;
74.24
74.25 - QueueElement(EventObject event, Vector vector) {
74.26 + QueueElement(EventObject event, Vector<NamingListener> vector) {
74.27 this.event = event;
74.28 this.vector = vector;
74.29 }
74.30 @@ -87,7 +86,7 @@
74.31 * are notified.
74.32 * @param vector List of NamingListeners that will be notified of event.
74.33 */
74.34 - synchronized void enqueue(EventObject event, Vector vector) {
74.35 + synchronized void enqueue(EventObject event, Vector<NamingListener> vector) {
74.36 QueueElement newElt = new QueueElement(event, vector);
74.37
74.38 if (head == null) {
74.39 @@ -133,7 +132,7 @@
74.40 try {
74.41 while ((qe = dequeue()) != null) {
74.42 EventObject e = qe.event;
74.43 - Vector v = qe.vector;
74.44 + Vector<NamingListener> v = qe.vector;
74.45
74.46 for (int i = 0; i < v.size(); i++) {
74.47
74.48 @@ -145,12 +144,11 @@
74.49 // only enqueue events with listseners of the correct type.
74.50
74.51 if (e instanceof NamingEvent) {
74.52 - ((NamingEvent)e).dispatch((NamingListener)v.elementAt(i));
74.53 + ((NamingEvent)e).dispatch(v.elementAt(i));
74.54
74.55 // An exception occurred: if notify all naming listeners
74.56 } else if (e instanceof NamingExceptionEvent) {
74.57 - ((NamingExceptionEvent)e).dispatch(
74.58 - (NamingListener)v.elementAt(i));
74.59 + ((NamingExceptionEvent)e).dispatch(v.elementAt(i));
74.60 } else if (e instanceof UnsolicitedNotificationEvent) {
74.61 ((UnsolicitedNotificationEvent)e).dispatch(
74.62 (UnsolicitedNotificationListener)v.elementAt(i));
75.1 --- a/src/share/classes/com/sun/jndi/ldap/EventSupport.java Thu Sep 01 13:54:38 2011 -0700
75.2 +++ b/src/share/classes/com/sun/jndi/ldap/EventSupport.java Mon Sep 05 23:58:19 2011 -0700
75.3 @@ -1,5 +1,5 @@
75.4 /*
75.5 - * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
75.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
75.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
75.8 *
75.9 * This code is free software; you can redistribute it and/or modify it
75.10 @@ -27,11 +27,9 @@
75.11
75.12 import java.util.Hashtable;
75.13 import java.util.Vector;
75.14 -import java.util.Enumeration;
75.15 import java.util.EventObject;
75.16
75.17 import javax.naming.*;
75.18 -import javax.naming.directory.*;
75.19 import javax.naming.event.*;
75.20 import javax.naming.directory.SearchControls;
75.21 import javax.naming.ldap.UnsolicitedNotificationListener;
75.22 @@ -120,12 +118,13 @@
75.23 /**
75.24 * NamingEventNotifiers; hashed by search arguments;
75.25 */
75.26 - private Hashtable notifiers = new Hashtable(11);
75.27 + private Hashtable<NotifierArgs, NamingEventNotifier> notifiers =
75.28 + new Hashtable<>(11);
75.29
75.30 /**
75.31 * List of unsolicited notification listeners.
75.32 */
75.33 - private Vector unsolicited = null;
75.34 + private Vector<UnsolicitedNotificationListener> unsolicited = null;
75.35
75.36 /**
75.37 * Constructs EventSupport for ctx.
75.38 @@ -155,8 +154,7 @@
75.39 l instanceof NamespaceChangeListener) {
75.40 NotifierArgs args = new NotifierArgs(nm, scope, l);
75.41
75.42 - NamingEventNotifier notifier =
75.43 - (NamingEventNotifier) notifiers.get(args);
75.44 + NamingEventNotifier notifier = notifiers.get(args);
75.45 if (notifier == null) {
75.46 notifier = new NamingEventNotifier(this, ctx, args, l);
75.47 notifiers.put(args, notifier);
75.48 @@ -167,10 +165,10 @@
75.49 if (l instanceof UnsolicitedNotificationListener) {
75.50 // Add listener to this's list of unsolicited notifiers
75.51 if (unsolicited == null) {
75.52 - unsolicited = new Vector(3);
75.53 + unsolicited = new Vector<>(3);
75.54 }
75.55
75.56 - unsolicited.addElement(l);
75.57 + unsolicited.addElement((UnsolicitedNotificationListener)l);
75.58 }
75.59 }
75.60
75.61 @@ -185,8 +183,7 @@
75.62 l instanceof NamespaceChangeListener) {
75.63 NotifierArgs args = new NotifierArgs(nm, filter, ctls, l);
75.64
75.65 - NamingEventNotifier notifier =
75.66 - (NamingEventNotifier) notifiers.get(args);
75.67 + NamingEventNotifier notifier = notifiers.get(args);
75.68 if (notifier == null) {
75.69 notifier = new NamingEventNotifier(this, ctx, args, l);
75.70 notifiers.put(args, notifier);
75.71 @@ -197,9 +194,9 @@
75.72 if (l instanceof UnsolicitedNotificationListener) {
75.73 // Add listener to this's list of unsolicited notifiers
75.74 if (unsolicited == null) {
75.75 - unsolicited = new Vector(3);
75.76 + unsolicited = new Vector<>(3);
75.77 }
75.78 - unsolicited.addElement(l);
75.79 + unsolicited.addElement((UnsolicitedNotificationListener)l);
75.80 }
75.81 }
75.82
75.83 @@ -207,15 +204,11 @@
75.84 * Removes <tt>l</tt> from all notifiers in this context.
75.85 */
75.86 synchronized void removeNamingListener(NamingListener l) {
75.87 - Enumeration allnotifiers = notifiers.elements();
75.88 - NamingEventNotifier notifier;
75.89 -
75.90 if (debug) System.err.println("EventSupport removing listener");
75.91
75.92 // Go through list of notifiers, remove 'l' from each.
75.93 // If 'l' is notifier's only listener, remove notifier too.
75.94 - while (allnotifiers.hasMoreElements()) {
75.95 - notifier = (NamingEventNotifier)allnotifiers.nextElement();
75.96 + for (NamingEventNotifier notifier : notifiers.values()) {
75.97 if (notifier != null) {
75.98 if (debug)
75.99 System.err.println("EventSupport removing listener from notifier");
75.100 @@ -305,8 +298,8 @@
75.101 synchronized void cleanup() {
75.102 if (debug) System.err.println("EventSupport clean up");
75.103 if (notifiers != null) {
75.104 - for (Enumeration ns = notifiers.elements(); ns.hasMoreElements(); ) {
75.105 - ((NamingEventNotifier) ns.nextElement()).stop();
75.106 + for (NamingEventNotifier notifier : notifiers.values()) {
75.107 + notifier.stop();
75.108 }
75.109 notifiers = null;
75.110 }
75.111 @@ -328,7 +321,8 @@
75.112 * them to the registered listeners.
75.113 * Package private; used by NamingEventNotifier to fire events
75.114 */
75.115 - synchronized void queueEvent(EventObject event, Vector vector) {
75.116 + synchronized void queueEvent(EventObject event,
75.117 + Vector<? extends NamingListener> vector) {
75.118 if (eventQueue == null)
75.119 eventQueue = new EventQueue();
75.120
75.121 @@ -340,7 +334,9 @@
75.122 * of this event will not take effect until after the event is
75.123 * delivered.
75.124 */
75.125 - Vector v = (Vector)vector.clone();
75.126 + @SuppressWarnings("unchecked") // clone()
75.127 + Vector<NamingListener> v =
75.128 + (Vector<NamingListener>)vector.clone();
75.129 eventQueue.enqueue(event, v);
75.130 }
75.131
76.1 --- a/src/share/classes/com/sun/jndi/ldap/LdapAttribute.java Thu Sep 01 13:54:38 2011 -0700
76.2 +++ b/src/share/classes/com/sun/jndi/ldap/LdapAttribute.java Mon Sep 05 23:58:19 2011 -0700
76.3 @@ -1,5 +1,5 @@
76.4 /*
76.5 - * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
76.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
76.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
76.8 *
76.9 * This code is free software; you can redistribute it and/or modify it
76.10 @@ -26,8 +26,6 @@
76.11 package com.sun.jndi.ldap;
76.12
76.13 import java.io.IOException;
76.14 -import java.io.Serializable;
76.15 -import java.util.Enumeration;
76.16 import java.util.Hashtable;
76.17 import java.util.Vector;
76.18 import javax.naming.*;
76.19 @@ -50,11 +48,12 @@
76.20 // these two are used to reconstruct the baseCtx if this attribute has
76.21 // been serialized (
76.22 private String baseCtxURL;
76.23 - private Hashtable baseCtxEnv;
76.24 + private Hashtable<String, ? super String> baseCtxEnv;
76.25
76.26 + @SuppressWarnings("unchecked") // clone()
76.27 public Object clone() {
76.28 LdapAttribute attr = new LdapAttribute(this.attrID, baseCtx, rdn);
76.29 - attr.values = (Vector)values.clone();
76.30 + attr.values = (Vector<Object>)values.clone();
76.31 return attr;
76.32 }
76.33
76.34 @@ -112,7 +111,7 @@
76.35 private DirContext getBaseCtx() throws NamingException {
76.36 if(baseCtx == null) {
76.37 if (baseCtxEnv == null) {
76.38 - baseCtxEnv = new Hashtable(3);
76.39 + baseCtxEnv = new Hashtable<String, String>(3);
76.40 }
76.41 baseCtxEnv.put(Context.INITIAL_CONTEXT_FACTORY,
76.42 "com.sun.jndi.ldap.LdapCtxFactory");
76.43 @@ -144,9 +143,10 @@
76.44 * we are serialized. This must be called _before_ the object is
76.45 * serialized!!!
76.46 */
76.47 + @SuppressWarnings("unchecked") // clone()
76.48 private void setBaseCtxInfo() {
76.49 - Hashtable realEnv = null;
76.50 - Hashtable secureEnv = null;
76.51 + Hashtable<String, Object> realEnv = null;
76.52 + Hashtable<String, Object> secureEnv = null;
76.53
76.54 if (baseCtx != null) {
76.55 realEnv = ((LdapCtx)baseCtx).envprops;
76.56 @@ -156,16 +156,14 @@
76.57 if(realEnv != null && realEnv.size() > 0 ) {
76.58 // remove any security credentials - otherwise the serialized form
76.59 // would store them in the clear
76.60 - Enumeration keys = realEnv.keys();
76.61 - while(keys.hasMoreElements()) {
76.62 - String key = (String)keys.nextElement();
76.63 + for (String key : realEnv.keySet()){
76.64 if (key.indexOf("security") != -1 ) {
76.65
76.66 //if we need to remove props, we must do it to a clone
76.67 //of the environment. cloning is expensive, so we only do
76.68 //it if we have to.
76.69 if(secureEnv == null) {
76.70 - secureEnv = (Hashtable)realEnv.clone();
76.71 + secureEnv = (Hashtable<String, Object>)realEnv.clone();
76.72 }
76.73 secureEnv.remove(key);
76.74 }
77.1 --- a/src/share/classes/com/sun/jndi/ldap/LdapBindingEnumeration.java Thu Sep 01 13:54:38 2011 -0700
77.2 +++ b/src/share/classes/com/sun/jndi/ldap/LdapBindingEnumeration.java Mon Sep 05 23:58:19 2011 -0700
77.3 @@ -1,5 +1,5 @@
77.4 /*
77.5 - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
77.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
77.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
77.8 *
77.9 * This code is free software; you can redistribute it and/or modify it
77.10 @@ -28,11 +28,13 @@
77.11 import java.util.Vector;
77.12 import javax.naming.*;
77.13 import javax.naming.directory.*;
77.14 +import javax.naming.ldap.Control;
77.15 import javax.naming.spi.*;
77.16
77.17 import com.sun.jndi.toolkit.ctx.Continuation;
77.18
77.19 -final class LdapBindingEnumeration extends LdapNamingEnumeration {
77.20 +final class LdapBindingEnumeration
77.21 + extends AbstractLdapNamingEnumeration<Binding> {
77.22
77.23 LdapBindingEnumeration(LdapCtx homeCtx, LdapResult answer, Name remain,
77.24 Continuation cont) throws NamingException
77.25 @@ -40,8 +42,9 @@
77.26 super(homeCtx, answer, remain, cont);
77.27 }
77.28
77.29 - protected NameClassPair
77.30 - createItem(String dn, Attributes attrs, Vector respCtls)
77.31 + @Override
77.32 + protected Binding
77.33 + createItem(String dn, Attributes attrs, Vector<Control> respCtls)
77.34 throws NamingException {
77.35
77.36 Object obj = null;
77.37 @@ -85,9 +88,10 @@
77.38 return binding;
77.39 }
77.40
77.41 - protected LdapNamingEnumeration
77.42 - getReferredResults(LdapReferralContext refCtx) throws NamingException{
77.43 + @Override
77.44 + protected LdapBindingEnumeration getReferredResults(
77.45 + LdapReferralContext refCtx) throws NamingException{
77.46 // repeat the original operation at the new context
77.47 - return (LdapNamingEnumeration) refCtx.listBindings(listArg);
77.48 + return (LdapBindingEnumeration)refCtx.listBindings(listArg);
77.49 }
77.50 }
78.1 --- a/src/share/classes/com/sun/jndi/ldap/LdapClient.java Thu Sep 01 13:54:38 2011 -0700
78.2 +++ b/src/share/classes/com/sun/jndi/ldap/LdapClient.java Mon Sep 05 23:58:19 2011 -0700
78.3 @@ -25,8 +25,8 @@
78.4
78.5 package com.sun.jndi.ldap;
78.6
78.7 -import java.net.*;
78.8 import java.io.*;
78.9 +import java.util.Locale;
78.10 import java.util.Vector;
78.11 import java.util.Hashtable;
78.12
78.13 @@ -81,7 +81,8 @@
78.14 static final boolean caseIgnore = true;
78.15
78.16 // Default list of binary attributes
78.17 - private static final Hashtable defaultBinaryAttrs = new Hashtable(23,0.75f);
78.18 + private static final Hashtable<String, Boolean> defaultBinaryAttrs =
78.19 + new Hashtable<>(23,0.75f);
78.20 static {
78.21 defaultBinaryAttrs.put("userpassword", Boolean.TRUE); //2.5.4.35
78.22 defaultBinaryAttrs.put("javaserializeddata", Boolean.TRUE);
78.23 @@ -146,7 +147,7 @@
78.24
78.25 synchronized LdapResult
78.26 authenticate(boolean initial, String name, Object pw, int version,
78.27 - String authMechanism, Control[] ctls, Hashtable env)
78.28 + String authMechanism, Control[] ctls, Hashtable<?,?> env)
78.29 throws NamingException {
78.30
78.31 authenticateCalled = true;
78.32 @@ -516,8 +517,8 @@
78.33 LdapResult search(String dn, int scope, int deref, int sizeLimit,
78.34 int timeLimit, boolean attrsOnly, String attrs[],
78.35 String filter, int batchSize, Control[] reqCtls,
78.36 - Hashtable binaryAttrs, boolean waitFirstReply,
78.37 - int replyQueueCapacity)
78.38 + Hashtable<String, Boolean> binaryAttrs,
78.39 + boolean waitFirstReply, int replyQueueCapacity)
78.40 throws IOException, NamingException {
78.41
78.42 ensureOpen();
78.43 @@ -586,7 +587,7 @@
78.44 * Retrieve the next batch of entries and/or referrals.
78.45 */
78.46 LdapResult getSearchReply(int batchSize, LdapResult res,
78.47 - Hashtable binaryAttrs) throws IOException, NamingException {
78.48 + Hashtable<String, Boolean> binaryAttrs) throws IOException, NamingException {
78.49
78.50 ensureOpen();
78.51
78.52 @@ -600,7 +601,7 @@
78.53 }
78.54
78.55 private LdapResult getSearchReply(LdapRequest req,
78.56 - int batchSize, LdapResult res, Hashtable binaryAttrs)
78.57 + int batchSize, LdapResult res, Hashtable<String, Boolean> binaryAttrs)
78.58 throws IOException, NamingException {
78.59
78.60 if (batchSize == 0)
78.61 @@ -610,7 +611,7 @@
78.62 res.entries.setSize(0); // clear the (previous) set of entries
78.63 } else {
78.64 res.entries =
78.65 - new Vector(batchSize == Integer.MAX_VALUE ? 32 : batchSize);
78.66 + new Vector<>(batchSize == Integer.MAX_VALUE ? 32 : batchSize);
78.67 }
78.68
78.69 if (res.referrals != null) {
78.70 @@ -660,7 +661,7 @@
78.71 } else if ((seq == LDAP_REP_SEARCH_REF) && isLdapv3) {
78.72
78.73 // handle LDAPv3 search reference
78.74 - Vector URLs = new Vector(4);
78.75 + Vector<String> URLs = new Vector<>(4);
78.76
78.77 // %%% Although not strictly correct, some LDAP servers
78.78 // encode the SEQUENCE OF tag in the SearchResultRef
78.79 @@ -676,7 +677,7 @@
78.80 }
78.81
78.82 if (res.referrals == null) {
78.83 - res.referrals = new Vector(4);
78.84 + res.referrals = new Vector<>(4);
78.85 }
78.86 res.referrals.addElement(URLs);
78.87 res.resControls = isLdapv3 ? parseControls(replyBer) : null;
78.88 @@ -700,7 +701,8 @@
78.89 return res;
78.90 }
78.91
78.92 - private Attribute parseAttribute(BerDecoder ber, Hashtable binaryAttrs)
78.93 + private Attribute parseAttribute(BerDecoder ber,
78.94 + Hashtable<String, Boolean> binaryAttrs)
78.95 throws IOException {
78.96
78.97 int len[] = new int[1];
78.98 @@ -737,13 +739,15 @@
78.99 if (hasBinaryValues) {
78.100 la.add(ber.parseOctetString(ber.peekByte(), len));
78.101 } else {
78.102 - la.add(ber.parseStringWithTag(Ber.ASN_SIMPLE_STRING, isLdapv3, len));
78.103 + la.add(ber.parseStringWithTag(
78.104 + Ber.ASN_SIMPLE_STRING, isLdapv3, len));
78.105 }
78.106 return len[0];
78.107 }
78.108
78.109 - private boolean isBinaryValued(String attrid, Hashtable binaryAttrs) {
78.110 - String id = attrid.toLowerCase();
78.111 + private boolean isBinaryValued(String attrid,
78.112 + Hashtable<String, Boolean> binaryAttrs) {
78.113 + String id = attrid.toLowerCase(Locale.ENGLISH);
78.114
78.115 return ((id.indexOf(";binary") != -1) ||
78.116 defaultBinaryAttrs.containsKey(id) ||
78.117 @@ -751,8 +755,8 @@
78.118 }
78.119
78.120 // package entry point; used by Connection
78.121 - static void parseResult(BerDecoder replyBer, LdapResult res, boolean isLdapv3)
78.122 - throws IOException {
78.123 + static void parseResult(BerDecoder replyBer, LdapResult res,
78.124 + boolean isLdapv3) throws IOException {
78.125
78.126 res.status = replyBer.parseEnumeration();
78.127 res.matchedDN = replyBer.parseString(isLdapv3);
78.128 @@ -763,7 +767,7 @@
78.129 (replyBer.bytesLeft() > 0) &&
78.130 (replyBer.peekByte() == LDAP_REP_REFERRAL)) {
78.131
78.132 - Vector URLs = new Vector(4);
78.133 + Vector<String> URLs = new Vector<>(4);
78.134 int[] seqlen = new int[1];
78.135
78.136 replyBer.parseSeq(seqlen);
78.137 @@ -775,18 +779,18 @@
78.138 }
78.139
78.140 if (res.referrals == null) {
78.141 - res.referrals = new Vector(4);
78.142 + res.referrals = new Vector<>(4);
78.143 }
78.144 res.referrals.addElement(URLs);
78.145 }
78.146 }
78.147
78.148 // package entry point; used by Connection
78.149 - static Vector parseControls(BerDecoder replyBer) throws IOException {
78.150 + static Vector<Control> parseControls(BerDecoder replyBer) throws IOException {
78.151
78.152 // handle LDAPv3 controls (if present)
78.153 if ((replyBer.bytesLeft() > 0) && (replyBer.peekByte() == LDAP_CONTROLS)) {
78.154 - Vector ctls = new Vector(4);
78.155 + Vector<Control> ctls = new Vector<>(4);
78.156 String controlOID;
78.157 boolean criticality = false; // default
78.158 byte[] controlValue = null; // optional
78.159 @@ -957,7 +961,7 @@
78.160 ber.beginSeq(Ber.ASN_SEQUENCE | Ber.ASN_CONSTRUCTOR);
78.161 ber.encodeString(attr.getID(), isLdapv3);
78.162 ber.beginSeq(Ber.ASN_SEQUENCE | Ber.ASN_CONSTRUCTOR | 1);
78.163 - NamingEnumeration enum_ = attr.getAll();
78.164 + NamingEnumeration<?> enum_ = attr.getAll();
78.165 Object val;
78.166 while (enum_.hasMore()) {
78.167 val = enum_.next();
78.168 @@ -1007,9 +1011,10 @@
78.169 ber.beginSeq(LDAP_REQ_ADD);
78.170 ber.encodeString(entry.DN, isLdapv3);
78.171 ber.beginSeq(Ber.ASN_SEQUENCE | Ber.ASN_CONSTRUCTOR);
78.172 - NamingEnumeration enum_ = entry.attributes.getAll();
78.173 + NamingEnumeration<? extends Attribute> enum_ =
78.174 + entry.attributes.getAll();
78.175 while (enum_.hasMore()) {
78.176 - attr = (Attribute)enum_.next();
78.177 + attr = enum_.next();
78.178
78.179 // zero values is not permitted
78.180 if (hasNoValue(attr)) {
78.181 @@ -1474,7 +1479,7 @@
78.182 // removeUnsolicited() is invoked to remove an LdapCtx from this client.
78.183 //
78.184 ////////////////////////////////////////////////////////////////////////////
78.185 - private Vector unsolicited = new Vector(3);
78.186 + private Vector<LdapCtx> unsolicited = new Vector<>(3);
78.187 void addUnsolicited(LdapCtx ctx) {
78.188 if (debug > 0) {
78.189 System.err.println("LdapClient.addUnsolicited" + ctx);
78.190 @@ -1500,70 +1505,70 @@
78.191 if (debug > 0) {
78.192 System.err.println("LdapClient.processUnsolicited");
78.193 }
78.194 - synchronized (unsolicited) {
78.195 - try {
78.196 - // Parse the response
78.197 - LdapResult res = new LdapResult();
78.198 + synchronized (unsolicited) {
78.199 + try {
78.200 + // Parse the response
78.201 + LdapResult res = new LdapResult();
78.202
78.203 - ber.parseSeq(null); // init seq
78.204 - ber.parseInt(); // msg id; should be 0; ignored
78.205 - if (ber.parseByte() != LDAP_REP_EXTENSION) {
78.206 - throw new IOException(
78.207 - "Unsolicited Notification must be an Extended Response");
78.208 + ber.parseSeq(null); // init seq
78.209 + ber.parseInt(); // msg id; should be 0; ignored
78.210 + if (ber.parseByte() != LDAP_REP_EXTENSION) {
78.211 + throw new IOException(
78.212 + "Unsolicited Notification must be an Extended Response");
78.213 + }
78.214 + ber.parseLength();
78.215 + parseExtResponse(ber, res);
78.216 +
78.217 + if (DISCONNECT_OID.equals(res.extensionId)) {
78.218 + // force closing of connection
78.219 + forceClose(pooled);
78.220 + }
78.221 +
78.222 + if (unsolicited.size() > 0) {
78.223 + // Create an UnsolicitedNotification using the parsed data
78.224 + // Need a 'ctx' object because we want to use the context's
78.225 + // list of provider control factories.
78.226 + UnsolicitedNotification notice = new UnsolicitedResponseImpl(
78.227 + res.extensionId,
78.228 + res.extensionValue,
78.229 + res.referrals,
78.230 + res.status,
78.231 + res.errorMessage,
78.232 + res.matchedDN,
78.233 + (res.resControls != null) ?
78.234 + unsolicited.elementAt(0).convertControls(res.resControls) :
78.235 + null);
78.236 +
78.237 + // Fire UnsolicitedNotification events to listeners
78.238 + notifyUnsolicited(notice);
78.239 +
78.240 + // If "disconnect" notification,
78.241 + // notify unsolicited listeners via NamingException
78.242 + if (DISCONNECT_OID.equals(res.extensionId)) {
78.243 + notifyUnsolicited(
78.244 + new CommunicationException("Connection closed"));
78.245 + }
78.246 + }
78.247 + } catch (IOException e) {
78.248 + if (unsolicited.size() == 0)
78.249 + return; // no one registered; ignore
78.250 +
78.251 + NamingException ne = new CommunicationException(
78.252 + "Problem parsing unsolicited notification");
78.253 + ne.setRootCause(e);
78.254 +
78.255 + notifyUnsolicited(ne);
78.256 +
78.257 + } catch (NamingException e) {
78.258 + notifyUnsolicited(e);
78.259 }
78.260 - ber.parseLength();
78.261 - parseExtResponse(ber, res);
78.262 -
78.263 - if (DISCONNECT_OID.equals(res.extensionId)) {
78.264 - // force closing of connection
78.265 - forceClose(pooled);
78.266 - }
78.267 -
78.268 - if (unsolicited.size() > 0) {
78.269 - // Create an UnsolicitedNotification using the parsed data
78.270 - // Need a 'ctx' object because we want to use the context's
78.271 - // list of provider control factories.
78.272 - UnsolicitedNotification notice = new UnsolicitedResponseImpl(
78.273 - res.extensionId,
78.274 - res.extensionValue,
78.275 - res.referrals,
78.276 - res.status,
78.277 - res.errorMessage,
78.278 - res.matchedDN,
78.279 - (res.resControls != null) ?
78.280 - ((LdapCtx)unsolicited.elementAt(0)).convertControls(res.resControls) :
78.281 - null);
78.282 -
78.283 - // Fire UnsolicitedNotification events to listeners
78.284 - notifyUnsolicited(notice);
78.285 -
78.286 - // If "disconnect" notification,
78.287 - // notify unsolicited listeners via NamingException
78.288 - if (DISCONNECT_OID.equals(res.extensionId)) {
78.289 - notifyUnsolicited(
78.290 - new CommunicationException("Connection closed"));
78.291 - }
78.292 - }
78.293 - } catch (IOException e) {
78.294 - if (unsolicited.size() == 0)
78.295 - return; // no one registered; ignore
78.296 -
78.297 - NamingException ne = new CommunicationException(
78.298 - "Problem parsing unsolicited notification");
78.299 - ne.setRootCause(e);
78.300 -
78.301 - notifyUnsolicited(ne);
78.302 -
78.303 - } catch (NamingException e) {
78.304 - notifyUnsolicited(e);
78.305 }
78.306 - }
78.307 }
78.308
78.309
78.310 private void notifyUnsolicited(Object e) {
78.311 for (int i = 0; i < unsolicited.size(); i++) {
78.312 - ((LdapCtx)unsolicited.elementAt(i)).fireUnsolicited(e);
78.313 + unsolicited.elementAt(i).fireUnsolicited(e);
78.314 }
78.315 if (e instanceof NamingException) {
78.316 unsolicited.setSize(0); // no more listeners after exception
78.317 @@ -1584,7 +1589,7 @@
78.318 static LdapClient getInstance(boolean usePool, String hostname, int port,
78.319 String factory, int connectTimeout, int readTimeout, OutputStream trace,
78.320 int version, String authMechanism, Control[] ctls, String protocol,
78.321 - String user, Object passwd, Hashtable env) throws NamingException {
78.322 + String user, Object passwd, Hashtable<?,?> env) throws NamingException {
78.323
78.324 if (usePool) {
78.325 if (LdapPoolManager.isPoolingAllowed(factory, trace,
79.1 --- a/src/share/classes/com/sun/jndi/ldap/LdapCtx.java Thu Sep 01 13:54:38 2011 -0700
79.2 +++ b/src/share/classes/com/sun/jndi/ldap/LdapCtx.java Mon Sep 05 23:58:19 2011 -0700
79.3 @@ -33,6 +33,7 @@
79.4 import javax.naming.ldap.LdapName;
79.5 import javax.naming.ldap.Rdn;
79.6
79.7 +import java.util.Locale;
79.8 import java.util.Vector;
79.9 import java.util.Hashtable;
79.10 import java.util.List;
79.11 @@ -223,7 +224,7 @@
79.12 String hostname = null; // host name of server (no brackets
79.13 // for IPv6 literals)
79.14 LdapClient clnt = null; // connection handle
79.15 - Hashtable envprops = null; // environment properties of context
79.16 + Hashtable<String, java.lang.Object> envprops = null; // environment properties of context
79.17 int handleReferrals = DEFAULT_REFERRAL_MODE; // how referral is handled
79.18 boolean hasLdapsScheme = false; // true if the context was created
79.19 // using an LDAPS URL.
79.20 @@ -232,7 +233,7 @@
79.21
79.22 String currentDN; // DN of this context
79.23 Name currentParsedDN; // DN of this context
79.24 - Vector respCtls = null; // Response controls read
79.25 + Vector<Control> respCtls = null; // Response controls read
79.26 Control[] reqCtls = null; // Controls to be sent with each request
79.27
79.28
79.29 @@ -244,14 +245,14 @@
79.30 private boolean netscapeSchemaBug = false; // workaround
79.31 private Control[] bindCtls = null; // Controls to be sent with LDAP "bind"
79.32 private int referralHopLimit = DEFAULT_REFERRAL_LIMIT; // max referral
79.33 - private Hashtable schemaTrees = null; // schema root of this context
79.34 + private Hashtable<String, DirContext> schemaTrees = null; // schema root of this context
79.35 private int batchSize = DEFAULT_BATCH_SIZE; // batch size for search results
79.36 private boolean deleteRDN = DEFAULT_DELETE_RDN; // delete the old RDN when modifying DN
79.37 private boolean typesOnly = DEFAULT_TYPES_ONLY; // return attribute types (no values)
79.38 private int derefAliases = DEFAULT_DEREF_ALIASES;// de-reference alias entries during searching
79.39 private char addrEncodingSeparator = DEFAULT_REF_SEPARATOR; // encoding RefAddr
79.40
79.41 - private Hashtable binaryAttrs = null; // attr values returned as byte[]
79.42 + private Hashtable<String, Boolean> binaryAttrs = null; // attr values returned as byte[]
79.43 private int connectTimeout = -1; // no timeout value
79.44 private int readTimeout = -1; // no timeout value
79.45 private boolean waitForReply = true; // wait for search response
79.46 @@ -272,13 +273,15 @@
79.47
79.48 // -------------- Constructors -----------------------------------
79.49
79.50 - public LdapCtx(String dn, String host, int port_number, Hashtable props,
79.51 + @SuppressWarnings("unchecked")
79.52 + public LdapCtx(String dn, String host, int port_number,
79.53 + Hashtable<?,?> props,
79.54 boolean useSsl) throws NamingException {
79.55
79.56 this.useSsl = this.hasLdapsScheme = useSsl;
79.57
79.58 if (props != null) {
79.59 - envprops = (Hashtable) props.clone();
79.60 + envprops = (Hashtable<String, java.lang.Object>) props.clone();
79.61
79.62 // SSL env prop overrides the useSsl argument
79.63 if ("ssl".equals(envprops.get(Context.SECURITY_PROTOCOL))) {
79.64 @@ -310,7 +313,7 @@
79.65 this.useDefaultPortNumber = true;
79.66 }
79.67
79.68 - schemaTrees = new Hashtable(11, 0.75f);
79.69 + schemaTrees = new Hashtable<>(11, 0.75f);
79.70 initEnv();
79.71 try {
79.72 connect(false);
79.73 @@ -557,9 +560,7 @@
79.74 if (answer.resControls != null) {
79.75 respCtls = appendVector(respCtls, answer.resControls);
79.76 }
79.77 - } catch (NamingException ae) {
79.78 - addEx = ae;
79.79 - } catch (IOException ae) {
79.80 + } catch (NamingException | IOException ae) {
79.81 addEx = ae;
79.82 }
79.83
79.84 @@ -918,19 +919,17 @@
79.85 }
79.86
79.87 // Parse string name into list of RDNs
79.88 - //List<Rdn> rdnList = (new LdapName(dn)).rdns();
79.89 - List rdnList = (new LdapName(dn)).getRdns();
79.90 + List<Rdn> rdnList = (new LdapName(dn)).getRdns();
79.91
79.92 // Get leaf RDN
79.93 - //Rdn rdn = rdnList.get(rdnList.size() - 1);
79.94 - Rdn rdn = (Rdn) rdnList.get(rdnList.size() - 1);
79.95 + Rdn rdn = rdnList.get(rdnList.size() - 1);
79.96 Attributes nameAttrs = rdn.toAttributes();
79.97
79.98 // Add attributes of RDN to attrs if not already there
79.99 - NamingEnumeration enum_ = nameAttrs.getAll();
79.100 + NamingEnumeration<? extends Attribute> enum_ = nameAttrs.getAll();
79.101 Attribute nameAttr;
79.102 while (enum_.hasMore()) {
79.103 - nameAttr = (Attribute) enum_.next();
79.104 + nameAttr = enum_.next();
79.105
79.106 // If attrs already has the attribute, don't change or add to it
79.107 if (attrs.get(nameAttr.getID()) == null) {
79.108 @@ -961,12 +960,12 @@
79.109 }
79.110
79.111
79.112 - private static boolean containsIgnoreCase(NamingEnumeration enumStr,
79.113 + private static boolean containsIgnoreCase(NamingEnumeration<String> enumStr,
79.114 String str) throws NamingException {
79.115 String strEntry;
79.116
79.117 while (enumStr.hasMore()) {
79.118 - strEntry = (String) enumStr.next();
79.119 + strEntry = enumStr.next();
79.120 if (strEntry.equalsIgnoreCase(str)) {
79.121 return true;
79.122 }
79.123 @@ -993,7 +992,7 @@
79.124 * Append the the second Vector onto the first Vector
79.125 * (v2 must be non-null)
79.126 */
79.127 - private static Vector appendVector(Vector v1, Vector v2) {
79.128 + private static <T> Vector<T> appendVector(Vector<T> v1, Vector<T> v2) {
79.129 if (v1 == null) {
79.130 v1 = v2;
79.131 } else {
79.132 @@ -1038,10 +1037,10 @@
79.133 // found it but got no attributes
79.134 attrs = new BasicAttributes(LdapClient.caseIgnore);
79.135 } else {
79.136 - LdapEntry entry = (LdapEntry)answer.entries.elementAt(0);
79.137 + LdapEntry entry = answer.entries.elementAt(0);
79.138 attrs = entry.attributes;
79.139
79.140 - Vector entryCtls = entry.respCtls; // retrieve entry controls
79.141 + Vector<Control> entryCtls = entry.respCtls; // retrieve entry controls
79.142 if (entryCtls != null) {
79.143 appendVector(respCtls, entryCtls); // concatenate controls
79.144 }
79.145 @@ -1097,7 +1096,7 @@
79.146 }
79.147 }
79.148
79.149 - protected NamingEnumeration c_list(Name name, Continuation cont)
79.150 + protected NamingEnumeration<NameClassPair> c_list(Name name, Continuation cont)
79.151 throws NamingException {
79.152 SearchControls cons = new SearchControls();
79.153 String[] classAttrs = new String[2];
79.154 @@ -1170,7 +1169,7 @@
79.155 }
79.156 }
79.157
79.158 - protected NamingEnumeration c_listBindings(Name name, Continuation cont)
79.159 + protected NamingEnumeration<Binding> c_listBindings(Name name, Continuation cont)
79.160 throws NamingException {
79.161
79.162 SearchControls cons = new SearchControls();
79.163 @@ -1198,7 +1197,7 @@
79.164
79.165 // process the referrals sequentially
79.166 while (true) {
79.167 -
79.168 + @SuppressWarnings("unchecked")
79.169 LdapReferralContext refCtx =
79.170 (LdapReferralContext)e.getReferralContext(envprops, bindCtls);
79.171
79.172 @@ -1220,16 +1219,14 @@
79.173 LdapBindingEnumeration res =
79.174 new LdapBindingEnumeration(this, answer, name, cont);
79.175
79.176 - res.setNamingException(
79.177 - (LimitExceededException)cont.fillInException(e));
79.178 + res.setNamingException(cont.fillInException(e));
79.179 return res;
79.180
79.181 } catch (PartialResultException e) {
79.182 LdapBindingEnumeration res =
79.183 new LdapBindingEnumeration(this, answer, name, cont);
79.184
79.185 - res.setNamingException(
79.186 - (PartialResultException)cont.fillInException(e));
79.187 + res.setNamingException(cont.fillInException(e));
79.188 return res;
79.189
79.190 } catch (NamingException e) {
79.191 @@ -1337,9 +1334,9 @@
79.192 }
79.193
79.194 // get attributes from result
79.195 - LdapEntry entry = (LdapEntry) answer.entries.elementAt(0);
79.196 -
79.197 - Vector entryCtls = entry.respCtls; // retrieve entry controls
79.198 + LdapEntry entry = answer.entries.elementAt(0);
79.199 +
79.200 + Vector<Control> entryCtls = entry.respCtls; // retrieve entry controls
79.201 if (entryCtls != null) {
79.202 appendVector(respCtls, entryCtls); // concatenate controls
79.203 }
79.204 @@ -1398,10 +1395,10 @@
79.205 int[] jmods = new int[attrs.size()];
79.206 Attribute[] jattrs = new Attribute[attrs.size()];
79.207
79.208 - NamingEnumeration ae = attrs.getAll();
79.209 + NamingEnumeration<? extends Attribute> ae = attrs.getAll();
79.210 for(int i = 0; i < jmods.length && ae.hasMore(); i++) {
79.211 jmods[i] = jmod_op;
79.212 - jattrs[i] = (Attribute)ae.next();
79.213 + jattrs[i] = ae.next();
79.214 }
79.215
79.216 LdapResult answer = clnt.modify(newDN, jmods, jattrs, reqCtls);
79.217 @@ -1565,7 +1562,7 @@
79.218 HierMemDirCtx objectClassCtx = new HierMemDirCtx();
79.219 DirContext objectClassDef;
79.220 String objectClassName;
79.221 - for (Enumeration objectClasses = objectClassAttr.getAll();
79.222 + for (Enumeration<?> objectClasses = objectClassAttr.getAll();
79.223 objectClasses.hasMoreElements(); ) {
79.224 objectClassName = (String)objectClasses.nextElement();
79.225 // %%% Should we fail if not found, or just continue?
79.226 @@ -1591,7 +1588,7 @@
79.227 private DirContext getSchemaTree(Name name) throws NamingException {
79.228 String subschemasubentry = getSchemaEntry(name, true);
79.229
79.230 - DirContext schemaTree = (DirContext)schemaTrees.get(subschemasubentry);
79.231 + DirContext schemaTree = schemaTrees.get(subschemasubentry);
79.232
79.233 if(schemaTree==null) {
79.234 if(debug){System.err.println("LdapCtx: building new schema tree " + this);}
79.235 @@ -1621,7 +1618,7 @@
79.236 false /*deref link */ );
79.237
79.238 Name sse = (new CompositeName()).add(subschemasubentry);
79.239 - NamingEnumeration results =
79.240 + NamingEnumeration<SearchResult> results =
79.241 searchAux(sse, "(objectClass=subschema)", constraints,
79.242 false, true, new Continuation());
79.243
79.244 @@ -1629,7 +1626,7 @@
79.245 throw new OperationNotSupportedException(
79.246 "Cannot get read subschemasubentry: " + subschemasubentry);
79.247 }
79.248 - SearchResult result = (SearchResult)results.next();
79.249 + SearchResult result = results.next();
79.250 results.close();
79.251
79.252 Object obj = result.getObject();
79.253 @@ -1674,7 +1671,7 @@
79.254 false /* returning obj */,
79.255 false /* deref link */);
79.256
79.257 - NamingEnumeration results;
79.258 + NamingEnumeration<SearchResult> results;
79.259 try {
79.260 results = searchAux(name, "objectclass=*", constraints, relative,
79.261 true, new Continuation());
79.262 @@ -1695,7 +1692,7 @@
79.263 "Requesting schema of nonexistent entry: " + name);
79.264 }
79.265
79.266 - SearchResult result = (SearchResult) results.next();
79.267 + SearchResult result = results.next();
79.268 results.close();
79.269
79.270 Attribute schemaEntryAttr =
79.271 @@ -1720,7 +1717,7 @@
79.272 // Set attributes to point to this context in case some one
79.273 // asked for their schema
79.274 void setParents(Attributes attrs, Name name) throws NamingException {
79.275 - NamingEnumeration ae = attrs.getAll();
79.276 + NamingEnumeration<? extends Attribute> ae = attrs.getAll();
79.277 while(ae.hasMore()) {
79.278 ((LdapAttribute) ae.next()).setParent(this, name);
79.279 }
79.280 @@ -1740,14 +1737,14 @@
79.281 }
79.282
79.283 // --------------------- Searches -----------------------------
79.284 - protected NamingEnumeration c_search(Name name,
79.285 + protected NamingEnumeration<SearchResult> c_search(Name name,
79.286 Attributes matchingAttributes,
79.287 Continuation cont)
79.288 throws NamingException {
79.289 return c_search(name, matchingAttributes, null, cont);
79.290 }
79.291
79.292 - protected NamingEnumeration c_search(Name name,
79.293 + protected NamingEnumeration<SearchResult> c_search(Name name,
79.294 Attributes matchingAttributes,
79.295 String[] attributesToReturn,
79.296 Continuation cont)
79.297 @@ -1764,7 +1761,7 @@
79.298 return c_search(name, filter, cons, cont);
79.299 }
79.300
79.301 - protected NamingEnumeration c_search(Name name,
79.302 + protected NamingEnumeration<SearchResult> c_search(Name name,
79.303 String filter,
79.304 SearchControls cons,
79.305 Continuation cont)
79.306 @@ -1773,7 +1770,7 @@
79.307 waitForReply, cont);
79.308 }
79.309
79.310 - protected NamingEnumeration c_search(Name name,
79.311 + protected NamingEnumeration<SearchResult> c_search(Name name,
79.312 String filterExpr,
79.313 Object[] filterArgs,
79.314 SearchControls cons,
79.315 @@ -1790,7 +1787,7 @@
79.316 }
79.317
79.318 // Used by NamingNotifier
79.319 - NamingEnumeration searchAux(Name name,
79.320 + NamingEnumeration<SearchResult> searchAux(Name name,
79.321 String filter,
79.322 SearchControls cons,
79.323 boolean relative,
79.324 @@ -1849,7 +1846,8 @@
79.325 processReturnCode(answer, name);
79.326 }
79.327 return new LdapSearchEnumeration(this, answer,
79.328 - fullyQualifiedName(name), args, cont);
79.329 + fullyQualifiedName(name),
79.330 + args, cont);
79.331
79.332 } catch (LdapReferralException e) {
79.333 if (handleReferrals == LdapClient.LDAP_REF_THROW)
79.334 @@ -1858,8 +1856,9 @@
79.335 // process the referrals sequentially
79.336 while (true) {
79.337
79.338 - LdapReferralContext refCtx =
79.339 - (LdapReferralContext)e.getReferralContext(envprops, bindCtls);
79.340 + @SuppressWarnings("unchecked")
79.341 + LdapReferralContext refCtx = (LdapReferralContext)
79.342 + e.getReferralContext(envprops, bindCtls);
79.343
79.344 // repeat the original operation at the new context
79.345 try {
79.346 @@ -2143,16 +2142,18 @@
79.347 /**
79.348 * Override with noncloning version.
79.349 */
79.350 - protected Hashtable p_getEnvironment() {
79.351 + protected Hashtable<String, Object> p_getEnvironment() {
79.352 return envprops;
79.353 }
79.354
79.355 - public Hashtable getEnvironment() throws NamingException {
79.356 + @SuppressWarnings("unchecked") // clone()
79.357 + public Hashtable<String, Object> getEnvironment() throws NamingException {
79.358 return (envprops == null
79.359 - ? new Hashtable(5, 0.75f)
79.360 - : (Hashtable)envprops.clone());
79.361 + ? new Hashtable<String, Object>(5, 0.75f)
79.362 + : (Hashtable<String, Object>)envprops.clone());
79.363 }
79.364
79.365 + @SuppressWarnings("unchecked") // clone()
79.366 public Object removeFromEnvironment(String propName)
79.367 throws NamingException {
79.368
79.369 @@ -2160,58 +2161,74 @@
79.370 if (envprops == null || envprops.get(propName) == null) {
79.371 return null;
79.372 }
79.373 -
79.374 - if (propName.equals(REF_SEPARATOR)) {
79.375 - addrEncodingSeparator = DEFAULT_REF_SEPARATOR;
79.376 - } else if (propName.equals(TYPES_ONLY)) {
79.377 - typesOnly = DEFAULT_TYPES_ONLY;
79.378 - } else if (propName.equals(DELETE_RDN)) {
79.379 - deleteRDN = DEFAULT_DELETE_RDN;
79.380 - } else if (propName.equals(DEREF_ALIASES)) {
79.381 - derefAliases = DEFAULT_DEREF_ALIASES;
79.382 - } else if (propName.equals(Context.BATCHSIZE)) {
79.383 - batchSize = DEFAULT_BATCH_SIZE;
79.384 - } else if (propName.equals(REFERRAL_LIMIT)) {
79.385 - referralHopLimit = DEFAULT_REFERRAL_LIMIT;
79.386 - } else if (propName.equals(Context.REFERRAL)) {
79.387 - setReferralMode(null, true);
79.388 - } else if (propName.equals(BINARY_ATTRIBUTES)) {
79.389 - setBinaryAttributes(null);
79.390 - } else if (propName.equals(CONNECT_TIMEOUT)) {
79.391 - connectTimeout = -1;
79.392 - } else if (propName.equals(READ_TIMEOUT)) {
79.393 - readTimeout = -1;
79.394 - } else if (propName.equals(WAIT_FOR_REPLY)) {
79.395 - waitForReply = true;
79.396 - } else if (propName.equals(REPLY_QUEUE_SIZE)) {
79.397 - replyQueueSize = -1;
79.398 -
79.399 -// The following properties affect the connection
79.400 -
79.401 - } else if (propName.equals(Context.SECURITY_PROTOCOL)) {
79.402 - closeConnection(SOFT_CLOSE);
79.403 - // De-activate SSL and reset the context's url and port number
79.404 - if (useSsl && !hasLdapsScheme) {
79.405 - useSsl = false;
79.406 - url = null;
79.407 - if (useDefaultPortNumber) {
79.408 - port_number = DEFAULT_PORT;
79.409 + switch (propName) {
79.410 + case REF_SEPARATOR:
79.411 + addrEncodingSeparator = DEFAULT_REF_SEPARATOR;
79.412 + break;
79.413 + case TYPES_ONLY:
79.414 + typesOnly = DEFAULT_TYPES_ONLY;
79.415 + break;
79.416 + case DELETE_RDN:
79.417 + deleteRDN = DEFAULT_DELETE_RDN;
79.418 + break;
79.419 + case DEREF_ALIASES:
79.420 + derefAliases = DEFAULT_DEREF_ALIASES;
79.421 + break;
79.422 + case Context.BATCHSIZE:
79.423 + batchSize = DEFAULT_BATCH_SIZE;
79.424 + break;
79.425 + case REFERRAL_LIMIT:
79.426 + referralHopLimit = DEFAULT_REFERRAL_LIMIT;
79.427 + break;
79.428 + case Context.REFERRAL:
79.429 + setReferralMode(null, true);
79.430 + break;
79.431 + case BINARY_ATTRIBUTES:
79.432 + setBinaryAttributes(null);
79.433 + break;
79.434 + case CONNECT_TIMEOUT:
79.435 + connectTimeout = -1;
79.436 + break;
79.437 + case READ_TIMEOUT:
79.438 + readTimeout = -1;
79.439 + break;
79.440 + case WAIT_FOR_REPLY:
79.441 + waitForReply = true;
79.442 + break;
79.443 + case REPLY_QUEUE_SIZE:
79.444 + replyQueueSize = -1;
79.445 + break;
79.446 +
79.447 + // The following properties affect the connection
79.448 +
79.449 + case Context.SECURITY_PROTOCOL:
79.450 + closeConnection(SOFT_CLOSE);
79.451 + // De-activate SSL and reset the context's url and port number
79.452 + if (useSsl && !hasLdapsScheme) {
79.453 + useSsl = false;
79.454 + url = null;
79.455 + if (useDefaultPortNumber) {
79.456 + port_number = DEFAULT_PORT;
79.457 + }
79.458 }
79.459 - }
79.460 - } else if (propName.equals(VERSION) ||
79.461 - propName.equals(SOCKET_FACTORY)) {
79.462 - closeConnection(SOFT_CLOSE);
79.463 - } else if(propName.equals(Context.SECURITY_AUTHENTICATION) ||
79.464 - propName.equals(Context.SECURITY_PRINCIPAL) ||
79.465 - propName.equals(Context.SECURITY_CREDENTIALS)) {
79.466 - sharable = false;
79.467 + break;
79.468 + case VERSION:
79.469 + case SOCKET_FACTORY:
79.470 + closeConnection(SOFT_CLOSE);
79.471 + break;
79.472 + case Context.SECURITY_AUTHENTICATION:
79.473 + case Context.SECURITY_PRINCIPAL:
79.474 + case Context.SECURITY_CREDENTIALS:
79.475 + sharable = false;
79.476 + break;
79.477 }
79.478
79.479 // Update environment; reconnection will use new props
79.480 - envprops = (Hashtable)envprops.clone();
79.481 + envprops = (Hashtable<String, Object>)envprops.clone();
79.482 return envprops.remove(propName);
79.483 }
79.484
79.485 + @SuppressWarnings("unchecked") // clone()
79.486 public Object addToEnvironment(String propName, Object propVal)
79.487 throws NamingException {
79.488
79.489 @@ -2219,57 +2236,72 @@
79.490 if (propVal == null) {
79.491 return removeFromEnvironment(propName);
79.492 }
79.493 -
79.494 - if (propName.equals(REF_SEPARATOR)) {
79.495 - setRefSeparator((String)propVal);
79.496 - } else if (propName.equals(TYPES_ONLY)) {
79.497 - setTypesOnly((String)propVal);
79.498 - } else if (propName.equals(DELETE_RDN)) {
79.499 - setDeleteRDN((String)propVal);
79.500 - } else if (propName.equals(DEREF_ALIASES)) {
79.501 - setDerefAliases((String)propVal);
79.502 - } else if (propName.equals(Context.BATCHSIZE)) {
79.503 - setBatchSize((String)propVal);
79.504 - } else if (propName.equals(REFERRAL_LIMIT)) {
79.505 - setReferralLimit((String)propVal);
79.506 - } else if (propName.equals(Context.REFERRAL)) {
79.507 - setReferralMode((String)propVal, true);
79.508 - } else if (propName.equals(BINARY_ATTRIBUTES)) {
79.509 - setBinaryAttributes((String)propVal);
79.510 - } else if (propName.equals(CONNECT_TIMEOUT)) {
79.511 - setConnectTimeout((String)propVal);
79.512 - } else if (propName.equals(READ_TIMEOUT)) {
79.513 - setReadTimeout((String)propVal);
79.514 - } else if (propName.equals(WAIT_FOR_REPLY)) {
79.515 - setWaitForReply((String)propVal);
79.516 - } else if (propName.equals(REPLY_QUEUE_SIZE)) {
79.517 - setReplyQueueSize((String)propVal);
79.518 -
79.519 -// The following properties affect the connection
79.520 -
79.521 - } else if (propName.equals(Context.SECURITY_PROTOCOL)) {
79.522 - closeConnection(SOFT_CLOSE);
79.523 - // Activate SSL and reset the context's url and port number
79.524 - if ("ssl".equals(propVal)) {
79.525 - useSsl = true;
79.526 - url = null;
79.527 - if (useDefaultPortNumber) {
79.528 - port_number = DEFAULT_SSL_PORT;
79.529 + switch (propName) {
79.530 + case REF_SEPARATOR:
79.531 + setRefSeparator((String)propVal);
79.532 + break;
79.533 + case TYPES_ONLY:
79.534 + setTypesOnly((String)propVal);
79.535 + break;
79.536 + case DELETE_RDN:
79.537 + setDeleteRDN((String)propVal);
79.538 + break;
79.539 + case DEREF_ALIASES:
79.540 + setDerefAliases((String)propVal);
79.541 + break;
79.542 + case Context.BATCHSIZE:
79.543 + setBatchSize((String)propVal);
79.544 + break;
79.545 + case REFERRAL_LIMIT:
79.546 + setReferralLimit((String)propVal);
79.547 + break;
79.548 + case Context.REFERRAL:
79.549 + setReferralMode((String)propVal, true);
79.550 + break;
79.551 + case BINARY_ATTRIBUTES:
79.552 + setBinaryAttributes((String)propVal);
79.553 + break;
79.554 + case CONNECT_TIMEOUT:
79.555 + setConnectTimeout((String)propVal);
79.556 + break;
79.557 + case READ_TIMEOUT:
79.558 + setReadTimeout((String)propVal);
79.559 + break;
79.560 + case WAIT_FOR_REPLY:
79.561 + setWaitForReply((String)propVal);
79.562 + break;
79.563 + case REPLY_QUEUE_SIZE:
79.564 + setReplyQueueSize((String)propVal);
79.565 + break;
79.566 +
79.567 + // The following properties affect the connection
79.568 +
79.569 + case Context.SECURITY_PROTOCOL:
79.570 + closeConnection(SOFT_CLOSE);
79.571 + // Activate SSL and reset the context's url and port number
79.572 + if ("ssl".equals(propVal)) {
79.573 + useSsl = true;
79.574 + url = null;
79.575 + if (useDefaultPortNumber) {
79.576 + port_number = DEFAULT_SSL_PORT;
79.577 + }
79.578 }
79.579 - }
79.580 - } else if (propName.equals(VERSION) ||
79.581 - propName.equals(SOCKET_FACTORY)) {
79.582 - closeConnection(SOFT_CLOSE);
79.583 - } else if (propName.equals(Context.SECURITY_AUTHENTICATION) ||
79.584 - propName.equals(Context.SECURITY_PRINCIPAL) ||
79.585 - propName.equals(Context.SECURITY_CREDENTIALS)) {
79.586 - sharable = false;
79.587 + break;
79.588 + case VERSION:
79.589 + case SOCKET_FACTORY:
79.590 + closeConnection(SOFT_CLOSE);
79.591 + break;
79.592 + case Context.SECURITY_AUTHENTICATION:
79.593 + case Context.SECURITY_PRINCIPAL:
79.594 + case Context.SECURITY_CREDENTIALS:
79.595 + sharable = false;
79.596 + break;
79.597 }
79.598
79.599 // Update environment; reconnection will use new props
79.600 envprops = (envprops == null
79.601 - ? new Hashtable(5, 0.75f)
79.602 - : (Hashtable)envprops.clone());
79.603 + ? new Hashtable<String, Object>(5, 0.75f)
79.604 + : (Hashtable<String, Object>)envprops.clone());
79.605 return envprops.put(propName, propVal);
79.606 }
79.607
79.608 @@ -2380,15 +2412,19 @@
79.609 private void setReferralMode(String ref, boolean update) {
79.610 // First determine the referral mode
79.611 if (ref != null) {
79.612 - if (ref.equals("follow")) {
79.613 - handleReferrals = LdapClient.LDAP_REF_FOLLOW;
79.614 - } else if (ref.equals("throw")) {
79.615 - handleReferrals = LdapClient.LDAP_REF_THROW;
79.616 - } else if (ref.equals("ignore")) {
79.617 - handleReferrals = LdapClient.LDAP_REF_IGNORE;
79.618 - } else {
79.619 - throw new IllegalArgumentException(
79.620 - "Illegal value for " + Context.REFERRAL + " property.");
79.621 + switch (ref) {
79.622 + case "follow":
79.623 + handleReferrals = LdapClient.LDAP_REF_FOLLOW;
79.624 + break;
79.625 + case "throw":
79.626 + handleReferrals = LdapClient.LDAP_REF_THROW;
79.627 + break;
79.628 + case "ignore":
79.629 + handleReferrals = LdapClient.LDAP_REF_IGNORE;
79.630 + break;
79.631 + default:
79.632 + throw new IllegalArgumentException(
79.633 + "Illegal value for " + Context.REFERRAL + " property.");
79.634 }
79.635 } else {
79.636 handleReferrals = DEFAULT_REFERRAL_MODE;
79.637 @@ -2411,17 +2447,22 @@
79.638 */
79.639 private void setDerefAliases(String deref) {
79.640 if (deref != null) {
79.641 - if (deref.equals("never")) {
79.642 - derefAliases = 0; // never de-reference aliases
79.643 - } else if (deref.equals("searching")) {
79.644 - derefAliases = 1; // de-reference aliases during searching
79.645 - } else if (deref.equals("finding")) {
79.646 - derefAliases = 2; // de-reference during name resolution
79.647 - } else if (deref.equals("always")) {
79.648 - derefAliases = 3; // always de-reference aliases
79.649 - } else {
79.650 - throw new IllegalArgumentException("Illegal value for " +
79.651 - DEREF_ALIASES + " property.");
79.652 + switch (deref) {
79.653 + case "never":
79.654 + derefAliases = 0; // never de-reference aliases
79.655 + break;
79.656 + case "searching":
79.657 + derefAliases = 1; // de-reference aliases during searching
79.658 + break;
79.659 + case "finding":
79.660 + derefAliases = 2; // de-reference during name resolution
79.661 + break;
79.662 + case "always":
79.663 + derefAliases = 3; // always de-reference aliases
79.664 + break;
79.665 + default:
79.666 + throw new IllegalArgumentException("Illegal value for " +
79.667 + DEREF_ALIASES + " property.");
79.668 }
79.669 } else {
79.670 derefAliases = DEFAULT_DEREF_ALIASES;
79.671 @@ -2514,8 +2555,10 @@
79.672 * <ldapurls> ::= <separator> <ldapurl> | <ldapurls>
79.673 * <separator> ::= ASCII linefeed character (0x0a)
79.674 * <ldapurl> ::= LDAP URL format (RFC 1959)
79.675 + *
79.676 + * Returns a Vector of single-String Vectors.
79.677 */
79.678 - private static Vector extractURLs(String refString) {
79.679 + private static Vector<Vector<String>> extractURLs(String refString) {
79.680
79.681 int separator = 0;
79.682 int urlCount = 0;
79.683 @@ -2526,17 +2569,21 @@
79.684 urlCount++;
79.685 }
79.686
79.687 - Vector referrals = new Vector(urlCount);
79.688 + Vector<Vector<String>> referrals = new Vector<>(urlCount);
79.689 int iURL;
79.690 int i = 0;
79.691
79.692 separator = refString.indexOf('\n');
79.693 iURL = separator + 1;
79.694 while ((separator = refString.indexOf('\n', iURL)) >= 0) {
79.695 - referrals.addElement(refString.substring(iURL, separator));
79.696 + Vector<String> referral = new Vector<>(1);
79.697 + referral.addElement(refString.substring(iURL, separator));
79.698 + referrals.addElement(referral);
79.699 iURL = separator + 1;
79.700 }
79.701 - referrals.addElement(refString.substring(iURL));
79.702 + Vector<String> referral = new Vector<>(1);
79.703 + referral.addElement(refString.substring(iURL));
79.704 + referrals.addElement(referral);
79.705
79.706 return referrals;
79.707 }
79.708 @@ -2549,9 +2596,9 @@
79.709 if (attrIds == null) {
79.710 binaryAttrs = null;
79.711 } else {
79.712 - binaryAttrs = new Hashtable(11, 0.75f);
79.713 + binaryAttrs = new Hashtable<>(11, 0.75f);
79.714 StringTokenizer tokens =
79.715 - new StringTokenizer(attrIds.toLowerCase(), " ");
79.716 + new StringTokenizer(attrIds.toLowerCase(Locale.ENGLISH), " ");
79.717
79.718 while (tokens.hasMoreTokens()) {
79.719 binaryAttrs.put(tokens.nextToken(), Boolean.TRUE);
79.720 @@ -2601,11 +2648,12 @@
79.721 */
79.722 }
79.723
79.724 + @SuppressWarnings("unchecked") // clone()
79.725 public void reconnect(Control[] connCtls) throws NamingException {
79.726 // Update environment
79.727 envprops = (envprops == null
79.728 - ? new Hashtable(5, 0.75f)
79.729 - : (Hashtable)envprops.clone());
79.730 + ? new Hashtable<String, Object>(5, 0.75f)
79.731 + : (Hashtable<String, Object>)envprops.clone());
79.732
79.733 if (connCtls == null) {
79.734 envprops.remove(BIND_CONTROLS);
79.735 @@ -2631,7 +2679,7 @@
79.736 }
79.737
79.738 // reset the cache before a new connection is established
79.739 - schemaTrees = new Hashtable(11, 0.75f);
79.740 + schemaTrees = new Hashtable<>(11, 0.75f);
79.741 connect(startTLS);
79.742
79.743 } else if (!sharable || startTLS) {
79.744 @@ -2644,7 +2692,7 @@
79.745 }
79.746 }
79.747 // reset the cache before a new connection is established
79.748 - schemaTrees = new Hashtable(11, 0.75f);
79.749 + schemaTrees = new Hashtable<>(11, 0.75f);
79.750 connect(startTLS);
79.751 }
79.752
79.753 @@ -2846,7 +2894,7 @@
79.754 }
79.755
79.756 protected void processReturnCode(LdapResult res, Name resolvedName,
79.757 - Object resolvedObj, Name remainName, Hashtable envprops, String fullDN)
79.758 + Object resolvedObj, Name remainName, Hashtable<?,?> envprops, String fullDN)
79.759 throws NamingException {
79.760
79.761 String msg = LdapClient.getErrorMessage(res.status, res.errorMessage);
79.762 @@ -2880,7 +2928,7 @@
79.763 r = new LdapReferralException(resolvedName, resolvedObj,
79.764 remainName, msg, envprops, fullDN, handleReferrals,
79.765 reqCtls);
79.766 - r.setReferralInfo((Vector)res.referrals.elementAt(i), true);
79.767 + r.setReferralInfo(res.referrals.elementAt(i), true);
79.768
79.769 if (hopCount > 1) {
79.770 r.setHopCount(hopCount);
79.771 @@ -2927,7 +2975,7 @@
79.772 r = new LdapReferralException(resolvedName, resolvedObj, remainName,
79.773 msg, envprops, fullDN, handleReferrals, reqCtls);
79.774 // only one set of URLs is present
79.775 - r.setReferralInfo((Vector)res.referrals.elementAt(0), false);
79.776 + r.setReferralInfo(res.referrals.elementAt(0), false);
79.777
79.778 if (hopCount > 1) {
79.779 r.setHopCount(hopCount);
79.780 @@ -2995,10 +3043,10 @@
79.781 * If 1 referral and 0 entries is received then
79.782 * assume name resolution has not yet completed.
79.783 */
79.784 - if (((res.entries == null) || (res.entries.size() == 0)) &&
79.785 + if (((res.entries == null) || (res.entries.isEmpty())) &&
79.786 (res.referrals.size() == 1)) {
79.787
79.788 - r.setReferralInfo((Vector)res.referrals, false);
79.789 + r.setReferralInfo(res.referrals, false);
79.790
79.791 // check the hop limit
79.792 if (hopCount > referralHopLimit) {
79.793 @@ -3284,9 +3332,9 @@
79.794
79.795 /**
79.796 * Narrow controls using own default factory and ControlFactory.
79.797 - * @param ctls A non-null Vector
79.798 + * @param ctls A non-null Vector<Control>
79.799 */
79.800 - Control[] convertControls(Vector ctls) throws NamingException {
79.801 + Control[] convertControls(Vector<Control> ctls) throws NamingException {
79.802 int count = ctls.size();
79.803
79.804 if (count == 0) {
79.805 @@ -3298,12 +3346,12 @@
79.806 for (int i = 0; i < count; i++) {
79.807 // Try own factory first
79.808 controls[i] = myResponseControlFactory.getControlInstance(
79.809 - (Control)ctls.elementAt(i));
79.810 + ctls.elementAt(i));
79.811
79.812 // Try assigned factories if own produced null
79.813 if (controls[i] == null) {
79.814 controls[i] = ControlFactory.getControlInstance(
79.815 - (Control)ctls.elementAt(i), this, envprops);
79.816 + ctls.elementAt(i), this, envprops);
79.817 }
79.818 }
79.819 return controls;
79.820 @@ -3448,7 +3496,7 @@
79.821 if (nm.size() > 1) {
79.822 throw new InvalidNameException(
79.823 "Target cannot span multiple namespaces: " + nm);
79.824 - } else if (nm.size() == 0) {
79.825 + } else if (nm.isEmpty()) {
79.826 return "";
79.827 } else {
79.828 return nm.get(0);
80.1 --- a/src/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java Thu Sep 01 13:54:38 2011 -0700
80.2 +++ b/src/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java Mon Sep 05 23:58:19 2011 -0700
80.3 @@ -1,5 +1,5 @@
80.4 /*
80.5 - * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
80.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
80.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
80.8 *
80.9 * This code is free software; you can redistribute it and/or modify it
80.10 @@ -28,7 +28,6 @@
80.11 import java.util.Hashtable;
80.12 import java.util.Vector;
80.13 import java.util.Enumeration;
80.14 -import java.net.MalformedURLException;
80.15
80.16 import javax.naming.*;
80.17 import javax.naming.directory.*;
80.18 @@ -119,9 +118,9 @@
80.19 int size = 0; // number of URLs
80.20 String[] urls = new String[ref.size()];
80.21
80.22 - Enumeration addrs = ref.getAll();
80.23 + Enumeration<RefAddr> addrs = ref.getAll();
80.24 while (addrs.hasMoreElements()) {
80.25 - RefAddr addr = (RefAddr)addrs.nextElement();
80.26 + RefAddr addr = addrs.nextElement();
80.27
80.28 if ((addr instanceof StringRefAddr) &&
80.29 addr.getType().equals(ADDRESS_TYPE)) {
80.30 @@ -145,7 +144,7 @@
80.31
80.32 // ------------ Utilities used by other classes ----------------
80.33
80.34 - public static DirContext getLdapCtxInstance(Object urlInfo, Hashtable env)
80.35 + public static DirContext getLdapCtxInstance(Object urlInfo, Hashtable<?,?> env)
80.36 throws NamingException {
80.37
80.38 if (urlInfo instanceof String) {
80.39 @@ -158,7 +157,7 @@
80.40 }
80.41 }
80.42
80.43 - private static DirContext getUsingURL(String url, Hashtable env)
80.44 + private static DirContext getUsingURL(String url, Hashtable<?,?> env)
80.45 throws NamingException {
80.46 DirContext ctx = null;
80.47 LdapURL ldapUrl = new LdapURL(url);
80.48 @@ -202,7 +201,7 @@
80.49 * If all URLs fail, throw one of the exceptions arbitrarily.
80.50 * Not pretty, but potentially more informative than returning null.
80.51 */
80.52 - private static DirContext getUsingURLs(String[] urls, Hashtable env)
80.53 + private static DirContext getUsingURLs(String[] urls, Hashtable<?,?> env)
80.54 throws NamingException {
80.55 NamingException ne = null;
80.56 DirContext ctx = null;
80.57 @@ -221,8 +220,8 @@
80.58 /**
80.59 * Used by Obj and obj/RemoteToAttrs too so must be public
80.60 */
80.61 - public static Attribute createTypeNameAttr(Class cl) {
80.62 - Vector v = new Vector(10);
80.63 + public static Attribute createTypeNameAttr(Class<?> cl) {
80.64 + Vector<String> v = new Vector<>(10);
80.65 String[] types = getTypeNames(cl, v);
80.66 if (types.length > 0) {
80.67 BasicAttribute tAttr =
80.68 @@ -235,7 +234,7 @@
80.69 return null;
80.70 }
80.71
80.72 - private static String[] getTypeNames(Class currentClass, Vector v) {
80.73 + private static String[] getTypeNames(Class<?> currentClass, Vector<String> v) {
80.74
80.75 getClassesAux(currentClass, v);
80.76 Class[] members = currentClass.getInterfaces();
80.77 @@ -244,13 +243,14 @@
80.78 }
80.79 String[] ret = new String[v.size()];
80.80 int i = 0;
80.81 - for (java.util.Enumeration e = v.elements(); e.hasMoreElements();) {
80.82 - ret[i++] = (String)e.nextElement();
80.83 +
80.84 + for (String name : v) {
80.85 + ret[i++] = name;
80.86 }
80.87 return ret;
80.88 }
80.89
80.90 - private static void getClassesAux(Class currentClass, Vector v) {
80.91 + private static void getClassesAux(Class<?> currentClass, Vector<String> v) {
80.92 if (!v.contains(currentClass.getName())) {
80.93 v.addElement(currentClass.getName());
80.94 }
81.1 --- a/src/share/classes/com/sun/jndi/ldap/LdapEntry.java Thu Sep 01 13:54:38 2011 -0700
81.2 +++ b/src/share/classes/com/sun/jndi/ldap/LdapEntry.java Mon Sep 05 23:58:19 2011 -0700
81.3 @@ -1,5 +1,5 @@
81.4 /*
81.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
81.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
81.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
81.8 *
81.9 * This code is free software; you can redistribute it and/or modify it
81.10 @@ -27,7 +27,7 @@
81.11
81.12 import java.util.Vector;
81.13 import javax.naming.directory.Attributes;
81.14 -import javax.naming.directory.Attribute;
81.15 +import javax.naming.ldap.Control;
81.16
81.17 /**
81.18 * A holder for an LDAP entry read from an LDAP server.
81.19 @@ -38,14 +38,14 @@
81.20 final class LdapEntry {
81.21 String DN;
81.22 Attributes attributes;
81.23 - Vector respCtls = null;
81.24 + Vector<Control> respCtls = null;
81.25
81.26 LdapEntry(String DN, Attributes attrs) {
81.27 this.DN = DN;
81.28 this.attributes = attrs;
81.29 }
81.30
81.31 - LdapEntry(String DN, Attributes attrs, Vector respCtls) {
81.32 + LdapEntry(String DN, Attributes attrs, Vector<Control> respCtls) {
81.33 this.DN = DN;
81.34 this.attributes = attrs;
81.35 this.respCtls = respCtls;
82.1 --- a/src/share/classes/com/sun/jndi/ldap/LdapName.java Thu Sep 01 13:54:38 2011 -0700
82.2 +++ b/src/share/classes/com/sun/jndi/ldap/LdapName.java Mon Sep 05 23:58:19 2011 -0700
82.3 @@ -1,5 +1,5 @@
82.4 /*
82.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
82.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
82.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
82.8 *
82.9 * This code is free software; you can redistribute it and/or modify it
82.10 @@ -28,6 +28,7 @@
82.11
82.12 import java.util.Enumeration;
82.13 import java.util.Vector;
82.14 +import java.util.Locale;
82.15
82.16 import javax.naming.*;
82.17 import javax.naming.directory.Attributes;
82.18 @@ -78,7 +79,7 @@
82.19 public final class LdapName implements Name {
82.20
82.21 private transient String unparsed; // if non-null, the DN in unparsed form
82.22 - private transient Vector rdns; // parsed name components
82.23 + private transient Vector<Rdn> rdns; // parsed name components
82.24 private transient boolean valuesCaseSensitive = false;
82.25
82.26 /**
82.27 @@ -97,9 +98,10 @@
82.28 * Constructs an LDAP name given its parsed components and, optionally
82.29 * (if "name" is not null), the unparsed DN.
82.30 */
82.31 - private LdapName(String name, Vector rdns) {
82.32 + @SuppressWarnings("unchecked") // clone()
82.33 + private LdapName(String name, Vector<Rdn> rdns) {
82.34 unparsed = name;
82.35 - this.rdns = (Vector)rdns.clone();
82.36 + this.rdns = (Vector<Rdn>)rdns.clone();
82.37 }
82.38
82.39 /*
82.40 @@ -107,9 +109,9 @@
82.41 * of "rdns" in the range [beg,end)) and, optionally
82.42 * (if "name" is not null), the unparsed DN.
82.43 */
82.44 - private LdapName(String name, Vector rdns, int beg, int end) {
82.45 + private LdapName(String name, Vector<Rdn> rdns, int beg, int end) {
82.46 unparsed = name;
82.47 - this.rdns = new Vector();
82.48 + this.rdns = new Vector<>();
82.49 for (int i = beg; i < end; i++) {
82.50 this.rdns.addElement(rdns.elementAt(i));
82.51 }
82.52 @@ -130,7 +132,7 @@
82.53 if (i < rdns.size() - 1) {
82.54 buf.append(',');
82.55 }
82.56 - Rdn rdn = (Rdn)rdns.elementAt(i);
82.57 + Rdn rdn = rdns.elementAt(i);
82.58 buf.append(rdn);
82.59 }
82.60
82.61 @@ -155,8 +157,8 @@
82.62 int minSize = Math.min(rdns.size(), that.rdns.size());
82.63 for (int i = 0 ; i < minSize; i++) {
82.64 // Compare a single pair of RDNs.
82.65 - Rdn rdn1 = (Rdn)rdns.elementAt(i);
82.66 - Rdn rdn2 = (Rdn)that.rdns.elementAt(i);
82.67 + Rdn rdn1 = rdns.elementAt(i);
82.68 + Rdn rdn2 = that.rdns.elementAt(i);
82.69
82.70 int diff = rdn1.compareTo(rdn2);
82.71 if (diff != 0) {
82.72 @@ -172,7 +174,7 @@
82.73
82.74 // For each RDN...
82.75 for (int i = 0; i < rdns.size(); i++) {
82.76 - Rdn rdn = (Rdn)rdns.elementAt(i);
82.77 + Rdn rdn = rdns.elementAt(i);
82.78 hash += rdn.hashCode();
82.79 }
82.80 return hash;
82.81 @@ -186,14 +188,14 @@
82.82 return rdns.isEmpty();
82.83 }
82.84
82.85 - public Enumeration getAll() {
82.86 - final Enumeration enum_ = rdns.elements();
82.87 + public Enumeration<String> getAll() {
82.88 + final Enumeration<Rdn> enum_ = rdns.elements();
82.89
82.90 - return new Enumeration () {
82.91 + return new Enumeration<String>() {
82.92 public boolean hasMoreElements() {
82.93 return enum_.hasMoreElements();
82.94 }
82.95 - public Object nextElement() {
82.96 + public String nextElement() {
82.97 return enum_.nextElement().toString();
82.98 }
82.99 };
82.100 @@ -254,7 +256,7 @@
82.101 Rdn rdn;
82.102 if (n instanceof LdapName) {
82.103 LdapName ln = (LdapName)n;
82.104 - rdn = (Rdn)ln.rdns.elementAt(i - beg);
82.105 + rdn = ln.rdns.elementAt(i - beg);
82.106 } else {
82.107 String rdnString = n.get(i - beg);
82.108 try {
82.109 @@ -286,9 +288,9 @@
82.110 rdns.insertElementAt(s.rdns.elementAt(i), pos++);
82.111 }
82.112 } else {
82.113 - Enumeration comps = suffix.getAll();
82.114 + Enumeration<String> comps = suffix.getAll();
82.115 while (comps.hasMoreElements()) {
82.116 - DnParser p = new DnParser((String)comps.nextElement(),
82.117 + DnParser p = new DnParser(comps.nextElement(),
82.118 valuesCaseSensitive);
82.119 rdns.insertElementAt(p.getRdn(), pos++);
82.120 }
82.121 @@ -406,9 +408,9 @@
82.122 /*
82.123 * Parses the DN, returning a Vector of its RDNs.
82.124 */
82.125 - Vector getDn() throws InvalidNameException {
82.126 + Vector<Rdn> getDn() throws InvalidNameException {
82.127 cur = 0;
82.128 - Vector rdns = new Vector(len / 3 + 10); // leave room for growth
82.129 + Vector<Rdn> rdns = new Vector<>(len / 3 + 10); // leave room for growth
82.130
82.131 if (len == 0) {
82.132 return rdns;
82.133 @@ -595,7 +597,7 @@
82.134 * A vector of the TypeAndValue elements of this Rdn.
82.135 * It is sorted to facilitate set operations.
82.136 */
82.137 - private final Vector tvs = new Vector();
82.138 + private final Vector<TypeAndValue> tvs = new Vector<>();
82.139
82.140 void add(TypeAndValue tv) {
82.141
82.142 @@ -636,7 +638,7 @@
82.143 int minSize = Math.min(tvs.size(), that.tvs.size());
82.144 for (int i = 0; i < minSize; i++) {
82.145 // Compare a single pair of type/value pairs.
82.146 - TypeAndValue tv = (TypeAndValue)tvs.elementAt(i);
82.147 + TypeAndValue tv = tvs.elementAt(i);
82.148 int diff = tv.compareTo(that.tvs.elementAt(i));
82.149 if (diff != 0) {
82.150 return diff;
82.151 @@ -662,7 +664,7 @@
82.152 Attribute attr;
82.153
82.154 for (int i = 0; i < tvs.size(); i++) {
82.155 - tv = (TypeAndValue) tvs.elementAt(i);
82.156 + tv = tvs.elementAt(i);
82.157 if ((attr = attrs.get(tv.getType())) == null) {
82.158 attrs.put(tv.getType(), tv.getUnescapedValue());
82.159 } else {
82.160 @@ -706,7 +708,7 @@
82.161
82.162 TypeAndValue that = (TypeAndValue)obj;
82.163
82.164 - int diff = type.toUpperCase().compareTo(that.type.toUpperCase());
82.165 + int diff = type.compareToIgnoreCase(that.type);
82.166 if (diff != 0) {
82.167 return diff;
82.168 }
82.169 @@ -729,7 +731,7 @@
82.170
82.171 public int hashCode() {
82.172 // If two objects are equal, their hash codes must match.
82.173 - return (type.toUpperCase().hashCode() +
82.174 + return (type.toUpperCase(Locale.ENGLISH).hashCode() +
82.175 getValueComparable().hashCode());
82.176 }
82.177
82.178 @@ -763,11 +765,12 @@
82.179
82.180 // cache result
82.181 if (binary) {
82.182 - comparable = value.toUpperCase();
82.183 + comparable = value.toUpperCase(Locale.ENGLISH);
82.184 } else {
82.185 comparable = (String)unescapeValue(value);
82.186 if (!valueCaseSensitive) {
82.187 - comparable = comparable.toUpperCase(); // ignore case
82.188 + // ignore case
82.189 + comparable = comparable.toUpperCase(Locale.ENGLISH);
82.190 }
82.191 }
82.192 return comparable;
82.193 @@ -835,7 +838,7 @@
82.194 buf.append(Character.forDigit(0xF & b, 16));
82.195 }
82.196
82.197 - return (new String(buf)).toUpperCase();
82.198 + return (new String(buf)).toUpperCase(Locale.ENGLISH);
82.199 }
82.200
82.201 /*
83.1 --- a/src/share/classes/com/sun/jndi/ldap/LdapNamingEnumeration.java Thu Sep 01 13:54:38 2011 -0700
83.2 +++ b/src/share/classes/com/sun/jndi/ldap/LdapNamingEnumeration.java Mon Sep 05 23:58:19 2011 -0700
83.3 @@ -1,5 +1,5 @@
83.4 /*
83.5 - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
83.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
83.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
83.8 *
83.9 * This code is free software; you can redistribute it and/or modify it
83.10 @@ -27,267 +27,25 @@
83.11
83.12 import javax.naming.*;
83.13 import javax.naming.directory.*;
83.14 -import javax.naming.spi.*;
83.15
83.16 import com.sun.jndi.toolkit.ctx.Continuation;
83.17 -import java.util.NoSuchElementException;
83.18 import java.util.Vector;
83.19 -import javax.naming.ldap.LdapName;
83.20 +import javax.naming.ldap.Control;
83.21
83.22 -/**
83.23 - * Basic enumeration for NameClassPair, Binding, and SearchResults.
83.24 - */
83.25
83.26 -class LdapNamingEnumeration implements NamingEnumeration, ReferralEnumeration {
83.27 - protected Name listArg;
83.28 -
83.29 - private boolean cleaned = false;
83.30 - private LdapResult res;
83.31 - private LdapClient enumClnt;
83.32 - private Continuation cont; // used to fill in exceptions
83.33 - private Vector entries = null;
83.34 - private int limit = 0;
83.35 - private int posn = 0;
83.36 - protected LdapCtx homeCtx;
83.37 - private LdapReferralException refEx = null;
83.38 - private NamingException errEx = null;
83.39 +final class LdapNamingEnumeration
83.40 + extends AbstractLdapNamingEnumeration<NameClassPair> {
83.41
83.42 private static final String defaultClassName = DirContext.class.getName();
83.43
83.44 - /*
83.45 - * Record the next set of entries and/or referrals.
83.46 - */
83.47 LdapNamingEnumeration(LdapCtx homeCtx, LdapResult answer, Name listArg,
83.48 - Continuation cont) throws NamingException {
83.49 -
83.50 - // These checks are to accommodate referrals and limit exceptions
83.51 - // which will generate an enumeration and defer the exception
83.52 - // to be thrown at the end of the enumeration.
83.53 - // All other exceptions are thrown immediately.
83.54 - // Exceptions shouldn't be thrown here anyhow because
83.55 - // process_return_code() is called before the constructor
83.56 - // is called, so these are just safety checks.
83.57 -
83.58 - if ((answer.status != LdapClient.LDAP_SUCCESS) &&
83.59 - (answer.status != LdapClient.LDAP_SIZE_LIMIT_EXCEEDED) &&
83.60 - (answer.status != LdapClient.LDAP_TIME_LIMIT_EXCEEDED) &&
83.61 - (answer.status != LdapClient.LDAP_ADMIN_LIMIT_EXCEEDED) &&
83.62 - (answer.status != LdapClient.LDAP_REFERRAL) &&
83.63 - (answer.status != LdapClient.LDAP_PARTIAL_RESULTS)) {
83.64 -
83.65 - // %%% need to deal with referral
83.66 - NamingException e = new NamingException(
83.67 - LdapClient.getErrorMessage(
83.68 - answer.status, answer.errorMessage));
83.69 -
83.70 - throw cont.fillInException(e);
83.71 - }
83.72 -
83.73 - // otherwise continue
83.74 -
83.75 - res = answer;
83.76 - entries = answer.entries;
83.77 - limit = (entries == null) ? 0 : entries.size(); // handle empty set
83.78 - this.listArg = listArg;
83.79 - this.cont = cont;
83.80 -
83.81 - if (answer.refEx != null) {
83.82 - refEx = answer.refEx;
83.83 - }
83.84 -
83.85 - // Ensures that context won't get closed from underneath us
83.86 - this.homeCtx = homeCtx;
83.87 - homeCtx.incEnumCount();
83.88 - enumClnt = homeCtx.clnt; // remember
83.89 + Continuation cont) throws NamingException {
83.90 + super(homeCtx, answer, listArg, cont);
83.91 }
83.92
83.93 - public Object nextElement() {
83.94 - try {
83.95 - return next();
83.96 - } catch (NamingException e) {
83.97 - // can't throw exception
83.98 - cleanup();
83.99 - return null;
83.100 - }
83.101 - }
83.102 -
83.103 - public boolean hasMoreElements() {
83.104 - try {
83.105 - return hasMore();
83.106 - } catch (NamingException e) {
83.107 - // can't throw exception
83.108 - cleanup();
83.109 - return false;
83.110 - }
83.111 - }
83.112 -
83.113 - /*
83.114 - * Retrieve the next set of entries and/or referrals.
83.115 - */
83.116 - private void getNextBatch() throws NamingException {
83.117 -
83.118 - res = homeCtx.getSearchReply(enumClnt, res);
83.119 - if (res == null) {
83.120 - limit = posn = 0;
83.121 - return;
83.122 - }
83.123 -
83.124 - entries = res.entries;
83.125 - limit = (entries == null) ? 0 : entries.size(); // handle empty set
83.126 - posn = 0; // reset
83.127 -
83.128 - // mimimize the number of calls to processReturnCode()
83.129 - // (expensive when batchSize is small and there are many results)
83.130 - if ((res.status != LdapClient.LDAP_SUCCESS) ||
83.131 - ((res.status == LdapClient.LDAP_SUCCESS) &&
83.132 - (res.referrals != null))) {
83.133 -
83.134 - try {
83.135 - // convert referrals into a chain of LdapReferralException
83.136 - homeCtx.processReturnCode(res, listArg);
83.137 -
83.138 - } catch (LimitExceededException e) {
83.139 - setNamingException(e);
83.140 -
83.141 - } catch (PartialResultException e) {
83.142 - setNamingException(e);
83.143 - }
83.144 - }
83.145 -
83.146 - // merge any newly received referrals with any current referrals
83.147 - if (res.refEx != null) {
83.148 - if (refEx == null) {
83.149 - refEx = res.refEx;
83.150 - } else {
83.151 - refEx = refEx.appendUnprocessedReferrals(res.refEx);
83.152 - }
83.153 - res.refEx = null; // reset
83.154 - }
83.155 -
83.156 - if (res.resControls != null) {
83.157 - homeCtx.respCtls = res.resControls;
83.158 - }
83.159 - }
83.160 -
83.161 - private boolean more = true; // assume we have something to start with
83.162 - private boolean hasMoreCalled = false;
83.163 -
83.164 - /*
83.165 - * Test if unprocessed entries or referrals exist.
83.166 - */
83.167 - public boolean hasMore() throws NamingException {
83.168 -
83.169 - if (hasMoreCalled) {
83.170 - return more;
83.171 - }
83.172 -
83.173 - hasMoreCalled = true;
83.174 -
83.175 - if (!more) {
83.176 - return false;
83.177 - } else {
83.178 - return (more = hasMoreImpl());
83.179 - }
83.180 - }
83.181 -
83.182 - /*
83.183 - * Retrieve the next entry.
83.184 - */
83.185 - public Object next() throws NamingException {
83.186 -
83.187 - if (!hasMoreCalled) {
83.188 - hasMore();
83.189 - }
83.190 - hasMoreCalled = false;
83.191 - return nextImpl();
83.192 - }
83.193 -
83.194 - /*
83.195 - * Test if unprocessed entries or referrals exist.
83.196 - */
83.197 - private boolean hasMoreImpl() throws NamingException {
83.198 - // when page size is supported, this
83.199 - // might generate an exception while attempting
83.200 - // to fetch the next batch to determine
83.201 - // whether there are any more elements
83.202 -
83.203 - // test if the current set of entries has been processed
83.204 - if (posn == limit) {
83.205 - getNextBatch();
83.206 - }
83.207 -
83.208 - // test if any unprocessed entries exist
83.209 - if (posn < limit) {
83.210 - return true;
83.211 - } else {
83.212 -
83.213 - try {
83.214 - // try to process another referral
83.215 - return hasMoreReferrals();
83.216 -
83.217 - } catch (LdapReferralException e) {
83.218 - cleanup();
83.219 - throw e;
83.220 -
83.221 - } catch (LimitExceededException e) {
83.222 - cleanup();
83.223 - throw e;
83.224 -
83.225 - } catch (PartialResultException e) {
83.226 - cleanup();
83.227 - throw e;
83.228 -
83.229 - } catch (NamingException e) {
83.230 - cleanup();
83.231 - PartialResultException pre = new PartialResultException();
83.232 - pre.setRootCause(e);
83.233 - throw pre;
83.234 - }
83.235 - }
83.236 - }
83.237 -
83.238 - /*
83.239 - * Retrieve the next entry.
83.240 - */
83.241 - private Object nextImpl() throws NamingException {
83.242 - try {
83.243 - return nextAux();
83.244 - } catch (NamingException e) {
83.245 - cleanup();
83.246 - throw cont.fillInException(e);
83.247 - }
83.248 - }
83.249 -
83.250 - private Object nextAux() throws NamingException {
83.251 - if (posn == limit) {
83.252 - getNextBatch(); // updates posn and limit
83.253 - }
83.254 -
83.255 - if (posn >= limit) {
83.256 - cleanup();
83.257 - throw new NoSuchElementException("invalid enumeration handle");
83.258 - }
83.259 -
83.260 - LdapEntry result = (LdapEntry)entries.elementAt(posn++);
83.261 -
83.262 - // gets and outputs DN from the entry
83.263 - return createItem(result.DN, result.attributes, result.respCtls);
83.264 - }
83.265 -
83.266 - protected String getAtom(String dn) {
83.267 - String atom;
83.268 - // need to strip off all but lowest component of dn
83.269 - // so that is relative to current context (currentDN)
83.270 - try {
83.271 - Name parsed = new LdapName(dn);
83.272 - return parsed.get(parsed.size() - 1);
83.273 - } catch (NamingException e) {
83.274 - return dn;
83.275 - }
83.276 - }
83.277 -
83.278 + @Override
83.279 protected NameClassPair createItem(String dn, Attributes attrs,
83.280 - Vector respCtls) throws NamingException {
83.281 + Vector<Control> respCtls) throws NamingException {
83.282
83.283 Attribute attr;
83.284 String className = null;
83.285 @@ -313,128 +71,10 @@
83.286 return ncp;
83.287 }
83.288
83.289 - /*
83.290 - * Append the supplied (chain of) referrals onto the
83.291 - * end of the current (chain of) referrals.
83.292 - */
83.293 - public void appendUnprocessedReferrals(LdapReferralException ex) {
83.294 -
83.295 - if (refEx != null) {
83.296 - refEx = refEx.appendUnprocessedReferrals(ex);
83.297 - } else {
83.298 - refEx = ex.appendUnprocessedReferrals(refEx);
83.299 - }
83.300 - }
83.301 -
83.302 - void setNamingException(NamingException e) {
83.303 - errEx = e;
83.304 - }
83.305 -
83.306 - protected LdapNamingEnumeration
83.307 - getReferredResults(LdapReferralContext refCtx) throws NamingException {
83.308 + @Override
83.309 + protected LdapNamingEnumeration getReferredResults(
83.310 + LdapReferralContext refCtx) throws NamingException {
83.311 // repeat the original operation at the new context
83.312 return (LdapNamingEnumeration)refCtx.list(listArg);
83.313 }
83.314 -
83.315 - /*
83.316 - * Iterate through the URLs of a referral. If successful then perform
83.317 - * a search operation and merge the received results with the current
83.318 - * results.
83.319 - */
83.320 - protected boolean hasMoreReferrals() throws NamingException {
83.321 -
83.322 - if ((refEx != null) &&
83.323 - (refEx.hasMoreReferrals() ||
83.324 - refEx.hasMoreReferralExceptions())) {
83.325 -
83.326 - if (homeCtx.handleReferrals == LdapClient.LDAP_REF_THROW) {
83.327 - throw (NamingException)(refEx.fillInStackTrace());
83.328 - }
83.329 -
83.330 - // process the referrals sequentially
83.331 - while (true) {
83.332 -
83.333 - LdapReferralContext refCtx =
83.334 - (LdapReferralContext)refEx.getReferralContext(
83.335 - homeCtx.envprops, homeCtx.reqCtls);
83.336 -
83.337 - try {
83.338 -
83.339 - update(getReferredResults(refCtx));
83.340 - break;
83.341 -
83.342 - } catch (LdapReferralException re) {
83.343 -
83.344 - // record a previous exception
83.345 - if (errEx == null) {
83.346 - errEx = re.getNamingException();
83.347 - }
83.348 - refEx = re;
83.349 - continue;
83.350 -
83.351 - } finally {
83.352 - // Make sure we close referral context
83.353 - refCtx.close();
83.354 - }
83.355 - }
83.356 - return hasMoreImpl();
83.357 -
83.358 - } else {
83.359 - cleanup();
83.360 -
83.361 - if (errEx != null) {
83.362 - throw errEx;
83.363 - }
83.364 - return (false);
83.365 - }
83.366 - }
83.367 -
83.368 - /*
83.369 - * Merge the entries and/or referrals from the supplied enumeration
83.370 - * with those of the current enumeration.
83.371 - */
83.372 - protected void update(LdapNamingEnumeration ne) {
83.373 - // Cleanup previous context first
83.374 - homeCtx.decEnumCount();
83.375 -
83.376 - // New enum will have already incremented enum count and recorded clnt
83.377 - homeCtx = ne.homeCtx;
83.378 - enumClnt = ne.enumClnt;
83.379 -
83.380 - // Do this to prevent referral enumeration (ne) from decrementing
83.381 - // enum count because we'll be doing that here from this
83.382 - // enumeration.
83.383 - ne.homeCtx = null;
83.384 -
83.385 - // Record rest of information from new enum
83.386 - posn = ne.posn;
83.387 - limit = ne.limit;
83.388 - res = ne.res;
83.389 - entries = ne.entries;
83.390 - refEx = ne.refEx;
83.391 - listArg = ne.listArg;
83.392 - }
83.393 -
83.394 - protected void finalize() {
83.395 - cleanup();
83.396 - }
83.397 -
83.398 - protected void cleanup() {
83.399 - if (cleaned) return; // been there; done that
83.400 -
83.401 - if(enumClnt != null) {
83.402 - enumClnt.clearSearchReply(res, homeCtx.reqCtls);
83.403 - }
83.404 -
83.405 - enumClnt = null;
83.406 - cleaned = true;
83.407 - if (homeCtx != null) {
83.408 - homeCtx.decEnumCount();
83.409 - homeCtx = null;
83.410 - }
83.411 - }
83.412 -
83.413 - public void close() {
83.414 - cleanup();
83.415 - }
83.416 }
84.1 --- a/src/share/classes/com/sun/jndi/ldap/LdapPoolManager.java Thu Sep 01 13:54:38 2011 -0700
84.2 +++ b/src/share/classes/com/sun/jndi/ldap/LdapPoolManager.java Mon Sep 05 23:58:19 2011 -0700
84.3 @@ -1,5 +1,5 @@
84.4 /*
84.5 - * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
84.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
84.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
84.8 *
84.9 * This code is free software; you can redistribute it and/or modify it
84.10 @@ -28,6 +28,7 @@
84.11 import java.io.PrintStream;
84.12 import java.io.OutputStream;
84.13 import java.util.Hashtable;
84.14 +import java.util.Locale;
84.15 import java.util.StringTokenizer;
84.16
84.17 import javax.naming.ldap.Control;
84.18 @@ -133,7 +134,7 @@
84.19 String mech;
84.20 int p;
84.21 for (int i = 0; i < count; i++) {
84.22 - mech = parser.nextToken().toLowerCase();
84.23 + mech = parser.nextToken().toLowerCase(Locale.ENGLISH);
84.24 if (mech.equals("anonymous")) {
84.25 mech = "none";
84.26 }
84.27 @@ -214,7 +215,7 @@
84.28 *
84.29 */
84.30 static boolean isPoolingAllowed(String socketFactory, OutputStream trace,
84.31 - String authMech, String protocol, Hashtable env)
84.32 + String authMech, String protocol, Hashtable<?,?> env)
84.33 throws NamingException {
84.34
84.35 if (trace != null && !debug
84.36 @@ -235,7 +236,7 @@
84.37 if ((socketFactory != null) &&
84.38 !socketFactory.equals(LdapCtx.DEFAULT_SSL_FACTORY)) {
84.39 try {
84.40 - Class socketFactoryClass = Obj.helper.loadClass(socketFactory);
84.41 + Class<?> socketFactoryClass = Obj.helper.loadClass(socketFactory);
84.42 Class[] interfaces = socketFactoryClass.getInterfaces();
84.43 for (int i = 0; i < interfaces.length; i++) {
84.44 if (interfaces[i].getCanonicalName().equals(COMPARATOR)) {
84.45 @@ -294,7 +295,7 @@
84.46 static LdapClient getLdapClient(String host, int port, String socketFactory,
84.47 int connTimeout, int readTimeout, OutputStream trace, int version,
84.48 String authMech, Control[] ctls, String protocol, String user,
84.49 - Object passwd, Hashtable env) throws NamingException {
84.50 + Object passwd, Hashtable<?,?> env) throws NamingException {
84.51
84.52 // Create base identity for LdapClient
84.53 ClientId id = null;
84.54 @@ -385,9 +386,9 @@
84.55
84.56 private static final String getProperty(final String propName,
84.57 final String defVal) {
84.58 - return (String) AccessController.doPrivileged(
84.59 - new PrivilegedAction() {
84.60 - public Object run() {
84.61 + return AccessController.doPrivileged(
84.62 + new PrivilegedAction<String>() {
84.63 + public String run() {
84.64 try {
84.65 return System.getProperty(propName, defVal);
84.66 } catch (SecurityException e) {
84.67 @@ -399,9 +400,9 @@
84.68
84.69 private static final int getInteger(final String propName,
84.70 final int defVal) {
84.71 - Integer val = (Integer) AccessController.doPrivileged(
84.72 - new PrivilegedAction() {
84.73 - public Object run() {
84.74 + Integer val = AccessController.doPrivileged(
84.75 + new PrivilegedAction<Integer>() {
84.76 + public Integer run() {
84.77 try {
84.78 return Integer.getInteger(propName, defVal);
84.79 } catch (SecurityException e) {
84.80 @@ -414,9 +415,9 @@
84.81
84.82 private static final long getLong(final String propName,
84.83 final long defVal) {
84.84 - Long val = (Long) AccessController.doPrivileged(
84.85 - new PrivilegedAction() {
84.86 - public Object run() {
84.87 + Long val = AccessController.doPrivileged(
84.88 + new PrivilegedAction<Long>() {
84.89 + public Long run() {
84.90 try {
84.91 return Long.getLong(propName, defVal);
84.92 } catch (SecurityException e) {
85.1 --- a/src/share/classes/com/sun/jndi/ldap/LdapReferralContext.java Thu Sep 01 13:54:38 2011 -0700
85.2 +++ b/src/share/classes/com/sun/jndi/ldap/LdapReferralContext.java Mon Sep 05 23:58:19 2011 -0700
85.3 @@ -1,5 +1,5 @@
85.4 /*
85.5 - * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
85.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
85.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
85.8 *
85.9 * This code is free software; you can redistribute it and/or modify it
85.10 @@ -52,7 +52,9 @@
85.11 private int hopCount = 1;
85.12 private NamingException previousEx = null;
85.13
85.14 - LdapReferralContext(LdapReferralException ex, Hashtable env,
85.15 + @SuppressWarnings("unchecked") // clone()
85.16 + LdapReferralContext(LdapReferralException ex,
85.17 + Hashtable<?,?> env,
85.18 Control[] connCtls,
85.19 Control[] reqCtls,
85.20 String nextName,
85.21 @@ -69,20 +71,21 @@
85.22
85.23 // Make copies of environment and connect controls for our own use.
85.24 if (env != null) {
85.25 - env = (Hashtable) env.clone();
85.26 + env = (Hashtable<?,?>) env.clone();
85.27 // Remove old connect controls from environment, unless we have new
85.28 // ones that will override them anyway.
85.29 if (connCtls == null) {
85.30 env.remove(LdapCtx.BIND_CONTROLS);
85.31 }
85.32 } else if (connCtls != null) {
85.33 - env = new Hashtable(5);
85.34 + env = new Hashtable<String, Control[]>(5);
85.35 }
85.36 if (connCtls != null) {
85.37 Control[] copiedCtls = new Control[connCtls.length];
85.38 System.arraycopy(connCtls, 0, copiedCtls, 0, connCtls.length);
85.39 // Add copied controls to environment, replacing any old ones.
85.40 - env.put(LdapCtx.BIND_CONTROLS, copiedCtls);
85.41 + ((Hashtable<? super String, ? super Control[]>)env)
85.42 + .put(LdapCtx.BIND_CONTROLS, copiedCtls);
85.43 }
85.44
85.45 while (true) {
85.46 @@ -260,24 +263,26 @@
85.47 refCtx.rename(overrideName(oldName), toName(refEx.getNewRdn()));
85.48 }
85.49
85.50 - public NamingEnumeration list(String name) throws NamingException {
85.51 + public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
85.52 return list(toName(name));
85.53 }
85.54
85.55 - public NamingEnumeration list(Name name) throws NamingException {
85.56 + @SuppressWarnings("unchecked")
85.57 + public NamingEnumeration<NameClassPair> list(Name name) throws NamingException {
85.58 if (skipThisReferral) {
85.59 throw (NamingException)
85.60 ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
85.61 }
85.62 try {
85.63 - NamingEnumeration ne = null;
85.64 + NamingEnumeration<NameClassPair> ne = null;
85.65
85.66 if (urlScope != null && urlScope.equals("base")) {
85.67 SearchControls cons = new SearchControls();
85.68 cons.setReturningObjFlag(true);
85.69 cons.setSearchScope(SearchControls.OBJECT_SCOPE);
85.70
85.71 - ne = refCtx.search(overrideName(name), "(objectclass=*)", cons);
85.72 + ne = (NamingEnumeration)
85.73 + refCtx.search(overrideName(name), "(objectclass=*)", cons);
85.74
85.75 } else {
85.76 ne = refCtx.list(overrideName(name));
85.77 @@ -318,25 +323,29 @@
85.78 }
85.79 }
85.80
85.81 - public NamingEnumeration listBindings(String name) throws NamingException {
85.82 + public NamingEnumeration<Binding> listBindings(String name) throws
85.83 + NamingException {
85.84 return listBindings(toName(name));
85.85 }
85.86
85.87 - public NamingEnumeration listBindings(Name name) throws NamingException {
85.88 + @SuppressWarnings("unchecked")
85.89 + public NamingEnumeration<Binding> listBindings(Name name) throws
85.90 + NamingException {
85.91 if (skipThisReferral) {
85.92 throw (NamingException)
85.93 ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
85.94 }
85.95
85.96 try {
85.97 - NamingEnumeration be = null;
85.98 + NamingEnumeration<Binding> be = null;
85.99
85.100 if (urlScope != null && urlScope.equals("base")) {
85.101 SearchControls cons = new SearchControls();
85.102 cons.setReturningObjFlag(true);
85.103 cons.setSearchScope(SearchControls.OBJECT_SCOPE);
85.104
85.105 - be = refCtx.search(overrideName(name), "(objectclass=*)", cons);
85.106 + be = (NamingEnumeration)refCtx.search(overrideName(name),
85.107 + "(objectclass=*)", cons);
85.108
85.109 } else {
85.110 be = refCtx.listBindings(overrideName(name));
85.111 @@ -347,7 +356,7 @@
85.112 // append (referrals from) the exception that generated this
85.113 // context to the new search results, so that referral processing
85.114 // can continue
85.115 - ((ReferralEnumeration)be).appendUnprocessedReferrals(refEx);
85.116 + ((ReferralEnumeration<Binding>)be).appendUnprocessedReferrals(refEx);
85.117
85.118 return (be);
85.119
85.120 @@ -462,7 +471,7 @@
85.121 return refCtx.removeFromEnvironment(propName);
85.122 }
85.123
85.124 - public Hashtable getEnvironment() throws NamingException {
85.125 + public Hashtable<?,?> getEnvironment() throws NamingException {
85.126 if (skipThisReferral) {
85.127 throw (NamingException)
85.128 ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
85.129 @@ -602,23 +611,23 @@
85.130 return refCtx.getSchemaClassDefinition(overrideName(name));
85.131 }
85.132
85.133 - public NamingEnumeration search(String name,
85.134 - Attributes matchingAttributes)
85.135 + public NamingEnumeration<SearchResult> search(String name,
85.136 + Attributes matchingAttributes)
85.137 throws NamingException {
85.138 return search(toName(name), SearchFilter.format(matchingAttributes),
85.139 new SearchControls());
85.140 }
85.141
85.142 - public NamingEnumeration search(Name name,
85.143 - Attributes matchingAttributes)
85.144 + public NamingEnumeration<SearchResult> search(Name name,
85.145 + Attributes matchingAttributes)
85.146 throws NamingException {
85.147 return search(name, SearchFilter.format(matchingAttributes),
85.148 new SearchControls());
85.149 }
85.150
85.151 - public NamingEnumeration search(String name,
85.152 - Attributes matchingAttributes,
85.153 - String[] attributesToReturn)
85.154 + public NamingEnumeration<SearchResult> search(String name,
85.155 + Attributes matchingAttributes,
85.156 + String[] attributesToReturn)
85.157 throws NamingException {
85.158 SearchControls cons = new SearchControls();
85.159 cons.setReturningAttributes(attributesToReturn);
85.160 @@ -627,9 +636,9 @@
85.161 cons);
85.162 }
85.163
85.164 - public NamingEnumeration search(Name name,
85.165 - Attributes matchingAttributes,
85.166 - String[] attributesToReturn)
85.167 + public NamingEnumeration<SearchResult> search(Name name,
85.168 + Attributes matchingAttributes,
85.169 + String[] attributesToReturn)
85.170 throws NamingException {
85.171 SearchControls cons = new SearchControls();
85.172 cons.setReturningAttributes(attributesToReturn);
85.173 @@ -637,15 +646,15 @@
85.174 return search(name, SearchFilter.format(matchingAttributes), cons);
85.175 }
85.176
85.177 - public NamingEnumeration search(String name,
85.178 - String filter,
85.179 - SearchControls cons)
85.180 + public NamingEnumeration<SearchResult> search(String name,
85.181 + String filter,
85.182 + SearchControls cons)
85.183 throws NamingException {
85.184 return search(toName(name), filter, cons);
85.185 }
85.186
85.187 - public NamingEnumeration search(Name name,
85.188 - String filter,
85.189 + public NamingEnumeration<SearchResult> search(Name name,
85.190 + String filter,
85.191 SearchControls cons) throws NamingException {
85.192
85.193 if (skipThisReferral) {
85.194 @@ -654,8 +663,10 @@
85.195 }
85.196
85.197 try {
85.198 - NamingEnumeration se = refCtx.search(overrideName(name),
85.199 - overrideFilter(filter), overrideAttributesAndScope(cons));
85.200 + NamingEnumeration<SearchResult> se =
85.201 + refCtx.search(overrideName(name),
85.202 + overrideFilter(filter),
85.203 + overrideAttributesAndScope(cons));
85.204
85.205 refEx.setNameResolved(true);
85.206
85.207 @@ -694,15 +705,15 @@
85.208 }
85.209 }
85.210
85.211 - public NamingEnumeration search(String name,
85.212 - String filterExpr,
85.213 - Object[] filterArgs,
85.214 - SearchControls cons)
85.215 + public NamingEnumeration<SearchResult> search(String name,
85.216 + String filterExpr,
85.217 + Object[] filterArgs,
85.218 + SearchControls cons)
85.219 throws NamingException {
85.220 return search(toName(name), filterExpr, filterArgs, cons);
85.221 }
85.222
85.223 - public NamingEnumeration search(Name name,
85.224 + public NamingEnumeration<SearchResult> search(Name name,
85.225 String filterExpr,
85.226 Object[] filterArgs,
85.227 SearchControls cons) throws NamingException {
85.228 @@ -713,7 +724,7 @@
85.229 }
85.230
85.231 try {
85.232 - NamingEnumeration se;
85.233 + NamingEnumeration<SearchResult> se;
85.234
85.235 if (urlFilter != null) {
85.236 se = refCtx.search(overrideName(name), urlFilter,
86.1 --- a/src/share/classes/com/sun/jndi/ldap/LdapReferralException.java Thu Sep 01 13:54:38 2011 -0700
86.2 +++ b/src/share/classes/com/sun/jndi/ldap/LdapReferralException.java Mon Sep 05 23:58:19 2011 -0700
86.3 @@ -1,5 +1,5 @@
86.4 /*
86.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
86.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
86.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
86.8 *
86.9 * This code is free software; you can redistribute it and/or modify it
86.10 @@ -26,7 +26,6 @@
86.11 package com.sun.jndi.ldap;
86.12
86.13 import javax.naming.*;
86.14 -import javax.naming.spi.*;
86.15 import javax.naming.ldap.Control;
86.16
86.17 import java.util.Hashtable;
86.18 @@ -67,15 +66,16 @@
86.19 */
86.20 final public class LdapReferralException extends
86.21 javax.naming.ldap.LdapReferralException {
86.22 + private static final long serialVersionUID = 627059076356906399L;
86.23
86.24 // ----------- fields initialized in constructor ---------------
86.25 private int handleReferrals;
86.26 - private Hashtable envprops;
86.27 + private Hashtable<?,?> envprops;
86.28 private String nextName;
86.29 private Control[] reqCtls;
86.30
86.31 // ----------- fields that have defaults -----------------------
86.32 - private Vector referrals = null; // alternatives,set by setReferralInfo()
86.33 + private Vector<?> referrals = null; // alternatives,set by setReferralInfo()
86.34 private int referralIndex = 0; // index into referrals
86.35 private int referralCount = 0; // count of referrals
86.36 private boolean foundEntry = false; // will stop when entry is found
86.37 @@ -98,7 +98,7 @@
86.38 Object resolvedObj,
86.39 Name remainingName,
86.40 String explanation,
86.41 - Hashtable envprops,
86.42 + Hashtable<?,?> envprops,
86.43 String nextName,
86.44 int handleReferrals,
86.45 Control[] reqCtls) {
86.46 @@ -210,7 +210,7 @@
86.47 /**
86.48 * Sets referral information.
86.49 */
86.50 - void setReferralInfo(Vector referrals, boolean continuationRef) {
86.51 + void setReferralInfo(Vector<?> referrals, boolean continuationRef) {
86.52 // %%% continuationRef is currently ignored
86.53
86.54 if (debug)
87.1 --- a/src/share/classes/com/sun/jndi/ldap/LdapResult.java Thu Sep 01 13:54:38 2011 -0700
87.2 +++ b/src/share/classes/com/sun/jndi/ldap/LdapResult.java Mon Sep 05 23:58:19 2011 -0700
87.3 @@ -1,5 +1,5 @@
87.4 /*
87.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
87.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
87.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
87.8 *
87.9 * This code is free software; you can redistribute it and/or modify it
87.10 @@ -28,6 +28,7 @@
87.11 import java.util.Vector;
87.12 import javax.naming.directory.Attributes;
87.13 import javax.naming.directory.BasicAttributes;
87.14 +import javax.naming.ldap.Control;
87.15
87.16 /**
87.17 * %%% public for use by LdapSasl %%%
87.18 @@ -37,10 +38,11 @@
87.19 public int status; // %%% public for use by LdapSasl
87.20 String matchedDN;
87.21 String errorMessage;
87.22 - Vector referrals = null;
87.23 + // Vector<String | Vector<String>>
87.24 + Vector<Vector<String>> referrals = null;
87.25 LdapReferralException refEx = null;
87.26 - Vector entries = null;
87.27 - Vector resControls = null;
87.28 + Vector<LdapEntry> entries = null;
87.29 + Vector<Control> resControls = null;
87.30 public byte[] serverCreds = null; // %%% public for use by LdapSasl
87.31 String extensionId = null; // string OID
87.32 byte[] extensionValue = null; // BER OCTET STRING
87.33 @@ -57,7 +59,7 @@
87.34 switch (status) {
87.35 case LdapClient.LDAP_COMPARE_TRUE:
87.36 status = LdapClient.LDAP_SUCCESS;
87.37 - entries = new Vector(1,1);
87.38 + entries = new Vector<>(1,1);
87.39 Attributes attrs = new BasicAttributes(LdapClient.caseIgnore);
87.40 LdapEntry entry = new LdapEntry( name, attrs );
87.41 entries.addElement(entry);
87.42 @@ -66,7 +68,7 @@
87.43
87.44 case LdapClient.LDAP_COMPARE_FALSE:
87.45 status = LdapClient.LDAP_SUCCESS;
87.46 - entries = new Vector(0);
87.47 + entries = new Vector<>(0);
87.48 successful = true;
87.49 break;
87.50
88.1 --- a/src/share/classes/com/sun/jndi/ldap/LdapSchemaCtx.java Thu Sep 01 13:54:38 2011 -0700
88.2 +++ b/src/share/classes/com/sun/jndi/ldap/LdapSchemaCtx.java Mon Sep 05 23:58:19 2011 -0700
88.3 @@ -1,5 +1,5 @@
88.4 /*
88.5 - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
88.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
88.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
88.8 *
88.9 * This code is free software; you can redistribute it and/or modify it
88.10 @@ -61,8 +61,9 @@
88.11
88.12 private int objectType;
88.13
88.14 - static DirContext createSchemaTree(Hashtable env, String subschemasubentry,
88.15 - LdapCtx schemaEntry, Attributes schemaAttrs, boolean netscapeBug)
88.16 + static DirContext createSchemaTree(Hashtable<String,Object> env,
88.17 + String subschemasubentry, LdapCtx schemaEntry,
88.18 + Attributes schemaAttrs, boolean netscapeBug)
88.19 throws NamingException {
88.20 try {
88.21 LdapSchemaParser parser = new LdapSchemaParser(netscapeBug);
88.22 @@ -71,7 +72,7 @@
88.23 schemaEntry, parser);
88.24
88.25 LdapSchemaCtx root = new LdapSchemaCtx(SCHEMA_ROOT, env, allinfo);
88.26 - parser.LDAP2JNDISchema(schemaAttrs, root);
88.27 + LdapSchemaParser.LDAP2JNDISchema(schemaAttrs, root);
88.28 return root;
88.29 } catch (NamingException e) {
88.30 schemaEntry.close(); // cleanup
88.31 @@ -80,7 +81,8 @@
88.32 }
88.33
88.34 // Called by createNewCtx
88.35 - private LdapSchemaCtx(int objectType, Hashtable environment, SchemaInfo info) {
88.36 + private LdapSchemaCtx(int objectType, Hashtable<String,Object> environment,
88.37 + SchemaInfo info) {
88.38 super(environment, LdapClient.caseIgnore);
88.39
88.40 this.objectType = objectType;
88.41 @@ -223,9 +225,9 @@
88.42 final private static Attributes deepClone(Attributes orig)
88.43 throws NamingException {
88.44 BasicAttributes copy = new BasicAttributes(true);
88.45 - NamingEnumeration attrs = orig.getAll();
88.46 + NamingEnumeration<? extends Attribute> attrs = orig.getAll();
88.47 while (attrs.hasMore()) {
88.48 - copy.put((Attribute)((Attribute)attrs.next()).clone());
88.49 + copy.put((Attribute)attrs.next().clone());
88.50 }
88.51 return copy;
88.52 }
88.53 @@ -409,13 +411,14 @@
88.54 }
88.55 }
88.56
88.57 - private LdapCtx reopenEntry(Hashtable env) throws NamingException {
88.58 + private LdapCtx reopenEntry(Hashtable<?,?> env) throws NamingException {
88.59 // Use subschemasubentry name as DN
88.60 return new LdapCtx(schemaEntryName, host, port,
88.61 env, hasLdapsScheme);
88.62 }
88.63
88.64 - synchronized void modifyAttributes(Hashtable env, ModificationItem[] mods)
88.65 + synchronized void modifyAttributes(Hashtable<?,?> env,
88.66 + ModificationItem[] mods)
88.67 throws NamingException {
88.68 if (schemaEntry == null) {
88.69 schemaEntry = reopenEntry(env);
88.70 @@ -423,7 +426,7 @@
88.71 schemaEntry.modifyAttributes("", mods);
88.72 }
88.73
88.74 - synchronized void modifyAttributes(Hashtable env, int mod,
88.75 + synchronized void modifyAttributes(Hashtable<?,?> env, int mod,
88.76 Attributes attrs) throws NamingException {
88.77 if (schemaEntry == null) {
88.78 schemaEntry = reopenEntry(env);
89.1 --- a/src/share/classes/com/sun/jndi/ldap/LdapSchemaParser.java Thu Sep 01 13:54:38 2011 -0700
89.2 +++ b/src/share/classes/com/sun/jndi/ldap/LdapSchemaParser.java Mon Sep 05 23:58:19 2011 -0700
89.3 @@ -1,5 +1,5 @@
89.4 /*
89.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
89.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
89.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
89.8 *
89.9 * This code is free software; you can redistribute it and/or modify it
89.10 @@ -27,7 +27,6 @@
89.11
89.12 import javax.naming.*;
89.13 import javax.naming.directory.*;
89.14 -import java.util.Hashtable;
89.15 import java.util.Vector;
89.16
89.17 /**
89.18 @@ -141,9 +140,9 @@
89.19 LdapSchemaCtx schemaRoot)
89.20 throws NamingException {
89.21
89.22 - NamingEnumeration objDescs;
89.23 - Attributes objDef;
89.24 - LdapSchemaCtx classDefTree;
89.25 + NamingEnumeration<?> objDescs;
89.26 + Attributes objDef;
89.27 + LdapSchemaCtx classDefTree;
89.28
89.29 // create the class def subtree
89.30 Attributes attrs = new BasicAttributes(LdapClient.caseIgnore);
89.31 @@ -173,9 +172,9 @@
89.32 LdapSchemaCtx schemaRoot)
89.33 throws NamingException {
89.34
89.35 - NamingEnumeration attrDescs;
89.36 - Attributes attrDef;
89.37 - LdapSchemaCtx attrDefTree;
89.38 + NamingEnumeration<?> attrDescs;
89.39 + Attributes attrDef;
89.40 + LdapSchemaCtx attrDefTree;
89.41
89.42 // create the AttributeDef subtree
89.43 Attributes attrs = new BasicAttributes(LdapClient.caseIgnore);
89.44 @@ -206,9 +205,9 @@
89.45 LdapSchemaCtx schemaRoot)
89.46 throws NamingException {
89.47
89.48 - NamingEnumeration syntaxDescs;
89.49 - Attributes syntaxDef;
89.50 - LdapSchemaCtx syntaxDefTree;
89.51 + NamingEnumeration<?> syntaxDescs;
89.52 + Attributes syntaxDef;
89.53 + LdapSchemaCtx syntaxDefTree;
89.54
89.55 // create the SyntaxDef subtree
89.56 Attributes attrs = new BasicAttributes(LdapClient.caseIgnore);
89.57 @@ -239,9 +238,9 @@
89.58 LdapSchemaCtx schemaRoot)
89.59 throws NamingException {
89.60
89.61 - NamingEnumeration matchRuleDescs;
89.62 - Attributes matchRuleDef;
89.63 - LdapSchemaCtx matchRuleDefTree;
89.64 + NamingEnumeration<?> matchRuleDescs;
89.65 + Attributes matchRuleDef;
89.66 + LdapSchemaCtx matchRuleDefTree;
89.67
89.68 // create the MatchRuleDef subtree
89.69 Attributes attrs = new BasicAttributes(LdapClient.caseIgnore);
89.70 @@ -519,8 +518,8 @@
89.71 final private static String[] readQDescrList(String string, int[] pos)
89.72 throws NamingException {
89.73
89.74 - int begin, end;
89.75 - Vector values = new Vector(5);
89.76 + int begin, end;
89.77 + Vector<String> values = new Vector<>(5);
89.78
89.79 if (debug) {
89.80 System.err.println("ReadQDescrList: pos="+pos[0]);
89.81 @@ -553,7 +552,7 @@
89.82
89.83 String[] answer = new String[values.size()];
89.84 for (int i = 0; i < answer.length; i++) {
89.85 - answer[i] = (String)values.elementAt(i);
89.86 + answer[i] = values.elementAt(i);
89.87 }
89.88 return answer;
89.89 }
89.90 @@ -614,7 +613,7 @@
89.91
89.92 int begin, cur, end;
89.93 String oidName = null;
89.94 - Vector values = new Vector(5);
89.95 + Vector<String> values = new Vector<>(5);
89.96
89.97 if (debug) {
89.98 System.err.println("ReadOIDList: pos="+pos[0]);
89.99 @@ -663,7 +662,7 @@
89.100
89.101 String[] answer = new String[values.size()];
89.102 for (int i = 0; i < answer.length; i++) {
89.103 - answer[i] = (String)values.elementAt(i);
89.104 + answer[i] = values.elementAt(i);
89.105 }
89.106 return answer;
89.107 }
89.108 @@ -843,10 +842,10 @@
89.109 String attrId = null;
89.110
89.111 // use enumeration because attribute ID is not known
89.112 - for (NamingEnumeration ae = attrs.getAll();
89.113 + for (NamingEnumeration<? extends Attribute> ae = attrs.getAll();
89.114 ae.hasMoreElements(); ) {
89.115
89.116 - attr = (Attribute)ae.next();
89.117 + attr = ae.next();
89.118 attrId = attr.getID();
89.119
89.120 // skip those already processed
89.121 @@ -973,10 +972,10 @@
89.122 String attrId = null;
89.123
89.124 // use enumeration because attribute ID is not known
89.125 - for (NamingEnumeration ae = attrs.getAll();
89.126 + for (NamingEnumeration<? extends Attribute> ae = attrs.getAll();
89.127 ae.hasMoreElements(); ) {
89.128
89.129 - attr = (Attribute)ae.next();
89.130 + attr = ae.next();
89.131 attrId = attr.getID();
89.132
89.133 // skip those already processed
89.134 @@ -1040,10 +1039,10 @@
89.135 String attrId = null;
89.136
89.137 // use enumeration because attribute ID is not known
89.138 - for (NamingEnumeration ae = attrs.getAll();
89.139 + for (NamingEnumeration<? extends Attribute> ae = attrs.getAll();
89.140 ae.hasMoreElements(); ) {
89.141
89.142 - attr = (Attribute)ae.next();
89.143 + attr = ae.next();
89.144 attrId = attr.getID();
89.145
89.146 // skip those already processed
89.147 @@ -1117,10 +1116,10 @@
89.148 String attrId = null;
89.149
89.150 // use enumeration because attribute ID is not known
89.151 - for (NamingEnumeration ae = attrs.getAll();
89.152 + for (NamingEnumeration<? extends Attribute> ae = attrs.getAll();
89.153 ae.hasMoreElements(); ) {
89.154
89.155 - attr = (Attribute)ae.next();
89.156 + attr = ae.next();
89.157 attrId = attr.getID();
89.158
89.159 // skip those already processed
89.160 @@ -1201,7 +1200,7 @@
89.161 qdList.append(WHSP);
89.162 qdList.append(OID_LIST_BEGIN);
89.163
89.164 - NamingEnumeration values = attr.getAll();
89.165 + NamingEnumeration<?> values = attr.getAll();
89.166
89.167 while(values.hasMore()) {
89.168 qdList.append(WHSP);
89.169 @@ -1238,7 +1237,7 @@
89.170 oidList.append(WHSP);
89.171 oidList.append(OID_LIST_BEGIN);
89.172
89.173 - NamingEnumeration values = oidsAttr.getAll();
89.174 + NamingEnumeration<?> values = oidsAttr.getAll();
89.175 oidList.append(WHSP);
89.176 oidList.append(values.next());
89.177
90.1 --- a/src/share/classes/com/sun/jndi/ldap/LdapSearchEnumeration.java Thu Sep 01 13:54:38 2011 -0700
90.2 +++ b/src/share/classes/com/sun/jndi/ldap/LdapSearchEnumeration.java Mon Sep 05 23:58:19 2011 -0700
90.3 @@ -1,5 +1,5 @@
90.4 /*
90.5 - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
90.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
90.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90.8 *
90.9 * This code is free software; you can redistribute it and/or modify it
90.10 @@ -34,7 +34,8 @@
90.11
90.12 import com.sun.jndi.toolkit.ctx.Continuation;
90.13
90.14 -final class LdapSearchEnumeration extends LdapNamingEnumeration {
90.15 +final class LdapSearchEnumeration
90.16 + extends AbstractLdapNamingEnumeration<SearchResult> {
90.17
90.18 private Name startName; // prefix of names of search results
90.19 private LdapCtx.SearchArgs searchArgs = null;
90.20 @@ -52,9 +53,10 @@
90.21 searchArgs = args;
90.22 }
90.23
90.24 - protected NameClassPair
90.25 - createItem(String dn, Attributes attrs, Vector respCtls)
90.26 - throws NamingException {
90.27 + @Override
90.28 + protected SearchResult createItem(String dn, Attributes attrs,
90.29 + Vector<Control> respCtls)
90.30 + throws NamingException {
90.31
90.32 Object obj = null;
90.33
90.34 @@ -174,6 +176,7 @@
90.35 return sr;
90.36 }
90.37
90.38 + @Override
90.39 public void appendUnprocessedReferrals(LdapReferralException ex) {
90.40
90.41 // a referral has been followed so do not create relative names
90.42 @@ -181,14 +184,16 @@
90.43 super.appendUnprocessedReferrals(ex);
90.44 }
90.45
90.46 - protected LdapNamingEnumeration
90.47 - getReferredResults(LdapReferralContext refCtx) throws NamingException {
90.48 + @Override
90.49 + protected LdapSearchEnumeration getReferredResults(
90.50 + LdapReferralContext refCtx) throws NamingException {
90.51 // repeat the original operation at the new context
90.52 - return (LdapSearchEnumeration)
90.53 - refCtx.search(searchArgs.name, searchArgs.filter, searchArgs.cons);
90.54 + return (LdapSearchEnumeration)refCtx.search(
90.55 + searchArgs.name, searchArgs.filter, searchArgs.cons);
90.56 }
90.57
90.58 - protected void update(LdapNamingEnumeration ne) {
90.59 + @Override
90.60 + protected void update(AbstractLdapNamingEnumeration<SearchResult> ne) {
90.61 super.update(ne);
90.62
90.63 // Update search-specific variables
91.1 --- a/src/share/classes/com/sun/jndi/ldap/NamingEventNotifier.java Thu Sep 01 13:54:38 2011 -0700
91.2 +++ b/src/share/classes/com/sun/jndi/ldap/NamingEventNotifier.java Mon Sep 05 23:58:19 2011 -0700
91.3 @@ -1,5 +1,5 @@
91.4 /*
91.5 - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
91.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
91.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
91.8 *
91.9 * This code is free software; you can redistribute it and/or modify it
91.10 @@ -50,12 +50,12 @@
91.11 final class NamingEventNotifier implements Runnable {
91.12 private final static boolean debug = false;
91.13
91.14 - private Vector namingListeners;
91.15 + private Vector<NamingListener> namingListeners;
91.16 private Thread worker;
91.17 private LdapCtx context;
91.18 private EventContext eventSrc;
91.19 private EventSupport support;
91.20 - private NamingEnumeration results;
91.21 + private NamingEnumeration<SearchResult> results;
91.22
91.23 // package private; used by EventSupport to remove it
91.24 NotifierArgs info;
91.25 @@ -83,7 +83,7 @@
91.26 context = (LdapCtx)ctx.newInstance(new Control[]{psearch});
91.27 eventSrc = ctx;
91.28
91.29 - namingListeners = new Vector();
91.30 + namingListeners = new Vector<>();
91.31 namingListeners.addElement(firstListener);
91.32
91.33 worker = Obj.helper.createThread(this);
91.34 @@ -124,7 +124,8 @@
91.35 // Change root of search results so that it will generate
91.36 // names relative to the event context instead of that
91.37 // named by nm
91.38 - ((LdapSearchEnumeration)results).setStartName(context.currentParsedDN);
91.39 + ((LdapSearchEnumeration)(NamingEnumeration)results)
91.40 + .setStartName(context.currentParsedDN);
91.41
91.42 SearchResult si;
91.43 Control[] respctls;
91.44 @@ -132,7 +133,7 @@
91.45 long changeNum;
91.46
91.47 while (results.hasMore()) {
91.48 - si = (SearchResult)results.next();
91.49 + si = results.next();
91.50 respctls = (si instanceof HasControls) ?
91.51 ((HasControls) si).getControls() : null;
91.52
92.1 --- a/src/share/classes/com/sun/jndi/ldap/NotifierArgs.java Thu Sep 01 13:54:38 2011 -0700
92.2 +++ b/src/share/classes/com/sun/jndi/ldap/NotifierArgs.java Mon Sep 05 23:58:19 2011 -0700
92.3 @@ -1,5 +1,5 @@
92.4 /*
92.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
92.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
92.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
92.8 *
92.9 * This code is free software; you can redistribute it and/or modify it
92.10 @@ -133,7 +133,7 @@
92.11 private int controlsCode() {
92.12 if (controls == null) return 0;
92.13
92.14 - int total = (int)controls.getTimeLimit() + (int)controls.getCountLimit() +
92.15 + int total = controls.getTimeLimit() + (int)controls.getCountLimit() +
92.16 (controls.getDerefLinkFlag() ? 1 : 0) +
92.17 (controls.getReturningObjFlag() ? 1 : 0);
92.18
93.1 --- a/src/share/classes/com/sun/jndi/ldap/Obj.java Thu Sep 01 13:54:38 2011 -0700
93.2 +++ b/src/share/classes/com/sun/jndi/ldap/Obj.java Mon Sep 05 23:58:19 2011 -0700
93.3 @@ -1,5 +1,5 @@
93.4 /*
93.5 - * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
93.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
93.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
93.8 *
93.9 * This code is free software; you can redistribute it and/or modify it
93.10 @@ -84,6 +84,7 @@
93.11 /**
93.12 * @deprecated
93.13 */
93.14 + @Deprecated
93.15 private static final int REMOTE_LOC = 7;
93.16
93.17 // LDAP object classes to support Java objects
93.18 @@ -206,13 +207,13 @@
93.19 } else {
93.20 StringTokenizer parser =
93.21 new StringTokenizer((String)codebaseAttr.get());
93.22 - Vector vec = new Vector(10);
93.23 + Vector<String> vec = new Vector<>(10);
93.24 while (parser.hasMoreTokens()) {
93.25 vec.addElement(parser.nextToken());
93.26 }
93.27 String[] answer = new String[vec.size()];
93.28 for (int i = 0; i < answer.length; i++) {
93.29 - answer[i] = (String)vec.elementAt(i);
93.30 + answer[i] = vec.elementAt(i);
93.31 }
93.32 return answer;
93.33 }
93.34 @@ -410,10 +411,10 @@
93.35 * Temporary Vector for decoded RefAddr addresses - used to ensure
93.36 * unordered addresses are correctly re-ordered.
93.37 */
93.38 - Vector refAddrList = new Vector();
93.39 + Vector<RefAddr> refAddrList = new Vector<>();
93.40 refAddrList.setSize(attr.size());
93.41
93.42 - for (NamingEnumeration vals = attr.getAll(); vals.hasMore(); ) {
93.43 + for (NamingEnumeration<?> vals = attr.getAll(); vals.hasMore(); ) {
93.44
93.45 val = (String)vals.next();
93.46
93.47 @@ -488,7 +489,7 @@
93.48
93.49 // Copy to real reference
93.50 for (int i = 0; i < refAddrList.size(); i++) {
93.51 - ref.add((RefAddr)refAddrList.elementAt(i));
93.52 + ref.add(refAddrList.elementAt(i));
93.53 }
93.54 }
93.55
93.56 @@ -502,9 +503,9 @@
93.57
93.58 try {
93.59 ByteArrayOutputStream bytes = new ByteArrayOutputStream();
93.60 - ObjectOutputStream serial = new ObjectOutputStream(bytes);
93.61 - serial.writeObject(obj);
93.62 - serial.close();
93.63 + try (ObjectOutputStream serial = new ObjectOutputStream(bytes)) {
93.64 + serial.writeObject(obj);
93.65 + }
93.66
93.67 return (bytes.toByteArray());
93.68
93.69 @@ -524,18 +525,14 @@
93.70 try {
93.71 // Create ObjectInputStream for deserialization
93.72 ByteArrayInputStream bytes = new ByteArrayInputStream(obj);
93.73 - ObjectInputStream deserial = (cl == null ?
93.74 - new ObjectInputStream(bytes) :
93.75 - new LoaderInputStream(bytes, cl));
93.76 -
93.77 - try {
93.78 + try (ObjectInputStream deserial = cl == null ?
93.79 + new ObjectInputStream(bytes) :
93.80 + new LoaderInputStream(bytes, cl)) {
93.81 return deserial.readObject();
93.82 } catch (ClassNotFoundException e) {
93.83 NamingException ne = new NamingException();
93.84 ne.setRootCause(e);
93.85 throw ne;
93.86 - } finally {
93.87 - deserial.close();
93.88 }
93.89 } catch (IOException e) {
93.90 NamingException ne = new NamingException();
93.91 @@ -549,7 +546,7 @@
93.92 */
93.93 static Attributes determineBindAttrs(
93.94 char separator, Object obj, Attributes attrs, boolean cloned,
93.95 - Name name, Context ctx, Hashtable env)
93.96 + Name name, Context ctx, Hashtable<?,?> env)
93.97 throws NamingException {
93.98
93.99 // Call state factories to convert object and attrs
93.100 @@ -582,10 +579,10 @@
93.101
93.102 } else {
93.103 // Get existing objectclass attribute
93.104 - objectClass = (Attribute)attrs.get("objectClass");
93.105 + objectClass = attrs.get("objectClass");
93.106 if (objectClass == null && !attrs.isCaseIgnored()) {
93.107 // %%% workaround
93.108 - objectClass = (Attribute)attrs.get("objectclass");
93.109 + objectClass = attrs.get("objectclass");
93.110 }
93.111
93.112 // No objectclasses supplied, use "top" to start
93.113 @@ -614,8 +611,8 @@
93.114 classLoader = cl;
93.115 }
93.116
93.117 - protected Class resolveClass(ObjectStreamClass desc) throws IOException,
93.118 - ClassNotFoundException {
93.119 + protected Class<?> resolveClass(ObjectStreamClass desc) throws
93.120 + IOException, ClassNotFoundException {
93.121 try {
93.122 // %%% Should use Class.forName(desc.getName(), false, classLoader);
93.123 // except we can't because that is only available on JDK1.2
93.124 @@ -625,15 +622,15 @@
93.125 }
93.126 }
93.127
93.128 - protected Class resolveProxyClass(String[] interfaces) throws
93.129 + protected Class<?> resolveProxyClass(String[] interfaces) throws
93.130 IOException, ClassNotFoundException {
93.131 ClassLoader nonPublicLoader = null;
93.132 boolean hasNonPublicInterface = false;
93.133
93.134 // define proxy in class loader of non-public interface(s), if any
93.135 - Class[] classObjs = new Class[interfaces.length];
93.136 + Class<?>[] classObjs = new Class<?>[interfaces.length];
93.137 for (int i = 0; i < interfaces.length; i++) {
93.138 - Class cl = Class.forName(interfaces[i], false, classLoader);
93.139 + Class<?> cl = Class.forName(interfaces[i], false, classLoader);
93.140 if ((cl.getModifiers() & Modifier.PUBLIC) == 0) {
93.141 if (hasNonPublicInterface) {
93.142 if (nonPublicLoader != cl.getClassLoader()) {
94.1 --- a/src/share/classes/com/sun/jndi/ldap/ReferralEnumeration.java Thu Sep 01 13:54:38 2011 -0700
94.2 +++ b/src/share/classes/com/sun/jndi/ldap/ReferralEnumeration.java Mon Sep 05 23:58:19 2011 -0700
94.3 @@ -1,5 +1,5 @@
94.4 /*
94.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
94.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
94.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
94.8 *
94.9 * This code is free software; you can redistribute it and/or modify it
94.10 @@ -27,6 +27,6 @@
94.11
94.12 import javax.naming.NamingEnumeration;
94.13
94.14 -interface ReferralEnumeration extends NamingEnumeration {
94.15 +interface ReferralEnumeration<T> extends NamingEnumeration<T> {
94.16 void appendUnprocessedReferrals(LdapReferralException ex);
94.17 }
95.1 --- a/src/share/classes/com/sun/jndi/ldap/ServiceLocator.java Thu Sep 01 13:54:38 2011 -0700
95.2 +++ b/src/share/classes/com/sun/jndi/ldap/ServiceLocator.java Mon Sep 05 23:58:19 2011 -0700
95.3 @@ -1,5 +1,5 @@
95.4 /*
95.5 - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
95.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
95.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
95.8 *
95.9 * This code is free software; you can redistribute it and/or modify it
95.10 @@ -26,9 +26,7 @@
95.11 package com.sun.jndi.ldap;
95.12
95.13 import java.util.Arrays;
95.14 -import java.util.Enumeration;
95.15 import java.util.Hashtable;
95.16 -import java.util.NoSuchElementException;
95.17 import java.util.Random;
95.18 import java.util.StringTokenizer;
95.19 import java.util.List;
95.20 @@ -39,8 +37,6 @@
95.21 import javax.naming.ldap.LdapName;
95.22 import javax.naming.ldap.Rdn;
95.23
95.24 -import com.sun.jndi.ldap.LdapURL;
95.25 -
95.26 /**
95.27 * This class discovers the location of LDAP services by querying DNS.
95.28 * See http://www.ietf.org/internet-drafts/draft-ietf-ldapext-locate-07.txt
95.29 @@ -78,10 +74,10 @@
95.30 // process RDNs left-to-right
95.31 //List<Rdn> rdnList = ldapName.getRdns();
95.32
95.33 - List rdnList = ldapName.getRdns();
95.34 + List<Rdn> rdnList = ldapName.getRdns();
95.35 for (int i = rdnList.size() - 1; i >= 0; i--) {
95.36 //Rdn rdn = rdnList.get(i);
95.37 - Rdn rdn = (Rdn) rdnList.get(i);
95.38 + Rdn rdn = rdnList.get(i);
95.39
95.40 // single-valued RDN with a DC attribute
95.41 if ((rdn.size() == 1) &&
95.42 @@ -117,7 +113,7 @@
95.43 * @return An ordered list of hostports for the LDAP service or null if
95.44 * the service has not been located.
95.45 */
95.46 - static String[] getLdapService(String domainName, Hashtable environment) {
95.47 + static String[] getLdapService(String domainName, Hashtable<?,?> environment) {
95.48
95.49 if (domainName == null || domainName.length() == 0) {
95.50 return null;
95.51 @@ -252,7 +248,7 @@
95.52 * See http://www.ietf.org/rfc/rfc2782.txt
95.53 */
95.54
95.55 -static class SrvRecord implements Comparable {
95.56 +static class SrvRecord implements Comparable<SrvRecord> {
95.57
95.58 int priority;
95.59 int weight;
95.60 @@ -284,8 +280,7 @@
95.61 * Sort records in ascending order of priority value. For records with
95.62 * equal priority move those with weight 0 to the top of the list.
95.63 */
95.64 - public int compareTo(Object o) {
95.65 - SrvRecord that = (SrvRecord) o;
95.66 + public int compareTo(SrvRecord that) {
95.67 if (priority > that.priority) {
95.68 return 1; // this > that
95.69 } else if (priority < that.priority) {
96.1 --- a/src/share/classes/com/sun/jndi/ldap/SimpleClientId.java Thu Sep 01 13:54:38 2011 -0700
96.2 +++ b/src/share/classes/com/sun/jndi/ldap/SimpleClientId.java Mon Sep 05 23:58:19 2011 -0700
96.3 @@ -1,5 +1,5 @@
96.4 /*
96.5 - * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
96.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
96.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
96.8 *
96.9 * This code is free software; you can redistribute it and/or modify it
96.10 @@ -54,9 +54,9 @@
96.11 } else if (passwd instanceof String) {
96.12 this.passwd = passwd;
96.13 } else if (passwd instanceof byte[]) {
96.14 - this.passwd = (byte[]) ((byte[])passwd).clone();
96.15 + this.passwd = ((byte[])passwd).clone();
96.16 } else if (passwd instanceof char[]) {
96.17 - this.passwd = (char[]) ((char[])passwd).clone();
96.18 + this.passwd = ((char[])passwd).clone();
96.19 } else {
96.20 this.passwd = passwd;
96.21 }
97.1 --- a/src/share/classes/com/sun/jndi/ldap/UnsolicitedResponseImpl.java Thu Sep 01 13:54:38 2011 -0700
97.2 +++ b/src/share/classes/com/sun/jndi/ldap/UnsolicitedResponseImpl.java Mon Sep 05 23:58:19 2011 -0700
97.3 @@ -1,5 +1,5 @@
97.4 /*
97.5 - * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
97.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
97.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
97.8 *
97.9 * This code is free software; you can redistribute it and/or modify it
97.10 @@ -41,7 +41,7 @@
97.11 private NamingException exception;
97.12 private Control[] controls;
97.13
97.14 - UnsolicitedResponseImpl(String oid, byte[] berVal, Vector ref,
97.15 + UnsolicitedResponseImpl(String oid, byte[] berVal, Vector<Vector<String>> ref,
97.16 int status, String msg, String matchedDN, Control[] controls) {
97.17 this.oid = oid;
97.18 this.extensionValue = berVal;
97.19 @@ -50,7 +50,8 @@
97.20 int len = ref.size();
97.21 referrals = new String[len];
97.22 for (int i = 0; i < len; i++) {
97.23 - referrals[i] = (String)ref.elementAt(i);
97.24 + // ref is a list of single-String Vectors
97.25 + referrals[i] = ref.elementAt(i).elementAt(0);
97.26 }
97.27 }
97.28 exception = LdapCtx.mapErrorCode(status, msg);
98.1 --- a/src/share/classes/com/sun/jndi/ldap/VersionHelper.java Thu Sep 01 13:54:38 2011 -0700
98.2 +++ b/src/share/classes/com/sun/jndi/ldap/VersionHelper.java Mon Sep 05 23:58:19 2011 -0700
98.3 @@ -1,5 +1,5 @@
98.4 /*
98.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
98.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
98.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
98.8 *
98.9 * This code is free software; you can redistribute it and/or modify it
98.10 @@ -72,7 +72,7 @@
98.11 return urlArray;
98.12 }
98.13
98.14 - abstract Class loadClass(String className) throws ClassNotFoundException;
98.15 + abstract Class<?> loadClass(String className) throws ClassNotFoundException;
98.16
98.17 abstract Thread createThread(Runnable r);
98.18 }
99.1 --- a/src/share/classes/com/sun/jndi/ldap/VersionHelper12.java Thu Sep 01 13:54:38 2011 -0700
99.2 +++ b/src/share/classes/com/sun/jndi/ldap/VersionHelper12.java Mon Sep 05 23:58:19 2011 -0700
99.3 @@ -1,5 +1,5 @@
99.4 /*
99.5 - * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
99.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
99.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
99.8 *
99.9 * This code is free software; you can redistribute it and/or modify it
99.10 @@ -66,15 +66,15 @@
99.11 }
99.12 }
99.13
99.14 - Class loadClass(String className) throws ClassNotFoundException {
99.15 + Class<?> loadClass(String className) throws ClassNotFoundException {
99.16 ClassLoader cl = getContextClassLoader();
99.17 return Class.forName(className, true, cl);
99.18 }
99.19
99.20 private ClassLoader getContextClassLoader() {
99.21 - return (ClassLoader) AccessController.doPrivileged(
99.22 - new PrivilegedAction() {
99.23 - public Object run() {
99.24 + return AccessController.doPrivileged(
99.25 + new PrivilegedAction<ClassLoader>() {
99.26 + public ClassLoader run() {
99.27 return Thread.currentThread().getContextClassLoader();
99.28 }
99.29 }
99.30 @@ -82,9 +82,9 @@
99.31 }
99.32
99.33 Thread createThread(final Runnable r) {
99.34 - return (Thread) AccessController.doPrivileged(
99.35 - new PrivilegedAction() {
99.36 - public Object run() {
99.37 + return AccessController.doPrivileged(
99.38 + new PrivilegedAction<Thread>() {
99.39 + public Thread run() {
99.40 return new Thread(r);
99.41 }
99.42 }
100.1 --- a/src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java Thu Sep 01 13:54:38 2011 -0700
100.2 +++ b/src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java Mon Sep 05 23:58:19 2011 -0700
100.3 @@ -1,5 +1,5 @@
100.4 /*
100.5 - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
100.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
100.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
100.8 *
100.9 * This code is free software; you can redistribute it and/or modify it
100.10 @@ -27,16 +27,8 @@
100.11
100.12 import java.io.InputStream;
100.13 import java.io.OutputStream;
100.14 -import java.io.BufferedInputStream;
100.15 -import java.io.BufferedOutputStream;
100.16 import java.io.IOException;
100.17
100.18 -import java.net.Socket;
100.19 -
100.20 -import java.util.Collection;
100.21 -import java.util.Iterator;
100.22 -import java.util.List;
100.23 -
100.24 import java.security.Principal;
100.25 import java.security.cert.X509Certificate;
100.26 import java.security.cert.CertificateException;
100.27 @@ -45,11 +37,9 @@
100.28 import javax.net.ssl.SSLSocket;
100.29 import javax.net.ssl.SSLSocketFactory;
100.30 import javax.net.ssl.SSLPeerUnverifiedException;
100.31 -import javax.net.ssl.SSLContext;
100.32 import javax.net.ssl.HostnameVerifier;
100.33 import sun.security.util.HostnameChecker;
100.34
100.35 -import javax.naming.*;
100.36 import javax.naming.ldap.*;
100.37 import com.sun.jndi.ldap.Connection;
100.38
100.39 @@ -415,7 +405,7 @@
100.40 // Use ciphersuite to determine whether Kerberos is active.
100.41 if (session.getCipherSuite().startsWith("TLS_KRB5")) {
100.42 Principal principal = getPeerPrincipal(session);
100.43 - if (!checker.match(hostname, principal)) {
100.44 + if (!HostnameChecker.match(hostname, principal)) {
100.45 throw new SSLPeerUnverifiedException(
100.46 "hostname of the kerberos principal:" + principal +
100.47 " does not match the hostname:" + hostname);
101.1 --- a/src/share/classes/com/sun/jndi/ldap/pool/Connections.java Thu Sep 01 13:54:38 2011 -0700
101.2 +++ b/src/share/classes/com/sun/jndi/ldap/pool/Connections.java Mon Sep 05 23:58:19 2011 -0700
101.3 @@ -1,5 +1,5 @@
101.4 /*
101.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
101.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
101.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
101.8 *
101.9 * This code is free software; you can redistribute it and/or modify it
101.10 @@ -71,10 +71,10 @@
101.11
101.12 final private int maxSize;
101.13 final private int prefSize;
101.14 - final private List conns;
101.15 + final private List<ConnectionDesc> conns;
101.16
101.17 private boolean closed = false; // Closed for business
101.18 - private Reference ref; // maintains reference to id to prevent premature GC
101.19 + private Reference<Object> ref; // maintains reference to id to prevent premature GC
101.20
101.21 /**
101.22 * @param id the identity (connection request) of the connections in the list
101.23 @@ -99,11 +99,11 @@
101.24 } else {
101.25 this.prefSize = prefSize;
101.26 }
101.27 - conns = new ArrayList(maxSize > 0 ? maxSize : DEFAULT_SIZE);
101.28 + conns = new ArrayList<>(maxSize > 0 ? maxSize : DEFAULT_SIZE);
101.29
101.30 // Maintain soft ref to id so that this Connections' entry in
101.31 // Pool doesn't get GC'ed prematurely
101.32 - ref = new SoftReference(id);
101.33 + ref = new SoftReference<>(id);
101.34
101.35 d("init size=", initSize);
101.36 d("max size=", maxSize);
101.37 @@ -186,7 +186,7 @@
101.38 // exceeds prefSize, then first look for an idle connection
101.39 ConnectionDesc entry;
101.40 for (int i = 0; i < size; i++) {
101.41 - entry = (ConnectionDesc) conns.get(i);
101.42 + entry = conns.get(i);
101.43 if ((conn = entry.tryUse()) != null) {
101.44 d("get(): use ", conn);
101.45 td("Use ", conn);
101.46 @@ -239,7 +239,7 @@
101.47 td("Release ", conn);
101.48
101.49 // Get ConnectionDesc from list to get correct state info
101.50 - entry = (ConnectionDesc) conns.get(loc);
101.51 + entry = conns.get(loc);
101.52 // Return connection to list, ready for reuse
101.53 entry.release();
101.54 }
101.55 @@ -291,10 +291,10 @@
101.56 * @return true if no more connections in list
101.57 */
101.58 synchronized boolean expire(long threshold) {
101.59 - Iterator iter = conns.iterator();
101.60 + Iterator<ConnectionDesc> iter = conns.iterator();
101.61 ConnectionDesc entry;
101.62 while (iter.hasNext()) {
101.63 - entry = (ConnectionDesc) iter.next();
101.64 + entry = iter.next();
101.65 if (entry.expire(threshold)) {
101.66 d("expire(): removing ", entry);
101.67 td("Expired ", entry);
101.68 @@ -333,7 +333,7 @@
101.69
101.70 ConnectionDesc entry;
101.71 for (int i = 0; i < len; i++) {
101.72 - entry = (ConnectionDesc) conns.get(i);
101.73 + entry = conns.get(i);
101.74 use += entry.getUseCount();
101.75 switch (entry.getState()) {
101.76 case ConnectionDesc.BUSY:
102.1 --- a/src/share/classes/com/sun/jndi/ldap/pool/ConnectionsWeakRef.java Thu Sep 01 13:54:38 2011 -0700
102.2 +++ b/src/share/classes/com/sun/jndi/ldap/pool/ConnectionsWeakRef.java Mon Sep 05 23:58:19 2011 -0700
102.3 @@ -1,5 +1,5 @@
102.4 /*
102.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
102.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
102.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
102.8 *
102.9 * This code is free software; you can redistribute it and/or modify it
102.10 @@ -55,11 +55,12 @@
102.11 * reference to Connections used for closing (which in turn terminates
102.12 * the Connection thread) it by monitoring the ReferenceQueue.
102.13 */
102.14 -class ConnectionsWeakRef extends WeakReference {
102.15 +class ConnectionsWeakRef extends WeakReference<ConnectionsRef> {
102.16
102.17 private final Connections conns;
102.18
102.19 - ConnectionsWeakRef (ConnectionsRef connsRef, ReferenceQueue queue) {
102.20 + ConnectionsWeakRef (ConnectionsRef connsRef,
102.21 + ReferenceQueue<? super ConnectionsRef> queue) {
102.22 super(connsRef, queue);
102.23 this.conns = connsRef.getConnections();
102.24 }
103.1 --- a/src/share/classes/com/sun/jndi/ldap/pool/Pool.java Thu Sep 01 13:54:38 2011 -0700
103.2 +++ b/src/share/classes/com/sun/jndi/ldap/pool/Pool.java Mon Sep 05 23:58:19 2011 -0700
103.3 @@ -1,5 +1,5 @@
103.4 /*
103.5 - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
103.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
103.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
103.8 *
103.9 * This code is free software; you can redistribute it and/or modify it
103.10 @@ -30,7 +30,6 @@
103.11 import java.util.Collection;
103.12 import java.util.Collections;
103.13 import java.util.Iterator;
103.14 -import java.util.Set;
103.15 import java.util.LinkedList;
103.16
103.17 import java.io.PrintStream;
103.18 @@ -83,17 +82,18 @@
103.19 /*
103.20 * Used for connections cleanup
103.21 */
103.22 - private static final ReferenceQueue queue = new ReferenceQueue();
103.23 - private static final Collection weakRefs =
103.24 - Collections.synchronizedList(new LinkedList());
103.25 + private static final ReferenceQueue<ConnectionsRef> queue =
103.26 + new ReferenceQueue<>();
103.27 + private static final Collection<Reference<ConnectionsRef>> weakRefs =
103.28 + Collections.synchronizedList(new LinkedList<Reference<ConnectionsRef>>());
103.29
103.30 final private int maxSize; // max num of identical conn per pool
103.31 final private int prefSize; // preferred num of identical conn per pool
103.32 final private int initSize; // initial number of identical conn to create
103.33 - final private Map map;
103.34 + final private Map<Object, ConnectionsRef> map;
103.35
103.36 public Pool(int initSize, int prefSize, int maxSize) {
103.37 - map = new WeakHashMap();
103.38 + map = new WeakHashMap<>();
103.39 this.prefSize = prefSize;
103.40 this.maxSize = maxSize;
103.41 this.initSize = initSize;
103.42 @@ -135,7 +135,8 @@
103.43 map.put(id, connsRef);
103.44
103.45 // Create a weak reference to ConnectionsRef
103.46 - Reference weakRef = new ConnectionsWeakRef(connsRef, queue);
103.47 + Reference<ConnectionsRef> weakRef =
103.48 + new ConnectionsWeakRef(connsRef, queue);
103.49
103.50 // Keep the weak reference through the element of a linked list
103.51 weakRefs.add(weakRef);
103.52 @@ -148,7 +149,7 @@
103.53 }
103.54
103.55 private Connections getConnections(Object id) {
103.56 - ConnectionsRef ref = (ConnectionsRef) map.get(id);
103.57 + ConnectionsRef ref = map.get(id);
103.58 return (ref != null) ? ref.getConnections() : null;
103.59 }
103.60
103.61 @@ -163,11 +164,10 @@
103.62 */
103.63 public void expire(long threshold) {
103.64 synchronized (map) {
103.65 - Collection coll = map.values();
103.66 - Iterator iter = coll.iterator();
103.67 + Iterator<ConnectionsRef> iter = map.values().iterator();
103.68 Connections conns;
103.69 while (iter.hasNext()) {
103.70 - conns = ((ConnectionsRef) (iter.next())).getConnections();
103.71 + conns = iter.next().getConnections();
103.72 if (conns.expire(threshold)) {
103.73 d("expire(): removing ", conns);
103.74 iter.remove();
103.75 @@ -202,7 +202,6 @@
103.76
103.77
103.78 public void showStats(PrintStream out) {
103.79 - Map.Entry entry;
103.80 Object id;
103.81 Connections conns;
103.82
103.83 @@ -212,13 +211,9 @@
103.84 out.println("initial pool size: " + initSize);
103.85 out.println("current pool size: " + map.size());
103.86
103.87 - Set entries = map.entrySet();
103.88 - Iterator iter = entries.iterator();
103.89 -
103.90 - while (iter.hasNext()) {
103.91 - entry = (Map.Entry) iter.next();
103.92 + for (Map.Entry<Object, ConnectionsRef> entry : map.entrySet()) {
103.93 id = entry.getKey();
103.94 - conns = ((ConnectionsRef) entry.getValue()).getConnections();
103.95 + conns = entry.getValue().getConnections();
103.96 out.println(" " + id + ":" + conns.getStats());
103.97 }
103.98
104.1 --- a/src/share/classes/com/sun/jndi/ldap/pool/PoolCleaner.java Thu Sep 01 13:54:38 2011 -0700
104.2 +++ b/src/share/classes/com/sun/jndi/ldap/pool/PoolCleaner.java Mon Sep 05 23:58:19 2011 -0700
104.3 @@ -1,5 +1,5 @@
104.4 /*
104.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
104.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
104.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
104.8 *
104.9 * This code is free software; you can redistribute it and/or modify it
104.10 @@ -41,7 +41,7 @@
104.11 public PoolCleaner(long period, Pool[] pools) {
104.12 super();
104.13 this.period = period;
104.14 - this.pools = (Pool[]) pools.clone();
104.15 + this.pools = pools.clone();
104.16 setDaemon(true);
104.17 }
104.18
105.1 --- a/src/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java Thu Sep 01 13:54:38 2011 -0700
105.2 +++ b/src/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java Mon Sep 05 23:58:19 2011 -0700
105.3 @@ -1,5 +1,5 @@
105.4 /*
105.5 - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
105.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
105.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
105.8 *
105.9 * This code is free software; you can redistribute it and/or modify it
105.10 @@ -57,7 +57,7 @@
105.11 if (cred instanceof String) {
105.12 passwd = ((String)cred).toCharArray();
105.13 } else if (cred instanceof char[]) {
105.14 - passwd = (char[])((char[])cred).clone();
105.15 + passwd = ((char[])cred).clone();
105.16 } else if (cred != null) {
105.17 // assume UTF-8 encoding
105.18 String orig = new String((byte[])cred, "UTF8");
106.1 --- a/src/share/classes/com/sun/jndi/ldap/sasl/LdapSasl.java Thu Sep 01 13:54:38 2011 -0700
106.2 +++ b/src/share/classes/com/sun/jndi/ldap/sasl/LdapSasl.java Mon Sep 05 23:58:19 2011 -0700
106.3 @@ -1,5 +1,5 @@
106.4 /*
106.5 - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
106.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
106.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
106.8 *
106.9 * This code is free software; you can redistribute it and/or modify it
106.10 @@ -89,9 +89,10 @@
106.11 * @param bindCtls The possibly null controls to accompany the bind
106.12 * @return LdapResult containing status of the bind
106.13 */
106.14 + @SuppressWarnings("unchecked")
106.15 public static LdapResult saslBind(LdapClient clnt, Connection conn,
106.16 String server, String dn, Object pw,
106.17 - String authMech, Hashtable env, Control[] bindCtls)
106.18 + String authMech, Hashtable<?,?> env, Control[] bindCtls)
106.19 throws IOException, NamingException {
106.20
106.21 SaslClient saslClnt = null;
106.22 @@ -112,7 +113,7 @@
106.23 try {
106.24 // Create SASL client to use using SASL package
106.25 saslClnt = Sasl.createSaslClient(
106.26 - mechs, authzId, "ldap", server, env, cbh);
106.27 + mechs, authzId, "ldap", server, (Hashtable<String, ?>)env, cbh);
106.28
106.29 if (saslClnt == null) {
106.30 throw new AuthenticationNotSupportedException(authMech);
106.31 @@ -185,13 +186,13 @@
106.32 */
106.33 private static String[] getSaslMechanismNames(String str) {
106.34 StringTokenizer parser = new StringTokenizer(str);
106.35 - Vector mechs = new Vector(10);
106.36 + Vector<String> mechs = new Vector<>(10);
106.37 while (parser.hasMoreTokens()) {
106.38 mechs.addElement(parser.nextToken());
106.39 }
106.40 String[] mechNames = new String[mechs.size()];
106.41 for (int i = 0; i < mechs.size(); i++) {
106.42 - mechNames[i] = (String)mechs.elementAt(i);
106.43 + mechNames[i] = mechs.elementAt(i);
106.44 }
106.45 return mechNames;
106.46 }
107.1 --- a/src/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java Thu Sep 01 13:54:38 2011 -0700
107.2 +++ b/src/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java Mon Sep 05 23:58:19 2011 -0700
107.3 @@ -1,5 +1,5 @@
107.4 /*
107.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
107.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
107.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
107.8 *
107.9 * This code is free software; you can redistribute it and/or modify it
107.10 @@ -46,7 +46,7 @@
107.11
107.12 public class RegistryContext implements Context, Referenceable {
107.13
107.14 - private Hashtable environment;
107.15 + private Hashtable<String, Object> environment;
107.16 private Registry registry;
107.17 private String host;
107.18 private int port;
107.19 @@ -67,10 +67,13 @@
107.20 * Cloning of "env" is handled by caller; see comments within
107.21 * RegistryContextFactory.getObjectInstance(), for example.
107.22 */
107.23 - public RegistryContext(String host, int port, Hashtable env)
107.24 + @SuppressWarnings("unchecked")
107.25 + public RegistryContext(String host, int port, Hashtable<?, ?> env)
107.26 throws NamingException
107.27 {
107.28 - environment = ((env == null) ? new Hashtable(5) : env);
107.29 + environment = (env == null)
107.30 + ? new Hashtable<String, Object>(5)
107.31 + : (Hashtable<String, Object>) env;
107.32 if (environment.get(SECURITY_MGR) != null) {
107.33 installSecurityMgr();
107.34 }
107.35 @@ -93,8 +96,9 @@
107.36 * won't close the other).
107.37 */
107.38 // %%% Alternatively, this could be done with a clone() method.
107.39 + @SuppressWarnings("unchecked") // clone()
107.40 RegistryContext(RegistryContext ctx) {
107.41 - environment = (Hashtable)ctx.environment.clone();
107.42 + environment = (Hashtable<String, Object>)ctx.environment.clone();
107.43 registry = ctx.registry;
107.44 host = ctx.host;
107.45 port = ctx.port;
107.46 @@ -195,7 +199,8 @@
107.47 rename(new CompositeName(name), new CompositeName(newName));
107.48 }
107.49
107.50 - public NamingEnumeration list(Name name) throws NamingException {
107.51 + public NamingEnumeration<NameClassPair> list(Name name) throws
107.52 + NamingException {
107.53 if (!name.isEmpty()) {
107.54 throw (new InvalidNameException(
107.55 "RegistryContext: can only list \"\""));
107.56 @@ -208,11 +213,12 @@
107.57 }
107.58 }
107.59
107.60 - public NamingEnumeration list(String name) throws NamingException {
107.61 + public NamingEnumeration<NameClassPair> list(String name) throws
107.62 + NamingException {
107.63 return list(new CompositeName(name));
107.64 }
107.65
107.66 - public NamingEnumeration listBindings(Name name)
107.67 + public NamingEnumeration<Binding> listBindings(Name name)
107.68 throws NamingException
107.69 {
107.70 if (!name.isEmpty()) {
107.71 @@ -227,7 +233,8 @@
107.72 }
107.73 }
107.74
107.75 - public NamingEnumeration listBindings(String name) throws NamingException {
107.76 + public NamingEnumeration<Binding> listBindings(String name) throws
107.77 + NamingException {
107.78 return listBindings(new CompositeName(name));
107.79 }
107.80
107.81 @@ -290,8 +297,9 @@
107.82 return environment.put(propName, propVal);
107.83 }
107.84
107.85 - public Hashtable getEnvironment() throws NamingException {
107.86 - return (Hashtable)environment.clone();
107.87 + @SuppressWarnings("unchecked") // clone()
107.88 + public Hashtable<String, Object> getEnvironment() throws NamingException {
107.89 + return (Hashtable<String, Object>)environment.clone();
107.90 }
107.91
107.92 public void close() {
107.93 @@ -483,11 +491,9 @@
107.94
107.95
107.96 /**
107.97 - * An enumeration of name / class-name pairs. Since we don't know anything
107.98 - * about the classes, each class name is returned as the generic
107.99 - * "java.lang.Object".
107.100 + * An enumeration of name / class-name pairs.
107.101 */
107.102 -class NameClassPairEnumeration implements NamingEnumeration {
107.103 +class NameClassPairEnumeration implements NamingEnumeration<NameClassPair> {
107.104 private final String[] names;
107.105 private int nextName; // index into "names"
107.106
107.107 @@ -500,7 +506,7 @@
107.108 return (nextName < names.length);
107.109 }
107.110
107.111 - public Object next() throws NamingException {
107.112 + public NameClassPair next() throws NamingException {
107.113 if (!hasMore()) {
107.114 throw (new java.util.NoSuchElementException());
107.115 }
107.116 @@ -518,7 +524,7 @@
107.117 return hasMore();
107.118 }
107.119
107.120 - public Object nextElement() {
107.121 + public NameClassPair nextElement() {
107.122 try {
107.123 return next();
107.124 } catch (NamingException e) { // should never happen
107.125 @@ -541,7 +547,7 @@
107.126 * requested. The problem with that approach is that Binding.getObject()
107.127 * cannot throw NamingException.
107.128 */
107.129 -class BindingEnumeration implements NamingEnumeration {
107.130 +class BindingEnumeration implements NamingEnumeration<Binding> {
107.131 private RegistryContext ctx;
107.132 private final String[] names;
107.133 private int nextName; // index into "names"
107.134 @@ -564,7 +570,7 @@
107.135 return (nextName < names.length);
107.136 }
107.137
107.138 - public Object next() throws NamingException {
107.139 + public Binding next() throws NamingException {
107.140 if (!hasMore()) {
107.141 throw (new java.util.NoSuchElementException());
107.142 }
107.143 @@ -584,7 +590,7 @@
107.144 return hasMore();
107.145 }
107.146
107.147 - public Object nextElement() {
107.148 + public Binding nextElement() {
107.149 try {
107.150 return next();
107.151 } catch (NamingException e) {
108.1 --- a/src/share/classes/com/sun/jndi/rmi/registry/RegistryContextFactory.java Thu Sep 01 13:54:38 2011 -0700
108.2 +++ b/src/share/classes/com/sun/jndi/rmi/registry/RegistryContextFactory.java Mon Sep 05 23:58:19 2011 -0700
108.3 @@ -1,5 +1,5 @@
108.4 /*
108.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
108.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
108.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
108.8 *
108.9 * This code is free software; you can redistribute it and/or modify it
108.10 @@ -95,7 +95,7 @@
108.11 return obj;
108.12 }
108.13
108.14 - private static Context URLToContext(String url, Hashtable env)
108.15 + private static Context URLToContext(String url, Hashtable<?,?> env)
108.16 throws NamingException
108.17 {
108.18 rmiURLContextFactory factory = new rmiURLContextFactory();
108.19 @@ -108,7 +108,7 @@
108.20 }
108.21 }
108.22
108.23 - private static Object URLsToObject(String[] urls, Hashtable env)
108.24 + private static Object URLsToObject(String[] urls, Hashtable<?,?> env)
108.25 throws NamingException
108.26 {
108.27 rmiURLContextFactory factory = new rmiURLContextFactory();
108.28 @@ -119,7 +119,7 @@
108.29 * Reads environment to find URL of initial context.
108.30 * The default URL is "rmi:".
108.31 */
108.32 - private static String getInitCtxURL(Hashtable env) {
108.33 + private static String getInitCtxURL(Hashtable<?,?> env) {
108.34
108.35 final String defaultURL = "rmi:";
108.36
108.37 @@ -152,9 +152,9 @@
108.38 int size = 0; // number of URLs
108.39 String[] urls = new String[ref.size()];
108.40
108.41 - Enumeration addrs = ref.getAll();
108.42 + Enumeration<RefAddr> addrs = ref.getAll();
108.43 while (addrs.hasMoreElements()) {
108.44 - RefAddr addr = (RefAddr)addrs.nextElement();
108.45 + RefAddr addr = addrs.nextElement();
108.46
108.47 if ((addr instanceof StringRefAddr) &&
108.48 addr.getType().equals(ADDRESS_TYPE)) {
109.1 --- a/src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java Thu Sep 01 13:54:38 2011 -0700
109.2 +++ b/src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java Mon Sep 05 23:58:19 2011 -0700
109.3 @@ -1,5 +1,5 @@
109.4 /*
109.5 - * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
109.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
109.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
109.8 *
109.9 * This code is free software; you can redistribute it and/or modify it
109.10 @@ -158,7 +158,7 @@
109.11 * Use all String properties from env for initializing ORB
109.12 * @return A non-null ORB.
109.13 */
109.14 - public static ORB getOrb(String server, int port, Hashtable env) {
109.15 + public static ORB getOrb(String server, int port, Hashtable<?,?> env) {
109.16 // See if we can get info from environment
109.17 Properties orbProp;
109.18
109.19 @@ -169,7 +169,7 @@
109.20 orbProp = (Properties) env.clone();
109.21 } else {
109.22 // Get all String properties
109.23 - Enumeration envProp;
109.24 + Enumeration<?> envProp;
109.25 orbProp = new Properties();
109.26 for (envProp = env.keys(); envProp.hasMoreElements();) {
109.27 String key = (String)envProp.nextElement();
109.28 @@ -239,7 +239,7 @@
109.29 // Fields used for reflection of RMI-IIOP
109.30 private static Method toStubMethod = null;
109.31 private static Method connectMethod = null;
109.32 - private static Class corbaStubClass = null;
109.33 + private static Class<?> corbaStubClass = null;
109.34 /**
109.35 * Initializes reflection method handles for RMI-IIOP.
109.36 * @exception ClassNotFoundException javax.rmi.CORBA.* not available
109.37 @@ -252,19 +252,19 @@
109.38
109.39 try {
109.40 connectMethod = corbaStubClass.getMethod("connect",
109.41 - new Class[] {org.omg.CORBA.ORB.class});
109.42 + new Class<?>[] {org.omg.CORBA.ORB.class});
109.43 } catch (NoSuchMethodException e) {
109.44 throw new IllegalStateException(
109.45 "No method definition for javax.rmi.CORBA.Stub.connect(org.omg.CORBA.ORB)");
109.46 }
109.47
109.48 - // Get javax.rmi.PortableRemoteObject method
109.49 - Class proClass = Class.forName("javax.rmi.PortableRemoteObject");
109.50 + // Get javax.rmi.PortableRemoteObject class
109.51 + Class<?> proClass = Class.forName("javax.rmi.PortableRemoteObject");
109.52
109.53 - // Get javax.rmi.PortableRemoteObject(java.rmi.Remote) method
109.54 + // Get javax.rmi.PortableRemoteObject.toStub(java.rmi.Remote) method
109.55 try {
109.56 toStubMethod = proClass.getMethod("toStub",
109.57 - new Class[] {java.rmi.Remote.class});
109.58 + new Class<?>[] {java.rmi.Remote.class});
109.59
109.60 } catch (NoSuchMethodException e) {
109.61 throw new IllegalStateException(
110.1 --- a/src/share/classes/com/sun/jndi/toolkit/ctx/AtomicContext.java Thu Sep 01 13:54:38 2011 -0700
110.2 +++ b/src/share/classes/com/sun/jndi/toolkit/ctx/AtomicContext.java Mon Sep 05 23:58:19 2011 -0700
110.3 @@ -1,5 +1,5 @@
110.4 /*
110.5 - * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
110.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
110.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
110.8 *
110.9 * This code is free software; you can redistribute it and/or modify it
110.10 @@ -26,7 +26,6 @@
110.11 package com.sun.jndi.toolkit.ctx;
110.12
110.13 import javax.naming.*;
110.14 -import javax.naming.spi.ResolveResult;
110.15
110.16 /**
110.17 * Clients: deal only with names for its own naming service
110.18 @@ -58,9 +57,9 @@
110.19 protected abstract Object a_lookupLink(String name, Continuation cont)
110.20 throws NamingException;
110.21
110.22 - protected abstract NamingEnumeration a_list(
110.23 + protected abstract NamingEnumeration<NameClassPair> a_list(
110.24 Continuation cont) throws NamingException;
110.25 - protected abstract NamingEnumeration a_listBindings(
110.26 + protected abstract NamingEnumeration<Binding> a_listBindings(
110.27 Continuation cont) throws NamingException;
110.28 protected abstract void a_bind(String name, Object obj, Continuation cont)
110.29 throws NamingException;
110.30 @@ -193,12 +192,12 @@
110.31 return null;
110.32 }
110.33
110.34 - protected NamingEnumeration a_list_nns(Continuation cont)
110.35 + protected NamingEnumeration<NameClassPair> a_list_nns(Continuation cont)
110.36 throws NamingException {
110.37 a_processJunction_nns(cont);
110.38 return null;
110.39 }
110.40 - protected NamingEnumeration a_listBindings_nns(Continuation cont)
110.41 + protected NamingEnumeration<Binding> a_listBindings_nns(Continuation cont)
110.42 throws NamingException {
110.43 a_processJunction_nns(cont);
110.44 return null;
110.45 @@ -273,7 +272,7 @@
110.46 return null;
110.47 }
110.48
110.49 - protected NamingEnumeration c_list(Name name,
110.50 + protected NamingEnumeration<NameClassPair> c_list(Name name,
110.51 Continuation cont) throws NamingException {
110.52 if (resolve_to_context(name, cont)) {
110.53 return a_list(cont);
110.54 @@ -281,7 +280,7 @@
110.55 return null;
110.56 }
110.57
110.58 - protected NamingEnumeration c_listBindings(Name name,
110.59 + protected NamingEnumeration<Binding> c_listBindings(Name name,
110.60 Continuation cont) throws NamingException {
110.61 if (resolve_to_context(name, cont)) {
110.62 return a_listBindings(cont);
110.63 @@ -392,7 +391,7 @@
110.64 }
110.65 }
110.66
110.67 - protected NamingEnumeration c_list_nns(Name name,
110.68 + protected NamingEnumeration<NameClassPair> c_list_nns(Name name,
110.69 Continuation cont) throws NamingException {
110.70 if (_contextType == _ATOMIC) {
110.71 resolve_to_nns_and_continue(name, cont);
110.72 @@ -403,14 +402,14 @@
110.73 }
110.74 }
110.75
110.76 - protected NamingEnumeration c_listBindings_nns(Name name,
110.77 + protected NamingEnumeration<Binding> c_listBindings_nns(Name name,
110.78 Continuation cont) throws NamingException {
110.79 if (_contextType == _ATOMIC) {
110.80 resolve_to_nns_and_continue(name, cont);
110.81 return null;
110.82 } else {
110.83 // use ComponentContext
110.84 - return super.c_list_nns(name, cont);
110.85 + return super.c_listBindings_nns(name, cont);
110.86 }
110.87 }
110.88
111.1 --- a/src/share/classes/com/sun/jndi/toolkit/ctx/AtomicDirContext.java Thu Sep 01 13:54:38 2011 -0700
111.2 +++ b/src/share/classes/com/sun/jndi/toolkit/ctx/AtomicDirContext.java Mon Sep 05 23:58:19 2011 -0700
111.3 @@ -1,5 +1,5 @@
111.4 /*
111.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
111.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
111.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
111.8 *
111.9 * This code is free software; you can redistribute it and/or modify it
111.10 @@ -27,7 +27,6 @@
111.11
111.12 import javax.naming.*;
111.13 import javax.naming.directory.*;
111.14 -import javax.naming.spi.ResolveResult;
111.15
111.16 /**
111.17 * Direct subclasses of AtomicDirContext must provide implementations for
111.18 @@ -79,20 +78,25 @@
111.19 Continuation cont)
111.20 throws NamingException;
111.21
111.22 - protected abstract NamingEnumeration a_search(Attributes matchingAttributes,
111.23 + protected abstract NamingEnumeration<SearchResult> a_search(
111.24 + Attributes matchingAttributes,
111.25 String[] attributesToReturn,
111.26 Continuation cont)
111.27 throws NamingException;
111.28
111.29 - protected abstract NamingEnumeration a_search(String name,
111.30 + protected abstract NamingEnumeration<SearchResult> a_search(
111.31 + String name,
111.32 String filterExpr,
111.33 Object[] filterArgs,
111.34 - SearchControls cons, Continuation cont)
111.35 + SearchControls cons,
111.36 + Continuation cont)
111.37 throws NamingException;
111.38
111.39 - protected abstract NamingEnumeration a_search(String name,
111.40 + protected abstract NamingEnumeration<SearchResult> a_search(
111.41 + String name,
111.42 String filter,
111.43 - SearchControls cons, Continuation cont)
111.44 + SearchControls cons,
111.45 + Continuation cont)
111.46 throws NamingException;
111.47
111.48 protected abstract DirContext a_getSchema(Continuation cont)
111.49 @@ -163,7 +167,8 @@
111.50 return null;
111.51 }
111.52
111.53 - protected NamingEnumeration a_search_nns(Attributes matchingAttributes,
111.54 + protected NamingEnumeration<SearchResult> a_search_nns(
111.55 + Attributes matchingAttributes,
111.56 String[] attributesToReturn,
111.57 Continuation cont)
111.58 throws NamingException {
111.59 @@ -171,20 +176,20 @@
111.60 return null;
111.61 }
111.62
111.63 - protected NamingEnumeration a_search_nns(String name,
111.64 - String filterExpr,
111.65 - Object[] filterArgs,
111.66 - SearchControls cons,
111.67 - Continuation cont)
111.68 + protected NamingEnumeration<SearchResult> a_search_nns(String name,
111.69 + String filterExpr,
111.70 + Object[] filterArgs,
111.71 + SearchControls cons,
111.72 + Continuation cont)
111.73 throws NamingException {
111.74 a_processJunction_nns(name, cont);
111.75 return null;
111.76 }
111.77
111.78 - protected NamingEnumeration a_search_nns(String name,
111.79 - String filter,
111.80 - SearchControls cons,
111.81 - Continuation cont)
111.82 + protected NamingEnumeration<SearchResult> a_search_nns(String name,
111.83 + String filter,
111.84 + SearchControls cons,
111.85 + Continuation cont)
111.86 throws NamingException {
111.87 a_processJunction_nns(name, cont);
111.88 return null;
111.89 @@ -250,7 +255,7 @@
111.90 return null;
111.91 }
111.92
111.93 - protected NamingEnumeration c_search(Name name,
111.94 + protected NamingEnumeration<SearchResult> c_search(Name name,
111.95 Attributes matchingAttributes,
111.96 String[] attributesToReturn,
111.97 Continuation cont)
111.98 @@ -260,19 +265,21 @@
111.99 return null;
111.100 }
111.101
111.102 - protected NamingEnumeration c_search(Name name,
111.103 - String filter,
111.104 - SearchControls cons, Continuation cont)
111.105 + protected NamingEnumeration<SearchResult> c_search(Name name,
111.106 + String filter,
111.107 + SearchControls cons,
111.108 + Continuation cont)
111.109 throws NamingException {
111.110 if (resolve_to_penultimate_context(name, cont))
111.111 return a_search(name.toString(), filter, cons, cont);
111.112 return null;
111.113 }
111.114
111.115 - protected NamingEnumeration c_search(Name name,
111.116 - String filterExpr,
111.117 - Object[] filterArgs,
111.118 - SearchControls cons, Continuation cont)
111.119 + protected NamingEnumeration<SearchResult> c_search(Name name,
111.120 + String filterExpr,
111.121 + Object[] filterArgs,
111.122 + SearchControls cons,
111.123 + Continuation cont)
111.124 throws NamingException {
111.125 if (resolve_to_penultimate_context(name, cont))
111.126 return a_search(name.toString(), filterExpr, filterArgs, cons, cont);
111.127 @@ -340,7 +347,8 @@
111.128 return null;
111.129 }
111.130
111.131 - protected NamingEnumeration c_search_nns(Name name,
111.132 + protected NamingEnumeration<SearchResult> c_search_nns(
111.133 + Name name,
111.134 Attributes matchingAttributes,
111.135 String[] attributesToReturn,
111.136 Continuation cont)
111.137 @@ -349,20 +357,21 @@
111.138 return null;
111.139 }
111.140
111.141 - protected NamingEnumeration c_search_nns(Name name,
111.142 - String filter,
111.143 - SearchControls cons, Continuation cont)
111.144 + protected NamingEnumeration<SearchResult> c_search_nns(Name name,
111.145 + String filter,
111.146 + SearchControls cons,
111.147 + Continuation cont)
111.148 throws NamingException {
111.149 if (resolve_to_penultimate_context_nns(name, cont))
111.150 return a_search_nns(name.toString(), filter, cons, cont);
111.151 return null;
111.152 }
111.153
111.154 - protected NamingEnumeration c_search_nns(Name name,
111.155 - String filterExpr,
111.156 - Object[] filterArgs,
111.157 - SearchControls cons,
111.158 - Continuation cont)
111.159 + protected NamingEnumeration<SearchResult> c_search_nns(Name name,
111.160 + String filterExpr,
111.161 + Object[] filterArgs,
111.162 + SearchControls cons,
111.163 + Continuation cont)
111.164 throws NamingException {
111.165 if (resolve_to_penultimate_context_nns(name, cont))
111.166 return a_search_nns(name.toString(), filterExpr, filterArgs,
112.1 --- a/src/share/classes/com/sun/jndi/toolkit/ctx/ComponentContext.java Thu Sep 01 13:54:38 2011 -0700
112.2 +++ b/src/share/classes/com/sun/jndi/toolkit/ctx/ComponentContext.java Mon Sep 05 23:58:19 2011 -0700
112.3 @@ -1,5 +1,5 @@
112.4 /*
112.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
112.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
112.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
112.8 *
112.9 * This code is free software; you can redistribute it and/or modify it
112.10 @@ -25,8 +25,6 @@
112.11
112.12 package com.sun.jndi.toolkit.ctx;
112.13
112.14 -import java.util.Hashtable;
112.15 -
112.16 import javax.naming.*;
112.17 import javax.naming.spi.ResolveResult;
112.18
112.19 @@ -57,9 +55,9 @@
112.20 protected abstract Object c_lookupLink(Name name, Continuation cont)
112.21 throws NamingException;
112.22
112.23 - protected abstract NamingEnumeration c_list(Name name,
112.24 + protected abstract NamingEnumeration<NameClassPair> c_list(Name name,
112.25 Continuation cont) throws NamingException;
112.26 - protected abstract NamingEnumeration c_listBindings(Name name,
112.27 + protected abstract NamingEnumeration<Binding> c_listBindings(Name name,
112.28 Continuation cont) throws NamingException;
112.29 protected abstract void c_bind(Name name, Object obj, Continuation cont)
112.30 throws NamingException;
112.31 @@ -237,13 +235,13 @@
112.32 return null;
112.33 }
112.34
112.35 - protected NamingEnumeration c_list_nns(Name name,
112.36 + protected NamingEnumeration<NameClassPair> c_list_nns(Name name,
112.37 Continuation cont) throws NamingException {
112.38 c_processJunction_nns(name, cont);
112.39 return null;
112.40 }
112.41
112.42 - protected NamingEnumeration c_listBindings_nns(Name name,
112.43 + protected NamingEnumeration<Binding> c_listBindings_nns(Name name,
112.44 Continuation cont) throws NamingException {
112.45 c_processJunction_nns(name, cont);
112.46 return null;
112.47 @@ -495,7 +493,7 @@
112.48 /* implementation for Resolver method */
112.49
112.50 protected ResolveResult p_resolveToClass(Name name,
112.51 - Class contextType,
112.52 + Class<?> contextType,
112.53 Continuation cont)
112.54 throws NamingException {
112.55
112.56 @@ -556,9 +554,9 @@
112.57 return ret;
112.58 }
112.59
112.60 - protected NamingEnumeration p_list(Name name, Continuation cont)
112.61 + protected NamingEnumeration<NameClassPair> p_list(Name name, Continuation cont)
112.62 throws NamingException {
112.63 - NamingEnumeration ret = null;
112.64 + NamingEnumeration<NameClassPair> ret = null;
112.65 HeadTail res = p_resolveIntermediate(name, cont);
112.66 switch (res.getStatus()) {
112.67 case TERMINAL_NNS_COMPONENT:
112.68 @@ -581,9 +579,9 @@
112.69 return ret;
112.70 }
112.71
112.72 - protected NamingEnumeration p_listBindings(Name name, Continuation cont) throws
112.73 + protected NamingEnumeration<Binding> p_listBindings(Name name, Continuation cont) throws
112.74 NamingException {
112.75 - NamingEnumeration ret = null;
112.76 + NamingEnumeration<Binding> ret = null;
112.77 HeadTail res = p_resolveIntermediate(name, cont);
112.78 switch (res.getStatus()) {
112.79 case TERMINAL_NNS_COMPONENT:
113.1 --- a/src/share/classes/com/sun/jndi/toolkit/ctx/ComponentDirContext.java Thu Sep 01 13:54:38 2011 -0700
113.2 +++ b/src/share/classes/com/sun/jndi/toolkit/ctx/ComponentDirContext.java Mon Sep 05 23:58:19 2011 -0700
113.3 @@ -1,5 +1,5 @@
113.4 /*
113.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
113.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
113.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
113.8 *
113.9 * This code is free software; you can redistribute it and/or modify it
113.10 @@ -28,8 +28,6 @@
113.11 import javax.naming.*;
113.12 import javax.naming.directory.*;
113.13
113.14 -import javax.naming.spi.ResolveResult;
113.15 -
113.16 /* Direct subclasses of ComponentDirContext must provide implementations for
113.17 * the abstract c_ DirContext methods, and override the c_ Context methods
113.18 * (which are no longer abstract because they have been overriden by
113.19 @@ -81,23 +79,26 @@
113.20 Continuation cont)
113.21 throws NamingException;
113.22
113.23 - protected abstract NamingEnumeration c_search(Name name,
113.24 - Attributes matchingAttributes,
113.25 - String[] attributesToReturn,
113.26 - Continuation cont)
113.27 + protected abstract NamingEnumeration<SearchResult> c_search(
113.28 + Name name,
113.29 + Attributes matchingAttributes,
113.30 + String[] attributesToReturn,
113.31 + Continuation cont)
113.32 throws NamingException;
113.33
113.34 - protected abstract NamingEnumeration c_search(Name name,
113.35 - String filter,
113.36 - SearchControls cons,
113.37 - Continuation cont)
113.38 + protected abstract NamingEnumeration<SearchResult> c_search(
113.39 + Name name,
113.40 + String filter,
113.41 + SearchControls cons,
113.42 + Continuation cont)
113.43 throws NamingException;
113.44
113.45 - protected abstract NamingEnumeration c_search(Name name,
113.46 - String filterExpr,
113.47 - Object[] filterArgs,
113.48 - SearchControls cons,
113.49 - Continuation cont)
113.50 + protected abstract NamingEnumeration<SearchResult> c_search(
113.51 + Name name,
113.52 + String filterExpr,
113.53 + Object[] filterArgs,
113.54 + SearchControls cons,
113.55 + Continuation cont)
113.56 throws NamingException;
113.57
113.58 protected abstract DirContext c_getSchema(Name name, Continuation cont)
113.59 @@ -172,29 +173,32 @@
113.60 return null;
113.61 }
113.62
113.63 - protected NamingEnumeration c_search_nns(Name name,
113.64 - Attributes matchingAttributes,
113.65 - String[] attributesToReturn,
113.66 - Continuation cont)
113.67 + protected NamingEnumeration<SearchResult> c_search_nns(
113.68 + Name name,
113.69 + Attributes matchingAttributes,
113.70 + String[] attributesToReturn,
113.71 + Continuation cont)
113.72 throws NamingException {
113.73 c_processJunction_nns(name, cont);
113.74 return null;
113.75 }
113.76
113.77 - protected NamingEnumeration c_search_nns(Name name,
113.78 - String filter,
113.79 - SearchControls cons,
113.80 - Continuation cont)
113.81 + protected NamingEnumeration<SearchResult> c_search_nns(
113.82 + Name name,
113.83 + String filter,
113.84 + SearchControls cons,
113.85 + Continuation cont)
113.86 throws NamingException {
113.87 c_processJunction_nns(name, cont);
113.88 return null;
113.89 }
113.90
113.91 - protected NamingEnumeration c_search_nns(Name name,
113.92 - String filterExpr,
113.93 - Object[] filterArgs,
113.94 - SearchControls cons,
113.95 - Continuation cont)
113.96 + protected NamingEnumeration<SearchResult> c_search_nns(
113.97 + Name name,
113.98 + String filterExpr,
113.99 + Object[] filterArgs,
113.100 + SearchControls cons,
113.101 + Continuation cont)
113.102 throws NamingException {
113.103 c_processJunction_nns(name, cont);
113.104 return null;
113.105 @@ -345,13 +349,14 @@
113.106 return answer;
113.107 }
113.108
113.109 - protected NamingEnumeration p_search(Name name,
113.110 - Attributes matchingAttributes,
113.111 - String[] attributesToReturn,
113.112 - Continuation cont)
113.113 + protected NamingEnumeration<SearchResult> p_search(
113.114 + Name name,
113.115 + Attributes matchingAttributes,
113.116 + String[] attributesToReturn,
113.117 + Continuation cont)
113.118 throws NamingException {
113.119 HeadTail res = p_resolveIntermediate(name, cont);
113.120 - NamingEnumeration answer = null;
113.121 + NamingEnumeration<SearchResult> answer = null;
113.122 switch (res.getStatus()) {
113.123 case TERMINAL_NNS_COMPONENT:
113.124 answer = c_search_nns(res.getHead(), matchingAttributes,
113.125 @@ -371,12 +376,13 @@
113.126 return answer;
113.127 }
113.128
113.129 - protected NamingEnumeration p_search(Name name,
113.130 - String filter,
113.131 - SearchControls cons, Continuation cont)
113.132 + protected NamingEnumeration<SearchResult> p_search(Name name,
113.133 + String filter,
113.134 + SearchControls cons,
113.135 + Continuation cont)
113.136 throws NamingException {
113.137 HeadTail res = p_resolveIntermediate(name, cont);
113.138 - NamingEnumeration answer = null;
113.139 + NamingEnumeration<SearchResult> answer = null;
113.140 switch (res.getStatus()) {
113.141 case TERMINAL_NNS_COMPONENT:
113.142 answer = c_search_nns(res.getHead(), filter, cons, cont);
113.143 @@ -394,14 +400,14 @@
113.144 return answer;
113.145 }
113.146
113.147 - protected NamingEnumeration p_search(Name name,
113.148 - String filterExpr,
113.149 - Object[] filterArgs,
113.150 - SearchControls cons,
113.151 - Continuation cont)
113.152 + protected NamingEnumeration<SearchResult> p_search(Name name,
113.153 + String filterExpr,
113.154 + Object[] filterArgs,
113.155 + SearchControls cons,
113.156 + Continuation cont)
113.157 throws NamingException {
113.158 HeadTail res = p_resolveIntermediate(name, cont);
113.159 - NamingEnumeration answer = null;
113.160 + NamingEnumeration<SearchResult> answer = null;
113.161 switch (res.getStatus()) {
113.162 case TERMINAL_NNS_COMPONENT:
113.163 answer = c_search_nns(res.getHead(),
114.1 --- a/src/share/classes/com/sun/jndi/toolkit/ctx/Continuation.java Thu Sep 01 13:54:38 2011 -0700
114.2 +++ b/src/share/classes/com/sun/jndi/toolkit/ctx/Continuation.java Mon Sep 05 23:58:19 2011 -0700
114.3 @@ -57,7 +57,7 @@
114.4 * The environment used by the caller. Initialized by constructor and
114.5 * used when filling out a CannotProceedException.
114.6 */
114.7 - protected Hashtable environment = null;
114.8 + protected Hashtable<?,?> environment = null;
114.9
114.10 /**
114.11 * Indicates whether the Continuation instance indicates that the operation
114.12 @@ -94,7 +94,7 @@
114.13 * @param environment The environment used by the caller. It is used
114.14 * when setting the "environment" of a CannotProceedException.
114.15 */
114.16 - public Continuation(Name top, Hashtable environment) {
114.17 + public Continuation(Name top, Hashtable<?,?> environment) {
114.18 super();
114.19 starter = top;
114.20 this.environment = environment;
114.21 @@ -154,8 +154,8 @@
114.22
114.23 if ((e instanceof CannotProceedException)) {
114.24 CannotProceedException cpe = (CannotProceedException)e;
114.25 - Hashtable env = (environment == null ?
114.26 - new Hashtable(11) : (Hashtable)environment.clone());
114.27 + Hashtable<?,?> env = (environment == null ?
114.28 + new Hashtable<>(11) : (Hashtable<?,?>)environment.clone());
114.29 cpe.setEnvironment(env);
114.30 cpe.setAltNameCtx(resolvedContext);
114.31 cpe.setAltName(relativeResolvedName);
115.1 --- a/src/share/classes/com/sun/jndi/toolkit/ctx/PartialCompositeContext.java Thu Sep 01 13:54:38 2011 -0700
115.2 +++ b/src/share/classes/com/sun/jndi/toolkit/ctx/PartialCompositeContext.java Mon Sep 05 23:58:19 2011 -0700
115.3 @@ -1,5 +1,5 @@
115.4 /*
115.5 - * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
115.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
115.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
115.8 *
115.9 * This code is free software; you can redistribute it and/or modify it
115.10 @@ -77,16 +77,16 @@
115.11
115.12 /* Equivalent to method in Resolver interface */
115.13 protected abstract ResolveResult p_resolveToClass(Name name,
115.14 - Class contextType, Continuation cont) throws NamingException;
115.15 + Class<?> contextType, Continuation cont) throws NamingException;
115.16
115.17 /* Equivalent to methods in Context interface */
115.18 protected abstract Object p_lookup(Name name, Continuation cont)
115.19 throws NamingException;
115.20 protected abstract Object p_lookupLink(Name name, Continuation cont)
115.21 throws NamingException;
115.22 - protected abstract NamingEnumeration p_list(Name name,
115.23 + protected abstract NamingEnumeration<NameClassPair> p_list(Name name,
115.24 Continuation cont) throws NamingException;
115.25 - protected abstract NamingEnumeration p_listBindings(Name name,
115.26 + protected abstract NamingEnumeration<Binding> p_listBindings(Name name,
115.27 Continuation cont) throws NamingException;
115.28 protected abstract void p_bind(Name name, Object obj, Continuation cont)
115.29 throws NamingException;
115.30 @@ -115,7 +115,7 @@
115.31 * The toolkit knows to clone when necessary.
115.32 * @return The possibly null environment of the context.
115.33 */
115.34 - protected Hashtable p_getEnvironment() throws NamingException {
115.35 + protected Hashtable<?,?> p_getEnvironment() throws NamingException {
115.36 return getEnvironment();
115.37 }
115.38
115.39 @@ -137,7 +137,7 @@
115.40 throws NamingException
115.41 {
115.42 PartialCompositeContext ctx = this;
115.43 - Hashtable env = p_getEnvironment();
115.44 + Hashtable<?,?> env = p_getEnvironment();
115.45 Continuation cont = new Continuation(name, env);
115.46 ResolveResult answer;
115.47 Name nm = name;
115.48 @@ -168,7 +168,7 @@
115.49
115.50 public Object lookup(Name name) throws NamingException {
115.51 PartialCompositeContext ctx = this;
115.52 - Hashtable env = p_getEnvironment();
115.53 + Hashtable<?,?> env = p_getEnvironment();
115.54 Continuation cont = new Continuation(name, env);
115.55 Object answer;
115.56 Name nm = name;
115.57 @@ -194,7 +194,7 @@
115.58 public void bind(Name name, Object newObj) throws NamingException {
115.59 PartialCompositeContext ctx = this;
115.60 Name nm = name;
115.61 - Hashtable env = p_getEnvironment();
115.62 + Hashtable<?,?> env = p_getEnvironment();
115.63 Continuation cont = new Continuation(name, env);
115.64
115.65 try {
115.66 @@ -216,7 +216,7 @@
115.67 public void rebind(Name name, Object newObj) throws NamingException {
115.68 PartialCompositeContext ctx = this;
115.69 Name nm = name;
115.70 - Hashtable env = p_getEnvironment();
115.71 + Hashtable<?,?> env = p_getEnvironment();
115.72 Continuation cont = new Continuation(name, env);
115.73
115.74 try {
115.75 @@ -238,7 +238,7 @@
115.76 public void unbind(Name name) throws NamingException {
115.77 PartialCompositeContext ctx = this;
115.78 Name nm = name;
115.79 - Hashtable env = p_getEnvironment();
115.80 + Hashtable<?,?> env = p_getEnvironment();
115.81 Continuation cont = new Continuation(name, env);
115.82
115.83 try {
115.84 @@ -262,7 +262,7 @@
115.85 {
115.86 PartialCompositeContext ctx = this;
115.87 Name nm = oldName;
115.88 - Hashtable env = p_getEnvironment();
115.89 + Hashtable<?,?> env = p_getEnvironment();
115.90 Continuation cont = new Continuation(oldName, env);
115.91
115.92 try {
115.93 @@ -293,8 +293,8 @@
115.94 {
115.95 PartialCompositeContext ctx = this;
115.96 Name nm = name;
115.97 - NamingEnumeration answer;
115.98 - Hashtable env = p_getEnvironment();
115.99 + NamingEnumeration<NameClassPair> answer;
115.100 + Hashtable<?,?> env = p_getEnvironment();
115.101 Continuation cont = new Continuation(name, env);
115.102
115.103 try {
115.104 @@ -322,8 +322,8 @@
115.105 {
115.106 PartialCompositeContext ctx = this;
115.107 Name nm = name;
115.108 - NamingEnumeration answer;
115.109 - Hashtable env = p_getEnvironment();
115.110 + NamingEnumeration<Binding> answer;
115.111 + Hashtable<?,?> env = p_getEnvironment();
115.112 Continuation cont = new Continuation(name, env);
115.113
115.114 try {
115.115 @@ -347,7 +347,7 @@
115.116 public void destroySubcontext(Name name) throws NamingException {
115.117 PartialCompositeContext ctx = this;
115.118 Name nm = name;
115.119 - Hashtable env = p_getEnvironment();
115.120 + Hashtable<?,?> env = p_getEnvironment();
115.121 Continuation cont = new Continuation(name, env);
115.122
115.123 try {
115.124 @@ -371,7 +371,7 @@
115.125 PartialCompositeContext ctx = this;
115.126 Name nm = name;
115.127 Context answer;
115.128 - Hashtable env = p_getEnvironment();
115.129 + Hashtable<?,?> env = p_getEnvironment();
115.130 Continuation cont = new Continuation(name, env);
115.131
115.132 try {
115.133 @@ -394,7 +394,7 @@
115.134
115.135 public Object lookupLink(Name name) throws NamingException {
115.136 PartialCompositeContext ctx = this;
115.137 - Hashtable env = p_getEnvironment();
115.138 + Hashtable<?,?> env = p_getEnvironment();
115.139 Continuation cont = new Continuation(name, env);
115.140 Object answer;
115.141 Name nm = name;
115.142 @@ -421,7 +421,7 @@
115.143 PartialCompositeContext ctx = this;
115.144 Name nm = name;
115.145 NameParser answer;
115.146 - Hashtable env = p_getEnvironment();
115.147 + Hashtable<?,?> env = p_getEnvironment();
115.148 Continuation cont = new Continuation(name, env);
115.149
115.150 try {
116.1 --- a/src/share/classes/com/sun/jndi/toolkit/ctx/PartialCompositeDirContext.java Thu Sep 01 13:54:38 2011 -0700
116.2 +++ b/src/share/classes/com/sun/jndi/toolkit/ctx/PartialCompositeDirContext.java Mon Sep 05 23:58:19 2011 -0700
116.3 @@ -1,5 +1,5 @@
116.4 /*
116.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
116.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
116.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
116.8 *
116.9 * This code is free software; you can redistribute it and/or modify it
116.10 @@ -29,7 +29,6 @@
116.11
116.12 import javax.naming.*;
116.13 import javax.naming.directory.*;
116.14 -import javax.naming.spi.NamingManager;
116.15 import javax.naming.spi.DirectoryManager;
116.16
116.17 /*
116.18 @@ -83,23 +82,26 @@
116.19 Continuation cont)
116.20 throws NamingException;
116.21
116.22 - protected abstract NamingEnumeration p_search(Name name,
116.23 - Attributes matchingAttributes,
116.24 - String[] attributesToReturn,
116.25 - Continuation cont)
116.26 + protected abstract NamingEnumeration<SearchResult> p_search(
116.27 + Name name,
116.28 + Attributes matchingAttributes,
116.29 + String[] attributesToReturn,
116.30 + Continuation cont)
116.31 throws NamingException;
116.32
116.33 - protected abstract NamingEnumeration p_search(Name name,
116.34 - String filter,
116.35 - SearchControls cons,
116.36 - Continuation cont)
116.37 + protected abstract NamingEnumeration<SearchResult> p_search(
116.38 + Name name,
116.39 + String filter,
116.40 + SearchControls cons,
116.41 + Continuation cont)
116.42 throws NamingException;
116.43
116.44 - protected abstract NamingEnumeration p_search(Name name,
116.45 - String filterExpr,
116.46 - Object[] filterArgs,
116.47 - SearchControls cons,
116.48 - Continuation cont)
116.49 + protected abstract NamingEnumeration<SearchResult> p_search(
116.50 + Name name,
116.51 + String filterExpr,
116.52 + Object[] filterArgs,
116.53 + SearchControls cons,
116.54 + Continuation cont)
116.55 throws NamingException;
116.56
116.57 protected abstract DirContext p_getSchema(Name name, Continuation cont)
116.58 @@ -130,7 +132,7 @@
116.59 public Attributes getAttributes(Name name, String[] attrIds)
116.60 throws NamingException {
116.61 PartialCompositeDirContext ctx = this;
116.62 - Hashtable env = p_getEnvironment();
116.63 + Hashtable<?,?> env = p_getEnvironment();
116.64 Continuation cont = new Continuation(name, env);
116.65 Attributes answer;
116.66 Name nm = name;
116.67 @@ -157,7 +159,7 @@
116.68 public void modifyAttributes(Name name, int mod_op, Attributes attrs)
116.69 throws NamingException {
116.70 PartialCompositeDirContext ctx = this;
116.71 - Hashtable env = p_getEnvironment();
116.72 + Hashtable<?,?> env = p_getEnvironment();
116.73 Continuation cont = new Continuation(name, env);
116.74 Name nm = name;
116.75
116.76 @@ -182,7 +184,7 @@
116.77 public void modifyAttributes(Name name, ModificationItem[] mods)
116.78 throws NamingException {
116.79 PartialCompositeDirContext ctx = this;
116.80 - Hashtable env = p_getEnvironment();
116.81 + Hashtable<?,?> env = p_getEnvironment();
116.82 Continuation cont = new Continuation(name, env);
116.83 Name nm = name;
116.84
116.85 @@ -207,7 +209,7 @@
116.86 public void bind(Name name, Object obj, Attributes attrs)
116.87 throws NamingException {
116.88 PartialCompositeDirContext ctx = this;
116.89 - Hashtable env = p_getEnvironment();
116.90 + Hashtable<?,?> env = p_getEnvironment();
116.91 Continuation cont = new Continuation(name, env);
116.92 Name nm = name;
116.93
116.94 @@ -232,7 +234,7 @@
116.95 public void rebind(Name name, Object obj, Attributes attrs)
116.96 throws NamingException {
116.97 PartialCompositeDirContext ctx = this;
116.98 - Hashtable env = p_getEnvironment();
116.99 + Hashtable<?,?> env = p_getEnvironment();
116.100 Continuation cont = new Continuation(name, env);
116.101 Name nm = name;
116.102
116.103 @@ -257,7 +259,7 @@
116.104 public DirContext createSubcontext(Name name, Attributes attrs)
116.105 throws NamingException {
116.106 PartialCompositeDirContext ctx = this;
116.107 - Hashtable env = p_getEnvironment();
116.108 + Hashtable<?,?> env = p_getEnvironment();
116.109 Continuation cont = new Continuation(name, env);
116.110 DirContext answer;
116.111 Name nm = name;
116.112 @@ -308,9 +310,9 @@
116.113 {
116.114
116.115 PartialCompositeDirContext ctx = this;
116.116 - Hashtable env = p_getEnvironment();
116.117 + Hashtable<?,?> env = p_getEnvironment();
116.118 Continuation cont = new Continuation(name, env);
116.119 - NamingEnumeration answer;
116.120 + NamingEnumeration<SearchResult> answer;
116.121 Name nm = name;
116.122
116.123 try {
116.124 @@ -347,9 +349,9 @@
116.125 {
116.126
116.127 PartialCompositeDirContext ctx = this;
116.128 - Hashtable env = p_getEnvironment();
116.129 + Hashtable<?,?> env = p_getEnvironment();
116.130 Continuation cont = new Continuation(name, env);
116.131 - NamingEnumeration answer;
116.132 + NamingEnumeration<SearchResult> answer;
116.133 Name nm = name;
116.134
116.135 try {
116.136 @@ -385,9 +387,9 @@
116.137 {
116.138
116.139 PartialCompositeDirContext ctx = this;
116.140 - Hashtable env = p_getEnvironment();
116.141 + Hashtable<?,?> env = p_getEnvironment();
116.142 Continuation cont = new Continuation(name, env);
116.143 - NamingEnumeration answer;
116.144 + NamingEnumeration<SearchResult> answer;
116.145 Name nm = name;
116.146
116.147 try {
116.148 @@ -411,7 +413,7 @@
116.149
116.150 public DirContext getSchema(Name name) throws NamingException {
116.151 PartialCompositeDirContext ctx = this;
116.152 - Hashtable env = p_getEnvironment();
116.153 + Hashtable<?,?> env = p_getEnvironment();
116.154 Continuation cont = new Continuation(name, env);
116.155 DirContext answer;
116.156 Name nm = name;
116.157 @@ -438,7 +440,7 @@
116.158 public DirContext getSchemaClassDefinition(Name name)
116.159 throws NamingException {
116.160 PartialCompositeDirContext ctx = this;
116.161 - Hashtable env = p_getEnvironment();
116.162 + Hashtable<?,?> env = p_getEnvironment();
116.163 Continuation cont = new Continuation(name, env);
116.164 DirContext answer;
116.165 Name nm = name;
116.166 @@ -509,14 +511,14 @@
116.167 throw cont.fillInException(e);
116.168 }
116.169
116.170 - protected NamingEnumeration a_list(
116.171 + protected NamingEnumeration<NameClassPair> a_list(
116.172 Continuation cont) throws NamingException {
116.173 OperationNotSupportedException e = new
116.174 OperationNotSupportedException();
116.175 throw cont.fillInException(e);
116.176 }
116.177
116.178 - protected NamingEnumeration a_listBindings(
116.179 + protected NamingEnumeration<Binding> a_listBindings(
116.180 Continuation cont) throws NamingException {
116.181 OperationNotSupportedException e = new
116.182 OperationNotSupportedException();
117.1 --- a/src/share/classes/com/sun/jndi/toolkit/dir/ContainmentFilter.java Thu Sep 01 13:54:38 2011 -0700
117.2 +++ b/src/share/classes/com/sun/jndi/toolkit/dir/ContainmentFilter.java Mon Sep 05 23:58:19 2011 -0700
117.3 @@ -1,5 +1,5 @@
117.4 /*
117.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
117.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
117.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
117.8 *
117.9 * This code is free software; you can redistribute it and/or modify it
117.10 @@ -56,19 +56,19 @@
117.11 if (subset == null)
117.12 return true; // an empty set is always a subset
117.13
117.14 - NamingEnumeration m = subset.getAll();
117.15 + NamingEnumeration<? extends Attribute> m = subset.getAll();
117.16 while (m.hasMore()) {
117.17 if (superset == null) {
117.18 return false; // contains nothing
117.19 }
117.20 - Attribute target = (Attribute) m.next();
117.21 + Attribute target = m.next();
117.22 Attribute fromSuper = superset.get(target.getID());
117.23 if (fromSuper == null) {
117.24 return false;
117.25 } else {
117.26 // check whether attribute values match
117.27 if (target.size() > 0) {
117.28 - NamingEnumeration vals = target.getAll();
117.29 + NamingEnumeration<?> vals = target.getAll();
117.30 while (vals.hasMore()) {
117.31 if (!fromSuper.contains(vals.next())) {
117.32 return false;
118.1 --- a/src/share/classes/com/sun/jndi/toolkit/dir/ContextEnumerator.java Thu Sep 01 13:54:38 2011 -0700
118.2 +++ b/src/share/classes/com/sun/jndi/toolkit/dir/ContextEnumerator.java Mon Sep 05 23:58:19 2011 -0700
118.3 @@ -1,5 +1,5 @@
118.4 /*
118.5 - * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
118.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
118.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
118.8 *
118.9 * This code is free software; you can redistribute it and/or modify it
118.10 @@ -33,10 +33,10 @@
118.11 *
118.12 * @author Jon Ruiz
118.13 */
118.14 -public class ContextEnumerator implements NamingEnumeration {
118.15 +public class ContextEnumerator implements NamingEnumeration<Binding> {
118.16
118.17 private static boolean debug = false;
118.18 - private NamingEnumeration children = null;
118.19 + private NamingEnumeration<Binding> children = null;
118.20 private Binding currentChild = null;
118.21 private boolean currentReturned = false;
118.22 private Context root;
118.23 @@ -77,7 +77,7 @@
118.24 }
118.25
118.26 // Subclass should override if it wants to avoid calling obj factory
118.27 - protected NamingEnumeration getImmediateChildren(Context ctx)
118.28 + protected NamingEnumeration<Binding> getImmediateChildren(Context ctx)
118.29 throws NamingException {
118.30 return ctx.listBindings("");
118.31 }
118.32 @@ -101,7 +101,7 @@
118.33 }
118.34 }
118.35
118.36 - public Object nextElement() {
118.37 + public Binding nextElement() {
118.38 try {
118.39 return next();
118.40 } catch (NamingException e) {
118.41 @@ -109,7 +109,7 @@
118.42 }
118.43 }
118.44
118.45 - public Object next() throws NamingException {
118.46 + public Binding next() throws NamingException {
118.47 if (!rootProcessed) {
118.48 rootProcessed = true;
118.49 return new Binding("", root.getClass().getName(),
118.50 @@ -132,7 +132,7 @@
118.51 }
118.52
118.53 private Binding getNextChild() throws NamingException {
118.54 - Binding oldBinding = ((Binding)children.next());
118.55 + Binding oldBinding = children.next();
118.56 Binding newBinding = null;
118.57
118.58 // if the name is relative, we need to add it to the name of this
118.59 @@ -192,7 +192,7 @@
118.60 if(debug) {System.out.println("getNextDescedant: expanded case");}
118.61
118.62 // if the current child is expanded, use it's enumerator
118.63 - return (Binding)currentChildEnum.next();
118.64 + return currentChildEnum.next();
118.65
118.66 } else {
118.67
119.1 --- a/src/share/classes/com/sun/jndi/toolkit/dir/DirSearch.java Thu Sep 01 13:54:38 2011 -0700
119.2 +++ b/src/share/classes/com/sun/jndi/toolkit/dir/DirSearch.java Mon Sep 05 23:58:19 2011 -0700
119.3 @@ -1,5 +1,5 @@
119.4 /*
119.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
119.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
119.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
119.8 *
119.9 * This code is free software; you can redistribute it and/or modify it
119.10 @@ -34,7 +34,7 @@
119.11 * @author Jon Ruiz
119.12 */
119.13 public class DirSearch {
119.14 - public static NamingEnumeration search(DirContext ctx,
119.15 + public static NamingEnumeration<SearchResult> search(DirContext ctx,
119.16 Attributes matchingAttributes,
119.17 String[] attributesToReturn) throws NamingException {
119.18 SearchControls cons = new SearchControls(
119.19 @@ -48,7 +48,7 @@
119.20 cons);
119.21 }
119.22
119.23 - public static NamingEnumeration search(DirContext ctx,
119.24 + public static NamingEnumeration<SearchResult> search(DirContext ctx,
119.25 String filter, SearchControls cons) throws NamingException {
119.26
119.27 if (cons == null)
119.28 @@ -60,7 +60,7 @@
119.29 cons);
119.30 }
119.31
119.32 - public static NamingEnumeration search(DirContext ctx,
119.33 + public static NamingEnumeration<SearchResult> search(DirContext ctx,
119.34 String filterExpr, Object[] filterArgs, SearchControls cons)
119.35 throws NamingException {
119.36
120.1 --- a/src/share/classes/com/sun/jndi/toolkit/dir/HierMemDirCtx.java Thu Sep 01 13:54:38 2011 -0700
120.2 +++ b/src/share/classes/com/sun/jndi/toolkit/dir/HierMemDirCtx.java Mon Sep 05 23:58:19 2011 -0700
120.3 @@ -1,5 +1,5 @@
120.4 /*
120.5 - * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
120.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
120.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
120.8 *
120.9 * This code is free software; you can redistribute it and/or modify it
120.10 @@ -42,8 +42,8 @@
120.11 static private final boolean debug = false;
120.12 private static final NameParser defaultParser = new HierarchicalNameParser();
120.13
120.14 - protected Hashtable myEnv;
120.15 - protected Hashtable bindings;
120.16 + protected Hashtable<String, Object> myEnv;
120.17 + protected Hashtable<Name, Object> bindings;
120.18 protected Attributes attrs;
120.19 protected boolean ignoreCase = false;
120.20 protected NamingException readOnlyEx = null;
120.21 @@ -70,12 +70,12 @@
120.22 this(null, ignoreCase, false);
120.23 }
120.24
120.25 - public HierMemDirCtx(Hashtable environment, boolean ignoreCase) {
120.26 + public HierMemDirCtx(Hashtable<String, Object> environment, boolean ignoreCase) {
120.27 this(environment, ignoreCase, false);
120.28 }
120.29
120.30 - protected HierMemDirCtx(Hashtable environment, boolean ignoreCase,
120.31 - boolean useFac) {
120.32 + protected HierMemDirCtx(Hashtable<String, Object> environment,
120.33 + boolean ignoreCase, boolean useFac) {
120.34 myEnv = environment;
120.35 this.ignoreCase = ignoreCase;
120.36 init();
120.37 @@ -84,7 +84,7 @@
120.38
120.39 private void init() {
120.40 attrs = new BasicAttributes(ignoreCase);
120.41 - bindings = new Hashtable(11, 0.75f);
120.42 + bindings = new Hashtable<>(11, 0.75f);
120.43 }
120.44
120.45 public Object lookup(String name) throws NamingException {
120.46 @@ -326,30 +326,30 @@
120.47 bindings.put(newname, oldBinding);
120.48 }
120.49
120.50 - public NamingEnumeration list(String name) throws NamingException {
120.51 + public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
120.52 return list(myParser.parse(name));
120.53 }
120.54
120.55 - public NamingEnumeration list(Name name) throws NamingException {
120.56 + public NamingEnumeration<NameClassPair> list(Name name) throws NamingException {
120.57 HierMemDirCtx ctx = (HierMemDirCtx) doLookup(name, false);
120.58 return ctx.doList();
120.59 }
120.60
120.61 - protected NamingEnumeration doList () throws NamingException {
120.62 + protected NamingEnumeration<NameClassPair> doList () throws NamingException {
120.63 return new FlatNames(bindings.keys());
120.64 }
120.65
120.66
120.67 - public NamingEnumeration listBindings(String name) throws NamingException {
120.68 + public NamingEnumeration<Binding> listBindings(String name) throws NamingException {
120.69 return listBindings(myParser.parse(name));
120.70 }
120.71
120.72 - public NamingEnumeration listBindings(Name name) throws NamingException {
120.73 + public NamingEnumeration<Binding> listBindings(Name name) throws NamingException {
120.74 HierMemDirCtx ctx = (HierMemDirCtx)doLookup(name, false);
120.75 return ctx.doListBindings(alwaysUseFactory);
120.76 }
120.77
120.78 - protected NamingEnumeration doListBindings(boolean useFactory)
120.79 + protected NamingEnumeration<Binding> doListBindings(boolean useFactory)
120.80 throws NamingException {
120.81 return new FlatBindings(bindings, myEnv, useFactory);
120.82 }
120.83 @@ -447,28 +447,32 @@
120.84 return result;
120.85 }
120.86
120.87 + @SuppressWarnings("unchecked") // clone()
120.88 public Object addToEnvironment(String propName, Object propVal)
120.89 throws NamingException {
120.90 - myEnv = (myEnv == null) ?
120.91 - new Hashtable(11, 0.75f) : (Hashtable)myEnv.clone();
120.92 + myEnv = (myEnv == null)
120.93 + ? new Hashtable<String, Object>(11, 0.75f)
120.94 + : (Hashtable<String, Object>)myEnv.clone();
120.95
120.96 return myEnv.put(propName, propVal);
120.97 }
120.98
120.99 + @SuppressWarnings("unchecked") // clone()
120.100 public Object removeFromEnvironment(String propName)
120.101 throws NamingException {
120.102 if (myEnv == null)
120.103 return null;
120.104
120.105 - myEnv = (Hashtable)myEnv.clone();
120.106 + myEnv = (Hashtable<String, Object>)myEnv.clone();
120.107 return myEnv.remove(propName);
120.108 }
120.109
120.110 - public Hashtable getEnvironment() throws NamingException {
120.111 + @SuppressWarnings("unchecked") // clone()
120.112 + public Hashtable<String, Object> getEnvironment() throws NamingException {
120.113 if (myEnv == null) {
120.114 - return new Hashtable(5, 0.75f);
120.115 + return new Hashtable<>(5, 0.75f);
120.116 } else {
120.117 - return (Hashtable)myEnv.clone();
120.118 + return (Hashtable<String, Object>)myEnv.clone();
120.119 }
120.120 }
120.121
120.122 @@ -529,10 +533,10 @@
120.123 }
120.124
120.125 // turn it into a modification Enumeration and pass it on
120.126 - NamingEnumeration attrEnum = attrs.getAll();
120.127 + NamingEnumeration<? extends Attribute> attrEnum = attrs.getAll();
120.128 ModificationItem[] mods = new ModificationItem[attrs.size()];
120.129 for (int i = 0; i < mods.length && attrEnum.hasMoreElements(); i++) {
120.130 - mods[i] = new ModificationItem(mod_op, (Attribute)attrEnum.next());
120.131 + mods[i] = new ModificationItem(mod_op, attrEnum.next());
120.132 }
120.133
120.134 modifyAttributes(name, mods);
120.135 @@ -564,7 +568,7 @@
120.136
120.137 ModificationItem mod;
120.138 Attribute existingAttr, modAttr;
120.139 - NamingEnumeration modVals;
120.140 + NamingEnumeration<?> modVals;
120.141
120.142 for (int i = 0; i < mods.length; i++) {
120.143 mod = mods[i];
120.144 @@ -619,29 +623,29 @@
120.145 return orig;
120.146 }
120.147
120.148 - public NamingEnumeration search(String name,
120.149 - Attributes matchingAttributes)
120.150 + public NamingEnumeration<SearchResult> search(String name,
120.151 + Attributes matchingAttributes)
120.152 throws NamingException {
120.153 return search(name, matchingAttributes, null);
120.154 }
120.155
120.156 - public NamingEnumeration search(Name name,
120.157 - Attributes matchingAttributes)
120.158 + public NamingEnumeration<SearchResult> search(Name name,
120.159 + Attributes matchingAttributes)
120.160 throws NamingException {
120.161 return search(name, matchingAttributes, null);
120.162 }
120.163
120.164 - public NamingEnumeration search(String name,
120.165 - Attributes matchingAttributes,
120.166 - String[] attributesToReturn)
120.167 + public NamingEnumeration<SearchResult> search(String name,
120.168 + Attributes matchingAttributes,
120.169 + String[] attributesToReturn)
120.170 throws NamingException {
120.171 return search(myParser.parse(name), matchingAttributes,
120.172 attributesToReturn);
120.173 }
120.174
120.175 - public NamingEnumeration search(Name name,
120.176 - Attributes matchingAttributes,
120.177 - String[] attributesToReturn)
120.178 + public NamingEnumeration<SearchResult> search(Name name,
120.179 + Attributes matchingAttributes,
120.180 + String[] attributesToReturn)
120.181 throws NamingException {
120.182
120.183 HierMemDirCtx target = (HierMemDirCtx) doLookup(name, false);
120.184 @@ -656,9 +660,9 @@
120.185 false); // alwaysUseFactory ignored because objReturnFlag == false
120.186 }
120.187
120.188 - public NamingEnumeration search(Name name,
120.189 - String filter,
120.190 - SearchControls cons)
120.191 + public NamingEnumeration<SearchResult> search(Name name,
120.192 + String filter,
120.193 + SearchControls cons)
120.194 throws NamingException {
120.195 DirContext target = (DirContext) doLookup(name, false);
120.196
120.197 @@ -671,27 +675,27 @@
120.198 cons, this, myEnv, alwaysUseFactory);
120.199 }
120.200
120.201 - public NamingEnumeration search(Name name,
120.202 - String filterExpr,
120.203 - Object[] filterArgs,
120.204 - SearchControls cons)
120.205 + public NamingEnumeration<SearchResult> search(Name name,
120.206 + String filterExpr,
120.207 + Object[] filterArgs,
120.208 + SearchControls cons)
120.209 throws NamingException {
120.210
120.211 String strfilter = SearchFilter.format(filterExpr, filterArgs);
120.212 return search(name, strfilter, cons);
120.213 }
120.214
120.215 - public NamingEnumeration search(String name,
120.216 - String filter,
120.217 - SearchControls cons)
120.218 + public NamingEnumeration<SearchResult> search(String name,
120.219 + String filter,
120.220 + SearchControls cons)
120.221 throws NamingException {
120.222 return search(myParser.parse(name), filter, cons);
120.223 }
120.224
120.225 - public NamingEnumeration search(String name,
120.226 - String filterExpr,
120.227 - Object[] filterArgs,
120.228 - SearchControls cons)
120.229 + public NamingEnumeration<SearchResult> search(String name,
120.230 + String filterExpr,
120.231 + Object[] filterArgs,
120.232 + SearchControls cons)
120.233 throws NamingException {
120.234 return search(myParser.parse(name), filterExpr, filterArgs, cons);
120.235 }
120.236 @@ -761,15 +765,17 @@
120.237 myParser = parser;
120.238 }
120.239
120.240 - // Class for enumerating name/class pairs
120.241 - private class FlatNames implements NamingEnumeration {
120.242 - Enumeration names;
120.243 + /*
120.244 + * Common base class for FlatNames and FlatBindings.
120.245 + */
120.246 + private abstract class BaseFlatNames<T> implements NamingEnumeration<T> {
120.247 + Enumeration<Name> names;
120.248
120.249 - FlatNames (Enumeration names) {
120.250 + BaseFlatNames (Enumeration<Name> names) {
120.251 this.names = names;
120.252 }
120.253
120.254 - public boolean hasMoreElements() {
120.255 + public final boolean hasMoreElements() {
120.256 try {
120.257 return hasMore();
120.258 } catch (NamingException e) {
120.259 @@ -777,11 +783,11 @@
120.260 }
120.261 }
120.262
120.263 - public boolean hasMore() throws NamingException {
120.264 + public final boolean hasMore() throws NamingException {
120.265 return names.hasMoreElements();
120.266 }
120.267
120.268 - public Object nextElement() {
120.269 + public final T nextElement() {
120.270 try {
120.271 return next();
120.272 } catch (NamingException e) {
120.273 @@ -789,32 +795,45 @@
120.274 }
120.275 }
120.276
120.277 - public Object next() throws NamingException {
120.278 - Name name = (Name)names.nextElement();
120.279 - String className = bindings.get(name).getClass().getName();
120.280 - return new NameClassPair(name.toString(), className);
120.281 - }
120.282 + public abstract T next() throws NamingException;
120.283
120.284 - public void close() {
120.285 + public final void close() {
120.286 names = null;
120.287 }
120.288 }
120.289
120.290 - // Class for enumerating bindings
120.291 - private final class FlatBindings extends FlatNames {
120.292 - private Hashtable bds;
120.293 - private Hashtable env;
120.294 + // Class for enumerating name/class pairs
120.295 + private final class FlatNames extends BaseFlatNames<NameClassPair> {
120.296 + FlatNames (Enumeration<Name> names) {
120.297 + super(names);
120.298 + }
120.299 +
120.300 + @Override
120.301 + public NameClassPair next() throws NamingException {
120.302 + Name name = names.nextElement();
120.303 + String className = bindings.get(name).getClass().getName();
120.304 + return new NameClassPair(name.toString(), className);
120.305 + }
120.306 + }
120.307 +
120.308 + // Class for enumerating bindings
120.309 + private final class FlatBindings extends BaseFlatNames<Binding> {
120.310 + private Hashtable<Name, Object> bds;
120.311 + private Hashtable<String, Object> env;
120.312 private boolean useFactory;
120.313
120.314 - FlatBindings(Hashtable bindings, Hashtable env, boolean useFactory) {
120.315 + FlatBindings(Hashtable<Name, Object> bindings,
120.316 + Hashtable<String, Object> env,
120.317 + boolean useFactory) {
120.318 super(bindings.keys());
120.319 this.env = env;
120.320 this.bds = bindings;
120.321 this.useFactory = useFactory;
120.322 }
120.323
120.324 - public Object next() throws NamingException {
120.325 - Name name = (Name)names.nextElement();
120.326 + @Override
120.327 + public Binding next() throws NamingException {
120.328 + Name name = names.nextElement();
120.329
120.330 HierMemDirCtx obj = (HierMemDirCtx)bds.get(name);
120.331
120.332 @@ -849,7 +868,7 @@
120.333 super(context, scope, contextName, returnSelf);
120.334 }
120.335
120.336 - protected NamingEnumeration getImmediateChildren(Context ctx)
120.337 + protected NamingEnumeration<Binding> getImmediateChildren(Context ctx)
120.338 throws NamingException {
120.339 return ((HierMemDirCtx)ctx).doListBindings(false);
120.340 }
120.341 @@ -872,14 +891,14 @@
120.342
120.343 // Creates an empty name
120.344 HierarchicalName() {
120.345 - super(new Enumeration() {
120.346 - public boolean hasMoreElements() {return false;}
120.347 - public Object nextElement() {throw new NoSuchElementException();}
120.348 - },
120.349 - HierarchicalNameParser.mySyntax);
120.350 + super(new Enumeration<String>() {
120.351 + public boolean hasMoreElements() {return false;}
120.352 + public String nextElement() {throw new NoSuchElementException();}
120.353 + },
120.354 + HierarchicalNameParser.mySyntax);
120.355 }
120.356
120.357 - HierarchicalName(Enumeration comps, Properties syntax) {
120.358 + HierarchicalName(Enumeration<String> comps, Properties syntax) {
120.359 super(comps, syntax);
120.360 }
120.361
120.362 @@ -891,7 +910,7 @@
120.363 public int hashCode() {
120.364 if (hashValue == -1) {
120.365
120.366 - String name = toString().toUpperCase();
120.367 + String name = toString().toUpperCase(Locale.ENGLISH);
120.368 int len = name.length();
120.369 int off = 0;
120.370 char val[] = new char[len];
120.371 @@ -907,12 +926,12 @@
120.372 }
120.373
120.374 public Name getPrefix(int posn) {
120.375 - Enumeration comps = super.getPrefix(posn).getAll();
120.376 + Enumeration<String> comps = super.getPrefix(posn).getAll();
120.377 return (new HierarchicalName(comps, mySyntax));
120.378 }
120.379
120.380 public Name getSuffix(int posn) {
120.381 - Enumeration comps = super.getSuffix(posn).getAll();
120.382 + Enumeration<String> comps = super.getSuffix(posn).getAll();
120.383 return (new HierarchicalName(comps, mySyntax));
120.384 }
120.385
121.1 --- a/src/share/classes/com/sun/jndi/toolkit/dir/LazySearchEnumerationImpl.java Thu Sep 01 13:54:38 2011 -0700
121.2 +++ b/src/share/classes/com/sun/jndi/toolkit/dir/LazySearchEnumerationImpl.java Mon Sep 05 23:58:19 2011 -0700
121.3 @@ -1,5 +1,5 @@
121.4 /*
121.5 - * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
121.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
121.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
121.8 *
121.9 * This code is free software; you can redistribute it and/or modify it
121.10 @@ -47,16 +47,17 @@
121.11 import java.util.NoSuchElementException;
121.12 import java.util.Hashtable;
121.13
121.14 -final public class LazySearchEnumerationImpl implements NamingEnumeration {
121.15 - private NamingEnumeration candidates;
121.16 +final public class LazySearchEnumerationImpl
121.17 + implements NamingEnumeration<SearchResult> {
121.18 + private NamingEnumeration<Binding> candidates;
121.19 private SearchResult nextMatch = null;
121.20 private SearchControls cons;
121.21 private AttrFilter filter;
121.22 private Context context;
121.23 - private Hashtable env;
121.24 + private Hashtable<String, Object> env;
121.25 private boolean useFactory = true;
121.26
121.27 - public LazySearchEnumerationImpl(NamingEnumeration candidates,
121.28 + public LazySearchEnumerationImpl(NamingEnumeration<Binding> candidates,
121.29 AttrFilter filter, SearchControls cons) throws NamingException {
121.30 this.candidates = candidates;
121.31 this.filter = filter;
121.32 @@ -68,9 +69,10 @@
121.33 }
121.34 }
121.35
121.36 - public LazySearchEnumerationImpl(NamingEnumeration candidates,
121.37 + public LazySearchEnumerationImpl(NamingEnumeration<Binding> candidates,
121.38 AttrFilter filter, SearchControls cons,
121.39 - Context ctx, Hashtable env, boolean useFactory) throws NamingException {
121.40 + Context ctx, Hashtable<String, Object> env, boolean useFactory)
121.41 + throws NamingException {
121.42
121.43 this.candidates = candidates;
121.44 this.filter = filter;
121.45 @@ -86,9 +88,9 @@
121.46 }
121.47
121.48
121.49 - public LazySearchEnumerationImpl(NamingEnumeration candidates,
121.50 + public LazySearchEnumerationImpl(NamingEnumeration<Binding> candidates,
121.51 AttrFilter filter, SearchControls cons,
121.52 - Context ctx, Hashtable env) throws NamingException {
121.53 + Context ctx, Hashtable<String, Object> env) throws NamingException {
121.54 this(candidates, filter, cons, ctx, env, true);
121.55 }
121.56
121.57 @@ -105,7 +107,7 @@
121.58 }
121.59 }
121.60
121.61 - public Object nextElement() {
121.62 + public SearchResult nextElement() {
121.63 try {
121.64 return findNextMatch(true);
121.65 } catch (NamingException e) {
121.66 @@ -113,7 +115,7 @@
121.67 }
121.68 }
121.69
121.70 - public Object next() throws NamingException {
121.71 + public SearchResult next() throws NamingException {
121.72 // find and remove from list
121.73 return (findNextMatch(true));
121.74 }
121.75 @@ -138,7 +140,7 @@
121.76 Object obj;
121.77 Attributes targetAttrs;
121.78 while (candidates.hasMore()) {
121.79 - next = (Binding)candidates.next();
121.80 + next = candidates.next();
121.81 obj = next.getObject();
121.82 if (obj instanceof DirContext) {
121.83 targetAttrs = ((DirContext)(obj)).getAttributes("");
122.1 --- a/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java Thu Sep 01 13:54:38 2011 -0700
122.2 +++ b/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java Mon Sep 05 23:58:19 2011 -0700
122.3 @@ -1,5 +1,5 @@
122.4 /*
122.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
122.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
122.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
122.8 *
122.9 * This code is free software; you can redistribute it and/or modify it
122.10 @@ -29,6 +29,7 @@
122.11 import java.util.Enumeration;
122.12 import java.util.StringTokenizer;
122.13 import java.util.Vector;
122.14 +import java.util.Locale;
122.15
122.16 /**
122.17 * A class for parsing LDAP search filters (defined in RFC 1960, 2254)
122.18 @@ -203,11 +204,11 @@
122.19 * A class for dealing with compound filters ("and" & "or" filters).
122.20 */
122.21 final class CompoundFilter implements StringFilter {
122.22 - private Vector subFilters;
122.23 + private Vector<StringFilter> subFilters;
122.24 private boolean polarity;
122.25
122.26 CompoundFilter(boolean polarity) {
122.27 - subFilters = new Vector();
122.28 + subFilters = new Vector<>();
122.29 this.polarity = polarity;
122.30 }
122.31
122.32 @@ -223,7 +224,7 @@
122.33
122.34 public boolean check(Attributes targetAttrs) throws NamingException {
122.35 for(int i = 0; i<subFilters.size(); i++) {
122.36 - StringFilter filter = (StringFilter)subFilters.elementAt(i);
122.37 + StringFilter filter = subFilters.elementAt(i);
122.38 if(filter.check(targetAttrs) != this.polarity) {
122.39 return !polarity;
122.40 }
122.41 @@ -330,7 +331,7 @@
122.42 }
122.43
122.44 public boolean check(Attributes targetAttrs) {
122.45 - Enumeration candidates;
122.46 + Enumeration<?> candidates;
122.47
122.48 try {
122.49 Attribute attr = targetAttrs.get(attrID);
122.50 @@ -395,19 +396,21 @@
122.51
122.52 // do we need to begin with the first token?
122.53 if(proto.charAt(0) != WILDCARD_TOKEN &&
122.54 - !value.toString().toLowerCase().startsWith(
122.55 - subStrs.nextToken().toLowerCase())) {
122.56 - if(debug) {System.out.println("faild initial test");}
122.57 + !value.toString().toLowerCase(Locale.ENGLISH).startsWith(
122.58 + subStrs.nextToken().toLowerCase(Locale.ENGLISH))) {
122.59 + if(debug) {
122.60 + System.out.println("faild initial test");
122.61 + }
122.62 return false;
122.63 }
122.64
122.65 -
122.66 while(subStrs.hasMoreTokens()) {
122.67 String currentStr = subStrs.nextToken();
122.68 if (debug) {System.out.println("looking for \"" +
122.69 currentStr +"\"");}
122.70 - currentPos = value.toLowerCase().indexOf(
122.71 - currentStr.toLowerCase(), currentPos);
122.72 + currentPos = value.toLowerCase(Locale.ENGLISH).indexOf(
122.73 + currentStr.toLowerCase(Locale.ENGLISH), currentPos);
122.74 +
122.75 if(currentPos == -1) {
122.76 return false;
122.77 }
122.78 @@ -441,15 +444,15 @@
122.79 String answer;
122.80 answer = "(& ";
122.81 Attribute attr;
122.82 - for (NamingEnumeration e = attrs.getAll(); e.hasMore(); ) {
122.83 - attr = (Attribute)e.next();
122.84 + for (NamingEnumeration<? extends Attribute> e = attrs.getAll();
122.85 + e.hasMore(); ) {
122.86 + attr = e.next();
122.87 if (attr.size() == 0 || (attr.size() == 1 && attr.get() == null)) {
122.88 // only checking presence of attribute
122.89 answer += "(" + attr.getID() + "=" + "*)";
122.90 } else {
122.91 - for (NamingEnumeration ve = attr.getAll();
122.92 - ve.hasMore();
122.93 - ) {
122.94 + for (NamingEnumeration<?> ve = attr.getAll();
122.95 + ve.hasMore(); ) {
122.96 String val = getEncodedStringRep(ve.next());
122.97 if (val != null) {
122.98 answer += "(" + attr.getID() + "=" + val + ")";
123.1 --- a/src/share/classes/com/sun/jndi/toolkit/url/GenericURLContext.java Thu Sep 01 13:54:38 2011 -0700
123.2 +++ b/src/share/classes/com/sun/jndi/toolkit/url/GenericURLContext.java Mon Sep 05 23:58:19 2011 -0700
123.3 @@ -1,5 +1,5 @@
123.4 /*
123.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
123.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
123.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
123.8 *
123.9 * This code is free software; you can redistribute it and/or modify it
123.10 @@ -48,11 +48,12 @@
123.11 * @author Rosanna Lee
123.12 */
123.13 abstract public class GenericURLContext implements Context {
123.14 - protected Hashtable myEnv = null;
123.15 + protected Hashtable<String, Object> myEnv = null;
123.16
123.17 - public GenericURLContext(Hashtable env) {
123.18 + @SuppressWarnings("unchecked") // Expect Hashtable<String, Object>
123.19 + public GenericURLContext(Hashtable<?,?> env) {
123.20 // context that is not tied to any specific URL
123.21 - myEnv = env; // copied on write
123.22 + myEnv = (Hashtable<String, Object>)env; // copied on write
123.23 }
123.24
123.25 public void close() throws NamingException {
123.26 @@ -75,7 +76,7 @@
123.27 * must be in sync wrt how URLs are parsed and returned.
123.28 */
123.29 abstract protected ResolveResult getRootURLContext(String url,
123.30 - Hashtable env) throws NamingException;
123.31 + Hashtable<?,?> env) throws NamingException;
123.32
123.33 /**
123.34 * Returns the suffix of the url. The result should be identical to
123.35 @@ -487,27 +488,31 @@
123.36 return result;
123.37 }
123.38
123.39 + @SuppressWarnings("unchecked") // clone()
123.40 public Object removeFromEnvironment(String propName)
123.41 throws NamingException {
123.42 if (myEnv == null) {
123.43 return null;
123.44 }
123.45 - myEnv = (Hashtable)myEnv.clone();
123.46 + myEnv = (Hashtable<String, Object>)myEnv.clone();
123.47 return myEnv.remove(propName);
123.48 }
123.49
123.50 + @SuppressWarnings("unchecked") // clone()
123.51 public Object addToEnvironment(String propName, Object propVal)
123.52 throws NamingException {
123.53 - myEnv = (myEnv == null) ?
123.54 - new Hashtable(11, 0.75f) : (Hashtable)myEnv.clone();
123.55 + myEnv = (myEnv == null)
123.56 + ? new Hashtable<String, Object>(11, 0.75f)
123.57 + : (Hashtable<String, Object>)myEnv.clone();
123.58 return myEnv.put(propName, propVal);
123.59 }
123.60
123.61 - public Hashtable getEnvironment() throws NamingException {
123.62 + @SuppressWarnings("unchecked") // clone()
123.63 + public Hashtable<String, Object> getEnvironment() throws NamingException {
123.64 if (myEnv == null) {
123.65 - return new Hashtable(5, 0.75f);
123.66 + return new Hashtable<>(5, 0.75f);
123.67 } else {
123.68 - return (Hashtable)myEnv.clone();
123.69 + return (Hashtable<String, Object>)myEnv.clone();
123.70 }
123.71 }
123.72
124.1 --- a/src/share/classes/com/sun/jndi/toolkit/url/GenericURLDirContext.java Thu Sep 01 13:54:38 2011 -0700
124.2 +++ b/src/share/classes/com/sun/jndi/toolkit/url/GenericURLDirContext.java Mon Sep 05 23:58:19 2011 -0700
124.3 @@ -1,5 +1,5 @@
124.4 /*
124.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
124.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
124.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
124.8 *
124.9 * This code is free software; you can redistribute it and/or modify it
124.10 @@ -50,7 +50,7 @@
124.11 abstract public class GenericURLDirContext extends GenericURLContext
124.12 implements DirContext {
124.13
124.14 - protected GenericURLDirContext(Hashtable env) {
124.15 + protected GenericURLDirContext(Hashtable<?,?> env) {
124.16 super(env);
124.17 }
124.18
125.1 --- a/src/share/classes/com/sun/jndi/url/dns/dnsURLContext.java Thu Sep 01 13:54:38 2011 -0700
125.2 +++ b/src/share/classes/com/sun/jndi/url/dns/dnsURLContext.java Mon Sep 05 23:58:19 2011 -0700
125.3 @@ -1,5 +1,5 @@
125.4 /*
125.5 - * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
125.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
125.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
125.8 *
125.9 * This code is free software; you can redistribute it and/or modify it
125.10 @@ -45,7 +45,7 @@
125.11
125.12 public class dnsURLContext extends GenericURLDirContext {
125.13
125.14 - public dnsURLContext(Hashtable env) {
125.15 + public dnsURLContext(Hashtable<?,?> env) {
125.16 super(env);
125.17 }
125.18
125.19 @@ -54,7 +54,7 @@
125.20 * to the named DNS server, and returns the domain name as the
125.21 * remaining name.
125.22 */
125.23 - protected ResolveResult getRootURLContext(String url, Hashtable env)
125.24 + protected ResolveResult getRootURLContext(String url, Hashtable<?,?> env)
125.25 throws NamingException {
125.26
125.27 DnsUrl dnsUrl;
126.1 --- a/src/share/classes/com/sun/jndi/url/dns/dnsURLContextFactory.java Thu Sep 01 13:54:38 2011 -0700
126.2 +++ b/src/share/classes/com/sun/jndi/url/dns/dnsURLContextFactory.java Mon Sep 05 23:58:19 2011 -0700
126.3 @@ -1,5 +1,5 @@
126.4 /*
126.5 - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
126.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
126.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
126.8 *
126.9 * This code is free software; you can redistribute it and/or modify it
126.10 @@ -62,7 +62,7 @@
126.11 }
126.12 }
126.13
126.14 - private static Object getUsingURL(String url, Hashtable env)
126.15 + private static Object getUsingURL(String url, Hashtable<?,?> env)
126.16 throws NamingException {
126.17
126.18 dnsURLContext urlCtx = new dnsURLContext(env);
126.19 @@ -78,7 +78,7 @@
126.20 * If all URLs fail, throw one of the exceptions arbitrarily.
126.21 * Not pretty, but potentially more informative than returning null.
126.22 */
126.23 - private static Object getUsingURLs(String[] urls, Hashtable env)
126.24 + private static Object getUsingURLs(String[] urls, Hashtable<?,?> env)
126.25 throws NamingException {
126.26
126.27 if (urls.length == 0) {
127.1 --- a/src/share/classes/com/sun/jndi/url/iiop/iiopURLContext.java Thu Sep 01 13:54:38 2011 -0700
127.2 +++ b/src/share/classes/com/sun/jndi/url/iiop/iiopURLContext.java Mon Sep 05 23:58:19 2011 -0700
127.3 @@ -1,5 +1,5 @@
127.4 /*
127.5 - * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
127.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
127.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
127.8 *
127.9 * This code is free software; you can redistribute it and/or modify it
127.10 @@ -42,7 +42,7 @@
127.11 public class iiopURLContext
127.12 extends com.sun.jndi.toolkit.url.GenericURLContext {
127.13
127.14 - iiopURLContext(Hashtable env) {
127.15 + iiopURLContext(Hashtable<?,?> env) {
127.16 super(env);
127.17 }
127.18
127.19 @@ -56,7 +56,7 @@
127.20 * context on for the ORB at 'localhost' on port 900,
127.21 * and returns as the remaining name "rest/of/name".
127.22 */
127.23 - protected ResolveResult getRootURLContext(String name, Hashtable env)
127.24 + protected ResolveResult getRootURLContext(String name, Hashtable<?,?> env)
127.25 throws NamingException {
127.26 return iiopURLContextFactory.getUsingURLIgnoreRest(name, env);
127.27 }
128.1 --- a/src/share/classes/com/sun/jndi/url/iiop/iiopURLContextFactory.java Thu Sep 01 13:54:38 2011 -0700
128.2 +++ b/src/share/classes/com/sun/jndi/url/iiop/iiopURLContextFactory.java Mon Sep 05 23:58:19 2011 -0700
128.3 @@ -1,5 +1,5 @@
128.4 /*
128.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
128.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
128.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
128.8 *
128.9 * This code is free software; you can redistribute it and/or modify it
128.10 @@ -68,12 +68,12 @@
128.11 * context on for the ORB at 'localhost' on port 900,
128.12 * and returns as the remaining name "rest/of/name".
128.13 */
128.14 - static ResolveResult getUsingURLIgnoreRest(String url, Hashtable env)
128.15 + static ResolveResult getUsingURLIgnoreRest(String url, Hashtable<?,?> env)
128.16 throws NamingException {
128.17 return CNCtx.createUsingURL(url, env);
128.18 }
128.19
128.20 - private static Object getUsingURL(String url, Hashtable env)
128.21 + private static Object getUsingURL(String url, Hashtable<?,?> env)
128.22 throws NamingException {
128.23 ResolveResult res = getUsingURLIgnoreRest(url, env);
128.24
128.25 @@ -85,7 +85,7 @@
128.26 }
128.27 }
128.28
128.29 - private static Object getUsingURLs(String[] urls, Hashtable env) {
128.30 + private static Object getUsingURLs(String[] urls, Hashtable<?,?> env) {
128.31 for (int i = 0; i < urls.length; i++) {
128.32 String url = urls[i];
128.33 try {
129.1 --- a/src/share/classes/com/sun/jndi/url/ldap/ldapURLContext.java Thu Sep 01 13:54:38 2011 -0700
129.2 +++ b/src/share/classes/com/sun/jndi/url/ldap/ldapURLContext.java Mon Sep 05 23:58:19 2011 -0700
129.3 @@ -1,5 +1,5 @@
129.4 /*
129.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
129.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
129.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
129.8 *
129.9 * This code is free software; you can redistribute it and/or modify it
129.10 @@ -42,7 +42,7 @@
129.11 final public class ldapURLContext
129.12 extends com.sun.jndi.toolkit.url.GenericURLDirContext {
129.13
129.14 - ldapURLContext(Hashtable env) {
129.15 + ldapURLContext(Hashtable<?,?> env) {
129.16 super(env);
129.17 }
129.18
129.19 @@ -56,7 +56,7 @@
129.20 * context on the server 'localhost' on port 389,
129.21 * and returns as the remaining name "o=widget, c=us".
129.22 */
129.23 - protected ResolveResult getRootURLContext(String name, Hashtable env)
129.24 + protected ResolveResult getRootURLContext(String name, Hashtable<?,?> env)
129.25 throws NamingException {
129.26 return ldapURLContextFactory.getUsingURLIgnoreRootDN(name, env);
129.27 }
129.28 @@ -171,7 +171,8 @@
129.29 }
129.30 }
129.31
129.32 - public NamingEnumeration list(String name) throws NamingException {
129.33 + public NamingEnumeration<NameClassPair> list(String name)
129.34 + throws NamingException {
129.35 if (LdapURL.hasQueryComponents(name)) {
129.36 throw new InvalidNameException(name);
129.37 } else {
129.38 @@ -179,7 +180,8 @@
129.39 }
129.40 }
129.41
129.42 - public NamingEnumeration list(Name name) throws NamingException {
129.43 + public NamingEnumeration<NameClassPair> list(Name name)
129.44 + throws NamingException {
129.45 if (LdapURL.hasQueryComponents(name.get(0))) {
129.46 throw new InvalidNameException(name.toString());
129.47 } else {
129.48 @@ -187,7 +189,8 @@
129.49 }
129.50 }
129.51
129.52 - public NamingEnumeration listBindings(String name) throws NamingException {
129.53 + public NamingEnumeration<Binding> listBindings(String name)
129.54 + throws NamingException {
129.55 if (LdapURL.hasQueryComponents(name)) {
129.56 throw new InvalidNameException(name);
129.57 } else {
129.58 @@ -195,7 +198,8 @@
129.59 }
129.60 }
129.61
129.62 - public NamingEnumeration listBindings(Name name) throws NamingException {
129.63 + public NamingEnumeration<Binding> listBindings(Name name)
129.64 + throws NamingException {
129.65 if (LdapURL.hasQueryComponents(name.get(0))) {
129.66 throw new InvalidNameException(name.toString());
129.67 } else {
129.68 @@ -447,7 +451,7 @@
129.69 }
129.70
129.71 // divert the search operation when the LDAP URL has query components
129.72 - public NamingEnumeration search(String name,
129.73 + public NamingEnumeration<SearchResult> search(String name,
129.74 Attributes matchingAttributes)
129.75 throws NamingException {
129.76
129.77 @@ -459,7 +463,7 @@
129.78 }
129.79
129.80 // divert the search operation when name has a single component
129.81 - public NamingEnumeration search(Name name,
129.82 + public NamingEnumeration<SearchResult> search(Name name,
129.83 Attributes matchingAttributes)
129.84 throws NamingException {
129.85 if (name.size() == 1) {
129.86 @@ -472,7 +476,7 @@
129.87 }
129.88
129.89 // divert the search operation when the LDAP URL has query components
129.90 - public NamingEnumeration search(String name,
129.91 + public NamingEnumeration<SearchResult> search(String name,
129.92 Attributes matchingAttributes,
129.93 String[] attributesToReturn)
129.94 throws NamingException {
129.95 @@ -485,7 +489,7 @@
129.96 }
129.97
129.98 // divert the search operation when name has a single component
129.99 - public NamingEnumeration search(Name name,
129.100 + public NamingEnumeration<SearchResult> search(Name name,
129.101 Attributes matchingAttributes,
129.102 String[] attributesToReturn)
129.103 throws NamingException {
129.104 @@ -500,7 +504,7 @@
129.105 }
129.106
129.107 // divert the search operation when the LDAP URL has query components
129.108 - public NamingEnumeration search(String name,
129.109 + public NamingEnumeration<SearchResult> search(String name,
129.110 String filter,
129.111 SearchControls cons)
129.112 throws NamingException {
129.113 @@ -513,7 +517,7 @@
129.114 }
129.115
129.116 // divert the search operation when name has a single component
129.117 - public NamingEnumeration search(Name name,
129.118 + public NamingEnumeration<SearchResult> search(Name name,
129.119 String filter,
129.120 SearchControls cons)
129.121 throws NamingException {
129.122 @@ -528,7 +532,7 @@
129.123 }
129.124
129.125 // divert the search operation when the LDAP URL has query components
129.126 - public NamingEnumeration search(String name,
129.127 + public NamingEnumeration<SearchResult> search(String name,
129.128 String filterExpr,
129.129 Object[] filterArgs,
129.130 SearchControls cons)
129.131 @@ -542,7 +546,7 @@
129.132 }
129.133
129.134 // divert the search operation when name has a single component
129.135 - public NamingEnumeration search(Name name,
129.136 + public NamingEnumeration<SearchResult> search(Name name,
129.137 String filterExpr,
129.138 Object[] filterArgs,
129.139 SearchControls cons)
129.140 @@ -559,7 +563,7 @@
129.141
129.142 // Search using the LDAP URL in name.
129.143 // LDAP URL query components override the search argments.
129.144 - private NamingEnumeration searchUsingURL(String name)
129.145 + private NamingEnumeration<SearchResult> searchUsingURL(String name)
129.146 throws NamingException {
129.147
129.148 LdapURL url = new LdapURL(name);
130.1 --- a/src/share/classes/com/sun/jndi/url/ldap/ldapURLContextFactory.java Thu Sep 01 13:54:38 2011 -0700
130.2 +++ b/src/share/classes/com/sun/jndi/url/ldap/ldapURLContextFactory.java Mon Sep 05 23:58:19 2011 -0700
130.3 @@ -1,5 +1,5 @@
130.4 /*
130.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
130.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
130.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
130.8 *
130.9 * This code is free software; you can redistribute it and/or modify it
130.10 @@ -53,7 +53,7 @@
130.11 }
130.12 }
130.13
130.14 - static ResolveResult getUsingURLIgnoreRootDN(String url, Hashtable env)
130.15 + static ResolveResult getUsingURLIgnoreRootDN(String url, Hashtable<?,?> env)
130.16 throws NamingException {
130.17 LdapURL ldapUrl = new LdapURL(url);
130.18 DirContext ctx = new LdapCtx("", ldapUrl.getHost(), ldapUrl.getPort(),
131.1 --- a/src/share/classes/com/sun/jndi/url/rmi/rmiURLContext.java Thu Sep 01 13:54:38 2011 -0700
131.2 +++ b/src/share/classes/com/sun/jndi/url/rmi/rmiURLContext.java Mon Sep 05 23:58:19 2011 -0700
131.3 @@ -1,5 +1,5 @@
131.4 /*
131.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
131.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
131.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
131.8 *
131.9 * This code is free software; you can redistribute it and/or modify it
131.10 @@ -26,7 +26,6 @@
131.11 package com.sun.jndi.url.rmi;
131.12
131.13 import java.util.Hashtable;
131.14 -import java.rmi.registry.LocateRegistry;
131.15
131.16 import javax.naming.*;
131.17 import javax.naming.spi.ResolveResult;
131.18 @@ -48,7 +47,7 @@
131.19 */
131.20 public class rmiURLContext extends GenericURLContext {
131.21
131.22 - public rmiURLContext(Hashtable env) {
131.23 + public rmiURLContext(Hashtable<?,?> env) {
131.24 super(env);
131.25 }
131.26
131.27 @@ -57,7 +56,7 @@
131.28 * RMI registry, and returns the atomic object name as the
131.29 * remaining name.
131.30 */
131.31 - protected ResolveResult getRootURLContext(String url, Hashtable env)
131.32 + protected ResolveResult getRootURLContext(String url, Hashtable<?,?> env)
131.33 throws NamingException
131.34 {
131.35 if (!url.startsWith("rmi:")) {
132.1 --- a/src/share/classes/com/sun/jndi/url/rmi/rmiURLContextFactory.java Thu Sep 01 13:54:38 2011 -0700
132.2 +++ b/src/share/classes/com/sun/jndi/url/rmi/rmiURLContextFactory.java Mon Sep 05 23:58:19 2011 -0700
132.3 @@ -1,5 +1,5 @@
132.4 /*
132.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
132.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
132.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
132.8 *
132.9 * This code is free software; you can redistribute it and/or modify it
132.10 @@ -63,7 +63,7 @@
132.11 }
132.12 }
132.13
132.14 - private static Object getUsingURL(String url, Hashtable env)
132.15 + private static Object getUsingURL(String url, Hashtable<?,?> env)
132.16 throws NamingException
132.17 {
132.18 rmiURLContext urlCtx = new rmiURLContext(env);
132.19 @@ -79,7 +79,7 @@
132.20 * If all URLs fail, throw one of the exceptions arbitrarily.
132.21 * Not pretty, but potentially more informative than returning null.
132.22 */
132.23 - private static Object getUsingURLs(String[] urls, Hashtable env)
132.24 + private static Object getUsingURLs(String[] urls, Hashtable<?,?> env)
132.25 throws NamingException
132.26 {
132.27 if (urls.length == 0) {
133.1 --- a/src/share/classes/com/sun/naming/internal/FactoryEnumeration.java Thu Sep 01 13:54:38 2011 -0700
133.2 +++ b/src/share/classes/com/sun/naming/internal/FactoryEnumeration.java Mon Sep 05 23:58:19 2011 -0700
133.3 @@ -1,5 +1,5 @@
133.4 /*
133.5 - * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
133.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
133.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
133.8 *
133.9 * This code is free software; you can redistribute it and/or modify it
133.10 @@ -37,7 +37,8 @@
133.11
133.12 // no need to implement Enumeration since this is only for internal use
133.13 public final class FactoryEnumeration {
133.14 - private List factories;
133.15 + // List<NamedWeakReference<Class | Object>>
133.16 + private List<NamedWeakReference<Object>> factories;
133.17 private int posn = 0;
133.18 private ClassLoader loader;
133.19
133.20 @@ -59,7 +60,8 @@
133.21 * @param factories A non-null list
133.22 * @param loader The class loader of the list's contents
133.23 */
133.24 - FactoryEnumeration(List factories, ClassLoader loader) {
133.25 + FactoryEnumeration(List<NamedWeakReference<Object>> factories,
133.26 + ClassLoader loader) {
133.27 this.factories = factories;
133.28 this.loader = loader;
133.29 }
133.30 @@ -67,7 +69,7 @@
133.31 public Object next() throws NamingException {
133.32 synchronized (factories) {
133.33
133.34 - NamedWeakReference ref = (NamedWeakReference) factories.get(posn++);
133.35 + NamedWeakReference<Object> ref = factories.get(posn++);
133.36 Object answer = ref.get();
133.37 if ((answer != null) && !(answer instanceof Class)) {
133.38 return answer;
133.39 @@ -81,7 +83,7 @@
133.40 }
133.41 // Instantiate Class to get factory
133.42 answer = ((Class) answer).newInstance();
133.43 - ref = new NamedWeakReference(answer, className);
133.44 + ref = new NamedWeakReference<>(answer, className);
133.45 factories.set(posn-1, ref); // replace Class object or null
133.46 return answer;
133.47 } catch (ClassNotFoundException e) {
134.1 --- a/src/share/classes/com/sun/naming/internal/NamedWeakReference.java Thu Sep 01 13:54:38 2011 -0700
134.2 +++ b/src/share/classes/com/sun/naming/internal/NamedWeakReference.java Mon Sep 05 23:58:19 2011 -0700
134.3 @@ -1,5 +1,5 @@
134.4 /*
134.5 - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
134.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
134.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
134.8 *
134.9 * This code is free software; you can redistribute it and/or modify it
134.10 @@ -33,11 +33,11 @@
134.11 */
134.12
134.13
134.14 -class NamedWeakReference extends java.lang.ref.WeakReference {
134.15 +class NamedWeakReference<T> extends java.lang.ref.WeakReference<T> {
134.16
134.17 private final String name;
134.18
134.19 - NamedWeakReference(Object referent, String name) {
134.20 + NamedWeakReference(T referent, String name) {
134.21 super(referent);
134.22 this.name = name;
134.23 }
135.1 --- a/src/share/classes/com/sun/naming/internal/ResourceManager.java Thu Sep 01 13:54:38 2011 -0700
135.2 +++ b/src/share/classes/com/sun/naming/internal/ResourceManager.java Mon Sep 05 23:58:19 2011 -0700
135.3 @@ -1,5 +1,5 @@
135.4 /*
135.5 - * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
135.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
135.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
135.8 *
135.9 * This code is free software; you can redistribute it and/or modify it
135.10 @@ -27,11 +27,9 @@
135.11
135.12 import java.io.InputStream;
135.13 import java.io.IOException;
135.14 -import java.net.URL;
135.15 import java.lang.ref.WeakReference;
135.16 import java.lang.reflect.Method;
135.17 import java.lang.reflect.InvocationTargetException;
135.18 -import java.util.Enumeration;
135.19 import java.util.HashMap;
135.20 import java.util.Hashtable;
135.21 import java.util.Map;
135.22 @@ -89,7 +87,9 @@
135.23 * One from application resource files is keyed on the thread's
135.24 * context class loader.
135.25 */
135.26 - private static final WeakHashMap propertiesCache = new WeakHashMap(11);
135.27 + // WeakHashMap<Class | ClassLoader, Hashtable>
135.28 + private static final WeakHashMap<Object, Hashtable<? super String, Object>>
135.29 + propertiesCache = new WeakHashMap<>(11);
135.30
135.31 /*
135.32 * A cache of factory objects (ObjectFactory, StateFactory, ControlFactory).
135.33 @@ -99,7 +99,9 @@
135.34 * weakly referenced so as not to prevent GC of the class loader.
135.35 * Used in getFactories().
135.36 */
135.37 - private static final WeakHashMap factoryCache = new WeakHashMap(11);
135.38 + private static final
135.39 + WeakHashMap<ClassLoader, Map<String, List<NamedWeakReference<Object>>>>
135.40 + factoryCache = new WeakHashMap<>(11);
135.41
135.42 /*
135.43 * A cache of URL factory objects (ObjectFactory).
135.44 @@ -110,8 +112,11 @@
135.45 * NO_FACTORY if a previous search revealed no factory. Used in
135.46 * getFactory().
135.47 */
135.48 - private static final WeakHashMap urlFactoryCache = new WeakHashMap(11);
135.49 - private static final WeakReference NO_FACTORY = new WeakReference(null);
135.50 + private static final
135.51 + WeakHashMap<ClassLoader, Map<String, WeakReference<Object>>>
135.52 + urlFactoryCache = new WeakHashMap<>(11);
135.53 + private static final WeakReference<Object> NO_FACTORY =
135.54 + new WeakReference<>(null);
135.55
135.56 /**
135.57 * A class to allow JNDI properties be specified as applet parameters
135.58 @@ -152,10 +157,9 @@
135.59 throw new ClassCastException(applet.getClass().getName());
135.60 try {
135.61 return getMethod.invoke(applet, name);
135.62 - } catch (InvocationTargetException e) {
135.63 + } catch (InvocationTargetException |
135.64 + IllegalAccessException e) {
135.65 throw new AssertionError(e);
135.66 - } catch (IllegalAccessException iae) {
135.67 - throw new AssertionError(iae);
135.68 }
135.69 }
135.70 }
135.71 @@ -183,12 +187,14 @@
135.72 * @throws NamingException if an error occurs while reading a
135.73 * resource file
135.74 */
135.75 - public static Hashtable getInitialEnvironment(Hashtable env)
135.76 + @SuppressWarnings("unchecked")
135.77 + public static Hashtable<?, ?> getInitialEnvironment(
135.78 + Hashtable<?, ?> env)
135.79 throws NamingException
135.80 {
135.81 String[] props = VersionHelper.PROPS; // system/applet properties
135.82 if (env == null) {
135.83 - env = new Hashtable(11);
135.84 + env = new Hashtable<>(11);
135.85 }
135.86 Object applet = env.get(Context.APPLET);
135.87
135.88 @@ -213,14 +219,14 @@
135.89 : helper.getJndiProperty(i);
135.90 }
135.91 if (val != null) {
135.92 - env.put(props[i], val);
135.93 + ((Hashtable<String, Object>)env).put(props[i], val);
135.94 }
135.95 }
135.96 }
135.97
135.98 // Merge the above with the values read from all application
135.99 // resource files. Colon-separated lists are concatenated.
135.100 - mergeTables(env, getApplicationResources());
135.101 + mergeTables((Hashtable<Object, Object>)env, getApplicationResources());
135.102 return env;
135.103 }
135.104
135.105 @@ -244,7 +250,7 @@
135.106 * @throws NamingException if an error occurs while reading the provider
135.107 * resource file.
135.108 */
135.109 - public static String getProperty(String propName, Hashtable env,
135.110 + public static String getProperty(String propName, Hashtable<?,?> env,
135.111 Context ctx, boolean concat)
135.112 throws NamingException {
135.113
135.114 @@ -305,8 +311,8 @@
135.115 * @see javax.naming.spi.DirectoryManager#getStateToBind
135.116 * @see javax.naming.ldap.ControlFactory#getControlInstance
135.117 */
135.118 - public static FactoryEnumeration getFactories(String propName, Hashtable env,
135.119 - Context ctx) throws NamingException {
135.120 + public static FactoryEnumeration getFactories(String propName,
135.121 + Hashtable<?,?> env, Context ctx) throws NamingException {
135.122
135.123 String facProp = getProperty(propName, env, ctx, true);
135.124 if (facProp == null)
135.125 @@ -315,17 +321,18 @@
135.126 // Cache is based on context class loader and property val
135.127 ClassLoader loader = helper.getContextClassLoader();
135.128
135.129 - Map perLoaderCache = null;
135.130 + Map<String, List<NamedWeakReference<Object>>> perLoaderCache = null;
135.131 synchronized (factoryCache) {
135.132 - perLoaderCache = (Map) factoryCache.get(loader);
135.133 + perLoaderCache = factoryCache.get(loader);
135.134 if (perLoaderCache == null) {
135.135 - perLoaderCache = new HashMap(11);
135.136 + perLoaderCache = new HashMap<>(11);
135.137 factoryCache.put(loader, perLoaderCache);
135.138 }
135.139 }
135.140
135.141 synchronized (perLoaderCache) {
135.142 - List factories = (List) perLoaderCache.get(facProp);
135.143 + List<NamedWeakReference<Object>> factories =
135.144 + perLoaderCache.get(facProp);
135.145 if (factories != null) {
135.146 // Cached list
135.147 return factories.size() == 0 ? null
135.148 @@ -334,13 +341,13 @@
135.149 // Populate list with classes named in facProp; skipping
135.150 // those that we cannot load
135.151 StringTokenizer parser = new StringTokenizer(facProp, ":");
135.152 - factories = new ArrayList(5);
135.153 + factories = new ArrayList<>(5);
135.154 while (parser.hasMoreTokens()) {
135.155 try {
135.156 // System.out.println("loading");
135.157 String className = parser.nextToken();
135.158 - Class c = helper.loadClass(className, loader);
135.159 - factories.add(new NamedWeakReference(c, className));
135.160 + Class<?> c = helper.loadClass(className, loader);
135.161 + factories.add(new NamedWeakReference<Object>(c, className));
135.162 } catch (Exception e) {
135.163 // ignore ClassNotFoundException, IllegalArgumentException
135.164 }
135.165 @@ -388,8 +395,9 @@
135.166 * @see javax.naming.spi.NamingManager#getURLContext
135.167 * @see javax.naming.spi.NamingManager#getURLObject
135.168 */
135.169 - public static Object getFactory(String propName, Hashtable env, Context ctx,
135.170 - String classSuffix, String defaultPkgPrefix) throws NamingException {
135.171 + public static Object getFactory(String propName, Hashtable<?,?> env,
135.172 + Context ctx, String classSuffix, String defaultPkgPrefix)
135.173 + throws NamingException {
135.174
135.175 // Merge property with provider property and supplied default
135.176 String facProp = getProperty(propName, env, ctx, true);
135.177 @@ -403,11 +411,11 @@
135.178 ClassLoader loader = helper.getContextClassLoader();
135.179 String key = classSuffix + " " + facProp;
135.180
135.181 - Map perLoaderCache = null;
135.182 + Map<String, WeakReference<Object>> perLoaderCache = null;
135.183 synchronized (urlFactoryCache) {
135.184 - perLoaderCache = (Map) urlFactoryCache.get(loader);
135.185 + perLoaderCache = urlFactoryCache.get(loader);
135.186 if (perLoaderCache == null) {
135.187 - perLoaderCache = new HashMap(11);
135.188 + perLoaderCache = new HashMap<>(11);
135.189 urlFactoryCache.put(loader, perLoaderCache);
135.190 }
135.191 }
135.192 @@ -415,7 +423,7 @@
135.193 synchronized (perLoaderCache) {
135.194 Object factory = null;
135.195
135.196 - WeakReference factoryRef = (WeakReference) perLoaderCache.get(key);
135.197 + WeakReference<Object> factoryRef = perLoaderCache.get(key);
135.198 if (factoryRef == NO_FACTORY) {
135.199 return null;
135.200 } else if (factoryRef != null) {
135.201 @@ -451,7 +459,7 @@
135.202
135.203 // Cache it.
135.204 perLoaderCache.put(key, (factory != null)
135.205 - ? new WeakReference(factory)
135.206 + ? new WeakReference<>(factory)
135.207 : NO_FACTORY);
135.208 return factory;
135.209 }
135.210 @@ -468,16 +476,18 @@
135.211 *
135.212 * @throws NamingException if an error occurs while reading the file.
135.213 */
135.214 - private static Hashtable getProviderResource(Object obj)
135.215 + private static Hashtable<? super String, Object>
135.216 + getProviderResource(Object obj)
135.217 throws NamingException
135.218 {
135.219 if (obj == null) {
135.220 - return (new Hashtable(1));
135.221 + return (new Hashtable<>(1));
135.222 }
135.223 synchronized (propertiesCache) {
135.224 - Class c = obj.getClass();
135.225 + Class<?> c = obj.getClass();
135.226
135.227 - Hashtable props = (Hashtable)propertiesCache.get(c);
135.228 + Hashtable<? super String, Object> props =
135.229 + propertiesCache.get(c);
135.230 if (props != null) {
135.231 return props;
135.232 }
135.233 @@ -518,22 +528,23 @@
135.234 * @throws NamingException if an error occurs while reading a resource
135.235 * file.
135.236 */
135.237 - private static Hashtable getApplicationResources() throws NamingException {
135.238 + private static Hashtable<? super String, Object> getApplicationResources()
135.239 + throws NamingException {
135.240
135.241 ClassLoader cl = helper.getContextClassLoader();
135.242
135.243 synchronized (propertiesCache) {
135.244 - Hashtable result = (Hashtable)propertiesCache.get(cl);
135.245 + Hashtable<? super String, Object> result = propertiesCache.get(cl);
135.246 if (result != null) {
135.247 return result;
135.248 }
135.249
135.250 try {
135.251 - NamingEnumeration resources =
135.252 + NamingEnumeration<InputStream> resources =
135.253 helper.getResources(cl, APP_RESOURCE_FILE_NAME);
135.254 while (resources.hasMore()) {
135.255 Properties props = new Properties();
135.256 - props.load((InputStream)resources.next());
135.257 + props.load(resources.next());
135.258
135.259 if (result == null) {
135.260 result = props;
135.261 @@ -563,7 +574,7 @@
135.262 throw ne;
135.263 }
135.264 if (result == null) {
135.265 - result = new Hashtable(11);
135.266 + result = new Hashtable<>(11);
135.267 }
135.268 propertiesCache.put(cl, result);
135.269 return result;
135.270 @@ -577,11 +588,10 @@
135.271 * standard JNDI properties that specify colon-separated lists,
135.272 * the values are concatenated and stored in props1.
135.273 */
135.274 - private static void mergeTables(Hashtable props1, Hashtable props2) {
135.275 - Enumeration keys = props2.keys();
135.276 -
135.277 - while (keys.hasMoreElements()) {
135.278 - String prop = (String)keys.nextElement();
135.279 + private static void mergeTables(Hashtable<? super String, Object> props1,
135.280 + Hashtable<? super String, Object> props2) {
135.281 + for (Object key : props2.keySet()) {
135.282 + String prop = (String)key;
135.283 Object val1 = props1.get(prop);
135.284 if (val1 == null) {
135.285 props1.put(prop, props2.get(prop));
136.1 --- a/src/share/classes/com/sun/naming/internal/VersionHelper.java Thu Sep 01 13:54:38 2011 -0700
136.2 +++ b/src/share/classes/com/sun/naming/internal/VersionHelper.java Mon Sep 05 23:58:19 2011 -0700
136.3 @@ -1,5 +1,5 @@
136.4 /*
136.5 - * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
136.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
136.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
136.8 *
136.9 * This code is free software; you can redistribute it and/or modify it
136.10 @@ -29,7 +29,6 @@
136.11 import java.io.IOException;
136.12 import java.net.MalformedURLException;
136.13 import java.net.URL;
136.14 -import java.util.Enumeration;
136.15 import java.util.StringTokenizer;
136.16 import java.util.Vector;
136.17
136.18 @@ -78,13 +77,13 @@
136.19 return helper;
136.20 }
136.21
136.22 - public abstract Class loadClass(String className)
136.23 + public abstract Class<?> loadClass(String className)
136.24 throws ClassNotFoundException;
136.25
136.26 - abstract Class loadClass(String className, ClassLoader cl)
136.27 + abstract Class<?> loadClass(String className, ClassLoader cl)
136.28 throws ClassNotFoundException;
136.29
136.30 - public abstract Class loadClass(String className, String codebase)
136.31 + public abstract Class<?> loadClass(String className, String codebase)
136.32 throws ClassNotFoundException, MalformedURLException;
136.33
136.34 /*
136.35 @@ -106,7 +105,7 @@
136.36 * Returns the resource of a given name associated with a particular
136.37 * class (never null), or null if none can be found.
136.38 */
136.39 - abstract InputStream getResourceAsStream(Class c, String name);
136.40 + abstract InputStream getResourceAsStream(Class<?> c, String name);
136.41
136.42 /*
136.43 * Returns an input stream for a file in <java.home>/lib,
136.44 @@ -122,7 +121,8 @@
136.45 * loader. Null represents the bootstrap class loader in some
136.46 * Java implementations.
136.47 */
136.48 - abstract NamingEnumeration getResources(ClassLoader cl, String name)
136.49 + abstract NamingEnumeration<InputStream> getResources(
136.50 + ClassLoader cl, String name)
136.51 throws IOException;
136.52
136.53 /*
136.54 @@ -137,13 +137,13 @@
136.55 throws MalformedURLException {
136.56 // Parse codebase into separate URLs
136.57 StringTokenizer parser = new StringTokenizer(codebase);
136.58 - Vector vec = new Vector(10);
136.59 + Vector<String> vec = new Vector<>(10);
136.60 while (parser.hasMoreTokens()) {
136.61 vec.addElement(parser.nextToken());
136.62 }
136.63 String[] url = new String[vec.size()];
136.64 for (int i = 0; i < url.length; i++) {
136.65 - url[i] = (String)vec.elementAt(i);
136.66 + url[i] = vec.elementAt(i);
136.67 }
136.68
136.69 URL[] urlArray = new URL[url.length];
137.1 --- a/src/share/classes/com/sun/naming/internal/VersionHelper12.java Thu Sep 01 13:54:38 2011 -0700
137.2 +++ b/src/share/classes/com/sun/naming/internal/VersionHelper12.java Mon Sep 05 23:58:19 2011 -0700
137.3 @@ -1,5 +1,5 @@
137.4 /*
137.5 - * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
137.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
137.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
137.8 *
137.9 * This code is free software; you can redistribute it and/or modify it
137.10 @@ -35,7 +35,6 @@
137.11 import java.security.PrivilegedActionException;
137.12 import java.security.PrivilegedExceptionAction;
137.13 import java.util.Enumeration;
137.14 -import java.util.Hashtable;
137.15 import java.util.NoSuchElementException;
137.16 import java.util.Properties;
137.17
137.18 @@ -58,7 +57,7 @@
137.19
137.20 VersionHelper12() {} // Disallow external from creating one of these.
137.21
137.22 - public Class loadClass(String className) throws ClassNotFoundException {
137.23 + public Class<?> loadClass(String className) throws ClassNotFoundException {
137.24 ClassLoader cl = getContextClassLoader();
137.25 return Class.forName(className, true, cl);
137.26 }
137.27 @@ -66,7 +65,7 @@
137.28 /**
137.29 * Package private.
137.30 */
137.31 - Class loadClass(String className, ClassLoader cl)
137.32 + Class<?> loadClass(String className, ClassLoader cl)
137.33 throws ClassNotFoundException {
137.34 return Class.forName(className, true, cl);
137.35 }
137.36 @@ -75,7 +74,7 @@
137.37 * @param className A non-null fully qualified class name.
137.38 * @param codebase A non-null, space-separated list of URL strings.
137.39 */
137.40 - public Class loadClass(String className, String codebase)
137.41 + public Class<?> loadClass(String className, String codebase)
137.42 throws ClassNotFoundException, MalformedURLException {
137.43 ClassLoader cl;
137.44
137.45 @@ -86,9 +85,9 @@
137.46 }
137.47
137.48 String getJndiProperty(final int i) {
137.49 - return (String) AccessController.doPrivileged(
137.50 - new PrivilegedAction() {
137.51 - public Object run() {
137.52 + return AccessController.doPrivileged(
137.53 + new PrivilegedAction<String>() {
137.54 + public String run() {
137.55 try {
137.56 return System.getProperty(PROPS[i]);
137.57 } catch (SecurityException e) {
137.58 @@ -103,9 +102,9 @@
137.59 if (getSystemPropsFailed) {
137.60 return null; // after one failure, don't bother trying again
137.61 }
137.62 - Properties sysProps = (Properties) AccessController.doPrivileged(
137.63 - new PrivilegedAction() {
137.64 - public Object run() {
137.65 + Properties sysProps = AccessController.doPrivileged(
137.66 + new PrivilegedAction<Properties>() {
137.67 + public Properties run() {
137.68 try {
137.69 return System.getProperties();
137.70 } catch (SecurityException e) {
137.71 @@ -125,10 +124,10 @@
137.72 return jProps;
137.73 }
137.74
137.75 - InputStream getResourceAsStream(final Class c, final String name) {
137.76 - return (InputStream) AccessController.doPrivileged(
137.77 - new PrivilegedAction() {
137.78 - public Object run() {
137.79 + InputStream getResourceAsStream(final Class<?> c, final String name) {
137.80 + return AccessController.doPrivileged(
137.81 + new PrivilegedAction<InputStream>() {
137.82 + public InputStream run() {
137.83 return c.getResourceAsStream(name);
137.84 }
137.85 }
137.86 @@ -136,9 +135,9 @@
137.87 }
137.88
137.89 InputStream getJavaHomeLibStream(final String filename) {
137.90 - return (InputStream) AccessController.doPrivileged(
137.91 - new PrivilegedAction() {
137.92 - public Object run() {
137.93 + return AccessController.doPrivileged(
137.94 + new PrivilegedAction<InputStream>() {
137.95 + public InputStream run() {
137.96 try {
137.97 String javahome = System.getProperty("java.home");
137.98 if (javahome == null) {
137.99 @@ -155,14 +154,13 @@
137.100 );
137.101 }
137.102
137.103 - NamingEnumeration getResources(final ClassLoader cl, final String name)
137.104 - throws IOException
137.105 - {
137.106 - Enumeration urls;
137.107 + NamingEnumeration<InputStream> getResources(final ClassLoader cl,
137.108 + final String name) throws IOException {
137.109 + Enumeration<URL> urls;
137.110 try {
137.111 - urls = (Enumeration) AccessController.doPrivileged(
137.112 - new PrivilegedExceptionAction() {
137.113 - public Object run() throws IOException {
137.114 + urls = AccessController.doPrivileged(
137.115 + new PrivilegedExceptionAction<Enumeration<URL>>() {
137.116 + public Enumeration<URL> run() throws IOException {
137.117 return (cl == null)
137.118 ? ClassLoader.getSystemResources(name)
137.119 : cl.getResources(name);
137.120 @@ -176,9 +174,9 @@
137.121 }
137.122
137.123 ClassLoader getContextClassLoader() {
137.124 - return (ClassLoader) AccessController.doPrivileged(
137.125 - new PrivilegedAction() {
137.126 - public Object run() {
137.127 + return AccessController.doPrivileged(
137.128 + new PrivilegedAction<ClassLoader>() {
137.129 + public ClassLoader run() {
137.130 return Thread.currentThread().getContextClassLoader();
137.131 }
137.132 }
137.133 @@ -193,13 +191,13 @@
137.134 * This is used to enumerate the resources under a foreign codebase.
137.135 * This class is not MT-safe.
137.136 */
137.137 - class InputStreamEnumeration implements NamingEnumeration {
137.138 + class InputStreamEnumeration implements NamingEnumeration<InputStream> {
137.139
137.140 - private final Enumeration urls;
137.141 + private final Enumeration<URL> urls;
137.142
137.143 - private Object nextElement = null;
137.144 + private InputStream nextElement = null;
137.145
137.146 - InputStreamEnumeration(Enumeration urls) {
137.147 + InputStreamEnumeration(Enumeration<URL> urls) {
137.148 this.urls = urls;
137.149 }
137.150
137.151 @@ -207,13 +205,13 @@
137.152 * Returns the next InputStream, or null if there are no more.
137.153 * An InputStream that cannot be opened is skipped.
137.154 */
137.155 - private Object getNextElement() {
137.156 + private InputStream getNextElement() {
137.157 return AccessController.doPrivileged(
137.158 - new PrivilegedAction() {
137.159 - public Object run() {
137.160 + new PrivilegedAction<InputStream>() {
137.161 + public InputStream run() {
137.162 while (urls.hasMoreElements()) {
137.163 try {
137.164 - return ((URL)urls.nextElement()).openStream();
137.165 + return urls.nextElement().openStream();
137.166 } catch (IOException e) {
137.167 // skip this URL
137.168 }
137.169 @@ -236,9 +234,9 @@
137.170 return hasMore();
137.171 }
137.172
137.173 - public Object next() {
137.174 + public InputStream next() {
137.175 if (hasMore()) {
137.176 - Object res = nextElement;
137.177 + InputStream res = nextElement;
137.178 nextElement = null;
137.179 return res;
137.180 } else {
137.181 @@ -246,7 +244,7 @@
137.182 }
137.183 }
137.184
137.185 - public Object nextElement() {
137.186 + public InputStream nextElement() {
137.187 return next();
137.188 }
137.189
138.1 --- a/src/share/classes/com/sun/security/auth/PolicyFile.java Thu Sep 01 13:54:38 2011 -0700
138.2 +++ b/src/share/classes/com/sun/security/auth/PolicyFile.java Mon Sep 05 23:58:19 2011 -0700
138.3 @@ -26,13 +26,10 @@
138.4 package com.sun.security.auth;
138.5
138.6 import java.io.*;
138.7 -import java.lang.RuntimePermission;
138.8 import java.lang.reflect.*;
138.9 -import java.net.MalformedURLException;
138.10 import java.net.URL;
138.11 import java.util.*;
138.12
138.13 -import java.security.AccessController;
138.14 import java.security.CodeSource;
138.15 import java.security.KeyStore;
138.16 import java.security.KeyStoreException;
138.17 @@ -260,7 +257,7 @@
138.18 private static final String AUTH_POLICY_URL = "auth.policy.url.";
138.19
138.20 private Vector<PolicyEntry> policyEntries;
138.21 - private Hashtable aliasMapping;
138.22 + private Hashtable<Object, Object> aliasMapping;
138.23
138.24 private boolean initialized = false;
138.25
138.26 @@ -293,7 +290,7 @@
138.27 return;
138.28
138.29 policyEntries = new Vector<PolicyEntry>();
138.30 - aliasMapping = new Hashtable(11);
138.31 + aliasMapping = new Hashtable<Object, Object>(11);
138.32
138.33 initPolicyFile();
138.34 initialized = true;
138.35 @@ -403,7 +400,7 @@
138.36 }
138.37 try {
138.38 extra_policy = PropertyExpander.expand(extra_policy);
138.39 - URL policyURL;;
138.40 + URL policyURL;
138.41 File policyFile = new File(extra_policy);
138.42 if (policyFile.exists()) {
138.43 policyURL =
138.44 @@ -702,8 +699,8 @@
138.45 InvocationTargetException
138.46 {
138.47 //XXX we might want to keep a hash of created factories...
138.48 - Class pc = Class.forName(type);
138.49 - Constructor c = pc.getConstructor(PARAMS);
138.50 + Class<?> pc = Class.forName(type);
138.51 + Constructor<?> c = pc.getConstructor(PARAMS);
138.52 return (Permission) c.newInstance(new Object[] { name, actions });
138.53 }
138.54
138.55 @@ -1088,16 +1085,20 @@
138.56 // because the earlier CodeSource.implies succeeded
138.57 SubjectCodeSource scs = (SubjectCodeSource)accCs;
138.58
138.59 - Set<Principal> principalSet = null;
138.60 + Set<? extends Principal> principalSet = null;
138.61 try {
138.62 - Class pClass = Class.forName(principal.principalClass, false,
138.63 - ClassLoader.getSystemClassLoader());
138.64 + // principal.principalClass should extend Principal
138.65 + // If it doesn't, we should stop here with a ClassCastException.
138.66 + @SuppressWarnings("unchecked")
138.67 + Class<? extends Principal> pClass = (Class<? extends Principal>)
138.68 + Class.forName(principal.principalClass, false,
138.69 + ClassLoader.getSystemClassLoader());
138.70 principalSet = scs.getSubject().getPrincipals(pClass);
138.71 } catch (Exception e) {
138.72 if (debug != null) {
138.73 debug.println("problem finding Principal Class " +
138.74 - "when expanding SELF permission: " +
138.75 - e.toString());
138.76 + "when expanding SELF permission: " +
138.77 + e.toString());
138.78 }
138.79 }
138.80
138.81 @@ -1107,11 +1108,9 @@
138.82 }
138.83
138.84 String[][] info = new String[principalSet.size()][2];
138.85 - java.util.Iterator<Principal> pIterator = principalSet.iterator();
138.86
138.87 int i = 0;
138.88 - while (pIterator.hasNext()) {
138.89 - Principal p = pIterator.next();
138.90 + for (Principal p : principalSet) {
138.91 info[i][0] = p.getClass().getName();
138.92 info[i][1] = p.getName();
138.93 i++;
139.1 --- a/src/share/classes/com/sun/security/auth/SubjectCodeSource.java Thu Sep 01 13:54:38 2011 -0700
139.2 +++ b/src/share/classes/com/sun/security/auth/SubjectCodeSource.java Mon Sep 05 23:58:19 2011 -0700
139.3 @@ -1,5 +1,5 @@
139.4 /*
139.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
139.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
139.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
139.8 *
139.9 * This code is free software; you can redistribute it and/or modify it
139.10 @@ -205,10 +205,9 @@
139.11
139.12 // handle PrincipalComparators
139.13
139.14 - Class principalComparator = Class.forName(pppe.principalClass,
139.15 - true,
139.16 - sysClassLoader);
139.17 - Constructor c = principalComparator.getConstructor(PARAMS);
139.18 + Class<?> principalComparator = Class.forName(
139.19 + pppe.principalClass, true, sysClassLoader);
139.20 + Constructor<?> c = principalComparator.getConstructor(PARAMS);
139.21 PrincipalComparator pc =
139.22 (PrincipalComparator)c.newInstance
139.23 (new Object[] { pppe.principalName });
140.1 --- a/src/share/classes/com/sun/security/auth/module/JndiLoginModule.java Thu Sep 01 13:54:38 2011 -0700
140.2 +++ b/src/share/classes/com/sun/security/auth/module/JndiLoginModule.java Mon Sep 05 23:58:19 2011 -0700
140.3 @@ -32,16 +32,13 @@
140.4 import javax.naming.*;
140.5 import javax.naming.directory.*;
140.6
140.7 -import java.io.IOException;
140.8 import java.util.Map;
140.9 import java.util.LinkedList;
140.10 -import java.util.ResourceBundle;
140.11
140.12 import com.sun.security.auth.UnixPrincipal;
140.13 import com.sun.security.auth.UnixNumericUserPrincipal;
140.14 import com.sun.security.auth.UnixNumericGroupPrincipal;
140.15
140.16 -import sun.security.util.AuthResources;
140.17
140.18 /**
140.19 * <p> The module prompts for a username and password
140.20 @@ -189,7 +186,7 @@
140.21 // initial state
140.22 private Subject subject;
140.23 private CallbackHandler callbackHandler;
140.24 - private Map sharedState;
140.25 + private Map<String, Object> sharedState;
140.26 private Map<String, ?> options;
140.27
140.28 private static final String CRYPT = "{crypt}";
140.29 @@ -217,13 +214,18 @@
140.30 * <code>Configuration</code> for this particular
140.31 * <code>LoginModule</code>.
140.32 */
140.33 + // Unchecked warning from (Map<String, Object>)sharedState is safe
140.34 + // since javax.security.auth.login.LoginContext passes a raw HashMap.
140.35 + // Unchecked warnings from options.get(String) are safe since we are
140.36 + // passing known keys.
140.37 + @SuppressWarnings("unchecked")
140.38 public void initialize(Subject subject, CallbackHandler callbackHandler,
140.39 Map<String,?> sharedState,
140.40 Map<String,?> options) {
140.41
140.42 this.subject = subject;
140.43 this.callbackHandler = callbackHandler;
140.44 - this.sharedState = sharedState;
140.45 + this.sharedState = (Map<String, Object>)sharedState;
140.46 this.options = options;
140.47
140.48 // initialize any configured options
141.1 --- a/src/share/classes/com/sun/security/auth/module/KeyStoreLoginModule.java Thu Sep 01 13:54:38 2011 -0700
141.2 +++ b/src/share/classes/com/sun/security/auth/module/KeyStoreLoginModule.java Mon Sep 05 23:58:19 2011 -0700
141.3 @@ -25,11 +25,9 @@
141.4
141.5 package com.sun.security.auth.module;
141.6
141.7 -import javax.security.auth.x500.X500Principal;
141.8 import java.io.File;
141.9 import java.io.IOException;
141.10 import java.io.InputStream;
141.11 -import java.io.PushbackInputStream;
141.12 import java.net.MalformedURLException;
141.13 import java.net.URL;
141.14 import java.security.AuthProvider;
141.15 @@ -39,7 +37,6 @@
141.16 import java.security.KeyStoreException;
141.17 import java.security.NoSuchAlgorithmException;
141.18 import java.security.NoSuchProviderException;
141.19 -import java.security.Principal;
141.20 import java.security.PrivateKey;
141.21 import java.security.Provider;
141.22 import java.security.UnrecoverableKeyException;
141.23 @@ -49,13 +46,10 @@
141.24 import java.util.Iterator;
141.25 import java.util.LinkedList;
141.26 import java.util.Map;
141.27 -import java.util.ResourceBundle;
141.28 import javax.security.auth.Destroyable;
141.29 import javax.security.auth.DestroyFailedException;
141.30 import javax.security.auth.Subject;
141.31 import javax.security.auth.x500.*;
141.32 -import javax.security.auth.Subject;
141.33 -import javax.security.auth.x500.*;
141.34 import javax.security.auth.callback.Callback;
141.35 import javax.security.auth.callback.CallbackHandler;
141.36 import javax.security.auth.callback.ConfirmationCallback;
141.37 @@ -67,7 +61,6 @@
141.38 import javax.security.auth.login.LoginException;
141.39 import javax.security.auth.spi.LoginModule;
141.40
141.41 -import sun.security.util.AuthResources;
141.42 import sun.security.util.Password;
141.43
141.44 /**
141.45 @@ -159,7 +152,7 @@
141.46
141.47 private Subject subject;
141.48 private CallbackHandler callbackHandler;
141.49 - private Map sharedState;
141.50 + private Map<String, Object> sharedState;
141.51 private Map<String, ?> options;
141.52
141.53 private char[] keyStorePassword;
141.54 @@ -202,7 +195,9 @@
141.55 * <code>Configuration</code> for this particular
141.56 * <code>LoginModule</code>.
141.57 */
141.58 -
141.59 + // Unchecked warning from (Map<String, Object>)sharedState is safe
141.60 + // since javax.security.auth.login.LoginContext passes a raw HashMap.
141.61 + @SuppressWarnings("unchecked")
141.62 public void initialize(Subject subject,
141.63 CallbackHandler callbackHandler,
141.64 Map<String,?> sharedState,
141.65 @@ -210,7 +205,7 @@
141.66 {
141.67 this.subject = subject;
141.68 this.callbackHandler = callbackHandler;
141.69 - this.sharedState = sharedState;
141.70 + this.sharedState = (Map<String, Object>)sharedState;
141.71 this.options = options;
141.72
141.73 processOptions();
141.74 @@ -337,6 +332,7 @@
141.75 }
141.76
141.77 /** Get the alias and passwords to use for looking up in the KeyStore. */
141.78 + @SuppressWarnings("fallthrough")
141.79 private void getAliasAndPasswords(int env) throws LoginException {
141.80 if (callbackHandler == null) {
141.81
142.1 --- a/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java Thu Sep 01 13:54:38 2011 -0700
142.2 +++ b/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java Mon Sep 05 23:58:19 2011 -0700
142.3 @@ -367,7 +367,7 @@
142.4 // initial state
142.5 private Subject subject;
142.6 private CallbackHandler callbackHandler;
142.7 - private Map sharedState;
142.8 + private Map<String, Object> sharedState;
142.9 private Map<String, ?> options;
142.10
142.11 // configurable option
142.12 @@ -432,7 +432,11 @@
142.13 * <code>Configuration</code> for this particular
142.14 * <code>LoginModule</code>.
142.15 */
142.16 -
142.17 + // Unchecked warning from (Map<String, Object>)sharedState is safe
142.18 + // since javax.security.auth.login.LoginContext passes a raw HashMap.
142.19 + // Unchecked warnings from options.get(String) are safe since we are
142.20 + // passing known keys.
142.21 + @SuppressWarnings("unchecked")
142.22 public void initialize(Subject subject,
142.23 CallbackHandler callbackHandler,
142.24 Map<String, ?> sharedState,
142.25 @@ -440,7 +444,7 @@
142.26
142.27 this.subject = subject;
142.28 this.callbackHandler = callbackHandler;
142.29 - this.sharedState = sharedState;
142.30 + this.sharedState = (Map<String, Object>)sharedState;
142.31 this.options = options;
142.32
142.33 // initialize any configured options
143.1 --- a/src/share/classes/com/sun/security/auth/module/LdapLoginModule.java Thu Sep 01 13:54:38 2011 -0700
143.2 +++ b/src/share/classes/com/sun/security/auth/module/LdapLoginModule.java Mon Sep 05 23:58:19 2011 -0700
143.3 @@ -1,5 +1,5 @@
143.4 /*
143.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
143.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
143.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
143.8 *
143.9 * This code is free software; you can redistribute it and/or modify it
143.10 @@ -25,14 +25,12 @@
143.11
143.12 package com.sun.security.auth.module;
143.13
143.14 -import java.io.IOException;
143.15 import java.security.AccessController;
143.16 import java.net.SocketPermission;
143.17 import java.security.Principal;
143.18 import java.security.PrivilegedAction;
143.19 import java.util.Arrays;
143.20 import java.util.Hashtable;
143.21 -import java.util.Iterator;
143.22 import java.util.Map;
143.23 import java.util.ResourceBundle;
143.24 import java.util.regex.Matcher;
143.25 @@ -50,7 +48,6 @@
143.26 import com.sun.security.auth.LdapPrincipal;
143.27 import com.sun.security.auth.UserPrincipal;
143.28
143.29 -import sun.security.util.AuthResources;
143.30
143.31 /**
143.32 * This {@link LoginModule} performs LDAP-based authentication.
143.33 @@ -366,12 +363,12 @@
143.34 // Initial state
143.35 private Subject subject;
143.36 private CallbackHandler callbackHandler;
143.37 - private Map sharedState;
143.38 + private Map<String, Object> sharedState;
143.39 private Map<String, ?> options;
143.40 private LdapContext ctx;
143.41 private Matcher identityMatcher = null;
143.42 private Matcher filterMatcher = null;
143.43 - private Hashtable ldapEnvironment;
143.44 + private Hashtable<String, Object> ldapEnvironment;
143.45 private SearchControls constraints = null;
143.46
143.47 /**
143.48 @@ -385,15 +382,18 @@
143.49 * <code>Configuration</code> for this particular
143.50 * <code>LoginModule</code>.
143.51 */
143.52 + // Unchecked warning from (Map<String, Object>)sharedState is safe
143.53 + // since javax.security.auth.login.LoginContext passes a raw HashMap.
143.54 + @SuppressWarnings("unchecked")
143.55 public void initialize(Subject subject, CallbackHandler callbackHandler,
143.56 Map<String, ?> sharedState, Map<String, ?> options) {
143.57
143.58 this.subject = subject;
143.59 this.callbackHandler = callbackHandler;
143.60 - this.sharedState = sharedState;
143.61 + this.sharedState = (Map<String, Object>)sharedState;
143.62 this.options = options;
143.63
143.64 - ldapEnvironment = new Hashtable(9);
143.65 + ldapEnvironment = new Hashtable<String, Object>(9);
143.66 ldapEnvironment.put(Context.INITIAL_CONTEXT_FACTORY,
143.67 "com.sun.jndi.ldap.LdapCtxFactory");
143.68
144.1 --- a/src/share/classes/com/sun/security/jgss/InquireSecContextPermission.java Thu Sep 01 13:54:38 2011 -0700
144.2 +++ b/src/share/classes/com/sun/security/jgss/InquireSecContextPermission.java Mon Sep 05 23:58:19 2011 -0700
144.3 @@ -1,5 +1,5 @@
144.4 /*
144.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
144.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
144.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
144.8 *
144.9 * This code is free software; you can redistribute it and/or modify it
144.10 @@ -36,6 +36,7 @@
144.11 * <p>The target name is the {@link InquireType} allowed.
144.12 */
144.13 public final class InquireSecContextPermission extends BasicPermission {
144.14 + private static final long serialVersionUID = -7131173349668647297L;
144.15
144.16 /**
144.17 * Constructs a new {@code InquireSecContextPermission} object with
145.1 --- a/src/share/classes/com/sun/security/ntlm/Client.java Thu Sep 01 13:54:38 2011 -0700
145.2 +++ b/src/share/classes/com/sun/security/ntlm/Client.java Mon Sep 05 23:58:19 2011 -0700
145.3 @@ -69,14 +69,16 @@
145.4 * This method does not make any modification to this parameter, it neither
145.5 * needs to access the content of this parameter after this method call,
145.6 * so you are free to modify or nullify this parameter after this call.
145.7 - * @throws NullPointerException if {@code username} or {@code password} is null.
145.8 - * @throws NTLMException if {@code version} is illegal
145.9 + * @throws NTLMException if {@code username} or {@code password} is null,
145.10 + * or {@code version} is illegal.
145.11 + *
145.12 */
145.13 public Client(String version, String hostname, String username,
145.14 String domain, char[] password) throws NTLMException {
145.15 super(version);
145.16 if ((username == null || password == null)) {
145.17 - throw new NullPointerException("username/password cannot be null");
145.18 + throw new NTLMException(NTLMException.PROTOCOL,
145.19 + "username/password cannot be null");
145.20 }
145.21 this.hostname = hostname;
145.22 this.username = username;
145.23 @@ -117,13 +119,13 @@
145.24 * @param nonce random 8-byte array to be used in message generation,
145.25 * must not be null except for original NTLM v1
145.26 * @return the message generated
145.27 - * @throws NullPointerException if {@code type2} or {@code nonce} is null
145.28 - * for NTLM v1.
145.29 - * @throws NTLMException if the incoming message is invalid
145.30 + * @throws NTLMException if the incoming message is invalid, or
145.31 + * {@code nonce} is null for NTLM v1.
145.32 */
145.33 public byte[] type3(byte[] type2, byte[] nonce) throws NTLMException {
145.34 if (type2 == null || (v != Version.NTLM && nonce == null)) {
145.35 - throw new NullPointerException("type2 and nonce cannot be null");
145.36 + throw new NTLMException(NTLMException.PROTOCOL,
145.37 + "type2 and nonce cannot be null");
145.38 }
145.39 debug("NTLM Client: Type 2 received\n");
145.40 debug(type2);
146.1 --- a/src/share/classes/com/sun/security/ntlm/NTLM.java Thu Sep 01 13:54:38 2011 -0700
146.2 +++ b/src/share/classes/com/sun/security/ntlm/NTLM.java Mon Sep 05 23:58:19 2011 -0700
146.3 @@ -33,6 +33,7 @@
146.4 import java.security.NoSuchAlgorithmException;
146.5 import java.security.spec.InvalidKeySpecException;
146.6 import java.util.Arrays;
146.7 +import java.util.Locale;
146.8 import javax.crypto.BadPaddingException;
146.9 import javax.crypto.Cipher;
146.10 import javax.crypto.IllegalBlockSizeException;
146.11 @@ -410,7 +411,8 @@
146.12
146.13 static byte[] getP1(char[] password) {
146.14 try {
146.15 - return new String(password).toUpperCase().getBytes("ISO8859_1");
146.16 + return new String(password).toUpperCase(
146.17 + Locale.ENGLISH).getBytes("ISO8859_1");
146.18 } catch (UnsupportedEncodingException ex) {
146.19 return null;
146.20 }
147.1 --- a/src/share/classes/com/sun/security/ntlm/NTLMException.java Thu Sep 01 13:54:38 2011 -0700
147.2 +++ b/src/share/classes/com/sun/security/ntlm/NTLMException.java Mon Sep 05 23:58:19 2011 -0700
147.3 @@ -1,5 +1,5 @@
147.4 /*
147.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
147.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
147.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
147.8 *
147.9 * This code is free software; you can redistribute it and/or modify it
147.10 @@ -31,6 +31,7 @@
147.11 * An NTLM-related Exception
147.12 */
147.13 public final class NTLMException extends GeneralSecurityException {
147.14 + private static final long serialVersionUID = -3298539507906689430L;
147.15
147.16 /**
147.17 * If the incoming packet is invalid.
147.18 @@ -64,6 +65,11 @@
147.19 */
147.20 public final static int BAD_VERSION = 5;
147.21
147.22 + /**
147.23 + * Protocol errors.
147.24 + */
147.25 + public final static int PROTOCOL = 6;
147.26 +
147.27 private int errorCode;
147.28
147.29 /**
148.1 --- a/src/share/classes/com/sun/security/ntlm/Server.java Thu Sep 01 13:54:38 2011 -0700
148.2 +++ b/src/share/classes/com/sun/security/ntlm/Server.java Mon Sep 05 23:58:19 2011 -0700
148.3 @@ -62,12 +62,13 @@
148.4 * is selected, authentication succeeds if one of LM (or LMv2) or
148.5 * NTLM (or NTLMv2) is verified.
148.6 * @param domain the domain, must not be null
148.7 - * @throws NullPointerException if {@code domain} is null.
148.8 + * @throws NTLMException if {@code domain} is null.
148.9 */
148.10 public Server(String version, String domain) throws NTLMException {
148.11 super(version);
148.12 if (domain == null) {
148.13 - throw new NullPointerException("domain cannot be null");
148.14 + throw new NTLMException(NTLMException.PROTOCOL,
148.15 + "domain cannot be null");
148.16 }
148.17 this.allVersion = (version == null);
148.18 this.domain = domain;
148.19 @@ -80,12 +81,13 @@
148.20 * @param nonce the random 8-byte array to be used in message generation,
148.21 * must not be null
148.22 * @return the message generated
148.23 - * @throws NullPointerException if type1 or nonce is null
148.24 - * @throws NTLMException if the incoming message is invalid
148.25 + * @throws NTLMException if the incoming message is invalid, or
148.26 + * {@code nonce} is null.
148.27 */
148.28 - public byte[] type2(byte[] type1, byte[] nonce) {
148.29 + public byte[] type2(byte[] type1, byte[] nonce) throws NTLMException {
148.30 if (nonce == null) {
148.31 - throw new NullPointerException("nonce cannot be null");
148.32 + throw new NTLMException(NTLMException.PROTOCOL,
148.33 + "nonce cannot be null");
148.34 }
148.35 debug("NTLM Server: Type 1 received\n");
148.36 if (type1 != null) debug(type1);
148.37 @@ -105,13 +107,14 @@
148.38 * @param type3 the incoming Type3 message from client, must not be null
148.39 * @param nonce the same nonce provided in {@link #type2}, must not be null
148.40 * @return username and hostname of the client in a byte array
148.41 - * @throws NullPointerException if {@code type3} or {@code nonce} is null
148.42 - * @throws NTLMException if the incoming message is invalid
148.43 + * @throws NTLMException if the incoming message is invalid, or
148.44 + * {@code nonce} is null.
148.45 */
148.46 public String[] verify(byte[] type3, byte[] nonce)
148.47 throws NTLMException {
148.48 if (type3 == null || nonce == null) {
148.49 - throw new NullPointerException("type1 or nonce cannot be null");
148.50 + throw new NTLMException(NTLMException.PROTOCOL,
148.51 + "type1 or nonce cannot be null");
148.52 }
148.53 debug("NTLM Server: Type 3 received\n");
148.54 if (type3 != null) debug(type3);
149.1 --- a/src/share/classes/com/sun/security/sasl/CramMD5Server.java Thu Sep 01 13:54:38 2011 -0700
149.2 +++ b/src/share/classes/com/sun/security/sasl/CramMD5Server.java Mon Sep 05 23:58:19 2011 -0700
149.3 @@ -1,5 +1,5 @@
149.4 /*
149.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
149.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
149.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
149.8 *
149.9 * This code is free software; you can redistribute it and/or modify it
149.10 @@ -33,7 +33,6 @@
149.11 import java.io.UnsupportedEncodingException;
149.12 import java.security.NoSuchAlgorithmException;
149.13
149.14 -import java.util.logging.Logger;
149.15 import java.util.logging.Level;
149.16
149.17 /**
149.18 @@ -68,7 +67,7 @@
149.19 * @param pw A non-null String or byte[]
149.20 * containing the password. If it is an array, it is first cloned.
149.21 */
149.22 - CramMD5Server(String protocol, String serverFqdn, Map props,
149.23 + CramMD5Server(String protocol, String serverFqdn, Map<String, ?> props,
149.24 CallbackHandler cbh) throws SaslException {
149.25 if (serverFqdn == null) {
149.26 throw new SaslException(
150.1 --- a/src/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java Thu Sep 01 13:54:38 2011 -0700
150.2 +++ b/src/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java Mon Sep 05 23:58:19 2011 -0700
150.3 @@ -1,5 +1,5 @@
150.4 /*
150.5 - * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
150.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
150.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
150.8 *
150.9 * This code is free software; you can redistribute it and/or modify it
150.10 @@ -28,21 +28,15 @@
150.11 import java.util.Map;
150.12 import java.util.Arrays;
150.13 import java.util.List;
150.14 -import java.util.Set;
150.15 -import java.util.logging.Logger;
150.16 import java.util.logging.Level;
150.17 import java.math.BigInteger;
150.18 import java.util.Random;
150.19 -import java.security.Provider;
150.20
150.21 -import java.io.ByteArrayInputStream;
150.22 import java.io.ByteArrayOutputStream;
150.23 import java.io.UnsupportedEncodingException;
150.24 import java.io.IOException;
150.25
150.26 import java.security.MessageDigest;
150.27 -import java.security.AccessController;
150.28 -import java.security.PrivilegedAction;
150.29 import java.security.NoSuchAlgorithmException;
150.30 import java.security.InvalidKeyException;
150.31 import java.security.spec.KeySpec;
150.32 @@ -53,7 +47,6 @@
150.33 import javax.crypto.SecretKey;
150.34 import javax.crypto.Mac;
150.35 import javax.crypto.SecretKeyFactory;
150.36 -import javax.crypto.BadPaddingException;
150.37 import javax.crypto.NoSuchPaddingException;
150.38 import javax.crypto.IllegalBlockSizeException;
150.39 import javax.crypto.spec.IvParameterSpec;
150.40 @@ -175,8 +168,9 @@
150.41 *
150.42 * @throws SaslException If invalid value found in props.
150.43 */
150.44 - protected DigestMD5Base(Map props, String className, int firstStep,
150.45 - String digestUri, CallbackHandler cbh) throws SaslException {
150.46 + protected DigestMD5Base(Map<String, ?> props, String className,
150.47 + int firstStep, String digestUri, CallbackHandler cbh)
150.48 + throws SaslException {
150.49 super(props, className); // sets QOP, STENGTH and BUFFER_SIZE
150.50
150.51 step = firstStep;
150.52 @@ -791,7 +785,7 @@
150.53 }
150.54 } else if (realmChoices != null && i == realmIndex) {
150.55 // > 1 realm specified
150.56 - if (realmChoices.size() == 0) {
150.57 + if (realmChoices.isEmpty()) {
150.58 realmChoices.add(valueTable[i]); // add existing one
150.59 }
150.60 realmChoices.add(value); // add new one
150.61 @@ -1585,47 +1579,45 @@
150.62 KeySpec spec = null;
150.63 SecretKeyFactory desFactory =
150.64 SecretKeyFactory.getInstance(desStrength);
150.65 -
150.66 - if (desStrength.equals("des")) {
150.67 - spec = new DESKeySpec(subkey1, 0);
150.68 - if (logger.isLoggable(Level.FINEST)) {
150.69 - traceOutput(DP_CLASS_NAME, "makeDesKeys",
150.70 - "DIGEST42:DES key input: ", input);
150.71 - traceOutput(DP_CLASS_NAME, "makeDesKeys",
150.72 - "DIGEST43:DES key parity-adjusted: ", subkey1);
150.73 - traceOutput(DP_CLASS_NAME, "makeDesKeys",
150.74 - "DIGEST44:DES key material: ", ((DESKeySpec)spec).getKey());
150.75 - logger.log(Level.FINEST, "DIGEST45: is parity-adjusted? {0}",
150.76 - Boolean.valueOf(DESKeySpec.isParityAdjusted(subkey1, 0)));
150.77 - }
150.78 -
150.79 - } else if (desStrength.equals("desede")) {
150.80 -
150.81 - // Generate second subkey using second 7 bytes
150.82 - byte[] subkey2 = addDesParity(input, 7, 7);
150.83 -
150.84 - // Construct 24-byte encryption-decryption-encryption sequence
150.85 - byte[] ede = new byte[subkey1.length*2+subkey2.length];
150.86 - System.arraycopy(subkey1, 0, ede, 0, subkey1.length);
150.87 - System.arraycopy(subkey2, 0, ede, subkey1.length, subkey2.length);
150.88 - System.arraycopy(subkey1, 0, ede, subkey1.length+subkey2.length,
150.89 - subkey1.length);
150.90 -
150.91 - spec = new DESedeKeySpec(ede, 0);
150.92 - if (logger.isLoggable(Level.FINEST)) {
150.93 - traceOutput(DP_CLASS_NAME, "makeDesKeys",
150.94 - "DIGEST46:3DES key input: ", input);
150.95 - traceOutput(DP_CLASS_NAME, "makeDesKeys",
150.96 - "DIGEST47:3DES key ede: ", ede);
150.97 - traceOutput(DP_CLASS_NAME, "makeDesKeys",
150.98 - "DIGEST48:3DES key material: ",
150.99 - ((DESedeKeySpec)spec).getKey());
150.100 - logger.log(Level.FINEST, "DIGEST49: is parity-adjusted? ",
150.101 - Boolean.valueOf(DESedeKeySpec.isParityAdjusted(ede, 0)));
150.102 - }
150.103 - } else {
150.104 - throw new IllegalArgumentException("Invalid DES strength:" +
150.105 - desStrength);
150.106 + switch (desStrength) {
150.107 + case "des":
150.108 + spec = new DESKeySpec(subkey1, 0);
150.109 + if (logger.isLoggable(Level.FINEST)) {
150.110 + traceOutput(DP_CLASS_NAME, "makeDesKeys",
150.111 + "DIGEST42:DES key input: ", input);
150.112 + traceOutput(DP_CLASS_NAME, "makeDesKeys",
150.113 + "DIGEST43:DES key parity-adjusted: ", subkey1);
150.114 + traceOutput(DP_CLASS_NAME, "makeDesKeys",
150.115 + "DIGEST44:DES key material: ", ((DESKeySpec)spec).getKey());
150.116 + logger.log(Level.FINEST, "DIGEST45: is parity-adjusted? {0}",
150.117 + Boolean.valueOf(DESKeySpec.isParityAdjusted(subkey1, 0)));
150.118 + }
150.119 + break;
150.120 + case "desede":
150.121 + // Generate second subkey using second 7 bytes
150.122 + byte[] subkey2 = addDesParity(input, 7, 7);
150.123 + // Construct 24-byte encryption-decryption-encryption sequence
150.124 + byte[] ede = new byte[subkey1.length*2+subkey2.length];
150.125 + System.arraycopy(subkey1, 0, ede, 0, subkey1.length);
150.126 + System.arraycopy(subkey2, 0, ede, subkey1.length, subkey2.length);
150.127 + System.arraycopy(subkey1, 0, ede, subkey1.length+subkey2.length,
150.128 + subkey1.length);
150.129 + spec = new DESedeKeySpec(ede, 0);
150.130 + if (logger.isLoggable(Level.FINEST)) {
150.131 + traceOutput(DP_CLASS_NAME, "makeDesKeys",
150.132 + "DIGEST46:3DES key input: ", input);
150.133 + traceOutput(DP_CLASS_NAME, "makeDesKeys",
150.134 + "DIGEST47:3DES key ede: ", ede);
150.135 + traceOutput(DP_CLASS_NAME, "makeDesKeys",
150.136 + "DIGEST48:3DES key material: ",
150.137 + ((DESedeKeySpec)spec).getKey());
150.138 + logger.log(Level.FINEST, "DIGEST49: is parity-adjusted? ",
150.139 + Boolean.valueOf(DESedeKeySpec.isParityAdjusted(ede, 0)));
150.140 + }
150.141 + break;
150.142 + default:
150.143 + throw new IllegalArgumentException("Invalid DES strength:" +
150.144 + desStrength);
150.145 }
150.146 return desFactory.generateSecret(spec);
150.147 }
151.1 --- a/src/share/classes/com/sun/security/sasl/digest/DigestMD5Client.java Thu Sep 01 13:54:38 2011 -0700
151.2 +++ b/src/share/classes/com/sun/security/sasl/digest/DigestMD5Client.java Mon Sep 05 23:58:19 2011 -0700
151.3 @@ -1,5 +1,5 @@
151.4 /*
151.5 - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
151.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
151.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
151.8 *
151.9 * This code is free software; you can redistribute it and/or modify it
151.10 @@ -25,21 +25,16 @@
151.11
151.12 package com.sun.security.sasl.digest;
151.13
151.14 -import java.security.AccessController;
151.15 -import java.security.MessageDigest;
151.16 import java.security.NoSuchAlgorithmException;
151.17 import java.io.ByteArrayOutputStream;
151.18 -import java.io.ByteArrayInputStream;
151.19 import java.io.IOException;
151.20 import java.io.UnsupportedEncodingException;
151.21 import java.util.StringTokenizer;
151.22 import java.util.ArrayList;
151.23 import java.util.List;
151.24 import java.util.Map;
151.25 -import java.util.Set;
151.26 import java.util.Arrays;
151.27
151.28 -import java.util.logging.Logger;
151.29 import java.util.logging.Level;
151.30
151.31 import javax.security.sasl.*;
151.32 @@ -153,7 +148,7 @@
151.33 * @throws SaslException if no authentication ID or password is supplied
151.34 */
151.35 DigestMD5Client(String authzid, String protocol, String serverName,
151.36 - Map props, CallbackHandler cbh) throws SaslException {
151.37 + Map<String, ?> props, CallbackHandler cbh) throws SaslException {
151.38
151.39 super(props, MY_CLASS_NAME, 2, protocol + "/" + serverName, cbh);
151.40
152.1 --- a/src/share/classes/com/sun/security/sasl/digest/DigestMD5Server.java Thu Sep 01 13:54:38 2011 -0700
152.2 +++ b/src/share/classes/com/sun/security/sasl/digest/DigestMD5Server.java Mon Sep 05 23:58:19 2011 -0700
152.3 @@ -1,5 +1,5 @@
152.4 /*
152.5 - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
152.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
152.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
152.8 *
152.9 * This code is free software; you can redistribute it and/or modify it
152.10 @@ -25,23 +25,16 @@
152.11
152.12 package com.sun.security.sasl.digest;
152.13
152.14 -import java.security.AccessController;
152.15 -import java.security.Provider;
152.16 -import java.security.MessageDigest;
152.17 import java.security.NoSuchAlgorithmException;
152.18 import java.io.ByteArrayOutputStream;
152.19 -import java.io.ByteArrayInputStream;
152.20 import java.io.IOException;
152.21 import java.io.UnsupportedEncodingException;
152.22 -import java.util.Random;
152.23 import java.util.StringTokenizer;
152.24 import java.util.ArrayList;
152.25 import java.util.List;
152.26 import java.util.Map;
152.27 -import java.util.Set;
152.28 import java.util.Arrays;
152.29
152.30 -import java.util.logging.Logger;
152.31 import java.util.logging.Level;
152.32
152.33 import javax.security.sasl.*;
152.34 @@ -147,7 +140,7 @@
152.35 private byte[] myCiphers;
152.36 private List<String> serverRealms;
152.37
152.38 - DigestMD5Server(String protocol, String serverName, Map props,
152.39 + DigestMD5Server(String protocol, String serverName, Map<String, ?> props,
152.40 CallbackHandler cbh) throws SaslException {
152.41 super(props, MY_CLASS_NAME, 1, protocol + "/" + serverName, cbh);
152.42
152.43 @@ -179,7 +172,7 @@
152.44 encoding = (useUTF8 ? "UTF8" : "8859_1");
152.45
152.46 // By default, use server name as realm
152.47 - if (serverRealms.size() == 0) {
152.48 + if (serverRealms.isEmpty()) {
152.49 serverRealms.add(serverName);
152.50 }
152.51 }
152.52 @@ -468,19 +461,23 @@
152.53
152.54 // Check that QOP is one sent by server
152.55 byte cQop;
152.56 - if (negotiatedQop.equals("auth")) {
152.57 - cQop = NO_PROTECTION;
152.58 - } else if (negotiatedQop.equals("auth-int")) {
152.59 - cQop = INTEGRITY_ONLY_PROTECTION;
152.60 - integrity = true;
152.61 - rawSendSize = sendMaxBufSize - 16;
152.62 - } else if (negotiatedQop.equals("auth-conf")) {
152.63 - cQop = PRIVACY_PROTECTION;
152.64 - integrity = privacy = true;
152.65 - rawSendSize = sendMaxBufSize - 26;
152.66 - } else {
152.67 - throw new SaslException("DIGEST-MD5: digest response format " +
152.68 - "violation. Invalid QOP: " + negotiatedQop);
152.69 + switch (negotiatedQop) {
152.70 + case "auth":
152.71 + cQop = NO_PROTECTION;
152.72 + break;
152.73 + case "auth-int":
152.74 + cQop = INTEGRITY_ONLY_PROTECTION;
152.75 + integrity = true;
152.76 + rawSendSize = sendMaxBufSize - 16;
152.77 + break;
152.78 + case "auth-conf":
152.79 + cQop = PRIVACY_PROTECTION;
152.80 + integrity = privacy = true;
152.81 + rawSendSize = sendMaxBufSize - 26;
152.82 + break;
152.83 + default:
152.84 + throw new SaslException("DIGEST-MD5: digest response format " +
152.85 + "violation. Invalid QOP: " + negotiatedQop);
152.86 }
152.87 if ((cQop&allQop) == 0) {
152.88 throw new SaslException("DIGEST-MD5: server does not support " +
153.1 --- a/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Base.java Thu Sep 01 13:54:38 2011 -0700
153.2 +++ b/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Base.java Mon Sep 05 23:58:19 2011 -0700
153.3 @@ -1,5 +1,5 @@
153.4 /*
153.5 - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
153.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
153.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
153.8 *
153.9 * This code is free software; you can redistribute it and/or modify it
153.10 @@ -26,9 +26,7 @@
153.11
153.12 package com.sun.security.sasl.gsskerb;
153.13
153.14 -import java.io.IOException;
153.15 import java.util.Map;
153.16 -import java.util.logging.Logger;
153.17 import java.util.logging.Level;
153.18 import javax.security.sasl.*;
153.19 import com.sun.security.sasl.util.AbstractSaslImpl;
153.20 @@ -50,7 +48,8 @@
153.21 protected MessageProp msgProp; // QOP and privacy for unwrap
153.22 protected static final int JGSS_QOP = 0; // unrelated to SASL QOP mask
153.23
153.24 - protected GssKrb5Base(Map props, String className) throws SaslException {
153.25 + protected GssKrb5Base(Map<String, ?> props, String className)
153.26 + throws SaslException {
153.27 super(props, className);
153.28 }
153.29
154.1 --- a/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java Thu Sep 01 13:54:38 2011 -0700
154.2 +++ b/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java Mon Sep 05 23:58:19 2011 -0700
154.3 @@ -1,5 +1,5 @@
154.4 /*
154.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
154.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
154.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
154.8 *
154.9 * This code is free software; you can redistribute it and/or modify it
154.10 @@ -27,7 +27,6 @@
154.11
154.12 import java.io.IOException;
154.13 import java.util.Map;
154.14 -import java.util.logging.Logger;
154.15 import java.util.logging.Level;
154.16 import javax.security.sasl.*;
154.17
154.18 @@ -93,7 +92,7 @@
154.19 * with the server.
154.20 */
154.21 GssKrb5Client(String authzID, String protocol, String serverName,
154.22 - Map props, CallbackHandler cbh) throws SaslException {
154.23 + Map<String, ?> props, CallbackHandler cbh) throws SaslException {
154.24
154.25 super(props, MY_CLASS_NAME);
154.26
155.1 --- a/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java Thu Sep 01 13:54:38 2011 -0700
155.2 +++ b/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java Mon Sep 05 23:58:19 2011 -0700
155.3 @@ -1,5 +1,5 @@
155.4 /*
155.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
155.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
155.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
155.8 *
155.9 * This code is free software; you can redistribute it and/or modify it
155.10 @@ -28,7 +28,6 @@
155.11 import javax.security.sasl.*;
155.12 import java.io.*;
155.13 import java.util.Map;
155.14 -import java.util.logging.Logger;
155.15 import java.util.logging.Level;
155.16
155.17 // JAAS
155.18 @@ -77,7 +76,7 @@
155.19 * with the client.
155.20 */
155.21 GssKrb5Server(String protocol, String serverName,
155.22 - Map props, CallbackHandler cbh) throws SaslException {
155.23 + Map<String, ?> props, CallbackHandler cbh) throws SaslException {
155.24
155.25 super(props, MY_CLASS_NAME);
155.26
156.1 --- a/src/share/classes/com/sun/security/sasl/ntlm/FactoryImpl.java Thu Sep 01 13:54:38 2011 -0700
156.2 +++ b/src/share/classes/com/sun/security/sasl/ntlm/FactoryImpl.java Mon Sep 05 23:58:19 2011 -0700
156.3 @@ -70,6 +70,12 @@
156.4 if (mechs[i].equals("NTLM") &&
156.5 PolicyUtils.checkPolicy(mechPolicies[0], props)) {
156.6
156.7 + if (cbh == null) {
156.8 + throw new SaslException(
156.9 + "Callback handler with support for " +
156.10 + "RealmCallback, NameCallback, and PasswordCallback " +
156.11 + "required");
156.12 + }
156.13 return new NTLMClient(mechs[i], authorizationId,
156.14 protocol, serverName, props, cbh);
156.15 }
156.16 @@ -98,9 +104,9 @@
156.17 }
156.18 if (cbh == null) {
156.19 throw new SaslException(
156.20 - "Callback handler with support for AuthorizeCallback, "+
156.21 - "RealmCallback, NameCallback, and PasswordCallback " +
156.22 - "required");
156.23 + "Callback handler with support for " +
156.24 + "RealmCallback, NameCallback, and PasswordCallback " +
156.25 + "required");
156.26 }
156.27 return new NTLMServer(mech, protocol, serverName, props, cbh);
156.28 }
157.1 --- a/src/share/classes/com/sun/security/sasl/ntlm/NTLMClient.java Thu Sep 01 13:54:38 2011 -0700
157.2 +++ b/src/share/classes/com/sun/security/sasl/ntlm/NTLMClient.java Mon Sep 05 23:58:19 2011 -0700
157.3 @@ -1,5 +1,5 @@
157.4 /*
157.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
157.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
157.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
157.8 *
157.9 * This code is free software; you can redistribute it and/or modify it
157.10 @@ -107,11 +107,11 @@
157.11 * @param protocol non-null for Sasl, useless for NTLM
157.12 * @param serverName non-null for Sasl, but can be null for NTLM
157.13 * @param props can be null
157.14 - * @param cbh can be null for Sasl, but will throw NPE for NTLM
157.15 + * @param cbh can be null for Sasl, already null-checked in factory
157.16 * @throws SaslException
157.17 */
157.18 NTLMClient(String mech, String authzid, String protocol, String serverName,
157.19 - Map props, CallbackHandler cbh) throws SaslException {
157.20 + Map<String, ?> props, CallbackHandler cbh) throws SaslException {
157.21
157.22 this.mech = mech;
157.23 String version = null;
157.24 @@ -166,7 +166,7 @@
157.25 pcb.getPassword());
157.26 } catch (NTLMException ne) {
157.27 throw new SaslException(
157.28 - "NTLM: Invalid version string: " + version, ne);
157.29 + "NTLM: client creation failure", ne);
157.30 }
157.31 }
157.32
157.33 @@ -183,23 +183,27 @@
157.34 @Override
157.35 public byte[] unwrap(byte[] incoming, int offset, int len)
157.36 throws SaslException {
157.37 - throw new UnsupportedOperationException("Not supported.");
157.38 + throw new IllegalStateException("Not supported.");
157.39 }
157.40
157.41 @Override
157.42 public byte[] wrap(byte[] outgoing, int offset, int len)
157.43 throws SaslException {
157.44 - throw new UnsupportedOperationException("Not supported.");
157.45 + throw new IllegalStateException("Not supported.");
157.46 }
157.47
157.48 @Override
157.49 public Object getNegotiatedProperty(String propName) {
157.50 - if (propName.equals(Sasl.QOP)) {
157.51 - return "auth";
157.52 - } else if (propName.equals(NTLM_DOMAIN)) {
157.53 - return client.getDomain();
157.54 - } else {
157.55 - return null;
157.56 + if (!isComplete()) {
157.57 + throw new IllegalStateException("authentication not complete");
157.58 + }
157.59 + switch (propName) {
157.60 + case Sasl.QOP:
157.61 + return "auth";
157.62 + case NTLM_DOMAIN:
157.63 + return client.getDomain();
157.64 + default:
157.65 + return null;
157.66 }
157.67 }
157.68
158.1 --- a/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java Thu Sep 01 13:54:38 2011 -0700
158.2 +++ b/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java Mon Sep 05 23:58:19 2011 -0700
158.3 @@ -1,5 +1,5 @@
158.4 /*
158.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
158.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
158.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
158.8 *
158.9 * This code is free software; you can redistribute it and/or modify it
158.10 @@ -106,11 +106,12 @@
158.11 * @param serverName not null for Sasl, can be null in NTLM. If non-null,
158.12 * might be used as domain if not provided in props
158.13 * @param props can be null
158.14 - * @param cbh can be null for Sasl, but will throw NPE in auth for NTLM
158.15 + * @param cbh can be null for Sasl, already null-checked in factory
158.16 * @throws SaslException
158.17 */
158.18 NTLMServer(String mech, String protocol, String serverName,
158.19 - Map props, final CallbackHandler cbh) throws SaslException {
158.20 + Map<String, ?> props, final CallbackHandler cbh)
158.21 + throws SaslException {
158.22
158.23 this.mech = mech;
158.24 String version = null;
158.25 @@ -131,7 +132,7 @@
158.26 domain = serverName;
158.27 }
158.28 if (domain == null) {
158.29 - throw new NullPointerException("Domain must be provided as"
158.30 + throw new SaslException("Domain must be provided as"
158.31 + " the serverName argument or in props");
158.32 }
158.33
158.34 @@ -158,7 +159,7 @@
158.35 };
158.36 } catch (NTLMException ne) {
158.37 throw new SaslException(
158.38 - "NTLM: Invalid version string: " + version, ne);
158.39 + "NTLM: server creation failure", ne);
158.40 }
158.41 nonce = new byte[8];
158.42 }
158.43 @@ -181,8 +182,8 @@
158.44 hostname = out[1];
158.45 return null;
158.46 }
158.47 - } catch (GeneralSecurityException ex) {
158.48 - throw new SaslException("", ex);
158.49 + } catch (NTLMException ex) {
158.50 + throw new SaslException("NTLM: generate response failure", ex);
158.51 }
158.52 }
158.53
158.54 @@ -193,29 +194,36 @@
158.55
158.56 @Override
158.57 public String getAuthorizationID() {
158.58 + if (!isComplete()) {
158.59 + throw new IllegalStateException("authentication not complete");
158.60 + }
158.61 return authzId;
158.62 }
158.63
158.64 @Override
158.65 public byte[] unwrap(byte[] incoming, int offset, int len)
158.66 throws SaslException {
158.67 - throw new UnsupportedOperationException("Not supported yet.");
158.68 + throw new IllegalStateException("Not supported yet.");
158.69 }
158.70
158.71 @Override
158.72 public byte[] wrap(byte[] outgoing, int offset, int len)
158.73 throws SaslException {
158.74 - throw new UnsupportedOperationException("Not supported yet.");
158.75 + throw new IllegalStateException("Not supported yet.");
158.76 }
158.77
158.78 @Override
158.79 public Object getNegotiatedProperty(String propName) {
158.80 - if (propName.equals(Sasl.QOP)) {
158.81 - return "auth";
158.82 - } else if (propName.equals(NTLM_HOSTNAME)) {
158.83 - return hostname;
158.84 - } else {
158.85 - return null;
158.86 + if (!isComplete()) {
158.87 + throw new IllegalStateException("authentication not complete");
158.88 + }
158.89 + switch (propName) {
158.90 + case Sasl.QOP:
158.91 + return "auth";
158.92 + case NTLM_HOSTNAME:
158.93 + return hostname;
158.94 + default:
158.95 + return null;
158.96 }
158.97 }
158.98
159.1 --- a/src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java Thu Sep 01 13:54:38 2011 -0700
159.2 +++ b/src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java Mon Sep 05 23:58:19 2011 -0700
159.3 @@ -1,5 +1,5 @@
159.4 /*
159.5 - * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
159.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
159.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
159.8 *
159.9 * This code is free software; you can redistribute it and/or modify it
159.10 @@ -29,8 +29,6 @@
159.11 import java.io.*;
159.12 import java.util.Map;
159.13 import java.util.StringTokenizer;
159.14 -import java.security.AccessController;
159.15 -import java.security.PrivilegedAction;
159.16
159.17 import java.util.logging.Logger;
159.18 import java.util.logging.Level;
159.19 @@ -63,7 +61,8 @@
159.20
159.21 protected String myClassName;
159.22
159.23 - protected AbstractSaslImpl(Map props, String className) throws SaslException {
159.24 + protected AbstractSaslImpl(Map<String, ?> props, String className)
159.25 + throws SaslException {
159.26 myClassName = className;
159.27
159.28 // Parse properties to set desired context options
159.29 @@ -156,23 +155,23 @@
159.30 if (!completed) {
159.31 throw new IllegalStateException("SASL authentication not completed");
159.32 }
159.33 -
159.34 - if (propName.equals(Sasl.QOP)) {
159.35 - if (privacy) {
159.36 - return "auth-conf";
159.37 - } else if (integrity) {
159.38 - return "auth-int";
159.39 - } else {
159.40 - return "auth";
159.41 - }
159.42 - } else if (propName.equals(Sasl.MAX_BUFFER)) {
159.43 - return Integer.toString(recvMaxBufSize);
159.44 - } else if (propName.equals(Sasl.RAW_SEND_SIZE)) {
159.45 - return Integer.toString(rawSendSize);
159.46 - } else if (propName.equals(MAX_SEND_BUF)) {
159.47 - return Integer.toString(sendMaxBufSize);
159.48 - } else {
159.49 - return null;
159.50 + switch (propName) {
159.51 + case Sasl.QOP:
159.52 + if (privacy) {
159.53 + return "auth-conf";
159.54 + } else if (integrity) {
159.55 + return "auth-int";
159.56 + } else {
159.57 + return "auth";
159.58 + }
159.59 + case Sasl.MAX_BUFFER:
159.60 + return Integer.toString(recvMaxBufSize);
159.61 + case Sasl.RAW_SEND_SIZE:
159.62 + return Integer.toString(rawSendSize);
159.63 + case MAX_SEND_BUF:
159.64 + return Integer.toString(sendMaxBufSize);
159.65 + default:
159.66 + return null;
159.67 }
159.68 }
159.69
160.1 --- a/src/share/classes/com/sun/security/sasl/util/PolicyUtils.java Thu Sep 01 13:54:38 2011 -0700
160.2 +++ b/src/share/classes/com/sun/security/sasl/util/PolicyUtils.java Mon Sep 05 23:58:19 2011 -0700
160.3 @@ -1,5 +1,5 @@
160.4 /*
160.5 - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
160.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
160.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
160.8 *
160.9 * This code is free software; you can redistribute it and/or modify it
160.10 @@ -53,7 +53,7 @@
160.11 * @param props The security policy properties to check
160.12 * @return true if passes; false if fails
160.13 */
160.14 - public static boolean checkPolicy(int flags, Map props) {
160.15 + public static boolean checkPolicy(int flags, Map<String, ?> props) {
160.16 if (props == null) {
160.17 return true;
160.18 }
160.19 @@ -93,7 +93,7 @@
160.20 *
160.21 */
160.22 public static String[] filterMechs(String[] mechs, int[] policies,
160.23 - Map props) {
160.24 + Map<String, ?> props) {
160.25 if (props == null) {
160.26 return mechs.clone();
160.27 }
161.1 --- a/src/share/classes/com/sun/servicetag/SunConnection.java Thu Sep 01 13:54:38 2011 -0700
161.2 +++ b/src/share/classes/com/sun/servicetag/SunConnection.java Mon Sep 05 23:58:19 2011 -0700
161.3 @@ -101,10 +101,7 @@
161.4 return new URL(registerURL);
161.5 } catch (MalformedURLException ex) {
161.6 // should never reach here
161.7 - InternalError x =
161.8 - new InternalError(ex.getMessage());
161.9 - x.initCause(ex);
161.10 - throw x;
161.11 + throw new InternalError(ex.getMessage(), ex);
161.12 }
161.13 }
161.14
161.15 @@ -171,9 +168,7 @@
161.16 try {
161.17 BrowserSupport.browse(url.toURI());
161.18 } catch (URISyntaxException ex) {
161.19 - InternalError x = new InternalError("Error in registering: " + ex.getMessage());
161.20 - x.initCause(ex);
161.21 - throw x;
161.22 + throw new InternalError("Error in registering: " + ex.getMessage(), ex);
161.23 } catch (IllegalArgumentException ex) {
161.24 if (Util.isVerbose()) {
161.25 ex.printStackTrace();
161.26 @@ -232,9 +227,7 @@
161.27 return (returnCode == HttpURLConnection.HTTP_OK);
161.28 } catch (MalformedURLException me) {
161.29 // should never reach here
161.30 - InternalError x = new InternalError("Error in registering: " + me.getMessage());
161.31 - x.initCause(me);
161.32 - throw x;
161.33 + throw new InternalError("Error in registering: " + me.getMessage(), me);
161.34 } catch (Exception ioe) {
161.35 // SocketTimeoutException, IOException or UnknownHostException
161.36 if (Util.isVerbose()) {
161.37 @@ -262,10 +255,9 @@
161.38 BrowserSupport.browse(registerPage.toURI());
161.39 } catch (FileNotFoundException ex) {
161.40 // should never reach here
161.41 - InternalError x =
161.42 - new InternalError("Error in launching " + registerPage + ": " + ex.getMessage());
161.43 - x.initCause(ex);
161.44 - throw x;
161.45 + throw new InternalError(
161.46 + "Error in launching " + registerPage + ": " + ex.getMessage()
161.47 + , ex);
161.48 } catch (IllegalArgumentException ex) {
161.49 if (Util.isVerbose()) {
161.50 ex.printStackTrace();
162.1 --- a/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth.properties Thu Sep 01 13:54:38 2011 -0700
162.2 +++ b/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth.properties Mon Sep 05 23:58:19 2011 -0700
162.3 @@ -19,10 +19,14 @@
162.4 ############ FILE CHOOSER STRINGS #############
162.5
162.6 FileChooser.lookInLabelText=Look In:
162.7 +FileChooser.lookInLabelMnemonic=73
162.8 FileChooser.saveInLabelText=Save In:
162.9 FileChooser.fileNameLabelText=File Name:
162.10 -FileChooser.folderNameLabelText=Folder name:
162.11 +FileChooser.fileNameLabelMnemonic=78
162.12 +FileChooser.folderNameLabelText=Folder Name:
162.13 +FileChooser.folderNameLabelMnemonic=78
162.14 FileChooser.filesOfTypeLabelText=Files of Type:
162.15 +FileChooser.filesOfTypeLabelMnemonic=84
162.16 FileChooser.upFolderToolTipText=Up One Level
162.17 FileChooser.upFolderAccessibleName=Up
162.18 FileChooser.homeFolderToolTipText=Home
163.1 --- a/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_de.properties Thu Sep 01 13:54:38 2011 -0700
163.2 +++ b/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_de.properties Mon Sep 05 23:58:19 2011 -0700
163.3 @@ -19,10 +19,14 @@
163.4 ############ FILE CHOOSER STRINGS #############
163.5
163.6 FileChooser.lookInLabelText=Suchen in:
163.7 +FileChooser.lookInLabelMnemonic=73
163.8 FileChooser.saveInLabelText=Speichern in:
163.9 FileChooser.fileNameLabelText=Dateiname:
163.10 +FileChooser.fileNameLabelMnemonic=78
163.11 FileChooser.folderNameLabelText=Ordnername:
163.12 +FileChooser.folderNameLabelMnemonic=78
163.13 FileChooser.filesOfTypeLabelText=Dateityp:
163.14 +FileChooser.filesOfTypeLabelMnemonic=84
163.15 FileChooser.upFolderToolTipText=Eine Ebene h\u00F6her
163.16 FileChooser.upFolderAccessibleName=Nach oben
163.17 FileChooser.homeFolderToolTipText=Home
164.1 --- a/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_es.properties Thu Sep 01 13:54:38 2011 -0700
164.2 +++ b/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_es.properties Mon Sep 05 23:58:19 2011 -0700
164.3 @@ -19,10 +19,14 @@
164.4 ############ FILE CHOOSER STRINGS #############
164.5
164.6 FileChooser.lookInLabelText=Buscar en:
164.7 +FileChooser.lookInLabelMnemonic=73
164.8 FileChooser.saveInLabelText=Guardar en:
164.9 FileChooser.fileNameLabelText=Nombre de Archivo:
164.10 +FileChooser.fileNameLabelMnemonic=78
164.11 FileChooser.folderNameLabelText=Nombre de la Carpeta:
164.12 +FileChooser.folderNameLabelMnemonic=78
164.13 FileChooser.filesOfTypeLabelText=Archivos de Tipo:
164.14 +FileChooser.filesOfTypeLabelMnemonic=84
164.15 FileChooser.upFolderToolTipText=Subir un Nivel
164.16 FileChooser.upFolderAccessibleName=Arriba
164.17 FileChooser.homeFolderToolTipText=Inicio
165.1 --- a/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_fr.properties Thu Sep 01 13:54:38 2011 -0700
165.2 +++ b/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_fr.properties Mon Sep 05 23:58:19 2011 -0700
165.3 @@ -19,10 +19,14 @@
165.4 ############ FILE CHOOSER STRINGS #############
165.5
165.6 FileChooser.lookInLabelText=Rechercher dans :
165.7 +FileChooser.lookInLabelMnemonic=73
165.8 FileChooser.saveInLabelText=Enregistrer dans :
165.9 FileChooser.fileNameLabelText=Nom du fichier :
165.10 +FileChooser.fileNameLabelMnemonic=78
165.11 FileChooser.folderNameLabelText=Nom du dossier :
165.12 +FileChooser.folderNameLabelMnemonic=78
165.13 FileChooser.filesOfTypeLabelText=Fichiers de type :
165.14 +FileChooser.filesOfTypeLabelMnemonic=84
165.15 FileChooser.upFolderToolTipText=Remonte d'un niveau.
165.16 FileChooser.upFolderAccessibleName=Monter
165.17 FileChooser.homeFolderToolTipText=R\u00E9pertoire d'origine
166.1 --- a/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_it.properties Thu Sep 01 13:54:38 2011 -0700
166.2 +++ b/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_it.properties Mon Sep 05 23:58:19 2011 -0700
166.3 @@ -19,10 +19,14 @@
166.4 ############ FILE CHOOSER STRINGS #############
166.5
166.6 FileChooser.lookInLabelText=Cerca in:
166.7 +FileChooser.lookInLabelMnemonic=73
166.8 FileChooser.saveInLabelText=Salva in:
166.9 FileChooser.fileNameLabelText=Nome file:
166.10 +FileChooser.fileNameLabelMnemonic=78
166.11 FileChooser.folderNameLabelText=Nome della cartella:
166.12 +FileChooser.folderNameLabelMnemonic=78
166.13 FileChooser.filesOfTypeLabelText=Tipo file:
166.14 +FileChooser.filesOfTypeLabelMnemonic=84
166.15 FileChooser.upFolderToolTipText=Cartella superiore
166.16 FileChooser.upFolderAccessibleName=Superiore
166.17 FileChooser.homeFolderToolTipText=Home
167.1 --- a/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ja.properties Thu Sep 01 13:54:38 2011 -0700
167.2 +++ b/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ja.properties Mon Sep 05 23:58:19 2011 -0700
167.3 @@ -19,10 +19,14 @@
167.4 ############ FILE CHOOSER STRINGS #############
167.5
167.6 FileChooser.lookInLabelText=\u53C2\u7167:
167.7 +FileChooser.lookInLabelMnemonic=73
167.8 FileChooser.saveInLabelText=\u4FDD\u5B58:
167.9 FileChooser.fileNameLabelText=\u30D5\u30A1\u30A4\u30EB\u540D:
167.10 +FileChooser.fileNameLabelMnemonic=78
167.11 FileChooser.folderNameLabelText=\u30D5\u30A9\u30EB\u30C0\u540D:
167.12 +FileChooser.folderNameLabelMnemonic=78
167.13 FileChooser.filesOfTypeLabelText=\u30D5\u30A1\u30A4\u30EB\u306E\u30BF\u30A4\u30D7:
167.14 +FileChooser.filesOfTypeLabelMnemonic=84
167.15 FileChooser.upFolderToolTipText=1\u30EC\u30D9\u30EB\u4E0A\u3078
167.16 FileChooser.upFolderAccessibleName=\u4E0A\u3078
167.17 FileChooser.homeFolderToolTipText=\u30DB\u30FC\u30E0
168.1 --- a/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ko.properties Thu Sep 01 13:54:38 2011 -0700
168.2 +++ b/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ko.properties Mon Sep 05 23:58:19 2011 -0700
168.3 @@ -19,10 +19,14 @@
168.4 ############ FILE CHOOSER STRINGS #############
168.5
168.6 FileChooser.lookInLabelText=\uAC80\uC0C9 \uC704\uCE58:
168.7 +FileChooser.lookInLabelMnemonic=73
168.8 FileChooser.saveInLabelText=\uC800\uC7A5 \uC704\uCE58:
168.9 FileChooser.fileNameLabelText=\uD30C\uC77C \uC774\uB984:
168.10 +FileChooser.fileNameLabelMnemonic=78
168.11 FileChooser.folderNameLabelText=\uD3F4\uB354 \uC774\uB984:
168.12 +FileChooser.folderNameLabelMnemonic=78
168.13 FileChooser.filesOfTypeLabelText=\uD30C\uC77C \uC720\uD615:
168.14 +FileChooser.filesOfTypeLabelMnemonic=84
168.15 FileChooser.upFolderToolTipText=\uD55C \uB808\uBCA8 \uC704\uB85C
168.16 FileChooser.upFolderAccessibleName=\uC704\uB85C
168.17 FileChooser.homeFolderToolTipText=\uD648
169.1 --- a/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_pt_BR.properties Thu Sep 01 13:54:38 2011 -0700
169.2 +++ b/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_pt_BR.properties Mon Sep 05 23:58:19 2011 -0700
169.3 @@ -19,10 +19,14 @@
169.4 ############ FILE CHOOSER STRINGS #############
169.5
169.6 FileChooser.lookInLabelText=Consultar Em:
169.7 +FileChooser.lookInLabelMnemonic=73
169.8 FileChooser.saveInLabelText=Salvar Em:
169.9 FileChooser.fileNameLabelText=Nome do Arquivo:
169.10 +FileChooser.fileNameLabelMnemonic=78
169.11 FileChooser.folderNameLabelText=Nome da pasta:
169.12 +FileChooser.folderNameLabelMnemonic=78
169.13 FileChooser.filesOfTypeLabelText=Arquivos do Tipo:
169.14 +FileChooser.filesOfTypeLabelMnemonic=84
169.15 FileChooser.upFolderToolTipText=Um N\u00EDvel Acima
169.16 FileChooser.upFolderAccessibleName=Acima
169.17 FileChooser.homeFolderToolTipText=In\u00EDcio
170.1 --- a/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_sv.properties Thu Sep 01 13:54:38 2011 -0700
170.2 +++ b/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_sv.properties Mon Sep 05 23:58:19 2011 -0700
170.3 @@ -19,10 +19,14 @@
170.4 ############ FILE CHOOSER STRINGS #############
170.5
170.6 FileChooser.lookInLabelText=Leta i:
170.7 +FileChooser.lookInLabelMnemonic=73
170.8 FileChooser.saveInLabelText=Spara i:
170.9 FileChooser.fileNameLabelText=Filnamn:
170.10 +FileChooser.fileNameLabelMnemonic=78
170.11 FileChooser.folderNameLabelText=Mapp:
170.12 +FileChooser.folderNameLabelMnemonic=78
170.13 FileChooser.filesOfTypeLabelText=Filformat:
170.14 +FileChooser.filesOfTypeLabelMnemonic=84
170.15 FileChooser.upFolderToolTipText=Upp en niv\u00E5
170.16 FileChooser.upFolderAccessibleName=Upp
170.17 FileChooser.homeFolderToolTipText=Hem
171.1 --- a/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_CN.properties Thu Sep 01 13:54:38 2011 -0700
171.2 +++ b/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_CN.properties Mon Sep 05 23:58:19 2011 -0700
171.3 @@ -19,10 +19,14 @@
171.4 ############ FILE CHOOSER STRINGS #############
171.5
171.6 FileChooser.lookInLabelText=\u67E5\u770B:
171.7 +FileChooser.lookInLabelMnemonic=73
171.8 FileChooser.saveInLabelText=\u4FDD\u5B58:
171.9 FileChooser.fileNameLabelText=\u6587\u4EF6\u540D:
171.10 +FileChooser.fileNameLabelMnemonic=78
171.11 FileChooser.folderNameLabelText=\u6587\u4EF6\u5939\u540D:
171.12 +FileChooser.folderNameLabelMnemonic=78
171.13 FileChooser.filesOfTypeLabelText=\u6587\u4EF6\u7C7B\u578B:
171.14 +FileChooser.filesOfTypeLabelMnemonic=84
171.15 FileChooser.upFolderToolTipText=\u5411\u4E0A\u4E00\u7EA7
171.16 FileChooser.upFolderAccessibleName=\u5411\u4E0A
171.17 FileChooser.homeFolderToolTipText=\u4E3B\u76EE\u5F55
172.1 --- a/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_TW.properties Thu Sep 01 13:54:38 2011 -0700
172.2 +++ b/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_TW.properties Mon Sep 05 23:58:19 2011 -0700
172.3 @@ -19,10 +19,14 @@
172.4 ############ FILE CHOOSER STRINGS #############
172.5
172.6 FileChooser.lookInLabelText=\u67E5\u8A62:
172.7 +FileChooser.lookInLabelMnemonic=73
172.8 FileChooser.saveInLabelText=\u5132\u5B58\u65BC:
172.9 FileChooser.fileNameLabelText=\u6A94\u6848\u540D\u7A31:
172.10 +FileChooser.fileNameLabelMnemonic=78
172.11 FileChooser.folderNameLabelText=\u8CC7\u6599\u593E\u540D\u7A31:
172.12 +FileChooser.folderNameLabelMnemonic=78
172.13 FileChooser.filesOfTypeLabelText=\u6A94\u6848\u985E\u578B:
172.14 +FileChooser.filesOfTypeLabelMnemonic=84
172.15 FileChooser.upFolderToolTipText=\u5F80\u4E0A\u4E00\u5C64
172.16 FileChooser.upFolderAccessibleName=\u5F80\u4E0A
172.17 FileChooser.homeFolderToolTipText=\u4E3B\u76EE\u9304
173.1 --- a/src/share/classes/java/io/BufferedReader.java Thu Sep 01 13:54:38 2011 -0700
173.2 +++ b/src/share/classes/java/io/BufferedReader.java Mon Sep 05 23:58:19 2011 -0700
173.3 @@ -514,9 +514,12 @@
173.4 synchronized (lock) {
173.5 if (in == null)
173.6 return;
173.7 - in.close();
173.8 - in = null;
173.9 - cb = null;
173.10 + try {
173.11 + in.close();
173.12 + } finally {
173.13 + in = null;
173.14 + cb = null;
173.15 + }
173.16 }
173.17 }
173.18 }
174.1 --- a/src/share/classes/java/io/BufferedWriter.java Thu Sep 01 13:54:38 2011 -0700
174.2 +++ b/src/share/classes/java/io/BufferedWriter.java Mon Sep 05 23:58:19 2011 -0700
174.3 @@ -255,15 +255,15 @@
174.4 }
174.5 }
174.6
174.7 + @SuppressWarnings("try")
174.8 public void close() throws IOException {
174.9 synchronized (lock) {
174.10 if (out == null) {
174.11 return;
174.12 }
174.13 - try {
174.14 + try (Writer w = out) {
174.15 flushBuffer();
174.16 } finally {
174.17 - out.close();
174.18 out = null;
174.19 cb = null;
174.20 }
175.1 --- a/src/share/classes/java/io/Closeable.java Thu Sep 01 13:54:38 2011 -0700
175.2 +++ b/src/share/classes/java/io/Closeable.java Mon Sep 05 23:58:19 2011 -0700
175.3 @@ -42,6 +42,12 @@
175.4 * with it. If the stream is already closed then invoking this
175.5 * method has no effect.
175.6 *
175.7 + * <p> As noted in {@link AutoCloseable#close()}, cases where the
175.8 + * close may fail require careful attention. It is strongly advised
175.9 + * to relinquish the underlying resources and to internally
175.10 + * <em>mark</em> the {@code Closeable} as closed, prior to throwing
175.11 + * the {@code IOException}.
175.12 + *
175.13 * @throws IOException if an I/O error occurs
175.14 */
175.15 public void close() throws IOException;
176.1 --- a/src/share/classes/java/io/FilterOutputStream.java Thu Sep 01 13:54:38 2011 -0700
176.2 +++ b/src/share/classes/java/io/FilterOutputStream.java Mon Sep 05 23:58:19 2011 -0700
176.3 @@ -152,11 +152,10 @@
176.4 * @see java.io.FilterOutputStream#flush()
176.5 * @see java.io.FilterOutputStream#out
176.6 */
176.7 + @SuppressWarnings("try")
176.8 public void close() throws IOException {
176.9 - try {
176.10 - flush();
176.11 - } catch (IOException ignored) {
176.12 + try (OutputStream ostream = out) {
176.13 + flush();
176.14 }
176.15 - out.close();
176.16 }
176.17 }
177.1 --- a/src/share/classes/java/lang/AutoCloseable.java Thu Sep 01 13:54:38 2011 -0700
177.2 +++ b/src/share/classes/java/lang/AutoCloseable.java Mon Sep 05 23:58:19 2011 -0700
177.3 @@ -43,6 +43,15 @@
177.4 * throw more specific exceptions, or to throw no exception at all
177.5 * if the close operation cannot fail.
177.6 *
177.7 + * <p> Cases where the close operation may fail require careful
177.8 + * attention by implementers. It is strongly advised to relinquish
177.9 + * the underlying resources and to internally <em>mark</em> the
177.10 + * resource as closed, prior to throwing the exception. The {@code
177.11 + * close} method is unlikely to be invoked more than once and so
177.12 + * this ensures that the resources are released in a timely manner.
177.13 + * Furthermore it reduces problems that could arise when the resource
177.14 + * wraps, or is wrapped, by another resource.
177.15 + *
177.16 * <p><em>Implementers of this interface are also strongly advised
177.17 * to not have the {@code close} method throw {@link
177.18 * InterruptedException}.</em>
178.1 --- a/src/share/classes/java/lang/Integer.java Thu Sep 01 13:54:38 2011 -0700
178.2 +++ b/src/share/classes/java/lang/Integer.java Mon Sep 05 23:58:19 2011 -0700
178.3 @@ -776,17 +776,17 @@
178.4 * Determines the integer value of the system property with the
178.5 * specified name.
178.6 *
178.7 - * <p>The first argument is treated as the name of a system property.
178.8 - * System properties are accessible through the
178.9 - * {@link java.lang.System#getProperty(java.lang.String)} method. The
178.10 + * <p>The first argument is treated as the name of a system
178.11 + * property. System properties are accessible through the {@link
178.12 + * java.lang.System#getProperty(java.lang.String)} method. The
178.13 * string value of this property is then interpreted as an integer
178.14 - * value and an {@code Integer} object representing this value is
178.15 - * returned. Details of possible numeric formats can be found with
178.16 - * the definition of {@code getProperty}.
178.17 + * value using the grammar supported by {@link Integer#decode decode} and
178.18 + * an {@code Integer} object representing this value is returned.
178.19 *
178.20 - * <p>If there is no property with the specified name, if the specified name
178.21 - * is empty or {@code null}, or if the property does not have
178.22 - * the correct numeric format, then {@code null} is returned.
178.23 + * <p>If there is no property with the specified name, if the
178.24 + * specified name is empty or {@code null}, or if the property
178.25 + * does not have the correct numeric format, then {@code null} is
178.26 + * returned.
178.27 *
178.28 * <p>In other words, this method returns an {@code Integer}
178.29 * object equal to the value of:
178.30 @@ -808,13 +808,12 @@
178.31 * Determines the integer value of the system property with the
178.32 * specified name.
178.33 *
178.34 - * <p>The first argument is treated as the name of a system property.
178.35 - * System properties are accessible through the {@link
178.36 + * <p>The first argument is treated as the name of a system
178.37 + * property. System properties are accessible through the {@link
178.38 * java.lang.System#getProperty(java.lang.String)} method. The
178.39 * string value of this property is then interpreted as an integer
178.40 - * value and an {@code Integer} object representing this value is
178.41 - * returned. Details of possible numeric formats can be found with
178.42 - * the definition of {@code getProperty}.
178.43 + * value using the grammar supported by {@link Integer#decode decode} and
178.44 + * an {@code Integer} object representing this value is returned.
178.45 *
178.46 * <p>The second argument is the default value. An {@code Integer} object
178.47 * that represents the value of the second argument is returned if there
178.48 @@ -856,9 +855,9 @@
178.49 * system property. System properties are accessible through the
178.50 * {@link java.lang.System#getProperty(java.lang.String)} method.
178.51 * The string value of this property is then interpreted as an
178.52 - * integer value, as per the {@code Integer.decode} method,
178.53 + * integer value, as per the {@link Integer#decode decode} method,
178.54 * and an {@code Integer} object representing this value is
178.55 - * returned.
178.56 + * returned; in summary:
178.57 *
178.58 * <ul><li>If the property value begins with the two ASCII characters
178.59 * {@code 0x} or the ASCII character {@code #}, not
178.60 @@ -882,16 +881,14 @@
178.61 * @param nm property name.
178.62 * @param val default value.
178.63 * @return the {@code Integer} value of the property.
178.64 - * @see java.lang.System#getProperty(java.lang.String)
178.65 - * @see java.lang.System#getProperty(java.lang.String, java.lang.String)
178.66 - * @see java.lang.Integer#decode
178.67 + * @see System#getProperty(java.lang.String)
178.68 + * @see System#getProperty(java.lang.String, java.lang.String)
178.69 */
178.70 public static Integer getInteger(String nm, Integer val) {
178.71 String v = null;
178.72 try {
178.73 v = System.getProperty(nm);
178.74 - } catch (IllegalArgumentException e) {
178.75 - } catch (NullPointerException e) {
178.76 + } catch (IllegalArgumentException | NullPointerException e) {
178.77 }
178.78 if (v != null) {
178.79 try {
179.1 --- a/src/share/classes/java/lang/InternalError.java Thu Sep 01 13:54:38 2011 -0700
179.2 +++ b/src/share/classes/java/lang/InternalError.java Mon Sep 05 23:58:19 2011 -0700
179.3 @@ -1,5 +1,5 @@
179.4 /*
179.5 - * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
179.6 + * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
179.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
179.8 *
179.9 * This code is free software; you can redistribute it and/or modify it
179.10 @@ -32,8 +32,7 @@
179.11 * @author unascribed
179.12 * @since JDK1.0
179.13 */
179.14 -public
179.15 -class InternalError extends VirtualMachineError {
179.16 +public class InternalError extends VirtualMachineError {
179.17 private static final long serialVersionUID = -9062593416125562365L;
179.18
179.19 /**
179.20 @@ -47,9 +46,45 @@
179.21 * Constructs an <code>InternalError</code> with the specified
179.22 * detail message.
179.23 *
179.24 - * @param s the detail message.
179.25 + * @param message the detail message.
179.26 */
179.27 - public InternalError(String s) {
179.28 - super(s);
179.29 + public InternalError(String message) {
179.30 + super(message);
179.31 }
179.32 +
179.33 +
179.34 + /**
179.35 + * Constructs an {@code InternalError} with the specified detail
179.36 + * message and cause. <p>Note that the detail message associated
179.37 + * with {@code cause} is <i>not</i> automatically incorporated in
179.38 + * this error's detail message.
179.39 + *
179.40 + * @param message the detail message (which is saved for later retrieval
179.41 + * by the {@link #getMessage()} method).
179.42 + * @param cause the cause (which is saved for later retrieval by the
179.43 + * {@link #getCause()} method). (A {@code null} value is
179.44 + * permitted, and indicates that the cause is nonexistent or
179.45 + * unknown.)
179.46 + * @since 1.8
179.47 + */
179.48 + public InternalError(String message, Throwable cause) {
179.49 + super(message, cause);
179.50 + }
179.51 +
179.52 + /**
179.53 + * Constructs an {@code InternalError} with the specified cause
179.54 + * and a detail message of {@code (cause==null ? null :
179.55 + * cause.toString())} (which typically contains the class and
179.56 + * detail message of {@code cause}).
179.57 + *
179.58 + * @param cause the cause (which is saved for later retrieval by the
179.59 + * {@link #getCause()} method). (A {@code null} value is
179.60 + * permitted, and indicates that the cause is nonexistent or
179.61 + * unknown.)
179.62 + * @since 1.8
179.63 + */
179.64 + public InternalError(Throwable cause) {
179.65 + super(cause);
179.66 + }
179.67 +
179.68 }
180.1 --- a/src/share/classes/java/lang/Long.java Thu Sep 01 13:54:38 2011 -0700
180.2 +++ b/src/share/classes/java/lang/Long.java Mon Sep 05 23:58:19 2011 -0700
180.3 @@ -806,22 +806,20 @@
180.4 * Determines the {@code long} value of the system property
180.5 * with the specified name.
180.6 *
180.7 - * <p>The first argument is treated as the name of a system property.
180.8 - * System properties are accessible through the {@link
180.9 + * <p>The first argument is treated as the name of a system
180.10 + * property. System properties are accessible through the {@link
180.11 * java.lang.System#getProperty(java.lang.String)} method. The
180.12 - * string value of this property is then interpreted as a
180.13 - * {@code long} value and a {@code Long} object
180.14 - * representing this value is returned. Details of possible
180.15 - * numeric formats can be found with the definition of
180.16 - * {@code getProperty}.
180.17 + * string value of this property is then interpreted as a {@code
180.18 + * long} value using the grammar supported by {@link Long#decode decode}
180.19 + * and a {@code Long} object representing this value is returned.
180.20 *
180.21 * <p>If there is no property with the specified name, if the
180.22 - * specified name is empty or {@code null}, or if the
180.23 - * property does not have the correct numeric format, then
180.24 - * {@code null} is returned.
180.25 + * specified name is empty or {@code null}, or if the property
180.26 + * does not have the correct numeric format, then {@code null} is
180.27 + * returned.
180.28 *
180.29 - * <p>In other words, this method returns a {@code Long} object equal to
180.30 - * the value of:
180.31 + * <p>In other words, this method returns a {@code Long} object
180.32 + * equal to the value of:
180.33 *
180.34 * <blockquote>
180.35 * {@code getLong(nm, null)}
180.36 @@ -840,14 +838,12 @@
180.37 * Determines the {@code long} value of the system property
180.38 * with the specified name.
180.39 *
180.40 - * <p>The first argument is treated as the name of a system property.
180.41 - * System properties are accessible through the {@link
180.42 + * <p>The first argument is treated as the name of a system
180.43 + * property. System properties are accessible through the {@link
180.44 * java.lang.System#getProperty(java.lang.String)} method. The
180.45 - * string value of this property is then interpreted as a
180.46 - * {@code long} value and a {@code Long} object
180.47 - * representing this value is returned. Details of possible
180.48 - * numeric formats can be found with the definition of
180.49 - * {@code getProperty}.
180.50 + * string value of this property is then interpreted as a {@code
180.51 + * long} value using the grammar supported by {@link Long#decode decode}
180.52 + * and a {@code Long} object representing this value is returned.
180.53 *
180.54 * <p>The second argument is the default value. A {@code Long} object
180.55 * that represents the value of the second argument is returned if there
180.56 @@ -889,8 +885,8 @@
180.57 * the {@link java.lang.System#getProperty(java.lang.String)}
180.58 * method. The string value of this property is then interpreted
180.59 * as a {@code long} value, as per the
180.60 - * {@code Long.decode} method, and a {@code Long} object
180.61 - * representing this value is returned.
180.62 + * {@link Long#decode decode} method, and a {@code Long} object
180.63 + * representing this value is returned; in summary:
180.64 *
180.65 * <ul>
180.66 * <li>If the property value begins with the two ASCII characters
180.67 @@ -921,16 +917,14 @@
180.68 * @param nm property name.
180.69 * @param val default value.
180.70 * @return the {@code Long} value of the property.
180.71 - * @see java.lang.System#getProperty(java.lang.String)
180.72 - * @see java.lang.System#getProperty(java.lang.String, java.lang.String)
180.73 - * @see java.lang.Long#decode
180.74 + * @see System#getProperty(java.lang.String)
180.75 + * @see System#getProperty(java.lang.String, java.lang.String)
180.76 */
180.77 public static Long getLong(String nm, Long val) {
180.78 String v = null;
180.79 try {
180.80 v = System.getProperty(nm);
180.81 - } catch (IllegalArgumentException e) {
180.82 - } catch (NullPointerException e) {
180.83 + } catch (IllegalArgumentException | NullPointerException e) {
180.84 }
180.85 if (v != null) {
180.86 try {
181.1 --- a/src/share/classes/java/lang/System.java Thu Sep 01 13:54:38 2011 -0700
181.2 +++ b/src/share/classes/java/lang/System.java Mon Sep 05 23:58:19 2011 -0700
181.3 @@ -632,6 +632,7 @@
181.4 *
181.5 * <p>On UNIX systems, it returns {@code "\n"}; on Microsoft
181.6 * Windows systems it returns {@code "\r\n"}.
181.7 + * @since 1.7
181.8 */
181.9 public static String lineSeparator() {
181.10 return lineSeparator;
182.1 --- a/src/share/classes/java/lang/VirtualMachineError.java Thu Sep 01 13:54:38 2011 -0700
182.2 +++ b/src/share/classes/java/lang/VirtualMachineError.java Mon Sep 05 23:58:19 2011 -0700
182.3 @@ -1,9 +1,9 @@
182.4 /*
182.5 - * Copyright (c) 1995, 1997, Oracle and/or its affiliates. All rights reserved.
182.6 + * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
182.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
182.8 *
182.9 * This code is free software; you can redistribute it and/or modify it
182.10 - * under the terms of the GNU General Public License version 2 only, as
182.11 + * under the terms of the GNU General Public License version 2 only, asP
182.12 * published by the Free Software Foundation. Oracle designates this
182.13 * particular file as subject to the "Classpath" exception as provided
182.14 * by Oracle in the LICENSE file that accompanied this code.
182.15 @@ -33,8 +33,9 @@
182.16 * @author Frank Yellin
182.17 * @since JDK1.0
182.18 */
182.19 -abstract public
182.20 -class VirtualMachineError extends Error {
182.21 +abstract public class VirtualMachineError extends Error {
182.22 + private static final long serialVersionUID = 4161983926571568670L;
182.23 +
182.24 /**
182.25 * Constructs a <code>VirtualMachineError</code> with no detail message.
182.26 */
182.27 @@ -46,9 +47,43 @@
182.28 * Constructs a <code>VirtualMachineError</code> with the specified
182.29 * detail message.
182.30 *
182.31 - * @param s the detail message.
182.32 + * @param message the detail message.
182.33 */
182.34 - public VirtualMachineError(String s) {
182.35 - super(s);
182.36 + public VirtualMachineError(String message) {
182.37 + super(message);
182.38 + }
182.39 +
182.40 + /**
182.41 + * Constructs a {@code VirtualMachineError} with the specified
182.42 + * detail message and cause. <p>Note that the detail message
182.43 + * associated with {@code cause} is <i>not</i> automatically
182.44 + * incorporated in this error's detail message.
182.45 + *
182.46 + * @param message the detail message (which is saved for later retrieval
182.47 + * by the {@link #getMessage()} method).
182.48 + * @param cause the cause (which is saved for later retrieval by the
182.49 + * {@link #getCause()} method). (A {@code null} value is
182.50 + * permitted, and indicates that the cause is nonexistent or
182.51 + * unknown.)
182.52 + * @since 1.8
182.53 + */
182.54 + public VirtualMachineError(String message, Throwable cause) {
182.55 + super(message, cause);
182.56 + }
182.57 +
182.58 + /**
182.59 + * Constructs an a {@code VirtualMachineError} with the specified
182.60 + * cause and a detail message of {@code (cause==null ? null :
182.61 + * cause.toString())} (which typically contains the class and
182.62 + * detail message of {@code cause}).
182.63 + *
182.64 + * @param cause the cause (which is saved for later retrieval by the
182.65 + * {@link #getCause()} method). (A {@code null} value is
182.66 + * permitted, and indicates that the cause is nonexistent or
182.67 + * unknown.)
182.68 + * @since 1.8
182.69 + */
182.70 + public VirtualMachineError(Throwable cause) {
182.71 + super(cause);
182.72 }
182.73 }
183.1 --- a/src/share/classes/java/lang/reflect/Array.java Thu Sep 01 13:54:38 2011 -0700
183.2 +++ b/src/share/classes/java/lang/reflect/Array.java Mon Sep 05 23:58:19 2011 -0700
183.3 @@ -474,10 +474,10 @@
183.4 * Private
183.5 */
183.6
183.7 - private static native Object newArray(Class componentType, int length)
183.8 + private static native Object newArray(Class<?> componentType, int length)
183.9 throws NegativeArraySizeException;
183.10
183.11 - private static native Object multiNewArray(Class componentType,
183.12 + private static native Object multiNewArray(Class<?> componentType,
183.13 int[] dimensions)
183.14 throws IllegalArgumentException, NegativeArraySizeException;
183.15
184.1 --- a/src/share/classes/java/lang/reflect/Constructor.java Thu Sep 01 13:54:38 2011 -0700
184.2 +++ b/src/share/classes/java/lang/reflect/Constructor.java Mon Sep 05 23:58:19 2011 -0700
184.3 @@ -27,14 +27,12 @@
184.4
184.5 import sun.reflect.ConstructorAccessor;
184.6 import sun.reflect.Reflection;
184.7 -import sun.reflect.annotation.AnnotationParser;
184.8 import sun.reflect.generics.repository.ConstructorRepository;
184.9 import sun.reflect.generics.factory.CoreReflectionFactory;
184.10 import sun.reflect.generics.factory.GenericsFactory;
184.11 import sun.reflect.generics.scope.ConstructorScope;
184.12 import java.lang.annotation.Annotation;
184.13 import java.lang.annotation.AnnotationFormatError;
184.14 -import java.lang.reflect.Modifier;
184.15
184.16 /**
184.17 * {@code Constructor} provides information about, and access to, a single
184.18 @@ -184,6 +182,7 @@
184.19 * @since 1.5
184.20 */
184.21 @Override
184.22 + @SuppressWarnings({ "rawtypes", "unchecked" })
184.23 public TypeVariable<Constructor<T>>[] getTypeParameters() {
184.24 if (getSignature() != null) {
184.25 return (TypeVariable<Constructor<T>>[])getGenericInfo().getTypeParameters();
184.26 @@ -197,7 +196,7 @@
184.27 */
184.28 @Override
184.29 public Class<?>[] getParameterTypes() {
184.30 - return (Class<?>[]) parameterTypes.clone();
184.31 + return parameterTypes.clone();
184.32 }
184.33
184.34 /**
184.35 @@ -217,7 +216,7 @@
184.36 */
184.37 @Override
184.38 public Class<?>[] getExceptionTypes() {
184.39 - return (Class<?>[])exceptionTypes.clone();
184.40 + return exceptionTypes.clone();
184.41 }
184.42
184.43
184.44 @@ -392,7 +391,9 @@
184.45 if (ca == null) {
184.46 ca = acquireConstructorAccessor();
184.47 }
184.48 - return (T) ca.newInstance(initargs);
184.49 + @SuppressWarnings("unchecked")
184.50 + T inst = (T) ca.newInstance(initargs);
184.51 + return inst;
184.52 }
184.53
184.54 /**
185.1 --- a/src/share/classes/java/lang/reflect/Executable.java Thu Sep 01 13:54:38 2011 -0700
185.2 +++ b/src/share/classes/java/lang/reflect/Executable.java Mon Sep 05 23:58:19 2011 -0700
185.3 @@ -29,9 +29,6 @@
185.4 import java.util.Map;
185.5 import sun.reflect.annotation.AnnotationParser;
185.6 import sun.reflect.generics.repository.ConstructorRepository;
185.7 -import sun.reflect.generics.factory.CoreReflectionFactory;
185.8 -import sun.reflect.generics.factory.GenericsFactory;
185.9 -import sun.reflect.generics.scope.ConstructorScope;
185.10
185.11 /**
185.12 * A shared superclass for the common functionality of {@link Method}
185.13 @@ -366,8 +363,8 @@
185.14 * {@inheritDoc}
185.15 * @throws NullPointerException {@inheritDoc}
185.16 */
185.17 - @SuppressWarnings("unchecked")
185.18 - public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
185.19 + @SuppressWarnings("unchecked")
185.20 + public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
185.21 if (annotationClass == null)
185.22 throw new NullPointerException();
185.23
186.1 --- a/src/share/classes/java/lang/reflect/Field.java Thu Sep 01 13:54:38 2011 -0700
186.2 +++ b/src/share/classes/java/lang/reflect/Field.java Mon Sep 05 23:58:19 2011 -0700
186.3 @@ -1012,6 +1012,7 @@
186.4 * @throws NullPointerException {@inheritDoc}
186.5 * @since 1.5
186.6 */
186.7 + @SuppressWarnings("unchecked")
186.8 public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
186.9 if (annotationClass == null)
186.10 throw new NullPointerException();
187.1 --- a/src/share/classes/java/lang/reflect/Method.java Thu Sep 01 13:54:38 2011 -0700
187.2 +++ b/src/share/classes/java/lang/reflect/Method.java Mon Sep 05 23:58:19 2011 -0700
187.3 @@ -194,6 +194,7 @@
187.4 * @since 1.5
187.5 */
187.6 @Override
187.7 + @SuppressWarnings({ "rawtypes", "unchecked" })
187.8 public TypeVariable<Method>[] getTypeParameters() {
187.9 if (getGenericSignature() != null)
187.10 return (TypeVariable<Method>[])getGenericInfo().getTypeParameters();
187.11 @@ -246,7 +247,7 @@
187.12 */
187.13 @Override
187.14 public Class<?>[] getParameterTypes() {
187.15 - return (Class<?>[]) parameterTypes.clone();
187.16 + return parameterTypes.clone();
187.17 }
187.18
187.19 /**
187.20 @@ -266,7 +267,7 @@
187.21 */
187.22 @Override
187.23 public Class<?>[] getExceptionTypes() {
187.24 - return (Class<?>[]) exceptionTypes.clone();
187.25 + return exceptionTypes.clone();
187.26 }
187.27
187.28 /**
188.1 --- a/src/share/classes/java/lang/reflect/Proxy.java Thu Sep 01 13:54:38 2011 -0700
188.2 +++ b/src/share/classes/java/lang/reflect/Proxy.java Mon Sep 05 23:58:19 2011 -0700
188.3 @@ -604,15 +604,12 @@
188.4 * Invoke its constructor with the designated invocation handler.
188.5 */
188.6 try {
188.7 - Constructor cons = cl.getConstructor(constructorParams);
188.8 + Constructor<?> cons = cl.getConstructor(constructorParams);
188.9 return cons.newInstance(new Object[] { h });
188.10 - } catch (NoSuchMethodException e) {
188.11 - throw new InternalError(e.toString());
188.12 - } catch (IllegalAccessException e) {
188.13 - throw new InternalError(e.toString());
188.14 - } catch (InstantiationException e) {
188.15 - throw new InternalError(e.toString());
188.16 - } catch (InvocationTargetException e) {
188.17 + } catch (NoSuchMethodException |
188.18 + IllegalAccessException |
188.19 + InstantiationException |
188.20 + InvocationTargetException e) {
188.21 throw new InternalError(e.toString());
188.22 }
188.23 }
188.24 @@ -661,6 +658,6 @@
188.25 return p.h;
188.26 }
188.27
188.28 - private static native Class defineClass0(ClassLoader loader, String name,
188.29 - byte[] b, int off, int len);
188.30 + private static native Class<?> defineClass0(ClassLoader loader, String name,
188.31 + byte[] b, int off, int len);
188.32 }
189.1 --- a/src/share/classes/java/net/HttpCookie.java Thu Sep 01 13:54:38 2011 -0700
189.2 +++ b/src/share/classes/java/net/HttpCookie.java Mon Sep 05 23:58:19 2011 -0700
189.3 @@ -748,10 +748,14 @@
189.4 && (embeddedDotInDomain == -1 || embeddedDotInDomain == domain.length() - 1))
189.5 return false;
189.6
189.7 - // if the host name contains no dot and the domain name is .local
189.8 + // if the host name contains no dot and the domain name
189.9 + // is .local or host.local
189.10 int firstDotInHost = host.indexOf('.');
189.11 - if (firstDotInHost == -1 && isLocalDomain)
189.12 + if (firstDotInHost == -1 &&
189.13 + (isLocalDomain ||
189.14 + domain.equalsIgnoreCase(host + ".local"))) {
189.15 return true;
189.16 + }
189.17
189.18 int domainLength = domain.length();
189.19 int lengthDiff = host.length() - domainLength;
190.1 --- a/src/share/classes/java/nio/Bits.java Thu Sep 01 13:54:38 2011 -0700
190.2 +++ b/src/share/classes/java/nio/Bits.java Mon Sep 05 23:58:19 2011 -0700
190.3 @@ -1,5 +1,5 @@
190.4 /*
190.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
190.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
190.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
190.8 *
190.9 * This code is free software; you can redistribute it and/or modify it
190.10 @@ -699,6 +699,14 @@
190.11 }
190.12 };
190.13 }
190.14 + @Override
190.15 + public ByteBuffer newDirectByteBuffer(long addr, int cap, Object ob) {
190.16 + return new DirectByteBuffer(addr, cap, ob);
190.17 + }
190.18 + @Override
190.19 + public void truncate(Buffer buf) {
190.20 + buf.truncate();
190.21 + }
190.22 });
190.23 }
190.24
191.1 --- a/src/share/classes/java/nio/Buffer.java Thu Sep 01 13:54:38 2011 -0700
191.2 +++ b/src/share/classes/java/nio/Buffer.java Mon Sep 05 23:58:19 2011 -0700
191.3 @@ -1,5 +1,5 @@
191.4 /*
191.5 - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
191.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
191.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
191.8 *
191.9 * This code is free software; you can redistribute it and/or modify it
191.10 @@ -543,6 +543,13 @@
191.11 return mark;
191.12 }
191.13
191.14 + final void truncate() { // package-private
191.15 + mark = -1;
191.16 + position = 0;
191.17 + limit = 0;
191.18 + capacity = 0;
191.19 + }
191.20 +
191.21 final void discardMark() { // package-private
191.22 mark = -1;
191.23 }
192.1 --- a/src/share/classes/java/nio/Direct-X-Buffer.java.template Thu Sep 01 13:54:38 2011 -0700
192.2 +++ b/src/share/classes/java/nio/Direct-X-Buffer.java.template Mon Sep 05 23:58:19 2011 -0700
192.3 @@ -1,5 +1,5 @@
192.4 /*
192.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
192.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
192.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
192.8 *
192.9 * This code is free software; you can redistribute it and/or modify it
192.10 @@ -58,12 +58,13 @@
192.11 // NOTE: moved up to Buffer.java for speed in JNI GetDirectBufferAddress
192.12 // protected long address;
192.13
192.14 - // If this buffer is a view of another buffer then we keep a reference to
192.15 - // that buffer so that its memory isn't freed before we're done with it
192.16 - protected Object viewedBuffer = null;
192.17 + // An object attached to this buffer. If this buffer is a view of another
192.18 + // buffer then we use this field to keep a reference to that buffer to
192.19 + // ensure that its memory isn't freed before we are done with it.
192.20 + private final Object att;
192.21
192.22 - public Object viewedBuffer() {
192.23 - return viewedBuffer;
192.24 + public Object attachment() {
192.25 + return att;
192.26 }
192.27
192.28 #if[byte]
192.29 @@ -136,6 +137,7 @@
192.30 address = base;
192.31 }
192.32 cleaner = Cleaner.create(this, new Deallocator(base, size, cap));
192.33 + att = null;
192.34 #else[rw]
192.35 super(cap);
192.36 #end[rw]
192.37 @@ -143,12 +145,24 @@
192.38
192.39 #if[rw]
192.40
192.41 + // Invoked to construct a direct ByteBuffer referring to the block of
192.42 + // memory. A given arbitrary object may also be attached to the buffer.
192.43 + //
192.44 + Direct$Type$Buffer(long addr, int cap, Object ob) {
192.45 + super(-1, 0, cap, cap);
192.46 + address = addr;
192.47 + cleaner = null;
192.48 + att = ob;
192.49 + }
192.50 +
192.51 +
192.52 // Invoked only by JNI: NewDirectByteBuffer(void*, long)
192.53 //
192.54 private Direct$Type$Buffer(long addr, int cap) {
192.55 super(-1, 0, cap, cap);
192.56 address = addr;
192.57 cleaner = null;
192.58 + att = null;
192.59 }
192.60
192.61 #end[rw]
192.62 @@ -162,8 +176,8 @@
192.63 #if[rw]
192.64 super(-1, 0, cap, cap, fd);
192.65 address = addr;
192.66 - viewedBuffer = null;
192.67 cleaner = Cleaner.create(this, unmapper);
192.68 + att = null;
192.69 #else[rw]
192.70 super(cap, addr, fd, unmapper);
192.71 #end[rw]
192.72 @@ -180,10 +194,10 @@
192.73 #if[rw]
192.74 super(mark, pos, lim, cap);
192.75 address = db.address() + off;
192.76 - viewedBuffer = db;
192.77 #if[byte]
192.78 cleaner = null;
192.79 #end[byte]
192.80 + att = db;
192.81 #else[rw]
192.82 super(db, mark, pos, lim, cap, off);
192.83 #end[rw]
193.1 --- a/src/share/classes/java/security/AccessControlContext.java Thu Sep 01 13:54:38 2011 -0700
193.2 +++ b/src/share/classes/java/security/AccessControlContext.java Mon Sep 05 23:58:19 2011 -0700
193.3 @@ -29,8 +29,6 @@
193.4 import java.util.List;
193.5 import sun.security.util.Debug;
193.6 import sun.security.util.SecurityConstants;
193.7 -import sun.misc.JavaSecurityAccess;
193.8 -import sun.misc.SharedSecrets;
193.9
193.10
193.11 /**
193.12 @@ -312,7 +310,7 @@
193.13 Debug.isOn("permission=" + perm.getClass().getCanonicalName());
193.14
193.15 if (dumpDebug && Debug.isOn("stack")) {
193.16 - Thread.currentThread().dumpStack();
193.17 + Thread.dumpStack();
193.18 }
193.19
193.20 if (dumpDebug && Debug.isOn("domain")) {
193.21 @@ -353,7 +351,7 @@
193.22 if (!dumpDebug) {
193.23 debug.println("access denied " + perm);
193.24 }
193.25 - Thread.currentThread().dumpStack();
193.26 + Thread.dumpStack();
193.27 final ProtectionDomain pd = context[i];
193.28 final Debug db = debug;
193.29 AccessController.doPrivileged (new PrivilegedAction<Void>() {
193.30 @@ -561,7 +559,7 @@
193.31 match = (that.context[j] == null);
193.32 }
193.33 } else {
193.34 - Class thisPdClass = thisPd.getClass();
193.35 + Class<?> thisPdClass = thisPd.getClass();
193.36 ProtectionDomain thatPd;
193.37 for (int j = 0; (j < that.context.length) && !match; j++) {
193.38 thatPd = that.context[j];
194.1 --- a/src/share/classes/java/security/AccessController.java Thu Sep 01 13:54:38 2011 -0700
194.2 +++ b/src/share/classes/java/security/AccessController.java Mon Sep 05 23:58:19 2011 -0700
194.3 @@ -1,5 +1,5 @@
194.4 /*
194.5 - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
194.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
194.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
194.8 *
194.9 * This code is free software; you can redistribute it and/or modify it
194.10 @@ -406,7 +406,7 @@
194.11 * callerClass[2] = AccessController.doPrivileged
194.12 * callerClass[3] = caller
194.13 */
194.14 - final Class callerClass = sun.reflect.Reflection.getCallerClass(3);
194.15 + final Class<?> callerClass = sun.reflect.Reflection.getCallerClass(3);
194.16 ProtectionDomain callerPd = doPrivileged
194.17 (new PrivilegedAction<ProtectionDomain>() {
194.18 public ProtectionDomain run() {
194.19 @@ -538,7 +538,7 @@
194.20 }
194.21
194.22 if (dumpDebug && Debug.isOn("stack")) {
194.23 - Thread.currentThread().dumpStack();
194.24 + Thread.dumpStack();
194.25 }
194.26
194.27 if (dumpDebug && Debug.isOn("domain")) {
195.1 --- a/src/share/classes/java/security/BasicPermission.java Thu Sep 01 13:54:38 2011 -0700
195.2 +++ b/src/share/classes/java/security/BasicPermission.java Mon Sep 05 23:58:19 2011 -0700
195.3 @@ -25,7 +25,6 @@
195.4
195.5 package java.security;
195.6
195.7 -import java.security.*;
195.8 import java.util.Enumeration;
195.9 import java.util.Map;
195.10 import java.util.HashMap;
195.11 @@ -333,14 +332,14 @@
195.12 *
195.13 * @see #serialPersistentFields
195.14 */
195.15 - private Class permClass;
195.16 + private Class<?> permClass;
195.17
195.18 /**
195.19 * Create an empty BasicPermissionCollection object.
195.20 *
195.21 */
195.22
195.23 - public BasicPermissionCollection(Class clazz) {
195.24 + public BasicPermissionCollection(Class<?> clazz) {
195.25 perms = new HashMap<String, Permission>(11);
195.26 all_allowed = false;
195.27 permClass = clazz;
195.28 @@ -542,6 +541,9 @@
195.29 ObjectInputStream.GetField gfields = in.readFields();
195.30
195.31 // Get permissions
195.32 + // writeObject writes a Hashtable<String, Permission> for the
195.33 + // permissions key, so this cast is safe, unless the data is corrupt.
195.34 + @SuppressWarnings("unchecked")
195.35 Hashtable<String, Permission> permissions =
195.36 (Hashtable<String, Permission>)gfields.get("permissions", null);
195.37 perms = new HashMap<String, Permission>(permissions.size()*2);
195.38 @@ -551,7 +553,7 @@
195.39 all_allowed = gfields.get("all_allowed", false);
195.40
195.41 // Get permClass
195.42 - permClass = (Class) gfields.get("permClass", null);
195.43 + permClass = (Class<?>) gfields.get("permClass", null);
195.44
195.45 if (permClass == null) {
195.46 // set permClass
196.1 --- a/src/share/classes/java/security/KeyRep.java Thu Sep 01 13:54:38 2011 -0700
196.2 +++ b/src/share/classes/java/security/KeyRep.java Mon Sep 05 23:58:19 2011 -0700
196.3 @@ -26,6 +26,7 @@
196.4 package java.security;
196.5
196.6 import java.io.*;
196.7 +import java.util.Locale;
196.8
196.9 import java.security.spec.PKCS8EncodedKeySpec;
196.10 import java.security.spec.X509EncodedKeySpec;
196.11 @@ -137,7 +138,7 @@
196.12
196.13 this.type = type;
196.14 this.algorithm = algorithm;
196.15 - this.format = format.toUpperCase();
196.16 + this.format = format.toUpperCase(Locale.ENGLISH);
196.17 this.encoded = encoded.clone();
196.18 }
196.19
197.1 --- a/src/share/classes/java/security/Permissions.java Thu Sep 01 13:54:38 2011 -0700
197.2 +++ b/src/share/classes/java/security/Permissions.java Mon Sep 05 23:58:19 2011 -0700
197.3 @@ -31,7 +31,6 @@
197.4 import java.util.Map;
197.5 import java.util.HashMap;
197.6 import java.util.List;
197.7 -import java.util.ArrayList;
197.8 import java.util.Iterator;
197.9 import java.util.Collections;
197.10 import java.io.Serializable;
197.11 @@ -238,7 +237,7 @@
197.12 */
197.13 private PermissionCollection getPermissionCollection(Permission p,
197.14 boolean createEmpty) {
197.15 - Class c = p.getClass();
197.16 + Class<?> c = p.getClass();
197.17
197.18 PermissionCollection pc = permsMap.get(c);
197.19
197.20 @@ -390,6 +389,9 @@
197.21 allPermission = (PermissionCollection) gfields.get("allPermission", null);
197.22
197.23 // Get permissions
197.24 + // writeObject writes a Hashtable<Class<?>, PermissionCollection> for
197.25 + // the perms key, so this cast is safe, unless the data is corrupt.
197.26 + @SuppressWarnings("unchecked")
197.27 Hashtable<Class<?>, PermissionCollection> perms =
197.28 (Hashtable<Class<?>, PermissionCollection>)gfields.get("perms", null);
197.29 permsMap = new HashMap<Class<?>, PermissionCollection>(perms.size()*2);
197.30 @@ -590,6 +592,9 @@
197.31 ObjectInputStream.GetField gfields = in.readFields();
197.32
197.33 // Get permissions
197.34 + // writeObject writes a Hashtable<Class<?>, PermissionCollection> for
197.35 + // the perms key, so this cast is safe, unless the data is corrupt.
197.36 + @SuppressWarnings("unchecked")
197.37 Hashtable<Permission, Permission> perms =
197.38 (Hashtable<Permission, Permission>)gfields.get("perms", null);
197.39 permsMap = new HashMap<Permission, Permission>(perms.size()*2);
198.1 --- a/src/share/classes/java/security/Policy.java Thu Sep 01 13:54:38 2011 -0700
198.2 +++ b/src/share/classes/java/security/Policy.java Mon Sep 05 23:58:19 2011 -0700
198.3 @@ -26,16 +26,7 @@
198.4
198.5 package java.security;
198.6
198.7 -import java.io.*;
198.8 -import java.lang.RuntimePermission;
198.9 -import java.lang.reflect.*;
198.10 -import java.net.MalformedURLException;
198.11 -import java.net.URL;
198.12 import java.util.Enumeration;
198.13 -import java.util.Hashtable;
198.14 -import java.util.PropertyPermission;
198.15 -import java.util.StringTokenizer;
198.16 -import java.util.Vector;
198.17 import java.util.WeakHashMap;
198.18 import sun.security.jca.GetInstance;
198.19 import sun.security.util.Debug;
198.20 @@ -786,6 +777,8 @@
198.21 private static class UnsupportedEmptyCollection
198.22 extends PermissionCollection {
198.23
198.24 + private static final long serialVersionUID = -8492269157353014774L;
198.25 +
198.26 private Permissions perms;
198.27
198.28 /**
199.1 --- a/src/share/classes/java/security/ProtectionDomain.java Thu Sep 01 13:54:38 2011 -0700
199.2 +++ b/src/share/classes/java/security/ProtectionDomain.java Mon Sep 05 23:58:19 2011 -0700
199.3 @@ -33,7 +33,6 @@
199.4 import java.util.WeakHashMap;
199.5 import sun.misc.JavaSecurityProtectionDomainAccess;
199.6 import static sun.misc.JavaSecurityProtectionDomainAccess.ProtectionDomainCache;
199.7 -import sun.misc.SharedSecrets;
199.8 import sun.security.util.Debug;
199.9 import sun.security.util.SecurityConstants;
199.10 import sun.misc.JavaSecurityAccess;
199.11 @@ -403,7 +402,7 @@
199.12 e = permissions.elements(); // domain vs policy
199.13 while (e.hasMoreElements()) {
199.14 Permission pdp = e.nextElement();
199.15 - Class pdpClass = pdp.getClass();
199.16 + Class<?> pdpClass = pdp.getClass();
199.17 String pdpActions = pdp.getActions();
199.18 String pdpName = pdp.getName();
199.19 for (int i = 0; i < plVector.size(); i++) {
200.1 --- a/src/share/classes/java/security/Provider.java Thu Sep 01 13:54:38 2011 -0700
200.2 +++ b/src/share/classes/java/security/Provider.java Mon Sep 05 23:58:19 2011 -0700
200.3 @@ -31,9 +31,6 @@
200.4 import java.lang.ref.*;
200.5 import java.lang.reflect.*;
200.6
200.7 -import java.security.cert.CertStoreParameters;
200.8 -import javax.security.auth.login.Configuration;
200.9 -
200.10 /**
200.11 * This class represents a "provider" for the
200.12 * Java Security API, where a provider implements some or all parts of
200.13 @@ -453,8 +450,8 @@
200.14 * Internal method to be called AFTER the security check has been
200.15 * performed.
200.16 */
200.17 - private void implPutAll(Map t) {
200.18 - for (Map.Entry e : ((Map<?,?>)t).entrySet()) {
200.19 + private void implPutAll(Map<?,?> t) {
200.20 + for (Map.Entry<?,?> e : t.entrySet()) {
200.21 implPut(e.getKey(), e.getValue());
200.22 }
200.23 }
200.24 @@ -562,9 +559,9 @@
200.25 * occur if the legacy properties are inconsistent or incomplete.
200.26 */
200.27 private void removeInvalidServices(Map<ServiceKey,Service> map) {
200.28 - for (Iterator t = map.entrySet().iterator(); t.hasNext(); ) {
200.29 - Map.Entry entry = (Map.Entry)t.next();
200.30 - Service s = (Service)entry.getValue();
200.31 + for (Iterator<Map.Entry<ServiceKey, Service>> t =
200.32 + map.entrySet().iterator(); t.hasNext(); ) {
200.33 + Service s = t.next().getValue();
200.34 if (s.isValid() == false) {
200.35 t.remove();
200.36 }
200.37 @@ -918,15 +915,15 @@
200.38 final String name;
200.39 final boolean supportsParameter;
200.40 final String constructorParameterClassName;
200.41 - private volatile Class constructorParameterClass;
200.42 + private volatile Class<?> constructorParameterClass;
200.43
200.44 EngineDescription(String name, boolean sp, String paramName) {
200.45 this.name = name;
200.46 this.supportsParameter = sp;
200.47 this.constructorParameterClassName = paramName;
200.48 }
200.49 - Class getConstructorParameterClass() throws ClassNotFoundException {
200.50 - Class clazz = constructorParameterClass;
200.51 + Class<?> getConstructorParameterClass() throws ClassNotFoundException {
200.52 + Class<?> clazz = constructorParameterClass;
200.53 if (clazz == null) {
200.54 clazz = Class.forName(constructorParameterClassName);
200.55 constructorParameterClass = clazz;
200.56 @@ -1038,7 +1035,7 @@
200.57 private Map<UString,String> attributes;
200.58
200.59 // Reference to the cached implementation Class object
200.60 - private volatile Reference<Class> classRef;
200.61 + private volatile Reference<Class<?>> classRef;
200.62
200.63 // flag indicating whether this service has its attributes for
200.64 // supportedKeyFormats or supportedKeyClasses set
200.65 @@ -1055,7 +1052,7 @@
200.66 // whether this service has been registered with the Provider
200.67 private boolean registered;
200.68
200.69 - private static final Class[] CLASS0 = new Class[0];
200.70 + private static final Class<?>[] CLASS0 = new Class<?>[0];
200.71
200.72 // this constructor and these methods are used for parsing
200.73 // the legacy string properties.
200.74 @@ -1234,12 +1231,12 @@
200.75 ("constructorParameter not used with " + type
200.76 + " engines");
200.77 }
200.78 - Class clazz = getImplClass();
200.79 + Class<?> clazz = getImplClass();
200.80 return clazz.newInstance();
200.81 } else {
200.82 - Class paramClass = cap.getConstructorParameterClass();
200.83 + Class<?> paramClass = cap.getConstructorParameterClass();
200.84 if (constructorParameter != null) {
200.85 - Class argClass = constructorParameter.getClass();
200.86 + Class<?> argClass = constructorParameter.getClass();
200.87 if (paramClass.isAssignableFrom(argClass) == false) {
200.88 throw new InvalidParameterException
200.89 ("constructorParameter must be instanceof "
200.90 @@ -1247,8 +1244,8 @@
200.91 + " for engine type " + type);
200.92 }
200.93 }
200.94 - Class clazz = getImplClass();
200.95 - Constructor cons = clazz.getConstructor(paramClass);
200.96 + Class<?> clazz = getImplClass();
200.97 + Constructor<?> cons = clazz.getConstructor(paramClass);
200.98 return cons.newInstance(constructorParameter);
200.99 }
200.100 } catch (NoSuchAlgorithmException e) {
200.101 @@ -1267,10 +1264,10 @@
200.102 }
200.103
200.104 // return the implementation Class object for this service
200.105 - private Class getImplClass() throws NoSuchAlgorithmException {
200.106 + private Class<?> getImplClass() throws NoSuchAlgorithmException {
200.107 try {
200.108 - Reference<Class> ref = classRef;
200.109 - Class clazz = (ref == null) ? null : ref.get();
200.110 + Reference<Class<?>> ref = classRef;
200.111 + Class<?> clazz = (ref == null) ? null : ref.get();
200.112 if (clazz == null) {
200.113 ClassLoader cl = provider.getClass().getClassLoader();
200.114 if (cl == null) {
200.115 @@ -1278,7 +1275,7 @@
200.116 } else {
200.117 clazz = cl.loadClass(className);
200.118 }
200.119 - classRef = new WeakReference<Class>(clazz);
200.120 + classRef = new WeakReference<Class<?>>(clazz);
200.121 }
200.122 return clazz;
200.123 } catch (ClassNotFoundException e) {
200.124 @@ -1295,18 +1292,18 @@
200.125 */
200.126 private Object newInstanceGeneric(Object constructorParameter)
200.127 throws Exception {
200.128 - Class clazz = getImplClass();
200.129 + Class<?> clazz = getImplClass();
200.130 if (constructorParameter == null) {
200.131 Object o = clazz.newInstance();
200.132 return o;
200.133 }
200.134 - Class argClass = constructorParameter.getClass();
200.135 + Class<?> argClass = constructorParameter.getClass();
200.136 Constructor[] cons = clazz.getConstructors();
200.137 // find first public constructor that can take the
200.138 // argument as parameter
200.139 for (int i = 0; i < cons.length; i++) {
200.140 - Constructor con = cons[i];
200.141 - Class[] paramTypes = con.getParameterTypes();
200.142 + Constructor<?> con = cons[i];
200.143 + Class<?>[] paramTypes = con.getParameterTypes();
200.144 if (paramTypes.length != 1) {
200.145 continue;
200.146 }
200.147 @@ -1394,10 +1391,10 @@
200.148 s = getAttribute("SupportedKeyClasses");
200.149 if (s != null) {
200.150 String[] classNames = s.split("\\|");
200.151 - List<Class> classList =
200.152 + List<Class<?>> classList =
200.153 new ArrayList<>(classNames.length);
200.154 for (String className : classNames) {
200.155 - Class clazz = getKeyClass(className);
200.156 + Class<?> clazz = getKeyClass(className);
200.157 if (clazz != null) {
200.158 classList.add(clazz);
200.159 }
200.160 @@ -1414,7 +1411,7 @@
200.161 }
200.162
200.163 // get the key class object of the specified name
200.164 - private Class getKeyClass(String name) {
200.165 + private Class<?> getKeyClass(String name) {
200.166 try {
200.167 return Class.forName(name);
200.168 } catch (ClassNotFoundException e) {
200.169 @@ -1451,8 +1448,8 @@
200.170 if (supportedClasses == null) {
200.171 return false;
200.172 }
200.173 - Class keyClass = key.getClass();
200.174 - for (Class clazz : supportedClasses) {
200.175 + Class<?> keyClass = key.getClass();
200.176 + for (Class<?> clazz : supportedClasses) {
200.177 if (clazz.isAssignableFrom(keyClass)) {
200.178 return true;
200.179 }
201.1 --- a/src/share/classes/java/security/Security.java Thu Sep 01 13:54:38 2011 -0700
201.2 +++ b/src/share/classes/java/security/Security.java Mon Sep 05 23:58:19 2011 -0700
201.3 @@ -33,8 +33,6 @@
201.4 import sun.security.util.Debug;
201.5 import sun.security.util.PropertyExpander;
201.6
201.7 -import java.security.Provider.Service;
201.8 -
201.9 import sun.security.jca.*;
201.10
201.11 /**
201.12 @@ -660,15 +658,16 @@
201.13 }
201.14
201.15 // Map containing cached Spi Class objects of the specified type
201.16 - private static final Map<String, Class> spiMap = new ConcurrentHashMap<>();
201.17 + private static final Map<String, Class<?>> spiMap =
201.18 + new ConcurrentHashMap<>();
201.19
201.20 /**
201.21 * Return the Class object for the given engine type
201.22 * (e.g. "MessageDigest"). Works for Spis in the java.security package
201.23 * only.
201.24 */
201.25 - private static Class getSpiClass(String type) {
201.26 - Class clazz = spiMap.get(type);
201.27 + private static Class<?> getSpiClass(String type) {
201.28 + Class<?> clazz = spiMap.get(type);
201.29 if (clazz != null) {
201.30 return clazz;
201.31 }
201.32 @@ -1078,7 +1077,7 @@
201.33
201.34 if ((serviceName == null) || (serviceName.length() == 0) ||
201.35 (serviceName.endsWith("."))) {
201.36 - return Collections.EMPTY_SET;
201.37 + return Collections.emptySet();
201.38 }
201.39
201.40 HashSet<String> result = new HashSet<>();
201.41 @@ -1088,8 +1087,10 @@
201.42 // Check the keys for each provider.
201.43 for (Enumeration<Object> e = providers[i].keys();
201.44 e.hasMoreElements(); ) {
201.45 - String currentKey = ((String)e.nextElement()).toUpperCase();
201.46 - if (currentKey.startsWith(serviceName.toUpperCase())) {
201.47 + String currentKey =
201.48 + ((String)e.nextElement()).toUpperCase(Locale.ENGLISH);
201.49 + if (currentKey.startsWith(
201.50 + serviceName.toUpperCase(Locale.ENGLISH))) {
201.51 // We should skip the currentKey if it contains a
201.52 // whitespace. The reason is: such an entry in the
201.53 // provider property contains attributes for the
201.54 @@ -1097,7 +1098,8 @@
201.55 // in entries which lead to the implementation
201.56 // classes.
201.57 if (currentKey.indexOf(" ") < 0) {
201.58 - result.add(currentKey.substring(serviceName.length() + 1));
201.59 + result.add(currentKey.substring(
201.60 + serviceName.length() + 1));
201.61 }
201.62 }
201.63 }
202.1 --- a/src/share/classes/java/security/UnresolvedPermission.java Thu Sep 01 13:54:38 2011 -0700
202.2 +++ b/src/share/classes/java/security/UnresolvedPermission.java Mon Sep 05 23:58:19 2011 -0700
202.3 @@ -28,9 +28,7 @@
202.4 import java.io.IOException;
202.5 import java.io.ByteArrayInputStream;
202.6 import java.util.ArrayList;
202.7 -import java.util.Enumeration;
202.8 import java.util.Hashtable;
202.9 -import java.util.Vector;
202.10 import java.lang.reflect.*;
202.11 import java.security.cert.*;
202.12
202.13 @@ -247,19 +245,19 @@
202.14 }
202.15 }
202.16 try {
202.17 - Class pc = p.getClass();
202.18 + Class<?> pc = p.getClass();
202.19
202.20 if (name == null && actions == null) {
202.21 try {
202.22 - Constructor c = pc.getConstructor(PARAMS0);
202.23 + Constructor<?> c = pc.getConstructor(PARAMS0);
202.24 return (Permission)c.newInstance(new Object[] {});
202.25 } catch (NoSuchMethodException ne) {
202.26 try {
202.27 - Constructor c = pc.getConstructor(PARAMS1);
202.28 + Constructor<?> c = pc.getConstructor(PARAMS1);
202.29 return (Permission) c.newInstance(
202.30 new Object[] { name});
202.31 } catch (NoSuchMethodException ne1) {
202.32 - Constructor c = pc.getConstructor(PARAMS2);
202.33 + Constructor<?> c = pc.getConstructor(PARAMS2);
202.34 return (Permission) c.newInstance(
202.35 new Object[] { name, actions });
202.36 }
202.37 @@ -267,16 +265,16 @@
202.38 } else {
202.39 if (name != null && actions == null) {
202.40 try {
202.41 - Constructor c = pc.getConstructor(PARAMS1);
202.42 + Constructor<?> c = pc.getConstructor(PARAMS1);
202.43 return (Permission) c.newInstance(
202.44 new Object[] { name});
202.45 } catch (NoSuchMethodException ne) {
202.46 - Constructor c = pc.getConstructor(PARAMS2);
202.47 + Constructor<?> c = pc.getConstructor(PARAMS2);
202.48 return (Permission) c.newInstance(
202.49 new Object[] { name, actions });
202.50 }
202.51 } else {
202.52 - Constructor c = pc.getConstructor(PARAMS2);
202.53 + Constructor<?> c = pc.getConstructor(PARAMS2);
202.54 return (Permission) c.newInstance(
202.55 new Object[] { name, actions });
202.56 }
203.1 --- a/src/share/classes/java/security/UnresolvedPermissionCollection.java Thu Sep 01 13:54:38 2011 -0700
203.2 +++ b/src/share/classes/java/security/UnresolvedPermissionCollection.java Mon Sep 05 23:58:19 2011 -0700
203.3 @@ -197,8 +197,12 @@
203.4 ObjectInputStream.GetField gfields = in.readFields();
203.5
203.6 // Get permissions
203.7 + @SuppressWarnings("unchecked")
203.8 + // writeObject writes a Hashtable<String, Vector<UnresolvedPermission>>
203.9 + // for the permissions key, so this cast is safe, unless the data is corrupt.
203.10 Hashtable<String, Vector<UnresolvedPermission>> permissions =
203.11 - (Hashtable<String, Vector<UnresolvedPermission>>)gfields.get("permissions", null);
203.12 + (Hashtable<String, Vector<UnresolvedPermission>>)
203.13 + gfields.get("permissions", null);
203.14 perms = new HashMap<String, List<UnresolvedPermission>>(permissions.size()*2);
203.15
203.16 // Convert each entry (Vector) into a List
204.1 --- a/src/share/classes/java/security/cert/CertificateRevokedException.java Thu Sep 01 13:54:38 2011 -0700
204.2 +++ b/src/share/classes/java/security/cert/CertificateRevokedException.java Mon Sep 05 23:58:19 2011 -0700
204.3 @@ -1,5 +1,5 @@
204.4 /*
204.5 - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
204.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
204.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
204.8 *
204.9 * This code is free software; you can redistribute it and/or modify it
204.10 @@ -32,7 +32,6 @@
204.11 import java.util.Date;
204.12 import java.util.HashMap;
204.13 import java.util.Map;
204.14 -import java.util.Map.Entry;
204.15 import javax.security.auth.x500.X500Principal;
204.16
204.17 import sun.security.util.ObjectIdentifier;
204.18 @@ -95,7 +94,7 @@
204.19 this.revocationDate = new Date(revocationDate.getTime());
204.20 this.reason = reason;
204.21 this.authority = authority;
204.22 - this.extensions = new HashMap(extensions);
204.23 + this.extensions = new HashMap<String, Extension>(extensions);
204.24 }
204.25
204.26 /**
204.27 @@ -148,8 +147,7 @@
204.28 return null;
204.29 } else {
204.30 try {
204.31 - Date invalidity =
204.32 - (Date) InvalidityDateExtension.toImpl(ext).get("DATE");
204.33 + Date invalidity = InvalidityDateExtension.toImpl(ext).get("DATE");
204.34 return new Date(invalidity.getTime());
204.35 } catch (IOException ioe) {
204.36 return null;
205.1 --- a/src/share/classes/java/security/cert/X509CRLSelector.java Thu Sep 01 13:54:38 2011 -0700
205.2 +++ b/src/share/classes/java/security/cert/X509CRLSelector.java Mon Sep 05 23:58:19 2011 -0700
205.3 @@ -1,5 +1,5 @@
205.4 /*
205.5 - * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
205.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
205.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
205.8 *
205.9 * This code is free software; you can redistribute it and/or modify it
205.10 @@ -632,7 +632,7 @@
205.11 byte[] encoded = in.getOctetString();
205.12 CRLNumberExtension crlNumExt =
205.13 new CRLNumberExtension(Boolean.FALSE, encoded);
205.14 - crlNum = (BigInteger)crlNumExt.get(CRLNumberExtension.NUMBER);
205.15 + crlNum = crlNumExt.get(CRLNumberExtension.NUMBER);
205.16 } catch (IOException ex) {
205.17 if (debug != null) {
205.18 debug.println("X509CRLSelector.match: exception in "
206.1 --- a/src/share/classes/java/security/cert/X509CertSelector.java Thu Sep 01 13:54:38 2011 -0700
206.2 +++ b/src/share/classes/java/security/cert/X509CertSelector.java Mon Sep 05 23:58:19 2011 -0700
206.3 @@ -1,5 +1,5 @@
206.4 /*
206.5 - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
206.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
206.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
206.8 *
206.9 * This code is free software; you can redistribute it and/or modify it
206.10 @@ -277,7 +277,7 @@
206.11 try {
206.12 issuer = (issuerDN == null ? null : new X500Principal(issuerDN));
206.13 } catch (IllegalArgumentException e) {
206.14 - throw (IOException)new IOException("Invalid name").initCause(e);
206.15 + throw new IOException("Invalid name", e);
206.16 }
206.17 }
206.18
206.19 @@ -341,7 +341,7 @@
206.20 try {
206.21 subject = (subjectDN == null ? null : new X500Principal(subjectDN));
206.22 } catch (IllegalArgumentException e) {
206.23 - throw (IOException)new IOException("Invalid name").initCause(e);
206.24 + throw new IOException("Invalid name", e);
206.25 }
206.26 }
206.27
206.28 @@ -872,7 +872,7 @@
206.29 * @param object2 a Collection containing the second object to compare
206.30 * @return true if the objects are equal, false otherwise
206.31 */
206.32 - static boolean equalNames(Collection object1, Collection object2) {
206.33 + static boolean equalNames(Collection<?> object1, Collection<?> object2) {
206.34 if ((object1 == null) || (object2 == null)) {
206.35 return object1 == object2;
206.36 }
206.37 @@ -1672,19 +1672,15 @@
206.38 private static Set<List<?>> cloneAndCheckNames(Collection<List<?>> names) throws IOException {
206.39 // Copy the Lists and Collection
206.40 Set<List<?>> namesCopy = new HashSet<List<?>>();
206.41 - Iterator<List<?>> i = names.iterator();
206.42 - while (i.hasNext()) {
206.43 - Object o = i.next();
206.44 - if (!(o instanceof List)) {
206.45 - throw new IOException("expected a List");
206.46 - }
206.47 - namesCopy.add(new ArrayList<Object>((List<?>)o));
206.48 + for (List<?> o : names)
206.49 + {
206.50 + namesCopy.add(new ArrayList<Object>(o));
206.51 }
206.52
206.53 // Check the contents of the Lists and clone any byte arrays
206.54 - i = namesCopy.iterator();
206.55 - while (i.hasNext()) {
206.56 - List<Object> nameList = (List<Object>)i.next();
206.57 + for (List<?> list : namesCopy) {
206.58 + @SuppressWarnings("unchecked") // See javadoc for parameter "names".
206.59 + List<Object> nameList = (List<Object>)list;
206.60 if (nameList.size() != 2) {
206.61 throw new IOException("name list size not 2");
206.62 }
206.63 @@ -2184,8 +2180,7 @@
206.64 if (debug != null) {
206.65 String time = "n/a";
206.66 try {
206.67 - Date notAfter =
206.68 - (Date)ext.get(PrivateKeyUsageExtension.NOT_AFTER);
206.69 + Date notAfter = ext.get(PrivateKeyUsageExtension.NOT_AFTER);
206.70 time = notAfter.toString();
206.71 } catch (CertificateException ex) {
206.72 // not able to retrieve notAfter value
206.73 @@ -2201,8 +2196,7 @@
206.74 if (debug != null) {
206.75 String time = "n/a";
206.76 try {
206.77 - Date notBefore = (Date)
206.78 - ext.get(PrivateKeyUsageExtension.NOT_BEFORE);
206.79 + Date notBefore = ext.get(PrivateKeyUsageExtension.NOT_BEFORE);
206.80 time = notBefore.toString();
206.81 } catch (CertificateException ex) {
206.82 // not able to retrieve notBefore value
206.83 @@ -2214,14 +2208,6 @@
206.84 e2.printStackTrace();
206.85 }
206.86 return false;
206.87 - } catch (CertificateException e3) {
206.88 - if (debug != null) {
206.89 - debug.println("X509CertSelector.match: CertificateException "
206.90 - + "in private key usage check; X509CertSelector: "
206.91 - + this.toString());
206.92 - e3.printStackTrace();
206.93 - }
206.94 - return false;
206.95 } catch (IOException e4) {
206.96 if (debug != null) {
206.97 debug.println("X509CertSelector.match: IOException in "
206.98 @@ -2252,7 +2238,7 @@
206.99 + subjectPublicKeyAlgID + ", xcert subjectPublicKeyAlgID = "
206.100 + algID.getOID());
206.101 }
206.102 - if (!subjectPublicKeyAlgID.equals(algID.getOID())) {
206.103 + if (!subjectPublicKeyAlgID.equals((Object)algID.getOID())) {
206.104 if (debug != null) {
206.105 debug.println("X509CertSelector.match: "
206.106 + "subject public key alg IDs don't match");
206.107 @@ -2301,7 +2287,7 @@
206.108 EXTENDED_KEY_USAGE_ID);
206.109 if (ext != null) {
206.110 Vector<ObjectIdentifier> certKeyPurposeVector =
206.111 - (Vector<ObjectIdentifier>)ext.get(ExtendedKeyUsageExtension.USAGES);
206.112 + ext.get(ExtendedKeyUsageExtension.USAGES);
206.113 if (!certKeyPurposeVector.contains(ANY_EXTENDED_KEY_USAGE)
206.114 && !certKeyPurposeVector.containsAll(keyPurposeOIDSet)) {
206.115 if (debug != null) {
206.116 @@ -2337,8 +2323,8 @@
206.117 }
206.118 return false;
206.119 }
206.120 - GeneralNames certNames = (GeneralNames)
206.121 - sanExt.get(SubjectAlternativeNameExtension.SUBJECT_NAME);
206.122 + GeneralNames certNames =
206.123 + sanExt.get(SubjectAlternativeNameExtension.SUBJECT_NAME);
206.124 Iterator<GeneralNameInterface> i =
206.125 subjectAlternativeGeneralNames.iterator();
206.126 while (i.hasNext()) {
206.127 @@ -2406,7 +2392,7 @@
206.128 }
206.129 return false;
206.130 }
206.131 - List<PolicyInformation> policies = (List<PolicyInformation>)ext.get(CertificatePoliciesExtension.POLICIES);
206.132 + List<PolicyInformation> policies = ext.get(CertificatePoliciesExtension.POLICIES);
206.133 /*
206.134 * Convert the Vector of PolicyInformation to a Vector
206.135 * of CertificatePolicyIds for easier comparison.
206.136 @@ -2467,7 +2453,7 @@
206.137 if (ext == null) {
206.138 return true;
206.139 }
206.140 - if ((debug != null) && debug.isOn("certpath")) {
206.141 + if ((debug != null) && Debug.isOn("certpath")) {
206.142 debug.println("X509CertSelector.match pathToNames:\n");
206.143 Iterator<GeneralNameInterface> i =
206.144 pathToGeneralNames.iterator();
206.145 @@ -2476,10 +2462,10 @@
206.146 }
206.147 }
206.148
206.149 - GeneralSubtrees permitted = (GeneralSubtrees)
206.150 - ext.get(NameConstraintsExtension.PERMITTED_SUBTREES);
206.151 - GeneralSubtrees excluded = (GeneralSubtrees)
206.152 - ext.get(NameConstraintsExtension.EXCLUDED_SUBTREES);
206.153 + GeneralSubtrees permitted =
206.154 + ext.get(NameConstraintsExtension.PERMITTED_SUBTREES);
206.155 + GeneralSubtrees excluded =
206.156 + ext.get(NameConstraintsExtension.EXCLUDED_SUBTREES);
206.157 if (excluded != null) {
206.158 if (matchExcluded(excluded) == false) {
206.159 return false;
206.160 @@ -2597,12 +2583,13 @@
206.161 return true;
206.162 }
206.163
206.164 - private static Set<?> cloneSet(Set<?> set) {
206.165 + @SuppressWarnings("unchecked") // Safe casts assuming clone() works correctly
206.166 + private static <T> Set<T> cloneSet(Set<T> set) {
206.167 if (set instanceof HashSet) {
206.168 - Object clone = ((HashSet<?>)set).clone();
206.169 - return (Set<?>)clone;
206.170 + Object clone = ((HashSet<T>)set).clone();
206.171 + return (Set<T>)clone;
206.172 } else {
206.173 - return new HashSet<Object>(set);
206.174 + return new HashSet<T>(set);
206.175 }
206.176 }
206.177
206.178 @@ -2617,17 +2604,13 @@
206.179 // Must clone these because addPathToName et al. modify them
206.180 if (subjectAlternativeNames != null) {
206.181 copy.subjectAlternativeNames =
206.182 - (Set<List<?>>)cloneSet(subjectAlternativeNames);
206.183 + cloneSet(subjectAlternativeNames);
206.184 copy.subjectAlternativeGeneralNames =
206.185 - (Set<GeneralNameInterface>)cloneSet
206.186 - (subjectAlternativeGeneralNames);
206.187 + cloneSet(subjectAlternativeGeneralNames);
206.188 }
206.189 if (pathToGeneralNames != null) {
206.190 - copy.pathToNames =
206.191 - (Set<List<?>>)cloneSet(pathToNames);
206.192 - copy.pathToGeneralNames =
206.193 - (Set<GeneralNameInterface>)cloneSet
206.194 - (pathToGeneralNames);
206.195 + copy.pathToNames = cloneSet(pathToNames);
206.196 + copy.pathToGeneralNames = cloneSet(pathToGeneralNames);
206.197 }
206.198 return copy;
206.199 } catch (CloneNotSupportedException e) {
207.1 --- a/src/share/classes/java/util/Locale.java Thu Sep 01 13:54:38 2011 -0700
207.2 +++ b/src/share/classes/java/util/Locale.java Mon Sep 05 23:58:19 2011 -0700
207.3 @@ -1589,7 +1589,7 @@
207.4 * @since 1.7
207.5 */
207.6 public String getDisplayScript() {
207.7 - return getDisplayScript(getDefault());
207.8 + return getDisplayScript(getDefault(Category.DISPLAY));
207.9 }
207.10
207.11 /**
208.1 --- a/src/share/classes/java/util/Observable.java Thu Sep 01 13:54:38 2011 -0700
208.2 +++ b/src/share/classes/java/util/Observable.java Mon Sep 05 23:58:19 2011 -0700
208.3 @@ -1,5 +1,5 @@
208.4 /*
208.5 - * Copyright (c) 1994, 2004, Oracle and/or its affiliates. All rights reserved.
208.6 + * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
208.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
208.8 *
208.9 * This code is free software; you can redistribute it and/or modify it
208.10 @@ -44,7 +44,7 @@
208.11 * notifications on separate threads, or may guarantee that their
208.12 * subclass follows this order, as they choose.
208.13 * <p>
208.14 - * Note that this notification mechanism is has nothing to do with threads
208.15 + * Note that this notification mechanism has nothing to do with threads
208.16 * and is completely separate from the <tt>wait</tt> and <tt>notify</tt>
208.17 * mechanism of class <tt>Object</tt>.
208.18 * <p>
209.1 --- a/src/share/classes/java/util/prefs/Preferences.java Thu Sep 01 13:54:38 2011 -0700
209.2 +++ b/src/share/classes/java/util/prefs/Preferences.java Mon Sep 05 23:58:19 2011 -0700
209.3 @@ -256,11 +256,9 @@
209.4 .getContextClassLoader())
209.5 .newInstance();
209.6 } catch (Exception e) {
209.7 - InternalError error = new InternalError(
209.8 + throw new InternalError(
209.9 "Can't instantiate Preferences factory "
209.10 - + factoryName);
209.11 - error.initCause(e);
209.12 - throw error;
209.13 + + factoryName, e);
209.14 }
209.15 }
209.16 }
209.17 @@ -299,11 +297,9 @@
209.18 return (PreferencesFactory)
209.19 Class.forName(platformFactory, false, null).newInstance();
209.20 } catch (Exception e) {
209.21 - InternalError error = new InternalError(
209.22 + throw new InternalError(
209.23 "Can't instantiate platform default Preferences factory "
209.24 - + platformFactory);
209.25 - error.initCause(e);
209.26 - throw error;
209.27 + + platformFactory, e);
209.28 }
209.29 }
209.30
210.1 --- a/src/share/classes/java/util/regex/Matcher.java Thu Sep 01 13:54:38 2011 -0700
210.2 +++ b/src/share/classes/java/util/regex/Matcher.java Mon Sep 05 23:58:19 2011 -0700
210.3 @@ -515,6 +515,7 @@
210.4 * @throws IllegalArgumentException
210.5 * If there is no capturing group in the pattern
210.6 * with the given name
210.7 + * @since 1.7
210.8 */
210.9 public String group(String name) {
210.10 if (name == null)
211.1 --- a/src/share/classes/javax/crypto/Cipher.java Thu Sep 01 13:54:38 2011 -0700
211.2 +++ b/src/share/classes/javax/crypto/Cipher.java Mon Sep 05 23:58:19 2011 -0700
211.3 @@ -28,7 +28,6 @@
211.4 import java.util.*;
211.5 import java.util.regex.*;
211.6
211.7 -import static java.util.Locale.ENGLISH;
211.8
211.9 import java.security.*;
211.10 import java.security.Provider.Service;
211.11 @@ -44,7 +43,6 @@
211.12
211.13 import sun.security.util.Debug;
211.14 import sun.security.jca.*;
211.15 -import sun.security.jca.GetInstance.Instance;
211.16
211.17 /**
211.18 * This class provides the functionality of a cryptographic cipher for
211.19 @@ -227,10 +225,10 @@
211.20
211.21 // remaining services to try in provider selection
211.22 // null once provider is selected
211.23 - private Iterator serviceIterator;
211.24 + private Iterator<Service> serviceIterator;
211.25
211.26 // list of transform Strings to lookup in the provider
211.27 - private List transforms;
211.28 + private List<Transform> transforms;
211.29
211.30 private final Object lock;
211.31
211.32 @@ -271,7 +269,8 @@
211.33 }
211.34
211.35 private Cipher(CipherSpi firstSpi, Service firstService,
211.36 - Iterator serviceIterator, String transformation, List transforms) {
211.37 + Iterator<Service> serviceIterator, String transformation,
211.38 + List<Transform> transforms) {
211.39 this.firstSpi = firstSpi;
211.40 this.firstService = firstService;
211.41 this.serviceIterator = serviceIterator;
211.42 @@ -392,11 +391,11 @@
211.43
211.44 // Map<String,Pattern> for previously compiled patterns
211.45 // XXX use ConcurrentHashMap once available
211.46 - private final static Map patternCache =
211.47 - Collections.synchronizedMap(new HashMap());
211.48 + private final static Map<String, Pattern> patternCache =
211.49 + Collections.synchronizedMap(new HashMap<String, Pattern>());
211.50
211.51 private static boolean matches(String regexp, String str) {
211.52 - Pattern pattern = (Pattern)patternCache.get(regexp);
211.53 + Pattern pattern = patternCache.get(regexp);
211.54 if (pattern == null) {
211.55 pattern = Pattern.compile(regexp);
211.56 patternCache.put(regexp, pattern);
211.57 @@ -406,7 +405,7 @@
211.58
211.59 }
211.60
211.61 - private static List getTransforms(String transformation)
211.62 + private static List<Transform> getTransforms(String transformation)
211.63 throws NoSuchAlgorithmException {
211.64 String[] parts = tokenizeTransformation(transformation);
211.65
211.66 @@ -426,7 +425,7 @@
211.67 return Collections.singletonList(tr);
211.68 } else { // if ((mode != null) && (pad != null)) {
211.69 // DES/CBC/PKCS5Padding
211.70 - List list = new ArrayList(4);
211.71 + List<Transform> list = new ArrayList<>(4);
211.72 list.add(new Transform(alg, "/" + mode + "/" + pad, null, null));
211.73 list.add(new Transform(alg, "/" + mode, null, pad));
211.74 list.add(new Transform(alg, "//" + pad, mode, null));
211.75 @@ -436,10 +435,10 @@
211.76 }
211.77
211.78 // get the transform matching the specified service
211.79 - private static Transform getTransform(Service s, List transforms) {
211.80 + private static Transform getTransform(Service s,
211.81 + List<Transform> transforms) {
211.82 String alg = s.getAlgorithm().toUpperCase(Locale.ENGLISH);
211.83 - for (Iterator t = transforms.iterator(); t.hasNext(); ) {
211.84 - Transform tr = (Transform)t.next();
211.85 + for (Transform tr : transforms) {
211.86 if (alg.endsWith(tr.suffix)) {
211.87 return tr;
211.88 }
211.89 @@ -482,19 +481,18 @@
211.90 public static final Cipher getInstance(String transformation)
211.91 throws NoSuchAlgorithmException, NoSuchPaddingException
211.92 {
211.93 - List transforms = getTransforms(transformation);
211.94 - List cipherServices = new ArrayList(transforms.size());
211.95 - for (Iterator t = transforms.iterator(); t.hasNext(); ) {
211.96 - Transform transform = (Transform)t.next();
211.97 + List<Transform> transforms = getTransforms(transformation);
211.98 + List<ServiceId> cipherServices = new ArrayList<>(transforms.size());
211.99 + for (Transform transform : transforms) {
211.100 cipherServices.add(new ServiceId("Cipher", transform.transform));
211.101 }
211.102 - List services = GetInstance.getServices(cipherServices);
211.103 + List<Service> services = GetInstance.getServices(cipherServices);
211.104 // make sure there is at least one service from a signed provider
211.105 // and that it can use the specified mode and padding
211.106 - Iterator t = services.iterator();
211.107 + Iterator<Service> t = services.iterator();
211.108 Exception failure = null;
211.109 while (t.hasNext()) {
211.110 - Service s = (Service)t.next();
211.111 + Service s = t.next();
211.112 if (JceSecurity.canUseProvider(s.getProvider()) == false) {
211.113 continue;
211.114 }
211.115 @@ -620,11 +618,10 @@
211.116 throw new IllegalArgumentException("Missing provider");
211.117 }
211.118 Exception failure = null;
211.119 - List transforms = getTransforms(transformation);
211.120 + List<Transform> transforms = getTransforms(transformation);
211.121 boolean providerChecked = false;
211.122 String paddingError = null;
211.123 - for (Iterator t = transforms.iterator(); t.hasNext();) {
211.124 - Transform tr = (Transform)t.next();
211.125 + for (Transform tr : transforms) {
211.126 Service s = provider.getService("Cipher", tr.transform);
211.127 if (s == null) {
211.128 continue;
211.129 @@ -727,7 +724,7 @@
211.130 firstService = null;
211.131 firstSpi = null;
211.132 } else {
211.133 - s = (Service)serviceIterator.next();
211.134 + s = serviceIterator.next();
211.135 thisSpi = null;
211.136 }
211.137 if (JceSecurity.canUseProvider(s.getProvider()) == false) {
211.138 @@ -821,7 +818,7 @@
211.139 firstService = null;
211.140 firstSpi = null;
211.141 } else {
211.142 - s = (Service)serviceIterator.next();
211.143 + s = serviceIterator.next();
211.144 thisSpi = null;
211.145 }
211.146 // if provider says it does not support this key, ignore it
211.147 @@ -1622,7 +1619,7 @@
211.148 // Check whether the cert has a key usage extension
211.149 // marked as a critical extension.
211.150 X509Certificate cert = (X509Certificate)certificate;
211.151 - Set critSet = cert.getCriticalExtensionOIDs();
211.152 + Set<String> critSet = cert.getCriticalExtensionOIDs();
211.153
211.154 if (critSet != null && !critSet.isEmpty()
211.155 && critSet.contains(KEY_USAGE_EXTENSION_OID)) {
212.1 --- a/src/share/classes/javax/crypto/CryptoAllPermission.java Thu Sep 01 13:54:38 2011 -0700
212.2 +++ b/src/share/classes/javax/crypto/CryptoAllPermission.java Mon Sep 05 23:58:19 2011 -0700
212.3 @@ -1,5 +1,5 @@
212.4 /*
212.5 - * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
212.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
212.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
212.8 *
212.9 * This code is free software; you can redistribute it and/or modify it
212.10 @@ -171,8 +171,8 @@
212.11 *
212.12 * @return an enumeration of all the CryptoAllPermission objects.
212.13 */
212.14 - public Enumeration elements() {
212.15 - Vector v = new Vector(1);
212.16 + public Enumeration<Permission> elements() {
212.17 + Vector<Permission> v = new Vector<>(1);
212.18 if (all_allowed) v.add(CryptoAllPermission.INSTANCE);
212.19 return v.elements();
212.20 }
213.1 --- a/src/share/classes/javax/crypto/CryptoPermission.java Thu Sep 01 13:54:38 2011 -0700
213.2 +++ b/src/share/classes/javax/crypto/CryptoPermission.java Mon Sep 05 23:58:19 2011 -0700
213.3 @@ -1,5 +1,5 @@
213.4 /*
213.5 - * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
213.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
213.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
213.8 *
213.9 * This code is free software; you can redistribute it and/or modify it
213.10 @@ -475,14 +475,14 @@
213.11
213.12 private static final long serialVersionUID = -511215555898802763L;
213.13
213.14 - private Vector permissions;
213.15 + private Vector<Permission> permissions;
213.16
213.17 /**
213.18 * Creates an empty CryptoPermissionCollection
213.19 * object.
213.20 */
213.21 CryptoPermissionCollection() {
213.22 - permissions = new Vector(3);
213.23 + permissions = new Vector<Permission>(3);
213.24 }
213.25
213.26 /**
213.27 @@ -520,7 +520,7 @@
213.28
213.29 CryptoPermission cp = (CryptoPermission)permission;
213.30
213.31 - Enumeration e = permissions.elements();
213.32 + Enumeration<Permission> e = permissions.elements();
213.33
213.34 while (e.hasMoreElements()) {
213.35 CryptoPermission x = (CryptoPermission) e.nextElement();
213.36 @@ -538,7 +538,7 @@
213.37 * @return an enumeration of all the CryptoPermission objects.
213.38 */
213.39
213.40 - public Enumeration elements()
213.41 + public Enumeration<Permission> elements()
213.42 {
213.43 return permissions.elements();
213.44 }
214.1 --- a/src/share/classes/javax/crypto/CryptoPermissions.java Thu Sep 01 13:54:38 2011 -0700
214.2 +++ b/src/share/classes/javax/crypto/CryptoPermissions.java Mon Sep 05 23:58:19 2011 -0700
214.3 @@ -1,5 +1,5 @@
214.4 /*
214.5 - * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
214.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
214.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
214.8 *
214.9 * This code is free software; you can redistribute it and/or modify it
214.10 @@ -62,14 +62,14 @@
214.11 private static final long serialVersionUID = 4946547168093391015L;
214.12
214.13 // This class is similar to java.security.Permissions
214.14 - private Hashtable perms;
214.15 + private Hashtable<String, PermissionCollection> perms;
214.16
214.17 /**
214.18 * Creates a new CryptoPermissions object containing
214.19 * no CryptoPermissionCollections.
214.20 */
214.21 CryptoPermissions() {
214.22 - perms = new Hashtable(7);
214.23 + perms = new Hashtable<String, PermissionCollection>(7);
214.24 }
214.25
214.26 /**
214.27 @@ -166,7 +166,7 @@
214.28 *
214.29 * @return an enumeration of all the Permissions.
214.30 */
214.31 - public Enumeration elements() {
214.32 + public Enumeration<Permission> elements() {
214.33 // go through each Permissions in the hash table
214.34 // and call their elements() function.
214.35 return new PermissionsEnumerator(perms.elements());
214.36 @@ -198,8 +198,7 @@
214.37
214.38
214.39 PermissionCollection thatWildcard =
214.40 - (PermissionCollection)other.perms.get(
214.41 - CryptoPermission.ALG_NAME_WILDCARD);
214.42 + other.perms.get(CryptoPermission.ALG_NAME_WILDCARD);
214.43 int maxKeySize = 0;
214.44 if (thatWildcard != null) {
214.45 maxKeySize = ((CryptoPermission)
214.46 @@ -208,14 +207,12 @@
214.47 // For each algorithm in this CryptoPermissions,
214.48 // find out if there is anything we should add into
214.49 // ret.
214.50 - Enumeration thisKeys = this.perms.keys();
214.51 + Enumeration<String> thisKeys = this.perms.keys();
214.52 while (thisKeys.hasMoreElements()) {
214.53 - String alg = (String)thisKeys.nextElement();
214.54 + String alg = thisKeys.nextElement();
214.55
214.56 - PermissionCollection thisPc =
214.57 - (PermissionCollection)this.perms.get(alg);
214.58 - PermissionCollection thatPc =
214.59 - (PermissionCollection)other.perms.get(alg);
214.60 + PermissionCollection thisPc = this.perms.get(alg);
214.61 + PermissionCollection thatPc = other.perms.get(alg);
214.62
214.63 CryptoPermission[] partialResult;
214.64
214.65 @@ -238,8 +235,7 @@
214.66 }
214.67
214.68 PermissionCollection thisWildcard =
214.69 - (PermissionCollection)this.perms.get(
214.70 - CryptoPermission.ALG_NAME_WILDCARD);
214.71 + this.perms.get(CryptoPermission.ALG_NAME_WILDCARD);
214.72
214.73 // If this CryptoPermissions doesn't
214.74 // have a wildcard, we are done.
214.75 @@ -252,16 +248,15 @@
214.76 maxKeySize =
214.77 ((CryptoPermission)
214.78 thisWildcard.elements().nextElement()).getMaxKeySize();
214.79 - Enumeration thatKeys = other.perms.keys();
214.80 + Enumeration<String> thatKeys = other.perms.keys();
214.81 while (thatKeys.hasMoreElements()) {
214.82 - String alg = (String)thatKeys.nextElement();
214.83 + String alg = thatKeys.nextElement();
214.84
214.85 if (this.perms.containsKey(alg)) {
214.86 continue;
214.87 }
214.88
214.89 - PermissionCollection thatPc =
214.90 - (PermissionCollection)other.perms.get(alg);
214.91 + PermissionCollection thatPc = other.perms.get(alg);
214.92
214.93 CryptoPermission[] partialResult;
214.94
214.95 @@ -286,9 +281,9 @@
214.96 */
214.97 private CryptoPermission[] getMinimum(PermissionCollection thisPc,
214.98 PermissionCollection thatPc) {
214.99 - Vector permVector = new Vector(2);
214.100 + Vector<CryptoPermission> permVector = new Vector<>(2);
214.101
214.102 - Enumeration thisPcPermissions = thisPc.elements();
214.103 + Enumeration<Permission> thisPcPermissions = thisPc.elements();
214.104
214.105 // For each CryptoPermission in
214.106 // thisPc object, do the following:
214.107 @@ -307,7 +302,7 @@
214.108 CryptoPermission thisCp =
214.109 (CryptoPermission)thisPcPermissions.nextElement();
214.110
214.111 - Enumeration thatPcPermissions = thatPc.elements();
214.112 + Enumeration<Permission> thatPcPermissions = thatPc.elements();
214.113 while (thatPcPermissions.hasMoreElements()) {
214.114 CryptoPermission thatCp =
214.115 (CryptoPermission)thatPcPermissions.nextElement();
214.116 @@ -342,9 +337,9 @@
214.117 */
214.118 private CryptoPermission[] getMinimum(int maxKeySize,
214.119 PermissionCollection pc) {
214.120 - Vector permVector = new Vector(1);
214.121 + Vector<CryptoPermission> permVector = new Vector<>(1);
214.122
214.123 - Enumeration enum_ = pc.elements();
214.124 + Enumeration<Permission> enum_ = pc.elements();
214.125
214.126 while (enum_.hasMoreElements()) {
214.127 CryptoPermission cp =
214.128 @@ -383,19 +378,17 @@
214.129 // If this CryptoPermissions includes CryptoAllPermission,
214.130 // we should return CryptoAllPermission.
214.131 if (perms.containsKey(CryptoAllPermission.ALG_NAME)) {
214.132 - return
214.133 - (PermissionCollection)(perms.get(CryptoAllPermission.ALG_NAME));
214.134 + return perms.get(CryptoAllPermission.ALG_NAME);
214.135 }
214.136
214.137 - PermissionCollection pc = (PermissionCollection)perms.get(alg);
214.138 + PermissionCollection pc = perms.get(alg);
214.139
214.140 // If there isn't a PermissionCollection for
214.141 // the given algorithm,we should return the
214.142 // PermissionCollection for the wildcard
214.143 // if there is one.
214.144 if (pc == null) {
214.145 - pc = (PermissionCollection)perms.get(
214.146 - CryptoPermission.ALG_NAME_WILDCARD);
214.147 + pc = perms.get(CryptoPermission.ALG_NAME_WILDCARD);
214.148 }
214.149 return pc;
214.150 }
214.151 @@ -414,7 +407,7 @@
214.152
214.153 String alg = cryptoPerm.getAlgorithm();
214.154
214.155 - PermissionCollection pc = (PermissionCollection)perms.get(alg);
214.156 + PermissionCollection pc = perms.get(alg);
214.157
214.158 if (pc == null) {
214.159 pc = cryptoPerm.newPermissionCollection();
214.160 @@ -423,14 +416,14 @@
214.161 }
214.162 }
214.163
214.164 -final class PermissionsEnumerator implements Enumeration {
214.165 +final class PermissionsEnumerator implements Enumeration<Permission> {
214.166
214.167 // all the perms
214.168 - private Enumeration perms;
214.169 + private Enumeration<PermissionCollection> perms;
214.170 // the current set
214.171 - private Enumeration permset;
214.172 + private Enumeration<Permission> permset;
214.173
214.174 - PermissionsEnumerator(Enumeration e) {
214.175 + PermissionsEnumerator(Enumeration<PermissionCollection> e) {
214.176 perms = e;
214.177 permset = getNextEnumWithMore();
214.178 }
214.179 @@ -454,7 +447,7 @@
214.180 return (permset != null);
214.181 }
214.182
214.183 - public synchronized Object nextElement() {
214.184 + public synchronized Permission nextElement() {
214.185 // hasMoreElements will update permset to the next permset
214.186 // with something in it...
214.187
214.188 @@ -466,11 +459,10 @@
214.189
214.190 }
214.191
214.192 - private Enumeration getNextEnumWithMore() {
214.193 + private Enumeration<Permission> getNextEnumWithMore() {
214.194 while (perms.hasMoreElements()) {
214.195 - PermissionCollection pc =
214.196 - (PermissionCollection) perms.nextElement();
214.197 - Enumeration next = pc.elements();
214.198 + PermissionCollection pc = perms.nextElement();
214.199 + Enumeration<Permission> next = pc.elements();
214.200 if (next.hasMoreElements())
214.201 return next;
214.202 }
215.1 --- a/src/share/classes/javax/crypto/CryptoPolicyParser.java Thu Sep 01 13:54:38 2011 -0700
215.2 +++ b/src/share/classes/javax/crypto/CryptoPolicyParser.java Mon Sep 05 23:58:19 2011 -0700
215.3 @@ -1,5 +1,5 @@
215.4 /*
215.5 - * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
215.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
215.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
215.8 *
215.9 * This code is free software; you can redistribute it and/or modify it
215.10 @@ -29,7 +29,6 @@
215.11 import java.util.Enumeration;
215.12 import java.util.Hashtable;
215.13 import java.util.Vector;
215.14 -import java.util.StringTokenizer;
215.15 import static java.util.Locale.ENGLISH;
215.16
215.17 import java.security.GeneralSecurityException;
215.18 @@ -64,7 +63,7 @@
215.19
215.20 final class CryptoPolicyParser {
215.21
215.22 - private Vector grantEntries;
215.23 + private Vector<GrantEntry> grantEntries;
215.24
215.25 // Convenience variables for parsing
215.26 private StreamTokenizer st;
215.27 @@ -74,7 +73,7 @@
215.28 * Creates a CryptoPolicyParser object.
215.29 */
215.30 CryptoPolicyParser() {
215.31 - grantEntries = new Vector();
215.32 + grantEntries = new Vector<GrantEntry>();
215.33 }
215.34
215.35 /**
215.36 @@ -127,7 +126,7 @@
215.37 * The crypto jurisdiction policy must be consistent. The
215.38 * following hashtable is used for checking consistency.
215.39 */
215.40 - Hashtable processedPermissions = null;
215.41 + Hashtable<String, Vector<String>> processedPermissions = null;
215.42
215.43 /*
215.44 * The main parsing loop. The loop is executed once for each entry
215.45 @@ -152,7 +151,8 @@
215.46 /**
215.47 * parse a Grant entry
215.48 */
215.49 - private GrantEntry parseGrantEntry(Hashtable processedPermissions)
215.50 + private GrantEntry parseGrantEntry(
215.51 + Hashtable<String, Vector<String>> processedPermissions)
215.52 throws ParsingException, IOException
215.53 {
215.54 GrantEntry e = new GrantEntry();
215.55 @@ -180,7 +180,7 @@
215.56 * parse a CryptoPermission entry
215.57 */
215.58 private CryptoPermissionEntry parsePermissionEntry(
215.59 - Hashtable processedPermissions)
215.60 + Hashtable<String, Vector<String>> processedPermissions)
215.61 throws ParsingException, IOException
215.62 {
215.63 CryptoPermissionEntry e = new CryptoPermissionEntry();
215.64 @@ -252,7 +252,7 @@
215.65 // AlgorithmParameterSpec class name.
215.66 String algParamSpecClassName = match("quoted string");
215.67
215.68 - Vector paramsV = new Vector(1);
215.69 + Vector<Integer> paramsV = new Vector<>(1);
215.70 while (peek(",")) {
215.71 match(",");
215.72 if (peek("number")) {
215.73 @@ -285,14 +285,14 @@
215.74 AlgorithmParameterSpec ret = null;
215.75
215.76 try {
215.77 - Class apsClass = Class.forName(type);
215.78 - Class[] paramClasses = new Class[params.length];
215.79 + Class<?> apsClass = Class.forName(type);
215.80 + Class<?>[] paramClasses = new Class<?>[params.length];
215.81
215.82 for (int i = 0; i < params.length; i++) {
215.83 paramClasses[i] = int.class;
215.84 }
215.85
215.86 - Constructor c = apsClass.getConstructor(paramClasses);
215.87 + Constructor<?> c = apsClass.getConstructor(paramClasses);
215.88 ret = (AlgorithmParameterSpec) c.newInstance((Object[]) params);
215.89 } catch (Exception e) {
215.90 throw new ParsingException("Cannot call the constructor of " +
215.91 @@ -456,15 +456,15 @@
215.92 }
215.93
215.94 CryptoPermission[] getPermissions() {
215.95 - Vector result = new Vector();
215.96 + Vector<CryptoPermission> result = new Vector<>();
215.97
215.98 - Enumeration grantEnum = grantEntries.elements();
215.99 + Enumeration<GrantEntry> grantEnum = grantEntries.elements();
215.100 while (grantEnum.hasMoreElements()) {
215.101 - GrantEntry ge = (GrantEntry)grantEnum.nextElement();
215.102 - Enumeration permEnum = ge.permissionElements();
215.103 + GrantEntry ge = grantEnum.nextElement();
215.104 + Enumeration<CryptoPermissionEntry> permEnum =
215.105 + ge.permissionElements();
215.106 while (permEnum.hasMoreElements()) {
215.107 - CryptoPermissionEntry pe =
215.108 - (CryptoPermissionEntry)permEnum.nextElement();
215.109 + CryptoPermissionEntry pe = permEnum.nextElement();
215.110 if (pe.cryptoPermission.equals(
215.111 "javax.crypto.CryptoAllPermission")) {
215.112 result.addElement(CryptoAllPermission.INSTANCE);
215.113 @@ -491,15 +491,14 @@
215.114 return ret;
215.115 }
215.116
215.117 - private boolean isConsistent(String alg,
215.118 - String exemptionMechanism,
215.119 - Hashtable processedPermissions) {
215.120 + private boolean isConsistent(String alg, String exemptionMechanism,
215.121 + Hashtable<String, Vector<String>> processedPermissions) {
215.122 String thisExemptionMechanism =
215.123 exemptionMechanism == null ? "none" : exemptionMechanism;
215.124
215.125 if (processedPermissions == null) {
215.126 - processedPermissions = new Hashtable();
215.127 - Vector exemptionMechanisms = new Vector(1);
215.128 + processedPermissions = new Hashtable<String, Vector<String>>();
215.129 + Vector<String> exemptionMechanisms = new Vector<>(1);
215.130 exemptionMechanisms.addElement(thisExemptionMechanism);
215.131 processedPermissions.put(alg, exemptionMechanisms);
215.132 return true;
215.133 @@ -509,15 +508,15 @@
215.134 return false;
215.135 }
215.136
215.137 - Vector exemptionMechanisms;
215.138 + Vector<String> exemptionMechanisms;
215.139
215.140 if (processedPermissions.containsKey(alg)) {
215.141 - exemptionMechanisms = (Vector)processedPermissions.get(alg);
215.142 + exemptionMechanisms = processedPermissions.get(alg);
215.143 if (exemptionMechanisms.contains(thisExemptionMechanism)) {
215.144 return false;
215.145 }
215.146 } else {
215.147 - exemptionMechanisms = new Vector(1);
215.148 + exemptionMechanisms = new Vector<String>(1);
215.149 }
215.150
215.151 exemptionMechanisms.addElement(thisExemptionMechanism);
215.152 @@ -556,10 +555,10 @@
215.153
215.154 private static class GrantEntry {
215.155
215.156 - private Vector permissionEntries;
215.157 + private Vector<CryptoPermissionEntry> permissionEntries;
215.158
215.159 GrantEntry() {
215.160 - permissionEntries = new Vector();
215.161 + permissionEntries = new Vector<CryptoPermissionEntry>();
215.162 }
215.163
215.164 void add(CryptoPermissionEntry pe)
215.165 @@ -580,7 +579,7 @@
215.166 /**
215.167 * Enumerate all the permission entries in this GrantEntry.
215.168 */
215.169 - Enumeration permissionElements(){
215.170 + Enumeration<CryptoPermissionEntry> permissionElements(){
215.171 return permissionEntries.elements();
215.172 }
215.173
216.1 --- a/src/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java Thu Sep 01 13:54:38 2011 -0700
216.2 +++ b/src/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java Mon Sep 05 23:58:19 2011 -0700
216.3 @@ -1,5 +1,5 @@
216.4 /*
216.5 - * Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved.
216.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
216.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
216.8 *
216.9 * This code is free software; you can redistribute it and/or modify it
216.10 @@ -80,7 +80,7 @@
216.11 throw new NullPointerException("the encoded parameter " +
216.12 "must be non-null");
216.13 }
216.14 - this.encoded = (byte[])encoded.clone();
216.15 + this.encoded = encoded.clone();
216.16 DerValue val = new DerValue(this.encoded);
216.17
216.18 DerValue[] seq = new DerValue[2];
216.19 @@ -143,7 +143,7 @@
216.20 throw new IllegalArgumentException("the encryptedData " +
216.21 "parameter must not be empty");
216.22 } else {
216.23 - this.encryptedData = (byte[])encryptedData.clone();
216.24 + this.encryptedData = encryptedData.clone();
216.25 }
216.26 // delay the generation of ASN.1 encoding until
216.27 // getEncoded() is called
216.28 @@ -183,7 +183,7 @@
216.29 throw new IllegalArgumentException("the encryptedData " +
216.30 "parameter must not be empty");
216.31 } else {
216.32 - this.encryptedData = (byte[])encryptedData.clone();
216.33 + this.encryptedData = encryptedData.clone();
216.34 }
216.35
216.36 // delay the generation of ASN.1 encoding until
216.37 @@ -222,7 +222,7 @@
216.38 * each time this method is called.
216.39 */
216.40 public byte[] getEncryptedData() {
216.41 - return (byte[])this.encryptedData.clone();
216.42 + return this.encryptedData.clone();
216.43 }
216.44
216.45 /**
216.46 @@ -247,26 +247,13 @@
216.47 throws InvalidKeySpecException {
216.48 byte[] encoded = null;
216.49 try {
216.50 - encoded = cipher.doFinal((byte[])encryptedData);
216.51 + encoded = cipher.doFinal(encryptedData);
216.52 checkPKCS8Encoding(encoded);
216.53 - } catch (GeneralSecurityException gse) {
216.54 - InvalidKeySpecException ikse = new
216.55 - InvalidKeySpecException(
216.56 - "Cannot retrieve the PKCS8EncodedKeySpec");
216.57 - ikse.initCause(gse);
216.58 - throw ikse;
216.59 - } catch (IOException ioe) {
216.60 - InvalidKeySpecException ikse = new
216.61 - InvalidKeySpecException(
216.62 - "Cannot retrieve the PKCS8EncodedKeySpec");
216.63 - ikse.initCause(ioe);
216.64 - throw ikse;
216.65 - } catch (IllegalStateException ise) {
216.66 - InvalidKeySpecException ikse = new
216.67 - InvalidKeySpecException(
216.68 - "Cannot retrieve the PKCS8EncodedKeySpec");
216.69 - ikse.initCause(ise);
216.70 - throw ikse;
216.71 + } catch (GeneralSecurityException |
216.72 + IOException |
216.73 + IllegalStateException ex) {
216.74 + throw new InvalidKeySpecException(
216.75 + "Cannot retrieve the PKCS8EncodedKeySpec", ex);
216.76 }
216.77 return new PKCS8EncodedKeySpec(encoded);
216.78 }
216.79 @@ -289,16 +276,9 @@
216.80 } catch (NoSuchAlgorithmException nsae) {
216.81 // rethrow
216.82 throw nsae;
216.83 - } catch (GeneralSecurityException gse) {
216.84 - InvalidKeyException ike = new InvalidKeyException
216.85 - ("Cannot retrieve the PKCS8EncodedKeySpec");
216.86 - ike.initCause(gse);
216.87 - throw ike;
216.88 - } catch (IOException ioe) {
216.89 - InvalidKeyException ike = new InvalidKeyException
216.90 - ("Cannot retrieve the PKCS8EncodedKeySpec");
216.91 - ike.initCause(ioe);
216.92 - throw ike;
216.93 + } catch (GeneralSecurityException | IOException ex) {
216.94 + throw new InvalidKeyException(
216.95 + "Cannot retrieve the PKCS8EncodedKeySpec", ex);
216.96 }
216.97 return new PKCS8EncodedKeySpec(encoded);
216.98 }
216.99 @@ -413,7 +393,7 @@
216.100 out.write(DerValue.tag_Sequence, tmp);
216.101 this.encoded = out.toByteArray();
216.102 }
216.103 - return (byte[])this.encoded.clone();
216.104 + return this.encoded.clone();
216.105 }
216.106
216.107 private static void checkTag(DerValue val, byte tag, String valName)
216.108 @@ -424,6 +404,7 @@
216.109 }
216.110 }
216.111
216.112 + @SuppressWarnings("fallthrough")
216.113 private static void checkPKCS8Encoding(byte[] encodedKey)
216.114 throws IOException {
216.115 DerInputStream in = new DerInputStream(encodedKey);
216.116 @@ -432,6 +413,7 @@
216.117 switch (values.length) {
216.118 case 4:
216.119 checkTag(values[3], DerValue.TAG_CONTEXT, "attributes");
216.120 + /* fall through */
216.121 case 3:
216.122 checkTag(values[0], DerValue.tag_Integer, "version");
216.123 DerInputStream algid = values[1].toDerInputStream();
217.1 --- a/src/share/classes/javax/crypto/JarVerifier.java Thu Sep 01 13:54:38 2011 -0700
217.2 +++ b/src/share/classes/javax/crypto/JarVerifier.java Mon Sep 05 23:58:19 2011 -0700
217.3 @@ -1,5 +1,5 @@
217.4 /*
217.5 - * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
217.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
217.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
217.8 *
217.9 * This code is free software; you can redistribute it and/or modify it
217.10 @@ -86,23 +86,19 @@
217.11
217.12 // Get a link to the Jarfile to search.
217.13 try {
217.14 - jf = (JarFile)
217.15 - AccessController.doPrivileged(
217.16 - new PrivilegedExceptionAction() {
217.17 - public Object run() throws Exception {
217.18 - JarURLConnection conn =
217.19 - (JarURLConnection) url.openConnection();
217.20 - // You could do some caching here as
217.21 - // an optimization.
217.22 - conn.setUseCaches(false);
217.23 - return conn.getJarFile();
217.24 - }
217.25 - });
217.26 + jf = AccessController.doPrivileged(
217.27 + new PrivilegedExceptionAction<JarFile>() {
217.28 + public JarFile run() throws Exception {
217.29 + JarURLConnection conn =
217.30 + (JarURLConnection) url.openConnection();
217.31 + // You could do some caching here as
217.32 + // an optimization.
217.33 + conn.setUseCaches(false);
217.34 + return conn.getJarFile();
217.35 + }
217.36 + });
217.37 } catch (java.security.PrivilegedActionException pae) {
217.38 - SecurityException se = new SecurityException(
217.39 - "Cannot load " + url.toString());
217.40 - se.initCause(pae);
217.41 - throw se;
217.42 + throw new SecurityException("Cannot load " + url.toString(), pae);
217.43 }
217.44
217.45 if (jf != null) {
218.1 --- a/src/share/classes/javax/crypto/JceSecurity.java Thu Sep 01 13:54:38 2011 -0700
218.2 +++ b/src/share/classes/javax/crypto/JceSecurity.java Mon Sep 05 23:58:19 2011 -0700
218.3 @@ -1,5 +1,5 @@
218.4 /*
218.5 - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
218.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
218.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
218.8 *
218.9 * This code is free software; you can redistribute it and/or modify it
218.10 @@ -57,10 +57,12 @@
218.11 // Map<Provider,?> of the providers we already have verified
218.12 // value == PROVIDER_VERIFIED is successfully verified
218.13 // value is failure cause Exception in error case
218.14 - private final static Map verificationResults = new IdentityHashMap();
218.15 + private final static Map<Provider, Object> verificationResults =
218.16 + new IdentityHashMap<>();
218.17
218.18 // Map<Provider,?> of the providers currently being verified
218.19 - private final static Map verifyingProviders = new IdentityHashMap();
218.20 + private final static Map<Provider, Object> verifyingProviders =
218.21 + new IdentityHashMap<>();
218.22
218.23 // Set the default value. May be changed in the static initializer.
218.24 private static boolean isRestricted = true;
218.25 @@ -73,25 +75,23 @@
218.26
218.27 static {
218.28 try {
218.29 - AccessController.doPrivileged(new PrivilegedExceptionAction() {
218.30 - public Object run() throws Exception {
218.31 - setupJurisdictionPolicies();
218.32 - return null;
218.33 - }
218.34 - });
218.35 + AccessController.doPrivileged(
218.36 + new PrivilegedExceptionAction<Object>() {
218.37 + public Object run() throws Exception {
218.38 + setupJurisdictionPolicies();
218.39 + return null;
218.40 + }
218.41 + });
218.42
218.43 isRestricted = defaultPolicy.implies(
218.44 CryptoAllPermission.INSTANCE) ? false : true;
218.45 } catch (Exception e) {
218.46 - SecurityException se =
218.47 - new SecurityException(
218.48 - "Can not initialize cryptographic mechanism");
218.49 - se.initCause(e);
218.50 - throw se;
218.51 + throw new SecurityException(
218.52 + "Can not initialize cryptographic mechanism", e);
218.53 }
218.54 }
218.55
218.56 - static Instance getInstance(String type, Class clazz, String algorithm,
218.57 + static Instance getInstance(String type, Class<?> clazz, String algorithm,
218.58 String provider) throws NoSuchAlgorithmException,
218.59 NoSuchProviderException {
218.60 Service s = GetInstance.getService(type, algorithm, provider);
218.61 @@ -104,7 +104,7 @@
218.62 return GetInstance.getInstance(s, clazz);
218.63 }
218.64
218.65 - static Instance getInstance(String type, Class clazz, String algorithm,
218.66 + static Instance getInstance(String type, Class<?> clazz, String algorithm,
218.67 Provider provider) throws NoSuchAlgorithmException {
218.68 Service s = GetInstance.getService(type, algorithm, provider);
218.69 Exception ve = JceSecurity.getVerificationResult(provider);
218.70 @@ -116,12 +116,11 @@
218.71 return GetInstance.getInstance(s, clazz);
218.72 }
218.73
218.74 - static Instance getInstance(String type, Class clazz, String algorithm)
218.75 + static Instance getInstance(String type, Class<?> clazz, String algorithm)
218.76 throws NoSuchAlgorithmException {
218.77 - List services = GetInstance.getServices(type, algorithm);
218.78 + List<Service> services = GetInstance.getServices(type, algorithm);
218.79 NoSuchAlgorithmException failure = null;
218.80 - for (Iterator t = services.iterator(); t.hasNext(); ) {
218.81 - Service s = (Service)t.next();
218.82 + for (Service s : services) {
218.83 if (canUseProvider(s.getProvider()) == false) {
218.84 // allow only signed providers
218.85 continue;
218.86 @@ -213,16 +212,17 @@
218.87 }
218.88
218.89 // reference to a Map we use as a cache for codebases
218.90 - private static final Map codeBaseCacheRef = new WeakHashMap();
218.91 + private static final Map<Class<?>, URL> codeBaseCacheRef =
218.92 + new WeakHashMap<>();
218.93
218.94 /*
218.95 * Retuns the CodeBase for the given class.
218.96 */
218.97 - static URL getCodeBase(final Class clazz) {
218.98 - URL url = (URL)codeBaseCacheRef.get(clazz);
218.99 + static URL getCodeBase(final Class<?> clazz) {
218.100 + URL url = codeBaseCacheRef.get(clazz);
218.101 if (url == null) {
218.102 - url = (URL)AccessController.doPrivileged(new PrivilegedAction() {
218.103 - public Object run() {
218.104 + url = AccessController.doPrivileged(new PrivilegedAction<URL>() {
218.105 + public URL run() {
218.106 ProtectionDomain pd = clazz.getProtectionDomain();
218.107 if (pd != null) {
218.108 CodeSource cs = pd.getCodeSource();
218.109 @@ -290,9 +290,9 @@
218.110
218.111 JarFile jf = new JarFile(jarPathName);
218.112
218.113 - Enumeration entries = jf.entries();
218.114 + Enumeration<JarEntry> entries = jf.entries();
218.115 while (entries.hasMoreElements()) {
218.116 - JarEntry je = (JarEntry)entries.nextElement();
218.117 + JarEntry je = entries.nextElement();
218.118 InputStream is = null;
218.119 try {
218.120 if (je.getName().startsWith("default_")) {
219.1 --- a/src/share/classes/javax/crypto/JceSecurityManager.java Thu Sep 01 13:54:38 2011 -0700
219.2 +++ b/src/share/classes/javax/crypto/JceSecurityManager.java Mon Sep 05 23:58:19 2011 -0700
219.3 @@ -1,5 +1,5 @@
219.4 /*
219.5 - * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
219.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
219.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
219.8 *
219.9 * This code is free software; you can redistribute it and/or modify it
219.10 @@ -28,7 +28,6 @@
219.11 import java.security.*;
219.12 import java.net.*;
219.13 import java.util.*;
219.14 -import java.util.jar.*;
219.15
219.16 /**
219.17 * The JCE security manager.
219.18 @@ -50,8 +49,10 @@
219.19 private static final CryptoPermissions defaultPolicy;
219.20 private static final CryptoPermissions exemptPolicy;
219.21 private static final CryptoAllPermission allPerm;
219.22 - private static final Vector TrustedCallersCache = new Vector(2);
219.23 - private static final Map exemptCache = new HashMap();
219.24 + private static final Vector<Class<?>> TrustedCallersCache =
219.25 + new Vector<>(2);
219.26 + private static final Map<URL, CryptoPermissions> exemptCache =
219.27 + new HashMap<>();
219.28
219.29 // singleton instance
219.30 static final JceSecurityManager INSTANCE;
219.31 @@ -60,12 +61,12 @@
219.32 defaultPolicy = JceSecurity.getDefaultPolicy();
219.33 exemptPolicy = JceSecurity.getExemptPolicy();
219.34 allPerm = CryptoAllPermission.INSTANCE;
219.35 - INSTANCE = (JceSecurityManager)
219.36 - AccessController.doPrivileged(new PrivilegedAction() {
219.37 - public Object run() {
219.38 - return new JceSecurityManager();
219.39 - }
219.40 - });
219.41 + INSTANCE = AccessController.doPrivileged(
219.42 + new PrivilegedAction<JceSecurityManager>() {
219.43 + public JceSecurityManager run() {
219.44 + return new JceSecurityManager();
219.45 + }
219.46 + });
219.47 }
219.48
219.49 private JceSecurityManager() {
219.50 @@ -94,11 +95,11 @@
219.51 // javax.crypto.* packages.
219.52 // NOTE: javax.crypto.* package maybe subject to package
219.53 // insertion, so need to check its classloader as well.
219.54 - Class[] context = getClassContext();
219.55 + Class<?>[] context = getClassContext();
219.56 URL callerCodeBase = null;
219.57 int i;
219.58 for (i=0; i<context.length; i++) {
219.59 - Class cls = context[i];
219.60 + Class<?> cls = context[i];
219.61 callerCodeBase = JceSecurity.getCodeBase(cls);
219.62 if (callerCodeBase != null) {
219.63 break;
219.64 @@ -119,7 +120,7 @@
219.65 CryptoPermissions appPerms;
219.66 synchronized (this.getClass()) {
219.67 if (exemptCache.containsKey(callerCodeBase)) {
219.68 - appPerms = (CryptoPermissions)exemptCache.get(callerCodeBase);
219.69 + appPerms = exemptCache.get(callerCodeBase);
219.70 } else {
219.71 appPerms = getAppPermissions(callerCodeBase);
219.72 exemptCache.put(callerCodeBase, appPerms);
219.73 @@ -143,7 +144,7 @@
219.74 if (appPc == null) {
219.75 return defaultPerm;
219.76 }
219.77 - Enumeration enum_ = appPc.elements();
219.78 + Enumeration<Permission> enum_ = appPc.elements();
219.79 while (enum_.hasMoreElements()) {
219.80 CryptoPermission cp = (CryptoPermission)enum_.nextElement();
219.81 if (cp.getExemptionMechanism() == null) {
219.82 @@ -215,7 +216,7 @@
219.83 * Returns the default permission for the given algorithm.
219.84 */
219.85 private CryptoPermission getDefaultPermission(String alg) {
219.86 - Enumeration enum_ =
219.87 + Enumeration<Permission> enum_ =
219.88 defaultPolicy.getPermissionCollection(alg).elements();
219.89 return (CryptoPermission)enum_.nextElement();
219.90 }
220.1 --- a/src/share/classes/javax/crypto/KeyAgreement.java Thu Sep 01 13:54:38 2011 -0700
220.2 +++ b/src/share/classes/javax/crypto/KeyAgreement.java Mon Sep 05 23:58:19 2011 -0700
220.3 @@ -93,7 +93,7 @@
220.4
220.5 // remaining services to try in provider selection
220.6 // null once provider is selected
220.7 - private Iterator serviceIterator;
220.8 + private Iterator<Service> serviceIterator;
220.9
220.10 private final Object lock;
220.11
220.12 @@ -112,7 +112,7 @@
220.13 lock = null;
220.14 }
220.15
220.16 - private KeyAgreement(Service s, Iterator t, String algorithm) {
220.17 + private KeyAgreement(Service s, Iterator<Service> t, String algorithm) {
220.18 firstService = s;
220.19 serviceIterator = t;
220.20 this.algorithm = algorithm;
220.21 @@ -165,11 +165,12 @@
220.22 */
220.23 public static final KeyAgreement getInstance(String algorithm)
220.24 throws NoSuchAlgorithmException {
220.25 - List services = GetInstance.getServices("KeyAgreement", algorithm);
220.26 + List<Service> services =
220.27 + GetInstance.getServices("KeyAgreement", algorithm);
220.28 // make sure there is at least one service from a signed provider
220.29 - Iterator t = services.iterator();
220.30 + Iterator<Service> t = services.iterator();
220.31 while (t.hasNext()) {
220.32 - Service s = (Service)t.next();
220.33 + Service s = t.next();
220.34 if (JceSecurity.canUseProvider(s.getProvider()) == false) {
220.35 continue;
220.36 }
220.37 @@ -301,7 +302,7 @@
220.38 s = firstService;
220.39 firstService = null;
220.40 } else {
220.41 - s = (Service)serviceIterator.next();
220.42 + s = serviceIterator.next();
220.43 }
220.44 if (JceSecurity.canUseProvider(s.getProvider()) == false) {
220.45 continue;
220.46 @@ -358,7 +359,7 @@
220.47 s = firstService;
220.48 firstService = null;
220.49 } else {
220.50 - s = (Service)serviceIterator.next();
220.51 + s = serviceIterator.next();
220.52 }
220.53 // if provider says it does not support this key, ignore it
220.54 if (s.supportsParameter(key) == false) {
221.1 --- a/src/share/classes/javax/crypto/KeyGenerator.java Thu Sep 01 13:54:38 2011 -0700
221.2 +++ b/src/share/classes/javax/crypto/KeyGenerator.java Mon Sep 05 23:58:19 2011 -0700
221.3 @@ -127,7 +127,7 @@
221.4
221.5 private final Object lock = new Object();
221.6
221.7 - private Iterator serviceIterator;
221.8 + private Iterator<Service> serviceIterator;
221.9
221.10 private int initType;
221.11 private int initKeySize;
221.12 @@ -150,7 +150,8 @@
221.13
221.14 private KeyGenerator(String algorithm) throws NoSuchAlgorithmException {
221.15 this.algorithm = algorithm;
221.16 - List list = GetInstance.getServices("KeyGenerator", algorithm);
221.17 + List<Service> list =
221.18 + GetInstance.getServices("KeyGenerator", algorithm);
221.19 serviceIterator = list.iterator();
221.20 initType = I_NONE;
221.21 // fetch and instantiate initial spi
221.22 @@ -320,7 +321,7 @@
221.23 return null;
221.24 }
221.25 while (serviceIterator.hasNext()) {
221.26 - Service s = (Service)serviceIterator.next();
221.27 + Service s = serviceIterator.next();
221.28 if (JceSecurity.canUseProvider(s.getProvider()) == false) {
221.29 continue;
221.30 }
222.1 --- a/src/share/classes/javax/crypto/Mac.java Thu Sep 01 13:54:38 2011 -0700
222.2 +++ b/src/share/classes/javax/crypto/Mac.java Mon Sep 05 23:58:19 2011 -0700
222.3 @@ -95,7 +95,7 @@
222.4
222.5 // remaining services to try in provider selection
222.6 // null once provider is selected
222.7 - private Iterator serviceIterator;
222.8 + private Iterator<Service> serviceIterator;
222.9
222.10 private final Object lock;
222.11
222.12 @@ -114,7 +114,7 @@
222.13 lock = null;
222.14 }
222.15
222.16 - private Mac(Service s, Iterator t, String algorithm) {
222.17 + private Mac(Service s, Iterator<Service> t, String algorithm) {
222.18 firstService = s;
222.19 serviceIterator = t;
222.20 this.algorithm = algorithm;
222.21 @@ -163,11 +163,11 @@
222.22 */
222.23 public static final Mac getInstance(String algorithm)
222.24 throws NoSuchAlgorithmException {
222.25 - List services = GetInstance.getServices("Mac", algorithm);
222.26 + List<Service> services = GetInstance.getServices("Mac", algorithm);
222.27 // make sure there is at least one service from a signed provider
222.28 - Iterator t = services.iterator();
222.29 + Iterator<Service> t = services.iterator();
222.30 while (t.hasNext()) {
222.31 - Service s = (Service)t.next();
222.32 + Service s = t.next();
222.33 if (JceSecurity.canUseProvider(s.getProvider()) == false) {
222.34 continue;
222.35 }
222.36 @@ -288,7 +288,7 @@
222.37 s = firstService;
222.38 firstService = null;
222.39 } else {
222.40 - s = (Service)serviceIterator.next();
222.41 + s = serviceIterator.next();
222.42 }
222.43 if (JceSecurity.canUseProvider(s.getProvider()) == false) {
222.44 continue;
222.45 @@ -331,7 +331,7 @@
222.46 s = firstService;
222.47 firstService = null;
222.48 } else {
222.49 - s = (Service)serviceIterator.next();
222.50 + s = serviceIterator.next();
222.51 }
222.52 // if provider says it does not support this key, ignore it
222.53 if (s.supportsParameter(key) == false) {
223.1 --- a/src/share/classes/javax/crypto/SealedObject.java Thu Sep 01 13:54:38 2011 -0700
223.2 +++ b/src/share/classes/javax/crypto/SealedObject.java Mon Sep 05 23:58:19 2011 -0700
223.3 @@ -1,5 +1,5 @@
223.4 /*
223.5 - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
223.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
223.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
223.8 *
223.9 * This code is free software; you can redistribute it and/or modify it
223.10 @@ -193,11 +193,11 @@
223.11 * @exception NullPointerException if the given sealed object is null.
223.12 */
223.13 protected SealedObject(SealedObject so) {
223.14 - this.encryptedContent = (byte[]) so.encryptedContent.clone();
223.15 + this.encryptedContent = so.encryptedContent.clone();
223.16 this.sealAlg = so.sealAlg;
223.17 this.paramsAlg = so.paramsAlg;
223.18 if (so.encodedParams != null) {
223.19 - this.encodedParams = (byte[]) so.encodedParams.clone();
223.20 + this.encodedParams = so.encodedParams.clone();
223.21 } else {
223.22 this.encodedParams = null;
223.23 }
223.24 @@ -353,10 +353,8 @@
223.25
223.26 try {
223.27 return unseal(key, provider);
223.28 - } catch (IllegalBlockSizeException ibse) {
223.29 - throw new InvalidKeyException(ibse.getMessage());
223.30 - } catch (BadPaddingException bpe) {
223.31 - throw new InvalidKeyException(bpe.getMessage());
223.32 + } catch (IllegalBlockSizeException | BadPaddingException ex) {
223.33 + throw new InvalidKeyException(ex.getMessage());
223.34 }
223.35 }
223.36
223.37 @@ -450,9 +448,9 @@
223.38 {
223.39 s.defaultReadObject();
223.40 if (encryptedContent != null)
223.41 - encryptedContent = (byte[])encryptedContent.clone();
223.42 + encryptedContent = encryptedContent.clone();
223.43 if (encodedParams != null)
223.44 - encodedParams = (byte[])encodedParams.clone();
223.45 + encodedParams = encodedParams.clone();
223.46 }
223.47 }
223.48
223.49 @@ -465,7 +463,7 @@
223.50 super(in);
223.51 }
223.52
223.53 - protected Class resolveClass(ObjectStreamClass v)
223.54 + protected Class<?> resolveClass(ObjectStreamClass v)
223.55 throws IOException, ClassNotFoundException
223.56 {
223.57
224.1 --- a/src/share/classes/javax/crypto/SecretKeyFactory.java Thu Sep 01 13:54:38 2011 -0700
224.2 +++ b/src/share/classes/javax/crypto/SecretKeyFactory.java Mon Sep 05 23:58:19 2011 -0700
224.3 @@ -96,7 +96,7 @@
224.4
224.5 // remaining services to try in provider selection
224.6 // null once provider is selected
224.7 - private Iterator serviceIterator;
224.8 + private Iterator<Service> serviceIterator;
224.9
224.10 /**
224.11 * Creates a SecretKeyFactory object.
224.12 @@ -114,7 +114,8 @@
224.13
224.14 private SecretKeyFactory(String algorithm) throws NoSuchAlgorithmException {
224.15 this.algorithm = algorithm;
224.16 - List list = GetInstance.getServices("SecretKeyFactory", algorithm);
224.17 + List<Service> list =
224.18 + GetInstance.getServices("SecretKeyFactory", algorithm);
224.19 serviceIterator = list.iterator();
224.20 // fetch and instantiate initial spi
224.21 if (nextSpi(null) == null) {
224.22 @@ -290,7 +291,7 @@
224.23 return null;
224.24 }
224.25 while (serviceIterator.hasNext()) {
224.26 - Service s = (Service)serviceIterator.next();
224.27 + Service s = serviceIterator.next();
224.28 if (JceSecurity.canUseProvider(s.getProvider()) == false) {
224.29 continue;
224.30 }
224.31 @@ -367,7 +368,7 @@
224.32 * (e.g., the given key has an algorithm or format not supported by this
224.33 * secret-key factory).
224.34 */
224.35 - public final KeySpec getKeySpec(SecretKey key, Class keySpec)
224.36 + public final KeySpec getKeySpec(SecretKey key, Class<?> keySpec)
224.37 throws InvalidKeySpecException {
224.38 if (serviceIterator == null) {
224.39 return spi.engineGetKeySpec(key, keySpec);
225.1 --- a/src/share/classes/javax/crypto/SecretKeyFactorySpi.java Thu Sep 01 13:54:38 2011 -0700
225.2 +++ b/src/share/classes/javax/crypto/SecretKeyFactorySpi.java Mon Sep 05 23:58:19 2011 -0700
225.3 @@ -1,5 +1,5 @@
225.4 /*
225.5 - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
225.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
225.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
225.8 *
225.9 * This code is free software; you can redistribute it and/or modify it
225.10 @@ -88,7 +88,7 @@
225.11 * (e.g., the given key has an algorithm or format not supported by this
225.12 * secret-key factory).
225.13 */
225.14 - protected abstract KeySpec engineGetKeySpec(SecretKey key, Class keySpec)
225.15 + protected abstract KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpec)
225.16 throws InvalidKeySpecException;
225.17
225.18 /**
226.1 --- a/src/share/classes/javax/crypto/spec/DESKeySpec.java Thu Sep 01 13:54:38 2011 -0700
226.2 +++ b/src/share/classes/javax/crypto/spec/DESKeySpec.java Mon Sep 05 23:58:19 2011 -0700
226.3 @@ -1,5 +1,5 @@
226.4 /*
226.5 - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
226.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
226.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
226.8 *
226.9 * This code is free software; you can redistribute it and/or modify it
226.10 @@ -165,7 +165,7 @@
226.11 * each time this method is called.
226.12 */
226.13 public byte[] getKey() {
226.14 - return (byte[])this.key.clone();
226.15 + return this.key.clone();
226.16 }
226.17
226.18 /**
227.1 --- a/src/share/classes/javax/crypto/spec/DESedeKeySpec.java Thu Sep 01 13:54:38 2011 -0700
227.2 +++ b/src/share/classes/javax/crypto/spec/DESedeKeySpec.java Mon Sep 05 23:58:19 2011 -0700
227.3 @@ -1,5 +1,5 @@
227.4 /*
227.5 - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
227.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
227.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
227.8 *
227.9 * This code is free software; you can redistribute it and/or modify it
227.10 @@ -95,7 +95,7 @@
227.11 * each time this method is called.
227.12 */
227.13 public byte[] getKey() {
227.14 - return (byte[])this.key.clone();
227.15 + return this.key.clone();
227.16 }
227.17
227.18 /**
228.1 --- a/src/share/classes/javax/crypto/spec/IvParameterSpec.java Thu Sep 01 13:54:38 2011 -0700
228.2 +++ b/src/share/classes/javax/crypto/spec/IvParameterSpec.java Mon Sep 05 23:58:19 2011 -0700
228.3 @@ -1,5 +1,5 @@
228.4 /*
228.5 - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
228.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
228.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
228.8 *
228.9 * This code is free software; you can redistribute it and/or modify it
228.10 @@ -94,6 +94,6 @@
228.11 * each time this method is called.
228.12 */
228.13 public byte[] getIV() {
228.14 - return (byte[])this.iv.clone();
228.15 + return this.iv.clone();
228.16 }
228.17 }
229.1 --- a/src/share/classes/javax/crypto/spec/PBEKeySpec.java Thu Sep 01 13:54:38 2011 -0700
229.2 +++ b/src/share/classes/javax/crypto/spec/PBEKeySpec.java Mon Sep 05 23:58:19 2011 -0700
229.3 @@ -1,5 +1,5 @@
229.4 /*
229.5 - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
229.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
229.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
229.8 *
229.9 * This code is free software; you can redistribute it and/or modify it
229.10 @@ -80,7 +80,7 @@
229.11 if ((password == null) || (password.length == 0)) {
229.12 this.password = new char[0];
229.13 } else {
229.14 - this.password = (char[])password.clone();
229.15 + this.password = password.clone();
229.16 }
229.17 }
229.18
229.19 @@ -109,7 +109,7 @@
229.20 if ((password == null) || (password.length == 0)) {
229.21 this.password = new char[0];
229.22 } else {
229.23 - this.password = (char[])password.clone();
229.24 + this.password = password.clone();
229.25 }
229.26 if (salt == null) {
229.27 throw new NullPointerException("the salt parameter " +
229.28 @@ -118,7 +118,7 @@
229.29 throw new IllegalArgumentException("the salt parameter " +
229.30 "must not be empty");
229.31 } else {
229.32 - this.salt = (byte[]) salt.clone();
229.33 + this.salt = salt.clone();
229.34 }
229.35 if (iterationCount<=0) {
229.36 throw new IllegalArgumentException("invalid iterationCount value");
229.37 @@ -151,7 +151,7 @@
229.38 if ((password == null) || (password.length == 0)) {
229.39 this.password = new char[0];
229.40 } else {
229.41 - this.password = (char[])password.clone();
229.42 + this.password = password.clone();
229.43 }
229.44 if (salt == null) {
229.45 throw new NullPointerException("the salt parameter " +
229.46 @@ -160,7 +160,7 @@
229.47 throw new IllegalArgumentException("the salt parameter " +
229.48 "must not be empty");
229.49 } else {
229.50 - this.salt = (byte[]) salt.clone();
229.51 + this.salt = salt.clone();
229.52 }
229.53 if (iterationCount<=0) {
229.54 throw new IllegalArgumentException("invalid iterationCount value");
229.55 @@ -196,7 +196,7 @@
229.56 if (password == null) {
229.57 throw new IllegalStateException("password has been cleared");
229.58 }
229.59 - return (char[]) password.clone();
229.60 + return password.clone();
229.61 }
229.62
229.63 /**
229.64 @@ -210,7 +210,7 @@
229.65 */
229.66 public final byte[] getSalt() {
229.67 if (salt != null) {
229.68 - return (byte[]) salt.clone();
229.69 + return salt.clone();
229.70 } else {
229.71 return null;
229.72 }
230.1 --- a/src/share/classes/javax/crypto/spec/PBEParameterSpec.java Thu Sep 01 13:54:38 2011 -0700
230.2 +++ b/src/share/classes/javax/crypto/spec/PBEParameterSpec.java Mon Sep 05 23:58:19 2011 -0700
230.3 @@ -1,5 +1,5 @@
230.4 /*
230.5 - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
230.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
230.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
230.8 *
230.9 * This code is free software; you can redistribute it and/or modify it
230.10 @@ -25,7 +25,6 @@
230.11
230.12 package javax.crypto.spec;
230.13
230.14 -import java.math.BigInteger;
230.15 import java.security.spec.AlgorithmParameterSpec;
230.16
230.17 /**
230.18 @@ -53,7 +52,7 @@
230.19 * @exception NullPointerException if <code>salt</code> is null.
230.20 */
230.21 public PBEParameterSpec(byte[] salt, int iterationCount) {
230.22 - this.salt = (byte[])salt.clone();
230.23 + this.salt = salt.clone();
230.24 this.iterationCount = iterationCount;
230.25 }
230.26
230.27 @@ -64,7 +63,7 @@
230.28 * each time this method is called.
230.29 */
230.30 public byte[] getSalt() {
230.31 - return (byte[])this.salt.clone();
230.32 + return this.salt.clone();
230.33 }
230.34
230.35 /**
231.1 --- a/src/share/classes/javax/crypto/spec/PSource.java Thu Sep 01 13:54:38 2011 -0700
231.2 +++ b/src/share/classes/javax/crypto/spec/PSource.java Mon Sep 05 23:58:19 2011 -0700
231.3 @@ -1,5 +1,5 @@
231.4 /*
231.5 - * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
231.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
231.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
231.8 *
231.9 * This code is free software; you can redistribute it and/or modify it
231.10 @@ -25,9 +25,6 @@
231.11
231.12 package javax.crypto.spec;
231.13
231.14 -import java.math.BigInteger;
231.15 -import java.security.spec.AlgorithmParameterSpec;
231.16 -
231.17 /**
231.18 * This class specifies the source for encoding input P in OAEP Padding,
231.19 * as defined in the
231.20 @@ -97,7 +94,7 @@
231.21 */
231.22 public PSpecified(byte[] p) {
231.23 super("PSpecified");
231.24 - this.p = (byte[]) p.clone();
231.25 + this.p = p.clone();
231.26 }
231.27 /**
231.28 * Returns the value of encoding input P.
231.29 @@ -105,7 +102,7 @@
231.30 * returned each time this method is called.
231.31 */
231.32 public byte[] getValue() {
231.33 - return (p.length==0? p: (byte[])p.clone());
231.34 + return (p.length==0? p: p.clone());
231.35 }
231.36 }
231.37 }
232.1 --- a/src/share/classes/javax/crypto/spec/RC2ParameterSpec.java Thu Sep 01 13:54:38 2011 -0700
232.2 +++ b/src/share/classes/javax/crypto/spec/RC2ParameterSpec.java Mon Sep 05 23:58:19 2011 -0700
232.3 @@ -1,5 +1,5 @@
232.4 /*
232.5 - * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
232.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
232.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
232.8 *
232.9 * This code is free software; you can redistribute it and/or modify it
232.10 @@ -117,7 +117,7 @@
232.11 * Returns a new array each time this method is called.
232.12 */
232.13 public byte[] getIV() {
232.14 - return (iv == null? null:(byte[])iv.clone());
232.15 + return (iv == null? null:iv.clone());
232.16 }
232.17
232.18 /**
233.1 --- a/src/share/classes/javax/crypto/spec/RC5ParameterSpec.java Thu Sep 01 13:54:38 2011 -0700
233.2 +++ b/src/share/classes/javax/crypto/spec/RC5ParameterSpec.java Mon Sep 05 23:58:19 2011 -0700
233.3 @@ -1,5 +1,5 @@
233.4 /*
233.5 - * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
233.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
233.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
233.8 *
233.9 * This code is free software; you can redistribute it and/or modify it
233.10 @@ -157,7 +157,7 @@
233.11 * Returns a new array each time this method is called.
233.12 */
233.13 public byte[] getIV() {
233.14 - return (iv == null? null:(byte[])iv.clone());
233.15 + return (iv == null? null:iv.clone());
233.16 }
233.17
233.18 /**
234.1 --- a/src/share/classes/javax/crypto/spec/SecretKeySpec.java Thu Sep 01 13:54:38 2011 -0700
234.2 +++ b/src/share/classes/javax/crypto/spec/SecretKeySpec.java Mon Sep 05 23:58:19 2011 -0700
234.3 @@ -1,5 +1,5 @@
234.4 /*
234.5 - * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
234.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
234.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
234.8 *
234.9 * This code is free software; you can redistribute it and/or modify it
234.10 @@ -25,8 +25,6 @@
234.11
234.12 package javax.crypto.spec;
234.13
234.14 -import java.io.UnsupportedEncodingException;
234.15 -import java.security.Key;
234.16 import java.security.spec.KeySpec;
234.17 import javax.crypto.SecretKey;
234.18
234.19 @@ -95,7 +93,7 @@
234.20 if (key.length == 0) {
234.21 throw new IllegalArgumentException("Empty key");
234.22 }
234.23 - this.key = (byte[])key.clone();
234.24 + this.key = key.clone();
234.25 this.algorithm = algorithm;
234.26 }
234.27
234.28 @@ -181,7 +179,7 @@
234.29 * each time this method is called.
234.30 */
234.31 public byte[] getEncoded() {
234.32 - return (byte[])this.key.clone();
234.33 + return this.key.clone();
234.34 }
234.35
234.36 /**
235.1 --- a/src/share/classes/javax/naming/CompositeName.java Thu Sep 01 13:54:38 2011 -0700
235.2 +++ b/src/share/classes/javax/naming/CompositeName.java Mon Sep 05 23:58:19 2011 -0700
235.3 @@ -1,5 +1,5 @@
235.4 /*
235.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
235.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
235.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
235.8 *
235.9 * This code is free software; you can redistribute it and/or modify it
235.10 @@ -394,7 +394,7 @@
235.11 * If posn is outside the specified range.
235.12 */
235.13 public Name getPrefix(int posn) {
235.14 - Enumeration comps = impl.getPrefix(posn);
235.15 + Enumeration<String> comps = impl.getPrefix(posn);
235.16 return (new CompositeName(comps));
235.17 }
235.18
235.19 @@ -412,7 +412,7 @@
235.20 * If posn is outside the specified range.
235.21 */
235.22 public Name getSuffix(int posn) {
235.23 - Enumeration comps = impl.getSuffix(posn);
235.24 + Enumeration<String> comps = impl.getSuffix(posn);
235.25 return (new CompositeName(comps));
235.26 }
235.27
235.28 @@ -563,7 +563,7 @@
235.29 private void writeObject(java.io.ObjectOutputStream s)
235.30 throws java.io.IOException {
235.31 s.writeInt(size());
235.32 - Enumeration comps = getAll();
235.33 + Enumeration<String> comps = getAll();
235.34 while (comps.hasMoreElements()) {
235.35 s.writeObject(comps.nextElement());
235.36 }
236.1 --- a/src/share/classes/javax/naming/CompoundName.java Thu Sep 01 13:54:38 2011 -0700
236.2 +++ b/src/share/classes/javax/naming/CompoundName.java Mon Sep 05 23:58:19 2011 -0700
236.3 @@ -1,5 +1,5 @@
236.4 /*
236.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
236.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
236.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
236.8 *
236.9 * This code is free software; you can redistribute it and/or modify it
236.10 @@ -376,7 +376,7 @@
236.11 * If posn is outside the specified range.
236.12 */
236.13 public Name getPrefix(int posn) {
236.14 - Enumeration comps = impl.getPrefix(posn);
236.15 + Enumeration<String> comps = impl.getPrefix(posn);
236.16 return (new CompoundName(comps, mySyntax));
236.17 }
236.18
236.19 @@ -396,7 +396,7 @@
236.20 * If posn is outside the specified range.
236.21 */
236.22 public Name getSuffix(int posn) {
236.23 - Enumeration comps = impl.getSuffix(posn);
236.24 + Enumeration<String> comps = impl.getSuffix(posn);
236.25 return (new CompoundName(comps, mySyntax));
236.26 }
236.27
236.28 @@ -557,7 +557,7 @@
236.29 throws java.io.IOException {
236.30 s.writeObject(mySyntax);
236.31 s.writeInt(size());
236.32 - Enumeration comps = getAll();
236.33 + Enumeration<String> comps = getAll();
236.34 while (comps.hasMoreElements()) {
236.35 s.writeObject(comps.nextElement());
236.36 }
237.1 --- a/src/share/classes/javax/naming/InitialContext.java Thu Sep 01 13:54:38 2011 -0700
237.2 +++ b/src/share/classes/javax/naming/InitialContext.java Mon Sep 05 23:58:19 2011 -0700
237.3 @@ -1,5 +1,5 @@
237.4 /*
237.5 - * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
237.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
237.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
237.8 *
237.9 * This code is free software; you can redistribute it and/or modify it
237.10 @@ -232,10 +232,12 @@
237.11 * @see #InitialContext(boolean)
237.12 * @since 1.3
237.13 */
237.14 + @SuppressWarnings("unchecked")
237.15 protected void init(Hashtable<?,?> environment)
237.16 throws NamingException
237.17 {
237.18 - myProps = ResourceManager.getInitialEnvironment(environment);
237.19 + myProps = (Hashtable<Object,Object>)
237.20 + ResourceManager.getInitialEnvironment(environment);
237.21
237.22 if (myProps.get(Context.INITIAL_CONTEXT_FACTORY) != null) {
237.23 // user has specified initial context factory; try to get it
237.24 @@ -265,6 +267,7 @@
237.25 * @see #lookup(Name)
237.26 * @since 1.6
237.27 */
237.28 + @SuppressWarnings("unchecked")
237.29 public static <T> T doLookup(Name name)
237.30 throws NamingException {
237.31 return (T) (new InitialContext()).lookup(name);
237.32 @@ -279,6 +282,7 @@
237.33 * @throws NamingException if a naming exception is encountered
237.34 * @since 1.6
237.35 */
237.36 + @SuppressWarnings("unchecked")
237.37 public static <T> T doLookup(String name)
237.38 throws NamingException {
237.39 return (T) (new InitialContext()).lookup(name);
238.1 --- a/src/share/classes/javax/naming/NameImpl.java Thu Sep 01 13:54:38 2011 -0700
238.2 +++ b/src/share/classes/javax/naming/NameImpl.java Mon Sep 05 23:58:19 2011 -0700
238.3 @@ -1,5 +1,5 @@
238.4 /*
238.5 - * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
238.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
238.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
238.8 *
238.9 * This code is free software; you can redistribute it and/or modify it
238.10 @@ -25,6 +25,7 @@
238.11
238.12 package javax.naming;
238.13
238.14 +import java.util.Locale;
238.15 import java.util.Vector;
238.16 import java.util.Enumeration;
238.17 import java.util.Properties;
238.18 @@ -45,7 +46,7 @@
238.19 private static final byte RIGHT_TO_LEFT = 2;
238.20 private static final byte FLAT = 0;
238.21
238.22 - private Vector components;
238.23 + private Vector<String> components;
238.24
238.25 private byte syntaxDirection = LEFT_TO_RIGHT;
238.26 private String syntaxSeparator = "/";
238.27 @@ -97,7 +98,7 @@
238.28 return (i);
238.29 }
238.30
238.31 - private final int extractComp(String name, int i, int len, Vector comps)
238.32 + private final int extractComp(String name, int i, int len, Vector<String> comps)
238.33 throws InvalidNameException {
238.34 String beginQuote;
238.35 String endQuote;
238.36 @@ -216,7 +217,8 @@
238.37 }
238.38
238.39 private static boolean toBoolean(String name) {
238.40 - return ((name != null) && name.toLowerCase().equals("true"));
238.41 + return ((name != null) &&
238.42 + name.toLowerCase(Locale.ENGLISH).equals("true"));
238.43 }
238.44
238.45 private final void recordNamingConvention(Properties p) {
238.46 @@ -270,7 +272,7 @@
238.47 if (syntax != null) {
238.48 recordNamingConvention(syntax);
238.49 }
238.50 - components = new Vector();
238.51 + components = new Vector<>();
238.52 }
238.53
238.54 NameImpl(Properties syntax, String n) throws InvalidNameException {
238.55 @@ -284,8 +286,8 @@
238.56 i = extractComp(n, i, len, components);
238.57
238.58 String comp = rToL
238.59 - ? (String)components.firstElement()
238.60 - : (String)components.lastElement();
238.61 + ? components.firstElement()
238.62 + : components.lastElement();
238.63 if (comp.length() >= 1) {
238.64 compsAllEmpty = false;
238.65 }
238.66 @@ -304,7 +306,7 @@
238.67 }
238.68 }
238.69
238.70 - NameImpl(Properties syntax, Enumeration comps) {
238.71 + NameImpl(Properties syntax, Enumeration<String> comps) {
238.72 this(syntax);
238.73
238.74 // %% comps could shrink in the middle.
238.75 @@ -455,9 +457,9 @@
238.76 for (int i = 0; i < size; i++) {
238.77 if (syntaxDirection == RIGHT_TO_LEFT) {
238.78 comp =
238.79 - stringifyComp((String) components.elementAt(size - 1 - i));
238.80 + stringifyComp(components.elementAt(size - 1 - i));
238.81 } else {
238.82 - comp = stringifyComp((String) components.elementAt(i));
238.83 + comp = stringifyComp(components.elementAt(i));
238.84 }
238.85 if ((i != 0) && (syntaxSeparator != null))
238.86 answer.append(syntaxSeparator);
238.87 @@ -474,12 +476,12 @@
238.88 if ((obj != null) && (obj instanceof NameImpl)) {
238.89 NameImpl target = (NameImpl)obj;
238.90 if (target.size() == this.size()) {
238.91 - Enumeration mycomps = getAll();
238.92 - Enumeration comps = target.getAll();
238.93 + Enumeration<String> mycomps = getAll();
238.94 + Enumeration<String> comps = target.getAll();
238.95 while (mycomps.hasMoreElements()) {
238.96 // %% comps could shrink in the middle.
238.97 - String my = (String)mycomps.nextElement();
238.98 - String his = (String)comps.nextElement();
238.99 + String my = mycomps.nextElement();
238.100 + String his = comps.nextElement();
238.101 if (syntaxTrimBlanks) {
238.102 my = my.trim();
238.103 his = his.trim();
238.104 @@ -526,11 +528,14 @@
238.105 comp1 = comp1.trim();
238.106 comp2 = comp2.trim();
238.107 }
238.108 +
238.109 + int local;
238.110 if (syntaxCaseInsensitive) {
238.111 - comp1 = comp1.toLowerCase();
238.112 - comp2 = comp2.toLowerCase();
238.113 + local = comp1.compareToIgnoreCase(comp2);
238.114 + } else {
238.115 + local = comp1.compareTo(comp2);
238.116 }
238.117 - int local = comp1.compareTo(comp2);
238.118 +
238.119 if (local != 0) {
238.120 return local;
238.121 }
238.122 @@ -543,22 +548,22 @@
238.123 return (components.size());
238.124 }
238.125
238.126 - public Enumeration getAll() {
238.127 + public Enumeration<String> getAll() {
238.128 return components.elements();
238.129 }
238.130
238.131 public String get(int posn) {
238.132 - return ((String) components.elementAt(posn));
238.133 + return components.elementAt(posn);
238.134 }
238.135
238.136 - public Enumeration getPrefix(int posn) {
238.137 + public Enumeration<String> getPrefix(int posn) {
238.138 if (posn < 0 || posn > size()) {
238.139 throw new ArrayIndexOutOfBoundsException(posn);
238.140 }
238.141 return new NameImplEnumerator(components, 0, posn);
238.142 }
238.143
238.144 - public Enumeration getSuffix(int posn) {
238.145 + public Enumeration<String> getSuffix(int posn) {
238.146 int cnt = size();
238.147 if (posn < 0 || posn > cnt) {
238.148 throw new ArrayIndexOutOfBoundsException(posn);
238.149 @@ -570,15 +575,15 @@
238.150 return (components.isEmpty());
238.151 }
238.152
238.153 - public boolean startsWith(int posn, Enumeration prefix) {
238.154 + public boolean startsWith(int posn, Enumeration<String> prefix) {
238.155 if (posn < 0 || posn > size()) {
238.156 return false;
238.157 }
238.158 try {
238.159 - Enumeration mycomps = getPrefix(posn);
238.160 + Enumeration<String> mycomps = getPrefix(posn);
238.161 while (mycomps.hasMoreElements()) {
238.162 - String my = (String)mycomps.nextElement();
238.163 - String his = (String)prefix.nextElement();
238.164 + String my = mycomps.nextElement();
238.165 + String his = prefix.nextElement();
238.166 if (syntaxTrimBlanks) {
238.167 my = my.trim();
238.168 his = his.trim();
238.169 @@ -597,7 +602,7 @@
238.170 return true;
238.171 }
238.172
238.173 - public boolean endsWith(int posn, Enumeration suffix) {
238.174 + public boolean endsWith(int posn, Enumeration<String> suffix) {
238.175 // posn is number of elements in suffix
238.176 // startIndex is the starting position in this name
238.177 // at which to start the comparison. It is calculated by
238.178 @@ -607,10 +612,10 @@
238.179 return false;
238.180 }
238.181 try {
238.182 - Enumeration mycomps = getSuffix(startIndex);
238.183 + Enumeration<String> mycomps = getSuffix(startIndex);
238.184 while (mycomps.hasMoreElements()) {
238.185 - String my = (String)mycomps.nextElement();
238.186 - String his = (String)suffix.nextElement();
238.187 + String my = mycomps.nextElement();
238.188 + String his = suffix.nextElement();
238.189 if (syntaxTrimBlanks) {
238.190 my = my.trim();
238.191 his = his.trim();
238.192 @@ -629,11 +634,11 @@
238.193 return true;
238.194 }
238.195
238.196 - public boolean addAll(Enumeration comps) throws InvalidNameException {
238.197 + public boolean addAll(Enumeration<String> comps) throws InvalidNameException {
238.198 boolean added = false;
238.199 while (comps.hasMoreElements()) {
238.200 try {
238.201 - Object comp = comps.nextElement();
238.202 + String comp = comps.nextElement();
238.203 if (size() > 0 && syntaxDirection == FLAT) {
238.204 throw new InvalidNameException(
238.205 "A flat name can only have a single component");
238.206 @@ -647,12 +652,12 @@
238.207 return added;
238.208 }
238.209
238.210 - public boolean addAll(int posn, Enumeration comps)
238.211 + public boolean addAll(int posn, Enumeration<String> comps)
238.212 throws InvalidNameException {
238.213 boolean added = false;
238.214 for (int i = posn; comps.hasMoreElements(); i++) {
238.215 try {
238.216 - Object comp = comps.nextElement();
238.217 + String comp = comps.nextElement();
238.218 if (size() > 0 && syntaxDirection == FLAT) {
238.219 throw new InvalidNameException(
238.220 "A flat name can only have a single component");
238.221 @@ -690,13 +695,13 @@
238.222
238.223 public int hashCode() {
238.224 int hash = 0;
238.225 - for (Enumeration e = getAll(); e.hasMoreElements();) {
238.226 - String comp = (String)e.nextElement();
238.227 + for (Enumeration<String> e = getAll(); e.hasMoreElements();) {
238.228 + String comp = e.nextElement();
238.229 if (syntaxTrimBlanks) {
238.230 comp = comp.trim();
238.231 }
238.232 if (syntaxCaseInsensitive) {
238.233 - comp = comp.toLowerCase();
238.234 + comp = comp.toLowerCase(Locale.ENGLISH);
238.235 }
238.236
238.237 hash += comp.hashCode();
238.238 @@ -706,12 +711,12 @@
238.239 }
238.240
238.241 final
238.242 -class NameImplEnumerator implements Enumeration {
238.243 - Vector vector;
238.244 +class NameImplEnumerator implements Enumeration<String> {
238.245 + Vector<String> vector;
238.246 int count;
238.247 int limit;
238.248
238.249 - NameImplEnumerator(Vector v, int start, int lim) {
238.250 + NameImplEnumerator(Vector<String> v, int start, int lim) {
238.251 vector = v;
238.252 count = start;
238.253 limit = lim;
238.254 @@ -721,7 +726,7 @@
238.255 return count < limit;
238.256 }
238.257
238.258 - public Object nextElement() {
238.259 + public String nextElement() {
238.260 if (count < limit) {
238.261 return vector.elementAt(count++);
238.262 }
239.1 --- a/src/share/classes/javax/naming/Reference.java Thu Sep 01 13:54:38 2011 -0700
239.2 +++ b/src/share/classes/javax/naming/Reference.java Mon Sep 05 23:58:19 2011 -0700
239.3 @@ -1,5 +1,5 @@
239.4 /*
239.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
239.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
239.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
239.8 *
239.9 * This code is free software; you can redistribute it and/or modify it
239.10 @@ -120,7 +120,7 @@
239.11 */
239.12 public Reference(String className) {
239.13 this.className = className;
239.14 - addrs = new Vector();
239.15 + addrs = new Vector<>();
239.16 }
239.17
239.18 /**
239.19 @@ -134,7 +134,7 @@
239.20 */
239.21 public Reference(String className, RefAddr addr) {
239.22 this.className = className;
239.23 - addrs = new Vector();
239.24 + addrs = new Vector<>();
239.25 addrs.addElement(addr);
239.26 }
239.27
239.28 @@ -225,7 +225,7 @@
239.29 int len = addrs.size();
239.30 RefAddr addr;
239.31 for (int i = 0; i < len; i++) {
239.32 - addr = (RefAddr) addrs.elementAt(i);
239.33 + addr = addrs.elementAt(i);
239.34 if (addr.getType().compareTo(addrType) == 0)
239.35 return addr;
239.36 }
239.37 @@ -241,7 +241,7 @@
239.38 * range.
239.39 */
239.40 public RefAddr get(int posn) {
239.41 - return ((RefAddr) addrs.elementAt(posn));
239.42 + return addrs.elementAt(posn);
239.43 }
239.44
239.45 /**
239.46 @@ -331,8 +331,8 @@
239.47 // ignore factory information
239.48 if (target.className.equals(this.className) &&
239.49 target.size() == this.size()) {
239.50 - Enumeration mycomps = getAll();
239.51 - Enumeration comps = target.getAll();
239.52 + Enumeration<RefAddr> mycomps = getAll();
239.53 + Enumeration<RefAddr> comps = target.getAll();
239.54 while (mycomps.hasMoreElements())
239.55 if (!(mycomps.nextElement().equals(comps.nextElement())))
239.56 return false;
239.57 @@ -350,7 +350,7 @@
239.58 */
239.59 public int hashCode() {
239.60 int hash = className.hashCode();
239.61 - for (Enumeration e = getAll(); e.hasMoreElements();)
239.62 + for (Enumeration<RefAddr> e = getAll(); e.hasMoreElements();)
239.63 hash += e.nextElement().hashCode();
239.64 return hash;
239.65 }
239.66 @@ -382,7 +382,7 @@
239.67 public Object clone() {
239.68 Reference r = new Reference(className, classFactory, classFactoryLocation);
239.69 Enumeration<RefAddr> a = getAll();
239.70 - r.addrs = new Vector();
239.71 + r.addrs = new Vector<>();
239.72
239.73 while (a.hasMoreElements())
239.74 r.addrs.addElement(a.nextElement());
240.1 --- a/src/share/classes/javax/naming/directory/BasicAttribute.java Thu Sep 01 13:54:38 2011 -0700
240.2 +++ b/src/share/classes/javax/naming/directory/BasicAttribute.java Mon Sep 05 23:58:19 2011 -0700
240.3 @@ -1,5 +1,5 @@
240.4 /*
240.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
240.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
240.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
240.8 *
240.9 * This code is free software; you can redistribute it and/or modify it
240.10 @@ -91,6 +91,7 @@
240.11 */
240.12 protected boolean ordered = false;
240.13
240.14 + @SuppressWarnings("unchecked")
240.15 public Object clone() {
240.16 BasicAttribute attr;
240.17 try {
240.18 @@ -98,7 +99,7 @@
240.19 } catch (CloneNotSupportedException e) {
240.20 attr = new BasicAttribute(attrID, ordered);
240.21 }
240.22 - attr.values = (Vector)values.clone();
240.23 + attr.values = (Vector<Object>)values.clone();
240.24 return attr;
240.25 }
240.26
240.27 @@ -149,7 +150,7 @@
240.28 }
240.29 } else {
240.30 // order is not relevant; check for existence
240.31 - Enumeration theirs = target.getAll();
240.32 + Enumeration<?> theirs = target.getAll();
240.33 while (theirs.hasMoreElements()) {
240.34 if (find(theirs.nextElement()) < 0)
240.35 return false;
240.36 @@ -215,7 +216,7 @@
240.37 answer.append("No values");
240.38 } else {
240.39 boolean start = true;
240.40 - for (Enumeration e = values.elements(); e.hasMoreElements(); ) {
240.41 + for (Enumeration<Object> e = values.elements(); e.hasMoreElements(); ) {
240.42 if (!start)
240.43 answer.append(", ");
240.44 answer.append(e.nextElement());
240.45 @@ -254,7 +255,7 @@
240.46 */
240.47 public BasicAttribute(String id, boolean ordered) {
240.48 attrID = id;
240.49 - values = new Vector();
240.50 + values = new Vector<>();
240.51 this.ordered = ordered;
240.52 }
240.53
240.54 @@ -327,7 +328,7 @@
240.55 // For finding first element that has a null in JDK1.1 Vector.
240.56 // In the Java 2 platform, can just replace this with Vector.indexOf(target);
240.57 private int find(Object target) {
240.58 - Class cl;
240.59 + Class<?> cl;
240.60 if (target == null) {
240.61 int ct = values.size();
240.62 for (int i = 0 ; i < ct ; i++) {
240.63 @@ -514,7 +515,7 @@
240.64 throws java.io.IOException, ClassNotFoundException {
240.65 s.defaultReadObject(); // read in the attrID
240.66 int n = s.readInt(); // number of values
240.67 - values = new Vector(n);
240.68 + values = new Vector<>(n);
240.69 while (--n >= 0) {
240.70 values.addElement(s.readObject());
240.71 }
240.72 @@ -522,31 +523,31 @@
240.73
240.74
240.75 class ValuesEnumImpl implements NamingEnumeration<Object> {
240.76 - Enumeration list;
240.77 + Enumeration<Object> list;
240.78
240.79 - ValuesEnumImpl() {
240.80 - list = values.elements();
240.81 - }
240.82 + ValuesEnumImpl() {
240.83 + list = values.elements();
240.84 + }
240.85
240.86 - public boolean hasMoreElements() {
240.87 - return list.hasMoreElements();
240.88 - }
240.89 + public boolean hasMoreElements() {
240.90 + return list.hasMoreElements();
240.91 + }
240.92
240.93 - public Object nextElement() {
240.94 - return(list.nextElement());
240.95 - }
240.96 + public Object nextElement() {
240.97 + return(list.nextElement());
240.98 + }
240.99
240.100 - public Object next() throws NamingException {
240.101 - return list.nextElement();
240.102 - }
240.103 + public Object next() throws NamingException {
240.104 + return list.nextElement();
240.105 + }
240.106
240.107 - public boolean hasMore() throws NamingException {
240.108 - return list.hasMoreElements();
240.109 - }
240.110 + public boolean hasMore() throws NamingException {
240.111 + return list.hasMoreElements();
240.112 + }
240.113
240.114 - public void close() throws NamingException {
240.115 - list = null;
240.116 - }
240.117 + public void close() throws NamingException {
240.118 + list = null;
240.119 + }
240.120 }
240.121
240.122 /**
241.1 --- a/src/share/classes/javax/naming/directory/BasicAttributes.java Thu Sep 01 13:54:38 2011 -0700
241.2 +++ b/src/share/classes/javax/naming/directory/BasicAttributes.java Mon Sep 05 23:58:19 2011 -0700
241.3 @@ -1,5 +1,5 @@
241.4 /*
241.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
241.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
241.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
241.8 *
241.9 * This code is free software; you can redistribute it and/or modify it
241.10 @@ -28,6 +28,7 @@
241.11
241.12 import java.util.Hashtable;
241.13 import java.util.Enumeration;
241.14 +import java.util.Locale;
241.15
241.16 import javax.naming.NamingException;
241.17 import javax.naming.NamingEnumeration;
241.18 @@ -78,7 +79,7 @@
241.19 // If ignoreCase is true, key is aways lowercase.
241.20 // If ignoreCase is false, key is stored as supplied by put().
241.21 // %%% Not declared "private" due to bug 4064984.
241.22 - transient Hashtable attrs = new Hashtable(11);
241.23 + transient Hashtable<String,Attribute> attrs = new Hashtable<>(11);
241.24
241.25 /**
241.26 * Constructs a new instance of Attributes.
241.27 @@ -138,6 +139,7 @@
241.28 this.put(new BasicAttribute(attrID, val));
241.29 }
241.30
241.31 + @SuppressWarnings("unchecked")
241.32 public Object clone() {
241.33 BasicAttributes attrset;
241.34 try {
241.35 @@ -145,7 +147,7 @@
241.36 } catch (CloneNotSupportedException e) {
241.37 attrset = new BasicAttributes(ignoreCase);
241.38 }
241.39 - attrset.attrs = (Hashtable)attrs.clone();
241.40 + attrset.attrs = (Hashtable<String,Attribute>)attrs.clone();
241.41 return attrset;
241.42 }
241.43
241.44 @@ -158,8 +160,8 @@
241.45 }
241.46
241.47 public Attribute get(String attrID) {
241.48 - Attribute attr = (Attribute) attrs.get(
241.49 - ignoreCase ? attrID.toLowerCase() : attrID);
241.50 + Attribute attr = attrs.get(
241.51 + ignoreCase ? attrID.toLowerCase(Locale.ENGLISH) : attrID);
241.52 return (attr);
241.53 }
241.54
241.55 @@ -178,14 +180,14 @@
241.56 public Attribute put(Attribute attr) {
241.57 String id = attr.getID();
241.58 if (ignoreCase) {
241.59 - id = id.toLowerCase();
241.60 + id = id.toLowerCase(Locale.ENGLISH);
241.61 }
241.62 - return (Attribute)attrs.put(id, attr);
241.63 + return attrs.put(id, attr);
241.64 }
241.65
241.66 public Attribute remove(String attrID) {
241.67 - String id = (ignoreCase ? attrID.toLowerCase() : attrID);
241.68 - return (Attribute)attrs.remove(id);
241.69 + String id = (ignoreCase ? attrID.toLowerCase(Locale.ENGLISH) : attrID);
241.70 + return attrs.remove(id);
241.71 }
241.72
241.73 /**
241.74 @@ -234,7 +236,7 @@
241.75 if (size() == target.size()) {
241.76 Attribute their, mine;
241.77 try {
241.78 - NamingEnumeration theirs = target.getAll();
241.79 + NamingEnumeration<?> theirs = target.getAll();
241.80 while (theirs.hasMore()) {
241.81 their = (Attribute)theirs.next();
241.82 mine = get(their.getID());
241.83 @@ -268,7 +270,7 @@
241.84 public int hashCode() {
241.85 int hash = (ignoreCase ? 1 : 0);
241.86 try {
241.87 - NamingEnumeration all = getAll();
241.88 + NamingEnumeration<?> all = getAll();
241.89 while (all.hasMore()) {
241.90 hash += all.next().hashCode();
241.91 }
241.92 @@ -286,7 +288,7 @@
241.93 throws java.io.IOException {
241.94 s.defaultWriteObject(); // write out the ignoreCase flag
241.95 s.writeInt(attrs.size());
241.96 - Enumeration attrEnum = attrs.elements();
241.97 + Enumeration<Attribute> attrEnum = attrs.elements();
241.98 while (attrEnum.hasMoreElements()) {
241.99 s.writeObject(attrEnum.nextElement());
241.100 }
241.101 @@ -300,8 +302,8 @@
241.102 s.defaultReadObject(); // read in the ignoreCase flag
241.103 int n = s.readInt(); // number of attributes
241.104 attrs = (n >= 1)
241.105 - ? new Hashtable(n * 2)
241.106 - : new Hashtable(2); // can't have initial size of 0 (grrr...)
241.107 + ? new Hashtable<String,Attribute>(n * 2)
241.108 + : new Hashtable<String,Attribute>(2); // can't have initial size of 0 (grrr...)
241.109 while (--n >= 0) {
241.110 put((Attribute)s.readObject());
241.111 }
242.1 --- a/src/share/classes/javax/naming/ldap/InitialLdapContext.java Thu Sep 01 13:54:38 2011 -0700
242.2 +++ b/src/share/classes/javax/naming/ldap/InitialLdapContext.java Mon Sep 05 23:58:19 2011 -0700
242.3 @@ -1,5 +1,5 @@
242.4 /*
242.5 - * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
242.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
242.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
242.8 *
242.9 * This code is free software; you can redistribute it and/or modify it
242.10 @@ -129,15 +129,16 @@
242.11 * @see #reconnect
242.12 * @see LdapContext#reconnect
242.13 */
242.14 + @SuppressWarnings("unchecked")
242.15 public InitialLdapContext(Hashtable<?,?> environment,
242.16 Control[] connCtls)
242.17 throws NamingException {
242.18 super(true); // don't initialize yet
242.19
242.20 // Clone environment since caller owns it.
242.21 - Hashtable env = (environment == null)
242.22 - ? new Hashtable(11)
242.23 - : (Hashtable)environment.clone();
242.24 + Hashtable<Object,Object> env = (environment == null)
242.25 + ? new Hashtable<>(11)
242.26 + : (Hashtable<Object,Object>)environment.clone();
242.27
242.28 // Put connect controls into environment. Copy them first since
242.29 // caller owns the array.
243.1 --- a/src/share/classes/javax/naming/ldap/LdapName.java Thu Sep 01 13:54:38 2011 -0700
243.2 +++ b/src/share/classes/javax/naming/ldap/LdapName.java Mon Sep 05 23:58:19 2011 -0700
243.3 @@ -1,5 +1,5 @@
243.4 /*
243.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
243.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
243.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
243.8 *
243.9 * This code is free software; you can redistribute it and/or modify it
243.10 @@ -104,9 +104,7 @@
243.11
243.12 public class LdapName implements Name {
243.13
243.14 - // private transient ArrayList<Rdn> rdns; // parsed name components
243.15 -
243.16 - private transient ArrayList rdns; // parsed name components
243.17 + private transient List<Rdn> rdns; // parsed name components
243.18 private transient String unparsed; // if non-null, the DN in unparsed form
243.19 private static final long serialVersionUID = -1595520034788997356L;
243.20
243.21 @@ -144,14 +142,14 @@
243.22 // "Invalid entries, list entries must be of type Rdn");
243.23 // }
243.24
243.25 - this.rdns = new ArrayList(rdns.size());
243.26 + this.rdns = new ArrayList<>(rdns.size());
243.27 for (int i = 0; i < rdns.size(); i++) {
243.28 Object obj = rdns.get(i);
243.29 if (!(obj instanceof Rdn)) {
243.30 throw new IllegalArgumentException("Entry:" + obj +
243.31 " not a valid type;list entries must be of type Rdn");
243.32 }
243.33 - this.rdns.add(obj);
243.34 + this.rdns.add((Rdn)obj);
243.35 }
243.36 }
243.37
243.38 @@ -161,14 +159,12 @@
243.39 * (if "name" is not null), the unparsed DN.
243.40 *
243.41 */
243.42 - // private LdapName(String name, List<Rdn> rdns, int beg, int end) {
243.43 -
243.44 - private LdapName(String name, ArrayList rdns, int beg, int end) {
243.45 + private LdapName(String name, List<Rdn> rdns, int beg, int end) {
243.46 unparsed = name;
243.47 // this.rdns = rdns.subList(beg, end);
243.48
243.49 - List sList = rdns.subList(beg, end);
243.50 - this.rdns = new ArrayList(sList);
243.51 + List<Rdn> sList = rdns.subList(beg, end);
243.52 + this.rdns = new ArrayList<>(sList);
243.53 }
243.54
243.55 /**
243.56 @@ -201,7 +197,7 @@
243.57 * Each element of the enumeration is of class String.
243.58 */
243.59 public Enumeration<String> getAll() {
243.60 - final Iterator iter = rdns.iterator();
243.61 + final Iterator<Rdn> iter = rdns.iterator();
243.62
243.63 return new Enumeration<String>() {
243.64 public boolean hasMoreElements() {
243.65 @@ -234,7 +230,7 @@
243.66 * specified range.
243.67 */
243.68 public Rdn getRdn(int posn) {
243.69 - return (Rdn) rdns.get(posn);
243.70 + return rdns.get(posn);
243.71 }
243.72
243.73 /**
243.74 @@ -370,7 +366,7 @@
243.75 doesListMatch(len1 - len2, len1, rdns));
243.76 }
243.77
243.78 - private boolean doesListMatch(int beg, int end, List rdns) {
243.79 + private boolean doesListMatch(int beg, int end, List<Rdn> rdns) {
243.80 for (int i = beg; i < end; i++) {
243.81 if (!this.rdns.get(i).equals(rdns.get(i - beg))) {
243.82 return false;
243.83 @@ -457,10 +453,10 @@
243.84 LdapName s = (LdapName) suffix;
243.85 rdns.addAll(posn, s.rdns);
243.86 } else {
243.87 - Enumeration comps = suffix.getAll();
243.88 + Enumeration<String> comps = suffix.getAll();
243.89 while (comps.hasMoreElements()) {
243.90 rdns.add(posn++,
243.91 - (new Rfc2253Parser((String) comps.nextElement()).
243.92 + (new Rfc2253Parser(comps.nextElement()).
243.93 parseRdn()));
243.94 }
243.95 }
243.96 @@ -489,7 +485,7 @@
243.97 throw new IllegalArgumentException("Entry:" + obj +
243.98 " not a valid type;suffix list entries must be of type Rdn");
243.99 }
243.100 - rdns.add(i + posn, obj);
243.101 + rdns.add(i + posn, (Rdn)obj);
243.102 }
243.103 return this;
243.104 }
243.105 @@ -627,11 +623,11 @@
243.106 StringBuilder builder = new StringBuilder();
243.107 int size = rdns.size();
243.108 if ((size - 1) >= 0) {
243.109 - builder.append((Rdn) rdns.get(size - 1));
243.110 + builder.append(rdns.get(size - 1));
243.111 }
243.112 for (int next = size - 2; next >= 0; next--) {
243.113 builder.append(',');
243.114 - builder.append((Rdn) rdns.get(next));
243.115 + builder.append(rdns.get(next));
243.116 }
243.117 unparsed = builder.toString();
243.118 return unparsed;
243.119 @@ -672,8 +668,8 @@
243.120 // Compare RDNs one by one for equality
243.121 for (int i = 0; i < rdns.size(); i++) {
243.122 // Compare a single pair of RDNs.
243.123 - Rdn rdn1 = (Rdn) rdns.get(i);
243.124 - Rdn rdn2 = (Rdn) that.rdns.get(i);
243.125 + Rdn rdn1 = rdns.get(i);
243.126 + Rdn rdn2 = that.rdns.get(i);
243.127 if (!rdn1.equals(rdn2)) {
243.128 return false;
243.129 }
243.130 @@ -727,8 +723,8 @@
243.131 int minSize = Math.min(rdns.size(), that.rdns.size());
243.132 for (int i = 0; i < minSize; i++) {
243.133 // Compare a single pair of RDNs.
243.134 - Rdn rdn1 = (Rdn)rdns.get(i);
243.135 - Rdn rdn2 = (Rdn)that.rdns.get(i);
243.136 + Rdn rdn1 = rdns.get(i);
243.137 + Rdn rdn2 = that.rdns.get(i);
243.138
243.139 int diff = rdn1.compareTo(rdn2);
243.140 if (diff != 0) {
243.141 @@ -752,7 +748,7 @@
243.142
243.143 // For each RDN...
243.144 for (int i = 0; i < rdns.size(); i++) {
243.145 - Rdn rdn = (Rdn) rdns.get(i);
243.146 + Rdn rdn = rdns.get(i);
243.147 hash += rdn.hashCode();
243.148 }
243.149 return hash;
243.150 @@ -786,6 +782,6 @@
243.151 private void parse() throws InvalidNameException {
243.152 // rdns = (ArrayList<Rdn>) (new RFC2253Parser(unparsed)).getDN();
243.153
243.154 - rdns = (ArrayList) (new Rfc2253Parser(unparsed)).parseDn();
243.155 + rdns = new Rfc2253Parser(unparsed).parseDn();
243.156 }
243.157 }
244.1 --- a/src/share/classes/javax/naming/ldap/Rdn.java Thu Sep 01 13:54:38 2011 -0700
244.2 +++ b/src/share/classes/javax/naming/ldap/Rdn.java Mon Sep 05 23:58:19 2011 -0700
244.3 @@ -1,5 +1,5 @@
244.4 /*
244.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
244.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
244.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
244.8 *
244.9 * This code is free software; you can redistribute it and/or modify it
244.10 @@ -28,6 +28,7 @@
244.11 import java.util.Iterator;
244.12 import java.util.NoSuchElementException;
244.13 import java.util.ArrayList;
244.14 +import java.util.Locale;
244.15 import java.util.Collections;
244.16
244.17 import javax.naming.InvalidNameException;
244.18 @@ -104,8 +105,7 @@
244.19
244.20 public class Rdn implements Serializable, Comparable<Object> {
244.21
244.22 - // private transient ArrayList<RdnEntry> entries;
244.23 - private transient ArrayList entries;
244.24 + private transient ArrayList<RdnEntry> entries;
244.25
244.26 // The common case.
244.27 private static final int DEFAULT_SIZE = 1;
244.28 @@ -130,12 +130,12 @@
244.29 if (attrSet.size() == 0) {
244.30 throw new InvalidNameException("Attributes cannot be empty");
244.31 }
244.32 - entries = new ArrayList(attrSet.size());
244.33 - NamingEnumeration attrs = attrSet.getAll();
244.34 + entries = new ArrayList<>(attrSet.size());
244.35 + NamingEnumeration<? extends Attribute> attrs = attrSet.getAll();
244.36 try {
244.37 for (int nEntries = 0; attrs.hasMore(); nEntries++) {
244.38 RdnEntry entry = new RdnEntry();
244.39 - Attribute attr = (Attribute) attrs.next();
244.40 + Attribute attr = attrs.next();
244.41 entry.type = attr.getID();
244.42 entry.value = attr.get();
244.43 entries.add(nEntries, entry);
244.44 @@ -161,7 +161,7 @@
244.45 * parsing of the rdnString.
244.46 */
244.47 public Rdn(String rdnString) throws InvalidNameException {
244.48 - entries = new ArrayList(DEFAULT_SIZE);
244.49 + entries = new ArrayList<>(DEFAULT_SIZE);
244.50 (new Rfc2253Parser(rdnString)).parseRdn(this);
244.51 }
244.52
244.53 @@ -172,7 +172,7 @@
244.54 * @param rdn The non-null Rdn to be copied.
244.55 */
244.56 public Rdn(Rdn rdn) {
244.57 - entries = new ArrayList(rdn.entries.size());
244.58 + entries = new ArrayList<>(rdn.entries.size());
244.59 entries.addAll(rdn.entries);
244.60 }
244.61
244.62 @@ -199,7 +199,7 @@
244.63 "type or value cannot be empty, type:" + type +
244.64 " value:" + value);
244.65 }
244.66 - entries = new ArrayList(DEFAULT_SIZE);
244.67 + entries = new ArrayList<>(DEFAULT_SIZE);
244.68 put(type, value);
244.69 }
244.70
244.71 @@ -210,7 +210,7 @@
244.72
244.73 // An empty constructor used by the parser
244.74 Rdn() {
244.75 - entries = new ArrayList(DEFAULT_SIZE);
244.76 + entries = new ArrayList<>(DEFAULT_SIZE);
244.77 }
244.78
244.79 /*
244.80 @@ -257,7 +257,7 @@
244.81 * @return The non-null attribute value.
244.82 */
244.83 public Object getValue() {
244.84 - return ((RdnEntry) entries.get(0)).getValue();
244.85 + return entries.get(0).getValue();
244.86 }
244.87
244.88 /**
244.89 @@ -275,7 +275,7 @@
244.90 * @return The non-null attribute type.
244.91 */
244.92 public String getType() {
244.93 - return ((RdnEntry) entries.get(0)).getType();
244.94 + return entries.get(0).getType();
244.95 }
244.96
244.97 /**
244.98 @@ -329,8 +329,7 @@
244.99 for (int i = 0; i < minSize; i++) {
244.100
244.101 // Compare a single pair of type/value pairs.
244.102 - int diff = ((RdnEntry) entries.get(i)).compareTo(
244.103 - that.entries.get(i));
244.104 + int diff = entries.get(i).compareTo(that.entries.get(i));
244.105 if (diff != 0) {
244.106 return diff;
244.107 }
244.108 @@ -408,7 +407,7 @@
244.109 public Attributes toAttributes() {
244.110 Attributes attrs = new BasicAttributes(true);
244.111 for (int i = 0; i < entries.size(); i++) {
244.112 - RdnEntry entry = (RdnEntry) entries.get(i);
244.113 + RdnEntry entry = entries.get(i);
244.114 Attribute attr = attrs.put(entry.getType(), entry.getValue());
244.115 if (attr != null) {
244.116 attr.add(entry.getValue());
244.117 @@ -419,7 +418,7 @@
244.118 }
244.119
244.120
244.121 - private static class RdnEntry implements Comparable {
244.122 + private static class RdnEntry implements Comparable<RdnEntry> {
244.123 private String type;
244.124 private Object value;
244.125
244.126 @@ -435,14 +434,8 @@
244.127 return value;
244.128 }
244.129
244.130 - public int compareTo(Object obj) {
244.131 -
244.132 - // Any change here affecting equality must be
244.133 - // reflected in hashCode().
244.134 - RdnEntry that = (RdnEntry) obj;
244.135 -
244.136 - int diff = type.toUpperCase().compareTo(
244.137 - that.type.toUpperCase());
244.138 + public int compareTo(RdnEntry that) {
244.139 + int diff = type.compareToIgnoreCase(that.type);
244.140 if (diff != 0) {
244.141 return diff;
244.142 }
244.143 @@ -469,7 +462,7 @@
244.144 }
244.145
244.146 public int hashCode() {
244.147 - return (type.toUpperCase().hashCode() +
244.148 + return (type.toUpperCase(Locale.ENGLISH).hashCode() +
244.149 getValueComparable().hashCode());
244.150 }
244.151
244.152 @@ -486,7 +479,7 @@
244.153 if (value instanceof byte[]) {
244.154 comparable = escapeBinaryValue((byte[]) value);
244.155 } else {
244.156 - comparable = ((String) value).toUpperCase();
244.157 + comparable = ((String) value).toUpperCase(Locale.ENGLISH);
244.158 }
244.159 return comparable;
244.160 }
244.161 @@ -576,7 +569,6 @@
244.162 builder.append(Character.forDigit(0xF & b, 16));
244.163 }
244.164 return builder.toString();
244.165 - // return builder.toString().toUpperCase();
244.166 }
244.167
244.168 /**
244.169 @@ -755,7 +747,7 @@
244.170 private void readObject(ObjectInputStream s)
244.171 throws IOException, ClassNotFoundException {
244.172 s.defaultReadObject();
244.173 - entries = new ArrayList(DEFAULT_SIZE);
244.174 + entries = new ArrayList<>(DEFAULT_SIZE);
244.175 String unparsed = (String) s.readObject();
244.176 try {
244.177 (new Rfc2253Parser(unparsed)).parseRdn(this);
245.1 --- a/src/share/classes/javax/naming/ldap/Rfc2253Parser.java Thu Sep 01 13:54:38 2011 -0700
245.2 +++ b/src/share/classes/javax/naming/ldap/Rfc2253Parser.java Mon Sep 05 23:58:19 2011 -0700
245.3 @@ -1,5 +1,5 @@
245.4 /*
245.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
245.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
245.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
245.8 *
245.9 * This code is free software; you can redistribute it and/or modify it
245.10 @@ -54,14 +54,14 @@
245.11 */
245.12 // public List<Rdn> getDN() throws InvalidNameException {
245.13
245.14 - List parseDn() throws InvalidNameException {
245.15 + List<Rdn> parseDn() throws InvalidNameException {
245.16 cur = 0;
245.17
245.18 // ArrayList<Rdn> rdns =
245.19 // new ArrayList<Rdn>(len / 3 + 10); // leave room for growth
245.20
245.21 - ArrayList rdns =
245.22 - new ArrayList(len / 3 + 10); // leave room for growth
245.23 + ArrayList<Rdn> rdns =
245.24 + new ArrayList<>(len / 3 + 10); // leave room for growth
245.25
245.26 if (len == 0) {
245.27 return rdns;
246.1 --- a/src/share/classes/javax/naming/ldap/StartTlsRequest.java Thu Sep 01 13:54:38 2011 -0700
246.2 +++ b/src/share/classes/javax/naming/ldap/StartTlsRequest.java Mon Sep 05 23:58:19 2011 -0700
246.3 @@ -1,5 +1,5 @@
246.4 /*
246.5 - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
246.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
246.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
246.8 *
246.9 * This code is free software; you can redistribute it and/or modify it
246.10 @@ -192,7 +192,7 @@
246.11 }
246.12 try {
246.13 VersionHelper helper = VersionHelper.getVersionHelper();
246.14 - Class clas = helper.loadClass(
246.15 + Class<?> clas = helper.loadClass(
246.16 "com.sun.jndi.ldap.ext.StartTlsResponseImpl");
246.17
246.18 resp = (StartTlsResponse) clas.newInstance();
246.19 @@ -226,19 +226,19 @@
246.20 * Acquire the class loader associated with this thread.
246.21 */
246.22 private final ClassLoader getContextClassLoader() {
246.23 - return (ClassLoader) AccessController.doPrivileged(
246.24 - new PrivilegedAction() {
246.25 - public Object run() {
246.26 + return AccessController.doPrivileged(
246.27 + new PrivilegedAction<ClassLoader>() {
246.28 + public ClassLoader run() {
246.29 return Thread.currentThread().getContextClassLoader();
246.30 }
246.31 }
246.32 );
246.33 }
246.34
246.35 - private final static boolean privilegedHasNext(final Iterator iter) {
246.36 - Boolean answer = (Boolean) AccessController.doPrivileged(
246.37 - new PrivilegedAction() {
246.38 - public Object run() {
246.39 + private final static boolean privilegedHasNext(final Iterator<StartTlsResponse> iter) {
246.40 + Boolean answer = AccessController.doPrivileged(
246.41 + new PrivilegedAction<Boolean>() {
246.42 + public Boolean run() {
246.43 return Boolean.valueOf(iter.hasNext());
246.44 }
246.45 });
247.1 --- a/src/share/classes/javax/naming/spi/ContinuationContext.java Thu Sep 01 13:54:38 2011 -0700
247.2 +++ b/src/share/classes/javax/naming/spi/ContinuationContext.java Mon Sep 05 23:58:19 2011 -0700
247.3 @@ -1,5 +1,5 @@
247.4 /*
247.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
247.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
247.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
247.8 *
247.9 * This code is free software; you can redistribute it and/or modify it
247.10 @@ -38,11 +38,11 @@
247.11
247.12 class ContinuationContext implements Context, Resolver {
247.13 protected CannotProceedException cpe;
247.14 - protected Hashtable env;
247.15 + protected Hashtable<?,?> env;
247.16 protected Context contCtx = null;
247.17
247.18 protected ContinuationContext(CannotProceedException cpe,
247.19 - Hashtable env) {
247.20 + Hashtable<?,?> env) {
247.21 this.cpe = cpe;
247.22 this.env = env;
247.23 }
247.24 @@ -109,24 +109,24 @@
247.25 ctx.rename(name, newName);
247.26 }
247.27
247.28 - public NamingEnumeration list(Name name) throws NamingException {
247.29 + public NamingEnumeration<NameClassPair> list(Name name) throws NamingException {
247.30 Context ctx = getTargetContext();
247.31 return ctx.list(name);
247.32 }
247.33 - public NamingEnumeration list(String name) throws NamingException {
247.34 + public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
247.35 Context ctx = getTargetContext();
247.36 return ctx.list(name);
247.37 }
247.38
247.39
247.40 - public NamingEnumeration listBindings(Name name)
247.41 + public NamingEnumeration<Binding> listBindings(Name name)
247.42 throws NamingException
247.43 {
247.44 Context ctx = getTargetContext();
247.45 return ctx.listBindings(name);
247.46 }
247.47
247.48 - public NamingEnumeration listBindings(String name) throws NamingException {
247.49 + public NamingEnumeration<Binding> listBindings(String name) throws NamingException {
247.50 Context ctx = getTargetContext();
247.51 return ctx.listBindings(name);
247.52 }
247.53 @@ -193,7 +193,7 @@
247.54 return ctx.removeFromEnvironment(propName);
247.55 }
247.56
247.57 - public Hashtable getEnvironment() throws NamingException {
247.58 + public Hashtable<?,?> getEnvironment() throws NamingException {
247.59 Context ctx = getTargetContext();
247.60 return ctx.getEnvironment();
247.61 }
248.1 --- a/src/share/classes/javax/naming/spi/ContinuationDirContext.java Thu Sep 01 13:54:38 2011 -0700
248.2 +++ b/src/share/classes/javax/naming/spi/ContinuationDirContext.java Mon Sep 05 23:58:19 2011 -0700
248.3 @@ -1,5 +1,5 @@
248.4 /*
248.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
248.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
248.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
248.8 *
248.9 * This code is free software; you can redistribute it and/or modify it
248.10 @@ -38,6 +38,7 @@
248.11 import javax.naming.directory.DirContext;
248.12 import javax.naming.directory.Attributes;
248.13 import javax.naming.directory.SearchControls;
248.14 +import javax.naming.directory.SearchResult;
248.15 import javax.naming.directory.ModificationItem;
248.16
248.17 /**
248.18 @@ -50,7 +51,7 @@
248.19
248.20 class ContinuationDirContext extends ContinuationContext implements DirContext {
248.21
248.22 - ContinuationDirContext(CannotProceedException cpe, Hashtable env) {
248.23 + ContinuationDirContext(CannotProceedException cpe, Hashtable<?,?> env) {
248.24 super(cpe, env);
248.25 }
248.26
248.27 @@ -204,7 +205,7 @@
248.28 res.getDirContext().createSubcontext(res.getString(), attrs);
248.29 }
248.30
248.31 - public NamingEnumeration search(Name name,
248.32 + public NamingEnumeration<SearchResult> search(Name name,
248.33 Attributes matchingAttributes,
248.34 String[] attributesToReturn)
248.35 throws NamingException {
248.36 @@ -213,7 +214,7 @@
248.37 attributesToReturn);
248.38 }
248.39
248.40 - public NamingEnumeration search(String name,
248.41 + public NamingEnumeration<SearchResult> search(String name,
248.42 Attributes matchingAttributes,
248.43 String[] attributesToReturn)
248.44 throws NamingException {
248.45 @@ -223,13 +224,13 @@
248.46 attributesToReturn);
248.47 }
248.48
248.49 - public NamingEnumeration search(Name name,
248.50 + public NamingEnumeration<SearchResult> search(Name name,
248.51 Attributes matchingAttributes)
248.52 throws NamingException {
248.53 DirContextNamePair res = getTargetContext(name);
248.54 return res.getDirContext().search(res.getName(), matchingAttributes);
248.55 }
248.56 - public NamingEnumeration search(String name,
248.57 + public NamingEnumeration<SearchResult> search(String name,
248.58 Attributes matchingAttributes)
248.59 throws NamingException {
248.60 DirContextStringPair res = getTargetContext(name);
248.61 @@ -237,7 +238,7 @@
248.62 matchingAttributes);
248.63 }
248.64
248.65 - public NamingEnumeration search(Name name,
248.66 + public NamingEnumeration<SearchResult> search(Name name,
248.67 String filter,
248.68 SearchControls cons)
248.69 throws NamingException {
248.70 @@ -245,7 +246,7 @@
248.71 return res.getDirContext().search(res.getName(), filter, cons);
248.72 }
248.73
248.74 - public NamingEnumeration search(String name,
248.75 + public NamingEnumeration<SearchResult> search(String name,
248.76 String filter,
248.77 SearchControls cons)
248.78 throws NamingException {
248.79 @@ -253,7 +254,7 @@
248.80 return res.getDirContext().search(res.getString(), filter, cons);
248.81 }
248.82
248.83 - public NamingEnumeration search(Name name,
248.84 + public NamingEnumeration<SearchResult> search(Name name,
248.85 String filterExpr,
248.86 Object[] args,
248.87 SearchControls cons)
248.88 @@ -263,7 +264,7 @@
248.89 cons);
248.90 }
248.91
248.92 - public NamingEnumeration search(String name,
248.93 + public NamingEnumeration<SearchResult> search(String name,
248.94 String filterExpr,
248.95 Object[] args,
248.96 SearchControls cons)
249.1 --- a/src/share/classes/javax/naming/spi/DirectoryManager.java Thu Sep 01 13:54:38 2011 -0700
249.2 +++ b/src/share/classes/javax/naming/spi/DirectoryManager.java Mon Sep 05 23:58:19 2011 -0700
249.3 @@ -1,5 +1,5 @@
249.4 /*
249.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
249.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
249.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
249.8 *
249.9 * This code is free software; you can redistribute it and/or modify it
249.10 @@ -84,15 +84,16 @@
249.11 *
249.12 * @see NamingManager#getContinuationContext(CannotProceedException)
249.13 */
249.14 + @SuppressWarnings("unchecked")
249.15 public static DirContext getContinuationDirContext(
249.16 CannotProceedException cpe) throws NamingException {
249.17
249.18 - Hashtable env = cpe.getEnvironment();
249.19 + Hashtable<Object,Object> env = (Hashtable<Object,Object>)cpe.getEnvironment();
249.20 if (env == null) {
249.21 - env = new Hashtable(7);
249.22 + env = new Hashtable<>(7);
249.23 } else {
249.24 // Make a (shallow) copy of the environment.
249.25 - env = (Hashtable) env.clone();
249.26 + env = (Hashtable<Object,Object>) env.clone();
249.27 }
249.28 env.put(CPE, cpe);
249.29
249.30 @@ -217,7 +218,7 @@
249.31 }
249.32
249.33 private static Object createObjectFromFactories(Object obj, Name name,
249.34 - Context nameCtx, Hashtable environment, Attributes attrs)
249.35 + Context nameCtx, Hashtable<?,?> environment, Attributes attrs)
249.36 throws Exception {
249.37
249.38 FactoryEnumeration factories = ResourceManager.getFactories(
250.1 --- a/src/share/classes/javax/naming/spi/NamingManager.java Thu Sep 01 13:54:38 2011 -0700
250.2 +++ b/src/share/classes/javax/naming/spi/NamingManager.java Mon Sep 05 23:58:19 2011 -0700
250.3 @@ -1,5 +1,5 @@
250.4 /*
250.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
250.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
250.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
250.8 *
250.9 * This code is free software; you can redistribute it and/or modify it
250.10 @@ -139,7 +139,7 @@
250.11 throws IllegalAccessException,
250.12 InstantiationException,
250.13 MalformedURLException {
250.14 - Class clas = null;
250.15 + Class<?> clas = null;
250.16
250.17 // Try to use current class loader
250.18 try {
250.19 @@ -172,7 +172,7 @@
250.20 * @return factory created; null if cannot create
250.21 */
250.22 private static Object createObjectFromFactories(Object obj, Name name,
250.23 - Context nameCtx, Hashtable environment) throws Exception {
250.24 + Context nameCtx, Hashtable<?,?> environment) throws Exception {
250.25
250.26 FactoryEnumeration factories = ResourceManager.getFactories(
250.27 Context.OBJECT_FACTORIES, environment, nameCtx);
250.28 @@ -349,7 +349,7 @@
250.29 * invoking a factory.
250.30 */
250.31 static Object processURLAddrs(Reference ref, Name name, Context nameCtx,
250.32 - Hashtable environment)
250.33 + Hashtable<?,?> environment)
250.34 throws NamingException {
250.35
250.36 for (int i = 0; i < ref.size(); i++) {
250.37 @@ -368,7 +368,7 @@
250.38 }
250.39
250.40 private static Object processURL(Object refInfo, Name name,
250.41 - Context nameCtx, Hashtable environment)
250.42 + Context nameCtx, Hashtable<?,?> environment)
250.43 throws NamingException {
250.44 Object answer;
250.45
250.46 @@ -427,7 +427,7 @@
250.47 * @see #getObjectInstance
250.48 */
250.49 static Context getContext(Object obj, Name name, Context nameCtx,
250.50 - Hashtable environment) throws NamingException {
250.51 + Hashtable<?,?> environment) throws NamingException {
250.52 Object answer;
250.53
250.54 if (obj instanceof Context) {
250.55 @@ -452,7 +452,7 @@
250.56
250.57 // Used by ContinuationContext
250.58 static Resolver getResolver(Object obj, Name name, Context nameCtx,
250.59 - Hashtable environment) throws NamingException {
250.60 + Hashtable<?,?> environment) throws NamingException {
250.61 Object answer;
250.62
250.63 if (obj instanceof Resolver) {
250.64 @@ -585,7 +585,7 @@
250.65 */
250.66 private static Object getURLObject(String scheme, Object urlInfo,
250.67 Name name, Context nameCtx,
250.68 - Hashtable environment)
250.69 + Hashtable<?,?> environment)
250.70 throws NamingException {
250.71
250.72 // e.g. "ftpURLContextFactory"
250.73 @@ -771,15 +771,16 @@
250.74 * @return A non-null Context object for continuing the operation.
250.75 * @exception NamingException If a naming exception occurred.
250.76 */
250.77 + @SuppressWarnings("unchecked")
250.78 public static Context getContinuationContext(CannotProceedException cpe)
250.79 throws NamingException {
250.80
250.81 - Hashtable env = cpe.getEnvironment();
250.82 + Hashtable<Object,Object> env = (Hashtable<Object,Object>)cpe.getEnvironment();
250.83 if (env == null) {
250.84 - env = new Hashtable(7);
250.85 + env = new Hashtable<>(7);
250.86 } else {
250.87 // Make a (shallow) copy of the environment.
250.88 - env = (Hashtable) env.clone();
250.89 + env = (Hashtable<Object,Object>)env.clone();
250.90 }
250.91 env.put(CPE, cpe);
250.92
251.1 --- a/src/share/classes/javax/net/ssl/HttpsURLConnection.java Thu Sep 01 13:54:38 2011 -0700
251.2 +++ b/src/share/classes/javax/net/ssl/HttpsURLConnection.java Mon Sep 05 23:58:19 2011 -0700
251.3 @@ -144,8 +144,7 @@
251.4 throws SSLPeerUnverifiedException {
251.5
251.6 java.security.cert.Certificate[] certs = getServerCertificates();
251.7 - return ((X500Principal)
251.8 - ((X509Certificate)certs[0]).getSubjectX500Principal());
251.9 + return ((X509Certificate)certs[0]).getSubjectX500Principal();
251.10 }
251.11
251.12 /**
251.13 @@ -173,8 +172,7 @@
251.14
251.15 java.security.cert.Certificate[] certs = getLocalCertificates();
251.16 if (certs != null) {
251.17 - return ((X500Principal)
251.18 - ((X509Certificate)certs[0]).getSubjectX500Principal());
251.19 + return ((X509Certificate)certs[0]).getSubjectX500Principal();
251.20 } else {
251.21 return null;
251.22 }
252.1 --- a/src/share/classes/javax/sql/rowset/serial/SerialBlob.java Thu Sep 01 13:54:38 2011 -0700
252.2 +++ b/src/share/classes/javax/sql/rowset/serial/SerialBlob.java Mon Sep 05 23:58:19 2011 -0700
252.3 @@ -1,5 +1,5 @@
252.4 /*
252.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
252.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
252.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
252.8 *
252.9 * This code is free software; you can redistribute it and/or modify it
252.10 @@ -382,7 +382,7 @@
252.11 */
252.12 public java.io.OutputStream setBinaryStream(long pos)
252.13 throws SerialException, SQLException {
252.14 - if (this.blob.setBinaryStream(pos) != null) {
252.15 + if (this.blob != null) {
252.16 return this.blob.setBinaryStream(pos);
252.17 } else {
252.18 throw new SerialException("Unsupported operation. SerialBlob cannot " +
253.1 --- a/src/share/classes/javax/sql/rowset/serial/SerialClob.java Thu Sep 01 13:54:38 2011 -0700
253.2 +++ b/src/share/classes/javax/sql/rowset/serial/SerialClob.java Mon Sep 05 23:58:19 2011 -0700
253.3 @@ -436,7 +436,7 @@
253.4 */
253.5 public java.io.OutputStream setAsciiStream(long pos)
253.6 throws SerialException, SQLException {
253.7 - if (this.clob.setAsciiStream(pos) != null) {
253.8 + if (this.clob != null) {
253.9 return this.clob.setAsciiStream(pos);
253.10 } else {
253.11 throw new SerialException("Unsupported operation. SerialClob cannot " +
253.12 @@ -466,7 +466,7 @@
253.13 */
253.14 public java.io.Writer setCharacterStream(long pos)
253.15 throws SerialException, SQLException {
253.16 - if (this.clob.setCharacterStream(pos) != null) {
253.17 + if (this.clob != null) {
253.18 return this.clob.setCharacterStream(pos);
253.19 } else {
253.20 throw new SerialException("Unsupported operation. SerialClob cannot " +
254.1 --- a/src/share/classes/javax/swing/SwingUtilities.java Thu Sep 01 13:54:38 2011 -0700
254.2 +++ b/src/share/classes/javax/swing/SwingUtilities.java Mon Sep 05 23:58:19 2011 -0700
254.3 @@ -1274,8 +1274,7 @@
254.4 * <p>
254.5 * Additional documentation and examples for this method can be
254.6 * found in
254.7 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How to Use Threads</a>,
254.8 - * in <em>The Java Tutorial</em>.
254.9 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency in Swing</a>.
254.10 * <p>
254.11 * As of 1.3 this method is just a cover for <code>java.awt.EventQueue.invokeLater()</code>.
254.12 * <p>
254.13 @@ -1326,8 +1325,7 @@
254.14 * <p>
254.15 * Additional documentation and examples for this method can be
254.16 * found in
254.17 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How to Use Threads</a>,
254.18 - * in <em>The Java Tutorial</em>.
254.19 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency in Swing</a>.
254.20 * <p>
254.21 * As of 1.3 this method is just a cover for
254.22 * <code>java.awt.EventQueue.invokeAndWait()</code>.
255.1 --- a/src/share/classes/javax/swing/SwingWorker.java Thu Sep 01 13:54:38 2011 -0700
255.2 +++ b/src/share/classes/javax/swing/SwingWorker.java Mon Sep 05 23:58:19 2011 -0700
255.3 @@ -50,8 +50,8 @@
255.4 * When writing a multi-threaded application using Swing, there are
255.5 * two constraints to keep in mind:
255.6 * (refer to
255.7 - * <a href="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">
255.8 - * How to Use Threads
255.9 + * <a href="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">
255.10 + * Concurrency in Swing
255.11 * </a> for more details):
255.12 * <ul>
255.13 * <li> Time-consuming tasks should not be run on the <i>Event
256.1 --- a/src/share/classes/javax/swing/package.html Thu Sep 01 13:54:38 2011 -0700
256.2 +++ b/src/share/classes/javax/swing/package.html Mon Sep 05 23:58:19 2011 -0700
256.3 @@ -119,9 +119,9 @@
256.4 processing when working with Swing.
256.5 <p>
256.6 More information on this topic can be found in the
256.7 -<a href="http://java.sun.com/docs/books/tutorial/uiswing/">Swing tutorial</a>,
256.8 +<a href="http://download.oracle.com/javase/tutorial/uiswing/">Swing tutorial</a>,
256.9 in particular the section on
256.10 -<a href="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How to Use Threads</a>.
256.11 +<a href="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency in Swing</a>.
256.12
256.13
256.14 <H2>
257.1 --- a/src/share/classes/javax/swing/text/AbstractDocument.java Thu Sep 01 13:54:38 2011 -0700
257.2 +++ b/src/share/classes/javax/swing/text/AbstractDocument.java Mon Sep 05 23:58:19 2011 -0700
257.3 @@ -409,8 +409,8 @@
257.4 * <p>
257.5 * This method is thread safe, although most Swing methods
257.6 * are not. Please see
257.7 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How
257.8 - * to Use Threads</A> for more information.
257.9 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
257.10 + * in Swing</A> for more information.
257.11 *
257.12 * @param r the renderer to execute
257.13 */
257.14 @@ -570,8 +570,8 @@
257.15 * <p>
257.16 * This method is thread safe, although most Swing methods
257.17 * are not. Please see
257.18 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How
257.19 - * to Use Threads</A> for more information.
257.20 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
257.21 + * in Swing</A> for more information.
257.22 *
257.23 * @param offs the starting offset >= 0
257.24 * @param len the number of characters to remove >= 0
257.25 @@ -683,8 +683,8 @@
257.26 * <p>
257.27 * This method is thread safe, although most Swing methods
257.28 * are not. Please see
257.29 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How
257.30 - * to Use Threads</A> for more information.
257.31 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
257.32 + * in Swing</A> for more information.
257.33 *
257.34 * @param offs the starting offset >= 0
257.35 * @param str the string to insert; does nothing with null/empty strings
257.36 @@ -818,8 +818,8 @@
257.37 * <p>
257.38 * This method is thread safe, although most Swing methods
257.39 * are not. Please see
257.40 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How
257.41 - * to Use Threads</A> for more information.
257.42 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
257.43 + * in Swing</A> for more information.
257.44 *
257.45 * @param offs the position in the model >= 0
257.46 * @return the position
258.1 --- a/src/share/classes/javax/swing/text/DefaultCaret.java Thu Sep 01 13:54:38 2011 -0700
258.2 +++ b/src/share/classes/javax/swing/text/DefaultCaret.java Mon Sep 05 23:58:19 2011 -0700
258.3 @@ -237,8 +237,8 @@
258.4 * <p>
258.5 * This method is thread safe, although most Swing methods
258.6 * are not. Please see
258.7 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How
258.8 - * to Use Threads</A> for more information.
258.9 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
258.10 + * in Swing</A> for more information.
258.11 */
258.12 protected final synchronized void repaint() {
258.13 if (component != null) {
259.1 --- a/src/share/classes/javax/swing/text/DefaultStyledDocument.java Thu Sep 01 13:54:38 2011 -0700
259.2 +++ b/src/share/classes/javax/swing/text/DefaultStyledDocument.java Mon Sep 05 23:58:19 2011 -0700
259.3 @@ -173,8 +173,8 @@
259.4 * <p>
259.5 * This method is thread safe, although most Swing methods
259.6 * are not. Please see
259.7 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How
259.8 - * to Use Threads</A> for more information.
259.9 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
259.10 + * in Swing</A> for more information.
259.11 *
259.12 * @param offset the starting offset >= 0
259.13 * @param data the element data
259.14 @@ -426,8 +426,8 @@
259.15 * <p>
259.16 * This method is thread safe, although most Swing methods
259.17 * are not. Please see
259.18 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How
259.19 - * to Use Threads</A> for more information.
259.20 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
259.21 + * in Swing</A> for more information.
259.22 *
259.23 * @param pos the offset from the start of the document >= 0
259.24 * @param s the logical style to assign to the paragraph, null if none
259.25 @@ -483,8 +483,8 @@
259.26 * <p>
259.27 * This method is thread safe, although most Swing methods
259.28 * are not. Please see
259.29 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How
259.30 - * to Use Threads</A> for more information.
259.31 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
259.32 + * in Swing</A> for more information.
259.33 *
259.34 * @param offset the offset in the document >= 0
259.35 * @param length the length >= 0
259.36 @@ -536,8 +536,8 @@
259.37 * <p>
259.38 * This method is thread safe, although most Swing methods
259.39 * are not. Please see
259.40 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How
259.41 - * to Use Threads</A> for more information.
259.42 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
259.43 + * in Swing</A> for more information.
259.44 *
259.45 * @param offset the offset into the paragraph >= 0
259.46 * @param length the number of characters affected >= 0
260.1 --- a/src/share/classes/javax/swing/text/JTextComponent.java Thu Sep 01 13:54:38 2011 -0700
260.2 +++ b/src/share/classes/javax/swing/text/JTextComponent.java Mon Sep 05 23:58:19 2011 -0700
260.3 @@ -2213,8 +2213,8 @@
260.4 * <p>
260.5 * This method is thread-safe, although most Swing methods are not. Please
260.6 * see <A
260.7 - * HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">
260.8 - * How to Use Threads</A> for more information.
260.9 + * HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">
260.10 + * Concurrency in Swing</A> for more information.
260.11 *
260.12 * <p>
260.13 * <b>Sample Usage</b>. This code snippet shows a cross-platform print
260.14 @@ -2471,8 +2471,8 @@
260.15 * <p>
260.16 * This method is thread-safe, although most Swing methods are not. Please
260.17 * see <A
260.18 - * HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">
260.19 - * How to Use Threads</A> for more information.
260.20 + * HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">
260.21 + * Concurrency in Swing</A> for more information.
260.22 *
260.23 * <p>
260.24 * The returned {@code Printable} can be printed on any thread.
261.1 --- a/src/share/classes/javax/swing/text/PlainDocument.java Thu Sep 01 13:54:38 2011 -0700
261.2 +++ b/src/share/classes/javax/swing/text/PlainDocument.java Mon Sep 05 23:58:19 2011 -0700
261.3 @@ -100,8 +100,8 @@
261.4 * <p>
261.5 * This method is thread safe, although most Swing methods
261.6 * are not. Please see
261.7 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How
261.8 - * to Use Threads</A> for more information.
261.9 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
261.10 + * in Swing</A> for more information.
261.11 *
261.12 * @param offs the starting offset >= 0
261.13 * @param str the string to insert; does nothing with null/empty strings
262.1 --- a/src/share/classes/javax/swing/text/StyleContext.java Thu Sep 01 13:54:38 2011 -0700
262.2 +++ b/src/share/classes/javax/swing/text/StyleContext.java Mon Sep 05 23:58:19 2011 -0700
262.3 @@ -292,8 +292,8 @@
262.4 * <p>
262.5 * This method is thread safe, although most Swing methods
262.6 * are not. Please see
262.7 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How
262.8 - * to Use Threads</A> for more information.
262.9 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
262.10 + * in Swing</A> for more information.
262.11 *
262.12 * @param old the old attribute set
262.13 * @param name the non-null attribute name
262.14 @@ -321,8 +321,8 @@
262.15 * <p>
262.16 * This method is thread safe, although most Swing methods
262.17 * are not. Please see
262.18 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How
262.19 - * to Use Threads</A> for more information.
262.20 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
262.21 + * in Swing</A> for more information.
262.22 *
262.23 * @param old the old attribute set
262.24 * @param attr the attributes to add
262.25 @@ -349,8 +349,8 @@
262.26 * <p>
262.27 * This method is thread safe, although most Swing methods
262.28 * are not. Please see
262.29 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How
262.30 - * to Use Threads</A> for more information.
262.31 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
262.32 + * in Swing</A> for more information.
262.33 *
262.34 * @param old the old set of attributes
262.35 * @param name the non-null attribute name
262.36 @@ -377,8 +377,8 @@
262.37 * <p>
262.38 * This method is thread safe, although most Swing methods
262.39 * are not. Please see
262.40 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How
262.41 - * to Use Threads</A> for more information.
262.42 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
262.43 + * in Swing</A> for more information.
262.44 *
262.45 * @param old the old attribute set
262.46 * @param names the attribute names
262.47 @@ -405,8 +405,8 @@
262.48 * <p>
262.49 * This method is thread safe, although most Swing methods
262.50 * are not. Please see
262.51 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How
262.52 - * to Use Threads</A> for more information.
262.53 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
262.54 + * in Swing</A> for more information.
262.55 *
262.56 * @param old the old attribute set
262.57 * @param attrs the attributes
262.58 @@ -445,8 +445,8 @@
262.59 * <p>
262.60 * This method is thread safe, although most Swing methods
262.61 * are not. Please see
262.62 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How
262.63 - * to Use Threads</A> for more information.
262.64 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
262.65 + * in Swing</A> for more information.
262.66 *
262.67 * @param a the set to reclaim
262.68 */
263.1 --- a/src/share/classes/javax/swing/text/html/CSS.java Thu Sep 01 13:54:38 2011 -0700
263.2 +++ b/src/share/classes/javax/swing/text/html/CSS.java Mon Sep 05 23:58:19 2011 -0700
263.3 @@ -806,15 +806,11 @@
263.4 // translate border width into the cells, if it has non-zero value.
263.5 AttributeSet tableAttr = elem.getParentElement().
263.6 getParentElement().getAttributes();
263.7 - int borderWidth;
263.8 - try {
263.9 - borderWidth = Integer.parseInt(
263.10 - (String) tableAttr.getAttribute(HTML.Attribute.BORDER));
263.11 - } catch (NumberFormatException e) {
263.12 - borderWidth = 0;
263.13 - }
263.14 +
263.15 + int borderWidth = getTableBorder(tableAttr);
263.16 if (borderWidth > 0) {
263.17 - translateAttribute(HTML.Attribute.BORDER, tableAttr, cssAttrSet);
263.18 + // If table contains the BORDER attribute cells should have border width equals 1
263.19 + translateAttribute(HTML.Attribute.BORDER, "1", cssAttrSet);
263.20 }
263.21 String pad = (String)tableAttr.getAttribute(HTML.Attribute.CELLPADDING);
263.22 if (pad != null) {
263.23 @@ -850,6 +846,21 @@
263.24 return cssAttrSet;
263.25 }
263.26
263.27 + private static int getTableBorder(AttributeSet tableAttr) {
263.28 + String borderValue = (String) tableAttr.getAttribute(HTML.Attribute.BORDER);
263.29 +
263.30 + if (borderValue == HTML.NULL_ATTRIBUTE_VALUE || "".equals(borderValue)) {
263.31 + // Some browsers accept <TABLE BORDER> and <TABLE BORDER=""> with the same semantics as BORDER=1
263.32 + return 1;
263.33 + }
263.34 +
263.35 + try {
263.36 + return Integer.parseInt(borderValue);
263.37 + } catch (NumberFormatException e) {
263.38 + return 0;
263.39 + }
263.40 + }
263.41 +
263.42 private static final Hashtable<String, Attribute> attributeMap = new Hashtable<String, Attribute>();
263.43 private static final Hashtable<String, Value> valueMap = new Hashtable<String, Value>();
263.44
263.45 @@ -1400,17 +1411,20 @@
263.46 }
263.47 }
263.48 } else {
263.49 -
263.50 - /*
263.51 - * The html size attribute has a mapping in the CSS world only
263.52 - * if it is par of a font or base font tag.
263.53 - */
263.54 -
263.55 if (key == HTML.Attribute.SIZE && !isHTMLFontTag(tag)) {
263.56 - continue;
263.57 + /*
263.58 + * The html size attribute has a mapping in the CSS world only
263.59 + * if it is par of a font or base font tag.
263.60 + */
263.61 + } else if (tag == HTML.Tag.TABLE && key == HTML.Attribute.BORDER) {
263.62 + int borderWidth = getTableBorder(htmlAttrSet);
263.63 +
263.64 + if (borderWidth > 0) {
263.65 + translateAttribute(HTML.Attribute.BORDER, Integer.toString(borderWidth), cssAttrSet);
263.66 + }
263.67 + } else {
263.68 + translateAttribute(key, (String) htmlAttrSet.getAttribute(key), cssAttrSet);
263.69 }
263.70 -
263.71 - translateAttribute(key, htmlAttrSet, cssAttrSet);
263.72 }
263.73 } else if (name instanceof CSS.Attribute) {
263.74 cssAttrSet.addAttribute(name, htmlAttrSet.getAttribute(name));
263.75 @@ -1419,7 +1433,7 @@
263.76 }
263.77
263.78 private void translateAttribute(HTML.Attribute key,
263.79 - AttributeSet htmlAttrSet,
263.80 + String htmlAttrValue,
263.81 MutableAttributeSet cssAttrSet) {
263.82 /*
263.83 * In the case of all remaining HTML.Attribute's they
263.84 @@ -1427,8 +1441,6 @@
263.85 */
263.86 CSS.Attribute[] cssAttrList = getCssAttribute(key);
263.87
263.88 - String htmlAttrValue = (String)htmlAttrSet.getAttribute(key);
263.89 -
263.90 if (cssAttrList == null || htmlAttrValue == null) {
263.91 return;
263.92 }
264.1 --- a/src/share/classes/javax/swing/text/html/HTMLDocument.java Thu Sep 01 13:54:38 2011 -0700
264.2 +++ b/src/share/classes/javax/swing/text/html/HTMLDocument.java Mon Sep 05 23:58:19 2011 -0700
264.3 @@ -474,8 +474,8 @@
264.4 * <p>
264.5 * This method is thread safe, although most Swing methods
264.6 * are not. Please see
264.7 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How
264.8 - * to Use Threads</A> for more information.
264.9 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
264.10 + * in Swing</A> for more information.
264.11 *
264.12 * @param offset the offset into the paragraph (must be at least 0)
264.13 * @param length the number of characters affected (must be at least 0)
265.1 --- a/src/share/classes/javax/swing/text/html/TableView.java Thu Sep 01 13:54:38 2011 -0700
265.2 +++ b/src/share/classes/javax/swing/text/html/TableView.java Mon Sep 05 23:58:19 2011 -0700
265.3 @@ -242,7 +242,8 @@
265.4 if (lv != null) {
265.5 cellSpacing = (int) lv.getValue();
265.6 } else {
265.7 - cellSpacing = 0;
265.8 + // Default cell spacing equals 2
265.9 + cellSpacing = 2;
265.10 }
265.11 lv = (CSS.LengthValue)
265.12 attr.getAttribute(CSS.Attribute.BORDER_TOP_WIDTH);
265.13 @@ -251,8 +252,7 @@
265.14 } else {
265.15 borderWidth = 0;
265.16 }
265.17 -
265.18 - }
265.19 + }
265.20 }
265.21
265.22 /**
266.1 --- a/src/share/classes/sun/font/FontManagerFactory.java Thu Sep 01 13:54:38 2011 -0700
266.2 +++ b/src/share/classes/sun/font/FontManagerFactory.java Mon Sep 05 23:58:19 2011 -0700
266.3 @@ -78,20 +78,11 @@
266.4 ClassLoader cl = ClassLoader.getSystemClassLoader();
266.5 Class fmClass = Class.forName(fmClassName, true, cl);
266.6 instance = (FontManager) fmClass.newInstance();
266.7 - } catch (ClassNotFoundException ex) {
266.8 - InternalError err = new InternalError();
266.9 - err.initCause(ex);
266.10 - throw err;
266.11 + } catch (ClassNotFoundException |
266.12 + InstantiationException |
266.13 + IllegalAccessException ex) {
266.14 + throw new InternalError(ex);
266.15
266.16 - } catch (InstantiationException ex) {
266.17 - InternalError err = new InternalError();
266.18 - err.initCause(ex);
266.19 - throw err;
266.20 -
266.21 - } catch (IllegalAccessException ex) {
266.22 - InternalError err = new InternalError();
266.23 - err.initCause(ex);
266.24 - throw err;
266.25 }
266.26 return null;
266.27 }
267.1 --- a/src/share/classes/sun/io/ByteToCharASCII.java Thu Sep 01 13:54:38 2011 -0700
267.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
267.3 @@ -1,92 +0,0 @@
267.4 -/*
267.5 - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
267.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
267.7 - *
267.8 - * This code is free software; you can redistribute it and/or modify it
267.9 - * under the terms of the GNU General Public License version 2 only, as
267.10 - * published by the Free Software Foundation. Oracle designates this
267.11 - * particular file as subject to the "Classpath" exception as provided
267.12 - * by Oracle in the LICENSE file that accompanied this code.
267.13 - *
267.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
267.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
267.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
267.17 - * version 2 for more details (a copy is included in the LICENSE file that
267.18 - * accompanied this code).
267.19 - *
267.20 - * You should have received a copy of the GNU General Public License version
267.21 - * 2 along with this work; if not, write to the Free Software Foundation,
267.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
267.23 - *
267.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
267.25 - * or visit www.oracle.com if you need additional information or have any
267.26 - * questions.
267.27 - */
267.28 -
267.29 -package sun.io;
267.30 -
267.31 -/**
267.32 - * A algorithmic conversion from ASCII to Unicode
267.33 - *
267.34 - * @author Limin Shi
267.35 - */
267.36 -public class ByteToCharASCII extends ByteToCharConverter {
267.37 -
267.38 - // Return the character set id
267.39 - public String getCharacterEncoding()
267.40 - {
267.41 - return "ASCII";
267.42 - }
267.43 -
267.44 - public int flush(char[] output, int outStart, int outEnd) {
267.45 - // This converter will not buffer any data.
267.46 - byteOff = charOff = 0;
267.47 - return 0;
267.48 - }
267.49 -
267.50 - /**
267.51 - * Algorithmic character conversion
267.52 - */
267.53 - public int convert(byte[] input, int inOff, int inEnd,
267.54 - char[] output, int outOff, int outEnd)
267.55 - throws ConversionBufferFullException, UnknownCharacterException
267.56 - {
267.57 - byte inputByte;
267.58 -
267.59 - charOff = outOff;
267.60 - byteOff = inOff;
267.61 -
267.62 - // Loop until we hit the end of the input
267.63 - while(byteOff < inEnd)
267.64 - {
267.65 - // If we don't have room for the output, throw an exception
267.66 - if (charOff >= outEnd)
267.67 - throw new ConversionBufferFullException();
267.68 -
267.69 - // Convert the input byte
267.70 - inputByte = input[byteOff++];
267.71 -
267.72 - if (inputByte >= 0)
267.73 - output[charOff++] = (char)inputByte;
267.74 - else {
267.75 - if (subMode)
267.76 - output[charOff++] = '\uFFFD'; // Replace Char
267.77 - else {
267.78 - badInputLength = 1;
267.79 - throw new UnknownCharacterException();
267.80 - }
267.81 - }
267.82 - }
267.83 -
267.84 - // Return the length written to the output buffer
267.85 - return charOff-outOff;
267.86 - }
267.87 -
267.88 - /*
267.89 - * Reset after finding bad input
267.90 - */
267.91 - public void reset() {
267.92 - byteOff = charOff = 0;
267.93 - }
267.94 -
267.95 -}
268.1 --- a/src/share/classes/sun/io/ByteToCharBig5.java Thu Sep 01 13:54:38 2011 -0700
268.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
268.3 @@ -1,49 +0,0 @@
268.4 -/*
268.5 - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
268.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
268.7 - *
268.8 - * This code is free software; you can redistribute it and/or modify it
268.9 - * under the terms of the GNU General Public License version 2 only, as
268.10 - * published by the Free Software Foundation. Oracle designates this
268.11 - * particular file as subject to the "Classpath" exception as provided
268.12 - * by Oracle in the LICENSE file that accompanied this code.
268.13 - *
268.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
268.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
268.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
268.17 - * version 2 for more details (a copy is included in the LICENSE file that
268.18 - * accompanied this code).
268.19 - *
268.20 - * You should have received a copy of the GNU General Public License version
268.21 - * 2 along with this work; if not, write to the Free Software Foundation,
268.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
268.23 - *
268.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
268.25 - * or visit www.oracle.com if you need additional information or have any
268.26 - * questions.
268.27 - */
268.28 -
268.29 -
268.30 -package sun.io;
268.31 -
268.32 -import sun.nio.cs.ext.DoubleByte;
268.33 -import sun.nio.cs.ext.Big5;
268.34 -
268.35 -/**
268.36 - * Tables and data to convert Big5 to Unicode
268.37 - *
268.38 - */
268.39 -
268.40 -public class ByteToCharBig5 extends ByteToCharDBCS_ASCII {
268.41 -
268.42 - private static DoubleByte.Decoder dec =
268.43 - (DoubleByte.Decoder)new Big5().newDecoder();
268.44 -
268.45 - public String getCharacterEncoding() {
268.46 - return "Big5";
268.47 - }
268.48 -
268.49 - public ByteToCharBig5() {
268.50 - super(dec);
268.51 - }
268.52 -}
269.1 --- a/src/share/classes/sun/io/ByteToCharBig5_HKSCS.java Thu Sep 01 13:54:38 2011 -0700
269.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
269.3 @@ -1,52 +0,0 @@
269.4 -/*
269.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
269.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
269.7 - *
269.8 - * This code is free software; you can redistribute it and/or modify it
269.9 - * under the terms of the GNU General Public License version 2 only, as
269.10 - * published by the Free Software Foundation. Oracle designates this
269.11 - * particular file as subject to the "Classpath" exception as provided
269.12 - * by Oracle in the LICENSE file that accompanied this code.
269.13 - *
269.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
269.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
269.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
269.17 - * version 2 for more details (a copy is included in the LICENSE file that
269.18 - * accompanied this code).
269.19 - *
269.20 - * You should have received a copy of the GNU General Public License version
269.21 - * 2 along with this work; if not, write to the Free Software Foundation,
269.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
269.23 - *
269.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
269.25 - * or visit www.oracle.com if you need additional information or have any
269.26 - * questions.
269.27 - */
269.28 -
269.29 -package sun.io;
269.30 -
269.31 -import sun.nio.cs.ext.Big5_HKSCS;
269.32 -import sun.nio.cs.ext.HKSCS;
269.33 -import static sun.nio.cs.CharsetMapping.*;
269.34 -
269.35 -public class ByteToCharBig5_HKSCS extends ByteToCharDBCS_ASCII {
269.36 -
269.37 - protected static HKSCS.Decoder dec =
269.38 - (HKSCS.Decoder)new Big5_HKSCS().newDecoder();
269.39 -
269.40 -
269.41 - public String getCharacterEncoding() {
269.42 - return "Big5_HKSCS";
269.43 - }
269.44 -
269.45 - public ByteToCharBig5_HKSCS() {
269.46 - super(dec);
269.47 - }
269.48 -
269.49 - protected char decodeDouble(int byte1, int byte2) {
269.50 - char c = dec.decodeDouble(byte1, byte2);
269.51 - if (c == UNMAPPABLE_DECODING)
269.52 - c = dec.decodeBig5(byte1, byte2);
269.53 - return c;
269.54 - }
269.55 -}
270.1 --- a/src/share/classes/sun/io/ByteToCharBig5_Solaris.java Thu Sep 01 13:54:38 2011 -0700
270.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
270.3 @@ -1,43 +0,0 @@
270.4 -/*
270.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
270.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
270.7 - *
270.8 - * This code is free software; you can redistribute it and/or modify it
270.9 - * under the terms of the GNU General Public License version 2 only, as
270.10 - * published by the Free Software Foundation. Oracle designates this
270.11 - * particular file as subject to the "Classpath" exception as provided
270.12 - * by Oracle in the LICENSE file that accompanied this code.
270.13 - *
270.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
270.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
270.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
270.17 - * version 2 for more details (a copy is included in the LICENSE file that
270.18 - * accompanied this code).
270.19 - *
270.20 - * You should have received a copy of the GNU General Public License version
270.21 - * 2 along with this work; if not, write to the Free Software Foundation,
270.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
270.23 - *
270.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
270.25 - * or visit www.oracle.com if you need additional information or have any
270.26 - * questions.
270.27 - */
270.28 -
270.29 -package sun.io;
270.30 -
270.31 -import sun.nio.cs.ext.DoubleByte;
270.32 -import sun.nio.cs.ext.Big5_Solaris;
270.33 -
270.34 -public class ByteToCharBig5_Solaris extends ByteToCharDBCS_ASCII {
270.35 -
270.36 - private static DoubleByte.Decoder dec =
270.37 - (DoubleByte.Decoder)new Big5_Solaris().newDecoder();
270.38 -
270.39 - public String getCharacterEncoding() {
270.40 - return "Big5_Solaris";
270.41 - }
270.42 -
270.43 - public ByteToCharBig5_Solaris() {
270.44 - super(dec);
270.45 - }
270.46 -}
271.1 --- a/src/share/classes/sun/io/ByteToCharConverter.java Thu Sep 01 13:54:38 2011 -0700
271.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
271.3 @@ -1,294 +0,0 @@
271.4 -/*
271.5 - * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
271.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
271.7 - *
271.8 - * This code is free software; you can redistribute it and/or modify it
271.9 - * under the terms of the GNU General Public License version 2 only, as
271.10 - * published by the Free Software Foundation. Oracle designates this
271.11 - * particular file as subject to the "Classpath" exception as provided
271.12 - * by Oracle in the LICENSE file that accompanied this code.
271.13 - *
271.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
271.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
271.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
271.17 - * version 2 for more details (a copy is included in the LICENSE file that
271.18 - * accompanied this code).
271.19 - *
271.20 - * You should have received a copy of the GNU General Public License version
271.21 - * 2 along with this work; if not, write to the Free Software Foundation,
271.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
271.23 - *
271.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
271.25 - * or visit www.oracle.com if you need additional information or have any
271.26 - * questions.
271.27 - */
271.28 -
271.29 -package sun.io;
271.30 -
271.31 -import java.io.*;
271.32 -
271.33 -
271.34 -/**
271.35 - * An abstract base class for subclasses which convert character data
271.36 - * in an external encoding into Unicode characters.
271.37 - *
271.38 - * @author Asmus Freytag
271.39 - * @author Lloyd Honomichl
271.40 - *
271.41 - * @deprecated Replaced by {@link java.nio.charset}. THIS API WILL BE
271.42 - * REMOVED IN J2SE 1.6.
271.43 - */
271.44 -@Deprecated
271.45 -public abstract class ByteToCharConverter {
271.46 -
271.47 - /*
271.48 - * Substitution mode flag.
271.49 - */
271.50 - protected boolean subMode = true;
271.51 -
271.52 - /*
271.53 - * Characters to use for automatic substitution.
271.54 - */
271.55 - protected char[] subChars = { '\uFFFD' };
271.56 -
271.57 - /*
271.58 - * Offset of next character to be output
271.59 - */
271.60 - protected int charOff;
271.61 -
271.62 - /*
271.63 - * Offset of next byte to be converted
271.64 - */
271.65 - protected int byteOff;
271.66 -
271.67 - /*
271.68 - * Length of bad input that caused a MalformedInputException.
271.69 - */
271.70 - protected int badInputLength;
271.71 -
271.72 - /**
271.73 - * Create an instance of the default ByteToCharConverter subclass.
271.74 - */
271.75 - public static ByteToCharConverter getDefault() {
271.76 - Object cvt;
271.77 - cvt = Converters.newDefaultConverter(Converters.BYTE_TO_CHAR);
271.78 - return (ByteToCharConverter)cvt;
271.79 - }
271.80 -
271.81 - /**
271.82 - * Returns appropriate ByteToCharConverter subclass instance.
271.83 - * @param string represents encoding
271.84 - */
271.85 - public static ByteToCharConverter getConverter(String encoding)
271.86 - throws UnsupportedEncodingException
271.87 - {
271.88 - Object cvt;
271.89 - cvt = Converters.newConverter(Converters.BYTE_TO_CHAR, encoding);
271.90 - return (ByteToCharConverter)cvt;
271.91 - }
271.92 -
271.93 - /**
271.94 - * Returns the character set id for the conversion
271.95 - */
271.96 - public abstract String getCharacterEncoding();
271.97 -
271.98 - /**
271.99 - * Converts an array of bytes containing characters in an external
271.100 - * encoding into an array of Unicode characters. This method allows
271.101 - * a buffer by buffer conversion of a data stream. The state of the
271.102 - * conversion is saved between calls to convert. Among other things,
271.103 - * this means multibyte input sequences can be split between calls.
271.104 - * If a call to convert results in an exception, the conversion may be
271.105 - * continued by calling convert again with suitably modified parameters.
271.106 - * All conversions should be finished with a call to the flush method.
271.107 - *
271.108 - * @return the number of bytes written to output.
271.109 - * @param input byte array containing text to be converted.
271.110 - * @param inStart begin conversion at this offset in input array.
271.111 - * @param inEnd stop conversion at this offset in input array (exclusive).
271.112 - * @param output character array to receive conversion result.
271.113 - * @param outStart start writing to output array at this offset.
271.114 - * @param outEnd stop writing to output array at this offset (exclusive).
271.115 - * @exception MalformedInputException if the input buffer contains any
271.116 - * sequence of bytes that is illegal for the input character set.
271.117 - * @exception UnknownCharacterException for any character that
271.118 - * that cannot be converted to Unicode. Thrown only when converter
271.119 - * is not in substitution mode.
271.120 - * @exception ConversionBufferFullException if output array is filled prior
271.121 - * to converting all the input.
271.122 - */
271.123 - public abstract int convert(byte[] input, int inStart, int inEnd,
271.124 - char[] output, int outStart, int outEnd)
271.125 - throws MalformedInputException,
271.126 - UnknownCharacterException,
271.127 - ConversionBufferFullException;
271.128 -
271.129 - /**
271.130 - * Converts an array of bytes containing characters in an external
271.131 - * encoding into an array of Unicode characters. Unlike convert,
271.132 - * this method does not do incremental conversion. It assumes that
271.133 - * the given input array contains all the characters to be
271.134 - * converted. The state of the converter is reset at the beginning
271.135 - * of this method and is left in the reset state on successful
271.136 - * termination. The converter is not reset if an exception is
271.137 - * thrown. This allows the caller to determine where the bad input
271.138 - * was encountered by calling nextByteIndex.
271.139 - * <p>
271.140 - * This method uses substitution mode when performing the
271.141 - * conversion. The method setSubstitutionChars may be used to
271.142 - * determine what characters are substituted. Even though substitution
271.143 - * mode is used, the state of the converter's substitution mode is
271.144 - * not changed at the end of this method.
271.145 - *
271.146 - * @return an array of chars containing the converted characters.
271.147 - * @param input array containing Unicode characters to be converted.
271.148 - * @exception MalformedInputException if the input buffer contains any
271.149 - * sequence of chars that is illegal in the input character encoding.
271.150 - * After this exception is thrown,
271.151 - * the method nextByteIndex can be called to obtain the index of the
271.152 - * first invalid input byte and getBadInputLength can be called
271.153 - * to determine the length of the invalid input.
271.154 - *
271.155 - * @see #nextByteIndex
271.156 - * @see #setSubstitutionMode
271.157 - * @see sun.io.CharToByteConverter#setSubstitutionBytes(byte[])
271.158 - * @see #getBadInputLength
271.159 - */
271.160 - public char[] convertAll( byte input[] ) throws MalformedInputException {
271.161 - reset();
271.162 - boolean savedSubMode = subMode;
271.163 - subMode = true;
271.164 -
271.165 - char[] output = new char[ getMaxCharsPerByte() * input.length ];
271.166 -
271.167 - try {
271.168 - int outputLength = convert( input, 0, input.length,
271.169 - output, 0, output.length );
271.170 - outputLength += flush( output, outputLength, output.length );
271.171 -
271.172 - char [] returnedOutput = new char[ outputLength ];
271.173 - System.arraycopy( output, 0, returnedOutput, 0, outputLength );
271.174 - return returnedOutput;
271.175 - }
271.176 - catch( ConversionBufferFullException e ) {
271.177 - //Not supposed to happen. If it does, getMaxCharsPerByte() lied.
271.178 - throw new
271.179 - InternalError("this.getMaxCharsBerByte returned bad value");
271.180 - }
271.181 - catch( UnknownCharacterException e ) {
271.182 - // Not supposed to happen since we're in substitution mode.
271.183 - throw new InternalError();
271.184 - }
271.185 - finally {
271.186 - subMode = savedSubMode;
271.187 - }
271.188 - }
271.189 -
271.190 - /**
271.191 - * Writes any remaining output to the output buffer and resets the
271.192 - * converter to its initial state.
271.193 - *
271.194 - * @param output char array to receive flushed output.
271.195 - * @param outStart start writing to output array at this offset.
271.196 - * @param outEnd stop writing to output array at this offset (exclusive).
271.197 - * @exception MalformedInputException if the output to be flushed contained
271.198 - * a partial or invalid multibyte character sequence. flush will
271.199 - * write what it can to the output buffer and reset the converter before
271.200 - * throwing this exception. An additional call to flush is not required.
271.201 - * @exception ConversionBufferFullException if output array is filled
271.202 - * before all the output can be flushed. flush will write what it can
271.203 - * to the output buffer and remember its state. An additional call to
271.204 - * flush with a new output buffer will conclude the operation.
271.205 - */
271.206 - public abstract int flush( char[] output, int outStart, int outEnd )
271.207 - throws MalformedInputException, ConversionBufferFullException;
271.208 -
271.209 - /**
271.210 - * Resets converter to its initial state.
271.211 - */
271.212 - public abstract void reset();
271.213 -
271.214 - /**
271.215 - * Returns the maximum number of characters needed to convert a byte. Useful
271.216 - * for calculating the maximum output buffer size needed for a particular
271.217 - * input buffer.
271.218 - */
271.219 - public int getMaxCharsPerByte() {
271.220 - // Until UTF-16, this will do for every encoding
271.221 - return 1;
271.222 - }
271.223 -
271.224 - /**
271.225 - * Returns the length, in bytes, of the input which caused a
271.226 - * MalformedInputException. Always refers to the last
271.227 - * MalformedInputException thrown by the converter. If none have
271.228 - * ever been thrown, returns 0.
271.229 - */
271.230 - public int getBadInputLength() {
271.231 - return badInputLength;
271.232 - }
271.233 -
271.234 - /**
271.235 - * Returns the index of the character just past the last character
271.236 - * written by the previous call to convert.
271.237 - */
271.238 - public int nextCharIndex() {
271.239 - return charOff;
271.240 - }
271.241 -
271.242 - /**
271.243 - * Returns the index of the byte just past the last byte successfully
271.244 - * converted by the previous call to convert.
271.245 - */
271.246 - public int nextByteIndex() {
271.247 - return byteOff;
271.248 - }
271.249 -
271.250 - /**
271.251 - * Sets converter into substitution mode. In substitution mode,
271.252 - * the converter will replace untranslatable characters in the source
271.253 - * encoding with the substitution character set by setSubstitionChars.
271.254 - * When not in substitution mode, the converter will throw an
271.255 - * UnknownCharacterException when it encounters untranslatable input.
271.256 - *
271.257 - * @param doSub if true, enable substitution mode.
271.258 - * @see #setSubstitutionChars
271.259 - */
271.260 - public void setSubstitutionMode(boolean doSub) {
271.261 - subMode = doSub;
271.262 - }
271.263 -
271.264 - /**
271.265 - * Sets the substitution characters to use when the converter is in
271.266 - * substitution mode. The given chars must not be
271.267 - * longer than the value returned by getMaxCharsPerByte for this
271.268 - * converter.
271.269 - *
271.270 - * @param newSubBytes the substitution bytes
271.271 - * @exception IllegalArgumentException if given byte array is longer than
271.272 - * the value returned by the method getMaxBytesPerChar.
271.273 - * @see #setSubstitutionMode
271.274 - * @see #getMaxBytesPerChar
271.275 - */
271.276 - /**
271.277 - * sets the substitution character to use
271.278 - * @param c the substitution character
271.279 - */
271.280 - public void setSubstitutionChars(char[] c)
271.281 - throws IllegalArgumentException
271.282 - {
271.283 - if( c.length > getMaxCharsPerByte() ) {
271.284 - throw new IllegalArgumentException();
271.285 - }
271.286 -
271.287 - subChars = new char[ c.length ];
271.288 - System.arraycopy( c, 0, subChars, 0, c.length );
271.289 - }
271.290 -
271.291 - /**
271.292 - * returns a string representation of the character conversion
271.293 - */
271.294 - public String toString() {
271.295 - return "ByteToCharConverter: " + getCharacterEncoding();
271.296 - }
271.297 -}
272.1 --- a/src/share/classes/sun/io/ByteToCharCp037.java Thu Sep 01 13:54:38 2011 -0700
272.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
272.3 @@ -1,48 +0,0 @@
272.4 -/*
272.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
272.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
272.7 - *
272.8 - * This code is free software; you can redistribute it and/or modify it
272.9 - * under the terms of the GNU General Public License version 2 only, as
272.10 - * published by the Free Software Foundation. Oracle designates this
272.11 - * particular file as subject to the "Classpath" exception as provided
272.12 - * by Oracle in the LICENSE file that accompanied this code.
272.13 - *
272.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
272.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
272.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
272.17 - * version 2 for more details (a copy is included in the LICENSE file that
272.18 - * accompanied this code).
272.19 - *
272.20 - * You should have received a copy of the GNU General Public License version
272.21 - * 2 along with this work; if not, write to the Free Software Foundation,
272.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
272.23 - *
272.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
272.25 - * or visit www.oracle.com if you need additional information or have any
272.26 - * questions.
272.27 - */
272.28 -
272.29 -
272.30 -package sun.io;
272.31 -
272.32 -import sun.nio.cs.ext.IBM037;
272.33 -
272.34 -/**
272.35 - * A table to convert to Cp037 to Unicode
272.36 - *
272.37 - * @author ConverterGenerator tool
272.38 - */
272.39 -
272.40 -public class ByteToCharCp037 extends ByteToCharSingleByte {
272.41 -
272.42 - private final static IBM037 nioCoder = new IBM037();
272.43 -
272.44 - public String getCharacterEncoding() {
272.45 - return "Cp037";
272.46 - }
272.47 -
272.48 - public ByteToCharCp037() {
272.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
272.50 - }
272.51 -}
273.1 --- a/src/share/classes/sun/io/ByteToCharCp1006.java Thu Sep 01 13:54:38 2011 -0700
273.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
273.3 @@ -1,48 +0,0 @@
273.4 -/*
273.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
273.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
273.7 - *
273.8 - * This code is free software; you can redistribute it and/or modify it
273.9 - * under the terms of the GNU General Public License version 2 only, as
273.10 - * published by the Free Software Foundation. Oracle designates this
273.11 - * particular file as subject to the "Classpath" exception as provided
273.12 - * by Oracle in the LICENSE file that accompanied this code.
273.13 - *
273.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
273.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
273.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
273.17 - * version 2 for more details (a copy is included in the LICENSE file that
273.18 - * accompanied this code).
273.19 - *
273.20 - * You should have received a copy of the GNU General Public License version
273.21 - * 2 along with this work; if not, write to the Free Software Foundation,
273.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
273.23 - *
273.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
273.25 - * or visit www.oracle.com if you need additional information or have any
273.26 - * questions.
273.27 - */
273.28 -
273.29 -
273.30 -package sun.io;
273.31 -
273.32 -import sun.nio.cs.ext.IBM1006;
273.33 -
273.34 -/**
273.35 - * A table to convert to Cp1006 to Unicode
273.36 - *
273.37 - * @author ConverterGenerator tool
273.38 - */
273.39 -
273.40 -public class ByteToCharCp1006 extends ByteToCharSingleByte {
273.41 -
273.42 - private final static IBM1006 nioCoder = new IBM1006();
273.43 -
273.44 - public String getCharacterEncoding() {
273.45 - return "Cp1006";
273.46 - }
273.47 -
273.48 - public ByteToCharCp1006() {
273.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
273.50 - }
273.51 -}
274.1 --- a/src/share/classes/sun/io/ByteToCharCp1025.java Thu Sep 01 13:54:38 2011 -0700
274.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
274.3 @@ -1,48 +0,0 @@
274.4 -/*
274.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
274.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
274.7 - *
274.8 - * This code is free software; you can redistribute it and/or modify it
274.9 - * under the terms of the GNU General Public License version 2 only, as
274.10 - * published by the Free Software Foundation. Oracle designates this
274.11 - * particular file as subject to the "Classpath" exception as provided
274.12 - * by Oracle in the LICENSE file that accompanied this code.
274.13 - *
274.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
274.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
274.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
274.17 - * version 2 for more details (a copy is included in the LICENSE file that
274.18 - * accompanied this code).
274.19 - *
274.20 - * You should have received a copy of the GNU General Public License version
274.21 - * 2 along with this work; if not, write to the Free Software Foundation,
274.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
274.23 - *
274.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
274.25 - * or visit www.oracle.com if you need additional information or have any
274.26 - * questions.
274.27 - */
274.28 -
274.29 -
274.30 -package sun.io;
274.31 -
274.32 -import sun.nio.cs.ext.IBM1025;
274.33 -
274.34 -/**
274.35 - * A table to convert to Cp1025 to Unicode
274.36 - *
274.37 - * @author ConverterGenerator tool
274.38 - */
274.39 -
274.40 -public class ByteToCharCp1025 extends ByteToCharSingleByte {
274.41 -
274.42 - private final static IBM1025 nioCoder = new IBM1025();
274.43 -
274.44 - public String getCharacterEncoding() {
274.45 - return "Cp1025";
274.46 - }
274.47 -
274.48 - public ByteToCharCp1025() {
274.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
274.50 - }
274.51 -}
275.1 --- a/src/share/classes/sun/io/ByteToCharCp1026.java Thu Sep 01 13:54:38 2011 -0700
275.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
275.3 @@ -1,48 +0,0 @@
275.4 -/*
275.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
275.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
275.7 - *
275.8 - * This code is free software; you can redistribute it and/or modify it
275.9 - * under the terms of the GNU General Public License version 2 only, as
275.10 - * published by the Free Software Foundation. Oracle designates this
275.11 - * particular file as subject to the "Classpath" exception as provided
275.12 - * by Oracle in the LICENSE file that accompanied this code.
275.13 - *
275.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
275.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
275.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
275.17 - * version 2 for more details (a copy is included in the LICENSE file that
275.18 - * accompanied this code).
275.19 - *
275.20 - * You should have received a copy of the GNU General Public License version
275.21 - * 2 along with this work; if not, write to the Free Software Foundation,
275.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
275.23 - *
275.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
275.25 - * or visit www.oracle.com if you need additional information or have any
275.26 - * questions.
275.27 - */
275.28 -
275.29 -
275.30 -package sun.io;
275.31 -
275.32 -import sun.nio.cs.ext.IBM1026;
275.33 -
275.34 -/**
275.35 - * A table to convert to Cp1026 to Unicode
275.36 - *
275.37 - * @author ConverterGenerator tool
275.38 - */
275.39 -
275.40 -public class ByteToCharCp1026 extends ByteToCharSingleByte {
275.41 -
275.42 - private final static IBM1026 nioCoder = new IBM1026();
275.43 -
275.44 - public String getCharacterEncoding() {
275.45 - return "Cp1026";
275.46 - }
275.47 -
275.48 - public ByteToCharCp1026() {
275.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
275.50 - }
275.51 -}
276.1 --- a/src/share/classes/sun/io/ByteToCharCp1046.java Thu Sep 01 13:54:38 2011 -0700
276.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
276.3 @@ -1,48 +0,0 @@
276.4 -/*
276.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
276.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
276.7 - *
276.8 - * This code is free software; you can redistribute it and/or modify it
276.9 - * under the terms of the GNU General Public License version 2 only, as
276.10 - * published by the Free Software Foundation. Oracle designates this
276.11 - * particular file as subject to the "Classpath" exception as provided
276.12 - * by Oracle in the LICENSE file that accompanied this code.
276.13 - *
276.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
276.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
276.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
276.17 - * version 2 for more details (a copy is included in the LICENSE file that
276.18 - * accompanied this code).
276.19 - *
276.20 - * You should have received a copy of the GNU General Public License version
276.21 - * 2 along with this work; if not, write to the Free Software Foundation,
276.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
276.23 - *
276.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
276.25 - * or visit www.oracle.com if you need additional information or have any
276.26 - * questions.
276.27 - */
276.28 -
276.29 -
276.30 -package sun.io;
276.31 -
276.32 -import sun.nio.cs.ext.IBM1046;
276.33 -
276.34 -/**
276.35 - * A table to convert to Cp1046 to Unicode
276.36 - *
276.37 - * @author ConverterGenerator tool
276.38 - */
276.39 -
276.40 -public class ByteToCharCp1046 extends ByteToCharSingleByte {
276.41 -
276.42 - private final static IBM1046 nioCoder = new IBM1046();
276.43 -
276.44 - public String getCharacterEncoding() {
276.45 - return "Cp1046";
276.46 - }
276.47 -
276.48 - public ByteToCharCp1046() {
276.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
276.50 - }
276.51 -}
277.1 --- a/src/share/classes/sun/io/ByteToCharCp1047.java Thu Sep 01 13:54:38 2011 -0700
277.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
277.3 @@ -1,48 +0,0 @@
277.4 -/*
277.5 - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
277.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
277.7 - *
277.8 - * This code is free software; you can redistribute it and/or modify it
277.9 - * under the terms of the GNU General Public License version 2 only, as
277.10 - * published by the Free Software Foundation. Oracle designates this
277.11 - * particular file as subject to the "Classpath" exception as provided
277.12 - * by Oracle in the LICENSE file that accompanied this code.
277.13 - *
277.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
277.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
277.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
277.17 - * version 2 for more details (a copy is included in the LICENSE file that
277.18 - * accompanied this code).
277.19 - *
277.20 - * You should have received a copy of the GNU General Public License version
277.21 - * 2 along with this work; if not, write to the Free Software Foundation,
277.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
277.23 - *
277.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
277.25 - * or visit www.oracle.com if you need additional information or have any
277.26 - * questions.
277.27 - */
277.28 -
277.29 -
277.30 -package sun.io;
277.31 -
277.32 -import sun.nio.cs.ext.IBM1047;
277.33 -
277.34 -/**
277.35 - * A table to convert to Cp1047 to Unicode
277.36 - *
277.37 - * @author ConverterGenerator tool
277.38 - */
277.39 -
277.40 -public class ByteToCharCp1047 extends ByteToCharSingleByte {
277.41 -
277.42 - private final static IBM1047 nioCoder = new IBM1047();
277.43 -
277.44 - public String getCharacterEncoding() {
277.45 - return "Cp1047";
277.46 - }
277.47 -
277.48 - public ByteToCharCp1047() {
277.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
277.50 - }
277.51 -}
278.1 --- a/src/share/classes/sun/io/ByteToCharCp1097.java Thu Sep 01 13:54:38 2011 -0700
278.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
278.3 @@ -1,48 +0,0 @@
278.4 -/*
278.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
278.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
278.7 - *
278.8 - * This code is free software; you can redistribute it and/or modify it
278.9 - * under the terms of the GNU General Public License version 2 only, as
278.10 - * published by the Free Software Foundation. Oracle designates this
278.11 - * particular file as subject to the "Classpath" exception as provided
278.12 - * by Oracle in the LICENSE file that accompanied this code.
278.13 - *
278.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
278.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
278.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
278.17 - * version 2 for more details (a copy is included in the LICENSE file that
278.18 - * accompanied this code).
278.19 - *
278.20 - * You should have received a copy of the GNU General Public License version
278.21 - * 2 along with this work; if not, write to the Free Software Foundation,
278.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
278.23 - *
278.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
278.25 - * or visit www.oracle.com if you need additional information or have any
278.26 - * questions.
278.27 - */
278.28 -
278.29 -
278.30 -package sun.io;
278.31 -
278.32 -import sun.nio.cs.ext.IBM1097;
278.33 -
278.34 -/**
278.35 - * A table to convert to Cp1097 to Unicode
278.36 - *
278.37 - * @author ConverterGenerator tool
278.38 - */
278.39 -
278.40 -public class ByteToCharCp1097 extends ByteToCharSingleByte {
278.41 -
278.42 - private final static IBM1097 nioCoder = new IBM1097();
278.43 -
278.44 - public String getCharacterEncoding() {
278.45 - return "Cp1097";
278.46 - }
278.47 -
278.48 - public ByteToCharCp1097() {
278.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
278.50 - }
278.51 -}
279.1 --- a/src/share/classes/sun/io/ByteToCharCp1098.java Thu Sep 01 13:54:38 2011 -0700
279.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
279.3 @@ -1,48 +0,0 @@
279.4 -/*
279.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
279.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
279.7 - *
279.8 - * This code is free software; you can redistribute it and/or modify it
279.9 - * under the terms of the GNU General Public License version 2 only, as
279.10 - * published by the Free Software Foundation. Oracle designates this
279.11 - * particular file as subject to the "Classpath" exception as provided
279.12 - * by Oracle in the LICENSE file that accompanied this code.
279.13 - *
279.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
279.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
279.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
279.17 - * version 2 for more details (a copy is included in the LICENSE file that
279.18 - * accompanied this code).
279.19 - *
279.20 - * You should have received a copy of the GNU General Public License version
279.21 - * 2 along with this work; if not, write to the Free Software Foundation,
279.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
279.23 - *
279.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
279.25 - * or visit www.oracle.com if you need additional information or have any
279.26 - * questions.
279.27 - */
279.28 -
279.29 -
279.30 -package sun.io;
279.31 -
279.32 -import sun.nio.cs.ext.IBM1098;
279.33 -
279.34 -/**
279.35 - * A table to convert to Cp1098 to Unicode
279.36 - *
279.37 - * @author ConverterGenerator tool
279.38 - */
279.39 -
279.40 -public class ByteToCharCp1098 extends ByteToCharSingleByte {
279.41 -
279.42 - private final static IBM1098 nioCoder = new IBM1098();
279.43 -
279.44 - public String getCharacterEncoding() {
279.45 - return "Cp1098";
279.46 - }
279.47 -
279.48 - public ByteToCharCp1098() {
279.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
279.50 - }
279.51 -}
280.1 --- a/src/share/classes/sun/io/ByteToCharCp1112.java Thu Sep 01 13:54:38 2011 -0700
280.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
280.3 @@ -1,48 +0,0 @@
280.4 -/*
280.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
280.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
280.7 - *
280.8 - * This code is free software; you can redistribute it and/or modify it
280.9 - * under the terms of the GNU General Public License version 2 only, as
280.10 - * published by the Free Software Foundation. Oracle designates this
280.11 - * particular file as subject to the "Classpath" exception as provided
280.12 - * by Oracle in the LICENSE file that accompanied this code.
280.13 - *
280.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
280.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
280.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
280.17 - * version 2 for more details (a copy is included in the LICENSE file that
280.18 - * accompanied this code).
280.19 - *
280.20 - * You should have received a copy of the GNU General Public License version
280.21 - * 2 along with this work; if not, write to the Free Software Foundation,
280.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
280.23 - *
280.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
280.25 - * or visit www.oracle.com if you need additional information or have any
280.26 - * questions.
280.27 - */
280.28 -
280.29 -
280.30 -package sun.io;
280.31 -
280.32 -import sun.nio.cs.ext.IBM1112;
280.33 -
280.34 -/**
280.35 - * A table to convert to Cp1112 to Unicode
280.36 - *
280.37 - * @author ConverterGenerator tool
280.38 - */
280.39 -
280.40 -public class ByteToCharCp1112 extends ByteToCharSingleByte {
280.41 -
280.42 - private final static IBM1112 nioCoder = new IBM1112();
280.43 -
280.44 - public String getCharacterEncoding() {
280.45 - return "Cp1112";
280.46 - }
280.47 -
280.48 - public ByteToCharCp1112() {
280.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
280.50 - }
280.51 -}
281.1 --- a/src/share/classes/sun/io/ByteToCharCp1122.java Thu Sep 01 13:54:38 2011 -0700
281.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
281.3 @@ -1,48 +0,0 @@
281.4 -/*
281.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
281.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
281.7 - *
281.8 - * This code is free software; you can redistribute it and/or modify it
281.9 - * under the terms of the GNU General Public License version 2 only, as
281.10 - * published by the Free Software Foundation. Oracle designates this
281.11 - * particular file as subject to the "Classpath" exception as provided
281.12 - * by Oracle in the LICENSE file that accompanied this code.
281.13 - *
281.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
281.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
281.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
281.17 - * version 2 for more details (a copy is included in the LICENSE file that
281.18 - * accompanied this code).
281.19 - *
281.20 - * You should have received a copy of the GNU General Public License version
281.21 - * 2 along with this work; if not, write to the Free Software Foundation,
281.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
281.23 - *
281.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
281.25 - * or visit www.oracle.com if you need additional information or have any
281.26 - * questions.
281.27 - */
281.28 -
281.29 -
281.30 -package sun.io;
281.31 -
281.32 -import sun.nio.cs.ext.IBM1122;
281.33 -
281.34 -/**
281.35 - * A table to convert to Cp1122 to Unicode
281.36 - *
281.37 - * @author ConverterGenerator tool
281.38 - */
281.39 -
281.40 -public class ByteToCharCp1122 extends ByteToCharSingleByte {
281.41 -
281.42 - private final static IBM1122 nioCoder = new IBM1122();
281.43 -
281.44 - public String getCharacterEncoding() {
281.45 - return "Cp1122";
281.46 - }
281.47 -
281.48 - public ByteToCharCp1122() {
281.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
281.50 - }
281.51 -}
282.1 --- a/src/share/classes/sun/io/ByteToCharCp1123.java Thu Sep 01 13:54:38 2011 -0700
282.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
282.3 @@ -1,48 +0,0 @@
282.4 -/*
282.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
282.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
282.7 - *
282.8 - * This code is free software; you can redistribute it and/or modify it
282.9 - * under the terms of the GNU General Public License version 2 only, as
282.10 - * published by the Free Software Foundation. Oracle designates this
282.11 - * particular file as subject to the "Classpath" exception as provided
282.12 - * by Oracle in the LICENSE file that accompanied this code.
282.13 - *
282.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
282.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
282.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
282.17 - * version 2 for more details (a copy is included in the LICENSE file that
282.18 - * accompanied this code).
282.19 - *
282.20 - * You should have received a copy of the GNU General Public License version
282.21 - * 2 along with this work; if not, write to the Free Software Foundation,
282.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
282.23 - *
282.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
282.25 - * or visit www.oracle.com if you need additional information or have any
282.26 - * questions.
282.27 - */
282.28 -
282.29 -
282.30 -package sun.io;
282.31 -
282.32 -import sun.nio.cs.ext.IBM1123;
282.33 -
282.34 -/**
282.35 - * A table to convert to Cp1123 to Unicode
282.36 - *
282.37 - * @author ConverterGenerator tool
282.38 - */
282.39 -
282.40 -public class ByteToCharCp1123 extends ByteToCharSingleByte {
282.41 -
282.42 - private final static IBM1123 nioCoder = new IBM1123();
282.43 -
282.44 - public String getCharacterEncoding() {
282.45 - return "Cp1123";
282.46 - }
282.47 -
282.48 - public ByteToCharCp1123() {
282.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
282.50 - }
282.51 -}
283.1 --- a/src/share/classes/sun/io/ByteToCharCp1124.java Thu Sep 01 13:54:38 2011 -0700
283.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
283.3 @@ -1,48 +0,0 @@
283.4 -/*
283.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
283.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
283.7 - *
283.8 - * This code is free software; you can redistribute it and/or modify it
283.9 - * under the terms of the GNU General Public License version 2 only, as
283.10 - * published by the Free Software Foundation. Oracle designates this
283.11 - * particular file as subject to the "Classpath" exception as provided
283.12 - * by Oracle in the LICENSE file that accompanied this code.
283.13 - *
283.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
283.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
283.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
283.17 - * version 2 for more details (a copy is included in the LICENSE file that
283.18 - * accompanied this code).
283.19 - *
283.20 - * You should have received a copy of the GNU General Public License version
283.21 - * 2 along with this work; if not, write to the Free Software Foundation,
283.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
283.23 - *
283.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
283.25 - * or visit www.oracle.com if you need additional information or have any
283.26 - * questions.
283.27 - */
283.28 -
283.29 -
283.30 -package sun.io;
283.31 -
283.32 -import sun.nio.cs.ext.IBM1124;
283.33 -
283.34 -/**
283.35 - * A table to convert to Cp1124 to Unicode
283.36 - *
283.37 - * @author ConverterGenerator tool
283.38 - */
283.39 -
283.40 -public class ByteToCharCp1124 extends ByteToCharSingleByte {
283.41 -
283.42 - private final static IBM1124 nioCoder = new IBM1124();
283.43 -
283.44 - public String getCharacterEncoding() {
283.45 - return "Cp1124";
283.46 - }
283.47 -
283.48 - public ByteToCharCp1124() {
283.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
283.50 - }
283.51 -}
284.1 --- a/src/share/classes/sun/io/ByteToCharCp1140.java Thu Sep 01 13:54:38 2011 -0700
284.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
284.3 @@ -1,47 +0,0 @@
284.4 -/*
284.5 - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
284.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
284.7 - *
284.8 - * This code is free software; you can redistribute it and/or modify it
284.9 - * under the terms of the GNU General Public License version 2 only, as
284.10 - * published by the Free Software Foundation. Oracle designates this
284.11 - * particular file as subject to the "Classpath" exception as provided
284.12 - * by Oracle in the LICENSE file that accompanied this code.
284.13 - *
284.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
284.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
284.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
284.17 - * version 2 for more details (a copy is included in the LICENSE file that
284.18 - * accompanied this code).
284.19 - *
284.20 - * You should have received a copy of the GNU General Public License version
284.21 - * 2 along with this work; if not, write to the Free Software Foundation,
284.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
284.23 - *
284.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
284.25 - * or visit www.oracle.com if you need additional information or have any
284.26 - * questions.
284.27 - */
284.28 -
284.29 -package sun.io;
284.30 -
284.31 -/**
284.32 - * A table to convert Cp1140 to Unicode. This converter differs from
284.33 - * Cp037 is one code point, 0x9F, which changes from \u00A4 to \u20AC.
284.34 - * @author Alan Liu
284.35 - */
284.36 -public class ByteToCharCp1140 extends ByteToCharCp037 {
284.37 - public ByteToCharCp1140() {}
284.38 -
284.39 - public String getCharacterEncoding() {
284.40 - return "Cp1140";
284.41 - }
284.42 -
284.43 - protected char getUnicode(int byteIndex) {
284.44 - // Change single code point with respect to parent.
284.45 - // Cast to byte to get sign extension to match byteIndex.
284.46 - return (byteIndex == (byte)0x9F) ? '\u20AC' : super.getUnicode(byteIndex);
284.47 - }
284.48 -}
284.49 -
284.50 -//eof
285.1 --- a/src/share/classes/sun/io/ByteToCharCp1141.java Thu Sep 01 13:54:38 2011 -0700
285.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
285.3 @@ -1,47 +0,0 @@
285.4 -/*
285.5 - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
285.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
285.7 - *
285.8 - * This code is free software; you can redistribute it and/or modify it
285.9 - * under the terms of the GNU General Public License version 2 only, as
285.10 - * published by the Free Software Foundation. Oracle designates this
285.11 - * particular file as subject to the "Classpath" exception as provided
285.12 - * by Oracle in the LICENSE file that accompanied this code.
285.13 - *
285.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
285.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
285.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
285.17 - * version 2 for more details (a copy is included in the LICENSE file that
285.18 - * accompanied this code).
285.19 - *
285.20 - * You should have received a copy of the GNU General Public License version
285.21 - * 2 along with this work; if not, write to the Free Software Foundation,
285.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
285.23 - *
285.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
285.25 - * or visit www.oracle.com if you need additional information or have any
285.26 - * questions.
285.27 - */
285.28 -
285.29 -package sun.io;
285.30 -
285.31 -/**
285.32 - * A table to convert Cp1141 to Unicode. This converter differs from
285.33 - * Cp273 is one code point, 0x9F, which changes from \u00A4 to \u20AC.
285.34 - * @author Alan Liu
285.35 - */
285.36 -public class ByteToCharCp1141 extends ByteToCharCp273 {
285.37 - public ByteToCharCp1141() {}
285.38 -
285.39 - public String getCharacterEncoding() {
285.40 - return "Cp1141";
285.41 - }
285.42 -
285.43 - protected char getUnicode(int byteIndex) {
285.44 - // Change single code point with respect to parent.
285.45 - // Cast to byte to get sign extension to match byteIndex.
285.46 - return (byteIndex == (byte)0x9F) ? '\u20AC' : super.getUnicode(byteIndex);
285.47 - }
285.48 -}
285.49 -
285.50 -//eof
286.1 --- a/src/share/classes/sun/io/ByteToCharCp1142.java Thu Sep 01 13:54:38 2011 -0700
286.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
286.3 @@ -1,48 +0,0 @@
286.4 -/*
286.5 - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
286.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
286.7 - *
286.8 - * This code is free software; you can redistribute it and/or modify it
286.9 - * under the terms of the GNU General Public License version 2 only, as
286.10 - * published by the Free Software Foundation. Oracle designates this
286.11 - * particular file as subject to the "Classpath" exception as provided
286.12 - * by Oracle in the LICENSE file that accompanied this code.
286.13 - *
286.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
286.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
286.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
286.17 - * version 2 for more details (a copy is included in the LICENSE file that
286.18 - * accompanied this code).
286.19 - *
286.20 - * You should have received a copy of the GNU General Public License version
286.21 - * 2 along with this work; if not, write to the Free Software Foundation,
286.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
286.23 - *
286.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
286.25 - * or visit www.oracle.com if you need additional information or have any
286.26 - * questions.
286.27 - */
286.28 -
286.29 -package sun.io;
286.30 -
286.31 -/**
286.32 - * A table to convert Cp1142 to Unicode. This converter differs from
286.33 - * Cp277 is one code point, 0x5A, which changes from \u00A4 to \u20AC.
286.34 - * @author Alan Liu
286.35 - */
286.36 -public class ByteToCharCp1142 extends ByteToCharCp277 {
286.37 - public ByteToCharCp1142() {}
286.38 -
286.39 - public String getCharacterEncoding() {
286.40 - return "Cp1142";
286.41 - }
286.42 -
286.43 - protected char getUnicode(int byteIndex) {
286.44 - // Change single code point with respect to parent.
286.45 - // [Careful -- if the code point in question is >= 0x80, make
286.46 - // sure you do the comparison like this: (byteIndex == (byte)0x??)]
286.47 - return (byteIndex == 0x5A) ? '\u20AC' : super.getUnicode(byteIndex);
286.48 - }
286.49 -}
286.50 -
286.51 -//eof
287.1 --- a/src/share/classes/sun/io/ByteToCharCp1143.java Thu Sep 01 13:54:38 2011 -0700
287.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
287.3 @@ -1,48 +0,0 @@
287.4 -/*
287.5 - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
287.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
287.7 - *
287.8 - * This code is free software; you can redistribute it and/or modify it
287.9 - * under the terms of the GNU General Public License version 2 only, as
287.10 - * published by the Free Software Foundation. Oracle designates this
287.11 - * particular file as subject to the "Classpath" exception as provided
287.12 - * by Oracle in the LICENSE file that accompanied this code.
287.13 - *
287.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
287.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
287.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
287.17 - * version 2 for more details (a copy is included in the LICENSE file that
287.18 - * accompanied this code).
287.19 - *
287.20 - * You should have received a copy of the GNU General Public License version
287.21 - * 2 along with this work; if not, write to the Free Software Foundation,
287.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
287.23 - *
287.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
287.25 - * or visit www.oracle.com if you need additional information or have any
287.26 - * questions.
287.27 - */
287.28 -
287.29 -package sun.io;
287.30 -
287.31 -/**
287.32 - * A table to convert Cp1143 to Unicode. This converter differs from
287.33 - * Cp278 is one code point, 0x5A, which changes from \u00A4 to \u20AC.
287.34 - * @author Alan Liu
287.35 - */
287.36 -public class ByteToCharCp1143 extends ByteToCharCp278 {
287.37 - public ByteToCharCp1143() {}
287.38 -
287.39 - public String getCharacterEncoding() {
287.40 - return "Cp1143";
287.41 - }
287.42 -
287.43 - protected char getUnicode(int byteIndex) {
287.44 - // Change single code point with respect to parent.
287.45 - // [Careful -- if the code point in question is >= 0x80, make
287.46 - // sure you do the comparison like this: (byteIndex == (byte)0x??)]
287.47 - return (byteIndex == 0x5A) ? '\u20AC' : super.getUnicode(byteIndex);
287.48 - }
287.49 -}
287.50 -
287.51 -//eof
288.1 --- a/src/share/classes/sun/io/ByteToCharCp1144.java Thu Sep 01 13:54:38 2011 -0700
288.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
288.3 @@ -1,47 +0,0 @@
288.4 -/*
288.5 - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
288.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
288.7 - *
288.8 - * This code is free software; you can redistribute it and/or modify it
288.9 - * under the terms of the GNU General Public License version 2 only, as
288.10 - * published by the Free Software Foundation. Oracle designates this
288.11 - * particular file as subject to the "Classpath" exception as provided
288.12 - * by Oracle in the LICENSE file that accompanied this code.
288.13 - *
288.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
288.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
288.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
288.17 - * version 2 for more details (a copy is included in the LICENSE file that
288.18 - * accompanied this code).
288.19 - *
288.20 - * You should have received a copy of the GNU General Public License version
288.21 - * 2 along with this work; if not, write to the Free Software Foundation,
288.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
288.23 - *
288.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
288.25 - * or visit www.oracle.com if you need additional information or have any
288.26 - * questions.
288.27 - */
288.28 -
288.29 -package sun.io;
288.30 -
288.31 -/**
288.32 - * A table to convert Cp1144 to Unicode. This converter differs from
288.33 - * Cp280 is one code point, 0x9F, which changes from \u00A4 to \u20AC.
288.34 - * @author Alan Liu
288.35 - */
288.36 -public class ByteToCharCp1144 extends ByteToCharCp280 {
288.37 - public ByteToCharCp1144() {}
288.38 -
288.39 - public String getCharacterEncoding() {
288.40 - return "Cp1144";
288.41 - }
288.42 -
288.43 - protected char getUnicode(int byteIndex) {
288.44 - // Change single code point with respect to parent.
288.45 - // Cast to byte to get sign extension to match byteIndex.
288.46 - return (byteIndex == (byte)0x9F) ? '\u20AC' : super.getUnicode(byteIndex);
288.47 - }
288.48 -}
288.49 -
288.50 -//eof
289.1 --- a/src/share/classes/sun/io/ByteToCharCp1145.java Thu Sep 01 13:54:38 2011 -0700
289.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
289.3 @@ -1,47 +0,0 @@
289.4 -/*
289.5 - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
289.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
289.7 - *
289.8 - * This code is free software; you can redistribute it and/or modify it
289.9 - * under the terms of the GNU General Public License version 2 only, as
289.10 - * published by the Free Software Foundation. Oracle designates this
289.11 - * particular file as subject to the "Classpath" exception as provided
289.12 - * by Oracle in the LICENSE file that accompanied this code.
289.13 - *
289.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
289.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
289.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
289.17 - * version 2 for more details (a copy is included in the LICENSE file that
289.18 - * accompanied this code).
289.19 - *
289.20 - * You should have received a copy of the GNU General Public License version
289.21 - * 2 along with this work; if not, write to the Free Software Foundation,
289.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
289.23 - *
289.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
289.25 - * or visit www.oracle.com if you need additional information or have any
289.26 - * questions.
289.27 - */
289.28 -
289.29 -package sun.io;
289.30 -
289.31 -/**
289.32 - * A table to convert Cp1145 to Unicode. This converter differs from
289.33 - * Cp284 is one code point, 0x9F, which changes from \u00A4 to \u20AC.
289.34 - * @author Alan Liu
289.35 - */
289.36 -public class ByteToCharCp1145 extends ByteToCharCp284 {
289.37 - public ByteToCharCp1145() {}
289.38 -
289.39 - public String getCharacterEncoding() {
289.40 - return "Cp1145";
289.41 - }
289.42 -
289.43 - protected char getUnicode(int byteIndex) {
289.44 - // Change single code point with respect to parent.
289.45 - // Cast to byte to get sign extension to match byteIndex.
289.46 - return (byteIndex == (byte)0x9F) ? '\u20AC' : super.getUnicode(byteIndex);
289.47 - }
289.48 -}
289.49 -
289.50 -//eof
290.1 --- a/src/share/classes/sun/io/ByteToCharCp1146.java Thu Sep 01 13:54:38 2011 -0700
290.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
290.3 @@ -1,47 +0,0 @@
290.4 -/*
290.5 - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
290.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
290.7 - *
290.8 - * This code is free software; you can redistribute it and/or modify it
290.9 - * under the terms of the GNU General Public License version 2 only, as
290.10 - * published by the Free Software Foundation. Oracle designates this
290.11 - * particular file as subject to the "Classpath" exception as provided
290.12 - * by Oracle in the LICENSE file that accompanied this code.
290.13 - *
290.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
290.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
290.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
290.17 - * version 2 for more details (a copy is included in the LICENSE file that
290.18 - * accompanied this code).
290.19 - *
290.20 - * You should have received a copy of the GNU General Public License version
290.21 - * 2 along with this work; if not, write to the Free Software Foundation,
290.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
290.23 - *
290.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
290.25 - * or visit www.oracle.com if you need additional information or have any
290.26 - * questions.
290.27 - */
290.28 -
290.29 -package sun.io;
290.30 -
290.31 -/**
290.32 - * A table to convert Cp1146 to Unicode. This converter differs from
290.33 - * Cp285 is one code point, 0x9F, which changes from \u00A4 to \u20AC.
290.34 - * @author Alan Liu
290.35 - */
290.36 -public class ByteToCharCp1146 extends ByteToCharCp285 {
290.37 - public ByteToCharCp1146() {}
290.38 -
290.39 - public String getCharacterEncoding() {
290.40 - return "Cp1146";
290.41 - }
290.42 -
290.43 - protected char getUnicode(int byteIndex) {
290.44 - // Change single code point with respect to parent.
290.45 - // Cast to byte to get sign extension to match byteIndex.
290.46 - return (byteIndex == (byte)0x9F) ? '\u20AC' : super.getUnicode(byteIndex);
290.47 - }
290.48 -}
290.49 -
290.50 -//eof
291.1 --- a/src/share/classes/sun/io/ByteToCharCp1147.java Thu Sep 01 13:54:38 2011 -0700
291.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
291.3 @@ -1,47 +0,0 @@
291.4 -/*
291.5 - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
291.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
291.7 - *
291.8 - * This code is free software; you can redistribute it and/or modify it
291.9 - * under the terms of the GNU General Public License version 2 only, as
291.10 - * published by the Free Software Foundation. Oracle designates this
291.11 - * particular file as subject to the "Classpath" exception as provided
291.12 - * by Oracle in the LICENSE file that accompanied this code.
291.13 - *
291.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
291.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
291.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
291.17 - * version 2 for more details (a copy is included in the LICENSE file that
291.18 - * accompanied this code).
291.19 - *
291.20 - * You should have received a copy of the GNU General Public License version
291.21 - * 2 along with this work; if not, write to the Free Software Foundation,
291.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
291.23 - *
291.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
291.25 - * or visit www.oracle.com if you need additional information or have any
291.26 - * questions.
291.27 - */
291.28 -
291.29 -package sun.io;
291.30 -
291.31 -/**
291.32 - * A table to convert Cp1147 to Unicode. This converter differs from
291.33 - * Cp297 is one code point, 0x9F, which changes from \u00A4 to \u20AC.
291.34 - * @author Alan Liu
291.35 - */
291.36 -public class ByteToCharCp1147 extends ByteToCharCp297 {
291.37 - public ByteToCharCp1147() {}
291.38 -
291.39 - public String getCharacterEncoding() {
291.40 - return "Cp1147";
291.41 - }
291.42 -
291.43 - protected char getUnicode(int byteIndex) {
291.44 - // Change single code point with respect to parent.
291.45 - // Cast to byte to get sign extension to match byteIndex.
291.46 - return (byteIndex == (byte)0x9F) ? '\u20AC' : super.getUnicode(byteIndex);
291.47 - }
291.48 -}
291.49 -
291.50 -//eof
292.1 --- a/src/share/classes/sun/io/ByteToCharCp1148.java Thu Sep 01 13:54:38 2011 -0700
292.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
292.3 @@ -1,47 +0,0 @@
292.4 -/*
292.5 - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
292.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
292.7 - *
292.8 - * This code is free software; you can redistribute it and/or modify it
292.9 - * under the terms of the GNU General Public License version 2 only, as
292.10 - * published by the Free Software Foundation. Oracle designates this
292.11 - * particular file as subject to the "Classpath" exception as provided
292.12 - * by Oracle in the LICENSE file that accompanied this code.
292.13 - *
292.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
292.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
292.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
292.17 - * version 2 for more details (a copy is included in the LICENSE file that
292.18 - * accompanied this code).
292.19 - *
292.20 - * You should have received a copy of the GNU General Public License version
292.21 - * 2 along with this work; if not, write to the Free Software Foundation,
292.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
292.23 - *
292.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
292.25 - * or visit www.oracle.com if you need additional information or have any
292.26 - * questions.
292.27 - */
292.28 -
292.29 -package sun.io;
292.30 -
292.31 -/**
292.32 - * A table to convert Cp1148 to Unicode. This converter differs from
292.33 - * Cp500 is one code point, 0x9F, which changes from \u00A4 to \u20AC.
292.34 - * @author Alan Liu
292.35 - */
292.36 -public class ByteToCharCp1148 extends ByteToCharCp500 {
292.37 - public ByteToCharCp1148() {}
292.38 -
292.39 - public String getCharacterEncoding() {
292.40 - return "Cp1148";
292.41 - }
292.42 -
292.43 - protected char getUnicode(int byteIndex) {
292.44 - // Change single code point with respect to parent.
292.45 - // Cast to byte to get sign extension to match byteIndex.
292.46 - return (byteIndex == (byte)0x9F) ? '\u20AC' : super.getUnicode(byteIndex);
292.47 - }
292.48 -}
292.49 -
292.50 -//eof
293.1 --- a/src/share/classes/sun/io/ByteToCharCp1149.java Thu Sep 01 13:54:38 2011 -0700
293.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
293.3 @@ -1,47 +0,0 @@
293.4 -/*
293.5 - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
293.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
293.7 - *
293.8 - * This code is free software; you can redistribute it and/or modify it
293.9 - * under the terms of the GNU General Public License version 2 only, as
293.10 - * published by the Free Software Foundation. Oracle designates this
293.11 - * particular file as subject to the "Classpath" exception as provided
293.12 - * by Oracle in the LICENSE file that accompanied this code.
293.13 - *
293.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
293.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
293.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
293.17 - * version 2 for more details (a copy is included in the LICENSE file that
293.18 - * accompanied this code).
293.19 - *
293.20 - * You should have received a copy of the GNU General Public License version
293.21 - * 2 along with this work; if not, write to the Free Software Foundation,
293.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
293.23 - *
293.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
293.25 - * or visit www.oracle.com if you need additional information or have any
293.26 - * questions.
293.27 - */
293.28 -
293.29 -package sun.io;
293.30 -
293.31 -/**
293.32 - * A table to convert Cp1149 to Unicode. This converter differs from
293.33 - * Cp871 is one code point, 0x9F, which changes from \u00A4 to \u20AC.
293.34 - * @author Alan Liu
293.35 - */
293.36 -public class ByteToCharCp1149 extends ByteToCharCp871 {
293.37 - public ByteToCharCp1149() {}
293.38 -
293.39 - public String getCharacterEncoding() {
293.40 - return "Cp1149";
293.41 - }
293.42 -
293.43 - protected char getUnicode(int byteIndex) {
293.44 - // Change single code point with respect to parent.
293.45 - // Cast to byte to get sign extension to match byteIndex.
293.46 - return (byteIndex == (byte)0x9F) ? '\u20AC' : super.getUnicode(byteIndex);
293.47 - }
293.48 -}
293.49 -
293.50 -//eof
294.1 --- a/src/share/classes/sun/io/ByteToCharCp1250.java Thu Sep 01 13:54:38 2011 -0700
294.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
294.3 @@ -1,48 +0,0 @@
294.4 -/*
294.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
294.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
294.7 - *
294.8 - * This code is free software; you can redistribute it and/or modify it
294.9 - * under the terms of the GNU General Public License version 2 only, as
294.10 - * published by the Free Software Foundation. Oracle designates this
294.11 - * particular file as subject to the "Classpath" exception as provided
294.12 - * by Oracle in the LICENSE file that accompanied this code.
294.13 - *
294.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
294.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
294.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
294.17 - * version 2 for more details (a copy is included in the LICENSE file that
294.18 - * accompanied this code).
294.19 - *
294.20 - * You should have received a copy of the GNU General Public License version
294.21 - * 2 along with this work; if not, write to the Free Software Foundation,
294.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
294.23 - *
294.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
294.25 - * or visit www.oracle.com if you need additional information or have any
294.26 - * questions.
294.27 - */
294.28 -
294.29 -
294.30 -package sun.io;
294.31 -
294.32 -import sun.nio.cs.MS1250;
294.33 -
294.34 -/**
294.35 - * A table to convert Cp1250 to Unicode
294.36 - *
294.37 - * @author ConverterGenerator tool
294.38 - */
294.39 -
294.40 -public class ByteToCharCp1250 extends ByteToCharSingleByte {
294.41 -
294.42 - private final static MS1250 nioCoder = new MS1250();
294.43 -
294.44 - public String getCharacterEncoding() {
294.45 - return "Cp1250";
294.46 - }
294.47 -
294.48 - public ByteToCharCp1250() {
294.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
294.50 - }
294.51 -}
295.1 --- a/src/share/classes/sun/io/ByteToCharCp1251.java Thu Sep 01 13:54:38 2011 -0700
295.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
295.3 @@ -1,48 +0,0 @@
295.4 -/*
295.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
295.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
295.7 - *
295.8 - * This code is free software; you can redistribute it and/or modify it
295.9 - * under the terms of the GNU General Public License version 2 only, as
295.10 - * published by the Free Software Foundation. Oracle designates this
295.11 - * particular file as subject to the "Classpath" exception as provided
295.12 - * by Oracle in the LICENSE file that accompanied this code.
295.13 - *
295.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
295.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
295.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
295.17 - * version 2 for more details (a copy is included in the LICENSE file that
295.18 - * accompanied this code).
295.19 - *
295.20 - * You should have received a copy of the GNU General Public License version
295.21 - * 2 along with this work; if not, write to the Free Software Foundation,
295.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
295.23 - *
295.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
295.25 - * or visit www.oracle.com if you need additional information or have any
295.26 - * questions.
295.27 - */
295.28 -
295.29 -
295.30 -package sun.io;
295.31 -
295.32 -import sun.nio.cs.MS1251;
295.33 -
295.34 -/**
295.35 - * A table to convert Cp1251 to Unicode
295.36 - *
295.37 - * @author ConverterGenerator tool
295.38 - */
295.39 -
295.40 -public class ByteToCharCp1251 extends ByteToCharSingleByte {
295.41 -
295.42 - private final static MS1251 nioCoder = new MS1251();
295.43 -
295.44 - public String getCharacterEncoding() {
295.45 - return "Cp1251";
295.46 - }
295.47 -
295.48 - public ByteToCharCp1251() {
295.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
295.50 - }
295.51 -}
296.1 --- a/src/share/classes/sun/io/ByteToCharCp1252.java Thu Sep 01 13:54:38 2011 -0700
296.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
296.3 @@ -1,47 +0,0 @@
296.4 -/*
296.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
296.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
296.7 - *
296.8 - * This code is free software; you can redistribute it and/or modify it
296.9 - * under the terms of the GNU General Public License version 2 only, as
296.10 - * published by the Free Software Foundation. Oracle designates this
296.11 - * particular file as subject to the "Classpath" exception as provided
296.12 - * by Oracle in the LICENSE file that accompanied this code.
296.13 - *
296.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
296.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
296.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
296.17 - * version 2 for more details (a copy is included in the LICENSE file that
296.18 - * accompanied this code).
296.19 - *
296.20 - * You should have received a copy of the GNU General Public License version
296.21 - * 2 along with this work; if not, write to the Free Software Foundation,
296.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
296.23 - *
296.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
296.25 - * or visit www.oracle.com if you need additional information or have any
296.26 - * questions.
296.27 - */
296.28 -
296.29 -package sun.io;
296.30 -
296.31 -import sun.nio.cs.MS1252;
296.32 -
296.33 -/**
296.34 - * A table to convert Cp1252 to Unicode
296.35 - *
296.36 - * @author ConverterGenerator tool
296.37 - */
296.38 -
296.39 -public class ByteToCharCp1252 extends ByteToCharSingleByte {
296.40 -
296.41 - private final static MS1252 nioCoder = new MS1252();
296.42 -
296.43 - public String getCharacterEncoding() {
296.44 - return "Cp1252";
296.45 - }
296.46 -
296.47 - public ByteToCharCp1252() {
296.48 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
296.49 - }
296.50 -}
297.1 --- a/src/share/classes/sun/io/ByteToCharCp1253.java Thu Sep 01 13:54:38 2011 -0700
297.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
297.3 @@ -1,48 +0,0 @@
297.4 -/*
297.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
297.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
297.7 - *
297.8 - * This code is free software; you can redistribute it and/or modify it
297.9 - * under the terms of the GNU General Public License version 2 only, as
297.10 - * published by the Free Software Foundation. Oracle designates this
297.11 - * particular file as subject to the "Classpath" exception as provided
297.12 - * by Oracle in the LICENSE file that accompanied this code.
297.13 - *
297.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
297.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
297.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
297.17 - * version 2 for more details (a copy is included in the LICENSE file that
297.18 - * accompanied this code).
297.19 - *
297.20 - * You should have received a copy of the GNU General Public License version
297.21 - * 2 along with this work; if not, write to the Free Software Foundation,
297.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
297.23 - *
297.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
297.25 - * or visit www.oracle.com if you need additional information or have any
297.26 - * questions.
297.27 - */
297.28 -
297.29 -
297.30 -package sun.io;
297.31 -
297.32 -import sun.nio.cs.MS1253;
297.33 -
297.34 -/**
297.35 - * A table to convert Cp1253 to Unicode
297.36 - *
297.37 - * @author ConverterGenerator tool
297.38 - */
297.39 -
297.40 -public class ByteToCharCp1253 extends ByteToCharSingleByte {
297.41 -
297.42 - private final static MS1253 nioCoder = new MS1253();
297.43 -
297.44 - public String getCharacterEncoding() {
297.45 - return "Cp1253";
297.46 - }
297.47 -
297.48 - public ByteToCharCp1253() {
297.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
297.50 - }
297.51 -}
298.1 --- a/src/share/classes/sun/io/ByteToCharCp1254.java Thu Sep 01 13:54:38 2011 -0700
298.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
298.3 @@ -1,48 +0,0 @@
298.4 -/*
298.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
298.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
298.7 - *
298.8 - * This code is free software; you can redistribute it and/or modify it
298.9 - * under the terms of the GNU General Public License version 2 only, as
298.10 - * published by the Free Software Foundation. Oracle designates this
298.11 - * particular file as subject to the "Classpath" exception as provided
298.12 - * by Oracle in the LICENSE file that accompanied this code.
298.13 - *
298.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
298.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
298.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
298.17 - * version 2 for more details (a copy is included in the LICENSE file that
298.18 - * accompanied this code).
298.19 - *
298.20 - * You should have received a copy of the GNU General Public License version
298.21 - * 2 along with this work; if not, write to the Free Software Foundation,
298.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
298.23 - *
298.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
298.25 - * or visit www.oracle.com if you need additional information or have any
298.26 - * questions.
298.27 - */
298.28 -
298.29 -
298.30 -package sun.io;
298.31 -
298.32 -import sun.nio.cs.MS1254;
298.33 -
298.34 -/**
298.35 - * A table to convert Cp1254 to Unicode
298.36 - *
298.37 - * @author ConverterGenerator tool
298.38 - */
298.39 -
298.40 -public class ByteToCharCp1254 extends ByteToCharSingleByte {
298.41 -
298.42 - private final static MS1254 nioCoder = new MS1254();
298.43 -
298.44 - public String getCharacterEncoding() {
298.45 - return "Cp1254";
298.46 - }
298.47 -
298.48 - public ByteToCharCp1254() {
298.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
298.50 - }
298.51 -}
299.1 --- a/src/share/classes/sun/io/ByteToCharCp1255.java Thu Sep 01 13:54:38 2011 -0700
299.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
299.3 @@ -1,48 +0,0 @@
299.4 -/*
299.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
299.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
299.7 - *
299.8 - * This code is free software; you can redistribute it and/or modify it
299.9 - * under the terms of the GNU General Public License version 2 only, as
299.10 - * published by the Free Software Foundation. Oracle designates this
299.11 - * particular file as subject to the "Classpath" exception as provided
299.12 - * by Oracle in the LICENSE file that accompanied this code.
299.13 - *
299.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
299.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
299.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
299.17 - * version 2 for more details (a copy is included in the LICENSE file that
299.18 - * accompanied this code).
299.19 - *
299.20 - * You should have received a copy of the GNU General Public License version
299.21 - * 2 along with this work; if not, write to the Free Software Foundation,
299.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
299.23 - *
299.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
299.25 - * or visit www.oracle.com if you need additional information or have any
299.26 - * questions.
299.27 - */
299.28 -
299.29 -
299.30 -package sun.io;
299.31 -
299.32 -import sun.nio.cs.ext.MS1255;
299.33 -
299.34 -/**
299.35 - * A table to convert Cp1255 to Unicode
299.36 - *
299.37 - * @author ConverterGenerator tool
299.38 - */
299.39 -
299.40 -public class ByteToCharCp1255 extends ByteToCharSingleByte {
299.41 -
299.42 - private final static MS1255 nioCoder = new MS1255();
299.43 -
299.44 - public String getCharacterEncoding() {
299.45 - return "Cp1255";
299.46 - }
299.47 -
299.48 - public ByteToCharCp1255() {
299.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
299.50 - }
299.51 -}
300.1 --- a/src/share/classes/sun/io/ByteToCharCp1256.java Thu Sep 01 13:54:38 2011 -0700
300.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
300.3 @@ -1,48 +0,0 @@
300.4 -/*
300.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
300.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
300.7 - *
300.8 - * This code is free software; you can redistribute it and/or modify it
300.9 - * under the terms of the GNU General Public License version 2 only, as
300.10 - * published by the Free Software Foundation. Oracle designates this
300.11 - * particular file as subject to the "Classpath" exception as provided
300.12 - * by Oracle in the LICENSE file that accompanied this code.
300.13 - *
300.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
300.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
300.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
300.17 - * version 2 for more details (a copy is included in the LICENSE file that
300.18 - * accompanied this code).
300.19 - *
300.20 - * You should have received a copy of the GNU General Public License version
300.21 - * 2 along with this work; if not, write to the Free Software Foundation,
300.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
300.23 - *
300.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
300.25 - * or visit www.oracle.com if you need additional information or have any
300.26 - * questions.
300.27 - */
300.28 -
300.29 -
300.30 -package sun.io;
300.31 -
300.32 -import sun.nio.cs.ext.MS1256;
300.33 -
300.34 -/**
300.35 - * A table to convert Cp1256 to Unicode
300.36 - *
300.37 - * @author ConverterGenerator tool
300.38 - */
300.39 -
300.40 -public class ByteToCharCp1256 extends ByteToCharSingleByte {
300.41 -
300.42 - private final static MS1256 nioCoder = new MS1256();
300.43 -
300.44 - public String getCharacterEncoding() {
300.45 - return "Cp1256";
300.46 - }
300.47 -
300.48 - public ByteToCharCp1256() {
300.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
300.50 - }
300.51 -}
301.1 --- a/src/share/classes/sun/io/ByteToCharCp1257.java Thu Sep 01 13:54:38 2011 -0700
301.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
301.3 @@ -1,48 +0,0 @@
301.4 -/*
301.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
301.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
301.7 - *
301.8 - * This code is free software; you can redistribute it and/or modify it
301.9 - * under the terms of the GNU General Public License version 2 only, as
301.10 - * published by the Free Software Foundation. Oracle designates this
301.11 - * particular file as subject to the "Classpath" exception as provided
301.12 - * by Oracle in the LICENSE file that accompanied this code.
301.13 - *
301.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
301.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
301.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
301.17 - * version 2 for more details (a copy is included in the LICENSE file that
301.18 - * accompanied this code).
301.19 - *
301.20 - * You should have received a copy of the GNU General Public License version
301.21 - * 2 along with this work; if not, write to the Free Software Foundation,
301.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
301.23 - *
301.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
301.25 - * or visit www.oracle.com if you need additional information or have any
301.26 - * questions.
301.27 - */
301.28 -
301.29 -
301.30 -package sun.io;
301.31 -
301.32 -import sun.nio.cs.MS1257;
301.33 -
301.34 -/**
301.35 - * A table to convert Cp1257 to Unicode
301.36 - *
301.37 - * @author ConverterGenerator tool
301.38 - */
301.39 -
301.40 -public class ByteToCharCp1257 extends ByteToCharSingleByte {
301.41 -
301.42 - private final static MS1257 nioCoder = new MS1257();
301.43 -
301.44 - public String getCharacterEncoding() {
301.45 - return "Cp1257";
301.46 - }
301.47 -
301.48 - public ByteToCharCp1257() {
301.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
301.50 - }
301.51 -}
302.1 --- a/src/share/classes/sun/io/ByteToCharCp1258.java Thu Sep 01 13:54:38 2011 -0700
302.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
302.3 @@ -1,48 +0,0 @@
302.4 -/*
302.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
302.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
302.7 - *
302.8 - * This code is free software; you can redistribute it and/or modify it
302.9 - * under the terms of the GNU General Public License version 2 only, as
302.10 - * published by the Free Software Foundation. Oracle designates this
302.11 - * particular file as subject to the "Classpath" exception as provided
302.12 - * by Oracle in the LICENSE file that accompanied this code.
302.13 - *
302.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
302.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
302.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
302.17 - * version 2 for more details (a copy is included in the LICENSE file that
302.18 - * accompanied this code).
302.19 - *
302.20 - * You should have received a copy of the GNU General Public License version
302.21 - * 2 along with this work; if not, write to the Free Software Foundation,
302.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
302.23 - *
302.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
302.25 - * or visit www.oracle.com if you need additional information or have any
302.26 - * questions.
302.27 - */
302.28 -
302.29 -
302.30 -package sun.io;
302.31 -
302.32 -import sun.nio.cs.ext.MS1258;
302.33 -
302.34 -/**
302.35 - * A table to convert Cp1258 to Unicode
302.36 - *
302.37 - * @author ConverterGenerator tool
302.38 - */
302.39 -
302.40 -public class ByteToCharCp1258 extends ByteToCharSingleByte {
302.41 -
302.42 - private final static MS1258 nioCoder = new MS1258();
302.43 -
302.44 - public String getCharacterEncoding() {
302.45 - return "Cp1258";
302.46 - }
302.47 -
302.48 - public ByteToCharCp1258() {
302.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
302.50 - }
302.51 -}
303.1 --- a/src/share/classes/sun/io/ByteToCharCp1381.java Thu Sep 01 13:54:38 2011 -0700
303.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
303.3 @@ -1,39 +0,0 @@
303.4 -/*
303.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
303.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
303.7 - *
303.8 - * This code is free software; you can redistribute it and/or modify it
303.9 - * under the terms of the GNU General Public License version 2 only, as
303.10 - * published by the Free Software Foundation. Oracle designates this
303.11 - * particular file as subject to the "Classpath" exception as provided
303.12 - * by Oracle in the LICENSE file that accompanied this code.
303.13 - *
303.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
303.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
303.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
303.17 - * version 2 for more details (a copy is included in the LICENSE file that
303.18 - * accompanied this code).
303.19 - *
303.20 - * You should have received a copy of the GNU General Public License version
303.21 - * 2 along with this work; if not, write to the Free Software Foundation,
303.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
303.23 - *
303.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
303.25 - * or visit www.oracle.com if you need additional information or have any
303.26 - * questions.
303.27 - */
303.28 -package sun.io;
303.29 -
303.30 -import sun.nio.cs.ext.*;
303.31 -
303.32 -public class ByteToCharCp1381 extends ByteToCharDBCS_ASCII {
303.33 -
303.34 - // Return the character set id
303.35 - public String getCharacterEncoding() {
303.36 - return "Cp1381";
303.37 - }
303.38 -
303.39 - public ByteToCharCp1381() {
303.40 - super((DoubleByte.Decoder)new IBM1381().newDecoder());
303.41 - }
303.42 -}
304.1 --- a/src/share/classes/sun/io/ByteToCharCp1383.java Thu Sep 01 13:54:38 2011 -0700
304.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
304.3 @@ -1,39 +0,0 @@
304.4 -/*
304.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
304.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
304.7 - *
304.8 - * This code is free software; you can redistribute it and/or modify it
304.9 - * under the terms of the GNU General Public License version 2 only, as
304.10 - * published by the Free Software Foundation. Oracle designates this
304.11 - * particular file as subject to the "Classpath" exception as provided
304.12 - * by Oracle in the LICENSE file that accompanied this code.
304.13 - *
304.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
304.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
304.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
304.17 - * version 2 for more details (a copy is included in the LICENSE file that
304.18 - * accompanied this code).
304.19 - *
304.20 - * You should have received a copy of the GNU General Public License version
304.21 - * 2 along with this work; if not, write to the Free Software Foundation,
304.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
304.23 - *
304.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
304.25 - * or visit www.oracle.com if you need additional information or have any
304.26 - * questions.
304.27 - */
304.28 -package sun.io;
304.29 -
304.30 -import sun.nio.cs.ext.*;
304.31 -
304.32 -public class ByteToCharCp1383 extends ByteToCharEUC2 {
304.33 -
304.34 - // Return the character set id
304.35 - public String getCharacterEncoding() {
304.36 - return "Cp1383";
304.37 - }
304.38 -
304.39 - public ByteToCharCp1383() {
304.40 - super((DoubleByte.Decoder)new IBM1383().newDecoder());
304.41 - }
304.42 -}
305.1 --- a/src/share/classes/sun/io/ByteToCharCp273.java Thu Sep 01 13:54:38 2011 -0700
305.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
305.3 @@ -1,48 +0,0 @@
305.4 -/*
305.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
305.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
305.7 - *
305.8 - * This code is free software; you can redistribute it and/or modify it
305.9 - * under the terms of the GNU General Public License version 2 only, as
305.10 - * published by the Free Software Foundation. Oracle designates this
305.11 - * particular file as subject to the "Classpath" exception as provided
305.12 - * by Oracle in the LICENSE file that accompanied this code.
305.13 - *
305.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
305.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
305.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
305.17 - * version 2 for more details (a copy is included in the LICENSE file that
305.18 - * accompanied this code).
305.19 - *
305.20 - * You should have received a copy of the GNU General Public License version
305.21 - * 2 along with this work; if not, write to the Free Software Foundation,
305.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
305.23 - *
305.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
305.25 - * or visit www.oracle.com if you need additional information or have any
305.26 - * questions.
305.27 - */
305.28 -
305.29 -
305.30 -package sun.io;
305.31 -
305.32 -import sun.nio.cs.ext.IBM273;
305.33 -
305.34 -/**
305.35 - * A table to convert to Cp273 to Unicode
305.36 - *
305.37 - * @author ConverterGenerator tool
305.38 - */
305.39 -
305.40 -public class ByteToCharCp273 extends ByteToCharSingleByte {
305.41 -
305.42 - private final static IBM273 nioCoder = new IBM273();
305.43 -
305.44 - public String getCharacterEncoding() {
305.45 - return "Cp273";
305.46 - }
305.47 -
305.48 - public ByteToCharCp273() {
305.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
305.50 - }
305.51 -}
306.1 --- a/src/share/classes/sun/io/ByteToCharCp277.java Thu Sep 01 13:54:38 2011 -0700
306.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
306.3 @@ -1,48 +0,0 @@
306.4 -/*
306.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
306.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
306.7 - *
306.8 - * This code is free software; you can redistribute it and/or modify it
306.9 - * under the terms of the GNU General Public License version 2 only, as
306.10 - * published by the Free Software Foundation. Oracle designates this
306.11 - * particular file as subject to the "Classpath" exception as provided
306.12 - * by Oracle in the LICENSE file that accompanied this code.
306.13 - *
306.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
306.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
306.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
306.17 - * version 2 for more details (a copy is included in the LICENSE file that
306.18 - * accompanied this code).
306.19 - *
306.20 - * You should have received a copy of the GNU General Public License version
306.21 - * 2 along with this work; if not, write to the Free Software Foundation,
306.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
306.23 - *
306.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
306.25 - * or visit www.oracle.com if you need additional information or have any
306.26 - * questions.
306.27 - */
306.28 -
306.29 -
306.30 -package sun.io;
306.31 -
306.32 -import sun.nio.cs.ext.IBM277;
306.33 -
306.34 -/**
306.35 - * A table to convert to Cp277 to Unicode
306.36 - *
306.37 - * @author ConverterGenerator tool
306.38 - */
306.39 -
306.40 -public class ByteToCharCp277 extends ByteToCharSingleByte {
306.41 -
306.42 - private final static IBM277 nioCoder = new IBM277();
306.43 -
306.44 - public String getCharacterEncoding() {
306.45 - return "Cp277";
306.46 - }
306.47 -
306.48 - public ByteToCharCp277() {
306.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
306.50 - }
306.51 -}
307.1 --- a/src/share/classes/sun/io/ByteToCharCp278.java Thu Sep 01 13:54:38 2011 -0700
307.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
307.3 @@ -1,48 +0,0 @@
307.4 -/*
307.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
307.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
307.7 - *
307.8 - * This code is free software; you can redistribute it and/or modify it
307.9 - * under the terms of the GNU General Public License version 2 only, as
307.10 - * published by the Free Software Foundation. Oracle designates this
307.11 - * particular file as subject to the "Classpath" exception as provided
307.12 - * by Oracle in the LICENSE file that accompanied this code.
307.13 - *
307.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
307.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
307.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
307.17 - * version 2 for more details (a copy is included in the LICENSE file that
307.18 - * accompanied this code).
307.19 - *
307.20 - * You should have received a copy of the GNU General Public License version
307.21 - * 2 along with this work; if not, write to the Free Software Foundation,
307.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
307.23 - *
307.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
307.25 - * or visit www.oracle.com if you need additional information or have any
307.26 - * questions.
307.27 - */
307.28 -
307.29 -
307.30 -package sun.io;
307.31 -
307.32 -import sun.nio.cs.ext.IBM278;
307.33 -
307.34 -/**
307.35 - * A table to convert to Cp278 to Unicode
307.36 - *
307.37 - * @author ConverterGenerator tool
307.38 - */
307.39 -
307.40 -public class ByteToCharCp278 extends ByteToCharSingleByte {
307.41 -
307.42 - private final static IBM278 nioCoder = new IBM278();
307.43 -
307.44 - public String getCharacterEncoding() {
307.45 - return "Cp278";
307.46 - }
307.47 -
307.48 - public ByteToCharCp278() {
307.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
307.50 - }
307.51 -}
308.1 --- a/src/share/classes/sun/io/ByteToCharCp280.java Thu Sep 01 13:54:38 2011 -0700
308.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
308.3 @@ -1,48 +0,0 @@
308.4 -/*
308.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
308.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
308.7 - *
308.8 - * This code is free software; you can redistribute it and/or modify it
308.9 - * under the terms of the GNU General Public License version 2 only, as
308.10 - * published by the Free Software Foundation. Oracle designates this
308.11 - * particular file as subject to the "Classpath" exception as provided
308.12 - * by Oracle in the LICENSE file that accompanied this code.
308.13 - *
308.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
308.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
308.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
308.17 - * version 2 for more details (a copy is included in the LICENSE file that
308.18 - * accompanied this code).
308.19 - *
308.20 - * You should have received a copy of the GNU General Public License version
308.21 - * 2 along with this work; if not, write to the Free Software Foundation,
308.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
308.23 - *
308.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
308.25 - * or visit www.oracle.com if you need additional information or have any
308.26 - * questions.
308.27 - */
308.28 -
308.29 -
308.30 -package sun.io;
308.31 -
308.32 -import sun.nio.cs.ext.IBM280;
308.33 -
308.34 -/**
308.35 - * A table to convert to Cp280 to Unicode
308.36 - *
308.37 - * @author ConverterGenerator tool
308.38 - */
308.39 -
308.40 -public class ByteToCharCp280 extends ByteToCharSingleByte {
308.41 -
308.42 - private final static IBM280 nioCoder = new IBM280();
308.43 -
308.44 - public String getCharacterEncoding() {
308.45 - return "Cp280";
308.46 - }
308.47 -
308.48 - public ByteToCharCp280() {
308.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
308.50 - }
308.51 -}
309.1 --- a/src/share/classes/sun/io/ByteToCharCp284.java Thu Sep 01 13:54:38 2011 -0700
309.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
309.3 @@ -1,48 +0,0 @@
309.4 -/*
309.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
309.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
309.7 - *
309.8 - * This code is free software; you can redistribute it and/or modify it
309.9 - * under the terms of the GNU General Public License version 2 only, as
309.10 - * published by the Free Software Foundation. Oracle designates this
309.11 - * particular file as subject to the "Classpath" exception as provided
309.12 - * by Oracle in the LICENSE file that accompanied this code.
309.13 - *
309.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
309.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
309.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
309.17 - * version 2 for more details (a copy is included in the LICENSE file that
309.18 - * accompanied this code).
309.19 - *
309.20 - * You should have received a copy of the GNU General Public License version
309.21 - * 2 along with this work; if not, write to the Free Software Foundation,
309.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
309.23 - *
309.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
309.25 - * or visit www.oracle.com if you need additional information or have any
309.26 - * questions.
309.27 - */
309.28 -
309.29 -
309.30 -package sun.io;
309.31 -
309.32 -import sun.nio.cs.ext.IBM284;
309.33 -
309.34 -/**
309.35 - * A table to convert to Cp284 to Unicode
309.36 - *
309.37 - * @author ConverterGenerator tool
309.38 - */
309.39 -
309.40 -public class ByteToCharCp284 extends ByteToCharSingleByte {
309.41 -
309.42 - private final static IBM284 nioCoder = new IBM284();
309.43 -
309.44 - public String getCharacterEncoding() {
309.45 - return "Cp284";
309.46 - }
309.47 -
309.48 - public ByteToCharCp284() {
309.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
309.50 - }
309.51 -}
310.1 --- a/src/share/classes/sun/io/ByteToCharCp285.java Thu Sep 01 13:54:38 2011 -0700
310.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
310.3 @@ -1,48 +0,0 @@
310.4 -/*
310.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
310.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
310.7 - *
310.8 - * This code is free software; you can redistribute it and/or modify it
310.9 - * under the terms of the GNU General Public License version 2 only, as
310.10 - * published by the Free Software Foundation. Oracle designates this
310.11 - * particular file as subject to the "Classpath" exception as provided
310.12 - * by Oracle in the LICENSE file that accompanied this code.
310.13 - *
310.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
310.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
310.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
310.17 - * version 2 for more details (a copy is included in the LICENSE file that
310.18 - * accompanied this code).
310.19 - *
310.20 - * You should have received a copy of the GNU General Public License version
310.21 - * 2 along with this work; if not, write to the Free Software Foundation,
310.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
310.23 - *
310.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
310.25 - * or visit www.oracle.com if you need additional information or have any
310.26 - * questions.
310.27 - */
310.28 -
310.29 -
310.30 -package sun.io;
310.31 -
310.32 -import sun.nio.cs.ext.IBM285;
310.33 -
310.34 -/**
310.35 - * A table to convert to Cp285 to Unicode
310.36 - *
310.37 - * @author ConverterGenerator tool
310.38 - */
310.39 -
310.40 -public class ByteToCharCp285 extends ByteToCharSingleByte {
310.41 -
310.42 - private final static IBM285 nioCoder = new IBM285();
310.43 -
310.44 - public String getCharacterEncoding() {
310.45 - return "Cp285";
310.46 - }
310.47 -
310.48 - public ByteToCharCp285() {
310.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
310.50 - }
310.51 -}
311.1 --- a/src/share/classes/sun/io/ByteToCharCp297.java Thu Sep 01 13:54:38 2011 -0700
311.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
311.3 @@ -1,48 +0,0 @@
311.4 -/*
311.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
311.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
311.7 - *
311.8 - * This code is free software; you can redistribute it and/or modify it
311.9 - * under the terms of the GNU General Public License version 2 only, as
311.10 - * published by the Free Software Foundation. Oracle designates this
311.11 - * particular file as subject to the "Classpath" exception as provided
311.12 - * by Oracle in the LICENSE file that accompanied this code.
311.13 - *
311.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
311.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
311.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
311.17 - * version 2 for more details (a copy is included in the LICENSE file that
311.18 - * accompanied this code).
311.19 - *
311.20 - * You should have received a copy of the GNU General Public License version
311.21 - * 2 along with this work; if not, write to the Free Software Foundation,
311.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
311.23 - *
311.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
311.25 - * or visit www.oracle.com if you need additional information or have any
311.26 - * questions.
311.27 - */
311.28 -
311.29 -
311.30 -package sun.io;
311.31 -
311.32 -import sun.nio.cs.ext.IBM297;
311.33 -
311.34 -/**
311.35 - * A table to convert to Cp297 to Unicode
311.36 - *
311.37 - * @author ConverterGenerator tool
311.38 - */
311.39 -
311.40 -public class ByteToCharCp297 extends ByteToCharSingleByte {
311.41 -
311.42 - private final static IBM297 nioCoder = new IBM297();
311.43 -
311.44 - public String getCharacterEncoding() {
311.45 - return "Cp297";
311.46 - }
311.47 -
311.48 - public ByteToCharCp297() {
311.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
311.50 - }
311.51 -}
312.1 --- a/src/share/classes/sun/io/ByteToCharCp33722.java Thu Sep 01 13:54:38 2011 -0700
312.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
312.3 @@ -1,191 +0,0 @@
312.4 -/*
312.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
312.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
312.7 - *
312.8 - * This code is free software; you can redistribute it and/or modify it
312.9 - * under the terms of the GNU General Public License version 2 only, as
312.10 - * published by the Free Software Foundation. Oracle designates this
312.11 - * particular file as subject to the "Classpath" exception as provided
312.12 - * by Oracle in the LICENSE file that accompanied this code.
312.13 - *
312.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
312.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
312.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
312.17 - * version 2 for more details (a copy is included in the LICENSE file that
312.18 - * accompanied this code).
312.19 - *
312.20 - * You should have received a copy of the GNU General Public License version
312.21 - * 2 along with this work; if not, write to the Free Software Foundation,
312.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
312.23 - *
312.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
312.25 - * or visit www.oracle.com if you need additional information or have any
312.26 - * questions.
312.27 - */
312.28 -package sun.io;
312.29 -
312.30 -import sun.nio.cs.ext.IBM33722;
312.31 -
312.32 -/**
312.33 -* @author Malcolm Ayres
312.34 -*/
312.35 -public class ByteToCharCp33722 extends ByteToCharConverter
312.36 -{
312.37 - private final int G0 = 0;
312.38 - private final int G1 = 1;
312.39 - private final int G2 = 2;
312.40 - private final int G3 = 3;
312.41 - private final int G4 = 4;
312.42 - private final int SS2 = 0x8E;
312.43 - private final int SS3 = 0x8F;
312.44 -
312.45 - private int firstByte, state;
312.46 - private String byteToCharTable;
312.47 - private String mappingTableG1;
312.48 - private String mappingTableG2;
312.49 - private String mappingTableG3;
312.50 -
312.51 - private final static IBM33722 nioCoder = new IBM33722();
312.52 -
312.53 - public ByteToCharCp33722() {
312.54 - super();
312.55 - state = G0;
312.56 - byteToCharTable = nioCoder.getDecoderSingleByteMappings();
312.57 - mappingTableG1 = nioCoder.getDecoderMappingTableG1();
312.58 - mappingTableG2 = nioCoder.getDecoderMappingTableG2();
312.59 - mappingTableG3 = nioCoder.getDecoderMappingTableG3();
312.60 - }
312.61 -
312.62 - /**
312.63 - * Return the character set id
312.64 - */
312.65 - public String getCharacterEncoding()
312.66 - {
312.67 - return "Cp33722";
312.68 - }
312.69 -
312.70 - /**
312.71 - * flush out any residual data and reset the buffer state
312.72 - */
312.73 - public int flush(char[] output, int outStart, int outEnd)
312.74 - throws MalformedInputException
312.75 - {
312.76 - if (state != G0) {
312.77 - reset();
312.78 - badInputLength = 0;
312.79 - throw new MalformedInputException();
312.80 - }
312.81 -
312.82 - reset();
312.83 - return 0;
312.84 - }
312.85 -
312.86 - /**
312.87 - * Resets the converter.
312.88 - */
312.89 - public void reset() {
312.90 - state = G0;
312.91 - charOff = byteOff = 0;
312.92 - }
312.93 -
312.94 - /**
312.95 - * Character conversion
312.96 - */
312.97 - public int convert(byte[] input, int inOff, int inEnd,
312.98 - char[] output, int outOff, int outEnd)
312.99 - throws UnknownCharacterException, MalformedInputException,
312.100 - ConversionBufferFullException
312.101 - {
312.102 -
312.103 - int byte1;
312.104 - char outputChar = '\uFFFD';
312.105 -
312.106 - byteOff = inOff;
312.107 - charOff = outOff;
312.108 -
312.109 - while (byteOff < inEnd) {
312.110 -
312.111 - byte1 = input[byteOff];
312.112 - if (byte1 < 0)
312.113 - byte1 += 256;
312.114 -
312.115 - switch (state) {
312.116 - case G0:
312.117 - if (byte1 == SS2) // drop into G2 set
312.118 - state = G2;
312.119 - else if (byte1 == SS3) // drop into G3 set
312.120 - state = G3;
312.121 - else if ( byte1 <= 0x9f ) // valid single byte
312.122 - outputChar = byteToCharTable.charAt(byte1);
312.123 - else if (byte1 < 0xa1 || byte1 > 0xfe) { // valid G1 set 1st byte
312.124 - badInputLength = 1;
312.125 - throw new MalformedInputException();
312.126 - } else {
312.127 - firstByte = byte1; // save the 1st byte
312.128 - state = G1;
312.129 - }
312.130 - break;
312.131 -
312.132 - case G1:
312.133 - state = G0;
312.134 - if ( byte1 < 0xa1 || byte1 > 0xfe) { // valid second byte for G1
312.135 - badInputLength = 1;
312.136 - throw new MalformedInputException();
312.137 - }
312.138 - outputChar = mappingTableG1.charAt(((firstByte - 0xa1) * 94) + byte1 - 0xa1);
312.139 - break;
312.140 -
312.141 - case G2:
312.142 - state = G0; // valid first byte for G2
312.143 - if ( byte1 < 0xa1 || byte1 > 0xfe) {
312.144 - badInputLength = 1;
312.145 - throw new MalformedInputException();
312.146 - }
312.147 - outputChar = mappingTableG2.charAt(byte1 - 0xa1);
312.148 - break;
312.149 -
312.150 - case G3:
312.151 - if ( byte1 < 0xa1 || byte1 > 0xfe) { // valid first byte for G3
312.152 - state = G0;
312.153 - badInputLength = 1;
312.154 - throw new MalformedInputException();
312.155 - }
312.156 - firstByte = byte1;
312.157 - state = G4;
312.158 - break;
312.159 -
312.160 - case G4:
312.161 - state = G0; // valid second byte for G3
312.162 - if ( byte1 < 0xa1 || byte1 > 0xfe) {
312.163 - badInputLength = 1;
312.164 - throw new MalformedInputException();
312.165 - }
312.166 - outputChar = mappingTableG3.charAt(((firstByte - 0xa1) * 94) + byte1 - 0xa1);
312.167 - break;
312.168 -
312.169 - }
312.170 -
312.171 - if (state == G0) {
312.172 - if (outputChar == '\uFFFD') {
312.173 - if (subMode)
312.174 - outputChar = subChars[0];
312.175 - else {
312.176 - badInputLength = 1;
312.177 - throw new UnknownCharacterException();
312.178 - }
312.179 - }
312.180 -
312.181 - if (charOff >= outEnd)
312.182 - throw new ConversionBufferFullException();
312.183 -
312.184 - output[charOff++] = outputChar;
312.185 - }
312.186 -
312.187 - byteOff++;
312.188 -
312.189 - }
312.190 -
312.191 - return charOff - outOff;
312.192 -
312.193 - }
312.194 -}
313.1 --- a/src/share/classes/sun/io/ByteToCharCp420.java Thu Sep 01 13:54:38 2011 -0700
313.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
313.3 @@ -1,48 +0,0 @@
313.4 -/*
313.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
313.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
313.7 - *
313.8 - * This code is free software; you can redistribute it and/or modify it
313.9 - * under the terms of the GNU General Public License version 2 only, as
313.10 - * published by the Free Software Foundation. Oracle designates this
313.11 - * particular file as subject to the "Classpath" exception as provided
313.12 - * by Oracle in the LICENSE file that accompanied this code.
313.13 - *
313.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
313.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
313.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
313.17 - * version 2 for more details (a copy is included in the LICENSE file that
313.18 - * accompanied this code).
313.19 - *
313.20 - * You should have received a copy of the GNU General Public License version
313.21 - * 2 along with this work; if not, write to the Free Software Foundation,
313.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
313.23 - *
313.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
313.25 - * or visit www.oracle.com if you need additional information or have any
313.26 - * questions.
313.27 - */
313.28 -
313.29 -
313.30 -package sun.io;
313.31 -
313.32 -import sun.nio.cs.ext.IBM420;
313.33 -
313.34 -/**
313.35 - * A table to convert to Cp420 to Unicode
313.36 - *
313.37 - * @author ConverterGenerator tool
313.38 - */
313.39 -
313.40 -public class ByteToCharCp420 extends ByteToCharSingleByte {
313.41 -
313.42 - private final static IBM420 nioCoder = new IBM420();
313.43 -
313.44 - public String getCharacterEncoding() {
313.45 - return "Cp420";
313.46 - }
313.47 -
313.48 - public ByteToCharCp420() {
313.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
313.50 - }
313.51 -}
314.1 --- a/src/share/classes/sun/io/ByteToCharCp424.java Thu Sep 01 13:54:38 2011 -0700
314.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
314.3 @@ -1,48 +0,0 @@
314.4 -/*
314.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
314.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
314.7 - *
314.8 - * This code is free software; you can redistribute it and/or modify it
314.9 - * under the terms of the GNU General Public License version 2 only, as
314.10 - * published by the Free Software Foundation. Oracle designates this
314.11 - * particular file as subject to the "Classpath" exception as provided
314.12 - * by Oracle in the LICENSE file that accompanied this code.
314.13 - *
314.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
314.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
314.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
314.17 - * version 2 for more details (a copy is included in the LICENSE file that
314.18 - * accompanied this code).
314.19 - *
314.20 - * You should have received a copy of the GNU General Public License version
314.21 - * 2 along with this work; if not, write to the Free Software Foundation,
314.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
314.23 - *
314.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
314.25 - * or visit www.oracle.com if you need additional information or have any
314.26 - * questions.
314.27 - */
314.28 -
314.29 -
314.30 -package sun.io;
314.31 -
314.32 -import sun.nio.cs.ext.IBM424;
314.33 -
314.34 -/**
314.35 - * A table to convert to Cp424 to Unicode
314.36 - *
314.37 - * @author ConverterGenerator tool
314.38 - */
314.39 -
314.40 -public class ByteToCharCp424 extends ByteToCharSingleByte {
314.41 -
314.42 - private final static IBM424 nioCoder = new IBM424();
314.43 -
314.44 - public String getCharacterEncoding() {
314.45 - return "Cp424";
314.46 - }
314.47 -
314.48 - public ByteToCharCp424() {
314.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
314.50 - }
314.51 -}
315.1 --- a/src/share/classes/sun/io/ByteToCharCp437.java Thu Sep 01 13:54:38 2011 -0700
315.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
315.3 @@ -1,48 +0,0 @@
315.4 -/*
315.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
315.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
315.7 - *
315.8 - * This code is free software; you can redistribute it and/or modify it
315.9 - * under the terms of the GNU General Public License version 2 only, as
315.10 - * published by the Free Software Foundation. Oracle designates this
315.11 - * particular file as subject to the "Classpath" exception as provided
315.12 - * by Oracle in the LICENSE file that accompanied this code.
315.13 - *
315.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
315.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
315.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
315.17 - * version 2 for more details (a copy is included in the LICENSE file that
315.18 - * accompanied this code).
315.19 - *
315.20 - * You should have received a copy of the GNU General Public License version
315.21 - * 2 along with this work; if not, write to the Free Software Foundation,
315.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
315.23 - *
315.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
315.25 - * or visit www.oracle.com if you need additional information or have any
315.26 - * questions.
315.27 - */
315.28 -
315.29 -
315.30 -package sun.io;
315.31 -
315.32 -import sun.nio.cs.IBM437;
315.33 -
315.34 -/**
315.35 - * A table to convert to Cp437 to Unicode
315.36 - *
315.37 - * @author ConverterGenerator tool
315.38 - */
315.39 -
315.40 -public class ByteToCharCp437 extends ByteToCharSingleByte {
315.41 -
315.42 - private final static IBM437 nioCoder = new IBM437();
315.43 -
315.44 - public String getCharacterEncoding() {
315.45 - return "Cp437";
315.46 - }
315.47 -
315.48 - public ByteToCharCp437() {
315.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
315.50 - }
315.51 -}
316.1 --- a/src/share/classes/sun/io/ByteToCharCp500.java Thu Sep 01 13:54:38 2011 -0700
316.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
316.3 @@ -1,48 +0,0 @@
316.4 -/*
316.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
316.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
316.7 - *
316.8 - * This code is free software; you can redistribute it and/or modify it
316.9 - * under the terms of the GNU General Public License version 2 only, as
316.10 - * published by the Free Software Foundation. Oracle designates this
316.11 - * particular file as subject to the "Classpath" exception as provided
316.12 - * by Oracle in the LICENSE file that accompanied this code.
316.13 - *
316.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
316.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
316.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
316.17 - * version 2 for more details (a copy is included in the LICENSE file that
316.18 - * accompanied this code).
316.19 - *
316.20 - * You should have received a copy of the GNU General Public License version
316.21 - * 2 along with this work; if not, write to the Free Software Foundation,
316.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
316.23 - *
316.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
316.25 - * or visit www.oracle.com if you need additional information or have any
316.26 - * questions.
316.27 - */
316.28 -
316.29 -
316.30 -package sun.io;
316.31 -
316.32 -import sun.nio.cs.ext.IBM500;
316.33 -
316.34 -/**
316.35 - * A table to convert to Cp500 to Unicode
316.36 - *
316.37 - * @author ConverterGenerator tool
316.38 - */
316.39 -
316.40 -public class ByteToCharCp500 extends ByteToCharSingleByte {
316.41 -
316.42 - private final static IBM500 nioCoder = new IBM500();
316.43 -
316.44 - public String getCharacterEncoding() {
316.45 - return "Cp500";
316.46 - }
316.47 -
316.48 - public ByteToCharCp500() {
316.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
316.50 - }
316.51 -}
317.1 --- a/src/share/classes/sun/io/ByteToCharCp737.java Thu Sep 01 13:54:38 2011 -0700
317.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
317.3 @@ -1,48 +0,0 @@
317.4 -/*
317.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
317.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
317.7 - *
317.8 - * This code is free software; you can redistribute it and/or modify it
317.9 - * under the terms of the GNU General Public License version 2 only, as
317.10 - * published by the Free Software Foundation. Oracle designates this
317.11 - * particular file as subject to the "Classpath" exception as provided
317.12 - * by Oracle in the LICENSE file that accompanied this code.
317.13 - *
317.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
317.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
317.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
317.17 - * version 2 for more details (a copy is included in the LICENSE file that
317.18 - * accompanied this code).
317.19 - *
317.20 - * You should have received a copy of the GNU General Public License version
317.21 - * 2 along with this work; if not, write to the Free Software Foundation,
317.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
317.23 - *
317.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
317.25 - * or visit www.oracle.com if you need additional information or have any
317.26 - * questions.
317.27 - */
317.28 -
317.29 -
317.30 -package sun.io;
317.31 -
317.32 -import sun.nio.cs.IBM737;
317.33 -
317.34 -/**
317.35 - * A table to convert to Cp737 to Unicode
317.36 - *
317.37 - * @author ConverterGenerator tool
317.38 - */
317.39 -
317.40 -public class ByteToCharCp737 extends ByteToCharSingleByte {
317.41 -
317.42 - private final static IBM737 nioCoder = new IBM737();
317.43 -
317.44 - public String getCharacterEncoding() {
317.45 - return "Cp737";
317.46 - }
317.47 -
317.48 - public ByteToCharCp737() {
317.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
317.50 - }
317.51 -}
318.1 --- a/src/share/classes/sun/io/ByteToCharCp775.java Thu Sep 01 13:54:38 2011 -0700
318.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
318.3 @@ -1,48 +0,0 @@
318.4 -/*
318.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
318.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
318.7 - *
318.8 - * This code is free software; you can redistribute it and/or modify it
318.9 - * under the terms of the GNU General Public License version 2 only, as
318.10 - * published by the Free Software Foundation. Oracle designates this
318.11 - * particular file as subject to the "Classpath" exception as provided
318.12 - * by Oracle in the LICENSE file that accompanied this code.
318.13 - *
318.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
318.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
318.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
318.17 - * version 2 for more details (a copy is included in the LICENSE file that
318.18 - * accompanied this code).
318.19 - *
318.20 - * You should have received a copy of the GNU General Public License version
318.21 - * 2 along with this work; if not, write to the Free Software Foundation,
318.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
318.23 - *
318.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
318.25 - * or visit www.oracle.com if you need additional information or have any
318.26 - * questions.
318.27 - */
318.28 -
318.29 -
318.30 -package sun.io;
318.31 -
318.32 -import sun.nio.cs.IBM775;
318.33 -
318.34 -/**
318.35 - * A table to convert to Cp775 to Unicode
318.36 - *
318.37 - * @author ConverterGenerator tool
318.38 - */
318.39 -
318.40 -public class ByteToCharCp775 extends ByteToCharSingleByte {
318.41 -
318.42 - private final static IBM775 nioCoder = new IBM775();
318.43 -
318.44 - public String getCharacterEncoding() {
318.45 - return "Cp775";
318.46 - }
318.47 -
318.48 - public ByteToCharCp775() {
318.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
318.50 - }
318.51 -}
319.1 --- a/src/share/classes/sun/io/ByteToCharCp833.java Thu Sep 01 13:54:38 2011 -0700
319.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
319.3 @@ -1,42 +0,0 @@
319.4 -/*
319.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
319.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
319.7 - *
319.8 - * This code is free software; you can redistribute it and/or modify it
319.9 - * under the terms of the GNU General Public License version 2 only, as
319.10 - * published by the Free Software Foundation. Oracle designates this
319.11 - * particular file as subject to the "Classpath" exception as provided
319.12 - * by Oracle in the LICENSE file that accompanied this code.
319.13 - *
319.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
319.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
319.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
319.17 - * version 2 for more details (a copy is included in the LICENSE file that
319.18 - * accompanied this code).
319.19 - *
319.20 - * You should have received a copy of the GNU General Public License version
319.21 - * 2 along with this work; if not, write to the Free Software Foundation,
319.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
319.23 - *
319.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
319.25 - * or visit www.oracle.com if you need additional information or have any
319.26 - * questions.
319.27 - */
319.28 -
319.29 -package sun.io;
319.30 -
319.31 -import sun.nio.cs.ext.IBM833;
319.32 -
319.33 -public class ByteToCharCp833 extends ByteToCharSingleByte {
319.34 -
319.35 - private final static IBM833 nioCoder = new IBM833();
319.36 -
319.37 - public String getCharacterEncoding() {
319.38 - return "Cp833";
319.39 - }
319.40 -
319.41 - public ByteToCharCp833() {
319.42 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
319.43 - }
319.44 -}
319.45 -
320.1 --- a/src/share/classes/sun/io/ByteToCharCp834.java Thu Sep 01 13:54:38 2011 -0700
320.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
320.3 @@ -1,38 +0,0 @@
320.4 -/*
320.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
320.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
320.7 - *
320.8 - * This code is free software; you can redistribute it and/or modify it
320.9 - * under the terms of the GNU General Public License version 2 only, as
320.10 - * published by the Free Software Foundation. Oracle designates this
320.11 - * particular file as subject to the "Classpath" exception as provided
320.12 - * by Oracle in the LICENSE file that accompanied this code.
320.13 - *
320.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
320.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
320.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
320.17 - * version 2 for more details (a copy is included in the LICENSE file that
320.18 - * accompanied this code).
320.19 - *
320.20 - * You should have received a copy of the GNU General Public License version
320.21 - * 2 along with this work; if not, write to the Free Software Foundation,
320.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
320.23 - *
320.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
320.25 - * or visit www.oracle.com if you need additional information or have any
320.26 - * questions.
320.27 - */
320.28 -package sun.io;
320.29 -
320.30 -import sun.nio.cs.ext.*;
320.31 -
320.32 -public class ByteToCharCp834 extends ByteToCharDBCS_ASCII {
320.33 -
320.34 - public String getCharacterEncoding() {
320.35 - return "Cp834";
320.36 - }
320.37 -
320.38 - public ByteToCharCp834() {
320.39 - super((DoubleByte.Decoder)new IBM834().newDecoder());
320.40 - }
320.41 -}
321.1 --- a/src/share/classes/sun/io/ByteToCharCp838.java Thu Sep 01 13:54:38 2011 -0700
321.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
321.3 @@ -1,48 +0,0 @@
321.4 -/*
321.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
321.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
321.7 - *
321.8 - * This code is free software; you can redistribute it and/or modify it
321.9 - * under the terms of the GNU General Public License version 2 only, as
321.10 - * published by the Free Software Foundation. Oracle designates this
321.11 - * particular file as subject to the "Classpath" exception as provided
321.12 - * by Oracle in the LICENSE file that accompanied this code.
321.13 - *
321.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
321.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
321.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
321.17 - * version 2 for more details (a copy is included in the LICENSE file that
321.18 - * accompanied this code).
321.19 - *
321.20 - * You should have received a copy of the GNU General Public License version
321.21 - * 2 along with this work; if not, write to the Free Software Foundation,
321.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
321.23 - *
321.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
321.25 - * or visit www.oracle.com if you need additional information or have any
321.26 - * questions.
321.27 - */
321.28 -
321.29 -
321.30 -package sun.io;
321.31 -
321.32 -import sun.nio.cs.ext.IBM838;
321.33 -
321.34 -/**
321.35 - * A table to convert to Cp838 to Unicode
321.36 - *
321.37 - * @author ConverterGenerator tool
321.38 - */
321.39 -
321.40 -public class ByteToCharCp838 extends ByteToCharSingleByte {
321.41 -
321.42 - private final static IBM838 nioCoder = new IBM838();
321.43 -
321.44 - public String getCharacterEncoding() {
321.45 - return "Cp838";
321.46 - }
321.47 -
321.48 - public ByteToCharCp838() {
321.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
321.50 - }
321.51 -}
322.1 --- a/src/share/classes/sun/io/ByteToCharCp850.java Thu Sep 01 13:54:38 2011 -0700
322.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
322.3 @@ -1,46 +0,0 @@
322.4 -/*
322.5 - * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
322.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
322.7 - *
322.8 - * This code is free software; you can redistribute it and/or modify it
322.9 - * under the terms of the GNU General Public License version 2 only, as
322.10 - * published by the Free Software Foundation. Oracle designates this
322.11 - * particular file as subject to the "Classpath" exception as provided
322.12 - * by Oracle in the LICENSE file that accompanied this code.
322.13 - *
322.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
322.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
322.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
322.17 - * version 2 for more details (a copy is included in the LICENSE file that
322.18 - * accompanied this code).
322.19 - *
322.20 - * You should have received a copy of the GNU General Public License version
322.21 - * 2 along with this work; if not, write to the Free Software Foundation,
322.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
322.23 - *
322.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
322.25 - * or visit www.oracle.com if you need additional information or have any
322.26 - * questions.
322.27 - */
322.28 -
322.29 -package sun.io;
322.30 -
322.31 -import sun.nio.cs.IBM850;
322.32 -
322.33 -/**
322.34 - * A table to convert to Cp850 to Unicode
322.35 - *
322.36 - * @author ConverterGenerator tool
322.37 - * @version >= JDK1.1.6
322.38 - */
322.39 -
322.40 -public class ByteToCharCp850 extends ByteToCharSingleByte {
322.41 -
322.42 - public String getCharacterEncoding() {
322.43 - return "Cp850";
322.44 - }
322.45 -
322.46 - public ByteToCharCp850() {
322.47 - super.byteToCharTable = new IBM850().getDecoderSingleByteMappings();
322.48 - }
322.49 -}
323.1 --- a/src/share/classes/sun/io/ByteToCharCp852.java Thu Sep 01 13:54:38 2011 -0700
323.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
323.3 @@ -1,48 +0,0 @@
323.4 -/*
323.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
323.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
323.7 - *
323.8 - * This code is free software; you can redistribute it and/or modify it
323.9 - * under the terms of the GNU General Public License version 2 only, as
323.10 - * published by the Free Software Foundation. Oracle designates this
323.11 - * particular file as subject to the "Classpath" exception as provided
323.12 - * by Oracle in the LICENSE file that accompanied this code.
323.13 - *
323.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
323.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
323.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
323.17 - * version 2 for more details (a copy is included in the LICENSE file that
323.18 - * accompanied this code).
323.19 - *
323.20 - * You should have received a copy of the GNU General Public License version
323.21 - * 2 along with this work; if not, write to the Free Software Foundation,
323.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
323.23 - *
323.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
323.25 - * or visit www.oracle.com if you need additional information or have any
323.26 - * questions.
323.27 - */
323.28 -
323.29 -
323.30 -package sun.io;
323.31 -
323.32 -import sun.nio.cs.IBM852;
323.33 -
323.34 -/**
323.35 - * A table to convert to Cp852 to Unicode
323.36 - *
323.37 - * @author ConverterGenerator tool
323.38 - */
323.39 -
323.40 -public class ByteToCharCp852 extends ByteToCharSingleByte {
323.41 -
323.42 - private final static IBM852 nioCoder = new IBM852();
323.43 -
323.44 - public String getCharacterEncoding() {
323.45 - return "Cp852";
323.46 - }
323.47 -
323.48 - public ByteToCharCp852() {
323.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
323.50 - }
323.51 -}
324.1 --- a/src/share/classes/sun/io/ByteToCharCp855.java Thu Sep 01 13:54:38 2011 -0700
324.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
324.3 @@ -1,48 +0,0 @@
324.4 -/*
324.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
324.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
324.7 - *
324.8 - * This code is free software; you can redistribute it and/or modify it
324.9 - * under the terms of the GNU General Public License version 2 only, as
324.10 - * published by the Free Software Foundation. Oracle designates this
324.11 - * particular file as subject to the "Classpath" exception as provided
324.12 - * by Oracle in the LICENSE file that accompanied this code.
324.13 - *
324.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
324.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
324.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
324.17 - * version 2 for more details (a copy is included in the LICENSE file that
324.18 - * accompanied this code).
324.19 - *
324.20 - * You should have received a copy of the GNU General Public License version
324.21 - * 2 along with this work; if not, write to the Free Software Foundation,
324.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
324.23 - *
324.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
324.25 - * or visit www.oracle.com if you need additional information or have any
324.26 - * questions.
324.27 - */
324.28 -
324.29 -
324.30 -package sun.io;
324.31 -
324.32 -import sun.nio.cs.IBM855;
324.33 -
324.34 -/**
324.35 - * A table to convert to Cp855 to Unicode
324.36 - *
324.37 - * @author ConverterGenerator tool
324.38 - */
324.39 -
324.40 -public class ByteToCharCp855 extends ByteToCharSingleByte {
324.41 -
324.42 - private final static IBM855 nioCoder = new IBM855();
324.43 -
324.44 - public String getCharacterEncoding() {
324.45 - return "Cp855";
324.46 - }
324.47 -
324.48 - public ByteToCharCp855() {
324.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
324.50 - }
324.51 -}
325.1 --- a/src/share/classes/sun/io/ByteToCharCp856.java Thu Sep 01 13:54:38 2011 -0700
325.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
325.3 @@ -1,48 +0,0 @@
325.4 -/*
325.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
325.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
325.7 - *
325.8 - * This code is free software; you can redistribute it and/or modify it
325.9 - * under the terms of the GNU General Public License version 2 only, as
325.10 - * published by the Free Software Foundation. Oracle designates this
325.11 - * particular file as subject to the "Classpath" exception as provided
325.12 - * by Oracle in the LICENSE file that accompanied this code.
325.13 - *
325.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
325.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
325.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
325.17 - * version 2 for more details (a copy is included in the LICENSE file that
325.18 - * accompanied this code).
325.19 - *
325.20 - * You should have received a copy of the GNU General Public License version
325.21 - * 2 along with this work; if not, write to the Free Software Foundation,
325.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
325.23 - *
325.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
325.25 - * or visit www.oracle.com if you need additional information or have any
325.26 - * questions.
325.27 - */
325.28 -
325.29 -
325.30 -package sun.io;
325.31 -
325.32 -import sun.nio.cs.ext.IBM856;
325.33 -
325.34 -/**
325.35 - * A table to convert to Cp856 to Unicode
325.36 - *
325.37 - * @author ConverterGenerator tool
325.38 - */
325.39 -
325.40 -public class ByteToCharCp856 extends ByteToCharSingleByte {
325.41 -
325.42 - private final static IBM856 nioCoder = new IBM856();
325.43 -
325.44 - public String getCharacterEncoding() {
325.45 - return "Cp856";
325.46 - }
325.47 -
325.48 - public ByteToCharCp856() {
325.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
325.50 - }
325.51 -}
326.1 --- a/src/share/classes/sun/io/ByteToCharCp857.java Thu Sep 01 13:54:38 2011 -0700
326.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
326.3 @@ -1,48 +0,0 @@
326.4 -/*
326.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
326.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
326.7 - *
326.8 - * This code is free software; you can redistribute it and/or modify it
326.9 - * under the terms of the GNU General Public License version 2 only, as
326.10 - * published by the Free Software Foundation. Oracle designates this
326.11 - * particular file as subject to the "Classpath" exception as provided
326.12 - * by Oracle in the LICENSE file that accompanied this code.
326.13 - *
326.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
326.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
326.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
326.17 - * version 2 for more details (a copy is included in the LICENSE file that
326.18 - * accompanied this code).
326.19 - *
326.20 - * You should have received a copy of the GNU General Public License version
326.21 - * 2 along with this work; if not, write to the Free Software Foundation,
326.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
326.23 - *
326.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
326.25 - * or visit www.oracle.com if you need additional information or have any
326.26 - * questions.
326.27 - */
326.28 -
326.29 -
326.30 -package sun.io;
326.31 -
326.32 -import sun.nio.cs.IBM857;
326.33 -
326.34 -/**
326.35 - * A table to convert to Cp857 to Unicode
326.36 - *
326.37 - * @author ConverterGenerator tool
326.38 - */
326.39 -
326.40 -public class ByteToCharCp857 extends ByteToCharSingleByte {
326.41 -
326.42 - private final static IBM857 nioCoder = new IBM857();
326.43 -
326.44 - public String getCharacterEncoding() {
326.45 - return "Cp857";
326.46 - }
326.47 -
326.48 - public ByteToCharCp857() {
326.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
326.50 - }
326.51 -}
327.1 --- a/src/share/classes/sun/io/ByteToCharCp858.java Thu Sep 01 13:54:38 2011 -0700
327.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
327.3 @@ -1,47 +0,0 @@
327.4 -/*
327.5 - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
327.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
327.7 - *
327.8 - * This code is free software; you can redistribute it and/or modify it
327.9 - * under the terms of the GNU General Public License version 2 only, as
327.10 - * published by the Free Software Foundation. Oracle designates this
327.11 - * particular file as subject to the "Classpath" exception as provided
327.12 - * by Oracle in the LICENSE file that accompanied this code.
327.13 - *
327.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
327.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
327.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
327.17 - * version 2 for more details (a copy is included in the LICENSE file that
327.18 - * accompanied this code).
327.19 - *
327.20 - * You should have received a copy of the GNU General Public License version
327.21 - * 2 along with this work; if not, write to the Free Software Foundation,
327.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
327.23 - *
327.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
327.25 - * or visit www.oracle.com if you need additional information or have any
327.26 - * questions.
327.27 - */
327.28 -
327.29 -package sun.io;
327.30 -
327.31 -/**
327.32 - * A table to convert Cp858 to Unicode. This converter differs from
327.33 - * Cp850 is one code point, 0xD5, which changes from \u0131 to \u20AC.
327.34 - * @author Alan Liu
327.35 - */
327.36 -public class ByteToCharCp858 extends ByteToCharCp850 {
327.37 - public ByteToCharCp858() {}
327.38 -
327.39 - public String getCharacterEncoding() {
327.40 - return "Cp858";
327.41 - }
327.42 -
327.43 - protected char getUnicode(int byteIndex) {
327.44 - // Change single code point with respect to parent.
327.45 - // Cast to byte to get sign extension to match byteIndex.
327.46 - return (byteIndex == (byte)0xD5) ? '\u20AC' : super.getUnicode(byteIndex);
327.47 - }
327.48 -}
327.49 -
327.50 -//eof
328.1 --- a/src/share/classes/sun/io/ByteToCharCp860.java Thu Sep 01 13:54:38 2011 -0700
328.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
328.3 @@ -1,48 +0,0 @@
328.4 -/*
328.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
328.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
328.7 - *
328.8 - * This code is free software; you can redistribute it and/or modify it
328.9 - * under the terms of the GNU General Public License version 2 only, as
328.10 - * published by the Free Software Foundation. Oracle designates this
328.11 - * particular file as subject to the "Classpath" exception as provided
328.12 - * by Oracle in the LICENSE file that accompanied this code.
328.13 - *
328.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
328.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
328.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
328.17 - * version 2 for more details (a copy is included in the LICENSE file that
328.18 - * accompanied this code).
328.19 - *
328.20 - * You should have received a copy of the GNU General Public License version
328.21 - * 2 along with this work; if not, write to the Free Software Foundation,
328.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
328.23 - *
328.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
328.25 - * or visit www.oracle.com if you need additional information or have any
328.26 - * questions.
328.27 - */
328.28 -
328.29 -
328.30 -package sun.io;
328.31 -
328.32 -import sun.nio.cs.ext.IBM860;
328.33 -
328.34 -/**
328.35 - * A table to convert to Cp860 to Unicode
328.36 - *
328.37 - * @author ConverterGenerator tool
328.38 - */
328.39 -
328.40 -public class ByteToCharCp860 extends ByteToCharSingleByte {
328.41 -
328.42 - private final static IBM860 nioCoder = new IBM860();
328.43 -
328.44 - public String getCharacterEncoding() {
328.45 - return "Cp860";
328.46 - }
328.47 -
328.48 - public ByteToCharCp860() {
328.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
328.50 - }
328.51 -}
329.1 --- a/src/share/classes/sun/io/ByteToCharCp861.java Thu Sep 01 13:54:38 2011 -0700
329.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
329.3 @@ -1,48 +0,0 @@
329.4 -/*
329.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
329.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
329.7 - *
329.8 - * This code is free software; you can redistribute it and/or modify it
329.9 - * under the terms of the GNU General Public License version 2 only, as
329.10 - * published by the Free Software Foundation. Oracle designates this
329.11 - * particular file as subject to the "Classpath" exception as provided
329.12 - * by Oracle in the LICENSE file that accompanied this code.
329.13 - *
329.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
329.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
329.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
329.17 - * version 2 for more details (a copy is included in the LICENSE file that
329.18 - * accompanied this code).
329.19 - *
329.20 - * You should have received a copy of the GNU General Public License version
329.21 - * 2 along with this work; if not, write to the Free Software Foundation,
329.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
329.23 - *
329.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
329.25 - * or visit www.oracle.com if you need additional information or have any
329.26 - * questions.
329.27 - */
329.28 -
329.29 -
329.30 -package sun.io;
329.31 -
329.32 -import sun.nio.cs.ext.IBM861;
329.33 -
329.34 -/**
329.35 - * A table to convert to Cp861 to Unicode
329.36 - *
329.37 - * @author ConverterGenerator tool
329.38 - */
329.39 -
329.40 -public class ByteToCharCp861 extends ByteToCharSingleByte {
329.41 -
329.42 - private final static IBM861 nioCoder = new IBM861();
329.43 -
329.44 - public String getCharacterEncoding() {
329.45 - return "Cp861";
329.46 - }
329.47 -
329.48 - public ByteToCharCp861() {
329.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
329.50 - }
329.51 -}
330.1 --- a/src/share/classes/sun/io/ByteToCharCp862.java Thu Sep 01 13:54:38 2011 -0700
330.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
330.3 @@ -1,48 +0,0 @@
330.4 -/*
330.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
330.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
330.7 - *
330.8 - * This code is free software; you can redistribute it and/or modify it
330.9 - * under the terms of the GNU General Public License version 2 only, as
330.10 - * published by the Free Software Foundation. Oracle designates this
330.11 - * particular file as subject to the "Classpath" exception as provided
330.12 - * by Oracle in the LICENSE file that accompanied this code.
330.13 - *
330.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
330.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
330.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
330.17 - * version 2 for more details (a copy is included in the LICENSE file that
330.18 - * accompanied this code).
330.19 - *
330.20 - * You should have received a copy of the GNU General Public License version
330.21 - * 2 along with this work; if not, write to the Free Software Foundation,
330.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
330.23 - *
330.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
330.25 - * or visit www.oracle.com if you need additional information or have any
330.26 - * questions.
330.27 - */
330.28 -
330.29 -
330.30 -package sun.io;
330.31 -
330.32 -import sun.nio.cs.IBM862;
330.33 -
330.34 -/**
330.35 - * A table to convert to Cp862 to Unicode
330.36 - *
330.37 - * @author ConverterGenerator tool
330.38 - */
330.39 -
330.40 -public class ByteToCharCp862 extends ByteToCharSingleByte {
330.41 -
330.42 - private final static IBM862 nioCoder = new IBM862();
330.43 -
330.44 - public String getCharacterEncoding() {
330.45 - return "Cp862";
330.46 - }
330.47 -
330.48 - public ByteToCharCp862() {
330.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
330.50 - }
330.51 -}
331.1 --- a/src/share/classes/sun/io/ByteToCharCp863.java Thu Sep 01 13:54:38 2011 -0700
331.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
331.3 @@ -1,48 +0,0 @@
331.4 -/*
331.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
331.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
331.7 - *
331.8 - * This code is free software; you can redistribute it and/or modify it
331.9 - * under the terms of the GNU General Public License version 2 only, as
331.10 - * published by the Free Software Foundation. Oracle designates this
331.11 - * particular file as subject to the "Classpath" exception as provided
331.12 - * by Oracle in the LICENSE file that accompanied this code.
331.13 - *
331.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
331.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
331.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
331.17 - * version 2 for more details (a copy is included in the LICENSE file that
331.18 - * accompanied this code).
331.19 - *
331.20 - * You should have received a copy of the GNU General Public License version
331.21 - * 2 along with this work; if not, write to the Free Software Foundation,
331.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
331.23 - *
331.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
331.25 - * or visit www.oracle.com if you need additional information or have any
331.26 - * questions.
331.27 - */
331.28 -
331.29 -
331.30 -package sun.io;
331.31 -
331.32 -import sun.nio.cs.ext.IBM863;
331.33 -
331.34 -/**
331.35 - * A table to convert to Cp863 to Unicode
331.36 - *
331.37 - * @author ConverterGenerator tool
331.38 - */
331.39 -
331.40 -public class ByteToCharCp863 extends ByteToCharSingleByte {
331.41 -
331.42 - private final static IBM863 nioCoder = new IBM863();
331.43 -
331.44 - public String getCharacterEncoding() {
331.45 - return "Cp863";
331.46 - }
331.47 -
331.48 - public ByteToCharCp863() {
331.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
331.50 - }
331.51 -}
332.1 --- a/src/share/classes/sun/io/ByteToCharCp864.java Thu Sep 01 13:54:38 2011 -0700
332.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
332.3 @@ -1,48 +0,0 @@
332.4 -/*
332.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
332.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
332.7 - *
332.8 - * This code is free software; you can redistribute it and/or modify it
332.9 - * under the terms of the GNU General Public License version 2 only, as
332.10 - * published by the Free Software Foundation. Oracle designates this
332.11 - * particular file as subject to the "Classpath" exception as provided
332.12 - * by Oracle in the LICENSE file that accompanied this code.
332.13 - *
332.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
332.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
332.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
332.17 - * version 2 for more details (a copy is included in the LICENSE file that
332.18 - * accompanied this code).
332.19 - *
332.20 - * You should have received a copy of the GNU General Public License version
332.21 - * 2 along with this work; if not, write to the Free Software Foundation,
332.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
332.23 - *
332.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
332.25 - * or visit www.oracle.com if you need additional information or have any
332.26 - * questions.
332.27 - */
332.28 -
332.29 -
332.30 -package sun.io;
332.31 -
332.32 -import sun.nio.cs.ext.IBM864;
332.33 -
332.34 -/**
332.35 - * A table to convert to Cp864 to Unicode
332.36 - *
332.37 - * @author ConverterGenerator tool
332.38 - */
332.39 -
332.40 -public class ByteToCharCp864 extends ByteToCharSingleByte {
332.41 -
332.42 - private final static IBM864 nioCoder = new IBM864();
332.43 -
332.44 - public String getCharacterEncoding() {
332.45 - return "Cp864";
332.46 - }
332.47 -
332.48 - public ByteToCharCp864() {
332.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
332.50 - }
332.51 -}
333.1 --- a/src/share/classes/sun/io/ByteToCharCp865.java Thu Sep 01 13:54:38 2011 -0700
333.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
333.3 @@ -1,48 +0,0 @@
333.4 -/*
333.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
333.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
333.7 - *
333.8 - * This code is free software; you can redistribute it and/or modify it
333.9 - * under the terms of the GNU General Public License version 2 only, as
333.10 - * published by the Free Software Foundation. Oracle designates this
333.11 - * particular file as subject to the "Classpath" exception as provided
333.12 - * by Oracle in the LICENSE file that accompanied this code.
333.13 - *
333.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
333.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
333.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
333.17 - * version 2 for more details (a copy is included in the LICENSE file that
333.18 - * accompanied this code).
333.19 - *
333.20 - * You should have received a copy of the GNU General Public License version
333.21 - * 2 along with this work; if not, write to the Free Software Foundation,
333.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
333.23 - *
333.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
333.25 - * or visit www.oracle.com if you need additional information or have any
333.26 - * questions.
333.27 - */
333.28 -
333.29 -
333.30 -package sun.io;
333.31 -
333.32 -import sun.nio.cs.ext.IBM865;
333.33 -
333.34 -/**
333.35 - * A table to convert to Cp865 to Unicode
333.36 - *
333.37 - * @author ConverterGenerator tool
333.38 - */
333.39 -
333.40 -public class ByteToCharCp865 extends ByteToCharSingleByte {
333.41 -
333.42 - private final static IBM865 nioCoder = new IBM865();
333.43 -
333.44 - public String getCharacterEncoding() {
333.45 - return "Cp865";
333.46 - }
333.47 -
333.48 - public ByteToCharCp865() {
333.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
333.50 - }
333.51 -}
334.1 --- a/src/share/classes/sun/io/ByteToCharCp866.java Thu Sep 01 13:54:38 2011 -0700
334.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
334.3 @@ -1,48 +0,0 @@
334.4 -/*
334.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
334.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
334.7 - *
334.8 - * This code is free software; you can redistribute it and/or modify it
334.9 - * under the terms of the GNU General Public License version 2 only, as
334.10 - * published by the Free Software Foundation. Oracle designates this
334.11 - * particular file as subject to the "Classpath" exception as provided
334.12 - * by Oracle in the LICENSE file that accompanied this code.
334.13 - *
334.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
334.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
334.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
334.17 - * version 2 for more details (a copy is included in the LICENSE file that
334.18 - * accompanied this code).
334.19 - *
334.20 - * You should have received a copy of the GNU General Public License version
334.21 - * 2 along with this work; if not, write to the Free Software Foundation,
334.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
334.23 - *
334.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
334.25 - * or visit www.oracle.com if you need additional information or have any
334.26 - * questions.
334.27 - */
334.28 -
334.29 -
334.30 -package sun.io;
334.31 -
334.32 -import sun.nio.cs.IBM866;
334.33 -
334.34 -/**
334.35 - * A table to convert to Cp866 to Unicode
334.36 - *
334.37 - * @author ConverterGenerator tool
334.38 - */
334.39 -
334.40 -public class ByteToCharCp866 extends ByteToCharSingleByte {
334.41 -
334.42 - private final static IBM866 nioCoder = new IBM866();
334.43 -
334.44 - public String getCharacterEncoding() {
334.45 - return "Cp866";
334.46 - }
334.47 -
334.48 - public ByteToCharCp866() {
334.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
334.50 - }
334.51 -}
335.1 --- a/src/share/classes/sun/io/ByteToCharCp868.java Thu Sep 01 13:54:38 2011 -0700
335.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
335.3 @@ -1,48 +0,0 @@
335.4 -/*
335.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
335.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
335.7 - *
335.8 - * This code is free software; you can redistribute it and/or modify it
335.9 - * under the terms of the GNU General Public License version 2 only, as
335.10 - * published by the Free Software Foundation. Oracle designates this
335.11 - * particular file as subject to the "Classpath" exception as provided
335.12 - * by Oracle in the LICENSE file that accompanied this code.
335.13 - *
335.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
335.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
335.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
335.17 - * version 2 for more details (a copy is included in the LICENSE file that
335.18 - * accompanied this code).
335.19 - *
335.20 - * You should have received a copy of the GNU General Public License version
335.21 - * 2 along with this work; if not, write to the Free Software Foundation,
335.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
335.23 - *
335.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
335.25 - * or visit www.oracle.com if you need additional information or have any
335.26 - * questions.
335.27 - */
335.28 -
335.29 -
335.30 -package sun.io;
335.31 -
335.32 -import sun.nio.cs.ext.IBM868;
335.33 -
335.34 -/**
335.35 - * A table to convert to Cp868 to Unicode
335.36 - *
335.37 - * @author ConverterGenerator tool
335.38 - */
335.39 -
335.40 -public class ByteToCharCp868 extends ByteToCharSingleByte {
335.41 -
335.42 - private final static IBM868 nioCoder = new IBM868();
335.43 -
335.44 - public String getCharacterEncoding() {
335.45 - return "Cp868";
335.46 - }
335.47 -
335.48 - public ByteToCharCp868() {
335.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
335.50 - }
335.51 -}
336.1 --- a/src/share/classes/sun/io/ByteToCharCp869.java Thu Sep 01 13:54:38 2011 -0700
336.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
336.3 @@ -1,48 +0,0 @@
336.4 -/*
336.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
336.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
336.7 - *
336.8 - * This code is free software; you can redistribute it and/or modify it
336.9 - * under the terms of the GNU General Public License version 2 only, as
336.10 - * published by the Free Software Foundation. Oracle designates this
336.11 - * particular file as subject to the "Classpath" exception as provided
336.12 - * by Oracle in the LICENSE file that accompanied this code.
336.13 - *
336.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
336.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
336.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
336.17 - * version 2 for more details (a copy is included in the LICENSE file that
336.18 - * accompanied this code).
336.19 - *
336.20 - * You should have received a copy of the GNU General Public License version
336.21 - * 2 along with this work; if not, write to the Free Software Foundation,
336.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
336.23 - *
336.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
336.25 - * or visit www.oracle.com if you need additional information or have any
336.26 - * questions.
336.27 - */
336.28 -
336.29 -
336.30 -package sun.io;
336.31 -
336.32 -import sun.nio.cs.ext.IBM869;
336.33 -
336.34 -/**
336.35 - * A table to convert to Cp869 to Unicode
336.36 - *
336.37 - * @author ConverterGenerator tool
336.38 - */
336.39 -
336.40 -public class ByteToCharCp869 extends ByteToCharSingleByte {
336.41 -
336.42 - private final static IBM869 nioCoder = new IBM869();
336.43 -
336.44 - public String getCharacterEncoding() {
336.45 - return "Cp869";
336.46 - }
336.47 -
336.48 - public ByteToCharCp869() {
336.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
336.50 - }
336.51 -}
337.1 --- a/src/share/classes/sun/io/ByteToCharCp870.java Thu Sep 01 13:54:38 2011 -0700
337.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
337.3 @@ -1,48 +0,0 @@
337.4 -/*
337.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
337.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
337.7 - *
337.8 - * This code is free software; you can redistribute it and/or modify it
337.9 - * under the terms of the GNU General Public License version 2 only, as
337.10 - * published by the Free Software Foundation. Oracle designates this
337.11 - * particular file as subject to the "Classpath" exception as provided
337.12 - * by Oracle in the LICENSE file that accompanied this code.
337.13 - *
337.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
337.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
337.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
337.17 - * version 2 for more details (a copy is included in the LICENSE file that
337.18 - * accompanied this code).
337.19 - *
337.20 - * You should have received a copy of the GNU General Public License version
337.21 - * 2 along with this work; if not, write to the Free Software Foundation,
337.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
337.23 - *
337.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
337.25 - * or visit www.oracle.com if you need additional information or have any
337.26 - * questions.
337.27 - */
337.28 -
337.29 -
337.30 -package sun.io;
337.31 -
337.32 -import sun.nio.cs.ext.IBM870;
337.33 -
337.34 -/**
337.35 - * A table to convert to Cp870 to Unicode
337.36 - *
337.37 - * @author ConverterGenerator tool
337.38 - */
337.39 -
337.40 -public class ByteToCharCp870 extends ByteToCharSingleByte {
337.41 -
337.42 - private final static IBM870 nioCoder = new IBM870();
337.43 -
337.44 - public String getCharacterEncoding() {
337.45 - return "Cp870";
337.46 - }
337.47 -
337.48 - public ByteToCharCp870() {
337.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
337.50 - }
337.51 -}
338.1 --- a/src/share/classes/sun/io/ByteToCharCp871.java Thu Sep 01 13:54:38 2011 -0700
338.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
338.3 @@ -1,48 +0,0 @@
338.4 -/*
338.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
338.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
338.7 - *
338.8 - * This code is free software; you can redistribute it and/or modify it
338.9 - * under the terms of the GNU General Public License version 2 only, as
338.10 - * published by the Free Software Foundation. Oracle designates this
338.11 - * particular file as subject to the "Classpath" exception as provided
338.12 - * by Oracle in the LICENSE file that accompanied this code.
338.13 - *
338.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
338.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
338.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
338.17 - * version 2 for more details (a copy is included in the LICENSE file that
338.18 - * accompanied this code).
338.19 - *
338.20 - * You should have received a copy of the GNU General Public License version
338.21 - * 2 along with this work; if not, write to the Free Software Foundation,
338.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
338.23 - *
338.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
338.25 - * or visit www.oracle.com if you need additional information or have any
338.26 - * questions.
338.27 - */
338.28 -
338.29 -
338.30 -package sun.io;
338.31 -
338.32 -import sun.nio.cs.ext.IBM871;
338.33 -
338.34 -/**
338.35 - * A table to convert to Cp871 to Unicode
338.36 - *
338.37 - * @author ConverterGenerator tool
338.38 - */
338.39 -
338.40 -public class ByteToCharCp871 extends ByteToCharSingleByte {
338.41 -
338.42 - private final static IBM871 nioCoder = new IBM871();
338.43 -
338.44 - public String getCharacterEncoding() {
338.45 - return "Cp871";
338.46 - }
338.47 -
338.48 - public ByteToCharCp871() {
338.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
338.50 - }
338.51 -}
339.1 --- a/src/share/classes/sun/io/ByteToCharCp874.java Thu Sep 01 13:54:38 2011 -0700
339.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
339.3 @@ -1,48 +0,0 @@
339.4 -/*
339.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
339.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
339.7 - *
339.8 - * This code is free software; you can redistribute it and/or modify it
339.9 - * under the terms of the GNU General Public License version 2 only, as
339.10 - * published by the Free Software Foundation. Oracle designates this
339.11 - * particular file as subject to the "Classpath" exception as provided
339.12 - * by Oracle in the LICENSE file that accompanied this code.
339.13 - *
339.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
339.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
339.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
339.17 - * version 2 for more details (a copy is included in the LICENSE file that
339.18 - * accompanied this code).
339.19 - *
339.20 - * You should have received a copy of the GNU General Public License version
339.21 - * 2 along with this work; if not, write to the Free Software Foundation,
339.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
339.23 - *
339.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
339.25 - * or visit www.oracle.com if you need additional information or have any
339.26 - * questions.
339.27 - */
339.28 -
339.29 -
339.30 -package sun.io;
339.31 -
339.32 -import sun.nio.cs.IBM874;
339.33 -
339.34 -/**
339.35 - * A table to convert to Cp874 to Unicode
339.36 - *
339.37 - * @author ConverterGenerator tool
339.38 - */
339.39 -
339.40 -public class ByteToCharCp874 extends ByteToCharSingleByte {
339.41 -
339.42 - private final static IBM874 nioCoder = new IBM874();
339.43 -
339.44 - public String getCharacterEncoding() {
339.45 - return "Cp874";
339.46 - }
339.47 -
339.48 - public ByteToCharCp874() {
339.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
339.50 - }
339.51 -}
340.1 --- a/src/share/classes/sun/io/ByteToCharCp875.java Thu Sep 01 13:54:38 2011 -0700
340.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
340.3 @@ -1,48 +0,0 @@
340.4 -/*
340.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
340.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
340.7 - *
340.8 - * This code is free software; you can redistribute it and/or modify it
340.9 - * under the terms of the GNU General Public License version 2 only, as
340.10 - * published by the Free Software Foundation. Oracle designates this
340.11 - * particular file as subject to the "Classpath" exception as provided
340.12 - * by Oracle in the LICENSE file that accompanied this code.
340.13 - *
340.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
340.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
340.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
340.17 - * version 2 for more details (a copy is included in the LICENSE file that
340.18 - * accompanied this code).
340.19 - *
340.20 - * You should have received a copy of the GNU General Public License version
340.21 - * 2 along with this work; if not, write to the Free Software Foundation,
340.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
340.23 - *
340.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
340.25 - * or visit www.oracle.com if you need additional information or have any
340.26 - * questions.
340.27 - */
340.28 -
340.29 -
340.30 -package sun.io;
340.31 -
340.32 -import sun.nio.cs.ext.IBM875;
340.33 -
340.34 -/**
340.35 - * A table to convert to Cp875 to Unicode
340.36 - *
340.37 - * @author ConverterGenerator tool
340.38 - */
340.39 -
340.40 -public class ByteToCharCp875 extends ByteToCharSingleByte {
340.41 -
340.42 - private final static IBM875 nioCoder = new IBM875();
340.43 -
340.44 - public String getCharacterEncoding() {
340.45 - return "Cp875";
340.46 - }
340.47 -
340.48 - public ByteToCharCp875() {
340.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
340.50 - }
340.51 -}
341.1 --- a/src/share/classes/sun/io/ByteToCharCp918.java Thu Sep 01 13:54:38 2011 -0700
341.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
341.3 @@ -1,48 +0,0 @@
341.4 -/*
341.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
341.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
341.7 - *
341.8 - * This code is free software; you can redistribute it and/or modify it
341.9 - * under the terms of the GNU General Public License version 2 only, as
341.10 - * published by the Free Software Foundation. Oracle designates this
341.11 - * particular file as subject to the "Classpath" exception as provided
341.12 - * by Oracle in the LICENSE file that accompanied this code.
341.13 - *
341.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
341.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
341.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
341.17 - * version 2 for more details (a copy is included in the LICENSE file that
341.18 - * accompanied this code).
341.19 - *
341.20 - * You should have received a copy of the GNU General Public License version
341.21 - * 2 along with this work; if not, write to the Free Software Foundation,
341.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
341.23 - *
341.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
341.25 - * or visit www.oracle.com if you need additional information or have any
341.26 - * questions.
341.27 - */
341.28 -
341.29 -
341.30 -package sun.io;
341.31 -
341.32 -import sun.nio.cs.ext.IBM918;
341.33 -
341.34 -/**
341.35 - * A table to convert to Cp918 to Unicode
341.36 - *
341.37 - * @author ConverterGenerator tool
341.38 - */
341.39 -
341.40 -public class ByteToCharCp918 extends ByteToCharSingleByte {
341.41 -
341.42 - private final static IBM918 nioCoder = new IBM918();
341.43 -
341.44 - public String getCharacterEncoding() {
341.45 - return "Cp918";
341.46 - }
341.47 -
341.48 - public ByteToCharCp918() {
341.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
341.50 - }
341.51 -}
342.1 --- a/src/share/classes/sun/io/ByteToCharCp921.java Thu Sep 01 13:54:38 2011 -0700
342.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
342.3 @@ -1,48 +0,0 @@
342.4 -/*
342.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
342.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
342.7 - *
342.8 - * This code is free software; you can redistribute it and/or modify it
342.9 - * under the terms of the GNU General Public License version 2 only, as
342.10 - * published by the Free Software Foundation. Oracle designates this
342.11 - * particular file as subject to the "Classpath" exception as provided
342.12 - * by Oracle in the LICENSE file that accompanied this code.
342.13 - *
342.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
342.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
342.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
342.17 - * version 2 for more details (a copy is included in the LICENSE file that
342.18 - * accompanied this code).
342.19 - *
342.20 - * You should have received a copy of the GNU General Public License version
342.21 - * 2 along with this work; if not, write to the Free Software Foundation,
342.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
342.23 - *
342.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
342.25 - * or visit www.oracle.com if you need additional information or have any
342.26 - * questions.
342.27 - */
342.28 -
342.29 -
342.30 -package sun.io;
342.31 -
342.32 -import sun.nio.cs.ext.IBM921;
342.33 -
342.34 -/**
342.35 - * A table to convert to Cp921 to Unicode
342.36 - *
342.37 - * @author ConverterGenerator tool
342.38 - */
342.39 -
342.40 -public class ByteToCharCp921 extends ByteToCharSingleByte {
342.41 -
342.42 - private final static IBM921 nioCoder = new IBM921();
342.43 -
342.44 - public String getCharacterEncoding() {
342.45 - return "Cp921";
342.46 - }
342.47 -
342.48 - public ByteToCharCp921() {
342.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
342.50 - }
342.51 -}
343.1 --- a/src/share/classes/sun/io/ByteToCharCp922.java Thu Sep 01 13:54:38 2011 -0700
343.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
343.3 @@ -1,48 +0,0 @@
343.4 -/*
343.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
343.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
343.7 - *
343.8 - * This code is free software; you can redistribute it and/or modify it
343.9 - * under the terms of the GNU General Public License version 2 only, as
343.10 - * published by the Free Software Foundation. Oracle designates this
343.11 - * particular file as subject to the "Classpath" exception as provided
343.12 - * by Oracle in the LICENSE file that accompanied this code.
343.13 - *
343.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
343.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
343.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
343.17 - * version 2 for more details (a copy is included in the LICENSE file that
343.18 - * accompanied this code).
343.19 - *
343.20 - * You should have received a copy of the GNU General Public License version
343.21 - * 2 along with this work; if not, write to the Free Software Foundation,
343.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
343.23 - *
343.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
343.25 - * or visit www.oracle.com if you need additional information or have any
343.26 - * questions.
343.27 - */
343.28 -
343.29 -
343.30 -package sun.io;
343.31 -
343.32 -import sun.nio.cs.ext.IBM922;
343.33 -
343.34 -/**
343.35 - * A table to convert to Cp922 to Unicode
343.36 - *
343.37 - * @author ConverterGenerator tool
343.38 - */
343.39 -
343.40 -public class ByteToCharCp922 extends ByteToCharSingleByte {
343.41 -
343.42 - private final static IBM922 nioCoder = new IBM922();
343.43 -
343.44 - public String getCharacterEncoding() {
343.45 - return "Cp922";
343.46 - }
343.47 -
343.48 - public ByteToCharCp922() {
343.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
343.50 - }
343.51 -}
344.1 --- a/src/share/classes/sun/io/ByteToCharCp930.java Thu Sep 01 13:54:38 2011 -0700
344.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
344.3 @@ -1,39 +0,0 @@
344.4 -/*
344.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
344.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
344.7 - *
344.8 - * This code is free software; you can redistribute it and/or modify it
344.9 - * under the terms of the GNU General Public License version 2 only, as
344.10 - * published by the Free Software Foundation. Oracle designates this
344.11 - * particular file as subject to the "Classpath" exception as provided
344.12 - * by Oracle in the LICENSE file that accompanied this code.
344.13 - *
344.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
344.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
344.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
344.17 - * version 2 for more details (a copy is included in the LICENSE file that
344.18 - * accompanied this code).
344.19 - *
344.20 - * You should have received a copy of the GNU General Public License version
344.21 - * 2 along with this work; if not, write to the Free Software Foundation,
344.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
344.23 - *
344.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
344.25 - * or visit www.oracle.com if you need additional information or have any
344.26 - * questions.
344.27 - */
344.28 -package sun.io;
344.29 -
344.30 -import sun.nio.cs.ext.*;
344.31 -
344.32 -public class ByteToCharCp930 extends ByteToCharDBCS_EBCDIC {
344.33 -
344.34 - // Return the character set id
344.35 - public String getCharacterEncoding() {
344.36 - return "Cp930";
344.37 - }
344.38 -
344.39 - public ByteToCharCp930() {
344.40 - super((DoubleByte.Decoder)new IBM930().newDecoder());
344.41 - }
344.42 -}
345.1 --- a/src/share/classes/sun/io/ByteToCharCp933.java Thu Sep 01 13:54:38 2011 -0700
345.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
345.3 @@ -1,39 +0,0 @@
345.4 -/*
345.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
345.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
345.7 - *
345.8 - * This code is free software; you can redistribute it and/or modify it
345.9 - * under the terms of the GNU General Public License version 2 only, as
345.10 - * published by the Free Software Foundation. Oracle designates this
345.11 - * particular file as subject to the "Classpath" exception as provided
345.12 - * by Oracle in the LICENSE file that accompanied this code.
345.13 - *
345.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
345.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
345.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
345.17 - * version 2 for more details (a copy is included in the LICENSE file that
345.18 - * accompanied this code).
345.19 - *
345.20 - * You should have received a copy of the GNU General Public License version
345.21 - * 2 along with this work; if not, write to the Free Software Foundation,
345.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
345.23 - *
345.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
345.25 - * or visit www.oracle.com if you need additional information or have any
345.26 - * questions.
345.27 - */
345.28 -package sun.io;
345.29 -
345.30 -import sun.nio.cs.ext.*;
345.31 -
345.32 -public class ByteToCharCp933 extends ByteToCharDBCS_EBCDIC {
345.33 -
345.34 - // Return the character set id
345.35 - public String getCharacterEncoding() {
345.36 - return "Cp933";
345.37 - }
345.38 -
345.39 - public ByteToCharCp933() {
345.40 - super((DoubleByte.Decoder)new IBM933().newDecoder());
345.41 - }
345.42 -}
346.1 --- a/src/share/classes/sun/io/ByteToCharCp935.java Thu Sep 01 13:54:38 2011 -0700
346.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
346.3 @@ -1,39 +0,0 @@
346.4 -/*
346.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
346.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
346.7 - *
346.8 - * This code is free software; you can redistribute it and/or modify it
346.9 - * under the terms of the GNU General Public License version 2 only, as
346.10 - * published by the Free Software Foundation. Oracle designates this
346.11 - * particular file as subject to the "Classpath" exception as provided
346.12 - * by Oracle in the LICENSE file that accompanied this code.
346.13 - *
346.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
346.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
346.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
346.17 - * version 2 for more details (a copy is included in the LICENSE file that
346.18 - * accompanied this code).
346.19 - *
346.20 - * You should have received a copy of the GNU General Public License version
346.21 - * 2 along with this work; if not, write to the Free Software Foundation,
346.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
346.23 - *
346.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
346.25 - * or visit www.oracle.com if you need additional information or have any
346.26 - * questions.
346.27 - */
346.28 -package sun.io;
346.29 -
346.30 -import sun.nio.cs.ext.*;
346.31 -
346.32 -public class ByteToCharCp935 extends ByteToCharDBCS_EBCDIC {
346.33 -
346.34 - // Return the character set id
346.35 - public String getCharacterEncoding() {
346.36 - return "Cp935";
346.37 - }
346.38 -
346.39 - public ByteToCharCp935() {
346.40 - super((DoubleByte.Decoder)new IBM935().newDecoder());
346.41 - }
346.42 -}
347.1 --- a/src/share/classes/sun/io/ByteToCharCp937.java Thu Sep 01 13:54:38 2011 -0700
347.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
347.3 @@ -1,39 +0,0 @@
347.4 -/*
347.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
347.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
347.7 - *
347.8 - * This code is free software; you can redistribute it and/or modify it
347.9 - * under the terms of the GNU General Public License version 2 only, as
347.10 - * published by the Free Software Foundation. Oracle designates this
347.11 - * particular file as subject to the "Classpath" exception as provided
347.12 - * by Oracle in the LICENSE file that accompanied this code.
347.13 - *
347.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
347.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
347.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
347.17 - * version 2 for more details (a copy is included in the LICENSE file that
347.18 - * accompanied this code).
347.19 - *
347.20 - * You should have received a copy of the GNU General Public License version
347.21 - * 2 along with this work; if not, write to the Free Software Foundation,
347.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
347.23 - *
347.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
347.25 - * or visit www.oracle.com if you need additional information or have any
347.26 - * questions.
347.27 - */
347.28 -package sun.io;
347.29 -
347.30 -import sun.nio.cs.ext.*;
347.31 -
347.32 -public class ByteToCharCp937 extends ByteToCharDBCS_EBCDIC {
347.33 -
347.34 - // Return the character set id
347.35 - public String getCharacterEncoding() {
347.36 - return "Cp937";
347.37 - }
347.38 -
347.39 - public ByteToCharCp937() {
347.40 - super((DoubleByte.Decoder)new IBM937().newDecoder());
347.41 - }
347.42 -}
348.1 --- a/src/share/classes/sun/io/ByteToCharCp939.java Thu Sep 01 13:54:38 2011 -0700
348.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
348.3 @@ -1,39 +0,0 @@
348.4 -/*
348.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
348.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
348.7 - *
348.8 - * This code is free software; you can redistribute it and/or modify it
348.9 - * under the terms of the GNU General Public License version 2 only, as
348.10 - * published by the Free Software Foundation. Oracle designates this
348.11 - * particular file as subject to the "Classpath" exception as provided
348.12 - * by Oracle in the LICENSE file that accompanied this code.
348.13 - *
348.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
348.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
348.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
348.17 - * version 2 for more details (a copy is included in the LICENSE file that
348.18 - * accompanied this code).
348.19 - *
348.20 - * You should have received a copy of the GNU General Public License version
348.21 - * 2 along with this work; if not, write to the Free Software Foundation,
348.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
348.23 - *
348.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
348.25 - * or visit www.oracle.com if you need additional information or have any
348.26 - * questions.
348.27 - */
348.28 -package sun.io;
348.29 -
348.30 -import sun.nio.cs.ext.*;
348.31 -
348.32 -public class ByteToCharCp939 extends ByteToCharDBCS_EBCDIC {
348.33 -
348.34 - // Return the character set id
348.35 - public String getCharacterEncoding() {
348.36 - return "Cp939";
348.37 - }
348.38 -
348.39 - public ByteToCharCp939() {
348.40 - super((DoubleByte.Decoder)new IBM939().newDecoder());
348.41 - }
348.42 -}
349.1 --- a/src/share/classes/sun/io/ByteToCharCp942.java Thu Sep 01 13:54:38 2011 -0700
349.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
349.3 @@ -1,39 +0,0 @@
349.4 -/*
349.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
349.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
349.7 - *
349.8 - * This code is free software; you can redistribute it and/or modify it
349.9 - * under the terms of the GNU General Public License version 2 only, as
349.10 - * published by the Free Software Foundation. Oracle designates this
349.11 - * particular file as subject to the "Classpath" exception as provided
349.12 - * by Oracle in the LICENSE file that accompanied this code.
349.13 - *
349.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
349.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
349.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
349.17 - * version 2 for more details (a copy is included in the LICENSE file that
349.18 - * accompanied this code).
349.19 - *
349.20 - * You should have received a copy of the GNU General Public License version
349.21 - * 2 along with this work; if not, write to the Free Software Foundation,
349.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
349.23 - *
349.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
349.25 - * or visit www.oracle.com if you need additional information or have any
349.26 - * questions.
349.27 - */
349.28 -package sun.io;
349.29 -
349.30 -import sun.nio.cs.ext.*;
349.31 -
349.32 -public class ByteToCharCp942 extends ByteToCharDBCS_ASCII {
349.33 -
349.34 - // Return the character set id
349.35 - public String getCharacterEncoding() {
349.36 - return "Cp942";
349.37 - }
349.38 -
349.39 - public ByteToCharCp942() {
349.40 - super((DoubleByte.Decoder)new IBM942().newDecoder());
349.41 - }
349.42 -}
350.1 --- a/src/share/classes/sun/io/ByteToCharCp942C.java Thu Sep 01 13:54:38 2011 -0700
350.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
350.3 @@ -1,40 +0,0 @@
350.4 -/*
350.5 - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
350.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
350.7 - *
350.8 - * This code is free software; you can redistribute it and/or modify it
350.9 - * under the terms of the GNU General Public License version 2 only, as
350.10 - * published by the Free Software Foundation. Oracle designates this
350.11 - * particular file as subject to the "Classpath" exception as provided
350.12 - * by Oracle in the LICENSE file that accompanied this code.
350.13 - *
350.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
350.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
350.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
350.17 - * version 2 for more details (a copy is included in the LICENSE file that
350.18 - * accompanied this code).
350.19 - *
350.20 - * You should have received a copy of the GNU General Public License version
350.21 - * 2 along with this work; if not, write to the Free Software Foundation,
350.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
350.23 - *
350.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
350.25 - * or visit www.oracle.com if you need additional information or have any
350.26 - * questions.
350.27 - */
350.28 -
350.29 -package sun.io;
350.30 -
350.31 -import sun.nio.cs.ext.*;
350.32 -
350.33 -public class ByteToCharCp942C extends ByteToCharDBCS_ASCII {
350.34 -
350.35 - // Return the character set id
350.36 - public String getCharacterEncoding() {
350.37 - return "Cp942C";
350.38 - }
350.39 -
350.40 - public ByteToCharCp942C() {
350.41 - super((DoubleByte.Decoder)new IBM942C().newDecoder());
350.42 - }
350.43 -}
351.1 --- a/src/share/classes/sun/io/ByteToCharCp943.java Thu Sep 01 13:54:38 2011 -0700
351.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
351.3 @@ -1,40 +0,0 @@
351.4 -/*
351.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
351.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
351.7 - *
351.8 - * This code is free software; you can redistribute it and/or modify it
351.9 - * under the terms of the GNU General Public License version 2 only, as
351.10 - * published by the Free Software Foundation. Oracle designates this
351.11 - * particular file as subject to the "Classpath" exception as provided
351.12 - * by Oracle in the LICENSE file that accompanied this code.
351.13 - *
351.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
351.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
351.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
351.17 - * version 2 for more details (a copy is included in the LICENSE file that
351.18 - * accompanied this code).
351.19 - *
351.20 - * You should have received a copy of the GNU General Public License version
351.21 - * 2 along with this work; if not, write to the Free Software Foundation,
351.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
351.23 - *
351.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
351.25 - * or visit www.oracle.com if you need additional information or have any
351.26 - * questions.
351.27 - */
351.28 -
351.29 -package sun.io;
351.30 -
351.31 -import sun.nio.cs.ext.*;
351.32 -
351.33 -public class ByteToCharCp943 extends ByteToCharDBCS_ASCII {
351.34 -
351.35 - // Return the character set id
351.36 - public String getCharacterEncoding() {
351.37 - return "Cp943";
351.38 - }
351.39 -
351.40 - public ByteToCharCp943() {
351.41 - super((DoubleByte.Decoder)new IBM943().newDecoder());
351.42 - }
351.43 -}
352.1 --- a/src/share/classes/sun/io/ByteToCharCp943C.java Thu Sep 01 13:54:38 2011 -0700
352.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
352.3 @@ -1,40 +0,0 @@
352.4 -/*
352.5 - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
352.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
352.7 - *
352.8 - * This code is free software; you can redistribute it and/or modify it
352.9 - * under the terms of the GNU General Public License version 2 only, as
352.10 - * published by the Free Software Foundation. Oracle designates this
352.11 - * particular file as subject to the "Classpath" exception as provided
352.12 - * by Oracle in the LICENSE file that accompanied this code.
352.13 - *
352.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
352.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
352.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
352.17 - * version 2 for more details (a copy is included in the LICENSE file that
352.18 - * accompanied this code).
352.19 - *
352.20 - * You should have received a copy of the GNU General Public License version
352.21 - * 2 along with this work; if not, write to the Free Software Foundation,
352.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
352.23 - *
352.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
352.25 - * or visit www.oracle.com if you need additional information or have any
352.26 - * questions.
352.27 - */
352.28 -
352.29 -package sun.io;
352.30 -
352.31 -import sun.nio.cs.ext.*;
352.32 -
352.33 -public class ByteToCharCp943C extends ByteToCharDBCS_ASCII {
352.34 -
352.35 - // Return the character set id
352.36 - public String getCharacterEncoding() {
352.37 - return "Cp943C";
352.38 - }
352.39 -
352.40 - public ByteToCharCp943C() {
352.41 - super((DoubleByte.Decoder)new IBM943C().newDecoder());
352.42 - }
352.43 -}
353.1 --- a/src/share/classes/sun/io/ByteToCharCp948.java Thu Sep 01 13:54:38 2011 -0700
353.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
353.3 @@ -1,39 +0,0 @@
353.4 -/*
353.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
353.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
353.7 - *
353.8 - * This code is free software; you can redistribute it and/or modify it
353.9 - * under the terms of the GNU General Public License version 2 only, as
353.10 - * published by the Free Software Foundation. Oracle designates this
353.11 - * particular file as subject to the "Classpath" exception as provided
353.12 - * by Oracle in the LICENSE file that accompanied this code.
353.13 - *
353.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
353.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
353.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
353.17 - * version 2 for more details (a copy is included in the LICENSE file that
353.18 - * accompanied this code).
353.19 - *
353.20 - * You should have received a copy of the GNU General Public License version
353.21 - * 2 along with this work; if not, write to the Free Software Foundation,
353.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
353.23 - *
353.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
353.25 - * or visit www.oracle.com if you need additional information or have any
353.26 - * questions.
353.27 - */
353.28 -package sun.io;
353.29 -
353.30 -import sun.nio.cs.ext.*;
353.31 -
353.32 -public class ByteToCharCp948 extends ByteToCharDBCS_ASCII {
353.33 -
353.34 - // Return the character set id
353.35 - public String getCharacterEncoding() {
353.36 - return "Cp948";
353.37 - }
353.38 -
353.39 - public ByteToCharCp948() {
353.40 - super((DoubleByte.Decoder)new IBM948().newDecoder());
353.41 - }
353.42 -}
354.1 --- a/src/share/classes/sun/io/ByteToCharCp949.java Thu Sep 01 13:54:38 2011 -0700
354.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
354.3 @@ -1,39 +0,0 @@
354.4 -/*
354.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
354.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
354.7 - *
354.8 - * This code is free software; you can redistribute it and/or modify it
354.9 - * under the terms of the GNU General Public License version 2 only, as
354.10 - * published by the Free Software Foundation. Oracle designates this
354.11 - * particular file as subject to the "Classpath" exception as provided
354.12 - * by Oracle in the LICENSE file that accompanied this code.
354.13 - *
354.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
354.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
354.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
354.17 - * version 2 for more details (a copy is included in the LICENSE file that
354.18 - * accompanied this code).
354.19 - *
354.20 - * You should have received a copy of the GNU General Public License version
354.21 - * 2 along with this work; if not, write to the Free Software Foundation,
354.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
354.23 - *
354.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
354.25 - * or visit www.oracle.com if you need additional information or have any
354.26 - * questions.
354.27 - */
354.28 -package sun.io;
354.29 -
354.30 -import sun.nio.cs.ext.*;
354.31 -
354.32 -public class ByteToCharCp949 extends ByteToCharDBCS_ASCII {
354.33 -
354.34 - // Return the character set id
354.35 - public String getCharacterEncoding() {
354.36 - return "Cp949";
354.37 - }
354.38 -
354.39 - public ByteToCharCp949() {
354.40 - super((DoubleByte.Decoder)new IBM949().newDecoder());
354.41 - }
354.42 -}
355.1 --- a/src/share/classes/sun/io/ByteToCharCp949C.java Thu Sep 01 13:54:38 2011 -0700
355.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
355.3 @@ -1,40 +0,0 @@
355.4 -/*
355.5 - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
355.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
355.7 - *
355.8 - * This code is free software; you can redistribute it and/or modify it
355.9 - * under the terms of the GNU General Public License version 2 only, as
355.10 - * published by the Free Software Foundation. Oracle designates this
355.11 - * particular file as subject to the "Classpath" exception as provided
355.12 - * by Oracle in the LICENSE file that accompanied this code.
355.13 - *
355.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
355.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
355.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
355.17 - * version 2 for more details (a copy is included in the LICENSE file that
355.18 - * accompanied this code).
355.19 - *
355.20 - * You should have received a copy of the GNU General Public License version
355.21 - * 2 along with this work; if not, write to the Free Software Foundation,
355.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
355.23 - *
355.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
355.25 - * or visit www.oracle.com if you need additional information or have any
355.26 - * questions.
355.27 - */
355.28 -
355.29 -package sun.io;
355.30 -
355.31 -import sun.nio.cs.ext.*;
355.32 -
355.33 -public class ByteToCharCp949C extends ByteToCharDBCS_ASCII {
355.34 -
355.35 - // Return the character set id
355.36 - public String getCharacterEncoding() {
355.37 - return "Cp949C";
355.38 - }
355.39 -
355.40 - public ByteToCharCp949C() {
355.41 - super((DoubleByte.Decoder)new IBM949C().newDecoder());
355.42 - }
355.43 -}
356.1 --- a/src/share/classes/sun/io/ByteToCharCp950.java Thu Sep 01 13:54:38 2011 -0700
356.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
356.3 @@ -1,39 +0,0 @@
356.4 -/*
356.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
356.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
356.7 - *
356.8 - * This code is free software; you can redistribute it and/or modify it
356.9 - * under the terms of the GNU General Public License version 2 only, as
356.10 - * published by the Free Software Foundation. Oracle designates this
356.11 - * particular file as subject to the "Classpath" exception as provided
356.12 - * by Oracle in the LICENSE file that accompanied this code.
356.13 - *
356.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
356.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
356.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
356.17 - * version 2 for more details (a copy is included in the LICENSE file that
356.18 - * accompanied this code).
356.19 - *
356.20 - * You should have received a copy of the GNU General Public License version
356.21 - * 2 along with this work; if not, write to the Free Software Foundation,
356.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
356.23 - *
356.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
356.25 - * or visit www.oracle.com if you need additional information or have any
356.26 - * questions.
356.27 - */
356.28 -package sun.io;
356.29 -
356.30 -import sun.nio.cs.ext.*;
356.31 -
356.32 -public class ByteToCharCp950 extends ByteToCharDBCS_ASCII {
356.33 -
356.34 - // Return the character set id
356.35 - public String getCharacterEncoding() {
356.36 - return "Cp950";
356.37 - }
356.38 -
356.39 - public ByteToCharCp950() {
356.40 - super((DoubleByte.Decoder)new IBM950().newDecoder());
356.41 - }
356.42 -}
357.1 --- a/src/share/classes/sun/io/ByteToCharCp964.java Thu Sep 01 13:54:38 2011 -0700
357.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
357.3 @@ -1,207 +0,0 @@
357.4 -/*
357.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
357.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
357.7 - *
357.8 - * This code is free software; you can redistribute it and/or modify it
357.9 - * under the terms of the GNU General Public License version 2 only, as
357.10 - * published by the Free Software Foundation. Oracle designates this
357.11 - * particular file as subject to the "Classpath" exception as provided
357.12 - * by Oracle in the LICENSE file that accompanied this code.
357.13 - *
357.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
357.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
357.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
357.17 - * version 2 for more details (a copy is included in the LICENSE file that
357.18 - * accompanied this code).
357.19 - *
357.20 - * You should have received a copy of the GNU General Public License version
357.21 - * 2 along with this work; if not, write to the Free Software Foundation,
357.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
357.23 - *
357.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
357.25 - * or visit www.oracle.com if you need additional information or have any
357.26 - * questions.
357.27 - */
357.28 -package sun.io;
357.29 -
357.30 -import sun.nio.cs.ext.IBM964;
357.31 -
357.32 -/**
357.33 -* @author Malcolm Ayres
357.34 -*/
357.35 -public class ByteToCharCp964 extends ByteToCharConverter
357.36 -{
357.37 - private final static IBM964 nioCoder = new IBM964();
357.38 -
357.39 - private final int G0 = 0;
357.40 - private final int G1 = 1;
357.41 - private final int G2 = 2;
357.42 - private final int G3 = 3;
357.43 - private final int G4 = 4;
357.44 - private final int SS2 = 0x8E;
357.45 - private final int SS3 = 0x8F;
357.46 -
357.47 - private int firstByte, state;
357.48 -
357.49 - private String byteToCharTable;
357.50 - private String mappingTableG1;
357.51 - private String mappingTableG2;
357.52 - private String mappingTableG2a2;
357.53 - private String mappingTableG2ac;
357.54 - private String mappingTableG2ad;
357.55 -
357.56 -
357.57 - public ByteToCharCp964() {
357.58 - super();
357.59 - state = G0;
357.60 - byteToCharTable = nioCoder.getDecoderSingleByteMappings();
357.61 - mappingTableG1 = nioCoder.getDecoderMappingTableG1();
357.62 - mappingTableG2a2 = nioCoder.getDecoderMappingTableG2a2();
357.63 - mappingTableG2ac = nioCoder.getDecoderMappingTableG2ac();
357.64 - mappingTableG2ad = nioCoder.getDecoderMappingTableG2ad();
357.65 - }
357.66 -
357.67 - /**
357.68 - * Return the character set id
357.69 - */
357.70 - public String getCharacterEncoding()
357.71 - {
357.72 - return "Cp964";
357.73 - }
357.74 -
357.75 - /**
357.76 - * flush out any residual data and reset the buffer state
357.77 - */
357.78 - public int flush(char[] output, int outStart, int outEnd)
357.79 - throws MalformedInputException
357.80 - {
357.81 - if (state != G0) {
357.82 - reset();
357.83 - badInputLength = 0;
357.84 - throw new MalformedInputException();
357.85 - }
357.86 -
357.87 - reset();
357.88 - return 0;
357.89 - }
357.90 -
357.91 - /**
357.92 - * Resets the converter.
357.93 - */
357.94 - public void reset() {
357.95 - state = G0;
357.96 - charOff = byteOff = 0;
357.97 - }
357.98 -
357.99 - /**
357.100 - * Character conversion
357.101 - */
357.102 - public int convert(byte[] input, int inOff, int inEnd,
357.103 - char[] output, int outOff, int outEnd)
357.104 - throws UnknownCharacterException, MalformedInputException,
357.105 - ConversionBufferFullException
357.106 - {
357.107 -
357.108 - int byte1;
357.109 - char outputChar = '\uFFFD';
357.110 -
357.111 - byteOff = inOff;
357.112 - charOff = outOff;
357.113 -
357.114 - while (byteOff < inEnd) {
357.115 -
357.116 - byte1 = input[byteOff];
357.117 - if (byte1 < 0)
357.118 - byte1 += 256;
357.119 -
357.120 - switch (state) {
357.121 - case G0:
357.122 - if (byte1 == SS2)
357.123 - state = G2;
357.124 - else if (byte1 == SS3) {
357.125 - badInputLength = 1;
357.126 - throw new MalformedInputException();
357.127 - }
357.128 - else if ( byte1 <= 0x9f ) // valid single byte
357.129 - outputChar = byteToCharTable.charAt(byte1);
357.130 - else if (byte1 < 0xa1 || byte1 > 0xfe) {
357.131 - badInputLength = 1;
357.132 - throw new MalformedInputException();
357.133 - } else { // valid 1st byte for G1
357.134 - firstByte = byte1;
357.135 - state = G1;
357.136 - }
357.137 - break;
357.138 -
357.139 - case G1:
357.140 - state = G0;
357.141 - if ( byte1 < 0xa1 || byte1 > 0xfe) { // valid second byte for G1
357.142 - badInputLength = 1;
357.143 - throw new MalformedInputException();
357.144 - }
357.145 - outputChar = mappingTableG1.charAt(((firstByte - 0xa1) * 94) + byte1 - 0xa1);
357.146 - break;
357.147 -
357.148 - case G2:
357.149 - // set the correct mapping table for supported G2 sets
357.150 - if ( byte1 == 0xa2)
357.151 - mappingTableG2 = mappingTableG2a2;
357.152 - else
357.153 - if ( byte1 == 0xac)
357.154 - mappingTableG2 = mappingTableG2ac;
357.155 - else
357.156 - if ( byte1 == 0xad)
357.157 - mappingTableG2 = mappingTableG2ad;
357.158 - else {
357.159 - state = G0;
357.160 - badInputLength = 1;
357.161 - throw new MalformedInputException();
357.162 - }
357.163 - state = G3;
357.164 - break;
357.165 -
357.166 - case G3:
357.167 - if ( byte1 < 0xa1 || byte1 > 0xfe) { // valid 1st byte for G2 set
357.168 - state = G0;
357.169 - badInputLength = 1;
357.170 - throw new MalformedInputException();
357.171 - }
357.172 - firstByte = byte1;
357.173 - state = G4;
357.174 - break;
357.175 -
357.176 - case G4:
357.177 - state = G0;
357.178 - if ( byte1 < 0xa1 || byte1 > 0xfe) { // valid 2nd byte for G2 set
357.179 - badInputLength = 1;
357.180 - throw new MalformedInputException();
357.181 - }
357.182 - outputChar = mappingTableG2.charAt(((firstByte - 0xa1) * 94) + byte1 - 0xa1);
357.183 - break;
357.184 -
357.185 - }
357.186 -
357.187 - if (state == G0) {
357.188 - if (outputChar == '\uFFFD') {
357.189 - if (subMode)
357.190 - outputChar = subChars[0];
357.191 - else {
357.192 - badInputLength = 1;
357.193 - throw new UnknownCharacterException();
357.194 - }
357.195 - }
357.196 -
357.197 - if (charOff >= outEnd)
357.198 - throw new ConversionBufferFullException();
357.199 -
357.200 - output[charOff++] = outputChar;
357.201 - }
357.202 -
357.203 - byteOff++;
357.204 -
357.205 - }
357.206 -
357.207 - return charOff - outOff;
357.208 -
357.209 - }
357.210 -}
358.1 --- a/src/share/classes/sun/io/ByteToCharCp970.java Thu Sep 01 13:54:38 2011 -0700
358.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
358.3 @@ -1,39 +0,0 @@
358.4 -/*
358.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
358.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
358.7 - *
358.8 - * This code is free software; you can redistribute it and/or modify it
358.9 - * under the terms of the GNU General Public License version 2 only, as
358.10 - * published by the Free Software Foundation. Oracle designates this
358.11 - * particular file as subject to the "Classpath" exception as provided
358.12 - * by Oracle in the LICENSE file that accompanied this code.
358.13 - *
358.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
358.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
358.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
358.17 - * version 2 for more details (a copy is included in the LICENSE file that
358.18 - * accompanied this code).
358.19 - *
358.20 - * You should have received a copy of the GNU General Public License version
358.21 - * 2 along with this work; if not, write to the Free Software Foundation,
358.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
358.23 - *
358.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
358.25 - * or visit www.oracle.com if you need additional information or have any
358.26 - * questions.
358.27 - */
358.28 -package sun.io;
358.29 -
358.30 -import sun.nio.cs.ext.*;
358.31 -
358.32 -public class ByteToCharCp970 extends ByteToCharEUC2 {
358.33 -
358.34 - // Return the character set id
358.35 - public String getCharacterEncoding() {
358.36 - return "Cp970";
358.37 - }
358.38 -
358.39 - public ByteToCharCp970() {
358.40 - super((DoubleByte.Decoder)new IBM970().newDecoder());
358.41 - }
358.42 -}
359.1 --- a/src/share/classes/sun/io/ByteToCharDBCS_ASCII.java Thu Sep 01 13:54:38 2011 -0700
359.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
359.3 @@ -1,133 +0,0 @@
359.4 -/*
359.5 - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
359.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
359.7 - *
359.8 - * This code is free software; you can redistribute it and/or modify it
359.9 - * under the terms of the GNU General Public License version 2 only, as
359.10 - * published by the Free Software Foundation. Oracle designates this
359.11 - * particular file as subject to the "Classpath" exception as provided
359.12 - * by Oracle in the LICENSE file that accompanied this code.
359.13 - *
359.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
359.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
359.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
359.17 - * version 2 for more details (a copy is included in the LICENSE file that
359.18 - * accompanied this code).
359.19 - *
359.20 - * You should have received a copy of the GNU General Public License version
359.21 - * 2 along with this work; if not, write to the Free Software Foundation,
359.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
359.23 - *
359.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
359.25 - * or visit www.oracle.com if you need additional information or have any
359.26 - * questions.
359.27 - */
359.28 -package sun.io;
359.29 -
359.30 -import sun.nio.cs.ext.DoubleByte;
359.31 -import static sun.nio.cs.CharsetMapping.*;
359.32 -
359.33 -public abstract class ByteToCharDBCS_ASCII extends ByteToCharConverter
359.34 -{
359.35 - private boolean savedBytePresent;
359.36 - private int savedByte;
359.37 -
359.38 - private DoubleByte.Decoder dec;
359.39 -
359.40 - public ByteToCharDBCS_ASCII(DoubleByte.Decoder dec) {
359.41 - super();
359.42 - savedBytePresent = false;
359.43 - this.dec = dec;
359.44 - }
359.45 -
359.46 - char decodeSingle(int b) {
359.47 - return dec.decodeSingle(b);
359.48 - }
359.49 -
359.50 - char decodeDouble(int b1, int b2) {
359.51 - return dec.decodeDouble(b1, b2);
359.52 - }
359.53 -
359.54 - public int flush(char [] output, int outStart, int outEnd)
359.55 - throws MalformedInputException
359.56 - {
359.57 -
359.58 - if (savedBytePresent) {
359.59 - reset();
359.60 - badInputLength = 0;
359.61 - throw new MalformedInputException();
359.62 - }
359.63 -
359.64 - reset();
359.65 - return 0;
359.66 - }
359.67 -
359.68 - /**
359.69 - * Character conversion
359.70 - */
359.71 - public int convert(byte[] input, int inOff, int inEnd,
359.72 - char[] output, int outOff, int outEnd)
359.73 - throws UnknownCharacterException, MalformedInputException,
359.74 - ConversionBufferFullException
359.75 - {
359.76 - int inputSize;
359.77 - char outputChar = UNMAPPABLE_DECODING;
359.78 -
359.79 - charOff = outOff;
359.80 - byteOff = inOff;
359.81 -
359.82 - while(byteOff < inEnd)
359.83 - {
359.84 - int byte1;
359.85 -
359.86 - if (!savedBytePresent) {
359.87 - byte1 = input[byteOff] & 0xff;
359.88 - inputSize = 1;
359.89 - } else {
359.90 - byte1 = savedByte;
359.91 - savedBytePresent = false;
359.92 - inputSize = 0;
359.93 - }
359.94 -
359.95 - outputChar = decodeSingle(byte1);
359.96 - if (outputChar == UNMAPPABLE_DECODING) {
359.97 -
359.98 - if (byteOff + inputSize >= inEnd) {
359.99 - savedByte = byte1;
359.100 - savedBytePresent = true;
359.101 - byteOff += inputSize;
359.102 - break;
359.103 - }
359.104 -
359.105 - outputChar = decodeDouble(byte1, input[byteOff+inputSize] & 0xff);
359.106 - inputSize++;
359.107 - }
359.108 -
359.109 - if (outputChar == UNMAPPABLE_DECODING) {
359.110 - if (subMode)
359.111 - outputChar = subChars[0];
359.112 - else {
359.113 - badInputLength = inputSize;
359.114 - throw new UnknownCharacterException();
359.115 - }
359.116 - }
359.117 -
359.118 - if (charOff >= outEnd)
359.119 - throw new ConversionBufferFullException();
359.120 -
359.121 - output[charOff++] = outputChar;
359.122 - byteOff += inputSize;
359.123 -
359.124 - }
359.125 -
359.126 - return charOff - outOff;
359.127 - }
359.128 -
359.129 - /**
359.130 - * Resets the converter.
359.131 - */
359.132 - public void reset() {
359.133 - charOff = byteOff = 0;
359.134 - savedBytePresent = false;
359.135 - }
359.136 -}
360.1 --- a/src/share/classes/sun/io/ByteToCharDBCS_EBCDIC.java Thu Sep 01 13:54:38 2011 -0700
360.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
360.3 @@ -1,196 +0,0 @@
360.4 -/*
360.5 - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
360.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
360.7 - *
360.8 - * This code is free software; you can redistribute it and/or modify it
360.9 - * under the terms of the GNU General Public License version 2 only, as
360.10 - * published by the Free Software Foundation. Oracle designates this
360.11 - * particular file as subject to the "Classpath" exception as provided
360.12 - * by Oracle in the LICENSE file that accompanied this code.
360.13 - *
360.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
360.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
360.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
360.17 - * version 2 for more details (a copy is included in the LICENSE file that
360.18 - * accompanied this code).
360.19 - *
360.20 - * You should have received a copy of the GNU General Public License version
360.21 - * 2 along with this work; if not, write to the Free Software Foundation,
360.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
360.23 - *
360.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
360.25 - * or visit www.oracle.com if you need additional information or have any
360.26 - * questions.
360.27 - */
360.28 -package sun.io;
360.29 -
360.30 -import sun.nio.cs.ext.DoubleByte;
360.31 -import static sun.nio.cs.CharsetMapping.*;
360.32 -
360.33 -public abstract class ByteToCharDBCS_EBCDIC extends ByteToCharConverter
360.34 -{
360.35 -
360.36 - private static final int SBCS = 0;
360.37 - private static final int DBCS = 1;
360.38 -
360.39 - private static final int SO = 0x0e;
360.40 - private static final int SI = 0x0f;
360.41 -
360.42 - private int currentState;
360.43 - private boolean savedBytePresent;
360.44 - private int savedByte;
360.45 -
360.46 - private DoubleByte.Decoder dec;
360.47 -
360.48 - public ByteToCharDBCS_EBCDIC(DoubleByte.Decoder dec) {
360.49 - super();
360.50 - currentState = SBCS;
360.51 - savedBytePresent = false;
360.52 - this.dec = dec;
360.53 - }
360.54 -
360.55 - char decodeSingle(int b) {
360.56 - return dec.decodeSingle(b);
360.57 - }
360.58 -
360.59 - char decodeDouble(int b1, int b2) {
360.60 - return dec.decodeDouble(b1, b2);
360.61 - }
360.62 -
360.63 - public int flush(char [] output, int outStart, int outEnd)
360.64 - throws MalformedInputException
360.65 - {
360.66 -
360.67 - if (savedBytePresent) {
360.68 - reset();
360.69 - badInputLength = 0;
360.70 - throw new MalformedInputException();
360.71 - }
360.72 -
360.73 - reset();
360.74 - return 0;
360.75 - }
360.76 -
360.77 - /**
360.78 - * Character conversion
360.79 - */
360.80 - public int convert(byte[] input, int inOff, int inEnd,
360.81 - char[] output, int outOff, int outEnd)
360.82 - throws UnknownCharacterException, MalformedInputException,
360.83 - ConversionBufferFullException
360.84 - {
360.85 - int inputSize;
360.86 - char outputChar = UNMAPPABLE_DECODING;
360.87 -
360.88 - charOff = outOff;
360.89 - byteOff = inOff;
360.90 -
360.91 - while(byteOff < inEnd) {
360.92 - int byte1, byte2;
360.93 -
360.94 - if (!savedBytePresent) {
360.95 - byte1 = input[byteOff] & 0xff;
360.96 - inputSize = 1;
360.97 - } else {
360.98 - byte1 = savedByte;
360.99 - savedBytePresent = false;
360.100 - inputSize = 0;
360.101 - }
360.102 -
360.103 - if (byte1 == SO) {
360.104 -
360.105 - // For SO characters - simply validate the state and if OK
360.106 - // update the state and go to the next byte
360.107 -
360.108 - if (currentState != SBCS) {
360.109 - badInputLength = 1;
360.110 - throw new MalformedInputException();
360.111 - } else {
360.112 - currentState = DBCS;
360.113 - byteOff += inputSize;
360.114 - }
360.115 - }
360.116 -
360.117 - else
360.118 - if (byte1 == SI) {
360.119 - // For SI characters - simply validate the state and if OK
360.120 - // update the state and go to the next byte
360.121 -
360.122 - if (currentState != DBCS) {
360.123 - badInputLength = 1;
360.124 - throw new MalformedInputException();
360.125 - } else {
360.126 - currentState = SBCS;
360.127 - byteOff+= inputSize;
360.128 - }
360.129 - } else {
360.130 -
360.131 - // Process the real data characters
360.132 -
360.133 - if (currentState == SBCS) {
360.134 - outputChar = decodeSingle(byte1);
360.135 - } else {
360.136 -
360.137 - // for a DBCS character - architecture dictates the
360.138 - // valid range of 1st bytes
360.139 -
360.140 - if (byte1 < 0x40 || byte1 > 0xfe) {
360.141 - badInputLength = 1;
360.142 - throw new MalformedInputException();
360.143 - }
360.144 -
360.145 - if (byteOff + inputSize >= inEnd) {
360.146 - // We have been split in the middle if a character
360.147 - // save the first byte for next time around
360.148 -
360.149 - savedByte = byte1;
360.150 - savedBytePresent = true;
360.151 - byteOff += inputSize;
360.152 - break;
360.153 - }
360.154 -
360.155 - byte2 = input[byteOff+inputSize] & 0xff;
360.156 - inputSize++;
360.157 -
360.158 - // validate the pair of bytes meet the architecture
360.159 -
360.160 - if ((byte1 != 0x40 || byte2 != 0x40) &&
360.161 - (byte2 < 0x41 || byte2 > 0xfe)) {
360.162 - badInputLength = 2;
360.163 - throw new MalformedInputException();
360.164 - }
360.165 -
360.166 - outputChar = decodeDouble(byte1, byte2);
360.167 - }
360.168 -
360.169 - if (outputChar == UNMAPPABLE_DECODING) {
360.170 - if (subMode)
360.171 - outputChar = subChars[0];
360.172 - else {
360.173 - badInputLength = inputSize;
360.174 - throw new UnknownCharacterException();
360.175 - }
360.176 - }
360.177 -
360.178 - if (charOff >= outEnd)
360.179 - throw new ConversionBufferFullException();
360.180 -
360.181 - output[charOff++] = outputChar;
360.182 - byteOff += inputSize;
360.183 - }
360.184 -
360.185 - }
360.186 -
360.187 - return charOff - outOff;
360.188 - }
360.189 -
360.190 -
360.191 - /**
360.192 - * Resets the converter.
360.193 - */
360.194 - public void reset() {
360.195 - charOff = byteOff = 0;
360.196 - currentState = SBCS;
360.197 - savedBytePresent = false;
360.198 - }
360.199 -}
361.1 --- a/src/share/classes/sun/io/ByteToCharDoubleByte.java Thu Sep 01 13:54:38 2011 -0700
361.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
361.3 @@ -1,191 +0,0 @@
361.4 -/*
361.5 - * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
361.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
361.7 - *
361.8 - * This code is free software; you can redistribute it and/or modify it
361.9 - * under the terms of the GNU General Public License version 2 only, as
361.10 - * published by the Free Software Foundation. Oracle designates this
361.11 - * particular file as subject to the "Classpath" exception as provided
361.12 - * by Oracle in the LICENSE file that accompanied this code.
361.13 - *
361.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
361.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
361.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
361.17 - * version 2 for more details (a copy is included in the LICENSE file that
361.18 - * accompanied this code).
361.19 - *
361.20 - * You should have received a copy of the GNU General Public License version
361.21 - * 2 along with this work; if not, write to the Free Software Foundation,
361.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
361.23 - *
361.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
361.25 - * or visit www.oracle.com if you need additional information or have any
361.26 - * questions.
361.27 - */
361.28 -
361.29 -package sun.io;
361.30 -
361.31 -/**
361.32 - * @author Limin Shi
361.33 - * Sean Jiang
361.34 - */
361.35 -
361.36 -public abstract class ByteToCharDoubleByte extends ByteToCharConverter {
361.37 - protected byte savedByte;
361.38 -
361.39 - /*
361.40 - * 1st level index, provided by subclass
361.41 - */
361.42 - protected short index1[];
361.43 -
361.44 - /*
361.45 - * 2nd level index, provided by subclass
361.46 - * every string has 0x10*(end-start+1) characters.
361.47 - */
361.48 - protected String index2[];
361.49 -
361.50 - protected int start;
361.51 - protected int end;
361.52 -
361.53 - /*
361.54 - * Size of bad input that caused conversion to stop
361.55 - */
361.56 - protected int badInputLength;
361.57 -
361.58 - public ByteToCharDoubleByte() {
361.59 - super();
361.60 - savedByte = 0;
361.61 - }
361.62 -
361.63 -
361.64 - public short[] getIndex1() {
361.65 - return(index1);
361.66 - }
361.67 -
361.68 - public String[] getIndex2() {
361.69 - return(index2);
361.70 - }
361.71 -
361.72 - public int flush(char[] output, int outStart, int outEnd)
361.73 - throws MalformedInputException
361.74 - {
361.75 - if (savedByte != 0) {
361.76 - reset();
361.77 - badInputLength = 0;
361.78 - throw new MalformedInputException();
361.79 - }
361.80 - reset();
361.81 - return 0;
361.82 - }
361.83 -
361.84 - /**
361.85 - * Converts sequences of bytes to characters.
361.86 - * Conversions that result in Exceptions can be restarted by calling
361.87 - * convert again, with appropriately modified parameters.
361.88 - * @return the characters written to output.
361.89 - * @param input byte array containing text in Double/single Byte
361.90 - * @param inStart offset in input array
361.91 - * @param inEnd offset of last byte to be converted
361.92 - * @param output character array to receive conversion result
361.93 - * @param outStart starting offset
361.94 - * @param outEnd offset of last byte to be written to
361.95 - * @throw UnsupportedCharacterException for any bytes
361.96 - * that cannot be converted to the external character set.
361.97 - */
361.98 - public int convert(byte[] input, int inOff, int inEnd,
361.99 - char[] output, int outOff, int outEnd)
361.100 - throws UnknownCharacterException, MalformedInputException,
361.101 - ConversionBufferFullException
361.102 - {
361.103 - char outputChar = REPLACE_CHAR;
361.104 - int inputSize = 0; // Size of input
361.105 -
361.106 - // Record beginning offsets
361.107 - charOff = outOff;
361.108 - byteOff = inOff;
361.109 -
361.110 - // Loop until we hit the end of the input
361.111 - while (byteOff < inEnd) {
361.112 - int byte1, byte2;
361.113 -
361.114 - if (savedByte == 0) {
361.115 - byte1 = input[byteOff];
361.116 - inputSize = 1;
361.117 - } else {
361.118 - byte1 = savedByte;
361.119 - savedByte = 0;
361.120 - inputSize = 0;
361.121 - }
361.122 -
361.123 - outputChar = convSingleByte(byte1);
361.124 -
361.125 - if (outputChar == REPLACE_CHAR) { // DoubleByte char
361.126 - if (byteOff + inputSize >= inEnd) {
361.127 - // split in the middle of a character
361.128 - // save the first byte for next time around
361.129 - savedByte = (byte) byte1;
361.130 - byteOff += inputSize;
361.131 - break;
361.132 - }
361.133 -
361.134 - byte1 &= 0xff;
361.135 - byte2 = input[byteOff + inputSize] & 0xff;
361.136 -
361.137 - inputSize++;
361.138 - outputChar = getUnicode(byte1, byte2);
361.139 - }
361.140 -
361.141 - if (outputChar == REPLACE_CHAR) {
361.142 - if (subMode)
361.143 - outputChar = subChars[0];
361.144 - else {
361.145 - badInputLength = inputSize;
361.146 - throw new UnknownCharacterException();
361.147 - }
361.148 - }
361.149 -
361.150 - if (charOff >= outEnd)
361.151 - throw new ConversionBufferFullException();
361.152 -
361.153 - output[charOff++] = outputChar;
361.154 - byteOff += inputSize;
361.155 - }
361.156 -
361.157 - return charOff - outOff;
361.158 - }
361.159 -
361.160 - /**
361.161 - * Resets the converter.
361.162 - * Call this method to reset the converter to its initial state
361.163 - */
361.164 - public void reset() {
361.165 - byteOff = charOff = 0;
361.166 - savedByte = 0;
361.167 - }
361.168 -
361.169 -
361.170 - /*
361.171 - * Can be changed by subclass
361.172 - */
361.173 - protected char convSingleByte(int b) {
361.174 - if (b >= 0)
361.175 - return (char) b;
361.176 - return REPLACE_CHAR;
361.177 - }
361.178 -
361.179 - /*
361.180 - * Can be changed by subclass
361.181 - */
361.182 - protected char getUnicode(int byte1, int byte2) {
361.183 - // Fix for bug 4117820 - similar fix for bug 4121358 put
361.184 - // into ByteToCharEUC_JP.getUnicode()
361.185 - if (((byte1 < 0) || (byte1 > index1.length))
361.186 - || ((byte2 < start) || (byte2 > end)))
361.187 - return REPLACE_CHAR;
361.188 -
361.189 - int n = (index1[byte1] & 0xf) * (end - start + 1) + (byte2 - start);
361.190 - return index2[index1[byte1] >> 4].charAt(n);
361.191 - }
361.192 -
361.193 - protected final static char REPLACE_CHAR = '\uFFFD';
361.194 -}
362.1 --- a/src/share/classes/sun/io/ByteToCharEUC.java Thu Sep 01 13:54:38 2011 -0700
362.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
362.3 @@ -1,150 +0,0 @@
362.4 -/*
362.5 - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
362.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
362.7 - *
362.8 - * This code is free software; you can redistribute it and/or modify it
362.9 - * under the terms of the GNU General Public License version 2 only, as
362.10 - * published by the Free Software Foundation. Oracle designates this
362.11 - * particular file as subject to the "Classpath" exception as provided
362.12 - * by Oracle in the LICENSE file that accompanied this code.
362.13 - *
362.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
362.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
362.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
362.17 - * version 2 for more details (a copy is included in the LICENSE file that
362.18 - * accompanied this code).
362.19 - *
362.20 - * You should have received a copy of the GNU General Public License version
362.21 - * 2 along with this work; if not, write to the Free Software Foundation,
362.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
362.23 - *
362.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
362.25 - * or visit www.oracle.com if you need additional information or have any
362.26 - * questions.
362.27 - */
362.28 -package sun.io;
362.29 -
362.30 -/**
362.31 -* @author Malcolm Ayres
362.32 -*/
362.33 -public abstract class ByteToCharEUC extends ByteToCharConverter
362.34 -{
362.35 - private final int G0 = 0;
362.36 - private final int G1 = 1;
362.37 - private final int SS2 = 0x8E;
362.38 - private final int SS3 = 0x8F;
362.39 -
362.40 - private int firstByte, state;
362.41 -
362.42 - protected String mappingTableG1;
362.43 - protected String byteToCharTable;
362.44 -
362.45 -
362.46 - public ByteToCharEUC() {
362.47 - super();
362.48 - state = G0;
362.49 - }
362.50 -
362.51 - /**
362.52 - * flush out any residual data and reset the buffer state
362.53 - */
362.54 - public int flush(char[] output, int outStart, int outEnd)
362.55 - throws MalformedInputException
362.56 - {
362.57 - if (state != G0) {
362.58 - reset();
362.59 - badInputLength = 0;
362.60 - throw new MalformedInputException();
362.61 - }
362.62 -
362.63 - reset();
362.64 - return 0;
362.65 - }
362.66 -
362.67 - /**
362.68 - * Resets the converter.
362.69 - */
362.70 - public void reset() {
362.71 - state = G0;
362.72 - charOff = byteOff = 0;
362.73 - }
362.74 -
362.75 - /**
362.76 - * Character conversion
362.77 - */
362.78 - public int convert(byte[] input, int inOff, int inEnd,
362.79 - char[] output, int outOff, int outEnd)
362.80 - throws UnknownCharacterException, MalformedInputException,
362.81 - ConversionBufferFullException
362.82 - {
362.83 -
362.84 - int byte1;
362.85 - char outputChar = '\uFFFD';
362.86 -
362.87 - byteOff = inOff;
362.88 - charOff = outOff;
362.89 -
362.90 - while (byteOff < inEnd) {
362.91 -
362.92 - byte1 = input[byteOff];
362.93 - if (byte1 < 0)
362.94 - byte1 += 256;
362.95 -
362.96 - switch (state) {
362.97 - case G0:
362.98 - if (byte1 == SS2 || // no general support
362.99 - byte1 == SS3 ) { // for g2 or g3
362.100 - badInputLength = 1;
362.101 - throw new MalformedInputException();
362.102 - }
362.103 -
362.104 - if ( byte1 <= 0x9f ) // < 0x9f has its own table
362.105 - outputChar = byteToCharTable.charAt(byte1);
362.106 - else
362.107 - if (byte1 < 0xa1 || byte1 > 0xfe) { // byte within range?
362.108 - badInputLength = 1;
362.109 - throw new MalformedInputException();
362.110 - } else { // G1 set first byte
362.111 - firstByte = byte1;
362.112 - state = G1;
362.113 - }
362.114 - break;
362.115 -
362.116 - case G1:
362.117 -
362.118 - state = G0;
362.119 - if ( byte1 < 0xa1 || byte1 > 0xfe) { // valid G1 set second byte
362.120 - badInputLength = 1;
362.121 - throw new MalformedInputException();
362.122 - }
362.123 -
362.124 - outputChar = mappingTableG1.charAt(((firstByte - 0xa1) * 94) + byte1 - 0xa1);
362.125 - break;
362.126 -
362.127 - }
362.128 -
362.129 - if (state == G0) {
362.130 - if (outputChar == '\uFFFD') {
362.131 - if (subMode)
362.132 - outputChar = subChars[0];
362.133 - else {
362.134 - badInputLength = 1;
362.135 - throw new UnknownCharacterException();
362.136 - }
362.137 - }
362.138 -
362.139 - if (charOff >= outEnd)
362.140 - throw new ConversionBufferFullException();
362.141 -
362.142 - output[charOff++] = outputChar;
362.143 - }
362.144 -
362.145 - byteOff++;
362.146 -
362.147 - }
362.148 -
362.149 - return charOff - outOff;
362.150 -
362.151 - }
362.152 -
362.153 -}
363.1 --- a/src/share/classes/sun/io/ByteToCharEUC2.java Thu Sep 01 13:54:38 2011 -0700
363.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
363.3 @@ -1,138 +0,0 @@
363.4 -/*
363.5 - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
363.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
363.7 - *
363.8 - * This code is free software; you can redistribute it and/or modify it
363.9 - * under the terms of the GNU General Public License version 2 only, as
363.10 - * published by the Free Software Foundation. Oracle designates this
363.11 - * particular file as subject to the "Classpath" exception as provided
363.12 - * by Oracle in the LICENSE file that accompanied this code.
363.13 - *
363.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
363.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
363.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
363.17 - * version 2 for more details (a copy is included in the LICENSE file that
363.18 - * accompanied this code).
363.19 - *
363.20 - * You should have received a copy of the GNU General Public License version
363.21 - * 2 along with this work; if not, write to the Free Software Foundation,
363.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
363.23 - *
363.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
363.25 - * or visit www.oracle.com if you need additional information or have any
363.26 - * questions.
363.27 - */
363.28 -package sun.io;
363.29 -
363.30 -import sun.nio.cs.ext.DoubleByte;
363.31 -import static sun.nio.cs.CharsetMapping.*;
363.32 -
363.33 -public abstract class ByteToCharEUC2 extends ByteToCharConverter
363.34 -{
363.35 - private final int G0 = 0;
363.36 - private final int G1 = 1;
363.37 - private final int SS2 = 0x8E;
363.38 - private final int SS3 = 0x8F;
363.39 -
363.40 - private int firstByte, state;
363.41 -
363.42 - private DoubleByte.Decoder dec;
363.43 -
363.44 - public ByteToCharEUC2(DoubleByte.Decoder dec) {
363.45 - super();
363.46 - state = G0;
363.47 - this.dec = dec;
363.48 - }
363.49 -
363.50 - char decodeSingle(int b) {
363.51 - return dec.decodeSingle(b);
363.52 - }
363.53 -
363.54 - char decodeDouble(int b1, int b2) {
363.55 - return dec.decodeDouble(b1, b2);
363.56 - }
363.57 -
363.58 - /**
363.59 - * flush out any residual data and reset the buffer state
363.60 - */
363.61 - public int flush(char[] output, int outStart, int outEnd)
363.62 - throws MalformedInputException
363.63 - {
363.64 - if (state != G0) {
363.65 - reset();
363.66 - badInputLength = 0;
363.67 - throw new MalformedInputException();
363.68 - }
363.69 -
363.70 - reset();
363.71 - return 0;
363.72 - }
363.73 -
363.74 - /**
363.75 - * Resets the converter.
363.76 - */
363.77 - public void reset() {
363.78 - state = G0;
363.79 - charOff = byteOff = 0;
363.80 - }
363.81 -
363.82 - /**
363.83 - * Character conversion
363.84 - */
363.85 - public int convert(byte[] input, int inOff, int inEnd,
363.86 - char[] output, int outOff, int outEnd)
363.87 - throws UnknownCharacterException, MalformedInputException,
363.88 - ConversionBufferFullException
363.89 - {
363.90 - int byte1;
363.91 - char outputChar = UNMAPPABLE_DECODING;
363.92 - byteOff = inOff;
363.93 - charOff = outOff;
363.94 -
363.95 - while (byteOff < inEnd) {
363.96 - byte1 = input[byteOff] & 0xff;
363.97 - switch (state) {
363.98 - case G0:
363.99 - if (byte1 == SS2 || // no general support
363.100 - byte1 == SS3 ) { // for g2 or g3
363.101 - badInputLength = 1;
363.102 - throw new MalformedInputException();
363.103 - }
363.104 - if ( byte1 <= 0x9f ) // < 0x9f has its own table
363.105 - outputChar = decodeSingle(byte1);
363.106 - else
363.107 - if (byte1 < 0xa1 || byte1 > 0xfe) { // byte within range?
363.108 - badInputLength = 1;
363.109 - throw new MalformedInputException();
363.110 - } else { // G1 set first byte
363.111 - firstByte = byte1;
363.112 - state = G1;
363.113 - }
363.114 - break;
363.115 - case G1:
363.116 - state = G0;
363.117 - if ( byte1 < 0xa1 || byte1 > 0xfe) { // valid G1 set second byte
363.118 - badInputLength = 1;
363.119 - throw new MalformedInputException();
363.120 - }
363.121 - outputChar = decodeDouble(firstByte, byte1);
363.122 - break;
363.123 - }
363.124 - if (state == G0) {
363.125 - if (outputChar == UNMAPPABLE_DECODING) {
363.126 - if (subMode)
363.127 - outputChar = subChars[0];
363.128 - else {
363.129 - badInputLength = 1;
363.130 - throw new UnknownCharacterException();
363.131 - }
363.132 - }
363.133 - if (charOff >= outEnd)
363.134 - throw new ConversionBufferFullException();
363.135 - output[charOff++] = outputChar;
363.136 - }
363.137 - byteOff++;
363.138 - }
363.139 - return charOff - outOff;
363.140 - }
363.141 -}
364.1 --- a/src/share/classes/sun/io/ByteToCharEUC_CN.java Thu Sep 01 13:54:38 2011 -0700
364.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
364.3 @@ -1,42 +0,0 @@
364.4 -/*
364.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
364.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
364.7 - *
364.8 - * This code is free software; you can redistribute it and/or modify it
364.9 - * under the terms of the GNU General Public License version 2 only, as
364.10 - * published by the Free Software Foundation. Oracle designates this
364.11 - * particular file as subject to the "Classpath" exception as provided
364.12 - * by Oracle in the LICENSE file that accompanied this code.
364.13 - *
364.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
364.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
364.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
364.17 - * version 2 for more details (a copy is included in the LICENSE file that
364.18 - * accompanied this code).
364.19 - *
364.20 - * You should have received a copy of the GNU General Public License version
364.21 - * 2 along with this work; if not, write to the Free Software Foundation,
364.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
364.23 - *
364.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
364.25 - * or visit www.oracle.com if you need additional information or have any
364.26 - * questions.
364.27 - */
364.28 -
364.29 -package sun.io;
364.30 -
364.31 -import sun.nio.cs.ext.*;
364.32 -
364.33 -public class ByteToCharEUC_CN extends ByteToCharDBCS_ASCII {
364.34 -
364.35 - private static DoubleByte.Decoder dec =
364.36 - (DoubleByte.Decoder)new EUC_CN().newDecoder();
364.37 -
364.38 - public String getCharacterEncoding() {
364.39 - return "EUC_CN";
364.40 - }
364.41 -
364.42 - public ByteToCharEUC_CN() {
364.43 - super(dec);
364.44 - }
364.45 -}
365.1 --- a/src/share/classes/sun/io/ByteToCharEUC_JP.java Thu Sep 01 13:54:38 2011 -0700
365.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
365.3 @@ -1,192 +0,0 @@
365.4 -/*
365.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
365.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
365.7 - *
365.8 - * This code is free software; you can redistribute it and/or modify it
365.9 - * under the terms of the GNU General Public License version 2 only, as
365.10 - * published by the Free Software Foundation. Oracle designates this
365.11 - * particular file as subject to the "Classpath" exception as provided
365.12 - * by Oracle in the LICENSE file that accompanied this code.
365.13 - *
365.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
365.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
365.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
365.17 - * version 2 for more details (a copy is included in the LICENSE file that
365.18 - * accompanied this code).
365.19 - *
365.20 - * You should have received a copy of the GNU General Public License version
365.21 - * 2 along with this work; if not, write to the Free Software Foundation,
365.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
365.23 - *
365.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
365.25 - * or visit www.oracle.com if you need additional information or have any
365.26 - * questions.
365.27 - */
365.28 -
365.29 -package sun.io;
365.30 -
365.31 -/**
365.32 - * @author Limin Shi
365.33 - */
365.34 -
365.35 -public class ByteToCharEUC_JP extends ByteToCharJIS0208 {
365.36 - private byte savedSecond = 0;
365.37 -
365.38 - ByteToCharJIS0201 bcJIS0201 = new ByteToCharJIS0201();
365.39 - ByteToCharJIS0212 bcJIS0212 = new ByteToCharJIS0212();
365.40 -
365.41 - public ByteToCharEUC_JP() {
365.42 - super();
365.43 - start = 0xA1;
365.44 - end = 0xFE;
365.45 - savedSecond = 0;
365.46 - }
365.47 -
365.48 - public int flush(char[] output, int outStart, int outEnd)
365.49 - throws MalformedInputException
365.50 - {
365.51 - if (savedSecond != 0) {
365.52 - reset();
365.53 - throw new MalformedInputException();
365.54 - }
365.55 - reset();
365.56 - return 0;
365.57 - }
365.58 -
365.59 - /**
365.60 - * Resets the converter.
365.61 - * Call this method to reset the converter to its initial state
365.62 - */
365.63 - public void reset() {
365.64 - super.reset();
365.65 - savedSecond = 0;
365.66 - }
365.67 -
365.68 - public String getCharacterEncoding() {
365.69 - return "EUC_JP";
365.70 - }
365.71 -
365.72 - protected char convSingleByte(int b) {
365.73 - if (b < 0 || b > 0x7F)
365.74 - return REPLACE_CHAR;
365.75 - return bcJIS0201.getUnicode(b);
365.76 - }
365.77 -
365.78 - protected char getUnicode(int byte1, int byte2) {
365.79 - if (byte1 == 0x8E) {
365.80 - return bcJIS0201.getUnicode(byte2 - 256);
365.81 - }
365.82 - // Fix for bug 4121358 - similar fix for bug 4117820 put
365.83 - // into ByteToCharDoubleByte.getUnicode()
365.84 - if (((byte1 < 0) || (byte1 > index1.length))
365.85 - || ((byte2 < start) || (byte2 > end)))
365.86 - return REPLACE_CHAR;
365.87 -
365.88 - int n = (index1[byte1 - 0x80] & 0xf) * (end - start + 1)
365.89 - + (byte2 - start);
365.90 - return index2[index1[byte1 - 0x80] >> 4].charAt(n);
365.91 - }
365.92 -
365.93 - protected char decode0212(int byte1, int byte2) {
365.94 - return bcJIS0212.getUnicode(byte1, byte2);
365.95 - }
365.96 -
365.97 - /**
365.98 - * Converts sequences of bytes to characters.
365.99 - * Conversions that result in Exceptions can be restarted by calling
365.100 - * convert again, with appropriately modified parameters.
365.101 - * @return the characters written to output.
365.102 - * @param input byte array containing text in Double/single Byte
365.103 - * @param inStart offset in input array
365.104 - * @param inEnd offset of last byte to be converted
365.105 - * @param output character array to receive conversion result
365.106 - * @param outStart starting offset
365.107 - * @param outEnd offset of last byte to be written to
365.108 - * @throw UnsupportedCharacterException for any bytes
365.109 - * that cannot be converted to the external character set.
365.110 - */
365.111 - public int convert(byte[] input, int inOff, int inEnd,
365.112 - char[] output, int outOff, int outEnd)
365.113 - throws UnknownCharacterException,
365.114 - ConversionBufferFullException
365.115 - {
365.116 - char outputChar = REPLACE_CHAR;
365.117 - int inputSize = 0; // Size of input
365.118 -
365.119 - // Record beginning offsets
365.120 - charOff = outOff;
365.121 - byteOff = inOff;
365.122 -
365.123 - // Loop until we hit the end of the input
365.124 - while (byteOff < inEnd) {
365.125 - int byte1, byte2;
365.126 -
365.127 - if (savedByte == 0) {
365.128 - byte1 = input[byteOff];
365.129 - inputSize = 1;
365.130 - } else {
365.131 - byte1 = savedByte;
365.132 - savedByte = 0;
365.133 - inputSize = 0;
365.134 - }
365.135 -
365.136 - outputChar = convSingleByte(byte1);
365.137 -
365.138 - if (outputChar == REPLACE_CHAR) { // Multibyte char
365.139 - if ((byte1 & 0xff) == 0x8F) { // JIS0212
365.140 - if (byteOff + inputSize + 1 >= inEnd) {
365.141 - // split in the middle of a character
365.142 - // save the first 2 bytes for next time around
365.143 - savedByte = (byte) byte1;
365.144 - byteOff += inputSize;
365.145 - if (byteOff < inEnd) {
365.146 - savedSecond = input[byteOff];
365.147 - byteOff++;
365.148 - }
365.149 - break;
365.150 - }
365.151 - if (savedSecond != 0) {
365.152 - byte1 = savedSecond & 0xff;
365.153 - savedSecond = 0;
365.154 - } else {
365.155 - byte1 = input[byteOff + inputSize] & 0xff;
365.156 - inputSize++;
365.157 - }
365.158 - byte2 = input[byteOff + inputSize] & 0xff;
365.159 - inputSize++;
365.160 - outputChar = decode0212(byte1-0x80, byte2-0x80);
365.161 - } else { // JIS0208
365.162 - if (byteOff + inputSize >= inEnd) {
365.163 - // split in the middle of a character
365.164 - // save the first byte for next time around
365.165 - savedByte = (byte) byte1;
365.166 - byteOff += inputSize;
365.167 - break;
365.168 - }
365.169 - byte1 &= 0xff;
365.170 - byte2 = input[byteOff + inputSize] & 0xff;
365.171 - inputSize++;
365.172 - outputChar = getUnicode(byte1, byte2);
365.173 - }
365.174 - }
365.175 -
365.176 - if (outputChar == REPLACE_CHAR) {
365.177 - if (subMode)
365.178 - outputChar = subChars[0];
365.179 - else {
365.180 - badInputLength = inputSize;
365.181 - throw new UnknownCharacterException();
365.182 - }
365.183 - }
365.184 -
365.185 - if (charOff >= outEnd)
365.186 - throw new ConversionBufferFullException();
365.187 -
365.188 - output[charOff++] = outputChar;
365.189 - byteOff += inputSize;
365.190 - }
365.191 -
365.192 - return charOff - outOff;
365.193 - }
365.194 -
365.195 -}
366.1 --- a/src/share/classes/sun/io/ByteToCharEUC_JP_LINUX.java Thu Sep 01 13:54:38 2011 -0700
366.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
366.3 @@ -1,190 +0,0 @@
366.4 -/*
366.5 - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
366.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
366.7 - *
366.8 - * This code is free software; you can redistribute it and/or modify it
366.9 - * under the terms of the GNU General Public License version 2 only, as
366.10 - * published by the Free Software Foundation. Oracle designates this
366.11 - * particular file as subject to the "Classpath" exception as provided
366.12 - * by Oracle in the LICENSE file that accompanied this code.
366.13 - *
366.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
366.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
366.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
366.17 - * version 2 for more details (a copy is included in the LICENSE file that
366.18 - * accompanied this code).
366.19 - *
366.20 - * You should have received a copy of the GNU General Public License version
366.21 - * 2 along with this work; if not, write to the Free Software Foundation,
366.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
366.23 - *
366.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
366.25 - * or visit www.oracle.com if you need additional information or have any
366.26 - * questions.
366.27 - */
366.28 -
366.29 -package sun.io;
366.30 -
366.31 -/**
366.32 - * Class for converting bytes to characters for the EUC-JP encoding in
366.33 - * linux. This converter supports the JIS0201 and the JIS0208 encoding and
366.34 - * omits support for the JIS212 encoding.
366.35 - *
366.36 - * @author Naveen Sanjeeva
366.37 - */
366.38 -
366.39 -public class ByteToCharEUC_JP_LINUX extends ByteToCharJIS0208 {
366.40 - private byte savedSecond = 0;
366.41 - ByteToCharJIS0201 bcJIS0201 = new ByteToCharJIS0201();
366.42 -
366.43 - public ByteToCharEUC_JP_LINUX() {
366.44 - super();
366.45 - start = 0xA1;
366.46 - end = 0xFE;
366.47 - savedSecond = 0;
366.48 - }
366.49 -
366.50 - public int flush(char[] output, int outStart, int outEnd)
366.51 - throws MalformedInputException
366.52 - {
366.53 - if (savedSecond != 0) {
366.54 - reset();
366.55 - throw new MalformedInputException();
366.56 - }
366.57 - reset();
366.58 - return 0;
366.59 - }
366.60 -
366.61 - /**
366.62 - * Resets the converter.
366.63 - * Call this method to reset the converter to its initial state
366.64 - */
366.65 - public void reset() {
366.66 - super.reset();
366.67 - savedSecond = 0;
366.68 - }
366.69 -
366.70 - public String getCharacterEncoding() {
366.71 - return "EUC_JP_LINUX";
366.72 - }
366.73 -
366.74 - protected char convSingleByte(int b) {
366.75 - if (b < 0 || b > 0x7F)
366.76 - return REPLACE_CHAR;
366.77 - return bcJIS0201.getUnicode(b);
366.78 - }
366.79 -
366.80 - protected char getUnicode(int byte1, int byte2) {
366.81 - if (byte1 == 0x8E) {
366.82 - return bcJIS0201.getUnicode(byte2 - 256);
366.83 - }
366.84 - // Fix for bug 4121358 - similar fix for bug 4117820 put
366.85 - // into ByteToCharDoubleByte.getUnicode()
366.86 - if (((byte1 < 0) || (byte1 > index1.length))
366.87 - || ((byte2 < start) || (byte2 > end)))
366.88 - return REPLACE_CHAR;
366.89 -
366.90 - int n = (index1[byte1 - 0x80] & 0xf) * (end - start + 1)
366.91 - + (byte2 - start);
366.92 - return index2[index1[byte1 - 0x80] >> 4].charAt(n);
366.93 - }
366.94 -
366.95 - /**
366.96 - * Converts sequences of bytes to characters.
366.97 - * Conversions that result in Exceptions can be restarted by calling
366.98 - * convert again, with appropriately modified parameters.
366.99 - * @return the characters written to output.
366.100 - * @param input byte array containing text in Double/single Byte
366.101 - * @param inStart offset in input array
366.102 - * @param inEnd offset of last byte to be converted
366.103 - * @param output character array to receive conversion result
366.104 - * @param outStart starting offset
366.105 - * @param outEnd offset of last byte to be written to
366.106 - * @throw UnsupportedCharacterException for any bytes
366.107 - * that cannot be converted to the external character set.
366.108 - */
366.109 - public int convert(byte[] input, int inOff, int inEnd,
366.110 - char[] output, int outOff, int outEnd)
366.111 - throws UnknownCharacterException,
366.112 - ConversionBufferFullException
366.113 - {
366.114 - char outputChar = REPLACE_CHAR;
366.115 - int inputSize = 0; // Size of input
366.116 -
366.117 - // Record beginning offsets
366.118 - charOff = outOff;
366.119 - byteOff = inOff;
366.120 -
366.121 - // Loop until we hit the end of the input
366.122 - while (byteOff < inEnd) {
366.123 - int byte1, byte2;
366.124 -
366.125 - if (savedByte == 0) {
366.126 - byte1 = input[byteOff];
366.127 - inputSize = 1;
366.128 - } else {
366.129 - byte1 = savedByte;
366.130 - savedByte = 0;
366.131 - inputSize = 0;
366.132 - }
366.133 -
366.134 - outputChar = convSingleByte(byte1);
366.135 -
366.136 - if (outputChar == REPLACE_CHAR) { // Multibyte char
366.137 - if ((byte1 & 0xff) != 0x8F) { // JIS0208
366.138 - if (byteOff + inputSize >= inEnd) {
366.139 - // split in the middle of a character
366.140 - // save the first byte for next time around
366.141 - savedByte = (byte) byte1;
366.142 - byteOff += inputSize;
366.143 - break;
366.144 - }
366.145 - byte1 &= 0xff;
366.146 - byte2 = input[byteOff + inputSize] & 0xff;
366.147 - inputSize++;
366.148 - outputChar = getUnicode(byte1, byte2);
366.149 - } else if ((byte1 & 0xff) == 0x8F) { // JIS0212
366.150 - // Handling of 3-byte sequences for this converter involves
366.151 - // just ignoring the relevant bytes and returning a
366.152 - // suitable substitute char if one exists.
366.153 - if (byteOff + inputSize + 1 >= inEnd) {
366.154 - // split in the middle of a character
366.155 - // save the first 2 bytes for next time around
366.156 - savedByte = (byte) byte1;
366.157 - byteOff += inputSize;
366.158 - if (byteOff < inEnd) {
366.159 - savedSecond = input[byteOff];
366.160 - byteOff++;
366.161 - }
366.162 - break;
366.163 - }
366.164 -
366.165 - // Skip over the saved bytes if any
366.166 - if (savedSecond != 0) {
366.167 - savedSecond = 0;
366.168 - } else {
366.169 - inputSize++;
366.170 - }
366.171 - inputSize++;
366.172 - }
366.173 - }
366.174 -
366.175 - if (outputChar == REPLACE_CHAR) {
366.176 - if (subMode)
366.177 - outputChar = subChars[0];
366.178 - else {
366.179 - badInputLength = inputSize;
366.180 - throw new UnknownCharacterException();
366.181 - }
366.182 - }
366.183 -
366.184 - if (charOff >= outEnd)
366.185 - throw new ConversionBufferFullException();
366.186 -
366.187 - output[charOff++] = outputChar;
366.188 - byteOff += inputSize;
366.189 - }
366.190 -
366.191 - return charOff - outOff;
366.192 - }
366.193 -}
367.1 --- a/src/share/classes/sun/io/ByteToCharEUC_JP_Solaris.java Thu Sep 01 13:54:38 2011 -0700
367.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
367.3 @@ -1,209 +0,0 @@
367.4 -/*
367.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
367.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
367.7 - *
367.8 - * This code is free software; you can redistribute it and/or modify it
367.9 - * under the terms of the GNU General Public License version 2 only, as
367.10 - * published by the Free Software Foundation. Oracle designates this
367.11 - * particular file as subject to the "Classpath" exception as provided
367.12 - * by Oracle in the LICENSE file that accompanied this code.
367.13 - *
367.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
367.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
367.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
367.17 - * version 2 for more details (a copy is included in the LICENSE file that
367.18 - * accompanied this code).
367.19 - *
367.20 - * You should have received a copy of the GNU General Public License version
367.21 - * 2 along with this work; if not, write to the Free Software Foundation,
367.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
367.23 - *
367.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
367.25 - * or visit www.oracle.com if you need additional information or have any
367.26 - * questions.
367.27 - */
367.28 -
367.29 -package sun.io;
367.30 -
367.31 -import sun.nio.cs.ext.JIS_X_0208_Solaris_Decoder;
367.32 -import sun.nio.cs.ext.JIS_X_0212_Solaris_Decoder;
367.33 -/**
367.34 - *
367.35 - * @author Limin Shi
367.36 - * @author Ian Little
367.37 - *
367.38 - * EUC_JP variant converter for Solaris with vendor defined chars
367.39 - * added (4765370)
367.40 - */
367.41 -
367.42 -
367.43 -public class ByteToCharEUC_JP_Solaris extends ByteToCharEUC_JP {
367.44 - private byte savedSecond = 0;
367.45 -
367.46 - ByteToCharJIS0201 bcJIS0201 = new ByteToCharJIS0201();
367.47 - ByteToCharJIS0212_Solaris bcJIS0212 = new ByteToCharJIS0212_Solaris();
367.48 -
367.49 - short[] j0208Index1 = JIS_X_0208_Solaris_Decoder.getIndex1();
367.50 - String[] j0208Index2 = JIS_X_0208_Solaris_Decoder.getIndex2();
367.51 - ByteToCharJIS0212_Solaris j0212Decoder = new ByteToCharJIS0212_Solaris();
367.52 -
367.53 - public ByteToCharEUC_JP_Solaris() {
367.54 - super();
367.55 - start = 0xA1;
367.56 - end = 0xFE;
367.57 - savedSecond = 0;
367.58 - }
367.59 -
367.60 - public int flush(char[] output, int outStart, int outEnd)
367.61 - throws MalformedInputException
367.62 - {
367.63 - if (savedSecond != 0) {
367.64 - reset();
367.65 - throw new MalformedInputException();
367.66 - }
367.67 - reset();
367.68 - return 0;
367.69 - }
367.70 -
367.71 - /**
367.72 - * Resets the converter.
367.73 - * Call this method to reset the converter to its initial state
367.74 - */
367.75 - public void reset() {
367.76 - super.reset();
367.77 - savedSecond = 0;
367.78 - }
367.79 -
367.80 - public String getCharacterEncoding() {
367.81 - return "eucJP-open";
367.82 - }
367.83 -
367.84 - protected char convSingleByte(int b) {
367.85 - if (b < 0 || b > 0x7F)
367.86 - return REPLACE_CHAR;
367.87 - return bcJIS0201.getUnicode(b);
367.88 - }
367.89 -
367.90 - protected char getUnicode(int byte1, int byte2) {
367.91 - if (byte1 == 0x8E) {
367.92 - return bcJIS0201.getUnicode(byte2 - 256);
367.93 - }
367.94 - // Fix for bug 4121358 - similar fix for bug 4117820 put
367.95 - // into ByteToCharDoubleByte.getUnicode()
367.96 - if (((byte1 < 0) || (byte1 > j0208Index1.length))
367.97 - || ((byte2 < start) || (byte2 > end)))
367.98 - return REPLACE_CHAR;
367.99 -
367.100 - char result = super.getUnicode(byte1, byte2);
367.101 - if (result != '\uFFFD') {
367.102 - return result;
367.103 - } else {
367.104 - int n = (j0208Index1[byte1 - 0x80] & 0xf) * (end - start + 1)
367.105 - + (byte2 - start);
367.106 - return j0208Index2[j0208Index1[byte1 - 0x80] >> 4].charAt(n);
367.107 - }
367.108 - }
367.109 -
367.110 - protected char decode0212(int byte1, int byte2) {
367.111 - return j0212Decoder.getUnicode(byte1, byte2);
367.112 - }
367.113 -
367.114 - /**
367.115 - * Converts sequences of bytes to characters.
367.116 - * Conversions that result in Exceptions can be restarted by calling
367.117 - * convert again, with appropriately modified parameters.
367.118 - * @return the characters written to output.
367.119 - * @param input byte array containing text in Double/single Byte
367.120 - * @param inStart offset in input array
367.121 - * @param inEnd offset of last byte to be converted
367.122 - * @param output character array to receive conversion result
367.123 - * @param outStart starting offset
367.124 - * @param outEnd offset of last byte to be written to
367.125 - * @throw UnsupportedCharacterException for any bytes
367.126 - * that cannot be converted to the external character set.
367.127 - */
367.128 - public int convert(byte[] input, int inOff, int inEnd,
367.129 - char[] output, int outOff, int outEnd)
367.130 - throws UnknownCharacterException,
367.131 - ConversionBufferFullException
367.132 - {
367.133 - char outputChar = REPLACE_CHAR;
367.134 - int inputSize = 0; // Size of input
367.135 -
367.136 - // Record beginning offsets
367.137 - charOff = outOff;
367.138 - byteOff = inOff;
367.139 -
367.140 - // Loop until we hit the end of the input
367.141 - while (byteOff < inEnd) {
367.142 - int byte1, byte2;
367.143 -
367.144 - if (savedByte == 0) {
367.145 - byte1 = input[byteOff];
367.146 - inputSize = 1;
367.147 - } else {
367.148 - byte1 = savedByte;
367.149 - savedByte = 0;
367.150 - inputSize = 0;
367.151 - }
367.152 -
367.153 - outputChar = convSingleByte(byte1);
367.154 -
367.155 - if (outputChar == REPLACE_CHAR) { // Multibyte char
367.156 - if ((byte1 & 0xff) == 0x8F) { // JIS0212
367.157 - if (byteOff + inputSize + 1 >= inEnd) {
367.158 - // split in the middle of a character
367.159 - // save the first 2 bytes for next time around
367.160 - savedByte = (byte) byte1;
367.161 - byteOff += inputSize;
367.162 - if (byteOff < inEnd) {
367.163 - savedSecond = input[byteOff];
367.164 - byteOff++;
367.165 - }
367.166 - break;
367.167 - }
367.168 - if (savedSecond != 0) {
367.169 - byte1 = savedSecond & 0xff;
367.170 - savedSecond = 0;
367.171 - } else {
367.172 - byte1 = input[byteOff + inputSize] & 0xff;
367.173 - inputSize++;
367.174 - }
367.175 - byte2 = input[byteOff + inputSize] & 0xff;
367.176 - inputSize++;
367.177 - outputChar = bcJIS0212.getUnicode(byte1-0x80, byte2-0x80);
367.178 - } else { // JIS0208
367.179 - if (byteOff + inputSize >= inEnd) {
367.180 - // split in the middle of a character
367.181 - // save the first byte for next time around
367.182 - savedByte = (byte) byte1;
367.183 - byteOff += inputSize;
367.184 - break;
367.185 - }
367.186 - byte1 &= 0xff;
367.187 - byte2 = input[byteOff + inputSize] & 0xff;
367.188 - inputSize++;
367.189 - outputChar = getUnicode(byte1, byte2);
367.190 - }
367.191 - }
367.192 -
367.193 - if (outputChar == REPLACE_CHAR) {
367.194 - if (subMode)
367.195 - outputChar = subChars[0];
367.196 - else {
367.197 - badInputLength = inputSize;
367.198 - throw new UnknownCharacterException();
367.199 - }
367.200 - }
367.201 -
367.202 - if (charOff >= outEnd)
367.203 - throw new ConversionBufferFullException();
367.204 -
367.205 - output[charOff++] = outputChar;
367.206 - byteOff += inputSize;
367.207 - }
367.208 -
367.209 - return charOff - outOff;
367.210 - }
367.211 -
367.212 -}
368.1 --- a/src/share/classes/sun/io/ByteToCharEUC_KR.java Thu Sep 01 13:54:38 2011 -0700
368.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
368.3 @@ -1,43 +0,0 @@
368.4 -/*
368.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
368.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
368.7 - *
368.8 - * This code is free software; you can redistribute it and/or modify it
368.9 - * under the terms of the GNU General Public License version 2 only, as
368.10 - * published by the Free Software Foundation. Oracle designates this
368.11 - * particular file as subject to the "Classpath" exception as provided
368.12 - * by Oracle in the LICENSE file that accompanied this code.
368.13 - *
368.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
368.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
368.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
368.17 - * version 2 for more details (a copy is included in the LICENSE file that
368.18 - * accompanied this code).
368.19 - *
368.20 - * You should have received a copy of the GNU General Public License version
368.21 - * 2 along with this work; if not, write to the Free Software Foundation,
368.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
368.23 - *
368.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
368.25 - * or visit www.oracle.com if you need additional information or have any
368.26 - * questions.
368.27 - */
368.28 -
368.29 -
368.30 -package sun.io;
368.31 -
368.32 -import sun.nio.cs.ext.*;
368.33 -
368.34 -public class ByteToCharEUC_KR extends ByteToCharDBCS_ASCII {
368.35 -
368.36 - private static DoubleByte.Decoder dec =
368.37 - (DoubleByte.Decoder)new EUC_KR().newDecoder();
368.38 -
368.39 - public String getCharacterEncoding() {
368.40 - return "EUC_KR";
368.41 - }
368.42 -
368.43 - public ByteToCharEUC_KR() {
368.44 - super(dec);
368.45 - }
368.46 -}
369.1 --- a/src/share/classes/sun/io/ByteToCharEUC_TW.java Thu Sep 01 13:54:38 2011 -0700
369.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
369.3 @@ -1,176 +0,0 @@
369.4 -/*
369.5 - * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
369.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
369.7 - *
369.8 - * This code is free software; you can redistribute it and/or modify it
369.9 - * under the terms of the GNU General Public License version 2 only, as
369.10 - * published by the Free Software Foundation. Oracle designates this
369.11 - * particular file as subject to the "Classpath" exception as provided
369.12 - * by Oracle in the LICENSE file that accompanied this code.
369.13 - *
369.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
369.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
369.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
369.17 - * version 2 for more details (a copy is included in the LICENSE file that
369.18 - * accompanied this code).
369.19 - *
369.20 - * You should have received a copy of the GNU General Public License version
369.21 - * 2 along with this work; if not, write to the Free Software Foundation,
369.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
369.23 - *
369.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
369.25 - * or visit www.oracle.com if you need additional information or have any
369.26 - * questions.
369.27 - */
369.28 -
369.29 -package sun.io;
369.30 -
369.31 -import sun.nio.cs.ext.EUC_TW;
369.32 -
369.33 -/*
369.34 - * @author Limin Shi
369.35 - */
369.36 -public class ByteToCharEUC_TW extends ByteToCharConverter
369.37 -{
369.38 - private final byte G0 = 0;
369.39 - private final byte G1 = 1;
369.40 - private final byte G2 = 2;
369.41 - private final byte G3 = 3;
369.42 - private final byte G4 = 4;
369.43 - private final byte MSB = (byte) 0x80;
369.44 - private final byte SS2 = (byte) 0x8E;
369.45 -
369.46 - private byte firstByte = 0, state = G0;
369.47 - private int cnsPlane = 0;
369.48 -
369.49 - private EUC_TW.Decoder dec = (EUC_TW.Decoder)(new EUC_TW().newDecoder());
369.50 -
369.51 - public ByteToCharEUC_TW() {
369.52 - }
369.53 -
369.54 - public int flush(char[] output, int outStart, int outEnd)
369.55 - throws MalformedInputException
369.56 - {
369.57 - if (state != G0) {
369.58 - state = G0;
369.59 - firstByte = 0;
369.60 - badInputLength = 0;
369.61 - throw new MalformedInputException();
369.62 - }
369.63 - reset();
369.64 - return 0;
369.65 - }
369.66 -
369.67 - public void reset() {
369.68 - dec.reset();
369.69 - state = G0;
369.70 - firstByte = 0;
369.71 - byteOff = charOff = 0;
369.72 - }
369.73 -
369.74 - /**
369.75 - * Character conversion
369.76 - */
369.77 - public int convert(byte[] input, int inOff, int inEnd,
369.78 - char[] output, int outOff, int outEnd)
369.79 - throws UnknownCharacterException, MalformedInputException,
369.80 - ConversionBufferFullException
369.81 - {
369.82 - int inputSize = 0;
369.83 - char[] c1 = new char[1];
369.84 -
369.85 - byteOff = inOff;
369.86 - charOff = outOff;
369.87 -
369.88 - cnsPlane = 3;
369.89 - while (byteOff < inEnd) {
369.90 - if (charOff >= outEnd)
369.91 - throw new ConversionBufferFullException();
369.92 - char[] outputChar = null;
369.93 - switch (state) {
369.94 - case G0:
369.95 - if ( (input[byteOff] & MSB) == 0) { // ASCII
369.96 - outputChar = c1;
369.97 - outputChar[0] = (char) input[byteOff];
369.98 - } else if (input[byteOff] == SS2) { // Codeset 2
369.99 - state = G2;
369.100 - } else { // Codeset 1
369.101 - firstByte = input[byteOff];
369.102 - state = G1;
369.103 - }
369.104 - break;
369.105 - case G1:
369.106 - inputSize = 2;
369.107 - if ( (input[byteOff] & MSB) != 0) { // 2nd byte
369.108 - cnsPlane = 0;
369.109 - outputChar = dec.toUnicode(firstByte & 0xff,
369.110 - input[byteOff] & 0xff,
369.111 - cnsPlane);
369.112 - } else { // Error
369.113 - badInputLength = 1;
369.114 - throw new MalformedInputException();
369.115 - }
369.116 - firstByte = 0;
369.117 - state = G0;
369.118 - break;
369.119 - case G2:
369.120 - cnsPlane = (input[byteOff] & (byte)0x0f);
369.121 - // Adjust String array index for plan 15
369.122 - cnsPlane = (cnsPlane == 15)? 8 : cnsPlane;
369.123 -
369.124 - if (cnsPlane < 15) {
369.125 - state = G3;
369.126 - } else {
369.127 - badInputLength = 2;
369.128 - throw new MalformedInputException();
369.129 - }
369.130 -
369.131 - break;
369.132 - case G3:
369.133 - if ( (input[byteOff] & MSB) != 0) { // 1st byte
369.134 - firstByte = input[byteOff];
369.135 - state = G4;
369.136 - } else { // Error
369.137 - state = G0;
369.138 - badInputLength = 2;
369.139 - throw new MalformedInputException();
369.140 - }
369.141 - break;
369.142 - case G4:
369.143 - if ( (input[byteOff] & MSB) != 0) { // 2nd byte
369.144 - outputChar = dec.toUnicode(firstByte & 0xff,
369.145 - input[byteOff] & 0xff,
369.146 - cnsPlane - 1);
369.147 - } else { // Error
369.148 - badInputLength = 3;
369.149 - throw new MalformedInputException();
369.150 - }
369.151 - firstByte = 0;
369.152 - state = G0;
369.153 - break;
369.154 - }
369.155 - byteOff++;
369.156 - if (state == G0) {
369.157 - if (outputChar == null) {
369.158 - if (subMode) { // substitution enabled
369.159 - outputChar = c1;
369.160 - outputChar[0] = subChars[0];
369.161 - } else {
369.162 - badInputLength = inputSize;
369.163 - throw new UnknownCharacterException();
369.164 - }
369.165 - }
369.166 - output[charOff++] = outputChar[0];
369.167 - }
369.168 - }
369.169 - return charOff - outOff;
369.170 - }
369.171 -
369.172 -
369.173 - /**
369.174 - * Return the character set ID
369.175 - */
369.176 - public String getCharacterEncoding() {
369.177 - return "EUC_TW";
369.178 - }
369.179 -}
370.1 --- a/src/share/classes/sun/io/ByteToCharGB18030.java Thu Sep 01 13:54:38 2011 -0700
370.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
370.3 @@ -1,300 +0,0 @@
370.4 -/*
370.5 - * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
370.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
370.7 - *
370.8 - * This code is free software; you can redistribute it and/or modify it
370.9 - * under the terms of the GNU General Public License version 2 only, as
370.10 - * published by the Free Software Foundation. Oracle designates this
370.11 - * particular file as subject to the "Classpath" exception as provided
370.12 - * by Oracle in the LICENSE file that accompanied this code.
370.13 - *
370.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
370.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
370.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
370.17 - * version 2 for more details (a copy is included in the LICENSE file that
370.18 - * accompanied this code).
370.19 - *
370.20 - * You should have received a copy of the GNU General Public License version
370.21 - * 2 along with this work; if not, write to the Free Software Foundation,
370.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
370.23 - *
370.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
370.25 - * or visit www.oracle.com if you need additional information or have any
370.26 - * questions.
370.27 - */
370.28 -
370.29 -/*
370.30 - */
370.31 -
370.32 -package sun.io;
370.33 -
370.34 -import sun.nio.cs.ext.GB18030;
370.35 -
370.36 -public class ByteToCharGB18030 extends ByteToCharGB18030DB {
370.37 -
370.38 - private static final int GB18030_SINGLE_BYTE = 1;
370.39 - private static final int GB18030_DOUBLE_BYTE = 2;
370.40 - private static final int GB18030_FOUR_BYTE = 3;
370.41 - private static short[] decoderIndex1;
370.42 - private static String[] decoderIndex2;
370.43 -
370.44 - private int currentState;
370.45 - private int savedSize;
370.46 - private byte[] savedBytes;
370.47 -
370.48 - public ByteToCharGB18030() {
370.49 - super();
370.50 - GB18030 nioCoder = new GB18030();
370.51 - savedBytes = new byte[3];
370.52 - currentState = GB18030_DOUBLE_BYTE;
370.53 - decoderIndex1 = nioCoder.getDecoderIndex1();
370.54 - decoderIndex2 = nioCoder.getDecoderIndex2();
370.55 - savedSize = 0;
370.56 - }
370.57 -
370.58 - public short[] getOuter() {
370.59 - return(index1);
370.60 - }
370.61 -
370.62 - public String[] getInner() {
370.63 - return(index2);
370.64 - }
370.65 -
370.66 - public short[] getDBIndex1() {
370.67 - return(super.index1);
370.68 - }
370.69 -
370.70 - public String[] getDBIndex2() {
370.71 - return(super.index2);
370.72 - }
370.73 -
370.74 - public int flush(char [] output, int outStart, int outEnd)
370.75 - throws MalformedInputException
370.76 - {
370.77 - if (savedSize != 0) {
370.78 - savedSize = 0;
370.79 - currentState = GB18030_DOUBLE_BYTE;
370.80 - badInputLength = 0;
370.81 - throw new MalformedInputException();
370.82 - }
370.83 - byteOff = charOff = 0;
370.84 - return 0;
370.85 - }
370.86 -
370.87 -
370.88 - /**
370.89 - * Character conversion
370.90 - */
370.91 - public int convert(byte[] input, int inOff, int inEnd,
370.92 - char[] output, int outOff, int outEnd)
370.93 - throws UnknownCharacterException, MalformedInputException,
370.94 - ConversionBufferFullException
370.95 - {
370.96 - int inputSize = 0;
370.97 - char outputChar = '\uFFFD';
370.98 - // readOff keeps the actual buffer's pointer.
370.99 - // byteOff keeps original buffer's pointer.
370.100 - int readOff = byteOff = inOff;
370.101 -
370.102 - if (savedSize != 0) {
370.103 - // Filter illegal bytes when they are detected in saved
370.104 - // partial input from a previous conversion attempt.
370.105 - if (((savedBytes[0] & 0xFF) < 0x81 || savedBytes[0] > 0xFE) ||
370.106 - (savedSize > 1 &&
370.107 - (savedBytes[1] & 0xFF) < 0x30 ) ||
370.108 - (savedSize > 2 &&
370.109 - ((savedBytes[2] & 0xFF) < 0x81 ||
370.110 - (savedBytes[2] & 0xFF) > 0xFE ))) {
370.111 - badInputLength = 0;
370.112 - throw new MalformedInputException();
370.113 - }
370.114 -
370.115 - byte[] newBuf = new byte[inEnd - inOff + savedSize];
370.116 - for (int i = 0; i < savedSize; i++) {
370.117 - newBuf[i] = savedBytes[i];
370.118 - }
370.119 - System.arraycopy(input, inOff, newBuf, savedSize, inEnd - inOff);
370.120 - byteOff -= savedSize;
370.121 - input = newBuf;
370.122 - inOff = 0;
370.123 - inEnd = newBuf.length;
370.124 - savedSize = 0;
370.125 - }
370.126 -
370.127 - charOff = outOff;
370.128 - readOff = inOff;
370.129 -
370.130 - while(readOff < inEnd) {
370.131 - int byte1 = 0 , byte2 = 0, byte3 = 0, byte4 = 0;
370.132 -
370.133 - // Is there room in the output buffer for the result?
370.134 - if (charOff >= outEnd) {
370.135 - throw new ConversionBufferFullException();
370.136 - }
370.137 -
370.138 - // Get the input byte
370.139 - byte1 = input[readOff++] & 0xFF;
370.140 - inputSize = 1;
370.141 -
370.142 - if ((byte1 & (byte)0x80) == 0){ // US-ASCII range
370.143 - outputChar = (char)byte1;
370.144 - currentState = GB18030_SINGLE_BYTE;
370.145 - }
370.146 -
370.147 - else if (byte1 < 0x81 || byte1 > 0xfe) {
370.148 - if (subMode)
370.149 - outputChar = subChars[0];
370.150 - else {
370.151 - badInputLength = 1;
370.152 - throw new UnknownCharacterException();
370.153 - }
370.154 - }
370.155 - else {
370.156 - // Either 2 or 4 byte sequence follows
370.157 - // If an underrun is detected save for later
370.158 - // replay.
370.159 -
370.160 - if (readOff + inputSize > inEnd) {
370.161 - savedBytes[0]=(byte)byte1;
370.162 - savedSize = 1;
370.163 - break;
370.164 - }
370.165 -
370.166 - byte2 = input[readOff++] & 0xFF;
370.167 - inputSize = 2;
370.168 -
370.169 - if (byte2 < 0x30) {
370.170 - badInputLength = 1;
370.171 - throw new MalformedInputException();
370.172 - }
370.173 - else if (byte2 >= 0x30 && byte2 <= 0x39) {
370.174 - currentState = GB18030_FOUR_BYTE;
370.175 - inputSize = 4;
370.176 -
370.177 - if (readOff + 2 > inEnd) {
370.178 - if (readOff + 1 > inEnd) {
370.179 - savedBytes[0] = (byte)byte1;
370.180 - savedBytes[1] = (byte)byte2;
370.181 - savedSize = 2;
370.182 - }
370.183 - else {
370.184 - savedBytes[0] = (byte)byte1;
370.185 - savedBytes[1] = (byte)byte2;
370.186 - savedBytes[2] = input[readOff++];
370.187 - savedSize = 3;
370.188 - }
370.189 - break;
370.190 - }
370.191 - byte3 = input[readOff++] & 0xFF;
370.192 - if (byte3 < 0x81 || byte3 > 0xfe) {
370.193 - badInputLength = 3;
370.194 - throw new MalformedInputException();
370.195 - }
370.196 -
370.197 - byte4 = input[readOff++] & 0xFF;
370.198 -
370.199 - if (byte4 < 0x30 || byte4 > 0x39) {
370.200 - badInputLength = 4;
370.201 - throw new MalformedInputException();
370.202 - }
370.203 - }
370.204 - else if (byte2 == 0x7f || byte2 == 0xff ||
370.205 - (byte2 < 0x40 )) {
370.206 - badInputLength = 2;
370.207 - throw new MalformedInputException();
370.208 - }
370.209 - else
370.210 - currentState = GB18030_DOUBLE_BYTE;
370.211 - }
370.212 -
370.213 - switch (currentState){
370.214 - case GB18030_SINGLE_BYTE:
370.215 - output[charOff++] = (char)(byte1);
370.216 - break;
370.217 - case GB18030_DOUBLE_BYTE:
370.218 - output[charOff++] = super.getUnicode(byte1, byte2);
370.219 - break;
370.220 - case GB18030_FOUR_BYTE:
370.221 - int offset = (((byte1 - 0x81) * 10 +
370.222 - (byte2 - 0x30)) * 126 +
370.223 - byte3 - 0x81) * 10 + byte4 - 0x30;
370.224 - int hiByte = (offset >>8) & 0xFF;
370.225 - int lowByte = (offset & 0xFF);
370.226 -
370.227 - // Mixture of table lookups and algorithmic calculation
370.228 - // of character values.
370.229 -
370.230 - // BMP Ranges
370.231 -
370.232 - if (offset <= 0x4A62)
370.233 - output[charOff++] = getChar(offset);
370.234 - else if (offset > 0x4A62 && offset <= 0x82BC)
370.235 - output[charOff++] = (char) (offset + 0x5543);
370.236 - else if (offset >= 0x82BD && offset <= 0x830D)
370.237 - output[charOff++] = getChar(offset);
370.238 - else if (offset >= 0x830D && offset <= 0x93A8)
370.239 - output[charOff++] = (char) (offset + 0x6557);
370.240 - else if (offset >= 0x93A9 && offset <= 0x99FB)
370.241 - output[charOff++] = getChar(offset);
370.242 - // Supplemental UCS planes handled via surrogates
370.243 - else if (offset >= 0x2E248 && offset < 0x12E248) {
370.244 - if (offset >= 0x12E248) {
370.245 - if (subMode)
370.246 - return subChars[0];
370.247 - else {
370.248 - badInputLength = 4;
370.249 - throw new UnknownCharacterException();
370.250 - }
370.251 - }
370.252 -
370.253 - if (charOff +2 > outEnd) {
370.254 - throw new ConversionBufferFullException();
370.255 - }
370.256 - offset -= 0x1e248;
370.257 - char highSurr = (char) ((offset - 0x10000) / 0x400 + 0xD800);
370.258 - char lowSurr = (char) ((offset - 0x10000) % 0x400 + 0xDC00);
370.259 - output[charOff++] = highSurr;
370.260 - output[charOff++] = lowSurr;
370.261 - }
370.262 - else {
370.263 - badInputLength = 4;
370.264 - throw new MalformedInputException();
370.265 - }
370.266 - break;
370.267 - }
370.268 - byteOff += inputSize;
370.269 - }
370.270 -
370.271 - byteOff += savedSize;
370.272 - return charOff - outOff;
370.273 - }
370.274 -
370.275 - public void reset() {
370.276 - byteOff = charOff = 0;
370.277 - currentState = GB18030_DOUBLE_BYTE;
370.278 - savedSize = 0;
370.279 - }
370.280 -
370.281 - public String getCharacterEncoding() {
370.282 - return "GB18030";
370.283 - }
370.284 -
370.285 - private char getChar(int offset) throws UnknownCharacterException {
370.286 - int byte1 = (offset >>8) & 0xFF;
370.287 - int byte2 = (offset & 0xFF);
370.288 - int start = 0, end = 0xFF;
370.289 -
370.290 - if (((byte1 < 0) || (byte1 > getOuter().length))
370.291 - || ((byte2 < start) || (byte2 > end))) {
370.292 - if (subMode)
370.293 - return subChars[0];
370.294 - else {
370.295 - badInputLength = 1;
370.296 - throw new UnknownCharacterException();
370.297 - }
370.298 - }
370.299 -
370.300 - int n = (decoderIndex1[byte1] & 0xf) * (end - start + 1) + (byte2 - start);
370.301 - return decoderIndex2[decoderIndex1[byte1] >> 4].charAt(n);
370.302 - }
370.303 -}
371.1 --- a/src/share/classes/sun/io/ByteToCharGB18030DB.java Thu Sep 01 13:54:38 2011 -0700
371.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
371.3 @@ -1,53 +0,0 @@
371.4 -/*
371.5 - * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
371.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
371.7 - *
371.8 - * This code is free software; you can redistribute it and/or modify it
371.9 - * under the terms of the GNU General Public License version 2 only, as
371.10 - * published by the Free Software Foundation. Oracle designates this
371.11 - * particular file as subject to the "Classpath" exception as provided
371.12 - * by Oracle in the LICENSE file that accompanied this code.
371.13 - *
371.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
371.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
371.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
371.17 - * version 2 for more details (a copy is included in the LICENSE file that
371.18 - * accompanied this code).
371.19 - *
371.20 - * You should have received a copy of the GNU General Public License version
371.21 - * 2 along with this work; if not, write to the Free Software Foundation,
371.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
371.23 - *
371.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
371.25 - * or visit www.oracle.com if you need additional information or have any
371.26 - * questions.
371.27 - */
371.28 -
371.29 -
371.30 -package sun.io;
371.31 -
371.32 -import sun.nio.cs.ext.GB18030;
371.33 -
371.34 -
371.35 -/**
371.36 - * Tables and data to convert the two-byte portion of GB18030 to Unicode
371.37 - * The class is package level accessibility as it is just used for the
371.38 - * convenience of the main GB18030 converter.
371.39 - *
371.40 - * @author ConverterGenerator tool
371.41 - */
371.42 -
371.43 -abstract class ByteToCharGB18030DB extends ByteToCharDoubleByte {
371.44 -
371.45 - public String getCharacterEncoding() {
371.46 - return "ByteToCharGB18030DB";
371.47 - }
371.48 -
371.49 - public ByteToCharGB18030DB() {
371.50 - GB18030 nioCoder = new GB18030();
371.51 - super.index1 = nioCoder.getSubDecoderIndex1();
371.52 - super.index2 = nioCoder.getSubDecoderIndex2();
371.53 - start = 0x40;
371.54 - end = 0xFE;
371.55 - }
371.56 -}
372.1 --- a/src/share/classes/sun/io/ByteToCharGBK.java Thu Sep 01 13:54:38 2011 -0700
372.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
372.3 @@ -1,43 +0,0 @@
372.4 -/*
372.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
372.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
372.7 - *
372.8 - * This code is free software; you can redistribute it and/or modify it
372.9 - * under the terms of the GNU General Public License version 2 only, as
372.10 - * published by the Free Software Foundation. Oracle designates this
372.11 - * particular file as subject to the "Classpath" exception as provided
372.12 - * by Oracle in the LICENSE file that accompanied this code.
372.13 - *
372.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
372.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
372.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
372.17 - * version 2 for more details (a copy is included in the LICENSE file that
372.18 - * accompanied this code).
372.19 - *
372.20 - * You should have received a copy of the GNU General Public License version
372.21 - * 2 along with this work; if not, write to the Free Software Foundation,
372.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
372.23 - *
372.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
372.25 - * or visit www.oracle.com if you need additional information or have any
372.26 - * questions.
372.27 - */
372.28 -
372.29 -
372.30 -package sun.io;
372.31 -
372.32 -import sun.nio.cs.ext.*;
372.33 -
372.34 -public class ByteToCharGBK extends ByteToCharDBCS_ASCII {
372.35 -
372.36 - private static DoubleByte.Decoder dec =
372.37 - (DoubleByte.Decoder)new GBK().newDecoder();
372.38 -
372.39 - public String getCharacterEncoding() {
372.40 - return "GBK";
372.41 - }
372.42 -
372.43 - public ByteToCharGBK() {
372.44 - super(dec);
372.45 - }
372.46 -}
373.1 --- a/src/share/classes/sun/io/ByteToCharISCII91.java Thu Sep 01 13:54:38 2011 -0700
373.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
373.3 @@ -1,233 +0,0 @@
373.4 -/*
373.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
373.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
373.7 - *
373.8 - * This code is free software; you can redistribute it and/or modify it
373.9 - * under the terms of the GNU General Public License version 2 only, as
373.10 - * published by the Free Software Foundation. Oracle designates this
373.11 - * particular file as subject to the "Classpath" exception as provided
373.12 - * by Oracle in the LICENSE file that accompanied this code.
373.13 - *
373.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
373.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
373.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
373.17 - * version 2 for more details (a copy is included in the LICENSE file that
373.18 - * accompanied this code).
373.19 - *
373.20 - * You should have received a copy of the GNU General Public License version
373.21 - * 2 along with this work; if not, write to the Free Software Foundation,
373.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
373.23 - *
373.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
373.25 - * or visit www.oracle.com if you need additional information or have any
373.26 - * questions.
373.27 - */
373.28 -
373.29 -package sun.io;
373.30 -
373.31 -import sun.nio.cs.ext.ISCII91;
373.32 -
373.33 -/*
373.34 - * Copyright (c) 1998 International Business Machines.
373.35 - * All Rights Reserved.
373.36 - *
373.37 - * Author : Sunanda Bera, C. Thirumalesh
373.38 - * Last Modified : 23,November,1998
373.39 - *
373.40 - * Purpose : Defines class ByteToCharISCII91.
373.41 - *
373.42 - *
373.43 - * Revision History
373.44 - * ======== =======
373.45 - *
373.46 - * Date By Description
373.47 - * ---- -- -----------
373.48 - *
373.49 - *
373.50 - */
373.51 -
373.52 -/**
373.53 - * Converter class. Converts between Unicode encoding and ISCII91 encoding.
373.54 - * ISCII91 is the character encoding as defined in Indian Standard document
373.55 - * IS 13194:1991 ( Indian Script Code for Information Interchange ).
373.56 - *
373.57 - * @see sun.io.ByteToCharConverter
373.58 - */
373.59 -public class ByteToCharISCII91 extends ByteToCharConverter {
373.60 -
373.61 - private static final char[] directMapTable = ISCII91.getDirectMapTable();
373.62 -
373.63 - private static final char NUKTA_CHAR = '\u093c';
373.64 - private static final char HALANT_CHAR = '\u094d';
373.65 - private static final char ZWNJ_CHAR = '\u200c';
373.66 - private static final char ZWJ_CHAR = '\u200d';
373.67 - private static final char INVALID_CHAR = '\uffff';
373.68 -
373.69 - private char contextChar = INVALID_CHAR;
373.70 - private boolean needFlushing = false;
373.71 -
373.72 -/**
373.73 - * Converts ISCII91 characters to Unicode.
373.74 - * @see sun.io.ByteToCharConverter#convert
373.75 - */
373.76 - public int convert(byte input[], int inStart, int inEnd,
373.77 - char output[], int outStart, int outEnd)
373.78 - throws ConversionBufferFullException, UnknownCharacterException {
373.79 - /*Rules:
373.80 - * 1)ATR,EXT,following character to be replaced with '\ufffd'
373.81 - * 2)Halant + Halant => '\u094d' (Virama) + '\u200c'(ZWNJ)
373.82 - * 3)Halant + Nukta => '\u094d' (Virama) + '\u200d'(ZWJ)
373.83 - */
373.84 - charOff = outStart;
373.85 - byteOff = inStart;
373.86 - while (byteOff < inEnd) {
373.87 - if (charOff >= outEnd) {
373.88 - throw new ConversionBufferFullException();
373.89 - }
373.90 - int index = input[byteOff++];
373.91 - index = ( index < 0 )? ( index + 255 ):index;
373.92 - char currentChar = directMapTable[index];
373.93 -
373.94 - // if the contextChar is either ATR || EXT set the output to '\ufffd'
373.95 - if(contextChar == '\ufffd') {
373.96 - output[charOff++] = '\ufffd';
373.97 - contextChar = INVALID_CHAR;
373.98 - needFlushing = false;
373.99 - continue;
373.100 - }
373.101 -
373.102 - switch(currentChar) {
373.103 - case '\u0901':
373.104 - case '\u0907':
373.105 - case '\u0908':
373.106 - case '\u090b':
373.107 - case '\u093f':
373.108 - case '\u0940':
373.109 - case '\u0943':
373.110 - case '\u0964':
373.111 - if(needFlushing) {
373.112 - output[charOff++] = contextChar;
373.113 - contextChar = currentChar;
373.114 - continue;
373.115 - }
373.116 - contextChar = currentChar;
373.117 - needFlushing = true;
373.118 - continue;
373.119 - case NUKTA_CHAR:
373.120 - switch(contextChar) {
373.121 - case '\u0901':
373.122 - output[charOff] = '\u0950';
373.123 - break;
373.124 - case '\u0907':
373.125 - output[charOff] = '\u090c';
373.126 - break;
373.127 - case '\u0908':
373.128 - output[charOff] = '\u0961';
373.129 - break;
373.130 - case '\u090b':
373.131 - output[charOff] = '\u0960';
373.132 - break;
373.133 - case '\u093f':
373.134 - output[charOff] = '\u0962';
373.135 - break;
373.136 - case '\u0940':
373.137 - output[charOff] = '\u0963';
373.138 - break;
373.139 - case '\u0943':
373.140 - output[charOff] = '\u0944';
373.141 - break;
373.142 - case '\u0964':
373.143 - output[charOff] = '\u093d';
373.144 - break;
373.145 - case HALANT_CHAR:
373.146 - if(needFlushing) {
373.147 - output[charOff++] = contextChar;
373.148 - contextChar = currentChar;
373.149 - continue;
373.150 - }
373.151 - output[charOff] = ZWJ_CHAR;
373.152 - break;
373.153 - default:
373.154 - if(needFlushing) {
373.155 - output[charOff++] = contextChar;
373.156 - contextChar = currentChar;
373.157 - continue;
373.158 - }
373.159 - output[charOff] = NUKTA_CHAR;
373.160 - }
373.161 - break;
373.162 - case HALANT_CHAR:
373.163 - if(needFlushing) {
373.164 - output[charOff++] = contextChar;
373.165 - contextChar = currentChar;
373.166 - continue;
373.167 - }
373.168 - if(contextChar == HALANT_CHAR) {
373.169 - output[charOff] = ZWNJ_CHAR;
373.170 - break;
373.171 - }
373.172 - output[charOff] = HALANT_CHAR;
373.173 - break;
373.174 - case INVALID_CHAR:
373.175 - if(needFlushing) {
373.176 - output[charOff++] = contextChar;
373.177 - contextChar = currentChar;
373.178 - continue;
373.179 - }
373.180 - if(subMode) {
373.181 - output[charOff] = subChars[0];
373.182 - break;
373.183 - } else {
373.184 - contextChar = INVALID_CHAR;
373.185 - throw new UnknownCharacterException();
373.186 - }
373.187 - default:
373.188 - if(needFlushing) {
373.189 - output[charOff++] = contextChar;
373.190 - contextChar = currentChar;
373.191 - continue;
373.192 - }
373.193 - output[charOff] = currentChar;
373.194 - break;
373.195 - }//end switch
373.196 -
373.197 - contextChar = currentChar;
373.198 - needFlushing = false;
373.199 - charOff++;
373.200 - }//end while
373.201 - return charOff - outStart;
373.202 - } //convert()
373.203 -
373.204 -/**
373.205 - * @see sun.io.ByteToCharConverter#flush
373.206 - */
373.207 - public int flush( char[] output, int outStart, int outEnd )
373.208 - throws MalformedInputException, ConversionBufferFullException
373.209 - {
373.210 - int charsWritten = 0;
373.211 - //if the last char was not flushed, flush it!
373.212 - if(needFlushing) {
373.213 - output[outStart] = contextChar;
373.214 - charsWritten = 1;
373.215 - }
373.216 - contextChar = INVALID_CHAR;
373.217 - needFlushing = false;
373.218 - byteOff = charOff = 0;
373.219 - return charsWritten;
373.220 - }//flush()
373.221 -/**
373.222 - * Returns the character set id for the conversion.
373.223 - */
373.224 - public String getCharacterEncoding()
373.225 - {
373.226 - return "ISCII91";
373.227 - }//getCharacterEncoding()
373.228 -/**
373.229 - * @see sun.io.ByteToCharConverter#reset
373.230 - */
373.231 - public void reset()
373.232 - {
373.233 - byteOff = charOff = 0;
373.234 - }//reset()
373.235 -
373.236 -}//end of class definition
374.1 --- a/src/share/classes/sun/io/ByteToCharISO2022.java Thu Sep 01 13:54:38 2011 -0700
374.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
374.3 @@ -1,276 +0,0 @@
374.4 -/*
374.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
374.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
374.7 - *
374.8 - * This code is free software; you can redistribute it and/or modify it
374.9 - * under the terms of the GNU General Public License version 2 only, as
374.10 - * published by the Free Software Foundation. Oracle designates this
374.11 - * particular file as subject to the "Classpath" exception as provided
374.12 - * by Oracle in the LICENSE file that accompanied this code.
374.13 - *
374.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
374.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
374.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
374.17 - * version 2 for more details (a copy is included in the LICENSE file that
374.18 - * accompanied this code).
374.19 - *
374.20 - * You should have received a copy of the GNU General Public License version
374.21 - * 2 along with this work; if not, write to the Free Software Foundation,
374.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
374.23 - *
374.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
374.25 - * or visit www.oracle.com if you need additional information or have any
374.26 - * questions.
374.27 - */
374.28 -
374.29 -package sun.io;
374.30 -
374.31 -/**
374.32 - * An algorithmic conversion from ISO 2022 to Unicode
374.33 - *
374.34 - * @author Tom Zhou
374.35 - */
374.36 -public abstract class ByteToCharISO2022 extends ByteToCharConverter
374.37 -{
374.38 - // Value to be filled by subclass
374.39 - protected String SODesignator[];
374.40 - protected String SS2Designator[] = null;
374.41 - protected String SS3Designator[] = null;
374.42 -
374.43 - protected ByteToCharConverter SOConverter[];
374.44 - protected ByteToCharConverter SS2Converter[] = null;
374.45 - protected ByteToCharConverter SS3Converter[] = null;
374.46 -
374.47 - private static final byte ISO_ESC = 0x1b;
374.48 - private static final byte ISO_SI = 0x0f;
374.49 - private static final byte ISO_SO = 0x0e;
374.50 - private static final byte ISO_SS2_7 = 0x4e;
374.51 - private static final byte ISO_SS3_7 = 0x4f;
374.52 - private static final byte MSB = (byte)0x80;
374.53 - private static final char REPLACE_CHAR = '\uFFFD';
374.54 - private static final byte maximumDesignatorLength = 3;
374.55 -
374.56 - private static final byte SOFlag = 0;
374.57 - private static final byte SS2Flag = 1;
374.58 - private static final byte SS3Flag = 2;
374.59 - private static final byte G0 = 0;
374.60 - private static final byte G1 = 1;
374.61 -
374.62 - private ByteToCharConverter tmpConverter[];
374.63 -
374.64 - private int curSODes, curSS2Des, curSS3Des;
374.65 - private boolean shiftout;
374.66 -
374.67 - private byte remainByte[] = new byte[10];
374.68 - private int remainIndex = -1;
374.69 - private byte state, firstByte;
374.70 -
374.71 - public void reset()
374.72 - {
374.73 - int i = 0;
374.74 -
374.75 - shiftout = false;
374.76 - state = G0;
374.77 - firstByte = 0;
374.78 -
374.79 - curSODes = 0;
374.80 - curSS2Des = 0;
374.81 - curSS3Des = 0;
374.82 -
374.83 - charOff = byteOff = 0;
374.84 - remainIndex = -1;
374.85 -
374.86 - for(i = 0; i < remainByte.length; i++)
374.87 - remainByte[i] = 0;
374.88 - }
374.89 -
374.90 - public int flush(char[] output, int outStart, int outEnd)
374.91 - throws MalformedInputException
374.92 - {
374.93 - int i;
374.94 - if (state != G0) {
374.95 - badInputLength = 0;
374.96 - throw new MalformedInputException();
374.97 - }
374.98 - reset();
374.99 - return 0;
374.100 - }
374.101 -
374.102 - private byte[] savetyGetSrc(byte[] input, int inOff, int inEnd, int nbytes)
374.103 - {
374.104 - int i;
374.105 - byte tmp[];
374.106 -
374.107 - if(inOff <= (inEnd-nbytes+1))
374.108 - tmp = new byte[nbytes];
374.109 - else
374.110 - tmp = new byte[inEnd-inOff];
374.111 -
374.112 - for(i = 0; i < tmp.length; i++)
374.113 - tmp[i] = input[inOff+i];
374.114 - return tmp;
374.115 - }
374.116 -
374.117 - private char getUnicode(byte byte1, byte byte2, byte shiftFlag)
374.118 - {
374.119 - byte1 |= MSB;
374.120 - byte2 |= MSB;
374.121 -
374.122 - byte[] tmpByte = {byte1,byte2};
374.123 - char[] tmpChar = new char[1];
374.124 - int i = 0,
374.125 - tmpIndex = 0;
374.126 -
374.127 - switch(shiftFlag) {
374.128 - case SOFlag:
374.129 - tmpIndex = curSODes;
374.130 - tmpConverter = SOConverter;
374.131 - break;
374.132 - case SS2Flag:
374.133 - tmpIndex = curSS2Des;
374.134 - tmpConverter = SS2Converter;
374.135 - break;
374.136 - case SS3Flag:
374.137 - tmpIndex = curSS3Des;
374.138 - tmpConverter = SS3Converter;
374.139 - break;
374.140 - }
374.141 -
374.142 - for(i = 0; i < tmpConverter.length; i++) {
374.143 - if(tmpIndex == i) {
374.144 - try {
374.145 - tmpConverter[i].convert(tmpByte, 0, 2, tmpChar, 0, 1);
374.146 - } catch (Exception e) {}
374.147 - return tmpChar[0];
374.148 - }
374.149 - }
374.150 - return REPLACE_CHAR;
374.151 - }
374.152 -
374.153 - public final int convert(byte[] input, int inOff, int inEnd,
374.154 - char[] output, int outOff, int outEnd)
374.155 - throws ConversionBufferFullException,
374.156 - MalformedInputException
374.157 - {
374.158 - int i;
374.159 - int DesignatorLength = 0;
374.160 - charOff = outOff;
374.161 - byteOff = inOff;
374.162 -
374.163 - // Loop until we hit the end of the input
374.164 - while (byteOff < inEnd) {
374.165 - // If we don't have room for the output, throw an exception
374.166 - if (charOff >= outEnd)
374.167 - throw new ConversionBufferFullException();
374.168 - if(remainIndex < 0) {
374.169 - remainByte[0] = input[byteOff];
374.170 - remainIndex = 0;
374.171 - byteOff++;
374.172 - }
374.173 - switch (remainByte[0]) {
374.174 - case ISO_SO:
374.175 - shiftout = true;
374.176 - if(remainIndex > 0)
374.177 - System.arraycopy(remainByte, 1, remainByte, 0, remainIndex);
374.178 - remainIndex--;
374.179 - break;
374.180 - case ISO_SI:
374.181 - shiftout = false;
374.182 - if(remainIndex > 0)
374.183 - System.arraycopy(remainByte, 1, remainByte, 0, remainIndex);
374.184 - remainIndex--;
374.185 - break;
374.186 - case ISO_ESC:
374.187 - byte tmp[] = savetyGetSrc(input, byteOff, inEnd,
374.188 - (maximumDesignatorLength-remainIndex));
374.189 - System.arraycopy(tmp, 0, remainByte, remainIndex+1, tmp.length);
374.190 - remainIndex += tmp.length;
374.191 - byteOff += tmp.length;
374.192 - if(tmp.length<(maximumDesignatorLength-remainIndex))
374.193 - break;
374.194 - String tmpString = new String(remainByte, 1, remainIndex);
374.195 - for (i = 0; i < SODesignator.length; i++) {
374.196 - if(tmpString.indexOf(SODesignator[i]) == 0) {
374.197 - curSODes = i;
374.198 - DesignatorLength = SODesignator[i].length();
374.199 - break;
374.200 - }
374.201 - }
374.202 -
374.203 - if (DesignatorLength == 0 ) { // Designator not recognized
374.204 - badInputLength = tmp.length;
374.205 - throw new MalformedInputException();
374.206 - }
374.207 -
374.208 - if (i == SODesignator.length) {
374.209 - for (i = 0; i < SS2Designator.length; i++) {
374.210 - if(tmpString.indexOf(SS2Designator[i]) == 0) {
374.211 - curSS2Des = i;
374.212 - DesignatorLength = SS2Designator[i].length();
374.213 - break;
374.214 - }
374.215 - }
374.216 - if(i == SS2Designator.length) {
374.217 - for(i = 0; i < SS3Designator.length; i++) {
374.218 - if (tmpString.indexOf(SS3Designator[i]) == 0) {
374.219 - curSS3Des = i;
374.220 - DesignatorLength = SS3Designator[i].length();
374.221 - break;
374.222 - }
374.223 - }
374.224 - if (i == SS3Designator.length) {
374.225 - switch(remainByte[1]) {
374.226 - case ISO_SS2_7:
374.227 - output[charOff] = getUnicode(remainByte[2],
374.228 - remainByte[3],
374.229 - SS2Flag);
374.230 - charOff++;
374.231 - DesignatorLength = 3;
374.232 - break;
374.233 - case ISO_SS3_7:
374.234 - output[charOff] = getUnicode(remainByte[2],
374.235 - remainByte[3],
374.236 - SS3Flag);
374.237 - charOff++;
374.238 - DesignatorLength = 3;
374.239 - break;
374.240 - default:
374.241 - DesignatorLength = 0;
374.242 - }
374.243 - }
374.244 - }
374.245 - }
374.246 - if (remainIndex > DesignatorLength) {
374.247 - for(i = 0; i < remainIndex-DesignatorLength; i++)
374.248 - remainByte[i] = remainByte[DesignatorLength+1+i];
374.249 - remainIndex = i-1;
374.250 - } else {
374.251 - remainIndex = -1;
374.252 - }
374.253 - break;
374.254 - default:
374.255 - if (!shiftout) {
374.256 - output[charOff] = (char)remainByte[0];
374.257 - charOff++;
374.258 - } else {
374.259 - switch (state) {
374.260 - case G0:
374.261 - firstByte = remainByte[0];
374.262 - state = G1;
374.263 - break;
374.264 - case G1:
374.265 - output[charOff] = getUnicode(firstByte, remainByte[0],
374.266 - SOFlag);
374.267 - charOff++;
374.268 - state = G0;
374.269 - break;
374.270 - }
374.271 - }
374.272 - if (remainIndex > 0)
374.273 - System.arraycopy(remainByte, 1, remainByte, 0, remainIndex);
374.274 - remainIndex--;
374.275 - }
374.276 - }
374.277 - return charOff - outOff;
374.278 - }
374.279 -}
375.1 --- a/src/share/classes/sun/io/ByteToCharISO2022CN.java Thu Sep 01 13:54:38 2011 -0700
375.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
375.3 @@ -1,300 +0,0 @@
375.4 -/*
375.5 - * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
375.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
375.7 - *
375.8 - * This code is free software; you can redistribute it and/or modify it
375.9 - * under the terms of the GNU General Public License version 2 only, as
375.10 - * published by the Free Software Foundation. Oracle designates this
375.11 - * particular file as subject to the "Classpath" exception as provided
375.12 - * by Oracle in the LICENSE file that accompanied this code.
375.13 - *
375.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
375.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
375.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
375.17 - * version 2 for more details (a copy is included in the LICENSE file that
375.18 - * accompanied this code).
375.19 - *
375.20 - * You should have received a copy of the GNU General Public License version
375.21 - * 2 along with this work; if not, write to the Free Software Foundation,
375.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
375.23 - *
375.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
375.25 - * or visit www.oracle.com if you need additional information or have any
375.26 - * questions.
375.27 - */
375.28 -
375.29 -package sun.io;
375.30 -
375.31 -/**
375.32 - * @author Tom Zhou
375.33 - */
375.34 -public class ByteToCharISO2022CN extends ByteToCharConverter
375.35 -{
375.36 - private String SODesignator[];
375.37 - private String SS2Designator[] = null;
375.38 - private String SS3Designator[] = null;
375.39 - private ByteToCharConverter SOConverter[];
375.40 - private ByteToCharConverter SS2Converter[] = null;
375.41 - private ByteToCharConverter SS3Converter[] = null;
375.42 -
375.43 - private static final byte ISO_ESC = 0x1b;
375.44 - private static final byte ISO_SI = 0x0f;
375.45 - private static final byte ISO_SO = 0x0e;
375.46 - private static final byte ISO_SS2_7 = 0x4e;
375.47 - private static final byte ISO_SS3_7 = 0x4f;
375.48 - private static final byte MSB = (byte)0x80;
375.49 - private static final char REPLACE_CHAR = '\uFFFD';
375.50 - private static final byte maximumDesignatorLength = 3;
375.51 -
375.52 - private static final byte SOFlag = 0;
375.53 - private static final byte SS2Flag = 1;
375.54 - private static final byte SS3Flag = 2;
375.55 - private static final byte G0 = 0;
375.56 - private static final byte G1 = 1;
375.57 -
375.58 - private ByteToCharConverter tmpConverter[];
375.59 -
375.60 - private int curSODes, curSS2Des, curSS3Des;
375.61 - private boolean shiftout;
375.62 -
375.63 - private byte remainByte[] = new byte[10];
375.64 - private int remainIndex = -1;
375.65 - private byte state, firstByte;
375.66 -
375.67 - public void reset()
375.68 - {
375.69 - int i = 0;
375.70 -
375.71 - shiftout = false;
375.72 - state = G0;
375.73 - firstByte = 0;
375.74 -
375.75 - curSODes = 0;
375.76 - curSS2Des = 0;
375.77 - curSS3Des = 0;
375.78 -
375.79 - charOff = byteOff = 0;
375.80 - remainIndex = -1;
375.81 -
375.82 - for(i = 0; i < remainByte.length; i++)
375.83 - remainByte[i] = 0;
375.84 - }
375.85 -
375.86 - public int flush(char[] output, int outStart, int outEnd)
375.87 - throws MalformedInputException
375.88 - {
375.89 - int i;
375.90 - if (state != G0) {
375.91 - badInputLength = 0;
375.92 - throw new MalformedInputException();
375.93 - }
375.94 - reset();
375.95 - return 0;
375.96 - }
375.97 -
375.98 - private byte[] savetyGetSrc(byte[] input, int inOff, int inEnd, int nbytes)
375.99 - {
375.100 - int i;
375.101 - byte tmp[];
375.102 -
375.103 - if(inOff <= (inEnd-nbytes+1))
375.104 - tmp = new byte[nbytes];
375.105 - else
375.106 - tmp = new byte[inEnd-inOff];
375.107 -
375.108 - for(i = 0; i < tmp.length; i++)
375.109 - tmp[i] = input[inOff+i];
375.110 - return tmp;
375.111 - }
375.112 -
375.113 - private char getUnicode(byte byte1, byte byte2, byte shiftFlag)
375.114 - {
375.115 - byte1 |= MSB;
375.116 - byte2 |= MSB;
375.117 - char[] tmpChar = new char[1];
375.118 -
375.119 - switch(shiftFlag) {
375.120 - case SOFlag:
375.121 - try {
375.122 - byte[] tmpByte = {byte1,byte2};
375.123 - SOConverter[curSODes].convert(tmpByte, 0, 2, tmpChar, 0, 1);
375.124 - }
375.125 - catch (Exception e) {}
375.126 - break;
375.127 - case SS2Flag:
375.128 - try {
375.129 - byte[] tmpByte = {(byte)0x8e, (byte)0xa2, byte1, byte2};
375.130 - SS2Converter[curSS2Des].convert(tmpByte, 0, 4, tmpChar, 0, 1);
375.131 - }
375.132 - catch (Exception e){}
375.133 - break;
375.134 - case SS3Flag:
375.135 - try {
375.136 - byte[] tmpByte = {(byte)0x8e, (byte)0xa3, byte1,byte2};
375.137 - SS3Converter[curSS3Des].convert(tmpByte, 0, 4, tmpChar, 0, 1);
375.138 - }
375.139 - catch (Exception e){}
375.140 - break;
375.141 - default:
375.142 - tmpChar[0] = REPLACE_CHAR;
375.143 - }
375.144 - return tmpChar[0];
375.145 - }
375.146 -
375.147 - public final int convert(byte[] input, int inOff, int inEnd,
375.148 - char[] output, int outOff, int outEnd)
375.149 - throws ConversionBufferFullException,
375.150 - MalformedInputException
375.151 - {
375.152 - int i;
375.153 - int DesignatorLength = 0;
375.154 - charOff = outOff;
375.155 - byteOff = inOff;
375.156 -
375.157 - // Loop until we hit the end of the input
375.158 - while (byteOff < inEnd) {
375.159 - // If we don't have room for the output, throw an exception
375.160 - if (charOff >= outEnd)
375.161 - throw new ConversionBufferFullException();
375.162 - if(remainIndex < 0) {
375.163 - remainByte[0] = input[byteOff];
375.164 - remainIndex = 0;
375.165 - byteOff++;
375.166 - }
375.167 - switch (remainByte[0]) {
375.168 - case ISO_SO:
375.169 - shiftout = true;
375.170 - if(remainIndex > 0)
375.171 - System.arraycopy(remainByte, 1, remainByte, 0, remainIndex);
375.172 - remainIndex--;
375.173 - break;
375.174 - case ISO_SI:
375.175 - shiftout = false;
375.176 - if(remainIndex > 0)
375.177 - System.arraycopy(remainByte, 1, remainByte, 0, remainIndex);
375.178 - remainIndex--;
375.179 - break;
375.180 - case ISO_ESC:
375.181 - byte tmp[] = savetyGetSrc(input, byteOff, inEnd,
375.182 - (maximumDesignatorLength-remainIndex));
375.183 - System.arraycopy(tmp, 0, remainByte, remainIndex+1, tmp.length);
375.184 -
375.185 - remainIndex += tmp.length;
375.186 - byteOff += tmp.length;
375.187 - if(tmp.length<(maximumDesignatorLength-remainIndex))
375.188 - break;
375.189 - String tmpString = new String(remainByte, 1, remainIndex);
375.190 - for (i = 0; i < SODesignator.length; i++) {
375.191 - if(tmpString.indexOf(SODesignator[i]) == 0) {
375.192 - curSODes = i;
375.193 - DesignatorLength = SODesignator[i].length();
375.194 - break;
375.195 - }
375.196 - }
375.197 -
375.198 - if (DesignatorLength == 0) { // designator not recognized
375.199 - badInputLength = tmp.length;
375.200 - throw new MalformedInputException();
375.201 - }
375.202 -
375.203 - if (i == SODesignator.length) {
375.204 - for (i = 0; i < SS2Designator.length; i++) {
375.205 - if(tmpString.indexOf(SS2Designator[i]) == 0) {
375.206 - curSS2Des = i;
375.207 - DesignatorLength = SS2Designator[i].length();
375.208 - break;
375.209 - }
375.210 - }
375.211 - if(i == SS2Designator.length) {
375.212 - for(i = 0; i < SS3Designator.length; i++) {
375.213 - if (tmpString.indexOf(SS3Designator[i]) == 0) {
375.214 - curSS3Des = i;
375.215 - DesignatorLength = SS3Designator[i].length();
375.216 - break;
375.217 - }
375.218 - }
375.219 - if (i == SS3Designator.length) {
375.220 - switch(remainByte[1]) {
375.221 - case ISO_SS2_7:
375.222 - output[charOff] = getUnicode(remainByte[2],
375.223 - remainByte[3],
375.224 - SS2Flag);
375.225 - charOff++;
375.226 - DesignatorLength = 3;
375.227 - break;
375.228 - case ISO_SS3_7:
375.229 - output[charOff] = getUnicode(remainByte[2],
375.230 - remainByte[3],
375.231 - SS3Flag);
375.232 - charOff++;
375.233 - DesignatorLength = 3;
375.234 - break;
375.235 - default:
375.236 - DesignatorLength = 0;
375.237 - }
375.238 - }
375.239 - }
375.240 - }
375.241 - if (remainIndex > DesignatorLength) {
375.242 - for(i = 0; i < remainIndex-DesignatorLength; i++)
375.243 - remainByte[i] = remainByte[DesignatorLength+1+i];
375.244 - remainIndex = i-1;
375.245 - } else {
375.246 - remainIndex = -1;
375.247 - }
375.248 - break;
375.249 - default:
375.250 - if (!shiftout) {
375.251 - output[charOff] = (char)remainByte[0];
375.252 - charOff++;
375.253 - } else {
375.254 - switch (state) {
375.255 - case G0:
375.256 - firstByte = remainByte[0];
375.257 - state = G1;
375.258 - break;
375.259 - case G1:
375.260 - output[charOff] = getUnicode(firstByte, remainByte[0],
375.261 - SOFlag);
375.262 - charOff++;
375.263 - state = G0;
375.264 - break;
375.265 - }
375.266 - }
375.267 - if (remainIndex > 0)
375.268 - System.arraycopy(remainByte, 1, remainByte, 0, remainIndex);
375.269 - remainIndex--;
375.270 - }
375.271 - }
375.272 - return charOff - outOff;
375.273 - }
375.274 -
375.275 - public ByteToCharISO2022CN()
375.276 - {
375.277 - SODesignator = new String[3];
375.278 - SODesignator[0] = "$A";
375.279 - SODesignator[1] = "$)A";
375.280 - SODesignator[2] = "$)G";
375.281 - SS2Designator = new String[1];
375.282 - SS2Designator[0] = "$*H";
375.283 - SS3Designator = new String[1];
375.284 - SS3Designator[0] = "$+I";
375.285 -
375.286 - SOConverter = new ByteToCharConverter[3];
375.287 - SS2Converter = new ByteToCharConverter[1];
375.288 - SS3Converter = new ByteToCharConverter[1];
375.289 -
375.290 - try {
375.291 - SOConverter[0] = SOConverter[1]
375.292 - = ByteToCharConverter.getConverter("GB2312");
375.293 - SOConverter[2] = SS2Converter[0] = SS3Converter[0]
375.294 - = ByteToCharConverter.getConverter("CNS11643");
375.295 - } catch (Exception e) {};
375.296 - }
375.297 -
375.298 - // Return the character set id
375.299 - public String getCharacterEncoding()
375.300 - {
375.301 - return "ISO2022CN";
375.302 - }
375.303 -}
376.1 --- a/src/share/classes/sun/io/ByteToCharISO2022JP.java Thu Sep 01 13:54:38 2011 -0700
376.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
376.3 @@ -1,313 +0,0 @@
376.4 -/*
376.5 - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
376.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
376.7 - *
376.8 - * This code is free software; you can redistribute it and/or modify it
376.9 - * under the terms of the GNU General Public License version 2 only, as
376.10 - * published by the Free Software Foundation. Oracle designates this
376.11 - * particular file as subject to the "Classpath" exception as provided
376.12 - * by Oracle in the LICENSE file that accompanied this code.
376.13 - *
376.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
376.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376.17 - * version 2 for more details (a copy is included in the LICENSE file that
376.18 - * accompanied this code).
376.19 - *
376.20 - * You should have received a copy of the GNU General Public License version
376.21 - * 2 along with this work; if not, write to the Free Software Foundation,
376.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
376.23 - *
376.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
376.25 - * or visit www.oracle.com if you need additional information or have any
376.26 - * questions.
376.27 - */
376.28 -
376.29 -package sun.io;
376.30 -
376.31 -public class ByteToCharISO2022JP extends ByteToCharJIS0208 {
376.32 -
376.33 - private static final int ASCII = 0; // ESC ( B
376.34 - private static final int JISX0201_1976 = 1; // ESC ( J
376.35 - private static final int JISX0208_1978 = 2; // ESC $ @
376.36 - private static final int JISX0208_1983 = 3; // ESC $ B
376.37 - private static final int JISX0201_1976_KANA = 4; // ESC ( I
376.38 - private static final int SHIFTOUT = 5; // SO (0x0e)
376.39 -
376.40 - private int currentState;
376.41 - private int savedSize;
376.42 - private byte[] savedBytes;
376.43 -
376.44 - public ByteToCharISO2022JP() {
376.45 - super();
376.46 - savedBytes = new byte[2];
376.47 - currentState = ASCII;
376.48 - savedSize = 0;
376.49 - }
376.50 -
376.51 - public int flush(char [] output, int outStart, int outEnd)
376.52 - throws MalformedInputException
376.53 - {
376.54 - if (savedSize != 0) {
376.55 - savedSize = 0;
376.56 - currentState = ASCII;
376.57 - badInputLength = 0;
376.58 - throw new MalformedInputException();
376.59 - }
376.60 - byteOff = charOff = 0;
376.61 - return 0;
376.62 - }
376.63 -
376.64 -
376.65 - /**
376.66 - * Character conversion
376.67 - */
376.68 - public int convert(byte[] input, int inOff, int inEnd,
376.69 - char[] output, int outOff, int outEnd)
376.70 - throws UnknownCharacterException, MalformedInputException,
376.71 - ConversionBufferFullException
376.72 - {
376.73 - int previousState = ASCII;
376.74 - int inputSize = 0;
376.75 - char outputChar = '\uFFFD';
376.76 - // readOff keeps the actual buffer's pointer.
376.77 - // byteOff keeps original buffer's pointer.
376.78 - int readOff = byteOff = inOff;
376.79 -
376.80 - if (savedSize != 0) {
376.81 - if (savedBytes[0] == 0x1b) { // ESC
376.82 - if ((savedSize == 2 &&
376.83 - (savedBytes[1] == 0x28 &&
376.84 - input[0] != 'B' &&
376.85 - input[0] != 'J' &&
376.86 - input[0] != 'I') &&
376.87 - (savedBytes[1] == 0x24 &&
376.88 - input[0] != '@' &&
376.89 - input[0] != 'B')) ||
376.90 - ((savedSize == 1) &&
376.91 - (input[0] != 0x28 &&
376.92 - input[0] != 0x24))) {
376.93 - badInputLength = 0;
376.94 - throw new MalformedInputException();
376.95 - }
376.96 - if ((inEnd - inOff) == 1 && savedSize == 1 &&
376.97 - savedBytes[0] == 0x1b) {
376.98 - savedSize = 2;
376.99 - savedBytes[1] = input[0];
376.100 - byteOff++;
376.101 - return 0;
376.102 - }
376.103 - }
376.104 - byte[] newBuf = new byte[inEnd - inOff + savedSize];
376.105 - for (int i = 0; i < savedSize; i++) {
376.106 - newBuf[i] = savedBytes[i];
376.107 - }
376.108 - System.arraycopy(input, inOff, newBuf, savedSize, inEnd - inOff);
376.109 - byteOff -= savedSize;
376.110 - input = newBuf;
376.111 - inOff = 0;
376.112 - inEnd = newBuf.length;
376.113 - savedSize = 0;
376.114 - }
376.115 -
376.116 - charOff = outOff;
376.117 - readOff = inOff;
376.118 -
376.119 - while(readOff < inEnd) {
376.120 - int byte1, byte2, byte3;
376.121 - boolean noOutput = false;
376.122 -
376.123 - // Is there room in the output buffer for the result?
376.124 - if (charOff >= outEnd) {
376.125 - throw new ConversionBufferFullException();
376.126 - }
376.127 -
376.128 - // Get the input byte
376.129 - byte1 = input[readOff] & 0xFF;
376.130 - inputSize = 1;
376.131 -
376.132 - if ((byte1 & (byte)0x80) != 0){
376.133 - badInputLength = 1;
376.134 - throw new MalformedInputException();
376.135 - }
376.136 -
376.137 - // Is this a escape sequence?
376.138 - while (byte1 == 0x1b || byte1 == 0x0e || byte1 == 0x0f) {
376.139 - if (byte1 == 0x1b){ // ESC
376.140 - if (readOff + inputSize + 1 >= inEnd) {
376.141 - if (readOff + inputSize >= inEnd) {
376.142 - savedSize = 1;
376.143 - savedBytes[0] = (byte)byte1;
376.144 - } else {
376.145 - savedSize = 2;
376.146 - savedBytes[0] = (byte)byte1;
376.147 - savedBytes[1] = input[readOff + inputSize];
376.148 - inputSize++;
376.149 - }
376.150 - break;
376.151 - }
376.152 - byte2 = input[readOff + inputSize] & 0xFF;
376.153 - inputSize++;
376.154 - if ((byte2 & (byte)0x80) != 0){
376.155 - badInputLength = 2;
376.156 - throw new MalformedInputException();
376.157 - }
376.158 - if (byte2 == 0x28){
376.159 - byte3 = input[readOff + inputSize] & 0xFF;
376.160 - inputSize++;
376.161 - if (byte3 == 'B'){
376.162 - currentState = ASCII;
376.163 - } else if (byte3 == 'J'){
376.164 - currentState = JISX0201_1976;
376.165 - } else if (byte3 == 'I'){
376.166 - currentState = JISX0201_1976_KANA;
376.167 - } else {
376.168 - // illegal ESC sequence
376.169 - badInputLength = 3;
376.170 - throw new MalformedInputException();
376.171 - }
376.172 - } else if (byte2 == '$'){
376.173 - byte3 = input[readOff + inputSize] & 0xFF;
376.174 - inputSize++;
376.175 - if ((byte3 & (byte)0x80) != 0){
376.176 - badInputLength = 3;
376.177 - throw new MalformedInputException();
376.178 - }
376.179 - if (byte3 == '@'){
376.180 - currentState = JISX0208_1978;
376.181 - } else if (byte3 == 'B'){
376.182 - currentState = JISX0208_1983;
376.183 - } else {
376.184 - // illegal ESC sequence
376.185 - badInputLength = 3;
376.186 - throw new MalformedInputException();
376.187 - }
376.188 - } else {
376.189 - // illegal ESC sequence
376.190 - badInputLength = 2;
376.191 - throw new MalformedInputException();
376.192 - }
376.193 - if (readOff + inputSize >= inEnd) {
376.194 - noOutput = true;
376.195 - break;
376.196 - } else {
376.197 - byte1 = input[readOff + inputSize];
376.198 - inputSize++;
376.199 - }
376.200 - } else if (byte1 == 0x0e){ // shift out for one byte kana
376.201 - previousState = currentState;
376.202 - currentState = SHIFTOUT;
376.203 - if (readOff + inputSize >= inEnd) {
376.204 - noOutput = true;
376.205 - break;
376.206 - }
376.207 - byte1 = input[readOff + inputSize];
376.208 - inputSize++;
376.209 - if ((byte1 & (byte)0x80) != 0){
376.210 - badInputLength = 1;
376.211 - throw new MalformedInputException();
376.212 - }
376.213 - } else if (byte1 == 0x0f){ // shift in for previous mode
376.214 - currentState = previousState;
376.215 - if (readOff + inputSize >= inEnd) {
376.216 - noOutput = true;
376.217 - break;
376.218 - }
376.219 - byte1 = input[readOff + inputSize];
376.220 - inputSize++;
376.221 - if ((byte1 & (byte)0x80) != 0){
376.222 - badInputLength = 1;
376.223 - throw new MalformedInputException();
376.224 - }
376.225 - }
376.226 - }
376.227 - if (noOutput || savedSize != 0) {
376.228 - byteOff += inputSize;
376.229 - break;
376.230 - }
376.231 - noOutput = false;
376.232 - switch (currentState){
376.233 - case ASCII:
376.234 - outputChar = (char)(byte1 & 0xff);
376.235 - break;
376.236 - case JISX0201_1976:
376.237 - switch (byte1) {
376.238 - case 0x5c:
376.239 - outputChar = '\u00a5';
376.240 - break;
376.241 - case 0x7e:
376.242 - outputChar = '\u203e';
376.243 - break;
376.244 - default:
376.245 - outputChar = (char)byte1;
376.246 - break;
376.247 - }
376.248 - break;
376.249 - case JISX0208_1978:
376.250 - case JISX0208_1983:
376.251 - if (readOff + inputSize >= inEnd) {
376.252 - savedSize = 1;
376.253 - savedBytes[0] = (byte)byte1;
376.254 - break;
376.255 - }
376.256 - byte2 = input[readOff + inputSize] & 0xff;
376.257 - inputSize++;
376.258 - if ((byte2 & (byte)0x80) != 0){
376.259 - badInputLength = 1;
376.260 - throw new MalformedInputException();
376.261 - }
376.262 - // jisx0208Chars table convert FULLWIDTH_REVERSE_SOLIDUS
376.263 - // 0x2140 to REVERSE_SOLIDUS (BACKSLASH) 0x5c.
376.264 - // This behavior causes problem because
376.265 - // 0x5c is special escape character for java.
376.266 - if (byte1 == 0x21 && byte2 == 0x40) {
376.267 - outputChar = '\uFF3C';
376.268 - } else {
376.269 - try {
376.270 - outputChar = getUnicode(byte1, byte2);
376.271 - } catch (ArrayIndexOutOfBoundsException e) {
376.272 - outputChar = '\uFFFD';
376.273 - }
376.274 - }
376.275 - break;
376.276 - case JISX0201_1976_KANA:
376.277 - case SHIFTOUT:
376.278 - if (byte1 > 0x60) {
376.279 - badInputLength = 1;
376.280 - throw new MalformedInputException();
376.281 - }
376.282 - outputChar = (char)(byte1 + 0xff40);
376.283 - break;
376.284 - }
376.285 -
376.286 - if (savedSize != 0) {
376.287 - byteOff += inputSize;
376.288 - break;
376.289 - }
376.290 -
376.291 - if (outputChar == '\uFFFD') {
376.292 - if (subMode)
376.293 - outputChar = subChars[0];
376.294 - else {
376.295 - badInputLength = inputSize;
376.296 - throw new UnknownCharacterException();
376.297 - }
376.298 - }
376.299 - readOff += inputSize;
376.300 - byteOff += inputSize;
376.301 - output[charOff++] = outputChar;
376.302 - }
376.303 -
376.304 - return charOff - outOff;
376.305 - }
376.306 -
376.307 - public void reset() {
376.308 - byteOff = charOff = 0;
376.309 - currentState = ASCII;
376.310 - savedSize = 0;
376.311 - }
376.312 -
376.313 - public String getCharacterEncoding() {
376.314 - return "ISO2022JP";
376.315 - }
376.316 -}
377.1 --- a/src/share/classes/sun/io/ByteToCharISO2022KR.java Thu Sep 01 13:54:38 2011 -0700
377.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
377.3 @@ -1,47 +0,0 @@
377.4 -/*
377.5 - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
377.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
377.7 - *
377.8 - * This code is free software; you can redistribute it and/or modify it
377.9 - * under the terms of the GNU General Public License version 2 only, as
377.10 - * published by the Free Software Foundation. Oracle designates this
377.11 - * particular file as subject to the "Classpath" exception as provided
377.12 - * by Oracle in the LICENSE file that accompanied this code.
377.13 - *
377.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
377.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
377.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
377.17 - * version 2 for more details (a copy is included in the LICENSE file that
377.18 - * accompanied this code).
377.19 - *
377.20 - * You should have received a copy of the GNU General Public License version
377.21 - * 2 along with this work; if not, write to the Free Software Foundation,
377.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
377.23 - *
377.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
377.25 - * or visit www.oracle.com if you need additional information or have any
377.26 - * questions.
377.27 - */
377.28 -
377.29 -package sun.io;
377.30 -
377.31 -public class ByteToCharISO2022KR extends ByteToCharISO2022
377.32 -{
377.33 - public ByteToCharISO2022KR()
377.34 - {
377.35 - SODesignator = new String[1];
377.36 - SODesignator[0] = "$)C";
377.37 -
377.38 - SOConverter = new ByteToCharConverter[1];
377.39 -
377.40 - try {
377.41 - SOConverter[0] = ByteToCharConverter.getConverter("KSC5601");
377.42 - } catch (Exception e) {};
377.43 - }
377.44 -
377.45 - // Return the character set id
377.46 - public String getCharacterEncoding()
377.47 - {
377.48 - return "ISO2022KR";
377.49 - }
377.50 -}
378.1 --- a/src/share/classes/sun/io/ByteToCharISO8859_1.java Thu Sep 01 13:54:38 2011 -0700
378.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
378.3 @@ -1,87 +0,0 @@
378.4 -/*
378.5 - * Copyright (c) 1996, 1997, Oracle and/or its affiliates. All rights reserved.
378.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
378.7 - *
378.8 - * This code is free software; you can redistribute it and/or modify it
378.9 - * under the terms of the GNU General Public License version 2 only, as
378.10 - * published by the Free Software Foundation. Oracle designates this
378.11 - * particular file as subject to the "Classpath" exception as provided
378.12 - * by Oracle in the LICENSE file that accompanied this code.
378.13 - *
378.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
378.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
378.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
378.17 - * version 2 for more details (a copy is included in the LICENSE file that
378.18 - * accompanied this code).
378.19 - *
378.20 - * You should have received a copy of the GNU General Public License version
378.21 - * 2 along with this work; if not, write to the Free Software Foundation,
378.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
378.23 - *
378.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
378.25 - * or visit www.oracle.com if you need additional information or have any
378.26 - * questions.
378.27 - */
378.28 -package sun.io;
378.29 -
378.30 -/**
378.31 -* A algorithmic conversion from ISO 8859-1 to Unicode
378.32 -*
378.33 -* @author Lloyd Honomichl
378.34 -* @author Asmus Freytag
378.35 -*/
378.36 -public class ByteToCharISO8859_1 extends ByteToCharConverter {
378.37 -
378.38 - // Return the character set id
378.39 - public String getCharacterEncoding()
378.40 - {
378.41 - return "ISO8859_1";
378.42 - }
378.43 -
378.44 - public int flush(char[] output, int outStart, int outEnd) {
378.45 - // This converter will not buffer any data.
378.46 - byteOff = charOff = 0;
378.47 - return 0;
378.48 - }
378.49 -
378.50 - /**
378.51 - * Algorithmic character conversion
378.52 - */
378.53 - public int convert(byte[] input, int inOff, int inEnd,
378.54 - char[] output, int outOff, int outEnd)
378.55 -
378.56 - throws ConversionBufferFullException
378.57 - {
378.58 - int bound = inOff + (outEnd - outOff);
378.59 - if (bound >= inEnd) {
378.60 - bound = inEnd;
378.61 - }
378.62 - int bytesWritten = inEnd - inOff;
378.63 -
378.64 -
378.65 - // Loop until we hit the end of the input
378.66 - try {
378.67 - while(inOff < bound) {
378.68 - output[outOff++] = (char) (0xff & input[inOff++]);
378.69 - }
378.70 - } finally {
378.71 - charOff = outOff;
378.72 - byteOff = inOff;
378.73 - }
378.74 -
378.75 - // If we don't have room for the output, throw an exception
378.76 - if (bound < inEnd)
378.77 - throw new ConversionBufferFullException();
378.78 -
378.79 - // Return the length written to the output buffer
378.80 - return bytesWritten;
378.81 - }
378.82 -
378.83 - /*
378.84 - Reset after finding bad input
378.85 - */
378.86 - public void reset() {
378.87 - byteOff = charOff = 0;
378.88 - }
378.89 -
378.90 -}
379.1 --- a/src/share/classes/sun/io/ByteToCharISO8859_13.java Thu Sep 01 13:54:38 2011 -0700
379.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
379.3 @@ -1,47 +0,0 @@
379.4 -/*
379.5 - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
379.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
379.7 - *
379.8 - * This code is free software; you can redistribute it and/or modify it
379.9 - * under the terms of the GNU General Public License version 2 only, as
379.10 - * published by the Free Software Foundation. Oracle designates this
379.11 - * particular file as subject to the "Classpath" exception as provided
379.12 - * by Oracle in the LICENSE file that accompanied this code.
379.13 - *
379.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
379.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
379.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
379.17 - * version 2 for more details (a copy is included in the LICENSE file that
379.18 - * accompanied this code).
379.19 - *
379.20 - * You should have received a copy of the GNU General Public License version
379.21 - * 2 along with this work; if not, write to the Free Software Foundation,
379.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
379.23 - *
379.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
379.25 - * or visit www.oracle.com if you need additional information or have any
379.26 - * questions.
379.27 - */
379.28 -
379.29 -package sun.io;
379.30 -
379.31 -import sun.nio.cs.ISO_8859_13;
379.32 -
379.33 -/**
379.34 - * A table to convert ISO8859_13 to Unicode
379.35 - *
379.36 - * @author ConverterGenerator tool
379.37 - */
379.38 -
379.39 -public class ByteToCharISO8859_13 extends ByteToCharSingleByte {
379.40 -
379.41 - private final static ISO_8859_13 nioCoder = new ISO_8859_13();
379.42 -
379.43 - public String getCharacterEncoding() {
379.44 - return "ISO8859_13";
379.45 - }
379.46 -
379.47 - public ByteToCharISO8859_13() {
379.48 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
379.49 - }
379.50 -}
380.1 --- a/src/share/classes/sun/io/ByteToCharISO8859_15.java Thu Sep 01 13:54:38 2011 -0700
380.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
380.3 @@ -1,52 +0,0 @@
380.4 -/*
380.5 - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
380.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
380.7 - *
380.8 - * This code is free software; you can redistribute it and/or modify it
380.9 - * under the terms of the GNU General Public License version 2 only, as
380.10 - * published by the Free Software Foundation. Oracle designates this
380.11 - * particular file as subject to the "Classpath" exception as provided
380.12 - * by Oracle in the LICENSE file that accompanied this code.
380.13 - *
380.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
380.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
380.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
380.17 - * version 2 for more details (a copy is included in the LICENSE file that
380.18 - * accompanied this code).
380.19 - *
380.20 - * You should have received a copy of the GNU General Public License version
380.21 - * 2 along with this work; if not, write to the Free Software Foundation,
380.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
380.23 - *
380.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
380.25 - * or visit www.oracle.com if you need additional information or have any
380.26 - * questions.
380.27 - */
380.28 -
380.29 -/*
380.30 - * (C) Copyright IBM Corp. 1998 - All Rights Reserved
380.31 - *
380.32 - */
380.33 -
380.34 -package sun.io;
380.35 -
380.36 -import sun.nio.cs.ISO_8859_15;
380.37 -
380.38 -/**
380.39 - * A table to convert ISO8859_15 to Unicode
380.40 - *
380.41 - * @author ConverterGenerator tool
380.42 - */
380.43 -
380.44 -public class ByteToCharISO8859_15 extends ByteToCharSingleByte {
380.45 -
380.46 - private final static ISO_8859_15 nioCoder = new ISO_8859_15();
380.47 -
380.48 - public String getCharacterEncoding() {
380.49 - return "ISO8859_15";
380.50 - }
380.51 -
380.52 - public ByteToCharISO8859_15() {
380.53 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
380.54 - }
380.55 -}
381.1 --- a/src/share/classes/sun/io/ByteToCharISO8859_2.java Thu Sep 01 13:54:38 2011 -0700
381.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
381.3 @@ -1,47 +0,0 @@
381.4 -/*
381.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
381.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
381.7 - *
381.8 - * This code is free software; you can redistribute it and/or modify it
381.9 - * under the terms of the GNU General Public License version 2 only, as
381.10 - * published by the Free Software Foundation. Oracle designates this
381.11 - * particular file as subject to the "Classpath" exception as provided
381.12 - * by Oracle in the LICENSE file that accompanied this code.
381.13 - *
381.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
381.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
381.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
381.17 - * version 2 for more details (a copy is included in the LICENSE file that
381.18 - * accompanied this code).
381.19 - *
381.20 - * You should have received a copy of the GNU General Public License version
381.21 - * 2 along with this work; if not, write to the Free Software Foundation,
381.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
381.23 - *
381.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
381.25 - * or visit www.oracle.com if you need additional information or have any
381.26 - * questions.
381.27 - */
381.28 -
381.29 -package sun.io;
381.30 -
381.31 -import sun.nio.cs.ISO_8859_2;
381.32 -
381.33 -/**
381.34 - * A table to convert ISO8859_2 to Unicode
381.35 - *
381.36 - * @author ConverterGenerator tool
381.37 - */
381.38 -
381.39 -public class ByteToCharISO8859_2 extends ByteToCharSingleByte {
381.40 -
381.41 - private final static ISO_8859_2 nioCoder = new ISO_8859_2();
381.42 -
381.43 - public String getCharacterEncoding() {
381.44 - return "ISO8859_2";
381.45 - }
381.46 -
381.47 - public ByteToCharISO8859_2() {
381.48 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
381.49 - }
381.50 -}
382.1 --- a/src/share/classes/sun/io/ByteToCharISO8859_3.java Thu Sep 01 13:54:38 2011 -0700
382.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
382.3 @@ -1,47 +0,0 @@
382.4 -/*
382.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
382.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
382.7 - *
382.8 - * This code is free software; you can redistribute it and/or modify it
382.9 - * under the terms of the GNU General Public License version 2 only, as
382.10 - * published by the Free Software Foundation. Oracle designates this
382.11 - * particular file as subject to the "Classpath" exception as provided
382.12 - * by Oracle in the LICENSE file that accompanied this code.
382.13 - *
382.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
382.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
382.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
382.17 - * version 2 for more details (a copy is included in the LICENSE file that
382.18 - * accompanied this code).
382.19 - *
382.20 - * You should have received a copy of the GNU General Public License version
382.21 - * 2 along with this work; if not, write to the Free Software Foundation,
382.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
382.23 - *
382.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
382.25 - * or visit www.oracle.com if you need additional information or have any
382.26 - * questions.
382.27 - */
382.28 -
382.29 -package sun.io;
382.30 -
382.31 -import sun.nio.cs.ext.ISO_8859_3;
382.32 -
382.33 -/**
382.34 - * A table to convert ISO8859_3 to Unicode
382.35 - *
382.36 - * @author ConverterGenerator tool
382.37 - */
382.38 -
382.39 -public class ByteToCharISO8859_3 extends ByteToCharSingleByte {
382.40 -
382.41 - private final static ISO_8859_3 nioCoder = new ISO_8859_3();
382.42 -
382.43 - public String getCharacterEncoding() {
382.44 - return "ISO8859_3";
382.45 - }
382.46 -
382.47 - public ByteToCharISO8859_3() {
382.48 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
382.49 - }
382.50 -}
383.1 --- a/src/share/classes/sun/io/ByteToCharISO8859_4.java Thu Sep 01 13:54:38 2011 -0700
383.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
383.3 @@ -1,47 +0,0 @@
383.4 -/*
383.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
383.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
383.7 - *
383.8 - * This code is free software; you can redistribute it and/or modify it
383.9 - * under the terms of the GNU General Public License version 2 only, as
383.10 - * published by the Free Software Foundation. Oracle designates this
383.11 - * particular file as subject to the "Classpath" exception as provided
383.12 - * by Oracle in the LICENSE file that accompanied this code.
383.13 - *
383.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
383.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
383.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
383.17 - * version 2 for more details (a copy is included in the LICENSE file that
383.18 - * accompanied this code).
383.19 - *
383.20 - * You should have received a copy of the GNU General Public License version
383.21 - * 2 along with this work; if not, write to the Free Software Foundation,
383.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
383.23 - *
383.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
383.25 - * or visit www.oracle.com if you need additional information or have any
383.26 - * questions.
383.27 - */
383.28 -
383.29 -package sun.io;
383.30 -
383.31 -import sun.nio.cs.ISO_8859_4;
383.32 -
383.33 -/**
383.34 - * A table to convert ISO8859_4 to Unicode
383.35 - *
383.36 - * @author ConverterGenerator tool
383.37 - */
383.38 -
383.39 -public class ByteToCharISO8859_4 extends ByteToCharSingleByte {
383.40 -
383.41 - private final static ISO_8859_4 nioCoder = new ISO_8859_4();
383.42 -
383.43 - public String getCharacterEncoding() {
383.44 - return "ISO8859_4";
383.45 - }
383.46 -
383.47 - public ByteToCharISO8859_4() {
383.48 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
383.49 - }
383.50 -}
384.1 --- a/src/share/classes/sun/io/ByteToCharISO8859_5.java Thu Sep 01 13:54:38 2011 -0700
384.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
384.3 @@ -1,47 +0,0 @@
384.4 -/*
384.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
384.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
384.7 - *
384.8 - * This code is free software; you can redistribute it and/or modify it
384.9 - * under the terms of the GNU General Public License version 2 only, as
384.10 - * published by the Free Software Foundation. Oracle designates this
384.11 - * particular file as subject to the "Classpath" exception as provided
384.12 - * by Oracle in the LICENSE file that accompanied this code.
384.13 - *
384.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
384.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
384.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
384.17 - * version 2 for more details (a copy is included in the LICENSE file that
384.18 - * accompanied this code).
384.19 - *
384.20 - * You should have received a copy of the GNU General Public License version
384.21 - * 2 along with this work; if not, write to the Free Software Foundation,
384.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
384.23 - *
384.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
384.25 - * or visit www.oracle.com if you need additional information or have any
384.26 - * questions.
384.27 - */
384.28 -
384.29 -package sun.io;
384.30 -
384.31 -import sun.nio.cs.ISO_8859_5;
384.32 -
384.33 -/**
384.34 - * A table to convert ISO8859_5 to Unicode
384.35 - *
384.36 - * @author ConverterGenerator tool
384.37 - */
384.38 -
384.39 -public class ByteToCharISO8859_5 extends ByteToCharSingleByte {
384.40 -
384.41 - private final static ISO_8859_5 nioCoder = new ISO_8859_5();
384.42 -
384.43 - public String getCharacterEncoding() {
384.44 - return "ISO8859_5";
384.45 - }
384.46 -
384.47 - public ByteToCharISO8859_5() {
384.48 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
384.49 - }
384.50 -}
385.1 --- a/src/share/classes/sun/io/ByteToCharISO8859_6.java Thu Sep 01 13:54:38 2011 -0700
385.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
385.3 @@ -1,48 +0,0 @@
385.4 -/*
385.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
385.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
385.7 - *
385.8 - * This code is free software; you can redistribute it and/or modify it
385.9 - * under the terms of the GNU General Public License version 2 only, as
385.10 - * published by the Free Software Foundation. Oracle designates this
385.11 - * particular file as subject to the "Classpath" exception as provided
385.12 - * by Oracle in the LICENSE file that accompanied this code.
385.13 - *
385.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
385.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
385.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
385.17 - * version 2 for more details (a copy is included in the LICENSE file that
385.18 - * accompanied this code).
385.19 - *
385.20 - * You should have received a copy of the GNU General Public License version
385.21 - * 2 along with this work; if not, write to the Free Software Foundation,
385.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
385.23 - *
385.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
385.25 - * or visit www.oracle.com if you need additional information or have any
385.26 - * questions.
385.27 - */
385.28 -
385.29 -
385.30 -package sun.io;
385.31 -
385.32 -import sun.nio.cs.ext.ISO_8859_6;
385.33 -
385.34 -/**
385.35 - * A table to convert ISO8859_6 to Unicode
385.36 - *
385.37 - * @author ConverterGenerator tool
385.38 - */
385.39 -
385.40 -public class ByteToCharISO8859_6 extends ByteToCharSingleByte {
385.41 -
385.42 - private final static ISO_8859_6 nioCoder = new ISO_8859_6();
385.43 -
385.44 - public String getCharacterEncoding() {
385.45 - return "ISO8859_6";
385.46 - }
385.47 -
385.48 - public ByteToCharISO8859_6() {
385.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
385.50 - }
385.51 -}
386.1 --- a/src/share/classes/sun/io/ByteToCharISO8859_7.java Thu Sep 01 13:54:38 2011 -0700
386.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
386.3 @@ -1,48 +0,0 @@
386.4 -/*
386.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
386.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
386.7 - *
386.8 - * This code is free software; you can redistribute it and/or modify it
386.9 - * under the terms of the GNU General Public License version 2 only, as
386.10 - * published by the Free Software Foundation. Oracle designates this
386.11 - * particular file as subject to the "Classpath" exception as provided
386.12 - * by Oracle in the LICENSE file that accompanied this code.
386.13 - *
386.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
386.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
386.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
386.17 - * version 2 for more details (a copy is included in the LICENSE file that
386.18 - * accompanied this code).
386.19 - *
386.20 - * You should have received a copy of the GNU General Public License version
386.21 - * 2 along with this work; if not, write to the Free Software Foundation,
386.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
386.23 - *
386.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
386.25 - * or visit www.oracle.com if you need additional information or have any
386.26 - * questions.
386.27 - */
386.28 -
386.29 -package sun.io;
386.30 -
386.31 -import sun.nio.cs.ISO_8859_7;
386.32 -
386.33 -
386.34 -/**
386.35 - * A table to convert ISO8859_7 to Unicode
386.36 - *
386.37 - * @author ConverterGenerator tool
386.38 - */
386.39 -
386.40 -public class ByteToCharISO8859_7 extends ByteToCharSingleByte {
386.41 -
386.42 - private final static ISO_8859_7 nioCoder = new ISO_8859_7();
386.43 -
386.44 - public String getCharacterEncoding() {
386.45 - return "ISO8859_7";
386.46 - }
386.47 -
386.48 - public ByteToCharISO8859_7() {
386.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
386.50 - }
386.51 -}
387.1 --- a/src/share/classes/sun/io/ByteToCharISO8859_8.java Thu Sep 01 13:54:38 2011 -0700
387.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
387.3 @@ -1,47 +0,0 @@
387.4 -/*
387.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
387.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
387.7 - *
387.8 - * This code is free software; you can redistribute it and/or modify it
387.9 - * under the terms of the GNU General Public License version 2 only, as
387.10 - * published by the Free Software Foundation. Oracle designates this
387.11 - * particular file as subject to the "Classpath" exception as provided
387.12 - * by Oracle in the LICENSE file that accompanied this code.
387.13 - *
387.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
387.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
387.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
387.17 - * version 2 for more details (a copy is included in the LICENSE file that
387.18 - * accompanied this code).
387.19 - *
387.20 - * You should have received a copy of the GNU General Public License version
387.21 - * 2 along with this work; if not, write to the Free Software Foundation,
387.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
387.23 - *
387.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
387.25 - * or visit www.oracle.com if you need additional information or have any
387.26 - * questions.
387.27 - */
387.28 -
387.29 -package sun.io;
387.30 -
387.31 -import sun.nio.cs.ext.ISO_8859_8;
387.32 -
387.33 -/**
387.34 - * A table to convert ISO8859_8 to Unicode
387.35 - *
387.36 - * @author ConverterGenerator tool
387.37 - */
387.38 -
387.39 -public class ByteToCharISO8859_8 extends ByteToCharSingleByte {
387.40 -
387.41 - private final static ISO_8859_8 nioCoder = new ISO_8859_8();
387.42 -
387.43 - public String getCharacterEncoding() {
387.44 - return "ISO8859_8";
387.45 - }
387.46 -
387.47 - public ByteToCharISO8859_8() {
387.48 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
387.49 - }
387.50 -}
388.1 --- a/src/share/classes/sun/io/ByteToCharISO8859_9.java Thu Sep 01 13:54:38 2011 -0700
388.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
388.3 @@ -1,47 +0,0 @@
388.4 -/*
388.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
388.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
388.7 - *
388.8 - * This code is free software; you can redistribute it and/or modify it
388.9 - * under the terms of the GNU General Public License version 2 only, as
388.10 - * published by the Free Software Foundation. Oracle designates this
388.11 - * particular file as subject to the "Classpath" exception as provided
388.12 - * by Oracle in the LICENSE file that accompanied this code.
388.13 - *
388.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
388.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
388.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
388.17 - * version 2 for more details (a copy is included in the LICENSE file that
388.18 - * accompanied this code).
388.19 - *
388.20 - * You should have received a copy of the GNU General Public License version
388.21 - * 2 along with this work; if not, write to the Free Software Foundation,
388.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
388.23 - *
388.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
388.25 - * or visit www.oracle.com if you need additional information or have any
388.26 - * questions.
388.27 - */
388.28 -
388.29 -package sun.io;
388.30 -
388.31 -import sun.nio.cs.ISO_8859_9;
388.32 -
388.33 -/**
388.34 - * A table to convert ISO8859_9 to Unicode
388.35 - *
388.36 - * @author ConverterGenerator tool
388.37 - */
388.38 -
388.39 -public class ByteToCharISO8859_9 extends ByteToCharSingleByte {
388.40 -
388.41 - private final static ISO_8859_9 nioCoder = new ISO_8859_9();
388.42 -
388.43 - public String getCharacterEncoding() {
388.44 - return "ISO8859_9";
388.45 - }
388.46 -
388.47 - public ByteToCharISO8859_9() {
388.48 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
388.49 - }
388.50 -}
389.1 --- a/src/share/classes/sun/io/ByteToCharJIS0201.java Thu Sep 01 13:54:38 2011 -0700
389.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
389.3 @@ -1,79 +0,0 @@
389.4 -/*
389.5 - * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
389.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
389.7 - *
389.8 - * This code is free software; you can redistribute it and/or modify it
389.9 - * under the terms of the GNU General Public License version 2 only, as
389.10 - * published by the Free Software Foundation. Oracle designates this
389.11 - * particular file as subject to the "Classpath" exception as provided
389.12 - * by Oracle in the LICENSE file that accompanied this code.
389.13 - *
389.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
389.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
389.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
389.17 - * version 2 for more details (a copy is included in the LICENSE file that
389.18 - * accompanied this code).
389.19 - *
389.20 - * You should have received a copy of the GNU General Public License version
389.21 - * 2 along with this work; if not, write to the Free Software Foundation,
389.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
389.23 - *
389.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
389.25 - * or visit www.oracle.com if you need additional information or have any
389.26 - * questions.
389.27 - */
389.28 -
389.29 -package sun.io;
389.30 -
389.31 -/**
389.32 - * A table to convert JIS0201 to Unicode
389.33 - *
389.34 - * @author ConverterGenerator tool
389.35 - */
389.36 -
389.37 -class ByteToCharJIS0201 extends ByteToCharSingleByte {
389.38 -
389.39 - public String getCharacterEncoding() {
389.40 - return "JIS0201";
389.41 - }
389.42 -
389.43 - public ByteToCharJIS0201() {
389.44 - super.byteToCharTable = byteToCharTable;
389.45 - }
389.46 -
389.47 - private final static String byteToCharTable =
389.48 -
389.49 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x80 - 0x87
389.50 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x88 - 0x8F
389.51 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x90 - 0x97
389.52 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x98 - 0x9F
389.53 - "\uFFFD\uFF61\uFF62\uFF63\uFF64\uFF65\uFF66\uFF67" + // 0xA0 - 0xA7
389.54 - "\uFF68\uFF69\uFF6A\uFF6B\uFF6C\uFF6D\uFF6E\uFF6F" + // 0xA8 - 0xAF
389.55 - "\uFF70\uFF71\uFF72\uFF73\uFF74\uFF75\uFF76\uFF77" + // 0xB0 - 0xB7
389.56 - "\uFF78\uFF79\uFF7A\uFF7B\uFF7C\uFF7D\uFF7E\uFF7F" + // 0xB8 - 0xBF
389.57 - "\uFF80\uFF81\uFF82\uFF83\uFF84\uFF85\uFF86\uFF87" + // 0xC0 - 0xC7
389.58 - "\uFF88\uFF89\uFF8A\uFF8B\uFF8C\uFF8D\uFF8E\uFF8F" + // 0xC8 - 0xCF
389.59 - "\uFF90\uFF91\uFF92\uFF93\uFF94\uFF95\uFF96\uFF97" + // 0xD0 - 0xD7
389.60 - "\uFF98\uFF99\uFF9A\uFF9B\uFF9C\uFF9D\uFF9E\uFF9F" + // 0xD8 - 0xDF
389.61 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xE0 - 0xE7
389.62 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xE8 - 0xEF
389.63 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xF0 - 0xF7
389.64 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xF8 - 0xFF
389.65 - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07
389.66 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F
389.67 - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17
389.68 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F
389.69 - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27
389.70 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F
389.71 - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37
389.72 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F
389.73 - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47
389.74 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F
389.75 - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57
389.76 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F
389.77 - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67
389.78 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F
389.79 - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77
389.80 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F
389.81 -
389.82 -}
390.1 --- a/src/share/classes/sun/io/ByteToCharJIS0208.java Thu Sep 01 13:54:38 2011 -0700
390.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
390.3 @@ -1,54 +0,0 @@
390.4 -/*
390.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
390.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
390.7 - *
390.8 - * This code is free software; you can redistribute it and/or modify it
390.9 - * under the terms of the GNU General Public License version 2 only, as
390.10 - * published by the Free Software Foundation. Oracle designates this
390.11 - * particular file as subject to the "Classpath" exception as provided
390.12 - * by Oracle in the LICENSE file that accompanied this code.
390.13 - *
390.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
390.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
390.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
390.17 - * version 2 for more details (a copy is included in the LICENSE file that
390.18 - * accompanied this code).
390.19 - *
390.20 - * You should have received a copy of the GNU General Public License version
390.21 - * 2 along with this work; if not, write to the Free Software Foundation,
390.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
390.23 - *
390.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
390.25 - * or visit www.oracle.com if you need additional information or have any
390.26 - * questions.
390.27 - */
390.28 -
390.29 -
390.30 -package sun.io;
390.31 -
390.32 -/**
390.33 - * Tables and data to convert JIS0208 to Unicode
390.34 - *
390.35 - * @author ConverterGenerator tool
390.36 - */
390.37 -
390.38 -import sun.nio.cs.ext.JIS_X_0208_Decoder;
390.39 -
390.40 -public class ByteToCharJIS0208 extends ByteToCharDoubleByte {
390.41 -
390.42 - public String getCharacterEncoding() {
390.43 - return "JIS0208";
390.44 - }
390.45 -
390.46 - public ByteToCharJIS0208() {
390.47 - super.index1 = JIS_X_0208_Decoder.getIndex1();
390.48 - super.index2 = JIS_X_0208_Decoder.getIndex2();
390.49 - start = 0x21;
390.50 - end = 0x7E;
390.51 - }
390.52 -
390.53 - protected char convSingleByte(int b) {
390.54 - //Fix bug#4179800 - JIS0208 is 7bit,double-byte encoding
390.55 - return REPLACE_CHAR;
390.56 - }
390.57 -}
391.1 --- a/src/share/classes/sun/io/ByteToCharJIS0208_Solaris.java Thu Sep 01 13:54:38 2011 -0700
391.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
391.3 @@ -1,58 +0,0 @@
391.4 -/*
391.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
391.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
391.7 - *
391.8 - * This code is free software; you can redistribute it and/or modify it
391.9 - * under the terms of the GNU General Public License version 2 only, as
391.10 - * published by the Free Software Foundation. Oracle designates this
391.11 - * particular file as subject to the "Classpath" exception as provided
391.12 - * by Oracle in the LICENSE file that accompanied this code.
391.13 - *
391.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
391.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
391.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
391.17 - * version 2 for more details (a copy is included in the LICENSE file that
391.18 - * accompanied this code).
391.19 - *
391.20 - * You should have received a copy of the GNU General Public License version
391.21 - * 2 along with this work; if not, write to the Free Software Foundation,
391.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
391.23 - *
391.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
391.25 - * or visit www.oracle.com if you need additional information or have any
391.26 - * questions.
391.27 - */
391.28 -
391.29 -
391.30 -package sun.io;
391.31 -
391.32 -import sun.nio.cs.ext.JIS_X_0208_Solaris_Decoder;
391.33 -
391.34 -/**
391.35 - * Tables and data to convert JIS0208_Solaris to Unicode
391.36 - *
391.37 - * Vendor defined chars added for benefit of vendor defined character
391.38 - * supplemented mappings for EUC-JP-Solaris/PCK Solaris variants of EUC-JP
391.39 - * and SJIS/Shift_JIS (4765370)
391.40 - *
391.41 - * @author ConverterGenerator tool
391.42 - */
391.43 -
391.44 -public class ByteToCharJIS0208_Solaris extends ByteToCharDoubleByte {
391.45 -
391.46 - public String getCharacterEncoding() {
391.47 - return "JIS0208_Solaris";
391.48 - }
391.49 -
391.50 - protected char convSingleByte(int b) {
391.51 - //Fix bug#4179800 - JIS0208 is 7bit,double-byte encoding
391.52 - return REPLACE_CHAR;
391.53 - }
391.54 -
391.55 - public ByteToCharJIS0208_Solaris() {
391.56 - super.index1 = JIS_X_0208_Solaris_Decoder.getIndex1();
391.57 - super.index2 = JIS_X_0208_Solaris_Decoder.getIndex2();
391.58 - start = 0x21;
391.59 - end = 0x7E;
391.60 - }
391.61 -}
392.1 --- a/src/share/classes/sun/io/ByteToCharJIS0212.java Thu Sep 01 13:54:38 2011 -0700
392.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
392.3 @@ -1,54 +0,0 @@
392.4 -/*
392.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
392.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
392.7 - *
392.8 - * This code is free software; you can redistribute it and/or modify it
392.9 - * under the terms of the GNU General Public License version 2 only, as
392.10 - * published by the Free Software Foundation. Oracle designates this
392.11 - * particular file as subject to the "Classpath" exception as provided
392.12 - * by Oracle in the LICENSE file that accompanied this code.
392.13 - *
392.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
392.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
392.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
392.17 - * version 2 for more details (a copy is included in the LICENSE file that
392.18 - * accompanied this code).
392.19 - *
392.20 - * You should have received a copy of the GNU General Public License version
392.21 - * 2 along with this work; if not, write to the Free Software Foundation,
392.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
392.23 - *
392.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
392.25 - * or visit www.oracle.com if you need additional information or have any
392.26 - * questions.
392.27 - */
392.28 -
392.29 -package sun.io;
392.30 -
392.31 -import sun.nio.cs.ext.JIS_X_0212_Decoder;
392.32 -
392.33 -/**
392.34 - * Tables and data to convert JIS0212 to Unicode
392.35 - *
392.36 - * @author ConverterGenerator tool
392.37 - */
392.38 -
392.39 -
392.40 -public class ByteToCharJIS0212 extends ByteToCharDoubleByte {
392.41 -
392.42 - public String getCharacterEncoding() {
392.43 - return "JIS0212";
392.44 - }
392.45 -
392.46 - protected char convSingleByte(int b) {
392.47 - //Fix bug#4179800 - JIS0212 is 7bit,double-byte encoding
392.48 - return REPLACE_CHAR;
392.49 - }
392.50 -
392.51 - public ByteToCharJIS0212() {
392.52 - super.index1 = JIS_X_0212_Decoder.getIndex1();
392.53 - super.index2 = JIS_X_0212_Decoder.getIndex2();
392.54 - start = 0x21;
392.55 - end = 0x7E;
392.56 - }
392.57 -}
393.1 --- a/src/share/classes/sun/io/ByteToCharJIS0212_Solaris.java Thu Sep 01 13:54:38 2011 -0700
393.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
393.3 @@ -1,55 +0,0 @@
393.4 -/*
393.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
393.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
393.7 - *
393.8 - * This code is free software; you can redistribute it and/or modify it
393.9 - * under the terms of the GNU General Public License version 2 only, as
393.10 - * published by the Free Software Foundation. Oracle designates this
393.11 - * particular file as subject to the "Classpath" exception as provided
393.12 - * by Oracle in the LICENSE file that accompanied this code.
393.13 - *
393.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
393.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
393.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
393.17 - * version 2 for more details (a copy is included in the LICENSE file that
393.18 - * accompanied this code).
393.19 - *
393.20 - * You should have received a copy of the GNU General Public License version
393.21 - * 2 along with this work; if not, write to the Free Software Foundation,
393.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
393.23 - *
393.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
393.25 - * or visit www.oracle.com if you need additional information or have any
393.26 - * questions.
393.27 - */
393.28 -
393.29 -
393.30 -package sun.io;
393.31 -
393.32 -import sun.nio.cs.ext.JIS_X_0212_Solaris_Decoder;
393.33 -
393.34 -/**
393.35 - * Tables and data to convert JIS0212_Solaris to Unicode
393.36 - * Solaris ==> vendor defined characters -- NEC row 13 + IBM extended
393.37 - * selected character set.
393.38 - * @author ConverterGenerator tool
393.39 - */
393.40 -
393.41 -public class ByteToCharJIS0212_Solaris extends ByteToCharDoubleByte {
393.42 -
393.43 - public String getCharacterEncoding() {
393.44 - return "JIS0212_Solaris";
393.45 - }
393.46 -
393.47 - protected char convSingleByte(int b) {
393.48 - //Fix bug#4179800 - JIS0212 is 7bit,double-byte encoding
393.49 - return REPLACE_CHAR;
393.50 - }
393.51 -
393.52 - public ByteToCharJIS0212_Solaris() {
393.53 - super.index1 = JIS_X_0212_Solaris_Decoder.getIndex1();
393.54 - super.index2 = JIS_X_0212_Solaris_Decoder.getIndex2();
393.55 - start = 0x21;
393.56 - end = 0x7E;
393.57 - }
393.58 -}
394.1 --- a/src/share/classes/sun/io/ByteToCharJISAutoDetect.java Thu Sep 01 13:54:38 2011 -0700
394.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
394.3 @@ -1,239 +0,0 @@
394.4 -/*
394.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
394.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
394.7 - *
394.8 - * This code is free software; you can redistribute it and/or modify it
394.9 - * under the terms of the GNU General Public License version 2 only, as
394.10 - * published by the Free Software Foundation. Oracle designates this
394.11 - * particular file as subject to the "Classpath" exception as provided
394.12 - * by Oracle in the LICENSE file that accompanied this code.
394.13 - *
394.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
394.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
394.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
394.17 - * version 2 for more details (a copy is included in the LICENSE file that
394.18 - * accompanied this code).
394.19 - *
394.20 - * You should have received a copy of the GNU General Public License version
394.21 - * 2 along with this work; if not, write to the Free Software Foundation,
394.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
394.23 - *
394.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
394.25 - * or visit www.oracle.com if you need additional information or have any
394.26 - * questions.
394.27 - */
394.28 -package sun.io;
394.29 -
394.30 -import java.io.UnsupportedEncodingException;
394.31 -import sun.nio.cs.ext.JISAutoDetect;
394.32 -
394.33 -public class ByteToCharJISAutoDetect extends ByteToCharConverter {
394.34 -
394.35 - private final static int EUCJP_MASK = 0x01;
394.36 - private final static int SJIS2B_MASK = 0x02;
394.37 - private final static int SJIS1B_MASK = 0x04;
394.38 - private final static int EUCJP_KANA1_MASK = 0x08;
394.39 - private final static int EUCJP_KANA2_MASK = 0x10;
394.40 - private final static byte[] maskTable1 = JISAutoDetect.getByteMask1();
394.41 - private final static byte[] maskTable2 = JISAutoDetect.getByteMask2();
394.42 -
394.43 - private final static int SS2 = 0x8e;
394.44 - private final static int SS3 = 0x8f;
394.45 -
394.46 - // SJISName is set to either "SJIS" or "MS932"
394.47 - private String SJISName;
394.48 - private String EUCJPName;
394.49 -
394.50 - private String convName = null;
394.51 - private ByteToCharConverter detectedConv = null;
394.52 - private ByteToCharConverter defaultConv = null;
394.53 -
394.54 - public ByteToCharJISAutoDetect() {
394.55 - super();
394.56 - SJISName = CharacterEncoding.getSJISName();
394.57 - EUCJPName = CharacterEncoding.getEUCJPName();
394.58 - defaultConv = new ByteToCharISO8859_1();
394.59 - defaultConv.subChars = subChars;
394.60 - defaultConv.subMode = subMode;
394.61 - }
394.62 -
394.63 - public int flush(char [] output, int outStart, int outEnd)
394.64 - throws MalformedInputException, ConversionBufferFullException
394.65 - {
394.66 - badInputLength = 0;
394.67 - if(detectedConv != null)
394.68 - return detectedConv.flush(output, outStart, outEnd);
394.69 - else
394.70 - return defaultConv.flush(output, outStart, outEnd);
394.71 - }
394.72 -
394.73 -
394.74 - /**
394.75 - * Character conversion
394.76 - */
394.77 - public int convert(byte[] input, int inOff, int inEnd,
394.78 - char[] output, int outOff, int outEnd)
394.79 - throws UnknownCharacterException, MalformedInputException,
394.80 - ConversionBufferFullException
394.81 - {
394.82 - int num = 0;
394.83 -
394.84 - charOff = outOff;
394.85 - byteOff = inOff;
394.86 -
394.87 - try {
394.88 - if (detectedConv == null) {
394.89 - int euckana = 0;
394.90 - int ss2count = 0;
394.91 - int firstmask = 0;
394.92 - int secondmask = 0;
394.93 - int cnt;
394.94 - boolean nonAsciiFound = false;
394.95 -
394.96 - for (cnt = inOff; cnt < inEnd; cnt++) {
394.97 - firstmask = 0;
394.98 - secondmask = 0;
394.99 - int byte1 = input[cnt]&0xff;
394.100 - int byte2;
394.101 -
394.102 - // TODO: should check valid escape sequences!
394.103 - if (byte1 == 0x1b) {
394.104 - convName = "ISO2022JP";
394.105 - break;
394.106 - }
394.107 -
394.108 - // Try to convert all leading ASCII characters.
394.109 - if ((nonAsciiFound == false) && (byte1 < 0x80)) {
394.110 - if (charOff >= outEnd)
394.111 - throw new ConversionBufferFullException();
394.112 - output[charOff++] = (char) byte1;
394.113 - byteOff++;
394.114 - num++;
394.115 - continue;
394.116 - }
394.117 -
394.118 - // We can no longer convert ASCII.
394.119 - nonAsciiFound = true;
394.120 -
394.121 - firstmask = maskTable1[byte1];
394.122 - if (byte1 == SS2)
394.123 - ss2count++;
394.124 -
394.125 - if (firstmask != 0) {
394.126 - if (cnt+1 < inEnd) {
394.127 - byte2 = input[++cnt] & 0xff;
394.128 - secondmask = maskTable2[byte2];
394.129 - int mask = firstmask & secondmask;
394.130 - if (mask == EUCJP_MASK) {
394.131 - convName = EUCJPName;
394.132 - break;
394.133 - }
394.134 - if ((mask == SJIS2B_MASK) || (mask == SJIS1B_MASK)
394.135 - || (JISAutoDetect.canBeSJIS1B(firstmask) && secondmask == 0)) {
394.136 - convName = SJISName;
394.137 - break;
394.138 - }
394.139 -
394.140 - // If the first byte is a SS3 and the third byte
394.141 - // is not an EUC byte, it should be SJIS.
394.142 - // Otherwise, we can't determine it yet, but it's
394.143 - // very likely SJIS. So we don't take the EUCJP CS3
394.144 - // character boundary. If we tried both
394.145 - // possibilities here, it might be able to be
394.146 - // determined correctly.
394.147 - if ((byte1 == SS3) && JISAutoDetect.canBeEUCJP(secondmask)) {
394.148 - if (cnt+1 < inEnd) {
394.149 - int nextbyte = input[cnt+1] & 0xff;
394.150 - if (! JISAutoDetect.canBeEUCJP(maskTable2[nextbyte]))
394.151 - convName = SJISName;
394.152 - } else
394.153 - convName = SJISName;
394.154 - }
394.155 - if (JISAutoDetect.canBeEUCKana(firstmask, secondmask))
394.156 - euckana++;
394.157 - } else {
394.158 - if ((firstmask & SJIS1B_MASK) != 0) {
394.159 - convName = SJISName;
394.160 - break;
394.161 - }
394.162 - }
394.163 - }
394.164 - }
394.165 -
394.166 - if (nonAsciiFound && (convName == null)) {
394.167 - if ((euckana > 1) || (ss2count > 1))
394.168 - convName = EUCJPName;
394.169 - else
394.170 - convName = SJISName;
394.171 - }
394.172 -
394.173 - if (convName != null) {
394.174 - try {
394.175 - detectedConv = ByteToCharConverter.getConverter(convName);
394.176 - detectedConv.subChars = subChars;
394.177 - detectedConv.subMode = subMode;
394.178 - } catch (UnsupportedEncodingException e){
394.179 - detectedConv = null;
394.180 - convName = null;
394.181 - }
394.182 - }
394.183 - }
394.184 - } catch (ConversionBufferFullException bufferFullException) {
394.185 - throw bufferFullException;
394.186 - } catch (Exception e) {
394.187 - // If we fail to detect the converter needed for any reason,
394.188 - // use the default converter.
394.189 - detectedConv = defaultConv;
394.190 - }
394.191 -
394.192 - // If we've converted all ASCII characters, then return.
394.193 - if (byteOff == inEnd) {
394.194 - return num;
394.195 - }
394.196 -
394.197 - if(detectedConv != null) {
394.198 - try {
394.199 - num += detectedConv.convert(input, inOff + num, inEnd,
394.200 - output, outOff + num, outEnd);
394.201 - } finally {
394.202 - charOff = detectedConv.nextCharIndex();
394.203 - byteOff = detectedConv.nextByteIndex();
394.204 - badInputLength = detectedConv.badInputLength;
394.205 - }
394.206 - } else {
394.207 - try {
394.208 - num += defaultConv.convert(input, inOff + num, inEnd,
394.209 - output, outOff + num, outEnd);
394.210 - } finally {
394.211 - charOff = defaultConv.nextCharIndex();
394.212 - byteOff = defaultConv.nextByteIndex();
394.213 - badInputLength = defaultConv.badInputLength;
394.214 - }
394.215 - }
394.216 - return num;
394.217 - }
394.218 -
394.219 - public void reset() {
394.220 - if(detectedConv != null) {
394.221 - detectedConv.reset();
394.222 - detectedConv = null;
394.223 - convName = null;
394.224 - } else
394.225 - defaultConv.reset();
394.226 - charOff = byteOff = 0;
394.227 - }
394.228 -
394.229 - public String getCharacterEncoding() {
394.230 - return "JISAutoDetect";
394.231 - }
394.232 -
394.233 - public String toString() {
394.234 - String s = getCharacterEncoding();
394.235 - if (detectedConv != null) {
394.236 - s += "[" + detectedConv.getCharacterEncoding() + "]";
394.237 - } else {
394.238 - s += "[unknown]";
394.239 - }
394.240 - return s;
394.241 - }
394.242 -}
395.1 --- a/src/share/classes/sun/io/ByteToCharJohab.java Thu Sep 01 13:54:38 2011 -0700
395.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
395.3 @@ -1,43 +0,0 @@
395.4 -/*
395.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
395.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
395.7 - *
395.8 - * This code is free software; you can redistribute it and/or modify it
395.9 - * under the terms of the GNU General Public License version 2 only, as
395.10 - * published by the Free Software Foundation. Oracle designates this
395.11 - * particular file as subject to the "Classpath" exception as provided
395.12 - * by Oracle in the LICENSE file that accompanied this code.
395.13 - *
395.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
395.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
395.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
395.17 - * version 2 for more details (a copy is included in the LICENSE file that
395.18 - * accompanied this code).
395.19 - *
395.20 - * You should have received a copy of the GNU General Public License version
395.21 - * 2 along with this work; if not, write to the Free Software Foundation,
395.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
395.23 - *
395.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
395.25 - * or visit www.oracle.com if you need additional information or have any
395.26 - * questions.
395.27 - */
395.28 -
395.29 -
395.30 -package sun.io;
395.31 -
395.32 -import sun.nio.cs.ext.*;
395.33 -
395.34 -public class ByteToCharJohab extends ByteToCharDBCS_ASCII {
395.35 -
395.36 - private static DoubleByte.Decoder dec =
395.37 - (DoubleByte.Decoder)new Johab().newDecoder();
395.38 -
395.39 - public String getCharacterEncoding() {
395.40 - return "Johab";
395.41 - }
395.42 -
395.43 - public ByteToCharJohab() {
395.44 - super(dec);
395.45 - }
395.46 -}
396.1 --- a/src/share/classes/sun/io/ByteToCharKOI8_R.java Thu Sep 01 13:54:38 2011 -0700
396.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
396.3 @@ -1,47 +0,0 @@
396.4 -/*
396.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
396.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
396.7 - *
396.8 - * This code is free software; you can redistribute it and/or modify it
396.9 - * under the terms of the GNU General Public License version 2 only, as
396.10 - * published by the Free Software Foundation. Oracle designates this
396.11 - * particular file as subject to the "Classpath" exception as provided
396.12 - * by Oracle in the LICENSE file that accompanied this code.
396.13 - *
396.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
396.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
396.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
396.17 - * version 2 for more details (a copy is included in the LICENSE file that
396.18 - * accompanied this code).
396.19 - *
396.20 - * You should have received a copy of the GNU General Public License version
396.21 - * 2 along with this work; if not, write to the Free Software Foundation,
396.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
396.23 - *
396.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
396.25 - * or visit www.oracle.com if you need additional information or have any
396.26 - * questions.
396.27 - */
396.28 -
396.29 -package sun.io;
396.30 -
396.31 -import sun.nio.cs.KOI8_R;
396.32 -
396.33 -/**
396.34 - * A table to convert KOI8_R to Unicode
396.35 - *
396.36 - * @author ConverterGenerator tool
396.37 - */
396.38 -
396.39 -public class ByteToCharKOI8_R extends ByteToCharSingleByte {
396.40 -
396.41 - private final static KOI8_R nioCoder = new KOI8_R();
396.42 -
396.43 - public String getCharacterEncoding() {
396.44 - return "KOI8_R";
396.45 - }
396.46 -
396.47 - public ByteToCharKOI8_R() {
396.48 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
396.49 - }
396.50 -}
397.1 --- a/src/share/classes/sun/io/ByteToCharMS874.java Thu Sep 01 13:54:38 2011 -0700
397.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
397.3 @@ -1,48 +0,0 @@
397.4 -/*
397.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
397.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
397.7 - *
397.8 - * This code is free software; you can redistribute it and/or modify it
397.9 - * under the terms of the GNU General Public License version 2 only, as
397.10 - * published by the Free Software Foundation. Oracle designates this
397.11 - * particular file as subject to the "Classpath" exception as provided
397.12 - * by Oracle in the LICENSE file that accompanied this code.
397.13 - *
397.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
397.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
397.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
397.17 - * version 2 for more details (a copy is included in the LICENSE file that
397.18 - * accompanied this code).
397.19 - *
397.20 - * You should have received a copy of the GNU General Public License version
397.21 - * 2 along with this work; if not, write to the Free Software Foundation,
397.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
397.23 - *
397.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
397.25 - * or visit www.oracle.com if you need additional information or have any
397.26 - * questions.
397.27 - */
397.28 -
397.29 -
397.30 -package sun.io;
397.31 -
397.32 -import sun.nio.cs.ext.MS874;
397.33 -
397.34 -/**
397.35 - * A table to convert MS874 to Unicode
397.36 - *
397.37 - * @author ConverterGenerator tool
397.38 - */
397.39 -
397.40 -public class ByteToCharMS874 extends ByteToCharSingleByte {
397.41 -
397.42 - private final static MS874 nioCoder = new MS874();
397.43 -
397.44 - public String getCharacterEncoding() {
397.45 - return "MS874";
397.46 - }
397.47 -
397.48 - public ByteToCharMS874() {
397.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
397.50 - }
397.51 -}
398.1 --- a/src/share/classes/sun/io/ByteToCharMS932.java Thu Sep 01 13:54:38 2011 -0700
398.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
398.3 @@ -1,43 +0,0 @@
398.4 -/*
398.5 - * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
398.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
398.7 - *
398.8 - * This code is free software; you can redistribute it and/or modify it
398.9 - * under the terms of the GNU General Public License version 2 only, as
398.10 - * published by the Free Software Foundation. Oracle designates this
398.11 - * particular file as subject to the "Classpath" exception as provided
398.12 - * by Oracle in the LICENSE file that accompanied this code.
398.13 - *
398.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
398.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
398.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
398.17 - * version 2 for more details (a copy is included in the LICENSE file that
398.18 - * accompanied this code).
398.19 - *
398.20 - * You should have received a copy of the GNU General Public License version
398.21 - * 2 along with this work; if not, write to the Free Software Foundation,
398.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
398.23 - *
398.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
398.25 - * or visit www.oracle.com if you need additional information or have any
398.26 - * questions.
398.27 - */
398.28 -
398.29 -package sun.io;
398.30 -
398.31 -import sun.nio.cs.ext.*;
398.32 -
398.33 -public class ByteToCharMS932 extends ByteToCharDBCS_ASCII {
398.34 -
398.35 - private static DoubleByte.Decoder dec =
398.36 - (DoubleByte.Decoder)new MS932().newDecoder();
398.37 -
398.38 - public String getCharacterEncoding() {
398.39 - return "MS932";
398.40 - }
398.41 -
398.42 - public ByteToCharMS932() {
398.43 - super(dec);
398.44 - }
398.45 -
398.46 -}
399.1 --- a/src/share/classes/sun/io/ByteToCharMS936.java Thu Sep 01 13:54:38 2011 -0700
399.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
399.3 @@ -1,42 +0,0 @@
399.4 -/*
399.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
399.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
399.7 - *
399.8 - * This code is free software; you can redistribute it and/or modify it
399.9 - * under the terms of the GNU General Public License version 2 only, as
399.10 - * published by the Free Software Foundation. Oracle designates this
399.11 - * particular file as subject to the "Classpath" exception as provided
399.12 - * by Oracle in the LICENSE file that accompanied this code.
399.13 - *
399.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
399.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
399.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
399.17 - * version 2 for more details (a copy is included in the LICENSE file that
399.18 - * accompanied this code).
399.19 - *
399.20 - * You should have received a copy of the GNU General Public License version
399.21 - * 2 along with this work; if not, write to the Free Software Foundation,
399.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
399.23 - *
399.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
399.25 - * or visit www.oracle.com if you need additional information or have any
399.26 - * questions.
399.27 - */
399.28 -
399.29 -package sun.io;
399.30 -
399.31 -import sun.nio.cs.ext.*;
399.32 -
399.33 -public class ByteToCharMS936 extends ByteToCharDBCS_ASCII {
399.34 -
399.35 - private static DoubleByte.Decoder dec =
399.36 - (DoubleByte.Decoder)new MS936().newDecoder();
399.37 -
399.38 - public String getCharacterEncoding() {
399.39 - return "MS936";
399.40 - }
399.41 -
399.42 - public ByteToCharMS936() {
399.43 - super(dec);
399.44 - }
399.45 -}
400.1 --- a/src/share/classes/sun/io/ByteToCharMS949.java Thu Sep 01 13:54:38 2011 -0700
400.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
400.3 @@ -1,44 +0,0 @@
400.4 -/*
400.5 - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
400.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
400.7 - *
400.8 - * This code is free software; you can redistribute it and/or modify it
400.9 - * under the terms of the GNU General Public License version 2 only, as
400.10 - * published by the Free Software Foundation. Oracle designates this
400.11 - * particular file as subject to the "Classpath" exception as provided
400.12 - * by Oracle in the LICENSE file that accompanied this code.
400.13 - *
400.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
400.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
400.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
400.17 - * version 2 for more details (a copy is included in the LICENSE file that
400.18 - * accompanied this code).
400.19 - *
400.20 - * You should have received a copy of the GNU General Public License version
400.21 - * 2 along with this work; if not, write to the Free Software Foundation,
400.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
400.23 - *
400.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
400.25 - * or visit www.oracle.com if you need additional information or have any
400.26 - * questions.
400.27 - */
400.28 -
400.29 -
400.30 -package sun.io;
400.31 -
400.32 -import sun.nio.cs.ext.*;
400.33 -
400.34 -public class ByteToCharMS949 extends ByteToCharDBCS_ASCII {
400.35 -
400.36 - private static DoubleByte.Decoder dec =
400.37 - (DoubleByte.Decoder)new MS949().newDecoder();
400.38 -
400.39 -
400.40 - public String getCharacterEncoding() {
400.41 - return "MS949";
400.42 - }
400.43 -
400.44 - public ByteToCharMS949() {
400.45 - super(dec);
400.46 - }
400.47 -}
401.1 --- a/src/share/classes/sun/io/ByteToCharMS950.java Thu Sep 01 13:54:38 2011 -0700
401.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
401.3 @@ -1,43 +0,0 @@
401.4 -/*
401.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
401.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
401.7 - *
401.8 - * This code is free software; you can redistribute it and/or modify it
401.9 - * under the terms of the GNU General Public License version 2 only, as
401.10 - * published by the Free Software Foundation. Oracle designates this
401.11 - * particular file as subject to the "Classpath" exception as provided
401.12 - * by Oracle in the LICENSE file that accompanied this code.
401.13 - *
401.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
401.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
401.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
401.17 - * version 2 for more details (a copy is included in the LICENSE file that
401.18 - * accompanied this code).
401.19 - *
401.20 - * You should have received a copy of the GNU General Public License version
401.21 - * 2 along with this work; if not, write to the Free Software Foundation,
401.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
401.23 - *
401.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
401.25 - * or visit www.oracle.com if you need additional information or have any
401.26 - * questions.
401.27 - */
401.28 -
401.29 -
401.30 -package sun.io;
401.31 -
401.32 -import sun.nio.cs.ext.*;
401.33 -
401.34 -public class ByteToCharMS950 extends ByteToCharDBCS_ASCII {
401.35 -
401.36 - private static DoubleByte.Decoder dec =
401.37 - (DoubleByte.Decoder)new MS950().newDecoder();
401.38 -
401.39 - public String getCharacterEncoding() {
401.40 - return "MS950";
401.41 - }
401.42 -
401.43 - public ByteToCharMS950() {
401.44 - super(dec);
401.45 - }
401.46 -}
402.1 --- a/src/share/classes/sun/io/ByteToCharMS950_HKSCS.java Thu Sep 01 13:54:38 2011 -0700
402.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
402.3 @@ -1,51 +0,0 @@
402.4 -/*
402.5 - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
402.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
402.7 - *
402.8 - * This code is free software; you can redistribute it and/or modify it
402.9 - * under the terms of the GNU General Public License version 2 only, as
402.10 - * published by the Free Software Foundation. Oracle designates this
402.11 - * particular file as subject to the "Classpath" exception as provided
402.12 - * by Oracle in the LICENSE file that accompanied this code.
402.13 - *
402.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
402.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
402.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
402.17 - * version 2 for more details (a copy is included in the LICENSE file that
402.18 - * accompanied this code).
402.19 - *
402.20 - * You should have received a copy of the GNU General Public License version
402.21 - * 2 along with this work; if not, write to the Free Software Foundation,
402.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
402.23 - *
402.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
402.25 - * or visit www.oracle.com if you need additional information or have any
402.26 - * questions.
402.27 - */
402.28 -
402.29 -package sun.io;
402.30 -
402.31 -import sun.nio.cs.ext.HKSCS;
402.32 -import sun.nio.cs.ext.MS950_HKSCS;
402.33 -import static sun.nio.cs.CharsetMapping.*;
402.34 -
402.35 -public class ByteToCharMS950_HKSCS extends ByteToCharDBCS_ASCII {
402.36 -
402.37 - private static HKSCS.Decoder dec =
402.38 - (HKSCS.Decoder)new MS950_HKSCS().newDecoder();
402.39 -
402.40 - public String getCharacterEncoding() {
402.41 - return "MS950_HKSCS";
402.42 - }
402.43 -
402.44 - public ByteToCharMS950_HKSCS() {
402.45 - super(dec);
402.46 - }
402.47 -
402.48 - protected char decodeDouble(int byte1, int byte2) {
402.49 - char c = dec.decodeDouble(byte1, byte2);
402.50 - if (c == UNMAPPABLE_DECODING)
402.51 - c = dec.decodeBig5(byte1, byte2);
402.52 - return c;
402.53 - }
402.54 -}
403.1 --- a/src/share/classes/sun/io/ByteToCharMacArabic.java Thu Sep 01 13:54:38 2011 -0700
403.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
403.3 @@ -1,48 +0,0 @@
403.4 -/*
403.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
403.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
403.7 - *
403.8 - * This code is free software; you can redistribute it and/or modify it
403.9 - * under the terms of the GNU General Public License version 2 only, as
403.10 - * published by the Free Software Foundation. Oracle designates this
403.11 - * particular file as subject to the "Classpath" exception as provided
403.12 - * by Oracle in the LICENSE file that accompanied this code.
403.13 - *
403.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
403.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
403.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
403.17 - * version 2 for more details (a copy is included in the LICENSE file that
403.18 - * accompanied this code).
403.19 - *
403.20 - * You should have received a copy of the GNU General Public License version
403.21 - * 2 along with this work; if not, write to the Free Software Foundation,
403.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
403.23 - *
403.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
403.25 - * or visit www.oracle.com if you need additional information or have any
403.26 - * questions.
403.27 - */
403.28 -
403.29 -
403.30 -package sun.io;
403.31 -
403.32 -import sun.nio.cs.ext.MacArabic;
403.33 -
403.34 -/**
403.35 - * A table to convert to MacArabic to Unicode
403.36 - *
403.37 - * @author ConverterGenerator tool
403.38 - */
403.39 -
403.40 -public class ByteToCharMacArabic extends ByteToCharSingleByte {
403.41 -
403.42 - private final static MacArabic nioCoder = new MacArabic();
403.43 -
403.44 - public String getCharacterEncoding() {
403.45 - return "MacArabic";
403.46 - }
403.47 -
403.48 - public ByteToCharMacArabic() {
403.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
403.50 - }
403.51 -}
404.1 --- a/src/share/classes/sun/io/ByteToCharMacCentralEurope.java Thu Sep 01 13:54:38 2011 -0700
404.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
404.3 @@ -1,48 +0,0 @@
404.4 -/*
404.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
404.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
404.7 - *
404.8 - * This code is free software; you can redistribute it and/or modify it
404.9 - * under the terms of the GNU General Public License version 2 only, as
404.10 - * published by the Free Software Foundation. Oracle designates this
404.11 - * particular file as subject to the "Classpath" exception as provided
404.12 - * by Oracle in the LICENSE file that accompanied this code.
404.13 - *
404.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
404.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
404.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
404.17 - * version 2 for more details (a copy is included in the LICENSE file that
404.18 - * accompanied this code).
404.19 - *
404.20 - * You should have received a copy of the GNU General Public License version
404.21 - * 2 along with this work; if not, write to the Free Software Foundation,
404.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
404.23 - *
404.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
404.25 - * or visit www.oracle.com if you need additional information or have any
404.26 - * questions.
404.27 - */
404.28 -
404.29 -
404.30 -package sun.io;
404.31 -
404.32 -import sun.nio.cs.ext.MacCentralEurope;
404.33 -
404.34 -/**
404.35 - * A table to convert to MacCentralEurope to Unicode
404.36 - *
404.37 - * @author ConverterGenerator tool
404.38 - */
404.39 -
404.40 -public class ByteToCharMacCentralEurope extends ByteToCharSingleByte {
404.41 -
404.42 - private final static MacCentralEurope nioCoder = new MacCentralEurope();
404.43 -
404.44 - public String getCharacterEncoding() {
404.45 - return "MacCentralEurope";
404.46 - }
404.47 -
404.48 - public ByteToCharMacCentralEurope() {
404.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
404.50 - }
404.51 -}
405.1 --- a/src/share/classes/sun/io/ByteToCharMacCroatian.java Thu Sep 01 13:54:38 2011 -0700
405.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
405.3 @@ -1,48 +0,0 @@
405.4 -/*
405.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
405.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
405.7 - *
405.8 - * This code is free software; you can redistribute it and/or modify it
405.9 - * under the terms of the GNU General Public License version 2 only, as
405.10 - * published by the Free Software Foundation. Oracle designates this
405.11 - * particular file as subject to the "Classpath" exception as provided
405.12 - * by Oracle in the LICENSE file that accompanied this code.
405.13 - *
405.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
405.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
405.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
405.17 - * version 2 for more details (a copy is included in the LICENSE file that
405.18 - * accompanied this code).
405.19 - *
405.20 - * You should have received a copy of the GNU General Public License version
405.21 - * 2 along with this work; if not, write to the Free Software Foundation,
405.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
405.23 - *
405.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
405.25 - * or visit www.oracle.com if you need additional information or have any
405.26 - * questions.
405.27 - */
405.28 -
405.29 -
405.30 -package sun.io;
405.31 -
405.32 -import sun.nio.cs.ext.MacCroatian;
405.33 -
405.34 -/**
405.35 - * A table to convert to MacCroatian to Unicode
405.36 - *
405.37 - * @author ConverterGenerator tool
405.38 - */
405.39 -
405.40 -public class ByteToCharMacCroatian extends ByteToCharSingleByte {
405.41 -
405.42 - private final static MacCroatian nioCoder = new MacCroatian();
405.43 -
405.44 - public String getCharacterEncoding() {
405.45 - return "MacCroatian";
405.46 - }
405.47 -
405.48 - public ByteToCharMacCroatian() {
405.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
405.50 - }
405.51 -}
406.1 --- a/src/share/classes/sun/io/ByteToCharMacCyrillic.java Thu Sep 01 13:54:38 2011 -0700
406.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
406.3 @@ -1,48 +0,0 @@
406.4 -/*
406.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
406.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
406.7 - *
406.8 - * This code is free software; you can redistribute it and/or modify it
406.9 - * under the terms of the GNU General Public License version 2 only, as
406.10 - * published by the Free Software Foundation. Oracle designates this
406.11 - * particular file as subject to the "Classpath" exception as provided
406.12 - * by Oracle in the LICENSE file that accompanied this code.
406.13 - *
406.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
406.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
406.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
406.17 - * version 2 for more details (a copy is included in the LICENSE file that
406.18 - * accompanied this code).
406.19 - *
406.20 - * You should have received a copy of the GNU General Public License version
406.21 - * 2 along with this work; if not, write to the Free Software Foundation,
406.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
406.23 - *
406.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
406.25 - * or visit www.oracle.com if you need additional information or have any
406.26 - * questions.
406.27 - */
406.28 -
406.29 -
406.30 -package sun.io;
406.31 -
406.32 -import sun.nio.cs.ext.MacCyrillic;
406.33 -
406.34 -/**
406.35 - * A table to convert to MacCyrillic to Unicode
406.36 - *
406.37 - * @author ConverterGenerator tool
406.38 - */
406.39 -
406.40 -public class ByteToCharMacCyrillic extends ByteToCharSingleByte {
406.41 -
406.42 - private final static MacCyrillic nioCoder = new MacCyrillic();
406.43 -
406.44 - public String getCharacterEncoding() {
406.45 - return "MacCyrillic";
406.46 - }
406.47 -
406.48 - public ByteToCharMacCyrillic() {
406.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
406.50 - }
406.51 -}
407.1 --- a/src/share/classes/sun/io/ByteToCharMacDingbat.java Thu Sep 01 13:54:38 2011 -0700
407.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
407.3 @@ -1,48 +0,0 @@
407.4 -/*
407.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
407.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
407.7 - *
407.8 - * This code is free software; you can redistribute it and/or modify it
407.9 - * under the terms of the GNU General Public License version 2 only, as
407.10 - * published by the Free Software Foundation. Oracle designates this
407.11 - * particular file as subject to the "Classpath" exception as provided
407.12 - * by Oracle in the LICENSE file that accompanied this code.
407.13 - *
407.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
407.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
407.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
407.17 - * version 2 for more details (a copy is included in the LICENSE file that
407.18 - * accompanied this code).
407.19 - *
407.20 - * You should have received a copy of the GNU General Public License version
407.21 - * 2 along with this work; if not, write to the Free Software Foundation,
407.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
407.23 - *
407.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
407.25 - * or visit www.oracle.com if you need additional information or have any
407.26 - * questions.
407.27 - */
407.28 -
407.29 -
407.30 -package sun.io;
407.31 -
407.32 -import sun.nio.cs.ext.MacDingbat;
407.33 -
407.34 -/**
407.35 - * A table to convert to MacDingbat to Unicode
407.36 - *
407.37 - * @author ConverterGenerator tool
407.38 - */
407.39 -
407.40 -public class ByteToCharMacDingbat extends ByteToCharSingleByte {
407.41 -
407.42 - private final static MacDingbat nioCoder = new MacDingbat();
407.43 -
407.44 - public String getCharacterEncoding() {
407.45 - return "MacDingbat";
407.46 - }
407.47 -
407.48 - public ByteToCharMacDingbat() {
407.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
407.50 - }
407.51 -}
408.1 --- a/src/share/classes/sun/io/ByteToCharMacGreek.java Thu Sep 01 13:54:38 2011 -0700
408.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
408.3 @@ -1,48 +0,0 @@
408.4 -/*
408.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
408.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
408.7 - *
408.8 - * This code is free software; you can redistribute it and/or modify it
408.9 - * under the terms of the GNU General Public License version 2 only, as
408.10 - * published by the Free Software Foundation. Oracle designates this
408.11 - * particular file as subject to the "Classpath" exception as provided
408.12 - * by Oracle in the LICENSE file that accompanied this code.
408.13 - *
408.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
408.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
408.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
408.17 - * version 2 for more details (a copy is included in the LICENSE file that
408.18 - * accompanied this code).
408.19 - *
408.20 - * You should have received a copy of the GNU General Public License version
408.21 - * 2 along with this work; if not, write to the Free Software Foundation,
408.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
408.23 - *
408.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
408.25 - * or visit www.oracle.com if you need additional information or have any
408.26 - * questions.
408.27 - */
408.28 -
408.29 -
408.30 -package sun.io;
408.31 -
408.32 -import sun.nio.cs.ext.MacGreek;
408.33 -
408.34 -/**
408.35 - * A table to convert to MacGreek to Unicode
408.36 - *
408.37 - * @author ConverterGenerator tool
408.38 - */
408.39 -
408.40 -public class ByteToCharMacGreek extends ByteToCharSingleByte {
408.41 -
408.42 - private final static MacGreek nioCoder = new MacGreek();
408.43 -
408.44 - public String getCharacterEncoding() {
408.45 - return "MacGreek";
408.46 - }
408.47 -
408.48 - public ByteToCharMacGreek() {
408.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
408.50 - }
408.51 -}
409.1 --- a/src/share/classes/sun/io/ByteToCharMacHebrew.java Thu Sep 01 13:54:38 2011 -0700
409.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
409.3 @@ -1,48 +0,0 @@
409.4 -/*
409.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
409.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
409.7 - *
409.8 - * This code is free software; you can redistribute it and/or modify it
409.9 - * under the terms of the GNU General Public License version 2 only, as
409.10 - * published by the Free Software Foundation. Oracle designates this
409.11 - * particular file as subject to the "Classpath" exception as provided
409.12 - * by Oracle in the LICENSE file that accompanied this code.
409.13 - *
409.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
409.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
409.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
409.17 - * version 2 for more details (a copy is included in the LICENSE file that
409.18 - * accompanied this code).
409.19 - *
409.20 - * You should have received a copy of the GNU General Public License version
409.21 - * 2 along with this work; if not, write to the Free Software Foundation,
409.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
409.23 - *
409.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
409.25 - * or visit www.oracle.com if you need additional information or have any
409.26 - * questions.
409.27 - */
409.28 -
409.29 -
409.30 -package sun.io;
409.31 -
409.32 -import sun.nio.cs.ext.MacHebrew;
409.33 -
409.34 -/**
409.35 - * A table to convert to MacHebrew to Unicode
409.36 - *
409.37 - * @author ConverterGenerator tool
409.38 - */
409.39 -
409.40 -public class ByteToCharMacHebrew extends ByteToCharSingleByte {
409.41 -
409.42 - private final static MacHebrew nioCoder = new MacHebrew();
409.43 -
409.44 - public String getCharacterEncoding() {
409.45 - return "MacHebrew";
409.46 - }
409.47 -
409.48 - public ByteToCharMacHebrew() {
409.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
409.50 - }
409.51 -}
410.1 --- a/src/share/classes/sun/io/ByteToCharMacIceland.java Thu Sep 01 13:54:38 2011 -0700
410.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
410.3 @@ -1,48 +0,0 @@
410.4 -/*
410.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
410.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
410.7 - *
410.8 - * This code is free software; you can redistribute it and/or modify it
410.9 - * under the terms of the GNU General Public License version 2 only, as
410.10 - * published by the Free Software Foundation. Oracle designates this
410.11 - * particular file as subject to the "Classpath" exception as provided
410.12 - * by Oracle in the LICENSE file that accompanied this code.
410.13 - *
410.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
410.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
410.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
410.17 - * version 2 for more details (a copy is included in the LICENSE file that
410.18 - * accompanied this code).
410.19 - *
410.20 - * You should have received a copy of the GNU General Public License version
410.21 - * 2 along with this work; if not, write to the Free Software Foundation,
410.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
410.23 - *
410.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
410.25 - * or visit www.oracle.com if you need additional information or have any
410.26 - * questions.
410.27 - */
410.28 -
410.29 -
410.30 -package sun.io;
410.31 -
410.32 -import sun.nio.cs.ext.MacIceland;
410.33 -
410.34 -/**
410.35 - * A table to convert to MacIceland to Unicode
410.36 - *
410.37 - * @author ConverterGenerator tool
410.38 - */
410.39 -
410.40 -public class ByteToCharMacIceland extends ByteToCharSingleByte {
410.41 -
410.42 - private final static MacIceland nioCoder = new MacIceland();
410.43 -
410.44 - public String getCharacterEncoding() {
410.45 - return "MacIceland";
410.46 - }
410.47 -
410.48 - public ByteToCharMacIceland() {
410.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
410.50 - }
410.51 -}
411.1 --- a/src/share/classes/sun/io/ByteToCharMacRoman.java Thu Sep 01 13:54:38 2011 -0700
411.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
411.3 @@ -1,48 +0,0 @@
411.4 -/*
411.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
411.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
411.7 - *
411.8 - * This code is free software; you can redistribute it and/or modify it
411.9 - * under the terms of the GNU General Public License version 2 only, as
411.10 - * published by the Free Software Foundation. Oracle designates this
411.11 - * particular file as subject to the "Classpath" exception as provided
411.12 - * by Oracle in the LICENSE file that accompanied this code.
411.13 - *
411.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
411.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
411.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
411.17 - * version 2 for more details (a copy is included in the LICENSE file that
411.18 - * accompanied this code).
411.19 - *
411.20 - * You should have received a copy of the GNU General Public License version
411.21 - * 2 along with this work; if not, write to the Free Software Foundation,
411.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
411.23 - *
411.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
411.25 - * or visit www.oracle.com if you need additional information or have any
411.26 - * questions.
411.27 - */
411.28 -
411.29 -
411.30 -package sun.io;
411.31 -
411.32 -import sun.nio.cs.ext.MacRoman;
411.33 -
411.34 -/**
411.35 - * A table to convert to MacRoman to Unicode
411.36 - *
411.37 - * @author ConverterGenerator tool
411.38 - */
411.39 -
411.40 -public class ByteToCharMacRoman extends ByteToCharSingleByte {
411.41 -
411.42 - private final static MacRoman nioCoder = new MacRoman();
411.43 -
411.44 - public String getCharacterEncoding() {
411.45 - return "MacRoman";
411.46 - }
411.47 -
411.48 - public ByteToCharMacRoman() {
411.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
411.50 - }
411.51 -}
412.1 --- a/src/share/classes/sun/io/ByteToCharMacRomania.java Thu Sep 01 13:54:38 2011 -0700
412.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
412.3 @@ -1,48 +0,0 @@
412.4 -/*
412.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
412.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
412.7 - *
412.8 - * This code is free software; you can redistribute it and/or modify it
412.9 - * under the terms of the GNU General Public License version 2 only, as
412.10 - * published by the Free Software Foundation. Oracle designates this
412.11 - * particular file as subject to the "Classpath" exception as provided
412.12 - * by Oracle in the LICENSE file that accompanied this code.
412.13 - *
412.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
412.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
412.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
412.17 - * version 2 for more details (a copy is included in the LICENSE file that
412.18 - * accompanied this code).
412.19 - *
412.20 - * You should have received a copy of the GNU General Public License version
412.21 - * 2 along with this work; if not, write to the Free Software Foundation,
412.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
412.23 - *
412.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
412.25 - * or visit www.oracle.com if you need additional information or have any
412.26 - * questions.
412.27 - */
412.28 -
412.29 -
412.30 -package sun.io;
412.31 -
412.32 -import sun.nio.cs.ext.MacRomania;
412.33 -
412.34 -/**
412.35 - * A table to convert to MacRomania to Unicode
412.36 - *
412.37 - * @author ConverterGenerator tool
412.38 - */
412.39 -
412.40 -public class ByteToCharMacRomania extends ByteToCharSingleByte {
412.41 -
412.42 - private final static MacRomania nioCoder = new MacRomania();
412.43 -
412.44 - public String getCharacterEncoding() {
412.45 - return "MacRomania";
412.46 - }
412.47 -
412.48 - public ByteToCharMacRomania() {
412.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
412.50 - }
412.51 -}
413.1 --- a/src/share/classes/sun/io/ByteToCharMacSymbol.java Thu Sep 01 13:54:38 2011 -0700
413.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
413.3 @@ -1,48 +0,0 @@
413.4 -/*
413.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
413.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
413.7 - *
413.8 - * This code is free software; you can redistribute it and/or modify it
413.9 - * under the terms of the GNU General Public License version 2 only, as
413.10 - * published by the Free Software Foundation. Oracle designates this
413.11 - * particular file as subject to the "Classpath" exception as provided
413.12 - * by Oracle in the LICENSE file that accompanied this code.
413.13 - *
413.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
413.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
413.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
413.17 - * version 2 for more details (a copy is included in the LICENSE file that
413.18 - * accompanied this code).
413.19 - *
413.20 - * You should have received a copy of the GNU General Public License version
413.21 - * 2 along with this work; if not, write to the Free Software Foundation,
413.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
413.23 - *
413.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
413.25 - * or visit www.oracle.com if you need additional information or have any
413.26 - * questions.
413.27 - */
413.28 -
413.29 -
413.30 -package sun.io;
413.31 -
413.32 -import sun.nio.cs.ext.MacSymbol;
413.33 -
413.34 -/**
413.35 - * A table to convert to MacSymbol to Unicode
413.36 - *
413.37 - * @author ConverterGenerator tool
413.38 - */
413.39 -
413.40 -public class ByteToCharMacSymbol extends ByteToCharSingleByte {
413.41 -
413.42 - private final static MacSymbol nioCoder = new MacSymbol();
413.43 -
413.44 - public String getCharacterEncoding() {
413.45 - return "MacSymbol";
413.46 - }
413.47 -
413.48 - public ByteToCharMacSymbol() {
413.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
413.50 - }
413.51 -}
414.1 --- a/src/share/classes/sun/io/ByteToCharMacThai.java Thu Sep 01 13:54:38 2011 -0700
414.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
414.3 @@ -1,48 +0,0 @@
414.4 -/*
414.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
414.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
414.7 - *
414.8 - * This code is free software; you can redistribute it and/or modify it
414.9 - * under the terms of the GNU General Public License version 2 only, as
414.10 - * published by the Free Software Foundation. Oracle designates this
414.11 - * particular file as subject to the "Classpath" exception as provided
414.12 - * by Oracle in the LICENSE file that accompanied this code.
414.13 - *
414.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
414.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
414.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
414.17 - * version 2 for more details (a copy is included in the LICENSE file that
414.18 - * accompanied this code).
414.19 - *
414.20 - * You should have received a copy of the GNU General Public License version
414.21 - * 2 along with this work; if not, write to the Free Software Foundation,
414.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
414.23 - *
414.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
414.25 - * or visit www.oracle.com if you need additional information or have any
414.26 - * questions.
414.27 - */
414.28 -
414.29 -
414.30 -package sun.io;
414.31 -
414.32 -import sun.nio.cs.ext.MacThai;
414.33 -
414.34 -/**
414.35 - * A table to convert to MacThai to Unicode
414.36 - *
414.37 - * @author ConverterGenerator tool
414.38 - */
414.39 -
414.40 -public class ByteToCharMacThai extends ByteToCharSingleByte {
414.41 -
414.42 - private final static MacThai nioCoder = new MacThai();
414.43 -
414.44 - public String getCharacterEncoding() {
414.45 - return "MacThai";
414.46 - }
414.47 -
414.48 - public ByteToCharMacThai() {
414.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
414.50 - }
414.51 -}
415.1 --- a/src/share/classes/sun/io/ByteToCharMacTurkish.java Thu Sep 01 13:54:38 2011 -0700
415.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
415.3 @@ -1,48 +0,0 @@
415.4 -/*
415.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
415.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
415.7 - *
415.8 - * This code is free software; you can redistribute it and/or modify it
415.9 - * under the terms of the GNU General Public License version 2 only, as
415.10 - * published by the Free Software Foundation. Oracle designates this
415.11 - * particular file as subject to the "Classpath" exception as provided
415.12 - * by Oracle in the LICENSE file that accompanied this code.
415.13 - *
415.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
415.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
415.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
415.17 - * version 2 for more details (a copy is included in the LICENSE file that
415.18 - * accompanied this code).
415.19 - *
415.20 - * You should have received a copy of the GNU General Public License version
415.21 - * 2 along with this work; if not, write to the Free Software Foundation,
415.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
415.23 - *
415.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
415.25 - * or visit www.oracle.com if you need additional information or have any
415.26 - * questions.
415.27 - */
415.28 -
415.29 -
415.30 -package sun.io;
415.31 -
415.32 -import sun.nio.cs.ext.MacTurkish;
415.33 -
415.34 -/**
415.35 - * A table to convert to MacTurkish to Unicode
415.36 - *
415.37 - * @author ConverterGenerator tool
415.38 - */
415.39 -
415.40 -public class ByteToCharMacTurkish extends ByteToCharSingleByte {
415.41 -
415.42 - private final static MacTurkish nioCoder = new MacTurkish();
415.43 -
415.44 - public String getCharacterEncoding() {
415.45 - return "MacTurkish";
415.46 - }
415.47 -
415.48 - public ByteToCharMacTurkish() {
415.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
415.50 - }
415.51 -}
416.1 --- a/src/share/classes/sun/io/ByteToCharMacUkraine.java Thu Sep 01 13:54:38 2011 -0700
416.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
416.3 @@ -1,48 +0,0 @@
416.4 -/*
416.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
416.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
416.7 - *
416.8 - * This code is free software; you can redistribute it and/or modify it
416.9 - * under the terms of the GNU General Public License version 2 only, as
416.10 - * published by the Free Software Foundation. Oracle designates this
416.11 - * particular file as subject to the "Classpath" exception as provided
416.12 - * by Oracle in the LICENSE file that accompanied this code.
416.13 - *
416.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
416.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
416.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
416.17 - * version 2 for more details (a copy is included in the LICENSE file that
416.18 - * accompanied this code).
416.19 - *
416.20 - * You should have received a copy of the GNU General Public License version
416.21 - * 2 along with this work; if not, write to the Free Software Foundation,
416.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
416.23 - *
416.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
416.25 - * or visit www.oracle.com if you need additional information or have any
416.26 - * questions.
416.27 - */
416.28 -
416.29 -
416.30 -package sun.io;
416.31 -
416.32 -import sun.nio.cs.ext.MacUkraine;
416.33 -
416.34 -/**
416.35 - * A table to convert to MacUkraine to Unicode
416.36 - *
416.37 - * @author ConverterGenerator tool
416.38 - */
416.39 -
416.40 -public class ByteToCharMacUkraine extends ByteToCharSingleByte {
416.41 -
416.42 - private final static MacUkraine nioCoder = new MacUkraine();
416.43 -
416.44 - public String getCharacterEncoding() {
416.45 - return "MacUkraine";
416.46 - }
416.47 -
416.48 - public ByteToCharMacUkraine() {
416.49 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
416.50 - }
416.51 -}
417.1 --- a/src/share/classes/sun/io/ByteToCharPCK.java Thu Sep 01 13:54:38 2011 -0700
417.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
417.3 @@ -1,79 +0,0 @@
417.4 -/*
417.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
417.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
417.7 - *
417.8 - * This code is free software; you can redistribute it and/or modify it
417.9 - * under the terms of the GNU General Public License version 2 only, as
417.10 - * published by the Free Software Foundation. Oracle designates this
417.11 - * particular file as subject to the "Classpath" exception as provided
417.12 - * by Oracle in the LICENSE file that accompanied this code.
417.13 - *
417.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
417.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
417.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
417.17 - * version 2 for more details (a copy is included in the LICENSE file that
417.18 - * accompanied this code).
417.19 - *
417.20 - * You should have received a copy of the GNU General Public License version
417.21 - * 2 along with this work; if not, write to the Free Software Foundation,
417.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
417.23 - *
417.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
417.25 - * or visit www.oracle.com if you need additional information or have any
417.26 - * questions.
417.27 - */
417.28 -
417.29 -package sun.io;
417.30 -
417.31 -import sun.nio.cs.ext.JIS_X_0208_Solaris_Decoder;
417.32 -
417.33 -/**
417.34 - *
417.35 - * @author Limin Shi
417.36 - * @author Mark Son-Bell
417.37 - * @author Ian Little
417.38 - *
417.39 - *
417.40 - * PCK Converter for Solaris ja locales
417.41 - * refer to : Solaris manpage man PCK(5)
417.42 - * Incorporates mappings from NEC row 13 and IBM select extension chars
417.43 - * in addition to those defined within JIS X0208:1997 (bugID: 4765370)
417.44 - *
417.45 - */
417.46 -
417.47 -public class ByteToCharPCK extends ByteToCharSJIS {
417.48 - ByteToCharJIS0201 bcJIS0201 = new ByteToCharJIS0201();
417.49 - ByteToCharJIS0208_Solaris bcJIS0208 = new ByteToCharJIS0208_Solaris();
417.50 -
417.51 - public String getCharacterEncoding() {
417.52 - return "PCK";
417.53 - }
417.54 -
417.55 - protected char convSingleByte(int b) {
417.56 - // If the high bits are all off, it's ASCII == Unicode
417.57 - if ((b & 0xFF80) == 0) {
417.58 - return (char)b;
417.59 - }
417.60 - return bcJIS0201.getUnicode(b);
417.61 - }
417.62 -
417.63 - protected char getUnicode(int c1, int c2) {
417.64 - char outChar;
417.65 - if ((outChar = super.getUnicode(c1, c2)) != '\uFFFD') {
417.66 - // Map JIS X 0208:1983 0x213D <--> U+2015
417.67 - return ((outChar != '\u2014')? outChar: '\u2015');
417.68 - } else {
417.69 - int adjust = c2 < 0x9F ? 1 : 0;
417.70 - int rowOffset = c1 < 0xA0 ? 0x70 : 0xB0;
417.71 - int cellOffset = (adjust == 1) ? (c2 > 0x7F ? 0x20 : 0x1F) : 0x7E;
417.72 - int b1 = ((c1 - rowOffset) << 1) - adjust;
417.73 - int b2 = c2 - cellOffset;
417.74 - outChar = bcJIS0208.getUnicode(b1, b2);
417.75 - return outChar;
417.76 - }
417.77 - }
417.78 -
417.79 - String prt(int i) {
417.80 - return Integer.toString(i,16);
417.81 - }
417.82 -}
418.1 --- a/src/share/classes/sun/io/ByteToCharSJIS.java Thu Sep 01 13:54:38 2011 -0700
418.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
418.3 @@ -1,65 +0,0 @@
418.4 -/*
418.5 - * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
418.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
418.7 - *
418.8 - * This code is free software; you can redistribute it and/or modify it
418.9 - * under the terms of the GNU General Public License version 2 only, as
418.10 - * published by the Free Software Foundation. Oracle designates this
418.11 - * particular file as subject to the "Classpath" exception as provided
418.12 - * by Oracle in the LICENSE file that accompanied this code.
418.13 - *
418.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
418.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
418.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
418.17 - * version 2 for more details (a copy is included in the LICENSE file that
418.18 - * accompanied this code).
418.19 - *
418.20 - * You should have received a copy of the GNU General Public License version
418.21 - * 2 along with this work; if not, write to the Free Software Foundation,
418.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
418.23 - *
418.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
418.25 - * or visit www.oracle.com if you need additional information or have any
418.26 - * questions.
418.27 - */
418.28 -
418.29 -package sun.io;
418.30 -
418.31 -/**
418.32 - * The SJIS converters follow the Shift JIS definition in the JIS
418.33 - * X0208:1997 standard as much as possible. The MS932 converters must
418.34 - * be used where the Microsoft Code Page 932 character repertoire and
418.35 - * Unicode mappings are required.
418.36 - *
418.37 - * @author Limin Shi
418.38 - * @author Mark Son-Bell
418.39 - */
418.40 -
418.41 -public class ByteToCharSJIS extends ByteToCharJIS0208 {
418.42 - ByteToCharJIS0201 bcJIS0201 = new ByteToCharJIS0201();
418.43 -
418.44 - public String getCharacterEncoding() {
418.45 - return "SJIS";
418.46 - }
418.47 -
418.48 - protected char convSingleByte(int b) {
418.49 - // If the high bits are all off, it's ASCII == Unicode
418.50 - if ((b & 0xFF80) == 0) {
418.51 - return (char)b;
418.52 - }
418.53 - return bcJIS0201.getUnicode(b);
418.54 - }
418.55 -
418.56 - protected char getUnicode(int c1, int c2) {
418.57 - int adjust = c2 < 0x9F ? 1 : 0;
418.58 - int rowOffset = c1 < 0xA0 ? 0x70 : 0xB0;
418.59 - int cellOffset = (adjust == 1) ? (c2 > 0x7F ? 0x20 : 0x1F) : 0x7E;
418.60 - int b1 = ((c1 - rowOffset) << 1) - adjust;
418.61 - int b2 = c2 - cellOffset;
418.62 - return super.getUnicode(b1, b2);
418.63 - }
418.64 -
418.65 - String prt(int i) {
418.66 - return Integer.toString(i,16);
418.67 - }
418.68 -}
419.1 --- a/src/share/classes/sun/io/ByteToCharSingleByte.java Thu Sep 01 13:54:38 2011 -0700
419.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
419.3 @@ -1,137 +0,0 @@
419.4 -/*
419.5 - * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
419.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
419.7 - *
419.8 - * This code is free software; you can redistribute it and/or modify it
419.9 - * under the terms of the GNU General Public License version 2 only, as
419.10 - * published by the Free Software Foundation. Oracle designates this
419.11 - * particular file as subject to the "Classpath" exception as provided
419.12 - * by Oracle in the LICENSE file that accompanied this code.
419.13 - *
419.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
419.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
419.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
419.17 - * version 2 for more details (a copy is included in the LICENSE file that
419.18 - * accompanied this code).
419.19 - *
419.20 - * You should have received a copy of the GNU General Public License version
419.21 - * 2 along with this work; if not, write to the Free Software Foundation,
419.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
419.23 - *
419.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
419.25 - * or visit www.oracle.com if you need additional information or have any
419.26 - * questions.
419.27 - */
419.28 -
419.29 -package sun.io;
419.30 -
419.31 -/**
419.32 - * A table driven conversion from byte to char for single byte character sets.
419.33 - * The needed data tables will reside in a character set specific subclass.
419.34 - *
419.35 - * @author Lloyd Honomichl
419.36 - * @author Asmus Freytag
419.37 - */
419.38 -public abstract class ByteToCharSingleByte extends ByteToCharConverter {
419.39 -
419.40 - /**
419.41 - * Mapping table. Values supplied by subclass
419.42 - */
419.43 - protected String byteToCharTable;
419.44 -
419.45 - public String getByteToCharTable() {
419.46 - return byteToCharTable;
419.47 - }
419.48 -
419.49 - public int flush(char[] output, int outStart, int outEnd) {
419.50 - byteOff = charOff = 0;
419.51 - return 0;
419.52 - }
419.53 -
419.54 - /**
419.55 - * Converts bytes to characters according to the selected character
419.56 - * encoding.
419.57 - * Maintains internal state, so that conversions that result in
419.58 - * exceptions can be restarted by calling convert again, with
419.59 - * appropriately modified parameters.
419.60 - * Call reset before converting input that is not a continuation of
419.61 - * the previous call.
419.62 - * @return the number of characters written to output.
419.63 - * @param input byte array containing text in character set
419.64 - * @param inStart offset in input array
419.65 - * @param inEnd offset of last byte to be converted
419.66 - * @param output character array to receive conversion result
419.67 - * @param outStart starting offset
419.68 - * @param outEnd offset of last character to be written to
419.69 - * @throw MalformedInputException for any sequence of bytes that is
419.70 - * illegal for the input character set, including any partial multi-byte
419.71 - * sequence which occurs at the end of an input buffer.
419.72 - * @throw UnsupportedCharacterException for any sequence of bytes that
419.73 - * contain a character not supported in the current conversion.
419.74 - * @throw BufferFullException whenever the output buffer is full
419.75 - * before the input is exhausted.
419.76 - * @see #reset
419.77 - */
419.78 - public int convert(byte[] input, int inOff, int inEnd,
419.79 - char[] output, int outOff, int outEnd)
419.80 - throws UnknownCharacterException,
419.81 - MalformedInputException,
419.82 - ConversionBufferFullException
419.83 - {
419.84 - char outputChar;
419.85 - int byteIndex;
419.86 -
419.87 - charOff = outOff;
419.88 - byteOff = inOff;
419.89 -
419.90 - // Loop until we hit the end of the input
419.91 - while(byteOff < inEnd) {
419.92 -
419.93 - byteIndex = input[byteOff];
419.94 -
419.95 - /* old source
419.96 - *outputChar = byteToCharTable[input[byteOff] + 128];
419.97 - */
419.98 - // Lookup the output character
419.99 - outputChar = getUnicode(byteIndex);
419.100 -
419.101 - // Is the output unmappable?
419.102 - if (outputChar == '\uFFFD') {
419.103 - if (subMode) {
419.104 - outputChar = subChars[0];
419.105 - } else {
419.106 - badInputLength = 1;
419.107 - throw new UnknownCharacterException();
419.108 - }
419.109 - }
419.110 -
419.111 - // If we don't have room for the output, throw an exception
419.112 - if (charOff >= outEnd)
419.113 - throw new ConversionBufferFullException();
419.114 -
419.115 - // Put the character in the output buffer
419.116 - output[charOff]= outputChar;
419.117 - charOff++;
419.118 - byteOff++;
419.119 - }
419.120 -
419.121 - // Return the length written to the output buffer
419.122 - return charOff-outOff;
419.123 - }
419.124 -
419.125 - protected char getUnicode(int byteIndex) {
419.126 - int n = byteIndex + 128;
419.127 - if (n >= byteToCharTable.length() || n < 0)
419.128 - return '\uFFFD';
419.129 - return byteToCharTable.charAt(n);
419.130 - }
419.131 -
419.132 - /**
419.133 - * Resets the converter.
419.134 - * Call this method to reset the converter to its initial state
419.135 - */
419.136 - public void reset() {
419.137 - byteOff = charOff = 0;
419.138 - }
419.139 -
419.140 -}
420.1 --- a/src/share/classes/sun/io/ByteToCharTIS620.java Thu Sep 01 13:54:38 2011 -0700
420.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
420.3 @@ -1,47 +0,0 @@
420.4 -/*
420.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
420.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
420.7 - *
420.8 - * This code is free software; you can redistribute it and/or modify it
420.9 - * under the terms of the GNU General Public License version 2 only, as
420.10 - * published by the Free Software Foundation. Oracle designates this
420.11 - * particular file as subject to the "Classpath" exception as provided
420.12 - * by Oracle in the LICENSE file that accompanied this code.
420.13 - *
420.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
420.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
420.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
420.17 - * version 2 for more details (a copy is included in the LICENSE file that
420.18 - * accompanied this code).
420.19 - *
420.20 - * You should have received a copy of the GNU General Public License version
420.21 - * 2 along with this work; if not, write to the Free Software Foundation,
420.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
420.23 - *
420.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
420.25 - * or visit www.oracle.com if you need additional information or have any
420.26 - * questions.
420.27 - */
420.28 -
420.29 -package sun.io;
420.30 -
420.31 -import sun.nio.cs.ext.TIS_620;
420.32 -
420.33 -/**
420.34 - * A table to convert TIS620 to Unicode
420.35 - *
420.36 - * @author ConverterGenerator tool
420.37 - */
420.38 -
420.39 -public class ByteToCharTIS620 extends ByteToCharSingleByte {
420.40 -
420.41 - private final static TIS_620 nioCoder = new TIS_620();
420.42 -
420.43 - public String getCharacterEncoding() {
420.44 - return "TIS620";
420.45 - }
420.46 -
420.47 - public ByteToCharTIS620() {
420.48 - super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
420.49 - }
420.50 -}
421.1 --- a/src/share/classes/sun/io/ByteToCharUTF16.java Thu Sep 01 13:54:38 2011 -0700
421.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
421.3 @@ -1,44 +0,0 @@
421.4 -/*
421.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
421.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
421.7 - *
421.8 - * This code is free software; you can redistribute it and/or modify it
421.9 - * under the terms of the GNU General Public License version 2 only, as
421.10 - * published by the Free Software Foundation. Oracle designates this
421.11 - * particular file as subject to the "Classpath" exception as provided
421.12 - * by Oracle in the LICENSE file that accompanied this code.
421.13 - *
421.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
421.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
421.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
421.17 - * version 2 for more details (a copy is included in the LICENSE file that
421.18 - * accompanied this code).
421.19 - *
421.20 - * You should have received a copy of the GNU General Public License version
421.21 - * 2 along with this work; if not, write to the Free Software Foundation,
421.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
421.23 - *
421.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
421.25 - * or visit www.oracle.com if you need additional information or have any
421.26 - * questions.
421.27 - */
421.28 -
421.29 -package sun.io;
421.30 -
421.31 -
421.32 -/**
421.33 - * Convert byte arrays containing Unicode characters into arrays of actual
421.34 - * Unicode characters, assuming an initial byte-order mark.
421.35 - */
421.36 -
421.37 -public class ByteToCharUTF16 extends ByteToCharUnicode {
421.38 -
421.39 - public ByteToCharUTF16() {
421.40 - super(AUTO, true);
421.41 - }
421.42 -
421.43 - public String getCharacterEncoding() {
421.44 - return "UTF-16";
421.45 - }
421.46 -
421.47 -}
422.1 --- a/src/share/classes/sun/io/ByteToCharUTF8.java Thu Sep 01 13:54:38 2011 -0700
422.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
422.3 @@ -1,200 +0,0 @@
422.4 -/*
422.5 - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
422.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
422.7 - *
422.8 - * This code is free software; you can redistribute it and/or modify it
422.9 - * under the terms of the GNU General Public License version 2 only, as
422.10 - * published by the Free Software Foundation. Oracle designates this
422.11 - * particular file as subject to the "Classpath" exception as provided
422.12 - * by Oracle in the LICENSE file that accompanied this code.
422.13 - *
422.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
422.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
422.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
422.17 - * version 2 for more details (a copy is included in the LICENSE file that
422.18 - * accompanied this code).
422.19 - *
422.20 - * You should have received a copy of the GNU General Public License version
422.21 - * 2 along with this work; if not, write to the Free Software Foundation,
422.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
422.23 - *
422.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
422.25 - * or visit www.oracle.com if you need additional information or have any
422.26 - * questions.
422.27 - */
422.28 -package sun.io;
422.29 -
422.30 -
422.31 -/**
422.32 - * UCS Transformation Format 8 (UTF-8) -> UCS2 (UTF16) converter
422.33 - *
422.34 - * see CharToByteUTF8.java about UTF-8 format
422.35 - */
422.36 -
422.37 -public class ByteToCharUTF8 extends ByteToCharConverter {
422.38 -
422.39 - private int savedSize;
422.40 - private byte[] savedBytes;
422.41 -
422.42 - public ByteToCharUTF8() {
422.43 - super();
422.44 - savedSize = 0;
422.45 - savedBytes = new byte[5];
422.46 - }
422.47 -
422.48 - public int flush(char[] output, int outStart, int outEnd)
422.49 - throws MalformedInputException
422.50 - {
422.51 - if (savedSize != 0) {
422.52 - savedSize = 0;
422.53 - badInputLength = 0;
422.54 - throw new MalformedInputException();
422.55 - }
422.56 - byteOff = charOff = 0;
422.57 - return 0;
422.58 - }
422.59 -
422.60 - /**
422.61 - * Character converson
422.62 - */
422.63 - public int convert(byte[] input, int inOff, int inEnd,
422.64 - char[] output, int outOff, int outEnd)
422.65 - throws MalformedInputException, ConversionBufferFullException
422.66 - {
422.67 - int byte1, byte2, byte3, byte4;
422.68 - char[] outputChar = new char[2];
422.69 - int outputSize;
422.70 - int byteOffAdjustment = 0;
422.71 -
422.72 - if (savedSize != 0) {
422.73 - byte[] newBuf;
422.74 - newBuf = new byte[inEnd - inOff + savedSize];
422.75 - for (int i = 0; i < savedSize; i++) {
422.76 - newBuf[i] = savedBytes[i];
422.77 - }
422.78 - System.arraycopy(input, inOff, newBuf, savedSize, inEnd - inOff);
422.79 - input = newBuf;
422.80 - inOff = 0;
422.81 - inEnd = newBuf.length;
422.82 - byteOffAdjustment = -savedSize;
422.83 - savedSize = 0;
422.84 - }
422.85 -
422.86 - charOff = outOff;
422.87 - byteOff = inOff;
422.88 - int startByteOff;
422.89 -
422.90 - while(byteOff < inEnd) {
422.91 -
422.92 - startByteOff = byteOff;
422.93 - byte1 = input[byteOff++] & 0xff;
422.94 -
422.95 - if ((byte1 & 0x80) == 0){
422.96 - outputChar[0] = (char)byte1;
422.97 - outputSize = 1;
422.98 - } else if ((byte1 & 0xe0) == 0xc0) {
422.99 - if (byteOff >= inEnd) {
422.100 - savedSize = 1;
422.101 - savedBytes[0] = (byte)byte1;
422.102 - break;
422.103 - }
422.104 - byte2 = input[byteOff++] & 0xff;
422.105 - if ((byte2 & 0xc0) != 0x80) {
422.106 - badInputLength = 2;
422.107 - byteOff += byteOffAdjustment;
422.108 - throw new MalformedInputException();
422.109 - }
422.110 - outputChar[0] = (char)(((byte1 & 0x1f) << 6) | (byte2 & 0x3f));
422.111 - outputSize = 1;
422.112 - } else if ((byte1 & 0xf0) == 0xe0){
422.113 - if (byteOff + 1 >= inEnd) {
422.114 - savedBytes[0] = (byte)byte1;
422.115 - if (byteOff >= inEnd) {
422.116 - savedSize = 1;
422.117 - } else {
422.118 - savedSize = 2;
422.119 - savedBytes[1] = input[byteOff++];
422.120 - }
422.121 - break;
422.122 - }
422.123 - byte2 = input[byteOff++] & 0xff;
422.124 - byte3 = input[byteOff++] & 0xff;
422.125 - if ((byte2 & 0xc0) != 0x80 || (byte3 & 0xc0) != 0x80) {
422.126 - badInputLength = 3;
422.127 - byteOff += byteOffAdjustment;
422.128 - throw new MalformedInputException();
422.129 - }
422.130 - outputChar[0] = (char)(((byte1 & 0x0f) << 12)
422.131 - | ((byte2 & 0x3f) << 6)
422.132 - | (byte3 & 0x3f));
422.133 - outputSize = 1;
422.134 - } else if ((byte1 & 0xf8) == 0xf0) {
422.135 - if (byteOff + 2 >= inEnd) {
422.136 - savedBytes[0] = (byte)byte1;
422.137 - if (byteOff >= inEnd) {
422.138 - savedSize = 1;
422.139 - } else if (byteOff + 1 >= inEnd) {
422.140 - savedSize = 2;
422.141 - savedBytes[1] = input[byteOff++];
422.142 - } else {
422.143 - savedSize = 3;
422.144 - savedBytes[1] = input[byteOff++];
422.145 - savedBytes[2] = input[byteOff++];
422.146 - }
422.147 - break;
422.148 - }
422.149 - byte2 = input[byteOff++] & 0xff;
422.150 - byte3 = input[byteOff++] & 0xff;
422.151 - byte4 = input[byteOff++] & 0xff;
422.152 - if ((byte2 & 0xc0) != 0x80 ||
422.153 - (byte3 & 0xc0) != 0x80 ||
422.154 - (byte4 & 0xc0) != 0x80) {
422.155 - badInputLength = 4;
422.156 - byteOff += byteOffAdjustment;
422.157 - throw new MalformedInputException();
422.158 - }
422.159 - // this byte sequence is UTF16 character
422.160 - int ucs4 = (0x07 & byte1) << 18 |
422.161 - (0x3f & byte2) << 12 |
422.162 - (0x3f & byte3) << 6 |
422.163 - (0x3f & byte4);
422.164 - outputChar[0] = (char)((ucs4 - 0x10000) / 0x400 + 0xd800);
422.165 - outputChar[1] = (char)((ucs4 - 0x10000) % 0x400 + 0xdc00);
422.166 - outputSize = 2;
422.167 - } else {
422.168 - badInputLength = 1;
422.169 - byteOff += byteOffAdjustment;
422.170 - throw new MalformedInputException();
422.171 - }
422.172 -
422.173 - if (charOff + outputSize > outEnd) {
422.174 - byteOff = startByteOff;
422.175 - byteOff += byteOffAdjustment;
422.176 - throw new ConversionBufferFullException();
422.177 - }
422.178 -
422.179 - for (int i = 0; i < outputSize; i++) {
422.180 - output[charOff + i] = outputChar[i];
422.181 - }
422.182 - charOff += outputSize;
422.183 - }
422.184 -
422.185 - byteOff += byteOffAdjustment;
422.186 - return charOff - outOff;
422.187 - }
422.188 -
422.189 - /*
422.190 - * Return the character set id
422.191 - */
422.192 - public String getCharacterEncoding() {
422.193 - return "UTF8";
422.194 - }
422.195 -
422.196 - /*
422.197 - * Reset after finding bad input
422.198 - */
422.199 - public void reset() {
422.200 - byteOff = charOff = 0;
422.201 - savedSize = 0;
422.202 - }
422.203 -}
423.1 --- a/src/share/classes/sun/io/ByteToCharUnicode.java Thu Sep 01 13:54:38 2011 -0700
423.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
423.3 @@ -1,220 +0,0 @@
423.4 -/*
423.5 - * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
423.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
423.7 - *
423.8 - * This code is free software; you can redistribute it and/or modify it
423.9 - * under the terms of the GNU General Public License version 2 only, as
423.10 - * published by the Free Software Foundation. Oracle designates this
423.11 - * particular file as subject to the "Classpath" exception as provided
423.12 - * by Oracle in the LICENSE file that accompanied this code.
423.13 - *
423.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
423.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
423.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
423.17 - * version 2 for more details (a copy is included in the LICENSE file that
423.18 - * accompanied this code).
423.19 - *
423.20 - * You should have received a copy of the GNU General Public License version
423.21 - * 2 along with this work; if not, write to the Free Software Foundation,
423.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
423.23 - *
423.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
423.25 - * or visit www.oracle.com if you need additional information or have any
423.26 - * questions.
423.27 - */
423.28 -
423.29 -package sun.io;
423.30 -import java.io.*;
423.31 -
423.32 -
423.33 -/**
423.34 - * Convert byte arrays containing Unicode characters into arrays of actual
423.35 - * Unicode characters. This class may be used directly, in which case it
423.36 - * expects the input byte array to begin with a byte-order mark, or it may be
423.37 - * subclassed in order to preset the byte order and mark behavior.
423.38 - *
423.39 - * <p> Whether or not a mark is expected, if a mark that does not match the
423.40 - * established byte order is later discovered then a
423.41 - * <tt>MalformedInputException</tt> will be thrown by the <tt>convert</tt>
423.42 - * method. If a correct mark is seen later in the input stream, it is passed
423.43 - * through as a character.
423.44 - *
423.45 - * @see ByteToCharUnicodeLittle
423.46 - * @see ByteToCharUnicodeLittleUnmarked
423.47 - * @see ByteToCharUnicodeBig
423.48 - * @see ByteToCharUnicodeBigUnmarked
423.49 - *
423.50 - * @author Mark Reinhold
423.51 - */
423.52 -
423.53 -public class ByteToCharUnicode extends ByteToCharConverter {
423.54 -
423.55 - static final char BYTE_ORDER_MARK = (char) 0xfeff;
423.56 - static final char REVERSED_MARK = (char) 0xfffe;
423.57 -
423.58 - static final int AUTO = 0;
423.59 - static final int BIG = 1;
423.60 - static final int LITTLE = 2;
423.61 -
423.62 - int originalByteOrder; /* Byte order specified at creation */
423.63 - int byteOrder; /* Byte order in use */
423.64 - boolean usesMark; /* Look for a mark and interpret it */
423.65 -
423.66 - /**
423.67 - * Creates a Unicode byte-to-char converter that expects the first pair of
423.68 - * input bytes to be a byte-order mark, which will be interpreted and
423.69 - * discarded. If the first pair of bytes is not such a mark then a
423.70 - * <tt>MalformedInputException</tt> will be thrown by the convert method.
423.71 - */
423.72 - public ByteToCharUnicode() {
423.73 - originalByteOrder = byteOrder = AUTO;
423.74 - usesMark = true;
423.75 - }
423.76 -
423.77 - /**
423.78 - * Creates a Unicode byte-to-char converter that uses the given byte order
423.79 - * and may or may not insist upon an initial byte-order mark.
423.80 - */
423.81 - protected ByteToCharUnicode(int bo, boolean m) {
423.82 - originalByteOrder = byteOrder = bo;
423.83 - usesMark = m;
423.84 - }
423.85 -
423.86 - public String getCharacterEncoding() {
423.87 - switch (originalByteOrder) {
423.88 - case BIG:
423.89 - return usesMark ? "UnicodeBig" : "UnicodeBigUnmarked";
423.90 - case LITTLE:
423.91 - return usesMark ? "UnicodeLittle" : "UnicodeLittleUnmarked";
423.92 - default:
423.93 - return "Unicode";
423.94 - }
423.95 - }
423.96 -
423.97 - boolean started = false;
423.98 - int leftOverByte;
423.99 - boolean leftOver = false;
423.100 -
423.101 - public int convert(byte[] in, int inOff, int inEnd,
423.102 - char[] out, int outOff, int outEnd)
423.103 - throws ConversionBufferFullException, MalformedInputException
423.104 - {
423.105 - byteOff = inOff;
423.106 - charOff = outOff;
423.107 -
423.108 - if (inOff >= inEnd)
423.109 - return 0;
423.110 -
423.111 - int b1, b2;
423.112 - int bc = 0;
423.113 - int inI = inOff, outI = outOff;
423.114 -
423.115 - if (leftOver) {
423.116 - b1 = leftOverByte & 0xff;
423.117 - leftOver = false;
423.118 - }
423.119 - else {
423.120 - b1 = in[inI++] & 0xff;
423.121 - }
423.122 - bc = 1;
423.123 -
423.124 - if (usesMark && !started) { /* Read initial byte-order mark */
423.125 - if (inI < inEnd) {
423.126 - b2 = in[inI++] & 0xff;
423.127 - bc = 2;
423.128 -
423.129 - char c = (char) ((b1 << 8) | b2);
423.130 - int bo = AUTO;
423.131 -
423.132 - if (c == BYTE_ORDER_MARK)
423.133 - bo = BIG;
423.134 - else if (c == REVERSED_MARK)
423.135 - bo = LITTLE;
423.136 -
423.137 - if (byteOrder == AUTO) {
423.138 - if (bo == AUTO) {
423.139 - badInputLength = bc;
423.140 - throw new
423.141 - MalformedInputException("Missing byte-order mark");
423.142 - }
423.143 - byteOrder = bo;
423.144 - if (inI < inEnd) {
423.145 - b1 = in[inI++] & 0xff;
423.146 - bc = 1;
423.147 - }
423.148 - }
423.149 - else if (bo == AUTO) {
423.150 - inI--;
423.151 - bc = 1;
423.152 - }
423.153 - else if (byteOrder == bo) {
423.154 - if (inI < inEnd) {
423.155 - b1 = in[inI++] & 0xff;
423.156 - bc = 1;
423.157 - }
423.158 - }
423.159 - else {
423.160 - badInputLength = bc;
423.161 - throw new
423.162 - MalformedInputException("Incorrect byte-order mark");
423.163 - }
423.164 -
423.165 - started = true;
423.166 - }
423.167 - }
423.168 -
423.169 - /* Loop invariant: (b1 contains the next input byte) && (bc == 1) */
423.170 - while (inI < inEnd) {
423.171 - b2 = in[inI++] & 0xff;
423.172 - bc = 2;
423.173 -
423.174 - char c;
423.175 - if (byteOrder == BIG)
423.176 - c = (char) ((b1 << 8) | b2);
423.177 - else
423.178 - c = (char) ((b2 << 8) | b1);
423.179 -
423.180 - if (c == REVERSED_MARK)
423.181 - throw new
423.182 - MalformedInputException("Reversed byte-order mark");
423.183 -
423.184 - if (outI >= outEnd)
423.185 - throw new ConversionBufferFullException();
423.186 - out[outI++] = c;
423.187 - byteOff = inI;
423.188 - charOff = outI;
423.189 -
423.190 - if (inI < inEnd) {
423.191 - b1 = in[inI++] & 0xff;
423.192 - bc = 1;
423.193 - }
423.194 - }
423.195 -
423.196 - if (bc == 1) {
423.197 - leftOverByte = b1;
423.198 - byteOff = inI;
423.199 - leftOver = true;
423.200 - }
423.201 -
423.202 - return outI - outOff;
423.203 - }
423.204 -
423.205 - public void reset() {
423.206 - leftOver = false;
423.207 - byteOff = charOff = 0;
423.208 - started = false;
423.209 - byteOrder = originalByteOrder;
423.210 - }
423.211 -
423.212 - public int flush(char buf[], int off, int len)
423.213 - throws MalformedInputException
423.214 - {
423.215 - if (leftOver) {
423.216 - reset();
423.217 - throw new MalformedInputException();
423.218 - }
423.219 - byteOff = charOff = 0;
423.220 - return 0;
423.221 - }
423.222 -
423.223 -}
424.1 --- a/src/share/classes/sun/io/ByteToCharUnicodeBig.java Thu Sep 01 13:54:38 2011 -0700
424.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
424.3 @@ -1,43 +0,0 @@
424.4 -/*
424.5 - * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
424.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
424.7 - *
424.8 - * This code is free software; you can redistribute it and/or modify it
424.9 - * under the terms of the GNU General Public License version 2 only, as
424.10 - * published by the Free Software Foundation. Oracle designates this
424.11 - * particular file as subject to the "Classpath" exception as provided
424.12 - * by Oracle in the LICENSE file that accompanied this code.
424.13 - *
424.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
424.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
424.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
424.17 - * version 2 for more details (a copy is included in the LICENSE file that
424.18 - * accompanied this code).
424.19 - *
424.20 - * You should have received a copy of the GNU General Public License version
424.21 - * 2 along with this work; if not, write to the Free Software Foundation,
424.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
424.23 - *
424.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
424.25 - * or visit www.oracle.com if you need additional information or have any
424.26 - * questions.
424.27 - */
424.28 -
424.29 -package sun.io;
424.30 -import java.io.*;
424.31 -
424.32 -
424.33 -/**
424.34 - * Convert byte arrays containing Unicode characters into arrays of actual
424.35 - * Unicode characters, assuming a big-endian byte order.
424.36 - *
424.37 - * @author Mark Reinhold
424.38 - */
424.39 -
424.40 -public class ByteToCharUnicodeBig extends ByteToCharUnicode {
424.41 -
424.42 - public ByteToCharUnicodeBig() {
424.43 - super(BIG, true);
424.44 - }
424.45 -
424.46 -}
425.1 --- a/src/share/classes/sun/io/ByteToCharUnicodeBigUnmarked.java Thu Sep 01 13:54:38 2011 -0700
425.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
425.3 @@ -1,44 +0,0 @@
425.4 -/*
425.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
425.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
425.7 - *
425.8 - * This code is free software; you can redistribute it and/or modify it
425.9 - * under the terms of the GNU General Public License version 2 only, as
425.10 - * published by the Free Software Foundation. Oracle designates this
425.11 - * particular file as subject to the "Classpath" exception as provided
425.12 - * by Oracle in the LICENSE file that accompanied this code.
425.13 - *
425.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
425.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
425.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
425.17 - * version 2 for more details (a copy is included in the LICENSE file that
425.18 - * accompanied this code).
425.19 - *
425.20 - * You should have received a copy of the GNU General Public License version
425.21 - * 2 along with this work; if not, write to the Free Software Foundation,
425.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
425.23 - *
425.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
425.25 - * or visit www.oracle.com if you need additional information or have any
425.26 - * questions.
425.27 - */
425.28 -
425.29 -package sun.io;
425.30 -import java.io.*;
425.31 -
425.32 -
425.33 -/**
425.34 - * Convert byte arrays containing Unicode characters into arrays of actual
425.35 - * Unicode characters, assuming a big-endian byte order and requiring no
425.36 - * byte-order mark.
425.37 - *
425.38 - * @author Mark Reinhold
425.39 - */
425.40 -
425.41 -public class ByteToCharUnicodeBigUnmarked extends ByteToCharUnicode {
425.42 -
425.43 - public ByteToCharUnicodeBigUnmarked() {
425.44 - super(BIG, false);
425.45 - }
425.46 -
425.47 -}
426.1 --- a/src/share/classes/sun/io/ByteToCharUnicodeLittle.java Thu Sep 01 13:54:38 2011 -0700
426.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
426.3 @@ -1,43 +0,0 @@
426.4 -/*
426.5 - * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
426.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
426.7 - *
426.8 - * This code is free software; you can redistribute it and/or modify it
426.9 - * under the terms of the GNU General Public License version 2 only, as
426.10 - * published by the Free Software Foundation. Oracle designates this
426.11 - * particular file as subject to the "Classpath" exception as provided
426.12 - * by Oracle in the LICENSE file that accompanied this code.
426.13 - *
426.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
426.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
426.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
426.17 - * version 2 for more details (a copy is included in the LICENSE file that
426.18 - * accompanied this code).
426.19 - *
426.20 - * You should have received a copy of the GNU General Public License version
426.21 - * 2 along with this work; if not, write to the Free Software Foundation,
426.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
426.23 - *
426.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
426.25 - * or visit www.oracle.com if you need additional information or have any
426.26 - * questions.
426.27 - */
426.28 -
426.29 -package sun.io;
426.30 -import java.io.*;
426.31 -
426.32 -
426.33 -/**
426.34 - * Convert byte arrays containing Unicode characters into arrays of actual
426.35 - * Unicode characters, assuming a little-endian byte order.
426.36 - *
426.37 - * @author Mark Reinhold
426.38 - */
426.39 -
426.40 -public class ByteToCharUnicodeLittle extends ByteToCharUnicode {
426.41 -
426.42 - public ByteToCharUnicodeLittle() {
426.43 - super(LITTLE, true);
426.44 - }
426.45 -
426.46 -}
427.1 --- a/src/share/classes/sun/io/ByteToCharUnicodeLittleUnmarked.java Thu Sep 01 13:54:38 2011 -0700
427.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
427.3 @@ -1,44 +0,0 @@
427.4 -/*
427.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
427.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
427.7 - *
427.8 - * This code is free software; you can redistribute it and/or modify it
427.9 - * under the terms of the GNU General Public License version 2 only, as
427.10 - * published by the Free Software Foundation. Oracle designates this
427.11 - * particular file as subject to the "Classpath" exception as provided
427.12 - * by Oracle in the LICENSE file that accompanied this code.
427.13 - *
427.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
427.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
427.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
427.17 - * version 2 for more details (a copy is included in the LICENSE file that
427.18 - * accompanied this code).
427.19 - *
427.20 - * You should have received a copy of the GNU General Public License version
427.21 - * 2 along with this work; if not, write to the Free Software Foundation,
427.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
427.23 - *
427.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
427.25 - * or visit www.oracle.com if you need additional information or have any
427.26 - * questions.
427.27 - */
427.28 -
427.29 -package sun.io;
427.30 -import java.io.*;
427.31 -
427.32 -
427.33 -/**
427.34 - * Convert byte arrays containing Unicode characters into arrays of actual
427.35 - * Unicode characters, assuming a little-endian byte order and requiring no
427.36 - * byte-order mark.
427.37 - *
427.38 - * @author Mark Reinhold
427.39 - */
427.40 -
427.41 -public class ByteToCharUnicodeLittleUnmarked extends ByteToCharUnicode {
427.42 -
427.43 - public ByteToCharUnicodeLittleUnmarked() {
427.44 - super(LITTLE, false);
427.45 - }
427.46 -
427.47 -}
428.1 --- a/src/share/classes/sun/io/CharToByteASCII.java Thu Sep 01 13:54:38 2011 -0700
428.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
428.3 @@ -1,183 +0,0 @@
428.4 -/*
428.5 - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
428.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
428.7 - *
428.8 - * This code is free software; you can redistribute it and/or modify it
428.9 - * under the terms of the GNU General Public License version 2 only, as
428.10 - * published by the Free Software Foundation. Oracle designates this
428.11 - * particular file as subject to the "Classpath" exception as provided
428.12 - * by Oracle in the LICENSE file that accompanied this code.
428.13 - *
428.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
428.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
428.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
428.17 - * version 2 for more details (a copy is included in the LICENSE file that
428.18 - * accompanied this code).
428.19 - *
428.20 - * You should have received a copy of the GNU General Public License version
428.21 - * 2 along with this work; if not, write to the Free Software Foundation,
428.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
428.23 - *
428.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
428.25 - * or visit www.oracle.com if you need additional information or have any
428.26 - * questions.
428.27 - */
428.28 -
428.29 -package sun.io;
428.30 -
428.31 -public class CharToByteASCII extends CharToByteConverter {
428.32 -
428.33 - // Return the character set ID
428.34 - public String getCharacterEncoding()
428.35 - {
428.36 - return "ASCII";
428.37 - }
428.38 -
428.39 - private char highHalfZoneCode;
428.40 -
428.41 - public int flush(byte[] output, int outStart, int outEnd)
428.42 - throws MalformedInputException
428.43 - {
428.44 - if (highHalfZoneCode != 0) {
428.45 - highHalfZoneCode = 0;
428.46 - throw new MalformedInputException
428.47 - ("String ends with <High Half Zone code> of UTF16");
428.48 - }
428.49 - byteOff = charOff = 0;
428.50 - return 0;
428.51 - }
428.52 -
428.53 - /*
428.54 - * Character conversion
428.55 - */
428.56 - public int convert(char[] input, int inOff, int inEnd,
428.57 - byte[] output, int outOff, int outEnd)
428.58 - throws MalformedInputException,
428.59 - UnknownCharacterException,
428.60 - ConversionBufferFullException
428.61 - {
428.62 - char inputChar; // Input character to be converted
428.63 - byte[] outputByte; // Output byte written to output
428.64 - byte[] tmpArray = new byte[1];
428.65 - int inputSize; // Size of input
428.66 - int outputSize; // Size of output
428.67 -
428.68 - // Record beginning offsets
428.69 - charOff = inOff;
428.70 - byteOff = outOff;
428.71 -
428.72 - if (highHalfZoneCode != 0) {
428.73 - inputChar = highHalfZoneCode;
428.74 - highHalfZoneCode = 0;
428.75 - if (input[inOff] >= 0xdc00 && input[inOff] <= 0xdfff) {
428.76 - // This is legal UTF16 sequence.
428.77 - badInputLength = 1;
428.78 - throw new UnknownCharacterException();
428.79 - } else {
428.80 - // This is illegal UTF16 sequence.
428.81 - badInputLength = 0;
428.82 - throw new MalformedInputException
428.83 - ("Previous converted string ends with " +
428.84 - "<High Half Zone Code> of UTF16 " +
428.85 - ", but this string is not begin with <Low Half Zone>");
428.86 - }
428.87 - }
428.88 -
428.89 - // Loop until we hit the end of the input
428.90 - while(charOff < inEnd) {
428.91 - outputByte = tmpArray;
428.92 -
428.93 - // Get the input character
428.94 - inputChar = input[charOff];
428.95 -
428.96 - // default outputSize
428.97 - outputSize = 1;
428.98 -
428.99 - // Assume this is a simple character
428.100 - inputSize = 1;
428.101 -
428.102 - // Is this a high surrogate?
428.103 - if(inputChar >= '\uD800' && inputChar <= '\uDBFF') {
428.104 - // Is this the last character in the input?
428.105 - if (charOff + 1 == inEnd) {
428.106 - highHalfZoneCode = inputChar;
428.107 - break;
428.108 - }
428.109 -
428.110 - // Is there a low surrogate following?
428.111 - inputChar = input[charOff + 1];
428.112 - if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
428.113 - // We have a valid surrogate pair. Too bad we don't map
428.114 - // surrogates. Is substitution enabled?
428.115 - if (subMode) {
428.116 - outputByte = subBytes;
428.117 - outputSize = subBytes.length;
428.118 - inputSize = 2;
428.119 - } else {
428.120 - badInputLength = 2;
428.121 - throw new UnknownCharacterException();
428.122 - }
428.123 - } else {
428.124 - // We have a malformed surrogate pair
428.125 - badInputLength = 1;
428.126 - throw new MalformedInputException();
428.127 - }
428.128 - }
428.129 - // Is this an unaccompanied low surrogate?
428.130 - else if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
428.131 - badInputLength = 1;
428.132 - throw new MalformedInputException();
428.133 - }
428.134 - // Not part of a surrogate, so try to convert
428.135 - else {
428.136 - // Is this character mappable?
428.137 - if (inputChar <= '\u007F') {
428.138 - outputByte[0] = (byte)inputChar;
428.139 - } else {
428.140 - // Is substitution enabled?
428.141 - if (subMode) {
428.142 - outputByte = subBytes;
428.143 - outputSize = subBytes.length;
428.144 - } else {
428.145 - badInputLength = 1;
428.146 - throw new UnknownCharacterException();
428.147 - }
428.148 - }
428.149 - }
428.150 -
428.151 - // If we don't have room for the output, throw an exception
428.152 - if (byteOff + outputSize > outEnd)
428.153 - throw new ConversionBufferFullException();
428.154 -
428.155 - // Put the byte in the output buffer
428.156 - for (int i = 0; i < outputSize; i++) {
428.157 - output[byteOff++] = outputByte[i];
428.158 - }
428.159 - charOff += inputSize;
428.160 - }
428.161 -
428.162 - // Return the length written to the output buffer
428.163 - return byteOff-outOff;
428.164 - }
428.165 -
428.166 - // Determine if a character is mappable or not
428.167 - public boolean canConvert(char ch)
428.168 - {
428.169 - return (ch <= '\u007F');
428.170 - }
428.171 -
428.172 - // Reset the converter
428.173 - public void reset()
428.174 - {
428.175 - byteOff = charOff = 0;
428.176 - highHalfZoneCode = 0;
428.177 - }
428.178 -
428.179 - /**
428.180 - * returns the maximum number of bytes needed to convert a char
428.181 - */
428.182 - public int getMaxBytesPerChar()
428.183 - {
428.184 - return 1;
428.185 - }
428.186 -}
429.1 --- a/src/share/classes/sun/io/CharToByteBig5.java Thu Sep 01 13:54:38 2011 -0700
429.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
429.3 @@ -1,49 +0,0 @@
429.4 -/*
429.5 - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
429.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
429.7 - *
429.8 - * This code is free software; you can redistribute it and/or modify it
429.9 - * under the terms of the GNU General Public License version 2 only, as
429.10 - * published by the Free Software Foundation. Oracle designates this
429.11 - * particular file as subject to the "Classpath" exception as provided
429.12 - * by Oracle in the LICENSE file that accompanied this code.
429.13 - *
429.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
429.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
429.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
429.17 - * version 2 for more details (a copy is included in the LICENSE file that
429.18 - * accompanied this code).
429.19 - *
429.20 - * You should have received a copy of the GNU General Public License version
429.21 - * 2 along with this work; if not, write to the Free Software Foundation,
429.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
429.23 - *
429.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
429.25 - * or visit www.oracle.com if you need additional information or have any
429.26 - * questions.
429.27 - */
429.28 -
429.29 -
429.30 -package sun.io;
429.31 -
429.32 -import sun.nio.cs.ext.DoubleByte;
429.33 -import sun.nio.cs.ext.Big5;
429.34 -
429.35 -/**
429.36 - * Tables and data to convert Unicode to Big5
429.37 - *
429.38 - */
429.39 -
429.40 -public class CharToByteBig5 extends CharToByteDBCS_ASCII {
429.41 -
429.42 - private static DoubleByte.Encoder enc =
429.43 - (DoubleByte.Encoder)new Big5().newEncoder();
429.44 -
429.45 - public String getCharacterEncoding() {
429.46 - return "Big5";
429.47 - }
429.48 -
429.49 - public CharToByteBig5() {
429.50 - super(enc);
429.51 - }
429.52 -}
430.1 --- a/src/share/classes/sun/io/CharToByteBig5_HKSCS.java Thu Sep 01 13:54:38 2011 -0700
430.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
430.3 @@ -1,42 +0,0 @@
430.4 -/*
430.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
430.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
430.7 - *
430.8 - * This code is free software; you can redistribute it and/or modify it
430.9 - * under the terms of the GNU General Public License version 2 only, as
430.10 - * published by the Free Software Foundation. Oracle designates this
430.11 - * particular file as subject to the "Classpath" exception as provided
430.12 - * by Oracle in the LICENSE file that accompanied this code.
430.13 - *
430.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
430.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
430.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
430.17 - * version 2 for more details (a copy is included in the LICENSE file that
430.18 - * accompanied this code).
430.19 - *
430.20 - * You should have received a copy of the GNU General Public License version
430.21 - * 2 along with this work; if not, write to the Free Software Foundation,
430.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
430.23 - *
430.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
430.25 - * or visit www.oracle.com if you need additional information or have any
430.26 - * questions.
430.27 - */
430.28 -
430.29 -package sun.io;
430.30 -
430.31 -import sun.nio.cs.ext.DoubleByte;
430.32 -import sun.nio.cs.ext.Big5_HKSCS;
430.33 -
430.34 -public class CharToByteBig5_HKSCS extends CharToByteDBCS_ASCII {
430.35 - private static DoubleByte.Encoder enc =
430.36 - (DoubleByte.Encoder)new Big5_HKSCS().newEncoder();
430.37 -
430.38 - public String getCharacterEncoding() {
430.39 - return "Big5_HKSCS";
430.40 - }
430.41 -
430.42 - public CharToByteBig5_HKSCS() {
430.43 - super(enc);
430.44 - }
430.45 -}
431.1 --- a/src/share/classes/sun/io/CharToByteBig5_Solaris.java Thu Sep 01 13:54:38 2011 -0700
431.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
431.3 @@ -1,43 +0,0 @@
431.4 -/*
431.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
431.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
431.7 - *
431.8 - * This code is free software; you can redistribute it and/or modify it
431.9 - * under the terms of the GNU General Public License version 2 only, as
431.10 - * published by the Free Software Foundation. Oracle designates this
431.11 - * particular file as subject to the "Classpath" exception as provided
431.12 - * by Oracle in the LICENSE file that accompanied this code.
431.13 - *
431.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
431.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
431.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
431.17 - * version 2 for more details (a copy is included in the LICENSE file that
431.18 - * accompanied this code).
431.19 - *
431.20 - * You should have received a copy of the GNU General Public License version
431.21 - * 2 along with this work; if not, write to the Free Software Foundation,
431.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
431.23 - *
431.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
431.25 - * or visit www.oracle.com if you need additional information or have any
431.26 - * questions.
431.27 - */
431.28 -
431.29 -package sun.io;
431.30 -
431.31 -import sun.nio.cs.ext.DoubleByte;
431.32 -import sun.nio.cs.ext.Big5_Solaris;
431.33 -
431.34 -public class CharToByteBig5_Solaris extends CharToByteDBCS_ASCII {
431.35 -
431.36 - private static DoubleByte.Encoder enc =
431.37 - (DoubleByte.Encoder)new Big5_Solaris().newEncoder();
431.38 -
431.39 - public String getCharacterEncoding() {
431.40 - return "Big5_Solaris";
431.41 - }
431.42 -
431.43 - public CharToByteBig5_Solaris() {
431.44 - super(enc);
431.45 - }
431.46 -}
432.1 --- a/src/share/classes/sun/io/CharToByteConverter.java Thu Sep 01 13:54:38 2011 -0700
432.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
432.3 @@ -1,419 +0,0 @@
432.4 -/*
432.5 - * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
432.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
432.7 - *
432.8 - * This code is free software; you can redistribute it and/or modify it
432.9 - * under the terms of the GNU General Public License version 2 only, as
432.10 - * published by the Free Software Foundation. Oracle designates this
432.11 - * particular file as subject to the "Classpath" exception as provided
432.12 - * by Oracle in the LICENSE file that accompanied this code.
432.13 - *
432.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
432.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
432.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
432.17 - * version 2 for more details (a copy is included in the LICENSE file that
432.18 - * accompanied this code).
432.19 - *
432.20 - * You should have received a copy of the GNU General Public License version
432.21 - * 2 along with this work; if not, write to the Free Software Foundation,
432.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
432.23 - *
432.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
432.25 - * or visit www.oracle.com if you need additional information or have any
432.26 - * questions.
432.27 - */
432.28 -
432.29 -package sun.io;
432.30 -
432.31 -import java.io.*;
432.32 -
432.33 -
432.34 -/**
432.35 - * An abstract base class for subclasses which convert Unicode
432.36 - * characters into an external encoding.
432.37 - *
432.38 - * @author Asmus Freytag
432.39 - * @author Lloyd Honomichl, Novell, Inc.
432.40 - *
432.41 - * @deprecated Replaced by {@link java.nio.charset}. THIS API WILL BE
432.42 - * REMOVED IN J2SE 1.6.
432.43 - */
432.44 -@Deprecated
432.45 -public abstract class CharToByteConverter {
432.46 -
432.47 - /**
432.48 - * Substitution mode flag.
432.49 - */
432.50 - protected boolean subMode = true;
432.51 -
432.52 - /**
432.53 - * Bytes to substitute for unmappable input.
432.54 - */
432.55 - protected byte[] subBytes = { (byte)'?' };
432.56 -
432.57 - /**
432.58 - * Offset of next character to be converted.
432.59 - */
432.60 - protected int charOff;
432.61 -
432.62 - /**
432.63 - * Offset of next byte to be output.
432.64 - */
432.65 - protected int byteOff;
432.66 -
432.67 - /**
432.68 - * Length of bad input that caused conversion to stop.
432.69 - */
432.70 - protected int badInputLength;
432.71 -
432.72 - /**
432.73 - * Create an instance of the default CharToByteConverter subclass.
432.74 - */
432.75 - public static CharToByteConverter getDefault() {
432.76 - Object cvt;
432.77 - cvt = Converters.newDefaultConverter(Converters.CHAR_TO_BYTE);
432.78 - return (CharToByteConverter)cvt;
432.79 - }
432.80 -
432.81 - /**
432.82 - * Returns appropriate CharToByteConverter subclass instance.
432.83 - * @param string represets encoding
432.84 - */
432.85 - public static CharToByteConverter getConverter(String encoding)
432.86 - throws UnsupportedEncodingException
432.87 - {
432.88 - Object cvt;
432.89 - cvt = Converters.newConverter(Converters.CHAR_TO_BYTE, encoding);
432.90 - return (CharToByteConverter)cvt;
432.91 - }
432.92 -
432.93 - /**
432.94 - * Returns the character set id for the conversion.
432.95 - */
432.96 - public abstract String getCharacterEncoding();
432.97 -
432.98 - /**
432.99 - * Converts an array of Unicode characters into an array of bytes
432.100 - * in the target character encoding. This method allows a buffer by
432.101 - * buffer conversion of a data stream. The state of the conversion is
432.102 - * saved between calls to convert. If a call to convert results in
432.103 - * an exception, the conversion may be continued by calling convert again
432.104 - * with suitably modified parameters. All conversions should be finished
432.105 - * with a call to the flush method.
432.106 - *
432.107 - * @return the number of bytes written to output.
432.108 - * @param input array containing Unicode characters to be converted.
432.109 - * @param inStart begin conversion at this offset in input array.
432.110 - * @param inEnd stop conversion at this offset in input array (exclusive).
432.111 - * @param output byte array to receive conversion result.
432.112 - * @param outStart start writing to output array at this offset.
432.113 - * @param outEnd stop writing to output array at this offset (exclusive).
432.114 - * @exception MalformedInputException if the input buffer contains any
432.115 - * sequence of chars that is illegal in Unicode (principally unpaired
432.116 - * surrogates and \uFFFF or \uFFFE). After this exception is thrown,
432.117 - * the method nextCharIndex can be called to obtain the index of the
432.118 - * first invalid input character. The MalformedInputException can
432.119 - * be queried for the length of the invalid input.
432.120 - * @exception UnknownCharacterException for any character that
432.121 - * that cannot be converted to the external character encoding. Thrown
432.122 - * only when converter is not in substitution mode.
432.123 - * @exception ConversionBufferFullException if output array is filled prior
432.124 - * to converting all the input.
432.125 - */
432.126 - public abstract int convert(char[] input, int inStart, int inEnd,
432.127 - byte[] output, int outStart, int outEnd)
432.128 - throws MalformedInputException,
432.129 - UnknownCharacterException,
432.130 - ConversionBufferFullException;
432.131 -
432.132 - /*
432.133 - * Converts any array of characters, including malformed surrogate
432.134 - * pairs, into an array of bytes in the target character encoding.
432.135 - * A precondition is that substitution mode is turned on. This method
432.136 - * allows a buffer by buffer conversion of a data stream.
432.137 - * The state of the conversion is saved between calls to convert.
432.138 - * All conversions should be finished with a call to the flushAny method.
432.139 - *
432.140 - * @return the number of bytes written to output.
432.141 - * @param input array containing Unicode characters to be converted.
432.142 - * @param inStart begin conversion at this offset in input array.
432.143 - * @param inEnd stop conversion at this offset in input array (exclusive).
432.144 - * @param output byte array to receive conversion result.
432.145 - * @param outStart start writing to output array at this offset.
432.146 - * @param outEnd stop writing to output array at this offset (exclusive).
432.147 - * @exception ConversionBufferFullException if output array is filled prior
432.148 - * to converting all the input.
432.149 - */
432.150 - public int convertAny(char[] input, int inStart, int inEnd,
432.151 - byte[] output, int outStart, int outEnd)
432.152 - throws ConversionBufferFullException
432.153 - {
432.154 - if (!subMode) { /* Precondition: subMode == true */
432.155 - throw new IllegalStateException("Substitution mode is not on");
432.156 - }
432.157 - /* Rely on the untested precondition that the indices are meaningful */
432.158 - /* For safety, use the public interface to charOff and byteOff, but
432.159 - badInputLength is directly modified.*/
432.160 - int localInOff = inStart;
432.161 - int localOutOff = outStart;
432.162 - while(localInOff < inEnd) {
432.163 - try {
432.164 - int discard = convert(input, localInOff, inEnd,
432.165 - output, localOutOff, outEnd);
432.166 - return (nextByteIndex() - outStart);
432.167 - } catch (MalformedInputException e) {
432.168 - byte[] s = subBytes;
432.169 - int subSize = s.length;
432.170 - localOutOff = nextByteIndex();
432.171 - if ((localOutOff + subSize) > outEnd)
432.172 - throw new ConversionBufferFullException();
432.173 - for (int i = 0; i < subSize; i++)
432.174 - output[localOutOff++] = s[i];
432.175 - localInOff = nextCharIndex();
432.176 - localInOff += badInputLength;
432.177 - badInputLength = 0;
432.178 - if (localInOff >= inEnd){
432.179 - byteOff = localOutOff;
432.180 - return (byteOff - outStart);
432.181 - }
432.182 - continue;
432.183 - }catch (UnknownCharacterException e) {
432.184 - /* Should never occur, since subMode == true */
432.185 - throw new Error("UnknownCharacterException thrown "
432.186 - + "in substititution mode",
432.187 - e);
432.188 - }
432.189 - }
432.190 - return (nextByteIndex() - outStart);
432.191 - }
432.192 -
432.193 -
432.194 -
432.195 - /**
432.196 - * Converts an array of Unicode characters into an array of bytes
432.197 - * in the target character encoding. Unlike convert, this method
432.198 - * does not do incremental conversion. It assumes that the given
432.199 - * input array contains all the characters to be converted. The
432.200 - * state of the converter is reset at the beginning of this method
432.201 - * and is left in the reset state on successful termination.
432.202 - * The converter is not reset if an exception is thrown.
432.203 - * This allows the caller to determine where the bad input
432.204 - * was encountered by calling nextCharIndex.
432.205 - * <p>
432.206 - * This method uses substitution mode when performing the conversion.
432.207 - * The method setSubstitutionBytes may be used to determine what
432.208 - * bytes are substituted. Even though substitution mode is used,
432.209 - * the state of the converter's substitution mode is not changed
432.210 - * at the end of this method.
432.211 - *
432.212 - * @return an array of bytes containing the converted characters.
432.213 - * @param input array containing Unicode characters to be converted.
432.214 - * @exception MalformedInputException if the input buffer contains any
432.215 - * sequence of chars that is illegal in Unicode (principally unpaired
432.216 - * surrogates and \uFFFF or \uFFFE). After this exception is thrown,
432.217 - * the method nextCharIndex can be called to obtain the index of the
432.218 - * first invalid input character and getBadInputLength can be called
432.219 - * to determine the length of the invalid input.
432.220 - *
432.221 - * @see #nextCharIndex
432.222 - * @see #setSubstitutionMode
432.223 - * @see #setSubstitutionBytes
432.224 - * @see #getBadInputLength
432.225 - */
432.226 - public byte[] convertAll( char input[] ) throws MalformedInputException {
432.227 - reset();
432.228 - boolean savedSubMode = subMode;
432.229 - subMode = true;
432.230 -
432.231 - byte[] output = new byte[ getMaxBytesPerChar() * input.length ];
432.232 -
432.233 - try {
432.234 - int outputLength = convert( input, 0, input.length,
432.235 - output, 0, output.length );
432.236 - outputLength += flush( output, nextByteIndex(), output.length );
432.237 -
432.238 - byte [] returnedOutput = new byte[ outputLength ];
432.239 - System.arraycopy( output, 0, returnedOutput, 0, outputLength );
432.240 - return returnedOutput;
432.241 - }
432.242 - catch( ConversionBufferFullException e ) {
432.243 - //Not supposed to happen. If it does, getMaxBytesPerChar() lied.
432.244 - throw new
432.245 - InternalError("this.getMaxBytesPerChar returned bad value");
432.246 - }
432.247 - catch( UnknownCharacterException e ) {
432.248 - // Not supposed to happen since we're in substitution mode.
432.249 - throw new InternalError();
432.250 - }
432.251 - finally {
432.252 - subMode = savedSubMode;
432.253 - }
432.254 - }
432.255 -
432.256 - /**
432.257 - * Writes any remaining output to the output buffer and resets the
432.258 - * converter to its initial state.
432.259 - *
432.260 - * @param output byte array to receive flushed output.
432.261 - * @param outStart start writing to output array at this offset.
432.262 - * @param outEnd stop writing to output array at this offset (exclusive).
432.263 - * @exception MalformedInputException if the output to be flushed contained
432.264 - * a partial or invalid multibyte character sequence. Will occur if the
432.265 - * input buffer on the last call to convert ended with the first character
432.266 - * of a surrogate pair. flush will write what it can to the output buffer
432.267 - * and reset the converter before throwing this exception. An additional
432.268 - * call to flush is not required.
432.269 - * @exception ConversionBufferFullException if output array is filled
432.270 - * before all the output can be flushed. flush will write what it can
432.271 - * to the output buffer and remember its state. An additional call to
432.272 - * flush with a new output buffer will conclude the operation.
432.273 - */
432.274 - public abstract int flush( byte[] output, int outStart, int outEnd )
432.275 - throws MalformedInputException, ConversionBufferFullException;
432.276 -
432.277 - /**
432.278 - * Writes any remaining output to the output buffer and resets the
432.279 - * converter to its initial state. May only be called when substitution
432.280 - * mode is turned on, and never complains about malformed input (always
432.281 - * substitutes).
432.282 - *
432.283 - * @param output byte array to receive flushed output.
432.284 - * @param outStart start writing to output array at this offset.
432.285 - * @param outEnd stop writing to output array at this offset (exclusive).
432.286 - * @return number of bytes writter into output.
432.287 - * @exception ConversionBufferFullException if output array is filled
432.288 - * before all the output can be flushed. flush will write what it can
432.289 - * to the output buffer and remember its state. An additional call to
432.290 - * flush with a new output buffer will conclude the operation.
432.291 - */
432.292 - public int flushAny( byte[] output, int outStart, int outEnd )
432.293 - throws ConversionBufferFullException
432.294 - {
432.295 - if (!subMode) { /* Precondition: subMode == true */
432.296 - throw new IllegalStateException("Substitution mode is not on");
432.297 - }
432.298 - try {
432.299 - return flush(output, outStart, outEnd);
432.300 - } catch (MalformedInputException e) {
432.301 - /* Assume that if a malformed input exception has occurred,
432.302 - no useful data has been placed in the output buffer.
432.303 - i.e. there is no mixture of left over good + some bad data.
432.304 - Usually occurs with a trailing high surrogate pair element.
432.305 - Special cases occur in Cp970, 949c and 933 that seem
432.306 - to be covered, but may require further investigation */
432.307 - int subSize = subBytes.length;
432.308 - byte[] s = subBytes;
432.309 - int outIndex = outStart;
432.310 - if ((outStart + subSize) > outEnd)
432.311 - throw new ConversionBufferFullException();
432.312 - for (int i = 0; i < subSize; i++)
432.313 - output[outIndex++] = s[i];
432.314 - byteOff = charOff = 0; // Reset the internal state.
432.315 - badInputLength = 0;
432.316 - return subSize;
432.317 - }
432.318 - }
432.319 -
432.320 - /**
432.321 - * Resets converter to its initial state.
432.322 - */
432.323 - public abstract void reset();
432.324 -
432.325 - /**
432.326 - * Returns true if the given character can be converted to the
432.327 - * target character encoding.
432.328 - * @return true if given character is translatable, false otherwise.
432.329 - * @param c character to test
432.330 - */
432.331 - public boolean canConvert(char c) {
432.332 - try {
432.333 - //FIXME output buffer size should use getMaxBytesPerChar value.
432.334 - char[] input = new char[1];
432.335 - byte[] output = new byte[3];
432.336 - input[0] = c;
432.337 - convert(input, 0, 1, output, 0, 3);
432.338 - return true;
432.339 - } catch(CharConversionException e){
432.340 - return false;
432.341 - }
432.342 - }
432.343 -
432.344 - /**
432.345 - * Returns the maximum number of bytes needed to convert a char. Useful
432.346 - * for calculating the maximum output buffer size needed for a particular
432.347 - * input buffer.
432.348 - */
432.349 - public abstract int getMaxBytesPerChar();
432.350 -
432.351 - /**
432.352 - * Returns the length, in chars, of the input which caused a
432.353 - * MalformedInputException. Always refers to the last
432.354 - * MalformedInputException thrown by the converter. If none have
432.355 - * ever been thrown, returns 0.
432.356 - */
432.357 - public int getBadInputLength() {
432.358 - return badInputLength;
432.359 - }
432.360 -
432.361 - /**
432.362 - * Returns the index of the character just past
432.363 - * the last character successfully converted by the previous call
432.364 - * to convert.
432.365 - */
432.366 - public int nextCharIndex() {
432.367 - return charOff;
432.368 - }
432.369 -
432.370 - /**
432.371 - * Returns the index of the byte just past the last byte written by
432.372 - * the previous call to convert.
432.373 - */
432.374 - public int nextByteIndex() {
432.375 - return byteOff;
432.376 - }
432.377 -
432.378 - /**
432.379 - * Sets converter into substitution mode. In substitution mode,
432.380 - * the converter will replace untranslatable characters in the source
432.381 - * encoding with the substitution character set by setSubstitutionBytes.
432.382 - * When not in substitution mode, the converter will throw an
432.383 - * UnknownCharacterException when it encounters untranslatable input.
432.384 - *
432.385 - * @param doSub if true, enable substitution mode.
432.386 - * @see #setSubstitutionBytes
432.387 - */
432.388 - public void setSubstitutionMode(boolean doSub) {
432.389 - subMode = doSub;
432.390 - }
432.391 -
432.392 - /**
432.393 - * Sets the substitution bytes to use when the converter is in
432.394 - * substitution mode. The given bytes should represent a valid
432.395 - * character in the target character encoding and must not be
432.396 - * longer than the value returned by getMaxBytesPerChar for this
432.397 - * converter.
432.398 - *
432.399 - * @param newSubBytes the substitution bytes
432.400 - * @exception IllegalArgumentException if given byte array is longer than
432.401 - * the value returned by the method getMaxBytesPerChar.
432.402 - * @see #setSubstitutionMode
432.403 - * @see #getMaxBytesPerChar
432.404 - */
432.405 - public void setSubstitutionBytes( byte[] newSubBytes )
432.406 - throws IllegalArgumentException
432.407 - {
432.408 - if( newSubBytes.length > getMaxBytesPerChar() ) {
432.409 - throw new IllegalArgumentException();
432.410 - }
432.411 -
432.412 - subBytes = new byte[ newSubBytes.length ];
432.413 - System.arraycopy( newSubBytes, 0, subBytes, 0, newSubBytes.length );
432.414 - }
432.415 -
432.416 - /**
432.417 - * Returns a string representation of the class.
432.418 - */
432.419 - public String toString() {
432.420 - return "CharToByteConverter: " + getCharacterEncoding();
432.421 - }
432.422 -}
433.1 --- a/src/share/classes/sun/io/CharToByteCp037.java Thu Sep 01 13:54:38 2011 -0700
433.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
433.3 @@ -1,51 +0,0 @@
433.4 -/*
433.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
433.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
433.7 - *
433.8 - * This code is free software; you can redistribute it and/or modify it
433.9 - * under the terms of the GNU General Public License version 2 only, as
433.10 - * published by the Free Software Foundation. Oracle designates this
433.11 - * particular file as subject to the "Classpath" exception as provided
433.12 - * by Oracle in the LICENSE file that accompanied this code.
433.13 - *
433.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
433.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
433.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
433.17 - * version 2 for more details (a copy is included in the LICENSE file that
433.18 - * accompanied this code).
433.19 - *
433.20 - * You should have received a copy of the GNU General Public License version
433.21 - * 2 along with this work; if not, write to the Free Software Foundation,
433.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
433.23 - *
433.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
433.25 - * or visit www.oracle.com if you need additional information or have any
433.26 - * questions.
433.27 - */
433.28 -
433.29 -package sun.io;
433.30 -
433.31 -import sun.nio.cs.ext.IBM037;
433.32 -
433.33 -/**
433.34 - * Tables and data to convert Unicode to Cp037
433.35 - *
433.36 - * @author ConverterGenerator tool
433.37 - */
433.38 -
433.39 -public class CharToByteCp037 extends CharToByteSingleByte {
433.40 -
433.41 - private final static IBM037 nioCoder = new IBM037();
433.42 -
433.43 - public String getCharacterEncoding() {
433.44 - return "Cp037";
433.45 - }
433.46 -
433.47 - public CharToByteCp037() {
433.48 - super.mask1 = 0xFF00;
433.49 - super.mask2 = 0x00FF;
433.50 - super.shift = 8;
433.51 - super.index1 = nioCoder.getEncoderIndex1();
433.52 - super.index2 = nioCoder.getEncoderIndex2();
433.53 - }
433.54 -}
434.1 --- a/src/share/classes/sun/io/CharToByteCp1006.java Thu Sep 01 13:54:38 2011 -0700
434.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
434.3 @@ -1,51 +0,0 @@
434.4 -/*
434.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
434.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
434.7 - *
434.8 - * This code is free software; you can redistribute it and/or modify it
434.9 - * under the terms of the GNU General Public License version 2 only, as
434.10 - * published by the Free Software Foundation. Oracle designates this
434.11 - * particular file as subject to the "Classpath" exception as provided
434.12 - * by Oracle in the LICENSE file that accompanied this code.
434.13 - *
434.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
434.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
434.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
434.17 - * version 2 for more details (a copy is included in the LICENSE file that
434.18 - * accompanied this code).
434.19 - *
434.20 - * You should have received a copy of the GNU General Public License version
434.21 - * 2 along with this work; if not, write to the Free Software Foundation,
434.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
434.23 - *
434.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
434.25 - * or visit www.oracle.com if you need additional information or have any
434.26 - * questions.
434.27 - */
434.28 -
434.29 -package sun.io;
434.30 -
434.31 -import sun.nio.cs.ext.IBM1006;
434.32 -
434.33 -/**
434.34 - * Tables and data to convert Unicode to Cp1006
434.35 - *
434.36 - * @author ConverterGenerator tool
434.37 - */
434.38 -
434.39 -public class CharToByteCp1006 extends CharToByteSingleByte {
434.40 -
434.41 - private final static IBM1006 nioCoder = new IBM1006();
434.42 -
434.43 - public String getCharacterEncoding() {
434.44 - return "Cp1006";
434.45 - }
434.46 -
434.47 - public CharToByteCp1006() {
434.48 - super.mask1 = 0xFF00;
434.49 - super.mask2 = 0x00FF;
434.50 - super.shift = 8;
434.51 - super.index1 = nioCoder.getEncoderIndex1();
434.52 - super.index2 = nioCoder.getEncoderIndex2();
434.53 - }
434.54 -}
435.1 --- a/src/share/classes/sun/io/CharToByteCp1025.java Thu Sep 01 13:54:38 2011 -0700
435.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
435.3 @@ -1,51 +0,0 @@
435.4 -/*
435.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
435.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
435.7 - *
435.8 - * This code is free software; you can redistribute it and/or modify it
435.9 - * under the terms of the GNU General Public License version 2 only, as
435.10 - * published by the Free Software Foundation. Oracle designates this
435.11 - * particular file as subject to the "Classpath" exception as provided
435.12 - * by Oracle in the LICENSE file that accompanied this code.
435.13 - *
435.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
435.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
435.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
435.17 - * version 2 for more details (a copy is included in the LICENSE file that
435.18 - * accompanied this code).
435.19 - *
435.20 - * You should have received a copy of the GNU General Public License version
435.21 - * 2 along with this work; if not, write to the Free Software Foundation,
435.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
435.23 - *
435.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
435.25 - * or visit www.oracle.com if you need additional information or have any
435.26 - * questions.
435.27 - */
435.28 -
435.29 -package sun.io;
435.30 -
435.31 -import sun.nio.cs.ext.IBM1025;
435.32 -
435.33 -/**
435.34 - * Tables and data to convert Unicode to Cp1025
435.35 - *
435.36 - * @author ConverterGenerator tool
435.37 - */
435.38 -
435.39 -public class CharToByteCp1025 extends CharToByteSingleByte {
435.40 -
435.41 - private final static IBM1025 nioCoder = new IBM1025();
435.42 -
435.43 - public String getCharacterEncoding() {
435.44 - return "Cp1025";
435.45 - }
435.46 -
435.47 - public CharToByteCp1025() {
435.48 - super.mask1 = 0xFF00;
435.49 - super.mask2 = 0x00FF;
435.50 - super.shift = 8;
435.51 - super.index1 = nioCoder.getEncoderIndex1();
435.52 - super.index2 = nioCoder.getEncoderIndex2();
435.53 - }
435.54 -}
436.1 --- a/src/share/classes/sun/io/CharToByteCp1026.java Thu Sep 01 13:54:38 2011 -0700
436.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
436.3 @@ -1,51 +0,0 @@
436.4 -/*
436.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
436.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
436.7 - *
436.8 - * This code is free software; you can redistribute it and/or modify it
436.9 - * under the terms of the GNU General Public License version 2 only, as
436.10 - * published by the Free Software Foundation. Oracle designates this
436.11 - * particular file as subject to the "Classpath" exception as provided
436.12 - * by Oracle in the LICENSE file that accompanied this code.
436.13 - *
436.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
436.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
436.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
436.17 - * version 2 for more details (a copy is included in the LICENSE file that
436.18 - * accompanied this code).
436.19 - *
436.20 - * You should have received a copy of the GNU General Public License version
436.21 - * 2 along with this work; if not, write to the Free Software Foundation,
436.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
436.23 - *
436.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
436.25 - * or visit www.oracle.com if you need additional information or have any
436.26 - * questions.
436.27 - */
436.28 -
436.29 -package sun.io;
436.30 -
436.31 -import sun.nio.cs.ext.IBM1026;
436.32 -
436.33 -/**
436.34 - * Tables and data to convert Unicode to Cp1026
436.35 - *
436.36 - * @author ConverterGenerator tool
436.37 - */
436.38 -
436.39 -public class CharToByteCp1026 extends CharToByteSingleByte {
436.40 -
436.41 - private final static IBM1026 nioCoder = new IBM1026();
436.42 -
436.43 - public String getCharacterEncoding() {
436.44 - return "Cp1026";
436.45 - }
436.46 -
436.47 - public CharToByteCp1026() {
436.48 - super.mask1 = 0xFF00;
436.49 - super.mask2 = 0x00FF;
436.50 - super.shift = 8;
436.51 - super.index1 = nioCoder.getEncoderIndex1();
436.52 - super.index2 = nioCoder.getEncoderIndex2();
436.53 - }
436.54 -}
437.1 --- a/src/share/classes/sun/io/CharToByteCp1046.java Thu Sep 01 13:54:38 2011 -0700
437.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
437.3 @@ -1,51 +0,0 @@
437.4 -/*
437.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
437.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
437.7 - *
437.8 - * This code is free software; you can redistribute it and/or modify it
437.9 - * under the terms of the GNU General Public License version 2 only, as
437.10 - * published by the Free Software Foundation. Oracle designates this
437.11 - * particular file as subject to the "Classpath" exception as provided
437.12 - * by Oracle in the LICENSE file that accompanied this code.
437.13 - *
437.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
437.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
437.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
437.17 - * version 2 for more details (a copy is included in the LICENSE file that
437.18 - * accompanied this code).
437.19 - *
437.20 - * You should have received a copy of the GNU General Public License version
437.21 - * 2 along with this work; if not, write to the Free Software Foundation,
437.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
437.23 - *
437.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
437.25 - * or visit www.oracle.com if you need additional information or have any
437.26 - * questions.
437.27 - */
437.28 -
437.29 -package sun.io;
437.30 -
437.31 -import sun.nio.cs.ext.IBM1046;
437.32 -
437.33 -/**
437.34 - * Tables and data to convert Unicode to Cp1046
437.35 - *
437.36 - * @author ConverterGenerator tool
437.37 - */
437.38 -
437.39 -public class CharToByteCp1046 extends CharToByteSingleByte {
437.40 -
437.41 - private final static IBM1046 nioCoder = new IBM1046();
437.42 -
437.43 - public String getCharacterEncoding() {
437.44 - return "Cp1046";
437.45 - }
437.46 -
437.47 - public CharToByteCp1046() {
437.48 - super.mask1 = 0xFF00;
437.49 - super.mask2 = 0x00FF;
437.50 - super.shift = 8;
437.51 - super.index1 = nioCoder.getEncoderIndex1();
437.52 - super.index2 = nioCoder.getEncoderIndex2();
437.53 - }
437.54 -}
438.1 --- a/src/share/classes/sun/io/CharToByteCp1047.java Thu Sep 01 13:54:38 2011 -0700
438.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
438.3 @@ -1,51 +0,0 @@
438.4 -/*
438.5 - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
438.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
438.7 - *
438.8 - * This code is free software; you can redistribute it and/or modify it
438.9 - * under the terms of the GNU General Public License version 2 only, as
438.10 - * published by the Free Software Foundation. Oracle designates this
438.11 - * particular file as subject to the "Classpath" exception as provided
438.12 - * by Oracle in the LICENSE file that accompanied this code.
438.13 - *
438.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
438.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
438.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
438.17 - * version 2 for more details (a copy is included in the LICENSE file that
438.18 - * accompanied this code).
438.19 - *
438.20 - * You should have received a copy of the GNU General Public License version
438.21 - * 2 along with this work; if not, write to the Free Software Foundation,
438.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
438.23 - *
438.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
438.25 - * or visit www.oracle.com if you need additional information or have any
438.26 - * questions.
438.27 - */
438.28 -
438.29 -package sun.io;
438.30 -
438.31 -import sun.nio.cs.ext.IBM1047;
438.32 -
438.33 -/**
438.34 - * Tables and data to convert Unicode to Cp1047
438.35 - *
438.36 - * @author ConverterGenerator tool
438.37 - */
438.38 -
438.39 -public class CharToByteCp1047 extends CharToByteSingleByte {
438.40 -
438.41 - private final static IBM1047 nioCoder = new IBM1047();
438.42 -
438.43 - public String getCharacterEncoding() {
438.44 - return "Cp1047";
438.45 - }
438.46 -
438.47 - public CharToByteCp1047() {
438.48 - super.mask1 = 0xFF00;
438.49 - super.mask2 = 0x00FF;
438.50 - super.shift = 8;
438.51 - super.index1 = nioCoder.getEncoderIndex1();
438.52 - super.index2 = nioCoder.getEncoderIndex2();
438.53 - }
438.54 -}
439.1 --- a/src/share/classes/sun/io/CharToByteCp1097.java Thu Sep 01 13:54:38 2011 -0700
439.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
439.3 @@ -1,51 +0,0 @@
439.4 -/*
439.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
439.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
439.7 - *
439.8 - * This code is free software; you can redistribute it and/or modify it
439.9 - * under the terms of the GNU General Public License version 2 only, as
439.10 - * published by the Free Software Foundation. Oracle designates this
439.11 - * particular file as subject to the "Classpath" exception as provided
439.12 - * by Oracle in the LICENSE file that accompanied this code.
439.13 - *
439.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
439.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
439.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
439.17 - * version 2 for more details (a copy is included in the LICENSE file that
439.18 - * accompanied this code).
439.19 - *
439.20 - * You should have received a copy of the GNU General Public License version
439.21 - * 2 along with this work; if not, write to the Free Software Foundation,
439.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
439.23 - *
439.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
439.25 - * or visit www.oracle.com if you need additional information or have any
439.26 - * questions.
439.27 - */
439.28 -
439.29 -package sun.io;
439.30 -
439.31 -import sun.nio.cs.ext.IBM1097;
439.32 -
439.33 -/**
439.34 - * Tables and data to convert Unicode to Cp1097
439.35 - *
439.36 - * @author ConverterGenerator tool
439.37 - */
439.38 -
439.39 -public class CharToByteCp1097 extends CharToByteSingleByte {
439.40 -
439.41 - private final static IBM1097 nioCoder = new IBM1097();
439.42 -
439.43 - public String getCharacterEncoding() {
439.44 - return "Cp1097";
439.45 - }
439.46 -
439.47 - public CharToByteCp1097() {
439.48 - super.mask1 = 0xFF00;
439.49 - super.mask2 = 0x00FF;
439.50 - super.shift = 8;
439.51 - super.index1 = nioCoder.getEncoderIndex1();
439.52 - super.index2 = nioCoder.getEncoderIndex2();
439.53 - }
439.54 -}
440.1 --- a/src/share/classes/sun/io/CharToByteCp1098.java Thu Sep 01 13:54:38 2011 -0700
440.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
440.3 @@ -1,51 +0,0 @@
440.4 -/*
440.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
440.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
440.7 - *
440.8 - * This code is free software; you can redistribute it and/or modify it
440.9 - * under the terms of the GNU General Public License version 2 only, as
440.10 - * published by the Free Software Foundation. Oracle designates this
440.11 - * particular file as subject to the "Classpath" exception as provided
440.12 - * by Oracle in the LICENSE file that accompanied this code.
440.13 - *
440.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
440.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
440.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
440.17 - * version 2 for more details (a copy is included in the LICENSE file that
440.18 - * accompanied this code).
440.19 - *
440.20 - * You should have received a copy of the GNU General Public License version
440.21 - * 2 along with this work; if not, write to the Free Software Foundation,
440.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
440.23 - *
440.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
440.25 - * or visit www.oracle.com if you need additional information or have any
440.26 - * questions.
440.27 - */
440.28 -
440.29 -package sun.io;
440.30 -
440.31 -import sun.nio.cs.ext.IBM1098;
440.32 -
440.33 -/**
440.34 - * Tables and data to convert Unicode to Cp1098
440.35 - *
440.36 - * @author ConverterGenerator tool
440.37 - */
440.38 -
440.39 -public class CharToByteCp1098 extends CharToByteSingleByte {
440.40 -
440.41 - private final static IBM1098 nioCoder = new IBM1098();
440.42 -
440.43 - public String getCharacterEncoding() {
440.44 - return "Cp1098";
440.45 - }
440.46 -
440.47 - public CharToByteCp1098() {
440.48 - super.mask1 = 0xFF00;
440.49 - super.mask2 = 0x00FF;
440.50 - super.shift = 8;
440.51 - super.index1 = nioCoder.getEncoderIndex1();
440.52 - super.index2 = nioCoder.getEncoderIndex2();
440.53 - }
440.54 -}
441.1 --- a/src/share/classes/sun/io/CharToByteCp1112.java Thu Sep 01 13:54:38 2011 -0700
441.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
441.3 @@ -1,51 +0,0 @@
441.4 -/*
441.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
441.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
441.7 - *
441.8 - * This code is free software; you can redistribute it and/or modify it
441.9 - * under the terms of the GNU General Public License version 2 only, as
441.10 - * published by the Free Software Foundation. Oracle designates this
441.11 - * particular file as subject to the "Classpath" exception as provided
441.12 - * by Oracle in the LICENSE file that accompanied this code.
441.13 - *
441.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
441.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
441.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
441.17 - * version 2 for more details (a copy is included in the LICENSE file that
441.18 - * accompanied this code).
441.19 - *
441.20 - * You should have received a copy of the GNU General Public License version
441.21 - * 2 along with this work; if not, write to the Free Software Foundation,
441.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
441.23 - *
441.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
441.25 - * or visit www.oracle.com if you need additional information or have any
441.26 - * questions.
441.27 - */
441.28 -
441.29 -package sun.io;
441.30 -
441.31 -import sun.nio.cs.ext.IBM1112;
441.32 -
441.33 -/**
441.34 - * Tables and data to convert Unicode to Cp1112
441.35 - *
441.36 - * @author ConverterGenerator tool
441.37 - */
441.38 -
441.39 -public class CharToByteCp1112 extends CharToByteSingleByte {
441.40 -
441.41 - private final static IBM1112 nioCoder = new IBM1112();
441.42 -
441.43 - public String getCharacterEncoding() {
441.44 - return "Cp1112";
441.45 - }
441.46 -
441.47 - public CharToByteCp1112() {
441.48 - super.mask1 = 0xFF00;
441.49 - super.mask2 = 0x00FF;
441.50 - super.shift = 8;
441.51 - super.index1 = nioCoder.getEncoderIndex1();
441.52 - super.index2 = nioCoder.getEncoderIndex2();
441.53 - }
441.54 -}
442.1 --- a/src/share/classes/sun/io/CharToByteCp1122.java Thu Sep 01 13:54:38 2011 -0700
442.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
442.3 @@ -1,51 +0,0 @@
442.4 -/*
442.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
442.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
442.7 - *
442.8 - * This code is free software; you can redistribute it and/or modify it
442.9 - * under the terms of the GNU General Public License version 2 only, as
442.10 - * published by the Free Software Foundation. Oracle designates this
442.11 - * particular file as subject to the "Classpath" exception as provided
442.12 - * by Oracle in the LICENSE file that accompanied this code.
442.13 - *
442.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
442.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
442.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
442.17 - * version 2 for more details (a copy is included in the LICENSE file that
442.18 - * accompanied this code).
442.19 - *
442.20 - * You should have received a copy of the GNU General Public License version
442.21 - * 2 along with this work; if not, write to the Free Software Foundation,
442.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
442.23 - *
442.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
442.25 - * or visit www.oracle.com if you need additional information or have any
442.26 - * questions.
442.27 - */
442.28 -
442.29 -package sun.io;
442.30 -
442.31 -import sun.nio.cs.ext.IBM1122;
442.32 -
442.33 -/**
442.34 - * Tables and data to convert Unicode to Cp1122
442.35 - *
442.36 - * @author ConverterGenerator tool
442.37 - */
442.38 -
442.39 -public class CharToByteCp1122 extends CharToByteSingleByte {
442.40 -
442.41 - private final static IBM1122 nioCoder = new IBM1122();
442.42 -
442.43 - public String getCharacterEncoding() {
442.44 - return "Cp1122";
442.45 - }
442.46 -
442.47 - public CharToByteCp1122() {
442.48 - super.mask1 = 0xFF00;
442.49 - super.mask2 = 0x00FF;
442.50 - super.shift = 8;
442.51 - super.index1 = nioCoder.getEncoderIndex1();
442.52 - super.index2 = nioCoder.getEncoderIndex2();
442.53 - }
442.54 -}
443.1 --- a/src/share/classes/sun/io/CharToByteCp1123.java Thu Sep 01 13:54:38 2011 -0700
443.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
443.3 @@ -1,51 +0,0 @@
443.4 -/*
443.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
443.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
443.7 - *
443.8 - * This code is free software; you can redistribute it and/or modify it
443.9 - * under the terms of the GNU General Public License version 2 only, as
443.10 - * published by the Free Software Foundation. Oracle designates this
443.11 - * particular file as subject to the "Classpath" exception as provided
443.12 - * by Oracle in the LICENSE file that accompanied this code.
443.13 - *
443.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
443.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
443.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
443.17 - * version 2 for more details (a copy is included in the LICENSE file that
443.18 - * accompanied this code).
443.19 - *
443.20 - * You should have received a copy of the GNU General Public License version
443.21 - * 2 along with this work; if not, write to the Free Software Foundation,
443.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
443.23 - *
443.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
443.25 - * or visit www.oracle.com if you need additional information or have any
443.26 - * questions.
443.27 - */
443.28 -
443.29 -package sun.io;
443.30 -
443.31 -import sun.nio.cs.ext.IBM1123;
443.32 -
443.33 -/**
443.34 - * Tables and data to convert Unicode to Cp1123
443.35 - *
443.36 - * @author ConverterGenerator tool
443.37 - */
443.38 -
443.39 -public class CharToByteCp1123 extends CharToByteSingleByte {
443.40 -
443.41 - private final static IBM1123 nioCoder = new IBM1123();
443.42 -
443.43 - public String getCharacterEncoding() {
443.44 - return "Cp1123";
443.45 - }
443.46 -
443.47 - public CharToByteCp1123() {
443.48 - super.mask1 = 0xFF00;
443.49 - super.mask2 = 0x00FF;
443.50 - super.shift = 8;
443.51 - super.index1 = nioCoder.getEncoderIndex1();
443.52 - super.index2 = nioCoder.getEncoderIndex2();
443.53 - }
443.54 -}
444.1 --- a/src/share/classes/sun/io/CharToByteCp1124.java Thu Sep 01 13:54:38 2011 -0700
444.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
444.3 @@ -1,51 +0,0 @@
444.4 -/*
444.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
444.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
444.7 - *
444.8 - * This code is free software; you can redistribute it and/or modify it
444.9 - * under the terms of the GNU General Public License version 2 only, as
444.10 - * published by the Free Software Foundation. Oracle designates this
444.11 - * particular file as subject to the "Classpath" exception as provided
444.12 - * by Oracle in the LICENSE file that accompanied this code.
444.13 - *
444.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
444.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
444.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
444.17 - * version 2 for more details (a copy is included in the LICENSE file that
444.18 - * accompanied this code).
444.19 - *
444.20 - * You should have received a copy of the GNU General Public License version
444.21 - * 2 along with this work; if not, write to the Free Software Foundation,
444.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
444.23 - *
444.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
444.25 - * or visit www.oracle.com if you need additional information or have any
444.26 - * questions.
444.27 - */
444.28 -
444.29 -package sun.io;
444.30 -
444.31 -import sun.nio.cs.ext.IBM1124;
444.32 -
444.33 -/**
444.34 - * Tables and data to convert Unicode to Cp1124
444.35 - *
444.36 - * @author ConverterGenerator tool
444.37 - */
444.38 -
444.39 -public class CharToByteCp1124 extends CharToByteSingleByte {
444.40 -
444.41 - private final static IBM1124 nioCoder = new IBM1124();
444.42 -
444.43 - public String getCharacterEncoding() {
444.44 - return "Cp1124";
444.45 - }
444.46 -
444.47 - public CharToByteCp1124() {
444.48 - super.mask1 = 0xFF00;
444.49 - super.mask2 = 0x00FF;
444.50 - super.shift = 8;
444.51 - super.index1 = nioCoder.getEncoderIndex1();
444.52 - super.index2 = nioCoder.getEncoderIndex2();
444.53 - }
444.54 -}
445.1 --- a/src/share/classes/sun/io/CharToByteCp1140.java Thu Sep 01 13:54:38 2011 -0700
445.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
445.3 @@ -1,56 +0,0 @@
445.4 -/*
445.5 - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
445.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
445.7 - *
445.8 - * This code is free software; you can redistribute it and/or modify it
445.9 - * under the terms of the GNU General Public License version 2 only, as
445.10 - * published by the Free Software Foundation. Oracle designates this
445.11 - * particular file as subject to the "Classpath" exception as provided
445.12 - * by Oracle in the LICENSE file that accompanied this code.
445.13 - *
445.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
445.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
445.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
445.17 - * version 2 for more details (a copy is included in the LICENSE file that
445.18 - * accompanied this code).
445.19 - *
445.20 - * You should have received a copy of the GNU General Public License version
445.21 - * 2 along with this work; if not, write to the Free Software Foundation,
445.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
445.23 - *
445.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
445.25 - * or visit www.oracle.com if you need additional information or have any
445.26 - * questions.
445.27 - */
445.28 -
445.29 -/*
445.30 - * (C) Copyright IBM Corp. 1998 - All Rights Reserved
445.31 - *
445.32 - */
445.33 -
445.34 -package sun.io;
445.35 -
445.36 -import sun.nio.cs.ext.IBM1140;
445.37 -
445.38 -/**
445.39 - * Tables and data to convert Unicode to Cp1140
445.40 - *
445.41 - * @author ConverterGenerator tool
445.42 - */
445.43 -
445.44 -public class CharToByteCp1140 extends CharToByteSingleByte {
445.45 -
445.46 - private final static IBM1140 nioCoder = new IBM1140();
445.47 -
445.48 - public String getCharacterEncoding() {
445.49 - return "Cp1140";
445.50 - }
445.51 -
445.52 - public CharToByteCp1140() {
445.53 - super.mask1 = 0xFF00;
445.54 - super.mask2 = 0x00FF;
445.55 - super.shift = 8;
445.56 - super.index1 = nioCoder.getEncoderIndex1();
445.57 - super.index2 = nioCoder.getEncoderIndex2();
445.58 - }
445.59 -}
446.1 --- a/src/share/classes/sun/io/CharToByteCp1141.java Thu Sep 01 13:54:38 2011 -0700
446.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
446.3 @@ -1,56 +0,0 @@
446.4 -/*
446.5 - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
446.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
446.7 - *
446.8 - * This code is free software; you can redistribute it and/or modify it
446.9 - * under the terms of the GNU General Public License version 2 only, as
446.10 - * published by the Free Software Foundation. Oracle designates this
446.11 - * particular file as subject to the "Classpath" exception as provided
446.12 - * by Oracle in the LICENSE file that accompanied this code.
446.13 - *
446.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
446.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
446.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
446.17 - * version 2 for more details (a copy is included in the LICENSE file that
446.18 - * accompanied this code).
446.19 - *
446.20 - * You should have received a copy of the GNU General Public License version
446.21 - * 2 along with this work; if not, write to the Free Software Foundation,
446.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
446.23 - *
446.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
446.25 - * or visit www.oracle.com if you need additional information or have any
446.26 - * questions.
446.27 - */
446.28 -
446.29 -/*
446.30 - * (C) Copyright IBM Corp. 1998 - All Rights Reserved
446.31 - *
446.32 - */
446.33 -
446.34 -package sun.io;
446.35 -
446.36 -import sun.nio.cs.ext.IBM1141;
446.37 -
446.38 -/**
446.39 - * Tables and data to convert Unicode to Cp1141
446.40 - *
446.41 - * @author ConverterGenerator tool
446.42 - */
446.43 -
446.44 -public class CharToByteCp1141 extends CharToByteSingleByte {
446.45 -
446.46 - private final static IBM1141 nioCoder = new IBM1141();
446.47 -
446.48 - public String getCharacterEncoding() {
446.49 - return "Cp1141";
446.50 - }
446.51 -
446.52 - public CharToByteCp1141() {
446.53 - super.mask1 = 0xFF00;
446.54 - super.mask2 = 0x00FF;
446.55 - super.shift = 8;
446.56 - super.index1 = nioCoder.getEncoderIndex1();
446.57 - super.index2 = nioCoder.getEncoderIndex2();
446.58 - }
446.59 -}
447.1 --- a/src/share/classes/sun/io/CharToByteCp1142.java Thu Sep 01 13:54:38 2011 -0700
447.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
447.3 @@ -1,56 +0,0 @@
447.4 -/*
447.5 - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
447.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
447.7 - *
447.8 - * This code is free software; you can redistribute it and/or modify it
447.9 - * under the terms of the GNU General Public License version 2 only, as
447.10 - * published by the Free Software Foundation. Oracle designates this
447.11 - * particular file as subject to the "Classpath" exception as provided
447.12 - * by Oracle in the LICENSE file that accompanied this code.
447.13 - *
447.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
447.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
447.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
447.17 - * version 2 for more details (a copy is included in the LICENSE file that
447.18 - * accompanied this code).
447.19 - *
447.20 - * You should have received a copy of the GNU General Public License version
447.21 - * 2 along with this work; if not, write to the Free Software Foundation,
447.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
447.23 - *
447.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
447.25 - * or visit www.oracle.com if you need additional information or have any
447.26 - * questions.
447.27 - */
447.28 -
447.29 -/*
447.30 - * (C) Copyright IBM Corp. 1998 - All Rights Reserved
447.31 - *
447.32 - */
447.33 -
447.34 -package sun.io;
447.35 -
447.36 -import sun.nio.cs.ext.IBM1142;
447.37 -
447.38 -/**
447.39 - * Tables and data to convert Unicode to Cp1142
447.40 - *
447.41 - * @author ConverterGenerator tool
447.42 - */
447.43 -
447.44 -public class CharToByteCp1142 extends CharToByteSingleByte {
447.45 -
447.46 - private final static IBM1142 nioCoder = new IBM1142();
447.47 -
447.48 - public String getCharacterEncoding() {
447.49 - return "Cp1142";
447.50 - }
447.51 -
447.52 - public CharToByteCp1142() {
447.53 - super.mask1 = 0xFF00;
447.54 - super.mask2 = 0x00FF;
447.55 - super.shift = 8;
447.56 - super.index1 = nioCoder.getEncoderIndex1();
447.57 - super.index2 = nioCoder.getEncoderIndex2();
447.58 - }
447.59 -}
448.1 --- a/src/share/classes/sun/io/CharToByteCp1143.java Thu Sep 01 13:54:38 2011 -0700
448.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
448.3 @@ -1,56 +0,0 @@
448.4 -/*
448.5 - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
448.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
448.7 - *
448.8 - * This code is free software; you can redistribute it and/or modify it
448.9 - * under the terms of the GNU General Public License version 2 only, as
448.10 - * published by the Free Software Foundation. Oracle designates this
448.11 - * particular file as subject to the "Classpath" exception as provided
448.12 - * by Oracle in the LICENSE file that accompanied this code.
448.13 - *
448.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
448.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
448.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
448.17 - * version 2 for more details (a copy is included in the LICENSE file that
448.18 - * accompanied this code).
448.19 - *
448.20 - * You should have received a copy of the GNU General Public License version
448.21 - * 2 along with this work; if not, write to the Free Software Foundation,
448.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
448.23 - *
448.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
448.25 - * or visit www.oracle.com if you need additional information or have any
448.26 - * questions.
448.27 - */
448.28 -
448.29 -/*
448.30 - * (C) Copyright IBM Corp. 1998 - All Rights Reserved
448.31 - *
448.32 - */
448.33 -
448.34 -package sun.io;
448.35 -
448.36 -import sun.nio.cs.ext.IBM1143;
448.37 -
448.38 -/**
448.39 - * Tables and data to convert Unicode to Cp1143
448.40 - *
448.41 - * @author ConverterGenerator tool
448.42 - */
448.43 -
448.44 -public class CharToByteCp1143 extends CharToByteSingleByte {
448.45 -
448.46 - private final static IBM1143 nioCoder = new IBM1143();
448.47 -
448.48 - public String getCharacterEncoding() {
448.49 - return "Cp1143";
448.50 - }
448.51 -
448.52 - public CharToByteCp1143() {
448.53 - super.mask1 = 0xFF00;
448.54 - super.mask2 = 0x00FF;
448.55 - super.shift = 8;
448.56 - super.index1 = nioCoder.getEncoderIndex1();
448.57 - super.index2 = nioCoder.getEncoderIndex2();
448.58 - }
448.59 -}
449.1 --- a/src/share/classes/sun/io/CharToByteCp1144.java Thu Sep 01 13:54:38 2011 -0700
449.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
449.3 @@ -1,56 +0,0 @@
449.4 -/*
449.5 - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
449.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
449.7 - *
449.8 - * This code is free software; you can redistribute it and/or modify it
449.9 - * under the terms of the GNU General Public License version 2 only, as
449.10 - * published by the Free Software Foundation. Oracle designates this
449.11 - * particular file as subject to the "Classpath" exception as provided
449.12 - * by Oracle in the LICENSE file that accompanied this code.
449.13 - *
449.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
449.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
449.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
449.17 - * version 2 for more details (a copy is included in the LICENSE file that
449.18 - * accompanied this code).
449.19 - *
449.20 - * You should have received a copy of the GNU General Public License version
449.21 - * 2 along with this work; if not, write to the Free Software Foundation,
449.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
449.23 - *
449.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
449.25 - * or visit www.oracle.com if you need additional information or have any
449.26 - * questions.
449.27 - */
449.28 -
449.29 -/*
449.30 - * (C) Copyright IBM Corp. 1998 - All Rights Reserved
449.31 - *
449.32 - */
449.33 -
449.34 -package sun.io;
449.35 -
449.36 -import sun.nio.cs.ext.IBM1144;
449.37 -
449.38 -/**
449.39 - * Tables and data to convert Unicode to Cp1144
449.40 - *
449.41 - * @author ConverterGenerator tool
449.42 - */
449.43 -
449.44 -public class CharToByteCp1144 extends CharToByteSingleByte {
449.45 -
449.46 - private final static IBM1144 nioCoder = new IBM1144();
449.47 -
449.48 - public String getCharacterEncoding() {
449.49 - return "Cp1144";
449.50 - }
449.51 -
449.52 - public CharToByteCp1144() {
449.53 - super.mask1 = 0xFF00;
449.54 - super.mask2 = 0x00FF;
449.55 - super.shift = 8;
449.56 - super.index1 = nioCoder.getEncoderIndex1();
449.57 - super.index2 = nioCoder.getEncoderIndex2();
449.58 - }
449.59 -}
450.1 --- a/src/share/classes/sun/io/CharToByteCp1145.java Thu Sep 01 13:54:38 2011 -0700
450.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
450.3 @@ -1,56 +0,0 @@
450.4 -/*
450.5 - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
450.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
450.7 - *
450.8 - * This code is free software; you can redistribute it and/or modify it
450.9 - * under the terms of the GNU General Public License version 2 only, as
450.10 - * published by the Free Software Foundation. Oracle designates this
450.11 - * particular file as subject to the "Classpath" exception as provided
450.12 - * by Oracle in the LICENSE file that accompanied this code.
450.13 - *
450.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
450.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
450.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
450.17 - * version 2 for more details (a copy is included in the LICENSE file that
450.18 - * accompanied this code).
450.19 - *
450.20 - * You should have received a copy of the GNU General Public License version
450.21 - * 2 along with this work; if not, write to the Free Software Foundation,
450.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
450.23 - *
450.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
450.25 - * or visit www.oracle.com if you need additional information or have any
450.26 - * questions.
450.27 - */
450.28 -
450.29 -/*
450.30 - * (C) Copyright IBM Corp. 1998 - All Rights Reserved
450.31 - *
450.32 - */
450.33 -
450.34 -package sun.io;
450.35 -
450.36 -import sun.nio.cs.ext.IBM1145;
450.37 -
450.38 -/**
450.39 - * Tables and data to convert Unicode to Cp1145
450.40 - *
450.41 - * @author ConverterGenerator tool
450.42 - */
450.43 -
450.44 -public class CharToByteCp1145 extends CharToByteSingleByte {
450.45 -
450.46 - private final static IBM1145 nioCoder = new IBM1145();
450.47 -
450.48 - public String getCharacterEncoding() {
450.49 - return "Cp1145";
450.50 - }
450.51 -
450.52 - public CharToByteCp1145() {
450.53 - super.mask1 = 0xFF00;
450.54 - super.mask2 = 0x00FF;
450.55 - super.shift = 8;
450.56 - super.index1 = nioCoder.getEncoderIndex1();
450.57 - super.index2 = nioCoder.getEncoderIndex2();
450.58 - }
450.59 -}
451.1 --- a/src/share/classes/sun/io/CharToByteCp1146.java Thu Sep 01 13:54:38 2011 -0700
451.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
451.3 @@ -1,56 +0,0 @@
451.4 -/*
451.5 - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
451.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
451.7 - *
451.8 - * This code is free software; you can redistribute it and/or modify it
451.9 - * under the terms of the GNU General Public License version 2 only, as
451.10 - * published by the Free Software Foundation. Oracle designates this
451.11 - * particular file as subject to the "Classpath" exception as provided
451.12 - * by Oracle in the LICENSE file that accompanied this code.
451.13 - *
451.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
451.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
451.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
451.17 - * version 2 for more details (a copy is included in the LICENSE file that
451.18 - * accompanied this code).
451.19 - *
451.20 - * You should have received a copy of the GNU General Public License version
451.21 - * 2 along with this work; if not, write to the Free Software Foundation,
451.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
451.23 - *
451.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
451.25 - * or visit www.oracle.com if you need additional information or have any
451.26 - * questions.
451.27 - */
451.28 -
451.29 -/*
451.30 - * (C) Copyright IBM Corp. 1998 - All Rights Reserved
451.31 - *
451.32 - */
451.33 -
451.34 -package sun.io;
451.35 -
451.36 -import sun.nio.cs.ext.IBM1146;
451.37 -
451.38 -/**
451.39 - * Tables and data to convert Unicode to Cp1146
451.40 - *
451.41 - * @author ConverterGenerator tool
451.42 - */
451.43 -
451.44 -public class CharToByteCp1146 extends CharToByteSingleByte {
451.45 -
451.46 - private final static IBM1146 nioCoder = new IBM1146();
451.47 -
451.48 - public String getCharacterEncoding() {
451.49 - return "Cp1146";
451.50 - }
451.51 -
451.52 - public CharToByteCp1146() {
451.53 - super.mask1 = 0xFF00;
451.54 - super.mask2 = 0x00FF;
451.55 - super.shift = 8;
451.56 - super.index1 = nioCoder.getEncoderIndex1();
451.57 - super.index2 = nioCoder.getEncoderIndex2();
451.58 - }
451.59 -}
452.1 --- a/src/share/classes/sun/io/CharToByteCp1147.java Thu Sep 01 13:54:38 2011 -0700
452.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
452.3 @@ -1,56 +0,0 @@
452.4 -/*
452.5 - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
452.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
452.7 - *
452.8 - * This code is free software; you can redistribute it and/or modify it
452.9 - * under the terms of the GNU General Public License version 2 only, as
452.10 - * published by the Free Software Foundation. Oracle designates this
452.11 - * particular file as subject to the "Classpath" exception as provided
452.12 - * by Oracle in the LICENSE file that accompanied this code.
452.13 - *
452.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
452.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
452.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
452.17 - * version 2 for more details (a copy is included in the LICENSE file that
452.18 - * accompanied this code).
452.19 - *
452.20 - * You should have received a copy of the GNU General Public License version
452.21 - * 2 along with this work; if not, write to the Free Software Foundation,
452.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
452.23 - *
452.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
452.25 - * or visit www.oracle.com if you need additional information or have any
452.26 - * questions.
452.27 - */
452.28 -
452.29 -/*
452.30 - * (C) Copyright IBM Corp. 1998 - All Rights Reserved
452.31 - *
452.32 - */
452.33 -
452.34 -package sun.io;
452.35 -
452.36 -import sun.nio.cs.ext.IBM1147;
452.37 -
452.38 -/**
452.39 - * Tables and data to convert Unicode to Cp1147
452.40 - *
452.41 - * @author ConverterGenerator tool
452.42 - */
452.43 -
452.44 -public class CharToByteCp1147 extends CharToByteSingleByte {
452.45 -
452.46 - private final static IBM1147 nioCoder = new IBM1147();
452.47 -
452.48 - public String getCharacterEncoding() {
452.49 - return "Cp1147";
452.50 - }
452.51 -
452.52 - public CharToByteCp1147() {
452.53 - super.mask1 = 0xFF00;
452.54 - super.mask2 = 0x00FF;
452.55 - super.shift = 8;
452.56 - super.index1 = nioCoder.getEncoderIndex1();
452.57 - super.index2 = nioCoder.getEncoderIndex2();
452.58 - }
452.59 -}
453.1 --- a/src/share/classes/sun/io/CharToByteCp1148.java Thu Sep 01 13:54:38 2011 -0700
453.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
453.3 @@ -1,56 +0,0 @@
453.4 -/*
453.5 - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
453.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
453.7 - *
453.8 - * This code is free software; you can redistribute it and/or modify it
453.9 - * under the terms of the GNU General Public License version 2 only, as
453.10 - * published by the Free Software Foundation. Oracle designates this
453.11 - * particular file as subject to the "Classpath" exception as provided
453.12 - * by Oracle in the LICENSE file that accompanied this code.
453.13 - *
453.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
453.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
453.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
453.17 - * version 2 for more details (a copy is included in the LICENSE file that
453.18 - * accompanied this code).
453.19 - *
453.20 - * You should have received a copy of the GNU General Public License version
453.21 - * 2 along with this work; if not, write to the Free Software Foundation,
453.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
453.23 - *
453.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
453.25 - * or visit www.oracle.com if you need additional information or have any
453.26 - * questions.
453.27 - */
453.28 -
453.29 -/*
453.30 - * (C) Copyright IBM Corp. 1998 - All Rights Reserved
453.31 - *
453.32 - */
453.33 -
453.34 -package sun.io;
453.35 -
453.36 -import sun.nio.cs.ext.IBM1148;
453.37 -
453.38 -/**
453.39 - * Tables and data to convert Unicode to Cp1148
453.40 - *
453.41 - * @author ConverterGenerator tool
453.42 - */
453.43 -
453.44 -public class CharToByteCp1148 extends CharToByteSingleByte {
453.45 -
453.46 - private final static IBM1148 nioCoder = new IBM1148();
453.47 -
453.48 - public String getCharacterEncoding() {
453.49 - return "Cp1148";
453.50 - }
453.51 -
453.52 - public CharToByteCp1148() {
453.53 - super.mask1 = 0xFF00;
453.54 - super.mask2 = 0x00FF;
453.55 - super.shift = 8;
453.56 - super.index1 = nioCoder.getEncoderIndex1();
453.57 - super.index2 = nioCoder.getEncoderIndex2();
453.58 - }
453.59 -}
454.1 --- a/src/share/classes/sun/io/CharToByteCp1149.java Thu Sep 01 13:54:38 2011 -0700
454.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
454.3 @@ -1,56 +0,0 @@
454.4 -/*
454.5 - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
454.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
454.7 - *
454.8 - * This code is free software; you can redistribute it and/or modify it
454.9 - * under the terms of the GNU General Public License version 2 only, as
454.10 - * published by the Free Software Foundation. Oracle designates this
454.11 - * particular file as subject to the "Classpath" exception as provided
454.12 - * by Oracle in the LICENSE file that accompanied this code.
454.13 - *
454.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
454.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
454.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
454.17 - * version 2 for more details (a copy is included in the LICENSE file that
454.18 - * accompanied this code).
454.19 - *
454.20 - * You should have received a copy of the GNU General Public License version
454.21 - * 2 along with this work; if not, write to the Free Software Foundation,
454.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
454.23 - *
454.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
454.25 - * or visit www.oracle.com if you need additional information or have any
454.26 - * questions.
454.27 - */
454.28 -
454.29 -/*
454.30 - * (C) Copyright IBM Corp. 1998 - All Rights Reserved
454.31 - *
454.32 - */
454.33 -
454.34 -package sun.io;
454.35 -
454.36 -import sun.nio.cs.ext.IBM1149;
454.37 -
454.38 -/**
454.39 - * Tables and data to convert Unicode to Cp1149
454.40 - *
454.41 - * @author ConverterGenerator tool
454.42 - */
454.43 -
454.44 -public class CharToByteCp1149 extends CharToByteSingleByte {
454.45 -
454.46 - private final static IBM1149 nioCoder = new IBM1149();
454.47 -
454.48 - public String getCharacterEncoding() {
454.49 - return "Cp1149";
454.50 - }
454.51 -
454.52 - public CharToByteCp1149() {
454.53 - super.mask1 = 0xFF00;
454.54 - super.mask2 = 0x00FF;
454.55 - super.shift = 8;
454.56 - super.index1 = nioCoder.getEncoderIndex1();
454.57 - super.index2 = nioCoder.getEncoderIndex2();
454.58 - }
454.59 -}
455.1 --- a/src/share/classes/sun/io/CharToByteCp1250.java Thu Sep 01 13:54:38 2011 -0700
455.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
455.3 @@ -1,52 +0,0 @@
455.4 -/*
455.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
455.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
455.7 - *
455.8 - * This code is free software; you can redistribute it and/or modify it
455.9 - * under the terms of the GNU General Public License version 2 only, as
455.10 - * published by the Free Software Foundation. Oracle designates this
455.11 - * particular file as subject to the "Classpath" exception as provided
455.12 - * by Oracle in the LICENSE file that accompanied this code.
455.13 - *
455.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
455.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
455.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
455.17 - * version 2 for more details (a copy is included in the LICENSE file that
455.18 - * accompanied this code).
455.19 - *
455.20 - * You should have received a copy of the GNU General Public License version
455.21 - * 2 along with this work; if not, write to the Free Software Foundation,
455.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
455.23 - *
455.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
455.25 - * or visit www.oracle.com if you need additional information or have any
455.26 - * questions.
455.27 - */
455.28 -
455.29 -
455.30 -package sun.io;
455.31 -
455.32 -import sun.nio.cs.MS1250;
455.33 -
455.34 -/**
455.35 - * Tables and data to convert Unicode to Cp1250
455.36 - *
455.37 - * @author ConverterGenerator tool
455.38 - */
455.39 -
455.40 -public class CharToByteCp1250 extends CharToByteSingleByte {
455.41 -
455.42 - private final static MS1250 nioCoder = new MS1250();
455.43 -
455.44 - public String getCharacterEncoding() {
455.45 - return "Cp1250";
455.46 - }
455.47 -
455.48 - public CharToByteCp1250() {
455.49 - super.mask1 = 0xFF00;
455.50 - super.mask2 = 0x00FF;
455.51 - super.shift = 8;
455.52 - super.index1 = nioCoder.getEncoderIndex1();
455.53 - super.index2 = nioCoder.getEncoderIndex2();
455.54 - }
455.55 -}
456.1 --- a/src/share/classes/sun/io/CharToByteCp1251.java Thu Sep 01 13:54:38 2011 -0700
456.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
456.3 @@ -1,51 +0,0 @@
456.4 -/*
456.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
456.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
456.7 - *
456.8 - * This code is free software; you can redistribute it and/or modify it
456.9 - * under the terms of the GNU General Public License version 2 only, as
456.10 - * published by the Free Software Foundation. Oracle designates this
456.11 - * particular file as subject to the "Classpath" exception as provided
456.12 - * by Oracle in the LICENSE file that accompanied this code.
456.13 - *
456.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
456.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
456.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
456.17 - * version 2 for more details (a copy is included in the LICENSE file that
456.18 - * accompanied this code).
456.19 - *
456.20 - * You should have received a copy of the GNU General Public License version
456.21 - * 2 along with this work; if not, write to the Free Software Foundation,
456.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
456.23 - *
456.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
456.25 - * or visit www.oracle.com if you need additional information or have any
456.26 - * questions.
456.27 - */
456.28 -
456.29 -package sun.io;
456.30 -
456.31 -import sun.nio.cs.MS1251;
456.32 -
456.33 -/**
456.34 - * Tables and data to convert Unicode to Cp1251
456.35 - *
456.36 - * @author ConverterGenerator tool
456.37 - */
456.38 -
456.39 -public class CharToByteCp1251 extends CharToByteSingleByte {
456.40 -
456.41 - private final static MS1251 nioCoder = new MS1251();
456.42 -
456.43 - public String getCharacterEncoding() {
456.44 - return "Cp1251";
456.45 - }
456.46 -
456.47 - public CharToByteCp1251() {
456.48 - super.mask1 = 0xFF00;
456.49 - super.mask2 = 0x00FF;
456.50 - super.shift = 8;
456.51 - super.index1 = nioCoder.getEncoderIndex1();
456.52 - super.index2 = nioCoder.getEncoderIndex2();
456.53 - }
456.54 -}
457.1 --- a/src/share/classes/sun/io/CharToByteCp1252.java Thu Sep 01 13:54:38 2011 -0700
457.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
457.3 @@ -1,51 +0,0 @@
457.4 -/*
457.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
457.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
457.7 - *
457.8 - * This code is free software; you can redistribute it and/or modify it
457.9 - * under the terms of the GNU General Public License version 2 only, as
457.10 - * published by the Free Software Foundation. Oracle designates this
457.11 - * particular file as subject to the "Classpath" exception as provided
457.12 - * by Oracle in the LICENSE file that accompanied this code.
457.13 - *
457.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
457.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
457.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
457.17 - * version 2 for more details (a copy is included in the LICENSE file that
457.18 - * accompanied this code).
457.19 - *
457.20 - * You should have received a copy of the GNU General Public License version
457.21 - * 2 along with this work; if not, write to the Free Software Foundation,
457.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
457.23 - *
457.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
457.25 - * or visit www.oracle.com if you need additional information or have any
457.26 - * questions.
457.27 - */
457.28 -
457.29 -package sun.io;
457.30 -
457.31 -import sun.nio.cs.MS1252;
457.32 -
457.33 -/**
457.34 - * Tables and data to convert Unicode to Cp1252
457.35 - *
457.36 - * @author ConverterGenerator tool
457.37 - */
457.38 -
457.39 -public class CharToByteCp1252 extends CharToByteSingleByte {
457.40 -
457.41 - private final static MS1252 nioCoder = new MS1252();
457.42 -
457.43 - public String getCharacterEncoding() {
457.44 - return "Cp1252";
457.45 - }
457.46 -
457.47 - public CharToByteCp1252() {
457.48 - super.mask1 = 0xFF00;
457.49 - super.mask2 = 0x00FF;
457.50 - super.shift = 8;
457.51 - super.index1 = nioCoder.getEncoderIndex1();
457.52 - super.index2 = nioCoder.getEncoderIndex2();
457.53 - }
457.54 -}
458.1 --- a/src/share/classes/sun/io/CharToByteCp1253.java Thu Sep 01 13:54:38 2011 -0700
458.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
458.3 @@ -1,51 +0,0 @@
458.4 -/*
458.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
458.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
458.7 - *
458.8 - * This code is free software; you can redistribute it and/or modify it
458.9 - * under the terms of the GNU General Public License version 2 only, as
458.10 - * published by the Free Software Foundation. Oracle designates this
458.11 - * particular file as subject to the "Classpath" exception as provided
458.12 - * by Oracle in the LICENSE file that accompanied this code.
458.13 - *
458.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
458.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
458.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
458.17 - * version 2 for more details (a copy is included in the LICENSE file that
458.18 - * accompanied this code).
458.19 - *
458.20 - * You should have received a copy of the GNU General Public License version
458.21 - * 2 along with this work; if not, write to the Free Software Foundation,
458.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
458.23 - *
458.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
458.25 - * or visit www.oracle.com if you need additional information or have any
458.26 - * questions.
458.27 - */
458.28 -
458.29 -package sun.io;
458.30 -
458.31 -import sun.nio.cs.MS1253;
458.32 -
458.33 -/**
458.34 - * Tables and data to convert Unicode to Cp1253
458.35 - *
458.36 - * @author ConverterGenerator tool
458.37 - */
458.38 -
458.39 -public class CharToByteCp1253 extends CharToByteSingleByte {
458.40 -
458.41 - private final static MS1253 nioCoder = new MS1253();
458.42 -
458.43 - public String getCharacterEncoding() {
458.44 - return "Cp1253";
458.45 - }
458.46 -
458.47 - public CharToByteCp1253() {
458.48 - super.mask1 = 0xFF00;
458.49 - super.mask2 = 0x00FF;
458.50 - super.shift = 8;
458.51 - super.index1 = nioCoder.getEncoderIndex1();
458.52 - super.index2 = nioCoder.getEncoderIndex2();
458.53 - }
458.54 -}
459.1 --- a/src/share/classes/sun/io/CharToByteCp1254.java Thu Sep 01 13:54:38 2011 -0700
459.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
459.3 @@ -1,51 +0,0 @@
459.4 -/*
459.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
459.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
459.7 - *
459.8 - * This code is free software; you can redistribute it and/or modify it
459.9 - * under the terms of the GNU General Public License version 2 only, as
459.10 - * published by the Free Software Foundation. Oracle designates this
459.11 - * particular file as subject to the "Classpath" exception as provided
459.12 - * by Oracle in the LICENSE file that accompanied this code.
459.13 - *
459.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
459.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
459.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
459.17 - * version 2 for more details (a copy is included in the LICENSE file that
459.18 - * accompanied this code).
459.19 - *
459.20 - * You should have received a copy of the GNU General Public License version
459.21 - * 2 along with this work; if not, write to the Free Software Foundation,
459.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
459.23 - *
459.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
459.25 - * or visit www.oracle.com if you need additional information or have any
459.26 - * questions.
459.27 - */
459.28 -
459.29 -package sun.io;
459.30 -
459.31 -import sun.nio.cs.MS1254;
459.32 -
459.33 -/**
459.34 - * Tables and data to convert Unicode to Cp1254
459.35 - *
459.36 - * @author ConverterGenerator tool
459.37 - */
459.38 -
459.39 -public class CharToByteCp1254 extends CharToByteSingleByte {
459.40 -
459.41 - private final static MS1254 nioCoder = new MS1254();
459.42 -
459.43 - public String getCharacterEncoding() {
459.44 - return "Cp1254";
459.45 - }
459.46 -
459.47 - public CharToByteCp1254() {
459.48 - super.mask1 = 0xFF00;
459.49 - super.mask2 = 0x00FF;
459.50 - super.shift = 8;
459.51 - super.index1 = nioCoder.getEncoderIndex1();
459.52 - super.index2 = nioCoder.getEncoderIndex2();
459.53 - }
459.54 -}
460.1 --- a/src/share/classes/sun/io/CharToByteCp1255.java Thu Sep 01 13:54:38 2011 -0700
460.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
460.3 @@ -1,52 +0,0 @@
460.4 -/*
460.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
460.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
460.7 - *
460.8 - * This code is free software; you can redistribute it and/or modify it
460.9 - * under the terms of the GNU General Public License version 2 only, as
460.10 - * published by the Free Software Foundation. Oracle designates this
460.11 - * particular file as subject to the "Classpath" exception as provided
460.12 - * by Oracle in the LICENSE file that accompanied this code.
460.13 - *
460.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
460.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
460.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
460.17 - * version 2 for more details (a copy is included in the LICENSE file that
460.18 - * accompanied this code).
460.19 - *
460.20 - * You should have received a copy of the GNU General Public License version
460.21 - * 2 along with this work; if not, write to the Free Software Foundation,
460.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
460.23 - *
460.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
460.25 - * or visit www.oracle.com if you need additional information or have any
460.26 - * questions.
460.27 - */
460.28 -
460.29 -
460.30 -package sun.io;
460.31 -
460.32 -import sun.nio.cs.ext.MS1255;
460.33 -
460.34 -/**
460.35 - * Tables and data to convert Unicode to Cp1255
460.36 - *
460.37 - * @author ConverterGenerator tool
460.38 - */
460.39 -
460.40 -public class CharToByteCp1255 extends CharToByteSingleByte {
460.41 -
460.42 - private final static MS1255 nioCoder = new MS1255();
460.43 -
460.44 - public String getCharacterEncoding() {
460.45 - return "Cp1255";
460.46 - }
460.47 -
460.48 - public CharToByteCp1255() {
460.49 - super.mask1 = 0xFF00;
460.50 - super.mask2 = 0x00FF;
460.51 - super.shift = 8;
460.52 - super.index1 = nioCoder.getEncoderIndex1();
460.53 - super.index2 = nioCoder.getEncoderIndex2();
460.54 - }
460.55 -}
461.1 --- a/src/share/classes/sun/io/CharToByteCp1256.java Thu Sep 01 13:54:38 2011 -0700
461.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
461.3 @@ -1,52 +0,0 @@
461.4 -/*
461.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
461.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
461.7 - *
461.8 - * This code is free software; you can redistribute it and/or modify it
461.9 - * under the terms of the GNU General Public License version 2 only, as
461.10 - * published by the Free Software Foundation. Oracle designates this
461.11 - * particular file as subject to the "Classpath" exception as provided
461.12 - * by Oracle in the LICENSE file that accompanied this code.
461.13 - *
461.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
461.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
461.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
461.17 - * version 2 for more details (a copy is included in the LICENSE file that
461.18 - * accompanied this code).
461.19 - *
461.20 - * You should have received a copy of the GNU General Public License version
461.21 - * 2 along with this work; if not, write to the Free Software Foundation,
461.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
461.23 - *
461.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
461.25 - * or visit www.oracle.com if you need additional information or have any
461.26 - * questions.
461.27 - */
461.28 -
461.29 -
461.30 -package sun.io;
461.31 -
461.32 -import sun.nio.cs.ext.MS1256;
461.33 -
461.34 -/**
461.35 - * Tables and data to convert Unicode to Cp1256
461.36 - *
461.37 - * @author ConverterGenerator tool
461.38 - */
461.39 -
461.40 -public class CharToByteCp1256 extends CharToByteSingleByte {
461.41 -
461.42 - private final static MS1256 nioCoder = new MS1256();
461.43 -
461.44 - public String getCharacterEncoding() {
461.45 - return "Cp1256";
461.46 - }
461.47 -
461.48 - public CharToByteCp1256() {
461.49 - super.mask1 = 0xFF00;
461.50 - super.mask2 = 0x00FF;
461.51 - super.shift = 8;
461.52 - super.index1 = nioCoder.getEncoderIndex1();
461.53 - super.index2 = nioCoder.getEncoderIndex2();
461.54 - }
461.55 -}
462.1 --- a/src/share/classes/sun/io/CharToByteCp1257.java Thu Sep 01 13:54:38 2011 -0700
462.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
462.3 @@ -1,51 +0,0 @@
462.4 -/*
462.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
462.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
462.7 - *
462.8 - * This code is free software; you can redistribute it and/or modify it
462.9 - * under the terms of the GNU General Public License version 2 only, as
462.10 - * published by the Free Software Foundation. Oracle designates this
462.11 - * particular file as subject to the "Classpath" exception as provided
462.12 - * by Oracle in the LICENSE file that accompanied this code.
462.13 - *
462.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
462.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
462.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
462.17 - * version 2 for more details (a copy is included in the LICENSE file that
462.18 - * accompanied this code).
462.19 - *
462.20 - * You should have received a copy of the GNU General Public License version
462.21 - * 2 along with this work; if not, write to the Free Software Foundation,
462.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
462.23 - *
462.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
462.25 - * or visit www.oracle.com if you need additional information or have any
462.26 - * questions.
462.27 - */
462.28 -
462.29 -package sun.io;
462.30 -
462.31 -import sun.nio.cs.MS1257;
462.32 -
462.33 -/**
462.34 - * Tables and data to convert Unicode to Cp1257
462.35 - *
462.36 - * @author ConverterGenerator tool
462.37 - */
462.38 -
462.39 -public class CharToByteCp1257 extends CharToByteSingleByte {
462.40 -
462.41 - private final static MS1257 nioCoder = new MS1257();
462.42 -
462.43 - public String getCharacterEncoding() {
462.44 - return "Cp1257";
462.45 - }
462.46 -
462.47 - public CharToByteCp1257() {
462.48 - super.mask1 = 0xFF00;
462.49 - super.mask2 = 0x00FF;
462.50 - super.shift = 8;
462.51 - super.index1 = nioCoder.getEncoderIndex1();
462.52 - super.index2 = nioCoder.getEncoderIndex2();
462.53 - }
462.54 -}
463.1 --- a/src/share/classes/sun/io/CharToByteCp1258.java Thu Sep 01 13:54:38 2011 -0700
463.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
463.3 @@ -1,52 +0,0 @@
463.4 -/*
463.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
463.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
463.7 - *
463.8 - * This code is free software; you can redistribute it and/or modify it
463.9 - * under the terms of the GNU General Public License version 2 only, as
463.10 - * published by the Free Software Foundation. Oracle designates this
463.11 - * particular file as subject to the "Classpath" exception as provided
463.12 - * by Oracle in the LICENSE file that accompanied this code.
463.13 - *
463.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
463.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
463.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
463.17 - * version 2 for more details (a copy is included in the LICENSE file that
463.18 - * accompanied this code).
463.19 - *
463.20 - * You should have received a copy of the GNU General Public License version
463.21 - * 2 along with this work; if not, write to the Free Software Foundation,
463.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
463.23 - *
463.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
463.25 - * or visit www.oracle.com if you need additional information or have any
463.26 - * questions.
463.27 - */
463.28 -
463.29 -
463.30 -package sun.io;
463.31 -
463.32 -import sun.nio.cs.ext.MS1258;
463.33 -
463.34 -/**
463.35 - * Tables and data to convert Unicode to Cp1258
463.36 - *
463.37 - * @author ConverterGenerator tool
463.38 - */
463.39 -
463.40 -public class CharToByteCp1258 extends CharToByteSingleByte {
463.41 -
463.42 - private final static MS1258 nioCoder = new MS1258();
463.43 -
463.44 - public String getCharacterEncoding() {
463.45 - return "Cp1258";
463.46 - }
463.47 -
463.48 - public CharToByteCp1258() {
463.49 - super.mask1 = 0xFF00;
463.50 - super.mask2 = 0x00FF;
463.51 - super.shift = 8;
463.52 - super.index1 = nioCoder.getEncoderIndex1();
463.53 - super.index2 = nioCoder.getEncoderIndex2();
463.54 - }
463.55 -}
464.1 --- a/src/share/classes/sun/io/CharToByteCp1381.java Thu Sep 01 13:54:38 2011 -0700
464.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
464.3 @@ -1,39 +0,0 @@
464.4 -/*
464.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
464.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
464.7 - *
464.8 - * This code is free software; you can redistribute it and/or modify it
464.9 - * under the terms of the GNU General Public License version 2 only, as
464.10 - * published by the Free Software Foundation. Oracle designates this
464.11 - * particular file as subject to the "Classpath" exception as provided
464.12 - * by Oracle in the LICENSE file that accompanied this code.
464.13 - *
464.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
464.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
464.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
464.17 - * version 2 for more details (a copy is included in the LICENSE file that
464.18 - * accompanied this code).
464.19 - *
464.20 - * You should have received a copy of the GNU General Public License version
464.21 - * 2 along with this work; if not, write to the Free Software Foundation,
464.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
464.23 - *
464.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
464.25 - * or visit www.oracle.com if you need additional information or have any
464.26 - * questions.
464.27 - */
464.28 -package sun.io;
464.29 -
464.30 -import sun.nio.cs.ext.*;
464.31 -
464.32 -public class CharToByteCp1381 extends CharToByteDBCS_ASCII {
464.33 -
464.34 - // Return the character set id
464.35 - public String getCharacterEncoding() {
464.36 - return "Cp1381";
464.37 - }
464.38 -
464.39 - public CharToByteCp1381() {
464.40 - super((DoubleByte.Encoder)new IBM1381().newEncoder());
464.41 - }
464.42 -}
465.1 --- a/src/share/classes/sun/io/CharToByteCp1383.java Thu Sep 01 13:54:38 2011 -0700
465.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
465.3 @@ -1,39 +0,0 @@
465.4 -/*
465.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
465.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
465.7 - *
465.8 - * This code is free software; you can redistribute it and/or modify it
465.9 - * under the terms of the GNU General Public License version 2 only, as
465.10 - * published by the Free Software Foundation. Oracle designates this
465.11 - * particular file as subject to the "Classpath" exception as provided
465.12 - * by Oracle in the LICENSE file that accompanied this code.
465.13 - *
465.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
465.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
465.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
465.17 - * version 2 for more details (a copy is included in the LICENSE file that
465.18 - * accompanied this code).
465.19 - *
465.20 - * You should have received a copy of the GNU General Public License version
465.21 - * 2 along with this work; if not, write to the Free Software Foundation,
465.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
465.23 - *
465.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
465.25 - * or visit www.oracle.com if you need additional information or have any
465.26 - * questions.
465.27 - */
465.28 -package sun.io;
465.29 -
465.30 -import sun.nio.cs.ext.*;
465.31 -
465.32 -public class CharToByteCp1383 extends CharToByteDBCS_ASCII {
465.33 -
465.34 - // Return the character set id
465.35 - public String getCharacterEncoding() {
465.36 - return "Cp1383";
465.37 - }
465.38 -
465.39 - public CharToByteCp1383() {
465.40 - super((DoubleByte.Encoder)new IBM1383().newEncoder());
465.41 - }
465.42 -}
466.1 --- a/src/share/classes/sun/io/CharToByteCp273.java Thu Sep 01 13:54:38 2011 -0700
466.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
466.3 @@ -1,51 +0,0 @@
466.4 -/*
466.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
466.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
466.7 - *
466.8 - * This code is free software; you can redistribute it and/or modify it
466.9 - * under the terms of the GNU General Public License version 2 only, as
466.10 - * published by the Free Software Foundation. Oracle designates this
466.11 - * particular file as subject to the "Classpath" exception as provided
466.12 - * by Oracle in the LICENSE file that accompanied this code.
466.13 - *
466.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
466.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
466.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
466.17 - * version 2 for more details (a copy is included in the LICENSE file that
466.18 - * accompanied this code).
466.19 - *
466.20 - * You should have received a copy of the GNU General Public License version
466.21 - * 2 along with this work; if not, write to the Free Software Foundation,
466.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
466.23 - *
466.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
466.25 - * or visit www.oracle.com if you need additional information or have any
466.26 - * questions.
466.27 - */
466.28 -
466.29 -package sun.io;
466.30 -
466.31 -import sun.nio.cs.ext.IBM273;
466.32 -
466.33 -/**
466.34 - * Tables and data to convert Unicode to Cp273
466.35 - *
466.36 - * @author ConverterGenerator tool
466.37 - */
466.38 -
466.39 -public class CharToByteCp273 extends CharToByteSingleByte {
466.40 -
466.41 - private final static IBM273 nioCoder = new IBM273();
466.42 -
466.43 - public String getCharacterEncoding() {
466.44 - return "Cp273";
466.45 - }
466.46 -
466.47 - public CharToByteCp273() {
466.48 - super.mask1 = 0xFF00;
466.49 - super.mask2 = 0x00FF;
466.50 - super.shift = 8;
466.51 - super.index1 = nioCoder.getEncoderIndex1();
466.52 - super.index2 = nioCoder.getEncoderIndex2();
466.53 - }
466.54 -}
467.1 --- a/src/share/classes/sun/io/CharToByteCp277.java Thu Sep 01 13:54:38 2011 -0700
467.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
467.3 @@ -1,51 +0,0 @@
467.4 -/*
467.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
467.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
467.7 - *
467.8 - * This code is free software; you can redistribute it and/or modify it
467.9 - * under the terms of the GNU General Public License version 2 only, as
467.10 - * published by the Free Software Foundation. Oracle designates this
467.11 - * particular file as subject to the "Classpath" exception as provided
467.12 - * by Oracle in the LICENSE file that accompanied this code.
467.13 - *
467.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
467.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
467.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
467.17 - * version 2 for more details (a copy is included in the LICENSE file that
467.18 - * accompanied this code).
467.19 - *
467.20 - * You should have received a copy of the GNU General Public License version
467.21 - * 2 along with this work; if not, write to the Free Software Foundation,
467.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
467.23 - *
467.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
467.25 - * or visit www.oracle.com if you need additional information or have any
467.26 - * questions.
467.27 - */
467.28 -
467.29 -package sun.io;
467.30 -
467.31 -import sun.nio.cs.ext.IBM277;
467.32 -
467.33 -/**
467.34 - * Tables and data to convert Unicode to Cp277
467.35 - *
467.36 - * @author ConverterGenerator tool
467.37 - */
467.38 -
467.39 -public class CharToByteCp277 extends CharToByteSingleByte {
467.40 -
467.41 - private final static IBM277 nioCoder = new IBM277();
467.42 -
467.43 - public String getCharacterEncoding() {
467.44 - return "Cp277";
467.45 - }
467.46 -
467.47 - public CharToByteCp277() {
467.48 - super.mask1 = 0xFF00;
467.49 - super.mask2 = 0x00FF;
467.50 - super.shift = 8;
467.51 - super.index1 = nioCoder.getEncoderIndex1();
467.52 - super.index2 = nioCoder.getEncoderIndex2();
467.53 - }
467.54 -}
468.1 --- a/src/share/classes/sun/io/CharToByteCp278.java Thu Sep 01 13:54:38 2011 -0700
468.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
468.3 @@ -1,51 +0,0 @@
468.4 -/*
468.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
468.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
468.7 - *
468.8 - * This code is free software; you can redistribute it and/or modify it
468.9 - * under the terms of the GNU General Public License version 2 only, as
468.10 - * published by the Free Software Foundation. Oracle designates this
468.11 - * particular file as subject to the "Classpath" exception as provided
468.12 - * by Oracle in the LICENSE file that accompanied this code.
468.13 - *
468.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
468.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
468.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
468.17 - * version 2 for more details (a copy is included in the LICENSE file that
468.18 - * accompanied this code).
468.19 - *
468.20 - * You should have received a copy of the GNU General Public License version
468.21 - * 2 along with this work; if not, write to the Free Software Foundation,
468.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
468.23 - *
468.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
468.25 - * or visit www.oracle.com if you need additional information or have any
468.26 - * questions.
468.27 - */
468.28 -
468.29 -package sun.io;
468.30 -
468.31 -import sun.nio.cs.ext.IBM278;
468.32 -
468.33 -/**
468.34 - * Tables and data to convert Unicode to Cp278
468.35 - *
468.36 - * @author ConverterGenerator tool
468.37 - */
468.38 -
468.39 -public class CharToByteCp278 extends CharToByteSingleByte {
468.40 -
468.41 - private final static IBM278 nioCoder = new IBM278();
468.42 -
468.43 - public String getCharacterEncoding() {
468.44 - return "Cp278";
468.45 - }
468.46 -
468.47 - public CharToByteCp278() {
468.48 - super.mask1 = 0xFF00;
468.49 - super.mask2 = 0x00FF;
468.50 - super.shift = 8;
468.51 - super.index1 = nioCoder.getEncoderIndex1();
468.52 - super.index2 = nioCoder.getEncoderIndex2();
468.53 - }
468.54 -}
469.1 --- a/src/share/classes/sun/io/CharToByteCp280.java Thu Sep 01 13:54:38 2011 -0700
469.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
469.3 @@ -1,51 +0,0 @@
469.4 -/*
469.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
469.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
469.7 - *
469.8 - * This code is free software; you can redistribute it and/or modify it
469.9 - * under the terms of the GNU General Public License version 2 only, as
469.10 - * published by the Free Software Foundation. Oracle designates this
469.11 - * particular file as subject to the "Classpath" exception as provided
469.12 - * by Oracle in the LICENSE file that accompanied this code.
469.13 - *
469.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
469.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
469.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
469.17 - * version 2 for more details (a copy is included in the LICENSE file that
469.18 - * accompanied this code).
469.19 - *
469.20 - * You should have received a copy of the GNU General Public License version
469.21 - * 2 along with this work; if not, write to the Free Software Foundation,
469.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
469.23 - *
469.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
469.25 - * or visit www.oracle.com if you need additional information or have any
469.26 - * questions.
469.27 - */
469.28 -
469.29 -package sun.io;
469.30 -
469.31 -import sun.nio.cs.ext.IBM280;
469.32 -
469.33 -/**
469.34 - * Tables and data to convert Unicode to Cp280
469.35 - *
469.36 - * @author ConverterGenerator tool
469.37 - */
469.38 -
469.39 -public class CharToByteCp280 extends CharToByteSingleByte {
469.40 -
469.41 - private final static IBM280 nioCoder = new IBM280();
469.42 -
469.43 - public String getCharacterEncoding() {
469.44 - return "Cp280";
469.45 - }
469.46 -
469.47 - public CharToByteCp280() {
469.48 - super.mask1 = 0xFF00;
469.49 - super.mask2 = 0x00FF;
469.50 - super.shift = 8;
469.51 - super.index1 = nioCoder.getEncoderIndex1();
469.52 - super.index2 = nioCoder.getEncoderIndex2();
469.53 - }
469.54 -}
470.1 --- a/src/share/classes/sun/io/CharToByteCp284.java Thu Sep 01 13:54:38 2011 -0700
470.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
470.3 @@ -1,51 +0,0 @@
470.4 -/*
470.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
470.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
470.7 - *
470.8 - * This code is free software; you can redistribute it and/or modify it
470.9 - * under the terms of the GNU General Public License version 2 only, as
470.10 - * published by the Free Software Foundation. Oracle designates this
470.11 - * particular file as subject to the "Classpath" exception as provided
470.12 - * by Oracle in the LICENSE file that accompanied this code.
470.13 - *
470.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
470.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
470.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
470.17 - * version 2 for more details (a copy is included in the LICENSE file that
470.18 - * accompanied this code).
470.19 - *
470.20 - * You should have received a copy of the GNU General Public License version
470.21 - * 2 along with this work; if not, write to the Free Software Foundation,
470.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
470.23 - *
470.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
470.25 - * or visit www.oracle.com if you need additional information or have any
470.26 - * questions.
470.27 - */
470.28 -
470.29 -package sun.io;
470.30 -
470.31 -import sun.nio.cs.ext.IBM284;
470.32 -
470.33 -/**
470.34 - * Tables and data to convert Unicode to Cp284
470.35 - *
470.36 - * @author ConverterGenerator tool
470.37 - */
470.38 -
470.39 -public class CharToByteCp284 extends CharToByteSingleByte {
470.40 -
470.41 - private final static IBM284 nioCoder = new IBM284();
470.42 -
470.43 - public String getCharacterEncoding() {
470.44 - return "Cp284";
470.45 - }
470.46 -
470.47 - public CharToByteCp284() {
470.48 - super.mask1 = 0xFF00;
470.49 - super.mask2 = 0x00FF;
470.50 - super.shift = 8;
470.51 - super.index1 = nioCoder.getEncoderIndex1();
470.52 - super.index2 = nioCoder.getEncoderIndex2();
470.53 - }
470.54 -}
471.1 --- a/src/share/classes/sun/io/CharToByteCp285.java Thu Sep 01 13:54:38 2011 -0700
471.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
471.3 @@ -1,51 +0,0 @@
471.4 -/*
471.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
471.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
471.7 - *
471.8 - * This code is free software; you can redistribute it and/or modify it
471.9 - * under the terms of the GNU General Public License version 2 only, as
471.10 - * published by the Free Software Foundation. Oracle designates this
471.11 - * particular file as subject to the "Classpath" exception as provided
471.12 - * by Oracle in the LICENSE file that accompanied this code.
471.13 - *
471.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
471.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
471.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
471.17 - * version 2 for more details (a copy is included in the LICENSE file that
471.18 - * accompanied this code).
471.19 - *
471.20 - * You should have received a copy of the GNU General Public License version
471.21 - * 2 along with this work; if not, write to the Free Software Foundation,
471.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
471.23 - *
471.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
471.25 - * or visit www.oracle.com if you need additional information or have any
471.26 - * questions.
471.27 - */
471.28 -
471.29 -package sun.io;
471.30 -
471.31 -import sun.nio.cs.ext.IBM285;
471.32 -
471.33 -/**
471.34 - * Tables and data to convert Unicode to Cp285
471.35 - *
471.36 - * @author ConverterGenerator tool
471.37 - */
471.38 -
471.39 -public class CharToByteCp285 extends CharToByteSingleByte {
471.40 -
471.41 - private final static IBM285 nioCoder = new IBM285();
471.42 -
471.43 - public String getCharacterEncoding() {
471.44 - return "Cp285";
471.45 - }
471.46 -
471.47 - public CharToByteCp285() {
471.48 - super.mask1 = 0xFF00;
471.49 - super.mask2 = 0x00FF;
471.50 - super.shift = 8;
471.51 - super.index1 = nioCoder.getEncoderIndex1();
471.52 - super.index2 = nioCoder.getEncoderIndex2();
471.53 - }
471.54 -}
472.1 --- a/src/share/classes/sun/io/CharToByteCp297.java Thu Sep 01 13:54:38 2011 -0700
472.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
472.3 @@ -1,51 +0,0 @@
472.4 -/*
472.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
472.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
472.7 - *
472.8 - * This code is free software; you can redistribute it and/or modify it
472.9 - * under the terms of the GNU General Public License version 2 only, as
472.10 - * published by the Free Software Foundation. Oracle designates this
472.11 - * particular file as subject to the "Classpath" exception as provided
472.12 - * by Oracle in the LICENSE file that accompanied this code.
472.13 - *
472.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
472.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
472.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
472.17 - * version 2 for more details (a copy is included in the LICENSE file that
472.18 - * accompanied this code).
472.19 - *
472.20 - * You should have received a copy of the GNU General Public License version
472.21 - * 2 along with this work; if not, write to the Free Software Foundation,
472.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
472.23 - *
472.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
472.25 - * or visit www.oracle.com if you need additional information or have any
472.26 - * questions.
472.27 - */
472.28 -
472.29 -package sun.io;
472.30 -
472.31 -import sun.nio.cs.ext.IBM297;
472.32 -
472.33 -/**
472.34 - * Tables and data to convert Unicode to Cp297
472.35 - *
472.36 - * @author ConverterGenerator tool
472.37 - */
472.38 -
472.39 -public class CharToByteCp297 extends CharToByteSingleByte {
472.40 -
472.41 - private final static IBM297 nioCoder = new IBM297();
472.42 -
472.43 - public String getCharacterEncoding() {
472.44 - return "Cp297";
472.45 - }
472.46 -
472.47 - public CharToByteCp297() {
472.48 - super.mask1 = 0xFF00;
472.49 - super.mask2 = 0x00FF;
472.50 - super.shift = 8;
472.51 - super.index1 = nioCoder.getEncoderIndex1();
472.52 - super.index2 = nioCoder.getEncoderIndex2();
472.53 - }
472.54 -}
473.1 --- a/src/share/classes/sun/io/CharToByteCp33722.java Thu Sep 01 13:54:38 2011 -0700
473.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
473.3 @@ -1,61 +0,0 @@
473.4 -/*
473.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
473.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
473.7 - *
473.8 - * This code is free software; you can redistribute it and/or modify it
473.9 - * under the terms of the GNU General Public License version 2 only, as
473.10 - * published by the Free Software Foundation. Oracle designates this
473.11 - * particular file as subject to the "Classpath" exception as provided
473.12 - * by Oracle in the LICENSE file that accompanied this code.
473.13 - *
473.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
473.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
473.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
473.17 - * version 2 for more details (a copy is included in the LICENSE file that
473.18 - * accompanied this code).
473.19 - *
473.20 - * You should have received a copy of the GNU General Public License version
473.21 - * 2 along with this work; if not, write to the Free Software Foundation,
473.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
473.23 - *
473.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
473.25 - * or visit www.oracle.com if you need additional information or have any
473.26 - * questions.
473.27 - */
473.28 -package sun.io;
473.29 -
473.30 -import sun.nio.cs.ext.IBM33722;
473.31 -
473.32 -/**
473.33 -* Tables and data to convert Unicode to Cp33722
473.34 -*
473.35 -* @author Malcolm Ayres, assisted by UniMap program
473.36 -*/
473.37 -public class CharToByteCp33722
473.38 - extends CharToByteEUC
473.39 -
473.40 -{
473.41 - private final static IBM33722 nioCoder = new IBM33722();
473.42 -
473.43 - // Return the character set id
473.44 - public String getCharacterEncoding()
473.45 - {
473.46 - return "Cp33722";
473.47 - }
473.48 -
473.49 - public int getMaxBytesPerChar() {
473.50 - return 3;
473.51 - }
473.52 -
473.53 - public CharToByteCp33722()
473.54 - {
473.55 - super();
473.56 - super.mask1 = 0xFFE0;
473.57 - super.mask2 = 0x001F;
473.58 - super.shift = 5;
473.59 - super.index1 = nioCoder.getEncoderIndex1();
473.60 - super.index2 = nioCoder.getEncoderIndex2();
473.61 - super.index2a = nioCoder.getEncoderIndex2a();
473.62 - super.index2b = nioCoder.getEncoderIndex2b();
473.63 - }
473.64 -}
474.1 --- a/src/share/classes/sun/io/CharToByteCp420.java Thu Sep 01 13:54:38 2011 -0700
474.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
474.3 @@ -1,51 +0,0 @@
474.4 -/*
474.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
474.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
474.7 - *
474.8 - * This code is free software; you can redistribute it and/or modify it
474.9 - * under the terms of the GNU General Public License version 2 only, as
474.10 - * published by the Free Software Foundation. Oracle designates this
474.11 - * particular file as subject to the "Classpath" exception as provided
474.12 - * by Oracle in the LICENSE file that accompanied this code.
474.13 - *
474.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
474.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
474.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
474.17 - * version 2 for more details (a copy is included in the LICENSE file that
474.18 - * accompanied this code).
474.19 - *
474.20 - * You should have received a copy of the GNU General Public License version
474.21 - * 2 along with this work; if not, write to the Free Software Foundation,
474.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
474.23 - *
474.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
474.25 - * or visit www.oracle.com if you need additional information or have any
474.26 - * questions.
474.27 - */
474.28 -
474.29 -package sun.io;
474.30 -
474.31 -import sun.nio.cs.ext.IBM420;
474.32 -
474.33 -/**
474.34 - * Tables and data to convert Unicode to Cp420
474.35 - *
474.36 - * @author ConverterGenerator tool
474.37 - */
474.38 -
474.39 -public class CharToByteCp420 extends CharToByteSingleByte {
474.40 -
474.41 - private final static IBM420 nioCoder = new IBM420();
474.42 -
474.43 - public String getCharacterEncoding() {
474.44 - return "Cp420";
474.45 - }
474.46 -
474.47 - public CharToByteCp420() {
474.48 - super.mask1 = 0xFF00;
474.49 - super.mask2 = 0x00FF;
474.50 - super.shift = 8;
474.51 - super.index1 = nioCoder.getEncoderIndex1();
474.52 - super.index2 = nioCoder.getEncoderIndex2();
474.53 - }
474.54 -}
475.1 --- a/src/share/classes/sun/io/CharToByteCp424.java Thu Sep 01 13:54:38 2011 -0700
475.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
475.3 @@ -1,51 +0,0 @@
475.4 -/*
475.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
475.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
475.7 - *
475.8 - * This code is free software; you can redistribute it and/or modify it
475.9 - * under the terms of the GNU General Public License version 2 only, as
475.10 - * published by the Free Software Foundation. Oracle designates this
475.11 - * particular file as subject to the "Classpath" exception as provided
475.12 - * by Oracle in the LICENSE file that accompanied this code.
475.13 - *
475.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
475.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
475.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
475.17 - * version 2 for more details (a copy is included in the LICENSE file that
475.18 - * accompanied this code).
475.19 - *
475.20 - * You should have received a copy of the GNU General Public License version
475.21 - * 2 along with this work; if not, write to the Free Software Foundation,
475.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
475.23 - *
475.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
475.25 - * or visit www.oracle.com if you need additional information or have any
475.26 - * questions.
475.27 - */
475.28 -
475.29 -package sun.io;
475.30 -
475.31 -import sun.nio.cs.ext.IBM424;
475.32 -
475.33 -/**
475.34 - * Tables and data to convert Unicode to Cp424
475.35 - *
475.36 - * @author ConverterGenerator tool
475.37 - */
475.38 -
475.39 -public class CharToByteCp424 extends CharToByteSingleByte {
475.40 -
475.41 - private final static IBM424 nioCoder = new IBM424();
475.42 -
475.43 - public String getCharacterEncoding() {
475.44 - return "Cp424";
475.45 - }
475.46 -
475.47 - public CharToByteCp424() {
475.48 - super.mask1 = 0xFF00;
475.49 - super.mask2 = 0x00FF;
475.50 - super.shift = 8;
475.51 - super.index1 = nioCoder.getEncoderIndex1();
475.52 - super.index2 = nioCoder.getEncoderIndex2();
475.53 - }
475.54 -}
476.1 --- a/src/share/classes/sun/io/CharToByteCp437.java Thu Sep 01 13:54:38 2011 -0700
476.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
476.3 @@ -1,51 +0,0 @@
476.4 -/*
476.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
476.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
476.7 - *
476.8 - * This code is free software; you can redistribute it and/or modify it
476.9 - * under the terms of the GNU General Public License version 2 only, as
476.10 - * published by the Free Software Foundation. Oracle designates this
476.11 - * particular file as subject to the "Classpath" exception as provided
476.12 - * by Oracle in the LICENSE file that accompanied this code.
476.13 - *
476.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
476.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
476.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
476.17 - * version 2 for more details (a copy is included in the LICENSE file that
476.18 - * accompanied this code).
476.19 - *
476.20 - * You should have received a copy of the GNU General Public License version
476.21 - * 2 along with this work; if not, write to the Free Software Foundation,
476.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
476.23 - *
476.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
476.25 - * or visit www.oracle.com if you need additional information or have any
476.26 - * questions.
476.27 - */
476.28 -
476.29 -package sun.io;
476.30 -
476.31 -import sun.nio.cs.IBM437;
476.32 -
476.33 -/**
476.34 - * Tables and data to convert Unicode to Cp437
476.35 - *
476.36 - * @author ConverterGenerator tool
476.37 - */
476.38 -
476.39 -public class CharToByteCp437 extends CharToByteSingleByte {
476.40 -
476.41 - private final static IBM437 nioCoder = new IBM437();
476.42 -
476.43 - public String getCharacterEncoding() {
476.44 - return "Cp437";
476.45 - }
476.46 -
476.47 - public CharToByteCp437() {
476.48 - super.mask1 = 0xFF00;
476.49 - super.mask2 = 0x00FF;
476.50 - super.shift = 8;
476.51 - super.index1 = nioCoder.getEncoderIndex1();
476.52 - super.index2 = nioCoder.getEncoderIndex2();
476.53 - }
476.54 -}
477.1 --- a/src/share/classes/sun/io/CharToByteCp500.java Thu Sep 01 13:54:38 2011 -0700
477.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
477.3 @@ -1,51 +0,0 @@
477.4 -/*
477.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
477.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
477.7 - *
477.8 - * This code is free software; you can redistribute it and/or modify it
477.9 - * under the terms of the GNU General Public License version 2 only, as
477.10 - * published by the Free Software Foundation. Oracle designates this
477.11 - * particular file as subject to the "Classpath" exception as provided
477.12 - * by Oracle in the LICENSE file that accompanied this code.
477.13 - *
477.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
477.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
477.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
477.17 - * version 2 for more details (a copy is included in the LICENSE file that
477.18 - * accompanied this code).
477.19 - *
477.20 - * You should have received a copy of the GNU General Public License version
477.21 - * 2 along with this work; if not, write to the Free Software Foundation,
477.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
477.23 - *
477.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
477.25 - * or visit www.oracle.com if you need additional information or have any
477.26 - * questions.
477.27 - */
477.28 -
477.29 -package sun.io;
477.30 -
477.31 -import sun.nio.cs.ext.IBM500;
477.32 -
477.33 -/**
477.34 - * Tables and data to convert Unicode to Cp500
477.35 - *
477.36 - * @author ConverterGenerator tool
477.37 - */
477.38 -
477.39 -public class CharToByteCp500 extends CharToByteSingleByte {
477.40 -
477.41 - private final static IBM500 nioCoder = new IBM500();
477.42 -
477.43 - public String getCharacterEncoding() {
477.44 - return "Cp500";
477.45 - }
477.46 -
477.47 - public CharToByteCp500() {
477.48 - super.mask1 = 0xFF00;
477.49 - super.mask2 = 0x00FF;
477.50 - super.shift = 8;
477.51 - super.index1 = nioCoder.getEncoderIndex1();
477.52 - super.index2 = nioCoder.getEncoderIndex2();
477.53 - }
477.54 -}
478.1 --- a/src/share/classes/sun/io/CharToByteCp737.java Thu Sep 01 13:54:38 2011 -0700
478.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
478.3 @@ -1,51 +0,0 @@
478.4 -/*
478.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
478.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
478.7 - *
478.8 - * This code is free software; you can redistribute it and/or modify it
478.9 - * under the terms of the GNU General Public License version 2 only, as
478.10 - * published by the Free Software Foundation. Oracle designates this
478.11 - * particular file as subject to the "Classpath" exception as provided
478.12 - * by Oracle in the LICENSE file that accompanied this code.
478.13 - *
478.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
478.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
478.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
478.17 - * version 2 for more details (a copy is included in the LICENSE file that
478.18 - * accompanied this code).
478.19 - *
478.20 - * You should have received a copy of the GNU General Public License version
478.21 - * 2 along with this work; if not, write to the Free Software Foundation,
478.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
478.23 - *
478.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
478.25 - * or visit www.oracle.com if you need additional information or have any
478.26 - * questions.
478.27 - */
478.28 -
478.29 -package sun.io;
478.30 -
478.31 -import sun.nio.cs.IBM737;
478.32 -
478.33 -/**
478.34 - * Tables and data to convert Unicode to Cp737
478.35 - *
478.36 - * @author ConverterGenerator tool
478.37 - */
478.38 -
478.39 -public class CharToByteCp737 extends CharToByteSingleByte {
478.40 -
478.41 - private final static IBM737 nioCoder = new IBM737();
478.42 -
478.43 - public String getCharacterEncoding() {
478.44 - return "Cp737";
478.45 - }
478.46 -
478.47 - public CharToByteCp737() {
478.48 - super.mask1 = 0xFF00;
478.49 - super.mask2 = 0x00FF;
478.50 - super.shift = 8;
478.51 - super.index1 = nioCoder.getEncoderIndex1();
478.52 - super.index2 = nioCoder.getEncoderIndex2();
478.53 - }
478.54 -}
479.1 --- a/src/share/classes/sun/io/CharToByteCp775.java Thu Sep 01 13:54:38 2011 -0700
479.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
479.3 @@ -1,51 +0,0 @@
479.4 -/*
479.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
479.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
479.7 - *
479.8 - * This code is free software; you can redistribute it and/or modify it
479.9 - * under the terms of the GNU General Public License version 2 only, as
479.10 - * published by the Free Software Foundation. Oracle designates this
479.11 - * particular file as subject to the "Classpath" exception as provided
479.12 - * by Oracle in the LICENSE file that accompanied this code.
479.13 - *
479.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
479.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
479.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
479.17 - * version 2 for more details (a copy is included in the LICENSE file that
479.18 - * accompanied this code).
479.19 - *
479.20 - * You should have received a copy of the GNU General Public License version
479.21 - * 2 along with this work; if not, write to the Free Software Foundation,
479.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
479.23 - *
479.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
479.25 - * or visit www.oracle.com if you need additional information or have any
479.26 - * questions.
479.27 - */
479.28 -
479.29 -package sun.io;
479.30 -
479.31 -import sun.nio.cs.IBM775;
479.32 -
479.33 -/**
479.34 - * Tables and data to convert Unicode to Cp775
479.35 - *
479.36 - * @author ConverterGenerator tool
479.37 - */
479.38 -
479.39 -public class CharToByteCp775 extends CharToByteSingleByte {
479.40 -
479.41 - private final static IBM775 nioCoder = new IBM775();
479.42 -
479.43 - public String getCharacterEncoding() {
479.44 - return "Cp775";
479.45 - }
479.46 -
479.47 - public CharToByteCp775() {
479.48 - super.mask1 = 0xFF00;
479.49 - super.mask2 = 0x00FF;
479.50 - super.shift = 8;
479.51 - super.index1 = nioCoder.getEncoderIndex1();
479.52 - super.index2 = nioCoder.getEncoderIndex2();
479.53 - }
479.54 -}
480.1 --- a/src/share/classes/sun/io/CharToByteCp833.java Thu Sep 01 13:54:38 2011 -0700
480.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
480.3 @@ -1,46 +0,0 @@
480.4 -/*
480.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
480.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
480.7 - *
480.8 - * This code is free software; you can redistribute it and/or modify it
480.9 - * under the terms of the GNU General Public License version 2 only, as
480.10 - * published by the Free Software Foundation. Oracle designates this
480.11 - * particular file as subject to the "Classpath" exception as provided
480.12 - * by Oracle in the LICENSE file that accompanied this code.
480.13 - *
480.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
480.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
480.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
480.17 - * version 2 for more details (a copy is included in the LICENSE file that
480.18 - * accompanied this code).
480.19 - *
480.20 - * You should have received a copy of the GNU General Public License version
480.21 - * 2 along with this work; if not, write to the Free Software Foundation,
480.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
480.23 - *
480.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
480.25 - * or visit www.oracle.com if you need additional information or have any
480.26 - * questions.
480.27 - */
480.28 -
480.29 -package sun.io;
480.30 -
480.31 -import sun.nio.cs.ext.IBM833;
480.32 -
480.33 -public class CharToByteCp833 extends CharToByteSingleByte {
480.34 -
480.35 - private final static IBM833 nioCoder = new IBM833();
480.36 -
480.37 - public String getCharacterEncoding() {
480.38 - return "Cp833";
480.39 - }
480.40 -
480.41 - public CharToByteCp833() {
480.42 - super.mask1 = 0xFF00;
480.43 - super.mask2 = 0x00FF;
480.44 - super.shift = 8;
480.45 - super.index1 = nioCoder.getEncoderIndex1();
480.46 - super.index2 = nioCoder.getEncoderIndex2();
480.47 - }
480.48 -}
480.49 -
481.1 --- a/src/share/classes/sun/io/CharToByteCp834.java Thu Sep 01 13:54:38 2011 -0700
481.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
481.3 @@ -1,45 +0,0 @@
481.4 -/*
481.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
481.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
481.7 - *
481.8 - * This code is free software; you can redistribute it and/or modify it
481.9 - * under the terms of the GNU General Public License version 2 only, as
481.10 - * published by the Free Software Foundation. Oracle designates this
481.11 - * particular file as subject to the "Classpath" exception as provided
481.12 - * by Oracle in the LICENSE file that accompanied this code.
481.13 - *
481.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
481.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
481.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
481.17 - * version 2 for more details (a copy is included in the LICENSE file that
481.18 - * accompanied this code).
481.19 - *
481.20 - * You should have received a copy of the GNU General Public License version
481.21 - * 2 along with this work; if not, write to the Free Software Foundation,
481.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
481.23 - *
481.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
481.25 - * or visit www.oracle.com if you need additional information or have any
481.26 - * questions.
481.27 - */
481.28 -package sun.io;
481.29 -
481.30 -import sun.nio.cs.ext.*;
481.31 -
481.32 -//EBIDIC DBCSONLY Korean
481.33 -
481.34 -public class CharToByteCp834 extends CharToByteDBCS_ASCII {
481.35 -
481.36 - public CharToByteCp834() {
481.37 - super((DoubleByte.Encoder)new IBM834().newEncoder());
481.38 - subBytes = new byte[] {(byte)0xfe, (byte)0xfe};
481.39 - }
481.40 -
481.41 - public int getMaxBytesPerChar() {
481.42 - return 2;
481.43 - }
481.44 -
481.45 - public String getCharacterEncoding() {
481.46 - return "Cp834";
481.47 - }
481.48 -}
482.1 --- a/src/share/classes/sun/io/CharToByteCp838.java Thu Sep 01 13:54:38 2011 -0700
482.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
482.3 @@ -1,51 +0,0 @@
482.4 -/*
482.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
482.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
482.7 - *
482.8 - * This code is free software; you can redistribute it and/or modify it
482.9 - * under the terms of the GNU General Public License version 2 only, as
482.10 - * published by the Free Software Foundation. Oracle designates this
482.11 - * particular file as subject to the "Classpath" exception as provided
482.12 - * by Oracle in the LICENSE file that accompanied this code.
482.13 - *
482.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
482.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
482.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
482.17 - * version 2 for more details (a copy is included in the LICENSE file that
482.18 - * accompanied this code).
482.19 - *
482.20 - * You should have received a copy of the GNU General Public License version
482.21 - * 2 along with this work; if not, write to the Free Software Foundation,
482.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
482.23 - *
482.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
482.25 - * or visit www.oracle.com if you need additional information or have any
482.26 - * questions.
482.27 - */
482.28 -
482.29 -package sun.io;
482.30 -
482.31 -import sun.nio.cs.ext.IBM838;
482.32 -
482.33 -/**
482.34 - * Tables and data to convert Unicode to Cp838
482.35 - *
482.36 - * @author ConverterGenerator tool
482.37 - */
482.38 -
482.39 -public class CharToByteCp838 extends CharToByteSingleByte {
482.40 -
482.41 - private final static IBM838 nioCoder = new IBM838();
482.42 -
482.43 - public String getCharacterEncoding() {
482.44 - return "Cp838";
482.45 - }
482.46 -
482.47 - public CharToByteCp838() {
482.48 - super.mask1 = 0xFF00;
482.49 - super.mask2 = 0x00FF;
482.50 - super.shift = 8;
482.51 - super.index1 = nioCoder.getEncoderIndex1();
482.52 - super.index2 = nioCoder.getEncoderIndex2();
482.53 - }
482.54 -}
483.1 --- a/src/share/classes/sun/io/CharToByteCp850.java Thu Sep 01 13:54:38 2011 -0700
483.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
483.3 @@ -1,51 +0,0 @@
483.4 -/*
483.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
483.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
483.7 - *
483.8 - * This code is free software; you can redistribute it and/or modify it
483.9 - * under the terms of the GNU General Public License version 2 only, as
483.10 - * published by the Free Software Foundation. Oracle designates this
483.11 - * particular file as subject to the "Classpath" exception as provided
483.12 - * by Oracle in the LICENSE file that accompanied this code.
483.13 - *
483.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
483.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
483.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
483.17 - * version 2 for more details (a copy is included in the LICENSE file that
483.18 - * accompanied this code).
483.19 - *
483.20 - * You should have received a copy of the GNU General Public License version
483.21 - * 2 along with this work; if not, write to the Free Software Foundation,
483.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
483.23 - *
483.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
483.25 - * or visit www.oracle.com if you need additional information or have any
483.26 - * questions.
483.27 - */
483.28 -
483.29 -package sun.io;
483.30 -
483.31 -import sun.nio.cs.IBM850;
483.32 -
483.33 -/**
483.34 - * Tables and data to convert Unicode to Cp850
483.35 - *
483.36 - * @author ConverterGenerator tool
483.37 - */
483.38 -
483.39 -public class CharToByteCp850 extends CharToByteSingleByte {
483.40 -
483.41 - private final static IBM850 nioCoder = new IBM850();
483.42 -
483.43 - public String getCharacterEncoding() {
483.44 - return "Cp850";
483.45 - }
483.46 -
483.47 - public CharToByteCp850() {
483.48 - super.mask1 = 0xFF00;
483.49 - super.mask2 = 0x00FF;
483.50 - super.shift = 8;
483.51 - super.index1 = nioCoder.getEncoderIndex1();
483.52 - super.index2 = nioCoder.getEncoderIndex2();
483.53 - }
483.54 -}
484.1 --- a/src/share/classes/sun/io/CharToByteCp852.java Thu Sep 01 13:54:38 2011 -0700
484.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
484.3 @@ -1,51 +0,0 @@
484.4 -/*
484.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
484.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
484.7 - *
484.8 - * This code is free software; you can redistribute it and/or modify it
484.9 - * under the terms of the GNU General Public License version 2 only, as
484.10 - * published by the Free Software Foundation. Oracle designates this
484.11 - * particular file as subject to the "Classpath" exception as provided
484.12 - * by Oracle in the LICENSE file that accompanied this code.
484.13 - *
484.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
484.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
484.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
484.17 - * version 2 for more details (a copy is included in the LICENSE file that
484.18 - * accompanied this code).
484.19 - *
484.20 - * You should have received a copy of the GNU General Public License version
484.21 - * 2 along with this work; if not, write to the Free Software Foundation,
484.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
484.23 - *
484.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
484.25 - * or visit www.oracle.com if you need additional information or have any
484.26 - * questions.
484.27 - */
484.28 -
484.29 -package sun.io;
484.30 -
484.31 -import sun.nio.cs.IBM852;
484.32 -
484.33 -/**
484.34 - * Tables and data to convert Unicode to Cp852
484.35 - *
484.36 - * @author ConverterGenerator tool
484.37 - */
484.38 -
484.39 -public class CharToByteCp852 extends CharToByteSingleByte {
484.40 -
484.41 - private final static IBM852 nioCoder = new IBM852();
484.42 -
484.43 - public String getCharacterEncoding() {
484.44 - return "Cp852";
484.45 - }
484.46 -
484.47 - public CharToByteCp852() {
484.48 - super.mask1 = 0xFF00;
484.49 - super.mask2 = 0x00FF;
484.50 - super.shift = 8;
484.51 - super.index1 = nioCoder.getEncoderIndex1();
484.52 - super.index2 = nioCoder.getEncoderIndex2();
484.53 - }
484.54 -}
485.1 --- a/src/share/classes/sun/io/CharToByteCp855.java Thu Sep 01 13:54:38 2011 -0700
485.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
485.3 @@ -1,51 +0,0 @@
485.4 -/*
485.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
485.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
485.7 - *
485.8 - * This code is free software; you can redistribute it and/or modify it
485.9 - * under the terms of the GNU General Public License version 2 only, as
485.10 - * published by the Free Software Foundation. Oracle designates this
485.11 - * particular file as subject to the "Classpath" exception as provided
485.12 - * by Oracle in the LICENSE file that accompanied this code.
485.13 - *
485.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
485.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
485.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
485.17 - * version 2 for more details (a copy is included in the LICENSE file that
485.18 - * accompanied this code).
485.19 - *
485.20 - * You should have received a copy of the GNU General Public License version
485.21 - * 2 along with this work; if not, write to the Free Software Foundation,
485.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
485.23 - *
485.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
485.25 - * or visit www.oracle.com if you need additional information or have any
485.26 - * questions.
485.27 - */
485.28 -
485.29 -package sun.io;
485.30 -
485.31 -import sun.nio.cs.IBM855;
485.32 -
485.33 -/**
485.34 - * Tables and data to convert Unicode to Cp855
485.35 - *
485.36 - * @author ConverterGenerator tool
485.37 - */
485.38 -
485.39 -public class CharToByteCp855 extends CharToByteSingleByte {
485.40 -
485.41 - private final static IBM855 nioCoder = new IBM855();
485.42 -
485.43 - public String getCharacterEncoding() {
485.44 - return "Cp855";
485.45 - }
485.46 -
485.47 - public CharToByteCp855() {
485.48 - super.mask1 = 0xFF00;
485.49 - super.mask2 = 0x00FF;
485.50 - super.shift = 8;
485.51 - super.index1 = nioCoder.getEncoderIndex1();
485.52 - super.index2 = nioCoder.getEncoderIndex2();
485.53 - }
485.54 -}
486.1 --- a/src/share/classes/sun/io/CharToByteCp856.java Thu Sep 01 13:54:38 2011 -0700
486.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
486.3 @@ -1,51 +0,0 @@
486.4 -/*
486.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
486.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
486.7 - *
486.8 - * This code is free software; you can redistribute it and/or modify it
486.9 - * under the terms of the GNU General Public License version 2 only, as
486.10 - * published by the Free Software Foundation. Oracle designates this
486.11 - * particular file as subject to the "Classpath" exception as provided
486.12 - * by Oracle in the LICENSE file that accompanied this code.
486.13 - *
486.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
486.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
486.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
486.17 - * version 2 for more details (a copy is included in the LICENSE file that
486.18 - * accompanied this code).
486.19 - *
486.20 - * You should have received a copy of the GNU General Public License version
486.21 - * 2 along with this work; if not, write to the Free Software Foundation,
486.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
486.23 - *
486.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
486.25 - * or visit www.oracle.com if you need additional information or have any
486.26 - * questions.
486.27 - */
486.28 -
486.29 -package sun.io;
486.30 -
486.31 -import sun.nio.cs.ext.IBM856;
486.32 -
486.33 -/**
486.34 - * Tables and data to convert Unicode to Cp856
486.35 - *
486.36 - * @author ConverterGenerator tool
486.37 - */
486.38 -
486.39 -public class CharToByteCp856 extends CharToByteSingleByte {
486.40 -
486.41 - private final static IBM856 nioCoder = new IBM856();
486.42 -
486.43 - public String getCharacterEncoding() {
486.44 - return "Cp856";
486.45 - }
486.46 -
486.47 - public CharToByteCp856() {
486.48 - super.mask1 = 0xFF00;
486.49 - super.mask2 = 0x00FF;
486.50 - super.shift = 8;
486.51 - super.index1 = nioCoder.getEncoderIndex1();
486.52 - super.index2 = nioCoder.getEncoderIndex2();
486.53 - }
486.54 -}
487.1 --- a/src/share/classes/sun/io/CharToByteCp857.java Thu Sep 01 13:54:38 2011 -0700
487.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
487.3 @@ -1,51 +0,0 @@
487.4 -/*
487.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
487.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
487.7 - *
487.8 - * This code is free software; you can redistribute it and/or modify it
487.9 - * under the terms of the GNU General Public License version 2 only, as
487.10 - * published by the Free Software Foundation. Oracle designates this
487.11 - * particular file as subject to the "Classpath" exception as provided
487.12 - * by Oracle in the LICENSE file that accompanied this code.
487.13 - *
487.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
487.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
487.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
487.17 - * version 2 for more details (a copy is included in the LICENSE file that
487.18 - * accompanied this code).
487.19 - *
487.20 - * You should have received a copy of the GNU General Public License version
487.21 - * 2 along with this work; if not, write to the Free Software Foundation,
487.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
487.23 - *
487.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
487.25 - * or visit www.oracle.com if you need additional information or have any
487.26 - * questions.
487.27 - */
487.28 -
487.29 -package sun.io;
487.30 -
487.31 -import sun.nio.cs.IBM857;
487.32 -
487.33 -/**
487.34 - * Tables and data to convert Unicode to Cp857
487.35 - *
487.36 - * @author ConverterGenerator tool
487.37 - */
487.38 -
487.39 -public class CharToByteCp857 extends CharToByteSingleByte {
487.40 -
487.41 - private final static IBM857 nioCoder = new IBM857();
487.42 -
487.43 - public String getCharacterEncoding() {
487.44 - return "Cp857";
487.45 - }
487.46 -
487.47 - public CharToByteCp857() {
487.48 - super.mask1 = 0xFF00;
487.49 - super.mask2 = 0x00FF;
487.50 - super.shift = 8;
487.51 - super.index1 = nioCoder.getEncoderIndex1();
487.52 - super.index2 = nioCoder.getEncoderIndex2();
487.53 - }
487.54 -}
488.1 --- a/src/share/classes/sun/io/CharToByteCp858.java Thu Sep 01 13:54:38 2011 -0700
488.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
488.3 @@ -1,56 +0,0 @@
488.4 -/*
488.5 - * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
488.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
488.7 - *
488.8 - * This code is free software; you can redistribute it and/or modify it
488.9 - * under the terms of the GNU General Public License version 2 only, as
488.10 - * published by the Free Software Foundation. Oracle designates this
488.11 - * particular file as subject to the "Classpath" exception as provided
488.12 - * by Oracle in the LICENSE file that accompanied this code.
488.13 - *
488.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
488.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
488.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
488.17 - * version 2 for more details (a copy is included in the LICENSE file that
488.18 - * accompanied this code).
488.19 - *
488.20 - * You should have received a copy of the GNU General Public License version
488.21 - * 2 along with this work; if not, write to the Free Software Foundation,
488.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
488.23 - *
488.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
488.25 - * or visit www.oracle.com if you need additional information or have any
488.26 - * questions.
488.27 - */
488.28 -
488.29 -/*
488.30 - * (C) Copyright IBM Corp. 1998 - All Rights Reserved
488.31 - *
488.32 - */
488.33 -
488.34 -package sun.io;
488.35 -
488.36 -import sun.nio.cs.IBM858;
488.37 -
488.38 -/**
488.39 - * Tables and data to convert Unicode to Cp858
488.40 - *
488.41 - * @author ConverterGenerator tool
488.42 - */
488.43 -
488.44 -public class CharToByteCp858 extends CharToByteSingleByte {
488.45 -
488.46 - public String getCharacterEncoding() {
488.47 - return "Cp858";
488.48 - }
488.49 -
488.50 - private final static IBM858 nioCoder = new IBM858();
488.51 -
488.52 - public CharToByteCp858() {
488.53 - super.mask1 = 0xFF00;
488.54 - super.mask2 = 0x00FF;
488.55 - super.shift = 8;
488.56 - super.index1 = nioCoder.getEncoderIndex1();
488.57 - super.index2 = nioCoder.getEncoderIndex2();
488.58 - }
488.59 -}
489.1 --- a/src/share/classes/sun/io/CharToByteCp860.java Thu Sep 01 13:54:38 2011 -0700
489.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
489.3 @@ -1,51 +0,0 @@
489.4 -/*
489.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
489.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489.7 - *
489.8 - * This code is free software; you can redistribute it and/or modify it
489.9 - * under the terms of the GNU General Public License version 2 only, as
489.10 - * published by the Free Software Foundation. Oracle designates this
489.11 - * particular file as subject to the "Classpath" exception as provided
489.12 - * by Oracle in the LICENSE file that accompanied this code.
489.13 - *
489.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
489.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
489.17 - * version 2 for more details (a copy is included in the LICENSE file that
489.18 - * accompanied this code).
489.19 - *
489.20 - * You should have received a copy of the GNU General Public License version
489.21 - * 2 along with this work; if not, write to the Free Software Foundation,
489.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489.23 - *
489.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
489.25 - * or visit www.oracle.com if you need additional information or have any
489.26 - * questions.
489.27 - */
489.28 -
489.29 -package sun.io;
489.30 -
489.31 -import sun.nio.cs.ext.IBM860;
489.32 -
489.33 -/**
489.34 - * Tables and data to convert Unicode to Cp860
489.35 - *
489.36 - * @author ConverterGenerator tool
489.37 - */
489.38 -
489.39 -public class CharToByteCp860 extends CharToByteSingleByte {
489.40 -
489.41 - private final static IBM860 nioCoder = new IBM860();
489.42 -
489.43 - public String getCharacterEncoding() {
489.44 - return "Cp860";
489.45 - }
489.46 -
489.47 - public CharToByteCp860() {
489.48 - super.mask1 = 0xFF00;
489.49 - super.mask2 = 0x00FF;
489.50 - super.shift = 8;
489.51 - super.index1 = nioCoder.getEncoderIndex1();
489.52 - super.index2 = nioCoder.getEncoderIndex2();
489.53 - }
489.54 -}
490.1 --- a/src/share/classes/sun/io/CharToByteCp861.java Thu Sep 01 13:54:38 2011 -0700
490.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
490.3 @@ -1,51 +0,0 @@
490.4 -/*
490.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
490.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
490.7 - *
490.8 - * This code is free software; you can redistribute it and/or modify it
490.9 - * under the terms of the GNU General Public License version 2 only, as
490.10 - * published by the Free Software Foundation. Oracle designates this
490.11 - * particular file as subject to the "Classpath" exception as provided
490.12 - * by Oracle in the LICENSE file that accompanied this code.
490.13 - *
490.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
490.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
490.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
490.17 - * version 2 for more details (a copy is included in the LICENSE file that
490.18 - * accompanied this code).
490.19 - *
490.20 - * You should have received a copy of the GNU General Public License version
490.21 - * 2 along with this work; if not, write to the Free Software Foundation,
490.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
490.23 - *
490.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
490.25 - * or visit www.oracle.com if you need additional information or have any
490.26 - * questions.
490.27 - */
490.28 -
490.29 -package sun.io;
490.30 -
490.31 -import sun.nio.cs.ext.IBM861;
490.32 -
490.33 -/**
490.34 - * Tables and data to convert Unicode to Cp861
490.35 - *
490.36 - * @author ConverterGenerator tool
490.37 - */
490.38 -
490.39 -public class CharToByteCp861 extends CharToByteSingleByte {
490.40 -
490.41 - private final static IBM861 nioCoder = new IBM861();
490.42 -
490.43 - public String getCharacterEncoding() {
490.44 - return "Cp861";
490.45 - }
490.46 -
490.47 - public CharToByteCp861() {
490.48 - super.mask1 = 0xFF00;
490.49 - super.mask2 = 0x00FF;
490.50 - super.shift = 8;
490.51 - super.index1 = nioCoder.getEncoderIndex1();
490.52 - super.index2 = nioCoder.getEncoderIndex2();
490.53 - }
490.54 -}
491.1 --- a/src/share/classes/sun/io/CharToByteCp862.java Thu Sep 01 13:54:38 2011 -0700
491.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
491.3 @@ -1,51 +0,0 @@
491.4 -/*
491.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
491.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
491.7 - *
491.8 - * This code is free software; you can redistribute it and/or modify it
491.9 - * under the terms of the GNU General Public License version 2 only, as
491.10 - * published by the Free Software Foundation. Oracle designates this
491.11 - * particular file as subject to the "Classpath" exception as provided
491.12 - * by Oracle in the LICENSE file that accompanied this code.
491.13 - *
491.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
491.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
491.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
491.17 - * version 2 for more details (a copy is included in the LICENSE file that
491.18 - * accompanied this code).
491.19 - *
491.20 - * You should have received a copy of the GNU General Public License version
491.21 - * 2 along with this work; if not, write to the Free Software Foundation,
491.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
491.23 - *
491.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
491.25 - * or visit www.oracle.com if you need additional information or have any
491.26 - * questions.
491.27 - */
491.28 -
491.29 -package sun.io;
491.30 -
491.31 -import sun.nio.cs.IBM862;
491.32 -
491.33 -/**
491.34 - * Tables and data to convert Unicode to Cp862
491.35 - *
491.36 - * @author ConverterGenerator tool
491.37 - */
491.38 -
491.39 -public class CharToByteCp862 extends CharToByteSingleByte {
491.40 -
491.41 - private final static IBM862 nioCoder = new IBM862();
491.42 -
491.43 - public String getCharacterEncoding() {
491.44 - return "Cp862";
491.45 - }
491.46 -
491.47 - public CharToByteCp862() {
491.48 - super.mask1 = 0xFF00;
491.49 - super.mask2 = 0x00FF;
491.50 - super.shift = 8;
491.51 - super.index1 = nioCoder.getEncoderIndex1();
491.52 - super.index2 = nioCoder.getEncoderIndex2();
491.53 - }
491.54 -}
492.1 --- a/src/share/classes/sun/io/CharToByteCp863.java Thu Sep 01 13:54:38 2011 -0700
492.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
492.3 @@ -1,51 +0,0 @@
492.4 -/*
492.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
492.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
492.7 - *
492.8 - * This code is free software; you can redistribute it and/or modify it
492.9 - * under the terms of the GNU General Public License version 2 only, as
492.10 - * published by the Free Software Foundation. Oracle designates this
492.11 - * particular file as subject to the "Classpath" exception as provided
492.12 - * by Oracle in the LICENSE file that accompanied this code.
492.13 - *
492.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
492.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
492.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
492.17 - * version 2 for more details (a copy is included in the LICENSE file that
492.18 - * accompanied this code).
492.19 - *
492.20 - * You should have received a copy of the GNU General Public License version
492.21 - * 2 along with this work; if not, write to the Free Software Foundation,
492.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
492.23 - *
492.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
492.25 - * or visit www.oracle.com if you need additional information or have any
492.26 - * questions.
492.27 - */
492.28 -
492.29 -package sun.io;
492.30 -
492.31 -import sun.nio.cs.ext.IBM863;
492.32 -
492.33 -/**
492.34 - * Tables and data to convert Unicode to Cp863
492.35 - *
492.36 - * @author ConverterGenerator tool
492.37 - */
492.38 -
492.39 -public class CharToByteCp863 extends CharToByteSingleByte {
492.40 -
492.41 - private final static IBM863 nioCoder = new IBM863();
492.42 -
492.43 - public String getCharacterEncoding() {
492.44 - return "Cp863";
492.45 - }
492.46 -
492.47 - public CharToByteCp863() {
492.48 - super.mask1 = 0xFF00;
492.49 - super.mask2 = 0x00FF;
492.50 - super.shift = 8;
492.51 - super.index1 = nioCoder.getEncoderIndex1();
492.52 - super.index2 = nioCoder.getEncoderIndex2();
492.53 - }
492.54 -}
493.1 --- a/src/share/classes/sun/io/CharToByteCp864.java Thu Sep 01 13:54:38 2011 -0700
493.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
493.3 @@ -1,51 +0,0 @@
493.4 -/*
493.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
493.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
493.7 - *
493.8 - * This code is free software; you can redistribute it and/or modify it
493.9 - * under the terms of the GNU General Public License version 2 only, as
493.10 - * published by the Free Software Foundation. Oracle designates this
493.11 - * particular file as subject to the "Classpath" exception as provided
493.12 - * by Oracle in the LICENSE file that accompanied this code.
493.13 - *
493.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
493.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
493.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
493.17 - * version 2 for more details (a copy is included in the LICENSE file that
493.18 - * accompanied this code).
493.19 - *
493.20 - * You should have received a copy of the GNU General Public License version
493.21 - * 2 along with this work; if not, write to the Free Software Foundation,
493.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
493.23 - *
493.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
493.25 - * or visit www.oracle.com if you need additional information or have any
493.26 - * questions.
493.27 - */
493.28 -
493.29 -package sun.io;
493.30 -
493.31 -import sun.nio.cs.ext.IBM864;
493.32 -
493.33 -/**
493.34 - * Tables and data to convert Unicode to Cp864
493.35 - *
493.36 - * @author ConverterGenerator tool
493.37 - */
493.38 -
493.39 -public class CharToByteCp864 extends CharToByteSingleByte {
493.40 -
493.41 - private final static IBM864 nioCoder = new IBM864();
493.42 -
493.43 - public String getCharacterEncoding() {
493.44 - return "Cp864";
493.45 - }
493.46 -
493.47 - public CharToByteCp864() {
493.48 - super.mask1 = 0xFF00;
493.49 - super.mask2 = 0x00FF;
493.50 - super.shift = 8;
493.51 - super.index1 = nioCoder.getEncoderIndex1();
493.52 - super.index2 = nioCoder.getEncoderIndex2();
493.53 - }
493.54 -}
494.1 --- a/src/share/classes/sun/io/CharToByteCp865.java Thu Sep 01 13:54:38 2011 -0700
494.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
494.3 @@ -1,51 +0,0 @@
494.4 -/*
494.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
494.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
494.7 - *
494.8 - * This code is free software; you can redistribute it and/or modify it
494.9 - * under the terms of the GNU General Public License version 2 only, as
494.10 - * published by the Free Software Foundation. Oracle designates this
494.11 - * particular file as subject to the "Classpath" exception as provided
494.12 - * by Oracle in the LICENSE file that accompanied this code.
494.13 - *
494.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
494.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
494.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
494.17 - * version 2 for more details (a copy is included in the LICENSE file that
494.18 - * accompanied this code).
494.19 - *
494.20 - * You should have received a copy of the GNU General Public License version
494.21 - * 2 along with this work; if not, write to the Free Software Foundation,
494.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
494.23 - *
494.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
494.25 - * or visit www.oracle.com if you need additional information or have any
494.26 - * questions.
494.27 - */
494.28 -
494.29 -package sun.io;
494.30 -
494.31 -import sun.nio.cs.ext.IBM865;
494.32 -
494.33 -/**
494.34 - * Tables and data to convert Unicode to Cp865
494.35 - *
494.36 - * @author ConverterGenerator tool
494.37 - */
494.38 -
494.39 -public class CharToByteCp865 extends CharToByteSingleByte {
494.40 -
494.41 - private final static IBM865 nioCoder = new IBM865();
494.42 -
494.43 - public String getCharacterEncoding() {
494.44 - return "Cp865";
494.45 - }
494.46 -
494.47 - public CharToByteCp865() {
494.48 - super.mask1 = 0xFF00;
494.49 - super.mask2 = 0x00FF;
494.50 - super.shift = 8;
494.51 - super.index1 = nioCoder.getEncoderIndex1();
494.52 - super.index2 = nioCoder.getEncoderIndex2();
494.53 - }
494.54 -}
495.1 --- a/src/share/classes/sun/io/CharToByteCp866.java Thu Sep 01 13:54:38 2011 -0700
495.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
495.3 @@ -1,51 +0,0 @@
495.4 -/*
495.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
495.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
495.7 - *
495.8 - * This code is free software; you can redistribute it and/or modify it
495.9 - * under the terms of the GNU General Public License version 2 only, as
495.10 - * published by the Free Software Foundation. Oracle designates this
495.11 - * particular file as subject to the "Classpath" exception as provided
495.12 - * by Oracle in the LICENSE file that accompanied this code.
495.13 - *
495.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
495.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
495.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
495.17 - * version 2 for more details (a copy is included in the LICENSE file that
495.18 - * accompanied this code).
495.19 - *
495.20 - * You should have received a copy of the GNU General Public License version
495.21 - * 2 along with this work; if not, write to the Free Software Foundation,
495.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
495.23 - *
495.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
495.25 - * or visit www.oracle.com if you need additional information or have any
495.26 - * questions.
495.27 - */
495.28 -
495.29 -package sun.io;
495.30 -
495.31 -import sun.nio.cs.IBM866;
495.32 -
495.33 -/**
495.34 - * Tables and data to convert Unicode to Cp866
495.35 - *
495.36 - * @author ConverterGenerator tool
495.37 - */
495.38 -
495.39 -public class CharToByteCp866 extends CharToByteSingleByte {
495.40 -
495.41 - private final static IBM866 nioCoder = new IBM866();
495.42 -
495.43 - public String getCharacterEncoding() {
495.44 - return "Cp866";
495.45 - }
495.46 -
495.47 - public CharToByteCp866() {
495.48 - super.mask1 = 0xFF00;
495.49 - super.mask2 = 0x00FF;
495.50 - super.shift = 8;
495.51 - super.index1 = nioCoder.getEncoderIndex1();
495.52 - super.index2 = nioCoder.getEncoderIndex2();
495.53 - }
495.54 -}
496.1 --- a/src/share/classes/sun/io/CharToByteCp868.java Thu Sep 01 13:54:38 2011 -0700
496.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
496.3 @@ -1,51 +0,0 @@
496.4 -/*
496.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
496.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
496.7 - *
496.8 - * This code is free software; you can redistribute it and/or modify it
496.9 - * under the terms of the GNU General Public License version 2 only, as
496.10 - * published by the Free Software Foundation. Oracle designates this
496.11 - * particular file as subject to the "Classpath" exception as provided
496.12 - * by Oracle in the LICENSE file that accompanied this code.
496.13 - *
496.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
496.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
496.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
496.17 - * version 2 for more details (a copy is included in the LICENSE file that
496.18 - * accompanied this code).
496.19 - *
496.20 - * You should have received a copy of the GNU General Public License version
496.21 - * 2 along with this work; if not, write to the Free Software Foundation,
496.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
496.23 - *
496.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
496.25 - * or visit www.oracle.com if you need additional information or have any
496.26 - * questions.
496.27 - */
496.28 -
496.29 -package sun.io;
496.30 -
496.31 -import sun.nio.cs.ext.IBM868;
496.32 -
496.33 -/**
496.34 - * Tables and data to convert Unicode to Cp868
496.35 - *
496.36 - * @author ConverterGenerator tool
496.37 - */
496.38 -
496.39 -public class CharToByteCp868 extends CharToByteSingleByte {
496.40 -
496.41 - private final static IBM868 nioCoder = new IBM868();
496.42 -
496.43 - public String getCharacterEncoding() {
496.44 - return "Cp868";
496.45 - }
496.46 -
496.47 - public CharToByteCp868() {
496.48 - super.mask1 = 0xFF00;
496.49 - super.mask2 = 0x00FF;
496.50 - super.shift = 8;
496.51 - super.index1 = nioCoder.getEncoderIndex1();
496.52 - super.index2 = nioCoder.getEncoderIndex2();
496.53 - }
496.54 -}
497.1 --- a/src/share/classes/sun/io/CharToByteCp869.java Thu Sep 01 13:54:38 2011 -0700
497.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
497.3 @@ -1,51 +0,0 @@
497.4 -/*
497.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
497.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
497.7 - *
497.8 - * This code is free software; you can redistribute it and/or modify it
497.9 - * under the terms of the GNU General Public License version 2 only, as
497.10 - * published by the Free Software Foundation. Oracle designates this
497.11 - * particular file as subject to the "Classpath" exception as provided
497.12 - * by Oracle in the LICENSE file that accompanied this code.
497.13 - *
497.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
497.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
497.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
497.17 - * version 2 for more details (a copy is included in the LICENSE file that
497.18 - * accompanied this code).
497.19 - *
497.20 - * You should have received a copy of the GNU General Public License version
497.21 - * 2 along with this work; if not, write to the Free Software Foundation,
497.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
497.23 - *
497.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
497.25 - * or visit www.oracle.com if you need additional information or have any
497.26 - * questions.
497.27 - */
497.28 -
497.29 -package sun.io;
497.30 -
497.31 -import sun.nio.cs.ext.IBM869;
497.32 -
497.33 -/**
497.34 - * Tables and data to convert Unicode to Cp869
497.35 - *
497.36 - * @author ConverterGenerator tool
497.37 - */
497.38 -
497.39 -public class CharToByteCp869 extends CharToByteSingleByte {
497.40 -
497.41 - private final static IBM869 nioCoder = new IBM869();
497.42 -
497.43 - public String getCharacterEncoding() {
497.44 - return "Cp869";
497.45 - }
497.46 -
497.47 - public CharToByteCp869() {
497.48 - super.mask1 = 0xFF00;
497.49 - super.mask2 = 0x00FF;
497.50 - super.shift = 8;
497.51 - super.index1 = nioCoder.getEncoderIndex1();
497.52 - super.index2 = nioCoder.getEncoderIndex2();
497.53 - }
497.54 -}
498.1 --- a/src/share/classes/sun/io/CharToByteCp870.java Thu Sep 01 13:54:38 2011 -0700
498.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
498.3 @@ -1,51 +0,0 @@
498.4 -/*
498.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
498.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
498.7 - *
498.8 - * This code is free software; you can redistribute it and/or modify it
498.9 - * under the terms of the GNU General Public License version 2 only, as
498.10 - * published by the Free Software Foundation. Oracle designates this
498.11 - * particular file as subject to the "Classpath" exception as provided
498.12 - * by Oracle in the LICENSE file that accompanied this code.
498.13 - *
498.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
498.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
498.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
498.17 - * version 2 for more details (a copy is included in the LICENSE file that
498.18 - * accompanied this code).
498.19 - *
498.20 - * You should have received a copy of the GNU General Public License version
498.21 - * 2 along with this work; if not, write to the Free Software Foundation,
498.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
498.23 - *
498.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
498.25 - * or visit www.oracle.com if you need additional information or have any
498.26 - * questions.
498.27 - */
498.28 -
498.29 -package sun.io;
498.30 -
498.31 -import sun.nio.cs.ext.IBM870;
498.32 -
498.33 -/**
498.34 - * Tables and data to convert Unicode to Cp870
498.35 - *
498.36 - * @author ConverterGenerator tool
498.37 - */
498.38 -
498.39 -public class CharToByteCp870 extends CharToByteSingleByte {
498.40 -
498.41 - private final static IBM870 nioCoder = new IBM870();
498.42 -
498.43 - public String getCharacterEncoding() {
498.44 - return "Cp870";
498.45 - }
498.46 -
498.47 - public CharToByteCp870() {
498.48 - super.mask1 = 0xFF00;
498.49 - super.mask2 = 0x00FF;
498.50 - super.shift = 8;
498.51 - super.index1 = nioCoder.getEncoderIndex1();
498.52 - super.index2 = nioCoder.getEncoderIndex2();
498.53 - }
498.54 -}
499.1 --- a/src/share/classes/sun/io/CharToByteCp871.java Thu Sep 01 13:54:38 2011 -0700
499.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
499.3 @@ -1,51 +0,0 @@
499.4 -/*
499.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
499.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
499.7 - *
499.8 - * This code is free software; you can redistribute it and/or modify it
499.9 - * under the terms of the GNU General Public License version 2 only, as
499.10 - * published by the Free Software Foundation. Oracle designates this
499.11 - * particular file as subject to the "Classpath" exception as provided
499.12 - * by Oracle in the LICENSE file that accompanied this code.
499.13 - *
499.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
499.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
499.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
499.17 - * version 2 for more details (a copy is included in the LICENSE file that
499.18 - * accompanied this code).
499.19 - *
499.20 - * You should have received a copy of the GNU General Public License version
499.21 - * 2 along with this work; if not, write to the Free Software Foundation,
499.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
499.23 - *
499.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
499.25 - * or visit www.oracle.com if you need additional information or have any
499.26 - * questions.
499.27 - */
499.28 -
499.29 -package sun.io;
499.30 -
499.31 -import sun.nio.cs.ext.IBM871;
499.32 -
499.33 -/**
499.34 - * Tables and data to convert Unicode to Cp871
499.35 - *
499.36 - * @author ConverterGenerator tool
499.37 - */
499.38 -
499.39 -public class CharToByteCp871 extends CharToByteSingleByte {
499.40 -
499.41 - private final static IBM871 nioCoder = new IBM871();
499.42 -
499.43 - public String getCharacterEncoding() {
499.44 - return "Cp871";
499.45 - }
499.46 -
499.47 - public CharToByteCp871() {
499.48 - super.mask1 = 0xFF00;
499.49 - super.mask2 = 0x00FF;
499.50 - super.shift = 8;
499.51 - super.index1 = nioCoder.getEncoderIndex1();
499.52 - super.index2 = nioCoder.getEncoderIndex2();
499.53 - }
499.54 -}
500.1 --- a/src/share/classes/sun/io/CharToByteCp874.java Thu Sep 01 13:54:38 2011 -0700
500.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
500.3 @@ -1,51 +0,0 @@
500.4 -/*
500.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
500.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
500.7 - *
500.8 - * This code is free software; you can redistribute it and/or modify it
500.9 - * under the terms of the GNU General Public License version 2 only, as
500.10 - * published by the Free Software Foundation. Oracle designates this
500.11 - * particular file as subject to the "Classpath" exception as provided
500.12 - * by Oracle in the LICENSE file that accompanied this code.
500.13 - *
500.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
500.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
500.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
500.17 - * version 2 for more details (a copy is included in the LICENSE file that
500.18 - * accompanied this code).
500.19 - *
500.20 - * You should have received a copy of the GNU General Public License version
500.21 - * 2 along with this work; if not, write to the Free Software Foundation,
500.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
500.23 - *
500.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
500.25 - * or visit www.oracle.com if you need additional information or have any
500.26 - * questions.
500.27 - */
500.28 -
500.29 -package sun.io;
500.30 -
500.31 -import sun.nio.cs.IBM874;
500.32 -
500.33 -/**
500.34 - * Tables and data to convert Unicode to Cp874
500.35 - *
500.36 - * @author ConverterGenerator tool
500.37 - */
500.38 -
500.39 -public class CharToByteCp874 extends CharToByteSingleByte {
500.40 -
500.41 - private final static IBM874 nioCoder = new IBM874();
500.42 -
500.43 - public String getCharacterEncoding() {
500.44 - return "Cp874";
500.45 - }
500.46 -
500.47 - public CharToByteCp874() {
500.48 - super.mask1 = 0xFF00;
500.49 - super.mask2 = 0x00FF;
500.50 - super.shift = 8;
500.51 - super.index1 = nioCoder.getEncoderIndex1();
500.52 - super.index2 = nioCoder.getEncoderIndex2();
500.53 - }
500.54 -}
501.1 --- a/src/share/classes/sun/io/CharToByteCp875.java Thu Sep 01 13:54:38 2011 -0700
501.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
501.3 @@ -1,51 +0,0 @@
501.4 -/*
501.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
501.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
501.7 - *
501.8 - * This code is free software; you can redistribute it and/or modify it
501.9 - * under the terms of the GNU General Public License version 2 only, as
501.10 - * published by the Free Software Foundation. Oracle designates this
501.11 - * particular file as subject to the "Classpath" exception as provided
501.12 - * by Oracle in the LICENSE file that accompanied this code.
501.13 - *
501.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
501.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
501.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
501.17 - * version 2 for more details (a copy is included in the LICENSE file that
501.18 - * accompanied this code).
501.19 - *
501.20 - * You should have received a copy of the GNU General Public License version
501.21 - * 2 along with this work; if not, write to the Free Software Foundation,
501.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
501.23 - *
501.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
501.25 - * or visit www.oracle.com if you need additional information or have any
501.26 - * questions.
501.27 - */
501.28 -
501.29 -package sun.io;
501.30 -
501.31 -import sun.nio.cs.ext.IBM875;
501.32 -
501.33 -/**
501.34 - * Tables and data to convert Unicode to Cp875
501.35 - *
501.36 - * @author ConverterGenerator tool
501.37 - */
501.38 -
501.39 -public class CharToByteCp875 extends CharToByteSingleByte {
501.40 -
501.41 - private final static IBM875 nioCoder = new IBM875();
501.42 -
501.43 - public String getCharacterEncoding() {
501.44 - return "Cp875";
501.45 - }
501.46 -
501.47 - public CharToByteCp875() {
501.48 - super.mask1 = 0xFF00;
501.49 - super.mask2 = 0x00FF;
501.50 - super.shift = 8;
501.51 - super.index1 = nioCoder.getEncoderIndex1();
501.52 - super.index2 = nioCoder.getEncoderIndex2();
501.53 - }
501.54 -}
502.1 --- a/src/share/classes/sun/io/CharToByteCp918.java Thu Sep 01 13:54:38 2011 -0700
502.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
502.3 @@ -1,51 +0,0 @@
502.4 -/*
502.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
502.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
502.7 - *
502.8 - * This code is free software; you can redistribute it and/or modify it
502.9 - * under the terms of the GNU General Public License version 2 only, as
502.10 - * published by the Free Software Foundation. Oracle designates this
502.11 - * particular file as subject to the "Classpath" exception as provided
502.12 - * by Oracle in the LICENSE file that accompanied this code.
502.13 - *
502.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
502.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
502.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
502.17 - * version 2 for more details (a copy is included in the LICENSE file that
502.18 - * accompanied this code).
502.19 - *
502.20 - * You should have received a copy of the GNU General Public License version
502.21 - * 2 along with this work; if not, write to the Free Software Foundation,
502.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
502.23 - *
502.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
502.25 - * or visit www.oracle.com if you need additional information or have any
502.26 - * questions.
502.27 - */
502.28 -
502.29 -package sun.io;
502.30 -
502.31 -import sun.nio.cs.ext.IBM918;
502.32 -
502.33 -/**
502.34 - * Tables and data to convert Unicode to Cp918
502.35 - *
502.36 - * @author ConverterGenerator tool
502.37 - */
502.38 -
502.39 -public class CharToByteCp918 extends CharToByteSingleByte {
502.40 -
502.41 - private final static IBM918 nioCoder = new IBM918();
502.42 -
502.43 - public String getCharacterEncoding() {
502.44 - return "Cp918";
502.45 - }
502.46 -
502.47 - public CharToByteCp918() {
502.48 - super.mask1 = 0xFF00;
502.49 - super.mask2 = 0x00FF;
502.50 - super.shift = 8;
502.51 - super.index1 = nioCoder.getEncoderIndex1();
502.52 - super.index2 = nioCoder.getEncoderIndex2();
502.53 - }
502.54 -}
503.1 --- a/src/share/classes/sun/io/CharToByteCp921.java Thu Sep 01 13:54:38 2011 -0700
503.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
503.3 @@ -1,51 +0,0 @@
503.4 -/*
503.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
503.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
503.7 - *
503.8 - * This code is free software; you can redistribute it and/or modify it
503.9 - * under the terms of the GNU General Public License version 2 only, as
503.10 - * published by the Free Software Foundation. Oracle designates this
503.11 - * particular file as subject to the "Classpath" exception as provided
503.12 - * by Oracle in the LICENSE file that accompanied this code.
503.13 - *
503.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
503.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
503.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
503.17 - * version 2 for more details (a copy is included in the LICENSE file that
503.18 - * accompanied this code).
503.19 - *
503.20 - * You should have received a copy of the GNU General Public License version
503.21 - * 2 along with this work; if not, write to the Free Software Foundation,
503.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
503.23 - *
503.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
503.25 - * or visit www.oracle.com if you need additional information or have any
503.26 - * questions.
503.27 - */
503.28 -
503.29 -package sun.io;
503.30 -
503.31 -import sun.nio.cs.ext.IBM921;
503.32 -
503.33 -/**
503.34 - * Tables and data to convert Unicode to Cp921
503.35 - *
503.36 - * @author ConverterGenerator tool
503.37 - */
503.38 -
503.39 -public class CharToByteCp921 extends CharToByteSingleByte {
503.40 -
503.41 - private final static IBM921 nioCoder = new IBM921();
503.42 -
503.43 - public String getCharacterEncoding() {
503.44 - return "Cp921";
503.45 - }
503.46 -
503.47 - public CharToByteCp921() {
503.48 - super.mask1 = 0xFF00;
503.49 - super.mask2 = 0x00FF;
503.50 - super.shift = 8;
503.51 - super.index1 = nioCoder.getEncoderIndex1();
503.52 - super.index2 = nioCoder.getEncoderIndex2();
503.53 - }
503.54 -}
504.1 --- a/src/share/classes/sun/io/CharToByteCp922.java Thu Sep 01 13:54:38 2011 -0700
504.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
504.3 @@ -1,51 +0,0 @@
504.4 -/*
504.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
504.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
504.7 - *
504.8 - * This code is free software; you can redistribute it and/or modify it
504.9 - * under the terms of the GNU General Public License version 2 only, as
504.10 - * published by the Free Software Foundation. Oracle designates this
504.11 - * particular file as subject to the "Classpath" exception as provided
504.12 - * by Oracle in the LICENSE file that accompanied this code.
504.13 - *
504.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
504.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
504.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
504.17 - * version 2 for more details (a copy is included in the LICENSE file that
504.18 - * accompanied this code).
504.19 - *
504.20 - * You should have received a copy of the GNU General Public License version
504.21 - * 2 along with this work; if not, write to the Free Software Foundation,
504.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
504.23 - *
504.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
504.25 - * or visit www.oracle.com if you need additional information or have any
504.26 - * questions.
504.27 - */
504.28 -
504.29 -package sun.io;
504.30 -
504.31 -import sun.nio.cs.ext.IBM922;
504.32 -
504.33 -/**
504.34 - * Tables and data to convert Unicode to Cp922
504.35 - *
504.36 - * @author ConverterGenerator tool
504.37 - */
504.38 -
504.39 -public class CharToByteCp922 extends CharToByteSingleByte {
504.40 -
504.41 - private final static IBM922 nioCoder = new IBM922();
504.42 -
504.43 - public String getCharacterEncoding() {
504.44 - return "Cp922";
504.45 - }
504.46 -
504.47 - public CharToByteCp922() {
504.48 - super.mask1 = 0xFF00;
504.49 - super.mask2 = 0x00FF;
504.50 - super.shift = 8;
504.51 - super.index1 = nioCoder.getEncoderIndex1();
504.52 - super.index2 = nioCoder.getEncoderIndex2();
504.53 - }
504.54 -}
505.1 --- a/src/share/classes/sun/io/CharToByteCp930.java Thu Sep 01 13:54:38 2011 -0700
505.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
505.3 @@ -1,39 +0,0 @@
505.4 -/*
505.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
505.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
505.7 - *
505.8 - * This code is free software; you can redistribute it and/or modify it
505.9 - * under the terms of the GNU General Public License version 2 only, as
505.10 - * published by the Free Software Foundation. Oracle designates this
505.11 - * particular file as subject to the "Classpath" exception as provided
505.12 - * by Oracle in the LICENSE file that accompanied this code.
505.13 - *
505.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
505.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
505.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
505.17 - * version 2 for more details (a copy is included in the LICENSE file that
505.18 - * accompanied this code).
505.19 - *
505.20 - * You should have received a copy of the GNU General Public License version
505.21 - * 2 along with this work; if not, write to the Free Software Foundation,
505.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
505.23 - *
505.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
505.25 - * or visit www.oracle.com if you need additional information or have any
505.26 - * questions.
505.27 - */
505.28 -package sun.io;
505.29 -
505.30 -import sun.nio.cs.ext.*;
505.31 -
505.32 -public class CharToByteCp930 extends CharToByteDBCS_EBCDIC {
505.33 -
505.34 - // Return the character set id
505.35 - public String getCharacterEncoding() {
505.36 - return "Cp930";
505.37 - }
505.38 -
505.39 - public CharToByteCp930() {
505.40 - super((DoubleByte.Encoder)new IBM930().newEncoder());
505.41 - }
505.42 -}
506.1 --- a/src/share/classes/sun/io/CharToByteCp933.java Thu Sep 01 13:54:38 2011 -0700
506.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
506.3 @@ -1,39 +0,0 @@
506.4 -/*
506.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
506.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
506.7 - *
506.8 - * This code is free software; you can redistribute it and/or modify it
506.9 - * under the terms of the GNU General Public License version 2 only, as
506.10 - * published by the Free Software Foundation. Oracle designates this
506.11 - * particular file as subject to the "Classpath" exception as provided
506.12 - * by Oracle in the LICENSE file that accompanied this code.
506.13 - *
506.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
506.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
506.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
506.17 - * version 2 for more details (a copy is included in the LICENSE file that
506.18 - * accompanied this code).
506.19 - *
506.20 - * You should have received a copy of the GNU General Public License version
506.21 - * 2 along with this work; if not, write to the Free Software Foundation,
506.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
506.23 - *
506.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
506.25 - * or visit www.oracle.com if you need additional information or have any
506.26 - * questions.
506.27 - */
506.28 -package sun.io;
506.29 -
506.30 -import sun.nio.cs.ext.*;
506.31 -
506.32 -public class CharToByteCp933 extends CharToByteDBCS_EBCDIC {
506.33 -
506.34 - // Return the character set id
506.35 - public String getCharacterEncoding() {
506.36 - return "Cp933";
506.37 - }
506.38 -
506.39 - public CharToByteCp933() {
506.40 - super((DoubleByte.Encoder)new IBM933().newEncoder());
506.41 - }
506.42 -}
507.1 --- a/src/share/classes/sun/io/CharToByteCp935.java Thu Sep 01 13:54:38 2011 -0700
507.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
507.3 @@ -1,39 +0,0 @@
507.4 -/*
507.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
507.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
507.7 - *
507.8 - * This code is free software; you can redistribute it and/or modify it
507.9 - * under the terms of the GNU General Public License version 2 only, as
507.10 - * published by the Free Software Foundation. Oracle designates this
507.11 - * particular file as subject to the "Classpath" exception as provided
507.12 - * by Oracle in the LICENSE file that accompanied this code.
507.13 - *
507.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
507.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
507.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
507.17 - * version 2 for more details (a copy is included in the LICENSE file that
507.18 - * accompanied this code).
507.19 - *
507.20 - * You should have received a copy of the GNU General Public License version
507.21 - * 2 along with this work; if not, write to the Free Software Foundation,
507.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
507.23 - *
507.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
507.25 - * or visit www.oracle.com if you need additional information or have any
507.26 - * questions.
507.27 - */
507.28 -package sun.io;
507.29 -
507.30 -import sun.nio.cs.ext.*;
507.31 -
507.32 -public class CharToByteCp935 extends CharToByteDBCS_EBCDIC {
507.33 -
507.34 - // Return the character set id
507.35 - public String getCharacterEncoding() {
507.36 - return "Cp935";
507.37 - }
507.38 -
507.39 - public CharToByteCp935() {
507.40 - super((DoubleByte.Encoder)new IBM935().newEncoder());
507.41 - }
507.42 -}
508.1 --- a/src/share/classes/sun/io/CharToByteCp937.java Thu Sep 01 13:54:38 2011 -0700
508.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
508.3 @@ -1,39 +0,0 @@
508.4 -/*
508.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
508.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
508.7 - *
508.8 - * This code is free software; you can redistribute it and/or modify it
508.9 - * under the terms of the GNU General Public License version 2 only, as
508.10 - * published by the Free Software Foundation. Oracle designates this
508.11 - * particular file as subject to the "Classpath" exception as provided
508.12 - * by Oracle in the LICENSE file that accompanied this code.
508.13 - *
508.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
508.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
508.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
508.17 - * version 2 for more details (a copy is included in the LICENSE file that
508.18 - * accompanied this code).
508.19 - *
508.20 - * You should have received a copy of the GNU General Public License version
508.21 - * 2 along with this work; if not, write to the Free Software Foundation,
508.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
508.23 - *
508.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
508.25 - * or visit www.oracle.com if you need additional information or have any
508.26 - * questions.
508.27 - */
508.28 -package sun.io;
508.29 -
508.30 -import sun.nio.cs.ext.*;
508.31 -
508.32 -public class CharToByteCp937 extends CharToByteDBCS_EBCDIC {
508.33 -
508.34 - // Return the character set id
508.35 - public String getCharacterEncoding() {
508.36 - return "Cp937";
508.37 - }
508.38 -
508.39 - public CharToByteCp937() {
508.40 - super((DoubleByte.Encoder)new IBM937().newEncoder());
508.41 - }
508.42 -}
509.1 --- a/src/share/classes/sun/io/CharToByteCp939.java Thu Sep 01 13:54:38 2011 -0700
509.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
509.3 @@ -1,39 +0,0 @@
509.4 -/*
509.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
509.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
509.7 - *
509.8 - * This code is free software; you can redistribute it and/or modify it
509.9 - * under the terms of the GNU General Public License version 2 only, as
509.10 - * published by the Free Software Foundation. Oracle designates this
509.11 - * particular file as subject to the "Classpath" exception as provided
509.12 - * by Oracle in the LICENSE file that accompanied this code.
509.13 - *
509.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
509.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
509.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
509.17 - * version 2 for more details (a copy is included in the LICENSE file that
509.18 - * accompanied this code).
509.19 - *
509.20 - * You should have received a copy of the GNU General Public License version
509.21 - * 2 along with this work; if not, write to the Free Software Foundation,
509.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
509.23 - *
509.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
509.25 - * or visit www.oracle.com if you need additional information or have any
509.26 - * questions.
509.27 - */
509.28 -package sun.io;
509.29 -
509.30 -import sun.nio.cs.ext.*;
509.31 -
509.32 -public class CharToByteCp939 extends CharToByteDBCS_EBCDIC {
509.33 -
509.34 - // Return the character set id
509.35 - public String getCharacterEncoding() {
509.36 - return "Cp939";
509.37 - }
509.38 -
509.39 - public CharToByteCp939() {
509.40 - super((DoubleByte.Encoder)new IBM939().newEncoder());
509.41 - }
509.42 -}
510.1 --- a/src/share/classes/sun/io/CharToByteCp942.java Thu Sep 01 13:54:38 2011 -0700
510.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
510.3 @@ -1,39 +0,0 @@
510.4 -/*
510.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
510.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
510.7 - *
510.8 - * This code is free software; you can redistribute it and/or modify it
510.9 - * under the terms of the GNU General Public License version 2 only, as
510.10 - * published by the Free Software Foundation. Oracle designates this
510.11 - * particular file as subject to the "Classpath" exception as provided
510.12 - * by Oracle in the LICENSE file that accompanied this code.
510.13 - *
510.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
510.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
510.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
510.17 - * version 2 for more details (a copy is included in the LICENSE file that
510.18 - * accompanied this code).
510.19 - *
510.20 - * You should have received a copy of the GNU General Public License version
510.21 - * 2 along with this work; if not, write to the Free Software Foundation,
510.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
510.23 - *
510.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
510.25 - * or visit www.oracle.com if you need additional information or have any
510.26 - * questions.
510.27 - */
510.28 -package sun.io;
510.29 -
510.30 -import sun.nio.cs.ext.*;
510.31 -
510.32 -public class CharToByteCp942 extends CharToByteDBCS_ASCII {
510.33 -
510.34 - // Return the character set id
510.35 - public String getCharacterEncoding() {
510.36 - return "Cp942";
510.37 - }
510.38 -
510.39 - public CharToByteCp942() {
510.40 - super((DoubleByte.Encoder)new IBM942().newEncoder());
510.41 - }
510.42 -}
511.1 --- a/src/share/classes/sun/io/CharToByteCp942C.java Thu Sep 01 13:54:38 2011 -0700
511.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
511.3 @@ -1,40 +0,0 @@
511.4 -/*
511.5 - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
511.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
511.7 - *
511.8 - * This code is free software; you can redistribute it and/or modify it
511.9 - * under the terms of the GNU General Public License version 2 only, as
511.10 - * published by the Free Software Foundation. Oracle designates this
511.11 - * particular file as subject to the "Classpath" exception as provided
511.12 - * by Oracle in the LICENSE file that accompanied this code.
511.13 - *
511.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
511.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
511.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
511.17 - * version 2 for more details (a copy is included in the LICENSE file that
511.18 - * accompanied this code).
511.19 - *
511.20 - * You should have received a copy of the GNU General Public License version
511.21 - * 2 along with this work; if not, write to the Free Software Foundation,
511.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
511.23 - *
511.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
511.25 - * or visit www.oracle.com if you need additional information or have any
511.26 - * questions.
511.27 - */
511.28 -
511.29 -package sun.io;
511.30 -
511.31 -import sun.nio.cs.ext.*;
511.32 -
511.33 -public class CharToByteCp942C extends CharToByteDBCS_ASCII {
511.34 -
511.35 - // Return the character set id
511.36 - public String getCharacterEncoding() {
511.37 - return "Cp942C";
511.38 - }
511.39 -
511.40 - public CharToByteCp942C() {
511.41 - super((DoubleByte.Encoder)new IBM942C().newEncoder());
511.42 - }
511.43 -}
512.1 --- a/src/share/classes/sun/io/CharToByteCp943.java Thu Sep 01 13:54:38 2011 -0700
512.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
512.3 @@ -1,40 +0,0 @@
512.4 -/*
512.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
512.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
512.7 - *
512.8 - * This code is free software; you can redistribute it and/or modify it
512.9 - * under the terms of the GNU General Public License version 2 only, as
512.10 - * published by the Free Software Foundation. Oracle designates this
512.11 - * particular file as subject to the "Classpath" exception as provided
512.12 - * by Oracle in the LICENSE file that accompanied this code.
512.13 - *
512.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
512.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
512.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
512.17 - * version 2 for more details (a copy is included in the LICENSE file that
512.18 - * accompanied this code).
512.19 - *
512.20 - * You should have received a copy of the GNU General Public License version
512.21 - * 2 along with this work; if not, write to the Free Software Foundation,
512.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
512.23 - *
512.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
512.25 - * or visit www.oracle.com if you need additional information or have any
512.26 - * questions.
512.27 - */
512.28 -
512.29 -package sun.io;
512.30 -
512.31 -import sun.nio.cs.ext.*;
512.32 -
512.33 -public class CharToByteCp943 extends CharToByteDBCS_ASCII {
512.34 -
512.35 - // Return the character set id
512.36 - public String getCharacterEncoding() {
512.37 - return "Cp943";
512.38 - }
512.39 -
512.40 - public CharToByteCp943() {
512.41 - super((DoubleByte.Encoder)new IBM943().newEncoder());
512.42 - }
512.43 -}
513.1 --- a/src/share/classes/sun/io/CharToByteCp943C.java Thu Sep 01 13:54:38 2011 -0700
513.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
513.3 @@ -1,40 +0,0 @@
513.4 -/*
513.5 - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
513.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
513.7 - *
513.8 - * This code is free software; you can redistribute it and/or modify it
513.9 - * under the terms of the GNU General Public License version 2 only, as
513.10 - * published by the Free Software Foundation. Oracle designates this
513.11 - * particular file as subject to the "Classpath" exception as provided
513.12 - * by Oracle in the LICENSE file that accompanied this code.
513.13 - *
513.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
513.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
513.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
513.17 - * version 2 for more details (a copy is included in the LICENSE file that
513.18 - * accompanied this code).
513.19 - *
513.20 - * You should have received a copy of the GNU General Public License version
513.21 - * 2 along with this work; if not, write to the Free Software Foundation,
513.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
513.23 - *
513.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
513.25 - * or visit www.oracle.com if you need additional information or have any
513.26 - * questions.
513.27 - */
513.28 -
513.29 -package sun.io;
513.30 -
513.31 -import sun.nio.cs.ext.*;
513.32 -
513.33 -public class CharToByteCp943C extends CharToByteDBCS_ASCII {
513.34 -
513.35 - // Return the character set id
513.36 - public String getCharacterEncoding() {
513.37 - return "Cp943C";
513.38 - }
513.39 -
513.40 - public CharToByteCp943C() {
513.41 - super((DoubleByte.Encoder)new IBM943C().newEncoder());
513.42 - }
513.43 -}
514.1 --- a/src/share/classes/sun/io/CharToByteCp948.java Thu Sep 01 13:54:38 2011 -0700
514.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
514.3 @@ -1,40 +0,0 @@
514.4 -/*
514.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
514.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
514.7 - *
514.8 - * This code is free software; you can redistribute it and/or modify it
514.9 - * under the terms of the GNU General Public License version 2 only, as
514.10 - * published by the Free Software Foundation. Oracle designates this
514.11 - * particular file as subject to the "Classpath" exception as provided
514.12 - * by Oracle in the LICENSE file that accompanied this code.
514.13 - *
514.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
514.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
514.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
514.17 - * version 2 for more details (a copy is included in the LICENSE file that
514.18 - * accompanied this code).
514.19 - *
514.20 - * You should have received a copy of the GNU General Public License version
514.21 - * 2 along with this work; if not, write to the Free Software Foundation,
514.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
514.23 - *
514.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
514.25 - * or visit www.oracle.com if you need additional information or have any
514.26 - * questions.
514.27 - */
514.28 -
514.29 -package sun.io;
514.30 -
514.31 -import sun.nio.cs.ext.*;
514.32 -
514.33 -public class CharToByteCp948 extends CharToByteDBCS_ASCII {
514.34 -
514.35 - // Return the character set id
514.36 - public String getCharacterEncoding() {
514.37 - return "Cp948";
514.38 - }
514.39 -
514.40 - public CharToByteCp948() {
514.41 - super((DoubleByte.Encoder)new IBM948().newEncoder());
514.42 - }
514.43 -}
515.1 --- a/src/share/classes/sun/io/CharToByteCp949.java Thu Sep 01 13:54:38 2011 -0700
515.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
515.3 @@ -1,40 +0,0 @@
515.4 -/*
515.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
515.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
515.7 - *
515.8 - * This code is free software; you can redistribute it and/or modify it
515.9 - * under the terms of the GNU General Public License version 2 only, as
515.10 - * published by the Free Software Foundation. Oracle designates this
515.11 - * particular file as subject to the "Classpath" exception as provided
515.12 - * by Oracle in the LICENSE file that accompanied this code.
515.13 - *
515.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
515.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
515.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
515.17 - * version 2 for more details (a copy is included in the LICENSE file that
515.18 - * accompanied this code).
515.19 - *
515.20 - * You should have received a copy of the GNU General Public License version
515.21 - * 2 along with this work; if not, write to the Free Software Foundation,
515.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
515.23 - *
515.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
515.25 - * or visit www.oracle.com if you need additional information or have any
515.26 - * questions.
515.27 - */
515.28 -
515.29 -package sun.io;
515.30 -
515.31 -import sun.nio.cs.ext.*;
515.32 -
515.33 -public class CharToByteCp949 extends CharToByteDBCS_ASCII {
515.34 -
515.35 - // Return the character set id
515.36 - public String getCharacterEncoding() {
515.37 - return "Cp949";
515.38 - }
515.39 -
515.40 - public CharToByteCp949() {
515.41 - super((DoubleByte.Encoder)new IBM949().newEncoder());
515.42 - }
515.43 -}
516.1 --- a/src/share/classes/sun/io/CharToByteCp949C.java Thu Sep 01 13:54:38 2011 -0700
516.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
516.3 @@ -1,40 +0,0 @@
516.4 -/*
516.5 - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
516.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
516.7 - *
516.8 - * This code is free software; you can redistribute it and/or modify it
516.9 - * under the terms of the GNU General Public License version 2 only, as
516.10 - * published by the Free Software Foundation. Oracle designates this
516.11 - * particular file as subject to the "Classpath" exception as provided
516.12 - * by Oracle in the LICENSE file that accompanied this code.
516.13 - *
516.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
516.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
516.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
516.17 - * version 2 for more details (a copy is included in the LICENSE file that
516.18 - * accompanied this code).
516.19 - *
516.20 - * You should have received a copy of the GNU General Public License version
516.21 - * 2 along with this work; if not, write to the Free Software Foundation,
516.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
516.23 - *
516.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
516.25 - * or visit www.oracle.com if you need additional information or have any
516.26 - * questions.
516.27 - */
516.28 -
516.29 -package sun.io;
516.30 -
516.31 -import sun.nio.cs.ext.*;
516.32 -
516.33 -public class CharToByteCp949C extends CharToByteDBCS_ASCII {
516.34 -
516.35 - // Return the character set id
516.36 - public String getCharacterEncoding() {
516.37 - return "Cp949C";
516.38 - }
516.39 -
516.40 - public CharToByteCp949C() {
516.41 - super((DoubleByte.Encoder)new IBM949C().newEncoder());
516.42 - }
516.43 -}
517.1 --- a/src/share/classes/sun/io/CharToByteCp950.java Thu Sep 01 13:54:38 2011 -0700
517.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
517.3 @@ -1,40 +0,0 @@
517.4 -/*
517.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
517.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
517.7 - *
517.8 - * This code is free software; you can redistribute it and/or modify it
517.9 - * under the terms of the GNU General Public License version 2 only, as
517.10 - * published by the Free Software Foundation. Oracle designates this
517.11 - * particular file as subject to the "Classpath" exception as provided
517.12 - * by Oracle in the LICENSE file that accompanied this code.
517.13 - *
517.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
517.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
517.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
517.17 - * version 2 for more details (a copy is included in the LICENSE file that
517.18 - * accompanied this code).
517.19 - *
517.20 - * You should have received a copy of the GNU General Public License version
517.21 - * 2 along with this work; if not, write to the Free Software Foundation,
517.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
517.23 - *
517.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
517.25 - * or visit www.oracle.com if you need additional information or have any
517.26 - * questions.
517.27 - */
517.28 -
517.29 -package sun.io;
517.30 -
517.31 -import sun.nio.cs.ext.*;
517.32 -
517.33 -public class CharToByteCp950 extends CharToByteDBCS_ASCII {
517.34 -
517.35 - // Return the character set id
517.36 - public String getCharacterEncoding() {
517.37 - return "Cp950";
517.38 - }
517.39 -
517.40 - public CharToByteCp950() {
517.41 - super((DoubleByte.Encoder)new IBM950().newEncoder());
517.42 - }
517.43 -}
518.1 --- a/src/share/classes/sun/io/CharToByteCp964.java Thu Sep 01 13:54:38 2011 -0700
518.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
518.3 @@ -1,62 +0,0 @@
518.4 -/*
518.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
518.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
518.7 - *
518.8 - * This code is free software; you can redistribute it and/or modify it
518.9 - * under the terms of the GNU General Public License version 2 only, as
518.10 - * published by the Free Software Foundation. Oracle designates this
518.11 - * particular file as subject to the "Classpath" exception as provided
518.12 - * by Oracle in the LICENSE file that accompanied this code.
518.13 - *
518.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
518.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
518.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
518.17 - * version 2 for more details (a copy is included in the LICENSE file that
518.18 - * accompanied this code).
518.19 - *
518.20 - * You should have received a copy of the GNU General Public License version
518.21 - * 2 along with this work; if not, write to the Free Software Foundation,
518.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
518.23 - *
518.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
518.25 - * or visit www.oracle.com if you need additional information or have any
518.26 - * questions.
518.27 - */
518.28 -package sun.io;
518.29 -
518.30 -import sun.nio.cs.ext.IBM964;
518.31 -
518.32 -/**
518.33 -* Tables and data to convert Unicode to Cp964
518.34 -*
518.35 -* @author Malcolm Ayres, assisted by UniMap program
518.36 -*/
518.37 -public class CharToByteCp964
518.38 - extends CharToByteEUC
518.39 -
518.40 -{
518.41 - private final static IBM964 nioCoder = new IBM964();
518.42 -
518.43 - // Return the character set id
518.44 - public String getCharacterEncoding()
518.45 - {
518.46 - return "Cp964";
518.47 - }
518.48 -
518.49 - public int getMaxBytesPerChar() {
518.50 - return 4;
518.51 - }
518.52 -
518.53 - public CharToByteCp964()
518.54 - {
518.55 - super();
518.56 - super.mask1 = 0xFFC0;
518.57 - super.mask2 = 0x003F;
518.58 - super.shift = 6;
518.59 - super.index1 = nioCoder.getEncoderIndex1();
518.60 - super.index2 = nioCoder.getEncoderIndex2();
518.61 - super.index2a = nioCoder.getEncoderIndex2a();
518.62 - super.index2b = nioCoder.getEncoderIndex2b();
518.63 - super.index2c = nioCoder.getEncoderIndex2c();
518.64 - }
518.65 -}
519.1 --- a/src/share/classes/sun/io/CharToByteCp970.java Thu Sep 01 13:54:38 2011 -0700
519.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
519.3 @@ -1,40 +0,0 @@
519.4 -/*
519.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
519.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
519.7 - *
519.8 - * This code is free software; you can redistribute it and/or modify it
519.9 - * under the terms of the GNU General Public License version 2 only, as
519.10 - * published by the Free Software Foundation. Oracle designates this
519.11 - * particular file as subject to the "Classpath" exception as provided
519.12 - * by Oracle in the LICENSE file that accompanied this code.
519.13 - *
519.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
519.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
519.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
519.17 - * version 2 for more details (a copy is included in the LICENSE file that
519.18 - * accompanied this code).
519.19 - *
519.20 - * You should have received a copy of the GNU General Public License version
519.21 - * 2 along with this work; if not, write to the Free Software Foundation,
519.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
519.23 - *
519.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
519.25 - * or visit www.oracle.com if you need additional information or have any
519.26 - * questions.
519.27 - */
519.28 -package sun.io;
519.29 -
519.30 -import sun.nio.cs.ext.*;
519.31 -
519.32 -// EUC_Simple is the same as DBCS_ASCII
519.33 -public class CharToByteCp970 extends CharToByteDBCS_ASCII {
519.34 -
519.35 - // Return the character set id
519.36 - public String getCharacterEncoding() {
519.37 - return "Cp970";
519.38 - }
519.39 -
519.40 - public CharToByteCp970() {
519.41 - super((DoubleByte.Encoder)new IBM970().newEncoder());
519.42 - }
519.43 -}
520.1 --- a/src/share/classes/sun/io/CharToByteDBCS_ASCII.java Thu Sep 01 13:54:38 2011 -0700
520.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
520.3 @@ -1,195 +0,0 @@
520.4 -/*
520.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
520.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
520.7 - *
520.8 - * This code is free software; you can redistribute it and/or modify it
520.9 - * under the terms of the GNU General Public License version 2 only, as
520.10 - * published by the Free Software Foundation. Oracle designates this
520.11 - * particular file as subject to the "Classpath" exception as provided
520.12 - * by Oracle in the LICENSE file that accompanied this code.
520.13 - *
520.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
520.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
520.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
520.17 - * version 2 for more details (a copy is included in the LICENSE file that
520.18 - * accompanied this code).
520.19 - *
520.20 - * You should have received a copy of the GNU General Public License version
520.21 - * 2 along with this work; if not, write to the Free Software Foundation,
520.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
520.23 - *
520.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
520.25 - * or visit www.oracle.com if you need additional information or have any
520.26 - * questions.
520.27 - */
520.28 -package sun.io;
520.29 -
520.30 -import sun.nio.cs.ext.DoubleByte;
520.31 -import static sun.nio.cs.CharsetMapping.*;
520.32 -
520.33 -public abstract class CharToByteDBCS_ASCII extends CharToByteConverter
520.34 -{
520.35 -
520.36 - private char highHalfZoneCode;
520.37 - private byte[] outputByte = new byte[2];
520.38 -
520.39 - private DoubleByte.Encoder enc;
520.40 -
520.41 - public CharToByteDBCS_ASCII(DoubleByte.Encoder enc) {
520.42 - super();
520.43 - this.enc = enc;
520.44 - }
520.45 -
520.46 - int encodeChar(char c) {
520.47 - return enc.encodeChar(c);
520.48 - }
520.49 -
520.50 - /**
520.51 - * flush out any residual data and reset the buffer state
520.52 - */
520.53 - public int flush(byte [] output, int outStart, int outEnd)
520.54 - throws MalformedInputException, ConversionBufferFullException
520.55 - {
520.56 -
520.57 - if (highHalfZoneCode != 0) {
520.58 - reset();
520.59 - badInputLength = 0;
520.60 - throw new MalformedInputException();
520.61 - }
520.62 -
520.63 - reset();
520.64 - return 0;
520.65 - }
520.66 -
520.67 - /**
520.68 - * Character conversion
520.69 - */
520.70 - public int convert(char[] input, int inOff, int inEnd,
520.71 - byte[] output, int outOff, int outEnd)
520.72 - throws UnknownCharacterException, MalformedInputException,
520.73 - ConversionBufferFullException
520.74 - {
520.75 - char inputChar;
520.76 - int inputSize;
520.77 -
520.78 - byteOff = outOff;
520.79 - charOff = inOff;
520.80 -
520.81 - while(charOff < inEnd) {
520.82 - int index;
520.83 - int theBytes;
520.84 - int spaceNeeded;
520.85 -
520.86 - if (highHalfZoneCode == 0) {
520.87 - inputChar = input[charOff];
520.88 - inputSize = 1;
520.89 - } else {
520.90 - inputChar = highHalfZoneCode;
520.91 - inputSize = 0;
520.92 - highHalfZoneCode = 0;
520.93 - }
520.94 -
520.95 - // Is this a high surrogate?
520.96 - if (Character.isHighSurrogate(inputChar)) {
520.97 - // Is this the last character of the input?
520.98 - if (charOff + inputSize >= inEnd) {
520.99 - highHalfZoneCode = inputChar;
520.100 - charOff += inputSize;
520.101 - break;
520.102 - }
520.103 -
520.104 - // Is there a low surrogate following?
520.105 - inputChar = input[charOff + inputSize];
520.106 - if (Character.isLowSurrogate(inputChar)) {
520.107 - // We have a valid surrogate pair. Too bad we don't do
520.108 - // surrogates. Is substitution enabled?
520.109 - if (subMode) {
520.110 - if (subBytes.length == 1) {
520.111 - outputByte[0] = 0x00;
520.112 - outputByte[1] = subBytes[0];
520.113 - }
520.114 - else {
520.115 - outputByte[0] = subBytes[0];
520.116 - outputByte[1] = subBytes[1];
520.117 - }
520.118 - inputSize++;
520.119 - } else {
520.120 - badInputLength = 2;
520.121 - throw new UnknownCharacterException();
520.122 - }
520.123 - } else {
520.124 - // We have a malformed surrogate pair
520.125 - badInputLength = 1;
520.126 - throw new MalformedInputException();
520.127 - }
520.128 - }
520.129 - // Is this an unaccompanied low surrogate?
520.130 - else if (Character.isLowSurrogate(inputChar)) {
520.131 - badInputLength = 1;
520.132 - throw new MalformedInputException();
520.133 - } else {
520.134 -
520.135 - // We have a valid character, get the bytes for it
520.136 - theBytes = encodeChar(inputChar);
520.137 - if (theBytes == UNMAPPABLE_ENCODING) {
520.138 - // if there was no mapping - look for substitution characters
520.139 - if (subMode) {
520.140 - if (subBytes.length == 1) {
520.141 - outputByte[0] = 0x00;
520.142 - outputByte[1] = subBytes[0];
520.143 - } else {
520.144 - outputByte[0] = subBytes[0];
520.145 - outputByte[1] = subBytes[1];
520.146 - }
520.147 - } else {
520.148 - badInputLength = 1;
520.149 - throw new UnknownCharacterException();
520.150 - }
520.151 - } else {
520.152 - outputByte[0] = (byte)(theBytes >>8);
520.153 - outputByte[1] = (byte)theBytes;
520.154 - }
520.155 - }
520.156 - if (outputByte[0] == 0x00)
520.157 - spaceNeeded = 1;
520.158 - else
520.159 - spaceNeeded = 2;
520.160 -
520.161 - if (byteOff + spaceNeeded > outEnd)
520.162 - throw new ConversionBufferFullException();
520.163 -
520.164 - if (spaceNeeded == 1)
520.165 - output[byteOff++] = outputByte[1];
520.166 - else {
520.167 - output[byteOff++] = outputByte[0];
520.168 - output[byteOff++] = outputByte[1];
520.169 - }
520.170 -
520.171 - charOff += inputSize;
520.172 - }
520.173 - return byteOff - outOff;
520.174 - }
520.175 -
520.176 - /**
520.177 - * Resets converter to its initial state.
520.178 - */
520.179 - public void reset() {
520.180 - charOff = byteOff = 0;
520.181 - highHalfZoneCode = 0;
520.182 - }
520.183 -
520.184 - /**
520.185 - * Returns the maximum number of bytes needed to convert a char.
520.186 - */
520.187 - public int getMaxBytesPerChar() {
520.188 - return 2;
520.189 - }
520.190 -
520.191 - /**
520.192 - * Returns true if the given character can be converted to the
520.193 - * target character encoding.
520.194 - */
520.195 - public boolean canConvert(char c) {
520.196 - return encodeChar(c) != UNMAPPABLE_ENCODING;
520.197 - }
520.198 -}
521.1 --- a/src/share/classes/sun/io/CharToByteDBCS_EBCDIC.java Thu Sep 01 13:54:38 2011 -0700
521.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
521.3 @@ -1,253 +0,0 @@
521.4 -/*
521.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
521.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
521.7 - *
521.8 - * This code is free software; you can redistribute it and/or modify it
521.9 - * under the terms of the GNU General Public License version 2 only, as
521.10 - * published by the Free Software Foundation. Oracle designates this
521.11 - * particular file as subject to the "Classpath" exception as provided
521.12 - * by Oracle in the LICENSE file that accompanied this code.
521.13 - *
521.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
521.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
521.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
521.17 - * version 2 for more details (a copy is included in the LICENSE file that
521.18 - * accompanied this code).
521.19 - *
521.20 - * You should have received a copy of the GNU General Public License version
521.21 - * 2 along with this work; if not, write to the Free Software Foundation,
521.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
521.23 - *
521.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
521.25 - * or visit www.oracle.com if you need additional information or have any
521.26 - * questions.
521.27 - */
521.28 -package sun.io;
521.29 -
521.30 -import sun.nio.cs.ext.DoubleByte;
521.31 -import static sun.nio.cs.CharsetMapping.*;
521.32 -
521.33 -public abstract class CharToByteDBCS_EBCDIC extends CharToByteConverter
521.34 -{
521.35 - private static final int SBCS = 0;
521.36 - private static final int DBCS = 1;
521.37 -
521.38 - private static final byte SO = 0x0e;
521.39 - private static final byte SI = 0x0f;
521.40 -
521.41 - private int currentState;
521.42 - private char highHalfZoneCode;
521.43 - private byte[] outputByte = new byte[2];
521.44 -
521.45 - private DoubleByte.Encoder enc;
521.46 -
521.47 - public CharToByteDBCS_EBCDIC(DoubleByte.Encoder enc) {
521.48 - super();
521.49 - highHalfZoneCode = 0;
521.50 - currentState = SBCS;
521.51 - this.enc = enc;
521.52 - }
521.53 -
521.54 - int encodeChar(char c) {
521.55 - return enc.encodeChar(c);
521.56 - }
521.57 -
521.58 - /**
521.59 - * flush out any residual data and reset the buffer state
521.60 - */
521.61 - public int flush(byte [] output, int outStart, int outEnd)
521.62 - throws MalformedInputException, ConversionBufferFullException
521.63 - {
521.64 - int bytesOut = 0;
521.65 -
521.66 - if (highHalfZoneCode != 0) {
521.67 - reset();
521.68 - badInputLength = 0;
521.69 - throw new MalformedInputException();
521.70 - }
521.71 -
521.72 - if (currentState == DBCS) {
521.73 - if (outStart >= outEnd)
521.74 - throw new ConversionBufferFullException();
521.75 - output[outStart] = SI;
521.76 - bytesOut++;
521.77 - }
521.78 -
521.79 - reset();
521.80 - return bytesOut;
521.81 - }
521.82 -
521.83 - /**
521.84 - * Character conversion
521.85 - */
521.86 - public int convert(char[] input, int inOff, int inEnd,
521.87 - byte[] output, int outOff, int outEnd)
521.88 - throws UnknownCharacterException, MalformedInputException,
521.89 - ConversionBufferFullException
521.90 - {
521.91 - char inputChar;
521.92 - int inputSize;
521.93 -
521.94 - byteOff = outOff;
521.95 - charOff = inOff;
521.96 -
521.97 - while(charOff < inEnd) {
521.98 -
521.99 - int index;
521.100 - int theBytes;
521.101 - int spaceNeeded;
521.102 -
521.103 - if (highHalfZoneCode == 0) {
521.104 - inputChar = input[charOff];
521.105 - inputSize = 1;
521.106 - } else {
521.107 - inputChar = highHalfZoneCode;
521.108 - inputSize = 0;
521.109 - highHalfZoneCode = 0;
521.110 - }
521.111 -
521.112 - // Is this a high surrogate?
521.113 - if (Character.isHighSurrogate(inputChar)) {
521.114 - // Is this the last character of the input?
521.115 - if (charOff + inputSize >= inEnd) {
521.116 - highHalfZoneCode = inputChar;
521.117 - charOff += inputSize;
521.118 - break;
521.119 - }
521.120 -
521.121 - // Is there a low surrogate following?
521.122 - inputChar = input[charOff + inputSize];
521.123 - if (Character.isLowSurrogate(inputChar)) {
521.124 - // We have a valid surrogate pair. Too bad we don't do
521.125 - // surrogates. Is substitution enabled?
521.126 - if (subMode) {
521.127 - if (subBytes.length == 1) {
521.128 - outputByte[0] = 0x00;
521.129 - outputByte[1] = subBytes[0];
521.130 - }
521.131 - else {
521.132 - outputByte[0] = subBytes[0];
521.133 - outputByte[1] = subBytes[1];
521.134 - }
521.135 - inputSize++;
521.136 - } else {
521.137 - badInputLength = 2;
521.138 - throw new UnknownCharacterException();
521.139 - }
521.140 - } else {
521.141 - // We have a malformed surrogate pair
521.142 - badInputLength = 1;
521.143 - throw new MalformedInputException();
521.144 - }
521.145 - }
521.146 - // Is this an unaccompanied low surrogate?
521.147 - else if (Character.isLowSurrogate(inputChar)) {
521.148 - badInputLength = 1;
521.149 - throw new MalformedInputException();
521.150 - } else {
521.151 -
521.152 - // We have a valid character, get the bytes for it
521.153 - theBytes = encodeChar(inputChar);
521.154 - if (theBytes == UNMAPPABLE_ENCODING) {
521.155 - // if there was no mapping - look for substitution characters
521.156 - if (subMode) {
521.157 - if (subBytes.length == 1) {
521.158 - outputByte[0] = 0x00;
521.159 - outputByte[1] = subBytes[0];
521.160 - } else {
521.161 - outputByte[0] = subBytes[0];
521.162 - outputByte[1] = subBytes[1];
521.163 - }
521.164 - } else {
521.165 - badInputLength = 1;
521.166 - throw new UnknownCharacterException();
521.167 - }
521.168 - } else {
521.169 - outputByte[0] = (byte)((theBytes & 0x0000ff00)>>8);
521.170 - outputByte[1] = (byte)(theBytes & 0x000000ff);
521.171 - }
521.172 - }
521.173 -
521.174 - //Set the output buffer into the correct state
521.175 -
521.176 - if (currentState == DBCS && outputByte[0] == 0x00) {
521.177 - if (byteOff >= outEnd)
521.178 - throw new ConversionBufferFullException();
521.179 - currentState = SBCS;
521.180 - output[byteOff++] = SI;
521.181 - } else
521.182 - if (currentState == SBCS && outputByte[0] != 0x00) {
521.183 - if (byteOff >= outEnd) {
521.184 - throw new ConversionBufferFullException();
521.185 - }
521.186 - currentState = DBCS;
521.187 - output[byteOff++] = SO;
521.188 - }
521.189 -
521.190 - if (currentState == DBCS)
521.191 - spaceNeeded = 2;
521.192 - else
521.193 - spaceNeeded = 1;
521.194 -
521.195 - if (byteOff + spaceNeeded > outEnd) {
521.196 - throw new ConversionBufferFullException();
521.197 - }
521.198 -
521.199 - if (currentState == SBCS)
521.200 - output[byteOff++] = outputByte[1];
521.201 - else {
521.202 - output[byteOff++] = outputByte[0];
521.203 - output[byteOff++] = outputByte[1];
521.204 - }
521.205 -
521.206 - charOff += inputSize;
521.207 - }
521.208 - return byteOff - outOff;
521.209 - }
521.210 -
521.211 -
521.212 -
521.213 - /**
521.214 - * Resets converter to its initial state.
521.215 - */
521.216 - public void reset() {
521.217 - charOff = byteOff = 0;
521.218 - highHalfZoneCode = 0;
521.219 - currentState = SBCS;
521.220 - }
521.221 -
521.222 -
521.223 - /**
521.224 - * Returns the maximum number of bytes needed to convert a char.
521.225 - */
521.226 - public int getMaxBytesPerChar() {
521.227 - return 4; //Fixed with bug 4199599 so tests would pass.
521.228 - }
521.229 -
521.230 -
521.231 - /**
521.232 - * Sets the substitution bytes to use when the converter is in
521.233 - * substitution mode. The given bytes should represent a valid
521.234 - * character in the target character encoding.
521.235 - */
521.236 -
521.237 - public void setSubstitutionBytes( byte[] newSubBytes )
521.238 - throws IllegalArgumentException
521.239 - {
521.240 - if( newSubBytes.length > 2 || newSubBytes.length == 0) {
521.241 - throw new IllegalArgumentException();
521.242 - }
521.243 -
521.244 - subBytes = new byte[ newSubBytes.length ];
521.245 - System.arraycopy( newSubBytes, 0, subBytes, 0, newSubBytes.length );
521.246 -
521.247 - }
521.248 -
521.249 - /**
521.250 - * Returns true if the given character can be converted to the
521.251 - * target character encoding.
521.252 - */
521.253 - public boolean canConvert(char c) {
521.254 - return encodeChar(c) != UNMAPPABLE_ENCODING;
521.255 - }
521.256 -}
522.1 --- a/src/share/classes/sun/io/CharToByteDoubleByte.java Thu Sep 01 13:54:38 2011 -0700
522.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
522.3 @@ -1,232 +0,0 @@
522.4 -/*
522.5 - * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
522.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
522.7 - *
522.8 - * This code is free software; you can redistribute it and/or modify it
522.9 - * under the terms of the GNU General Public License version 2 only, as
522.10 - * published by the Free Software Foundation. Oracle designates this
522.11 - * particular file as subject to the "Classpath" exception as provided
522.12 - * by Oracle in the LICENSE file that accompanied this code.
522.13 - *
522.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
522.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
522.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
522.17 - * version 2 for more details (a copy is included in the LICENSE file that
522.18 - * accompanied this code).
522.19 - *
522.20 - * You should have received a copy of the GNU General Public License version
522.21 - * 2 along with this work; if not, write to the Free Software Foundation,
522.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
522.23 - *
522.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
522.25 - * or visit www.oracle.com if you need additional information or have any
522.26 - * questions.
522.27 - */
522.28 -
522.29 -package sun.io;
522.30 -
522.31 -/**
522.32 - * @author Limin Shi
522.33 - */
522.34 -
522.35 -public abstract class CharToByteDoubleByte extends CharToByteConverter {
522.36 -
522.37 - /*
522.38 - * 1st level index, provided by subclass
522.39 - */
522.40 - protected short index1[];
522.41 -
522.42 - /*
522.43 - * 2nd level index, provided by subclass
522.44 - */
522.45 - protected String index2[];
522.46 -
522.47 - protected char highHalfZoneCode;
522.48 -
522.49 - public short[] getIndex1() {
522.50 - return index1;
522.51 - }
522.52 -
522.53 - public String[] getIndex2() {
522.54 - return index2;
522.55 - }
522.56 -
522.57 - public int flush(byte[] output, int outStart, int outEnd)
522.58 - throws MalformedInputException, ConversionBufferFullException
522.59 - {
522.60 - if (highHalfZoneCode != 0) {
522.61 - highHalfZoneCode = 0;
522.62 - badInputLength = 0;
522.63 - throw new MalformedInputException();
522.64 - }
522.65 - byteOff = charOff = 0;
522.66 - return 0;
522.67 - }
522.68 -
522.69 - /**
522.70 - * Converts characters to sequences of bytes.
522.71 - * Conversions that result in Exceptions can be restarted by calling
522.72 - * convert again, with appropriately modified parameters.
522.73 - * @return the characters written to output.
522.74 - * @param input char array containing text in Unicode
522.75 - * @param inStart offset in input array
522.76 - * @param inEnd offset of last byte to be converted
522.77 - * @param output byte array to receive conversion result
522.78 - * @param outStart starting offset
522.79 - * @param outEnd offset of last byte to be written to
522.80 - * @throw UnsupportedCharacterException for any character
522.81 - * that cannot be converted to the external character set.
522.82 - */
522.83 - public int convert(char[] input, int inOff, int inEnd,
522.84 - byte[] output, int outOff, int outEnd)
522.85 - throws MalformedInputException, UnknownCharacterException,
522.86 - ConversionBufferFullException
522.87 - {
522.88 - char inputChar; // Input character to be converted
522.89 - byte[] outputByte; // Output byte written to output
522.90 - int inputSize = 0; // Size of input
522.91 - int outputSize = 0; // Size of output
522.92 - byte[] tmpbuf = new byte[2];
522.93 -
522.94 - // Record beginning offsets
522.95 - charOff = inOff;
522.96 - byteOff = outOff;
522.97 -
522.98 - if (highHalfZoneCode != 0) {
522.99 - inputChar = highHalfZoneCode;
522.100 - highHalfZoneCode = 0;
522.101 - if (input[inOff] >= 0xdc00 && input[inOff] <= 0xdfff) {
522.102 - // This is legal UTF16 sequence.
522.103 - badInputLength = 1;
522.104 - throw new UnknownCharacterException();
522.105 - } else {
522.106 - // This is illegal UTF16 sequence.
522.107 - badInputLength = 0;
522.108 - throw new MalformedInputException();
522.109 - }
522.110 - }
522.111 -
522.112 - // Loop until we hit the end of the input
522.113 - while(charOff < inEnd) {
522.114 - inputSize = 1;
522.115 - outputByte = tmpbuf;
522.116 - inputChar = input[charOff]; // Get the input character
522.117 -
522.118 - // Is this a high surrogate?
522.119 - if(inputChar >= '\uD800' && inputChar <= '\uDBFF') {
522.120 - // Is this the last character of the input?
522.121 - if (charOff + 1 >= inEnd) {
522.122 - highHalfZoneCode = inputChar;
522.123 - break;
522.124 - }
522.125 -
522.126 - // Is there a low surrogate following?
522.127 - inputChar = input[charOff + 1];
522.128 - if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
522.129 - // We have a valid surrogate pair. Too bad we don't do
522.130 - // surrogates. Is substitution enabled?
522.131 - if (subMode) {
522.132 - outputByte = subBytes;
522.133 - outputSize = subBytes.length;
522.134 - inputSize = 2;
522.135 - } else {
522.136 - badInputLength = 2;
522.137 - throw new UnknownCharacterException();
522.138 - }
522.139 - } else {
522.140 - // We have a malformed surrogate pair
522.141 - badInputLength = 1;
522.142 - throw new MalformedInputException();
522.143 - }
522.144 - }
522.145 - // Is this an unaccompanied low surrogate?
522.146 - else if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
522.147 - badInputLength = 1;
522.148 - throw new MalformedInputException();
522.149 - } else {
522.150 - outputSize = convSingleByte(inputChar, outputByte);
522.151 - if (outputSize == 0) { // DoubleByte
522.152 - int ncode = getNative(inputChar);
522.153 - if (ncode != 0 ) {
522.154 - outputByte[0] = (byte) ((ncode & 0xff00) >> 8);
522.155 - outputByte[1] = (byte) (ncode & 0xff);
522.156 - outputSize = 2;
522.157 - } else {
522.158 - if (subMode) {
522.159 - outputByte = subBytes;
522.160 - outputSize = subBytes.length;
522.161 - } else {
522.162 - badInputLength = 1;
522.163 - throw new UnknownCharacterException();
522.164 - }
522.165 - }
522.166 - }
522.167 - }
522.168 -
522.169 - // If we don't have room for the output, throw an exception
522.170 - if (byteOff + outputSize > outEnd)
522.171 - throw new ConversionBufferFullException();
522.172 -
522.173 - // Put the byte in the output buffer
522.174 - for (int i = 0; i < outputSize; i++) {
522.175 - output[byteOff++] = outputByte[i];
522.176 - }
522.177 - charOff += inputSize;
522.178 - }
522.179 - // Return the length written to the output buffer
522.180 - return byteOff - outOff;
522.181 - }
522.182 -
522.183 -
522.184 - /**
522.185 - * the maximum number of bytes needed to hold a converted char
522.186 - * @returns the maximum number of bytes needed for a converted char
522.187 - */
522.188 - public int getMaxBytesPerChar() {
522.189 - return 2;
522.190 - }
522.191 -
522.192 - /**
522.193 - * Resets the converter.
522.194 - * Call this method to reset the converter to its initial state
522.195 - */
522.196 - public void reset() {
522.197 - byteOff = charOff = 0;
522.198 - highHalfZoneCode = 0;
522.199 - }
522.200 -
522.201 - /**
522.202 - * Return whether a character is mappable or not
522.203 - * @return true if a character is mappable
522.204 - */
522.205 - public boolean canConvert(char ch) {
522.206 - byte[] outByte = new byte[2];
522.207 -
522.208 - if ((ch == (char) 0) || (convSingleByte(ch, outByte) != 0))
522.209 - return true;
522.210 - if (this.getNative(ch) != 0)
522.211 - return true;
522.212 - return false;
522.213 - }
522.214 -
522.215 -
522.216 - /*
522.217 - * Can be changed by subclass
522.218 - */
522.219 - protected int convSingleByte(char inputChar, byte[] outputByte) {
522.220 - if (inputChar < 0x80) {
522.221 - outputByte[0] = (byte)(inputChar & 0x7f);
522.222 - return 1;
522.223 - }
522.224 - return 0;
522.225 - }
522.226 -
522.227 - /*
522.228 - * Can be changed by subclass
522.229 - */
522.230 - protected int getNative(char ch) {
522.231 - int offset = index1[((ch & 0xff00) >> 8 )] << 8;
522.232 - return index2[offset >> 12].charAt((offset & 0xfff) + (ch & 0xff));
522.233 - }
522.234 -
522.235 -}
523.1 --- a/src/share/classes/sun/io/CharToByteEUC.java Thu Sep 01 13:54:38 2011 -0700
523.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
523.3 @@ -1,256 +0,0 @@
523.4 -/*
523.5 - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
523.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
523.7 - *
523.8 - * This code is free software; you can redistribute it and/or modify it
523.9 - * under the terms of the GNU General Public License version 2 only, as
523.10 - * published by the Free Software Foundation. Oracle designates this
523.11 - * particular file as subject to the "Classpath" exception as provided
523.12 - * by Oracle in the LICENSE file that accompanied this code.
523.13 - *
523.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
523.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
523.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
523.17 - * version 2 for more details (a copy is included in the LICENSE file that
523.18 - * accompanied this code).
523.19 - *
523.20 - * You should have received a copy of the GNU General Public License version
523.21 - * 2 along with this work; if not, write to the Free Software Foundation,
523.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
523.23 - *
523.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
523.25 - * or visit www.oracle.com if you need additional information or have any
523.26 - * questions.
523.27 - */
523.28 -package sun.io;
523.29 -
523.30 -public abstract class CharToByteEUC extends CharToByteConverter
523.31 -{
523.32 -
523.33 - private char highHalfZoneCode;
523.34 - private byte[] outputByte;
523.35 -
523.36 - protected short index1[];
523.37 - protected String index2;
523.38 - protected String index2a;
523.39 - protected String index2b;
523.40 - protected String index2c;
523.41 - protected int mask1;
523.42 - protected int mask2;
523.43 - protected int shift;
523.44 -
523.45 - private byte[] workByte = new byte[4];
523.46 -
523.47 - /**
523.48 - * flush out any residual data and reset the buffer state
523.49 - */
523.50 - public int flush(byte [] output, int outStart, int outEnd)
523.51 - throws MalformedInputException, ConversionBufferFullException
523.52 - {
523.53 -
523.54 - if (highHalfZoneCode != 0) {
523.55 - reset();
523.56 - badInputLength = 0;
523.57 - throw new MalformedInputException();
523.58 - }
523.59 -
523.60 - reset();
523.61 - return 0;
523.62 - }
523.63 -
523.64 - /**
523.65 - * Character conversion
523.66 - */
523.67 - public int convert(char[] input, int inOff, int inEnd,
523.68 - byte[] output, int outOff, int outEnd)
523.69 - throws UnknownCharacterException, MalformedInputException,
523.70 - ConversionBufferFullException
523.71 - {
523.72 - char inputChar;
523.73 - int inputSize;
523.74 -
523.75 - byteOff = outOff;
523.76 - charOff = inOff;
523.77 -
523.78 - while(charOff < inEnd) {
523.79 -
523.80 - outputByte = workByte;
523.81 -
523.82 - int index;
523.83 - int theBytes;
523.84 - int spaceNeeded;
523.85 - boolean allZeroes = true;
523.86 - int i;
523.87 -
523.88 -
523.89 - if (highHalfZoneCode == 0) {
523.90 - inputChar = input[charOff];
523.91 - inputSize = 1;
523.92 - } else {
523.93 - inputChar = highHalfZoneCode;
523.94 - inputSize = 0;
523.95 - highHalfZoneCode = 0;
523.96 - }
523.97 -
523.98 -
523.99 - // Is this a high surrogate?
523.100 - if(inputChar >= '\ud800' && inputChar <= '\udbff') {
523.101 - // Is this the last character of the input?
523.102 - if (charOff + inputSize >= inEnd) {
523.103 - highHalfZoneCode = inputChar;
523.104 - charOff += inputSize;
523.105 - break;
523.106 - }
523.107 -
523.108 - // Is there a low surrogate following?
523.109 - inputChar = input[charOff + inputSize];
523.110 - if (inputChar >= '\udc00' && inputChar <= '\udfff') {
523.111 -
523.112 - // We have a valid surrogate pair. Too bad we don't do
523.113 - // surrogates. Is substitution enabled?
523.114 - if (subMode) {
523.115 - outputByte = subBytes;
523.116 - inputSize++;
523.117 - } else {
523.118 - badInputLength = 2;
523.119 - throw new UnknownCharacterException();
523.120 - }
523.121 - } else {
523.122 -
523.123 - // We have a malformed surrogate pair
523.124 - badInputLength = 1;
523.125 - throw new MalformedInputException();
523.126 - }
523.127 - }
523.128 -
523.129 - // Is this an unaccompanied low surrogate?
523.130 - else
523.131 - if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
523.132 - badInputLength = 1;
523.133 - throw new MalformedInputException();
523.134 - } else {
523.135 -
523.136 - String theChars;
523.137 - char aChar;
523.138 -
523.139 - // We have a valid character, get the bytes for it
523.140 - index = index1[((inputChar & mask1) >> shift)] + (inputChar & mask2);
523.141 -
523.142 - if (index < 7500)
523.143 - theChars = index2;
523.144 - else
523.145 - if (index < 15000) {
523.146 - index = index - 7500;
523.147 - theChars = index2a;
523.148 - }
523.149 - else
523.150 - if (index < 22500){
523.151 - index = index - 15000;
523.152 - theChars = index2b;
523.153 - }
523.154 - else {
523.155 - index = index - 22500;
523.156 - theChars = index2c;
523.157 - }
523.158 -
523.159 - aChar = theChars.charAt(2*index);
523.160 - outputByte[0] = (byte)((aChar & 0xff00)>>8);
523.161 - outputByte[1] = (byte)(aChar & 0x00ff);
523.162 - aChar = theChars.charAt(2*index + 1);
523.163 - outputByte[2] = (byte)((aChar & 0xff00)>>8);
523.164 - outputByte[3] = (byte)(aChar & 0x00ff);
523.165 - }
523.166 -
523.167 - // if there was no mapping - look for substitution characters
523.168 -
523.169 - for (i = 0; i < outputByte.length; i++) {
523.170 - if (outputByte[i] != 0x00) {
523.171 - allZeroes = false;
523.172 - break;
523.173 - }
523.174 - }
523.175 -
523.176 - if (allZeroes && inputChar != '\u0000')
523.177 - {
523.178 - if (subMode) {
523.179 - outputByte = subBytes;
523.180 - } else {
523.181 - badInputLength = 1;
523.182 - throw new UnknownCharacterException();
523.183 - }
523.184 - }
523.185 -
523.186 - int oindex = 0;
523.187 - for (spaceNeeded = outputByte.length; spaceNeeded > 1; spaceNeeded--){
523.188 - if (outputByte[oindex++] != 0x00 )
523.189 - break;
523.190 - }
523.191 -
523.192 - if (byteOff + spaceNeeded > outEnd)
523.193 - throw new ConversionBufferFullException();
523.194 -
523.195 -
523.196 - for (i = outputByte.length - spaceNeeded; i < outputByte.length; i++) {
523.197 - output[byteOff++] = outputByte[i];
523.198 - }
523.199 -
523.200 - charOff += inputSize;
523.201 - }
523.202 -
523.203 - return byteOff - outOff;
523.204 - }
523.205 -
523.206 - /**
523.207 - * Resets converter to its initial state.
523.208 - */
523.209 - public void reset() {
523.210 - charOff = byteOff = 0;
523.211 - highHalfZoneCode = 0;
523.212 - }
523.213 -
523.214 - /**
523.215 - * Returns the maximum number of bytes needed to convert a char.
523.216 - */
523.217 - public int getMaxBytesPerChar() {
523.218 - return 2;
523.219 - }
523.220 -
523.221 -
523.222 - /**
523.223 - * Returns true if the given character can be converted to the
523.224 - * target character encoding.
523.225 - */
523.226 - public boolean canConvert(char ch) {
523.227 - int index;
523.228 - String theChars;
523.229 -
523.230 - index = index1[((ch & mask1) >> shift)] + (ch & mask2);
523.231 -
523.232 - if (index < 7500)
523.233 - theChars = index2;
523.234 - else
523.235 - if (index < 15000) {
523.236 - index = index - 7500;
523.237 - theChars = index2a;
523.238 - }
523.239 - else
523.240 - if (index < 22500){
523.241 - index = index - 15000;
523.242 - theChars = index2b;
523.243 - }
523.244 - else {
523.245 - index = index - 22500;
523.246 - theChars = index2c;
523.247 - }
523.248 -
523.249 - if (theChars.charAt(2*index) != '\u0000' ||
523.250 - theChars.charAt(2*index + 1) != '\u0000')
523.251 - return (true);
523.252 -
523.253 - // only return true if input char was unicode null - all others are
523.254 - // undefined
523.255 - return( ch == '\u0000');
523.256 -
523.257 - }
523.258 -
523.259 -}
524.1 --- a/src/share/classes/sun/io/CharToByteEUC_CN.java Thu Sep 01 13:54:38 2011 -0700
524.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
524.3 @@ -1,42 +0,0 @@
524.4 -/*
524.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
524.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
524.7 - *
524.8 - * This code is free software; you can redistribute it and/or modify it
524.9 - * under the terms of the GNU General Public License version 2 only, as
524.10 - * published by the Free Software Foundation. Oracle designates this
524.11 - * particular file as subject to the "Classpath" exception as provided
524.12 - * by Oracle in the LICENSE file that accompanied this code.
524.13 - *
524.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
524.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
524.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
524.17 - * version 2 for more details (a copy is included in the LICENSE file that
524.18 - * accompanied this code).
524.19 - *
524.20 - * You should have received a copy of the GNU General Public License version
524.21 - * 2 along with this work; if not, write to the Free Software Foundation,
524.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
524.23 - *
524.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
524.25 - * or visit www.oracle.com if you need additional information or have any
524.26 - * questions.
524.27 - */
524.28 -
524.29 -package sun.io;
524.30 -
524.31 -import sun.nio.cs.ext.*;
524.32 -
524.33 -public class CharToByteEUC_CN extends CharToByteDBCS_ASCII {
524.34 -
524.35 - private static DoubleByte.Encoder enc =
524.36 - (DoubleByte.Encoder)new EUC_CN().newEncoder();
524.37 -
524.38 - public String getCharacterEncoding() {
524.39 - return "EUC_CN";
524.40 - }
524.41 -
524.42 - public CharToByteEUC_CN() {
524.43 - super(enc);
524.44 - }
524.45 -}
525.1 --- a/src/share/classes/sun/io/CharToByteEUC_JP.java Thu Sep 01 13:54:38 2011 -0700
525.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
525.3 @@ -1,201 +0,0 @@
525.4 -/*
525.5 - * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
525.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
525.7 - *
525.8 - * This code is free software; you can redistribute it and/or modify it
525.9 - * under the terms of the GNU General Public License version 2 only, as
525.10 - * published by the Free Software Foundation. Oracle designates this
525.11 - * particular file as subject to the "Classpath" exception as provided
525.12 - * by Oracle in the LICENSE file that accompanied this code.
525.13 - *
525.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
525.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
525.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
525.17 - * version 2 for more details (a copy is included in the LICENSE file that
525.18 - * accompanied this code).
525.19 - *
525.20 - * You should have received a copy of the GNU General Public License version
525.21 - * 2 along with this work; if not, write to the Free Software Foundation,
525.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
525.23 - *
525.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
525.25 - * or visit www.oracle.com if you need additional information or have any
525.26 - * questions.
525.27 - */
525.28 -
525.29 -package sun.io;
525.30 -
525.31 -/**
525.32 - * @author Limin Shi
525.33 - */
525.34 -
525.35 -public class CharToByteEUC_JP extends CharToByteJIS0208 {
525.36 - CharToByteJIS0201 cbJIS0201 = new CharToByteJIS0201();
525.37 - CharToByteJIS0212 cbJIS0212 = new CharToByteJIS0212();
525.38 -
525.39 - public String getCharacterEncoding() {
525.40 - return "EUC_JP";
525.41 - }
525.42 -
525.43 - protected int convSingleByte(char inputChar, byte[] outputByte) {
525.44 - byte b;
525.45 -
525.46 - if (inputChar == 0) {
525.47 - outputByte[0] = (byte)0;
525.48 - return 1;
525.49 - }
525.50 -
525.51 - if ((b = cbJIS0201.getNative(inputChar)) == 0)
525.52 - return 0;
525.53 -
525.54 - if (b > 0 && b < 128) {
525.55 - outputByte[0] = b;
525.56 - return 1;
525.57 - }
525.58 - outputByte[0] = (byte)0x8E;
525.59 - outputByte[1] = b;
525.60 - return 2;
525.61 - }
525.62 -
525.63 - protected int getNative(char ch) {
525.64 - int offset = index1[((ch & 0xff00) >> 8 )] << 8;
525.65 - int r = index2[offset >> 12].charAt((offset & 0xfff) + (ch & 0xff));
525.66 - if (r != 0)
525.67 - return r + 0x8080;
525.68 - r = cbJIS0212.getNative(ch);
525.69 - if (r == 0)
525.70 - return r;
525.71 - return r + 0x8F8080;
525.72 - }
525.73 -
525.74 -
525.75 - /**
525.76 - * Converts characters to sequences of bytes.
525.77 - * Conversions that result in Exceptions can be restarted by calling
525.78 - * convert again, with appropriately modified parameters.
525.79 - * @return the characters written to output.
525.80 - * @param input char array containing text in Unicode
525.81 - * @param inStart offset in input array
525.82 - * @param inEnd offset of last byte to be converted
525.83 - * @param output byte array to receive conversion result
525.84 - * @param outStart starting offset
525.85 - * @param outEnd offset of last byte to be written to
525.86 - * @throw UnsupportedCharacterException for any character
525.87 - * that cannot be converted to the external character set.
525.88 - */
525.89 - public int convert(char[] input, int inOff, int inEnd,
525.90 - byte[] output, int outOff, int outEnd)
525.91 - throws MalformedInputException, UnknownCharacterException,
525.92 - ConversionBufferFullException
525.93 - {
525.94 - char inputChar; // Input character to be converted
525.95 - byte[] outputByte; // Output byte written to output
525.96 - int inputSize = 0; // Size of input
525.97 - int outputSize = 0; // Size of output
525.98 - byte[] tmpbuf = new byte[4];
525.99 -
525.100 - // Record beginning offsets
525.101 - charOff = inOff;
525.102 - byteOff = outOff;
525.103 -
525.104 - if (highHalfZoneCode != 0) {
525.105 - inputChar = highHalfZoneCode;
525.106 - highHalfZoneCode = 0;
525.107 - if (input[inOff] >= 0xdc00 && input[inOff] <= 0xdfff) {
525.108 - // This is legal UTF16 sequence.
525.109 - badInputLength = 1;
525.110 - throw new UnknownCharacterException();
525.111 - } else {
525.112 - // This is illegal UTF16 sequence.
525.113 - badInputLength = 0;
525.114 - throw new MalformedInputException();
525.115 - }
525.116 - }
525.117 -
525.118 - // Loop until we hit the end of the input
525.119 - while(charOff < inEnd) {
525.120 - inputSize = 1;
525.121 - outputByte = tmpbuf;
525.122 - inputChar = input[charOff]; // Get the input character
525.123 -
525.124 - // Is this a high surrogate?
525.125 - if(inputChar >= '\uD800' && inputChar <= '\uDBFF') {
525.126 - // Is this the last character of the input?
525.127 - if (charOff + 1 >= inEnd) {
525.128 - highHalfZoneCode = inputChar;
525.129 - break;
525.130 - }
525.131 -
525.132 - // Is there a low surrogate following?
525.133 - inputChar = input[charOff + 1];
525.134 - if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
525.135 - // We have a valid surrogate pair. Too bad we don't do
525.136 - // surrogates. Is substitution enabled?
525.137 - if (subMode) {
525.138 - outputByte = subBytes;
525.139 - outputSize = subBytes.length;
525.140 - inputSize = 2;
525.141 - } else {
525.142 - badInputLength = 2;
525.143 - throw new UnknownCharacterException();
525.144 - }
525.145 - } else {
525.146 - // We have a malformed surrogate pair
525.147 - badInputLength = 1;
525.148 - throw new MalformedInputException();
525.149 - }
525.150 - }
525.151 - // Is this an unaccompanied low surrogate?
525.152 - else if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
525.153 - badInputLength = 1;
525.154 - throw new MalformedInputException();
525.155 - } else {
525.156 - outputSize = convSingleByte(inputChar, outputByte);
525.157 - if (outputSize == 0) { // DoubleByte
525.158 - int ncode = getNative(inputChar);
525.159 - if (ncode != 0 ) {
525.160 - if ((ncode & 0xFF0000) == 0) {
525.161 - outputByte[0] = (byte) ((ncode & 0xff00) >> 8);
525.162 - outputByte[1] = (byte) (ncode & 0xff);
525.163 - outputSize = 2;
525.164 - } else {
525.165 - outputByte[0] = (byte) 0x8F;
525.166 - outputByte[1] = (byte) ((ncode & 0xff00) >> 8);
525.167 - outputByte[2] = (byte) (ncode & 0xff);
525.168 - outputSize = 3;
525.169 - }
525.170 - } else {
525.171 - if (subMode) {
525.172 - outputByte = subBytes;
525.173 - outputSize = subBytes.length;
525.174 - } else {
525.175 - badInputLength = 1;
525.176 - throw new UnknownCharacterException();
525.177 - }
525.178 - }
525.179 - }
525.180 - }
525.181 -
525.182 - // If we don't have room for the output, throw an exception
525.183 - if (byteOff + outputSize > outEnd)
525.184 - throw new ConversionBufferFullException();
525.185 -
525.186 - // Put the byte in the output buffer
525.187 - for (int i = 0; i < outputSize; i++) {
525.188 - output[byteOff++] = outputByte[i];
525.189 - }
525.190 - charOff += inputSize;
525.191 - }
525.192 - // Return the length written to the output buffer
525.193 - return byteOff - outOff;
525.194 - }
525.195 -
525.196 -
525.197 - /**
525.198 - * the maximum number of bytes needed to hold a converted char
525.199 - * @returns the maximum number of bytes needed for a converted char
525.200 - */
525.201 - public int getMaxBytesPerChar() {
525.202 - return 3;
525.203 - }
525.204 -}
526.1 --- a/src/share/classes/sun/io/CharToByteEUC_JP_LINUX.java Thu Sep 01 13:54:38 2011 -0700
526.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
526.3 @@ -1,193 +0,0 @@
526.4 -/*
526.5 - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
526.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
526.7 - *
526.8 - * This code is free software; you can redistribute it and/or modify it
526.9 - * under the terms of the GNU General Public License version 2 only, as
526.10 - * published by the Free Software Foundation. Oracle designates this
526.11 - * particular file as subject to the "Classpath" exception as provided
526.12 - * by Oracle in the LICENSE file that accompanied this code.
526.13 - *
526.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
526.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
526.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
526.17 - * version 2 for more details (a copy is included in the LICENSE file that
526.18 - * accompanied this code).
526.19 - *
526.20 - * You should have received a copy of the GNU General Public License version
526.21 - * 2 along with this work; if not, write to the Free Software Foundation,
526.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
526.23 - *
526.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
526.25 - * or visit www.oracle.com if you need additional information or have any
526.26 - * questions.
526.27 - */
526.28 -
526.29 -package sun.io;
526.30 -
526.31 -/**
526.32 - * Class for converting characters to bytes for the EUC-JP encoding in
526.33 - * linux. This converter supports the JIS0201 and the JIS0208 encoding and
526.34 - * omits support for the JIS212 encoding.
526.35 - *
526.36 - * @author Naveen Sanjeeva
526.37 - */
526.38 -
526.39 -public class CharToByteEUC_JP_LINUX extends CharToByteJIS0208 {
526.40 - CharToByteJIS0201 cbJIS0201 = new CharToByteJIS0201();
526.41 -
526.42 - public String getCharacterEncoding() {
526.43 - return "EUC_JP_LINUX";
526.44 - }
526.45 -
526.46 - protected int convSingleByte(char inputChar, byte[] outputByte) {
526.47 - byte b;
526.48 -
526.49 - if (inputChar == 0) {
526.50 - outputByte[0] = (byte)0;
526.51 - return 1;
526.52 - }
526.53 -
526.54 - if ((b = cbJIS0201.getNative(inputChar)) == 0)
526.55 - return 0;
526.56 -
526.57 - if (b > 0 && b < 128) {
526.58 - outputByte[0] = b;
526.59 - return 1;
526.60 - }
526.61 - outputByte[0] = (byte)0x8E;
526.62 - outputByte[1] = b;
526.63 - return 2;
526.64 - }
526.65 -
526.66 - protected int getNative(char ch) {
526.67 - int offset = index1[((ch & 0xff00) >> 8 )] << 8;
526.68 - int r = index2[offset >> 12].charAt((offset & 0xfff) + (ch & 0xff));
526.69 - if (r != 0)
526.70 - return r + 0x8080;
526.71 - return r;
526.72 - }
526.73 -
526.74 - /**
526.75 - * Converts characters to sequences of bytes.
526.76 - * Conversions that result in Exceptions can be restarted by calling
526.77 - * convert again, with appropriately modified parameters.
526.78 - * @return the characters written to output.
526.79 - * @param input char array containing text in Unicode
526.80 - * @param inStart offset in input array
526.81 - * @param inEnd offset of last byte to be converted
526.82 - * @param output byte array to receive conversion result
526.83 - * @param outStart starting offset
526.84 - * @param outEnd offset of last byte to be written to
526.85 - * @throw UnsupportedCharacterException for any character
526.86 - * that cannot be converted to the external character set.
526.87 - */
526.88 - public int convert(char[] input, int inOff, int inEnd,
526.89 - byte[] output, int outOff, int outEnd)
526.90 - throws MalformedInputException, UnknownCharacterException,
526.91 - ConversionBufferFullException
526.92 - {
526.93 - char inputChar; // Input character to be converted
526.94 - byte[] outputByte; // Output byte written to output
526.95 - int inputSize = 0; // Size of input
526.96 - int outputSize = 0; // Size of output
526.97 - byte[] tmpbuf = new byte[4];
526.98 -
526.99 - // Record beginning offsets
526.100 - charOff = inOff;
526.101 - byteOff = outOff;
526.102 -
526.103 - if (highHalfZoneCode != 0) {
526.104 - inputChar = highHalfZoneCode;
526.105 - highHalfZoneCode = 0;
526.106 - if (input[inOff] >= 0xdc00 && input[inOff] <= 0xdfff) {
526.107 - // This is legal UTF16 sequence.
526.108 - badInputLength = 1;
526.109 - throw new UnknownCharacterException();
526.110 - } else {
526.111 - // This is illegal UTF16 sequence.
526.112 - badInputLength = 0;
526.113 - throw new MalformedInputException();
526.114 - }
526.115 - }
526.116 -
526.117 - // Loop until we hit the end of the input
526.118 - while(charOff < inEnd) {
526.119 - inputSize = 1;
526.120 - outputByte = tmpbuf;
526.121 - inputChar = input[charOff]; // Get the input character
526.122 -
526.123 - // Is this a high surrogate?
526.124 - if(inputChar >= '\uD800' && inputChar <= '\uDBFF') {
526.125 - // Is this the last character of the input?
526.126 - if (charOff + 1 >= inEnd) {
526.127 - highHalfZoneCode = inputChar;
526.128 - break;
526.129 - }
526.130 -
526.131 - // Is there a low surrogate following?
526.132 - inputChar = input[charOff + 1];
526.133 - if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
526.134 - // We have a valid surrogate pair. Too bad we don't do
526.135 - // surrogates. Is substitution enabled?
526.136 - if (subMode) {
526.137 - outputByte = subBytes;
526.138 - outputSize = subBytes.length;
526.139 - inputSize = 2;
526.140 - } else {
526.141 - badInputLength = 2;
526.142 - throw new UnknownCharacterException();
526.143 - }
526.144 - } else {
526.145 - // We have a malformed surrogate pair
526.146 - badInputLength = 1;
526.147 - throw new MalformedInputException();
526.148 - }
526.149 - }
526.150 - // Is this an unaccompanied low surrogate?
526.151 - else if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
526.152 - badInputLength = 1;
526.153 - throw new MalformedInputException();
526.154 - } else {
526.155 - outputSize = convSingleByte(inputChar, outputByte);
526.156 - if (outputSize == 0) { // DoubleByte
526.157 - int ncode = getNative(inputChar);
526.158 - if (ncode != 0 && ((ncode & 0xFF0000) == 0)) {
526.159 - outputByte[0] = (byte) ((ncode & 0xff00) >> 8);
526.160 - outputByte[1] = (byte) (ncode & 0xff);
526.161 - outputSize = 2;
526.162 - } else {
526.163 - if (subMode) {
526.164 - outputByte = subBytes;
526.165 - outputSize = subBytes.length;
526.166 - } else {
526.167 - badInputLength = 1;
526.168 - throw new UnknownCharacterException();
526.169 - }
526.170 - }
526.171 - }
526.172 - }
526.173 -
526.174 - // If we don't have room for the output, throw an exception
526.175 - if (byteOff + outputSize > outEnd)
526.176 - throw new ConversionBufferFullException();
526.177 -
526.178 - // Put the byte in the output buffer
526.179 - for (int i = 0; i < outputSize; i++) {
526.180 - output[byteOff++] = outputByte[i];
526.181 - }
526.182 - charOff += inputSize;
526.183 - }
526.184 - // Return the length written to the output buffer
526.185 - return byteOff - outOff;
526.186 - }
526.187 -
526.188 -
526.189 - /**
526.190 - * the maximum number of bytes needed to hold a converted char
526.191 - * @returns the maximum number of bytes needed for a converted char
526.192 - */
526.193 - public int getMaxBytesPerChar() {
526.194 - return 2;
526.195 - }
526.196 -}
527.1 --- a/src/share/classes/sun/io/CharToByteEUC_JP_Solaris.java Thu Sep 01 13:54:38 2011 -0700
527.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
527.3 @@ -1,213 +0,0 @@
527.4 -/*
527.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
527.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
527.7 - *
527.8 - * This code is free software; you can redistribute it and/or modify it
527.9 - * under the terms of the GNU General Public License version 2 only, as
527.10 - * published by the Free Software Foundation. Oracle designates this
527.11 - * particular file as subject to the "Classpath" exception as provided
527.12 - * by Oracle in the LICENSE file that accompanied this code.
527.13 - *
527.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
527.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
527.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
527.17 - * version 2 for more details (a copy is included in the LICENSE file that
527.18 - * accompanied this code).
527.19 - *
527.20 - * You should have received a copy of the GNU General Public License version
527.21 - * 2 along with this work; if not, write to the Free Software Foundation,
527.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
527.23 - *
527.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
527.25 - * or visit www.oracle.com if you need additional information or have any
527.26 - * questions.
527.27 - */
527.28 -
527.29 -package sun.io;
527.30 -
527.31 -import sun.nio.cs.ext.JIS_X_0208_Solaris_Encoder;
527.32 -import sun.nio.cs.ext.JIS_X_0212_Solaris_Encoder;
527.33 -
527.34 -/**
527.35 - * @author Limin Shi
527.36 - * @author Ian Little
527.37 - *
527.38 - * EUC_JP variant converter for Solaris with vendor defined chars
527.39 - * added (4765370)
527.40 - */
527.41 -
527.42 -public class CharToByteEUC_JP_Solaris extends CharToByteEUC_JP {
527.43 - CharToByteJIS0201 cbJIS0201 = new CharToByteJIS0201();
527.44 - CharToByteJIS0212_Solaris cbJIS0212 = new CharToByteJIS0212_Solaris();
527.45 -
527.46 - short[] j0208Index1 = JIS_X_0208_Solaris_Encoder.getIndex1();
527.47 - String[] j0208Index2 = JIS_X_0208_Solaris_Encoder.getIndex2();
527.48 -
527.49 - public String getCharacterEncoding() {
527.50 - return "eucJP-open";
527.51 - }
527.52 -
527.53 - protected int convSingleByte(char inputChar, byte[] outputByte) {
527.54 - byte b;
527.55 -
527.56 - if (inputChar == 0) {
527.57 - outputByte[0] = (byte)0;
527.58 - return 1;
527.59 - }
527.60 -
527.61 - if ((b = cbJIS0201.getNative(inputChar)) == 0)
527.62 - return 0;
527.63 -
527.64 - if (b > 0 && b < 128) {
527.65 - outputByte[0] = b;
527.66 - return 1;
527.67 - }
527.68 - outputByte[0] = (byte)0x8E;
527.69 - outputByte[1] = b;
527.70 - return 2;
527.71 - }
527.72 -
527.73 - protected int getNative(char ch) {
527.74 - int r = super.getNative(ch);
527.75 - if (r != 0) {
527.76 - return r;
527.77 - } else {
527.78 - int offset = j0208Index1[((ch & 0xff00) >> 8 )] << 8;
527.79 - r = j0208Index2[offset >> 12].charAt((offset & 0xfff) + (ch & 0xff));
527.80 - if (r > 0x7500)
527.81 - return 0x8f8080 + cbJIS0212.getNative(ch);
527.82 - }
527.83 - return (r == 0)? r : r + 0x8080;
527.84 - }
527.85 -
527.86 -
527.87 - /**
527.88 - * Converts characters to sequences of bytes.
527.89 - * Conversions that result in Exceptions can be restarted by calling
527.90 - * convert again, with appropriately modified parameters.
527.91 - * @return the characters written to output.
527.92 - * @param input char array containing text in Unicode
527.93 - * @param inStart offset in input array
527.94 - * @param inEnd offset of last byte to be converted
527.95 - * @param output byte array to receive conversion result
527.96 - * @param outStart starting offset
527.97 - * @param outEnd offset of last byte to be written to
527.98 - * @throw UnsupportedCharacterException for any character
527.99 - * that cannot be converted to the external character set.
527.100 - */
527.101 - public int convert(char[] input, int inOff, int inEnd,
527.102 - byte[] output, int outOff, int outEnd)
527.103 - throws MalformedInputException, UnknownCharacterException,
527.104 - ConversionBufferFullException
527.105 - {
527.106 - char inputChar; // Input character to be converted
527.107 - byte[] outputByte; // Output byte written to output
527.108 - int inputSize = 0; // Size of input
527.109 - int outputSize = 0; // Size of output
527.110 - byte[] tmpbuf = new byte[4];
527.111 -
527.112 - // Record beginning offsets
527.113 - charOff = inOff;
527.114 - byteOff = outOff;
527.115 -
527.116 - if (highHalfZoneCode != 0) {
527.117 - inputChar = highHalfZoneCode;
527.118 - highHalfZoneCode = 0;
527.119 - if (input[inOff] >= 0xdc00 && input[inOff] <= 0xdfff) {
527.120 - // This is legal UTF16 sequence.
527.121 - badInputLength = 1;
527.122 - throw new UnknownCharacterException();
527.123 - } else {
527.124 - // This is illegal UTF16 sequence.
527.125 - badInputLength = 0;
527.126 - throw new MalformedInputException();
527.127 - }
527.128 - }
527.129 -
527.130 - // Loop until we hit the end of the input
527.131 - while(charOff < inEnd) {
527.132 - inputSize = 1;
527.133 - outputByte = tmpbuf;
527.134 - inputChar = input[charOff]; // Get the input character
527.135 -
527.136 - // Is this a high surrogate?
527.137 - if(inputChar >= '\uD800' && inputChar <= '\uDBFF') {
527.138 - // Is this the last character of the input?
527.139 - if (charOff + 1 >= inEnd) {
527.140 - highHalfZoneCode = inputChar;
527.141 - break;
527.142 - }
527.143 -
527.144 - // Is there a low surrogate following?
527.145 - inputChar = input[charOff + 1];
527.146 - if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
527.147 - // We have a valid surrogate pair. Too bad we don't do
527.148 - // surrogates. Is substitution enabled?
527.149 - if (subMode) {
527.150 - outputByte = subBytes;
527.151 - outputSize = subBytes.length;
527.152 - inputSize = 2;
527.153 - } else {
527.154 - badInputLength = 2;
527.155 - throw new UnknownCharacterException();
527.156 - }
527.157 - } else {
527.158 - // We have a malformed surrogate pair
527.159 - badInputLength = 1;
527.160 - throw new MalformedInputException();
527.161 - }
527.162 - }
527.163 - // Is this an unaccompanied low surrogate?
527.164 - else if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
527.165 - badInputLength = 1;
527.166 - throw new MalformedInputException();
527.167 - } else {
527.168 - outputSize = convSingleByte(inputChar, outputByte);
527.169 - if (outputSize == 0) { // DoubleByte
527.170 - int ncode = getNative(inputChar);
527.171 - if (ncode != 0 ) {
527.172 - if ((ncode & 0xFF0000) == 0) {
527.173 - outputByte[0] = (byte) ((ncode & 0xff00) >> 8);
527.174 - outputByte[1] = (byte) (ncode & 0xff);
527.175 - outputSize = 2;
527.176 - } else {
527.177 - outputByte[0] = (byte) 0x8F;
527.178 - outputByte[1] = (byte) ((ncode & 0xff00) >> 8);
527.179 - outputByte[2] = (byte) (ncode & 0xff);
527.180 - outputSize = 3;
527.181 - }
527.182 - } else {
527.183 - if (subMode) {
527.184 - outputByte = subBytes;
527.185 - outputSize = subBytes.length;
527.186 - } else {
527.187 - badInputLength = 1;
527.188 - throw new UnknownCharacterException();
527.189 - }
527.190 - }
527.191 - }
527.192 - }
527.193 -
527.194 - // If we don't have room for the output, throw an exception
527.195 - if (byteOff + outputSize > outEnd)
527.196 - throw new ConversionBufferFullException();
527.197 -
527.198 - // Put the byte in the output buffer
527.199 - for (int i = 0; i < outputSize; i++) {
527.200 - output[byteOff++] = outputByte[i];
527.201 - }
527.202 - charOff += inputSize;
527.203 - }
527.204 - // Return the length written to the output buffer
527.205 - return byteOff - outOff;
527.206 - }
527.207 -
527.208 -
527.209 - /**
527.210 - * the maximum number of bytes needed to hold a converted char
527.211 - * @returns the maximum number of bytes needed for a converted char
527.212 - */
527.213 - public int getMaxBytesPerChar() {
527.214 - return 3;
527.215 - }
527.216 -}
528.1 --- a/src/share/classes/sun/io/CharToByteEUC_KR.java Thu Sep 01 13:54:38 2011 -0700
528.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
528.3 @@ -1,42 +0,0 @@
528.4 -/*
528.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
528.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
528.7 - *
528.8 - * This code is free software; you can redistribute it and/or modify it
528.9 - * under the terms of the GNU General Public License version 2 only, as
528.10 - * published by the Free Software Foundation. Oracle designates this
528.11 - * particular file as subject to the "Classpath" exception as provided
528.12 - * by Oracle in the LICENSE file that accompanied this code.
528.13 - *
528.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
528.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
528.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
528.17 - * version 2 for more details (a copy is included in the LICENSE file that
528.18 - * accompanied this code).
528.19 - *
528.20 - * You should have received a copy of the GNU General Public License version
528.21 - * 2 along with this work; if not, write to the Free Software Foundation,
528.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
528.23 - *
528.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
528.25 - * or visit www.oracle.com if you need additional information or have any
528.26 - * questions.
528.27 - */
528.28 -
528.29 -package sun.io;
528.30 -
528.31 -import sun.nio.cs.ext.*;
528.32 -
528.33 -public class CharToByteEUC_KR extends CharToByteDBCS_ASCII {
528.34 -
528.35 - private static DoubleByte.Encoder enc =
528.36 - (DoubleByte.Encoder)new EUC_KR().newEncoder();
528.37 -
528.38 - public String getCharacterEncoding() {
528.39 - return "EUC_KR";
528.40 - }
528.41 -
528.42 - public CharToByteEUC_KR() {
528.43 - super(enc);
528.44 - }
528.45 -}
529.1 --- a/src/share/classes/sun/io/CharToByteEUC_TW.java Thu Sep 01 13:54:38 2011 -0700
529.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
529.3 @@ -1,112 +0,0 @@
529.4 -/*
529.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
529.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
529.7 - *
529.8 - * This code is free software; you can redistribute it and/or modify it
529.9 - * under the terms of the GNU General Public License version 2 only, as
529.10 - * published by the Free Software Foundation. Oracle designates this
529.11 - * particular file as subject to the "Classpath" exception as provided
529.12 - * by Oracle in the LICENSE file that accompanied this code.
529.13 - *
529.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
529.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
529.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
529.17 - * version 2 for more details (a copy is included in the LICENSE file that
529.18 - * accompanied this code).
529.19 - *
529.20 - * You should have received a copy of the GNU General Public License version
529.21 - * 2 along with this work; if not, write to the Free Software Foundation,
529.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
529.23 - *
529.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
529.25 - * or visit www.oracle.com if you need additional information or have any
529.26 - * questions.
529.27 - */
529.28 -
529.29 -package sun.io;
529.30 -
529.31 -import sun.nio.cs.ext.EUC_TW;
529.32 -
529.33 -/*
529.34 - * @author Limin Shi
529.35 - */
529.36 -
529.37 -public class CharToByteEUC_TW extends CharToByteConverter
529.38 -{
529.39 - private final EUC_TW.Encoder enc = (EUC_TW.Encoder)(new EUC_TW().newEncoder());
529.40 -
529.41 - public int flush(byte[] output, int outStart, int outEnd)
529.42 - throws MalformedInputException
529.43 - {
529.44 - reset();
529.45 - return 0;
529.46 - }
529.47 -
529.48 - public void reset() {
529.49 - byteOff = charOff = 0;
529.50 - }
529.51 -
529.52 - public boolean canConvert(char ch){
529.53 - return enc.canEncode(ch);
529.54 - }
529.55 -
529.56 - /**
529.57 - * Character conversion
529.58 - */
529.59 - public int convert(char[] input, int inOff, int inEnd,
529.60 - byte[] output, int outOff, int outEnd)
529.61 - throws UnknownCharacterException, MalformedInputException,
529.62 - ConversionBufferFullException
529.63 - {
529.64 - int outputSize;
529.65 - byte [] tmpbuf = new byte[4];;
529.66 - byte [] outputByte;
529.67 - byteOff = outOff;
529.68 -
529.69 - //Fixed 4122961 by bringing the charOff++ out to this
529.70 - // loop where it belongs, changing the loop from
529.71 - // while(){} to for(){}.
529.72 - for (charOff = inOff; charOff < inEnd; charOff++) {
529.73 - outputByte = tmpbuf;
529.74 - if ( input[charOff] < 0x80) { // ASCII
529.75 - outputSize = 1;
529.76 - outputByte[0] = (byte)(input[charOff] & 0x7f);
529.77 - } else {
529.78 - outputSize = enc.toEUC(input[charOff], outputByte);
529.79 - }
529.80 -
529.81 - if (outputSize == -1) {
529.82 - if (subMode) {
529.83 - outputByte = subBytes;
529.84 - outputSize = subBytes.length;
529.85 - } else {
529.86 - badInputLength = 1;
529.87 - throw new UnknownCharacterException();
529.88 - }
529.89 - }
529.90 -
529.91 - if (outEnd - byteOff < outputSize)
529.92 - throw new ConversionBufferFullException();
529.93 -
529.94 - for (int i = 0; i < outputSize; i++)
529.95 - output[byteOff++] = outputByte[i];
529.96 - }
529.97 -
529.98 - return byteOff - outOff;
529.99 -
529.100 - }
529.101 -
529.102 - /**
529.103 - * returns the maximum number of bytes needed to convert a char
529.104 - */
529.105 - public int getMaxBytesPerChar() {
529.106 - return 4;
529.107 - }
529.108 -
529.109 - /**
529.110 - * Return the character set ID
529.111 - */
529.112 - public String getCharacterEncoding() {
529.113 - return "EUC_TW";
529.114 - }
529.115 -}
530.1 --- a/src/share/classes/sun/io/CharToByteGB18030.java Thu Sep 01 13:54:38 2011 -0700
530.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
530.3 @@ -1,261 +0,0 @@
530.4 -/*
530.5 - * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
530.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
530.7 - *
530.8 - * This code is free software; you can redistribute it and/or modify it
530.9 - * under the terms of the GNU General Public License version 2 only, as
530.10 - * published by the Free Software Foundation. Oracle designates this
530.11 - * particular file as subject to the "Classpath" exception as provided
530.12 - * by Oracle in the LICENSE file that accompanied this code.
530.13 - *
530.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
530.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
530.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
530.17 - * version 2 for more details (a copy is included in the LICENSE file that
530.18 - * accompanied this code).
530.19 - *
530.20 - * You should have received a copy of the GNU General Public License version
530.21 - * 2 along with this work; if not, write to the Free Software Foundation,
530.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
530.23 - *
530.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
530.25 - * or visit www.oracle.com if you need additional information or have any
530.26 - * questions.
530.27 - */
530.28 -
530.29 -/*
530.30 - */
530.31 -
530.32 -
530.33 -package sun.io;
530.34 -import sun.nio.cs.ext.GB18030;
530.35 -
530.36 -public class CharToByteGB18030 extends CharToByteConverter
530.37 -{
530.38 -
530.39 - private char highHalfZoneCode;
530.40 - boolean flushed = true;
530.41 -
530.42 - private final static int GB18030_SINGLE_BYTE = 1;
530.43 - private final static int GB18030_DOUBLE_BYTE = 2;
530.44 - private final static int GB18030_FOUR_BYTE = 3;
530.45 - private static short[] index1;
530.46 - private static String[] index2;
530.47 - private int currentState;
530.48 -
530.49 - public CharToByteGB18030() {
530.50 - GB18030 nioCoder = new GB18030();
530.51 - currentState = GB18030_DOUBLE_BYTE;
530.52 - subBytes = new byte[1];
530.53 - subBytes[0] = (byte)'?';
530.54 - index1 = nioCoder.getEncoderIndex1();
530.55 - index2 = nioCoder.getEncoderIndex2();
530.56 - }
530.57 -
530.58 - public int flush(byte[] output, int outStart, int outEnd)
530.59 - throws MalformedInputException
530.60 - {
530.61 - if (highHalfZoneCode != 0) {
530.62 - highHalfZoneCode = 0;
530.63 - badInputLength = 0;
530.64 - throw new MalformedInputException();
530.65 - }
530.66 - reset();
530.67 - flushed = true;
530.68 - return 0;
530.69 - }
530.70 -
530.71 - public void reset() {
530.72 - byteOff = charOff = 0;
530.73 - currentState = GB18030_DOUBLE_BYTE;
530.74 - }
530.75 -
530.76 - public boolean canConvert(char c) {
530.77 - // converts all but unpaired surrogates
530.78 - // and illegal chars, U+FFFE & U+FFFF
530.79 -
530.80 - if ((c >= 0xd800 && c <=0xdfff) || (c >= 0xfffe))
530.81 - return false;
530.82 - else
530.83 - return true;
530.84 - }
530.85 -
530.86 - /**
530.87 - * Character conversion
530.88 - */
530.89 - public int convert(char[] input, int inOff, int inEnd,
530.90 - byte[] output, int outOff, int outEnd)
530.91 - throws UnknownCharacterException, MalformedInputException,
530.92 - ConversionBufferFullException
530.93 - {
530.94 - int linearDiffValue = 0;
530.95 - int hiByte = 0 , loByte = 0; // low and high order bytes
530.96 - char inputChar; // Input character to be converted
530.97 - charOff = inOff;
530.98 - byteOff = outOff;
530.99 - int inputSize; // Size of the input
530.100 - int outputSize; // Size of the output
530.101 -
530.102 - flushed = false;
530.103 -
530.104 - if (highHalfZoneCode != 0) {
530.105 - if (input[inOff] >= 0xDC00 && input[inOff] <= 0xDFFF) {
530.106 -
530.107 - // This is legal UTF16 sequence, so shunt in the high
530.108 - // surrogate for conversion by convert() loop.
530.109 -
530.110 - char[] newBuf = new char[inEnd - inOff + 1];
530.111 - newBuf[0] = highHalfZoneCode;
530.112 - System.arraycopy(input, inOff, newBuf, 1, inEnd - inOff);
530.113 - charOff -= 1;
530.114 - input = newBuf;
530.115 - inOff = 0;
530.116 - inEnd = newBuf.length;
530.117 - highHalfZoneCode = 0;
530.118 - } else {
530.119 - // This is illegal UTF16 sequence.
530.120 - badInputLength = 0;
530.121 - throw new MalformedInputException();
530.122 - }
530.123 - }
530.124 -
530.125 - // Main encode loop
530.126 -
530.127 - while (charOff < inEnd) {
530.128 - inputChar = input[charOff++];
530.129 -
530.130 - if(inputChar >= '\uD800' && inputChar <= '\uDBFF') {
530.131 - // Is this the last character of the input?
530.132 - if (charOff + 1 > inEnd) {
530.133 - highHalfZoneCode = inputChar;
530.134 - break;
530.135 - }
530.136 -
530.137 - char previousChar = inputChar;
530.138 - inputChar = input[charOff];
530.139 -
530.140 - // Is there a low surrogate following?
530.141 - if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
530.142 - inputSize = 2;
530.143 - charOff++;
530.144 - linearDiffValue = ( previousChar - 0xD800) * 0x400 +
530.145 - ( inputChar - 0xDC00) + 0x2E248;
530.146 -
530.147 - currentState = GB18030_FOUR_BYTE;
530.148 - } else {
530.149 - // We have a malformed surrogate pair
530.150 - badInputLength = 1;
530.151 - throw new MalformedInputException();
530.152 - }
530.153 - }
530.154 - // Is this an unaccompanied low surrogate?
530.155 - else if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
530.156 - badInputLength = 1;
530.157 - throw new MalformedInputException();
530.158 - }
530.159 -
530.160 - // Not part of a surrogate
530.161 - else if (inputChar >= 0x0000 && inputChar <= 0x007F) {
530.162 - if (byteOff >= outEnd) {
530.163 - throw new ConversionBufferFullException();
530.164 - }
530.165 - currentState = GB18030_SINGLE_BYTE;
530.166 - output[byteOff++] = (byte) inputChar;
530.167 - }
530.168 - else if (inputChar <= 0xA4C6 || inputChar >= 0xE000) {
530.169 - int outByteVal = getGB18030(index1, index2, inputChar);
530.170 -
530.171 - if (outByteVal == 0xFFFD ) {
530.172 - if (subMode) {
530.173 - if (byteOff >= outEnd) {
530.174 - throw new ConversionBufferFullException();
530.175 - } else {
530.176 - output[byteOff++] = subBytes[0];
530.177 - continue;
530.178 - }
530.179 - } else {
530.180 - badInputLength = 1;
530.181 - throw new UnknownCharacterException();
530.182 - }
530.183 - }
530.184 -
530.185 - hiByte = (outByteVal & 0xFF00) >> 8;
530.186 - loByte = (outByteVal & 0xFF);
530.187 -
530.188 - linearDiffValue = (hiByte - 0x20) * 256 + loByte;
530.189 -
530.190 - if (inputChar >= 0xE000 && inputChar < 0xF900)
530.191 - linearDiffValue += 0x82BD;
530.192 - else if (inputChar >= 0xF900)
530.193 - linearDiffValue += 0x93A9;
530.194 -
530.195 - if (hiByte > 0x80)
530.196 - currentState = GB18030_DOUBLE_BYTE;
530.197 - else
530.198 - currentState = GB18030_FOUR_BYTE;
530.199 - }
530.200 - else if (inputChar >= 0xA4C7 && inputChar <= 0xD7FF) {
530.201 - linearDiffValue = inputChar - 0x5543;
530.202 - currentState = GB18030_FOUR_BYTE;
530.203 - }
530.204 - else {
530.205 - badInputLength = 1;
530.206 - throw new MalformedInputException();
530.207 - }
530.208 -
530.209 - if (currentState == GB18030_SINGLE_BYTE)
530.210 - continue;
530.211 -
530.212 - if (currentState == GB18030_DOUBLE_BYTE) {
530.213 - if (byteOff + 2 > outEnd) {
530.214 - throw new ConversionBufferFullException();
530.215 - }
530.216 - output[byteOff++] = (byte)hiByte;
530.217 - output[byteOff++] = (byte)loByte;
530.218 - }
530.219 - else { // Four Byte encoding
530.220 - if (byteOff + 4 > outEnd) {
530.221 - throw new ConversionBufferFullException();
530.222 - }
530.223 -
530.224 - byte b1, b2, b3, b4;
530.225 -
530.226 - b4 = (byte)((linearDiffValue % 10) + 0x30);
530.227 - linearDiffValue /= 10;
530.228 - b3 = (byte)((linearDiffValue % 126) + 0x81);
530.229 - linearDiffValue /= 126;
530.230 - b2 = (byte)((linearDiffValue % 10) + 0x30);
530.231 - b1 = (byte)((linearDiffValue / 10) + 0x81);
530.232 - output[byteOff++] = b1;
530.233 - output[byteOff++] = b2;
530.234 - output[byteOff++] = b3;
530.235 - output[byteOff++] = b4;
530.236 - }
530.237 - }
530.238 - // Return number of bytes written to the output buffer.
530.239 - return byteOff - outOff;
530.240 - }
530.241 -
530.242 -
530.243 - /**
530.244 - * returns the maximum number of bytes needed to convert a char
530.245 - */
530.246 - public int getMaxBytesPerChar() {
530.247 - return 4;
530.248 - }
530.249 -
530.250 -
530.251 - /**
530.252 - * Return the character set ID
530.253 - */
530.254 - public String getCharacterEncoding() {
530.255 - return "GB18030";
530.256 - }
530.257 -
530.258 - private int getGB18030(short[] outerIndex, String[] innerIndex, char ch) {
530.259 - int offset = outerIndex[((ch & 0xff00) >> 8 )] << 8;
530.260 -
530.261 - return innerIndex[offset >> 12].charAt((offset & 0xfff) + (ch & 0xff));
530.262 - }
530.263 -
530.264 -}
531.1 --- a/src/share/classes/sun/io/CharToByteGBK.java Thu Sep 01 13:54:38 2011 -0700
531.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
531.3 @@ -1,43 +0,0 @@
531.4 -/*
531.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
531.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
531.7 - *
531.8 - * This code is free software; you can redistribute it and/or modify it
531.9 - * under the terms of the GNU General Public License version 2 only, as
531.10 - * published by the Free Software Foundation. Oracle designates this
531.11 - * particular file as subject to the "Classpath" exception as provided
531.12 - * by Oracle in the LICENSE file that accompanied this code.
531.13 - *
531.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
531.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
531.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
531.17 - * version 2 for more details (a copy is included in the LICENSE file that
531.18 - * accompanied this code).
531.19 - *
531.20 - * You should have received a copy of the GNU General Public License version
531.21 - * 2 along with this work; if not, write to the Free Software Foundation,
531.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
531.23 - *
531.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
531.25 - * or visit www.oracle.com if you need additional information or have any
531.26 - * questions.
531.27 - */
531.28 -
531.29 -
531.30 -package sun.io;
531.31 -
531.32 -import sun.nio.cs.ext.*;
531.33 -
531.34 -public class CharToByteGBK extends CharToByteDBCS_ASCII {
531.35 -
531.36 - private static DoubleByte.Encoder enc =
531.37 - (DoubleByte.Encoder)new GBK().newEncoder();
531.38 -
531.39 - public String getCharacterEncoding() {
531.40 - return "GBK";
531.41 - }
531.42 -
531.43 - public CharToByteGBK() {
531.44 - super(enc);
531.45 - }
531.46 -}
532.1 --- a/src/share/classes/sun/io/CharToByteISCII91.java Thu Sep 01 13:54:38 2011 -0700
532.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
532.3 @@ -1,200 +0,0 @@
532.4 -/*
532.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
532.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
532.7 - *
532.8 - * This code is free software; you can redistribute it and/or modify it
532.9 - * under the terms of the GNU General Public License version 2 only, as
532.10 - * published by the Free Software Foundation. Oracle designates this
532.11 - * particular file as subject to the "Classpath" exception as provided
532.12 - * by Oracle in the LICENSE file that accompanied this code.
532.13 - *
532.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
532.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
532.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
532.17 - * version 2 for more details (a copy is included in the LICENSE file that
532.18 - * accompanied this code).
532.19 - *
532.20 - * You should have received a copy of the GNU General Public License version
532.21 - * 2 along with this work; if not, write to the Free Software Foundation,
532.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
532.23 - *
532.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
532.25 - * or visit www.oracle.com if you need additional information or have any
532.26 - * questions.
532.27 - */
532.28 -
532.29 -package sun.io;
532.30 -
532.31 -import sun.nio.cs.ext.ISCII91;
532.32 -
532.33 -/*
532.34 - * Copyright (c) 1998 International Business Machines.
532.35 - * All Rights Reserved.
532.36 - *
532.37 - * Author : Sunanda Bera, C. Thirumalesh
532.38 - * Last Modified : 11,December,1998
532.39 - *
532.40 - * Purpose : Defines class CharToByteISCII91.
532.41 - *
532.42 - *
532.43 - * Revision History
532.44 - * ======== =======
532.45 - *
532.46 - * Date By Description
532.47 - * ---- -- -----------
532.48 - * March 29, 1999 John Raley Removed MalformedInputException; modified substitution logic
532.49 - *
532.50 - */
532.51 -
532.52 -/**
532.53 - * Converter class. Converts between ISCII91 encoding and Unicode encoding.
532.54 - * ISCII91 is the character encoding as defined in Indian Standard document
532.55 - * IS 13194:1991 ( Indian Script Code for Information Interchange ).
532.56 - *
532.57 - * @see sun.io.CharToByteConverter
532.58 - */
532.59 -
532.60 -/*
532.61 - * {jbr} I am not sure this class adheres to code converter conventions.
532.62 - * Need to investigate.
532.63 - * Might should recode as a subclass of CharToByteSingleByte.
532.64 - */
532.65 -
532.66 -public class CharToByteISCII91 extends CharToByteConverter {
532.67 -
532.68 - private static final byte NO_CHAR = (byte)255;
532.69 -
532.70 - //private final static ISCII91 nioCoder = new ISCII91();
532.71 - private final static byte[] directMapTable = ISCII91.getEncoderMappingTable();
532.72 -
532.73 - private static final char NUKTA_CHAR = '\u093c';
532.74 - private static final char HALANT_CHAR = '\u094d';
532.75 -
532.76 -
532.77 -/**
532.78 - * @return true for Devanagari and ASCII range and for the special characters
532.79 - * Zero Width Joiner and Zero Width Non-Joiner
532.80 - * @see sun.io.CharToByteConverter#canConvert
532.81 - *
532.82 - */
532.83 - public boolean canConvert(char ch) {
532.84 - //check for Devanagari range,ZWJ,ZWNJ and ASCII range.
532.85 - return ((ch >= 0x0900 && ch <= 0x097f) || (ch == 0x200d || ch == 0x200c)
532.86 - || (ch >= 0x0000 && ch <= 0x007f) );
532.87 - } //canConvert()
532.88 -/**
532.89 - * Converts both Devanagari and ASCII range of characters.
532.90 - * @see sun.io.CharToByteConverter#convert
532.91 - */
532.92 - public int convert(char[] input, int inStart, int inEnd, byte[] output, int outStart, int outEnd) throws MalformedInputException, UnknownCharacterException, ConversionBufferFullException {
532.93 -
532.94 - charOff = inStart;
532.95 - byteOff = outStart;
532.96 -
532.97 - for (;charOff < inEnd; charOff++) {
532.98 -
532.99 - char inputChar = input[charOff];
532.100 - int index = Integer.MIN_VALUE;
532.101 - boolean isSurrogatePair = false;
532.102 -
532.103 - //check if input is in ASCII RANGE
532.104 - if (inputChar >= 0x0000 && inputChar <= 0x007f) {
532.105 - if (byteOff >= outEnd) {
532.106 - throw new ConversionBufferFullException();
532.107 - }
532.108 - output[byteOff++] = (byte) inputChar;
532.109 - continue;
532.110 - }
532.111 -
532.112 - // if inputChar == ZWJ replace it with halant
532.113 - // if inputChar == ZWNJ replace it with Nukta
532.114 - if (inputChar == 0x200c) {
532.115 - inputChar = HALANT_CHAR;
532.116 - }
532.117 - else if (inputChar == 0x200d) {
532.118 - inputChar = NUKTA_CHAR;
532.119 - }
532.120 -
532.121 - if (inputChar >= 0x0900 && inputChar <= 0x097f) {
532.122 - index = ((int)(inputChar) - 0x0900)*2;
532.123 - }
532.124 -
532.125 - // If input char is a high surrogate, ensure that the following
532.126 - // char is a low surrogate. If not, throw a MalformedInputException.
532.127 - // Leave index untouched so substitution or an UnknownCharacterException
532.128 - // will result.
532.129 - else if (inputChar >= 0xd800 && inputChar <= 0xdbff) {
532.130 - if (charOff < inEnd-1) {
532.131 - char nextChar = input[charOff];
532.132 - if (nextChar >= 0xdc00 && nextChar <= 0xdfff) {
532.133 - charOff++;
532.134 - isSurrogatePair = true;
532.135 - }
532.136 - }
532.137 - if (!isSurrogatePair) {
532.138 - badInputLength = 1;
532.139 - throw new MalformedInputException();
532.140 - }
532.141 - }
532.142 - else if (inputChar >= 0xdc00 && inputChar <= 0xdfff) {
532.143 - badInputLength = 1;
532.144 - throw new MalformedInputException();
532.145 - }
532.146 -
532.147 - if (index == Integer.MIN_VALUE || directMapTable[index] == NO_CHAR) {
532.148 - if (subMode) {
532.149 - if (byteOff + subBytes.length >= outEnd) {
532.150 - throw new ConversionBufferFullException();
532.151 - }
532.152 - System.arraycopy(subBytes, 0, output, byteOff, subBytes.length);
532.153 - byteOff += subBytes.length;
532.154 - } else {
532.155 - badInputLength = isSurrogatePair? 2 : 1;
532.156 - throw new UnknownCharacterException();
532.157 - }
532.158 - }
532.159 - else {
532.160 - if(byteOff >= outEnd) {
532.161 - throw new ConversionBufferFullException();
532.162 - }
532.163 - output[byteOff++] = directMapTable[index++];
532.164 - if(directMapTable[index] != NO_CHAR) {
532.165 - if(byteOff >= outEnd) {
532.166 - throw new ConversionBufferFullException();
532.167 - }
532.168 - output[byteOff++] = directMapTable[index];
532.169 - }
532.170 - }
532.171 -
532.172 - } //end for
532.173 -
532.174 - return byteOff - outStart;
532.175 - } //end of routine convert.
532.176 -
532.177 -/**
532.178 -* @see sun.io.CharToByteConverter#flush
532.179 -*/
532.180 - public int flush( byte[] output, int outStart, int outEnd )
532.181 - throws MalformedInputException, ConversionBufferFullException {
532.182 - byteOff = charOff = 0;
532.183 - return 0;
532.184 - }//flush()
532.185 -/**
532.186 - * @return The character encoding as a String.
532.187 - */
532.188 - public String getCharacterEncoding() {
532.189 - return "ISCII91";
532.190 - }//getCharacterEncoding
532.191 -/**
532.192 - * @see sun.io.CharToByteConverter#getMaxBytesPerChar
532.193 - */
532.194 - public int getMaxBytesPerChar() {
532.195 - return 2;
532.196 - }//getMaxBytesPerChar()
532.197 -/**
532.198 - * @see sun.io.CharToByteConverter#reset
532.199 - */
532.200 - public void reset() {
532.201 - byteOff = charOff = 0;
532.202 - }
532.203 -} //end of class definition
533.1 --- a/src/share/classes/sun/io/CharToByteISO2022.java Thu Sep 01 13:54:38 2011 -0700
533.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
533.3 @@ -1,221 +0,0 @@
533.4 -/*
533.5 - * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
533.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
533.7 - *
533.8 - * This code is free software; you can redistribute it and/or modify it
533.9 - * under the terms of the GNU General Public License version 2 only, as
533.10 - * published by the Free Software Foundation. Oracle designates this
533.11 - * particular file as subject to the "Classpath" exception as provided
533.12 - * by Oracle in the LICENSE file that accompanied this code.
533.13 - *
533.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
533.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
533.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
533.17 - * version 2 for more details (a copy is included in the LICENSE file that
533.18 - * accompanied this code).
533.19 - *
533.20 - * You should have received a copy of the GNU General Public License version
533.21 - * 2 along with this work; if not, write to the Free Software Foundation,
533.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
533.23 - *
533.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
533.25 - * or visit www.oracle.com if you need additional information or have any
533.26 - * questions.
533.27 - */
533.28 -
533.29 -package sun.io;
533.30 -
533.31 -/**
533.32 -* @author Tom Zhou
533.33 -*/
533.34 -
533.35 -public abstract class CharToByteISO2022 extends CharToByteConverter
533.36 -{
533.37 - private final byte ISO_ESC = 0x1b;
533.38 - private final byte ISO_SI = 0x0f;
533.39 - private final byte ISO_SO = 0x0e;
533.40 - private final byte ISO_SS2_7 = 0x4e;
533.41 - private final byte ISO_SS3_7 = 0x4f;
533.42 - private final byte SS2 = (byte)0x8e;
533.43 - private final byte P2 = (byte)0xA2;
533.44 - private final byte P3 = (byte)0xA3;
533.45 - private final byte MSB = (byte)0x80;
533.46 -
533.47 - protected final byte maximumDesignatorLength = 4;
533.48 -
533.49 - protected String SODesignator,
533.50 - SS2Designator = null,
533.51 - SS3Designator = null;
533.52 -
533.53 - protected CharToByteConverter codeConverter;
533.54 -
533.55 - private boolean shiftout = false;
533.56 - private boolean SODesDefined = false;
533.57 - private boolean SS2DesDefined = false;
533.58 - private boolean SS3DesDefined = false;
533.59 -
533.60 - private boolean newshiftout = false;
533.61 - private boolean newSODesDefined = false;
533.62 - private boolean newSS2DesDefined = false;
533.63 - private boolean newSS3DesDefined = false;
533.64 -
533.65 - public int flush(byte[] output, int outStart, int outEnd)
533.66 - throws MalformedInputException
533.67 - {
533.68 - reset();
533.69 - return 0;
533.70 - }
533.71 -
533.72 - public void reset() {
533.73 - shiftout = false;
533.74 - SODesDefined = false;
533.75 - SS2DesDefined = false;
533.76 - SS3DesDefined = false;
533.77 - byteOff = charOff = 0;
533.78 - }
533.79 -
533.80 - public boolean canConvert(char ch)
533.81 - {
533.82 - if (ch<0x80)
533.83 - return true;
533.84 - return codeConverter.canConvert(ch);
533.85 - }
533.86 -
533.87 - private int unicodeToNative(char unicode, byte ebyte[])
533.88 - {
533.89 - int index = 0;
533.90 - byte tmpByte[];
533.91 - byte convByte[] = new byte[codeConverter.getMaxBytesPerChar()];
533.92 - char convChar[] = {unicode};
533.93 - int converted;
533.94 -
533.95 - try{
533.96 - converted = codeConverter.convert(convChar, 0, 1, convByte, 0,
533.97 - codeConverter.getMaxBytesPerChar());
533.98 - } catch(Exception e) {
533.99 - return -1;
533.100 - }
533.101 -
533.102 - if (converted == 2) {
533.103 - if (!SODesDefined) {
533.104 - newSODesDefined = true;
533.105 - ebyte[0] = ISO_ESC;
533.106 - tmpByte = SODesignator.getBytes();
533.107 - System.arraycopy(tmpByte,0,ebyte,1,tmpByte.length);
533.108 - index = tmpByte.length+1;
533.109 - }
533.110 - if (!shiftout) {
533.111 - newshiftout = true;
533.112 - ebyte[index++] = ISO_SO;
533.113 - }
533.114 - ebyte[index++] = (byte)(convByte[0]&0x7f);
533.115 - ebyte[index++] = (byte)(convByte[1]&0x7f);
533.116 - } else {
533.117 - if((convByte[0] == SS2)&&(convByte[1] == P2)) {
533.118 - if (!SS2DesDefined) {
533.119 - newSS2DesDefined = true;
533.120 - ebyte[0] = ISO_ESC;
533.121 - tmpByte = SS2Designator.getBytes();
533.122 - System.arraycopy(tmpByte,0,ebyte,1,tmpByte.length);
533.123 - index = tmpByte.length+1;
533.124 - }
533.125 - ebyte[index++] = ISO_ESC;
533.126 - ebyte[index++] = ISO_SS2_7;
533.127 - ebyte[index++] = (byte)(convByte[2]&0x7f);
533.128 - ebyte[index++] = (byte)(convByte[3]&0x7f);
533.129 - }
533.130 - if((convByte[0] == SS2)&&(convByte[1] == 0xA3))
533.131 - {
533.132 - if(!SS3DesDefined){
533.133 - newSS3DesDefined = true;
533.134 - ebyte[0] = ISO_ESC;
533.135 - tmpByte = SS3Designator.getBytes();
533.136 - System.arraycopy(tmpByte,0,ebyte,1,tmpByte.length);
533.137 - index = tmpByte.length+1;
533.138 - }
533.139 - ebyte[index++] = ISO_ESC;
533.140 - ebyte[index++] = ISO_SS3_7;
533.141 - ebyte[index++] = (byte)(convByte[2]&0x7f);
533.142 - ebyte[index++] = (byte)(convByte[3]&0x7f);
533.143 - }
533.144 - }
533.145 - return index;
533.146 - }
533.147 -
533.148 - /**
533.149 - * Character conversion
533.150 - */
533.151 - public int convert(char[] input, int inOff, int inEnd,
533.152 - byte[] output, int outOff, int outEnd)
533.153 - throws UnknownCharacterException, MalformedInputException,
533.154 - ConversionBufferFullException
533.155 - {
533.156 - int outputSize;
533.157 - byte [] tmpbuf = new byte[this.getMaxBytesPerChar()];
533.158 - byte [] outputByte;
533.159 -
533.160 - byteOff = outOff;
533.161 -
533.162 - newshiftout = shiftout;
533.163 - newSODesDefined = SODesDefined;
533.164 - newSS2DesDefined = SS2DesDefined;
533.165 - newSS3DesDefined = SS3DesDefined;
533.166 -
533.167 - //Fixed 4122961 by bringing the charOff++ out to this
533.168 - // loop where it belongs, changing the loop from
533.169 - // while(){} to for(){}.
533.170 - for (charOff = inOff; charOff < inEnd; charOff++) {
533.171 - outputByte = tmpbuf;
533.172 - if (input[charOff] < 0x80) { // ASCII
533.173 - if (shiftout){
533.174 - newshiftout = false;
533.175 - outputSize = 2;
533.176 - outputByte[0] = ISO_SI;
533.177 - outputByte[1] = (byte)(input[charOff] & 0x7f);
533.178 - } else {
533.179 - outputSize = 1;
533.180 - outputByte[0] = (byte)(input[charOff] & 0x7f);
533.181 - }
533.182 - if(input[charOff] == '\n'){
533.183 - newSODesDefined = false;
533.184 - newSS2DesDefined = false;
533.185 - newSS3DesDefined = false;
533.186 - }
533.187 - } else {
533.188 - outputSize = unicodeToNative(input[charOff], outputByte);
533.189 - }
533.190 -
533.191 - if (outputSize == -1) {
533.192 - if (subMode) {
533.193 - if(!newSODesDefined){
533.194 - newSODesDefined = !newSODesDefined;
533.195 - outputByte[0] = ISO_SO;
533.196 - outputByte[1] = (byte)'?';
533.197 - outputSize = 2;
533.198 - } else {
533.199 - outputByte = subBytes;
533.200 - outputSize = subBytes.length;
533.201 - }
533.202 - } else {
533.203 - badInputLength = 1;
533.204 - throw new UnknownCharacterException();
533.205 - }
533.206 - }
533.207 -
533.208 - if (outEnd - byteOff < outputSize)
533.209 - throw new ConversionBufferFullException();
533.210 -
533.211 - for (int i = 0; i < outputSize; i++)
533.212 - output[byteOff++] = outputByte[i];
533.213 -
533.214 - // Bug 4266772. Update statuses only when output buffer has been
533.215 - // updated. When ConversionBufferFullException() has been throwed
533.216 - // we want to keep old statuses for next call.
533.217 - shiftout = newshiftout;
533.218 - SODesDefined = newSODesDefined;
533.219 - SS2DesDefined = newSS2DesDefined;
533.220 - SS3DesDefined = newSS3DesDefined;
533.221 - }
533.222 - return byteOff - outOff;
533.223 - }
533.224 -}
534.1 --- a/src/share/classes/sun/io/CharToByteISO2022CN_CNS.java Thu Sep 01 13:54:38 2011 -0700
534.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
534.3 @@ -1,59 +0,0 @@
534.4 -/*
534.5 - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
534.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
534.7 - *
534.8 - * This code is free software; you can redistribute it and/or modify it
534.9 - * under the terms of the GNU General Public License version 2 only, as
534.10 - * published by the Free Software Foundation. Oracle designates this
534.11 - * particular file as subject to the "Classpath" exception as provided
534.12 - * by Oracle in the LICENSE file that accompanied this code.
534.13 - *
534.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
534.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
534.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
534.17 - * version 2 for more details (a copy is included in the LICENSE file that
534.18 - * accompanied this code).
534.19 - *
534.20 - * You should have received a copy of the GNU General Public License version
534.21 - * 2 along with this work; if not, write to the Free Software Foundation,
534.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
534.23 - *
534.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
534.25 - * or visit www.oracle.com if you need additional information or have any
534.26 - * questions.
534.27 - */
534.28 -
534.29 -package sun.io;
534.30 -
534.31 -/**
534.32 -* @author Tom Zhou
534.33 -*/
534.34 -
534.35 -public class CharToByteISO2022CN_CNS extends CharToByteISO2022
534.36 -{
534.37 - public CharToByteISO2022CN_CNS()
534.38 - {
534.39 - SODesignator = "$)G";
534.40 - SS2Designator = "$*H";
534.41 - SS3Designator = "$+I";
534.42 - try {
534.43 - codeConverter = CharToByteConverter.getConverter("CNS11643");
534.44 - } catch (Exception e) {};
534.45 - }
534.46 -
534.47 - /**
534.48 - * returns the maximum number of bytes needed to convert a char
534.49 - */
534.50 - public int getMaxBytesPerChar()
534.51 - {
534.52 - return maximumDesignatorLength+4;
534.53 - }
534.54 -
534.55 - /**
534.56 - * Return the character set ID
534.57 - */
534.58 - public String getCharacterEncoding()
534.59 - {
534.60 - return "ISO2022CN_CNS";
534.61 - }
534.62 -}
535.1 --- a/src/share/classes/sun/io/CharToByteISO2022CN_GB.java Thu Sep 01 13:54:38 2011 -0700
535.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
535.3 @@ -1,58 +0,0 @@
535.4 -/*
535.5 - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
535.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
535.7 - *
535.8 - * This code is free software; you can redistribute it and/or modify it
535.9 - * under the terms of the GNU General Public License version 2 only, as
535.10 - * published by the Free Software Foundation. Oracle designates this
535.11 - * particular file as subject to the "Classpath" exception as provided
535.12 - * by Oracle in the LICENSE file that accompanied this code.
535.13 - *
535.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
535.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
535.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
535.17 - * version 2 for more details (a copy is included in the LICENSE file that
535.18 - * accompanied this code).
535.19 - *
535.20 - * You should have received a copy of the GNU General Public License version
535.21 - * 2 along with this work; if not, write to the Free Software Foundation,
535.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
535.23 - *
535.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
535.25 - * or visit www.oracle.com if you need additional information or have any
535.26 - * questions.
535.27 - */
535.28 -
535.29 -package sun.io;
535.30 -
535.31 -/**
535.32 -* @author Tom Zhou
535.33 -*/
535.34 -
535.35 -public class CharToByteISO2022CN_GB extends CharToByteISO2022
535.36 -{
535.37 - public CharToByteISO2022CN_GB()
535.38 - {
535.39 - SODesignator = "$)A";
535.40 - try {
535.41 - codeConverter = CharToByteConverter.getConverter("GB2312");
535.42 - } catch (Exception e) {};
535.43 - }
535.44 -
535.45 - /**
535.46 - * returns the maximum number of bytes needed to convert a char
535.47 - */
535.48 - public int getMaxBytesPerChar()
535.49 - {
535.50 - return maximumDesignatorLength+4;
535.51 - }
535.52 -
535.53 - /**
535.54 - * Return the character set ID
535.55 - */
535.56 - public String getCharacterEncoding()
535.57 - {
535.58 - return "ISO2022CN_GB";
535.59 - }
535.60 -
535.61 -}
536.1 --- a/src/share/classes/sun/io/CharToByteISO2022JP.java Thu Sep 01 13:54:38 2011 -0700
536.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
536.3 @@ -1,319 +0,0 @@
536.4 -/*
536.5 - * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
536.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
536.7 - *
536.8 - * This code is free software; you can redistribute it and/or modify it
536.9 - * under the terms of the GNU General Public License version 2 only, as
536.10 - * published by the Free Software Foundation. Oracle designates this
536.11 - * particular file as subject to the "Classpath" exception as provided
536.12 - * by Oracle in the LICENSE file that accompanied this code.
536.13 - *
536.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
536.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
536.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
536.17 - * version 2 for more details (a copy is included in the LICENSE file that
536.18 - * accompanied this code).
536.19 - *
536.20 - * You should have received a copy of the GNU General Public License version
536.21 - * 2 along with this work; if not, write to the Free Software Foundation,
536.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
536.23 - *
536.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
536.25 - * or visit www.oracle.com if you need additional information or have any
536.26 - * questions.
536.27 - */
536.28 -
536.29 -package sun.io;
536.30 -import java.io.*;
536.31 -
536.32 -public class CharToByteISO2022JP extends CharToByteJIS0208 {
536.33 -
536.34 - private static final int ASCII = 0; // ESC ( B
536.35 - private static final int JISX0201_1976 = 1; // ESC ( J
536.36 - private static final int JISX0208_1978 = 2; // ESC $ @
536.37 - private static final int JISX0208_1983 = 3; // ESC $ B
536.38 - private static final int JISX0201_1976_KANA = 4; // ESC ( I
536.39 -
536.40 - private char highHalfZoneCode;
536.41 - private boolean flushed = true;
536.42 -
536.43 - // JIS is state full encoding, so currentMode keep the
536.44 - // current codeset
536.45 - private int currentMode = ASCII;
536.46 -
536.47 - /**
536.48 - * Bytes for substitute for unmappable input.
536.49 - */
536.50 - // XXX: Assumes subBytes are ASCII string. Need to change Escape sequence
536.51 - // for other character sets.
536.52 - protected byte[] subBytesEscape = { (byte)0x1b, (byte)0x28, (byte)0x42 }; // ESC ( B
536.53 - protected int subBytesMode = ASCII;
536.54 -
536.55 - public int flush(byte[] output, int outStart, int outEnd)
536.56 - throws MalformedInputException, ConversionBufferFullException
536.57 - {
536.58 - if (highHalfZoneCode != 0) {
536.59 - highHalfZoneCode = 0;
536.60 - badInputLength = 0;
536.61 - throw new MalformedInputException();
536.62 - }
536.63 -
536.64 - if (!flushed && (currentMode != ASCII)) {
536.65 - if (outEnd - outStart < 3) {
536.66 - throw new ConversionBufferFullException();
536.67 - }
536.68 - output[outStart] = (byte)0x1b;
536.69 - output[outStart + 1] = (byte)0x28;
536.70 - output[outStart + 2] = (byte)0x42;
536.71 - byteOff += 3;
536.72 - byteOff = charOff = 0;
536.73 - flushed = true;
536.74 - currentMode = ASCII;
536.75 - return 3;
536.76 - }
536.77 - return 0;
536.78 - }
536.79 -
536.80 - public int convert(char[] input, int inOff, int inEnd,
536.81 - byte[] output, int outOff, int outEnd)
536.82 - throws MalformedInputException, UnknownCharacterException,
536.83 - ConversionBufferFullException
536.84 -
536.85 - {
536.86 - char inputChar; // Input character to be converted
536.87 - int inputSize; // Size of the input
536.88 - int outputSize; // Size of the output
536.89 -
536.90 - // Buffer for output bytes
536.91 - byte[] tmpArray = new byte[6];
536.92 - byte[] outputByte;
536.93 -
536.94 - flushed = false;
536.95 -
536.96 - // Make copies of input and output indexes
536.97 - charOff = inOff;
536.98 - byteOff = outOff;
536.99 -
536.100 - if (highHalfZoneCode != 0) {
536.101 - inputChar = highHalfZoneCode;
536.102 - highHalfZoneCode = 0;
536.103 - if (input[inOff] >= 0xdc00 && input[inOff] <= 0xdfff) {
536.104 - // This is legal UTF16 sequence.
536.105 - badInputLength = 1;
536.106 - throw new UnknownCharacterException();
536.107 - } else {
536.108 - // This is illegal UTF16 sequence.
536.109 - badInputLength = 0;
536.110 - throw new MalformedInputException();
536.111 - }
536.112 - }
536.113 -
536.114 - // Loop until we run out of input
536.115 - while(charOff < inEnd) {
536.116 - outputByte = tmpArray;
536.117 - int newMode = currentMode; // Trace character mode changing
536.118 -
536.119 - // Get the input character
536.120 - inputChar = input[charOff];
536.121 - inputSize = 1;
536.122 - outputSize = 1;
536.123 -
536.124 - // Is this a high surrogate?
536.125 - if(inputChar >= '\uD800' && inputChar <= '\uDBFF') {
536.126 - // Is this the last character of the input?
536.127 - if (charOff + 1 >= inEnd) {
536.128 - highHalfZoneCode = inputChar;
536.129 - break;
536.130 - }
536.131 -
536.132 - // Is there a low surrogate following?
536.133 - inputChar = input[charOff + 1];
536.134 - if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
536.135 - // We have a valid surrogate pair. Too bad we don't do
536.136 - // surrogates. Is substitution enabled?
536.137 - if (subMode) {
536.138 - if (currentMode != subBytesMode) {
536.139 - System.arraycopy(subBytesEscape, 0, outputByte, 0,
536.140 - subBytesEscape.length);
536.141 - outputSize = subBytesEscape.length;
536.142 - System.arraycopy(subBytes, 0, outputByte,
536.143 - outputSize, subBytes.length);
536.144 - outputSize += subBytes.length;
536.145 - newMode = subBytesMode;
536.146 - } else {
536.147 - outputByte = subBytes;
536.148 - outputSize = subBytes.length;
536.149 - }
536.150 - inputSize = 2;
536.151 - } else {
536.152 - badInputLength = 2;
536.153 - throw new UnknownCharacterException();
536.154 - }
536.155 - } else {
536.156 - // We have a malformed surrogate pair
536.157 - badInputLength = 1;
536.158 - throw new MalformedInputException();
536.159 - }
536.160 - }
536.161 -
536.162 - // Is this an unaccompanied low surrogate?
536.163 - else if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
536.164 - badInputLength = 1;
536.165 - throw new MalformedInputException();
536.166 - } else {
536.167 - // Not part of a surrogate
536.168 -
536.169 - // Does this map to the Roman range?
536.170 - if (inputChar <= '\u007F') {
536.171 - if (currentMode != ASCII) {
536.172 - outputByte[0] = (byte)0x1b;
536.173 - outputByte[1] = (byte)0x28;
536.174 - outputByte[2] = (byte)0x42;
536.175 - outputByte[3] = (byte)inputChar;
536.176 - outputSize = 4;
536.177 - newMode = ASCII;
536.178 - } else {
536.179 - outputByte[0] = (byte)inputChar;
536.180 - outputSize = 1;
536.181 - }
536.182 - }
536.183 - // Is it a single byte kana?
536.184 - else if (inputChar >= 0xFF61 && inputChar <= 0xFF9F) {
536.185 - if (currentMode != JISX0201_1976_KANA) {
536.186 - outputByte[0] = (byte)0x1b;
536.187 - outputByte[1] = (byte)0x28;
536.188 - outputByte[2] = (byte)0x49;
536.189 - outputByte[3] = (byte)(inputChar - 0xff40);
536.190 - outputSize = 4;
536.191 - newMode = JISX0201_1976_KANA;
536.192 - } else {
536.193 - outputByte[0] = (byte)(inputChar - 0xff40);
536.194 - outputSize = 1;
536.195 - }
536.196 - }
536.197 - // Is it a yen sign?
536.198 - else if (inputChar == '\u00A5') {
536.199 - if (currentMode != JISX0201_1976) {
536.200 - outputByte[0] = (byte)0x1b;
536.201 - outputByte[1] = (byte)0x28;
536.202 - outputByte[2] = (byte)0x4a;
536.203 - outputByte[3] = (byte)0x5c;
536.204 - outputSize = 4;
536.205 - newMode = JISX0201_1976;
536.206 - } else {
536.207 - outputByte[0] = (byte)0x5C;
536.208 - outputSize = 1;
536.209 - }
536.210 - }
536.211 - // Is it a tilde?
536.212 - else if (inputChar == '\u203E')
536.213 - {
536.214 - if (currentMode != JISX0201_1976) {
536.215 - outputByte[0] = (byte)0x1b;
536.216 - outputByte[1] = (byte)0x28;
536.217 - outputByte[2] = (byte)0x4a;
536.218 - outputByte[3] = (byte)0x7e;
536.219 - outputSize = 4;
536.220 - newMode = JISX0201_1976;
536.221 - } else {
536.222 - outputByte[0] = (byte)0x7e;
536.223 - outputSize = 1;
536.224 - }
536.225 - }
536.226 - // Is it a JIS-X-0208 character?
536.227 - else {
536.228 - int index = getNative(inputChar);
536.229 - if (index != 0) {
536.230 - if (currentMode != JISX0208_1983) {
536.231 - outputByte[0] = (byte)0x1b;
536.232 - outputByte[1] = (byte)0x24;
536.233 - outputByte[2] = (byte)0x42;
536.234 - outputByte[3] = (byte)(index >> 8);
536.235 - outputByte[4] = (byte)(index & 0xff);
536.236 - outputSize = 5;
536.237 - newMode = JISX0208_1983;
536.238 - } else {
536.239 - outputByte[0] = (byte)(index >> 8);
536.240 - outputByte[1] = (byte)(index & 0xff);
536.241 - outputSize = 2;
536.242 - }
536.243 - }
536.244 - // It doesn't map to JIS-0208!
536.245 - else {
536.246 - if (subMode) {
536.247 - if (currentMode != subBytesMode) {
536.248 - System.arraycopy(subBytesEscape, 0, outputByte, 0,
536.249 - subBytesEscape.length);
536.250 - outputSize = subBytesEscape.length;
536.251 - System.arraycopy(subBytes, 0, outputByte,
536.252 - outputSize, subBytes.length);
536.253 - outputSize += subBytes.length;
536.254 - newMode = subBytesMode;
536.255 - } else {
536.256 - outputByte = subBytes;
536.257 - outputSize = subBytes.length;
536.258 - }
536.259 - } else {
536.260 - badInputLength = 1;
536.261 - throw new UnknownCharacterException();
536.262 - }
536.263 - }
536.264 - }
536.265 - }
536.266 -
536.267 - // Is there room in the output buffer?
536.268 - // XXX: The code assumes output buffer can hold at least 5 bytes,
536.269 - // in this coverter case. However, there is no way for apps to
536.270 - // see how many bytes will be necessary for next call.
536.271 - // getMaxBytesPerChar() should be overriden in every subclass of
536.272 - // CharToByteConverter and reflect real value (5 for this).
536.273 - if (byteOff + outputSize > outEnd)
536.274 - throw new ConversionBufferFullException();
536.275 -
536.276 - // Put the output into the buffer
536.277 - for ( int i = 0 ; i < outputSize ; i++ )
536.278 - output[byteOff++] = outputByte[i];
536.279 -
536.280 - // Advance the input pointer
536.281 - charOff += inputSize;
536.282 -
536.283 - // We can successfuly output the characters, changes
536.284 - // current mode. Fix for 4251646.
536.285 - currentMode = newMode;
536.286 - }
536.287 -
536.288 - // return mode ASCII at the end
536.289 - if (currentMode != ASCII){
536.290 - if (byteOff + 3 > outEnd)
536.291 - throw new ConversionBufferFullException();
536.292 -
536.293 - output[byteOff++] = 0x1b;
536.294 - output[byteOff++] = 0x28;
536.295 - output[byteOff++] = 0x42;
536.296 - currentMode = ASCII;
536.297 - }
536.298 -
536.299 - // Return the length written to the output buffer
536.300 - return byteOff-outOff;
536.301 - }
536.302 -
536.303 - // Reset
536.304 - public void reset() {
536.305 - highHalfZoneCode = 0;
536.306 - byteOff = charOff = 0;
536.307 - currentMode = ASCII;
536.308 - }
536.309 -
536.310 - /**
536.311 - * returns the maximum number of bytes needed to convert a char
536.312 - */
536.313 - public int getMaxBytesPerChar() {
536.314 - return 8;
536.315 - }
536.316 -
536.317 - // Return the character set ID
536.318 - public String getCharacterEncoding() {
536.319 - return "ISO2022JP";
536.320 - }
536.321 -
536.322 -}
537.1 --- a/src/share/classes/sun/io/CharToByteISO2022KR.java Thu Sep 01 13:54:38 2011 -0700
537.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
537.3 @@ -1,54 +0,0 @@
537.4 -/*
537.5 - * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
537.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
537.7 - *
537.8 - * This code is free software; you can redistribute it and/or modify it
537.9 - * under the terms of the GNU General Public License version 2 only, as
537.10 - * published by the Free Software Foundation. Oracle designates this
537.11 - * particular file as subject to the "Classpath" exception as provided
537.12 - * by Oracle in the LICENSE file that accompanied this code.
537.13 - *
537.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
537.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
537.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
537.17 - * version 2 for more details (a copy is included in the LICENSE file that
537.18 - * accompanied this code).
537.19 - *
537.20 - * You should have received a copy of the GNU General Public License version
537.21 - * 2 along with this work; if not, write to the Free Software Foundation,
537.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
537.23 - *
537.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
537.25 - * or visit www.oracle.com if you need additional information or have any
537.26 - * questions.
537.27 - */
537.28 -
537.29 -package sun.io;
537.30 -
537.31 -public class CharToByteISO2022KR extends CharToByteISO2022
537.32 -{
537.33 - public CharToByteISO2022KR()
537.34 - {
537.35 - SODesignator = "$)C";
537.36 - try {
537.37 - codeConverter = CharToByteConverter.getConverter("KSC5601");
537.38 - } catch (Exception e) {};
537.39 - }
537.40 -
537.41 - /**
537.42 - * returns the maximum number of bytes needed to convert a char
537.43 - */
537.44 - public int getMaxBytesPerChar()
537.45 - {
537.46 - return maximumDesignatorLength+4;
537.47 - }
537.48 -
537.49 - /**
537.50 - * Return the character set ID
537.51 - */
537.52 - public String getCharacterEncoding()
537.53 - {
537.54 - return "ISO2022KR";
537.55 - }
537.56 -
537.57 -}
538.1 --- a/src/share/classes/sun/io/CharToByteISO8859_1.java Thu Sep 01 13:54:38 2011 -0700
538.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
538.3 @@ -1,195 +0,0 @@
538.4 -/*
538.5 - * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
538.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
538.7 - *
538.8 - * This code is free software; you can redistribute it and/or modify it
538.9 - * under the terms of the GNU General Public License version 2 only, as
538.10 - * published by the Free Software Foundation. Oracle designates this
538.11 - * particular file as subject to the "Classpath" exception as provided
538.12 - * by Oracle in the LICENSE file that accompanied this code.
538.13 - *
538.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
538.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
538.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
538.17 - * version 2 for more details (a copy is included in the LICENSE file that
538.18 - * accompanied this code).
538.19 - *
538.20 - * You should have received a copy of the GNU General Public License version
538.21 - * 2 along with this work; if not, write to the Free Software Foundation,
538.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
538.23 - *
538.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
538.25 - * or visit www.oracle.com if you need additional information or have any
538.26 - * questions.
538.27 - */
538.28 -package sun.io;
538.29 -
538.30 -public class CharToByteISO8859_1 extends CharToByteConverter {
538.31 -
538.32 - // Return the character set ID
538.33 - public String getCharacterEncoding()
538.34 - {
538.35 - return "ISO8859_1";
538.36 - }
538.37 -
538.38 - private char highHalfZoneCode;
538.39 -
538.40 - public int flush(byte[] output, int outStart, int outEnd)
538.41 - throws MalformedInputException
538.42 - {
538.43 - if (highHalfZoneCode != 0) {
538.44 - highHalfZoneCode = 0;
538.45 - throw new MalformedInputException
538.46 - ("String ends with <High Half Zone code> of UTF16");
538.47 - }
538.48 - byteOff = charOff = 0;
538.49 - return 0;
538.50 - }
538.51 -
538.52 - /*
538.53 - * Character conversion
538.54 - */
538.55 - public int convert(char[] input, int inOff, int inEnd,
538.56 - byte[] output, int outOff, int outEnd)
538.57 - throws MalformedInputException,
538.58 - UnknownCharacterException,
538.59 - ConversionBufferFullException
538.60 -
538.61 - {
538.62 -
538.63 - char inputChar; // Input character to be converted
538.64 - byte[] outputByte; // Output byte written to output
538.65 - byte[] tmpArray = new byte[1];
538.66 - int inputSize; // Size of input
538.67 - int outputSize; // Size of output
538.68 -
538.69 - // Record beginning offsets
538.70 - charOff = inOff;
538.71 - byteOff = outOff;
538.72 -
538.73 - if (highHalfZoneCode != 0) {
538.74 - inputChar = highHalfZoneCode;
538.75 - highHalfZoneCode = 0;
538.76 - if (input[inOff] >= 0xdc00 && input[inOff] <= 0xdfff) {
538.77 - // This is legal UTF16 sequence.
538.78 - if (subMode) {
538.79 - outputSize = subBytes.length;
538.80 - if (byteOff + outputSize > outEnd)
538.81 - throw new ConversionBufferFullException();
538.82 - for(int i = 0; i < outputSize; i++)
538.83 - output[byteOff++] = subBytes[i];
538.84 - charOff += 1;
538.85 - } else {
538.86 - badInputLength = 1;
538.87 - throw new UnknownCharacterException();
538.88 - }
538.89 - } else {
538.90 - // This is illegal UTF16 sequence.
538.91 - badInputLength = 0;
538.92 - throw new MalformedInputException
538.93 - ("Previous converted string ends with " +
538.94 - "<High Half Zone Code> of UTF16 " +
538.95 - ", but this string is not begin with <Low Half Zone>");
538.96 - }
538.97 - }
538.98 -
538.99 - // Loop until we hit the end of the input
538.100 - while(charOff < inEnd) {
538.101 - outputByte = tmpArray;
538.102 -
538.103 - // Get the input character
538.104 - inputChar = input[charOff];
538.105 -
538.106 - // default outputSize
538.107 - outputSize = 1;
538.108 -
538.109 - // Assume this is a simple character
538.110 - inputSize = 1;
538.111 -
538.112 - // Is this a high surrogate?
538.113 - if(inputChar >= '\uD800' && inputChar <= '\uDBFF') {
538.114 - // Is this the last character in the input?
538.115 - if (charOff + 1 == inEnd) {
538.116 - highHalfZoneCode = inputChar;
538.117 - break;
538.118 - }
538.119 -
538.120 - // Is there a low surrogate following?
538.121 - inputChar = input[charOff + 1];
538.122 - if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
538.123 - // We have a valid surrogate pair. Too bad we don't map
538.124 - // surrogates. Is substitution enabled?
538.125 - if (subMode) {
538.126 - outputByte = subBytes;
538.127 - outputSize = subBytes.length;
538.128 - inputSize = 2;
538.129 - } else {
538.130 - badInputLength = 2;
538.131 - throw new UnknownCharacterException();
538.132 - }
538.133 - } else {
538.134 - // We have a malformed surrogate pair
538.135 - badInputLength = 1;
538.136 - throw new MalformedInputException();
538.137 - }
538.138 - }
538.139 - // Is this an unaccompanied low surrogate?
538.140 - else if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
538.141 - badInputLength = 1;
538.142 - throw new MalformedInputException();
538.143 - }
538.144 - // Not part of a surrogate, so try to convert
538.145 - else {
538.146 - // Is this character mappable?
538.147 - if (inputChar <= '\u00FF') {
538.148 - outputByte[0] = (byte)inputChar;
538.149 - } else {
538.150 - // Is substitution enabled?
538.151 - if (subMode) {
538.152 - outputByte = subBytes;
538.153 - outputSize = subBytes.length;
538.154 - } else {
538.155 - badInputLength = 1;
538.156 - throw new UnknownCharacterException();
538.157 - }
538.158 - }
538.159 - }
538.160 -
538.161 - // If we don't have room for the output, throw an exception
538.162 - if (byteOff + outputSize > outEnd)
538.163 - throw new ConversionBufferFullException();
538.164 -
538.165 - // Put the byte in the output buffer
538.166 - for (int i = 0; i < outputSize; i++) {
538.167 - output[byteOff++] = outputByte[i];
538.168 - }
538.169 - charOff += inputSize;
538.170 - }
538.171 -
538.172 - // Return the length written to the output buffer
538.173 - return byteOff-outOff;
538.174 - }
538.175 -
538.176 - // Determine if a character is mappable or not
538.177 - public boolean canConvert(char ch)
538.178 - {
538.179 - return (ch <= '\u00FF');
538.180 - }
538.181 -
538.182 - // Reset the converter
538.183 - public void reset()
538.184 - {
538.185 - byteOff = charOff = 0;
538.186 - highHalfZoneCode = 0;
538.187 - }
538.188 -
538.189 - /**
538.190 - * returns the maximum number of bytes needed to convert a char
538.191 - */
538.192 - public int getMaxBytesPerChar()
538.193 - {
538.194 - return 1;
538.195 - }
538.196 -
538.197 -
538.198 -}
539.1 --- a/src/share/classes/sun/io/CharToByteISO8859_13.java Thu Sep 01 13:54:38 2011 -0700
539.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
539.3 @@ -1,51 +0,0 @@
539.4 -/*
539.5 - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
539.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
539.7 - *
539.8 - * This code is free software; you can redistribute it and/or modify it
539.9 - * under the terms of the GNU General Public License version 2 only, as
539.10 - * published by the Free Software Foundation. Oracle designates this
539.11 - * particular file as subject to the "Classpath" exception as provided
539.12 - * by Oracle in the LICENSE file that accompanied this code.
539.13 - *
539.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
539.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
539.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
539.17 - * version 2 for more details (a copy is included in the LICENSE file that
539.18 - * accompanied this code).
539.19 - *
539.20 - * You should have received a copy of the GNU General Public License version
539.21 - * 2 along with this work; if not, write to the Free Software Foundation,
539.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
539.23 - *
539.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
539.25 - * or visit www.oracle.com if you need additional information or have any
539.26 - * questions.
539.27 - */
539.28 -
539.29 -package sun.io;
539.30 -
539.31 -import sun.nio.cs.ISO_8859_13;
539.32 -
539.33 -/**
539.34 - * Tables and data to convert Unicode to ISO8859_13
539.35 - *
539.36 - * @author ConverterGenerator tool
539.37 - */
539.38 -
539.39 -public class CharToByteISO8859_13 extends CharToByteSingleByte {
539.40 -
539.41 - private final static ISO_8859_13 nioCoder = new ISO_8859_13();
539.42 -
539.43 - public String getCharacterEncoding() {
539.44 - return "ISO8859_13";
539.45 - }
539.46 -
539.47 - public CharToByteISO8859_13() {
539.48 - super.mask1 = 0xFF00;
539.49 - super.mask2 = 0x00FF;
539.50 - super.shift = 8;
539.51 - super.index1 = nioCoder.getEncoderIndex1();
539.52 - super.index2 = nioCoder.getEncoderIndex2();
539.53 - }
539.54 -}
540.1 --- a/src/share/classes/sun/io/CharToByteISO8859_15.java Thu Sep 01 13:54:38 2011 -0700
540.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
540.3 @@ -1,56 +0,0 @@
540.4 -/*
540.5 - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
540.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
540.7 - *
540.8 - * This code is free software; you can redistribute it and/or modify it
540.9 - * under the terms of the GNU General Public License version 2 only, as
540.10 - * published by the Free Software Foundation. Oracle designates this
540.11 - * particular file as subject to the "Classpath" exception as provided
540.12 - * by Oracle in the LICENSE file that accompanied this code.
540.13 - *
540.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
540.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
540.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
540.17 - * version 2 for more details (a copy is included in the LICENSE file that
540.18 - * accompanied this code).
540.19 - *
540.20 - * You should have received a copy of the GNU General Public License version
540.21 - * 2 along with this work; if not, write to the Free Software Foundation,
540.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
540.23 - *
540.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
540.25 - * or visit www.oracle.com if you need additional information or have any
540.26 - * questions.
540.27 - */
540.28 -
540.29 -/*
540.30 - * (C) Copyright IBM Corp. 1998 - All Rights Reserved
540.31 - *
540.32 - */
540.33 -
540.34 -package sun.io;
540.35 -
540.36 -import sun.nio.cs.ISO_8859_15;
540.37 -
540.38 -/**
540.39 - * Tables and data to convert Unicode to ISO8859_15
540.40 - *
540.41 - * @author ConverterGenerator tool
540.42 - */
540.43 -
540.44 -public class CharToByteISO8859_15 extends CharToByteSingleByte {
540.45 -
540.46 - private final static ISO_8859_15 nioCoder = new ISO_8859_15();
540.47 -
540.48 - public String getCharacterEncoding() {
540.49 - return "ISO8859_15";
540.50 - }
540.51 -
540.52 - public CharToByteISO8859_15() {
540.53 - super.mask1 = 0xFF00;
540.54 - super.mask2 = 0x00FF;
540.55 - super.shift = 8;
540.56 - super.index1 = nioCoder.getEncoderIndex1();
540.57 - super.index2 = nioCoder.getEncoderIndex2();
540.58 - }
540.59 -}
541.1 --- a/src/share/classes/sun/io/CharToByteISO8859_2.java Thu Sep 01 13:54:38 2011 -0700
541.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
541.3 @@ -1,51 +0,0 @@
541.4 -/*
541.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
541.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
541.7 - *
541.8 - * This code is free software; you can redistribute it and/or modify it
541.9 - * under the terms of the GNU General Public License version 2 only, as
541.10 - * published by the Free Software Foundation. Oracle designates this
541.11 - * particular file as subject to the "Classpath" exception as provided
541.12 - * by Oracle in the LICENSE file that accompanied this code.
541.13 - *
541.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
541.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
541.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
541.17 - * version 2 for more details (a copy is included in the LICENSE file that
541.18 - * accompanied this code).
541.19 - *
541.20 - * You should have received a copy of the GNU General Public License version
541.21 - * 2 along with this work; if not, write to the Free Software Foundation,
541.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
541.23 - *
541.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
541.25 - * or visit www.oracle.com if you need additional information or have any
541.26 - * questions.
541.27 - */
541.28 -
541.29 -package sun.io;
541.30 -
541.31 -import sun.nio.cs.ISO_8859_2;
541.32 -
541.33 -/**
541.34 - * Tables and data to convert Unicode to ISO8859_2
541.35 - *
541.36 - * @author ConverterGenerator tool
541.37 - */
541.38 -
541.39 -public class CharToByteISO8859_2 extends CharToByteSingleByte {
541.40 -
541.41 - private final static ISO_8859_2 nioCoder = new ISO_8859_2();
541.42 -
541.43 - public String getCharacterEncoding() {
541.44 - return "ISO8859_2";
541.45 - }
541.46 -
541.47 - public CharToByteISO8859_2() {
541.48 - super.mask1 = 0xFF00;
541.49 - super.mask2 = 0x00FF;
541.50 - super.shift = 8;
541.51 - super.index1 = nioCoder.getEncoderIndex1();
541.52 - super.index2 = nioCoder.getEncoderIndex2();
541.53 - }
541.54 -}
542.1 --- a/src/share/classes/sun/io/CharToByteISO8859_3.java Thu Sep 01 13:54:38 2011 -0700
542.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
542.3 @@ -1,51 +0,0 @@
542.4 -/*
542.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
542.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
542.7 - *
542.8 - * This code is free software; you can redistribute it and/or modify it
542.9 - * under the terms of the GNU General Public License version 2 only, as
542.10 - * published by the Free Software Foundation. Oracle designates this
542.11 - * particular file as subject to the "Classpath" exception as provided
542.12 - * by Oracle in the LICENSE file that accompanied this code.
542.13 - *
542.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
542.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
542.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
542.17 - * version 2 for more details (a copy is included in the LICENSE file that
542.18 - * accompanied this code).
542.19 - *
542.20 - * You should have received a copy of the GNU General Public License version
542.21 - * 2 along with this work; if not, write to the Free Software Foundation,
542.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
542.23 - *
542.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
542.25 - * or visit www.oracle.com if you need additional information or have any
542.26 - * questions.
542.27 - */
542.28 -
542.29 -package sun.io;
542.30 -
542.31 -import sun.nio.cs.ext.ISO_8859_3;
542.32 -
542.33 -/**
542.34 - * Tables and data to convert Unicode to ISO8859_3
542.35 - *
542.36 - * @author ConverterGenerator tool
542.37 - */
542.38 -
542.39 -public class CharToByteISO8859_3 extends CharToByteSingleByte {
542.40 -
542.41 - private final static ISO_8859_3 nioCoder = new ISO_8859_3();
542.42 -
542.43 - public String getCharacterEncoding() {
542.44 - return "ISO8859_3";
542.45 - }
542.46 -
542.47 - public CharToByteISO8859_3() {
542.48 - super.mask1 = 0xFF00;
542.49 - super.mask2 = 0x00FF;
542.50 - super.shift = 8;
542.51 - super.index1 = nioCoder.getEncoderIndex1();
542.52 - super.index2 = nioCoder.getEncoderIndex2();
542.53 - }
542.54 -}
543.1 --- a/src/share/classes/sun/io/CharToByteISO8859_4.java Thu Sep 01 13:54:38 2011 -0700
543.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
543.3 @@ -1,51 +0,0 @@
543.4 -/*
543.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
543.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
543.7 - *
543.8 - * This code is free software; you can redistribute it and/or modify it
543.9 - * under the terms of the GNU General Public License version 2 only, as
543.10 - * published by the Free Software Foundation. Oracle designates this
543.11 - * particular file as subject to the "Classpath" exception as provided
543.12 - * by Oracle in the LICENSE file that accompanied this code.
543.13 - *
543.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
543.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
543.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
543.17 - * version 2 for more details (a copy is included in the LICENSE file that
543.18 - * accompanied this code).
543.19 - *
543.20 - * You should have received a copy of the GNU General Public License version
543.21 - * 2 along with this work; if not, write to the Free Software Foundation,
543.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
543.23 - *
543.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
543.25 - * or visit www.oracle.com if you need additional information or have any
543.26 - * questions.
543.27 - */
543.28 -
543.29 -package sun.io;
543.30 -
543.31 -import sun.nio.cs.ISO_8859_4;
543.32 -
543.33 -/**
543.34 - * Tables and data to convert Unicode to ISO8859_4
543.35 - *
543.36 - * @author ConverterGenerator tool
543.37 - */
543.38 -
543.39 -public class CharToByteISO8859_4 extends CharToByteSingleByte {
543.40 -
543.41 - private final static ISO_8859_4 nioCoder = new ISO_8859_4();
543.42 -
543.43 - public String getCharacterEncoding() {
543.44 - return "ISO8859_4";
543.45 - }
543.46 -
543.47 - public CharToByteISO8859_4() {
543.48 - super.mask1 = 0xFF00;
543.49 - super.mask2 = 0x00FF;
543.50 - super.shift = 8;
543.51 - super.index1 = nioCoder.getEncoderIndex1();
543.52 - super.index2 = nioCoder.getEncoderIndex2();
543.53 - }
543.54 -}
544.1 --- a/src/share/classes/sun/io/CharToByteISO8859_5.java Thu Sep 01 13:54:38 2011 -0700
544.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
544.3 @@ -1,51 +0,0 @@
544.4 -/*
544.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
544.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
544.7 - *
544.8 - * This code is free software; you can redistribute it and/or modify it
544.9 - * under the terms of the GNU General Public License version 2 only, as
544.10 - * published by the Free Software Foundation. Oracle designates this
544.11 - * particular file as subject to the "Classpath" exception as provided
544.12 - * by Oracle in the LICENSE file that accompanied this code.
544.13 - *
544.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
544.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
544.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
544.17 - * version 2 for more details (a copy is included in the LICENSE file that
544.18 - * accompanied this code).
544.19 - *
544.20 - * You should have received a copy of the GNU General Public License version
544.21 - * 2 along with this work; if not, write to the Free Software Foundation,
544.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
544.23 - *
544.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
544.25 - * or visit www.oracle.com if you need additional information or have any
544.26 - * questions.
544.27 - */
544.28 -
544.29 -package sun.io;
544.30 -
544.31 -import sun.nio.cs.ISO_8859_5;
544.32 -
544.33 -/**
544.34 - * Tables and data to convert Unicode to ISO8859_5
544.35 - *
544.36 - * @author ConverterGenerator tool
544.37 - */
544.38 -
544.39 -public class CharToByteISO8859_5 extends CharToByteSingleByte {
544.40 -
544.41 - private final static ISO_8859_5 nioCoder = new ISO_8859_5();
544.42 -
544.43 - public String getCharacterEncoding() {
544.44 - return "ISO8859_5";
544.45 - }
544.46 -
544.47 - public CharToByteISO8859_5() {
544.48 - super.mask1 = 0xFF00;
544.49 - super.mask2 = 0x00FF;
544.50 - super.shift = 8;
544.51 - super.index1 = nioCoder.getEncoderIndex1();
544.52 - super.index2 = nioCoder.getEncoderIndex2();
544.53 - }
544.54 -}
545.1 --- a/src/share/classes/sun/io/CharToByteISO8859_6.java Thu Sep 01 13:54:38 2011 -0700
545.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
545.3 @@ -1,52 +0,0 @@
545.4 -/*
545.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
545.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
545.7 - *
545.8 - * This code is free software; you can redistribute it and/or modify it
545.9 - * under the terms of the GNU General Public License version 2 only, as
545.10 - * published by the Free Software Foundation. Oracle designates this
545.11 - * particular file as subject to the "Classpath" exception as provided
545.12 - * by Oracle in the LICENSE file that accompanied this code.
545.13 - *
545.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
545.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
545.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
545.17 - * version 2 for more details (a copy is included in the LICENSE file that
545.18 - * accompanied this code).
545.19 - *
545.20 - * You should have received a copy of the GNU General Public License version
545.21 - * 2 along with this work; if not, write to the Free Software Foundation,
545.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
545.23 - *
545.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
545.25 - * or visit www.oracle.com if you need additional information or have any
545.26 - * questions.
545.27 - */
545.28 -
545.29 -
545.30 -package sun.io;
545.31 -
545.32 -import sun.nio.cs.ext.ISO_8859_6;
545.33 -
545.34 -/**
545.35 - * Tables and data to convert Unicode to ISO8859_6
545.36 - *
545.37 - * @author ConverterGenerator tool
545.38 - */
545.39 -
545.40 -public class CharToByteISO8859_6 extends CharToByteSingleByte {
545.41 -
545.42 - private final static ISO_8859_6 nioCoder = new ISO_8859_6();
545.43 -
545.44 - public String getCharacterEncoding() {
545.45 - return "ISO8859_6";
545.46 - }
545.47 -
545.48 - public CharToByteISO8859_6() {
545.49 - super.mask1 = 0xFF00;
545.50 - super.mask2 = 0x00FF;
545.51 - super.shift = 8;
545.52 - super.index1 = nioCoder.getEncoderIndex1();
545.53 - super.index2 = nioCoder.getEncoderIndex2();
545.54 - }
545.55 -}
546.1 --- a/src/share/classes/sun/io/CharToByteISO8859_7.java Thu Sep 01 13:54:38 2011 -0700
546.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
546.3 @@ -1,52 +0,0 @@
546.4 -/*
546.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
546.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
546.7 - *
546.8 - * This code is free software; you can redistribute it and/or modify it
546.9 - * under the terms of the GNU General Public License version 2 only, as
546.10 - * published by the Free Software Foundation. Oracle designates this
546.11 - * particular file as subject to the "Classpath" exception as provided
546.12 - * by Oracle in the LICENSE file that accompanied this code.
546.13 - *
546.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
546.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
546.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
546.17 - * version 2 for more details (a copy is included in the LICENSE file that
546.18 - * accompanied this code).
546.19 - *
546.20 - * You should have received a copy of the GNU General Public License version
546.21 - * 2 along with this work; if not, write to the Free Software Foundation,
546.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
546.23 - *
546.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
546.25 - * or visit www.oracle.com if you need additional information or have any
546.26 - * questions.
546.27 - */
546.28 -
546.29 -package sun.io;
546.30 -
546.31 -import sun.nio.cs.ISO_8859_7;
546.32 -
546.33 -
546.34 -/**
546.35 - * Tables and data to convert Unicode to ISO8859_7
546.36 - *
546.37 - * @author ConverterGenerator tool
546.38 - */
546.39 -
546.40 -public class CharToByteISO8859_7 extends CharToByteSingleByte {
546.41 -
546.42 - public String getCharacterEncoding() {
546.43 - return "ISO8859_7";
546.44 - }
546.45 -
546.46 - private final static ISO_8859_7 nioCoder = new ISO_8859_7();
546.47 -
546.48 - public CharToByteISO8859_7() {
546.49 - super.mask1 = 0xFF00;
546.50 - super.mask2 = 0x00FF;
546.51 - super.shift = 8;
546.52 - super.index1 = nioCoder.getEncoderIndex1();
546.53 - super.index2 = nioCoder.getEncoderIndex2();
546.54 - }
546.55 -}
547.1 --- a/src/share/classes/sun/io/CharToByteISO8859_8.java Thu Sep 01 13:54:38 2011 -0700
547.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
547.3 @@ -1,51 +0,0 @@
547.4 -/*
547.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
547.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
547.7 - *
547.8 - * This code is free software; you can redistribute it and/or modify it
547.9 - * under the terms of the GNU General Public License version 2 only, as
547.10 - * published by the Free Software Foundation. Oracle designates this
547.11 - * particular file as subject to the "Classpath" exception as provided
547.12 - * by Oracle in the LICENSE file that accompanied this code.
547.13 - *
547.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
547.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
547.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
547.17 - * version 2 for more details (a copy is included in the LICENSE file that
547.18 - * accompanied this code).
547.19 - *
547.20 - * You should have received a copy of the GNU General Public License version
547.21 - * 2 along with this work; if not, write to the Free Software Foundation,
547.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
547.23 - *
547.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
547.25 - * or visit www.oracle.com if you need additional information or have any
547.26 - * questions.
547.27 - */
547.28 -
547.29 -package sun.io;
547.30 -
547.31 -import sun.nio.cs.ext.ISO_8859_8;
547.32 -
547.33 -/**
547.34 - * Tables and data to convert Unicode to ISO8859_8
547.35 - *
547.36 - * @author ConverterGenerator tool
547.37 - */
547.38 -
547.39 -public class CharToByteISO8859_8 extends CharToByteSingleByte {
547.40 -
547.41 - private final static ISO_8859_8 nioCoder = new ISO_8859_8();
547.42 -
547.43 - public String getCharacterEncoding() {
547.44 - return "ISO8859_8";
547.45 - }
547.46 -
547.47 - public CharToByteISO8859_8() {
547.48 - super.mask1 = 0xFF00;
547.49 - super.mask2 = 0x00FF;
547.50 - super.shift = 8;
547.51 - super.index1 = nioCoder.getEncoderIndex1();
547.52 - super.index2 = nioCoder.getEncoderIndex2();
547.53 - }
547.54 -}
548.1 --- a/src/share/classes/sun/io/CharToByteISO8859_9.java Thu Sep 01 13:54:38 2011 -0700
548.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
548.3 @@ -1,51 +0,0 @@
548.4 -/*
548.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
548.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
548.7 - *
548.8 - * This code is free software; you can redistribute it and/or modify it
548.9 - * under the terms of the GNU General Public License version 2 only, as
548.10 - * published by the Free Software Foundation. Oracle designates this
548.11 - * particular file as subject to the "Classpath" exception as provided
548.12 - * by Oracle in the LICENSE file that accompanied this code.
548.13 - *
548.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
548.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
548.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
548.17 - * version 2 for more details (a copy is included in the LICENSE file that
548.18 - * accompanied this code).
548.19 - *
548.20 - * You should have received a copy of the GNU General Public License version
548.21 - * 2 along with this work; if not, write to the Free Software Foundation,
548.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
548.23 - *
548.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
548.25 - * or visit www.oracle.com if you need additional information or have any
548.26 - * questions.
548.27 - */
548.28 -
548.29 -package sun.io;
548.30 -
548.31 -import sun.nio.cs.ISO_8859_9;
548.32 -
548.33 -/**
548.34 - * Tables and data to convert Unicode to ISO8859_9
548.35 - *
548.36 - * @author ConverterGenerator tool
548.37 - */
548.38 -
548.39 -public class CharToByteISO8859_9 extends CharToByteSingleByte {
548.40 -
548.41 - private final static ISO_8859_9 nioCoder = new ISO_8859_9();
548.42 -
548.43 - public String getCharacterEncoding() {
548.44 - return "ISO8859_9";
548.45 - }
548.46 -
548.47 - public CharToByteISO8859_9() {
548.48 - super.mask1 = 0xFF00;
548.49 - super.mask2 = 0x00FF;
548.50 - super.shift = 8;
548.51 - super.index1 = nioCoder.getEncoderIndex1();
548.52 - super.index2 = nioCoder.getEncoderIndex2();
548.53 - }
548.54 -}
549.1 --- a/src/share/classes/sun/io/CharToByteJIS0201.java Thu Sep 01 13:54:38 2011 -0700
549.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
549.3 @@ -1,181 +0,0 @@
549.4 -/*
549.5 - * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
549.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
549.7 - *
549.8 - * This code is free software; you can redistribute it and/or modify it
549.9 - * under the terms of the GNU General Public License version 2 only, as
549.10 - * published by the Free Software Foundation. Oracle designates this
549.11 - * particular file as subject to the "Classpath" exception as provided
549.12 - * by Oracle in the LICENSE file that accompanied this code.
549.13 - *
549.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
549.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
549.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
549.17 - * version 2 for more details (a copy is included in the LICENSE file that
549.18 - * accompanied this code).
549.19 - *
549.20 - * You should have received a copy of the GNU General Public License version
549.21 - * 2 along with this work; if not, write to the Free Software Foundation,
549.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
549.23 - *
549.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
549.25 - * or visit www.oracle.com if you need additional information or have any
549.26 - * questions.
549.27 - */
549.28 -
549.29 -package sun.io;
549.30 -
549.31 -/**
549.32 - * Tables and data to convert Unicode to JIS0201
549.33 - *
549.34 - * @author ConverterGenerator tool
549.35 - * @version >= JDK1.1.6
549.36 - */
549.37 -
549.38 -class CharToByteJIS0201 extends CharToByteSingleByte {
549.39 -
549.40 - public String getCharacterEncoding() {
549.41 - return "JIS0201";
549.42 - }
549.43 -
549.44 - public CharToByteJIS0201() {
549.45 - super.mask1 = 0xFF00;
549.46 - super.mask2 = 0x00FF;
549.47 - super.shift = 8;
549.48 - /*
549.49 - super.index1 = index1;
549.50 - super.index2 = index2;
549.51 - */
549.52 - }
549.53 -
549.54 - public byte getNative(char inputChar) {
549.55 - return (byte)index2.charAt(index1[(inputChar & mask1) >> shift]
549.56 - + (inputChar & mask2));
549.57 - }
549.58 -
549.59 - public boolean canConvert(char ch) {
549.60 - if (index2.charAt(index1[((ch & mask1) >> shift)] + (ch & mask2)) != '\u0000')
549.61 - return true;
549.62 - return (ch == '\u0000');
549.63 - }
549.64 -
549.65 - private final static String index2 =
549.66 -
549.67 - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" +
549.68 - "\b\t\n\u000B\f\r\u000E\u000F" +
549.69 - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" +
549.70 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" +
549.71 - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" +
549.72 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" +
549.73 - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" +
549.74 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" +
549.75 - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" +
549.76 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" +
549.77 - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" +
549.78 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" +
549.79 - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" +
549.80 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" +
549.81 - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" +
549.82 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" +
549.83 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.84 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.85 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.86 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.87 - "\u0000\u0000\u0000\u0000\u0000\\\u0000\u0000" +
549.88 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.89 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.90 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.91 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.92 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.93 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.94 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.95 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.96 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.97 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.98 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.99 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.100 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.101 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.102 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.103 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.104 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.105 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.106 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.107 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.108 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.109 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.110 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.111 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.112 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.113 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.114 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.115 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.116 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.117 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.118 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.119 - "\u0000\u0000\u0000\u0000\u0000\u0000\u007E\u0000" +
549.120 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.121 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.122 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.123 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.124 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.125 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.126 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.127 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.128 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.129 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.130 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.131 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.132 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.133 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.134 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.135 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.136 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.137 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.138 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.139 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.140 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.141 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.142 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.143 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.144 - "\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8" +
549.145 - "\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF\u00B0" +
549.146 - "\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8" +
549.147 - "\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF\u00C0" +
549.148 - "\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8" +
549.149 - "\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D0" +
549.150 - "\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8" +
549.151 - "\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF\u0000" +
549.152 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.153 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.154 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.155 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.156 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.157 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.158 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.159 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.160 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.161 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.162 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
549.163 - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000";
549.164 -
549.165 - private final static short index1[] = {
549.166 - 0, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
549.167 - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
549.168 - 360, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
549.169 - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
549.170 - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
549.171 - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
549.172 - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
549.173 - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
549.174 - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
549.175 - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
549.176 - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
549.177 - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
549.178 - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
549.179 - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
549.180 - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
549.181 - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 519,
549.182 - };
549.183 -
549.184 -}
550.1 --- a/src/share/classes/sun/io/CharToByteJIS0208.java Thu Sep 01 13:54:38 2011 -0700
550.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
550.3 @@ -1,47 +0,0 @@
550.4 -/*
550.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
550.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
550.7 - *
550.8 - * This code is free software; you can redistribute it and/or modify it
550.9 - * under the terms of the GNU General Public License version 2 only, as
550.10 - * published by the Free Software Foundation. Oracle designates this
550.11 - * particular file as subject to the "Classpath" exception as provided
550.12 - * by Oracle in the LICENSE file that accompanied this code.
550.13 - *
550.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
550.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
550.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
550.17 - * version 2 for more details (a copy is included in the LICENSE file that
550.18 - * accompanied this code).
550.19 - *
550.20 - * You should have received a copy of the GNU General Public License version
550.21 - * 2 along with this work; if not, write to the Free Software Foundation,
550.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
550.23 - *
550.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
550.25 - * or visit www.oracle.com if you need additional information or have any
550.26 - * questions.
550.27 - */
550.28 -
550.29 -
550.30 -package sun.io;
550.31 -
550.32 -import sun.nio.cs.ext.JIS_X_0208_Encoder;
550.33 -
550.34 -/**
550.35 - * Tables and data to convert Unicode to JIS0208
550.36 - *
550.37 - * @author ConverterGenerator tool
550.38 - */
550.39 -
550.40 -public class CharToByteJIS0208 extends CharToByteDoubleByte {
550.41 -
550.42 - public String getCharacterEncoding() {
550.43 - return "JIS0208";
550.44 - }
550.45 -
550.46 - public CharToByteJIS0208() {
550.47 - super.index1 = JIS_X_0208_Encoder.getIndex1();
550.48 - super.index2 = JIS_X_0208_Encoder.getIndex2();
550.49 - }
550.50 -}
551.1 --- a/src/share/classes/sun/io/CharToByteJIS0208_Solaris.java Thu Sep 01 13:54:38 2011 -0700
551.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
551.3 @@ -1,52 +0,0 @@
551.4 -/*
551.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
551.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
551.7 - *
551.8 - * This code is free software; you can redistribute it and/or modify it
551.9 - * under the terms of the GNU General Public License version 2 only, as
551.10 - * published by the Free Software Foundation. Oracle designates this
551.11 - * particular file as subject to the "Classpath" exception as provided
551.12 - * by Oracle in the LICENSE file that accompanied this code.
551.13 - *
551.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
551.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
551.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
551.17 - * version 2 for more details (a copy is included in the LICENSE file that
551.18 - * accompanied this code).
551.19 - *
551.20 - * You should have received a copy of the GNU General Public License version
551.21 - * 2 along with this work; if not, write to the Free Software Foundation,
551.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
551.23 - *
551.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
551.25 - * or visit www.oracle.com if you need additional information or have any
551.26 - * questions.
551.27 - */
551.28 -
551.29 -
551.30 -package sun.io;
551.31 -
551.32 -import sun.nio.cs.ext.JIS_X_0208_Solaris_Encoder;
551.33 -
551.34 -/**
551.35 - * Tables and data to convert Unicode to JIS0208_Solaris
551.36 - *
551.37 - *
551.38 - * Vendor defined chars added for benefit of vendor defined character
551.39 - * supplemented mappings for EUC-JP-Solaris/PCK Solaris variants of EUC-JP
551.40 - * and SJIS/Shift_JIS (4765370)
551.41 - *
551.42 - * @author ConverterGenerator tool
551.43 - */
551.44 -
551.45 -public class CharToByteJIS0208_Solaris extends CharToByteDoubleByte {
551.46 -
551.47 - public String getCharacterEncoding() {
551.48 - return "JIS0208_Solaris";
551.49 - }
551.50 -
551.51 - public CharToByteJIS0208_Solaris() {
551.52 - super.index1 = JIS_X_0208_Solaris_Encoder.getIndex1();
551.53 - super.index2 = JIS_X_0208_Solaris_Encoder.getIndex2();
551.54 - }
551.55 -}
552.1 --- a/src/share/classes/sun/io/CharToByteJIS0212.java Thu Sep 01 13:54:38 2011 -0700
552.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
552.3 @@ -1,45 +0,0 @@
552.4 -/*
552.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
552.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
552.7 - *
552.8 - * This code is free software; you can redistribute it and/or modify it
552.9 - * under the terms of the GNU General Public License version 2 only, as
552.10 - * published by the Free Software Foundation. Oracle designates this
552.11 - * particular file as subject to the "Classpath" exception as provided
552.12 - * by Oracle in the LICENSE file that accompanied this code.
552.13 - *
552.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
552.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
552.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
552.17 - * version 2 for more details (a copy is included in the LICENSE file that
552.18 - * accompanied this code).
552.19 - *
552.20 - * You should have received a copy of the GNU General Public License version
552.21 - * 2 along with this work; if not, write to the Free Software Foundation,
552.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
552.23 - *
552.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
552.25 - * or visit www.oracle.com if you need additional information or have any
552.26 - * questions.
552.27 - */
552.28 -
552.29 -
552.30 -package sun.io;
552.31 -import sun.nio.cs.ext.JIS_X_0212_Encoder;
552.32 -
552.33 -/**
552.34 - * Tables and data to convert Unicode to JIS0212
552.35 - *
552.36 - * @author ConverterGenerator tool
552.37 - */
552.38 -
552.39 -public class CharToByteJIS0212 extends CharToByteDoubleByte {
552.40 - public String getCharacterEncoding() {
552.41 - return "JIS0212";
552.42 - }
552.43 -
552.44 - public CharToByteJIS0212() {
552.45 - super.index1 = JIS_X_0212_Encoder.getIndex1();
552.46 - super.index2 = JIS_X_0212_Encoder.getIndex2();
552.47 - }
552.48 -}
553.1 --- a/src/share/classes/sun/io/CharToByteJIS0212_Solaris.java Thu Sep 01 13:54:38 2011 -0700
553.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
553.3 @@ -1,47 +0,0 @@
553.4 -/*
553.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
553.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
553.7 - *
553.8 - * This code is free software; you can redistribute it and/or modify it
553.9 - * under the terms of the GNU General Public License version 2 only, as
553.10 - * published by the Free Software Foundation. Oracle designates this
553.11 - * particular file as subject to the "Classpath" exception as provided
553.12 - * by Oracle in the LICENSE file that accompanied this code.
553.13 - *
553.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
553.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
553.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
553.17 - * version 2 for more details (a copy is included in the LICENSE file that
553.18 - * accompanied this code).
553.19 - *
553.20 - * You should have received a copy of the GNU General Public License version
553.21 - * 2 along with this work; if not, write to the Free Software Foundation,
553.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
553.23 - *
553.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
553.25 - * or visit www.oracle.com if you need additional information or have any
553.26 - * questions.
553.27 - */
553.28 -
553.29 -
553.30 -package sun.io;
553.31 -
553.32 -import sun.nio.cs.ext.JIS_X_0212_Solaris_Encoder;
553.33 -
553.34 -/**
553.35 - * Tables and data to convert Unicode to JIS0212_Solaris
553.36 - *
553.37 - * @author ConverterGenerator tool
553.38 - */
553.39 -
553.40 -public class CharToByteJIS0212_Solaris extends CharToByteDoubleByte {
553.41 -
553.42 - public String getCharacterEncoding() {
553.43 - return "JIS0212_Solaris";
553.44 - }
553.45 -
553.46 - public CharToByteJIS0212_Solaris() {
553.47 - super.index1 = JIS_X_0212_Solaris_Encoder.getIndex1();
553.48 - super.index2 = JIS_X_0212_Solaris_Encoder.getIndex2();
553.49 - }
553.50 -}
554.1 --- a/src/share/classes/sun/io/CharToByteJohab.java Thu Sep 01 13:54:38 2011 -0700
554.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
554.3 @@ -1,43 +0,0 @@
554.4 -/*
554.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
554.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
554.7 - *
554.8 - * This code is free software; you can redistribute it and/or modify it
554.9 - * under the terms of the GNU General Public License version 2 only, as
554.10 - * published by the Free Software Foundation. Oracle designates this
554.11 - * particular file as subject to the "Classpath" exception as provided
554.12 - * by Oracle in the LICENSE file that accompanied this code.
554.13 - *
554.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
554.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
554.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
554.17 - * version 2 for more details (a copy is included in the LICENSE file that
554.18 - * accompanied this code).
554.19 - *
554.20 - * You should have received a copy of the GNU General Public License version
554.21 - * 2 along with this work; if not, write to the Free Software Foundation,
554.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
554.23 - *
554.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
554.25 - * or visit www.oracle.com if you need additional information or have any
554.26 - * questions.
554.27 - */
554.28 -
554.29 -
554.30 -package sun.io;
554.31 -
554.32 -import sun.nio.cs.ext.*;
554.33 -
554.34 -public class CharToByteJohab extends CharToByteDBCS_ASCII {
554.35 -
554.36 - private static DoubleByte.Encoder enc =
554.37 - (DoubleByte.Encoder)new Johab().newEncoder();
554.38 -
554.39 - public String getCharacterEncoding() {
554.40 - return "Johab";
554.41 - }
554.42 -
554.43 - public CharToByteJohab() {
554.44 - super(enc);
554.45 - }
554.46 -}
555.1 --- a/src/share/classes/sun/io/CharToByteKOI8_R.java Thu Sep 01 13:54:38 2011 -0700
555.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
555.3 @@ -1,51 +0,0 @@
555.4 -/*
555.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
555.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
555.7 - *
555.8 - * This code is free software; you can redistribute it and/or modify it
555.9 - * under the terms of the GNU General Public License version 2 only, as
555.10 - * published by the Free Software Foundation. Oracle designates this
555.11 - * particular file as subject to the "Classpath" exception as provided
555.12 - * by Oracle in the LICENSE file that accompanied this code.
555.13 - *
555.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
555.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
555.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
555.17 - * version 2 for more details (a copy is included in the LICENSE file that
555.18 - * accompanied this code).
555.19 - *
555.20 - * You should have received a copy of the GNU General Public License version
555.21 - * 2 along with this work; if not, write to the Free Software Foundation,
555.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
555.23 - *
555.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
555.25 - * or visit www.oracle.com if you need additional information or have any
555.26 - * questions.
555.27 - */
555.28 -
555.29 -package sun.io;
555.30 -
555.31 -import sun.nio.cs.KOI8_R;
555.32 -
555.33 -/**
555.34 - * Tables and data to convert Unicode to KOI8_R
555.35 - *
555.36 - * @author ConverterGenerator tool
555.37 - */
555.38 -
555.39 -public class CharToByteKOI8_R extends CharToByteSingleByte {
555.40 -
555.41 - private final static KOI8_R nioCoder = new KOI8_R();
555.42 -
555.43 - public String getCharacterEncoding() {
555.44 - return "KOI8_R";
555.45 - }
555.46 -
555.47 - public CharToByteKOI8_R() {
555.48 - super.mask1 = 0xFF00;
555.49 - super.mask2 = 0x00FF;
555.50 - super.shift = 8;
555.51 - super.index1 = nioCoder.getEncoderIndex1();
555.52 - super.index2 = nioCoder.getEncoderIndex2();
555.53 - }
555.54 -}
556.1 --- a/src/share/classes/sun/io/CharToByteMS874.java Thu Sep 01 13:54:38 2011 -0700
556.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
556.3 @@ -1,52 +0,0 @@
556.4 -/*
556.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
556.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
556.7 - *
556.8 - * This code is free software; you can redistribute it and/or modify it
556.9 - * under the terms of the GNU General Public License version 2 only, as
556.10 - * published by the Free Software Foundation. Oracle designates this
556.11 - * particular file as subject to the "Classpath" exception as provided
556.12 - * by Oracle in the LICENSE file that accompanied this code.
556.13 - *
556.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
556.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
556.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
556.17 - * version 2 for more details (a copy is included in the LICENSE file that
556.18 - * accompanied this code).
556.19 - *
556.20 - * You should have received a copy of the GNU General Public License version
556.21 - * 2 along with this work; if not, write to the Free Software Foundation,
556.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
556.23 - *
556.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
556.25 - * or visit www.oracle.com if you need additional information or have any
556.26 - * questions.
556.27 - */
556.28 -
556.29 -
556.30 -package sun.io;
556.31 -
556.32 -import sun.nio.cs.ext.MS874;
556.33 -
556.34 -/**
556.35 - * Tables and data to convert Unicode to MS874
556.36 - *
556.37 - * @author ConverterGenerator tool
556.38 - */
556.39 -
556.40 -public class CharToByteMS874 extends CharToByteSingleByte {
556.41 -
556.42 - private final static MS874 nioCoder = new MS874();
556.43 -
556.44 - public String getCharacterEncoding() {
556.45 - return "MS874";
556.46 - }
556.47 -
556.48 - public CharToByteMS874() {
556.49 - super.mask1 = 0xFF00;
556.50 - super.mask2 = 0x00FF;
556.51 - super.shift = 8;
556.52 - super.index1 = nioCoder.getEncoderIndex1();
556.53 - super.index2 = nioCoder.getEncoderIndex2();
556.54 - }
556.55 -}
557.1 --- a/src/share/classes/sun/io/CharToByteMS932.java Thu Sep 01 13:54:38 2011 -0700
557.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
557.3 @@ -1,42 +0,0 @@
557.4 -/*
557.5 - * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
557.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
557.7 - *
557.8 - * This code is free software; you can redistribute it and/or modify it
557.9 - * under the terms of the GNU General Public License version 2 only, as
557.10 - * published by the Free Software Foundation. Oracle designates this
557.11 - * particular file as subject to the "Classpath" exception as provided
557.12 - * by Oracle in the LICENSE file that accompanied this code.
557.13 - *
557.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
557.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
557.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
557.17 - * version 2 for more details (a copy is included in the LICENSE file that
557.18 - * accompanied this code).
557.19 - *
557.20 - * You should have received a copy of the GNU General Public License version
557.21 - * 2 along with this work; if not, write to the Free Software Foundation,
557.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
557.23 - *
557.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
557.25 - * or visit www.oracle.com if you need additional information or have any
557.26 - * questions.
557.27 - */
557.28 -
557.29 -package sun.io;
557.30 -
557.31 -import sun.nio.cs.ext.*;
557.32 -
557.33 -public class CharToByteMS932 extends CharToByteDBCS_ASCII {
557.34 -
557.35 - private static DoubleByte.Encoder enc =
557.36 - (DoubleByte.Encoder)new MS932().newEncoder();
557.37 -
557.38 - public String getCharacterEncoding() {
557.39 - return "MS932";
557.40 - }
557.41 -
557.42 - public CharToByteMS932() {
557.43 - super(enc);
557.44 - }
557.45 -}
558.1 --- a/src/share/classes/sun/io/CharToByteMS936.java Thu Sep 01 13:54:38 2011 -0700
558.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
558.3 @@ -1,42 +0,0 @@
558.4 -/*
558.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
558.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
558.7 - *
558.8 - * This code is free software; you can redistribute it and/or modify it
558.9 - * under the terms of the GNU General Public License version 2 only, as
558.10 - * published by the Free Software Foundation. Oracle designates this
558.11 - * particular file as subject to the "Classpath" exception as provided
558.12 - * by Oracle in the LICENSE file that accompanied this code.
558.13 - *
558.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
558.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
558.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
558.17 - * version 2 for more details (a copy is included in the LICENSE file that
558.18 - * accompanied this code).
558.19 - *
558.20 - * You should have received a copy of the GNU General Public License version
558.21 - * 2 along with this work; if not, write to the Free Software Foundation,
558.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
558.23 - *
558.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
558.25 - * or visit www.oracle.com if you need additional information or have any
558.26 - * questions.
558.27 - */
558.28 -
558.29 -package sun.io;
558.30 -
558.31 -import sun.nio.cs.ext.*;
558.32 -
558.33 -public class CharToByteMS936 extends CharToByteDBCS_ASCII {
558.34 -
558.35 - private static DoubleByte.Encoder enc =
558.36 - (DoubleByte.Encoder)new MS936().newEncoder();
558.37 -
558.38 - public String getCharacterEncoding() {
558.39 - return "MS936";
558.40 - }
558.41 -
558.42 - public CharToByteMS936() {
558.43 - super(enc);
558.44 - }
558.45 -}
559.1 --- a/src/share/classes/sun/io/CharToByteMS949.java Thu Sep 01 13:54:38 2011 -0700
559.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
559.3 @@ -1,43 +0,0 @@
559.4 -/*
559.5 - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
559.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
559.7 - *
559.8 - * This code is free software; you can redistribute it and/or modify it
559.9 - * under the terms of the GNU General Public License version 2 only, as
559.10 - * published by the Free Software Foundation. Oracle designates this
559.11 - * particular file as subject to the "Classpath" exception as provided
559.12 - * by Oracle in the LICENSE file that accompanied this code.
559.13 - *
559.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
559.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
559.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
559.17 - * version 2 for more details (a copy is included in the LICENSE file that
559.18 - * accompanied this code).
559.19 - *
559.20 - * You should have received a copy of the GNU General Public License version
559.21 - * 2 along with this work; if not, write to the Free Software Foundation,
559.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
559.23 - *
559.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
559.25 - * or visit www.oracle.com if you need additional information or have any
559.26 - * questions.
559.27 - */
559.28 -
559.29 -
559.30 -package sun.io;
559.31 -
559.32 -import sun.nio.cs.ext.*;
559.33 -
559.34 -public class CharToByteMS949 extends CharToByteDBCS_ASCII {
559.35 -
559.36 - private static DoubleByte.Encoder enc =
559.37 - (DoubleByte.Encoder)new MS949().newEncoder();
559.38 -
559.39 - public String getCharacterEncoding() {
559.40 - return "MS949";
559.41 - }
559.42 -
559.43 - public CharToByteMS949() {
559.44 - super(enc);
559.45 - }
559.46 -}
560.1 --- a/src/share/classes/sun/io/CharToByteMS950.java Thu Sep 01 13:54:38 2011 -0700
560.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
560.3 @@ -1,43 +0,0 @@
560.4 -/*
560.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
560.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
560.7 - *
560.8 - * This code is free software; you can redistribute it and/or modify it
560.9 - * under the terms of the GNU General Public License version 2 only, as
560.10 - * published by the Free Software Foundation. Oracle designates this
560.11 - * particular file as subject to the "Classpath" exception as provided
560.12 - * by Oracle in the LICENSE file that accompanied this code.
560.13 - *
560.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
560.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
560.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
560.17 - * version 2 for more details (a copy is included in the LICENSE file that
560.18 - * accompanied this code).
560.19 - *
560.20 - * You should have received a copy of the GNU General Public License version
560.21 - * 2 along with this work; if not, write to the Free Software Foundation,
560.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
560.23 - *
560.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
560.25 - * or visit www.oracle.com if you need additional information or have any
560.26 - * questions.
560.27 - */
560.28 -
560.29 -
560.30 -package sun.io;
560.31 -
560.32 -import sun.nio.cs.ext.*;
560.33 -
560.34 -public class CharToByteMS950 extends CharToByteDBCS_ASCII {
560.35 -
560.36 - private static DoubleByte.Encoder enc =
560.37 - (DoubleByte.Encoder)new MS950().newEncoder();
560.38 -
560.39 - public String getCharacterEncoding() {
560.40 - return "MS950";
560.41 - }
560.42 -
560.43 - public CharToByteMS950() {
560.44 - super(enc);
560.45 - }
560.46 -}
561.1 --- a/src/share/classes/sun/io/CharToByteMS950_HKSCS.java Thu Sep 01 13:54:38 2011 -0700
561.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
561.3 @@ -1,43 +0,0 @@
561.4 -/*
561.5 - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
561.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
561.7 - *
561.8 - * This code is free software; you can redistribute it and/or modify it
561.9 - * under the terms of the GNU General Public License version 2 only, as
561.10 - * published by the Free Software Foundation. Oracle designates this
561.11 - * particular file as subject to the "Classpath" exception as provided
561.12 - * by Oracle in the LICENSE file that accompanied this code.
561.13 - *
561.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
561.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
561.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
561.17 - * version 2 for more details (a copy is included in the LICENSE file that
561.18 - * accompanied this code).
561.19 - *
561.20 - * You should have received a copy of the GNU General Public License version
561.21 - * 2 along with this work; if not, write to the Free Software Foundation,
561.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
561.23 - *
561.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
561.25 - * or visit www.oracle.com if you need additional information or have any
561.26 - * questions.
561.27 - */
561.28 -
561.29 -package sun.io;
561.30 -
561.31 -import sun.nio.cs.ext.DoubleByte;
561.32 -import sun.nio.cs.ext.MS950_HKSCS;
561.33 -
561.34 -public class CharToByteMS950_HKSCS extends CharToByteDBCS_ASCII {
561.35 -
561.36 - private static DoubleByte.Encoder enc =
561.37 - (DoubleByte.Encoder)new MS950_HKSCS().newEncoder();
561.38 -
561.39 - public String getCharacterEncoding() {
561.40 - return "MS950_HKSCS";
561.41 - }
561.42 -
561.43 - public CharToByteMS950_HKSCS() {
561.44 - super(enc);
561.45 - }
561.46 -}
562.1 --- a/src/share/classes/sun/io/CharToByteMacArabic.java Thu Sep 01 13:54:38 2011 -0700
562.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
562.3 @@ -1,51 +0,0 @@
562.4 -/*
562.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
562.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
562.7 - *
562.8 - * This code is free software; you can redistribute it and/or modify it
562.9 - * under the terms of the GNU General Public License version 2 only, as
562.10 - * published by the Free Software Foundation. Oracle designates this
562.11 - * particular file as subject to the "Classpath" exception as provided
562.12 - * by Oracle in the LICENSE file that accompanied this code.
562.13 - *
562.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
562.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
562.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
562.17 - * version 2 for more details (a copy is included in the LICENSE file that
562.18 - * accompanied this code).
562.19 - *
562.20 - * You should have received a copy of the GNU General Public License version
562.21 - * 2 along with this work; if not, write to the Free Software Foundation,
562.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
562.23 - *
562.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
562.25 - * or visit www.oracle.com if you need additional information or have any
562.26 - * questions.
562.27 - */
562.28 -
562.29 -package sun.io;
562.30 -
562.31 -import sun.nio.cs.ext.MacArabic;
562.32 -
562.33 -/**
562.34 - * Tables and data to convert Unicode to MacArabic
562.35 - *
562.36 - * @author ConverterGenerator tool
562.37 - */
562.38 -
562.39 -public class CharToByteMacArabic extends CharToByteSingleByte {
562.40 -
562.41 - private final static MacArabic nioCoder = new MacArabic();
562.42 -
562.43 - public String getCharacterEncoding() {
562.44 - return "MacArabic";
562.45 - }
562.46 -
562.47 - public CharToByteMacArabic() {
562.48 - super.mask1 = 0xFF00;
562.49 - super.mask2 = 0x00FF;
562.50 - super.shift = 8;
562.51 - super.index1 = nioCoder.getEncoderIndex1();
562.52 - super.index2 = nioCoder.getEncoderIndex2();
562.53 - }
562.54 -}
563.1 --- a/src/share/classes/sun/io/CharToByteMacCentralEurope.java Thu Sep 01 13:54:38 2011 -0700
563.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
563.3 @@ -1,51 +0,0 @@
563.4 -/*
563.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
563.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
563.7 - *
563.8 - * This code is free software; you can redistribute it and/or modify it
563.9 - * under the terms of the GNU General Public License version 2 only, as
563.10 - * published by the Free Software Foundation. Oracle designates this
563.11 - * particular file as subject to the "Classpath" exception as provided
563.12 - * by Oracle in the LICENSE file that accompanied this code.
563.13 - *
563.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
563.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
563.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
563.17 - * version 2 for more details (a copy is included in the LICENSE file that
563.18 - * accompanied this code).
563.19 - *
563.20 - * You should have received a copy of the GNU General Public License version
563.21 - * 2 along with this work; if not, write to the Free Software Foundation,
563.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
563.23 - *
563.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
563.25 - * or visit www.oracle.com if you need additional information or have any
563.26 - * questions.
563.27 - */
563.28 -
563.29 -package sun.io;
563.30 -
563.31 -import sun.nio.cs.ext.MacCentralEurope;
563.32 -
563.33 -/**
563.34 - * Tables and data to convert Unicode to MacCentralEurope
563.35 - *
563.36 - * @author ConverterGenerator tool
563.37 - */
563.38 -
563.39 -public class CharToByteMacCentralEurope extends CharToByteSingleByte {
563.40 -
563.41 - private final static MacCentralEurope nioCoder = new MacCentralEurope();
563.42 -
563.43 - public String getCharacterEncoding() {
563.44 - return "MacCentralEurope";
563.45 - }
563.46 -
563.47 - public CharToByteMacCentralEurope() {
563.48 - super.mask1 = 0xFF00;
563.49 - super.mask2 = 0x00FF;
563.50 - super.shift = 8;
563.51 - super.index1 = nioCoder.getEncoderIndex1();
563.52 - super.index2 = nioCoder.getEncoderIndex2();
563.53 - }
563.54 -}
564.1 --- a/src/share/classes/sun/io/CharToByteMacCroatian.java Thu Sep 01 13:54:38 2011 -0700
564.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
564.3 @@ -1,51 +0,0 @@
564.4 -/*
564.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
564.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
564.7 - *
564.8 - * This code is free software; you can redistribute it and/or modify it
564.9 - * under the terms of the GNU General Public License version 2 only, as
564.10 - * published by the Free Software Foundation. Oracle designates this
564.11 - * particular file as subject to the "Classpath" exception as provided
564.12 - * by Oracle in the LICENSE file that accompanied this code.
564.13 - *
564.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
564.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
564.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
564.17 - * version 2 for more details (a copy is included in the LICENSE file that
564.18 - * accompanied this code).
564.19 - *
564.20 - * You should have received a copy of the GNU General Public License version
564.21 - * 2 along with this work; if not, write to the Free Software Foundation,
564.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
564.23 - *
564.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
564.25 - * or visit www.oracle.com if you need additional information or have any
564.26 - * questions.
564.27 - */
564.28 -
564.29 -package sun.io;
564.30 -
564.31 -import sun.nio.cs.ext.MacCroatian;
564.32 -
564.33 -/**
564.34 - * Tables and data to convert Unicode to MacCroatian
564.35 - *
564.36 - * @author ConverterGenerator tool
564.37 - */
564.38 -
564.39 -public class CharToByteMacCroatian extends CharToByteSingleByte {
564.40 -
564.41 - private final static MacCroatian nioCoder = new MacCroatian();
564.42 -
564.43 - public String getCharacterEncoding() {
564.44 - return "MacCroatian";
564.45 - }
564.46 -
564.47 - public CharToByteMacCroatian() {
564.48 - super.mask1 = 0xFF00;
564.49 - super.mask2 = 0x00FF;
564.50 - super.shift = 8;
564.51 - super.index1 = nioCoder.getEncoderIndex1();
564.52 - super.index2 = nioCoder.getEncoderIndex2();
564.53 - }
564.54 -}
565.1 --- a/src/share/classes/sun/io/CharToByteMacCyrillic.java Thu Sep 01 13:54:38 2011 -0700
565.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
565.3 @@ -1,51 +0,0 @@
565.4 -/*
565.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
565.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
565.7 - *
565.8 - * This code is free software; you can redistribute it and/or modify it
565.9 - * under the terms of the GNU General Public License version 2 only, as
565.10 - * published by the Free Software Foundation. Oracle designates this
565.11 - * particular file as subject to the "Classpath" exception as provided
565.12 - * by Oracle in the LICENSE file that accompanied this code.
565.13 - *
565.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
565.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
565.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
565.17 - * version 2 for more details (a copy is included in the LICENSE file that
565.18 - * accompanied this code).
565.19 - *
565.20 - * You should have received a copy of the GNU General Public License version
565.21 - * 2 along with this work; if not, write to the Free Software Foundation,
565.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
565.23 - *
565.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
565.25 - * or visit www.oracle.com if you need additional information or have any
565.26 - * questions.
565.27 - */
565.28 -
565.29 -package sun.io;
565.30 -
565.31 -import sun.nio.cs.ext.MacCyrillic;
565.32 -
565.33 -/**
565.34 - * Tables and data to convert Unicode to MacCyrillic
565.35 - *
565.36 - * @author ConverterGenerator tool
565.37 - */
565.38 -
565.39 -public class CharToByteMacCyrillic extends CharToByteSingleByte {
565.40 -
565.41 - private final static MacCyrillic nioCoder = new MacCyrillic();
565.42 -
565.43 - public String getCharacterEncoding() {
565.44 - return "MacCyrillic";
565.45 - }
565.46 -
565.47 - public CharToByteMacCyrillic() {
565.48 - super.mask1 = 0xFF00;
565.49 - super.mask2 = 0x00FF;
565.50 - super.shift = 8;
565.51 - super.index1 = nioCoder.getEncoderIndex1();
565.52 - super.index2 = nioCoder.getEncoderIndex2();
565.53 - }
565.54 -}
566.1 --- a/src/share/classes/sun/io/CharToByteMacDingbat.java Thu Sep 01 13:54:38 2011 -0700
566.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
566.3 @@ -1,51 +0,0 @@
566.4 -/*
566.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
566.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
566.7 - *
566.8 - * This code is free software; you can redistribute it and/or modify it
566.9 - * under the terms of the GNU General Public License version 2 only, as
566.10 - * published by the Free Software Foundation. Oracle designates this
566.11 - * particular file as subject to the "Classpath" exception as provided
566.12 - * by Oracle in the LICENSE file that accompanied this code.
566.13 - *
566.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
566.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
566.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
566.17 - * version 2 for more details (a copy is included in the LICENSE file that
566.18 - * accompanied this code).
566.19 - *
566.20 - * You should have received a copy of the GNU General Public License version
566.21 - * 2 along with this work; if not, write to the Free Software Foundation,
566.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
566.23 - *
566.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
566.25 - * or visit www.oracle.com if you need additional information or have any
566.26 - * questions.
566.27 - */
566.28 -
566.29 -package sun.io;
566.30 -
566.31 -import sun.nio.cs.ext.MacDingbat;
566.32 -
566.33 -/**
566.34 - * Tables and data to convert Unicode to MacDingbat
566.35 - *
566.36 - * @author ConverterGenerator tool
566.37 - */
566.38 -
566.39 -public class CharToByteMacDingbat extends CharToByteSingleByte {
566.40 -
566.41 - private final static MacDingbat nioCoder = new MacDingbat();
566.42 -
566.43 - public String getCharacterEncoding() {
566.44 - return "MacDingbat";
566.45 - }
566.46 -
566.47 - public CharToByteMacDingbat() {
566.48 - super.mask1 = 0xFF00;
566.49 - super.mask2 = 0x00FF;
566.50 - super.shift = 8;
566.51 - super.index1 = nioCoder.getEncoderIndex1();
566.52 - super.index2 = nioCoder.getEncoderIndex2();
566.53 - }
566.54 -}
567.1 --- a/src/share/classes/sun/io/CharToByteMacGreek.java Thu Sep 01 13:54:38 2011 -0700
567.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
567.3 @@ -1,51 +0,0 @@
567.4 -/*
567.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
567.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
567.7 - *
567.8 - * This code is free software; you can redistribute it and/or modify it
567.9 - * under the terms of the GNU General Public License version 2 only, as
567.10 - * published by the Free Software Foundation. Oracle designates this
567.11 - * particular file as subject to the "Classpath" exception as provided
567.12 - * by Oracle in the LICENSE file that accompanied this code.
567.13 - *
567.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
567.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
567.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
567.17 - * version 2 for more details (a copy is included in the LICENSE file that
567.18 - * accompanied this code).
567.19 - *
567.20 - * You should have received a copy of the GNU General Public License version
567.21 - * 2 along with this work; if not, write to the Free Software Foundation,
567.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
567.23 - *
567.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
567.25 - * or visit www.oracle.com if you need additional information or have any
567.26 - * questions.
567.27 - */
567.28 -
567.29 -package sun.io;
567.30 -
567.31 -import sun.nio.cs.ext.MacGreek;
567.32 -
567.33 -/**
567.34 - * Tables and data to convert Unicode to MacGreek
567.35 - *
567.36 - * @author ConverterGenerator tool
567.37 - */
567.38 -
567.39 -public class CharToByteMacGreek extends CharToByteSingleByte {
567.40 -
567.41 - private final static MacGreek nioCoder = new MacGreek();
567.42 -
567.43 - public String getCharacterEncoding() {
567.44 - return "MacGreek";
567.45 - }
567.46 -
567.47 - public CharToByteMacGreek() {
567.48 - super.mask1 = 0xFF00;
567.49 - super.mask2 = 0x00FF;
567.50 - super.shift = 8;
567.51 - super.index1 = nioCoder.getEncoderIndex1();
567.52 - super.index2 = nioCoder.getEncoderIndex2();
567.53 - }
567.54 -}
568.1 --- a/src/share/classes/sun/io/CharToByteMacHebrew.java Thu Sep 01 13:54:38 2011 -0700
568.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
568.3 @@ -1,51 +0,0 @@
568.4 -/*
568.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
568.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
568.7 - *
568.8 - * This code is free software; you can redistribute it and/or modify it
568.9 - * under the terms of the GNU General Public License version 2 only, as
568.10 - * published by the Free Software Foundation. Oracle designates this
568.11 - * particular file as subject to the "Classpath" exception as provided
568.12 - * by Oracle in the LICENSE file that accompanied this code.
568.13 - *
568.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
568.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
568.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
568.17 - * version 2 for more details (a copy is included in the LICENSE file that
568.18 - * accompanied this code).
568.19 - *
568.20 - * You should have received a copy of the GNU General Public License version
568.21 - * 2 along with this work; if not, write to the Free Software Foundation,
568.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
568.23 - *
568.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
568.25 - * or visit www.oracle.com if you need additional information or have any
568.26 - * questions.
568.27 - */
568.28 -
568.29 -package sun.io;
568.30 -
568.31 -import sun.nio.cs.ext.MacHebrew;
568.32 -
568.33 -/**
568.34 - * Tables and data to convert Unicode to MacHebrew
568.35 - *
568.36 - * @author ConverterGenerator tool
568.37 - */
568.38 -
568.39 -public class CharToByteMacHebrew extends CharToByteSingleByte {
568.40 -
568.41 - private final static MacHebrew nioCoder = new MacHebrew();
568.42 -
568.43 - public String getCharacterEncoding() {
568.44 - return "MacHebrew";
568.45 - }
568.46 -
568.47 - public CharToByteMacHebrew() {
568.48 - super.mask1 = 0xFF00;
568.49 - super.mask2 = 0x00FF;
568.50 - super.shift = 8;
568.51 - super.index1 = nioCoder.getEncoderIndex1();
568.52 - super.index2 = nioCoder.getEncoderIndex2();
568.53 - }
568.54 -}
569.1 --- a/src/share/classes/sun/io/CharToByteMacIceland.java Thu Sep 01 13:54:38 2011 -0700
569.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
569.3 @@ -1,51 +0,0 @@
569.4 -/*
569.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
569.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
569.7 - *
569.8 - * This code is free software; you can redistribute it and/or modify it
569.9 - * under the terms of the GNU General Public License version 2 only, as
569.10 - * published by the Free Software Foundation. Oracle designates this
569.11 - * particular file as subject to the "Classpath" exception as provided
569.12 - * by Oracle in the LICENSE file that accompanied this code.
569.13 - *
569.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
569.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
569.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
569.17 - * version 2 for more details (a copy is included in the LICENSE file that
569.18 - * accompanied this code).
569.19 - *
569.20 - * You should have received a copy of the GNU General Public License version
569.21 - * 2 along with this work; if not, write to the Free Software Foundation,
569.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
569.23 - *
569.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
569.25 - * or visit www.oracle.com if you need additional information or have any
569.26 - * questions.
569.27 - */
569.28 -
569.29 -package sun.io;
569.30 -
569.31 -import sun.nio.cs.ext.MacIceland;
569.32 -
569.33 -/**
569.34 - * Tables and data to convert Unicode to MacIceland
569.35 - *
569.36 - * @author ConverterGenerator tool
569.37 - */
569.38 -
569.39 -public class CharToByteMacIceland extends CharToByteSingleByte {
569.40 -
569.41 - private final static MacIceland nioCoder = new MacIceland();
569.42 -
569.43 - public String getCharacterEncoding() {
569.44 - return "MacIceland";
569.45 - }
569.46 -
569.47 - public CharToByteMacIceland() {
569.48 - super.mask1 = 0xFF00;
569.49 - super.mask2 = 0x00FF;
569.50 - super.shift = 8;
569.51 - super.index1 = nioCoder.getEncoderIndex1();
569.52 - super.index2 = nioCoder.getEncoderIndex2();
569.53 - }
569.54 -}
570.1 --- a/src/share/classes/sun/io/CharToByteMacRoman.java Thu Sep 01 13:54:38 2011 -0700
570.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
570.3 @@ -1,51 +0,0 @@
570.4 -/*
570.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
570.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
570.7 - *
570.8 - * This code is free software; you can redistribute it and/or modify it
570.9 - * under the terms of the GNU General Public License version 2 only, as
570.10 - * published by the Free Software Foundation. Oracle designates this
570.11 - * particular file as subject to the "Classpath" exception as provided
570.12 - * by Oracle in the LICENSE file that accompanied this code.
570.13 - *
570.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
570.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
570.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
570.17 - * version 2 for more details (a copy is included in the LICENSE file that
570.18 - * accompanied this code).
570.19 - *
570.20 - * You should have received a copy of the GNU General Public License version
570.21 - * 2 along with this work; if not, write to the Free Software Foundation,
570.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
570.23 - *
570.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
570.25 - * or visit www.oracle.com if you need additional information or have any
570.26 - * questions.
570.27 - */
570.28 -
570.29 -package sun.io;
570.30 -
570.31 -import sun.nio.cs.ext.MacRoman;
570.32 -
570.33 -/**
570.34 - * Tables and data to convert Unicode to MacRoman
570.35 - *
570.36 - * @author ConverterGenerator tool
570.37 - */
570.38 -
570.39 -public class CharToByteMacRoman extends CharToByteSingleByte {
570.40 -
570.41 - private final static MacRoman nioCoder = new MacRoman();
570.42 -
570.43 - public String getCharacterEncoding() {
570.44 - return "MacRoman";
570.45 - }
570.46 -
570.47 - public CharToByteMacRoman() {
570.48 - super.mask1 = 0xFF00;
570.49 - super.mask2 = 0x00FF;
570.50 - super.shift = 8;
570.51 - super.index1 = nioCoder.getEncoderIndex1();
570.52 - super.index2 = nioCoder.getEncoderIndex2();
570.53 - }
570.54 -}
571.1 --- a/src/share/classes/sun/io/CharToByteMacRomania.java Thu Sep 01 13:54:38 2011 -0700
571.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
571.3 @@ -1,51 +0,0 @@
571.4 -/*
571.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
571.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
571.7 - *
571.8 - * This code is free software; you can redistribute it and/or modify it
571.9 - * under the terms of the GNU General Public License version 2 only, as
571.10 - * published by the Free Software Foundation. Oracle designates this
571.11 - * particular file as subject to the "Classpath" exception as provided
571.12 - * by Oracle in the LICENSE file that accompanied this code.
571.13 - *
571.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
571.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
571.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
571.17 - * version 2 for more details (a copy is included in the LICENSE file that
571.18 - * accompanied this code).
571.19 - *
571.20 - * You should have received a copy of the GNU General Public License version
571.21 - * 2 along with this work; if not, write to the Free Software Foundation,
571.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
571.23 - *
571.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
571.25 - * or visit www.oracle.com if you need additional information or have any
571.26 - * questions.
571.27 - */
571.28 -
571.29 -package sun.io;
571.30 -
571.31 -import sun.nio.cs.ext.MacRomania;
571.32 -
571.33 -/**
571.34 - * Tables and data to convert Unicode to MacRomania
571.35 - *
571.36 - * @author ConverterGenerator tool
571.37 - */
571.38 -
571.39 -public class CharToByteMacRomania extends CharToByteSingleByte {
571.40 -
571.41 - private final static MacRomania nioCoder = new MacRomania();
571.42 -
571.43 - public String getCharacterEncoding() {
571.44 - return "MacRomania";
571.45 - }
571.46 -
571.47 - public CharToByteMacRomania() {
571.48 - super.mask1 = 0xFF00;
571.49 - super.mask2 = 0x00FF;
571.50 - super.shift = 8;
571.51 - super.index1 = nioCoder.getEncoderIndex1();
571.52 - super.index2 = nioCoder.getEncoderIndex2();
571.53 - }
571.54 -}
572.1 --- a/src/share/classes/sun/io/CharToByteMacSymbol.java Thu Sep 01 13:54:38 2011 -0700
572.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
572.3 @@ -1,51 +0,0 @@
572.4 -/*
572.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
572.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
572.7 - *
572.8 - * This code is free software; you can redistribute it and/or modify it
572.9 - * under the terms of the GNU General Public License version 2 only, as
572.10 - * published by the Free Software Foundation. Oracle designates this
572.11 - * particular file as subject to the "Classpath" exception as provided
572.12 - * by Oracle in the LICENSE file that accompanied this code.
572.13 - *
572.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
572.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
572.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
572.17 - * version 2 for more details (a copy is included in the LICENSE file that
572.18 - * accompanied this code).
572.19 - *
572.20 - * You should have received a copy of the GNU General Public License version
572.21 - * 2 along with this work; if not, write to the Free Software Foundation,
572.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
572.23 - *
572.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
572.25 - * or visit www.oracle.com if you need additional information or have any
572.26 - * questions.
572.27 - */
572.28 -
572.29 -package sun.io;
572.30 -
572.31 -import sun.nio.cs.ext.MacSymbol;
572.32 -
572.33 -/**
572.34 - * Tables and data to convert Unicode to MacSymbol
572.35 - *
572.36 - * @author ConverterGenerator tool
572.37 - */
572.38 -
572.39 -public class CharToByteMacSymbol extends CharToByteSingleByte {
572.40 -
572.41 - private final static MacSymbol nioCoder = new MacSymbol();
572.42 -
572.43 - public String getCharacterEncoding() {
572.44 - return "MacSymbol";
572.45 - }
572.46 -
572.47 - public CharToByteMacSymbol() {
572.48 - super.mask1 = 0xFF00;
572.49 - super.mask2 = 0x00FF;
572.50 - super.shift = 8;
572.51 - super.index1 = nioCoder.getEncoderIndex1();
572.52 - super.index2 = nioCoder.getEncoderIndex2();
572.53 - }
572.54 -}
573.1 --- a/src/share/classes/sun/io/CharToByteMacThai.java Thu Sep 01 13:54:38 2011 -0700
573.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
573.3 @@ -1,51 +0,0 @@
573.4 -/*
573.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
573.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
573.7 - *
573.8 - * This code is free software; you can redistribute it and/or modify it
573.9 - * under the terms of the GNU General Public License version 2 only, as
573.10 - * published by the Free Software Foundation. Oracle designates this
573.11 - * particular file as subject to the "Classpath" exception as provided
573.12 - * by Oracle in the LICENSE file that accompanied this code.
573.13 - *
573.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
573.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
573.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
573.17 - * version 2 for more details (a copy is included in the LICENSE file that
573.18 - * accompanied this code).
573.19 - *
573.20 - * You should have received a copy of the GNU General Public License version
573.21 - * 2 along with this work; if not, write to the Free Software Foundation,
573.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
573.23 - *
573.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
573.25 - * or visit www.oracle.com if you need additional information or have any
573.26 - * questions.
573.27 - */
573.28 -
573.29 -package sun.io;
573.30 -
573.31 -import sun.nio.cs.ext.MacThai;
573.32 -
573.33 -/**
573.34 - * Tables and data to convert Unicode to MacThai
573.35 - *
573.36 - * @author ConverterGenerator tool
573.37 - */
573.38 -
573.39 -public class CharToByteMacThai extends CharToByteSingleByte {
573.40 -
573.41 - private final static MacThai nioCoder = new MacThai();
573.42 -
573.43 - public String getCharacterEncoding() {
573.44 - return "MacThai";
573.45 - }
573.46 -
573.47 - public CharToByteMacThai() {
573.48 - super.mask1 = 0xFF00;
573.49 - super.mask2 = 0x00FF;
573.50 - super.shift = 8;
573.51 - super.index1 = nioCoder.getEncoderIndex1();
573.52 - super.index2 = nioCoder.getEncoderIndex2();
573.53 - }
573.54 -}
574.1 --- a/src/share/classes/sun/io/CharToByteMacTurkish.java Thu Sep 01 13:54:38 2011 -0700
574.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
574.3 @@ -1,51 +0,0 @@
574.4 -/*
574.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
574.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
574.7 - *
574.8 - * This code is free software; you can redistribute it and/or modify it
574.9 - * under the terms of the GNU General Public License version 2 only, as
574.10 - * published by the Free Software Foundation. Oracle designates this
574.11 - * particular file as subject to the "Classpath" exception as provided
574.12 - * by Oracle in the LICENSE file that accompanied this code.
574.13 - *
574.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
574.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
574.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
574.17 - * version 2 for more details (a copy is included in the LICENSE file that
574.18 - * accompanied this code).
574.19 - *
574.20 - * You should have received a copy of the GNU General Public License version
574.21 - * 2 along with this work; if not, write to the Free Software Foundation,
574.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
574.23 - *
574.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
574.25 - * or visit www.oracle.com if you need additional information or have any
574.26 - * questions.
574.27 - */
574.28 -
574.29 -package sun.io;
574.30 -
574.31 -import sun.nio.cs.ext.MacTurkish;
574.32 -
574.33 -/**
574.34 - * Tables and data to convert Unicode to MacTurkish
574.35 - *
574.36 - * @author ConverterGenerator tool
574.37 - */
574.38 -
574.39 -public class CharToByteMacTurkish extends CharToByteSingleByte {
574.40 -
574.41 - private final static MacTurkish nioCoder = new MacTurkish();
574.42 -
574.43 - public String getCharacterEncoding() {
574.44 - return "MacTurkish";
574.45 - }
574.46 -
574.47 - public CharToByteMacTurkish() {
574.48 - super.mask1 = 0xFF00;
574.49 - super.mask2 = 0x00FF;
574.50 - super.shift = 8;
574.51 - super.index1 = nioCoder.getEncoderIndex1();
574.52 - super.index2 = nioCoder.getEncoderIndex2();
574.53 - }
574.54 -}
575.1 --- a/src/share/classes/sun/io/CharToByteMacUkraine.java Thu Sep 01 13:54:38 2011 -0700
575.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
575.3 @@ -1,51 +0,0 @@
575.4 -/*
575.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
575.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
575.7 - *
575.8 - * This code is free software; you can redistribute it and/or modify it
575.9 - * under the terms of the GNU General Public License version 2 only, as
575.10 - * published by the Free Software Foundation. Oracle designates this
575.11 - * particular file as subject to the "Classpath" exception as provided
575.12 - * by Oracle in the LICENSE file that accompanied this code.
575.13 - *
575.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
575.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
575.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
575.17 - * version 2 for more details (a copy is included in the LICENSE file that
575.18 - * accompanied this code).
575.19 - *
575.20 - * You should have received a copy of the GNU General Public License version
575.21 - * 2 along with this work; if not, write to the Free Software Foundation,
575.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
575.23 - *
575.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
575.25 - * or visit www.oracle.com if you need additional information or have any
575.26 - * questions.
575.27 - */
575.28 -
575.29 -package sun.io;
575.30 -
575.31 -import sun.nio.cs.ext.MacUkraine;
575.32 -
575.33 -/**
575.34 - * Tables and data to convert Unicode to MacUkraine
575.35 - *
575.36 - * @author ConverterGenerator tool
575.37 - */
575.38 -
575.39 -public class CharToByteMacUkraine extends CharToByteSingleByte {
575.40 -
575.41 - private final static MacUkraine nioCoder = new MacUkraine();
575.42 -
575.43 - public String getCharacterEncoding() {
575.44 - return "MacUkraine";
575.45 - }
575.46 -
575.47 - public CharToByteMacUkraine() {
575.48 - super.mask1 = 0xFF00;
575.49 - super.mask2 = 0x00FF;
575.50 - super.shift = 8;
575.51 - super.index1 = nioCoder.getEncoderIndex1();
575.52 - super.index2 = nioCoder.getEncoderIndex2();
575.53 - }
575.54 -}
576.1 --- a/src/share/classes/sun/io/CharToBytePCK.java Thu Sep 01 13:54:38 2011 -0700
576.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
576.3 @@ -1,96 +0,0 @@
576.4 -/*
576.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
576.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
576.7 - *
576.8 - * This code is free software; you can redistribute it and/or modify it
576.9 - * under the terms of the GNU General Public License version 2 only, as
576.10 - * published by the Free Software Foundation. Oracle designates this
576.11 - * particular file as subject to the "Classpath" exception as provided
576.12 - * by Oracle in the LICENSE file that accompanied this code.
576.13 - *
576.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
576.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
576.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
576.17 - * version 2 for more details (a copy is included in the LICENSE file that
576.18 - * accompanied this code).
576.19 - *
576.20 - * You should have received a copy of the GNU General Public License version
576.21 - * 2 along with this work; if not, write to the Free Software Foundation,
576.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
576.23 - *
576.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
576.25 - * or visit www.oracle.com if you need additional information or have any
576.26 - * questions.
576.27 - */
576.28 -
576.29 -package sun.io;
576.30 -
576.31 -import sun.nio.cs.ext.JIS_X_0208_Solaris_Encoder;
576.32 -
576.33 -/**
576.34 - * @author Limin Shi
576.35 - * @author Mark Son-Bell
576.36 - * @author Ian Little
576.37 - *
576.38 - * PCK char->byte converter for Solaris platform containing additional
576.39 - * mappings for vendor defined chars (NEC row 13 & IBM extension chars)
576.40 - * (bugID 4765370)
576.41 - */
576.42 -public class CharToBytePCK extends CharToByteSJIS {
576.43 - CharToByteJIS0201 cbJIS0201 = new CharToByteJIS0201();
576.44 - short[] j0208Index1 = JIS_X_0208_Solaris_Encoder.getIndex1();
576.45 - String[] j0208Index2 = JIS_X_0208_Solaris_Encoder.getIndex2();
576.46 -
576.47 - public String getCharacterEncoding() {
576.48 - return "PCK";
576.49 - }
576.50 -
576.51 - protected int convSingleByte(char inputChar, byte[] outputByte) {
576.52 - byte b;
576.53 -
576.54 - // \u0000 - \u007F map straight through
576.55 - if ((inputChar & 0xFF80) == 0) {
576.56 - outputByte[0] = (byte)inputChar;
576.57 - return 1;
576.58 - }
576.59 -
576.60 - if ((b = cbJIS0201.getNative(inputChar)) == 0)
576.61 - return 0;
576.62 -
576.63 - outputByte[0] = b;
576.64 - return 1;
576.65 - }
576.66 -
576.67 - protected int getNative(char ch) {
576.68 - int result = 0;
576.69 -
576.70 - switch (ch) {
576.71 - case '\u2015':
576.72 - return 0x815C;
576.73 - case '\u2014':
576.74 - return 0;
576.75 - default:
576.76 - break;
576.77 - }
576.78 -
576.79 - if ((result = super.getNative(ch)) != 0) {
576.80 - return result;
576.81 - } else {
576.82 - int offset = j0208Index1[ch >> 8] << 8;
576.83 - int pos = j0208Index2[offset >> 12].charAt((offset & 0xfff) + (ch & 0xff));
576.84 -
576.85 - if (pos != 0) {
576.86 - /*
576.87 - * This algorithm for converting from JIS to SJIS comes from Ken Lunde's
576.88 - * "Understanding Japanese Information Processing", pg 163.
576.89 - */
576.90 - int c1 = (pos >> 8) & 0xff;
576.91 - int c2 = pos & 0xff;
576.92 - int rowOffset = c1 < 0x5F ? 0x70 : 0xB0;
576.93 - int cellOffset = (c1 % 2 == 1) ? (c2 > 0x5F ? 0x20 : 0x1F) : 0x7E;
576.94 - result = ((((c1 + 1 ) >> 1) + rowOffset) << 8) | (c2 + cellOffset);
576.95 - }
576.96 - }
576.97 - return result;
576.98 - }
576.99 -}
577.1 --- a/src/share/classes/sun/io/CharToByteSJIS.java Thu Sep 01 13:54:38 2011 -0700
577.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
577.3 @@ -1,77 +0,0 @@
577.4 -/*
577.5 - * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
577.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
577.7 - *
577.8 - * This code is free software; you can redistribute it and/or modify it
577.9 - * under the terms of the GNU General Public License version 2 only, as
577.10 - * published by the Free Software Foundation. Oracle designates this
577.11 - * particular file as subject to the "Classpath" exception as provided
577.12 - * by Oracle in the LICENSE file that accompanied this code.
577.13 - *
577.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
577.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
577.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
577.17 - * version 2 for more details (a copy is included in the LICENSE file that
577.18 - * accompanied this code).
577.19 - *
577.20 - * You should have received a copy of the GNU General Public License version
577.21 - * 2 along with this work; if not, write to the Free Software Foundation,
577.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
577.23 - *
577.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
577.25 - * or visit www.oracle.com if you need additional information or have any
577.26 - * questions.
577.27 - */
577.28 -
577.29 -package sun.io;
577.30 -
577.31 -/**
577.32 - * @author Limin Shi
577.33 - * @author Mark Son-Bell
577.34 - */
577.35 -
577.36 -public class CharToByteSJIS extends CharToByteJIS0208 {
577.37 - CharToByteJIS0201 cbJIS0201 = new CharToByteJIS0201();
577.38 -
577.39 - public String getCharacterEncoding() {
577.40 - return "SJIS";
577.41 - }
577.42 -
577.43 - protected int convSingleByte(char inputChar, byte[] outputByte) {
577.44 - byte b;
577.45 -
577.46 - // \u0000 - \u007F map straight through
577.47 - if ((inputChar & 0xFF80) == 0) {
577.48 - outputByte[0] = (byte)inputChar;
577.49 - return 1;
577.50 - }
577.51 -
577.52 - if ((b = cbJIS0201.getNative(inputChar)) == 0)
577.53 - return 0;
577.54 -
577.55 - outputByte[0] = b;
577.56 - return 1;
577.57 - }
577.58 -
577.59 - protected int getNative(char ch) {
577.60 - int offset = index1[ch >> 8] << 8;
577.61 - int pos = index2[offset >> 12].charAt((offset & 0xfff) + (ch & 0xff));
577.62 - if (pos == 0) {
577.63 - /* Zero value indicates this Unicode has no mapping to JIS0208.
577.64 - * We bail here because the JIS -> SJIS algorithm produces
577.65 - * bogus SJIS values for invalid JIS input. Zero should be the
577.66 - * only invalid JIS value in our table.
577.67 - */
577.68 - return 0;
577.69 - }
577.70 - /*
577.71 - * This algorithm for converting from JIS to SJIS comes from Ken Lunde's
577.72 - * "Understanding Japanese Information Processing", pg 163.
577.73 - */
577.74 - int c1 = (pos >> 8) & 0xff;
577.75 - int c2 = pos & 0xff;
577.76 - int rowOffset = c1 < 0x5F ? 0x70 : 0xB0;
577.77 - int cellOffset = (c1 % 2 == 1) ? (c2 > 0x5F ? 0x20 : 0x1F) : 0x7E;
577.78 - return ((((c1 + 1 ) >> 1) + rowOffset) << 8) | (c2 + cellOffset);
577.79 - }
577.80 -}
578.1 --- a/src/share/classes/sun/io/CharToByteSingleByte.java Thu Sep 01 13:54:38 2011 -0700
578.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
578.3 @@ -1,265 +0,0 @@
578.4 -/*
578.5 - * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
578.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
578.7 - *
578.8 - * This code is free software; you can redistribute it and/or modify it
578.9 - * under the terms of the GNU General Public License version 2 only, as
578.10 - * published by the Free Software Foundation. Oracle designates this
578.11 - * particular file as subject to the "Classpath" exception as provided
578.12 - * by Oracle in the LICENSE file that accompanied this code.
578.13 - *
578.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
578.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
578.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
578.17 - * version 2 for more details (a copy is included in the LICENSE file that
578.18 - * accompanied this code).
578.19 - *
578.20 - * You should have received a copy of the GNU General Public License version
578.21 - * 2 along with this work; if not, write to the Free Software Foundation,
578.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
578.23 - *
578.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
578.25 - * or visit www.oracle.com if you need additional information or have any
578.26 - * questions.
578.27 - */
578.28 -
578.29 -package sun.io;
578.30 -
578.31 -import static sun.nio.cs.CharsetMapping.*;
578.32 -
578.33 -/**
578.34 -* A table driven conversion from char to byte for single byte
578.35 -* character sets. Tables will reside in the class CharToByteYYYYY,
578.36 -* where YYYYY is a unique character set identifier
578.37 -
578.38 - < TBD: Tables are of the form... >
578.39 -
578.40 -*
578.41 -* @author Lloyd Honomichl
578.42 -* @author Asmus Freytag
578.43 -* @version 8/28/96
578.44 -*/
578.45 -
578.46 -public abstract class CharToByteSingleByte extends CharToByteConverter {
578.47 -
578.48 - /*
578.49 - * 1st level index, provided by subclass
578.50 - */
578.51 - protected char[] index1;
578.52 -
578.53 - /*
578.54 - * 2nd level index, provided by subclass
578.55 - */
578.56 - protected char[] index2;
578.57 -
578.58 - /*
578.59 - * Mask to isolate bits for 1st level index, from subclass
578.60 - */
578.61 - protected int mask1;
578.62 -
578.63 - /*
578.64 - * Mask to isolate bits for 2nd level index, from subclass
578.65 - */
578.66 - protected int mask2;
578.67 -
578.68 - /*
578.69 - * Shift to isolate bits for 1st level index, from subclass
578.70 - */
578.71 - protected int shift;
578.72 -
578.73 - private char highHalfZoneCode;
578.74 -
578.75 - public char[] getIndex1() {
578.76 - return index1;
578.77 - }
578.78 -
578.79 - public char[] getIndex2() {
578.80 - return index2;
578.81 - }
578.82 - public int flush(byte[] output, int outStart, int outEnd)
578.83 - throws MalformedInputException
578.84 - {
578.85 - if (highHalfZoneCode != 0) {
578.86 - highHalfZoneCode = 0;
578.87 - badInputLength = 0;
578.88 - throw new MalformedInputException();
578.89 - }
578.90 - byteOff = charOff = 0;
578.91 - return 0;
578.92 - }
578.93 -
578.94 - /**
578.95 - * Converts characters to sequences of bytes.
578.96 - * Conversions that result in Exceptions can be restarted by calling
578.97 - * convert again, with appropriately modified parameters.
578.98 - * @return the characters written to output.
578.99 - * @param input char array containing text in Unicode
578.100 - * @param inStart offset in input array
578.101 - * @param inEnd offset of last byte to be converted
578.102 - * @param output byte array to receive conversion result
578.103 - * @param outStart starting offset
578.104 - * @param outEnd offset of last byte to be written to
578.105 - * @throw MalformedInputException for any sequence of chars that is
578.106 - * illegal in Unicode (principally unpaired surrogates
578.107 - * and \uFFFF or \uFFFE), including any partial surrogate pair
578.108 - * which occurs at the end of an input buffer.
578.109 - * @throw UnsupportedCharacterException for any character that
578.110 - * that cannot be converted to the external character set.
578.111 - */
578.112 - public int convert(char[] input, int inOff, int inEnd,
578.113 - byte[] output, int outOff, int outEnd)
578.114 - throws MalformedInputException,
578.115 - UnknownCharacterException,
578.116 - ConversionBufferFullException
578.117 - {
578.118 - char inputChar; // Input character to be converted
578.119 - byte[] outputByte; // Output byte written to output
578.120 - int inputSize; // Size of input
578.121 - int outputSize; // Size of output
578.122 -
578.123 - byte[] tmpArray = new byte[1];
578.124 -
578.125 - // Record beginning offsets
578.126 - charOff = inOff;
578.127 - byteOff = outOff;
578.128 -
578.129 - if (highHalfZoneCode != 0) {
578.130 - inputChar = highHalfZoneCode;
578.131 - highHalfZoneCode = 0;
578.132 - if (input[inOff] >= 0xdc00 && input[inOff] <= 0xdfff) {
578.133 - // This is legal UTF16 sequence.
578.134 - badInputLength = 1;
578.135 - throw new UnknownCharacterException();
578.136 - } else {
578.137 - // This is illegal UTF16 sequence.
578.138 - badInputLength = 0;
578.139 - throw new MalformedInputException();
578.140 - }
578.141 - }
578.142 -
578.143 - // Loop until we hit the end of the input
578.144 - while(charOff < inEnd) {
578.145 -
578.146 - outputByte = tmpArray;
578.147 -
578.148 - // Get the input character
578.149 - inputChar = input[charOff];
578.150 -
578.151 - // Default output size
578.152 - outputSize = 1;
578.153 -
578.154 - // Assume this is a simple character
578.155 - inputSize = 1;
578.156 -
578.157 - // Is this a high surrogate?
578.158 - if(inputChar >= '\uD800' && inputChar <= '\uDBFF') {
578.159 - // Is this the last character in the input?
578.160 - if (charOff + 1 >= inEnd) {
578.161 - highHalfZoneCode = inputChar;
578.162 - break;
578.163 - }
578.164 -
578.165 - // Is there a low surrogate following?
578.166 - inputChar = input[charOff + 1];
578.167 - if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
578.168 - // We have a valid surrogate pair. Too bad we don't map
578.169 - // surrogates. Is substitution enabled?
578.170 - if (subMode) {
578.171 - outputByte = subBytes;
578.172 - outputSize = subBytes.length;
578.173 - inputSize = 2;
578.174 - } else {
578.175 - badInputLength = 2;
578.176 - throw new UnknownCharacterException();
578.177 - }
578.178 - } else {
578.179 - // We have a malformed surrogate pair
578.180 - badInputLength = 1;
578.181 - throw new MalformedInputException();
578.182 - }
578.183 - }
578.184 -
578.185 - // Is this an unaccompanied low surrogate?
578.186 - else if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
578.187 - badInputLength = 1;
578.188 - throw new MalformedInputException();
578.189 - }
578.190 -
578.191 - // Not part of a surrogate, so look it up
578.192 - else {
578.193 - // Get output using two level lookup
578.194 - outputByte[0] = getNative(inputChar);
578.195 -
578.196 - // Might this character be unmappable?
578.197 - if (outputByte[0] == 0) {
578.198 - // If outputByte is zero because the input was zero
578.199 - // then this character is actually mappable
578.200 - if (input[charOff] != '\u0000') {
578.201 - // We have an unmappable character
578.202 - // Is substitution enabled?
578.203 - if (subMode) {
578.204 - outputByte = subBytes;
578.205 - outputSize = subBytes.length;
578.206 - } else {
578.207 - badInputLength = 1;
578.208 - throw new UnknownCharacterException();
578.209 - }
578.210 - }
578.211 - }
578.212 - }
578.213 -
578.214 - // If we don't have room for the output, throw an exception
578.215 - if (byteOff + outputSize > outEnd)
578.216 - throw new ConversionBufferFullException();
578.217 -
578.218 - // Put the byte in the output buffer
578.219 - for (int i = 0; i < outputSize; i++) {
578.220 - output[byteOff++] = outputByte[i];
578.221 - }
578.222 - charOff += inputSize;
578.223 -
578.224 - }
578.225 -
578.226 - // Return the length written to the output buffer
578.227 - return byteOff - outOff;
578.228 - }
578.229 -
578.230 - /**
578.231 - * the maximum number of bytes needed to hold a converted char
578.232 - * @returns the maximum number of bytes needed for a converted char
578.233 - */
578.234 - public int getMaxBytesPerChar() {
578.235 - return 1;
578.236 - }
578.237 -
578.238 - int encodeChar(char ch) {
578.239 - char index = index1[ch >> 8];
578.240 - if (index == UNMAPPABLE_ENCODING)
578.241 - return UNMAPPABLE_ENCODING;
578.242 - return index2[index + (ch & 0xff)];
578.243 - }
578.244 -
578.245 - public byte getNative(char inputChar) {
578.246 - int b = encodeChar(inputChar);
578.247 - if (b == UNMAPPABLE_ENCODING)
578.248 - return 0;
578.249 - return (byte)b;
578.250 - }
578.251 -
578.252 - /**
578.253 - * Resets the converter.
578.254 - * Call this method to reset the converter to its initial state
578.255 - */
578.256 - public void reset() {
578.257 - byteOff = charOff = 0;
578.258 - highHalfZoneCode = 0;
578.259 - }
578.260 -
578.261 - /**
578.262 - * Return whether a character is mappable or not
578.263 - * @return true if a character is mappable
578.264 - */
578.265 - public boolean canConvert(char ch) {
578.266 - return encodeChar(ch) != UNMAPPABLE_ENCODING;
578.267 - }
578.268 -}
579.1 --- a/src/share/classes/sun/io/CharToByteTIS620.java Thu Sep 01 13:54:38 2011 -0700
579.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
579.3 @@ -1,51 +0,0 @@
579.4 -/*
579.5 - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
579.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
579.7 - *
579.8 - * This code is free software; you can redistribute it and/or modify it
579.9 - * under the terms of the GNU General Public License version 2 only, as
579.10 - * published by the Free Software Foundation. Oracle designates this
579.11 - * particular file as subject to the "Classpath" exception as provided
579.12 - * by Oracle in the LICENSE file that accompanied this code.
579.13 - *
579.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
579.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
579.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
579.17 - * version 2 for more details (a copy is included in the LICENSE file that
579.18 - * accompanied this code).
579.19 - *
579.20 - * You should have received a copy of the GNU General Public License version
579.21 - * 2 along with this work; if not, write to the Free Software Foundation,
579.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
579.23 - *
579.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
579.25 - * or visit www.oracle.com if you need additional information or have any
579.26 - * questions.
579.27 - */
579.28 -
579.29 -package sun.io;
579.30 -
579.31 -import sun.nio.cs.ext.TIS_620;
579.32 -
579.33 -/**
579.34 - * Tables and data to convert Unicode to TIS620
579.35 - *
579.36 - * @author ConverterGenerator tool
579.37 - */
579.38 -
579.39 -public class CharToByteTIS620 extends CharToByteSingleByte {
579.40 -
579.41 - private final static TIS_620 nioCoder = new TIS_620();
579.42 -
579.43 - public String getCharacterEncoding() {
579.44 - return "TIS620";
579.45 - }
579.46 -
579.47 - public CharToByteTIS620() {
579.48 - super.mask1 = 0xFF00;
579.49 - super.mask2 = 0x00FF;
579.50 - super.shift = 8;
579.51 - super.index1 = nioCoder.getEncoderIndex1();
579.52 - super.index2 = nioCoder.getEncoderIndex2();
579.53 - }
579.54 -}
580.1 --- a/src/share/classes/sun/io/CharToByteUTF16.java Thu Sep 01 13:54:38 2011 -0700
580.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
580.3 @@ -1,44 +0,0 @@
580.4 -/*
580.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
580.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
580.7 - *
580.8 - * This code is free software; you can redistribute it and/or modify it
580.9 - * under the terms of the GNU General Public License version 2 only, as
580.10 - * published by the Free Software Foundation. Oracle designates this
580.11 - * particular file as subject to the "Classpath" exception as provided
580.12 - * by Oracle in the LICENSE file that accompanied this code.
580.13 - *
580.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
580.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
580.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
580.17 - * version 2 for more details (a copy is included in the LICENSE file that
580.18 - * accompanied this code).
580.19 - *
580.20 - * You should have received a copy of the GNU General Public License version
580.21 - * 2 along with this work; if not, write to the Free Software Foundation,
580.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
580.23 - *
580.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
580.25 - * or visit www.oracle.com if you need additional information or have any
580.26 - * questions.
580.27 - */
580.28 -
580.29 -package sun.io;
580.30 -
580.31 -
580.32 -/**
580.33 - * Convert arrays containing Unicode characters into arrays of bytes, using
580.34 - * big-endian byte order and writing an initial byte-order mark.
580.35 - */
580.36 -
580.37 -public class CharToByteUTF16 extends CharToByteUnicode {
580.38 -
580.39 - public CharToByteUTF16() {
580.40 - super(BIG, true);
580.41 - }
580.42 -
580.43 - public String getCharacterEncoding() {
580.44 - return "UTF-16";
580.45 - }
580.46 -
580.47 -}
581.1 --- a/src/share/classes/sun/io/CharToByteUTF8.java Thu Sep 01 13:54:38 2011 -0700
581.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
581.3 @@ -1,159 +0,0 @@
581.4 -/*
581.5 - * Copyright (c) 1996, 1997, Oracle and/or its affiliates. All rights reserved.
581.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
581.7 - *
581.8 - * This code is free software; you can redistribute it and/or modify it
581.9 - * under the terms of the GNU General Public License version 2 only, as
581.10 - * published by the Free Software Foundation. Oracle designates this
581.11 - * particular file as subject to the "Classpath" exception as provided
581.12 - * by Oracle in the LICENSE file that accompanied this code.
581.13 - *
581.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
581.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
581.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
581.17 - * version 2 for more details (a copy is included in the LICENSE file that
581.18 - * accompanied this code).
581.19 - *
581.20 - * You should have received a copy of the GNU General Public License version
581.21 - * 2 along with this work; if not, write to the Free Software Foundation,
581.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
581.23 - *
581.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
581.25 - * or visit www.oracle.com if you need additional information or have any
581.26 - * questions.
581.27 - */
581.28 -package sun.io;
581.29 -
581.30 -
581.31 -/**
581.32 - * UCS2 (UTF16) -> UCS Transformation Format 8 (UTF-8) converter
581.33 - * It's represented like below.
581.34 - *
581.35 - * # Bits Bit pattern
581.36 - * 1 7 0xxxxxxx
581.37 - * 2 11 110xxxxx 10xxxxxx
581.38 - * 3 16 1110xxxx 10xxxxxx 10xxxxxx
581.39 - * 4 21 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
581.40 - * 5 26 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
581.41 - * 6 31 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
581.42 - *
581.43 - * UCS2 uses 1-3 / UTF16 uses 1-4 / UCS4 uses 1-6
581.44 - */
581.45 -
581.46 -public class CharToByteUTF8 extends CharToByteConverter {
581.47 -
581.48 - private char highHalfZoneCode;
581.49 -
581.50 - public int flush(byte[] output, int outStart, int outEnd)
581.51 - throws MalformedInputException
581.52 - {
581.53 - if (highHalfZoneCode != 0) {
581.54 - highHalfZoneCode = 0;
581.55 - badInputLength = 0;
581.56 - throw new MalformedInputException();
581.57 - }
581.58 - byteOff = charOff = 0;
581.59 - return 0;
581.60 - }
581.61 -
581.62 - /**
581.63 - * Character conversion
581.64 - */
581.65 - public int convert(char[] input, int inOff, int inEnd,
581.66 - byte[] output, int outOff, int outEnd)
581.67 - throws ConversionBufferFullException, MalformedInputException
581.68 - {
581.69 - char inputChar;
581.70 - byte[] outputByte = new byte[6];
581.71 - int inputSize;
581.72 - int outputSize;
581.73 -
581.74 - charOff = inOff;
581.75 - byteOff = outOff;
581.76 -
581.77 - if (highHalfZoneCode != 0) {
581.78 - inputChar = highHalfZoneCode;
581.79 - highHalfZoneCode = 0;
581.80 - if (input[inOff] >= 0xdc00 && input[inOff] <= 0xdfff) {
581.81 - // This is legal UTF16 sequence.
581.82 - int ucs4 = (highHalfZoneCode - 0xd800) * 0x400
581.83 - + (input[inOff] - 0xdc00) + 0x10000;
581.84 - output[0] = (byte)(0xf0 | ((ucs4 >> 18)) & 0x07);
581.85 - output[1] = (byte)(0x80 | ((ucs4 >> 12) & 0x3f));
581.86 - output[2] = (byte)(0x80 | ((ucs4 >> 6) & 0x3f));
581.87 - output[3] = (byte)(0x80 | (ucs4 & 0x3f));
581.88 - charOff++;
581.89 - highHalfZoneCode = 0;
581.90 - } else {
581.91 - // This is illegal UTF16 sequence.
581.92 - badInputLength = 0;
581.93 - throw new MalformedInputException();
581.94 - }
581.95 - }
581.96 -
581.97 - while(charOff < inEnd) {
581.98 - inputChar = input[charOff];
581.99 - if (inputChar < 0x80) {
581.100 - outputByte[0] = (byte)inputChar;
581.101 - inputSize = 1;
581.102 - outputSize = 1;
581.103 - } else if (inputChar < 0x800) {
581.104 - outputByte[0] = (byte)(0xc0 | ((inputChar >> 6) & 0x1f));
581.105 - outputByte[1] = (byte)(0x80 | (inputChar & 0x3f));
581.106 - inputSize = 1;
581.107 - outputSize = 2;
581.108 - } else if (inputChar >= 0xd800 && inputChar <= 0xdbff) {
581.109 - // this is <high-half zone code> in UTF-16
581.110 - if (charOff + 1 >= inEnd) {
581.111 - highHalfZoneCode = inputChar;
581.112 - break;
581.113 - }
581.114 - // check next char is valid <low-half zone code>
581.115 - char lowChar = input[charOff + 1];
581.116 - if (lowChar < 0xdc00 || lowChar > 0xdfff) {
581.117 - badInputLength = 1;
581.118 - throw new MalformedInputException();
581.119 - }
581.120 - int ucs4 = (inputChar - 0xd800) * 0x400 + (lowChar - 0xdc00)
581.121 - + 0x10000;
581.122 - outputByte[0] = (byte)(0xf0 | ((ucs4 >> 18)) & 0x07);
581.123 - outputByte[1] = (byte)(0x80 | ((ucs4 >> 12) & 0x3f));
581.124 - outputByte[2] = (byte)(0x80 | ((ucs4 >> 6) & 0x3f));
581.125 - outputByte[3] = (byte)(0x80 | (ucs4 & 0x3f));
581.126 - outputSize = 4;
581.127 - inputSize = 2;
581.128 - } else {
581.129 - outputByte[0] = (byte)(0xe0 | ((inputChar >> 12)) & 0x0f);
581.130 - outputByte[1] = (byte)(0x80 | ((inputChar >> 6) & 0x3f));
581.131 - outputByte[2] = (byte)(0x80 | (inputChar & 0x3f));
581.132 - inputSize = 1;
581.133 - outputSize = 3;
581.134 - }
581.135 - if (byteOff + outputSize > outEnd) {
581.136 - throw new ConversionBufferFullException();
581.137 - }
581.138 - for (int i = 0; i < outputSize; i++) {
581.139 - output[byteOff++] = outputByte[i];
581.140 - }
581.141 - charOff += inputSize;
581.142 - }
581.143 - return byteOff - outOff;
581.144 - }
581.145 -
581.146 - public boolean canConvert(char ch) {
581.147 - return true;
581.148 - }
581.149 -
581.150 - public int getMaxBytesPerChar() {
581.151 - return 3;
581.152 - }
581.153 -
581.154 - public void reset() {
581.155 - byteOff = charOff = 0;
581.156 - highHalfZoneCode = 0;
581.157 - }
581.158 -
581.159 - public String getCharacterEncoding() {
581.160 - return "UTF8";
581.161 - }
581.162 -}
582.1 --- a/src/share/classes/sun/io/CharToByteUnicode.java Thu Sep 01 13:54:38 2011 -0700
582.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
582.3 @@ -1,153 +0,0 @@
582.4 -/*
582.5 - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
582.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
582.7 - *
582.8 - * This code is free software; you can redistribute it and/or modify it
582.9 - * under the terms of the GNU General Public License version 2 only, as
582.10 - * published by the Free Software Foundation. Oracle designates this
582.11 - * particular file as subject to the "Classpath" exception as provided
582.12 - * by Oracle in the LICENSE file that accompanied this code.
582.13 - *
582.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
582.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
582.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
582.17 - * version 2 for more details (a copy is included in the LICENSE file that
582.18 - * accompanied this code).
582.19 - *
582.20 - * You should have received a copy of the GNU General Public License version
582.21 - * 2 along with this work; if not, write to the Free Software Foundation,
582.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
582.23 - *
582.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
582.25 - * or visit www.oracle.com if you need additional information or have any
582.26 - * questions.
582.27 - */
582.28 -
582.29 -package sun.io;
582.30 -import java.io.*;
582.31 -
582.32 -
582.33 -/**
582.34 - * Convert arrays containing Unicode characters into arrays of bytes, using the
582.35 - * platform-default byte order.
582.36 - *
582.37 - * @author Mark Reinhold
582.38 - */
582.39 -
582.40 -public class CharToByteUnicode extends CharToByteConverter {
582.41 -
582.42 - static final char BYTE_ORDER_MARK = (char) 0xfeff;
582.43 - protected boolean usesMark = true; /* A mark should be written */
582.44 - private boolean markWritten = false; /* A mark has been written */
582.45 -
582.46 - static final int UNKNOWN = 0;
582.47 - static final int BIG = 1;
582.48 - static final int LITTLE = 2;
582.49 - protected int byteOrder = UNKNOWN;
582.50 -
582.51 - public CharToByteUnicode() {
582.52 - String enc = java.security.AccessController.doPrivileged(
582.53 - new sun.security.action.GetPropertyAction("sun.io.unicode.encoding",
582.54 - "UnicodeBig"));
582.55 - if (enc.equals("UnicodeBig"))
582.56 - byteOrder = BIG;
582.57 - else if (enc.equals("UnicodeLittle"))
582.58 - byteOrder = LITTLE;
582.59 - else
582.60 - byteOrder = BIG;
582.61 - }
582.62 -
582.63 - public CharToByteUnicode(int byteOrder, boolean usesMark) {
582.64 - this.byteOrder = byteOrder;
582.65 - this.usesMark = usesMark;
582.66 - }
582.67 -
582.68 - public CharToByteUnicode(boolean usesMark) {
582.69 - this();
582.70 - this.usesMark = usesMark;
582.71 - }
582.72 -
582.73 - public String getCharacterEncoding() {
582.74 - switch (byteOrder) {
582.75 - case BIG:
582.76 - return usesMark ? "UnicodeBig" : "UnicodeBigUnmarked";
582.77 - case LITTLE:
582.78 - return usesMark ? "UnicodeLittle" : "UnicodeLittleUnmarked";
582.79 - default:
582.80 - return "UnicodeUnknown";
582.81 - }
582.82 - }
582.83 -
582.84 - public int convert(char in[], int inOff, int inEnd,
582.85 - byte out[], int outOff, int outEnd)
582.86 - throws ConversionBufferFullException, MalformedInputException
582.87 - {
582.88 - charOff = inOff;
582.89 - byteOff = outOff;
582.90 -
582.91 - if (inOff >= inEnd)
582.92 - return 0;
582.93 -
582.94 - int inI = inOff,
582.95 - outI = outOff,
582.96 - outTop = outEnd - 2;
582.97 -
582.98 - if (usesMark && !markWritten) {
582.99 - if (outI > outTop)
582.100 - throw new ConversionBufferFullException();
582.101 - if (byteOrder == BIG) {
582.102 - out[outI++] = (byte) (BYTE_ORDER_MARK >> 8);
582.103 - out[outI++] = (byte) (BYTE_ORDER_MARK & 0xff);
582.104 - }
582.105 - else {
582.106 - out[outI++] = (byte) (BYTE_ORDER_MARK & 0xff);
582.107 - out[outI++] = (byte) (BYTE_ORDER_MARK >> 8);
582.108 - }
582.109 - markWritten = true;
582.110 - }
582.111 -
582.112 - if (byteOrder == BIG) {
582.113 - while (inI < inEnd) {
582.114 - if (outI > outTop) {
582.115 - charOff = inI;
582.116 - byteOff = outI;
582.117 - throw new ConversionBufferFullException();
582.118 - }
582.119 - char c = in[inI++];
582.120 - out[outI++] = (byte) (c >> 8);
582.121 - out[outI++] = (byte) (c & 0xff);
582.122 - }
582.123 - }
582.124 - else {
582.125 - while (inI < inEnd) {
582.126 - if (outI > outTop) {
582.127 - charOff = inI;
582.128 - byteOff = outI;
582.129 - throw new ConversionBufferFullException();
582.130 - }
582.131 - char c = in[inI++];
582.132 - out[outI++] = (byte) (c & 0xff);
582.133 - out[outI++] = (byte) (c >> 8);
582.134 - }
582.135 - }
582.136 -
582.137 - charOff = inI;
582.138 - byteOff = outI;
582.139 - return outI - outOff;
582.140 - }
582.141 -
582.142 - public int flush(byte in[], int inOff, int inEnd) {
582.143 - byteOff = charOff = 0;
582.144 - return 0;
582.145 - }
582.146 -
582.147 - public void reset () {
582.148 - byteOff = charOff = 0;
582.149 - markWritten = false;
582.150 - }
582.151 -
582.152 - public int getMaxBytesPerChar() {
582.153 - return 4; /* To allow for writing the byte-order mark */
582.154 - }
582.155 -
582.156 -}
583.1 --- a/src/share/classes/sun/io/CharToByteUnicodeBig.java Thu Sep 01 13:54:38 2011 -0700
583.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
583.3 @@ -1,42 +0,0 @@
583.4 -/*
583.5 - * Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved.
583.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
583.7 - *
583.8 - * This code is free software; you can redistribute it and/or modify it
583.9 - * under the terms of the GNU General Public License version 2 only, as
583.10 - * published by the Free Software Foundation. Oracle designates this
583.11 - * particular file as subject to the "Classpath" exception as provided
583.12 - * by Oracle in the LICENSE file that accompanied this code.
583.13 - *
583.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
583.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
583.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
583.17 - * version 2 for more details (a copy is included in the LICENSE file that
583.18 - * accompanied this code).
583.19 - *
583.20 - * You should have received a copy of the GNU General Public License version
583.21 - * 2 along with this work; if not, write to the Free Software Foundation,
583.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
583.23 - *
583.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
583.25 - * or visit www.oracle.com if you need additional information or have any
583.26 - * questions.
583.27 - */
583.28 -
583.29 -package sun.io;
583.30 -
583.31 -
583.32 -/**
583.33 - * Convert arrays containing Unicode characters into arrays of bytes, using
583.34 - * big-endian byte order.
583.35 - *
583.36 - * @author Mark Reinhold
583.37 - */
583.38 -
583.39 -public class CharToByteUnicodeBig extends CharToByteUnicode {
583.40 -
583.41 - public CharToByteUnicodeBig () {
583.42 - byteOrder = BIG;
583.43 - }
583.44 -
583.45 -}
584.1 --- a/src/share/classes/sun/io/CharToByteUnicodeBigUnmarked.java Thu Sep 01 13:54:38 2011 -0700
584.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
584.3 @@ -1,44 +0,0 @@
584.4 -/*
584.5 - * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
584.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
584.7 - *
584.8 - * This code is free software; you can redistribute it and/or modify it
584.9 - * under the terms of the GNU General Public License version 2 only, as
584.10 - * published by the Free Software Foundation. Oracle designates this
584.11 - * particular file as subject to the "Classpath" exception as provided
584.12 - * by Oracle in the LICENSE file that accompanied this code.
584.13 - *
584.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
584.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
584.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
584.17 - * version 2 for more details (a copy is included in the LICENSE file that
584.18 - * accompanied this code).
584.19 - *
584.20 - * You should have received a copy of the GNU General Public License version
584.21 - * 2 along with this work; if not, write to the Free Software Foundation,
584.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
584.23 - *
584.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
584.25 - * or visit www.oracle.com if you need additional information or have any
584.26 - * questions.
584.27 - */
584.28 -
584.29 -package sun.io;
584.30 -
584.31 -
584.32 -/**
584.33 - * Convert arrays containing Unicode characters into arrays of bytes, using
584.34 - * big-endian byte order; do not write a byte-order mark before the first
584.35 - * converted character.
584.36 - *
584.37 - * @author Mark Reinhold
584.38 - */
584.39 -
584.40 -public class CharToByteUnicodeBigUnmarked extends CharToByteUnicode {
584.41 -
584.42 - public CharToByteUnicodeBigUnmarked () {
584.43 - byteOrder = BIG;
584.44 - usesMark = false;
584.45 - }
584.46 -
584.47 -}
585.1 --- a/src/share/classes/sun/io/CharToByteUnicodeLittle.java Thu Sep 01 13:54:38 2011 -0700
585.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
585.3 @@ -1,42 +0,0 @@
585.4 -/*
585.5 - * Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved.
585.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
585.7 - *
585.8 - * This code is free software; you can redistribute it and/or modify it
585.9 - * under the terms of the GNU General Public License version 2 only, as
585.10 - * published by the Free Software Foundation. Oracle designates this
585.11 - * particular file as subject to the "Classpath" exception as provided
585.12 - * by Oracle in the LICENSE file that accompanied this code.
585.13 - *
585.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
585.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
585.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
585.17 - * version 2 for more details (a copy is included in the LICENSE file that
585.18 - * accompanied this code).
585.19 - *
585.20 - * You should have received a copy of the GNU General Public License version
585.21 - * 2 along with this work; if not, write to the Free Software Foundation,
585.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
585.23 - *
585.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
585.25 - * or visit www.oracle.com if you need additional information or have any
585.26 - * questions.
585.27 - */
585.28 -
585.29 -package sun.io;
585.30 -
585.31 -
585.32 -/**
585.33 - * Convert arrays containing Unicode characters into arrays of bytes, using
585.34 - * little-endian byte order.
585.35 - *
585.36 - * @author Mark Reinhold
585.37 - */
585.38 -
585.39 -public class CharToByteUnicodeLittle extends CharToByteUnicode {
585.40 -
585.41 - public CharToByteUnicodeLittle () {
585.42 - byteOrder = LITTLE;
585.43 - }
585.44 -
585.45 -}
586.1 --- a/src/share/classes/sun/io/CharToByteUnicodeLittleUnmarked.java Thu Sep 01 13:54:38 2011 -0700
586.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
586.3 @@ -1,44 +0,0 @@
586.4 -/*
586.5 - * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
586.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
586.7 - *
586.8 - * This code is free software; you can redistribute it and/or modify it
586.9 - * under the terms of the GNU General Public License version 2 only, as
586.10 - * published by the Free Software Foundation. Oracle designates this
586.11 - * particular file as subject to the "Classpath" exception as provided
586.12 - * by Oracle in the LICENSE file that accompanied this code.
586.13 - *
586.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
586.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
586.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
586.17 - * version 2 for more details (a copy is included in the LICENSE file that
586.18 - * accompanied this code).
586.19 - *
586.20 - * You should have received a copy of the GNU General Public License version
586.21 - * 2 along with this work; if not, write to the Free Software Foundation,
586.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
586.23 - *
586.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
586.25 - * or visit www.oracle.com if you need additional information or have any
586.26 - * questions.
586.27 - */
586.28 -
586.29 -package sun.io;
586.30 -
586.31 -
586.32 -/**
586.33 - * Convert arrays containing Unicode characters into arrays of bytes, using
586.34 - * little-endian byte order; do not write a byte-order mark before the first
586.35 - * converted character.
586.36 - *
586.37 - * @author Mark Reinhold
586.38 - */
586.39 -
586.40 -public class CharToByteUnicodeLittleUnmarked extends CharToByteUnicode {
586.41 -
586.42 - public CharToByteUnicodeLittleUnmarked () {
586.43 - byteOrder = LITTLE;
586.44 - usesMark = false;
586.45 - }
586.46 -
586.47 -}
587.1 --- a/src/share/classes/sun/io/CharacterEncoding.java Thu Sep 01 13:54:38 2011 -0700
587.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
587.3 @@ -1,900 +0,0 @@
587.4 -/*
587.5 - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
587.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
587.7 - *
587.8 - * This code is free software; you can redistribute it and/or modify it
587.9 - * under the terms of the GNU General Public License version 2 only, as
587.10 - * published by the Free Software Foundation. Oracle designates this
587.11 - * particular file as subject to the "Classpath" exception as provided
587.12 - * by Oracle in the LICENSE file that accompanied this code.
587.13 - *
587.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
587.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
587.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
587.17 - * version 2 for more details (a copy is included in the LICENSE file that
587.18 - * accompanied this code).
587.19 - *
587.20 - * You should have received a copy of the GNU General Public License version
587.21 - * 2 along with this work; if not, write to the Free Software Foundation,
587.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
587.23 - *
587.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
587.25 - * or visit www.oracle.com if you need additional information or have any
587.26 - * questions.
587.27 - */
587.28 -
587.29 -package sun.io;
587.30 -
587.31 -import java.util.Collections;
587.32 -import java.util.Iterator;
587.33 -import java.util.HashMap;
587.34 -import java.util.Locale;
587.35 -import java.util.Map;
587.36 -import java.security.AccessController;
587.37 -import java.security.PrivilegedAction;
587.38 -import sun.security.action.GetPropertyAction;
587.39 -
587.40 -/*
587.41 - * This class is public in sun.io, so other sun.* packages (such as
587.42 - * HotJava) can use it, without exposing it to java.*.
587.43 - * Translates IANA encoding name to the string which is the part of
587.44 - * converter class.
587.45 - */
587.46 -
587.47 -/**
587.48 - * @deprecated Replaced by {@link java.nio.charset}. THIS API WILL BE
587.49 - * REMOVED IN J2SE 1.6.
587.50 - */
587.51 -@Deprecated
587.52 -public class CharacterEncoding {
587.53 -
587.54 - private static boolean sjisIsMS932;
587.55 -
587.56 - private static Map<String,String> aliasTable;
587.57 - private static volatile boolean installedAll;
587.58 -
587.59 - static {
587.60 - aliasTable = new HashMap<>(460, 1.0f); /* MDA */
587.61 -
587.62 - aliasTable.put("us-ascii", "ASCII");
587.63 - aliasTable.put("ascii", "ASCII");
587.64 - aliasTable.put("646", "ASCII"); // Solaris POSIX locale
587.65 - aliasTable.put("iso_646.irv:1983", "ASCII"); // Linux POSIX locale
587.66 - aliasTable.put("ansi_x3.4-1968", "ASCII"); // Caldera linux
587.67 - aliasTable.put("iso646-us", "ASCII");
587.68 - aliasTable.put("default", "ASCII"); // compatibility with obsolete "Default" converters
587.69 - aliasTable.put("ascii7", "ASCII"); // compatibility with obsolete "Default" converters
587.70 -
587.71 - // Core encodings
587.72 - aliasTable.put("8859_1", "ISO8859_1");
587.73 - aliasTable.put("iso8859_1", "ISO8859_1");
587.74 - aliasTable.put("utf-8", "UTF8");
587.75 - aliasTable.put("utf8", "UTF8");
587.76 - aliasTable.put("utf-16le", "UnicodeLittleUnmarked");
587.77 -
587.78 - // Standard encodings used on Solaris and Linux
587.79 - aliasTable.put("iso8859-1", "ISO8859_1");
587.80 - aliasTable.put("iso8859-2", "ISO8859_2");
587.81 - aliasTable.put("iso8859-4", "ISO8859_4");
587.82 - aliasTable.put("iso8859-5", "ISO8859_5");
587.83 - aliasTable.put("iso8859-6", "ISO8859_6");
587.84 - aliasTable.put("iso8859-8", "ISO8859_8");
587.85 - aliasTable.put("iso8859-9", "ISO8859_9");
587.86 - aliasTable.put("iso8859-13", "ISO8859_13");
587.87 - aliasTable.put("iso8859-15", "ISO8859_15");
587.88 - aliasTable.put("5601", "EUC_KR");
587.89 - aliasTable.put("ansi-1251", "Cp1251");
587.90 - aliasTable.put("big5", "Big5");
587.91 - aliasTable.put("big5hk", "Big5_HKSCS");
587.92 - aliasTable.put("eucjp", "EUC_JP");
587.93 - aliasTable.put("cns11643", "EUC_TW");
587.94 - aliasTable.put("gb2312", "EUC_CN");
587.95 - aliasTable.put("gb18030", "GB18030");
587.96 - aliasTable.put("gbk", "GBK");
587.97 - aliasTable.put("koi8-r", "KOI8_R");
587.98 - aliasTable.put("tis620.2533", "TIS620");
587.99 -
587.100 - // Windows encodings
587.101 - aliasTable.put("cp1250", "Cp1250");
587.102 - aliasTable.put("cp1251", "Cp1251");
587.103 - aliasTable.put("cp1252", "Cp1252");
587.104 - aliasTable.put("cp1253", "Cp1253");
587.105 - aliasTable.put("cp1254", "Cp1254");
587.106 - aliasTable.put("cp1255", "Cp1255");
587.107 - aliasTable.put("cp1256", "Cp1256");
587.108 - aliasTable.put("cp1257", "Cp1257");
587.109 - aliasTable.put("cp1258", "Cp1258");
587.110 - aliasTable.put("ms874", "MS874");
587.111 - aliasTable.put("ms932", "MS932");
587.112 - aliasTable.put("ms949", "MS949");
587.113 - aliasTable.put("ms950", "MS950");
587.114 - aliasTable.put("ms1361", "MS1361");
587.115 - }
587.116 -
587.117 - public static String aliasName(String name){
587.118 -
587.119 - if (name.startsWith("\1")) {
587.120 - // Emergency access to old converters
587.121 - name = name.substring(1);
587.122 - }
587.123 - // need to use Locale.US so we can load ISO converters in tr_TR locale
587.124 - String lower = name.toLowerCase(Locale.US);
587.125 - String val = aliasTable.get(lower);
587.126 -
587.127 - if (val == null && !installedAll) {
587.128 - installAll();
587.129 - val = aliasTable.get(lower);
587.130 - }
587.131 - return val;
587.132 - }
587.133 -
587.134 - private static synchronized void installAll() {
587.135 - if (!installedAll) {
587.136 - GetPropertyAction a = new GetPropertyAction("sun.nio.cs.map");
587.137 - String map = AccessController.doPrivileged(a);
587.138 - if (map != null) {
587.139 - sjisIsMS932 = map.equalsIgnoreCase("Windows-31J/Shift_JIS");
587.140 - } else {
587.141 - sjisIsMS932 = false;
587.142 - }
587.143 -
587.144 - // MIBenum: 4
587.145 - aliasTable.put("8859_1", "ISO8859_1");
587.146 - aliasTable.put("iso_8859-1:1987", "ISO8859_1");
587.147 - aliasTable.put("iso-ir-100", "ISO8859_1");
587.148 - aliasTable.put("iso_8859-1", "ISO8859_1");
587.149 - aliasTable.put("iso-8859-1", "ISO8859_1");
587.150 - aliasTable.put("iso8859-1", "ISO8859_1");
587.151 - aliasTable.put("latin1", "ISO8859_1");
587.152 - aliasTable.put("l1", "ISO8859_1");
587.153 - aliasTable.put("ibm819", "ISO8859_1");
587.154 - aliasTable.put("ibm-819", "ISO8859_1");
587.155 - aliasTable.put("cp819", "ISO8859_1");
587.156 - aliasTable.put("819", "ISO8859_1");
587.157 - aliasTable.put("csisolatin1", "ISO8859_1");
587.158 -
587.159 - // MIBenum: 5
587.160 - aliasTable.put("8859_2", "ISO8859_2");
587.161 - aliasTable.put("iso_8859-2:1987", "ISO8859_2");
587.162 - aliasTable.put("iso-ir-101", "ISO8859_2");
587.163 - aliasTable.put("iso_8859-2", "ISO8859_2");
587.164 - aliasTable.put("iso-8859-2", "ISO8859_2");
587.165 - aliasTable.put("iso8859-2", "ISO8859_2");
587.166 - aliasTable.put("latin2", "ISO8859_2");
587.167 - aliasTable.put("l2", "ISO8859_2");
587.168 - aliasTable.put("ibm912", "ISO8859_2");
587.169 - aliasTable.put("ibm-912", "ISO8859_2");
587.170 - aliasTable.put("cp912", "ISO8859_2");
587.171 - aliasTable.put("912", "ISO8859_2");
587.172 - aliasTable.put("csisolatin2", "ISO8859_2");
587.173 -
587.174 - // MIBenum: 6
587.175 - aliasTable.put("8859_3", "ISO8859_3");
587.176 - aliasTable.put("iso_8859-3:1988", "ISO8859_3");
587.177 - aliasTable.put("iso-ir-109", "ISO8859_3");
587.178 - aliasTable.put("iso_8859-3", "ISO8859_3");
587.179 - aliasTable.put("iso-8859-3", "ISO8859_3");
587.180 - aliasTable.put("iso8859-3", "ISO8859_3");
587.181 - aliasTable.put("latin3", "ISO8859_3");
587.182 - aliasTable.put("l3", "ISO8859_3");
587.183 - aliasTable.put("ibm913", "ISO8859_3");
587.184 - aliasTable.put("ibm-913", "ISO8859_3");
587.185 - aliasTable.put("cp913", "ISO8859_3");
587.186 - aliasTable.put("913", "ISO8859_3");
587.187 - aliasTable.put("csisolatin3", "ISO8859_3");
587.188 -
587.189 - // MIBenum: 7
587.190 - aliasTable.put("8859_4", "ISO8859_4");
587.191 - aliasTable.put("iso_8859-4:1988", "ISO8859_4");
587.192 - aliasTable.put("iso-ir-110", "ISO8859_4");
587.193 - aliasTable.put("iso_8859-4", "ISO8859_4");
587.194 - aliasTable.put("iso-8859-4", "ISO8859_4");
587.195 - aliasTable.put("iso8859-4", "ISO8859_4");
587.196 - aliasTable.put("latin4", "ISO8859_4");
587.197 - aliasTable.put("l4", "ISO8859_4");
587.198 - aliasTable.put("ibm914", "ISO8859_4");
587.199 - aliasTable.put("ibm-914", "ISO8859_4");
587.200 - aliasTable.put("cp914", "ISO8859_4");
587.201 - aliasTable.put("914", "ISO8859_4");
587.202 - aliasTable.put("csisolatin4", "ISO8859_4");
587.203 -
587.204 - // MIBenum: 8
587.205 - aliasTable.put("8859_5", "ISO8859_5");
587.206 - aliasTable.put("iso_8859-5:1988", "ISO8859_5");
587.207 - aliasTable.put("iso-ir-144", "ISO8859_5");
587.208 - aliasTable.put("iso_8859-5", "ISO8859_5");
587.209 - aliasTable.put("iso-8859-5", "ISO8859_5");
587.210 - aliasTable.put("iso8859-5", "ISO8859_5");
587.211 - aliasTable.put("cyrillic", "ISO8859_5");
587.212 - aliasTable.put("csisolatincyrillic", "ISO8859_5");
587.213 - aliasTable.put("ibm915", "ISO8859_5");
587.214 - aliasTable.put("ibm-915", "ISO8859_5");
587.215 - aliasTable.put("cp915", "ISO8859_5");
587.216 - aliasTable.put("915", "ISO8859_5");
587.217 -
587.218 - // MIBenum: 9
587.219 - aliasTable.put("8859_6", "ISO8859_6");
587.220 - aliasTable.put("iso_8859-6:1987", "ISO8859_6");
587.221 - aliasTable.put("iso-ir-127", "ISO8859_6");
587.222 - aliasTable.put("iso_8859-6", "ISO8859_6");
587.223 - aliasTable.put("iso-8859-6", "ISO8859_6");
587.224 - aliasTable.put("iso8859-6", "ISO8859_6");
587.225 - aliasTable.put("ecma-114", "ISO8859_6");
587.226 - aliasTable.put("asmo-708", "ISO8859_6");
587.227 - aliasTable.put("arabic", "ISO8859_6");
587.228 - aliasTable.put("csisolatinarabic", "ISO8859_6");
587.229 - aliasTable.put("ibm1089", "ISO8859_6");
587.230 - aliasTable.put("ibm-1089", "ISO8859_6");
587.231 - aliasTable.put("cp1089", "ISO8859_6");
587.232 - aliasTable.put("1089", "ISO8859_6");
587.233 -
587.234 - // MIBenum: 10
587.235 - aliasTable.put("8859_7", "ISO8859_7");
587.236 - aliasTable.put("iso_8859-7:1987", "ISO8859_7");
587.237 - aliasTable.put("iso-ir-126", "ISO8859_7");
587.238 - aliasTable.put("iso_8859-7", "ISO8859_7");
587.239 - aliasTable.put("iso-8859-7", "ISO8859_7");
587.240 - aliasTable.put("iso8859-7", "ISO8859_7");
587.241 - aliasTable.put("elot_928", "ISO8859_7");
587.242 - aliasTable.put("ecma-118", "ISO8859_7");
587.243 - aliasTable.put("greek", "ISO8859_7");
587.244 - aliasTable.put("greek8", "ISO8859_7");
587.245 - aliasTable.put("csisolatingreek", "ISO8859_7");
587.246 - aliasTable.put("ibm813", "ISO8859_7");
587.247 - aliasTable.put("ibm-813", "ISO8859_7");
587.248 - aliasTable.put("cp813", "ISO8859_7");
587.249 - aliasTable.put("813", "ISO8859_7");
587.250 - aliasTable.put("sun_eu_greek", "ISO8859_7");
587.251 -
587.252 - // MIBenum: 11
587.253 - aliasTable.put("8859_8", "ISO8859_8");
587.254 - aliasTable.put("iso_8859-8:1988", "ISO8859_8");
587.255 - aliasTable.put("iso-ir-138", "ISO8859_8");
587.256 - aliasTable.put("iso_8859-8", "ISO8859_8");
587.257 - aliasTable.put("iso-8859-8", "ISO8859_8");
587.258 - aliasTable.put("iso8859-8", "ISO8859_8");
587.259 - aliasTable.put("hebrew", "ISO8859_8");
587.260 - aliasTable.put("csisolatinhebrew", "ISO8859_8");
587.261 - aliasTable.put("ibm916", "ISO8859_8");
587.262 - aliasTable.put("ibm-916", "ISO8859_8");
587.263 - aliasTable.put("cp916", "ISO8859_8");
587.264 - aliasTable.put("916", "ISO8859_8");
587.265 -
587.266 - // MIBenum: 12
587.267 - aliasTable.put("8859_9", "ISO8859_9");
587.268 - aliasTable.put("iso-ir-148", "ISO8859_9");
587.269 - aliasTable.put("iso_8859-9", "ISO8859_9");
587.270 - aliasTable.put("iso-8859-9", "ISO8859_9");
587.271 - aliasTable.put("iso8859-9", "ISO8859_9");
587.272 - aliasTable.put("latin5", "ISO8859_9");
587.273 - aliasTable.put("l5", "ISO8859_9");
587.274 - aliasTable.put("ibm920", "ISO8859_9");
587.275 - aliasTable.put("ibm-920", "ISO8859_9");
587.276 - aliasTable.put("cp920", "ISO8859_9");
587.277 - aliasTable.put("920", "ISO8859_9");
587.278 - aliasTable.put("csisolatin5", "ISO8859_9");
587.279 -
587.280 - // MIBenum: ???
587.281 - aliasTable.put("8859_13", "ISO8859_13");
587.282 - aliasTable.put("iso_8859-13", "ISO8859_13");
587.283 - aliasTable.put("iso-8859-13", "ISO8859_13");
587.284 - aliasTable.put("iso8859-13", "ISO8859_13");
587.285 -
587.286 -
587.287 - // MIBenum: ????
587.288 - aliasTable.put("8859_15", "ISO8859_15");
587.289 - aliasTable.put("iso-8859-15", "ISO8859_15");
587.290 - aliasTable.put("iso_8859-15", "ISO8859_15");
587.291 - aliasTable.put("iso8859-15", "ISO8859_15");
587.292 - aliasTable.put("ibm923", "ISO8859_15");
587.293 - aliasTable.put("ibm-923", "ISO8859_15");
587.294 - aliasTable.put("cp923", "ISO8859_15");
587.295 - aliasTable.put("923", "ISO8859_15");
587.296 - aliasTable.put("latin0", "ISO8859_15");
587.297 - aliasTable.put("latin9", "ISO8859_15");
587.298 - aliasTable.put("csisolatin0", "ISO8859_15");
587.299 - aliasTable.put("csisolatin9", "ISO8859_15");
587.300 -
587.301 - //For compatibility purpose
587.302 - aliasTable.put("iso8859_15_fdis", "ISO8859_15");
587.303 -
587.304 - // MIBenum: 106
587.305 - aliasTable.put("utf-8", "UTF8");
587.306 -
587.307 - // Alias recommended in RFC 1641
587.308 - aliasTable.put("unicode-1-1-utf-8", "UTF8");
587.309 -
587.310 - // MIBenum: 1010
587.311 - aliasTable.put("unicode-1-1", "UnicodeBigUnmarked");
587.312 -
587.313 - // MIBenum: 1000
587.314 - aliasTable.put("iso-10646-ucs-2", "UnicodeBigUnmarked");
587.315 -
587.316 - // Per Unicode standard
587.317 - aliasTable.put("utf-16be", "UnicodeBigUnmarked");
587.318 - aliasTable.put("utf-16le", "UnicodeLittleUnmarked");
587.319 - aliasTable.put("utf-16", "UTF16");
587.320 -
587.321 - // Used by drag-and-drop subsystem
587.322 - aliasTable.put("x-utf-16be", "UnicodeBigUnmarked");
587.323 - aliasTable.put("x-utf-16le", "UnicodeLittleUnmarked");
587.324 -
587.325 - aliasTable.put("unicode", "Unicode");
587.326 -
587.327 - // MIBenum: ????
587.328 - aliasTable.put("ibm037", "Cp037");
587.329 - aliasTable.put("ibm-037", "Cp037");
587.330 - aliasTable.put("cp037", "Cp037");
587.331 - aliasTable.put("037", "Cp037");
587.332 -
587.333 - // MIBenum: ????
587.334 - aliasTable.put("ibm273", "Cp273");
587.335 - aliasTable.put("ibm-273", "Cp273");
587.336 - aliasTable.put("cp273", "Cp273");
587.337 - aliasTable.put("273", "Cp273");
587.338 -
587.339 - // MIBenum: ????
587.340 - aliasTable.put("ibm277", "Cp277");
587.341 - aliasTable.put("ibm-277", "Cp277");
587.342 - aliasTable.put("cp277", "Cp277");
587.343 - aliasTable.put("277", "Cp277");
587.344 -
587.345 - // MIBenum: ????
587.346 - aliasTable.put("ibm278", "Cp278");
587.347 - aliasTable.put("ibm-278", "Cp278");
587.348 - aliasTable.put("cp278", "Cp278");
587.349 - aliasTable.put("278", "Cp278");
587.350 -
587.351 - // MIBenum: ????
587.352 - aliasTable.put("ibm280", "Cp280");
587.353 - aliasTable.put("ibm-280", "Cp280");
587.354 - aliasTable.put("cp280", "Cp280");
587.355 - aliasTable.put("280", "Cp280");
587.356 -
587.357 - // MIBenum: ????
587.358 - aliasTable.put("ibm284", "Cp284");
587.359 - aliasTable.put("ibm-284", "Cp284");
587.360 - aliasTable.put("cp284", "Cp284");
587.361 - aliasTable.put("284", "Cp284");
587.362 -
587.363 - // MIBenum: ????
587.364 - aliasTable.put("ibm285", "Cp285");
587.365 - aliasTable.put("ibm-285", "Cp285");
587.366 - aliasTable.put("cp285", "Cp285");
587.367 - aliasTable.put("285", "Cp285");
587.368 -
587.369 - // MIBenum: ????
587.370 - aliasTable.put("ibm297", "Cp297");
587.371 - aliasTable.put("ibm-297", "Cp297");
587.372 - aliasTable.put("cp297", "Cp297");
587.373 - aliasTable.put("297", "Cp297");
587.374 -
587.375 - // MIBenum: ????
587.376 - aliasTable.put("ibm420", "Cp420");
587.377 - aliasTable.put("ibm-420", "Cp420");
587.378 - aliasTable.put("cp420", "Cp420");
587.379 - aliasTable.put("420", "Cp420");
587.380 -
587.381 - // MIBenum: ????
587.382 - aliasTable.put("ibm424", "Cp424");
587.383 - aliasTable.put("ibm-424", "Cp424");
587.384 - aliasTable.put("cp424", "Cp424");
587.385 - aliasTable.put("424", "Cp424");
587.386 -
587.387 - // MIBenum: 2011
587.388 - aliasTable.put("ibm437", "Cp437");
587.389 - aliasTable.put("ibm-437", "Cp437");
587.390 - aliasTable.put("cp437", "Cp437");
587.391 - aliasTable.put("437", "Cp437");
587.392 - aliasTable.put("cspc8codepage437", "Cp437");
587.393 -
587.394 - // MIBenum: ????
587.395 - aliasTable.put("ibm500", "Cp500");
587.396 - aliasTable.put("ibm-500", "Cp500");
587.397 - aliasTable.put("cp500", "Cp500");
587.398 - aliasTable.put("500", "Cp500");
587.399 -
587.400 - // MIBenum: ????
587.401 - aliasTable.put("ibm737", "Cp737");
587.402 - aliasTable.put("ibm-737", "Cp737");
587.403 - aliasTable.put("cp737", "Cp737");
587.404 - aliasTable.put("737", "Cp737");
587.405 -
587.406 - // MIBenum: ????
587.407 - aliasTable.put("ibm775", "Cp775");
587.408 - aliasTable.put("ibm-775", "Cp775");
587.409 - aliasTable.put("cp775", "Cp775");
587.410 - aliasTable.put("775", "Cp775");
587.411 -
587.412 - aliasTable.put("ibm833", "Cp833");
587.413 - aliasTable.put("ibm-833", "Cp833");
587.414 - aliasTable.put("cp833", "Cp833");
587.415 - aliasTable.put("833", "Cp833");
587.416 -
587.417 - aliasTable.put("ibm834", "Cp834");
587.418 - aliasTable.put("ibm-834", "Cp834");
587.419 - aliasTable.put("cp834", "Cp834");
587.420 - aliasTable.put("834", "Cp834");
587.421 -
587.422 - // MIBenum: ????
587.423 - aliasTable.put("ibm838", "Cp838"); /* MDA */
587.424 - aliasTable.put("ibm-838", "Cp838"); /* MDA */
587.425 - aliasTable.put("cp838", "Cp838"); /* MDA */
587.426 - aliasTable.put("838", "Cp838"); /* MDA */
587.427 -
587.428 - // "Cp850"
587.429 - // MIBenum: 2009
587.430 - aliasTable.put("ibm850", "Cp850");
587.431 - aliasTable.put("ibm-850", "Cp850");
587.432 - aliasTable.put("cp850", "Cp850");
587.433 - aliasTable.put("850", "Cp850");
587.434 - aliasTable.put("cspc850multilingual", "Cp850");
587.435 -
587.436 - // "Cp852"
587.437 - // MIBenum: 2010
587.438 - aliasTable.put("ibm852", "Cp852");
587.439 - aliasTable.put("ibm-852", "Cp852");
587.440 - aliasTable.put("cp852", "Cp852");
587.441 - aliasTable.put("852", "Cp852");
587.442 - aliasTable.put("cspcp852", "Cp852");
587.443 -
587.444 - // "Cp855"
587.445 - // MIBenum: 2046
587.446 - aliasTable.put("ibm855", "Cp855");
587.447 - aliasTable.put("ibm-855", "Cp855");
587.448 - aliasTable.put("cp855", "Cp855");
587.449 - aliasTable.put("855", "Cp855");
587.450 - aliasTable.put("cspcp855", "Cp855");
587.451 -
587.452 - // "Cp855"
587.453 - // MIBenum: ???
587.454 - aliasTable.put("ibm856", "Cp856");
587.455 - aliasTable.put("ibm-856", "Cp856");
587.456 - aliasTable.put("cp856", "Cp856");
587.457 - aliasTable.put("856", "Cp856");
587.458 -
587.459 - // "Cp857"
587.460 - // MIBenum: 2047
587.461 - aliasTable.put("ibm857", "Cp857");
587.462 - aliasTable.put("ibm-857", "Cp857");
587.463 - aliasTable.put("cp857", "Cp857");
587.464 - aliasTable.put("857", "Cp857");
587.465 - aliasTable.put("csibm857", "Cp857");
587.466 -
587.467 - // "Cp860"
587.468 - // MIBenum: 2048
587.469 - aliasTable.put("ibm860", "Cp860");
587.470 - aliasTable.put("ibm-860", "Cp860");
587.471 - aliasTable.put("cp860", "Cp860");
587.472 - aliasTable.put("860", "Cp860");
587.473 - aliasTable.put("csibm860", "Cp860");
587.474 -
587.475 - // MIBenum: 2049
587.476 - aliasTable.put("ibm861", "Cp861");
587.477 - aliasTable.put("ibm-861", "Cp861");
587.478 - aliasTable.put("cp861", "Cp861");
587.479 - aliasTable.put("cp-is", "Cp861");
587.480 - aliasTable.put("861", "Cp861");
587.481 - aliasTable.put("csibm861", "Cp861");
587.482 -
587.483 - // MIBenum: 2013
587.484 - aliasTable.put("ibm862", "Cp862");
587.485 - aliasTable.put("ibm-862", "Cp862");
587.486 - aliasTable.put("cp862", "Cp862");
587.487 - aliasTable.put("862", "Cp862");
587.488 - aliasTable.put("cspc862latinhebrew", "Cp862");
587.489 -
587.490 - // MIBenum: 2050
587.491 - aliasTable.put("ibm863", "Cp863");
587.492 - aliasTable.put("ibm-863", "Cp863");
587.493 - aliasTable.put("cp863", "Cp863");
587.494 - aliasTable.put("863", "Cp863");
587.495 - aliasTable.put("csibm863", "Cp863");
587.496 -
587.497 - // MIBenum: 2051
587.498 - aliasTable.put("ibm864", "Cp864");
587.499 - aliasTable.put("ibm-864", "Cp864");
587.500 - aliasTable.put("cp864", "Cp864");
587.501 - aliasTable.put("csibm864", "Cp864");
587.502 -
587.503 - // MIBenum: 2052
587.504 - aliasTable.put("ibm865", "Cp865");
587.505 - aliasTable.put("ibm-865", "Cp865");
587.506 - aliasTable.put("cp865", "Cp865");
587.507 - aliasTable.put("865", "Cp865");
587.508 - aliasTable.put("csibm865", "Cp865");
587.509 -
587.510 - // MIBenum: ????
587.511 - aliasTable.put("ibm866", "Cp866");
587.512 - aliasTable.put("ibm-866", "Cp866");
587.513 - aliasTable.put("cp866", "Cp866");
587.514 - aliasTable.put("866", "Cp866");
587.515 - aliasTable.put("csibm866", "Cp866");
587.516 -
587.517 - // MIBenum: ????
587.518 - aliasTable.put("ibm868", "Cp868");
587.519 - aliasTable.put("ibm-868", "Cp868");
587.520 - aliasTable.put("cp868", "Cp868");
587.521 - aliasTable.put("868", "Cp868");
587.522 -
587.523 - // MIBenum: 2054
587.524 - aliasTable.put("ibm869", "Cp869");
587.525 - aliasTable.put("ibm-869", "Cp869");
587.526 - aliasTable.put("cp869", "Cp869");
587.527 - aliasTable.put("869", "Cp869");
587.528 - aliasTable.put("cp-gr", "Cp869");
587.529 - aliasTable.put("csibm869", "Cp869");
587.530 -
587.531 - // MIBenum: ????
587.532 - aliasTable.put("ibm870", "Cp870");
587.533 - aliasTable.put("ibm-870", "Cp870");
587.534 - aliasTable.put("cp870", "Cp870");
587.535 - aliasTable.put("870", "Cp870");
587.536 -
587.537 - // MIBenum: ????
587.538 - aliasTable.put("ibm871", "Cp871");
587.539 - aliasTable.put("ibm-871", "Cp871");
587.540 - aliasTable.put("cp871", "Cp871");
587.541 - aliasTable.put("871", "Cp871");
587.542 -
587.543 - // MIBenum: ????
587.544 - aliasTable.put("ibm874", "Cp874");
587.545 - aliasTable.put("ibm-874", "Cp874");
587.546 - aliasTable.put("cp874", "Cp874");
587.547 - aliasTable.put("874", "Cp874");
587.548 -
587.549 - // MIBenum: ????
587.550 - aliasTable.put("ibm875", "Cp875");
587.551 - aliasTable.put("ibm-875", "Cp875");
587.552 - aliasTable.put("cp875", "Cp875");
587.553 - aliasTable.put("875", "Cp875");
587.554 -
587.555 - // MIBenum: ????
587.556 - aliasTable.put("ibm918", "Cp918");
587.557 - aliasTable.put("ibm-918", "Cp918");
587.558 - aliasTable.put("cp918", "Cp918");
587.559 - aliasTable.put("918", "Cp918");
587.560 -
587.561 - // MIBenum: ????
587.562 - aliasTable.put("ibm921", "Cp921");
587.563 - aliasTable.put("ibm-921", "Cp921");
587.564 - aliasTable.put("cp921", "Cp921");
587.565 - aliasTable.put("921", "Cp921");
587.566 -
587.567 - // MIBenum: ????
587.568 - aliasTable.put("ibm922", "Cp922");
587.569 - aliasTable.put("ibm-922", "Cp922");
587.570 - aliasTable.put("cp922", "Cp922");
587.571 - aliasTable.put("922", "Cp922");
587.572 -
587.573 - // MIBenum: ????
587.574 - aliasTable.put("ibm930", "Cp930"); /* MDA */
587.575 - aliasTable.put("ibm-930", "Cp930"); /* MDA */
587.576 - aliasTable.put("cp930", "Cp930"); /* MDA */
587.577 - aliasTable.put("930", "Cp930"); /* MDA */
587.578 -
587.579 - // MIBenum: ????
587.580 - aliasTable.put("ibm933", "Cp933"); /* MDA */
587.581 - aliasTable.put("ibm-933", "Cp933"); /* MDA */
587.582 - aliasTable.put("cp933", "Cp933"); /* MDA */
587.583 - aliasTable.put("933", "Cp933"); /* MDA */
587.584 -
587.585 - // MIBenum: ????
587.586 - aliasTable.put("ibm935", "Cp935"); /* MDA */
587.587 - aliasTable.put("ibm-935", "Cp935"); /* MDA */
587.588 - aliasTable.put("cp935", "Cp935"); /* MDA */
587.589 - aliasTable.put("935", "Cp935"); /* MDA */
587.590 -
587.591 - // MIBenum: ????
587.592 - aliasTable.put("ibm937", "Cp937"); /* MDA */
587.593 - aliasTable.put("ibm-937", "Cp937"); /* MDA */
587.594 - aliasTable.put("cp937", "Cp937"); /* MDA */
587.595 - aliasTable.put("937", "Cp937"); /* MDA */
587.596 -
587.597 - // MIBenum: ????
587.598 - aliasTable.put("ibm939", "Cp939"); /* MDA */
587.599 - aliasTable.put("ibm-939", "Cp939"); /* MDA */
587.600 - aliasTable.put("cp939", "Cp939"); /* MDA */
587.601 - aliasTable.put("939", "Cp939"); /* MDA */
587.602 -
587.603 - // MIBenum: ????
587.604 - aliasTable.put("ibm942", "Cp942"); /* MDA */
587.605 - aliasTable.put("ibm-942", "Cp942"); /* MDA */
587.606 - aliasTable.put("cp942", "Cp942"); /* MDA */
587.607 - aliasTable.put("942", "Cp942"); /* MDA */
587.608 -
587.609 - // MIBenum: ????
587.610 - aliasTable.put("ibm943", "Cp943"); /* ibm.3158 */
587.611 - aliasTable.put("ibm-943", "Cp943"); /* ibm.3158 */
587.612 - aliasTable.put("cp943", "Cp943"); /* ibm.3158 */
587.613 - aliasTable.put("943", "Cp943"); /* ibm.3158 */
587.614 -
587.615 - // MIBenum: ????
587.616 - aliasTable.put("ibm948", "Cp948"); /* MDA */
587.617 - aliasTable.put("ibm-948", "Cp948"); /* MDA */
587.618 - aliasTable.put("cp948", "Cp948"); /* MDA */
587.619 - aliasTable.put("948", "Cp948"); /* MDA */
587.620 -
587.621 - // MIBenum: ????
587.622 - aliasTable.put("ibm949", "Cp949"); /* MDA */
587.623 - aliasTable.put("ibm-949", "Cp949"); /* MDA */
587.624 - aliasTable.put("cp949", "Cp949"); /* MDA */
587.625 - aliasTable.put("949", "Cp949"); /* MDA */
587.626 -
587.627 - // MIBenum: ????
587.628 - aliasTable.put("ibm950", "Cp950"); /* MDA */
587.629 - aliasTable.put("ibm-950", "Cp950"); /* MDA */
587.630 - aliasTable.put("cp950", "Cp950"); /* MDA */
587.631 - aliasTable.put("950", "Cp950"); /* MDA */
587.632 -
587.633 - // MIBenum: ????
587.634 - aliasTable.put("ibm964", "Cp964"); /* MDA */
587.635 - aliasTable.put("ibm-964", "Cp964"); /* MDA */
587.636 - aliasTable.put("cp964", "Cp964"); /* MDA */
587.637 - aliasTable.put("964", "Cp964"); /* MDA */
587.638 -
587.639 - // MIBenum: ????
587.640 - aliasTable.put("ibm970", "Cp970"); /* MDA */
587.641 - aliasTable.put("ibm-970", "Cp970"); /* MDA */
587.642 - aliasTable.put("cp970", "Cp970"); /* MDA */
587.643 - aliasTable.put("970", "Cp970"); /* MDA */
587.644 -
587.645 - // MIBenum: ????
587.646 - aliasTable.put("ibm1006", "Cp1006");
587.647 - aliasTable.put("ibm-1006", "Cp1006");
587.648 - aliasTable.put("cp1006", "Cp1006");
587.649 - aliasTable.put("1006", "Cp1006");
587.650 -
587.651 - // MIBenum: ????
587.652 - aliasTable.put("ibm1025", "Cp1025");
587.653 - aliasTable.put("ibm-1025", "Cp1025");
587.654 - aliasTable.put("cp1025", "Cp1025");
587.655 - aliasTable.put("1025", "Cp1025");
587.656 -
587.657 - // MIBenum: ????
587.658 - aliasTable.put("ibm1026", "Cp1026");
587.659 - aliasTable.put("ibm-1026", "Cp1026");
587.660 - aliasTable.put("cp1026", "Cp1026");
587.661 - aliasTable.put("1026", "Cp1026");
587.662 -
587.663 - // MIBenum: ????
587.664 - aliasTable.put("ibm1097", "Cp1097");
587.665 - aliasTable.put("ibm-1097", "Cp1097");
587.666 - aliasTable.put("cp1097", "Cp1097");
587.667 - aliasTable.put("1097", "Cp1097");
587.668 -
587.669 - // MIBenum: ????
587.670 - aliasTable.put("ibm1098", "Cp1098");
587.671 - aliasTable.put("ibm-1098", "Cp1098");
587.672 - aliasTable.put("cp1098", "Cp1098");
587.673 - aliasTable.put("1098", "Cp1098");
587.674 -
587.675 - // MIBenum: ????
587.676 - aliasTable.put("ibm1112", "Cp1112");
587.677 - aliasTable.put("ibm-1112", "Cp1112");
587.678 - aliasTable.put("cp1112", "Cp1112");
587.679 - aliasTable.put("1112", "Cp1112");
587.680 -
587.681 - // MIBenum: ????
587.682 - aliasTable.put("ibm1122", "Cp1122");
587.683 - aliasTable.put("ibm-1122", "Cp1122");
587.684 - aliasTable.put("cp1122", "Cp1122");
587.685 - aliasTable.put("1122", "Cp1122");
587.686 -
587.687 - // MIBenum: ????
587.688 - aliasTable.put("ibm1123", "Cp1123");
587.689 - aliasTable.put("ibm-1123", "Cp1123");
587.690 - aliasTable.put("cp1123", "Cp1123");
587.691 - aliasTable.put("1123", "Cp1123");
587.692 -
587.693 - // MIBenum: ????
587.694 - aliasTable.put("ibm1124", "Cp1124");
587.695 - aliasTable.put("ibm-1124", "Cp1124");
587.696 - aliasTable.put("cp1124", "Cp1124");
587.697 - aliasTable.put("1124", "Cp1124");
587.698 -
587.699 - // MIBenum: ????
587.700 - aliasTable.put("ibm1381", "Cp1381"); /* MDA */
587.701 - aliasTable.put("ibm-1381", "Cp1381"); /* MDA */
587.702 - aliasTable.put("cp1381", "Cp1381"); /* MDA */
587.703 - aliasTable.put("1381", "Cp1381"); /* MDA */
587.704 -
587.705 - // MIBenum: ????
587.706 - aliasTable.put("ibm1383", "Cp1383"); /* MDA */
587.707 - aliasTable.put("ibm-1383", "Cp1383"); /* MDA */
587.708 - aliasTable.put("cp1383", "Cp1383"); /* MDA */
587.709 - aliasTable.put("1383", "Cp1383"); /* MDA */
587.710 -
587.711 - // Specialized auto-detection for Japanese charsets
587.712 - aliasTable.put("jis auto detect", "JISAutoDetect");
587.713 -
587.714 - // MIBenum: 16/39
587.715 - aliasTable.put("jis", "ISO2022JP");
587.716 - aliasTable.put("iso-2022-jp", "ISO2022JP");
587.717 - aliasTable.put("csiso2022jp", "ISO2022JP");
587.718 - aliasTable.put("jis_encoding", "ISO2022JP");
587.719 - aliasTable.put("csjisencoding", "ISO2022JP");
587.720 -
587.721 - // MIBenum: 17/2024
587.722 - aliasTable.put("windows-31j", "MS932");
587.723 - aliasTable.put("cswindows31j", "MS932");
587.724 -
587.725 - // JIS-defined Shift JIS
587.726 - aliasTable.put("\u30b7\u30d5\u30c8\u7b26\u53f7\u5316\u8868\u73fe",
587.727 - "SJIS"); // JIS name
587.728 - aliasTable.put("pck", "PCK"); // Case independent PCK alias
587.729 -
587.730 - if (sjisIsMS932) {
587.731 - aliasTable.put("shift_jis", "MS932"); // IANA shift jis aliases
587.732 - aliasTable.put("csshiftjis", "MS932"); // updated per 4556882
587.733 - aliasTable.put("x-sjis", "MS932");
587.734 - aliasTable.put("ms_kanji", "MS932");
587.735 - } else {
587.736 - aliasTable.put("shift_jis", "SJIS"); // IANA shift jis aliases
587.737 - aliasTable.put("csshiftjis", "SJIS");
587.738 - aliasTable.put("x-sjis", "SJIS");
587.739 - aliasTable.put("ms_kanji", "SJIS");
587.740 - }
587.741 -
587.742 - // MIBenum: 18
587.743 - // Japanese EUC
587.744 - aliasTable.put("eucjis", "EUC_JP");
587.745 - aliasTable.put("euc-jp", "EUC_JP");
587.746 - aliasTable.put("eucjp", "EUC_JP");
587.747 - aliasTable.put("extended_unix_code_packed_format_for_japanese",
587.748 - "EUC_JP");
587.749 - aliasTable.put("cseucpkdfmtjapanese", "EUC_JP");
587.750 - aliasTable.put("x-euc-jp", "EUC_JP");
587.751 - aliasTable.put("x-eucjp", "EUC_JP");
587.752 - aliasTable.put("eucjp-open", "EUC_JP_Solaris"); // 1.3.1_x compatibility
587.753 -
587.754 - // For handing only JIS0202 and JIS0208 in linux
587.755 - aliasTable.put("euc-jp-linux", "EUC_JP_LINUX");
587.756 -
587.757 - // MIBenum: 874
587.758 - aliasTable.put("windows-874", "MS874");
587.759 -
587.760 - // MIBenum: 2250
587.761 - aliasTable.put("windows-1250", "Cp1250");
587.762 -
587.763 - // MIBenum: 2251
587.764 - aliasTable.put("windows-1251", "Cp1251");
587.765 - aliasTable.put("ansi-1251", "Cp1251"); // Solaris ru_RU.ANSI1251 locale
587.766 -
587.767 - // MIBenum: 2252
587.768 - aliasTable.put("windows-1252", "Cp1252");
587.769 -
587.770 - // MIBenum: 2253
587.771 - aliasTable.put("windows-1253", "Cp1253");
587.772 -
587.773 - // MIBenum: 2254
587.774 - aliasTable.put("windows-1254", "Cp1254");
587.775 -
587.776 - // MIBenum: 2255
587.777 - aliasTable.put("windows-1255", "Cp1255");
587.778 -
587.779 - // MIBenum: 2256
587.780 - aliasTable.put("windows-1256", "Cp1256");
587.781 -
587.782 - // MIBenum: 2257
587.783 - aliasTable.put("windows-1257", "Cp1257");
587.784 -
587.785 - // MIBenum: 2258
587.786 - aliasTable.put("windows-1258", "Cp1258");
587.787 -
587.788 - // MIBenum: ????
587.789 - aliasTable.put("ibm33722", "Cp33722"); /* MDA */
587.790 - aliasTable.put("ibm-33722", "Cp33722"); /* MDA */
587.791 - aliasTable.put("cp33722", "Cp33722"); /* MDA */
587.792 - aliasTable.put("33722", "Cp33722"); /* MDA */
587.793 -
587.794 - // Russian KOI8-R
587.795 - aliasTable.put("koi8-r", "KOI8_R");
587.796 - aliasTable.put("koi8", "KOI8_R");
587.797 - aliasTable.put("cskoi8r", "KOI8_R");
587.798 -
587.799 - // Simplified Chinese
587.800 - aliasTable.put("gb2312", "EUC_CN");
587.801 - aliasTable.put("gb2312-80", "EUC_CN");
587.802 - aliasTable.put("gb2312-1980", "EUC_CN");
587.803 - aliasTable.put("euc-cn", "EUC_CN");
587.804 - aliasTable.put("euccn", "EUC_CN");
587.805 -
587.806 - aliasTable.put("big5", "Big5");
587.807 - aliasTable.put("big5hk", "Big5_HKSCS");
587.808 - aliasTable.put("big5-hkscs", "Big5_HKSCS");
587.809 - // Added for future compatibility, explicit mapping to Unicode 3.0
587.810 - aliasTable.put("big5-hkscs:unicode3.0", "Big5_HKSCS");
587.811 - aliasTable.put("big5_solaris", "Big5_Solaris");
587.812 -
587.813 - // Traditional Chinese
587.814 - aliasTable.put("cns11643", "EUC_TW");
587.815 - aliasTable.put("euc-tw", "EUC_TW");
587.816 - aliasTable.put("euctw", "EUC_TW");
587.817 -
587.818 - // Korean
587.819 - aliasTable.put("ksc5601", "EUC_KR");
587.820 - aliasTable.put("euc-kr", "EUC_KR");
587.821 - aliasTable.put("euckr", "EUC_KR");
587.822 - aliasTable.put("ks_c_5601-1987", "EUC_KR");
587.823 - aliasTable.put("ksc5601-1987", "EUC_KR");
587.824 - aliasTable.put("ksc5601_1987", "EUC_KR");
587.825 - aliasTable.put("ksc_5601", "EUC_KR");
587.826 - aliasTable.put("5601", "EUC_KR");
587.827 -
587.828 - aliasTable.put("ksc5601-1992", "Johab");
587.829 - aliasTable.put("ksc5601_1992", "Johab");
587.830 - aliasTable.put("ms1361", "Johab");
587.831 -
587.832 - aliasTable.put("windows-949", "MS949");
587.833 -
587.834 - //MIBenum: 37
587.835 - aliasTable.put("iso-2022-kr", "ISO2022KR");
587.836 - aliasTable.put("csiso2022kr", "ISO2022KR");
587.837 -
587.838 - // Thai
587.839 - aliasTable.put("tis620.2533", "TIS620");
587.840 - aliasTable.put("tis-620", "TIS620"); // Linux name
587.841 -
587.842 - // X11 Compound Text
587.843 - aliasTable.put("x-compound-text", "COMPOUND_TEXT");
587.844 - aliasTable.put("x11-compound_text", "COMPOUND_TEXT");
587.845 -
587.846 - // Variants
587.847 - aliasTable.put("cp942c", "Cp942C");
587.848 - aliasTable.put("cp943c", "Cp943C");
587.849 - aliasTable.put("cp949c", "Cp949C");
587.850 - aliasTable.put("iscii", "ISCII91");
587.851 -
587.852 - installedAll = true;
587.853 - }
587.854 - }
587.855 -
587.856 - /**
587.857 - * For Solaris:
587.858 - * always returns "PCK"
587.859 - *
587.860 - * For other platforms:
587.861 - * method returns "MS932" if the file.encoding property value is "MS932"
587.862 - * or an alias of "MS932"
587.863 - * otherwise, "SJIS", regardless of its
587.864 - * actual file.encoding value. This method is called from the JIS
587.865 - * Auto Detect converter.
587.866 - */
587.867 - static String getSJISName() {
587.868 - String encodeName = AccessController.doPrivileged(
587.869 - new PrivilegedAction<String>() {
587.870 - public String run() {
587.871 - String osName = System.getProperty("os.name");
587.872 - if (osName.equals("Solaris") || osName.equals("SunOS")){
587.873 - return "PCK";
587.874 - }
587.875 - else {
587.876 - return System.getProperty("file.encoding", null);
587.877 - }
587.878 - }
587.879 - });
587.880 -
587.881 - if (encodeName != null) {
587.882 - if (encodeName.equals("MS932"))
587.883 - return encodeName;
587.884 - encodeName = aliasName(encodeName);
587.885 - }
587.886 - return (encodeName != null && encodeName.equals("MS932")) ? encodeName : "SJIS";
587.887 - }
587.888 -
587.889 -
587.890 - static String getEUCJPName() {
587.891 - String encodeName = AccessController.doPrivileged(
587.892 - new PrivilegedAction<String>() {
587.893 - public String run() {
587.894 - String osName = System.getProperty("os.name");
587.895 - if (osName.equals("Solaris") || osName.equals("SunOS"))
587.896 - return "eucJP-open";
587.897 - else
587.898 - return "EUC_JP";
587.899 - }
587.900 - });
587.901 - return encodeName;
587.902 - }
587.903 -}
588.1 --- a/src/share/classes/sun/io/ConversionBufferFullException.java Thu Sep 01 13:54:38 2011 -0700
588.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
588.3 @@ -1,60 +0,0 @@
588.4 -/*
588.5 - * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
588.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
588.7 - *
588.8 - * This code is free software; you can redistribute it and/or modify it
588.9 - * under the terms of the GNU General Public License version 2 only, as
588.10 - * published by the Free Software Foundation. Oracle designates this
588.11 - * particular file as subject to the "Classpath" exception as provided
588.12 - * by Oracle in the LICENSE file that accompanied this code.
588.13 - *
588.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
588.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
588.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
588.17 - * version 2 for more details (a copy is included in the LICENSE file that
588.18 - * accompanied this code).
588.19 - *
588.20 - * You should have received a copy of the GNU General Public License version
588.21 - * 2 along with this work; if not, write to the Free Software Foundation,
588.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
588.23 - *
588.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
588.25 - * or visit www.oracle.com if you need additional information or have any
588.26 - * questions.
588.27 - */
588.28 -
588.29 -package sun.io;
588.30 -
588.31 -
588.32 -/**
588.33 - * The output buffer for a character conversion is full, but additional
588.34 - * input remains to be converted
588.35 - *
588.36 - * @author Asmus Freytag
588.37 - *
588.38 - * @deprecated Replaced by {@link java.nio.charset}. THIS API WILL BE
588.39 - * REMOVED IN J2SE 1.6.
588.40 - */
588.41 -@Deprecated
588.42 -public class ConversionBufferFullException
588.43 - extends java.io.CharConversionException
588.44 -{
588.45 - private static final long serialVersionUID = -6537318994265003622L;
588.46 -
588.47 - /**
588.48 - * Constructs a BufferFullException with no detail message.
588.49 - * A detail message is a String that describes this particular exception.
588.50 - */
588.51 - public ConversionBufferFullException() {
588.52 - super();
588.53 - }
588.54 -
588.55 - /**
588.56 - * Constructs a BufferFullException with the specified detail message.
588.57 - * A detail message is a String that describes this particular exception.
588.58 - * @param s the String containing a detail message
588.59 - */
588.60 - public ConversionBufferFullException(String s) {
588.61 - super(s);
588.62 - }
588.63 -}
589.1 --- a/src/share/classes/sun/io/Converters.java Thu Sep 01 13:54:38 2011 -0700
589.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
589.3 @@ -1,341 +0,0 @@
589.4 -/*
589.5 - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
589.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
589.7 - *
589.8 - * This code is free software; you can redistribute it and/or modify it
589.9 - * under the terms of the GNU General Public License version 2 only, as
589.10 - * published by the Free Software Foundation. Oracle designates this
589.11 - * particular file as subject to the "Classpath" exception as provided
589.12 - * by Oracle in the LICENSE file that accompanied this code.
589.13 - *
589.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
589.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
589.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
589.17 - * version 2 for more details (a copy is included in the LICENSE file that
589.18 - * accompanied this code).
589.19 - *
589.20 - * You should have received a copy of the GNU General Public License version
589.21 - * 2 along with this work; if not, write to the Free Software Foundation,
589.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
589.23 - *
589.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
589.25 - * or visit www.oracle.com if you need additional information or have any
589.26 - * questions.
589.27 - */
589.28 -
589.29 -package sun.io;
589.30 -
589.31 -import java.io.UnsupportedEncodingException;
589.32 -import java.lang.ref.SoftReference;
589.33 -import java.util.Properties;
589.34 -
589.35 -/**
589.36 - * Package-private utility class that caches the default converter classes and
589.37 - * provides other logic common to both the ByteToCharConverter and
589.38 - * CharToByteConverter classes.
589.39 - *
589.40 - * @author Mark Reinhold
589.41 - * @since 1.2
589.42 - *
589.43 - * @deprecated Replaced by {@link java.nio.charset}. THIS API WILL BE
589.44 - * REMOVED IN J2SE 1.6.
589.45 - */
589.46 -@Deprecated
589.47 -public class Converters {
589.48 -
589.49 - private Converters() { } /* To prevent instantiation */
589.50 -
589.51 - /* Lock for all static fields in this class */
589.52 - private static Object lock = Converters.class;
589.53 -
589.54 - /* Cached values of system properties */
589.55 - private static String converterPackageName = null; /* file.encoding.pkg */
589.56 - private static String defaultEncoding = null; /* file.encoding */
589.57 -
589.58 - /* Converter type constants and names */
589.59 - public static final int BYTE_TO_CHAR = 0;
589.60 - public static final int CHAR_TO_BYTE = 1;
589.61 - private static final String[] converterPrefix = { "ByteToChar",
589.62 - "CharToByte" };
589.63 -
589.64 -
589.65 - // -- Converter class cache --
589.66 -
589.67 - private static final int CACHE_SIZE = 3;
589.68 -
589.69 - /* For the default charset, whatever it turns out to be */
589.70 - private static final Object DEFAULT_NAME = new Object();
589.71 -
589.72 - /* Cached converter classes, CACHE_SIZE per converter type. Each cache
589.73 - * entry is a soft reference to a two-object array; the first element of
589.74 - * the array is the converter class, the second is an object (typically a
589.75 - * string) representing the encoding name that was used to request the
589.76 - * converter, e.g.,
589.77 - *
589.78 - * ((Object[])classCache[CHAR_TO_BYTE][i].get())[0]
589.79 - *
589.80 - * will be a CharToByteConverter and
589.81 - *
589.82 - * ((Object[])classCache[CHAR_TO_BYTE][i].get())[1]
589.83 - *
589.84 - * will be the string encoding name used to request it, assuming that cache
589.85 - * entry i is valid.
589.86 - *
589.87 - * Ordinarily we'd do this with a private static utility class, but since
589.88 - * this code can be involved in the startup sequence it's important to keep
589.89 - * the footprint down.
589.90 - */
589.91 - @SuppressWarnings("unchecked")
589.92 - private static SoftReference<Object[]>[][] classCache
589.93 - = (SoftReference<Object[]>[][]) new SoftReference<?>[][] {
589.94 - new SoftReference<?>[CACHE_SIZE],
589.95 - new SoftReference<?>[CACHE_SIZE]
589.96 - };
589.97 -
589.98 - private static void moveToFront(Object[] oa, int i) {
589.99 - Object ob = oa[i];
589.100 - for (int j = i; j > 0; j--)
589.101 - oa[j] = oa[j - 1];
589.102 - oa[0] = ob;
589.103 - }
589.104 -
589.105 - private static Class<?> cache(int type, Object encoding) {
589.106 - SoftReference<Object[]>[] srs = classCache[type];
589.107 - for (int i = 0; i < CACHE_SIZE; i++) {
589.108 - SoftReference<Object[]> sr = srs[i];
589.109 - if (sr == null)
589.110 - continue;
589.111 - Object[] oa = sr.get();
589.112 - if (oa == null) {
589.113 - srs[i] = null;
589.114 - continue;
589.115 - }
589.116 - if (oa[1].equals(encoding)) {
589.117 - moveToFront(srs, i);
589.118 - return (Class<?>)oa[0];
589.119 - }
589.120 - }
589.121 - return null;
589.122 - }
589.123 -
589.124 - private static Class<?> cache(int type, Object encoding, Class<?> c) {
589.125 - SoftReference<Object[]>[] srs = classCache[type];
589.126 - srs[CACHE_SIZE - 1] = new SoftReference<>(new Object[] { c, encoding });
589.127 - moveToFront(srs, CACHE_SIZE - 1);
589.128 - return c;
589.129 - }
589.130 -
589.131 - /* Used to avoid doing expensive charset lookups for charsets that are not
589.132 - * yet directly supported by NIO.
589.133 - */
589.134 - public static boolean isCached(int type, String encoding) {
589.135 - synchronized (lock) {
589.136 - SoftReference<Object[]>[] srs = classCache[type];
589.137 - for (int i = 0; i < CACHE_SIZE; i++) {
589.138 - SoftReference<Object[]> sr = srs[i];
589.139 - if (sr == null)
589.140 - continue;
589.141 - Object[] oa = sr.get();
589.142 - if (oa == null) {
589.143 - srs[i] = null;
589.144 - continue;
589.145 - }
589.146 - if (oa[1].equals(encoding))
589.147 - return true;
589.148 - }
589.149 - return false;
589.150 - }
589.151 - }
589.152 -
589.153 -
589.154 -
589.155 - /** Get the name of the converter package */
589.156 - private static String getConverterPackageName() {
589.157 - String cp = converterPackageName;
589.158 - if (cp != null) return cp;
589.159 - java.security.PrivilegedAction<String> pa =
589.160 - new sun.security.action.GetPropertyAction("file.encoding.pkg");
589.161 - cp = java.security.AccessController.doPrivileged(pa);
589.162 - if (cp != null) {
589.163 - /* Property is set, so take it as the true converter package */
589.164 - converterPackageName = cp;
589.165 - } else {
589.166 - /* Fall back to sun.io */
589.167 - cp = "sun.io";
589.168 - }
589.169 - return cp;
589.170 - }
589.171 -
589.172 - public static String getDefaultEncodingName() {
589.173 - synchronized (lock) {
589.174 - if (defaultEncoding == null) {
589.175 - java.security.PrivilegedAction<String> pa =
589.176 - new sun.security.action.GetPropertyAction("file.encoding");
589.177 - defaultEncoding = java.security.AccessController.doPrivileged(pa);
589.178 - }
589.179 - }
589.180 - return defaultEncoding;
589.181 - }
589.182 -
589.183 - public static void resetDefaultEncodingName() {
589.184 - // This method should only be called during VM initialization.
589.185 - if (sun.misc.VM.isBooted())
589.186 - return;
589.187 -
589.188 - synchronized (lock) {
589.189 - defaultEncoding = "ISO-8859-1";
589.190 - Properties p = System.getProperties();
589.191 - p.setProperty("file.encoding", defaultEncoding);
589.192 - System.setProperties(p);
589.193 - }
589.194 - }
589.195 -
589.196 - /**
589.197 - * Get the class that implements the given type of converter for the named
589.198 - * encoding, or throw an UnsupportedEncodingException if no such class can
589.199 - * be found
589.200 - */
589.201 - private static Class<?> getConverterClass(int type, String encoding)
589.202 - throws UnsupportedEncodingException
589.203 - {
589.204 - String enc = null;
589.205 -
589.206 - /* "ISO8859_1" is the canonical name for the ISO-Latin-1 encoding.
589.207 - Native code in the JDK commonly uses the alias "8859_1" instead of
589.208 - "ISO8859_1". We hardwire this alias here in order to avoid loading
589.209 - the full alias table just for this case. */
589.210 - if (!encoding.equals("ISO8859_1")) {
589.211 - if (encoding.equals("8859_1")) {
589.212 - enc = "ISO8859_1";
589.213 - /*
589.214 - * On Solaris with nl_langinfo() called in GetJavaProperties():
589.215 - *
589.216 - * locale undefined -> NULL -> hardcoded default
589.217 - * "C" locale -> "" -> hardcoded default (on 2.6)
589.218 - * "C" locale -> "646" (on 2.7)
589.219 - * "en_US" locale -> "ISO8859-1"
589.220 - * "en_GB" locale -> "ISO8859-1" (on 2.7)
589.221 - * "en_UK" locale -> "ISO8859-1" (on 2.6)
589.222 - */
589.223 - } else if (encoding.equals("ISO8859-1")) {
589.224 - enc = "ISO8859_1";
589.225 - } else if (encoding.equals("646")) {
589.226 - enc = "ASCII";
589.227 - } else {
589.228 - enc = CharacterEncoding.aliasName(encoding);
589.229 - }
589.230 - }
589.231 - if (enc == null) {
589.232 - enc = encoding;
589.233 - }
589.234 -
589.235 - try {
589.236 - return Class.forName(getConverterPackageName()
589.237 - + "." + converterPrefix[type] + enc);
589.238 - } catch(ClassNotFoundException e) {
589.239 - throw new UnsupportedEncodingException(enc);
589.240 - }
589.241 -
589.242 - }
589.243 -
589.244 - /**
589.245 - * Instantiate the given converter class, or throw an
589.246 - * UnsupportedEncodingException if it cannot be instantiated
589.247 - */
589.248 - private static Object newConverter(String enc, Class<?> c)
589.249 - throws UnsupportedEncodingException
589.250 - {
589.251 - try {
589.252 - return c.newInstance();
589.253 - } catch(InstantiationException e) {
589.254 - throw new UnsupportedEncodingException(enc);
589.255 - } catch(IllegalAccessException e) {
589.256 - throw new UnsupportedEncodingException(enc);
589.257 - }
589.258 - }
589.259 -
589.260 - /**
589.261 - * Create a converter object that implements the given type of converter
589.262 - * for the given encoding, or throw an UnsupportedEncodingException if no
589.263 - * appropriate converter class can be found and instantiated
589.264 - */
589.265 - static Object newConverter(int type, String enc)
589.266 - throws UnsupportedEncodingException
589.267 - {
589.268 - Class<?> c;
589.269 - synchronized (lock) {
589.270 - c = cache(type, enc);
589.271 - if (c == null) {
589.272 - c = getConverterClass(type, enc);
589.273 - if (!c.getName().equals("sun.io.CharToByteUTF8"))
589.274 - cache(type, enc, c);
589.275 - }
589.276 - }
589.277 - return newConverter(enc, c);
589.278 - }
589.279 -
589.280 - /**
589.281 - * Find the class that implements the given type of converter for the
589.282 - * default encoding. If the default encoding cannot be determined or is
589.283 - * not yet defined, return a class that implements the fallback default
589.284 - * encoding, which is just ISO 8859-1.
589.285 - */
589.286 - private static Class<?> getDefaultConverterClass(int type) {
589.287 - boolean fillCache = false;
589.288 - Class<?> c;
589.289 -
589.290 - /* First check the class cache */
589.291 - c = cache(type, DEFAULT_NAME);
589.292 - if (c != null)
589.293 - return c;
589.294 -
589.295 - /* Determine the encoding name */
589.296 - String enc = getDefaultEncodingName();
589.297 - if (enc != null) {
589.298 - /* file.encoding has been set, so cache the converter class */
589.299 - fillCache = true;
589.300 - } else {
589.301 - /* file.encoding has not been set, so use a default encoding which
589.302 - will not be cached */
589.303 - enc = "ISO8859_1";
589.304 - }
589.305 -
589.306 - /* We have an encoding name; try to find its class */
589.307 - try {
589.308 - c = getConverterClass(type, enc);
589.309 - if (fillCache) {
589.310 - cache(type, DEFAULT_NAME, c);
589.311 - }
589.312 - } catch (UnsupportedEncodingException x) {
589.313 - /* Can't find the default class, so fall back to ISO 8859-1 */
589.314 - try {
589.315 - c = getConverterClass(type, "ISO8859_1");
589.316 - } catch (UnsupportedEncodingException y) {
589.317 - throw new InternalError("Cannot find default "
589.318 - + converterPrefix[type]
589.319 - + " converter class");
589.320 - }
589.321 - }
589.322 - return c;
589.323 -
589.324 - }
589.325 -
589.326 - /**
589.327 - * Create a converter object that implements the given type of converter
589.328 - * for the default encoding, falling back to ISO 8859-1 if the default
589.329 - * encoding cannot be determined.
589.330 - */
589.331 - static Object newDefaultConverter(int type) {
589.332 - Class<?> c;
589.333 - synchronized (lock) {
589.334 - c = getDefaultConverterClass(type);
589.335 - }
589.336 - try {
589.337 - return newConverter("", c);
589.338 - } catch (UnsupportedEncodingException x) {
589.339 - throw new InternalError("Cannot instantiate default converter"
589.340 - + " class " + c.getName());
589.341 - }
589.342 - }
589.343 -
589.344 -}
590.1 --- a/src/share/classes/sun/io/MalformedInputException.java Thu Sep 01 13:54:38 2011 -0700
590.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
590.3 @@ -1,60 +0,0 @@
590.4 -/*
590.5 - * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
590.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
590.7 - *
590.8 - * This code is free software; you can redistribute it and/or modify it
590.9 - * under the terms of the GNU General Public License version 2 only, as
590.10 - * published by the Free Software Foundation. Oracle designates this
590.11 - * particular file as subject to the "Classpath" exception as provided
590.12 - * by Oracle in the LICENSE file that accompanied this code.
590.13 - *
590.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
590.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
590.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
590.17 - * version 2 for more details (a copy is included in the LICENSE file that
590.18 - * accompanied this code).
590.19 - *
590.20 - * You should have received a copy of the GNU General Public License version
590.21 - * 2 along with this work; if not, write to the Free Software Foundation,
590.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
590.23 - *
590.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
590.25 - * or visit www.oracle.com if you need additional information or have any
590.26 - * questions.
590.27 - */
590.28 -
590.29 -package sun.io;
590.30 -
590.31 -
590.32 -/**
590.33 -* The input string or input byte array to a character conversion
590.34 -* contains a malformed sequence of characters or bytes.
590.35 -*
590.36 -* @author Asmus Freytag
590.37 -*
590.38 -* @deprecated Replaced by {@link java.nio.charset}. THIS API WILL BE
590.39 -* REMOVED IN J2SE 1.6.
590.40 -*/
590.41 -@Deprecated
590.42 -public class MalformedInputException
590.43 - extends java.io.CharConversionException
590.44 -{
590.45 - private static final long serialVersionUID = 2585413228493157652L;
590.46 -
590.47 - /**
590.48 - * Constructs a MalformedInputException with no detail message.
590.49 - * A detail message is a String that describes this particular exception.
590.50 - */
590.51 - public MalformedInputException() {
590.52 - super();
590.53 - }
590.54 -
590.55 - /**
590.56 - * Constructs a MalformedInputException with the specified detail message.
590.57 - * A detail message is a String that describes this particular exception.
590.58 - * @param s the String containing a detail message
590.59 - */
590.60 - public MalformedInputException(String s) {
590.61 - super(s);
590.62 - }
590.63 -}
591.1 --- a/src/share/classes/sun/io/UnknownCharacterException.java Thu Sep 01 13:54:38 2011 -0700
591.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
591.3 @@ -1,60 +0,0 @@
591.4 -/*
591.5 - * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
591.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
591.7 - *
591.8 - * This code is free software; you can redistribute it and/or modify it
591.9 - * under the terms of the GNU General Public License version 2 only, as
591.10 - * published by the Free Software Foundation. Oracle designates this
591.11 - * particular file as subject to the "Classpath" exception as provided
591.12 - * by Oracle in the LICENSE file that accompanied this code.
591.13 - *
591.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
591.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
591.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
591.17 - * version 2 for more details (a copy is included in the LICENSE file that
591.18 - * accompanied this code).
591.19 - *
591.20 - * You should have received a copy of the GNU General Public License version
591.21 - * 2 along with this work; if not, write to the Free Software Foundation,
591.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
591.23 - *
591.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
591.25 - * or visit www.oracle.com if you need additional information or have any
591.26 - * questions.
591.27 - */
591.28 -
591.29 -package sun.io;
591.30 -
591.31 -
591.32 -/**
591.33 -* A character conversion encountered a character
591.34 -* that does not have an assigned mapping, and automatic
591.35 -* substitution is not selected
591.36 -*
591.37 -* @author Asmus Freytag
591.38 -* @deprecated Replaced by {@link java.nio.charset}. THIS API WILL BE
591.39 -* REMOVED IN J2SE 1.6.
591.40 -*/
591.41 -@Deprecated
591.42 -public class UnknownCharacterException
591.43 - extends java.io.CharConversionException
591.44 -{
591.45 - private static final long serialVersionUID = -8563196502398436986L;
591.46 -
591.47 - /**
591.48 - * Constructs a UnknownCharacterException with no detail message.
591.49 - * A detail message is a String that describes this particular exception.
591.50 - */
591.51 - public UnknownCharacterException() {
591.52 - super();
591.53 - }
591.54 -
591.55 - /**
591.56 - * Constructs a UnknownCharacterException with the specified detail message.
591.57 - * A detail message is a String that describes this particular exception.
591.58 - * @param s the String containing a detail message
591.59 - */
591.60 - public UnknownCharacterException(String s) {
591.61 - super(s);
591.62 - }
591.63 -}
592.1 --- a/src/share/classes/sun/management/ManagementFactoryHelper.java Thu Sep 01 13:54:38 2011 -0700
592.2 +++ b/src/share/classes/sun/management/ManagementFactoryHelper.java Mon Sep 05 23:58:19 2011 -0700
592.3 @@ -171,7 +171,8 @@
592.4 ObjectName result = objname;
592.5 if (result == null) {
592.6 synchronized (this) {
592.7 - if (objname == null) {
592.8 + result = objname;
592.9 + if (result == null) {
592.10 result = Util.newObjectName(LOGGING_MXBEAN_NAME);
592.11 objname = result;
592.12 }
592.13 @@ -228,7 +229,8 @@
592.14 ObjectName result = objname;
592.15 if (result == null) {
592.16 synchronized (this) {
592.17 - if (objname == null) {
592.18 + result = objname;
592.19 + if (result == null) {
592.20 result = Util.newObjectName(BUFFER_POOL_MXBEAN_NAME +
592.21 ",name=" + pool.getName());
592.22 objname = result;
593.1 --- a/src/share/classes/sun/misc/JavaNioAccess.java Thu Sep 01 13:54:38 2011 -0700
593.2 +++ b/src/share/classes/sun/misc/JavaNioAccess.java Mon Sep 05 23:58:19 2011 -0700
593.3 @@ -1,5 +1,5 @@
593.4 /*
593.5 - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
593.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
593.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
593.8 *
593.9 * This code is free software; you can redistribute it and/or modify it
593.10 @@ -25,6 +25,9 @@
593.11
593.12 package sun.misc;
593.13
593.14 +import java.nio.Buffer;
593.15 +import java.nio.ByteBuffer;
593.16 +
593.17 public interface JavaNioAccess {
593.18 /**
593.19 * Provides access to information on buffer usage.
593.20 @@ -36,4 +39,18 @@
593.21 long getMemoryUsed();
593.22 }
593.23 BufferPool getDirectBufferPool();
593.24 +
593.25 + /**
593.26 + * Constructs a direct ByteBuffer referring to the block of memory starting
593.27 + * at the given memory address and and extending {@code cap} bytes.
593.28 + * The {@code ob} parameter is an arbitrary object that is attached
593.29 + * to the resulting buffer.
593.30 + */
593.31 + ByteBuffer newDirectByteBuffer(long addr, int cap, Object ob);
593.32 +
593.33 + /**
593.34 + * Truncates a buffer by changing its capacity to 0.
593.35 + */
593.36 + void truncate(Buffer buf);
593.37 +
593.38 }
594.1 --- a/src/share/classes/sun/misc/URLClassPath.java Thu Sep 01 13:54:38 2011 -0700
594.2 +++ b/src/share/classes/sun/misc/URLClassPath.java Mon Sep 05 23:58:19 2011 -0700
594.3 @@ -717,7 +717,7 @@
594.4 try {
594.5 ensureOpen();
594.6 } catch (IOException e) {
594.7 - throw (InternalError) new InternalError().initCause(e);
594.8 + throw new InternalError(e);
594.9 }
594.10 return index;
594.11 }
594.12 @@ -812,7 +812,7 @@
594.13 try {
594.14 ensureOpen();
594.15 } catch (IOException e) {
594.16 - throw (InternalError) new InternalError().initCause(e);
594.17 + throw new InternalError(e);
594.18 }
594.19 final JarEntry entry = jar.getJarEntry(name);
594.20 if (entry != null)
594.21 @@ -900,7 +900,7 @@
594.22 try {
594.23 newLoader.ensureOpen();
594.24 } catch (IOException e) {
594.25 - throw (InternalError) new InternalError().initCause(e);
594.26 + throw new InternalError(e);
594.27 }
594.28 final JarEntry entry = newLoader.jar.getJarEntry(name);
594.29 if (entry != null) {
595.1 --- a/src/share/classes/sun/nio/ch/DirectBuffer.java Thu Sep 01 13:54:38 2011 -0700
595.2 +++ b/src/share/classes/sun/nio/ch/DirectBuffer.java Mon Sep 05 23:58:19 2011 -0700
595.3 @@ -1,5 +1,5 @@
595.4 /*
595.5 - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
595.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
595.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
595.8 *
595.9 * This code is free software; you can redistribute it and/or modify it
595.10 @@ -32,7 +32,7 @@
595.11
595.12 public long address();
595.13
595.14 - public Object viewedBuffer();
595.15 + public Object attachment();
595.16
595.17 public Cleaner cleaner();
595.18
596.1 --- a/src/share/classes/sun/nio/cs/ext/GB18030.java Thu Sep 01 13:54:38 2011 -0700
596.2 +++ b/src/share/classes/sun/nio/cs/ext/GB18030.java Mon Sep 05 23:58:19 2011 -0700
596.3 @@ -47,30 +47,6 @@
596.4 super("GB18030", ExtendedCharsets.aliasesFor("GB18030"));
596.5 }
596.6
596.7 - public short[] getDecoderIndex1() {
596.8 - return decoderIndex1;
596.9 - }
596.10 -
596.11 - public String[] getDecoderIndex2() {
596.12 - return decoderIndex2;
596.13 - }
596.14 -
596.15 - public short[] getSubDecoderIndex1() {
596.16 - return index1;
596.17 - }
596.18 -
596.19 - public String[] getSubDecoderIndex2() {
596.20 - return index2;
596.21 - }
596.22 -
596.23 - public short[] getEncoderIndex1() {
596.24 - return encoderIndex1;
596.25 - }
596.26 -
596.27 - public String[] getEncoderIndex2() {
596.28 - return encoderIndex2;
596.29 - }
596.30 -
596.31 public boolean contains(Charset cs) {
596.32 return ((cs.name().equals("US-ASCII"))
596.33 || (cs.name().equals("GBK"))
597.1 --- a/src/share/classes/sun/nio/cs/ext/IBM33722.java Thu Sep 01 13:54:38 2011 -0700
597.2 +++ b/src/share/classes/sun/nio/cs/ext/IBM33722.java Mon Sep 05 23:58:19 2011 -0700
597.3 @@ -62,47 +62,6 @@
597.4 return new Encoder(this);
597.5 }
597.6
597.7 -
597.8 - /**
597.9 - * These accessors are temporarily supplied while sun.io
597.10 - * converters co-exist with the sun.nio.cs.{ext} charset coders
597.11 - * These facilitate sharing of conversion tables between the
597.12 - * two co-existing implementations. When sun.io converters
597.13 - * are made extinct these will be unncessary and should be removed
597.14 - */
597.15 -
597.16 - public String getDecoderSingleByteMappings() {
597.17 - return Decoder.byteToCharTable;
597.18 - }
597.19 -
597.20 - public String getDecoderMappingTableG1() {
597.21 - return Decoder.mappingTableG1;
597.22 - }
597.23 -
597.24 - public String getDecoderMappingTableG2() {
597.25 - return Decoder.mappingTableG2;
597.26 - }
597.27 -
597.28 - public String getDecoderMappingTableG3() {
597.29 - return Decoder.mappingTableG3;
597.30 - }
597.31 -
597.32 - public short[] getEncoderIndex1() {
597.33 - return Encoder.index1;
597.34 -
597.35 - }
597.36 - public String getEncoderIndex2() {
597.37 - return Encoder.index2;
597.38 - }
597.39 -
597.40 - public String getEncoderIndex2a() {
597.41 - return Encoder.index2a;
597.42 - }
597.43 -
597.44 - public String getEncoderIndex2b() {
597.45 - return Encoder.index2b;
597.46 - }
597.47 -
597.48 protected static class Decoder extends CharsetDecoder {
597.49
597.50 private final int G0 = 0;
598.1 --- a/src/share/classes/sun/nio/cs/ext/IBM964.java Thu Sep 01 13:54:38 2011 -0700
598.2 +++ b/src/share/classes/sun/nio/cs/ext/IBM964.java Mon Sep 05 23:58:19 2011 -0700
598.3 @@ -62,54 +62,6 @@
598.4 return new Encoder(this);
598.5 }
598.6
598.7 -
598.8 - /**
598.9 - * These accessors are temporarily supplied while sun.io
598.10 - * converters co-exist with the sun.nio.cs.{ext} charset coders
598.11 - * These facilitate sharing of conversion tables between the
598.12 - * two co-existing implementations. When sun.io converters
598.13 - * are made extinct these will be unncessary and should be removed
598.14 - */
598.15 -
598.16 - public String getDecoderSingleByteMappings() {
598.17 - return Decoder.byteToCharTable;
598.18 - }
598.19 -
598.20 - public String getDecoderMappingTableG1() {
598.21 - return Decoder.mappingTableG1;
598.22 - }
598.23 -
598.24 - public String getDecoderMappingTableG2a2() {
598.25 - return Decoder.mappingTableG2a2;
598.26 - }
598.27 -
598.28 - public String getDecoderMappingTableG2ac() {
598.29 - return Decoder.mappingTableG2ac;
598.30 - }
598.31 -
598.32 - public String getDecoderMappingTableG2ad() {
598.33 - return Decoder.mappingTableG2ad;
598.34 - }
598.35 -
598.36 - public short[] getEncoderIndex1() {
598.37 - return Encoder.index1;
598.38 -
598.39 - }
598.40 - public String getEncoderIndex2() {
598.41 - return Encoder.index2;
598.42 -
598.43 - }
598.44 - public String getEncoderIndex2a() {
598.45 - return Encoder.index2a;
598.46 - }
598.47 -
598.48 - public String getEncoderIndex2b() {
598.49 - return Encoder.index2b;
598.50 - }
598.51 -
598.52 - public String getEncoderIndex2c() {
598.53 - return Encoder.index2c;
598.54 - }
598.55 protected static class Decoder extends CharsetDecoder {
598.56 private final int SS2 = 0x8E;
598.57 private final int SS3 = 0x8F;
599.1 --- a/src/share/classes/sun/nio/cs/ext/ISCII91.java Thu Sep 01 13:54:38 2011 -0700
599.2 +++ b/src/share/classes/sun/nio/cs/ext/ISCII91.java Mon Sep 05 23:58:19 2011 -0700
599.3 @@ -331,18 +331,6 @@
599.4 '\uffff' // ff -- This position shall not be used
599.5 }; //end of table definition
599.6
599.7 - /**
599.8 - * This accessor is temporarily supplied while sun.io
599.9 - * converters co-exist with the sun.nio.cs.{ext} charset coders
599.10 - * These facilitate sharing of conversion tables between the
599.11 - * two co-existing implementations. When sun.io converters
599.12 - * are made extinct these will be unnecessary and should be removed
599.13 - */
599.14 -
599.15 - public static char[] getDirectMapTable() {
599.16 - return directMapTable;
599.17 - }
599.18 -
599.19 private static final byte[] encoderMappingTable = {
599.20 NO_CHAR,NO_CHAR, //0900 <reserved>
599.21 (byte)161,NO_CHAR, //0901 -- DEVANAGARI SIGN CANDRABINDU = anunasika
599.22 @@ -474,20 +462,6 @@
599.23 NO_CHAR,NO_CHAR //097f -- reserved
599.24 }; //end of table definition
599.25
599.26 -
599.27 - /**
599.28 - * This accessor is temporarily supplied while sun.io
599.29 - * converters co-exist with the sun.nio.cs.{ext} charset coders
599.30 - * These facilitate sharing of conversion tables between the
599.31 - * two co-existing implementations. When sun.io converters
599.32 - * are made extinct these will be unnecessary and should be removed
599.33 - */
599.34 -
599.35 - public static byte[] getEncoderMappingTable() {
599.36 - return encoderMappingTable;
599.37 - }
599.38 -
599.39 -
599.40 private static class Decoder extends CharsetDecoder {
599.41
599.42 private static final char ZWNJ_CHAR = '\u200c';
600.1 --- a/src/share/classes/sun/nio/cs/ext/JIS_X_0208_Decoder.java Thu Sep 01 13:54:38 2011 -0700
600.2 +++ b/src/share/classes/sun/nio/cs/ext/JIS_X_0208_Decoder.java Mon Sep 05 23:58:19 2011 -0700
600.3 @@ -1000,18 +1000,11 @@
600.4 return REPLACE_CHAR;
600.5 }
600.6
600.7 - /**
600.8 - * These accessors are temporarily supplied while sun.io
600.9 - * converters co-exist with the sun.nio.cs.{ext} charset coders
600.10 - * These facilitate sharing of conversion tables between the
600.11 - * two co-existing implementations. When sun.io converters
600.12 - * are made extinct these will be unncessary and should be removed
600.13 - */
600.14 - public static short[] getIndex1() {
600.15 + static short[] getIndex1() {
600.16 return index1;
600.17 }
600.18
600.19 - public static String[] getIndex2() {
600.20 + static String[] getIndex2() {
600.21 return index2;
600.22 }
600.23 }
601.1 --- a/src/share/classes/sun/nio/cs/ext/JIS_X_0208_Encoder.java Thu Sep 01 13:54:38 2011 -0700
601.2 +++ b/src/share/classes/sun/nio/cs/ext/JIS_X_0208_Encoder.java Mon Sep 05 23:58:19 2011 -0700
601.3 @@ -65,19 +65,11 @@
601.4 return -1;
601.5 }
601.6
601.7 - /**
601.8 - * These accessors are temporarily supplied while sun.io
601.9 - * converters co-exist with the sun.nio.cs.{ext} charset coders
601.10 - * These facilitate sharing of conversion tables between the
601.11 - * two co-existing implementations. When sun.io converters
601.12 - * are made extinct these will be unncessary and should be removed
601.13 - */
601.14 -
601.15 - public static short[] getIndex1() {
601.16 + static short[] getIndex1() {
601.17 return index1;
601.18 }
601.19
601.20 - public static String[] getIndex2() {
601.21 + static String[] getIndex2() {
601.22 return index2;
601.23 }
601.24
602.1 --- a/src/share/classes/sun/nio/cs/ext/JIS_X_0208_Solaris_Decoder.java Thu Sep 01 13:54:38 2011 -0700
602.2 +++ b/src/share/classes/sun/nio/cs/ext/JIS_X_0208_Solaris_Decoder.java Mon Sep 05 23:58:19 2011 -0700
602.3 @@ -201,19 +201,11 @@
602.4 }
602.5
602.6
602.7 - /**
602.8 - * These accessors are temporarily supplied while sun.io
602.9 - * converters co-exist with the sun.nio.cs.{ext} charset coders
602.10 - * These facilitate sharing of conversion tables between the
602.11 - * two co-existing implementations. When sun.io converters
602.12 - * are made extinct these will be unncessary and should be removed
602.13 - */
602.14 -
602.15 - public static short[] getIndex1() {
602.16 + static short[] getIndex1() {
602.17 return index1;
602.18 }
602.19
602.20 - public static String[] getIndex2() {
602.21 + static String[] getIndex2() {
602.22 return index2;
602.23 }
602.24 }
603.1 --- a/src/share/classes/sun/nio/cs/ext/JIS_X_0212_Decoder.java Thu Sep 01 13:54:38 2011 -0700
603.2 +++ b/src/share/classes/sun/nio/cs/ext/JIS_X_0212_Decoder.java Mon Sep 05 23:58:19 2011 -0700
603.3 @@ -42,21 +42,6 @@
603.4 0x7E);
603.5 }
603.6
603.7 - /**
603.8 - * These accessors are temporarily supplied while sun.io
603.9 - * converters co-exist with the sun.nio.cs.{ext} charset coders
603.10 - * These facilitate sharing of conversion tables between the
603.11 - * two co-existing implementations. When sun.io converters
603.12 - * are made extinct these will be unncessary and should be removed
603.13 - */
603.14 -
603.15 - public static short[] getIndex1() {
603.16 - return index1;
603.17 - }
603.18 - public static String[] getIndex2() {
603.19 - return index2;
603.20 - }
603.21 -
603.22 private final static String innerIndex0=
603.23 "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
603.24 "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
604.1 --- a/src/share/classes/sun/nio/cs/ext/JIS_X_0212_Encoder.java Thu Sep 01 13:54:38 2011 -0700
604.2 +++ b/src/share/classes/sun/nio/cs/ext/JIS_X_0212_Encoder.java Mon Sep 05 23:58:19 2011 -0700
604.3 @@ -58,20 +58,6 @@
604.4 return -1;
604.5 }
604.6
604.7 - /**
604.8 - * These accessors are temporarily supplied while sun.io
604.9 - * converters co-exist with the sun.nio.cs.{ext} charset coders
604.10 - * These facilitate sharing of conversion tables between the
604.11 - * two co-existing implementations. When sun.io converters
604.12 - * are made extinct these will be unncessary and should be removed
604.13 - */
604.14 - public static short[] getIndex1() {
604.15 - return index1;
604.16 - }
604.17 - public static String[] getIndex2() {
604.18 - return index2;
604.19 - }
604.20 -
604.21 private final static String innerIndex0=
604.22 "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
604.23 "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
605.1 --- a/src/share/classes/sun/nio/cs/ext/JIS_X_0212_Solaris_Decoder.java Thu Sep 01 13:54:38 2011 -0700
605.2 +++ b/src/share/classes/sun/nio/cs/ext/JIS_X_0212_Solaris_Decoder.java Mon Sep 05 23:58:19 2011 -0700
605.3 @@ -41,21 +41,6 @@
605.4 0x7E);
605.5 }
605.6
605.7 - /**
605.8 - * These accessors are temporarily supplied while sun.io
605.9 - * converters co-exist with the sun.nio.cs.{ext} charset coders
605.10 - * These facilitate sharing of conversion tables between the
605.11 - * two co-existing implementations. When sun.io converters
605.12 - * are made extinct these will be unncessary and should be removed
605.13 - */
605.14 -
605.15 - public static short[] getIndex1() {
605.16 - return index1;
605.17 - }
605.18 - public static String[] getIndex2() {
605.19 - return index2;
605.20 - }
605.21 -
605.22 private final static String innerIndex0=
605.23 "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
605.24 "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
606.1 --- a/src/share/classes/sun/nio/cs/ext/JIS_X_0212_Solaris_Encoder.java Thu Sep 01 13:54:38 2011 -0700
606.2 +++ b/src/share/classes/sun/nio/cs/ext/JIS_X_0212_Solaris_Encoder.java Mon Sep 05 23:58:19 2011 -0700
606.3 @@ -48,21 +48,6 @@
606.4 return -1;
606.5 }
606.6
606.7 - /**
606.8 - * These accessors are temporarily supplied while sun.io
606.9 - * converters co-exist with the sun.nio.cs.{ext} charset coders
606.10 - * These facilitate sharing of conversion tables between the
606.11 - * two co-existing implementations. When sun.io converters
606.12 - * are made extinct these will be unncessary and should be removed
606.13 - */
606.14 -
606.15 - public static short[] getIndex1() {
606.16 - return index1;
606.17 - }
606.18 - public static String[] getIndex2() {
606.19 - return index2;
606.20 - }
606.21 -
606.22 private final static String innerIndex0=
606.23 "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
606.24 "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
607.1 --- a/src/share/classes/sun/reflect/AccessorGenerator.java Thu Sep 01 13:54:38 2011 -0700
607.2 +++ b/src/share/classes/sun/reflect/AccessorGenerator.java Mon Sep 05 23:58:19 2011 -0700
607.3 @@ -382,7 +382,7 @@
607.4 /** Returns class name in "internal" form (i.e., '/' separators
607.5 instead of '.') */
607.6 protected static String getClassName
607.7 - (Class c, boolean addPrefixAndSuffixForNonPrimitiveTypes)
607.8 + (Class<?> c, boolean addPrefixAndSuffixForNonPrimitiveTypes)
607.9 {
607.10 if (c.isPrimitive()) {
607.11 if (c == Boolean.TYPE) {
607.12 @@ -490,7 +490,7 @@
607.13 }
607.14 }
607.15
607.16 - protected short indexForPrimitiveType(Class type) {
607.17 + protected short indexForPrimitiveType(Class<?> type) {
607.18 if (type == Boolean.TYPE) {
607.19 return booleanIdx;
607.20 } else if (type == Byte.TYPE) {
607.21 @@ -511,7 +511,7 @@
607.22 throw new InternalError("Should have found primitive type");
607.23 }
607.24
607.25 - protected short ctorIndexForPrimitiveType(Class type) {
607.26 + protected short ctorIndexForPrimitiveType(Class<?> type) {
607.27 if (type == Boolean.TYPE) {
607.28 return booleanCtorIdx;
607.29 } else if (type == Byte.TYPE) {
607.30 @@ -534,7 +534,7 @@
607.31
607.32 /** Returns true for widening or identity conversions for primitive
607.33 types only */
607.34 - protected static boolean canWidenTo(Class type, Class otherType) {
607.35 + protected static boolean canWidenTo(Class<?> type, Class<?> otherType) {
607.36 if (!type.isPrimitive()) {
607.37 return false;
607.38 }
607.39 @@ -609,8 +609,8 @@
607.40 called and returned true. */
607.41 protected static void emitWideningBytecodeForPrimitiveConversion
607.42 (ClassFileAssembler cb,
607.43 - Class fromType,
607.44 - Class toType)
607.45 + Class<?> fromType,
607.46 + Class<?> toType)
607.47 {
607.48 // Note that widening conversions for integral types (i.e., "b2s",
607.49 // "s2i") are no-ops since values on the Java stack are
607.50 @@ -650,7 +650,7 @@
607.51 // Otherwise, was identity or no-op conversion. Fall through.
607.52 }
607.53
607.54 - protected short unboxingMethodForPrimitiveType(Class primType) {
607.55 + protected short unboxingMethodForPrimitiveType(Class<?> primType) {
607.56 if (primType == Boolean.TYPE) {
607.57 return booleanUnboxIdx;
607.58 } else if (primType == Byte.TYPE) {
607.59 @@ -671,7 +671,7 @@
607.60 throw new InternalError("Illegal primitive type " + primType.getName());
607.61 }
607.62
607.63 - protected static final Class[] primitiveTypes = new Class[] {
607.64 + protected static final Class<?>[] primitiveTypes = new Class<?>[] {
607.65 Boolean.TYPE,
607.66 Byte.TYPE,
607.67 Character.TYPE,
607.68 @@ -683,11 +683,11 @@
607.69 };
607.70
607.71 /** We don't consider "Void" to be a primitive type */
607.72 - protected static boolean isPrimitive(Class c) {
607.73 + protected static boolean isPrimitive(Class<?> c) {
607.74 return (c.isPrimitive() && c != Void.TYPE);
607.75 }
607.76
607.77 - protected int typeSizeInStackSlots(Class c) {
607.78 + protected int typeSizeInStackSlots(Class<?> c) {
607.79 if (c == Void.TYPE) {
607.80 return 0;
607.81 }
608.1 --- a/src/share/classes/sun/reflect/BootstrapConstructorAccessorImpl.java Thu Sep 01 13:54:38 2011 -0700
608.2 +++ b/src/share/classes/sun/reflect/BootstrapConstructorAccessorImpl.java Mon Sep 05 23:58:19 2011 -0700
608.3 @@ -32,9 +32,9 @@
608.4 bootstrapping. */
608.5
608.6 class BootstrapConstructorAccessorImpl extends ConstructorAccessorImpl {
608.7 - private Constructor constructor;
608.8 + private Constructor<?> constructor;
608.9
608.10 - BootstrapConstructorAccessorImpl(Constructor c) {
608.11 + BootstrapConstructorAccessorImpl(Constructor<?> c) {
608.12 this.constructor = c;
608.13 }
608.14
609.1 --- a/src/share/classes/sun/reflect/ClassDefiner.java Thu Sep 01 13:54:38 2011 -0700
609.2 +++ b/src/share/classes/sun/reflect/ClassDefiner.java Mon Sep 05 23:58:19 2011 -0700
609.3 @@ -51,8 +51,8 @@
609.4 than would otherwise be possible, decreasing run-time
609.5 footprint. </P>
609.6 */
609.7 - static Class defineClass(String name, byte[] bytes, int off, int len,
609.8 - final ClassLoader parentClassLoader)
609.9 + static Class<?> defineClass(String name, byte[] bytes, int off, int len,
609.10 + final ClassLoader parentClassLoader)
609.11 {
609.12 ClassLoader newLoader = AccessController.doPrivileged(
609.13 new PrivilegedAction<ClassLoader>() {
610.1 --- a/src/share/classes/sun/reflect/ConstantPool.java Thu Sep 01 13:54:38 2011 -0700
610.2 +++ b/src/share/classes/sun/reflect/ConstantPool.java Mon Sep 05 23:58:19 2011 -0700
610.3 @@ -34,8 +34,8 @@
610.4 public class ConstantPool {
610.5 // Number of entries in this constant pool (= maximum valid constant pool index)
610.6 public int getSize() { return getSize0 (constantPoolOop); }
610.7 - public Class getClassAt (int index) { return getClassAt0 (constantPoolOop, index); }
610.8 - public Class getClassAtIfLoaded (int index) { return getClassAtIfLoaded0 (constantPoolOop, index); }
610.9 + public Class<?> getClassAt (int index) { return getClassAt0 (constantPoolOop, index); }
610.10 + public Class<?> getClassAtIfLoaded (int index) { return getClassAtIfLoaded0 (constantPoolOop, index); }
610.11 // Returns either a Method or Constructor.
610.12 // Static initializers are returned as Method objects.
610.13 public Member getMethodAt (int index) { return getMethodAt0 (constantPoolOop, index); }
610.14 @@ -64,8 +64,8 @@
610.15 private Object constantPoolOop;
610.16
610.17 private native int getSize0 (Object constantPoolOop);
610.18 - private native Class getClassAt0 (Object constantPoolOop, int index);
610.19 - private native Class getClassAtIfLoaded0 (Object constantPoolOop, int index);
610.20 + private native Class<?> getClassAt0 (Object constantPoolOop, int index);
610.21 + private native Class<?> getClassAtIfLoaded0 (Object constantPoolOop, int index);
610.22 private native Member getMethodAt0 (Object constantPoolOop, int index);
610.23 private native Member getMethodAtIfLoaded0(Object constantPoolOop, int index);
610.24 private native Field getFieldAt0 (Object constantPoolOop, int index);
611.1 --- a/src/share/classes/sun/reflect/Label.java Thu Sep 01 13:54:38 2011 -0700
611.2 +++ b/src/share/classes/sun/reflect/Label.java Mon Sep 05 23:58:19 2011 -0700
611.3 @@ -25,7 +25,6 @@
611.4
611.5 package sun.reflect;
611.6
611.7 -import java.util.Iterator;
611.8 import java.util.List;
611.9 import java.util.ArrayList;
611.10
611.11 @@ -53,7 +52,7 @@
611.12 short patchBCI;
611.13 int stackDepth;
611.14 }
611.15 - private List/*<PatchInfo>*/ patches = new ArrayList();
611.16 + private List<PatchInfo> patches = new ArrayList<>();
611.17
611.18 public Label() {
611.19 }
611.20 @@ -67,8 +66,7 @@
611.21 }
611.22
611.23 public void bind() {
611.24 - for (Iterator iter = patches.iterator(); iter.hasNext(); ) {
611.25 - PatchInfo patch = (PatchInfo) iter.next();
611.26 + for (PatchInfo patch : patches){
611.27 short curBCI = patch.asm.getLength();
611.28 short offset = (short) (curBCI - patch.instrBCI);
611.29 patch.asm.emitShort(patch.patchBCI, offset);
612.1 --- a/src/share/classes/sun/reflect/MethodAccessorGenerator.java Thu Sep 01 13:54:38 2011 -0700
612.2 +++ b/src/share/classes/sun/reflect/MethodAccessorGenerator.java Mon Sep 05 23:58:19 2011 -0700
612.3 @@ -25,10 +25,8 @@
612.4
612.5 package sun.reflect;
612.6
612.7 -import java.lang.reflect.*;
612.8 import java.security.AccessController;
612.9 import java.security.PrivilegedAction;
612.10 -import sun.misc.Unsafe;
612.11
612.12 /** Generator for sun.reflect.MethodAccessor and
612.13 sun.reflect.ConstructorAccessor objects using bytecodes to
612.14 @@ -50,11 +48,11 @@
612.15 private static volatile int constructorSymnum = 0;
612.16 private static volatile int serializationConstructorSymnum = 0;
612.17
612.18 - private Class declaringClass;
612.19 - private Class[] parameterTypes;
612.20 - private Class returnType;
612.21 - private boolean isConstructor;
612.22 - private boolean forSerialization;
612.23 + private Class<?> declaringClass;
612.24 + private Class<?>[] parameterTypes;
612.25 + private Class<?> returnType;
612.26 + private boolean isConstructor;
612.27 + private boolean forSerialization;
612.28
612.29 private short targetMethodRef;
612.30 private short invokeIdx;
612.31 @@ -67,11 +65,11 @@
612.32 }
612.33
612.34 /** This routine is not thread-safe */
612.35 - public MethodAccessor generateMethod(Class declaringClass,
612.36 - String name,
612.37 - Class[] parameterTypes,
612.38 - Class returnType,
612.39 - Class[] checkedExceptions,
612.40 + public MethodAccessor generateMethod(Class<?> declaringClass,
612.41 + String name,
612.42 + Class<?>[] parameterTypes,
612.43 + Class<?> returnType,
612.44 + Class<?>[] checkedExceptions,
612.45 int modifiers)
612.46 {
612.47 return (MethodAccessor) generate(declaringClass,
612.48 @@ -86,9 +84,9 @@
612.49 }
612.50
612.51 /** This routine is not thread-safe */
612.52 - public ConstructorAccessor generateConstructor(Class declaringClass,
612.53 - Class[] parameterTypes,
612.54 - Class[] checkedExceptions,
612.55 + public ConstructorAccessor generateConstructor(Class<?> declaringClass,
612.56 + Class<?>[] parameterTypes,
612.57 + Class<?>[] checkedExceptions,
612.58 int modifiers)
612.59 {
612.60 return (ConstructorAccessor) generate(declaringClass,
612.61 @@ -104,11 +102,11 @@
612.62
612.63 /** This routine is not thread-safe */
612.64 public SerializationConstructorAccessorImpl
612.65 - generateSerializationConstructor(Class declaringClass,
612.66 - Class[] parameterTypes,
612.67 - Class[] checkedExceptions,
612.68 + generateSerializationConstructor(Class<?> declaringClass,
612.69 + Class<?>[] parameterTypes,
612.70 + Class<?>[] checkedExceptions,
612.71 int modifiers,
612.72 - Class targetConstructorClass)
612.73 + Class<?> targetConstructorClass)
612.74 {
612.75 return (SerializationConstructorAccessorImpl)
612.76 generate(declaringClass,
612.77 @@ -123,15 +121,15 @@
612.78 }
612.79
612.80 /** This routine is not thread-safe */
612.81 - private MagicAccessorImpl generate(final Class declaringClass,
612.82 + private MagicAccessorImpl generate(final Class<?> declaringClass,
612.83 String name,
612.84 - Class[] parameterTypes,
612.85 - Class returnType,
612.86 - Class[] checkedExceptions,
612.87 + Class<?>[] parameterTypes,
612.88 + Class<?> returnType,
612.89 + Class<?>[] checkedExceptions,
612.90 int modifiers,
612.91 boolean isConstructor,
612.92 boolean forSerialization,
612.93 - Class serializationTargetClass)
612.94 + Class<?> serializationTargetClass)
612.95 {
612.96 ByteVector vec = ByteVectorFactory.create();
612.97 asm = new ClassFileAssembler(vec);
612.98 @@ -340,7 +338,7 @@
612.99 // Output class information for non-primitive parameter types
612.100 nonPrimitiveParametersBaseIdx = add(asm.cpi(), S2);
612.101 for (int i = 0; i < parameterTypes.length; i++) {
612.102 - Class c = parameterTypes[i];
612.103 + Class<?> c = parameterTypes[i];
612.104 if (!isPrimitive(c)) {
612.105 asm.emitConstantPoolUTF8(getClassName(c, false));
612.106 asm.emitConstantPoolClass(asm.cpi());
612.107 @@ -403,12 +401,8 @@
612.108 0,
612.109 bytes.length,
612.110 declaringClass.getClassLoader()).newInstance();
612.111 - } catch (InstantiationException e) {
612.112 - throw (InternalError)
612.113 - new InternalError().initCause(e);
612.114 - } catch (IllegalAccessException e) {
612.115 - throw (InternalError)
612.116 - new InternalError().initCause(e);
612.117 + } catch (InstantiationException | IllegalAccessException e) {
612.118 + throw new InternalError(e);
612.119 }
612.120 }
612.121 });
612.122 @@ -530,7 +524,7 @@
612.123 byte count = 1; // both invokeinterface opcode's "count" as well as
612.124 // num args of other invoke bytecodes
612.125 for (int i = 0; i < parameterTypes.length; i++) {
612.126 - Class paramType = parameterTypes[i];
612.127 + Class<?> paramType = parameterTypes[i];
612.128 count += (byte) typeSizeInStackSlots(paramType);
612.129 if (nextParamLabel != null) {
612.130 nextParamLabel.bind();
612.131 @@ -577,7 +571,7 @@
612.132 nextParamLabel = new Label();
612.133
612.134 for (int j = 0; j < primitiveTypes.length; j++) {
612.135 - Class c = primitiveTypes[j];
612.136 + Class<?> c = primitiveTypes[j];
612.137 if (canWidenTo(c, paramType)) {
612.138 if (l != null) {
612.139 l.bind();
613.1 --- a/src/share/classes/sun/reflect/NativeConstructorAccessorImpl.java Thu Sep 01 13:54:38 2011 -0700
613.2 +++ b/src/share/classes/sun/reflect/NativeConstructorAccessorImpl.java Mon Sep 05 23:58:19 2011 -0700
613.3 @@ -31,11 +31,11 @@
613.4 afterward, switches to bytecode-based implementation */
613.5
613.6 class NativeConstructorAccessorImpl extends ConstructorAccessorImpl {
613.7 - private Constructor c;
613.8 + private Constructor<?> c;
613.9 private DelegatingConstructorAccessorImpl parent;
613.10 private int numInvocations;
613.11
613.12 - NativeConstructorAccessorImpl(Constructor c) {
613.13 + NativeConstructorAccessorImpl(Constructor<?> c) {
613.14 this.c = c;
613.15 }
613.16
613.17 @@ -61,7 +61,7 @@
613.18 this.parent = parent;
613.19 }
613.20
613.21 - private static native Object newInstance0(Constructor c, Object[] args)
613.22 + private static native Object newInstance0(Constructor<?> c, Object[] args)
613.23 throws InstantiationException,
613.24 IllegalArgumentException,
613.25 InvocationTargetException;
614.1 --- a/src/share/classes/sun/reflect/Reflection.java Thu Sep 01 13:54:38 2011 -0700
614.2 +++ b/src/share/classes/sun/reflect/Reflection.java Mon Sep 05 23:58:19 2011 -0700
614.3 @@ -26,7 +26,6 @@
614.4 package sun.reflect;
614.5
614.6 import java.lang.reflect.*;
614.7 -import java.util.Collections;
614.8 import java.util.HashMap;
614.9 import java.util.Map;
614.10
614.11 @@ -39,17 +38,17 @@
614.12 view, where they are sensitive or they may contain VM-internal objects.
614.13 These Maps are updated very rarely. Rather than synchronize on
614.14 each access, we use copy-on-write */
614.15 - private static volatile Map<Class,String[]> fieldFilterMap;
614.16 - private static volatile Map<Class,String[]> methodFilterMap;
614.17 + private static volatile Map<Class<?>,String[]> fieldFilterMap;
614.18 + private static volatile Map<Class<?>,String[]> methodFilterMap;
614.19
614.20 static {
614.21 - Map<Class,String[]> map = new HashMap<Class,String[]>();
614.22 + Map<Class<?>,String[]> map = new HashMap<Class<?>,String[]>();
614.23 map.put(Reflection.class,
614.24 new String[] {"fieldFilterMap", "methodFilterMap"});
614.25 map.put(System.class, new String[] {"security"});
614.26 fieldFilterMap = map;
614.27
614.28 - methodFilterMap = new HashMap<Class,String[]>();
614.29 + methodFilterMap = new HashMap<>();
614.30 }
614.31
614.32 /** Returns the class of the method <code>realFramesToSkip</code>
614.33 @@ -61,7 +60,7 @@
614.34 java.lang.reflect.Method.invoke() and its implementation are
614.35 completely ignored and do not count toward the number of "real"
614.36 frames skipped. */
614.37 - public static native Class getCallerClass(int realFramesToSkip);
614.38 + public static native Class<?> getCallerClass(int realFramesToSkip);
614.39
614.40 /** Retrieves the access flags written to the class file. For
614.41 inner classes these flags may differ from those returned by
614.42 @@ -71,18 +70,18 @@
614.43 to compatibility reasons; see 4471811. Only the values of the
614.44 low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
614.45 valid. */
614.46 - private static native int getClassAccessFlags(Class c);
614.47 + private static native int getClassAccessFlags(Class<?> c);
614.48
614.49 /** A quick "fast-path" check to try to avoid getCallerClass()
614.50 calls. */
614.51 - public static boolean quickCheckMemberAccess(Class memberClass,
614.52 + public static boolean quickCheckMemberAccess(Class<?> memberClass,
614.53 int modifiers)
614.54 {
614.55 return Modifier.isPublic(getClassAccessFlags(memberClass) & modifiers);
614.56 }
614.57
614.58 - public static void ensureMemberAccess(Class currentClass,
614.59 - Class memberClass,
614.60 + public static void ensureMemberAccess(Class<?> currentClass,
614.61 + Class<?> memberClass,
614.62 Object target,
614.63 int modifiers)
614.64 throws IllegalAccessException
614.65 @@ -101,13 +100,13 @@
614.66 }
614.67 }
614.68
614.69 - public static boolean verifyMemberAccess(Class currentClass,
614.70 + public static boolean verifyMemberAccess(Class<?> currentClass,
614.71 // Declaring class of field
614.72 // or method
614.73 - Class memberClass,
614.74 + Class<?> memberClass,
614.75 // May be NULL in case of statics
614.76 - Object target,
614.77 - int modifiers)
614.78 + Object target,
614.79 + int modifiers)
614.80 {
614.81 // Verify that currentClass can access a field, method, or
614.82 // constructor of memberClass, where that member's access bits are
614.83 @@ -162,7 +161,7 @@
614.84
614.85 if (Modifier.isProtected(modifiers)) {
614.86 // Additional test for protected members: JLS 6.6.2
614.87 - Class targetClass = (target == null ? memberClass : target.getClass());
614.88 + Class<?> targetClass = (target == null ? memberClass : target.getClass());
614.89 if (targetClass != currentClass) {
614.90 if (!gotIsSameClassPackage) {
614.91 isSameClassPackage = isSameClassPackage(currentClass, memberClass);
614.92 @@ -179,7 +178,7 @@
614.93 return true;
614.94 }
614.95
614.96 - private static boolean isSameClassPackage(Class c1, Class c2) {
614.97 + private static boolean isSameClassPackage(Class<?> c1, Class<?> c2) {
614.98 return isSameClassPackage(c1.getClassLoader(), c1.getName(),
614.99 c2.getClassLoader(), c2.getName());
614.100 }
614.101 @@ -234,8 +233,8 @@
614.102 }
614.103 }
614.104
614.105 - static boolean isSubclassOf(Class queryClass,
614.106 - Class ofClass)
614.107 + static boolean isSubclassOf(Class<?> queryClass,
614.108 + Class<?> ofClass)
614.109 {
614.110 while (queryClass != null) {
614.111 if (queryClass == ofClass) {
614.112 @@ -247,31 +246,31 @@
614.113 }
614.114
614.115 // fieldNames must contain only interned Strings
614.116 - public static synchronized void registerFieldsToFilter(Class containingClass,
614.117 + public static synchronized void registerFieldsToFilter(Class<?> containingClass,
614.118 String ... fieldNames) {
614.119 fieldFilterMap =
614.120 registerFilter(fieldFilterMap, containingClass, fieldNames);
614.121 }
614.122
614.123 // methodNames must contain only interned Strings
614.124 - public static synchronized void registerMethodsToFilter(Class containingClass,
614.125 + public static synchronized void registerMethodsToFilter(Class<?> containingClass,
614.126 String ... methodNames) {
614.127 methodFilterMap =
614.128 registerFilter(methodFilterMap, containingClass, methodNames);
614.129 }
614.130
614.131 - private static Map<Class,String[]> registerFilter(Map<Class,String[]> map,
614.132 - Class containingClass, String ... names) {
614.133 + private static Map<Class<?>,String[]> registerFilter(Map<Class<?>,String[]> map,
614.134 + Class<?> containingClass, String ... names) {
614.135 if (map.get(containingClass) != null) {
614.136 throw new IllegalArgumentException
614.137 ("Filter already registered: " + containingClass);
614.138 }
614.139 - map = new HashMap<Class,String[]>(map);
614.140 + map = new HashMap<Class<?>,String[]>(map);
614.141 map.put(containingClass, names);
614.142 return map;
614.143 }
614.144
614.145 - public static Field[] filterFields(Class containingClass,
614.146 + public static Field[] filterFields(Class<?> containingClass,
614.147 Field[] fields) {
614.148 if (fieldFilterMap == null) {
614.149 // Bootstrapping
614.150 @@ -280,7 +279,7 @@
614.151 return (Field[])filter(fields, fieldFilterMap.get(containingClass));
614.152 }
614.153
614.154 - public static Method[] filterMethods(Class containingClass, Method[] methods) {
614.155 + public static Method[] filterMethods(Class<?> containingClass, Method[] methods) {
614.156 if (methodFilterMap == null) {
614.157 // Bootstrapping
614.158 return methods;
615.1 --- a/src/share/classes/sun/reflect/ReflectionFactory.java Thu Sep 01 13:54:38 2011 -0700
615.2 +++ b/src/share/classes/sun/reflect/ReflectionFactory.java Mon Sep 05 23:58:19 2011 -0700
615.3 @@ -161,7 +161,7 @@
615.4 }
615.5 }
615.6
615.7 - public ConstructorAccessor newConstructorAccessor(Constructor c) {
615.8 + public ConstructorAccessor newConstructorAccessor(Constructor<?> c) {
615.9 checkInitted();
615.10
615.11 Class<?> declaringClass = c.getDeclaringClass();
615.12 @@ -250,14 +250,14 @@
615.13
615.14 /** Creates a new java.lang.reflect.Constructor. Access checks as
615.15 per java.lang.reflect.AccessibleObject are not overridden. */
615.16 - public Constructor newConstructor(Class<?> declaringClass,
615.17 - Class<?>[] parameterTypes,
615.18 - Class<?>[] checkedExceptions,
615.19 - int modifiers,
615.20 - int slot,
615.21 - String signature,
615.22 - byte[] annotations,
615.23 - byte[] parameterAnnotations)
615.24 + public Constructor<?> newConstructor(Class<?> declaringClass,
615.25 + Class<?>[] parameterTypes,
615.26 + Class<?>[] checkedExceptions,
615.27 + int modifiers,
615.28 + int slot,
615.29 + String signature,
615.30 + byte[] annotations,
615.31 + byte[] parameterAnnotations)
615.32 {
615.33 return langReflectAccess().newConstructor(declaringClass,
615.34 parameterTypes,
615.35 @@ -281,13 +281,13 @@
615.36
615.37 /** Gets the ConstructorAccessor object for a
615.38 java.lang.reflect.Constructor */
615.39 - public ConstructorAccessor getConstructorAccessor(Constructor c) {
615.40 + public ConstructorAccessor getConstructorAccessor(Constructor<?> c) {
615.41 return langReflectAccess().getConstructorAccessor(c);
615.42 }
615.43
615.44 /** Sets the ConstructorAccessor object for a
615.45 java.lang.reflect.Constructor */
615.46 - public void setConstructorAccessor(Constructor c,
615.47 + public void setConstructorAccessor(Constructor<?> c,
615.48 ConstructorAccessor accessor)
615.49 {
615.50 langReflectAccess().setConstructorAccessor(c, accessor);
615.51 @@ -320,8 +320,8 @@
615.52 //
615.53 //
615.54
615.55 - public Constructor newConstructorForSerialization
615.56 - (Class<?> classToInstantiate, Constructor constructorToCall)
615.57 + public Constructor<?> newConstructorForSerialization
615.58 + (Class<?> classToInstantiate, Constructor<?> constructorToCall)
615.59 {
615.60 // Fast path
615.61 if (constructorToCall.getDeclaringClass() == classToInstantiate) {
615.62 @@ -334,18 +334,18 @@
615.63 constructorToCall.getExceptionTypes(),
615.64 constructorToCall.getModifiers(),
615.65 constructorToCall.getDeclaringClass());
615.66 - Constructor c = newConstructor(constructorToCall.getDeclaringClass(),
615.67 - constructorToCall.getParameterTypes(),
615.68 - constructorToCall.getExceptionTypes(),
615.69 - constructorToCall.getModifiers(),
615.70 - langReflectAccess().
615.71 - getConstructorSlot(constructorToCall),
615.72 - langReflectAccess().
615.73 - getConstructorSignature(constructorToCall),
615.74 - langReflectAccess().
615.75 - getConstructorAnnotations(constructorToCall),
615.76 - langReflectAccess().
615.77 - getConstructorParameterAnnotations(constructorToCall));
615.78 + Constructor<?> c = newConstructor(constructorToCall.getDeclaringClass(),
615.79 + constructorToCall.getParameterTypes(),
615.80 + constructorToCall.getExceptionTypes(),
615.81 + constructorToCall.getModifiers(),
615.82 + langReflectAccess().
615.83 + getConstructorSlot(constructorToCall),
615.84 + langReflectAccess().
615.85 + getConstructorSignature(constructorToCall),
615.86 + langReflectAccess().
615.87 + getConstructorAnnotations(constructorToCall),
615.88 + langReflectAccess().
615.89 + getConstructorParameterAnnotations(constructorToCall));
615.90 setConstructorAccessor(c, acc);
615.91 return c;
615.92 }
615.93 @@ -393,9 +393,7 @@
615.94 try {
615.95 inflationThreshold = Integer.parseInt(val);
615.96 } catch (NumberFormatException e) {
615.97 - throw (RuntimeException)
615.98 - new RuntimeException("Unable to parse property sun.reflect.inflationThreshold").
615.99 - initCause(e);
615.100 + throw new RuntimeException("Unable to parse property sun.reflect.inflationThreshold", e);
615.101 }
615.102 }
615.103
616.1 --- a/src/share/classes/sun/reflect/UnsafeFieldAccessorFactory.java Thu Sep 01 13:54:38 2011 -0700
616.2 +++ b/src/share/classes/sun/reflect/UnsafeFieldAccessorFactory.java Mon Sep 05 23:58:19 2011 -0700
616.3 @@ -30,7 +30,7 @@
616.4
616.5 class UnsafeFieldAccessorFactory {
616.6 static FieldAccessor newFieldAccessor(Field field, boolean override) {
616.7 - Class type = field.getType();
616.8 + Class<?> type = field.getType();
616.9 boolean isStatic = Modifier.isStatic(field.getModifiers());
616.10 boolean isFinal = Modifier.isFinal(field.getModifiers());
616.11 boolean isVolatile = Modifier.isVolatile(field.getModifiers());
617.1 --- a/src/share/classes/sun/reflect/UnsafeFieldAccessorImpl.java Thu Sep 01 13:54:38 2011 -0700
617.2 +++ b/src/share/classes/sun/reflect/UnsafeFieldAccessorImpl.java Mon Sep 05 23:58:19 2011 -0700
617.3 @@ -40,12 +40,15 @@
617.4 static final Unsafe unsafe = Unsafe.getUnsafe();
617.5
617.6 protected final Field field;
617.7 - protected final int fieldOffset;
617.8 + protected final long fieldOffset;
617.9 protected final boolean isFinal;
617.10
617.11 UnsafeFieldAccessorImpl(Field field) {
617.12 this.field = field;
617.13 - fieldOffset = unsafe.fieldOffset(field);
617.14 + if (Modifier.isStatic(field.getModifiers()))
617.15 + fieldOffset = unsafe.staticFieldOffset(field);
617.16 + else
617.17 + fieldOffset = unsafe.objectFieldOffset(field);
617.18 isFinal = Modifier.isFinal(field.getModifiers());
617.19 }
617.20
618.1 --- a/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java Thu Sep 01 13:54:38 2011 -0700
618.2 +++ b/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java Mon Sep 05 23:58:19 2011 -0700
618.3 @@ -1,5 +1,5 @@
618.4 /*
618.5 - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
618.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
618.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
618.8 *
618.9 * This code is free software; you can redistribute it and/or modify it
618.10 @@ -40,6 +40,7 @@
618.11 * @since 1.5
618.12 */
618.13 class AnnotationInvocationHandler implements InvocationHandler, Serializable {
618.14 + private static final long serialVersionUID = 6182022883658399397L;
618.15 private final Class<? extends Annotation> type;
618.16 private final Map<String, Object> memberValues;
618.17
619.1 --- a/src/share/classes/sun/reflect/annotation/AnnotationParser.java Thu Sep 01 13:54:38 2011 -0700
619.2 +++ b/src/share/classes/sun/reflect/annotation/AnnotationParser.java Mon Sep 05 23:58:19 2011 -0700
619.3 @@ -187,6 +187,7 @@
619.4 * TypeNotPresentException if a referenced annotation type is not
619.5 * available at runtime
619.6 */
619.7 + @SuppressWarnings("unchecked")
619.8 private static Annotation parseAnnotation(ByteBuffer buf,
619.9 ConstantPool constPool,
619.10 Class<?> container,
619.11 @@ -200,7 +201,7 @@
619.12 annotationClass = (Class<? extends Annotation>)parseSig(sig, container);
619.13 } catch (IllegalArgumentException ex) {
619.14 // support obsolete early jsr175 format class files
619.15 - annotationClass = constPool.getClassAt(typeIndex);
619.16 + annotationClass = (Class<? extends Annotation>)constPool.getClassAt(typeIndex);
619.17 }
619.18 } catch (NoClassDefFoundError e) {
619.19 if (exceptionOnMissingAnnotationClass)
619.20 @@ -256,7 +257,7 @@
619.21 Class<? extends Annotation> type, Map<String, Object> memberValues)
619.22 {
619.23 return (Annotation) Proxy.newProxyInstance(
619.24 - type.getClassLoader(), new Class[] { type },
619.25 + type.getClassLoader(), new Class<?>[] { type },
619.26 new AnnotationInvocationHandler(type, memberValues));
619.27 }
619.28
619.29 @@ -287,6 +288,7 @@
619.30 * The member must be of the indicated type. If it is not, this
619.31 * method returns an AnnotationTypeMismatchExceptionProxy.
619.32 */
619.33 + @SuppressWarnings("unchecked")
619.34 public static Object parseMemberValue(Class<?> memberType,
619.35 ByteBuffer buf,
619.36 ConstantPool constPool,
619.37 @@ -411,6 +413,7 @@
619.38 * u2 const_name_index;
619.39 * } enum_const_value;
619.40 */
619.41 + @SuppressWarnings({"rawtypes", "unchecked"})
619.42 private static Object parseEnumValue(Class<? extends Enum> enumType, ByteBuffer buf,
619.43 ConstantPool constPool,
619.44 Class<?> container) {
619.45 @@ -433,7 +436,7 @@
619.46 return Enum.valueOf(enumType, constName);
619.47 } catch(IllegalArgumentException e) {
619.48 return new EnumConstantNotPresentExceptionProxy(
619.49 - (Class<? extends Enum>)enumType, constName);
619.50 + (Class<? extends Enum<?>>)enumType, constName);
619.51 }
619.52 }
619.53
619.54 @@ -451,6 +454,7 @@
619.55 * If the array values do not match arrayType, an
619.56 * AnnotationTypeMismatchExceptionProxy will be returned.
619.57 */
619.58 + @SuppressWarnings("unchecked")
619.59 private static Object parseArray(Class<?> arrayType,
619.60 ByteBuffer buf,
619.61 ConstantPool constPool,
619.62 @@ -479,7 +483,7 @@
619.63 } else if (componentType == Class.class) {
619.64 return parseClassArray(length, buf, constPool, container);
619.65 } else if (componentType.isEnum()) {
619.66 - return parseEnumArray(length, (Class<? extends Enum>)componentType, buf,
619.67 + return parseEnumArray(length, (Class<? extends Enum<?>>)componentType, buf,
619.68 constPool, container);
619.69 } else {
619.70 assert componentType.isAnnotation();
619.71 @@ -679,7 +683,7 @@
619.72 return typeMismatch ? exceptionProxy(tag) : result;
619.73 }
619.74
619.75 - private static Object parseEnumArray(int length, Class<? extends Enum> enumType,
619.76 + private static Object parseEnumArray(int length, Class<? extends Enum<?>> enumType,
619.77 ByteBuffer buf,
619.78 ConstantPool constPool,
619.79 Class<?> container) {
620.1 --- a/src/share/classes/sun/reflect/annotation/AnnotationTypeMismatchExceptionProxy.java Thu Sep 01 13:54:38 2011 -0700
620.2 +++ b/src/share/classes/sun/reflect/annotation/AnnotationTypeMismatchExceptionProxy.java Mon Sep 05 23:58:19 2011 -0700
620.3 @@ -1,5 +1,5 @@
620.4 /*
620.5 - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
620.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
620.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
620.8 *
620.9 * This code is free software; you can redistribute it and/or modify it
620.10 @@ -34,6 +34,7 @@
620.11 * @since 1.5
620.12 */
620.13 class AnnotationTypeMismatchExceptionProxy extends ExceptionProxy {
620.14 + private static final long serialVersionUID = 7844069490309503934L;
620.15 private Method member;
620.16 private String foundType;
620.17
621.1 --- a/src/share/classes/sun/reflect/annotation/EnumConstantNotPresentExceptionProxy.java Thu Sep 01 13:54:38 2011 -0700
621.2 +++ b/src/share/classes/sun/reflect/annotation/EnumConstantNotPresentExceptionProxy.java Mon Sep 05 23:58:19 2011 -0700
621.3 @@ -1,5 +1,5 @@
621.4 /*
621.5 - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
621.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
621.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
621.8 *
621.9 * This code is free software; you can redistribute it and/or modify it
621.10 @@ -24,7 +24,6 @@
621.11 */
621.12
621.13 package sun.reflect.annotation;
621.14 -import java.lang.annotation.*;
621.15
621.16 /**
621.17 * ExceptionProxy for EnumConstantNotPresentException.
621.18 @@ -33,10 +32,11 @@
621.19 * @since 1.5
621.20 */
621.21 public class EnumConstantNotPresentExceptionProxy extends ExceptionProxy {
621.22 - Class<? extends Enum> enumType;
621.23 + private static final long serialVersionUID = -604662101303187330L;
621.24 + Class<? extends Enum<?>> enumType;
621.25 String constName;
621.26
621.27 - public EnumConstantNotPresentExceptionProxy(Class<? extends Enum> enumType,
621.28 + public EnumConstantNotPresentExceptionProxy(Class<? extends Enum<?>> enumType,
621.29 String constName) {
621.30 this.enumType = enumType;
621.31 this.constName = constName;
622.1 --- a/src/share/classes/sun/reflect/annotation/TypeNotPresentExceptionProxy.java Thu Sep 01 13:54:38 2011 -0700
622.2 +++ b/src/share/classes/sun/reflect/annotation/TypeNotPresentExceptionProxy.java Mon Sep 05 23:58:19 2011 -0700
622.3 @@ -1,5 +1,5 @@
622.4 /*
622.5 - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
622.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
622.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
622.8 *
622.9 * This code is free software; you can redistribute it and/or modify it
622.10 @@ -33,6 +33,7 @@
622.11 * @since 1.5
622.12 */
622.13 public class TypeNotPresentExceptionProxy extends ExceptionProxy {
622.14 + private static final long serialVersionUID = 5565925172427947573L;
622.15 String typeName;
622.16 Throwable cause;
622.17
623.1 --- a/src/share/classes/sun/reflect/generics/parser/SignatureParser.java Thu Sep 01 13:54:38 2011 -0700
623.2 +++ b/src/share/classes/sun/reflect/generics/parser/SignatureParser.java Mon Sep 05 23:58:19 2011 -0700
623.3 @@ -1,5 +1,5 @@
623.4 /*
623.5 - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
623.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
623.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
623.8 *
623.9 * This code is free software; you can redistribute it and/or modify it
623.10 @@ -25,17 +25,15 @@
623.11
623.12 package sun.reflect.generics.parser;
623.13
623.14 -
623.15 import java.lang.reflect.GenericSignatureFormatError;
623.16 import java.util.*;
623.17 import sun.reflect.generics.tree.*;
623.18
623.19 -
623.20 /**
623.21 * Parser for type signatures, as defined in the Java Virtual
623.22 -// Machine Specification (JVMS) chapter 4.
623.23 + * Machine Specification (JVMS) chapter 4.
623.24 * Converts the signatures into an abstract syntax tree (AST) representation.
623.25 -// See the package sun.reflect.generics.tree for details of the AST.
623.26 + * See the package sun.reflect.generics.tree for details of the AST.
623.27 */
623.28 public class SignatureParser {
623.29 // The input is conceptually a character stream (though currently it's
623.30 @@ -58,8 +56,8 @@
623.31 // if (current != x {error("expected an x");
623.32 //
623.33 // where x is some character constant.
623.34 - // The assertion inidcates, that, as currently written,
623.35 - // the code should nver reach this point unless the input is an
623.36 + // The assertion indicates, that, as currently written,
623.37 + // the code should never reach this point unless the input is an
623.38 // x. On the other hand, the test is there to check the legality
623.39 // of the input wrt to a given production. It may be that at a later
623.40 // time the code might be called directly, and if the input is
623.41 @@ -68,7 +66,7 @@
623.42
623.43 private char[] input; // the input signature
623.44 private int index = 0; // index into the input
623.45 -// used to mark end of input
623.46 + // used to mark end of input
623.47 private static final char EOI = ':';
623.48 private static final boolean DEBUG = false;
623.49
623.50 @@ -104,6 +102,11 @@
623.51 index++;
623.52 }
623.53
623.54 + // For debugging, prints current character to the end of the input.
623.55 + private String remainder() {
623.56 + return new String(input, index, input.length-index);
623.57 + }
623.58 +
623.59 // Match c against a "set" of characters
623.60 private boolean matches(char c, char... set) {
623.61 for (char e : set) {
623.62 @@ -117,8 +120,17 @@
623.63 // Currently throws a GenericSignatureFormatError.
623.64
623.65 private Error error(String errorMsg) {
623.66 - if (DEBUG) System.out.println("Parse error:" + errorMsg);
623.67 - return new GenericSignatureFormatError();
623.68 + return new GenericSignatureFormatError("Signature Parse error: " + errorMsg +
623.69 + "\n\tRemaining input: " + remainder());
623.70 + }
623.71 +
623.72 + /**
623.73 + * Verify the parse has made forward progress; throw an exception
623.74 + * if no progress.
623.75 + */
623.76 + private void progress(int startingPosition) {
623.77 + if (index <= startingPosition)
623.78 + throw error("Failure to make progress!");
623.79 }
623.80
623.81 /**
623.82 @@ -163,6 +175,7 @@
623.83 /**
623.84 * Parses a type signature
623.85 * and produces an abstract syntax tree representing it.
623.86 + *
623.87 * @param s a string representing the input type signature
623.88 * @return An abstract syntax tree for a type signature
623.89 * corresponding to the input string
623.90 @@ -183,38 +196,58 @@
623.91 // and when it completes parsing, it leaves the input at the first
623.92 // character after the input parses.
623.93
623.94 - // parse a class signature based on the implicit input.
623.95 + /*
623.96 + * Note on grammar conventions: a trailing "*" matches zero or
623.97 + * more occurrences, a trailing "+" matches one or more occurrences,
623.98 + * "_opt" indicates an optional component.
623.99 + */
623.100 +
623.101 + /**
623.102 + * ClassSignature:
623.103 + * FormalTypeParameters_opt SuperclassSignature SuperinterfaceSignature*
623.104 + */
623.105 private ClassSignature parseClassSignature() {
623.106 + // parse a class signature based on the implicit input.
623.107 assert(index == 0);
623.108 return ClassSignature.make(parseZeroOrMoreFormalTypeParameters(),
623.109 - parseClassTypeSignature(),
623.110 + parseClassTypeSignature(), // Only rule for SuperclassSignature
623.111 parseSuperInterfaces());
623.112 }
623.113
623.114 private FormalTypeParameter[] parseZeroOrMoreFormalTypeParameters(){
623.115 - if (current() == '<') { return parseFormalTypeParameters();}
623.116 - else {return new FormalTypeParameter[0];}
623.117 + if (current() == '<') {
623.118 + return parseFormalTypeParameters();
623.119 + } else {
623.120 + return new FormalTypeParameter[0];
623.121 + }
623.122 }
623.123
623.124 -
623.125 + /**
623.126 + * FormalTypeParameters:
623.127 + * "<" FormalTypeParameter+ ">"
623.128 + */
623.129 private FormalTypeParameter[] parseFormalTypeParameters(){
623.130 - Collection<FormalTypeParameter> ftps =
623.131 - new ArrayList<FormalTypeParameter>(3);
623.132 + List<FormalTypeParameter> ftps = new ArrayList<>(3);
623.133 assert(current() == '<'); // should not have been called at all
623.134 - if (current() != '<') { throw error("expected <");}
623.135 + if (current() != '<') { throw error("expected '<'");}
623.136 advance();
623.137 ftps.add(parseFormalTypeParameter());
623.138 while (current() != '>') {
623.139 + int startingPosition = index;
623.140 ftps.add(parseFormalTypeParameter());
623.141 + progress(startingPosition);
623.142 }
623.143 advance();
623.144 - FormalTypeParameter[] ftpa = new FormalTypeParameter[ftps.size()];
623.145 - return ftps.toArray(ftpa);
623.146 + return ftps.toArray(new FormalTypeParameter[ftps.size()]);
623.147 }
623.148
623.149 + /**
623.150 + * FormalTypeParameter:
623.151 + * Identifier ClassBound InterfaceBound*
623.152 + */
623.153 private FormalTypeParameter parseFormalTypeParameter(){
623.154 String id = parseIdentifier();
623.155 - FieldTypeSignature[] bs = parseZeroOrMoreBounds();
623.156 + FieldTypeSignature[] bs = parseBounds();
623.157 return FormalTypeParameter.make(id, bs);
623.158 }
623.159
623.160 @@ -229,7 +262,8 @@
623.161 case '[':
623.162 case ':':
623.163 case '>':
623.164 - case '<': return result.toString();
623.165 + case '<':
623.166 + return result.toString();
623.167 default:{
623.168 result.append(c);
623.169 advance();
623.170 @@ -239,26 +273,42 @@
623.171 }
623.172 return result.toString();
623.173 }
623.174 + /**
623.175 + * FieldTypeSignature:
623.176 + * ClassTypeSignature
623.177 + * ArrayTypeSignature
623.178 + * TypeVariableSignature
623.179 + */
623.180 + private FieldTypeSignature parseFieldTypeSignature() {
623.181 + return parseFieldTypeSignature(true);
623.182 + }
623.183
623.184 - private FieldTypeSignature parseFieldTypeSignature() {
623.185 + private FieldTypeSignature parseFieldTypeSignature(boolean allowArrays) {
623.186 switch(current()) {
623.187 case 'L':
623.188 return parseClassTypeSignature();
623.189 case 'T':
623.190 return parseTypeVariableSignature();
623.191 case '[':
623.192 - return parseArrayTypeSignature();
623.193 + if (allowArrays)
623.194 + return parseArrayTypeSignature();
623.195 + else
623.196 + throw error("Array signature not allowed here.");
623.197 default: throw error("Expected Field Type Signature");
623.198 }
623.199 }
623.200
623.201 + /**
623.202 + * ClassTypeSignature:
623.203 + * "L" PackageSpecifier_opt SimpleClassTypeSignature ClassTypeSignatureSuffix* ";"
623.204 + */
623.205 private ClassTypeSignature parseClassTypeSignature(){
623.206 assert(current() == 'L');
623.207 if (current() != 'L') { throw error("expected a class type");}
623.208 advance();
623.209 - List<SimpleClassTypeSignature> scts =
623.210 - new ArrayList<SimpleClassTypeSignature>(5);
623.211 - scts.add(parseSimpleClassTypeSignature(false));
623.212 + List<SimpleClassTypeSignature> scts = new ArrayList<>(5);
623.213 + scts.add(parsePackageNameAndSimpleClassTypeSignature());
623.214 +
623.215 parseClassTypeSignatureSuffix(scts);
623.216 if (current() != ';')
623.217 throw error("expected ';' got '" + current() + "'");
623.218 @@ -267,25 +317,65 @@
623.219 return ClassTypeSignature.make(scts);
623.220 }
623.221
623.222 - private SimpleClassTypeSignature parseSimpleClassTypeSignature(boolean dollar){
623.223 - String id = parseIdentifier();
623.224 - char c = current();
623.225 - switch (c) {
623.226 - case ';':
623.227 - case '/':
623.228 - return SimpleClassTypeSignature.make(id, dollar, new TypeArgument[0]) ;
623.229 - case '<': {
623.230 - return SimpleClassTypeSignature.make(id, dollar, parseTypeArguments());
623.231 + /**
623.232 + * PackageSpecifier:
623.233 + * Identifier "/" PackageSpecifier*
623.234 + */
623.235 + private SimpleClassTypeSignature parsePackageNameAndSimpleClassTypeSignature() {
623.236 + // Parse both any optional leading PackageSpecifier as well as
623.237 + // the following SimpleClassTypeSignature.
623.238 +
623.239 + String id = parseIdentifier();
623.240 +
623.241 + if (current() == '/') { // package name
623.242 + StringBuilder idBuild = new StringBuilder(id);
623.243 +
623.244 + while(current() == '/') {
623.245 + advance();
623.246 + idBuild.append(".");
623.247 + idBuild.append(parseIdentifier());
623.248 }
623.249 - default: {throw error("expected < or ; or /");}
623.250 - }
623.251 + id = idBuild.toString();
623.252 + }
623.253 +
623.254 + switch (current()) {
623.255 + case ';':
623.256 + return SimpleClassTypeSignature.make(id, false, new TypeArgument[0]); // all done!
623.257 + case '<':
623.258 + if (DEBUG) System.out.println("\t remainder: " + remainder());
623.259 + return SimpleClassTypeSignature.make(id, false, parseTypeArguments());
623.260 + default:
623.261 + throw error("expected '<' or ';' but got " + current());
623.262 + }
623.263 }
623.264
623.265 + /**
623.266 + * SimpleClassTypeSignature:
623.267 + * Identifier TypeArguments_opt
623.268 + */
623.269 + private SimpleClassTypeSignature parseSimpleClassTypeSignature(boolean dollar){
623.270 + String id = parseIdentifier();
623.271 + char c = current();
623.272 +
623.273 + switch (c) {
623.274 + case ';':
623.275 + case '.':
623.276 + return SimpleClassTypeSignature.make(id, dollar, new TypeArgument[0]) ;
623.277 + case '<':
623.278 + return SimpleClassTypeSignature.make(id, dollar, parseTypeArguments());
623.279 + default:
623.280 + throw error("expected '<' or ';' or '.', got '" + c + "'.");
623.281 + }
623.282 + }
623.283 +
623.284 + /**
623.285 + * ClassTypeSignatureSuffix:
623.286 + * "." SimpleClassTypeSignature
623.287 + */
623.288 private void parseClassTypeSignatureSuffix(List<SimpleClassTypeSignature> scts) {
623.289 - while (current() == '/' || current() == '.') {
623.290 - boolean dollar = (current() == '.');
623.291 + while (current() == '.') {
623.292 advance();
623.293 - scts.add(parseSimpleClassTypeSignature(dollar));
623.294 + scts.add(parseSimpleClassTypeSignature(true));
623.295 }
623.296 }
623.297
623.298 @@ -294,10 +384,14 @@
623.299 else {return new TypeArgument[0];}
623.300 }
623.301
623.302 + /**
623.303 + * TypeArguments:
623.304 + * "<" TypeArgument+ ">"
623.305 + */
623.306 private TypeArgument[] parseTypeArguments() {
623.307 - Collection<TypeArgument> tas = new ArrayList<TypeArgument>(3);
623.308 + List<TypeArgument> tas = new ArrayList<>(3);
623.309 assert(current() == '<');
623.310 - if (current() != '<') { throw error("expected <");}
623.311 + if (current() != '<') { throw error("expected '<'");}
623.312 advance();
623.313 tas.add(parseTypeArgument());
623.314 while (current() != '>') {
623.315 @@ -305,10 +399,14 @@
623.316 tas.add(parseTypeArgument());
623.317 }
623.318 advance();
623.319 - TypeArgument[] taa = new TypeArgument[tas.size()];
623.320 - return tas.toArray(taa);
623.321 + return tas.toArray(new TypeArgument[tas.size()]);
623.322 }
623.323
623.324 + /**
623.325 + * TypeArgument:
623.326 + * WildcardIndicator_opt FieldTypeSignature
623.327 + * "*"
623.328 + */
623.329 private TypeArgument parseTypeArgument() {
623.330 FieldTypeSignature[] ub, lb;
623.331 ub = new FieldTypeSignature[1];
623.332 @@ -334,18 +432,20 @@
623.333 ub[0] = SimpleClassTypeSignature.make("java.lang.Object", false, ta);
623.334 return Wildcard.make(ub, lb);
623.335 }
623.336 - default: return parseFieldTypeSignature();
623.337 + default:
623.338 + return parseFieldTypeSignature();
623.339 }
623.340 }
623.341
623.342 - // TypeVariableSignature -> T identifier
623.343 -
623.344 - private TypeVariableSignature parseTypeVariableSignature(){
623.345 + /**
623.346 + * TypeVariableSignature:
623.347 + * "T" Identifier ";"
623.348 + */
623.349 + private TypeVariableSignature parseTypeVariableSignature() {
623.350 assert(current() == 'T');
623.351 if (current() != 'T') { throw error("expected a type variable usage");}
623.352 advance();
623.353 - TypeVariableSignature ts =
623.354 - TypeVariableSignature.make(parseIdentifier());
623.355 + TypeVariableSignature ts = TypeVariableSignature.make(parseIdentifier());
623.356 if (current() != ';') {
623.357 throw error("; expected in signature of type variable named" +
623.358 ts.getIdentifier());
623.359 @@ -354,16 +454,21 @@
623.360 return ts;
623.361 }
623.362
623.363 - // ArrayTypeSignature -> [ TypeSignature
623.364 -
623.365 + /**
623.366 + * ArrayTypeSignature:
623.367 + * "[" TypeSignature
623.368 + */
623.369 private ArrayTypeSignature parseArrayTypeSignature() {
623.370 if (current() != '[') {throw error("expected array type signature");}
623.371 advance();
623.372 return ArrayTypeSignature.make(parseTypeSignature());
623.373 }
623.374
623.375 - // TypeSignature -> BaseType | FieldTypeSignature
623.376 -
623.377 + /**
623.378 + * TypeSignature:
623.379 + * FieldTypeSignature
623.380 + * BaseType
623.381 + */
623.382 private TypeSignature parseTypeSignature() {
623.383 switch (current()) {
623.384 case 'B':
623.385 @@ -373,8 +478,11 @@
623.386 case 'I':
623.387 case 'J':
623.388 case 'S':
623.389 - case 'Z':return parseBaseType();
623.390 - default: return parseFieldTypeSignature();
623.391 + case 'Z':
623.392 + return parseBaseType();
623.393 +
623.394 + default:
623.395 + return parseFieldTypeSignature();
623.396 }
623.397 }
623.398
623.399 @@ -408,12 +516,18 @@
623.400 assert(false);
623.401 throw error("expected primitive type");
623.402 }
623.403 - }
623.404 + }
623.405 }
623.406
623.407 - private FieldTypeSignature[] parseZeroOrMoreBounds() {
623.408 - Collection<FieldTypeSignature> fts =
623.409 - new ArrayList<FieldTypeSignature>(3);
623.410 + /**
623.411 + * ClassBound:
623.412 + * ":" FieldTypeSignature_opt
623.413 + *
623.414 + * InterfaceBound:
623.415 + * ":" FieldTypeSignature
623.416 + */
623.417 + private FieldTypeSignature[] parseBounds() {
623.418 + List<FieldTypeSignature> fts = new ArrayList<>(3);
623.419
623.420 if (current() == ':') {
623.421 advance();
623.422 @@ -430,24 +544,31 @@
623.423 advance();
623.424 fts.add(parseFieldTypeSignature());
623.425 }
623.426 - }
623.427 + } else
623.428 + error("Bound expected");
623.429
623.430 - FieldTypeSignature[] fta = new FieldTypeSignature[fts.size()];
623.431 - return fts.toArray(fta);
623.432 + return fts.toArray(new FieldTypeSignature[fts.size()]);
623.433 }
623.434
623.435 + /**
623.436 + * SuperclassSignature:
623.437 + * ClassTypeSignature
623.438 + */
623.439 private ClassTypeSignature[] parseSuperInterfaces() {
623.440 - Collection<ClassTypeSignature> cts =
623.441 - new ArrayList<ClassTypeSignature>(5);
623.442 + List<ClassTypeSignature> cts = new ArrayList<>(5);
623.443 while(current() == 'L') {
623.444 cts.add(parseClassTypeSignature());
623.445 }
623.446 - ClassTypeSignature[] cta = new ClassTypeSignature[cts.size()];
623.447 - return cts.toArray(cta);
623.448 + return cts.toArray(new ClassTypeSignature[cts.size()]);
623.449 }
623.450
623.451 - // parse a method signature based on the implicit input.
623.452 +
623.453 + /**
623.454 + * MethodTypeSignature:
623.455 + * FormalTypeParameters_opt "(" TypeSignature* ")" ReturnType ThrowsSignature*
623.456 + */
623.457 private MethodTypeSignature parseMethodTypeSignature() {
623.458 + // Parse a method signature based on the implicit input.
623.459 FieldTypeSignature[] ets;
623.460
623.461 assert(index == 0);
623.462 @@ -457,19 +578,19 @@
623.463 parseZeroOrMoreThrowsSignatures());
623.464 }
623.465
623.466 - // (TypeSignature*)
623.467 + // "(" TypeSignature* ")"
623.468 private TypeSignature[] parseFormalParameters() {
623.469 - if (current() != '(') {throw error("expected (");}
623.470 + if (current() != '(') {throw error("expected '('");}
623.471 advance();
623.472 TypeSignature[] pts = parseZeroOrMoreTypeSignatures();
623.473 - if (current() != ')') {throw error("expected )");}
623.474 + if (current() != ')') {throw error("expected ')'");}
623.475 advance();
623.476 return pts;
623.477 }
623.478
623.479 - // TypeSignature*
623.480 + // TypeSignature*
623.481 private TypeSignature[] parseZeroOrMoreTypeSignatures() {
623.482 - Collection<TypeSignature> ts = new ArrayList<TypeSignature>();
623.483 + List<TypeSignature> ts = new ArrayList<>();
623.484 boolean stop = false;
623.485 while (!stop) {
623.486 switch(current()) {
623.487 @@ -484,47 +605,46 @@
623.488 case 'L':
623.489 case 'T':
623.490 case '[': {
623.491 - ts.add(parseTypeSignature());
623.492 - break;
623.493 - }
623.494 + ts.add(parseTypeSignature());
623.495 + break;
623.496 + }
623.497 default: stop = true;
623.498 }
623.499 }
623.500 - /* while( matches(current(),
623.501 - 'B', 'C', 'D', 'F', 'I', 'J', 'S', 'Z', 'L', 'T', '[')
623.502 - ) {
623.503 - ts.add(parseTypeSignature());
623.504 - }*/
623.505 - TypeSignature[] ta = new TypeSignature[ts.size()];
623.506 - return ts.toArray(ta);
623.507 + return ts.toArray(new TypeSignature[ts.size()]);
623.508 }
623.509
623.510 - // ReturnType -> V | TypeSignature
623.511 -
623.512 + /**
623.513 + * ReturnType:
623.514 + * TypeSignature
623.515 + * VoidDescriptor
623.516 + */
623.517 private ReturnType parseReturnType(){
623.518 - if (current() == 'V') {
623.519 + if (current() == 'V') {
623.520 advance();
623.521 return VoidDescriptor.make();
623.522 - } else return parseTypeSignature();
623.523 + } else
623.524 + return parseTypeSignature();
623.525 }
623.526
623.527 // ThrowSignature*
623.528 private FieldTypeSignature[] parseZeroOrMoreThrowsSignatures(){
623.529 - Collection<FieldTypeSignature> ets =
623.530 - new ArrayList<FieldTypeSignature>(3);
623.531 + List<FieldTypeSignature> ets = new ArrayList<>(3);
623.532 while( current() == '^') {
623.533 ets.add(parseThrowsSignature());
623.534 }
623.535 - FieldTypeSignature[] eta = new FieldTypeSignature[ets.size()];
623.536 - return ets.toArray(eta);
623.537 + return ets.toArray(new FieldTypeSignature[ets.size()]);
623.538 }
623.539
623.540 - // ThrowSignature -> ^ FieldTypeSignature
623.541 -
623.542 + /**
623.543 + * ThrowsSignature:
623.544 + * "^" ClassTypeSignature
623.545 + * "^" TypeVariableSignature
623.546 + */
623.547 private FieldTypeSignature parseThrowsSignature() {
623.548 assert(current() == '^');
623.549 if (current() != '^') { throw error("expected throws signature");}
623.550 advance();
623.551 - return parseFieldTypeSignature();
623.552 + return parseFieldTypeSignature(false);
623.553 }
623.554 }
624.1 --- a/src/share/classes/sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java Thu Sep 01 13:54:38 2011 -0700
624.2 +++ b/src/share/classes/sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java Mon Sep 05 23:58:19 2011 -0700
624.3 @@ -157,7 +157,7 @@
624.4 @Override
624.5 public boolean equals(Object o) {
624.6 if (o instanceof TypeVariable) {
624.7 - TypeVariable that = (TypeVariable) o;
624.8 + TypeVariable<?> that = (TypeVariable<?>) o;
624.9
624.10 GenericDeclaration thatDecl = that.getGenericDeclaration();
624.11 String thatName = that.getName();
625.1 --- a/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java Thu Sep 01 13:54:38 2011 -0700
625.2 +++ b/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java Mon Sep 05 23:58:19 2011 -0700
625.3 @@ -69,7 +69,7 @@
625.4 // first, extract type parameter subtree(s) from AST
625.5 FormalTypeParameter[] ftps = getTree().getFormalTypeParameters();
625.6 // create array to store reified subtree(s)
625.7 - TypeVariable[] tps = new TypeVariable[ftps.length];
625.8 + TypeVariable<?>[] tps = new TypeVariable<?>[ftps.length];
625.9 // reify all subtrees
625.10 for (int i = 0; i < ftps.length; i++) {
625.11 Reifier r = getReifier(); // obtain visitor
626.1 --- a/src/share/classes/sun/reflect/generics/scope/AbstractScope.java Thu Sep 01 13:54:38 2011 -0700
626.2 +++ b/src/share/classes/sun/reflect/generics/scope/AbstractScope.java Mon Sep 05 23:58:19 2011 -0700
626.3 @@ -83,8 +83,8 @@
626.4 * @return the requested type variable, if found
626.5 */
626.6 public TypeVariable<?> lookup(String name) {
626.7 - TypeVariable[] tas = getRecvr().getTypeParameters();
626.8 - for (TypeVariable/*<?>*/ tv : tas) {
626.9 + TypeVariable<?>[] tas = getRecvr().getTypeParameters();
626.10 + for (TypeVariable<?> tv : tas) {
626.11 if (tv.getName().equals(name)) {return tv;}
626.12 }
626.13 return getEnclosingScope().lookup(name);
627.1 --- a/src/share/classes/sun/reflect/generics/scope/ConstructorScope.java Thu Sep 01 13:54:38 2011 -0700
627.2 +++ b/src/share/classes/sun/reflect/generics/scope/ConstructorScope.java Mon Sep 05 23:58:19 2011 -0700
627.3 @@ -32,10 +32,10 @@
627.4 * This class represents the scope containing the type variables of
627.5 * a constructor.
627.6 */
627.7 -public class ConstructorScope extends AbstractScope<Constructor> {
627.8 +public class ConstructorScope extends AbstractScope<Constructor<?>> {
627.9
627.10 // constructor is private to enforce use of factory method
627.11 - private ConstructorScope(Constructor c){
627.12 + private ConstructorScope(Constructor<?> c){
627.13 super(c);
627.14 }
627.15
627.16 @@ -61,7 +61,7 @@
627.17 * @param m - A Constructor whose scope we want to obtain
627.18 * @return The type-variable scope for the constructor m
627.19 */
627.20 - public static ConstructorScope make(Constructor c) {
627.21 + public static ConstructorScope make(Constructor<?> c) {
627.22 return new ConstructorScope(c);
627.23 }
627.24 }
628.1 --- a/src/share/classes/sun/reflect/generics/tree/ClassSignature.java Thu Sep 01 13:54:38 2011 -0700
628.2 +++ b/src/share/classes/sun/reflect/generics/tree/ClassSignature.java Mon Sep 05 23:58:19 2011 -0700
628.3 @@ -52,5 +52,5 @@
628.4 public ClassTypeSignature getSuperclass(){return superclass;}
628.5 public ClassTypeSignature[] getSuperInterfaces(){return superInterfaces;}
628.6
628.7 - public void accept(Visitor v){v.visitClassSignature(this);}
628.8 + public void accept(Visitor<?> v){v.visitClassSignature(this);}
628.9 }
629.1 --- a/src/share/classes/sun/reflect/generics/tree/MethodTypeSignature.java Thu Sep 01 13:54:38 2011 -0700
629.2 +++ b/src/share/classes/sun/reflect/generics/tree/MethodTypeSignature.java Mon Sep 05 23:58:19 2011 -0700
629.3 @@ -57,5 +57,5 @@
629.4 public ReturnType getReturnType(){return returnType;}
629.5 public FieldTypeSignature[] getExceptionTypes(){return exceptionTypes;}
629.6
629.7 - public void accept(Visitor v){v.visitMethodTypeSignature(this);}
629.8 + public void accept(Visitor<?> v){v.visitMethodTypeSignature(this);}
629.9 }
630.1 --- a/src/share/classes/sun/security/acl/AclEntryImpl.java Thu Sep 01 13:54:38 2011 -0700
630.2 +++ b/src/share/classes/sun/security/acl/AclEntryImpl.java Mon Sep 05 23:58:19 2011 -0700
630.3 @@ -25,7 +25,6 @@
630.4 package sun.security.acl;
630.5
630.6 import java.util.*;
630.7 -import java.io.*;
630.8 import java.security.Principal;
630.9 import java.security.acl.*;
630.10
630.11 @@ -162,6 +161,7 @@
630.12 /**
630.13 * Clones an AclEntry.
630.14 */
630.15 + @SuppressWarnings("unchecked") // Safe casts assuming clone() works correctly
630.16 public synchronized Object clone() {
630.17 AclEntryImpl cloned;
630.18 cloned = new AclEntryImpl(user);
631.1 --- a/src/share/classes/sun/security/action/PutAllAction.java Thu Sep 01 13:54:38 2011 -0700
631.2 +++ b/src/share/classes/sun/security/action/PutAllAction.java Mon Sep 05 23:58:19 2011 -0700
631.3 @@ -1,5 +1,5 @@
631.4 /*
631.5 - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
631.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
631.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
631.8 *
631.9 * This code is free software; you can redistribute it and/or modify it
631.10 @@ -41,9 +41,9 @@
631.11 public class PutAllAction implements PrivilegedAction<Void> {
631.12
631.13 private final Provider provider;
631.14 - private final Map map;
631.15 + private final Map<?, ?> map;
631.16
631.17 - public PutAllAction(Provider provider, Map map) {
631.18 + public PutAllAction(Provider provider, Map<?, ?> map) {
631.19 this.provider = provider;
631.20 this.map = map;
631.21 }
632.1 --- a/src/share/classes/sun/security/ec/ECDSASignature.java Thu Sep 01 13:54:38 2011 -0700
632.2 +++ b/src/share/classes/sun/security/ec/ECDSASignature.java Mon Sep 05 23:58:19 2011 -0700
632.3 @@ -1,5 +1,5 @@
632.4 /*
632.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
632.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
632.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
632.8 *
632.9 * This code is free software; you can redistribute it and/or modify it
632.10 @@ -25,10 +25,8 @@
632.11
632.12 package sun.security.ec;
632.13
632.14 -import java.io.IOException;
632.15 import java.nio.ByteBuffer;
632.16 import java.math.BigInteger;
632.17 -import java.util.Arrays;
632.18
632.19 import java.security.*;
632.20 import java.security.interfaces.*;
632.21 @@ -36,7 +34,6 @@
632.22
632.23 import sun.security.jca.JCAUtil;
632.24 import sun.security.util.*;
632.25 -import sun.security.x509.AlgorithmId;
632.26
632.27 /**
632.28 * ECDSA signature implementation. This class currently supports the
633.1 --- a/src/share/classes/sun/security/ec/ECKeyFactory.java Thu Sep 01 13:54:38 2011 -0700
633.2 +++ b/src/share/classes/sun/security/ec/ECKeyFactory.java Mon Sep 05 23:58:19 2011 -0700
633.3 @@ -1,5 +1,5 @@
633.4 /*
633.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
633.6 + * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
633.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
633.8 *
633.9 * This code is free software; you can redistribute it and/or modify it
633.10 @@ -61,7 +61,9 @@
633.11 public final static Provider ecInternalProvider;
633.12
633.13 static {
633.14 - final Provider p = new Provider("SunEC-Internal", 1.0d, null) {};
633.15 + final Provider p = new Provider("SunEC-Internal", 1.0d, null) {
633.16 + private static final long serialVersionUID = 970685700309471261L;
633.17 + };
633.18 AccessController.doPrivileged(new PrivilegedAction<Void>() {
633.19 public Void run() {
633.20 p.put("KeyFactory.EC", "sun.security.ec.ECKeyFactory");
633.21 @@ -262,12 +264,12 @@
633.22 if (key instanceof ECPublicKey) {
633.23 ECPublicKey ecKey = (ECPublicKey)key;
633.24 if (ECPublicKeySpec.class.isAssignableFrom(keySpec)) {
633.25 - return (T) new ECPublicKeySpec(
633.26 + return keySpec.cast(new ECPublicKeySpec(
633.27 ecKey.getW(),
633.28 ecKey.getParams()
633.29 - );
633.30 + ));
633.31 } else if (X509EncodedKeySpec.class.isAssignableFrom(keySpec)) {
633.32 - return (T) new X509EncodedKeySpec(key.getEncoded());
633.33 + return keySpec.cast(new X509EncodedKeySpec(key.getEncoded()));
633.34 } else {
633.35 throw new InvalidKeySpecException
633.36 ("KeySpec must be ECPublicKeySpec or "
633.37 @@ -275,13 +277,13 @@
633.38 }
633.39 } else if (key instanceof ECPrivateKey) {
633.40 if (PKCS8EncodedKeySpec.class.isAssignableFrom(keySpec)) {
633.41 - return (T) new PKCS8EncodedKeySpec(key.getEncoded());
633.42 + return keySpec.cast(new PKCS8EncodedKeySpec(key.getEncoded()));
633.43 } else if (ECPrivateKeySpec.class.isAssignableFrom(keySpec)) {
633.44 ECPrivateKey ecKey = (ECPrivateKey)key;
633.45 - return (T) new ECPrivateKeySpec(
633.46 + return keySpec.cast(new ECPrivateKeySpec(
633.47 ecKey.getS(),
633.48 ecKey.getParams()
633.49 - );
633.50 + ));
633.51 } else {
633.52 throw new InvalidKeySpecException
633.53 ("KeySpec must be ECPrivateKeySpec or "
634.1 --- a/src/share/classes/sun/security/ec/ECParameters.java Thu Sep 01 13:54:38 2011 -0700
634.2 +++ b/src/share/classes/sun/security/ec/ECParameters.java Mon Sep 05 23:58:19 2011 -0700
634.3 @@ -1,5 +1,5 @@
634.4 /*
634.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
634.6 + * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
634.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
634.8 *
634.9 * This code is free software; you can redistribute it and/or modify it
634.10 @@ -326,9 +326,9 @@
634.11 protected <T extends AlgorithmParameterSpec> T engineGetParameterSpec(Class<T> spec)
634.12 throws InvalidParameterSpecException {
634.13 if (spec.isAssignableFrom(ECParameterSpec.class)) {
634.14 - return (T)paramSpec;
634.15 + return spec.cast(paramSpec);
634.16 } else if (spec.isAssignableFrom(ECGenParameterSpec.class)) {
634.17 - return (T)new ECGenParameterSpec(getCurveName(paramSpec));
634.18 + return spec.cast(new ECGenParameterSpec(getCurveName(paramSpec)));
634.19 } else {
634.20 throw new InvalidParameterSpecException
634.21 ("Only ECParameterSpec and ECGenParameterSpec supported");
635.1 --- a/src/share/classes/sun/security/jca/GetInstance.java Thu Sep 01 13:54:38 2011 -0700
635.2 +++ b/src/share/classes/sun/security/jca/GetInstance.java Mon Sep 05 23:58:19 2011 -0700
635.3 @@ -1,5 +1,5 @@
635.4 /*
635.5 - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
635.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
635.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
635.8 *
635.9 * This code is free software; you can redistribute it and/or modify it
635.10 @@ -149,7 +149,7 @@
635.11 * There are overloaded methods for all the permutations.
635.12 */
635.13
635.14 - public static Instance getInstance(String type, Class clazz,
635.15 + public static Instance getInstance(String type, Class<?> clazz,
635.16 String algorithm) throws NoSuchAlgorithmException {
635.17 // in the almost all cases, the first service will work
635.18 // avoid taking long path if so
635.19 @@ -181,7 +181,7 @@
635.20 throw failure;
635.21 }
635.22
635.23 - public static Instance getInstance(String type, Class clazz,
635.24 + public static Instance getInstance(String type, Class<?> clazz,
635.25 String algorithm, Object param) throws NoSuchAlgorithmException {
635.26 List<Service> services = getServices(type, algorithm);
635.27 NoSuchAlgorithmException failure = null;
635.28 @@ -200,25 +200,25 @@
635.29 }
635.30 }
635.31
635.32 - public static Instance getInstance(String type, Class clazz,
635.33 + public static Instance getInstance(String type, Class<?> clazz,
635.34 String algorithm, String provider) throws NoSuchAlgorithmException,
635.35 NoSuchProviderException {
635.36 return getInstance(getService(type, algorithm, provider), clazz);
635.37 }
635.38
635.39 - public static Instance getInstance(String type, Class clazz,
635.40 + public static Instance getInstance(String type, Class<?> clazz,
635.41 String algorithm, Object param, String provider)
635.42 throws NoSuchAlgorithmException, NoSuchProviderException {
635.43 return getInstance(getService(type, algorithm, provider), clazz, param);
635.44 }
635.45
635.46 - public static Instance getInstance(String type, Class clazz,
635.47 + public static Instance getInstance(String type, Class<?> clazz,
635.48 String algorithm, Provider provider)
635.49 throws NoSuchAlgorithmException {
635.50 return getInstance(getService(type, algorithm, provider), clazz);
635.51 }
635.52
635.53 - public static Instance getInstance(String type, Class clazz,
635.54 + public static Instance getInstance(String type, Class<?> clazz,
635.55 String algorithm, Object param, Provider provider)
635.56 throws NoSuchAlgorithmException {
635.57 return getInstance(getService(type, algorithm, provider), clazz, param);
635.58 @@ -231,14 +231,14 @@
635.59 * Signature class.
635.60 */
635.61
635.62 - public static Instance getInstance(Service s, Class clazz)
635.63 + public static Instance getInstance(Service s, Class<?> clazz)
635.64 throws NoSuchAlgorithmException {
635.65 Object instance = s.newInstance(null);
635.66 checkSuperClass(s, instance.getClass(), clazz);
635.67 return new Instance(s.getProvider(), instance);
635.68 }
635.69
635.70 - public static Instance getInstance(Service s, Class clazz,
635.71 + public static Instance getInstance(Service s, Class<?> clazz,
635.72 Object param) throws NoSuchAlgorithmException {
635.73 Object instance = s.newInstance(param);
635.74 checkSuperClass(s, instance.getClass(), clazz);
635.75 @@ -249,8 +249,8 @@
635.76 * Check is subClass is a subclass of superClass. If not,
635.77 * throw a NoSuchAlgorithmException.
635.78 */
635.79 - public static void checkSuperClass(Service s, Class subClass,
635.80 - Class superClass) throws NoSuchAlgorithmException {
635.81 + public static void checkSuperClass(Service s, Class<?> subClass,
635.82 + Class<?> superClass) throws NoSuchAlgorithmException {
635.83 if (superClass == null) {
635.84 return;
635.85 }
636.1 --- a/src/share/classes/sun/security/jca/ProviderList.java Thu Sep 01 13:54:38 2011 -0700
636.2 +++ b/src/share/classes/sun/security/jca/ProviderList.java Mon Sep 05 23:58:19 2011 -0700
636.3 @@ -69,6 +69,7 @@
636.4 // used to avoid explicit null checks in various places
636.5 private static final Provider EMPTY_PROVIDER =
636.6 new Provider("##Empty##", 1.0d, "initialization in progress") {
636.7 + private static final long serialVersionUID = 1151354171352296389L;
636.8 // override getService() to return null slightly faster
636.9 public Service getService(String type, String algorithm) {
636.10 return null;
637.1 --- a/src/share/classes/sun/security/jca/Providers.java Thu Sep 01 13:54:38 2011 -0700
637.2 +++ b/src/share/classes/sun/security/jca/Providers.java Mon Sep 05 23:58:19 2011 -0700
637.3 @@ -25,10 +25,7 @@
637.4
637.5 package sun.security.jca;
637.6
637.7 -import java.util.*;
637.8 -
637.9 import java.security.Provider;
637.10 -import java.security.Security;
637.11
637.12 /**
637.13 * Collection of methods to get and set provider list. Also includes
637.14 @@ -97,11 +94,11 @@
637.15 // sun.security.util.ManifestEntryVerifier and java.security.SecureRandom.
637.16 public static Provider getSunProvider() {
637.17 try {
637.18 - Class clazz = Class.forName(jarVerificationProviders[0]);
637.19 + Class<?> clazz = Class.forName(jarVerificationProviders[0]);
637.20 return (Provider)clazz.newInstance();
637.21 } catch (Exception e) {
637.22 try {
637.23 - Class clazz = Class.forName(BACKUP_PROVIDER_CLASSNAME);
637.24 + Class<?> clazz = Class.forName(BACKUP_PROVIDER_CLASSNAME);
637.25 return (Provider)clazz.newInstance();
637.26 } catch (Exception ee) {
637.27 throw new RuntimeException("Sun provider not found", e);
638.1 --- a/src/share/classes/sun/security/jgss/GSSUtil.java Thu Sep 01 13:54:38 2011 -0700
638.2 +++ b/src/share/classes/sun/security/jgss/GSSUtil.java Mon Sep 05 23:58:19 2011 -0700
638.3 @@ -1,5 +1,5 @@
638.4 /*
638.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
638.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
638.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
638.8 *
638.9 * This code is free software; you can redistribute it and/or modify it
638.10 @@ -316,24 +316,25 @@
638.11 * no Subject present or a Vector which contains 0 or more
638.12 * matching GSSCredentialSpi objects.
638.13 */
638.14 - public static Vector searchSubject(final GSSNameSpi name,
638.15 - final Oid mech,
638.16 - final boolean initiate,
638.17 - final Class credCls) {
638.18 + public static <T extends GSSCredentialSpi> Vector<T>
638.19 + searchSubject(final GSSNameSpi name,
638.20 + final Oid mech,
638.21 + final boolean initiate,
638.22 + final Class<? extends T> credCls) {
638.23 debug("Search Subject for " + getMechStr(mech) +
638.24 (initiate? " INIT" : " ACCEPT") + " cred (" +
638.25 (name == null? "<<DEF>>" : name.toString()) + ", " +
638.26 credCls.getName() + ")");
638.27 final AccessControlContext acc = AccessController.getContext();
638.28 try {
638.29 - Vector creds =
638.30 + Vector<T> creds =
638.31 AccessController.doPrivileged
638.32 - (new PrivilegedExceptionAction<Vector>() {
638.33 - public Vector run() throws Exception {
638.34 + (new PrivilegedExceptionAction<Vector<T>>() {
638.35 + public Vector<T> run() throws Exception {
638.36 Subject accSubj = Subject.getSubject(acc);
638.37 - Vector<GSSCredentialSpi> result = null;
638.38 + Vector<T> result = null;
638.39 if (accSubj != null) {
638.40 - result = new Vector<GSSCredentialSpi>();
638.41 + result = new Vector<T>();
638.42 Iterator<GSSCredentialImpl> iterator =
638.43 accSubj.getPrivateCredentials
638.44 (GSSCredentialImpl.class).iterator();
638.45 @@ -347,7 +348,7 @@
638.46 if (ce.getClass().equals(credCls) &&
638.47 (name == null ||
638.48 name.equals((Object) ce.getName()))) {
638.49 - result.add(ce);
638.50 + result.add(credCls.cast(ce));
638.51 } else {
638.52 debug("......Discard element");
638.53 }
639.1 --- a/src/share/classes/sun/security/jgss/krb5/CipherHelper.java Thu Sep 01 13:54:38 2011 -0700
639.2 +++ b/src/share/classes/sun/security/jgss/krb5/CipherHelper.java Mon Sep 05 23:58:19 2011 -0700
639.3 @@ -1,5 +1,5 @@
639.4 /*
639.5 - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
639.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
639.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
639.8 *
639.9 * This code is free software; you can redistribute it and/or modify it
639.10 @@ -139,6 +139,7 @@
639.11 return flag;
639.12 }
639.13
639.14 + @SuppressWarnings("fallthrough")
639.15 byte[] calculateChecksum(int alg, byte[] header, byte[] trailer,
639.16 byte[] data, int start, int len, int tokenId) throws GSSException {
639.17
639.18 @@ -1265,7 +1266,7 @@
639.19 // Note: When using this RC4 based encryption type, the sequence number
639.20 // is always sent in big-endian rather than little-endian order.
639.21 byte[] seqNum = new byte[4];
639.22 - token.writeBigEndian(token.getSequenceNumber(), seqNum);
639.23 + WrapToken.writeBigEndian(token.getSequenceNumber(), seqNum);
639.24
639.25 // Krb5Token.debug("\narcFourEncrypt:" + Krb5Token.getHexBytes(all));
639.26
640.1 --- a/src/share/classes/sun/security/jgss/krb5/Krb5Context.java Thu Sep 01 13:54:38 2011 -0700
640.2 +++ b/src/share/classes/sun/security/jgss/krb5/Krb5Context.java Mon Sep 05 23:58:19 2011 -0700
640.3 @@ -1,5 +1,5 @@
640.4 /*
640.5 - * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
640.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
640.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
640.8 *
640.9 * This code is free software; you can redistribute it and/or modify it
640.10 @@ -1310,6 +1310,8 @@
640.11 * The session key returned by inquireSecContext(KRB5_INQ_SSPI_SESSION_KEY)
640.12 */
640.13 static class KerberosSessionKey implements Key {
640.14 + private static final long serialVersionUID = 699307378954123869L;
640.15 +
640.16 private final EncryptionKey key;
640.17
640.18 KerberosSessionKey(EncryptionKey key) {
641.1 --- a/src/share/classes/sun/security/jgss/krb5/Krb5NameElement.java Thu Sep 01 13:54:38 2011 -0700
641.2 +++ b/src/share/classes/sun/security/jgss/krb5/Krb5NameElement.java Mon Sep 05 23:58:19 2011 -0700
641.3 @@ -35,6 +35,7 @@
641.4 import java.net.InetAddress;
641.5 import java.net.UnknownHostException;
641.6 import java.security.Provider;
641.7 +import java.util.Locale;
641.8
641.9 /**
641.10 * Implements the GSSNameSpi for the krb5 mechanism.
641.11 @@ -184,7 +185,7 @@
641.12 } catch (UnknownHostException e) {
641.13 // use hostname as it is
641.14 }
641.15 - hostName = hostName.toLowerCase();
641.16 + hostName = hostName.toLowerCase(Locale.ENGLISH);
641.17
641.18 temp = temp.append('/').append(hostName);
641.19 return temp.toString();
642.1 --- a/src/share/classes/sun/security/jgss/krb5/Krb5Util.java Thu Sep 01 13:54:38 2011 -0700
642.2 +++ b/src/share/classes/sun/security/jgss/krb5/Krb5Util.java Mon Sep 05 23:58:19 2011 -0700
642.3 @@ -193,6 +193,8 @@
642.4 // Each time new keys are read from KeyTab objects in the private
642.5 // credentials set, old ones are removed and new ones added.
642.6 public static class KeysFromKeyTab extends KerberosKey {
642.7 + private static final long serialVersionUID = 8238092170252746927L;
642.8 +
642.9 public KeysFromKeyTab(KerberosKey key) {
642.10 super(key.getPrincipal(), key.getEncoded(),
642.11 key.getKeyType(), key.getVersionNumber());
643.1 --- a/src/share/classes/sun/security/jgss/krb5/MessageToken.java Thu Sep 01 13:54:38 2011 -0700
643.2 +++ b/src/share/classes/sun/security/jgss/krb5/MessageToken.java Mon Sep 05 23:58:19 2011 -0700
643.3 @@ -1,5 +1,5 @@
643.4 /*
643.5 - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
643.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
643.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
643.8 *
643.9 * This code is free software; you can redistribute it and/or modify it
643.10 @@ -27,12 +27,10 @@
643.11
643.12 import org.ietf.jgss.*;
643.13 import sun.security.jgss.*;
643.14 -import sun.security.krb5.*;
643.15 import java.io.InputStream;
643.16 import java.io.OutputStream;
643.17 import java.io.IOException;
643.18 import java.io.ByteArrayInputStream;
643.19 -import java.security.GeneralSecurityException;
643.20 import java.security.MessageDigest;
643.21
643.22 /**
643.23 @@ -184,7 +182,7 @@
643.24 try {
643.25 gssHeader = new GSSHeader(is);
643.26
643.27 - if (!gssHeader.getOid().equals(OID)) {
643.28 + if (!gssHeader.getOid().equals((Object)OID)) {
643.29 throw new GSSException(GSSException.DEFECTIVE_TOKEN, -1,
643.30 getTokenName(tokenId));
643.31 }
644.1 --- a/src/share/classes/sun/security/jgss/krb5/SubjectComber.java Thu Sep 01 13:54:38 2011 -0700
644.2 +++ b/src/share/classes/sun/security/jgss/krb5/SubjectComber.java Mon Sep 05 23:58:19 2011 -0700
644.3 @@ -56,15 +56,17 @@
644.4 static <T> T find(Subject subject, String serverPrincipal,
644.5 String clientPrincipal, Class<T> credClass) {
644.6
644.7 - return (T)findAux(subject, serverPrincipal, clientPrincipal, credClass,
644.8 - true);
644.9 + // findAux returns T if oneOnly.
644.10 + return credClass.cast(findAux(subject, serverPrincipal,
644.11 + clientPrincipal, credClass, true));
644.12 }
644.13
644.14 + @SuppressWarnings("unchecked") // findAux returns List<T> if !oneOnly.
644.15 static <T> List<T> findMany(Subject subject, String serverPrincipal,
644.16 String clientPrincipal, Class<T> credClass) {
644.17
644.18 - return (List<T>)findAux(subject, serverPrincipal, clientPrincipal, credClass,
644.19 - false);
644.20 + return (List<T>)findAux(subject, serverPrincipal, clientPrincipal,
644.21 + credClass, false);
644.22 }
644.23
644.24 /**
644.25 @@ -73,6 +75,7 @@
644.26 *
644.27 * @return the private credentials
644.28 */
644.29 + // Returns T if oneOnly and List<T> if !oneOnly.
644.30 private static <T> Object findAux(Subject subject, String serverPrincipal,
644.31 String clientPrincipal, Class<T> credClass, boolean oneOnly) {
644.32
644.33 @@ -98,11 +101,11 @@
644.34 }
644.35 } else if (credClass == KerberosKey.class) {
644.36 // We are looking for credentials for the serverPrincipal
644.37 - Iterator<T> iterator =
644.38 - subject.getPrivateCredentials(credClass).iterator();
644.39 + Iterator<KerberosKey> iterator =
644.40 + subject.getPrivateCredentials(KerberosKey.class).iterator();
644.41 while (iterator.hasNext()) {
644.42 - T t = iterator.next();
644.43 - String name = ((KerberosKey)t).getPrincipal().getName();
644.44 + KerberosKey t = iterator.next();
644.45 + String name = t.getPrincipal().getName();
644.46 if (serverPrincipal == null || serverPrincipal.equals(name)) {
644.47 if (DEBUG) {
644.48 System.out.println("Found " +
644.49 @@ -116,7 +119,7 @@
644.50 // belong to the same principal
644.51 serverPrincipal = name;
644.52 }
644.53 - answer.add(t);
644.54 + answer.add(credClass.cast(t));
644.55 }
644.56 }
644.57 }
644.58 @@ -129,6 +132,7 @@
644.59 while (iterator.hasNext()) {
644.60 Object obj = iterator.next();
644.61 if (obj instanceof KerberosTicket) {
644.62 + @SuppressWarnings("unchecked")
644.63 KerberosTicket ticket = (KerberosTicket)obj;
644.64 if (DEBUG) {
644.65 System.out.println("Found ticket for "
644.66 @@ -180,7 +184,7 @@
644.67 serverPrincipal =
644.68 ticket.getServer().getName();
644.69 }
644.70 - answer.add((T)ticket);
644.71 + answer.add(credClass.cast(ticket));
644.72 }
644.73 }
644.74 }
645.1 --- a/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java Thu Sep 01 13:54:38 2011 -0700
645.2 +++ b/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java Mon Sep 05 23:58:19 2011 -0700
645.3 @@ -1,5 +1,5 @@
645.4 /*
645.5 - * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
645.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
645.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
645.8 *
645.9 * This code is free software; you can redistribute it and/or modify it
645.10 @@ -1016,7 +1016,7 @@
645.11 // get the peer name for the mechanism
645.12 if (mechContext != null) {
645.13 GSSNameImpl targName = (GSSNameImpl)mechContext.getTargName();
645.14 - peerName = (GSSNameSpi) targName.getElement(internal_mech);
645.15 + peerName = targName.getElement(internal_mech);
645.16 return peerName;
645.17 } else {
645.18 if (DEBUG) {
645.19 @@ -1032,7 +1032,7 @@
645.20 // get the src name for the mechanism
645.21 if (mechContext != null) {
645.22 GSSNameImpl srcName = (GSSNameImpl)mechContext.getSrcName();
645.23 - myName = (GSSNameSpi) srcName.getElement(internal_mech);
645.24 + myName = srcName.getElement(internal_mech);
645.25 return myName;
645.26 } else {
645.27 if (DEBUG) {
645.28 @@ -1064,8 +1064,8 @@
645.29 if (delegCred.getUsage() == GSSCredential.INITIATE_ONLY) {
645.30 initiate = true;
645.31 }
645.32 - GSSCredentialSpi mechCred = (GSSCredentialSpi)
645.33 - delegCred.getElement(internal_mech, initiate);
645.34 + GSSCredentialSpi mechCred =
645.35 + delegCred.getElement(internal_mech, initiate);
645.36 SpNegoCredElement cred = new SpNegoCredElement(mechCred);
645.37 return cred.getInternalCred();
645.38 } else {
646.1 --- a/src/share/classes/sun/security/jgss/wrapper/NativeGSSFactory.java Thu Sep 01 13:54:38 2011 -0700
646.2 +++ b/src/share/classes/sun/security/jgss/wrapper/NativeGSSFactory.java Mon Sep 05 23:58:19 2011 -0700
646.3 @@ -1,5 +1,5 @@
646.4 /*
646.5 - * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
646.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
646.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
646.8 *
646.9 * This code is free software; you can redistribute it and/or modify it
646.10 @@ -113,8 +113,7 @@
646.11 }
646.12
646.13 GSSCredElement credElement =
646.14 - getCredFromSubject((GSSNameElement) nname,
646.15 - (usage == GSSCredential.INITIATE_ONLY));
646.16 + getCredFromSubject(nname, (usage == GSSCredential.INITIATE_ONLY));
646.17
646.18 if (credElement == null) {
646.19 // No cred in the Subject
647.1 --- a/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java Thu Sep 01 13:54:38 2011 -0700
647.2 +++ b/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java Mon Sep 05 23:58:19 2011 -0700
647.3 @@ -52,7 +52,7 @@
647.4 "sun.security.jgss.wrapper.NativeGSSFactory";
647.5 private static final String LIB_PROP = "sun.security.jgss.lib";
647.6 private static final String DEBUG_PROP = "sun.security.nativegss.debug";
647.7 - private static HashMap MECH_MAP;
647.8 + private static HashMap<String, String> MECH_MAP;
647.9 static final Provider INSTANCE = new SunNativeProvider();
647.10 static boolean DEBUG;
647.11 static void debug(String message) {
647.12 @@ -66,8 +66,9 @@
647.13
647.14 static {
647.15 MECH_MAP =
647.16 - AccessController.doPrivileged(new PrivilegedAction<HashMap>() {
647.17 - public HashMap run() {
647.18 + AccessController.doPrivileged(
647.19 + new PrivilegedAction<HashMap<String, String>>() {
647.20 + public HashMap<String, String> run() {
647.21 DEBUG = Boolean.parseBoolean
647.22 (System.getProperty(DEBUG_PROP));
647.23 try {
648.1 --- a/src/share/classes/sun/security/krb5/Checksum.java Thu Sep 01 13:54:38 2011 -0700
648.2 +++ b/src/share/classes/sun/security/krb5/Checksum.java Mon Sep 05 23:58:19 2011 -0700
648.3 @@ -1,5 +1,5 @@
648.4 /*
648.5 - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
648.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
648.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
648.8 *
648.9 * This code is free software; you can redistribute it and/or modify it
648.10 @@ -199,7 +199,7 @@
648.11 if (cksumType != cksum.cksumType)
648.12 return false;
648.13 CksumType cksumEngine = CksumType.getInstance(cksumType);
648.14 - return cksumEngine.isChecksumEqual(checksum, cksum.checksum);
648.15 + return CksumType.isChecksumEqual(checksum, cksum.checksum);
648.16 }
648.17
648.18 /**
649.1 --- a/src/share/classes/sun/security/krb5/Config.java Thu Sep 01 13:54:38 2011 -0700
649.2 +++ b/src/share/classes/sun/security/krb5/Config.java Mon Sep 05 23:58:19 2011 -0700
649.3 @@ -45,7 +45,6 @@
649.4 import java.util.List;
649.5 import sun.net.dns.ResolverConfiguration;
649.6 import sun.security.krb5.internal.crypto.EType;
649.7 -import sun.security.krb5.internal.ktab.*;
649.8 import sun.security.krb5.internal.Krb5;
649.9
649.10 /**
649.11 @@ -233,15 +232,18 @@
649.12 * @return the value found in config file, returns null if no value
649.13 * matched with the key is found.
649.14 */
649.15 - private String getDefault(String k, Hashtable t) {
649.16 + private String getDefault(String k, Hashtable<String, Object> t) {
649.17 String result = null;
649.18 String key;
649.19 if (stanzaTable != null) {
649.20 - for (Enumeration e = t.keys(); e.hasMoreElements(); ) {
649.21 - key = (String)e.nextElement();
649.22 + for (Enumeration<String> e = t.keys(); e.hasMoreElements(); ) {
649.23 + key = e.nextElement();
649.24 Object ob = t.get(key);
649.25 if (ob instanceof Hashtable) {
649.26 - result = getDefault(k, (Hashtable)ob);
649.27 + @SuppressWarnings("unchecked") // Checked with an instanceof check
649.28 + Hashtable<String, Object> table =
649.29 + (Hashtable<String, Object>)ob;
649.30 + result = getDefault(k, table);
649.31 if (result != null) {
649.32 return result;
649.33 }
649.34 @@ -276,15 +278,20 @@
649.35 * @param section the name of the section.
649.36 * @return the default value, null is returned if it cannot be found.
649.37 */
649.38 + // stanzaTable leads to a lot of unchecked casts since its value type is
649.39 + // STANZATABLE = String | Hashtable<String, STANZATABLE>
649.40 + @SuppressWarnings("unchecked")
649.41 public String getDefault(String name, String section) {
649.42 String stanzaName;
649.43 String result = null;
649.44 - Hashtable subTable;
649.45 + Hashtable<String, Object> subTable;
649.46
649.47 if (stanzaTable != null) {
649.48 - for (Enumeration e = stanzaTable.keys(); e.hasMoreElements(); ) {
649.49 - stanzaName = (String)e.nextElement();
649.50 - subTable = (Hashtable)stanzaTable.get(stanzaName);
649.51 + for (Enumeration<String> e = stanzaTable.keys();
649.52 + e.hasMoreElements(); ) {
649.53 + stanzaName = e.nextElement();
649.54 + subTable = (Hashtable<String, Object>)
649.55 + stanzaTable.get(stanzaName);
649.56 if (stanzaName.equalsIgnoreCase(section)) {
649.57 if (subTable.containsKey(name)) {
649.58 return (String)(subTable.get(name));
649.59 @@ -292,7 +299,8 @@
649.60 } else if (subTable.containsKey(section)) {
649.61 Object ob = subTable.get(section);
649.62 if (ob instanceof Hashtable) {
649.63 - Hashtable temp = (Hashtable)ob;
649.64 + Hashtable<String, Object> temp =
649.65 + (Hashtable<String, Object>)ob;
649.66 if (temp.containsKey(name)) {
649.67 Object object = temp.get(name);
649.68 if (object instanceof Vector) {
649.69 @@ -819,10 +827,10 @@
649.70 /**
649.71 * Compares the key with the known keys to see if it exists.
649.72 */
649.73 - private boolean exists(String key, Vector v) {
649.74 + private boolean exists(String key, Vector<String> v) {
649.75 boolean exists = false;
649.76 for (int i = 0; i < v.size(); i++) {
649.77 - if (((String)(v.elementAt(i))).equals(key)) {
649.78 + if (v.elementAt(i).equals(key)) {
649.79 exists = true;
649.80 }
649.81 }
649.82 @@ -837,12 +845,15 @@
649.83 listTable(stanzaTable);
649.84 }
649.85
649.86 - private void listTable(Hashtable table) {
649.87 - Vector v = new Vector();
649.88 + // stanzaTable leads to a lot of unchecked casts since its value type is
649.89 + // STANZATABLE = String | Hashtable<String, STANZATABLE>
649.90 + @SuppressWarnings("unchecked")
649.91 + private void listTable(Hashtable<String, Object> table) {
649.92 + Vector<String> v = new Vector<String>();
649.93 String key;
649.94 if (stanzaTable != null) {
649.95 - for (Enumeration e = table.keys(); e.hasMoreElements(); ) {
649.96 - key = (String)e.nextElement();
649.97 + for (Enumeration<String> e = table.keys(); e.hasMoreElements(); ) {
649.98 + key = e.nextElement();
649.99 Object object = table.get(key);
649.100 if (table == stanzaTable) {
649.101 System.out.println("[" + key + "]");
649.102 @@ -850,7 +861,7 @@
649.103 if (object instanceof Hashtable) {
649.104 if (table != stanzaTable)
649.105 System.out.println("\t" + key + " = {");
649.106 - listTable((Hashtable)object);
649.107 + listTable((Hashtable<String, Object>)object);
649.108 if (table != stanzaTable)
649.109 System.out.println("\t}");
649.110
649.111 @@ -858,10 +869,9 @@
649.112 System.out.println("\t" + key + " = " +
649.113 (String)table.get(key));
649.114 } else if (object instanceof Vector) {
649.115 - v = (Vector)object;
649.116 + v = (Vector<String>)object;
649.117 for (int i = 0; i < v.size(); i++) {
649.118 - System.out.println("\t" + key + " = " +
649.119 - (String)v.elementAt(i));
649.120 + System.out.println("\t" + key + " = " + v.elementAt(i));
649.121 }
649.122 }
649.123 }
649.124 @@ -906,7 +916,7 @@
649.125 ls.add(type);
649.126 }
649.127 }
649.128 - if (ls.size() == 0) {
649.129 + if (ls.isEmpty()) {
649.130 if (DEBUG) {
649.131 System.out.println(
649.132 "no supported default etypes for " + enctypes);
649.133 @@ -1296,7 +1306,7 @@
649.134 sb.append(obj);
649.135 sb.append('\n');
649.136 } else if (obj instanceof Hashtable) {
649.137 - Hashtable tab = (Hashtable)obj;
649.138 + Hashtable<?, ?> tab = (Hashtable<?, ?>)obj;
649.139 for (Object o: tab.keySet()) {
649.140 sb.append(prefix);
649.141 sb.append(o);
649.142 @@ -1305,7 +1315,7 @@
649.143 sb.append(prefix + "}\n");
649.144 }
649.145 } else if (obj instanceof Vector) {
649.146 - Vector v = (Vector)obj;
649.147 + Vector<?> v = (Vector<?>)obj;
649.148 for (Object o: v.toArray()) {
649.149 toStringIndented(prefix + " ", o, sb);
649.150 }
650.1 --- a/src/share/classes/sun/security/krb5/KrbServiceLocator.java Thu Sep 01 13:54:38 2011 -0700
650.2 +++ b/src/share/classes/sun/security/krb5/KrbServiceLocator.java Mon Sep 05 23:58:19 2011 -0700
650.3 @@ -1,5 +1,5 @@
650.4 /*
650.5 - * Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved.
650.6 + * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
650.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
650.8 *
650.9 * This code is free software; you can redistribute it and/or modify it
650.10 @@ -26,12 +26,9 @@
650.11 package sun.security.krb5;
650.12
650.13 import java.util.Arrays;
650.14 -import java.util.Enumeration;
650.15 import java.util.Hashtable;
650.16 -import java.util.NoSuchElementException;
650.17 import java.util.Random;
650.18 import java.util.StringTokenizer;
650.19 -import java.util.List;
650.20
650.21 import javax.naming.*;
650.22 import javax.naming.directory.*;
650.23 @@ -80,7 +77,7 @@
650.24 // the initial context constructor. This avoids having the initial
650.25 // context constructor call itself (when processing the URL
650.26 // argument in the getAttributes call).
650.27 - Context ctx = NamingManager.getURLContext("dns", new Hashtable(0));
650.28 + Context ctx = NamingManager.getURLContext("dns", new Hashtable<>(0));
650.29 if (!(ctx instanceof DirContext)) {
650.30 return null; // cannot create a DNS context
650.31 }
650.32 @@ -141,7 +138,7 @@
650.33 // the initial context constructor. This avoids having the initial
650.34 // context constructor call itself (when processing the URL
650.35 // argument in the getAttributes call).
650.36 - Context ctx = NamingManager.getURLContext("dns", new Hashtable(0));
650.37 + Context ctx = NamingManager.getURLContext("dns", new Hashtable<>(0));
650.38 if (!(ctx instanceof DirContext)) {
650.39 return null; // cannot create a DNS context
650.40 }
650.41 @@ -263,7 +260,7 @@
650.42 * See http://www.ietf.org/rfc/rfc2782.txt
650.43 */
650.44
650.45 -static class SrvRecord implements Comparable {
650.46 +static class SrvRecord implements Comparable<SrvRecord> {
650.47
650.48 int priority;
650.49 int weight;
650.50 @@ -295,8 +292,7 @@
650.51 * Sort records in ascending order of priority value. For records with
650.52 * equal priority move those with weight 0 to the top of the list.
650.53 */
650.54 - public int compareTo(Object o) {
650.55 - SrvRecord that = (SrvRecord) o;
650.56 + public int compareTo(SrvRecord that) {
650.57 if (priority > that.priority) {
650.58 return 1; // this > that
650.59 } else if (priority < that.priority) {
651.1 --- a/src/share/classes/sun/security/krb5/PrincipalName.java Thu Sep 01 13:54:38 2011 -0700
651.2 +++ b/src/share/classes/sun/security/krb5/PrincipalName.java Mon Sep 05 23:58:19 2011 -0700
651.3 @@ -35,6 +35,7 @@
651.4 import sun.security.util.*;
651.5 import java.net.*;
651.6 import java.util.Vector;
651.7 +import java.util.Locale;
651.8 import java.io.IOException;
651.9 import java.math.BigInteger;
651.10 import sun.security.krb5.internal.ccache.CCacheOutputStream;
651.11 @@ -389,14 +390,14 @@
651.12 // Looks if canonicalized is a longer format of hostName,
651.13 // we accept cases like
651.14 // bunny -> bunny.rabbit.hole
651.15 - if (canonicalized.toLowerCase()
651.16 - .startsWith(hostName.toLowerCase()+".")) {
651.17 + if (canonicalized.toLowerCase(Locale.ENGLISH).startsWith(
651.18 + hostName.toLowerCase(Locale.ENGLISH)+".")) {
651.19 hostName = canonicalized;
651.20 }
651.21 } catch (UnknownHostException e) {
651.22 // no canonicalization, use old
651.23 }
651.24 - nameParts[1] = hostName.toLowerCase();
651.25 + nameParts[1] = hostName.toLowerCase(Locale.ENGLISH);
651.26 }
651.27 nameStrings = nameParts;
651.28 nameType = type;
652.1 --- a/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java Thu Sep 01 13:54:38 2011 -0700
652.2 +++ b/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java Mon Sep 05 23:58:19 2011 -0700
652.3 @@ -69,9 +69,9 @@
652.4 try {
652.5 FileCredentialsCache fcc = new FileCredentialsCache();
652.6 if (cache == null) {
652.7 - cacheName = fcc.getDefaultCacheName();
652.8 + cacheName = FileCredentialsCache.getDefaultCacheName();
652.9 } else {
652.10 - cacheName = fcc.checkValidation(cache);
652.11 + cacheName = FileCredentialsCache.checkValidation(cache);
652.12 }
652.13 if ((cacheName == null) || !(new File(cacheName)).exists()) {
652.14 // invalid cache name or the file doesn't exist
652.15 @@ -105,7 +105,7 @@
652.16 String name) {
652.17 try {
652.18 FileCredentialsCache fcc = new FileCredentialsCache();
652.19 - cacheName = fcc.checkValidation(name);
652.20 + cacheName = FileCredentialsCache.checkValidation(name);
652.21 if (cacheName == null) {
652.22 // invalid cache name or the file doesn't exist
652.23 return null;
652.24 @@ -123,7 +123,7 @@
652.25 static synchronized FileCredentialsCache New(PrincipalName principal) {
652.26 try {
652.27 FileCredentialsCache fcc = new FileCredentialsCache();
652.28 - cacheName = fcc.getDefaultCacheName();
652.29 + cacheName = FileCredentialsCache.getDefaultCacheName();
652.30 fcc.init(principal, cacheName);
652.31 return fcc;
652.32 }
653.1 --- a/src/share/classes/sun/security/pkcs/ContentInfo.java Thu Sep 01 13:54:38 2011 -0700
653.2 +++ b/src/share/classes/sun/security/pkcs/ContentInfo.java Mon Sep 05 23:58:19 2011 -0700
653.3 @@ -1,5 +1,5 @@
653.4 /*
653.5 - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
653.6 + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
653.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
653.8 *
653.9 * This code is free software; you can redistribute it and/or modify it
653.10 @@ -163,9 +163,9 @@
653.11 }
653.12
653.13 public byte[] getData() throws IOException {
653.14 - if (contentType.equals(DATA_OID) ||
653.15 - contentType.equals(OLD_DATA_OID) ||
653.16 - contentType.equals(TIMESTAMP_TOKEN_INFO_OID)) {
653.17 + if (contentType.equals((Object)DATA_OID) ||
653.18 + contentType.equals((Object)OLD_DATA_OID) ||
653.19 + contentType.equals((Object)TIMESTAMP_TOKEN_INFO_OID)) {
653.20 if (content == null)
653.21 return null;
653.22 else
654.1 --- a/src/share/classes/sun/security/pkcs/PKCS10.java Thu Sep 01 13:54:38 2011 -0700
654.2 +++ b/src/share/classes/sun/security/pkcs/PKCS10.java Mon Sep 05 23:58:19 2011 -0700
654.3 @@ -1,5 +1,5 @@
654.4 /*
654.5 - * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
654.6 + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
654.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
654.8 *
654.9 * This code is free software; you can redistribute it and/or modify it
654.10 @@ -26,7 +26,6 @@
654.11
654.12 package sun.security.pkcs;
654.13
654.14 -import java.io.ByteArrayOutputStream;
654.15 import java.io.PrintStream;
654.16 import java.io.IOException;
654.17 import java.math.BigInteger;
654.18 @@ -225,7 +224,7 @@
654.19 */
654.20 AlgorithmId algId = null;
654.21 try {
654.22 - algId = AlgorithmId.getAlgorithmId(signature.getAlgorithm());
654.23 + algId = AlgorithmId.get(signature.getAlgorithm());
654.24 } catch (NoSuchAlgorithmException nsae) {
654.25 throw new SignatureException(nsae);
654.26 }
655.1 --- a/src/share/classes/sun/security/pkcs/PKCS7.java Thu Sep 01 13:54:38 2011 -0700
655.2 +++ b/src/share/classes/sun/security/pkcs/PKCS7.java Mon Sep 05 23:58:19 2011 -0700
655.3 @@ -153,12 +153,13 @@
655.4 contentType = contentInfo.contentType;
655.5 DerValue content = contentInfo.getContent();
655.6
655.7 - if (contentType.equals(ContentInfo.SIGNED_DATA_OID)) {
655.8 + if (contentType.equals((Object)ContentInfo.SIGNED_DATA_OID)) {
655.9 parseSignedData(content);
655.10 - } else if (contentType.equals(ContentInfo.OLD_SIGNED_DATA_OID)) {
655.11 + } else if (contentType.equals((Object)ContentInfo.OLD_SIGNED_DATA_OID)) {
655.12 // This is for backwards compatibility with JDK 1.1.x
655.13 parseOldSignedData(content);
655.14 - } else if (contentType.equals(ContentInfo.NETSCAPE_CERT_SEQUENCE_OID)){
655.15 + } else if (contentType.equals((Object)
655.16 + ContentInfo.NETSCAPE_CERT_SEQUENCE_OID)){
655.17 parseNetscapeCertChain(content);
655.18 } else {
655.19 throw new ParsingException("content type " + contentType +
655.20 @@ -477,9 +478,7 @@
655.21 byte[] encoded = certificates[i].getEncoded();
655.22 implCerts[i] = new X509CertImpl(encoded);
655.23 } catch (CertificateException ce) {
655.24 - IOException ie = new IOException(ce.getMessage());
655.25 - ie.initCause(ce);
655.26 - throw ie;
655.27 + throw new IOException(ce);
655.28 }
655.29 }
655.30 }
655.31 @@ -501,9 +500,7 @@
655.32 byte[] encoded = crl.getEncoded();
655.33 implCRLs.add(new X509CRLImpl(encoded));
655.34 } catch (CRLException ce) {
655.35 - IOException ie = new IOException(ce.getMessage());
655.36 - ie.initCause(ce);
655.37 - throw ie;
655.38 + throw new IOException(ce);
655.39 }
655.40 }
655.41 }
655.42 @@ -562,7 +559,7 @@
655.43 intResult.addElement(signerInfo);
655.44 }
655.45 }
655.46 - if (intResult.size() != 0) {
655.47 + if (!intResult.isEmpty()) {
655.48
655.49 SignerInfo[] result = new SignerInfo[intResult.size()];
655.50 intResult.copyInto(result);
656.1 --- a/src/share/classes/sun/security/pkcs/PKCS8Key.java Thu Sep 01 13:54:38 2011 -0700
656.2 +++ b/src/share/classes/sun/security/pkcs/PKCS8Key.java Mon Sep 05 23:58:19 2011 -0700
656.3 @@ -1,5 +1,5 @@
656.4 /*
656.5 - * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
656.6 + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
656.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
656.8 *
656.9 * This code is free software; you can redistribute it and/or modify it
656.10 @@ -208,7 +208,7 @@
656.11 throw new InstantiationException();
656.12 }
656.13
656.14 - Class keyClass = null;
656.15 + Class<?> keyClass = null;
656.16 try {
656.17 keyClass = Class.forName(classname);
656.18 } catch (ClassNotFoundException e) {
656.19 @@ -342,9 +342,9 @@
656.20
656.21
656.22 BigInteger version = val.data.getBigInteger();
656.23 - if (!version.equals(this.version)) {
656.24 + if (!version.equals(PKCS8Key.version)) {
656.25 throw new IOException("version mismatch: (supported: " +
656.26 - Debug.toHexString(this.version) +
656.27 + Debug.toHexString(PKCS8Key.version) +
656.28 ", parsed: " +
656.29 Debug.toHexString(version));
656.30 }
657.1 --- a/src/share/classes/sun/security/pkcs/PKCS9Attribute.java Thu Sep 01 13:54:38 2011 -0700
657.2 +++ b/src/share/classes/sun/security/pkcs/PKCS9Attribute.java Mon Sep 05 23:58:19 2011 -0700
657.3 @@ -1,5 +1,5 @@
657.4 /*
657.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
657.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
657.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
657.8 *
657.9 * This code is free software; you can redistribute it and/or modify it
657.10 @@ -320,11 +320,11 @@
657.11 {new Byte(DerValue.tag_Sequence)} // SignatureTimestampToken
657.12 };
657.13
657.14 - private static final Class[] VALUE_CLASSES = new Class[18];
657.15 + private static final Class<?>[] VALUE_CLASSES = new Class<?>[18];
657.16
657.17 static {
657.18 try {
657.19 - Class str = Class.forName("[Ljava.lang.String;");
657.20 + Class<?> str = Class.forName("[Ljava.lang.String;");
657.21
657.22 VALUE_CLASSES[0] = null; // not used
657.23 VALUE_CLASSES[1] = str; // EMailAddress
658.1 --- a/src/share/classes/sun/security/pkcs/SignerInfo.java Thu Sep 01 13:54:38 2011 -0700
658.2 +++ b/src/share/classes/sun/security/pkcs/SignerInfo.java Mon Sep 05 23:58:19 2011 -0700
658.3 @@ -36,7 +36,6 @@
658.4 import sun.security.x509.AlgorithmId;
658.5 import sun.security.x509.X500Name;
658.6 import sun.security.x509.KeyUsageExtension;
658.7 -import sun.security.x509.PKIXExtensions;
658.8 import sun.misc.HexDumpEncoder;
658.9
658.10 /**
658.11 @@ -300,7 +299,7 @@
658.12 authenticatedAttributes.getAttributeValue(
658.13 PKCS9Attribute.CONTENT_TYPE_OID);
658.14 if (contentType == null ||
658.15 - !contentType.equals(content.contentType))
658.16 + !contentType.equals((Object)content.contentType))
658.17 return null; // contentType does not match, bad SignerInfo
658.18
658.19 // now, check message digest
658.20 @@ -371,11 +370,11 @@
658.21 + "extension");
658.22 }
658.23
658.24 - boolean digSigAllowed = ((Boolean)keyUsage.get(
658.25 - KeyUsageExtension.DIGITAL_SIGNATURE)).booleanValue();
658.26 + boolean digSigAllowed = keyUsage.get(
658.27 + KeyUsageExtension.DIGITAL_SIGNATURE).booleanValue();
658.28
658.29 - boolean nonRepuAllowed = ((Boolean)keyUsage.get(
658.30 - KeyUsageExtension.NON_REPUDIATION)).booleanValue();
658.31 + boolean nonRepuAllowed = keyUsage.get(
658.32 + KeyUsageExtension.NON_REPUDIATION).booleanValue();
658.33
658.34 if (!digSigAllowed && !nonRepuAllowed) {
658.35 throw new SignatureException("Key usage restricted: "
659.1 --- a/src/share/classes/sun/security/pkcs11/Config.java Thu Sep 01 13:54:38 2011 -0700
659.2 +++ b/src/share/classes/sun/security/pkcs11/Config.java Mon Sep 05 23:58:19 2011 -0700
659.3 @@ -552,12 +552,13 @@
659.4
659.5 private boolean parseBoolean() throws IOException {
659.6 String val = parseWord();
659.7 - if (val.equals("true")) {
659.8 - return true;
659.9 - } else if (val.equals("false")) {
659.10 - return false;
659.11 - } else {
659.12 - throw excToken("Expected boolean value, read:");
659.13 + switch (val) {
659.14 + case "true":
659.15 + return true;
659.16 + case "false":
659.17 + return false;
659.18 + default:
659.19 + throw excToken("Expected boolean value, read:");
659.20 }
659.21 }
659.22
659.23 @@ -886,14 +887,15 @@
659.24
659.25 private String parseOperation() throws IOException {
659.26 String op = parseWord();
659.27 - if (op.equals("*")) {
659.28 - return TemplateManager.O_ANY;
659.29 - } else if (op.equals("generate")) {
659.30 - return TemplateManager.O_GENERATE;
659.31 - } else if (op.equals("import")) {
659.32 - return TemplateManager.O_IMPORT;
659.33 - } else {
659.34 - throw excLine("Unknown operation " + op);
659.35 + switch (op) {
659.36 + case "*":
659.37 + return TemplateManager.O_ANY;
659.38 + case "generate":
659.39 + return TemplateManager.O_GENERATE;
659.40 + case "import":
659.41 + return TemplateManager.O_IMPORT;
659.42 + default:
659.43 + throw excLine("Unknown operation " + op);
659.44 }
659.45 }
659.46
659.47 @@ -978,6 +980,7 @@
659.48 }
659.49
659.50 class ConfigurationException extends IOException {
659.51 + private static final long serialVersionUID = 254492758807673194L;
659.52 ConfigurationException(String msg) {
659.53 super(msg);
659.54 }
660.1 --- a/src/share/classes/sun/security/pkcs11/P11Cipher.java Thu Sep 01 13:54:38 2011 -0700
660.2 +++ b/src/share/classes/sun/security/pkcs11/P11Cipher.java Mon Sep 05 23:58:19 2011 -0700
660.3 @@ -258,7 +258,7 @@
660.4
660.5 // see JCE spec
660.6 protected byte[] engineGetIV() {
660.7 - return (iv == null) ? null : (byte[]) iv.clone();
660.8 + return (iv == null) ? null : iv.clone();
660.9 }
660.10
660.11 // see JCE spec
660.12 @@ -315,7 +315,7 @@
660.13 byte[] ivValue;
660.14 if (params != null) {
660.15 try {
660.16 - IvParameterSpec ivSpec = (IvParameterSpec)
660.17 + IvParameterSpec ivSpec =
660.18 params.getParameterSpec(IvParameterSpec.class);
660.19 ivValue = ivSpec.getIV();
660.20 } catch (InvalidParameterSpecException e) {
661.1 --- a/src/share/classes/sun/security/pkcs11/P11DHKeyFactory.java Thu Sep 01 13:54:38 2011 -0700
661.2 +++ b/src/share/classes/sun/security/pkcs11/P11DHKeyFactory.java Mon Sep 05 23:58:19 2011 -0700
661.3 @@ -1,5 +1,5 @@
661.4 /*
661.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
661.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
661.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
661.8 *
661.9 * This code is free software; you can redistribute it and/or modify it
661.10 @@ -212,8 +212,8 @@
661.11 }
661.12 }
661.13
661.14 - KeySpec implGetPublicKeySpec(P11Key key, Class keySpec, Session[] session)
661.15 - throws PKCS11Exception, InvalidKeySpecException {
661.16 + <T extends KeySpec> T implGetPublicKeySpec(P11Key key, Class<T> keySpec,
661.17 + Session[] session) throws PKCS11Exception, InvalidKeySpecException {
661.18 if (DHPublicKeySpec.class.isAssignableFrom(keySpec)) {
661.19 session[0] = token.getObjSession();
661.20 CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] {
661.21 @@ -227,15 +227,15 @@
661.22 attributes[1].getBigInteger(),
661.23 attributes[2].getBigInteger()
661.24 );
661.25 - return spec;
661.26 + return keySpec.cast(spec);
661.27 } else { // X.509 handled in superclass
661.28 throw new InvalidKeySpecException("Only DHPublicKeySpec and "
661.29 + "X509EncodedKeySpec supported for DH public keys");
661.30 }
661.31 }
661.32
661.33 - KeySpec implGetPrivateKeySpec(P11Key key, Class keySpec, Session[] session)
661.34 - throws PKCS11Exception, InvalidKeySpecException {
661.35 + <T extends KeySpec> T implGetPrivateKeySpec(P11Key key, Class<T> keySpec,
661.36 + Session[] session) throws PKCS11Exception, InvalidKeySpecException {
661.37 if (DHPrivateKeySpec.class.isAssignableFrom(keySpec)) {
661.38 session[0] = token.getObjSession();
661.39 CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] {
661.40 @@ -249,7 +249,7 @@
661.41 attributes[1].getBigInteger(),
661.42 attributes[2].getBigInteger()
661.43 );
661.44 - return spec;
661.45 + return keySpec.cast(spec);
661.46 } else { // PKCS#8 handled in superclass
661.47 throw new InvalidKeySpecException("Only DHPrivateKeySpec "
661.48 + "and PKCS8EncodedKeySpec supported for DH private keys");
662.1 --- a/src/share/classes/sun/security/pkcs11/P11DSAKeyFactory.java Thu Sep 01 13:54:38 2011 -0700
662.2 +++ b/src/share/classes/sun/security/pkcs11/P11DSAKeyFactory.java Mon Sep 05 23:58:19 2011 -0700
662.3 @@ -1,5 +1,5 @@
662.4 /*
662.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
662.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
662.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
662.8 *
662.9 * This code is free software; you can redistribute it and/or modify it
662.10 @@ -208,8 +208,8 @@
662.11 }
662.12 }
662.13
662.14 - KeySpec implGetPublicKeySpec(P11Key key, Class keySpec, Session[] session)
662.15 - throws PKCS11Exception, InvalidKeySpecException {
662.16 + <T extends KeySpec> T implGetPublicKeySpec(P11Key key, Class<T> keySpec,
662.17 + Session[] session) throws PKCS11Exception, InvalidKeySpecException {
662.18 if (DSAPublicKeySpec.class.isAssignableFrom(keySpec)) {
662.19 session[0] = token.getObjSession();
662.20 CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] {
662.21 @@ -225,15 +225,15 @@
662.22 attributes[2].getBigInteger(),
662.23 attributes[3].getBigInteger()
662.24 );
662.25 - return spec;
662.26 + return keySpec.cast(spec);
662.27 } else { // X.509 handled in superclass
662.28 throw new InvalidKeySpecException("Only DSAPublicKeySpec and "
662.29 + "X509EncodedKeySpec supported for DSA public keys");
662.30 }
662.31 }
662.32
662.33 - KeySpec implGetPrivateKeySpec(P11Key key, Class keySpec, Session[] session)
662.34 - throws PKCS11Exception, InvalidKeySpecException {
662.35 + <T extends KeySpec> T implGetPrivateKeySpec(P11Key key, Class<T> keySpec,
662.36 + Session[] session) throws PKCS11Exception, InvalidKeySpecException {
662.37 if (DSAPrivateKeySpec.class.isAssignableFrom(keySpec)) {
662.38 session[0] = token.getObjSession();
662.39 CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] {
662.40 @@ -249,7 +249,7 @@
662.41 attributes[2].getBigInteger(),
662.42 attributes[3].getBigInteger()
662.43 );
662.44 - return spec;
662.45 + return keySpec.cast(spec);
662.46 } else { // PKCS#8 handled in superclass
662.47 throw new InvalidKeySpecException("Only DSAPrivateKeySpec "
662.48 + "and PKCS8EncodedKeySpec supported for DSA private keys");
663.1 --- a/src/share/classes/sun/security/pkcs11/P11ECKeyFactory.java Thu Sep 01 13:54:38 2011 -0700
663.2 +++ b/src/share/classes/sun/security/pkcs11/P11ECKeyFactory.java Mon Sep 05 23:58:19 2011 -0700
663.3 @@ -1,5 +1,5 @@
663.4 /*
663.5 - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
663.6 + * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
663.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
663.8 *
663.9 * This code is free software; you can redistribute it and/or modify it
663.10 @@ -253,8 +253,8 @@
663.11 }
663.12 }
663.13
663.14 - KeySpec implGetPublicKeySpec(P11Key key, Class keySpec, Session[] session)
663.15 - throws PKCS11Exception, InvalidKeySpecException {
663.16 + <T extends KeySpec> T implGetPublicKeySpec(P11Key key, Class<T> keySpec,
663.17 + Session[] session) throws PKCS11Exception, InvalidKeySpecException {
663.18 if (ECPublicKeySpec.class.isAssignableFrom(keySpec)) {
663.19 session[0] = token.getObjSession();
663.20 CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] {
663.21 @@ -265,7 +265,7 @@
663.22 try {
663.23 ECParameterSpec params = decodeParameters(attributes[1].getByteArray());
663.24 ECPoint point = decodePoint(attributes[0].getByteArray(), params.getCurve());
663.25 - return new ECPublicKeySpec(point, params);
663.26 + return keySpec.cast(new ECPublicKeySpec(point, params));
663.27 } catch (IOException e) {
663.28 throw new InvalidKeySpecException("Could not parse key", e);
663.29 }
663.30 @@ -275,8 +275,8 @@
663.31 }
663.32 }
663.33
663.34 - KeySpec implGetPrivateKeySpec(P11Key key, Class keySpec, Session[] session)
663.35 - throws PKCS11Exception, InvalidKeySpecException {
663.36 + <T extends KeySpec> T implGetPrivateKeySpec(P11Key key, Class<T> keySpec,
663.37 + Session[] session) throws PKCS11Exception, InvalidKeySpecException {
663.38 if (ECPrivateKeySpec.class.isAssignableFrom(keySpec)) {
663.39 session[0] = token.getObjSession();
663.40 CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] {
663.41 @@ -286,7 +286,8 @@
663.42 token.p11.C_GetAttributeValue(session[0].id(), key.keyID, attributes);
663.43 try {
663.44 ECParameterSpec params = decodeParameters(attributes[1].getByteArray());
663.45 - return new ECPrivateKeySpec(attributes[0].getBigInteger(), params);
663.46 + return keySpec.cast(
663.47 + new ECPrivateKeySpec(attributes[0].getBigInteger(), params));
663.48 } catch (IOException e) {
663.49 throw new InvalidKeySpecException("Could not parse key", e);
663.50 }
664.1 --- a/src/share/classes/sun/security/pkcs11/P11Key.java Thu Sep 01 13:54:38 2011 -0700
664.2 +++ b/src/share/classes/sun/security/pkcs11/P11Key.java Mon Sep 05 23:58:19 2011 -0700
664.3 @@ -128,7 +128,7 @@
664.4 // see JCA spec
664.5 public final byte[] getEncoded() {
664.6 byte[] b = getEncodedInternal();
664.7 - return (b == null) ? null : (byte[])b.clone();
664.8 + return (b == null) ? null : b.clone();
664.9 }
664.10
664.11 abstract byte[] getEncodedInternal();
664.12 @@ -299,21 +299,22 @@
664.13 // we assume that all components of public keys are always accessible
664.14 static PublicKey publicKey(Session session, long keyID, String algorithm,
664.15 int keyLength, CK_ATTRIBUTE[] attributes) {
664.16 - if (algorithm.equals("RSA")) {
664.17 - return new P11RSAPublicKey
664.18 - (session, keyID, algorithm, keyLength, attributes);
664.19 - } else if (algorithm.equals("DSA")) {
664.20 - return new P11DSAPublicKey
664.21 - (session, keyID, algorithm, keyLength, attributes);
664.22 - } else if (algorithm.equals("DH")) {
664.23 - return new P11DHPublicKey
664.24 - (session, keyID, algorithm, keyLength, attributes);
664.25 - } else if (algorithm.equals("EC")) {
664.26 - return new P11ECPublicKey
664.27 - (session, keyID, algorithm, keyLength, attributes);
664.28 - } else {
664.29 - throw new ProviderException
664.30 - ("Unknown public key algorithm " + algorithm);
664.31 + switch (algorithm) {
664.32 + case "RSA":
664.33 + return new P11RSAPublicKey
664.34 + (session, keyID, algorithm, keyLength, attributes);
664.35 + case "DSA":
664.36 + return new P11DSAPublicKey
664.37 + (session, keyID, algorithm, keyLength, attributes);
664.38 + case "DH":
664.39 + return new P11DHPublicKey
664.40 + (session, keyID, algorithm, keyLength, attributes);
664.41 + case "EC":
664.42 + return new P11ECPublicKey
664.43 + (session, keyID, algorithm, keyLength, attributes);
664.44 + default:
664.45 + throw new ProviderException
664.46 + ("Unknown public key algorithm " + algorithm);
664.47 }
664.48 }
664.49
664.50 @@ -328,42 +329,43 @@
664.51 return new P11PrivateKey
664.52 (session, keyID, algorithm, keyLength, attributes);
664.53 } else {
664.54 - if (algorithm.equals("RSA")) {
664.55 - // XXX better test for RSA CRT keys (single getAttributes() call)
664.56 - // we need to determine whether this is a CRT key
664.57 - // see if we can obtain the public exponent
664.58 - // this should also be readable for sensitive/extractable keys
664.59 - CK_ATTRIBUTE[] attrs2 = new CK_ATTRIBUTE[] {
664.60 - new CK_ATTRIBUTE(CKA_PUBLIC_EXPONENT),
664.61 - };
664.62 - boolean crtKey;
664.63 - try {
664.64 - session.token.p11.C_GetAttributeValue
664.65 - (session.id(), keyID, attrs2);
664.66 - crtKey = (attrs2[0].pValue instanceof byte[]);
664.67 - } catch (PKCS11Exception e) {
664.68 - // ignore, assume not available
664.69 - crtKey = false;
664.70 - }
664.71 - if (crtKey) {
664.72 - return new P11RSAPrivateKey
664.73 + switch (algorithm) {
664.74 + case "RSA":
664.75 + // XXX better test for RSA CRT keys (single getAttributes() call)
664.76 + // we need to determine whether this is a CRT key
664.77 + // see if we can obtain the public exponent
664.78 + // this should also be readable for sensitive/extractable keys
664.79 + CK_ATTRIBUTE[] attrs2 = new CK_ATTRIBUTE[] {
664.80 + new CK_ATTRIBUTE(CKA_PUBLIC_EXPONENT),
664.81 + };
664.82 + boolean crtKey;
664.83 + try {
664.84 + session.token.p11.C_GetAttributeValue
664.85 + (session.id(), keyID, attrs2);
664.86 + crtKey = (attrs2[0].pValue instanceof byte[]);
664.87 + } catch (PKCS11Exception e) {
664.88 + // ignore, assume not available
664.89 + crtKey = false;
664.90 + }
664.91 + if (crtKey) {
664.92 + return new P11RSAPrivateKey
664.93 + (session, keyID, algorithm, keyLength, attributes);
664.94 + } else {
664.95 + return new P11RSAPrivateNonCRTKey
664.96 + (session, keyID, algorithm, keyLength, attributes);
664.97 + }
664.98 + case "DSA":
664.99 + return new P11DSAPrivateKey
664.100 (session, keyID, algorithm, keyLength, attributes);
664.101 - } else {
664.102 - return new P11RSAPrivateNonCRTKey
664.103 + case "DH":
664.104 + return new P11DHPrivateKey
664.105 (session, keyID, algorithm, keyLength, attributes);
664.106 - }
664.107 - } else if (algorithm.equals("DSA")) {
664.108 - return new P11DSAPrivateKey
664.109 - (session, keyID, algorithm, keyLength, attributes);
664.110 - } else if (algorithm.equals("DH")) {
664.111 - return new P11DHPrivateKey
664.112 - (session, keyID, algorithm, keyLength, attributes);
664.113 - } else if (algorithm.equals("EC")) {
664.114 - return new P11ECPrivateKey
664.115 - (session, keyID, algorithm, keyLength, attributes);
664.116 - } else {
664.117 - throw new ProviderException
664.118 - ("Unknown private key algorithm " + algorithm);
664.119 + case "EC":
664.120 + return new P11ECPrivateKey
664.121 + (session, keyID, algorithm, keyLength, attributes);
664.122 + default:
664.123 + throw new ProviderException
664.124 + ("Unknown private key algorithm " + algorithm);
664.125 }
664.126 }
664.127 }
664.128 @@ -371,6 +373,8 @@
664.129 // class for sensitive and unextractable private keys
664.130 private static final class P11PrivateKey extends P11Key
664.131 implements PrivateKey {
664.132 + private static final long serialVersionUID = -2138581185214187615L;
664.133 +
664.134 P11PrivateKey(Session session, long keyID, String algorithm,
664.135 int keyLength, CK_ATTRIBUTE[] attributes) {
664.136 super(PRIVATE, session, keyID, algorithm, keyLength, attributes);
664.137 @@ -387,6 +391,7 @@
664.138 }
664.139
664.140 private static class P11SecretKey extends P11Key implements SecretKey {
664.141 + private static final long serialVersionUID = -7828241727014329084L;
664.142 private volatile byte[] encoded;
664.143 P11SecretKey(Session session, long keyID, String algorithm,
664.144 int keyLength, CK_ATTRIBUTE[] attributes) {
664.145 @@ -434,6 +439,8 @@
664.146
664.147 private static class P11TlsMasterSecretKey extends P11SecretKey
664.148 implements TlsMasterSecret {
664.149 + private static final long serialVersionUID = -1318560923770573441L;
664.150 +
664.151 private final int majorVersion, minorVersion;
664.152 P11TlsMasterSecretKey(Session session, long keyID, String algorithm,
664.153 int keyLength, CK_ATTRIBUTE[] attributes, int major, int minor) {
664.154 @@ -453,6 +460,8 @@
664.155 // RSA CRT private key
664.156 private static final class P11RSAPrivateKey extends P11Key
664.157 implements RSAPrivateCrtKey {
664.158 + private static final long serialVersionUID = 9215872438913515220L;
664.159 +
664.160 private BigInteger n, e, d, p, q, pe, qe, coeff;
664.161 private byte[] encoded;
664.162 P11RSAPrivateKey(Session session, long keyID, String algorithm,
664.163 @@ -563,6 +572,8 @@
664.164 // RSA non-CRT private key
664.165 private static final class P11RSAPrivateNonCRTKey extends P11Key
664.166 implements RSAPrivateKey {
664.167 + private static final long serialVersionUID = 1137764983777411481L;
664.168 +
664.169 private BigInteger n, d;
664.170 private byte[] encoded;
664.171 P11RSAPrivateNonCRTKey(Session session, long keyID, String algorithm,
664.172 @@ -624,6 +635,8 @@
664.173
664.174 private static final class P11RSAPublicKey extends P11Key
664.175 implements RSAPublicKey {
664.176 + private static final long serialVersionUID = -826726289023854455L;
664.177 +
664.178 private BigInteger n, e;
664.179 private byte[] encoded;
664.180 P11RSAPublicKey(Session session, long keyID, String algorithm,
664.181 @@ -676,6 +689,8 @@
664.182
664.183 private static final class P11DSAPublicKey extends P11Key
664.184 implements DSAPublicKey {
664.185 + private static final long serialVersionUID = 5989753793316396637L;
664.186 +
664.187 private BigInteger y;
664.188 private DSAParams params;
664.189 private byte[] encoded;
664.190 @@ -737,6 +752,8 @@
664.191
664.192 private static final class P11DSAPrivateKey extends P11Key
664.193 implements DSAPrivateKey {
664.194 + private static final long serialVersionUID = 3119629997181999389L;
664.195 +
664.196 private BigInteger x;
664.197 private DSAParams params;
664.198 private byte[] encoded;
664.199 @@ -798,6 +815,8 @@
664.200
664.201 private static final class P11DHPrivateKey extends P11Key
664.202 implements DHPrivateKey {
664.203 + private static final long serialVersionUID = -1698576167364928838L;
664.204 +
664.205 private BigInteger x;
664.206 private DHParameterSpec params;
664.207 private byte[] encoded;
664.208 @@ -860,6 +879,8 @@
664.209
664.210 private static final class P11DHPublicKey extends P11Key
664.211 implements DHPublicKey {
664.212 + static final long serialVersionUID = -598383872153843657L;
664.213 +
664.214 private BigInteger y;
664.215 private DHParameterSpec params;
664.216 private byte[] encoded;
664.217 @@ -922,6 +943,8 @@
664.218
664.219 private static final class P11ECPrivateKey extends P11Key
664.220 implements ECPrivateKey {
664.221 + private static final long serialVersionUID = -7786054399510515515L;
664.222 +
664.223 private BigInteger s;
664.224 private ECParameterSpec params;
664.225 private byte[] encoded;
664.226 @@ -982,6 +1005,8 @@
664.227
664.228 private static final class P11ECPublicKey extends P11Key
664.229 implements ECPublicKey {
664.230 + private static final long serialVersionUID = -6371481375154806089L;
664.231 +
664.232 private ECPoint w;
664.233 private ECParameterSpec params;
664.234 private byte[] encoded;
665.1 --- a/src/share/classes/sun/security/pkcs11/P11KeyAgreement.java Thu Sep 01 13:54:38 2011 -0700
665.2 +++ b/src/share/classes/sun/security/pkcs11/P11KeyAgreement.java Mon Sep 05 23:58:19 2011 -0700
665.3 @@ -1,5 +1,5 @@
665.4 /*
665.5 - * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
665.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
665.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
665.8 *
665.9 * This code is free software; you can redistribute it and/or modify it
665.10 @@ -143,8 +143,8 @@
665.11 // just in case not, attempt conversion
665.12 P11DHKeyFactory kf = new P11DHKeyFactory(token, "DH");
665.13 try {
665.14 - DHPublicKeySpec spec = (DHPublicKeySpec)kf.engineGetKeySpec
665.15 - (key, DHPublicKeySpec.class);
665.16 + DHPublicKeySpec spec = kf.engineGetKeySpec(
665.17 + key, DHPublicKeySpec.class);
665.18 y = spec.getY();
665.19 p = spec.getP();
665.20 g = spec.getG();
666.1 --- a/src/share/classes/sun/security/pkcs11/P11KeyFactory.java Thu Sep 01 13:54:38 2011 -0700
666.2 +++ b/src/share/classes/sun/security/pkcs11/P11KeyFactory.java Mon Sep 05 23:58:19 2011 -0700
666.3 @@ -1,5 +1,5 @@
666.4 /*
666.5 - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
666.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
666.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
666.8 *
666.9 * This code is free software; you can redistribute it and/or modify it
666.10 @@ -29,7 +29,6 @@
666.11 import java.security.spec.*;
666.12
666.13 import sun.security.pkcs11.wrapper.PKCS11Exception;
666.14 -import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
666.15
666.16 /**
666.17 * KeyFactory base class. Provides common infrastructure for the RSA, DSA,
666.18 @@ -77,7 +76,7 @@
666.19 if (PKCS8EncodedKeySpec.class.isAssignableFrom(keySpec)
666.20 || X509EncodedKeySpec.class.isAssignableFrom(keySpec)) {
666.21 try {
666.22 - return (T)implGetSoftwareFactory().getKeySpec(key, keySpec);
666.23 + return implGetSoftwareFactory().getKeySpec(key, keySpec);
666.24 } catch (GeneralSecurityException e) {
666.25 throw new InvalidKeySpecException("Could not encode key", e);
666.26 }
666.27 @@ -92,9 +91,9 @@
666.28 Session[] session = new Session[1];
666.29 try {
666.30 if (p11Key.isPublic()) {
666.31 - return (T)implGetPublicKeySpec(p11Key, keySpec, session);
666.32 + return implGetPublicKeySpec(p11Key, keySpec, session);
666.33 } else {
666.34 - return (T)implGetPrivateKeySpec(p11Key, keySpec, session);
666.35 + return implGetPrivateKeySpec(p11Key, keySpec, session);
666.36 }
666.37 } catch (PKCS11Exception e) {
666.38 throw new InvalidKeySpecException("Could not generate KeySpec", e);
666.39 @@ -138,10 +137,10 @@
666.40 }
666.41 }
666.42
666.43 - abstract KeySpec implGetPublicKeySpec(P11Key key, Class keySpec,
666.44 + abstract <T extends KeySpec> T implGetPublicKeySpec(P11Key key, Class<T> keySpec,
666.45 Session[] session) throws PKCS11Exception, InvalidKeySpecException;
666.46
666.47 - abstract KeySpec implGetPrivateKeySpec(P11Key key, Class keySpec,
666.48 + abstract <T extends KeySpec> T implGetPrivateKeySpec(P11Key key, Class<T> keySpec,
666.49 Session[] session) throws PKCS11Exception, InvalidKeySpecException;
666.50
666.51 abstract PublicKey implTranslatePublicKey(PublicKey key)
667.1 --- a/src/share/classes/sun/security/pkcs11/P11KeyStore.java Thu Sep 01 13:54:38 2011 -0700
667.2 +++ b/src/share/classes/sun/security/pkcs11/P11KeyStore.java Mon Sep 05 23:58:19 2011 -0700
667.3 @@ -1,5 +1,5 @@
667.4 /*
667.5 - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
667.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
667.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
667.8 *
667.9 * This code is free software; you can redistribute it and/or modify it
667.10 @@ -34,12 +34,9 @@
667.11 import java.io.UnsupportedEncodingException;
667.12
667.13 import java.util.Arrays;
667.14 -import java.util.Collection;
667.15 import java.util.Collections;
667.16 import java.util.Date;
667.17 import java.util.Enumeration;
667.18 -import java.util.Iterator;
667.19 -import java.util.List;
667.20 import java.util.ArrayList;
667.21 import java.util.HashSet;
667.22 import java.util.HashMap;
667.23 @@ -48,7 +45,6 @@
667.24 import java.security.*;
667.25 import java.security.KeyStore.*;
667.26
667.27 -import java.security.cert.CertPath;
667.28 import java.security.cert.Certificate;
667.29 import java.security.cert.X509Certificate;
667.30 import java.security.cert.CertificateFactory;
667.31 @@ -60,7 +56,6 @@
667.32 import javax.crypto.SecretKey;
667.33 import javax.crypto.interfaces.*;
667.34
667.35 -import javax.security.auth.Subject;
667.36 import javax.security.auth.x500.X500Principal;
667.37 import javax.security.auth.login.LoginException;
667.38 import javax.security.auth.callback.Callback;
667.39 @@ -69,7 +64,6 @@
667.40 import javax.security.auth.callback.UnsupportedCallbackException;
667.41
667.42 import sun.security.util.Debug;
667.43 -import sun.security.x509.SerialNumber;
667.44 import sun.security.util.DerValue;
667.45
667.46 import sun.security.ec.ECParameters;
667.47 @@ -235,7 +229,7 @@
667.48
667.49 private PasswordCallbackHandler(char[] password) {
667.50 if (password != null) {
667.51 - this.password = (char[])password.clone();
667.52 + this.password = password.clone();
667.53 }
667.54 }
667.55
667.56 @@ -331,10 +325,8 @@
667.57
667.58 // did not find anything
667.59 return null;
667.60 - } catch (PKCS11Exception pe) {
667.61 - throw new ProviderException(pe);
667.62 - } catch (KeyStoreException ke) {
667.63 - throw new ProviderException(ke);
667.64 + } catch (PKCS11Exception | KeyStoreException e) {
667.65 + throw new ProviderException(e);
667.66 } finally {
667.67 token.releaseSession(session);
667.68 }
667.69 @@ -458,10 +450,8 @@
667.70 } else if (key instanceof SecretKey) {
667.71 entry = new KeyStore.SecretKeyEntry((SecretKey)key);
667.72 }
667.73 - } catch (NullPointerException npe) {
667.74 - throw new KeyStoreException(npe);
667.75 - } catch (IllegalArgumentException iae) {
667.76 - throw new KeyStoreException(iae);
667.77 + } catch (NullPointerException | IllegalArgumentException e) {
667.78 + throw new KeyStoreException(e);
667.79 }
667.80 engineSetEntry(alias, entry, new KeyStore.PasswordProtection(password));
667.81 }
667.82 @@ -566,10 +556,8 @@
667.83 } else {
667.84 throw new KeyStoreException("unexpected entry type");
667.85 }
667.86 - } catch (PKCS11Exception pe) {
667.87 - throw new KeyStoreException(pe);
667.88 - } catch (CertificateException ce) {
667.89 - throw new KeyStoreException(ce);
667.90 + } catch (PKCS11Exception | CertificateException e) {
667.91 + throw new KeyStoreException(e);
667.92 }
667.93 }
667.94 return false;
667.95 @@ -770,18 +758,8 @@
667.96 if (debug != null) {
667.97 dumpTokenMap();
667.98 }
667.99 - } catch (LoginException le) {
667.100 - IOException ioe = new IOException("load failed");
667.101 - ioe.initCause(le);
667.102 - throw ioe;
667.103 - } catch (KeyStoreException kse) {
667.104 - IOException ioe = new IOException("load failed");
667.105 - ioe.initCause(kse);
667.106 - throw ioe;
667.107 - } catch (PKCS11Exception pe) {
667.108 - IOException ioe = new IOException("load failed");
667.109 - ioe.initCause(pe);
667.110 - throw ioe;
667.111 + } catch (LoginException | KeyStoreException | PKCS11Exception e) {
667.112 + throw new IOException("load failed", e);
667.113 }
667.114 }
667.115
667.116 @@ -860,11 +838,7 @@
667.117 if (debug != null) {
667.118 dumpTokenMap();
667.119 }
667.120 - } catch (LoginException e) {
667.121 - throw new IOException("load failed", e);
667.122 - } catch (KeyStoreException e) {
667.123 - throw new IOException("load failed", e);
667.124 - } catch (PKCS11Exception e) {
667.125 + } catch (LoginException | KeyStoreException | PKCS11Exception e) {
667.126 throw new IOException("load failed", e);
667.127 }
667.128 }
667.129 @@ -1054,9 +1028,7 @@
667.130 storeCert(alias, xcert);
667.131 module.setTrust(token, xcert);
667.132 mapLabels();
667.133 - } catch (PKCS11Exception e) {
667.134 - throw new KeyStoreException(e);
667.135 - } catch (CertificateException e) {
667.136 + } catch (PKCS11Exception | CertificateException e) {
667.137 throw new KeyStoreException(e);
667.138 }
667.139
667.140 @@ -1118,10 +1090,8 @@
667.141 storePkey(alias, (KeyStore.PrivateKeyEntry)entry);
667.142 }
667.143
667.144 - } catch (PKCS11Exception pe) {
667.145 + } catch (PKCS11Exception | CertificateException pe) {
667.146 throw new KeyStoreException(pe);
667.147 - } catch (CertificateException ce) {
667.148 - throw new KeyStoreException(ce);
667.149 }
667.150
667.151 } else if (entry instanceof KeyStore.SecretKeyEntry) {
667.152 @@ -1158,10 +1128,8 @@
667.153 if (debug != null) {
667.154 dumpTokenMap();
667.155 }
667.156 - } catch (PKCS11Exception pe) {
667.157 + } catch (PKCS11Exception | CertificateException pe) {
667.158 throw new KeyStoreException(pe);
667.159 - } catch (CertificateException ce) {
667.160 - throw new KeyStoreException(ce);
667.161 }
667.162 }
667.163
667.164 @@ -1870,7 +1838,7 @@
667.165 debug.println("creating RSAPrivateKey attrs");
667.166 }
667.167
667.168 - RSAPrivateKey rsaKey = (RSAPrivateKey)key;
667.169 + RSAPrivateKey rsaKey = key;
667.170
667.171 attrs = new CK_ATTRIBUTE[] {
667.172 ATTR_TOKEN_TRUE,
667.173 @@ -2662,7 +2630,7 @@
667.174 private void dumpTokenMap() {
667.175 Set<String> aliases = aliasMap.keySet();
667.176 System.out.println("Token Alias Map:");
667.177 - if (aliases.size() == 0) {
667.178 + if (aliases.isEmpty()) {
667.179 System.out.println(" [empty]");
667.180 } else {
667.181 for (String s : aliases) {
668.1 --- a/src/share/classes/sun/security/pkcs11/P11RSAKeyFactory.java Thu Sep 01 13:54:38 2011 -0700
668.2 +++ b/src/share/classes/sun/security/pkcs11/P11RSAKeyFactory.java Mon Sep 05 23:58:19 2011 -0700
668.3 @@ -1,5 +1,5 @@
668.4 /*
668.5 - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
668.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
668.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
668.8 *
668.9 * This code is free software; you can redistribute it and/or modify it
668.10 @@ -130,10 +130,7 @@
668.11 rs.getModulus(),
668.12 rs.getPublicExponent()
668.13 );
668.14 - } catch (PKCS11Exception e) {
668.15 - throw new InvalidKeySpecException
668.16 - ("Could not create RSA public key", e);
668.17 - } catch (InvalidKeyException e) {
668.18 + } catch (PKCS11Exception | InvalidKeyException e) {
668.19 throw new InvalidKeySpecException
668.20 ("Could not create RSA public key", e);
668.21 }
668.22 @@ -177,10 +174,7 @@
668.23 throw new InvalidKeySpecException("Only RSAPrivate(Crt)KeySpec "
668.24 + "and PKCS8EncodedKeySpec supported for RSA private keys");
668.25 }
668.26 - } catch (PKCS11Exception e) {
668.27 - throw new InvalidKeySpecException
668.28 - ("Could not create RSA private key", e);
668.29 - } catch (InvalidKeyException e) {
668.30 + } catch (PKCS11Exception | InvalidKeyException e) {
668.31 throw new InvalidKeySpecException
668.32 ("Could not create RSA private key", e);
668.33 }
668.34 @@ -260,8 +254,8 @@
668.35 }
668.36 }
668.37
668.38 - KeySpec implGetPublicKeySpec(P11Key key, Class keySpec, Session[] session)
668.39 - throws PKCS11Exception, InvalidKeySpecException {
668.40 + <T extends KeySpec> T implGetPublicKeySpec(P11Key key, Class<T> keySpec,
668.41 + Session[] session) throws PKCS11Exception, InvalidKeySpecException {
668.42 if (RSAPublicKeySpec.class.isAssignableFrom(keySpec)) {
668.43 session[0] = token.getObjSession();
668.44 CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] {
668.45 @@ -273,15 +267,15 @@
668.46 attributes[0].getBigInteger(),
668.47 attributes[1].getBigInteger()
668.48 );
668.49 - return spec;
668.50 + return keySpec.cast(spec);
668.51 } else { // X.509 handled in superclass
668.52 throw new InvalidKeySpecException("Only RSAPublicKeySpec and "
668.53 + "X509EncodedKeySpec supported for RSA public keys");
668.54 }
668.55 }
668.56
668.57 - KeySpec implGetPrivateKeySpec(P11Key key, Class keySpec, Session[] session)
668.58 - throws PKCS11Exception, InvalidKeySpecException {
668.59 + <T extends KeySpec> T implGetPrivateKeySpec(P11Key key, Class<T> keySpec,
668.60 + Session[] session) throws PKCS11Exception, InvalidKeySpecException {
668.61 if (RSAPrivateCrtKeySpec.class.isAssignableFrom(keySpec)) {
668.62 session[0] = token.getObjSession();
668.63 CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] {
668.64 @@ -305,7 +299,7 @@
668.65 attributes[6].getBigInteger(),
668.66 attributes[7].getBigInteger()
668.67 );
668.68 - return spec;
668.69 + return keySpec.cast(spec);
668.70 } else if (RSAPrivateKeySpec.class.isAssignableFrom(keySpec)) {
668.71 session[0] = token.getObjSession();
668.72 CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] {
668.73 @@ -317,7 +311,7 @@
668.74 attributes[0].getBigInteger(),
668.75 attributes[1].getBigInteger()
668.76 );
668.77 - return spec;
668.78 + return keySpec.cast(spec);
668.79 } else { // PKCS#8 handled in superclass
668.80 throw new InvalidKeySpecException("Only RSAPrivate(Crt)KeySpec "
668.81 + "and PKCS8EncodedKeySpec supported for RSA private keys");
669.1 --- a/src/share/classes/sun/security/pkcs11/P11SecretKeyFactory.java Thu Sep 01 13:54:38 2011 -0700
669.2 +++ b/src/share/classes/sun/security/pkcs11/P11SecretKeyFactory.java Mon Sep 05 23:58:19 2011 -0700
669.3 @@ -1,5 +1,5 @@
669.4 /*
669.5 - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
669.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
669.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
669.8 *
669.9 * This code is free software; you can redistribute it and/or modify it
669.10 @@ -319,7 +319,7 @@
669.11 }
669.12
669.13 // see JCE spec
669.14 - protected KeySpec engineGetKeySpec(SecretKey key, Class keySpec)
669.15 + protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpec)
669.16 throws InvalidKeySpecException {
669.17 token.ensureValid();
669.18 if ((key == null) || (keySpec == null)) {
670.1 --- a/src/share/classes/sun/security/pkcs11/P11Signature.java Thu Sep 01 13:54:38 2011 -0700
670.2 +++ b/src/share/classes/sun/security/pkcs11/P11Signature.java Mon Sep 05 23:58:19 2011 -0700
670.3 @@ -1,5 +1,5 @@
670.4 /*
670.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
670.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
670.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
670.8 *
670.9 * This code is free software; you can redistribute it and/or modify it
670.10 @@ -396,7 +396,7 @@
670.11 ensureInitialized();
670.12 switch (type) {
670.13 case T_UPDATE:
670.14 - buffer[0] = (byte)b;
670.15 + buffer[0] = b;
670.16 engineUpdate(buffer, 0, 1);
670.17 break;
670.18 case T_DIGEST:
671.1 --- a/src/share/classes/sun/security/pkcs11/P11TlsPrfGenerator.java Thu Sep 01 13:54:38 2011 -0700
671.2 +++ b/src/share/classes/sun/security/pkcs11/P11TlsPrfGenerator.java Mon Sep 05 23:58:19 2011 -0700
671.3 @@ -1,5 +1,5 @@
671.4 /*
671.5 - * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
671.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
671.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
671.8 *
671.9 * This code is free software; you can redistribute it and/or modify it
671.10 @@ -98,6 +98,8 @@
671.11
671.12 // SecretKeySpec does not allow zero length keys, so we define our own class.
671.13 private static final SecretKey NULL_KEY = new SecretKey() {
671.14 + private static final long serialVersionUID = -8090049519656411362L;
671.15 +
671.16 public byte[] getEncoded() {
671.17 return new byte[0];
671.18 }
672.1 --- a/src/share/classes/sun/security/pkcs11/P11Util.java Thu Sep 01 13:54:38 2011 -0700
672.2 +++ b/src/share/classes/sun/security/pkcs11/P11Util.java Mon Sep 05 23:58:19 2011 -0700
672.3 @@ -1,5 +1,5 @@
672.4 /*
672.5 - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
672.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
672.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
672.8 *
672.9 * This code is free software; you can redistribute it and/or modify it
672.10 @@ -88,7 +88,7 @@
672.11 p = Security.getProvider(providerName);
672.12 if (p == null) {
672.13 try {
672.14 - Class clazz = Class.forName(className);
672.15 + Class<?> clazz = Class.forName(className);
672.16 p = (Provider)clazz.newInstance();
672.17 } catch (Exception e) {
672.18 throw new ProviderException
673.1 --- a/src/share/classes/sun/security/pkcs11/Secmod.java Thu Sep 01 13:54:38 2011 -0700
673.2 +++ b/src/share/classes/sun/security/pkcs11/Secmod.java Mon Sep 05 23:58:19 2011 -0700
673.3 @@ -236,6 +236,7 @@
673.4 throw new IllegalStateException(e);
673.5 }
673.6 if (modules == null) {
673.7 + @SuppressWarnings("unchecked")
673.8 List<Module> modules = (List<Module>)nssGetModuleList(nssHandle,
673.9 nssLibDir);
673.10 this.modules = Collections.unmodifiableList(modules);
674.1 --- a/src/share/classes/sun/security/pkcs11/Session.java Thu Sep 01 13:54:38 2011 -0700
674.2 +++ b/src/share/classes/sun/security/pkcs11/Session.java Mon Sep 05 23:58:19 2011 -0700
674.3 @@ -1,5 +1,5 @@
674.4 /*
674.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
674.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
674.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
674.8 *
674.9 * This code is free software; you can redistribute it and/or modify it
674.10 @@ -87,7 +87,7 @@
674.11 }
674.12
674.13 long id() {
674.14 - if (token.isPresent(this) == false) {
674.15 + if (token.isPresent(this.id) == false) {
674.16 throw new ProviderException("Token has been removed");
674.17 }
674.18 lastAccess = System.currentTimeMillis();
674.19 @@ -167,7 +167,9 @@
674.20 void dispose() {
674.21 refList.remove(this);
674.22 try {
674.23 - token.p11.C_CloseSession(id);
674.24 + if (token.isPresent(id)) {
674.25 + token.p11.C_CloseSession(id);
674.26 + }
674.27 } catch (PKCS11Exception e1) {
674.28 // ignore
674.29 } catch (ProviderException e2) {
675.1 --- a/src/share/classes/sun/security/pkcs11/Token.java Thu Sep 01 13:54:38 2011 -0700
675.2 +++ b/src/share/classes/sun/security/pkcs11/Token.java Mon Sep 05 23:58:19 2011 -0700
675.3 @@ -1,5 +1,5 @@
675.4 /*
675.5 - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
675.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
675.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
675.8 *
675.9 * This code is free software; you can redistribute it and/or modify it
675.10 @@ -217,7 +217,7 @@
675.11
675.12 // return whether a token is present (i.e. token not removed)
675.13 // returns cached value if current, otherwise performs new check
675.14 - boolean isPresent(Session session) {
675.15 + boolean isPresent(long sessionID) {
675.16 if (removable == false) {
675.17 return true;
675.18 }
675.19 @@ -238,7 +238,7 @@
675.20 // the token should return an error
675.21 CK_SESSION_INFO sessInfo =
675.22 provider.p11.C_GetSessionInfo
675.23 - (session.idInternal());
675.24 + (sessionID);
675.25 ok = true;
675.26 }
675.27 } catch (PKCS11Exception e) {
676.1 --- a/src/share/classes/sun/security/pkcs11/wrapper/Functions.java Thu Sep 01 13:54:38 2011 -0700
676.2 +++ b/src/share/classes/sun/security/pkcs11/wrapper/Functions.java Mon Sep 05 23:58:19 2011 -0700
676.3 @@ -1,5 +1,5 @@
676.4 /*
676.5 - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
676.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
676.7 */
676.8
676.9 /* Copyright (c) 2002 Graz University of Technology. All rights reserved.
676.10 @@ -517,7 +517,7 @@
676.11
676.12 if (array != null) {
676.13 for (int i = 0; (i < 4) && (i < array.length); i++) {
676.14 - hash ^= ((int) (0xFF & array[i])) << ((i%4) << 3);
676.15 + hash ^= (0xFF & array[i]) << ((i%4) << 3);
676.16 }
676.17 }
676.18
676.19 @@ -537,7 +537,7 @@
676.20
676.21 if (array != null) {
676.22 for (int i = 0; (i < 4) && (i < array.length); i++) {
676.23 - hash ^= ((int) (0xFFFF & array[i])) << ((i%2) << 4);
676.24 + hash ^= (0xFFFF & array[i]) << ((i%2) << 4);
676.25 }
676.26 }
676.27
676.28 @@ -557,18 +557,18 @@
676.29
676.30 if (date != null) {
676.31 if (date.year.length == 4) {
676.32 - hash ^= ((int) (0xFFFF & date.year[0])) << 16;
676.33 - hash ^= (int) (0xFFFF & date.year[1]);
676.34 - hash ^= ((int) (0xFFFF & date.year[2])) << 16;
676.35 - hash ^= (int) (0xFFFF & date.year[3]);
676.36 + hash ^= (0xFFFF & date.year[0]) << 16;
676.37 + hash ^= 0xFFFF & date.year[1];
676.38 + hash ^= (0xFFFF & date.year[2]) << 16;
676.39 + hash ^= 0xFFFF & date.year[3];
676.40 }
676.41 if (date.month.length == 2) {
676.42 - hash ^= ((int) (0xFFFF & date.month[0])) << 16;
676.43 - hash ^= (int) (0xFFFF & date.month[1]);
676.44 + hash ^= (0xFFFF & date.month[0]) << 16;
676.45 + hash ^= 0xFFFF & date.month[1];
676.46 }
676.47 if (date.day.length == 2) {
676.48 - hash ^= ((int) (0xFFFF & date.day[0])) << 16;
676.49 - hash ^= (int) (0xFFFF & date.day[1]);
676.50 + hash ^= (0xFFFF & date.day[0]) << 16;
676.51 + hash ^= 0xFFFF & date.day[1];
676.52 }
676.53 }
676.54
677.1 --- a/src/share/classes/sun/security/pkcs11/wrapper/PKCS11Exception.java Thu Sep 01 13:54:38 2011 -0700
677.2 +++ b/src/share/classes/sun/security/pkcs11/wrapper/PKCS11Exception.java Mon Sep 05 23:58:19 2011 -0700
677.3 @@ -1,5 +1,5 @@
677.4 /*
677.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
677.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
677.7 */
677.8
677.9 /* Copyright (c) 2002 Graz University of Technology. All rights reserved.
677.10 @@ -63,6 +63,7 @@
677.11 * @invariants
677.12 */
677.13 public class PKCS11Exception extends Exception {
677.14 + private static final long serialVersionUID = 4877072363729195L;
677.15
677.16 /**
677.17 * The code of the error which was the reason for this exception.
678.1 --- a/src/share/classes/sun/security/pkcs11/wrapper/PKCS11RuntimeException.java Thu Sep 01 13:54:38 2011 -0700
678.2 +++ b/src/share/classes/sun/security/pkcs11/wrapper/PKCS11RuntimeException.java Mon Sep 05 23:58:19 2011 -0700
678.3 @@ -57,6 +57,7 @@
678.4 * @invariants
678.5 */
678.6 public class PKCS11RuntimeException extends RuntimeException {
678.7 + private static final long serialVersionUID = 7889842162743590564L;
678.8
678.9 /**
678.10 * Empty constructor.
679.1 --- a/src/share/classes/sun/security/pkcs12/PKCS12KeyStore.java Thu Sep 01 13:54:38 2011 -0700
679.2 +++ b/src/share/classes/sun/security/pkcs12/PKCS12KeyStore.java Mon Sep 05 23:58:19 2011 -0700
679.3 @@ -1,5 +1,5 @@
679.4 /*
679.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
679.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
679.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
679.8 *
679.9 * This code is free software; you can redistribute it and/or modify it
679.10 @@ -41,13 +41,10 @@
679.11 import java.security.cert.CertificateException;
679.12 import java.security.spec.PKCS8EncodedKeySpec;
679.13 import java.util.*;
679.14 -import java.math.*;
679.15
679.16 import java.security.AlgorithmParameters;
679.17 -import java.security.spec.AlgorithmParameterSpec;
679.18 import javax.crypto.spec.PBEParameterSpec;
679.19 import javax.crypto.spec.PBEKeySpec;
679.20 -import javax.crypto.spec.SecretKeySpec;
679.21 import javax.crypto.SecretKeyFactory;
679.22 import javax.crypto.SecretKey;
679.23 import javax.crypto.Cipher;
679.24 @@ -222,7 +219,7 @@
679.25 public Key engineGetKey(String alias, char[] password)
679.26 throws NoSuchAlgorithmException, UnrecoverableKeyException
679.27 {
679.28 - KeyEntry entry = entries.get(alias.toLowerCase());
679.29 + KeyEntry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
679.30 Key key = null;
679.31
679.32 if (entry == null) {
679.33 @@ -299,7 +296,7 @@
679.34 * <i>key entry</i> without a certificate chain).
679.35 */
679.36 public Certificate[] engineGetCertificateChain(String alias) {
679.37 - KeyEntry entry = entries.get(alias.toLowerCase());
679.38 + KeyEntry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
679.39 if (entry != null) {
679.40 if (entry.chain == null) {
679.41 return null;
679.42 @@ -327,7 +324,7 @@
679.43 * does not contain a certificate.
679.44 */
679.45 public Certificate engineGetCertificate(String alias) {
679.46 - KeyEntry entry = entries.get(alias.toLowerCase());
679.47 + KeyEntry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
679.48 if (entry != null) {
679.49 if (entry.chain == null) {
679.50 return null;
679.51 @@ -348,7 +345,7 @@
679.52 * not exist
679.53 */
679.54 public Date engineGetCreationDate(String alias) {
679.55 - KeyEntry entry = entries.get(alias.toLowerCase());
679.56 + KeyEntry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
679.57 if (entry != null) {
679.58 return new Date(entry.date.getTime());
679.59 } else {
679.60 @@ -412,15 +409,13 @@
679.61 // set the keyId to current date
679.62 entry.keyId = ("Time " + (entry.date).getTime()).getBytes("UTF8");
679.63 // set the alias
679.64 - entry.alias = alias.toLowerCase();
679.65 + entry.alias = alias.toLowerCase(Locale.ENGLISH);
679.66
679.67 // add the entry
679.68 - entries.put(alias.toLowerCase(), entry);
679.69 + entries.put(alias.toLowerCase(Locale.ENGLISH), entry);
679.70 } catch (Exception nsae) {
679.71 - KeyStoreException ke = new KeyStoreException("Key protection " +
679.72 - " algorithm not found: " + nsae);
679.73 - ke.initCause(nsae);
679.74 - throw ke;
679.75 + throw new KeyStoreException("Key protection " +
679.76 + " algorithm not found: " + nsae, nsae);
679.77 }
679.78 }
679.79
679.80 @@ -456,10 +451,8 @@
679.81 try {
679.82 new EncryptedPrivateKeyInfo(key);
679.83 } catch (IOException ioe) {
679.84 - KeyStoreException ke = new KeyStoreException("Private key is not"
679.85 - + " stored as PKCS#8 EncryptedPrivateKeyInfo: " + ioe);
679.86 - ke.initCause(ioe);
679.87 - throw ke;
679.88 + throw new KeyStoreException("Private key is not stored"
679.89 + + " as PKCS#8 EncryptedPrivateKeyInfo: " + ioe, ioe);
679.90 }
679.91
679.92 KeyEntry entry = new KeyEntry();
679.93 @@ -472,7 +465,7 @@
679.94 // Won't happen
679.95 }
679.96 // set the alias
679.97 - entry.alias = alias.toLowerCase();
679.98 + entry.alias = alias.toLowerCase(Locale.ENGLISH);
679.99
679.100 entry.protectedPrivKey = key.clone();
679.101 if (chain != null) {
679.102 @@ -480,7 +473,7 @@
679.103 }
679.104
679.105 // add the entry
679.106 - entries.put(alias.toLowerCase(), entry);
679.107 + entries.put(alias.toLowerCase(Locale.ENGLISH), entry);
679.108 }
679.109
679.110
679.111 @@ -513,11 +506,8 @@
679.112 algParams = AlgorithmParameters.getInstance(algorithm);
679.113 algParams.init(paramSpec);
679.114 } catch (Exception e) {
679.115 - IOException ioe =
679.116 - new IOException("getAlgorithmParameters failed: " +
679.117 - e.getMessage());
679.118 - ioe.initCause(e);
679.119 - throw ioe;
679.120 + throw new IOException("getAlgorithmParameters failed: " +
679.121 + e.getMessage(), e);
679.122 }
679.123 return algParams;
679.124 }
679.125 @@ -544,11 +534,8 @@
679.126 algParams.init(params.toByteArray());
679.127 }
679.128 } catch (Exception e) {
679.129 - IOException ioe =
679.130 - new IOException("parseAlgParameters failed: " +
679.131 - e.getMessage());
679.132 - ioe.initCause(e);
679.133 - throw ioe;
679.134 + throw new IOException("parseAlgParameters failed: " +
679.135 + e.getMessage(), e);
679.136 }
679.137 return algParams;
679.138 }
679.139 @@ -565,10 +552,8 @@
679.140 SecretKeyFactory skFac = SecretKeyFactory.getInstance("PBE");
679.141 skey = skFac.generateSecret(keySpec);
679.142 } catch (Exception e) {
679.143 - IOException ioe = new IOException("getSecretKey failed: " +
679.144 - e.getMessage());
679.145 - ioe.initCause(e);
679.146 - throw ioe;
679.147 + throw new IOException("getSecretKey failed: " +
679.148 + e.getMessage(), e);
679.149 }
679.150 return skey;
679.151 }
679.152 @@ -633,7 +618,7 @@
679.153 public synchronized void engineSetCertificateEntry(String alias,
679.154 Certificate cert) throws KeyStoreException
679.155 {
679.156 - KeyEntry entry = entries.get(alias.toLowerCase());
679.157 + KeyEntry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
679.158 if (entry != null) {
679.159 throw new KeyStoreException("Cannot overwrite own certificate");
679.160 } else
679.161 @@ -650,7 +635,7 @@
679.162 public synchronized void engineDeleteEntry(String alias)
679.163 throws KeyStoreException
679.164 {
679.165 - entries.remove(alias.toLowerCase());
679.166 + entries.remove(alias.toLowerCase(Locale.ENGLISH));
679.167 }
679.168
679.169 /**
679.170 @@ -670,7 +655,7 @@
679.171 * @return true if the alias exists, false otherwise
679.172 */
679.173 public boolean engineContainsAlias(String alias) {
679.174 - return entries.containsKey(alias.toLowerCase());
679.175 + return entries.containsKey(alias.toLowerCase(Locale.ENGLISH));
679.176 }
679.177
679.178 /**
679.179 @@ -690,7 +675,7 @@
679.180 * <i>key entry</i>, false otherwise.
679.181 */
679.182 public boolean engineIsKeyEntry(String alias) {
679.183 - KeyEntry entry = entries.get(alias.toLowerCase());
679.184 + KeyEntry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
679.185 if (entry != null) {
679.186 return true;
679.187 } else {
679.188 @@ -826,9 +811,7 @@
679.189 md.update(data);
679.190 digest = md.digest();
679.191 } catch (Exception e) {
679.192 - IOException ioe = new IOException("generateHash failed: " + e);
679.193 - ioe.initCause(e);
679.194 - throw ioe;
679.195 + throw new IOException("generateHash failed: " + e, e);
679.196 }
679.197 return digest;
679.198 }
679.199 @@ -866,9 +849,7 @@
679.200 bytes.write(macData.getEncoded());
679.201 mData = bytes.toByteArray();
679.202 } catch (Exception e) {
679.203 - IOException ioe = new IOException("calculateMac failed: " + e);
679.204 - ioe.initCause(e);
679.205 - throw ioe;
679.206 + throw new IOException("calculateMac failed: " + e, e);
679.207 }
679.208 return mData;
679.209 }
679.210 @@ -1149,10 +1130,8 @@
679.211 encryptedData = cipher.doFinal(data);
679.212
679.213 } catch (Exception e) {
679.214 - IOException ioe = new IOException("Failed to encrypt" +
679.215 - " safe contents entry: " + e);
679.216 - ioe.initCause(e);
679.217 - throw ioe;
679.218 + throw new IOException("Failed to encrypt" +
679.219 + " safe contents entry: " + e, e);
679.220 }
679.221
679.222 // create EncryptedContentInfo
679.223 @@ -1220,7 +1199,7 @@
679.224 ContentInfo authSafe = new ContentInfo(s);
679.225 ObjectIdentifier contentType = authSafe.getContentType();
679.226
679.227 - if (contentType.equals(ContentInfo.DATA_OID)) {
679.228 + if (contentType.equals((Object)ContentInfo.DATA_OID)) {
679.229 authSafeData = authSafe.getData();
679.230 } else /* signed data */ {
679.231 throw new IOException("public key protected PKCS12 not supported");
679.232 @@ -1246,7 +1225,7 @@
679.233 safeContents = new ContentInfo(sci);
679.234 contentType = safeContents.getContentType();
679.235 safeContentsData = null;
679.236 - if (contentType.equals(ContentInfo.DATA_OID)) {
679.237 + if (contentType.equals((Object)ContentInfo.DATA_OID)) {
679.238 safeContentsData = safeContents.getData();
679.239 } else if (contentType.equals(ContentInfo.ENCRYPTED_DATA_OID)) {
679.240 if (password == null) {
679.241 @@ -1280,10 +1259,8 @@
679.242 safeContentsData = cipher.doFinal(safeContentsData);
679.243
679.244 } catch (Exception e) {
679.245 - IOException ioe = new IOException("failed to decrypt safe"
679.246 - + " contents entry: " + e);
679.247 - ioe.initCause(e);
679.248 - throw ioe;
679.249 + throw new IOException("failed to decrypt safe"
679.250 + + " contents entry: " + e, e);
679.251 }
679.252 } else {
679.253 throw new IOException("public key protected PKCS12" +
679.254 @@ -1297,7 +1274,8 @@
679.255 if (password != null && s.available() > 0) {
679.256 MacData macData = new MacData(s);
679.257 try {
679.258 - String algName = macData.getDigestAlgName().toUpperCase();
679.259 + String algName =
679.260 + macData.getDigestAlgName().toUpperCase(Locale.ENGLISH);
679.261 if (algName.equals("SHA") ||
679.262 algName.equals("SHA1") ||
679.263 algName.equals("SHA-1")) {
679.264 @@ -1319,10 +1297,7 @@
679.265 " integrity checking");
679.266 }
679.267 } catch (Exception e) {
679.268 - IOException ioe =
679.269 - new IOException("Integrity check failed: " + e);
679.270 - ioe.initCause(e);
679.271 - throw ioe;
679.272 + throw new IOException("Integrity check failed: " + e, e);
679.273 }
679.274 }
679.275
679.276 @@ -1402,12 +1377,12 @@
679.277 + bagValue.tag);
679.278 }
679.279 bagValue = bagValue.data.getDerValue();
679.280 - if (bagId.equals(PKCS8ShroudedKeyBag_OID)) {
679.281 + if (bagId.equals((Object)PKCS8ShroudedKeyBag_OID)) {
679.282 KeyEntry kEntry = new KeyEntry();
679.283 kEntry.protectedPrivKey = bagValue.toByteArray();
679.284 bagItem = kEntry;
679.285 privateKeyCount++;
679.286 - } else if (bagId.equals(CertBag_OID)) {
679.287 + } else if (bagId.equals((Object)CertBag_OID)) {
679.288 DerInputStream cs = new DerInputStream(bagValue.toByteArray());
679.289 DerValue[] certValues = cs.getSequence(2);
679.290 ObjectIdentifier certId = certValues[0].getOID();
679.291 @@ -1453,9 +1428,9 @@
679.292 throw new IOException("Attribute " + attrId +
679.293 " should have a value " + e.getMessage());
679.294 }
679.295 - if (attrId.equals(PKCS9FriendlyName_OID)) {
679.296 + if (attrId.equals((Object)PKCS9FriendlyName_OID)) {
679.297 alias = valSet[0].getBMPString();
679.298 - } else if (attrId.equals(PKCS9LocalKeyId_OID)) {
679.299 + } else if (attrId.equals((Object)PKCS9LocalKeyId_OID)) {
679.300 keyId = valSet[0].getOctetString();
679.301 } else {
679.302 // log error message for "unknown attr"
679.303 @@ -1505,7 +1480,7 @@
679.304 if (alias == null)
679.305 alias = getUnfriendlyName();
679.306 entry.alias = alias;
679.307 - entries.put(alias.toLowerCase(), entry);
679.308 + entries.put(alias.toLowerCase(Locale.ENGLISH), entry);
679.309 } else if (bagItem instanceof X509Certificate) {
679.310 X509Certificate cert = (X509Certificate)bagItem;
679.311 // Insert a localKeyID for the corresponding cert
680.1 --- a/src/share/classes/sun/security/provider/DSAKeyFactory.java Thu Sep 01 13:54:38 2011 -0700
680.2 +++ b/src/share/classes/sun/security/provider/DSAKeyFactory.java Mon Sep 05 23:58:19 2011 -0700
680.3 @@ -1,5 +1,5 @@
680.4 /*
680.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
680.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
680.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
680.8 *
680.9 * This code is free software; you can redistribute it and/or modify it
680.10 @@ -25,15 +25,12 @@
680.11
680.12 package sun.security.provider;
680.13
680.14 -import java.util.*;
680.15 -import java.lang.*;
680.16 import java.security.Key;
680.17 import java.security.PublicKey;
680.18 import java.security.PrivateKey;
680.19 import java.security.KeyFactorySpi;
680.20 import java.security.InvalidKeyException;
680.21 import java.security.AccessController;
680.22 -import java.security.PrivilegedAction;
680.23 import java.security.interfaces.DSAParams;
680.24 import java.security.spec.DSAPublicKeySpec;
680.25 import java.security.spec.DSAPrivateKeySpec;
680.26 @@ -194,13 +191,13 @@
680.27 java.security.interfaces.DSAPublicKey dsaPubKey
680.28 = (java.security.interfaces.DSAPublicKey)key;
680.29 params = dsaPubKey.getParams();
680.30 - return (T) new DSAPublicKeySpec(dsaPubKey.getY(),
680.31 - params.getP(),
680.32 - params.getQ(),
680.33 - params.getG());
680.34 + return keySpec.cast(new DSAPublicKeySpec(dsaPubKey.getY(),
680.35 + params.getP(),
680.36 + params.getQ(),
680.37 + params.getG()));
680.38
680.39 } else if (x509KeySpec.isAssignableFrom(keySpec)) {
680.40 - return (T) new X509EncodedKeySpec(key.getEncoded());
680.41 + return keySpec.cast(new X509EncodedKeySpec(key.getEncoded()));
680.42
680.43 } else {
680.44 throw new InvalidKeySpecException
680.45 @@ -219,13 +216,13 @@
680.46 java.security.interfaces.DSAPrivateKey dsaPrivKey
680.47 = (java.security.interfaces.DSAPrivateKey)key;
680.48 params = dsaPrivKey.getParams();
680.49 - return (T) new DSAPrivateKeySpec(dsaPrivKey.getX(),
680.50 - params.getP(),
680.51 - params.getQ(),
680.52 - params.getG());
680.53 + return keySpec.cast(new DSAPrivateKeySpec(dsaPrivKey.getX(),
680.54 + params.getP(),
680.55 + params.getQ(),
680.56 + params.getG()));
680.57
680.58 } else if (pkcs8KeySpec.isAssignableFrom(keySpec)) {
680.59 - return (T) new PKCS8EncodedKeySpec(key.getEncoded());
680.60 + return keySpec.cast(new PKCS8EncodedKeySpec(key.getEncoded()));
680.61
680.62 } else {
680.63 throw new InvalidKeySpecException
681.1 --- a/src/share/classes/sun/security/provider/DSAParameters.java Thu Sep 01 13:54:38 2011 -0700
681.2 +++ b/src/share/classes/sun/security/provider/DSAParameters.java Mon Sep 05 23:58:19 2011 -0700
681.3 @@ -1,5 +1,5 @@
681.4 /*
681.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
681.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
681.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
681.8 *
681.9 * This code is free software; you can redistribute it and/or modify it
681.10 @@ -25,7 +25,6 @@
681.11
681.12 package sun.security.provider;
681.13
681.14 -import java.util.*;
681.15 import java.io.*;
681.16 import java.math.BigInteger;
681.17 import java.security.AlgorithmParametersSpi;
681.18 @@ -103,7 +102,8 @@
681.19 Class<?> dsaParamSpec = Class.forName
681.20 ("java.security.spec.DSAParameterSpec");
681.21 if (dsaParamSpec.isAssignableFrom(paramSpec)) {
681.22 - return (T)new DSAParameterSpec(this.p, this.q, this.g);
681.23 + return paramSpec.cast(
681.24 + new DSAParameterSpec(this.p, this.q, this.g));
681.25 } else {
681.26 throw new InvalidParameterSpecException
681.27 ("Inappropriate parameter Specification");
682.1 --- a/src/share/classes/sun/security/provider/JavaKeyStore.java Thu Sep 01 13:54:38 2011 -0700
682.2 +++ b/src/share/classes/sun/security/provider/JavaKeyStore.java Mon Sep 05 23:58:19 2011 -0700
682.3 @@ -54,7 +54,7 @@
682.4 // regular JKS
682.5 public static final class JKS extends JavaKeyStore {
682.6 String convertAlias(String alias) {
682.7 - return alias.toLowerCase();
682.8 + return alias.toLowerCase(Locale.ENGLISH);
682.9 }
682.10 }
682.11
683.1 --- a/src/share/classes/sun/security/provider/MD4.java Thu Sep 01 13:54:38 2011 -0700
683.2 +++ b/src/share/classes/sun/security/provider/MD4.java Mon Sep 05 23:58:19 2011 -0700
683.3 @@ -1,5 +1,5 @@
683.4 /*
683.5 - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
683.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
683.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
683.8 *
683.9 * This code is free software; you can redistribute it and/or modify it
683.10 @@ -65,7 +65,9 @@
683.11 private final static Provider md4Provider;
683.12
683.13 static {
683.14 - md4Provider = new Provider("MD4Provider", 1.0d, "MD4 MessageDigest") {};
683.15 + md4Provider = new Provider("MD4Provider", 1.0d, "MD4 MessageDigest") {
683.16 + private static final long serialVersionUID = -8850464997518327965L;
683.17 + };
683.18 AccessController.doPrivileged(new PrivilegedAction<Void>() {
683.19 public Void run() {
683.20 md4Provider.put("MessageDigest.MD4", "sun.security.provider.MD4");
684.1 --- a/src/share/classes/sun/security/provider/PolicyFile.java Thu Sep 01 13:54:38 2011 -0700
684.2 +++ b/src/share/classes/sun/security/provider/PolicyFile.java Mon Sep 05 23:58:19 2011 -0700
684.3 @@ -26,27 +26,21 @@
684.4 package sun.security.provider;
684.5
684.6 import java.io.*;
684.7 -import java.lang.RuntimePermission;
684.8 import java.lang.reflect.*;
684.9 -import java.lang.ref.*;
684.10 import java.net.MalformedURLException;
684.11 import java.net.URL;
684.12 import java.net.URI;
684.13 import java.util.*;
684.14 import java.util.Enumeration;
684.15 -import java.util.Hashtable;
684.16 import java.util.List;
684.17 import java.util.StringTokenizer;
684.18 -import java.util.PropertyPermission;
684.19 import java.util.ArrayList;
684.20 import java.util.ListIterator;
684.21 -import java.util.WeakHashMap;
684.22 import java.text.MessageFormat;
684.23 import com.sun.security.auth.PrincipalComparator;
684.24 import java.security.*;
684.25 import java.security.cert.Certificate;
684.26 import java.security.cert.X509Certificate;
684.27 -import javax.security.auth.PrivateCredentialPermission;
684.28 import javax.security.auth.Subject;
684.29 import javax.security.auth.x500.X500Principal;
684.30 import java.io.FilePermission;
684.31 @@ -68,7 +62,6 @@
684.32 import sun.misc.JavaSecurityProtectionDomainAccess;
684.33 import static sun.misc.JavaSecurityProtectionDomainAccess.ProtectionDomainCache;
684.34 import sun.misc.SharedSecrets;
684.35 -import sun.security.util.Password;
684.36 import sun.security.util.PolicyUtil;
684.37 import sun.security.util.PropertyExpander;
684.38 import sun.security.util.Debug;
684.39 @@ -1006,7 +999,7 @@
684.40 * via reflection. Keep list short to not penalize non-JDK-defined
684.41 * permissions.
684.42 */
684.43 - private static final Permission getKnownInstance(Class claz,
684.44 + private static final Permission getKnownInstance(Class<?> claz,
684.45 String name, String actions) {
684.46 // XXX shorten list to most popular ones?
684.47 if (claz.equals(FilePermission.class)) {
684.48 @@ -1346,7 +1339,7 @@
684.49 "\tActive Principals: " + accPs);
684.50 }
684.51
684.52 - if (entryPs == null || entryPs.size() == 0) {
684.53 + if (entryPs == null || entryPs.isEmpty()) {
684.54
684.55 // policy entry has no principals -
684.56 // add perms regardless of principals in current ACC
684.57 @@ -1547,7 +1540,7 @@
684.58 Principal[] pdp,
684.59 Permissions perms) {
684.60
684.61 - if (entryPs == null || entryPs.size() == 0) {
684.62 + if (entryPs == null || entryPs.isEmpty()) {
684.63 // No principals in the grant to substitute
684.64 if (debug != null) {
684.65 debug.println("Ignoring permission "
684.66 @@ -1890,7 +1883,7 @@
684.67 private boolean replacePrincipals(
684.68 List<PolicyParser.PrincipalEntry> principals, KeyStore keystore) {
684.69
684.70 - if (principals == null || principals.size() == 0 || keystore == null)
684.71 + if (principals == null || principals.isEmpty() || keystore == null)
684.72 return true;
684.73
684.74 ListIterator<PolicyParser.PrincipalEntry> i = principals.listIterator();
684.75 @@ -2403,7 +2396,7 @@
684.76 final List<PolicyEntry> identityPolicyEntries;
684.77
684.78 // Maps aliases to certs
684.79 - final Map aliasMapping;
684.80 + final Map<Object, Object> aliasMapping;
684.81
684.82 // Maps ProtectionDomain to PermissionCollection
684.83 private final ProtectionDomainCache[] pdMapping;
684.84 @@ -2413,7 +2406,8 @@
684.85 policyEntries = new ArrayList<PolicyEntry>();
684.86 identityPolicyEntries =
684.87 Collections.synchronizedList(new ArrayList<PolicyEntry>(2));
684.88 - aliasMapping = Collections.synchronizedMap(new HashMap(11));
684.89 + aliasMapping = Collections.synchronizedMap(
684.90 + new HashMap<Object, Object>(11));
684.91
684.92 pdMapping = new ProtectionDomainCache[numCaches];
684.93 JavaSecurityProtectionDomainAccess jspda
685.1 --- a/src/share/classes/sun/security/provider/certpath/AdaptableX509CertSelector.java Thu Sep 01 13:54:38 2011 -0700
685.2 +++ b/src/share/classes/sun/security/provider/certpath/AdaptableX509CertSelector.java Mon Sep 05 23:58:19 2011 -0700
685.3 @@ -101,7 +101,8 @@
685.4 void parseAuthorityKeyIdentifierExtension(
685.5 AuthorityKeyIdentifierExtension akidext) throws IOException {
685.6 if (akidext != null) {
685.7 - KeyIdentifier akid = (KeyIdentifier)akidext.get(akidext.KEY_ID);
685.8 + KeyIdentifier akid = (KeyIdentifier)akidext.get(
685.9 + AuthorityKeyIdentifierExtension.KEY_ID);
685.10 if (akid != null) {
685.11 // Do not override the previous setting for initial selection.
685.12 if (isSKIDSensitive || getSubjectKeyIdentifier() == null) {
685.13 @@ -113,8 +114,8 @@
685.14 }
685.15 }
685.16
685.17 - SerialNumber asn =
685.18 - (SerialNumber)akidext.get(akidext.SERIAL_NUMBER);
685.19 + SerialNumber asn = (SerialNumber)akidext.get(
685.20 + AuthorityKeyIdentifierExtension.SERIAL_NUMBER);
685.21 if (asn != null) {
685.22 // Do not override the previous setting for initial selection.
685.23 if (isSNSensitive || getSerialNumber() == null) {
686.1 --- a/src/share/classes/sun/security/provider/certpath/Builder.java Thu Sep 01 13:54:38 2011 -0700
686.2 +++ b/src/share/classes/sun/security/provider/certpath/Builder.java Mon Sep 05 23:58:19 2011 -0700
686.3 @@ -1,5 +1,5 @@
686.4 /*
686.5 - * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
686.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
686.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
686.8 *
686.9 * This code is free software; you can redistribute it and/or modify it
686.10 @@ -153,6 +153,7 @@
686.11 if (debug != null) {
686.12 debug.println("Builder.distance(): Names are different types");
686.13 }
686.14 + return incomparable;
686.15 case GeneralNameInterface.NAME_SAME_TYPE:
686.16 if (debug != null) {
686.17 debug.println("Builder.distance(): Names are same type but " +
686.18 @@ -306,8 +307,8 @@
686.19 SubjectAlternativeNameExtension altNameExt =
686.20 certImpl.getSubjectAlternativeNameExtension();
686.21 if (altNameExt != null) {
686.22 - GeneralNames altNames =
686.23 - (GeneralNames)altNameExt.get(altNameExt.SUBJECT_NAME);
686.24 + GeneralNames altNames = altNameExt.get(
686.25 + SubjectAlternativeNameExtension.SUBJECT_NAME);
686.26 /* see if any alternative name matches target */
686.27 if (altNames != null) {
686.28 for (int j = 0, n = altNames.size(); j < n; j++) {
686.29 @@ -343,10 +344,10 @@
686.30 + String.valueOf(constraints));
686.31 }
686.32 /* reduce permitted by excluded */
686.33 - GeneralSubtrees permitted = (GeneralSubtrees)
686.34 - constraints.get(constraints.PERMITTED_SUBTREES);
686.35 - GeneralSubtrees excluded = (GeneralSubtrees)
686.36 - constraints.get(constraints.EXCLUDED_SUBTREES);
686.37 + GeneralSubtrees permitted =
686.38 + constraints.get(NameConstraintsExtension.PERMITTED_SUBTREES);
686.39 + GeneralSubtrees excluded =
686.40 + constraints.get(NameConstraintsExtension.EXCLUDED_SUBTREES);
686.41 if (permitted != null) {
686.42 permitted.reduce(excluded);
686.43 }
687.1 --- a/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java Thu Sep 01 13:54:38 2011 -0700
687.2 +++ b/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java Mon Sep 05 23:58:19 2011 -0700
687.3 @@ -41,7 +41,6 @@
687.4 import java.security.cert.*;
687.5 import java.security.cert.CertPathValidatorException.BasicReason;
687.6 import java.security.interfaces.DSAPublicKey;
687.7 -import javax.security.auth.x500.X500Principal;
687.8 import sun.security.util.Debug;
687.9 import sun.security.x509.AccessDescription;
687.10 import sun.security.x509.AuthorityInfoAccessExtension;
687.11 @@ -758,8 +757,7 @@
687.12 null, null);
687.13 points = Collections.singletonList(point);
687.14 } else {
687.15 - points = (List<DistributionPoint>)ext.get(
687.16 - CRLDistributionPointsExtension.POINTS);
687.17 + points = ext.get(CRLDistributionPointsExtension.POINTS);
687.18 }
687.19 Set<X509CRL> results = new HashSet<X509CRL>();
687.20 DistributionPointFetcher dpf =
688.1 --- a/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java Thu Sep 01 13:54:38 2011 -0700
688.2 +++ b/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java Mon Sep 05 23:58:19 2011 -0700
688.3 @@ -114,8 +114,8 @@
688.4 }
688.5 return Collections.emptySet();
688.6 }
688.7 - List<DistributionPoint> points = (List<DistributionPoint>)ext.get(
688.8 - CRLDistributionPointsExtension.POINTS);
688.9 + List<DistributionPoint> points =
688.10 + ext.get(CRLDistributionPointsExtension.POINTS);
688.11 Set<X509CRL> results = new HashSet<X509CRL>();
688.12 for (Iterator<DistributionPoint> t = points.iterator();
688.13 t.hasNext() && !Arrays.equals(reasonsMask, ALL_REASONS); ) {
688.14 @@ -570,15 +570,16 @@
688.15 AuthorityKeyIdentifierExtension akidext =
688.16 crlImpl.getAuthKeyIdExtension();
688.17 if (akidext != null) {
688.18 - KeyIdentifier akid = (KeyIdentifier)akidext.get(akidext.KEY_ID);
688.19 + KeyIdentifier akid = (KeyIdentifier)akidext.get(
688.20 + AuthorityKeyIdentifierExtension.KEY_ID);
688.21 if (akid != null) {
688.22 DerOutputStream derout = new DerOutputStream();
688.23 derout.putOctetString(akid.getIdentifier());
688.24 certSel.setSubjectKeyIdentifier(derout.toByteArray());
688.25 }
688.26
688.27 - SerialNumber asn =
688.28 - (SerialNumber)akidext.get(akidext.SERIAL_NUMBER);
688.29 + SerialNumber asn = (SerialNumber)akidext.get(
688.30 + AuthorityKeyIdentifierExtension.SERIAL_NUMBER);
688.31 if (asn != null) {
688.32 certSel.setSerialNumber(asn.getNumber());
688.33 }
689.1 --- a/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java Thu Sep 01 13:54:38 2011 -0700
689.2 +++ b/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java Mon Sep 05 23:58:19 2011 -0700
689.3 @@ -30,7 +30,6 @@
689.4
689.5 import java.security.GeneralSecurityException;
689.6 import java.security.InvalidKeyException;
689.7 -import java.security.cert.Certificate;
689.8 import java.security.cert.CertificateException;
689.9 import java.security.cert.CertPathValidatorException;
689.10 import java.security.cert.PKIXReason;
689.11 @@ -44,22 +43,13 @@
689.12 import javax.security.auth.x500.X500Principal;
689.13
689.14 import sun.security.util.Debug;
689.15 -import sun.security.util.DerOutputStream;
689.16 import sun.security.x509.AccessDescription;
689.17 import sun.security.x509.AuthorityInfoAccessExtension;
689.18 import sun.security.x509.PKIXExtensions;
689.19 import sun.security.x509.PolicyMappingsExtension;
689.20 import sun.security.x509.X500Name;
689.21 import sun.security.x509.X509CertImpl;
689.22 -import sun.security.x509.X509CRLImpl;
689.23 import sun.security.x509.AuthorityKeyIdentifierExtension;
689.24 -import sun.security.x509.KeyIdentifier;
689.25 -import sun.security.x509.SubjectKeyIdentifierExtension;
689.26 -import sun.security.x509.SerialNumber;
689.27 -import sun.security.x509.GeneralNames;
689.28 -import sun.security.x509.GeneralName;
689.29 -import sun.security.x509.GeneralNameInterface;
689.30 -import java.math.BigInteger;
689.31
689.32 /**
689.33 * This class represents a forward builder, which is able to retrieve
689.34 @@ -362,6 +352,9 @@
689.35 * Download Certificates from the given AIA and add them to the
689.36 * specified Collection.
689.37 */
689.38 + // cs.getCertificates(caSelector) returns a collection of X509Certificate's
689.39 + // because of the selector, so the cast is safe
689.40 + @SuppressWarnings("unchecked")
689.41 private boolean getCerts(AuthorityInfoAccessExtension aiaExt,
689.42 Collection<X509Certificate> certs) {
689.43 if (Builder.USE_AIA == false) {
690.1 --- a/src/share/classes/sun/security/provider/certpath/ForwardState.java Thu Sep 01 13:54:38 2011 -0700
690.2 +++ b/src/share/classes/sun/security/provider/certpath/ForwardState.java Mon Sep 05 23:58:19 2011 -0700
690.3 @@ -1,5 +1,5 @@
690.4 /*
690.5 - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
690.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
690.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
690.8 *
690.9 * This code is free software; you can redistribute it and/or modify it
690.10 @@ -206,8 +206,8 @@
690.11 SubjectAlternativeNameExtension subjAltNameExt
690.12 = icert.getSubjectAlternativeNameExtension();
690.13 if (subjAltNameExt != null) {
690.14 - GeneralNames gNames = (GeneralNames)
690.15 - subjAltNameExt.get(SubjectAlternativeNameExtension.SUBJECT_NAME);
690.16 + GeneralNames gNames = subjAltNameExt.get(
690.17 + SubjectAlternativeNameExtension.SUBJECT_NAME);
690.18 for (Iterator<GeneralName> t = gNames.iterator();
690.19 t.hasNext(); ) {
690.20 GeneralNameInterface gName = t.next().getName();
690.21 @@ -236,6 +236,7 @@
690.22 * because some of them will
690.23 * not have their contents modified by subsequent calls to updateState.
690.24 */
690.25 + @SuppressWarnings("unchecked") // Safe casts assuming clone() works correctly
690.26 public Object clone() {
690.27 try {
690.28 ForwardState clonedState = (ForwardState) super.clone();
691.1 --- a/src/share/classes/sun/security/provider/certpath/IndexedCollectionCertStore.java Thu Sep 01 13:54:38 2011 -0700
691.2 +++ b/src/share/classes/sun/security/provider/certpath/IndexedCollectionCertStore.java Mon Sep 05 23:58:19 2011 -0700
691.3 @@ -1,5 +1,5 @@
691.4 /*
691.5 - * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
691.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
691.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
691.8 *
691.9 * This code is free software; you can redistribute it and/or modify it
691.10 @@ -185,6 +185,7 @@
691.11 list.add((X509Certificate)oldEntry);
691.12 certSubjects.put(subject, list);
691.13 } else {
691.14 + @SuppressWarnings("unchecked") // See certSubjects javadoc.
691.15 List<X509Certificate> list = (List<X509Certificate>)oldEntry;
691.16 if (list.contains(cert) == false) {
691.17 list.add(cert);
691.18 @@ -210,6 +211,8 @@
691.19 list.add((X509CRL)oldEntry);
691.20 crlIssuers.put(issuer, list);
691.21 } else {
691.22 + // See crlIssuers javadoc.
691.23 + @SuppressWarnings("unchecked")
691.24 List<X509CRL> list = (List<X509CRL>)oldEntry;
691.25 if (list.contains(crl) == false) {
691.26 list.add(crl);
691.27 @@ -279,6 +282,8 @@
691.28 return Collections.<X509Certificate>emptySet();
691.29 }
691.30 } else {
691.31 + // See certSubjects javadoc.
691.32 + @SuppressWarnings("unchecked")
691.33 List<X509Certificate> list = (List<X509Certificate>)entry;
691.34 Set<X509Certificate> matches = new HashSet<X509Certificate>(16);
691.35 for (X509Certificate cert : list) {
691.36 @@ -309,6 +314,8 @@
691.37 matches.add(cert);
691.38 }
691.39 } else {
691.40 + // See certSubjects javadoc.
691.41 + @SuppressWarnings("unchecked")
691.42 List<X509Certificate> list = (List<X509Certificate>)obj;
691.43 for (X509Certificate cert : list) {
691.44 if (selector.match(cert)) {
691.45 @@ -370,6 +377,8 @@
691.46 matches.add(crl);
691.47 }
691.48 } else { // List
691.49 + // See crlIssuers javadoc.
691.50 + @SuppressWarnings("unchecked")
691.51 List<X509CRL> list = (List<X509CRL>)entry;
691.52 for (X509CRL crl : list) {
691.53 if (x509Selector.match(crl)) {
691.54 @@ -398,6 +407,8 @@
691.55 matches.add(crl);
691.56 }
691.57 } else {
691.58 + // See crlIssuers javadoc.
691.59 + @SuppressWarnings("unchecked")
691.60 List<X509CRL> list = (List<X509CRL>)obj;
691.61 for (X509CRL crl : list) {
691.62 if (selector.match(crl)) {
692.1 --- a/src/share/classes/sun/security/provider/certpath/OCSP.java Thu Sep 01 13:54:38 2011 -0700
692.2 +++ b/src/share/classes/sun/security/provider/certpath/OCSP.java Mon Sep 05 23:58:19 2011 -0700
692.3 @@ -1,5 +1,5 @@
692.4 /*
692.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
692.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
692.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
692.8 *
692.9 * This code is free software; you can redistribute it and/or modify it
692.10 @@ -291,7 +291,7 @@
692.11
692.12 List<AccessDescription> descriptions = aia.getAccessDescriptions();
692.13 for (AccessDescription description : descriptions) {
692.14 - if (description.getAccessMethod().equals(
692.15 + if (description.getAccessMethod().equals((Object)
692.16 AccessDescription.Ad_OCSP_Id)) {
692.17
692.18 GeneralName generalName = description.getAccessLocation();
693.1 --- a/src/share/classes/sun/security/provider/certpath/OCSPChecker.java Thu Sep 01 13:54:38 2011 -0700
693.2 +++ b/src/share/classes/sun/security/provider/certpath/OCSPChecker.java Mon Sep 05 23:58:19 2011 -0700
693.3 @@ -1,5 +1,5 @@
693.4 /*
693.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
693.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
693.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
693.8 *
693.9 * This code is free software; you can redistribute it and/or modify it
693.10 @@ -300,7 +300,7 @@
693.11 if (filter != null) {
693.12 List<CertStore> certStores = pkixParams.getCertStores();
693.13 for (CertStore certStore : certStores) {
693.14 - Iterator i = null;
693.15 + Iterator<? extends Certificate> i = null;
693.16 try {
693.17 i = certStore.getCertificates(filter).iterator();
693.18 } catch (CertStoreException cse) {
693.19 @@ -392,7 +392,7 @@
693.20
693.21 List<AccessDescription> descriptions = aia.getAccessDescriptions();
693.22 for (AccessDescription description : descriptions) {
693.23 - if (description.getAccessMethod().equals(
693.24 + if (description.getAccessMethod().equals((Object)
693.25 AccessDescription.Ad_OCSP_Id)) {
693.26
693.27 GeneralName generalName = description.getAccessLocation();
694.1 --- a/src/share/classes/sun/security/provider/certpath/OCSPResponse.java Thu Sep 01 13:54:38 2011 -0700
694.2 +++ b/src/share/classes/sun/security/provider/certpath/OCSPResponse.java Mon Sep 05 23:58:19 2011 -0700
694.3 @@ -1,5 +1,5 @@
694.4 /*
694.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
694.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
694.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
694.8 *
694.9 * This code is free software; you can redistribute it and/or modify it
694.10 @@ -26,7 +26,6 @@
694.11 package sun.security.provider.certpath;
694.12
694.13 import java.io.*;
694.14 -import java.math.BigInteger;
694.15 import java.security.*;
694.16 import java.security.cert.CertificateException;
694.17 import java.security.cert.CertificateParsingException;
694.18 @@ -206,7 +205,7 @@
694.19 // responseType
694.20 derIn = tmp.data;
694.21 ObjectIdentifier responseType = derIn.getOID();
694.22 - if (responseType.equals(OCSP_BASIC_RESPONSE_OID)) {
694.23 + if (responseType.equals((Object)OCSP_BASIC_RESPONSE_OID)) {
694.24 if (DEBUG != null) {
694.25 DEBUG.println("OCSP response type: basic");
694.26 }
694.27 @@ -301,7 +300,7 @@
694.28 if (DEBUG != null) {
694.29 DEBUG.println("OCSP extension: " + responseExtension);
694.30 }
694.31 - if (responseExtension.getExtensionId().equals(
694.32 + if (responseExtension.getExtensionId().equals((Object)
694.33 OCSP_NONCE_EXTENSION_OID)) {
694.34 /*
694.35 ocspNonce =
695.1 --- a/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java Thu Sep 01 13:54:38 2011 -0700
695.2 +++ b/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java Mon Sep 05 23:58:19 2011 -0700
695.3 @@ -25,7 +25,6 @@
695.4
695.5 package sun.security.provider.certpath;
695.6
695.7 -import java.io.IOException;
695.8 import java.security.AccessController;
695.9 import java.security.InvalidAlgorithmParameterException;
695.10 import java.security.cert.CertPath;
695.11 @@ -40,13 +39,11 @@
695.12 import java.security.cert.PolicyNode;
695.13 import java.security.cert.TrustAnchor;
695.14 import java.security.cert.X509Certificate;
695.15 -import java.security.cert.X509CertSelector;
695.16 import java.util.Collections;
695.17 import java.util.List;
695.18 import java.util.ArrayList;
695.19 import java.util.Date;
695.20 import java.util.Set;
695.21 -import javax.security.auth.x500.X500Principal;
695.22 import sun.security.action.GetBooleanSecurityPropertyAction;
695.23 import sun.security.util.Debug;
695.24
695.25 @@ -130,6 +127,9 @@
695.26
695.27 // Must copy elements of certList into a new modifiable List before
695.28 // calling Collections.reverse().
695.29 + // If cp is not an X.509 or X509 certpath, an
695.30 + // InvalidAlgorithmParameterException will have been thrown by now.
695.31 + @SuppressWarnings("unchecked")
695.32 ArrayList<X509Certificate> certList = new ArrayList<X509Certificate>
695.33 ((List<X509Certificate>)cp.getCertificates());
695.34 if (debug != null) {
696.1 --- a/src/share/classes/sun/security/provider/certpath/PolicyChecker.java Thu Sep 01 13:54:38 2011 -0700
696.2 +++ b/src/share/classes/sun/security/provider/certpath/PolicyChecker.java Mon Sep 05 23:58:19 2011 -0700
696.3 @@ -1,5 +1,5 @@
696.4 /*
696.5 - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
696.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
696.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
696.8 *
696.9 * This code is free software; you can redistribute it and/or modify it
696.10 @@ -274,8 +274,8 @@
696.11 = currCert.getPolicyConstraintsExtension();
696.12 if (polConstExt == null)
696.13 return explicitPolicy;
696.14 - int require = ((Integer)
696.15 - polConstExt.get(PolicyConstraintsExtension.REQUIRE)).intValue();
696.16 + int require =
696.17 + polConstExt.get(PolicyConstraintsExtension.REQUIRE).intValue();
696.18 if (debug != null) {
696.19 debug.println("PolicyChecker.mergeExplicitPolicy() "
696.20 + "require Index from cert = " + require);
696.21 @@ -328,8 +328,8 @@
696.22 if (polConstExt == null)
696.23 return policyMapping;
696.24
696.25 - int inhibit = ((Integer)
696.26 - polConstExt.get(PolicyConstraintsExtension.INHIBIT)).intValue();
696.27 + int inhibit =
696.28 + polConstExt.get(PolicyConstraintsExtension.INHIBIT).intValue();
696.29 if (debug != null)
696.30 debug.println("PolicyChecker.mergePolicyMapping() "
696.31 + "inhibit Index from cert = " + inhibit);
696.32 @@ -376,8 +376,8 @@
696.33 if (inhAnyPolExt == null)
696.34 return inhibitAnyPolicy;
696.35
696.36 - int skipCerts = ((Integer)
696.37 - inhAnyPolExt.get(InhibitAnyPolicyExtension.SKIP_CERTS)).intValue();
696.38 + int skipCerts =
696.39 + inhAnyPolExt.get(InhibitAnyPolicyExtension.SKIP_CERTS).intValue();
696.40 if (debug != null)
696.41 debug.println("PolicyChecker.mergeInhibitAnyPolicy() "
696.42 + "skipCerts Index from cert = " + skipCerts);
696.43 @@ -448,8 +448,7 @@
696.44 + "policiesCritical = " + policiesCritical);
696.45
696.46 try {
696.47 - policyInfo = (List<PolicyInformation>)
696.48 - currCertPolicies.get(CertificatePoliciesExtension.POLICIES);
696.49 + policyInfo = currCertPolicies.get(CertificatePoliciesExtension.POLICIES);
696.50 } catch (IOException ioe) {
696.51 throw new CertPathValidatorException("Exception while "
696.52 + "retrieving policyOIDs", ioe);
696.53 @@ -751,8 +750,7 @@
696.54
696.55 List<CertificatePolicyMap> maps = null;
696.56 try {
696.57 - maps = (List<CertificatePolicyMap>)polMappingsExt.get
696.58 - (PolicyMappingsExtension.MAP);
696.59 + maps = polMappingsExt.get(PolicyMappingsExtension.MAP);
696.60 } catch (IOException e) {
696.61 if (debug != null) {
696.62 debug.println("PolicyChecker.processPolicyMappings() "
696.63 @@ -860,8 +858,7 @@
696.64 {
696.65 List<PolicyInformation> policyInfo = null;
696.66 try {
696.67 - policyInfo = (List<PolicyInformation>)
696.68 - currCertPolicies.get(CertificatePoliciesExtension.POLICIES);
696.69 + policyInfo = currCertPolicies.get(CertificatePoliciesExtension.POLICIES);
696.70 } catch (IOException ioe) {
696.71 throw new CertPathValidatorException("Exception while "
696.72 + "retrieving policyOIDs", ioe);
697.1 --- a/src/share/classes/sun/security/provider/certpath/ReverseState.java Thu Sep 01 13:54:38 2011 -0700
697.2 +++ b/src/share/classes/sun/security/provider/certpath/ReverseState.java Mon Sep 05 23:58:19 2011 -0700
697.3 @@ -1,5 +1,5 @@
697.4 /*
697.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
697.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
697.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
697.8 *
697.9 * This code is free software; you can redistribute it and/or modify it
697.10 @@ -365,6 +365,7 @@
697.11 * because some of them (e.g., subjKeyId) will
697.12 * not have their contents modified by subsequent calls to updateState.
697.13 */
697.14 + @SuppressWarnings("unchecked") // Safe casts assuming clone() works correctly
697.15 public Object clone() {
697.16 try {
697.17 ReverseState clonedState = (ReverseState) super.clone();
698.1 --- a/src/share/classes/sun/security/provider/certpath/URICertStore.java Thu Sep 01 13:54:38 2011 -0700
698.2 +++ b/src/share/classes/sun/security/provider/certpath/URICertStore.java Mon Sep 05 23:58:19 2011 -0700
698.3 @@ -1,5 +1,5 @@
698.4 /*
698.5 - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
698.6 + * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
698.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
698.8 *
698.9 * This code is free software; you can redistribute it and/or modify it
698.10 @@ -209,7 +209,8 @@
698.11 * object of a certificate's Authority Information Access Extension.
698.12 */
698.13 static CertStore getInstance(AccessDescription ad) {
698.14 - if (!ad.getAccessMethod().equals(AccessDescription.Ad_CAISSUERS_Id)) {
698.15 + if (!ad.getAccessMethod().equals((Object)
698.16 + AccessDescription.Ad_CAISSUERS_Id)) {
698.17 return null;
698.18 }
698.19 GeneralNameInterface gn = ad.getAccessLocation().getName();
698.20 @@ -241,6 +242,7 @@
698.21 * match the specified selector
698.22 * @throws CertStoreException if an exception occurs
698.23 */
698.24 + @SuppressWarnings("unchecked")
698.25 public synchronized Collection<X509Certificate> engineGetCertificates
698.26 (CertSelector selector) throws CertStoreException {
698.27
698.28 @@ -255,6 +257,7 @@
698.29 }
698.30 // Fetch the certificates via LDAP. LDAPCertStore has its own
698.31 // caching mechanism, see the class description for more info.
698.32 + // Safe cast since xsel is an X509 certificate selector.
698.33 return (Collection<X509Certificate>)
698.34 ldapCertStore.getCertificates(xsel);
698.35 }
698.36 @@ -300,6 +303,7 @@
698.37 if (debug != null) {
698.38 debug.println("Downloading new certificates...");
698.39 }
698.40 + // Safe cast since factory is an X.509 certificate factory
698.41 certs = (Collection<X509Certificate>)
698.42 factory.generateCertificates(in);
698.43 return getMatchingCerts(certs, selector);
698.44 @@ -361,6 +365,7 @@
698.45 * match the specified selector
698.46 * @throws CertStoreException if an exception occurs
698.47 */
698.48 + @SuppressWarnings("unchecked")
698.49 public synchronized Collection<X509CRL> engineGetCRLs(CRLSelector selector)
698.50 throws CertStoreException {
698.51
698.52 @@ -375,6 +380,7 @@
698.53 }
698.54 // Fetch the CRLs via LDAP. LDAPCertStore has its own
698.55 // caching mechanism, see the class description for more info.
698.56 + // Safe cast since xsel is an X509 certificate selector.
698.57 return (Collection<X509CRL>) ldapCertStore.getCRLs(xsel);
698.58 }
698.59
699.1 --- a/src/share/classes/sun/security/provider/certpath/Vertex.java Thu Sep 01 13:54:38 2011 -0700
699.2 +++ b/src/share/classes/sun/security/provider/certpath/Vertex.java Mon Sep 05 23:58:19 2011 -0700
699.3 @@ -1,5 +1,5 @@
699.4 /*
699.5 - * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
699.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
699.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
699.8 *
699.9 * This code is free software; you can redistribute it and/or modify it
699.10 @@ -171,7 +171,8 @@
699.11 try {
699.12 sKeyID = x509Cert.getSubjectKeyIdentifierExtension();
699.13 if (sKeyID != null) {
699.14 - KeyIdentifier keyID = (KeyIdentifier)sKeyID.get(sKeyID.KEY_ID);
699.15 + KeyIdentifier keyID = sKeyID.get(
699.16 + SubjectKeyIdentifierExtension.KEY_ID);
699.17 out = out + "SubjKeyID: " + keyID.toString();
699.18 }
699.19 } catch (Exception e) {
699.20 @@ -184,7 +185,8 @@
699.21 try {
699.22 aKeyID = x509Cert.getAuthorityKeyIdentifierExtension();
699.23 if (aKeyID != null) {
699.24 - KeyIdentifier keyID = (KeyIdentifier)aKeyID.get(aKeyID.KEY_ID);
699.25 + KeyIdentifier keyID = (KeyIdentifier)aKeyID.get(
699.26 + AuthorityKeyIdentifierExtension.KEY_ID);
699.27 out = out + "AuthKeyID: " + keyID.toString();
699.28 }
699.29 } catch (Exception e) {
700.1 --- a/src/share/classes/sun/security/provider/certpath/X509CertPath.java Thu Sep 01 13:54:38 2011 -0700
700.2 +++ b/src/share/classes/sun/security/provider/certpath/X509CertPath.java Mon Sep 05 23:58:19 2011 -0700
700.3 @@ -1,5 +1,5 @@
700.4 /*
700.5 - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
700.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
700.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
700.8 *
700.9 * This code is free software; you can redistribute it and/or modify it
700.10 @@ -25,7 +25,6 @@
700.11
700.12 package sun.security.provider.certpath;
700.13
700.14 -import java.io.BufferedInputStream;
700.15 import java.io.ByteArrayInputStream;
700.16 import java.io.ByteArrayOutputStream;
700.17 import java.io.IOException;
700.18 @@ -101,11 +100,18 @@
700.19 * @exception CertificateException if <code>certs</code> contains an element
700.20 * that is not an <code>X509Certificate</code>
700.21 */
700.22 + @SuppressWarnings("unchecked")
700.23 public X509CertPath(List<? extends Certificate> certs) throws CertificateException {
700.24 super("X.509");
700.25
700.26 // Ensure that the List contains only X509Certificates
700.27 - for (Object obj : (List<?>)certs) {
700.28 + //
700.29 + // Note; The certs parameter is not necessarily to be of Certificate
700.30 + // for some old code. For compatibility, to make sure the exception
700.31 + // is CertificateException, rather than ClassCastException, please
700.32 + // don't use
700.33 + // for (Certificate obj : certs)
700.34 + for (Object obj : certs) {
700.35 if (obj instanceof X509Certificate == false) {
700.36 throw new CertificateException
700.37 ("List is not all X509Certificates: "
700.38 @@ -147,12 +153,15 @@
700.39 throws CertificateException {
700.40 super("X.509");
700.41
700.42 - if (PKIPATH_ENCODING.equals(encoding)) {
700.43 - certs = parsePKIPATH(is);
700.44 - } else if (PKCS7_ENCODING.equals(encoding)) {
700.45 - certs = parsePKCS7(is);
700.46 - } else {
700.47 - throw new CertificateException("unsupported encoding");
700.48 + switch (encoding) {
700.49 + case PKIPATH_ENCODING:
700.50 + certs = parsePKIPATH(is);
700.51 + break;
700.52 + case PKCS7_ENCODING:
700.53 + certs = parsePKCS7(is);
700.54 + break;
700.55 + default:
700.56 + throw new CertificateException("unsupported encoding");
700.57 }
700.58 }
700.59
700.60 @@ -192,10 +201,8 @@
700.61 return Collections.unmodifiableList(certList);
700.62
700.63 } catch (IOException ioe) {
700.64 - CertificateException ce = new CertificateException("IOException" +
700.65 - " parsing PkiPath data: " + ioe);
700.66 - ce.initCause(ioe);
700.67 - throw ce;
700.68 + throw new CertificateException("IOException parsing PkiPath data: "
700.69 + + ioe, ioe);
700.70 }
700.71 }
700.72
700.73 @@ -220,7 +227,7 @@
700.74 // Copy the entire input stream into an InputStream that does
700.75 // support mark
700.76 is = new ByteArrayInputStream(readAllBytes(is));
700.77 - };
700.78 + }
700.79 PKCS7 pkcs7 = new PKCS7(is);
700.80
700.81 X509Certificate[] certArray = pkcs7.getCertificates();
700.82 @@ -301,10 +308,8 @@
700.83 return derout.toByteArray();
700.84
700.85 } catch (IOException ioe) {
700.86 - CertificateEncodingException ce = new CertificateEncodingException
700.87 - ("IOException encoding PkiPath data: " + ioe);
700.88 - ce.initCause(ioe);
700.89 - throw ce;
700.90 + throw new CertificateEncodingException("IOException encoding " +
700.91 + "PkiPath data: " + ioe, ioe);
700.92 }
700.93 }
700.94
700.95 @@ -339,12 +344,13 @@
700.96 */
700.97 public byte[] getEncoded(String encoding)
700.98 throws CertificateEncodingException {
700.99 - if (PKIPATH_ENCODING.equals(encoding)) {
700.100 - return encodePKIPATH();
700.101 - } else if (PKCS7_ENCODING.equals(encoding)) {
700.102 - return encodePKCS7();
700.103 - } else {
700.104 - throw new CertificateEncodingException("unsupported encoding");
700.105 + switch (encoding) {
700.106 + case PKIPATH_ENCODING:
700.107 + return encodePKIPATH();
700.108 + case PKCS7_ENCODING:
700.109 + return encodePKCS7();
700.110 + default:
700.111 + throw new CertificateEncodingException("unsupported encoding");
700.112 }
700.113 }
700.114
701.1 --- a/src/share/classes/sun/security/provider/certpath/ldap/LDAPCertStore.java Thu Sep 01 13:54:38 2011 -0700
701.2 +++ b/src/share/classes/sun/security/provider/certpath/ldap/LDAPCertStore.java Mon Sep 05 23:58:19 2011 -0700
701.3 @@ -879,7 +879,8 @@
701.4 if (hashCode == 0) {
701.5 int result = 17;
701.6 result = 37*result + getPort();
701.7 - result = 37*result + getServerName().toLowerCase().hashCode();
701.8 + result = 37*result +
701.9 + getServerName().toLowerCase(Locale.ENGLISH).hashCode();
701.10 hashCode = result;
701.11 }
701.12 return hashCode;
702.1 --- a/src/share/classes/sun/security/rsa/RSAKeyFactory.java Thu Sep 01 13:54:38 2011 -0700
702.2 +++ b/src/share/classes/sun/security/rsa/RSAKeyFactory.java Mon Sep 05 23:58:19 2011 -0700
702.3 @@ -1,5 +1,5 @@
702.4 /*
702.5 - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
702.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
702.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
702.8 *
702.9 * This code is free software; you can redistribute it and/or modify it
702.10 @@ -351,12 +351,12 @@
702.11 if (key instanceof RSAPublicKey) {
702.12 RSAPublicKey rsaKey = (RSAPublicKey)key;
702.13 if (rsaPublicKeySpecClass.isAssignableFrom(keySpec)) {
702.14 - return (T) new RSAPublicKeySpec(
702.15 + return keySpec.cast(new RSAPublicKeySpec(
702.16 rsaKey.getModulus(),
702.17 rsaKey.getPublicExponent()
702.18 - );
702.19 + ));
702.20 } else if (x509KeySpecClass.isAssignableFrom(keySpec)) {
702.21 - return (T) new X509EncodedKeySpec(key.getEncoded());
702.22 + return keySpec.cast(new X509EncodedKeySpec(key.getEncoded()));
702.23 } else {
702.24 throw new InvalidKeySpecException
702.25 ("KeySpec must be RSAPublicKeySpec or "
702.26 @@ -364,11 +364,11 @@
702.27 }
702.28 } else if (key instanceof RSAPrivateKey) {
702.29 if (pkcs8KeySpecClass.isAssignableFrom(keySpec)) {
702.30 - return (T) new PKCS8EncodedKeySpec(key.getEncoded());
702.31 + return keySpec.cast(new PKCS8EncodedKeySpec(key.getEncoded()));
702.32 } else if (rsaPrivateCrtKeySpecClass.isAssignableFrom(keySpec)) {
702.33 if (key instanceof RSAPrivateCrtKey) {
702.34 RSAPrivateCrtKey crtKey = (RSAPrivateCrtKey)key;
702.35 - return (T) new RSAPrivateCrtKeySpec(
702.36 + return keySpec.cast(new RSAPrivateCrtKeySpec(
702.37 crtKey.getModulus(),
702.38 crtKey.getPublicExponent(),
702.39 crtKey.getPrivateExponent(),
702.40 @@ -377,17 +377,17 @@
702.41 crtKey.getPrimeExponentP(),
702.42 crtKey.getPrimeExponentQ(),
702.43 crtKey.getCrtCoefficient()
702.44 - );
702.45 + ));
702.46 } else {
702.47 throw new InvalidKeySpecException
702.48 ("RSAPrivateCrtKeySpec can only be used with CRT keys");
702.49 }
702.50 } else if (rsaPrivateKeySpecClass.isAssignableFrom(keySpec)) {
702.51 RSAPrivateKey rsaKey = (RSAPrivateKey)key;
702.52 - return (T) new RSAPrivateKeySpec(
702.53 + return keySpec.cast(new RSAPrivateKeySpec(
702.54 rsaKey.getModulus(),
702.55 rsaKey.getPrivateExponent()
702.56 - );
702.57 + ));
702.58 } else {
702.59 throw new InvalidKeySpecException
702.60 ("KeySpec must be RSAPrivate(Crt)KeySpec or "
703.1 --- a/src/share/classes/sun/security/rsa/RSASignature.java Thu Sep 01 13:54:38 2011 -0700
703.2 +++ b/src/share/classes/sun/security/rsa/RSASignature.java Mon Sep 05 23:58:19 2011 -0700
703.3 @@ -1,5 +1,5 @@
703.4 /*
703.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
703.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
703.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
703.8 *
703.9 * This code is free software; you can redistribute it and/or modify it
703.10 @@ -27,7 +27,6 @@
703.11
703.12 import java.io.IOException;
703.13 import java.nio.ByteBuffer;
703.14 -import java.math.BigInteger;
703.15 import java.util.Arrays;
703.16
703.17 import java.security.*;
703.18 @@ -202,8 +201,6 @@
703.19 // return false rather than propagating the exception for
703.20 // compatibility/ease of use
703.21 return false;
703.22 - } catch (GeneralSecurityException e) {
703.23 - throw new SignatureException("Signature verification failed", e);
703.24 } catch (IOException e) {
703.25 throw new SignatureException("Signature encoding error", e);
703.26 }
703.27 @@ -235,7 +232,7 @@
703.28 throw new IOException("SEQUENCE length error");
703.29 }
703.30 AlgorithmId algId = AlgorithmId.parse(values[0]);
703.31 - if (algId.getOID().equals(oid) == false) {
703.32 + if (algId.getOID().equals((Object)oid) == false) {
703.33 throw new IOException("ObjectIdentifier mismatch: "
703.34 + algId.getOID());
703.35 }
704.1 --- a/src/share/classes/sun/security/ssl/CipherSuite.java Thu Sep 01 13:54:38 2011 -0700
704.2 +++ b/src/share/classes/sun/security/ssl/CipherSuite.java Mon Sep 05 23:58:19 2011 -0700
704.3 @@ -65,7 +65,7 @@
704.4 * unavailable or disabled at compile time
704.5 *
704.6 */
704.7 -final class CipherSuite implements Comparable {
704.8 +final class CipherSuite implements Comparable<CipherSuite> {
704.9
704.10 // minimum priority for supported CipherSuites
704.11 final static int SUPPORTED_SUITES_PRIORITY = 1;
704.12 @@ -202,8 +202,8 @@
704.13 * Note that for unsupported CipherSuites parsed from a handshake
704.14 * message we violate the equals() contract.
704.15 */
704.16 - public int compareTo(Object o) {
704.17 - return ((CipherSuite)o).priority - priority;
704.18 + public int compareTo(CipherSuite o) {
704.19 + return o.priority - priority;
704.20 }
704.21
704.22 /**
705.1 --- a/src/share/classes/sun/security/ssl/HandshakeMessage.java Thu Sep 01 13:54:38 2011 -0700
705.2 +++ b/src/share/classes/sun/security/ssl/HandshakeMessage.java Mon Sep 05 23:58:19 2011 -0700
705.3 @@ -811,13 +811,16 @@
705.4 sig = JsseJce.getSignature(
705.5 preferableSignatureAlgorithm.getAlgorithmName());
705.6 } else {
705.7 - if (algorithm.equals("DSA")) {
705.8 - sig = JsseJce.getSignature(JsseJce.SIGNATURE_DSA);
705.9 - } else if (algorithm.equals("RSA")) {
705.10 - sig = RSASignature.getInstance();
705.11 - } else {
705.12 - throw new SSLKeyException("neither an RSA or a DSA key");
705.13 - }
705.14 + switch (algorithm) {
705.15 + case "DSA":
705.16 + sig = JsseJce.getSignature(JsseJce.SIGNATURE_DSA);
705.17 + break;
705.18 + case "RSA":
705.19 + sig = RSASignature.getInstance();
705.20 + break;
705.21 + default:
705.22 + throw new SSLKeyException("neither an RSA or a DSA key");
705.23 + }
705.24 }
705.25
705.26 sig.initVerify(publicKey);
705.27 @@ -1097,13 +1100,14 @@
705.28
705.29 private static Signature getSignature(String keyAlgorithm)
705.30 throws NoSuchAlgorithmException {
705.31 - if (keyAlgorithm.equals("EC")) {
705.32 - return JsseJce.getSignature(JsseJce.SIGNATURE_ECDSA);
705.33 - } else if (keyAlgorithm.equals("RSA")) {
705.34 - return RSASignature.getInstance();
705.35 - } else {
705.36 - throw new NoSuchAlgorithmException("neither an RSA or a EC key");
705.37 - }
705.38 + switch (keyAlgorithm) {
705.39 + case "EC":
705.40 + return JsseJce.getSignature(JsseJce.SIGNATURE_ECDSA);
705.41 + case "RSA":
705.42 + return RSASignature.getInstance();
705.43 + default:
705.44 + throw new NoSuchAlgorithmException("neither an RSA or a EC key");
705.45 + }
705.46 }
705.47
705.48 private void updateSignature(Signature sig, byte clntNonce[],
705.49 @@ -1611,16 +1615,17 @@
705.50 */
705.51 private static Signature getSignature(ProtocolVersion protocolVersion,
705.52 String algorithm) throws GeneralSecurityException {
705.53 - if (algorithm.equals("RSA")) {
705.54 - return RSASignature.getInternalInstance();
705.55 - } else if (algorithm.equals("DSA")) {
705.56 - return JsseJce.getSignature(JsseJce.SIGNATURE_RAWDSA);
705.57 - } else if (algorithm.equals("EC")) {
705.58 - return JsseJce.getSignature(JsseJce.SIGNATURE_RAWECDSA);
705.59 - } else {
705.60 - throw new SignatureException("Unrecognized algorithm: "
705.61 - + algorithm);
705.62 - }
705.63 + switch (algorithm) {
705.64 + case "RSA":
705.65 + return RSASignature.getInternalInstance();
705.66 + case "DSA":
705.67 + return JsseJce.getSignature(JsseJce.SIGNATURE_RAWDSA);
705.68 + case "EC":
705.69 + return JsseJce.getSignature(JsseJce.SIGNATURE_RAWECDSA);
705.70 + default:
705.71 + throw new SignatureException("Unrecognized algorithm: "
705.72 + + algorithm);
705.73 + }
705.74 }
705.75
705.76 /*
705.77 @@ -1696,7 +1701,7 @@
705.78 md.update(temp);
705.79 }
705.80
705.81 - private final static Class delegate;
705.82 + private final static Class<?> delegate;
705.83 private final static Field spiField;
705.84
705.85 static {
705.86 @@ -1724,7 +1729,7 @@
705.87 // cache Method objects per Spi class
705.88 // Note that this will prevent the Spi classes from being GC'd. We assume
705.89 // that is not a problem.
705.90 - private final static Map<Class,Object> methodCache =
705.91 + private final static Map<Class<?>,Object> methodCache =
705.92 new ConcurrentHashMap<>();
705.93
705.94 private static void digestKey(MessageDigest md, SecretKey key) {
706.1 --- a/src/share/classes/sun/security/ssl/Handshaker.java Thu Sep 01 13:54:38 2011 -0700
706.2 +++ b/src/share/classes/sun/security/ssl/Handshaker.java Mon Sep 05 23:58:19 2011 -0700
706.3 @@ -154,7 +154,7 @@
706.4 * Data is protected by the SSLEngine.this lock.
706.5 */
706.6 private volatile boolean taskDelegated = false;
706.7 - private volatile DelegatedTask delegatedTask = null;
706.8 + private volatile DelegatedTask<?> delegatedTask = null;
706.9 private volatile Exception thrown = null;
706.10
706.11 // Could probably use a java.util.concurrent.atomic.AtomicReference
706.12 @@ -1316,7 +1316,7 @@
706.13 thrown = null;
706.14 }
706.15
706.16 - DelegatedTask getTask() {
706.17 + DelegatedTask<?> getTask() {
706.18 if (!taskDelegated) {
706.19 taskDelegated = true;
706.20 return delegatedTask;
706.21 @@ -1358,8 +1358,7 @@
706.22 thrown = null;
706.23
706.24 if (e instanceof RuntimeException) {
706.25 - throw (RuntimeException)
706.26 - new RuntimeException(msg).initCause(e);
706.27 + throw new RuntimeException(msg, e);
706.28 } else if (e instanceof SSLHandshakeException) {
706.29 throw (SSLHandshakeException)
706.30 new SSLHandshakeException(msg).initCause(e);
706.31 @@ -1377,8 +1376,7 @@
706.32 * If it's SSLException or any other Exception,
706.33 * we'll wrap it in an SSLException.
706.34 */
706.35 - throw (SSLException)
706.36 - new SSLException(msg).initCause(e);
706.37 + throw new SSLException(msg, e);
706.38 }
706.39 }
706.40 }
707.1 --- a/src/share/classes/sun/security/ssl/JsseJce.java Thu Sep 01 13:54:38 2011 -0700
707.2 +++ b/src/share/classes/sun/security/ssl/JsseJce.java Mon Sep 05 23:58:19 2011 -0700
707.3 @@ -30,7 +30,6 @@
707.4
707.5 import java.security.*;
707.6 import java.security.interfaces.RSAPublicKey;
707.7 -import java.security.spec.RSAPublicKeySpec;
707.8 import java.security.spec.*;
707.9
707.10 import javax.crypto.*;
707.11 @@ -110,6 +109,8 @@
707.12 }
707.13
707.14 private static final class SunCertificates extends Provider {
707.15 + private static final long serialVersionUID = -3284138292032213752L;
707.16 +
707.17 SunCertificates(final Provider p) {
707.18 super("SunCertificates", 1.0d, "SunJSSE internal");
707.19 AccessController.doPrivileged(new PrivilegedAction<Object>() {
707.20 @@ -372,7 +373,7 @@
707.21 KeyFactory factory = JsseJce.getKeyFactory("RSA");
707.22 return factory.getKeySpec(key, RSAPublicKeySpec.class);
707.23 } catch (Exception e) {
707.24 - throw (RuntimeException)new RuntimeException().initCause(e);
707.25 + throw new RuntimeException(e);
707.26 }
707.27 }
707.28
708.1 --- a/src/share/classes/sun/security/ssl/SSLEngineImpl.java Thu Sep 01 13:54:38 2011 -0700
708.2 +++ b/src/share/classes/sun/security/ssl/SSLEngineImpl.java Mon Sep 05 23:58:19 2011 -0700
708.3 @@ -27,8 +27,6 @@
708.4
708.5 import java.io.*;
708.6 import java.nio.*;
708.7 -import java.nio.ReadOnlyBufferException;
708.8 -import java.util.LinkedList;
708.9 import java.security.*;
708.10
708.11 import javax.crypto.BadPaddingException;
708.12 @@ -36,7 +34,6 @@
708.13 import javax.net.ssl.*;
708.14 import javax.net.ssl.SSLEngineResult.*;
708.15
708.16 -import com.sun.net.ssl.internal.ssl.X509ExtendedTrustManager;
708.17
708.18 /**
708.19 * Implementation of an non-blocking SSLEngine.
708.20 @@ -574,8 +571,7 @@
708.21 readMAC = handshaker.newReadMAC();
708.22 } catch (GeneralSecurityException e) {
708.23 // "can't happen"
708.24 - throw (SSLException)new SSLException
708.25 - ("Algorithm missing: ").initCause(e);
708.26 + throw new SSLException("Algorithm missing: ", e);
708.27 }
708.28
708.29 /*
708.30 @@ -611,8 +607,7 @@
708.31 writeMAC = handshaker.newWriteMAC();
708.32 } catch (GeneralSecurityException e) {
708.33 // "can't happen"
708.34 - throw (SSLException)new SSLException
708.35 - ("Algorithm missing: ").initCause(e);
708.36 + throw new SSLException("Algorithm missing: ", e);
708.37 }
708.38
708.39 // See comment above.
708.40 @@ -877,9 +872,7 @@
708.41 } catch (SSLException e) {
708.42 throw e;
708.43 } catch (IOException e) {
708.44 - SSLException ex = new SSLException("readRecord");
708.45 - ex.initCause(e);
708.46 - throw ex;
708.47 + throw new SSLException("readRecord", e);
708.48 }
708.49
708.50 /*
708.51 @@ -1151,7 +1144,7 @@
708.52 * For now, force it to be large enough to handle any
708.53 * valid SSL/TLS record.
708.54 */
708.55 - if (netData.remaining() < outputRecord.maxRecordSize) {
708.56 + if (netData.remaining() < EngineOutputRecord.maxRecordSize) {
708.57 return new SSLEngineResult(
708.58 Status.BUFFER_OVERFLOW, getHSStatus(null), 0, 0);
708.59 }
708.60 @@ -1248,9 +1241,7 @@
708.61 } catch (SSLException e) {
708.62 throw e;
708.63 } catch (IOException e) {
708.64 - SSLException ex = new SSLException("Write problems");
708.65 - ex.initCause(e);
708.66 - throw ex;
708.67 + throw new SSLException("Write problems", e);
708.68 }
708.69
708.70 /*
708.71 @@ -1624,10 +1615,7 @@
708.72 } else if (cause instanceof SSLException) {
708.73 throw (SSLException)cause;
708.74 } else if (cause instanceof Exception) {
708.75 - SSLException ssle = new SSLException(
708.76 - "fatal SSLEngine condition");
708.77 - ssle.initCause(cause);
708.78 - throw ssle;
708.79 + throw new SSLException("fatal SSLEngine condition", cause);
708.80 }
708.81 }
708.82
708.83 @@ -1875,6 +1863,7 @@
708.84 * client or server mode. Must be called before any SSL
708.85 * traffic has started.
708.86 */
708.87 + @SuppressWarnings("fallthrough")
708.88 synchronized public void setUseClientMode(boolean flag) {
708.89 switch (connectionState) {
708.90
709.1 --- a/src/share/classes/sun/security/ssl/SSLSessionContextImpl.java Thu Sep 01 13:54:38 2011 -0700
709.2 +++ b/src/share/classes/sun/security/ssl/SSLSessionContextImpl.java Mon Sep 05 23:58:19 2011 -0700
709.3 @@ -33,6 +33,7 @@
709.4 import java.util.Hashtable;
709.5 import java.util.NoSuchElementException;
709.6 import java.util.Vector;
709.7 +import java.util.Locale;
709.8
709.9 import javax.net.ssl.SSLSession;
709.10 import javax.net.ssl.SSLSessionContext;
709.11 @@ -166,7 +167,8 @@
709.12 }
709.13
709.14 private String getKey(String hostname, int port) {
709.15 - return (hostname + ":" + String.valueOf(port)).toLowerCase();
709.16 + return (hostname + ":" +
709.17 + String.valueOf(port)).toLowerCase(Locale.ENGLISH);
709.18 }
709.19
709.20 // cache a SSLSession
710.1 --- a/src/share/classes/sun/security/ssl/SSLSocketImpl.java Thu Sep 01 13:54:38 2011 -0700
710.2 +++ b/src/share/classes/sun/security/ssl/SSLSocketImpl.java Mon Sep 05 23:58:19 2011 -0700
710.3 @@ -41,8 +41,6 @@
710.4
710.5 import javax.net.ssl.*;
710.6
710.7 -import com.sun.net.ssl.internal.ssl.X509ExtendedTrustManager;
710.8 -
710.9 /**
710.10 * Implementation of an SSL socket. This is a normal connection type
710.11 * socket, implementing SSL over some lower level socket, such as TCP.
710.12 @@ -1996,8 +1994,7 @@
710.13 readMAC = handshaker.newReadMAC();
710.14 } catch (GeneralSecurityException e) {
710.15 // "can't happen"
710.16 - throw (SSLException)new SSLException
710.17 - ("Algorithm missing: ").initCause(e);
710.18 + throw new SSLException("Algorithm missing: ", e);
710.19 }
710.20
710.21 /*
710.22 @@ -2028,8 +2025,7 @@
710.23 writeMAC = handshaker.newWriteMAC();
710.24 } catch (GeneralSecurityException e) {
710.25 // "can't happen"
710.26 - throw (SSLException)new SSLException
710.27 - ("Algorithm missing: ").initCause(e);
710.28 + throw new SSLException("Algorithm missing: ", e);
710.29 }
710.30
710.31 // See comment above.
710.32 @@ -2217,6 +2213,7 @@
710.33 * client or server mode. Must be called before any SSL
710.34 * traffic has started.
710.35 */
710.36 + @SuppressWarnings("fallthrough")
710.37 synchronized public void setUseClientMode(boolean flag) {
710.38 switch (connectionState) {
710.39
711.1 --- a/src/share/classes/sun/security/ssl/SunX509KeyManagerImpl.java Thu Sep 01 13:54:38 2011 -0700
711.2 +++ b/src/share/classes/sun/security/ssl/SunX509KeyManagerImpl.java Mon Sep 05 23:58:19 2011 -0700
711.3 @@ -84,7 +84,7 @@
711.4 *
711.5 * Map: String(keyType) -> String[](alias)
711.6 */
711.7 - private Map<String,String[]> serverAliasCache;
711.8 + private final Map<String,String[]> serverAliasCache;
711.9
711.10 /*
711.11 * Basic container for credentials implemented as an inner class.
711.12 @@ -113,11 +113,13 @@
711.13 }
711.14 }
711.15
711.16 - SunX509KeyManagerImpl(KeyStore ks, char[] password) throws KeyStoreException,
711.17 + SunX509KeyManagerImpl(KeyStore ks, char[] password)
711.18 + throws KeyStoreException,
711.19 NoSuchAlgorithmException, UnrecoverableKeyException {
711.20
711.21 credentialsMap = new HashMap<String,X509Credentials>();
711.22 - serverAliasCache = new HashMap<String,String[]>();
711.23 + serverAliasCache = Collections.synchronizedMap(
711.24 + new HashMap<String,String[]>());
711.25 if (ks == null) {
711.26 return;
711.27 }
711.28 @@ -352,15 +354,17 @@
711.29 if (sigType != null) {
711.30 if (certs.length > 1) {
711.31 // if possible, check the public key in the issuer cert
711.32 - if (!sigType.equals(certs[1].getPublicKey().getAlgorithm())) {
711.33 + if (!sigType.equals(
711.34 + certs[1].getPublicKey().getAlgorithm())) {
711.35 continue;
711.36 }
711.37 } else {
711.38 // Check the signature algorithm of the certificate itself.
711.39 // Look for the "withRSA" in "SHA1withRSA", etc.
711.40 String sigAlgName =
711.41 - certs[0].getSigAlgName().toUpperCase(Locale.ENGLISH);
711.42 - String pattern = "WITH" + sigType.toUpperCase(Locale.ENGLISH);
711.43 + certs[0].getSigAlgName().toUpperCase(Locale.ENGLISH);
711.44 + String pattern = "WITH" +
711.45 + sigType.toUpperCase(Locale.ENGLISH);
711.46 if (sigAlgName.contains(pattern) == false) {
711.47 continue;
711.48 }
711.49 @@ -412,5 +416,4 @@
711.50 }
711.51 return list.toArray(new X500Principal[list.size()]);
711.52 }
711.53 -
711.54 }
712.1 --- a/src/share/classes/sun/security/ssl/X509KeyManagerImpl.java Thu Sep 01 13:54:38 2011 -0700
712.2 +++ b/src/share/classes/sun/security/ssl/X509KeyManagerImpl.java Mon Sep 05 23:58:19 2011 -0700
712.3 @@ -91,6 +91,8 @@
712.4 // LinkedHashMap with a max size of 10
712.5 // see LinkedHashMap JavaDocs
712.6 private static class SizedMap<K,V> extends LinkedHashMap<K,V> {
712.7 + private static final long serialVersionUID = -8211222668790986062L;
712.8 +
712.9 @Override protected boolean removeEldestEntry(Map.Entry<K,V> eldest) {
712.10 return size() > 10;
712.11 }
712.12 @@ -247,7 +249,7 @@
712.13 return null;
712.14 }
712.15 entry = (PrivateKeyEntry)newEntry;
712.16 - entryCacheMap.put(alias, new SoftReference(entry));
712.17 + entryCacheMap.put(alias, new SoftReference<PrivateKeyEntry>(entry));
712.18 return entry;
712.19 } catch (Exception e) {
712.20 // ignore
712.21 @@ -329,7 +331,7 @@
712.22 */
712.23 private String chooseAlias(List<KeyType> keyTypeList, Principal[] issuers,
712.24 CheckType checkType, AlgorithmConstraints constraints) {
712.25 - if (keyTypeList == null || keyTypeList.size() == 0) {
712.26 + if (keyTypeList == null || keyTypeList.isEmpty()) {
712.27 return null;
712.28 }
712.29
712.30 @@ -403,7 +405,7 @@
712.31 // ignore
712.32 }
712.33 }
712.34 - if (allResults == null || allResults.size() == 0) {
712.35 + if (allResults == null || allResults.isEmpty()) {
712.36 if (useDebug) {
712.37 debug.println("KeyMgr: no matching alias found");
712.38 }
712.39 @@ -523,38 +525,43 @@
712.40 if (ku != null) {
712.41 String algorithm = cert.getPublicKey().getAlgorithm();
712.42 boolean kuSignature = getBit(ku, 0);
712.43 - if (algorithm.equals("RSA")) {
712.44 - // require either signature bit
712.45 - // or if server also allow key encipherment bit
712.46 - if (kuSignature == false) {
712.47 - if ((this == CLIENT) || (getBit(ku, 2) == false)) {
712.48 + switch (algorithm) {
712.49 + case "RSA":
712.50 + // require either signature bit
712.51 + // or if server also allow key encipherment bit
712.52 + if (kuSignature == false) {
712.53 + if ((this == CLIENT) || (getBit(ku, 2) == false)) {
712.54 + return CheckResult.EXTENSION_MISMATCH;
712.55 + }
712.56 + }
712.57 + break;
712.58 + case "DSA":
712.59 + // require signature bit
712.60 + if (kuSignature == false) {
712.61 return CheckResult.EXTENSION_MISMATCH;
712.62 }
712.63 - }
712.64 - } else if (algorithm.equals("DSA")) {
712.65 - // require signature bit
712.66 - if (kuSignature == false) {
712.67 - return CheckResult.EXTENSION_MISMATCH;
712.68 - }
712.69 - } else if (algorithm.equals("DH")) {
712.70 - // require keyagreement bit
712.71 - if (getBit(ku, 4) == false) {
712.72 - return CheckResult.EXTENSION_MISMATCH;
712.73 - }
712.74 - } else if (algorithm.equals("EC")) {
712.75 - // require signature bit
712.76 - if (kuSignature == false) {
712.77 - return CheckResult.EXTENSION_MISMATCH;
712.78 - }
712.79 - // For servers, also require key agreement.
712.80 - // This is not totally accurate as the keyAgreement bit
712.81 - // is only necessary for static ECDH key exchange and
712.82 - // not ephemeral ECDH. We leave it in for now until
712.83 - // there are signs that this check causes problems
712.84 - // for real world EC certificates.
712.85 - if ((this == SERVER) && (getBit(ku, 4) == false)) {
712.86 - return CheckResult.EXTENSION_MISMATCH;
712.87 - }
712.88 + break;
712.89 + case "DH":
712.90 + // require keyagreement bit
712.91 + if (getBit(ku, 4) == false) {
712.92 + return CheckResult.EXTENSION_MISMATCH;
712.93 + }
712.94 + break;
712.95 + case "EC":
712.96 + // require signature bit
712.97 + if (kuSignature == false) {
712.98 + return CheckResult.EXTENSION_MISMATCH;
712.99 + }
712.100 + // For servers, also require key agreement.
712.101 + // This is not totally accurate as the keyAgreement bit
712.102 + // is only necessary for static ECDH key exchange and
712.103 + // not ephemeral ECDH. We leave it in for now until
712.104 + // there are signs that this check causes problems
712.105 + // for real world EC certificates.
712.106 + if ((this == SERVER) && (getBit(ku, 4) == false)) {
712.107 + return CheckResult.EXTENSION_MISMATCH;
712.108 + }
712.109 + break;
712.110 }
712.111 }
712.112 } catch (CertificateException e) {
713.1 --- a/src/share/classes/sun/security/timestamp/HttpTimestamper.java Thu Sep 01 13:54:38 2011 -0700
713.2 +++ b/src/share/classes/sun/security/timestamp/HttpTimestamper.java Mon Sep 05 23:58:19 2011 -0700
713.3 @@ -1,5 +1,5 @@
713.4 /*
713.5 - * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
713.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
713.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
713.8 *
713.9 * This code is free software; you can redistribute it and/or modify it
713.10 @@ -30,12 +30,11 @@
713.11 import java.io.IOException;
713.12 import java.net.URL;
713.13 import java.net.HttpURLConnection;
713.14 -import java.util.Iterator;
713.15 +import java.util.List;
713.16 +import java.util.Map;
713.17 import java.util.Set;
713.18 -import java.util.Arrays;
713.19
713.20 import sun.misc.IOUtils;
713.21 -import sun.security.pkcs.*;
713.22
713.23 /**
713.24 * A timestamper that communicates with a Timestamping Authority (TSA)
713.25 @@ -95,11 +94,12 @@
713.26 connection.setConnectTimeout(CONNECT_TIMEOUT);
713.27
713.28 if (DEBUG) {
713.29 - Set headers = connection.getRequestProperties().entrySet();
713.30 + Set<Map.Entry<String, List<String>>> headers =
713.31 + connection.getRequestProperties().entrySet();
713.32 System.out.println(connection.getRequestMethod() + " " + tsaUrl +
713.33 " HTTP/1.1");
713.34 - for (Iterator i = headers.iterator(); i.hasNext(); ) {
713.35 - System.out.println(" " + i.next());
713.36 + for (Map.Entry<String, List<String>> entry : headers) {
713.37 + System.out.println(" " + entry);
713.38 }
713.39 System.out.println();
713.40 }
714.1 --- a/src/share/classes/sun/security/timestamp/TSResponse.java Thu Sep 01 13:54:38 2011 -0700
714.2 +++ b/src/share/classes/sun/security/timestamp/TSResponse.java Mon Sep 05 23:58:19 2011 -0700
714.3 @@ -1,5 +1,5 @@
714.4 /*
714.5 - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
714.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
714.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
714.8 *
714.9 * This code is free software; you can redistribute it and/or modify it
714.10 @@ -26,15 +26,8 @@
714.11 package sun.security.timestamp;
714.12
714.13 import java.io.IOException;
714.14 -import java.math.BigInteger;
714.15 import sun.security.pkcs.PKCS7;
714.16 -import sun.security.pkcs.PKCS9Attribute;
714.17 -import sun.security.pkcs.PKCS9Attributes;
714.18 -import sun.security.pkcs.ParsingException;
714.19 -import sun.security.pkcs.SignerInfo;
714.20 import sun.security.util.DerValue;
714.21 -import sun.security.x509.AlgorithmId;
714.22 -import sun.security.x509.X500Name;
714.23
714.24 /**
714.25 * This class provides the response corresponding to a timestamp request,
714.26 @@ -376,9 +369,11 @@
714.27 }
714.28 }
714.29
714.30 -final static class TimestampException extends IOException {
714.31 - TimestampException(String message) {
714.32 - super(message);
714.33 + final static class TimestampException extends IOException {
714.34 + private static final long serialVersionUID = -1631631794891940953L;
714.35 +
714.36 + TimestampException(String message) {
714.37 + super(message);
714.38 + }
714.39 }
714.40 }
714.41 -}
715.1 --- a/src/share/classes/sun/security/tools/JarSigner.java Thu Sep 01 13:54:38 2011 -0700
715.2 +++ b/src/share/classes/sun/security/tools/JarSigner.java Mon Sep 05 23:58:19 2011 -0700
715.3 @@ -1425,6 +1425,7 @@
715.4 * lines of attributes plus an empty line. The empty line is included
715.5 * in the header.
715.6 */
715.7 + @SuppressWarnings("fallthrough")
715.8 private int findHeaderEnd(byte[] bs) {
715.9 // Initial state true to deal with empty header
715.10 boolean newline = true; // just met a newline
715.11 @@ -1739,8 +1740,7 @@
715.12 NetscapeCertTypeExtension extn =
715.13 new NetscapeCertTypeExtension(encoded);
715.14
715.15 - Boolean val = (Boolean)extn.get(
715.16 - NetscapeCertTypeExtension.OBJECT_SIGNING);
715.17 + Boolean val = extn.get(NetscapeCertTypeExtension.OBJECT_SIGNING);
715.18 if (!val) {
715.19 if (bad != null) {
715.20 bad[2] = true;
715.21 @@ -2054,7 +2054,7 @@
715.22 ClassLoader appClassLoader = new URLClassLoader(urls);
715.23
715.24 // attempt to find signer
715.25 - Class signerClass = appClassLoader.loadClass(signerClassName);
715.26 + Class<?> signerClass = appClassLoader.loadClass(signerClassName);
715.27
715.28 // Check that it implements ContentSigner
715.29 Object signer = signerClass.newInstance();
715.30 @@ -2297,9 +2297,7 @@
715.31 tsaUri = new URI(tsaUrl);
715.32 }
715.33 } catch (URISyntaxException e) {
715.34 - IOException ioe = new IOException();
715.35 - ioe.initCause(e);
715.36 - throw ioe;
715.37 + throw new IOException(e);
715.38 }
715.39
715.40 // Assemble parameters for the signing mechanism
716.1 --- a/src/share/classes/sun/security/tools/KeyStoreUtil.java Thu Sep 01 13:54:38 2011 -0700
716.2 +++ b/src/share/classes/sun/security/tools/KeyStoreUtil.java Mon Sep 05 23:58:19 2011 -0700
716.3 @@ -25,6 +25,8 @@
716.4
716.5 package sun.security.tools;
716.6
716.7 +import java.util.Locale;
716.8 +
716.9 /**
716.10 * <p> This class provides several utilities to <code>KeyStore</code>.
716.11 *
716.12 @@ -63,7 +65,7 @@
716.13 } else if(storetype.equalsIgnoreCase("Windows-ROOT")) {
716.14 return "Windows-ROOT";
716.15 } else {
716.16 - return storetype.toUpperCase();
716.17 + return storetype.toUpperCase(Locale.ENGLISH);
716.18 }
716.19 }
716.20 }
717.1 --- a/src/share/classes/sun/security/tools/KeyTool.java Thu Sep 01 13:54:38 2011 -0700
717.2 +++ b/src/share/classes/sun/security/tools/KeyTool.java Mon Sep 05 23:58:19 2011 -0700
717.3 @@ -1197,7 +1197,7 @@
717.4 new CertificateVersion(CertificateVersion.V3));
717.5 info.set(X509CertInfo.ALGORITHM_ID,
717.6 new CertificateAlgorithmId(
717.7 - AlgorithmId.getAlgorithmId(sigAlgName)));
717.8 + AlgorithmId.get(sigAlgName)));
717.9 info.set(X509CertInfo.ISSUER, new CertificateIssuerName(issuer));
717.10
717.11 BufferedReader reader = new BufferedReader(new InputStreamReader(in));
717.12 @@ -1227,7 +1227,7 @@
717.13 Iterator<PKCS10Attribute> attrs = req.getAttributes().getAttributes().iterator();
717.14 while (attrs.hasNext()) {
717.15 PKCS10Attribute attr = attrs.next();
717.16 - if (attr.getAttributeId().equals(PKCS9Attribute.EXTENSION_REQUEST_OID)) {
717.17 + if (attr.getAttributeId().equals((Object)PKCS9Attribute.EXTENSION_REQUEST_OID)) {
717.18 reqex = (CertificateExtensions)attr.getAttributeValue();
717.19 }
717.20 }
717.21 @@ -1266,7 +1266,7 @@
717.22
717.23 Date firstDate = getStartDate(startDate);
717.24 Date lastDate = (Date) firstDate.clone();
717.25 - lastDate.setTime(lastDate.getTime() + (long)validity*1000*24*60*60);
717.26 + lastDate.setTime(lastDate.getTime() + validity*1000*24*60*60);
717.27 CertificateValidity interval = new CertificateValidity(firstDate,
717.28 lastDate);
717.29
717.30 @@ -2093,8 +2093,9 @@
717.31 CRLDistributionPointsExtension ext =
717.32 X509CertImpl.toImpl(cert).getCRLDistributionPointsExtension();
717.33 if (ext == null) return crls;
717.34 - for (DistributionPoint o: (List<DistributionPoint>)
717.35 - ext.get(CRLDistributionPointsExtension.POINTS)) {
717.36 + List<DistributionPoint> distPoints =
717.37 + ext.get(CRLDistributionPointsExtension.POINTS);
717.38 + for (DistributionPoint o: distPoints) {
717.39 GeneralNames names = o.getFullName();
717.40 if (names != null) {
717.41 for (GeneralName name: names.names()) {
717.42 @@ -2199,7 +2200,7 @@
717.43 req.getSubjectName(), pkey.getFormat(), pkey.getAlgorithm());
717.44 for (PKCS10Attribute attr: req.getAttributes().getAttributes()) {
717.45 ObjectIdentifier oid = attr.getAttributeId();
717.46 - if (oid.equals(PKCS9Attribute.EXTENSION_REQUEST_OID)) {
717.47 + if (oid.equals((Object)PKCS9Attribute.EXTENSION_REQUEST_OID)) {
717.48 CertificateExtensions exts = (CertificateExtensions)attr.getAttributeValue();
717.49 if (exts != null) {
717.50 printExtensions(rb.getString("Extension.Request."), exts, out);
717.51 @@ -2314,7 +2315,7 @@
717.52 }
717.53 }
717.54 jf.close();
717.55 - if (ss.size() == 0) {
717.56 + if (ss.isEmpty()) {
717.57 out.println(rb.getString("Not.a.signed.jar.file"));
717.58 }
717.59 } else if (sslserver != null) {
717.60 @@ -3745,7 +3746,7 @@
717.61 }
717.62 String n = reqex.getNameByOid(findOidForExtName(type));
717.63 if (add) {
717.64 - Extension e = (Extension)reqex.get(n);
717.65 + Extension e = reqex.get(n);
717.66 if (!e.isCritical() && action == 0
717.67 || e.isCritical() && action == 1) {
717.68 e = Extension.newExtension(
718.1 --- a/src/share/classes/sun/security/tools/TimestampedSigner.java Thu Sep 01 13:54:38 2011 -0700
718.2 +++ b/src/share/classes/sun/security/tools/TimestampedSigner.java Mon Sep 05 23:58:19 2011 -0700
718.3 @@ -275,7 +275,8 @@
718.4 URIName uri;
718.5 for (int i = 0; i < derValue.length; i++) {
718.6 description = new AccessDescription(derValue[i]);
718.7 - if (description.getAccessMethod().equals(AD_TIMESTAMPING_Id)) {
718.8 + if (description.getAccessMethod()
718.9 + .equals((Object)AD_TIMESTAMPING_Id)) {
718.10 location = description.getAccessLocation();
718.11 if (location.getType() == GeneralNameInterface.NAME_URI) {
718.12 uri = (URIName) location.getName();
718.13 @@ -351,7 +352,7 @@
718.14 }
718.15 if (!Arrays.equals(tst.getHashedMessage(), digest)) {
718.16 throw new IOException("Digest octets changed in timestamp token");
718.17 - };
718.18 + }
718.19
718.20 BigInteger replyNonce = tst.getNonce();
718.21 if (replyNonce == null && nonce != null) {
718.22 @@ -374,7 +375,7 @@
718.23 throw new CertificateException(
718.24 "Certificate is not valid for timestamping");
718.25 }
718.26 - List keyPurposes = cert.getExtendedKeyUsage();
718.27 + List<String> keyPurposes = cert.getExtendedKeyUsage();
718.28 if (keyPurposes == null ||
718.29 ! keyPurposes.contains(KP_TIMESTAMPING_OID)) {
718.30 throw new CertificateException(
719.1 --- a/src/share/classes/sun/security/tools/policytool/PolicyTool.java Thu Sep 01 13:54:38 2011 -0700
719.2 +++ b/src/share/classes/sun/security/tools/policytool/PolicyTool.java Mon Sep 05 23:58:19 2011 -0700
719.3 @@ -123,7 +123,7 @@
719.4 * set the PolicyFileName
719.5 */
719.6 void setPolicyFileName(String policyFileName) {
719.7 - this.policyFileName = policyFileName;
719.8 + PolicyTool.policyFileName = policyFileName;
719.9 }
719.10
719.11 /**
719.12 @@ -605,7 +605,7 @@
719.13 if (type.equals(PolicyParser.PrincipalEntry.WILDCARD_CLASS) ||
719.14 type.equals(PolicyParser.REPLACE_NAME)) {
719.15 return;
719.16 - };
719.17 + }
719.18 Class<?> PRIN = Class.forName("java.security.Principal");
719.19 Class<?> pc = Class.forName(type, true,
719.20 Thread.currentThread().getContextClassLoader());
719.21 @@ -629,6 +629,7 @@
719.22 /**
719.23 * Check to see if the Permission contents are OK
719.24 */
719.25 + @SuppressWarnings("fallthrough")
719.26 void verifyPermission(String type,
719.27 String name,
719.28 String actions)
719.29 @@ -655,6 +656,7 @@
719.30 // proceed to the one-param constructor
719.31 objects.add(null);
719.32 }
719.33 + /* fall through */
719.34 case 1:
719.35 try {
719.36 c = pc.getConstructor(ONEPARAMS);
719.37 @@ -663,6 +665,7 @@
719.38 // proceed to the two-param constructor
719.39 objects.add(null);
719.40 }
719.41 + /* fall through */
719.42 case 2:
719.43 c = pc.getConstructor(TWOPARAMS);
719.44 break;
719.45 @@ -1553,16 +1556,15 @@
719.46 if (edit) {
719.47 // get the selected item
719.48 entries = tool.getEntry();
719.49 - List policyList = (List)tw.getComponent(tw.MW_POLICY_LIST);
719.50 + List policyList = (List)tw.getComponent(ToolWindow.MW_POLICY_LIST);
719.51 listIndex = policyList.getSelectedIndex();
719.52
719.53 // get principal list
719.54 - LinkedList principals =
719.55 + LinkedList<PolicyParser.PrincipalEntry> principals =
719.56 entries[listIndex].getGrantEntry().principals;
719.57 for (int i = 0; i < principals.size(); i++) {
719.58 String prinString = null;
719.59 - PolicyParser.PrincipalEntry nextPrin =
719.60 - (PolicyParser.PrincipalEntry)principals.get(i);
719.61 + PolicyParser.PrincipalEntry nextPrin = principals.get(i);
719.62 prinList.addTaggedItem(PrincipalEntryToUserFriendlyString(nextPrin), nextPrin);
719.63 }
719.64
719.65 @@ -1631,10 +1633,10 @@
719.66 label = new Label(PolicyTool.rb.getString("Principals."));
719.67 tw.addNewComponent(this, label, PE_PRIN_LABEL,
719.68 0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.69 - tw.BOTTOM_PADDING);
719.70 + ToolWindow.BOTTOM_PADDING);
719.71 tw.addNewComponent(this, prinList, PE_PRIN_LIST,
719.72 1, 3, 3, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.73 - tw.BOTTOM_PADDING);
719.74 + ToolWindow.BOTTOM_PADDING);
719.75
719.76 // panel for permission buttons
719.77 panel = new Panel();
719.78 @@ -1661,12 +1663,12 @@
719.79
719.80 tw.addNewComponent(this, panel, PE_PANEL1,
719.81 0, 4, 2, 1, 0.0, 0.0, GridBagConstraints.HORIZONTAL,
719.82 - tw.LITE_BOTTOM_PADDING);
719.83 + ToolWindow.LITE_BOTTOM_PADDING);
719.84
719.85 // permission list
719.86 tw.addNewComponent(this, permList, PE_PERM_LIST,
719.87 0, 5, 3, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.88 - tw.BOTTOM_PADDING);
719.89 + ToolWindow.BOTTOM_PADDING);
719.90
719.91
719.92 // panel for Done and Cancel buttons
719.93 @@ -1679,14 +1681,14 @@
719.94 (new AddEntryDoneButtonListener(tool, tw, this, edit));
719.95 tw.addNewComponent(panel, button, PE_DONE_BUTTON,
719.96 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
719.97 - tw.LR_PADDING);
719.98 + ToolWindow.LR_PADDING);
719.99
719.100 // Cancel Button
719.101 button = new Button(PolicyTool.rb.getString("Cancel"));
719.102 button.addActionListener(new CancelButtonListener(this));
719.103 tw.addNewComponent(panel, button, PE_CANCEL_BUTTON,
719.104 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
719.105 - tw.LR_PADDING);
719.106 + ToolWindow.LR_PADDING);
719.107
719.108 // add the panel
719.109 tw.addNewComponent(this, panel, PE_PANEL2,
719.110 @@ -1760,7 +1762,7 @@
719.111 (PolicyTool.rb.getString("KeyStore.URL."));
719.112 tw.addNewComponent(this, label, KSD_NAME_LABEL,
719.113 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.114 - tw.BOTTOM_PADDING);
719.115 + ToolWindow.BOTTOM_PADDING);
719.116 TextField tf = new TextField(tool.getKeyStoreName(), 30);
719.117
719.118 // URL to U R L, so that accessibility reader will pronounce well
719.119 @@ -1768,45 +1770,45 @@
719.120 PolicyTool.rb.getString("KeyStore.U.R.L."));
719.121 tw.addNewComponent(this, tf, KSD_NAME_TEXTFIELD,
719.122 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.123 - tw.BOTTOM_PADDING);
719.124 + ToolWindow.BOTTOM_PADDING);
719.125
719.126 // KeyStore type and textfield
719.127 label = new Label(PolicyTool.rb.getString("KeyStore.Type."));
719.128 tw.addNewComponent(this, label, KSD_TYPE_LABEL,
719.129 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.130 - tw.BOTTOM_PADDING);
719.131 + ToolWindow.BOTTOM_PADDING);
719.132 tf = new TextField(tool.getKeyStoreType(), 30);
719.133 tf.getAccessibleContext().setAccessibleName(
719.134 PolicyTool.rb.getString("KeyStore.Type."));
719.135 tw.addNewComponent(this, tf, KSD_TYPE_TEXTFIELD,
719.136 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.137 - tw.BOTTOM_PADDING);
719.138 + ToolWindow.BOTTOM_PADDING);
719.139
719.140 // KeyStore provider and textfield
719.141 label = new Label(PolicyTool.rb.getString
719.142 ("KeyStore.Provider."));
719.143 tw.addNewComponent(this, label, KSD_PROVIDER_LABEL,
719.144 0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.145 - tw.BOTTOM_PADDING);
719.146 + ToolWindow.BOTTOM_PADDING);
719.147 tf = new TextField(tool.getKeyStoreProvider(), 30);
719.148 tf.getAccessibleContext().setAccessibleName(
719.149 PolicyTool.rb.getString("KeyStore.Provider."));
719.150 tw.addNewComponent(this, tf, KSD_PROVIDER_TEXTFIELD,
719.151 1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.152 - tw.BOTTOM_PADDING);
719.153 + ToolWindow.BOTTOM_PADDING);
719.154
719.155 // KeyStore password URL and textfield
719.156 label = new Label(PolicyTool.rb.getString
719.157 ("KeyStore.Password.URL."));
719.158 tw.addNewComponent(this, label, KSD_PWD_URL_LABEL,
719.159 0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.160 - tw.BOTTOM_PADDING);
719.161 + ToolWindow.BOTTOM_PADDING);
719.162 tf = new TextField(tool.getKeyStorePwdURL(), 30);
719.163 tf.getAccessibleContext().setAccessibleName(
719.164 PolicyTool.rb.getString("KeyStore.Password.U.R.L."));
719.165 tw.addNewComponent(this, tf, KSD_PWD_URL_TEXTFIELD,
719.166 1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.167 - tw.BOTTOM_PADDING);
719.168 + ToolWindow.BOTTOM_PADDING);
719.169
719.170 // OK button
719.171 Button okButton = new Button(PolicyTool.rb.getString("OK"));
719.172 @@ -1862,7 +1864,7 @@
719.173 new Label(PolicyTool.rb.getString(".Add.New.Principal.")));
719.174 tw.addNewComponent(newTD, label, PRD_DESC_LABEL,
719.175 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.176 - tw.TOP_BOTTOM_PADDING);
719.177 + ToolWindow.TOP_BOTTOM_PADDING);
719.178
719.179 // principal choice
719.180 Choice choice = new Choice();
719.181 @@ -1888,7 +1890,7 @@
719.182
719.183 tw.addNewComponent(newTD, choice, PRD_PRIN_CHOICE,
719.184 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.185 - tw.LR_PADDING);
719.186 + ToolWindow.LR_PADDING);
719.187
719.188 // principal textfield
719.189 TextField tf;
719.190 @@ -1898,7 +1900,7 @@
719.191 tf.getAccessibleContext().setAccessibleName(PRIN_TYPE);
719.192 tw.addNewComponent(newTD, tf, PRD_PRIN_TEXTFIELD,
719.193 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.194 - tw.LR_PADDING);
719.195 + ToolWindow.LR_PADDING);
719.196
719.197 // name label and textfield
719.198 label = new Label(PRIN_NAME);
719.199 @@ -1909,10 +1911,10 @@
719.200
719.201 tw.addNewComponent(newTD, label, PRD_NAME_LABEL,
719.202 0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.203 - tw.LR_PADDING);
719.204 + ToolWindow.LR_PADDING);
719.205 tw.addNewComponent(newTD, tf, PRD_NAME_TEXTFIELD,
719.206 1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.207 - tw.LR_PADDING);
719.208 + ToolWindow.LR_PADDING);
719.209
719.210 // OK button
719.211 Button okButton = new Button(PolicyTool.rb.getString("OK"));
719.212 @@ -1921,13 +1923,13 @@
719.213 (tool, tw, this, newTD, edit));
719.214 tw.addNewComponent(newTD, okButton, PRD_OK_BUTTON,
719.215 0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
719.216 - tw.TOP_BOTTOM_PADDING);
719.217 + ToolWindow.TOP_BOTTOM_PADDING);
719.218 // cancel button
719.219 Button cancelButton = new Button(PolicyTool.rb.getString("Cancel"));
719.220 cancelButton.addActionListener(new CancelButtonListener(newTD));
719.221 tw.addNewComponent(newTD, cancelButton, PRD_CANCEL_BUTTON,
719.222 1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
719.223 - tw.TOP_BOTTOM_PADDING);
719.224 + ToolWindow.TOP_BOTTOM_PADDING);
719.225
719.226 newTD.setVisible(true);
719.227 }
719.228 @@ -1969,7 +1971,7 @@
719.229 new Label(PolicyTool.rb.getString(".Add.New.Permission.")));
719.230 tw.addNewComponent(newTD, label, PD_DESC_LABEL,
719.231 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.232 - tw.TOP_BOTTOM_PADDING);
719.233 + ToolWindow.TOP_BOTTOM_PADDING);
719.234
719.235 // permission choice (added in alphabetical order)
719.236 Choice choice = new Choice();
719.237 @@ -1982,7 +1984,7 @@
719.238 choice.addItemListener(new PermissionMenuListener(newTD));
719.239 tw.addNewComponent(newTD, choice, PD_PERM_CHOICE,
719.240 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.241 - tw.LR_PADDING);
719.242 + ToolWindow.LR_PADDING);
719.243
719.244 // permission textfield
719.245 TextField tf;
719.246 @@ -1996,7 +1998,7 @@
719.247 }
719.248 tw.addNewComponent(newTD, tf, PD_PERM_TEXTFIELD,
719.249 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.250 - tw.LR_PADDING);
719.251 + ToolWindow.LR_PADDING);
719.252
719.253 // name label and textfield
719.254 choice = new Choice();
719.255 @@ -2010,10 +2012,10 @@
719.256 }
719.257 tw.addNewComponent(newTD, choice, PD_NAME_CHOICE,
719.258 0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.259 - tw.LR_PADDING);
719.260 + ToolWindow.LR_PADDING);
719.261 tw.addNewComponent(newTD, tf, PD_NAME_TEXTFIELD,
719.262 1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.263 - tw.LR_PADDING);
719.264 + ToolWindow.LR_PADDING);
719.265
719.266 // actions label and textfield
719.267 choice = new Choice();
719.268 @@ -2027,22 +2029,22 @@
719.269 }
719.270 tw.addNewComponent(newTD, choice, PD_ACTIONS_CHOICE,
719.271 0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.272 - tw.LR_PADDING);
719.273 + ToolWindow.LR_PADDING);
719.274 tw.addNewComponent(newTD, tf, PD_ACTIONS_TEXTFIELD,
719.275 1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.276 - tw.LR_PADDING);
719.277 + ToolWindow.LR_PADDING);
719.278
719.279 // signedby label and textfield
719.280 label = new Label(PolicyTool.rb.getString("Signed.By."));
719.281 tw.addNewComponent(newTD, label, PD_SIGNEDBY_LABEL,
719.282 0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.283 - tw.LR_PADDING);
719.284 + ToolWindow.LR_PADDING);
719.285 tf = (edit ? new TextField(editMe.signedBy, 40) : new TextField(40));
719.286 tf.getAccessibleContext().setAccessibleName(
719.287 PolicyTool.rb.getString("Signed.By."));
719.288 tw.addNewComponent(newTD, tf, PD_SIGNEDBY_TEXTFIELD,
719.289 1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.290 - tw.LR_PADDING);
719.291 + ToolWindow.LR_PADDING);
719.292
719.293 // OK button
719.294 Button okButton = new Button(PolicyTool.rb.getString("OK"));
719.295 @@ -2051,14 +2053,14 @@
719.296 (tool, tw, this, newTD, edit));
719.297 tw.addNewComponent(newTD, okButton, PD_OK_BUTTON,
719.298 0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
719.299 - tw.TOP_BOTTOM_PADDING);
719.300 + ToolWindow.TOP_BOTTOM_PADDING);
719.301
719.302 // cancel button
719.303 Button cancelButton = new Button(PolicyTool.rb.getString("Cancel"));
719.304 cancelButton.addActionListener(new CancelButtonListener(newTD));
719.305 tw.addNewComponent(newTD, cancelButton, PD_CANCEL_BUTTON,
719.306 1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
719.307 - tw.TOP_BOTTOM_PADDING);
719.308 + ToolWindow.TOP_BOTTOM_PADDING);
719.309
719.310 newTD.setVisible(true);
719.311 }
719.312 @@ -2205,7 +2207,7 @@
719.313 void displayConfirmRemovePolicyEntry() {
719.314
719.315 // find the entry to be removed
719.316 - List list = (List)tw.getComponent(tw.MW_POLICY_LIST);
719.317 + List list = (List)tw.getComponent(ToolWindow.MW_POLICY_LIST);
719.318 int index = list.getSelectedIndex();
719.319 PolicyEntry entries[] = tool.getEntry();
719.320
719.321 @@ -2219,7 +2221,7 @@
719.322 (PolicyTool.rb.getString("Remove.this.Policy.Entry."));
719.323 tw.addNewComponent(this, label, CRPE_LABEL1,
719.324 0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.325 - tw.BOTTOM_PADDING);
719.326 + ToolWindow.BOTTOM_PADDING);
719.327
719.328 // display the policy entry
719.329 label = new Label(entries[index].codebaseToString());
719.330 @@ -2237,7 +2239,8 @@
719.331 if (i == (perms.size()-1)) {
719.332 tw.addNewComponent(this, label, CRPE_LABEL2 + 2 + i,
719.333 1, 3 + i, 1, 1, 0.0, 0.0,
719.334 - GridBagConstraints.BOTH, tw.BOTTOM_PADDING);
719.335 + GridBagConstraints.BOTH,
719.336 + ToolWindow.BOTTOM_PADDING);
719.337 } else {
719.338 tw.addNewComponent(this, label, CRPE_LABEL2 + 2 + i,
719.339 1, 3 + i, 1, 1, 0.0, 0.0,
719.340 @@ -2256,18 +2259,18 @@
719.341 (new ConfirmRemovePolicyEntryOKButtonListener(tool, tw, this));
719.342 tw.addNewComponent(panel, okButton, CRPE_PANEL_OK,
719.343 0, 0, 1, 1, 0.0, 0.0,
719.344 - GridBagConstraints.VERTICAL, tw.LR_PADDING);
719.345 + GridBagConstraints.VERTICAL, ToolWindow.LR_PADDING);
719.346
719.347 // cancel button
719.348 Button cancelButton = new Button(PolicyTool.rb.getString("Cancel"));
719.349 cancelButton.addActionListener(new CancelButtonListener(this));
719.350 tw.addNewComponent(panel, cancelButton, CRPE_PANEL_CANCEL,
719.351 1, 0, 1, 1, 0.0, 0.0,
719.352 - GridBagConstraints.VERTICAL, tw.LR_PADDING);
719.353 + GridBagConstraints.VERTICAL, ToolWindow.LR_PADDING);
719.354
719.355 tw.addNewComponent(this, panel, CRPE_LABEL2 + 2 + perms.size(),
719.356 0, 3 + perms.size(), 2, 1, 0.0, 0.0,
719.357 - GridBagConstraints.VERTICAL, tw.TOP_BOTTOM_PADDING);
719.358 + GridBagConstraints.VERTICAL, ToolWindow.TOP_BOTTOM_PADDING);
719.359
719.360 pack();
719.361 setVisible(true);
719.362 @@ -2310,7 +2313,7 @@
719.363
719.364 // display the new policy filename
719.365 TextField newFilename = (TextField)tw.getComponent
719.366 - (tw.MW_FILENAME_TEXTFIELD);
719.367 + (ToolWindow.MW_FILENAME_TEXTFIELD);
719.368 newFilename.setText(filename);
719.369 tw.setVisible(true);
719.370
719.371 @@ -2346,7 +2349,7 @@
719.372 (PolicyTool.rb.getString("Save.changes."));
719.373 tw.addNewComponent(this, label, USC_LABEL,
719.374 0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.BOTH,
719.375 - tw.L_TOP_BOTTOM_PADDING);
719.376 + ToolWindow.L_TOP_BOTTOM_PADDING);
719.377
719.378 Panel panel = new Panel();
719.379 panel.setLayout(new GridBagLayout());
719.380 @@ -2357,21 +2360,21 @@
719.381 tw.addNewComponent(panel, yesButton, USC_YES_BUTTON,
719.382 0, 0, 1, 1, 0.0, 0.0,
719.383 GridBagConstraints.VERTICAL,
719.384 - tw.LR_BOTTOM_PADDING);
719.385 + ToolWindow.LR_BOTTOM_PADDING);
719.386 Button noButton = new Button(PolicyTool.rb.getString("No"));
719.387 noButton.addActionListener
719.388 (new UserSaveNoButtonListener(this, tool, tw, select));
719.389 tw.addNewComponent(panel, noButton, USC_NO_BUTTON,
719.390 1, 0, 1, 1, 0.0, 0.0,
719.391 GridBagConstraints.VERTICAL,
719.392 - tw.LR_BOTTOM_PADDING);
719.393 + ToolWindow.LR_BOTTOM_PADDING);
719.394 Button cancelButton = new Button(PolicyTool.rb.getString("Cancel"));
719.395 cancelButton.addActionListener
719.396 (new UserSaveCancelButtonListener(this));
719.397 tw.addNewComponent(panel, cancelButton, USC_CANCEL_BUTTON,
719.398 2, 0, 1, 1, 0.0, 0.0,
719.399 GridBagConstraints.VERTICAL,
719.400 - tw.LR_BOTTOM_PADDING);
719.401 + ToolWindow.LR_BOTTOM_PADDING);
719.402
719.403 tw.addNewComponent(this, panel, USC_PANEL,
719.404 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
719.405 @@ -2391,6 +2394,7 @@
719.406 * (either QUITting, opening NEW policy file, or OPENing an existing
719.407 * policy file. do that now.
719.408 */
719.409 + @SuppressWarnings("fallthrough")
719.410 void userSaveContinue(PolicyTool tool, ToolWindow tw,
719.411 ToolDialog us, int select) {
719.412
719.413 @@ -2417,8 +2421,8 @@
719.414 tw.replacePolicyList(list);
719.415
719.416 // display null policy filename and keystore
719.417 - TextField newFilename = (TextField)
719.418 - tw.getComponent(tw.MW_FILENAME_TEXTFIELD);
719.419 + TextField newFilename = (TextField)tw.getComponent(
719.420 + ToolWindow.MW_FILENAME_TEXTFIELD);
719.421 newFilename.setText("");
719.422 tw.setVisible(true);
719.423 break;
719.424 @@ -2459,8 +2463,8 @@
719.425 tool.modified = false;
719.426
719.427 // display the new policy filename
719.428 - newFilename = (TextField)
719.429 - tw.getComponent(tw.MW_FILENAME_TEXTFIELD);
719.430 + newFilename = (TextField)tw.getComponent(
719.431 + ToolWindow.MW_FILENAME_TEXTFIELD);
719.432 newFilename.setText(policyFile);
719.433 tw.setVisible(true);
719.434
719.435 @@ -2479,8 +2483,8 @@
719.436 tool.modified = false;
719.437
719.438 // display a null policy filename
719.439 - newFilename = (TextField)
719.440 - tw.getComponent(tw.MW_FILENAME_TEXTFIELD);
719.441 + newFilename = (TextField)tw.getComponent(
719.442 + ToolWindow.MW_FILENAME_TEXTFIELD);
719.443 newFilename.setText("");
719.444 tw.setVisible(true);
719.445
719.446 @@ -2658,51 +2662,52 @@
719.447
719.448 public void actionPerformed(ActionEvent e) {
719.449
719.450 - if (PolicyTool.collator.compare(e.getActionCommand(), tw.QUIT) == 0) {
719.451 + if (PolicyTool.collator.compare(e.getActionCommand(),
719.452 + ToolWindow.QUIT) == 0) {
719.453
719.454 // ask user if they want to save changes
719.455 ToolDialog td = new ToolDialog
719.456 (PolicyTool.rb.getString("Save.Changes"), tool, tw, true);
719.457 - td.displayUserSave(td.QUIT);
719.458 + td.displayUserSave(ToolDialog.QUIT);
719.459
719.460 // the above method will perform the QUIT as long as the
719.461 // user does not CANCEL the request
719.462
719.463 } else if (PolicyTool.collator.compare(e.getActionCommand(),
719.464 - tw.NEW_POLICY_FILE) == 0) {
719.465 + ToolWindow.NEW_POLICY_FILE) == 0) {
719.466
719.467 // ask user if they want to save changes
719.468 ToolDialog td = new ToolDialog
719.469 (PolicyTool.rb.getString("Save.Changes"), tool, tw, true);
719.470 - td.displayUserSave(td.NEW);
719.471 + td.displayUserSave(ToolDialog.NEW);
719.472
719.473 // the above method will perform the NEW as long as the
719.474 // user does not CANCEL the request
719.475
719.476 } else if (PolicyTool.collator.compare(e.getActionCommand(),
719.477 - tw.OPEN_POLICY_FILE) == 0) {
719.478 + ToolWindow.OPEN_POLICY_FILE) == 0) {
719.479
719.480 // ask user if they want to save changes
719.481 ToolDialog td = new ToolDialog
719.482 (PolicyTool.rb.getString("Save.Changes"), tool, tw, true);
719.483 - td.displayUserSave(td.OPEN);
719.484 + td.displayUserSave(ToolDialog.OPEN);
719.485
719.486 // the above method will perform the OPEN as long as the
719.487 // user does not CANCEL the request
719.488
719.489 } else if (PolicyTool.collator.compare(e.getActionCommand(),
719.490 - tw.SAVE_POLICY_FILE) == 0) {
719.491 + ToolWindow.SAVE_POLICY_FILE) == 0) {
719.492
719.493 // get the previously entered filename
719.494 - String filename = ((TextField)
719.495 - tw.getComponent(tw.MW_FILENAME_TEXTFIELD)).getText();
719.496 + String filename = ((TextField)tw.getComponent(
719.497 + ToolWindow.MW_FILENAME_TEXTFIELD)).getText();
719.498
719.499 // if there is no filename, do a SAVE_AS
719.500 if (filename == null || filename.length() == 0) {
719.501 // user wants to SAVE AS
719.502 ToolDialog td = new ToolDialog
719.503 (PolicyTool.rb.getString("Save.As"), tool, tw, true);
719.504 - td.displaySaveAsDialog(td.NOACTION);
719.505 + td.displaySaveAsDialog(ToolDialog.NOACTION);
719.506 } else {
719.507 try {
719.508 // save the policy entries to a file
719.509 @@ -2726,15 +2731,15 @@
719.510 }
719.511 }
719.512 } else if (PolicyTool.collator.compare(e.getActionCommand(),
719.513 - tw.SAVE_AS_POLICY_FILE) == 0) {
719.514 + ToolWindow.SAVE_AS_POLICY_FILE) == 0) {
719.515
719.516 // user wants to SAVE AS
719.517 ToolDialog td = new ToolDialog
719.518 (PolicyTool.rb.getString("Save.As"), tool, tw, true);
719.519 - td.displaySaveAsDialog(td.NOACTION);
719.520 + td.displaySaveAsDialog(ToolDialog.NOACTION);
719.521
719.522 } else if (PolicyTool.collator.compare(e.getActionCommand(),
719.523 - tw.VIEW_WARNINGS) == 0) {
719.524 + ToolWindow.VIEW_WARNINGS) == 0) {
719.525 tw.displayWarningLog(null);
719.526 }
719.527 }
719.528 @@ -2756,7 +2761,7 @@
719.529 public void actionPerformed(ActionEvent e) {
719.530
719.531 if (PolicyTool.collator.compare(e.getActionCommand(),
719.532 - tw.ADD_POLICY_ENTRY) == 0) {
719.533 + ToolWindow.ADD_POLICY_ENTRY) == 0) {
719.534
719.535 // display a dialog box for the user to enter policy info
719.536 ToolDialog td = new ToolDialog
719.537 @@ -2764,10 +2769,10 @@
719.538 td.displayPolicyEntryDialog(false);
719.539
719.540 } else if (PolicyTool.collator.compare(e.getActionCommand(),
719.541 - tw.REMOVE_POLICY_ENTRY) == 0) {
719.542 + ToolWindow.REMOVE_POLICY_ENTRY) == 0) {
719.543
719.544 // get the selected entry
719.545 - List list = (List)tw.getComponent(tw.MW_POLICY_LIST);
719.546 + List list = (List)tw.getComponent(ToolWindow.MW_POLICY_LIST);
719.547 int index = list.getSelectedIndex();
719.548 if (index < 0) {
719.549 tw.displayErrorDialog(null, new Exception
719.550 @@ -2781,10 +2786,10 @@
719.551 td.displayConfirmRemovePolicyEntry();
719.552
719.553 } else if (PolicyTool.collator.compare(e.getActionCommand(),
719.554 - tw.EDIT_POLICY_ENTRY) == 0) {
719.555 + ToolWindow.EDIT_POLICY_ENTRY) == 0) {
719.556
719.557 // get the selected entry
719.558 - List list = (List)tw.getComponent(tw.MW_POLICY_LIST);
719.559 + List list = (List)tw.getComponent(ToolWindow.MW_POLICY_LIST);
719.560 int index = list.getSelectedIndex();
719.561 if (index < 0) {
719.562 tw.displayErrorDialog(null, new Exception
719.563 @@ -2798,12 +2803,12 @@
719.564 td.displayPolicyEntryDialog(true);
719.565
719.566 } else if (PolicyTool.collator.compare(e.getActionCommand(),
719.567 - tw.EDIT_KEYSTORE) == 0) {
719.568 + ToolWindow.EDIT_KEYSTORE) == 0) {
719.569
719.570 // display a dialog box for the user to enter keystore info
719.571 ToolDialog td = new ToolDialog
719.572 (PolicyTool.rb.getString("KeyStore"), tool, tw, true);
719.573 - td.keyStoreDialog(td.EDIT_KEYSTORE);
719.574 + td.keyStoreDialog(ToolDialog.EDIT_KEYSTORE);
719.575 }
719.576 }
719.577 }
719.578 @@ -2855,7 +2860,7 @@
719.579 }
719.580
719.581 // add the entry
719.582 - List policyList = (List)tw.getComponent(tw.MW_POLICY_LIST);
719.583 + List policyList = (List)tw.getComponent(ToolWindow.MW_POLICY_LIST);
719.584 if (edit) {
719.585 int listIndex = policyList.getSelectedIndex();
719.586 tool.addEntry(newEntry, listIndex);
719.587 @@ -2896,14 +2901,14 @@
719.588
719.589 public void actionPerformed(ActionEvent e) {
719.590
719.591 - String URLString = ((TextField)
719.592 - td.getComponent(td.KSD_NAME_TEXTFIELD)).getText().trim();
719.593 - String type = ((TextField)
719.594 - td.getComponent(td.KSD_TYPE_TEXTFIELD)).getText().trim();
719.595 - String provider = ((TextField)
719.596 - td.getComponent(td.KSD_PROVIDER_TEXTFIELD)).getText().trim();
719.597 - String pwdURL = ((TextField)
719.598 - td.getComponent(td.KSD_PWD_URL_TEXTFIELD)).getText().trim();
719.599 + String URLString = ((TextField)td.getComponent(
719.600 + ToolDialog.KSD_NAME_TEXTFIELD)).getText().trim();
719.601 + String type = ((TextField)td.getComponent(
719.602 + ToolDialog.KSD_TYPE_TEXTFIELD)).getText().trim();
719.603 + String provider = ((TextField)td.getComponent(
719.604 + ToolDialog.KSD_PROVIDER_TEXTFIELD)).getText().trim();
719.605 + String pwdURL = ((TextField)td.getComponent(
719.606 + ToolDialog.KSD_PWD_URL_TEXTFIELD)).getText().trim();
719.607
719.608 try {
719.609 tool.openKeyStore
719.610 @@ -3018,7 +3023,7 @@
719.611
719.612 // add the principal to the GUI principal list
719.613 TaggedList prinList =
719.614 - (TaggedList)listDialog.getComponent(listDialog.PE_PRIN_LIST);
719.615 + (TaggedList)listDialog.getComponent(ToolDialog.PE_PRIN_LIST);
719.616
719.617 String prinString = ToolDialog.PrincipalEntryToUserFriendlyString(pppe);
719.618 if (edit) {
719.619 @@ -3079,7 +3084,7 @@
719.620
719.621 // add the permission to the GUI permission list
719.622 TaggedList permList =
719.623 - (TaggedList)listDialog.getComponent(listDialog.PE_PERM_LIST);
719.624 + (TaggedList)listDialog.getComponent(ToolDialog.PE_PERM_LIST);
719.625
719.626 String permString = ToolDialog.PermissionEntryToUserFriendlyString(pppe);
719.627 if (edit) {
719.628 @@ -3121,7 +3126,8 @@
719.629 public void actionPerformed(ActionEvent e) {
719.630
719.631 // get the Principal selected from the Principal List
719.632 - TaggedList prinList = (TaggedList)td.getComponent(td.PE_PRIN_LIST);
719.633 + TaggedList prinList = (TaggedList)td.getComponent(
719.634 + ToolDialog.PE_PRIN_LIST);
719.635 int prinIndex = prinList.getSelectedIndex();
719.636
719.637 if (prinIndex < 0) {
719.638 @@ -3155,7 +3161,8 @@
719.639 public void actionPerformed(ActionEvent e) {
719.640
719.641 // get the Permission selected from the Permission List
719.642 - TaggedList permList = (TaggedList)td.getComponent(td.PE_PERM_LIST);
719.643 + TaggedList permList = (TaggedList)td.getComponent(
719.644 + ToolDialog.PE_PERM_LIST);
719.645 int permIndex = permList.getSelectedIndex();
719.646
719.647 if (permIndex < 0) {
719.648 @@ -3196,7 +3203,8 @@
719.649 public void actionPerformed(ActionEvent e) {
719.650
719.651 // get the Principal selected from the Principal List
719.652 - TaggedList list = (TaggedList)td.getComponent(td.PE_PRIN_LIST);
719.653 + TaggedList list = (TaggedList)td.getComponent(
719.654 + ToolDialog.PE_PRIN_LIST);
719.655 int prinIndex = list.getSelectedIndex();
719.656
719.657 if (prinIndex < 0) {
719.658 @@ -3235,7 +3243,7 @@
719.659 public void actionPerformed(ActionEvent e) {
719.660
719.661 // get the Permission selected from the Permission List
719.662 - List list = (List)td.getComponent(td.PE_PERM_LIST);
719.663 + List list = (List)td.getComponent(ToolDialog.PE_PERM_LIST);
719.664 int permIndex = list.getSelectedIndex();
719.665
719.666 if (permIndex < 0) {
719.667 @@ -3260,19 +3268,19 @@
719.668
719.669 public void itemStateChanged(ItemEvent e) {
719.670
719.671 - Choice prin = (Choice)td.getComponent(td.PRD_PRIN_CHOICE);
719.672 - TextField prinField =
719.673 - (TextField)td.getComponent(td.PRD_PRIN_TEXTFIELD);
719.674 - TextField nameField =
719.675 - (TextField)td.getComponent(td.PRD_NAME_TEXTFIELD);
719.676 + Choice prin = (Choice)td.getComponent(ToolDialog.PRD_PRIN_CHOICE);
719.677 + TextField prinField = (TextField)td.getComponent(
719.678 + ToolDialog.PRD_PRIN_TEXTFIELD);
719.679 + TextField nameField = (TextField)td.getComponent(
719.680 + ToolDialog.PRD_NAME_TEXTFIELD);
719.681
719.682 prin.getAccessibleContext().setAccessibleName(
719.683 PolicyTool.splitToWords((String)e.getItem()));
719.684 - if (((String)e.getItem()).equals(td.PRIN_TYPE)) {
719.685 + if (((String)e.getItem()).equals(ToolDialog.PRIN_TYPE)) {
719.686 // ignore if they choose "Principal Type:" item
719.687 if (prinField.getText() != null &&
719.688 prinField.getText().length() > 0) {
719.689 - Prin inputPrin = td.getPrin(prinField.getText(), true);
719.690 + Prin inputPrin = ToolDialog.getPrin(prinField.getText(), true);
719.691 prin.select(inputPrin.CLASS);
719.692 }
719.693 return;
719.694 @@ -3286,7 +3294,7 @@
719.695 // set the text in the textfield and also modify the
719.696 // pull-down choice menus to reflect the correct possible
719.697 // set of names and actions
719.698 - Prin inputPrin = td.getPrin((String)e.getItem(), false);
719.699 + Prin inputPrin = ToolDialog.getPrin((String)e.getItem(), false);
719.700 if (inputPrin != null) {
719.701 prinField.setText(inputPrin.FULL_CLASS);
719.702 }
719.703 @@ -3306,26 +3314,31 @@
719.704
719.705 public void itemStateChanged(ItemEvent e) {
719.706
719.707 - Choice perms = (Choice)td.getComponent(td.PD_PERM_CHOICE);
719.708 - Choice names = (Choice)td.getComponent(td.PD_NAME_CHOICE);
719.709 - Choice actions = (Choice)td.getComponent(td.PD_ACTIONS_CHOICE);
719.710 - TextField nameField =
719.711 - (TextField)td.getComponent(td.PD_NAME_TEXTFIELD);
719.712 - TextField actionsField =
719.713 - (TextField)td.getComponent(td.PD_ACTIONS_TEXTFIELD);
719.714 - TextField permField = (TextField)td.getComponent(td.PD_PERM_TEXTFIELD);
719.715 - TextField signedbyField =
719.716 - (TextField)td.getComponent(td.PD_SIGNEDBY_TEXTFIELD);
719.717 + Choice perms = (Choice)td.getComponent(
719.718 + ToolDialog.PD_PERM_CHOICE);
719.719 + Choice names = (Choice)td.getComponent(
719.720 + ToolDialog.PD_NAME_CHOICE);
719.721 + Choice actions = (Choice)td.getComponent(
719.722 + ToolDialog.PD_ACTIONS_CHOICE);
719.723 + TextField nameField = (TextField)td.getComponent(
719.724 + ToolDialog.PD_NAME_TEXTFIELD);
719.725 + TextField actionsField = (TextField)td.getComponent(
719.726 + ToolDialog.PD_ACTIONS_TEXTFIELD);
719.727 + TextField permField = (TextField)td.getComponent(
719.728 + ToolDialog.PD_PERM_TEXTFIELD);
719.729 + TextField signedbyField = (TextField)td.getComponent(
719.730 + ToolDialog.PD_SIGNEDBY_TEXTFIELD);
719.731
719.732 perms.getAccessibleContext().setAccessibleName(
719.733 PolicyTool.splitToWords((String)e.getItem()));
719.734
719.735 // ignore if they choose the 'Permission:' item
719.736 - if (PolicyTool.collator.compare((String)e.getItem(), td.PERM) == 0) {
719.737 + if (PolicyTool.collator.compare((String)e.getItem(),
719.738 + ToolDialog.PERM) == 0) {
719.739 if (permField.getText() != null &&
719.740 permField.getText().length() > 0) {
719.741
719.742 - Perm inputPerm = td.getPerm(permField.getText(), true);
719.743 + Perm inputPerm = ToolDialog.getPerm(permField.getText(), true);
719.744 if (inputPerm != null) {
719.745 perms.select(inputPerm.CLASS);
719.746 }
719.747 @@ -3344,7 +3357,7 @@
719.748 // pull-down choice menus to reflect the correct possible
719.749 // set of names and actions
719.750
719.751 - Perm inputPerm = td.getPerm((String)e.getItem(), false);
719.752 + Perm inputPerm = ToolDialog.getPerm((String)e.getItem(), false);
719.753 if (inputPerm == null) {
719.754 permField.setText("");
719.755 } else {
719.756 @@ -3368,14 +3381,14 @@
719.757
719.758 public void itemStateChanged(ItemEvent e) {
719.759
719.760 - Choice names = (Choice)td.getComponent(td.PD_NAME_CHOICE);
719.761 + Choice names = (Choice)td.getComponent(ToolDialog.PD_NAME_CHOICE);
719.762 names.getAccessibleContext().setAccessibleName(
719.763 PolicyTool.splitToWords((String)e.getItem()));
719.764
719.765 - if (((String)e.getItem()).indexOf(td.PERM_NAME) != -1)
719.766 + if (((String)e.getItem()).indexOf(ToolDialog.PERM_NAME) != -1)
719.767 return;
719.768
719.769 - TextField tf = (TextField)td.getComponent(td.PD_NAME_TEXTFIELD);
719.770 + TextField tf = (TextField)td.getComponent(ToolDialog.PD_NAME_TEXTFIELD);
719.771 tf.setText((String)e.getItem());
719.772 }
719.773 }
719.774 @@ -3393,13 +3406,15 @@
719.775
719.776 public void itemStateChanged(ItemEvent e) {
719.777
719.778 - Choice actions = (Choice)td.getComponent(td.PD_ACTIONS_CHOICE);
719.779 + Choice actions = (Choice)td.getComponent(
719.780 + ToolDialog.PD_ACTIONS_CHOICE);
719.781 actions.getAccessibleContext().setAccessibleName((String)e.getItem());
719.782
719.783 - if (((String)e.getItem()).indexOf(td.PERM_ACTIONS) != -1)
719.784 + if (((String)e.getItem()).indexOf(ToolDialog.PERM_ACTIONS) != -1)
719.785 return;
719.786
719.787 - TextField tf = (TextField)td.getComponent(td.PD_ACTIONS_TEXTFIELD);
719.788 + TextField tf = (TextField)td.getComponent(
719.789 + ToolDialog.PD_ACTIONS_TEXTFIELD);
719.790 if (tf.getText() == null || tf.getText().equals("")) {
719.791 tf.setText((String)e.getItem());
719.792 } else {
719.793 @@ -3521,8 +3536,8 @@
719.794 us.dispose();
719.795
719.796 try {
719.797 - String filename = ((TextField)
719.798 - tw.getComponent(tw.MW_FILENAME_TEXTFIELD)).getText();
719.799 + String filename = ((TextField)tw.getComponent(
719.800 + ToolWindow.MW_FILENAME_TEXTFIELD)).getText();
719.801 if (filename == null || filename.equals("")) {
719.802 us.displaySaveAsDialog(select);
719.803
719.804 @@ -3616,7 +3631,7 @@
719.805
719.806 public void actionPerformed(ActionEvent e) {
719.807 // remove the entry
719.808 - List list = (List)tw.getComponent(tw.MW_POLICY_LIST);
719.809 + List list = (List)tw.getComponent(ToolWindow.MW_POLICY_LIST);
719.810 int index = list.getSelectedIndex();
719.811 PolicyEntry entries[] = tool.getEntry();
719.812 tool.removeEntry(entries[index]);
719.813 @@ -3640,13 +3655,15 @@
719.814 * it's special, and does not pop out a warning box.
719.815 */
719.816 class NoDisplayException extends RuntimeException {
719.817 -
719.818 + private static final long serialVersionUID = -4611761427108719794L;
719.819 }
719.820
719.821 /**
719.822 * This is a java.awt.List that bind an Object to each String it holds.
719.823 */
719.824 class TaggedList extends List {
719.825 + private static final long serialVersionUID = -5676238110427785853L;
719.826 +
719.827 private java.util.List<Object> data = new LinkedList<>();
719.828 public TaggedList(int i, boolean b) {
719.829 super(i, b);
720.1 --- a/src/share/classes/sun/security/util/Cache.java Thu Sep 01 13:54:38 2011 -0700
720.2 +++ b/src/share/classes/sun/security/util/Cache.java Mon Sep 05 23:58:19 2011 -0700
720.3 @@ -1,5 +1,5 @@
720.4 /*
720.5 - * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
720.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
720.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
720.8 *
720.9 * This code is free software; you can redistribute it and/or modify it
720.10 @@ -251,7 +251,7 @@
720.11 private final Map<Object, CacheEntry> cacheMap;
720.12 private int maxSize;
720.13 private long lifetime;
720.14 - private final ReferenceQueue queue;
720.15 + private final ReferenceQueue<Object> queue;
720.16
720.17 public MemoryCache(boolean soft, int maxSize) {
720.18 this(soft, maxSize, 0);
720.19 @@ -260,7 +260,7 @@
720.20 public MemoryCache(boolean soft, int maxSize, int lifetime) {
720.21 this.maxSize = maxSize;
720.22 this.lifetime = lifetime * 1000;
720.23 - this.queue = soft ? new ReferenceQueue() : null;
720.24 + this.queue = soft ? new ReferenceQueue<Object>() : null;
720.25 int buckets = (int)(maxSize / LOAD_FACTOR) + 1;
720.26 cacheMap = new LinkedHashMap<Object, CacheEntry>(buckets,
720.27 LOAD_FACTOR, true);
720.28 @@ -449,7 +449,7 @@
720.29 }
720.30
720.31 protected CacheEntry newEntry(Object key, Object value,
720.32 - long expirationTime, ReferenceQueue queue) {
720.33 + long expirationTime, ReferenceQueue<Object> queue) {
720.34 if (queue != null) {
720.35 return new SoftCacheEntry(key, value, expirationTime, queue);
720.36 } else {
720.37 @@ -504,13 +504,13 @@
720.38 }
720.39
720.40 private static class SoftCacheEntry
720.41 - extends SoftReference implements CacheEntry {
720.42 + extends SoftReference<Object> implements CacheEntry {
720.43
720.44 private Object key;
720.45 private long expirationTime;
720.46
720.47 SoftCacheEntry(Object key, Object value, long expirationTime,
720.48 - ReferenceQueue queue) {
720.49 + ReferenceQueue<Object> queue) {
720.50 super(value, queue);
720.51 this.key = key;
720.52 this.expirationTime = expirationTime;
721.1 --- a/src/share/classes/sun/security/util/HostnameChecker.java Thu Sep 01 13:54:38 2011 -0700
721.2 +++ b/src/share/classes/sun/security/util/HostnameChecker.java Mon Sep 05 23:58:19 2011 -0700
721.3 @@ -266,8 +266,8 @@
721.4 */
721.5 private static boolean matchAllWildcards(String name,
721.6 String template) {
721.7 - name = name.toLowerCase();
721.8 - template = template.toLowerCase();
721.9 + name = name.toLowerCase(Locale.ENGLISH);
721.10 + template = template.toLowerCase(Locale.ENGLISH);
721.11 StringTokenizer nameSt = new StringTokenizer(name, ".");
721.12 StringTokenizer templateSt = new StringTokenizer(template, ".");
721.13
721.14 @@ -296,8 +296,8 @@
721.15 */
721.16 private static boolean matchLeftmostWildcard(String name,
721.17 String template) {
721.18 - name = name.toLowerCase();
721.19 - template = template.toLowerCase();
721.20 + name = name.toLowerCase(Locale.ENGLISH);
721.21 + template = template.toLowerCase(Locale.ENGLISH);
721.22
721.23 // Retreive leftmost component
721.24 int templateIdx = template.indexOf(".");
722.1 --- a/src/share/classes/sun/security/util/ManifestDigester.java Thu Sep 01 13:54:38 2011 -0700
722.2 +++ b/src/share/classes/sun/security/util/ManifestDigester.java Mon Sep 05 23:58:19 2011 -0700
722.3 @@ -1,5 +1,5 @@
722.4 /*
722.5 - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
722.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
722.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
722.8 *
722.9 * This code is free software; you can redistribute it and/or modify it
722.10 @@ -62,6 +62,7 @@
722.11 * @returns false if end of bytes has been reached, otherwise returns
722.12 * true
722.13 */
722.14 + @SuppressWarnings("fallthrough")
722.15 private boolean findSection(int offset, Position pos)
722.16 {
722.17 int i = offset, len = rawBytes.length;
722.18 @@ -79,6 +80,7 @@
722.19 pos.endOfFirstLine = i-1;
722.20 if ((i < len) && (rawBytes[i+1] == '\n'))
722.21 i++;
722.22 + /* fall through */
722.23 case '\n':
722.24 if (pos.endOfFirstLine == -1)
722.25 pos.endOfFirstLine = i-1;
723.1 --- a/src/share/classes/sun/security/util/Password.java Thu Sep 01 13:54:38 2011 -0700
723.2 +++ b/src/share/classes/sun/security/util/Password.java Mon Sep 05 23:58:19 2011 -0700
723.3 @@ -1,5 +1,5 @@
723.4 /*
723.5 - * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
723.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
723.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
723.8 *
723.9 * This code is free software; you can redistribute it and/or modify it
723.10 @@ -43,6 +43,7 @@
723.11 /** Reads user password from given input stream.
723.12 * @param isEchoOn true if the password should be echoed on the screen
723.13 */
723.14 + @SuppressWarnings("fallthrough")
723.15 public static char[] readPassword(InputStream in, boolean isEchoOn)
723.16 throws IOException {
723.17
723.18 @@ -95,7 +96,7 @@
723.19 done = true;
723.20 break;
723.21 }
723.22 -
723.23 + /* fall through */
723.24 default:
723.25 if (--room < 0) {
723.26 buf = new char[offset + 128];
724.1 --- a/src/share/classes/sun/security/util/SignatureFileVerifier.java Thu Sep 01 13:54:38 2011 -0700
724.2 +++ b/src/share/classes/sun/security/util/SignatureFileVerifier.java Mon Sep 05 23:58:19 2011 -0700
724.3 @@ -181,7 +181,7 @@
724.4 *
724.5 */
724.6 public void process(Hashtable<String, CodeSigner[]> signers,
724.7 - List manifestDigests)
724.8 + List<Object> manifestDigests)
724.9 throws IOException, SignatureException, NoSuchAlgorithmException,
724.10 JarException, CertificateException
724.11 {
724.12 @@ -198,7 +198,7 @@
724.13 }
724.14
724.15 private void processImpl(Hashtable<String, CodeSigner[]> signers,
724.16 - List manifestDigests)
724.17 + List<Object> manifestDigests)
724.18 throws IOException, SignatureException, NoSuchAlgorithmException,
724.19 JarException, CertificateException
724.20 {
724.21 @@ -277,7 +277,7 @@
724.22 private boolean verifyManifestHash(Manifest sf,
724.23 ManifestDigester md,
724.24 BASE64Decoder decoder,
724.25 - List manifestDigests)
724.26 + List<Object> manifestDigests)
724.27 throws IOException
724.28 {
724.29 Attributes mattr = sf.getMainAttributes();
725.1 --- a/src/share/classes/sun/security/validator/SimpleValidator.java Thu Sep 01 13:54:38 2011 -0700
725.2 +++ b/src/share/classes/sun/security/validator/SimpleValidator.java Mon Sep 05 23:58:19 2011 -0700
725.3 @@ -37,7 +37,6 @@
725.4 import sun.security.x509.NetscapeCertTypeExtension;
725.5 import sun.security.util.DerValue;
725.6 import sun.security.util.DerInputStream;
725.7 -import sun.security.util.DerOutputStream;
725.8 import sun.security.util.ObjectIdentifier;
725.9
725.10 import sun.security.provider.certpath.AlgorithmChecker;
725.11 @@ -275,7 +274,7 @@
725.12 .toByteArray();
725.13 ext = new NetscapeCertTypeExtension(encoded);
725.14 }
725.15 - Boolean val = (Boolean)ext.get(type);
725.16 + Boolean val = ext.get(type);
725.17 return val.booleanValue();
725.18 } catch (IOException e) {
725.19 return false;
726.1 --- a/src/share/classes/sun/security/x509/AVA.java Thu Sep 01 13:54:38 2011 -0700
726.2 +++ b/src/share/classes/sun/security/x509/AVA.java Mon Sep 05 23:58:19 2011 -0700
726.3 @@ -1,5 +1,5 @@
726.4 /*
726.5 - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
726.6 + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
726.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
726.8 *
726.9 * This code is free software; you can redistribute it and/or modify it
726.10 @@ -42,7 +42,7 @@
726.11 * X.500 Attribute-Value-Assertion (AVA): an attribute, as identified by
726.12 * some attribute ID, has some particular value. Values are as a rule ASN.1
726.13 * printable strings. A conventional set of type IDs is recognized when
726.14 - * parsing (and generating) RFC 1779 or RFC 2253 syntax strings.
726.15 + * parsing (and generating) RFC 1779, 2253 or 4514 syntax strings.
726.16 *
726.17 * <P>AVAs are components of X.500 relative names. Think of them as being
726.18 * individual fields of a database record. The attribute ID is how you
726.19 @@ -92,18 +92,20 @@
726.20 * Leading and trailing spaces, also multiple internal spaces, also
726.21 * call for quoting the whole string.
726.22 */
726.23 - private static final String specialChars = ",+=\n<>#;";
726.24 + private static final String specialChars1779 = ",=\n+<>#;\\\"";
726.25
726.26 /*
726.27 * In RFC2253, if the value has any of these characters in it, it
726.28 * must be quoted by a preceding \.
726.29 */
726.30 - private static final String specialChars2253 = ",+\"\\<>;";
726.31 + private static final String specialChars2253 = ",=+<>#;\\\"";
726.32
726.33 /*
726.34 - * includes special chars from RFC1779 and RFC2253, as well as ' '
726.35 + * includes special chars from RFC1779 and RFC2253, as well as ' ' from
726.36 + * RFC 4514.
726.37 */
726.38 - private static final String specialCharsAll = ",=\n+<>#;\\\" ";
726.39 + private static final String specialCharsDefault = ",=\n+<>#;\\\" ";
726.40 + private static final String escapedDefault = ",+<>;\"";
726.41
726.42 /*
726.43 * Values that aren't printable strings are emitted as BER-encoded
726.44 @@ -120,26 +122,26 @@
726.45 }
726.46
726.47 /**
726.48 - * Parse an RFC 1779 or RFC 2253 style AVA string: CN=fee fie foe fum
726.49 + * Parse an RFC 1779, 2253 or 4514 style AVA string: CN=fee fie foe fum
726.50 * or perhaps with quotes. Not all defined AVA tags are supported;
726.51 * of current note are X.400 related ones (PRMD, ADMD, etc).
726.52 *
726.53 * This terminates at unescaped AVA separators ("+") or RDN
726.54 - * separators (",", ";"), or DN terminators (">"), and removes
726.55 - * cosmetic whitespace at the end of values.
726.56 + * separators (",", ";"), and removes cosmetic whitespace at the end of
726.57 + * values.
726.58 */
726.59 AVA(Reader in) throws IOException {
726.60 this(in, DEFAULT);
726.61 }
726.62
726.63 /**
726.64 - * Parse an RFC 1779 or RFC 2253 style AVA string: CN=fee fie foe fum
726.65 + * Parse an RFC 1779, 2253 or 4514 style AVA string: CN=fee fie foe fum
726.66 * or perhaps with quotes. Additional keywords can be specified in the
726.67 * keyword/OID map.
726.68 *
726.69 * This terminates at unescaped AVA separators ("+") or RDN
726.70 - * separators (",", ";"), or DN terminators (">"), and removes
726.71 - * cosmetic whitespace at the end of values.
726.72 + * separators (",", ";"), and removes cosmetic whitespace at the end of
726.73 + * values.
726.74 */
726.75 AVA(Reader in, Map<String, String> keywordMap) throws IOException {
726.76 this(in, DEFAULT, keywordMap);
726.77 @@ -147,9 +149,6 @@
726.78
726.79 /**
726.80 * Parse an AVA string formatted according to format.
726.81 - *
726.82 - * XXX format RFC1779 should only allow RFC1779 syntax but is
726.83 - * actually DEFAULT with RFC1779 keywords.
726.84 */
726.85 AVA(Reader in, int format) throws IOException {
726.86 this(in, format, Collections.<String, String>emptyMap());
726.87 @@ -158,9 +157,6 @@
726.88 /**
726.89 * Parse an AVA string formatted according to format.
726.90 *
726.91 - * XXX format RFC1779 should only allow RFC1779 syntax but is
726.92 - * actually DEFAULT with RFC1779 keywords.
726.93 - *
726.94 * @param in Reader containing AVA String
726.95 * @param format parsing format
726.96 * @param keywordMap a Map where a keyword String maps to a corresponding
726.97 @@ -168,11 +164,11 @@
726.98 * If an entry does not exist, it will fallback to the builtin
726.99 * keyword/OID mapping.
726.100 * @throws IOException if the AVA String is not valid in the specified
726.101 - * standard or an OID String from the keywordMap is improperly formatted
726.102 + * format or an OID String from the keywordMap is improperly formatted
726.103 */
726.104 AVA(Reader in, int format, Map<String, String> keywordMap)
726.105 throws IOException {
726.106 - // assume format is one of DEFAULT, RFC1779, RFC2253
726.107 + // assume format is one of DEFAULT or RFC2253
726.108
726.109 StringBuilder temp = new StringBuilder();
726.110 int c;
726.111 @@ -193,7 +189,7 @@
726.112
726.113 /*
726.114 * Now parse the value. "#hex", a quoted string, or a string
726.115 - * terminated by "+", ",", ";", ">". Whitespace before or after
726.116 + * terminated by "+", ",", ";". Whitespace before or after
726.117 * the value is stripped away unless format is RFC2253.
726.118 */
726.119 temp.setLength(0);
726.120 @@ -202,7 +198,7 @@
726.121 c = in.read();
726.122 if (c == ' ') {
726.123 throw new IOException("Incorrect AVA RFC2253 format - " +
726.124 - "leading space must be escaped");
726.125 + "leading space must be escaped");
726.126 }
726.127 } else {
726.128 // read next character skipping whitespace
726.129 @@ -331,8 +327,7 @@
726.130 continue;
726.131 }
726.132
726.133 - if (c != '\\' && c != '"' &&
726.134 - specialChars.indexOf((char)c) < 0) {
726.135 + if (specialChars1779.indexOf((char)c) < 0) {
726.136 throw new IOException
726.137 ("Invalid escaped character in AVA: " +
726.138 (char)c);
726.139 @@ -369,8 +364,8 @@
726.140
726.141 // encode as PrintableString unless value contains
726.142 // non-PrintableString chars
726.143 - if (this.oid.equals(PKCS9Attribute.EMAIL_ADDRESS_OID) ||
726.144 - (this.oid.equals(X500Name.DOMAIN_COMPONENT_OID) &&
726.145 + if (this.oid.equals((Object)PKCS9Attribute.EMAIL_ADDRESS_OID) ||
726.146 + (this.oid.equals((Object)X500Name.DOMAIN_COMPONENT_OID) &&
726.147 PRESERVE_OLD_DC_ENCODING == false)) {
726.148 // EmailAddress and DomainComponent must be IA5String
726.149 return new DerValue(DerValue.tag_IA5String,
726.150 @@ -386,7 +381,7 @@
726.151 private DerValue parseString
726.152 (Reader in, int c, int format, StringBuilder temp) throws IOException {
726.153
726.154 - List<Byte> embeddedHex = new ArrayList<Byte>();
726.155 + List<Byte> embeddedHex = new ArrayList<>();
726.156 boolean isPrintableString = true;
726.157 boolean escape = false;
726.158 boolean leadingChar = true;
726.159 @@ -413,24 +408,19 @@
726.160 }
726.161
726.162 // check if character was improperly escaped
726.163 - if ((format == DEFAULT &&
726.164 - specialCharsAll.indexOf((char)c) == -1) ||
726.165 - (format == RFC1779 &&
726.166 - specialChars.indexOf((char)c) == -1 &&
726.167 - c != '\\' && c != '\"')) {
726.168 -
726.169 + if (format == DEFAULT &&
726.170 + specialCharsDefault.indexOf((char)c) == -1) {
726.171 throw new IOException
726.172 ("Invalid escaped character in AVA: '" +
726.173 (char)c + "'");
726.174 -
726.175 } else if (format == RFC2253) {
726.176 if (c == ' ') {
726.177 // only leading/trailing space can be escaped
726.178 if (!leadingChar && !trailingSpace(in)) {
726.179 - throw new IOException
726.180 - ("Invalid escaped space character " +
726.181 - "in AVA. Only a leading or trailing " +
726.182 - "space character can be escaped.");
726.183 + throw new IOException
726.184 + ("Invalid escaped space character " +
726.185 + "in AVA. Only a leading or trailing " +
726.186 + "space character can be escaped.");
726.187 }
726.188 } else if (c == '#') {
726.189 // only leading '#' can be escaped
726.190 @@ -443,18 +433,20 @@
726.191 throw new IOException
726.192 ("Invalid escaped character in AVA: '" +
726.193 (char)c + "'");
726.194 -
726.195 }
726.196 }
726.197 -
726.198 } else {
726.199 // check if character should have been escaped
726.200 if (format == RFC2253) {
726.201 if (specialChars2253.indexOf((char)c) != -1) {
726.202 throw new IOException
726.203 ("Character '" + (char)c +
726.204 - "' in AVA appears without escape");
726.205 + "' in AVA appears without escape");
726.206 }
726.207 + } else if (escapedDefault.indexOf((char)c) != -1) {
726.208 + throw new IOException
726.209 + ("Character '" + (char)c +
726.210 + "' in AVA appears without escape");
726.211 }
726.212 }
726.213
726.214 @@ -503,8 +495,8 @@
726.215
726.216 // encode as PrintableString unless value contains
726.217 // non-PrintableString chars
726.218 - if (this.oid.equals(PKCS9Attribute.EMAIL_ADDRESS_OID) ||
726.219 - (this.oid.equals(X500Name.DOMAIN_COMPONENT_OID) &&
726.220 + if (this.oid.equals((Object)PKCS9Attribute.EMAIL_ADDRESS_OID) ||
726.221 + (this.oid.equals((Object)X500Name.DOMAIN_COMPONENT_OID) &&
726.222 PRESERVE_OLD_DC_ENCODING == false)) {
726.223 // EmailAddress and DomainComponent must be IA5String
726.224 return new DerValue(DerValue.tag_IA5String, temp.toString());
726.225 @@ -551,7 +543,6 @@
726.226 case ',':
726.227 return true;
726.228 case ';':
726.229 - case '>':
726.230 return format != RFC2253;
726.231 default:
726.232 return false;
726.233 @@ -1204,18 +1195,6 @@
726.234 * Get an object identifier representing the specified keyword (or
726.235 * string encoded object identifier) in the given standard.
726.236 *
726.237 - * @throws IOException If the keyword is not valid in the specified standard
726.238 - */
726.239 - static ObjectIdentifier getOID(String keyword, int standard)
726.240 - throws IOException {
726.241 - return getOID
726.242 - (keyword, standard, Collections.<String, String>emptyMap());
726.243 - }
726.244 -
726.245 - /**
726.246 - * Get an object identifier representing the specified keyword (or
726.247 - * string encoded object identifier) in the given standard.
726.248 - *
726.249 * @param keywordMap a Map where a keyword String maps to a corresponding
726.250 * OID String. Each AVA keyword will be mapped to the corresponding OID.
726.251 * If an entry does not exist, it will fallback to the builtin
726.252 @@ -1249,19 +1228,11 @@
726.253 return new ObjectIdentifier(oidString);
726.254 }
726.255
726.256 - // no keyword found or not standard compliant, check if OID string
726.257 + // no keyword found, check if OID string
726.258 + if (standard == AVA.DEFAULT && keyword.startsWith("OID.")) {
726.259 + keyword = keyword.substring(4);
726.260 + }
726.261
726.262 - // RFC1779 requires, DEFAULT allows OID. prefix
726.263 - if (standard == AVA.RFC1779) {
726.264 - if (keyword.startsWith("OID.") == false) {
726.265 - throw new IOException("Invalid RFC1779 keyword: " + keyword);
726.266 - }
726.267 - keyword = keyword.substring(4);
726.268 - } else if (standard == AVA.DEFAULT) {
726.269 - if (keyword.startsWith("OID.")) {
726.270 - keyword = keyword.substring(4);
726.271 - }
726.272 - }
726.273 boolean number = false;
726.274 if (keyword.length() != 0) {
726.275 char ch = keyword.charAt(0);
727.1 --- a/src/share/classes/sun/security/x509/AccessDescription.java Thu Sep 01 13:54:38 2011 -0700
727.2 +++ b/src/share/classes/sun/security/x509/AccessDescription.java Mon Sep 05 23:58:19 2011 -0700
727.3 @@ -1,5 +1,5 @@
727.4 /*
727.5 - * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
727.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
727.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
727.8 *
727.9 * This code is free software; you can redistribute it and/or modify it
727.10 @@ -25,7 +25,6 @@
727.11
727.12 package sun.security.x509;
727.13
727.14 -import java.security.cert.*;
727.15 import java.io.IOException;
727.16
727.17 import sun.security.util.*;
727.18 @@ -96,19 +95,19 @@
727.19 if (this == that) {
727.20 return true;
727.21 }
727.22 - return (accessMethod.equals(that.getAccessMethod()) &&
727.23 + return (accessMethod.equals((Object)that.getAccessMethod()) &&
727.24 accessLocation.equals(that.getAccessLocation()));
727.25 }
727.26
727.27 public String toString() {
727.28 String method = null;
727.29 - if (accessMethod.equals(Ad_CAISSUERS_Id)) {
727.30 + if (accessMethod.equals((Object)Ad_CAISSUERS_Id)) {
727.31 method = "caIssuers";
727.32 - } else if (accessMethod.equals(Ad_CAREPOSITORY_Id)) {
727.33 + } else if (accessMethod.equals((Object)Ad_CAREPOSITORY_Id)) {
727.34 method = "caRepository";
727.35 - } else if (accessMethod.equals(Ad_TIMESTAMPING_Id)) {
727.36 + } else if (accessMethod.equals((Object)Ad_TIMESTAMPING_Id)) {
727.37 method = "timeStamping";
727.38 - } else if (accessMethod.equals(Ad_OCSP_Id)) {
727.39 + } else if (accessMethod.equals((Object)Ad_OCSP_Id)) {
727.40 method = "ocsp";
727.41 } else {
727.42 method = accessMethod.toString();
728.1 --- a/src/share/classes/sun/security/x509/AlgorithmId.java Thu Sep 01 13:54:38 2011 -0700
728.2 +++ b/src/share/classes/sun/security/x509/AlgorithmId.java Mon Sep 05 23:58:19 2011 -0700
728.3 @@ -1,5 +1,5 @@
728.4 /*
728.5 - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
728.6 + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
728.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
728.8 *
728.9 * This code is free software; you can redistribute it and/or modify it
728.10 @@ -236,7 +236,7 @@
728.11 if (algName != null) {
728.12 return algName;
728.13 }
728.14 - if ((params != null) && algid.equals(specifiedWithECDSA_oid)) {
728.15 + if ((params != null) && algid.equals((Object)specifiedWithECDSA_oid)) {
728.16 try {
728.17 AlgorithmId paramsId =
728.18 AlgorithmId.parse(new DerValue(getEncodedParams()));
728.19 @@ -273,7 +273,7 @@
728.20 public boolean equals(AlgorithmId other) {
728.21 boolean paramsEqual =
728.22 (params == null ? other.params == null : params.equals(other.params));
728.23 - return (algid.equals(other.algid) && paramsEqual);
728.24 + return (algid.equals((Object)other.algid) && paramsEqual);
728.25 }
728.26
728.27 /**
728.28 @@ -301,7 +301,7 @@
728.29 * they are the same algorithm, ignoring algorithm parameters.
728.30 */
728.31 public final boolean equals(ObjectIdentifier id) {
728.32 - return algid.equals(id);
728.33 + return algid.equals((Object)id);
728.34 }
728.35
728.36 /**
729.1 --- a/src/share/classes/sun/security/x509/AuthorityInfoAccessExtension.java Thu Sep 01 13:54:38 2011 -0700
729.2 +++ b/src/share/classes/sun/security/x509/AuthorityInfoAccessExtension.java Mon Sep 05 23:58:19 2011 -0700
729.3 @@ -1,5 +1,5 @@
729.4 /*
729.5 - * Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
729.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
729.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
729.8 *
729.9 * This code is free software; you can redistribute it and/or modify it
729.10 @@ -163,6 +163,7 @@
729.11 /**
729.12 * Set the attribute value.
729.13 */
729.14 + @SuppressWarnings("unchecked") // Checked with an instanceof check
729.15 public void set(String name, Object obj) throws IOException {
729.16 if (name.equalsIgnoreCase(DESCRIPTIONS)) {
729.17 if (!(obj instanceof List)) {
729.18 @@ -180,7 +181,7 @@
729.19 /**
729.20 * Get the attribute value.
729.21 */
729.22 - public Object get(String name) throws IOException {
729.23 + public List<AccessDescription> get(String name) throws IOException {
729.24 if (name.equalsIgnoreCase(DESCRIPTIONS)) {
729.25 return accessDescriptions;
729.26 } else {
730.1 --- a/src/share/classes/sun/security/x509/CRLDistributionPointsExtension.java Thu Sep 01 13:54:38 2011 -0700
730.2 +++ b/src/share/classes/sun/security/x509/CRLDistributionPointsExtension.java Mon Sep 05 23:58:19 2011 -0700
730.3 @@ -1,5 +1,5 @@
730.4 /*
730.5 - * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
730.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
730.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
730.8 *
730.9 * This code is free software; you can redistribute it and/or modify it
730.10 @@ -222,6 +222,7 @@
730.11 /**
730.12 * Set the attribute value.
730.13 */
730.14 + @SuppressWarnings("unchecked") // Checked with instanceof
730.15 public void set(String name, Object obj) throws IOException {
730.16 if (name.equalsIgnoreCase(POINTS)) {
730.17 if (!(obj instanceof List)) {
730.18 @@ -239,7 +240,7 @@
730.19 /**
730.20 * Get the attribute value.
730.21 */
730.22 - public Object get(String name) throws IOException {
730.23 + public List<DistributionPoint> get(String name) throws IOException {
730.24 if (name.equalsIgnoreCase(POINTS)) {
730.25 return distributionPoints;
730.26 } else {
731.1 --- a/src/share/classes/sun/security/x509/CRLExtensions.java Thu Sep 01 13:54:38 2011 -0700
731.2 +++ b/src/share/classes/sun/security/x509/CRLExtensions.java Mon Sep 05 23:58:19 2011 -0700
731.3 @@ -1,5 +1,5 @@
731.4 /*
731.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
731.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
731.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
731.8 *
731.9 * This code is free software; you can redistribute it and/or modify it
731.10 @@ -36,7 +36,6 @@
731.11 import java.util.Hashtable;
731.12
731.13 import sun.security.util.*;
731.14 -import sun.misc.HexDumpEncoder;
731.15
731.16 /**
731.17 * This class defines the CRL Extensions.
731.18 @@ -109,7 +108,7 @@
731.19 // Parse the encoded extension
731.20 private void parseExtension(Extension ext) throws CRLException {
731.21 try {
731.22 - Class extClass = OIDMap.getClass(ext.getExtensionId());
731.23 + Class<?> extClass = OIDMap.getClass(ext.getExtensionId());
731.24 if (extClass == null) { // Unsupported extension
731.25 if (ext.isCritical())
731.26 unsupportedCritExt = true;
731.27 @@ -117,10 +116,10 @@
731.28 throw new CRLException("Duplicate extensions not allowed");
731.29 return;
731.30 }
731.31 - Constructor cons = ((Class<?>)extClass).getConstructor(PARAMS);
731.32 + Constructor<?> cons = extClass.getConstructor(PARAMS);
731.33 Object[] passed = new Object[] {Boolean.valueOf(ext.isCritical()),
731.34 ext.getExtensionValue()};
731.35 - CertAttrSet crlExt = (CertAttrSet)cons.newInstance(passed);
731.36 + CertAttrSet<?> crlExt = (CertAttrSet<?>)cons.newInstance(passed);
731.37 if (map.put(crlExt.getName(), (Extension)crlExt) != null) {
731.38 throw new CRLException("Duplicate extensions not allowed");
731.39 }
732.1 --- a/src/share/classes/sun/security/x509/CRLNumberExtension.java Thu Sep 01 13:54:38 2011 -0700
732.2 +++ b/src/share/classes/sun/security/x509/CRLNumberExtension.java Mon Sep 05 23:58:19 2011 -0700
732.3 @@ -1,5 +1,5 @@
732.4 /*
732.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
732.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
732.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
732.8 *
732.9 * This code is free software; you can redistribute it and/or modify it
732.10 @@ -155,7 +155,7 @@
732.11 /**
732.12 * Get the attribute value.
732.13 */
732.14 - public Object get(String name) throws IOException {
732.15 + public BigInteger get(String name) throws IOException {
732.16 if (name.equalsIgnoreCase(NUMBER)) {
732.17 if (crlNumber == null) return null;
732.18 else return crlNumber;
733.1 --- a/src/share/classes/sun/security/x509/CRLReasonCodeExtension.java Thu Sep 01 13:54:38 2011 -0700
733.2 +++ b/src/share/classes/sun/security/x509/CRLReasonCodeExtension.java Mon Sep 05 23:58:19 2011 -0700
733.3 @@ -1,5 +1,5 @@
733.4 /*
733.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
733.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
733.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
733.8 *
733.9 * This code is free software; you can redistribute it and/or modify it
733.10 @@ -155,7 +155,7 @@
733.11 /**
733.12 * Get the attribute value.
733.13 */
733.14 - public Object get(String name) throws IOException {
733.15 + public Integer get(String name) throws IOException {
733.16 if (name.equalsIgnoreCase(REASON)) {
733.17 return new Integer(reasonCode);
733.18 } else {
734.1 --- a/src/share/classes/sun/security/x509/CertAndKeyGen.java Thu Sep 01 13:54:38 2011 -0700
734.2 +++ b/src/share/classes/sun/security/x509/CertAndKeyGen.java Mon Sep 05 23:58:19 2011 -0700
734.3 @@ -1,5 +1,5 @@
734.4 /*
734.5 - * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
734.6 + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
734.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
734.8 *
734.9 * This code is free software; you can redistribute it and/or modify it
734.10 @@ -229,7 +229,7 @@
734.11 new CertificateVersion(CertificateVersion.V3));
734.12 info.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber(
734.13 new java.util.Random().nextInt() & 0x7fffffff));
734.14 - AlgorithmId algID = AlgorithmId.getAlgorithmId(sigAlg);
734.15 + AlgorithmId algID = AlgorithmId.get(sigAlg);
734.16 info.set(X509CertInfo.ALGORITHM_ID,
734.17 new CertificateAlgorithmId(algID));
734.18 info.set(X509CertInfo.SUBJECT, new CertificateSubjectName(myname));
735.1 --- a/src/share/classes/sun/security/x509/CertificateAlgorithmId.java Thu Sep 01 13:54:38 2011 -0700
735.2 +++ b/src/share/classes/sun/security/x509/CertificateAlgorithmId.java Mon Sep 05 23:58:19 2011 -0700
735.3 @@ -1,5 +1,5 @@
735.4 /*
735.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
735.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
735.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
735.8 *
735.9 * This code is free software; you can redistribute it and/or modify it
735.10 @@ -130,7 +130,7 @@
735.11 /**
735.12 * Get the attribute value.
735.13 */
735.14 - public Object get(String name) throws IOException {
735.15 + public AlgorithmId get(String name) throws IOException {
735.16 if (name.equalsIgnoreCase(ALGORITHM)) {
735.17 return (algId);
735.18 } else {
736.1 --- a/src/share/classes/sun/security/x509/CertificateExtensions.java Thu Sep 01 13:54:38 2011 -0700
736.2 +++ b/src/share/classes/sun/security/x509/CertificateExtensions.java Mon Sep 05 23:58:19 2011 -0700
736.3 @@ -1,5 +1,5 @@
736.4 /*
736.5 - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
736.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
736.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
736.8 *
736.9 * This code is free software; you can redistribute it and/or modify it
736.10 @@ -93,7 +93,7 @@
736.11 // Parse the encoded extension
736.12 private void parseExtension(Extension ext) throws IOException {
736.13 try {
736.14 - Class extClass = OIDMap.getClass(ext.getExtensionId());
736.15 + Class<?> extClass = OIDMap.getClass(ext.getExtensionId());
736.16 if (extClass == null) { // Unsupported extension
736.17 if (ext.isCritical()) {
736.18 unsupportedCritExt = true;
736.19 @@ -104,11 +104,12 @@
736.20 throw new IOException("Duplicate extensions not allowed");
736.21 }
736.22 }
736.23 - Constructor cons = ((Class<?>)extClass).getConstructor(PARAMS);
736.24 + Constructor<?> cons = extClass.getConstructor(PARAMS);
736.25
736.26 Object[] passed = new Object[] {Boolean.valueOf(ext.isCritical()),
736.27 ext.getExtensionValue()};
736.28 - CertAttrSet certExt = (CertAttrSet)cons.newInstance(passed);
736.29 + CertAttrSet<?> certExt = (CertAttrSet<?>)
736.30 + cons.newInstance(passed);
736.31 if (map.put(certExt.getName(), (Extension)certExt) != null) {
736.32 throw new IOException("Duplicate extensions not allowed");
736.33 }
736.34 @@ -132,12 +133,12 @@
736.35 if (e instanceof IOException) {
736.36 throw (IOException)e;
736.37 } else {
736.38 - throw (IOException)new IOException(e.toString()).initCause(e);
736.39 + throw new IOException(e);
736.40 }
736.41 } catch (IOException e) {
736.42 throw e;
736.43 } catch (Exception e) {
736.44 - throw (IOException)new IOException(e.toString()).initCause(e);
736.45 + throw new IOException(e);
736.46 }
736.47 }
736.48
736.49 @@ -210,8 +211,8 @@
736.50 * @param name the extension name used in the lookup.
736.51 * @exception IOException if named extension is not found.
736.52 */
736.53 - public Object get(String name) throws IOException {
736.54 - Object obj = map.get(name);
736.55 + public Extension get(String name) throws IOException {
736.56 + Extension obj = map.get(name);
736.57 if (obj == null) {
736.58 throw new IOException("No extension found with name " + name);
736.59 }
736.60 @@ -233,7 +234,7 @@
736.61
736.62 public String getNameByOid(ObjectIdentifier oid) throws IOException {
736.63 for (String name: map.keySet()) {
736.64 - if (map.get(name).getExtensionId().equals(oid)) {
736.65 + if (map.get(name).getExtensionId().equals((Object)oid)) {
736.66 return name;
736.67 }
736.68 }
736.69 @@ -353,7 +354,7 @@
736.70
736.71 name = "";
736.72 try {
736.73 - Class extClass = OIDMap.getClass(ext.getExtensionId());
736.74 + Class<?> extClass = OIDMap.getClass(ext.getExtensionId());
736.75 if (extClass != null) {
736.76 Field field = extClass.getDeclaredField("NAME");
736.77 name = (String)(field.get(null)) + " ";
737.1 --- a/src/share/classes/sun/security/x509/CertificateIssuerExtension.java Thu Sep 01 13:54:38 2011 -0700
737.2 +++ b/src/share/classes/sun/security/x509/CertificateIssuerExtension.java Mon Sep 05 23:58:19 2011 -0700
737.3 @@ -1,5 +1,5 @@
737.4 /*
737.5 - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
737.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
737.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
737.8 *
737.9 * This code is free software; you can redistribute it and/or modify it
737.10 @@ -141,7 +141,7 @@
737.11 *
737.12 * @throws IOException on error
737.13 */
737.14 - public Object get(String name) throws IOException {
737.15 + public GeneralNames get(String name) throws IOException {
737.16 if (name.equalsIgnoreCase(ISSUER)) {
737.17 return names;
737.18 } else {
738.1 --- a/src/share/classes/sun/security/x509/CertificateIssuerUniqueIdentity.java Thu Sep 01 13:54:38 2011 -0700
738.2 +++ b/src/share/classes/sun/security/x509/CertificateIssuerUniqueIdentity.java Mon Sep 05 23:58:19 2011 -0700
738.3 @@ -1,5 +1,5 @@
738.4 /*
738.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
738.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
738.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
738.8 *
738.9 * This code is free software; you can redistribute it and/or modify it
738.10 @@ -136,7 +136,7 @@
738.11 /**
738.12 * Get the attribute value.
738.13 */
738.14 - public Object get(String name) throws IOException {
738.15 + public UniqueIdentity get(String name) throws IOException {
738.16 if (name.equalsIgnoreCase(ID)) {
738.17 return (id);
738.18 } else {
739.1 --- a/src/share/classes/sun/security/x509/CertificatePoliciesExtension.java Thu Sep 01 13:54:38 2011 -0700
739.2 +++ b/src/share/classes/sun/security/x509/CertificatePoliciesExtension.java Mon Sep 05 23:58:19 2011 -0700
739.3 @@ -1,5 +1,5 @@
739.4 /*
739.5 - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
739.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
739.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
739.8 *
739.9 * This code is free software; you can redistribute it and/or modify it
739.10 @@ -189,6 +189,7 @@
739.11 /**
739.12 * Set the attribute value.
739.13 */
739.14 + @SuppressWarnings("unchecked") // Checked with an instanceof check
739.15 public void set(String name, Object obj) throws IOException {
739.16 if (name.equalsIgnoreCase(POLICIES)) {
739.17 if (!(obj instanceof List)) {
739.18 @@ -206,7 +207,7 @@
739.19 /**
739.20 * Get the attribute value.
739.21 */
739.22 - public Object get(String name) throws IOException {
739.23 + public List<PolicyInformation> get(String name) throws IOException {
739.24 if (name.equalsIgnoreCase(POLICIES)) {
739.25 //XXXX May want to consider cloning this
739.26 return certPolicies;
740.1 --- a/src/share/classes/sun/security/x509/CertificatePolicyId.java Thu Sep 01 13:54:38 2011 -0700
740.2 +++ b/src/share/classes/sun/security/x509/CertificatePolicyId.java Mon Sep 05 23:58:19 2011 -0700
740.3 @@ -1,5 +1,5 @@
740.4 /*
740.5 - * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
740.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
740.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
740.8 *
740.9 * This code is free software; you can redistribute it and/or modify it
740.10 @@ -93,7 +93,8 @@
740.11 */
740.12 public boolean equals(Object other) {
740.13 if (other instanceof CertificatePolicyId)
740.14 - return id.equals(((CertificatePolicyId) other).getIdentifier());
740.15 + return id.equals((Object)
740.16 + ((CertificatePolicyId) other).getIdentifier());
740.17 else
740.18 return false;
740.19 }
741.1 --- a/src/share/classes/sun/security/x509/CertificateSerialNumber.java Thu Sep 01 13:54:38 2011 -0700
741.2 +++ b/src/share/classes/sun/security/x509/CertificateSerialNumber.java Mon Sep 05 23:58:19 2011 -0700
741.3 @@ -1,5 +1,5 @@
741.4 /*
741.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
741.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
741.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
741.8 *
741.9 * This code is free software; you can redistribute it and/or modify it
741.10 @@ -141,7 +141,7 @@
741.11 /**
741.12 * Get the attribute value.
741.13 */
741.14 - public Object get(String name) throws IOException {
741.15 + public SerialNumber get(String name) throws IOException {
741.16 if (name.equalsIgnoreCase(NUMBER)) {
741.17 return (serial);
741.18 } else {
742.1 --- a/src/share/classes/sun/security/x509/CertificateSubjectUniqueIdentity.java Thu Sep 01 13:54:38 2011 -0700
742.2 +++ b/src/share/classes/sun/security/x509/CertificateSubjectUniqueIdentity.java Mon Sep 05 23:58:19 2011 -0700
742.3 @@ -1,5 +1,5 @@
742.4 /*
742.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
742.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
742.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
742.8 *
742.9 * This code is free software; you can redistribute it and/or modify it
742.10 @@ -135,7 +135,7 @@
742.11 /**
742.12 * Get the attribute value.
742.13 */
742.14 - public Object get(String name) throws IOException {
742.15 + public UniqueIdentity get(String name) throws IOException {
742.16 if (name.equalsIgnoreCase(ID)) {
742.17 return(id);
742.18 } else {
743.1 --- a/src/share/classes/sun/security/x509/CertificateValidity.java Thu Sep 01 13:54:38 2011 -0700
743.2 +++ b/src/share/classes/sun/security/x509/CertificateValidity.java Mon Sep 05 23:58:19 2011 -0700
743.3 @@ -1,5 +1,5 @@
743.4 /*
743.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
743.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
743.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
743.8 *
743.9 * This code is free software; you can redistribute it and/or modify it
743.10 @@ -190,7 +190,7 @@
743.11 /**
743.12 * Get the attribute value.
743.13 */
743.14 - public Object get(String name) throws IOException {
743.15 + public Date get(String name) throws IOException {
743.16 if (name.equalsIgnoreCase(NOT_BEFORE)) {
743.17 return (getNotBefore());
743.18 } else if (name.equalsIgnoreCase(NOT_AFTER)) {
744.1 --- a/src/share/classes/sun/security/x509/CertificateVersion.java Thu Sep 01 13:54:38 2011 -0700
744.2 +++ b/src/share/classes/sun/security/x509/CertificateVersion.java Mon Sep 05 23:58:19 2011 -0700
744.3 @@ -1,5 +1,5 @@
744.4 /*
744.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
744.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
744.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
744.8 *
744.9 * This code is free software; you can redistribute it and/or modify it
744.10 @@ -191,7 +191,7 @@
744.11 /**
744.12 * Get the attribute value.
744.13 */
744.14 - public Object get(String name) throws IOException {
744.15 + public Integer get(String name) throws IOException {
744.16 if (name.equalsIgnoreCase(VERSION)) {
744.17 return(new Integer(getVersion()));
744.18 } else {
745.1 --- a/src/share/classes/sun/security/x509/CertificateX509Key.java Thu Sep 01 13:54:38 2011 -0700
745.2 +++ b/src/share/classes/sun/security/x509/CertificateX509Key.java Mon Sep 05 23:58:19 2011 -0700
745.3 @@ -1,5 +1,5 @@
745.4 /*
745.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
745.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
745.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
745.8 *
745.9 * This code is free software; you can redistribute it and/or modify it
745.10 @@ -122,7 +122,7 @@
745.11 /**
745.12 * Get the attribute value.
745.13 */
745.14 - public Object get(String name) throws IOException {
745.15 + public PublicKey get(String name) throws IOException {
745.16 if (name.equalsIgnoreCase(KEY)) {
745.17 return(key);
745.18 } else {
746.1 --- a/src/share/classes/sun/security/x509/DNSName.java Thu Sep 01 13:54:38 2011 -0700
746.2 +++ b/src/share/classes/sun/security/x509/DNSName.java Mon Sep 05 23:58:19 2011 -0700
746.3 @@ -159,7 +159,7 @@
746.4 * @return a hash code value for this object.
746.5 */
746.6 public int hashCode() {
746.7 - return name.toUpperCase().hashCode();
746.8 + return name.toUpperCase(Locale.ENGLISH).hashCode();
746.9 }
746.10
746.11 /**
747.1 --- a/src/share/classes/sun/security/x509/ExtendedKeyUsageExtension.java Thu Sep 01 13:54:38 2011 -0700
747.2 +++ b/src/share/classes/sun/security/x509/ExtendedKeyUsageExtension.java Mon Sep 05 23:58:19 2011 -0700
747.3 @@ -1,5 +1,5 @@
747.4 /*
747.5 - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
747.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
747.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
747.8 *
747.9 * This code is free software; you can redistribute it and/or modify it
747.10 @@ -241,6 +241,7 @@
747.11 /**
747.12 * Set the attribute value.
747.13 */
747.14 + @SuppressWarnings("unchecked") // Checked with instanceof
747.15 public void set(String name, Object obj) throws IOException {
747.16 if (name.equalsIgnoreCase(USAGES)) {
747.17 if (!(obj instanceof Vector)) {
747.18 @@ -258,7 +259,7 @@
747.19 /**
747.20 * Get the attribute value.
747.21 */
747.22 - public Object get(String name) throws IOException {
747.23 + public Vector<ObjectIdentifier> get(String name) throws IOException {
747.24 if (name.equalsIgnoreCase(USAGES)) {
747.25 //XXXX May want to consider cloning this
747.26 return keyUsages;
748.1 --- a/src/share/classes/sun/security/x509/Extension.java Thu Sep 01 13:54:38 2011 -0700
748.2 +++ b/src/share/classes/sun/security/x509/Extension.java Mon Sep 05 23:58:19 2011 -0700
748.3 @@ -1,5 +1,5 @@
748.4 /*
748.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
748.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
748.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
748.8 *
748.9 * This code is free software; you can redistribute it and/or modify it
748.10 @@ -269,7 +269,7 @@
748.11 Extension otherExt = (Extension) other;
748.12 if (critical != otherExt.critical)
748.13 return false;
748.14 - if (!extensionId.equals(otherExt.extensionId))
748.15 + if (!extensionId.equals((Object)otherExt.extensionId))
748.16 return false;
748.17 return Arrays.equals(extensionValue, otherExt.extensionValue);
748.18 }
749.1 --- a/src/share/classes/sun/security/x509/InhibitAnyPolicyExtension.java Thu Sep 01 13:54:38 2011 -0700
749.2 +++ b/src/share/classes/sun/security/x509/InhibitAnyPolicyExtension.java Mon Sep 05 23:58:19 2011 -0700
749.3 @@ -1,5 +1,5 @@
749.4 /*
749.5 - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
749.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
749.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
749.8 *
749.9 * This code is free software; you can redistribute it and/or modify it
749.10 @@ -215,7 +215,7 @@
749.11 * Integer.
749.12 * @throws IOException on error
749.13 */
749.14 - public Object get(String name) throws IOException {
749.15 + public Integer get(String name) throws IOException {
749.16 if (name.equalsIgnoreCase(SKIP_CERTS))
749.17 return (new Integer(skipCerts));
749.18 else
750.1 --- a/src/share/classes/sun/security/x509/InvalidityDateExtension.java Thu Sep 01 13:54:38 2011 -0700
750.2 +++ b/src/share/classes/sun/security/x509/InvalidityDateExtension.java Mon Sep 05 23:58:19 2011 -0700
750.3 @@ -1,5 +1,5 @@
750.4 /*
750.5 - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
750.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
750.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
750.8 *
750.9 * This code is free software; you can redistribute it and/or modify it
750.10 @@ -138,7 +138,7 @@
750.11 /**
750.12 * Get the attribute value.
750.13 */
750.14 - public Object get(String name) throws IOException {
750.15 + public Date get(String name) throws IOException {
750.16 if (name.equalsIgnoreCase(DATE)) {
750.17 if (date == null) {
750.18 return null;
751.1 --- a/src/share/classes/sun/security/x509/IssuerAlternativeNameExtension.java Thu Sep 01 13:54:38 2011 -0700
751.2 +++ b/src/share/classes/sun/security/x509/IssuerAlternativeNameExtension.java Mon Sep 05 23:58:19 2011 -0700
751.3 @@ -1,5 +1,5 @@
751.4 /*
751.5 - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
751.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
751.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
751.8 *
751.9 * This code is free software; you can redistribute it and/or modify it
751.10 @@ -190,7 +190,7 @@
751.11 /**
751.12 * Get the attribute value.
751.13 */
751.14 - public Object get(String name) throws IOException {
751.15 + public GeneralNames get(String name) throws IOException {
751.16 if (name.equalsIgnoreCase(ISSUER_NAME)) {
751.17 return (names);
751.18 } else {
752.1 --- a/src/share/classes/sun/security/x509/KeyUsageExtension.java Thu Sep 01 13:54:38 2011 -0700
752.2 +++ b/src/share/classes/sun/security/x509/KeyUsageExtension.java Mon Sep 05 23:58:19 2011 -0700
752.3 @@ -1,5 +1,5 @@
752.4 /*
752.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
752.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
752.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
752.8 *
752.9 * This code is free software; you can redistribute it and/or modify it
752.10 @@ -217,7 +217,7 @@
752.11 /**
752.12 * Get the attribute value.
752.13 */
752.14 - public Object get(String name) throws IOException {
752.15 + public Boolean get(String name) throws IOException {
752.16 if (name.equalsIgnoreCase(DIGITAL_SIGNATURE)) {
752.17 return Boolean.valueOf(isSet(0));
752.18 } else if (name.equalsIgnoreCase(NON_REPUDIATION)) {
753.1 --- a/src/share/classes/sun/security/x509/NameConstraintsExtension.java Thu Sep 01 13:54:38 2011 -0700
753.2 +++ b/src/share/classes/sun/security/x509/NameConstraintsExtension.java Mon Sep 05 23:58:19 2011 -0700
753.3 @@ -1,5 +1,5 @@
753.4 /*
753.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
753.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
753.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
753.8 *
753.9 * This code is free software; you can redistribute it and/or modify it
753.10 @@ -27,10 +27,7 @@
753.11
753.12 import java.io.IOException;
753.13 import java.io.OutputStream;
753.14 -import java.security.Principal;
753.15 -import java.security.cert.CertificateEncodingException;
753.16 import java.security.cert.CertificateException;
753.17 -import java.security.cert.CertificateParsingException;
753.18 import java.security.cert.X509Certificate;
753.19 import java.util.*;
753.20
753.21 @@ -268,7 +265,7 @@
753.22 /**
753.23 * Get the attribute value.
753.24 */
753.25 - public Object get(String name) throws IOException {
753.26 + public GeneralSubtrees get(String name) throws IOException {
753.27 if (name.equalsIgnoreCase(PERMITTED_SUBTREES)) {
753.28 return (permitted);
753.29 } else if (name.equalsIgnoreCase(EXCLUDED_SUBTREES)) {
753.30 @@ -349,8 +346,7 @@
753.31 * value and the value indicated in the extension field.
753.32 */
753.33
753.34 - GeneralSubtrees newExcluded =
753.35 - (GeneralSubtrees)newConstraints.get(EXCLUDED_SUBTREES);
753.36 + GeneralSubtrees newExcluded = newConstraints.get(EXCLUDED_SUBTREES);
753.37 if (excluded == null) {
753.38 excluded = (newExcluded != null) ?
753.39 (GeneralSubtrees)newExcluded.clone() : null;
753.40 @@ -367,8 +363,7 @@
753.41 * previous value and the value indicated in the extension field.
753.42 */
753.43
753.44 - GeneralSubtrees newPermitted =
753.45 - (GeneralSubtrees)newConstraints.get(PERMITTED_SUBTREES);
753.46 + GeneralSubtrees newPermitted = newConstraints.get(PERMITTED_SUBTREES);
753.47 if (permitted == null) {
753.48 permitted = (newPermitted != null) ?
753.49 (GeneralSubtrees)newPermitted.clone() : null;
753.50 @@ -455,8 +450,8 @@
753.51 if (altNameExt != null) {
753.52 // extract altNames from extension; this call does not
753.53 // return an IOException on null altnames
753.54 - altNames = (GeneralNames)
753.55 - (altNameExt.get(altNameExt.SUBJECT_NAME));
753.56 + altNames = altNameExt.get(
753.57 + SubjectAlternativeNameExtension.SUBJECT_NAME);
753.58 }
753.59 } catch (CertificateException ce) {
753.60 throw new IOException("Unable to extract extensions from " +
753.61 @@ -575,10 +570,9 @@
753.62 * @throws IOException on error
753.63 */
753.64 public boolean verifyRFC822SpecialCase(X500Name subject) throws IOException {
753.65 - for (Iterator t = subject.allAvas().iterator(); t.hasNext(); ) {
753.66 - AVA ava = (AVA)t.next();
753.67 + for (AVA ava : subject.allAvas()) {
753.68 ObjectIdentifier attrOID = ava.getObjectIdentifier();
753.69 - if (attrOID.equals(PKCS9Attribute.EMAIL_ADDRESS_OID)) {
753.70 + if (attrOID.equals((Object)PKCS9Attribute.EMAIL_ADDRESS_OID)) {
753.71 String attrValue = ava.getValueString();
753.72 if (attrValue != null) {
753.73 RFC822Name emailName;
754.1 --- a/src/share/classes/sun/security/x509/NetscapeCertTypeExtension.java Thu Sep 01 13:54:38 2011 -0700
754.2 +++ b/src/share/classes/sun/security/x509/NetscapeCertTypeExtension.java Mon Sep 05 23:58:19 2011 -0700
754.3 @@ -1,5 +1,5 @@
754.4 /*
754.5 - * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
754.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
754.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
754.8 *
754.9 * This code is free software; you can redistribute it and/or modify it
754.10 @@ -220,7 +220,7 @@
754.11 /**
754.12 * Get the attribute value.
754.13 */
754.14 - public Object get(String name) throws IOException {
754.15 + public Boolean get(String name) throws IOException {
754.16 return Boolean.valueOf(isSet(getPosition(name)));
754.17 }
754.18
754.19 @@ -306,15 +306,15 @@
754.20 if (isSet(getPosition(SSL_CLIENT)) ||
754.21 isSet(getPosition(S_MIME)) ||
754.22 isSet(getPosition(OBJECT_SIGNING)))
754.23 - keyUsage.set(keyUsage.DIGITAL_SIGNATURE, val);
754.24 + keyUsage.set(KeyUsageExtension.DIGITAL_SIGNATURE, val);
754.25
754.26 if (isSet(getPosition(SSL_SERVER)))
754.27 - keyUsage.set(keyUsage.KEY_ENCIPHERMENT, val);
754.28 + keyUsage.set(KeyUsageExtension.KEY_ENCIPHERMENT, val);
754.29
754.30 if (isSet(getPosition(SSL_CA)) ||
754.31 isSet(getPosition(S_MIME_CA)) ||
754.32 isSet(getPosition(OBJECT_SIGNING_CA)))
754.33 - keyUsage.set(keyUsage.KEY_CERTSIGN, val);
754.34 + keyUsage.set(KeyUsageExtension.KEY_CERTSIGN, val);
754.35 } catch (IOException e) { }
754.36 return keyUsage.getBits();
754.37 }
755.1 --- a/src/share/classes/sun/security/x509/OIDMap.java Thu Sep 01 13:54:38 2011 -0700
755.2 +++ b/src/share/classes/sun/security/x509/OIDMap.java Mon Sep 05 23:58:19 2011 -0700
755.3 @@ -1,5 +1,5 @@
755.4 /*
755.5 - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
755.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
755.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
755.8 *
755.9 * This code is free software; you can redistribute it and/or modify it
755.10 @@ -29,7 +29,6 @@
755.11 import java.io.IOException;
755.12
755.13 import java.security.cert.CertificateException;
755.14 -import java.security.cert.CertificateParsingException;
755.15
755.16 import sun.security.util.*;
755.17
755.18 @@ -186,7 +185,7 @@
755.19 final ObjectIdentifier oid;
755.20 final String name;
755.21 final String className;
755.22 - private volatile Class clazz;
755.23 + private volatile Class<?> clazz;
755.24
755.25 OIDInfo(String name, ObjectIdentifier oid, String className) {
755.26 this.name = name;
755.27 @@ -194,7 +193,7 @@
755.28 this.className = className;
755.29 }
755.30
755.31 - OIDInfo(String name, ObjectIdentifier oid, Class clazz) {
755.32 + OIDInfo(String name, ObjectIdentifier oid, Class<?> clazz) {
755.33 this.name = name;
755.34 this.oid = oid;
755.35 this.className = clazz.getName();
755.36 @@ -204,17 +203,16 @@
755.37 /**
755.38 * Return the Class object associated with this attribute.
755.39 */
755.40 - Class getClazz() throws CertificateException {
755.41 + Class<?> getClazz() throws CertificateException {
755.42 try {
755.43 - Class c = clazz;
755.44 + Class<?> c = clazz;
755.45 if (c == null) {
755.46 c = Class.forName(className);
755.47 clazz = c;
755.48 }
755.49 return c;
755.50 } catch (ClassNotFoundException e) {
755.51 - throw (CertificateException)new CertificateException
755.52 - ("Could not load class: " + e).initCause(e);
755.53 + throw new CertificateException("Could not load class: " + e, e);
755.54 }
755.55 }
755.56 }
755.57 @@ -228,7 +226,7 @@
755.58 * @param clazz the Class object associated with this attribute
755.59 * @exception CertificateException on errors.
755.60 */
755.61 - public static void addAttribute(String name, String oid, Class clazz)
755.62 + public static void addAttribute(String name, String oid, Class<?> clazz)
755.63 throws CertificateException {
755.64 ObjectIdentifier objId;
755.65 try {
755.66 @@ -277,7 +275,7 @@
755.67 * @param name the user friendly name.
755.68 * @exception CertificateException if class cannot be instantiated.
755.69 */
755.70 - public static Class getClass(String name) throws CertificateException {
755.71 + public static Class<?> getClass(String name) throws CertificateException {
755.72 OIDInfo info = nameMap.get(name);
755.73 return (info == null) ? null : info.getClazz();
755.74 }
755.75 @@ -288,7 +286,7 @@
755.76 * @param oid the name of the object identifier to be returned.
755.77 * @exception CertificateException if class cannot be instatiated.
755.78 */
755.79 - public static Class getClass(ObjectIdentifier oid)
755.80 + public static Class<?> getClass(ObjectIdentifier oid)
755.81 throws CertificateException {
755.82 OIDInfo info = oidMap.get(oid);
755.83 return (info == null) ? null : info.getClazz();
756.1 --- a/src/share/classes/sun/security/x509/OIDName.java Thu Sep 01 13:54:38 2011 -0700
756.2 +++ b/src/share/classes/sun/security/x509/OIDName.java Mon Sep 05 23:58:19 2011 -0700
756.3 @@ -1,5 +1,5 @@
756.4 /*
756.5 - * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
756.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
756.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
756.8 *
756.9 * This code is free software; you can redistribute it and/or modify it
756.10 @@ -120,7 +120,7 @@
756.11
756.12 OIDName other = (OIDName)obj;
756.13
756.14 - return oid.equals(other.oid);
756.15 + return oid.equals((Object)other.oid);
756.16 }
756.17
756.18 /**
757.1 --- a/src/share/classes/sun/security/x509/OtherName.java Thu Sep 01 13:54:38 2011 -0700
757.2 +++ b/src/share/classes/sun/security/x509/OtherName.java Mon Sep 05 23:58:19 2011 -0700
757.3 @@ -1,5 +1,5 @@
757.4 /*
757.5 - * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
757.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
757.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
757.8 *
757.9 * This code is free software; you can redistribute it and/or modify it
757.10 @@ -120,19 +120,19 @@
757.11 private GeneralNameInterface getGNI(ObjectIdentifier oid, byte[] nameValue)
757.12 throws IOException {
757.13 try {
757.14 - Class extClass = OIDMap.getClass(oid);
757.15 + Class<?> extClass = OIDMap.getClass(oid);
757.16 if (extClass == null) { // Unsupported OtherName
757.17 return null;
757.18 }
757.19 - Class[] params = { Object.class };
757.20 - Constructor cons = ((Class<?>)extClass).getConstructor(params);
757.21 + Class<?>[] params = { Object.class };
757.22 + Constructor<?> cons = extClass.getConstructor(params);
757.23
757.24 Object[] passed = new Object[] { nameValue };
757.25 GeneralNameInterface gni =
757.26 (GeneralNameInterface)cons.newInstance(passed);
757.27 return gni;
757.28 } catch (Exception e) {
757.29 - throw (IOException)new IOException("Instantiation error: " + e).initCause(e);
757.30 + throw new IOException("Instantiation error: " + e, e);
757.31 }
757.32 }
757.33
757.34 @@ -176,7 +176,7 @@
757.35 return false;
757.36 }
757.37 OtherName otherOther = (OtherName)other;
757.38 - if (!(otherOther.oid.equals(oid))) {
757.39 + if (!(otherOther.oid.equals((Object)oid))) {
757.40 return false;
757.41 }
757.42 GeneralNameInterface otherGNI = null;
758.1 --- a/src/share/classes/sun/security/x509/PolicyConstraintsExtension.java Thu Sep 01 13:54:38 2011 -0700
758.2 +++ b/src/share/classes/sun/security/x509/PolicyConstraintsExtension.java Mon Sep 05 23:58:19 2011 -0700
758.3 @@ -1,5 +1,5 @@
758.4 /*
758.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
758.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
758.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
758.8 *
758.9 * This code is free software; you can redistribute it and/or modify it
758.10 @@ -231,7 +231,7 @@
758.11 /**
758.12 * Get the attribute value.
758.13 */
758.14 - public Object get(String name) throws IOException {
758.15 + public Integer get(String name) throws IOException {
758.16 if (name.equalsIgnoreCase(REQUIRE)) {
758.17 return new Integer(require);
758.18 } else if (name.equalsIgnoreCase(INHIBIT)) {
759.1 --- a/src/share/classes/sun/security/x509/PolicyInformation.java Thu Sep 01 13:54:38 2011 -0700
759.2 +++ b/src/share/classes/sun/security/x509/PolicyInformation.java Mon Sep 05 23:58:19 2011 -0700
759.3 @@ -1,5 +1,5 @@
759.4 /*
759.5 - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
759.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
759.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
759.8 *
759.9 * This code is free software; you can redistribute it and/or modify it
759.10 @@ -186,6 +186,7 @@
759.11 /**
759.12 * Set the attribute value.
759.13 */
759.14 + @SuppressWarnings("unchecked") // Checked with instanceof
759.15 public void set(String name, Object obj) throws IOException {
759.16 if (name.equalsIgnoreCase(ID)) {
759.17 if (obj instanceof CertificatePolicyId)
760.1 --- a/src/share/classes/sun/security/x509/PolicyMappingsExtension.java Thu Sep 01 13:54:38 2011 -0700
760.2 +++ b/src/share/classes/sun/security/x509/PolicyMappingsExtension.java Mon Sep 05 23:58:19 2011 -0700
760.3 @@ -1,5 +1,5 @@
760.4 /*
760.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
760.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
760.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
760.8 *
760.9 * This code is free software; you can redistribute it and/or modify it
760.10 @@ -29,8 +29,6 @@
760.11 import java.io.OutputStream;
760.12 import java.util.*;
760.13
760.14 -import java.security.cert.CertificateException;
760.15 -
760.16 import sun.security.util.*;
760.17
760.18 /**
760.19 @@ -165,6 +163,7 @@
760.20 /**
760.21 * Set the attribute value.
760.22 */
760.23 + @SuppressWarnings("unchecked") // Checked with instanceof
760.24 public void set(String name, Object obj) throws IOException {
760.25 if (name.equalsIgnoreCase(MAP)) {
760.26 if (!(obj instanceof List)) {
760.27 @@ -182,7 +181,7 @@
760.28 /**
760.29 * Get the attribute value.
760.30 */
760.31 - public Object get(String name) throws IOException {
760.32 + public List<CertificatePolicyMap> get(String name) throws IOException {
760.33 if (name.equalsIgnoreCase(MAP)) {
760.34 return (maps);
760.35 } else {
761.1 --- a/src/share/classes/sun/security/x509/PrivateKeyUsageExtension.java Thu Sep 01 13:54:38 2011 -0700
761.2 +++ b/src/share/classes/sun/security/x509/PrivateKeyUsageExtension.java Mon Sep 05 23:58:19 2011 -0700
761.3 @@ -1,5 +1,5 @@
761.4 /*
761.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
761.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
761.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
761.8 *
761.9 * This code is free software; you can redistribute it and/or modify it
761.10 @@ -262,7 +262,7 @@
761.11 * Get the attribute value.
761.12 * @exception CertificateException on attribute handling errors.
761.13 */
761.14 - public Object get(String name) throws CertificateException {
761.15 + public Date get(String name) throws CertificateException {
761.16 if (name.equalsIgnoreCase(NOT_BEFORE)) {
761.17 return (new Date(notBefore.getTime()));
761.18 } else if (name.equalsIgnoreCase(NOT_AFTER)) {
762.1 --- a/src/share/classes/sun/security/x509/RDN.java Thu Sep 01 13:54:38 2011 -0700
762.2 +++ b/src/share/classes/sun/security/x509/RDN.java Mon Sep 05 23:58:19 2011 -0700
762.3 @@ -1,5 +1,5 @@
762.4 /*
762.5 - * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
762.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
762.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
762.8 *
762.9 * This code is free software; you can redistribute it and/or modify it
762.10 @@ -25,17 +25,11 @@
762.11
762.12 package sun.security.x509;
762.13
762.14 -import java.lang.reflect.*;
762.15 import java.io.IOException;
762.16 import java.io.StringReader;
762.17 -import java.security.PrivilegedExceptionAction;
762.18 -import java.security.AccessController;
762.19 -import java.security.Principal;
762.20 import java.util.*;
762.21
762.22 import sun.security.util.*;
762.23 -import sun.security.pkcs.PKCS9Attribute;
762.24 -import javax.security.auth.x500.X500Principal;
762.25
762.26 /**
762.27 * RDNs are a set of {attribute = value} assertions. Some of those
762.28 @@ -327,7 +321,7 @@
762.29 */
762.30 DerValue findAttribute(ObjectIdentifier oid) {
762.31 for (int i = 0; i < assertion.length; i++) {
762.32 - if (assertion[i].oid.equals(oid)) {
762.33 + if (assertion[i].oid.equals((Object)oid)) {
762.34 return assertion[i].value;
762.35 }
762.36 }
763.1 --- a/src/share/classes/sun/security/x509/RFC822Name.java Thu Sep 01 13:54:38 2011 -0700
763.2 +++ b/src/share/classes/sun/security/x509/RFC822Name.java Mon Sep 05 23:58:19 2011 -0700
763.3 @@ -153,7 +153,7 @@
763.4 * @return a hash code value for this object.
763.5 */
763.6 public int hashCode() {
763.7 - return name.toUpperCase().hashCode();
763.8 + return name.toUpperCase(Locale.ENGLISH).hashCode();
763.9 }
763.10
763.11 /**
764.1 --- a/src/share/classes/sun/security/x509/SubjectAlternativeNameExtension.java Thu Sep 01 13:54:38 2011 -0700
764.2 +++ b/src/share/classes/sun/security/x509/SubjectAlternativeNameExtension.java Mon Sep 05 23:58:19 2011 -0700
764.3 @@ -1,5 +1,5 @@
764.4 /*
764.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
764.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
764.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
764.8 *
764.9 * This code is free software; you can redistribute it and/or modify it
764.10 @@ -195,7 +195,7 @@
764.11 /**
764.12 * Get the attribute value.
764.13 */
764.14 - public Object get(String name) throws IOException {
764.15 + public GeneralNames get(String name) throws IOException {
764.16 if (name.equalsIgnoreCase(SUBJECT_NAME)) {
764.17 return (names);
764.18 } else {
765.1 --- a/src/share/classes/sun/security/x509/SubjectInfoAccessExtension.java Thu Sep 01 13:54:38 2011 -0700
765.2 +++ b/src/share/classes/sun/security/x509/SubjectInfoAccessExtension.java Mon Sep 05 23:58:19 2011 -0700
765.3 @@ -1,5 +1,5 @@
765.4 /*
765.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
765.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
765.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
765.8 *
765.9 * This code is free software; you can redistribute it and/or modify it
765.10 @@ -167,6 +167,7 @@
765.11 /**
765.12 * Set the attribute value.
765.13 */
765.14 + @SuppressWarnings("unchecked") // Checked with instanceof
765.15 public void set(String name, Object obj) throws IOException {
765.16 if (name.equalsIgnoreCase(DESCRIPTIONS)) {
765.17 if (!(obj instanceof List)) {
765.18 @@ -184,7 +185,7 @@
765.19 /**
765.20 * Get the attribute value.
765.21 */
765.22 - public Object get(String name) throws IOException {
765.23 + public List<AccessDescription> get(String name) throws IOException {
765.24 if (name.equalsIgnoreCase(DESCRIPTIONS)) {
765.25 return accessDescriptions;
765.26 } else {
766.1 --- a/src/share/classes/sun/security/x509/SubjectKeyIdentifierExtension.java Thu Sep 01 13:54:38 2011 -0700
766.2 +++ b/src/share/classes/sun/security/x509/SubjectKeyIdentifierExtension.java Mon Sep 05 23:58:19 2011 -0700
766.3 @@ -1,5 +1,5 @@
766.4 /*
766.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
766.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
766.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
766.8 *
766.9 * This code is free software; you can redistribute it and/or modify it
766.10 @@ -156,7 +156,7 @@
766.11 /**
766.12 * Get the attribute value.
766.13 */
766.14 - public Object get(String name) throws IOException {
766.15 + public KeyIdentifier get(String name) throws IOException {
766.16 if (name.equalsIgnoreCase(KEY_ID)) {
766.17 return (id);
766.18 } else {
767.1 --- a/src/share/classes/sun/security/x509/X500Name.java Thu Sep 01 13:54:38 2011 -0700
767.2 +++ b/src/share/classes/sun/security/x509/X500Name.java Mon Sep 05 23:58:19 2011 -0700
767.3 @@ -1,5 +1,5 @@
767.4 /*
767.5 - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
767.6 + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
767.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
767.8 *
767.9 * This code is free software; you can redistribute it and/or modify it
767.10 @@ -27,14 +27,12 @@
767.11
767.12 import java.lang.reflect.*;
767.13 import java.io.IOException;
767.14 -import java.io.StringReader;
767.15 import java.security.PrivilegedExceptionAction;
767.16 import java.security.AccessController;
767.17 import java.security.Principal;
767.18 import java.util.*;
767.19
767.20 import sun.security.util.*;
767.21 -import sun.security.pkcs.PKCS9Attribute;
767.22 import javax.security.auth.x500.X500Principal;
767.23
767.24 /**
767.25 @@ -144,9 +142,9 @@
767.26 /**
767.27 * Constructs a name from a conventionally formatted string, such
767.28 * as "CN=Dave, OU=JavaSoft, O=Sun Microsystems, C=US".
767.29 - * (RFC 1779 or RFC 2253 style).
767.30 + * (RFC 1779, 2253, or 4514 style).
767.31 *
767.32 - * @param DN X.500 Distinguished Name
767.33 + * @param dname the X.500 Distinguished Name
767.34 */
767.35 public X500Name(String dname) throws IOException {
767.36 this(dname, Collections.<String, String>emptyMap());
767.37 @@ -155,9 +153,9 @@
767.38 /**
767.39 * Constructs a name from a conventionally formatted string, such
767.40 * as "CN=Dave, OU=JavaSoft, O=Sun Microsystems, C=US".
767.41 - * (RFC 1779 or RFC 2253 style).
767.42 + * (RFC 1779, 2253, or 4514 style).
767.43 *
767.44 - * @param DN X.500 Distinguished Name
767.45 + * @param dname the X.500 Distinguished Name
767.46 * @param keywordMap an additional keyword/OID map
767.47 */
767.48 public X500Name(String dname, Map<String, String> keywordMap)
767.49 @@ -169,10 +167,11 @@
767.50 * Constructs a name from a string formatted according to format.
767.51 * Currently, the formats DEFAULT and RFC2253 are supported.
767.52 * DEFAULT is the default format used by the X500Name(String)
767.53 - * constructor. RFC2253 is format strictly according to RFC2253
767.54 + * constructor. RFC2253 is the format strictly according to RFC2253
767.55 * without extensions.
767.56 *
767.57 - * @param DN X.500 Distinguished Name
767.58 + * @param dname the X.500 Distinguished Name
767.59 + * @param format the specified format of the String DN
767.60 */
767.61 public X500Name(String dname, String format) throws IOException {
767.62 if (dname == null) {
767.63 @@ -867,8 +866,8 @@
767.64 * O="Sue, Grabbit and Runn" or
767.65 * O=Sue\, Grabbit and Runn
767.66 *
767.67 - * This method can parse 1779 or 2253 DNs and non-standard 3280 keywords.
767.68 - * Additional keywords can be specified in the keyword/OID map.
767.69 + * This method can parse RFC 1779, 2253 or 4514 DNs and non-standard 3280
767.70 + * keywords. Additional keywords can be specified in the keyword/OID map.
767.71 */
767.72 private void parseDN(String input, Map<String, String> keywordMap)
767.73 throws IOException {
767.74 @@ -877,7 +876,7 @@
767.75 return;
767.76 }
767.77
767.78 - List<RDN> dnVector = new ArrayList<RDN>();
767.79 + List<RDN> dnVector = new ArrayList<>();
767.80 int dnOffset = 0;
767.81 int rdnEnd;
767.82 String rdnString;
767.83 @@ -947,52 +946,51 @@
767.84 if (dnString.length() == 0) {
767.85 names = new RDN[0];
767.86 return;
767.87 - }
767.88 + }
767.89
767.90 - List<RDN> dnVector = new ArrayList<RDN>();
767.91 - int dnOffset = 0;
767.92 - String rdnString;
767.93 + List<RDN> dnVector = new ArrayList<>();
767.94 + int dnOffset = 0;
767.95 + String rdnString;
767.96 + int searchOffset = 0;
767.97 + int rdnEnd = dnString.indexOf(',');
767.98 + while (rdnEnd >=0) {
767.99 + /*
767.100 + * We have encountered an RDN delimiter (comma).
767.101 + * If the comma in the RDN under consideration is
767.102 + * preceded by a backslash (escape), it
767.103 + * is part of the RDN. Otherwise, it is used as a separator, to
767.104 + * delimit the RDN under consideration from any subsequent RDNs.
767.105 + */
767.106 + if (rdnEnd > 0 && !escaped(rdnEnd, searchOffset, dnString)) {
767.107
767.108 - int searchOffset = 0;
767.109 - int rdnEnd = dnString.indexOf(',');
767.110 - while (rdnEnd >=0) {
767.111 - /*
767.112 - * We have encountered an RDN delimiter (comma).
767.113 - * If the comma in the RDN under consideration is
767.114 - * preceded by a backslash (escape), it
767.115 - * is part of the RDN. Otherwise, it is used as a separator, to
767.116 - * delimit the RDN under consideration from any subsequent RDNs.
767.117 - */
767.118 - if (rdnEnd > 0 && !escaped(rdnEnd, searchOffset, dnString)) {
767.119 + /*
767.120 + * Comma is a separator
767.121 + */
767.122 + rdnString = dnString.substring(dnOffset, rdnEnd);
767.123
767.124 - /*
767.125 - * Comma is a separator
767.126 - */
767.127 - rdnString = dnString.substring(dnOffset, rdnEnd);
767.128 + // Parse RDN, and store it in vector
767.129 + RDN rdn = new RDN(rdnString, "RFC2253");
767.130 + dnVector.add(rdn);
767.131
767.132 - // Parse RDN, and store it in vector
767.133 - RDN rdn = new RDN(rdnString, "RFC2253");
767.134 - dnVector.add(rdn);
767.135 + // Increase the offset
767.136 + dnOffset = rdnEnd + 1;
767.137 + }
767.138
767.139 - // Increase the offset
767.140 - dnOffset = rdnEnd + 1;
767.141 - }
767.142 + searchOffset = rdnEnd + 1;
767.143 + rdnEnd = dnString.indexOf(',', searchOffset);
767.144 + }
767.145
767.146 - searchOffset = rdnEnd + 1;
767.147 - rdnEnd = dnString.indexOf(',', searchOffset);
767.148 - }
767.149 + // Parse last or only RDN, and store it in vector
767.150 + rdnString = dnString.substring(dnOffset);
767.151 + RDN rdn = new RDN(rdnString, "RFC2253");
767.152 + dnVector.add(rdn);
767.153
767.154 - // Parse last or only RDN, and store it in vector
767.155 - rdnString = dnString.substring(dnOffset);
767.156 - RDN rdn = new RDN(rdnString, "RFC2253");
767.157 - dnVector.add(rdn);
767.158 -
767.159 - /*
767.160 - * Store the vector elements as an array of RDNs
767.161 - * NOTE: It's only on output that little-endian ordering is used.
767.162 - */
767.163 - Collections.reverse(dnVector);
767.164 - names = dnVector.toArray(new RDN[dnVector.size()]);
767.165 + /*
767.166 + * Store the vector elements as an array of RDNs
767.167 + * NOTE: It's only on output that little-endian ordering is used.
767.168 + */
767.169 + Collections.reverse(dnVector);
767.170 + names = dnVector.toArray(new RDN[dnVector.size()]);
767.171 }
767.172
767.173 /*
767.174 @@ -1371,7 +1369,7 @@
767.175 /**
767.176 * Constructor object for use by asX500Principal().
767.177 */
767.178 - private static final Constructor principalConstructor;
767.179 + private static final Constructor<X500Principal> principalConstructor;
767.180
767.181 /**
767.182 * Field object for use by asX500Name().
767.183 @@ -1386,9 +1384,9 @@
767.184 PrivilegedExceptionAction<Object[]> pa =
767.185 new PrivilegedExceptionAction<Object[]>() {
767.186 public Object[] run() throws Exception {
767.187 - Class pClass = X500Principal.class;
767.188 - Class[] args = new Class[] {X500Name.class};
767.189 - Constructor cons = ((Class<?>)pClass).getDeclaredConstructor(args);
767.190 + Class<X500Principal> pClass = X500Principal.class;
767.191 + Class<?>[] args = new Class<?>[] { X500Name.class };
767.192 + Constructor<X500Principal> cons = pClass.getDeclaredConstructor(args);
767.193 cons.setAccessible(true);
767.194 Field field = pClass.getDeclaredField("thisX500Name");
767.195 field.setAccessible(true);
767.196 @@ -1397,11 +1395,13 @@
767.197 };
767.198 try {
767.199 Object[] result = AccessController.doPrivileged(pa);
767.200 - principalConstructor = (Constructor)result[0];
767.201 + @SuppressWarnings("unchecked")
767.202 + Constructor<X500Principal> constr =
767.203 + (Constructor<X500Principal>)result[0];
767.204 + principalConstructor = constr;
767.205 principalField = (Field)result[1];
767.206 } catch (Exception e) {
767.207 - throw (InternalError)new InternalError("Could not obtain "
767.208 - + "X500Principal access").initCause(e);
767.209 + throw new InternalError("Could not obtain X500Principal access", e);
767.210 }
767.211 }
767.212
767.213 @@ -1415,8 +1415,7 @@
767.214 if (x500Principal == null) {
767.215 try {
767.216 Object[] args = new Object[] {this};
767.217 - x500Principal =
767.218 - (X500Principal)principalConstructor.newInstance(args);
767.219 + x500Principal = principalConstructor.newInstance(args);
767.220 } catch (Exception e) {
767.221 throw new RuntimeException("Unexpected exception", e);
767.222 }
768.1 --- a/src/share/classes/sun/security/x509/X509CRLEntryImpl.java Thu Sep 01 13:54:38 2011 -0700
768.2 +++ b/src/share/classes/sun/security/x509/X509CRLEntryImpl.java Mon Sep 05 23:58:19 2011 -0700
768.3 @@ -1,5 +1,5 @@
768.4 /*
768.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
768.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
768.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
768.8 *
768.9 * This code is free software; you can redistribute it and/or modify it
768.10 @@ -25,11 +25,9 @@
768.11
768.12 package sun.security.x509;
768.13
768.14 -import java.io.InputStream;
768.15 import java.io.IOException;
768.16 import java.security.cert.CRLException;
768.17 import java.security.cert.CRLReason;
768.18 -import java.security.cert.CertificateException;
768.19 import java.security.cert.X509CRLEntry;
768.20 import java.math.BigInteger;
768.21 import java.util.Collection;
768.22 @@ -281,7 +279,7 @@
768.23 if (obj == null)
768.24 return null;
768.25 CRLReasonCodeExtension reasonCode = (CRLReasonCodeExtension)obj;
768.26 - return (Integer)(reasonCode.get(reasonCode.REASON));
768.27 + return reasonCode.get(CRLReasonCodeExtension.REASON);
768.28 }
768.29
768.30 /**
768.31 @@ -299,13 +297,13 @@
768.32 sb.append("\n Certificate issuer: " + certIssuer);
768.33 }
768.34 if (extensions != null) {
768.35 - Collection allEntryExts = extensions.getAllExtensions();
768.36 - Object[] objs = allEntryExts.toArray();
768.37 + Collection<Extension> allEntryExts = extensions.getAllExtensions();
768.38 + Extension[] exts = allEntryExts.toArray(new Extension[0]);
768.39
768.40 - sb.append("\n CRL Entry Extensions: " + objs.length);
768.41 - for (int i = 0; i < objs.length; i++) {
768.42 + sb.append("\n CRL Entry Extensions: " + exts.length);
768.43 + for (int i = 0; i < exts.length; i++) {
768.44 sb.append("\n [" + (i+1) + "]: ");
768.45 - Extension ext = (Extension)objs[i];
768.46 + Extension ext = exts[i];
768.47 try {
768.48 if (OIDMap.getClass(ext.getExtensionId()) == null) {
768.49 sb.append(ext.toString());
768.50 @@ -409,7 +407,7 @@
768.51 e.hasMoreElements();) {
768.52 ex = e.nextElement();
768.53 inCertOID = ex.getExtensionId();
768.54 - if (inCertOID.equals(findOID)) {
768.55 + if (inCertOID.equals((Object)findOID)) {
768.56 crlExt = ex;
768.57 break;
768.58 }
769.1 --- a/src/share/classes/sun/security/x509/X509CRLImpl.java Thu Sep 01 13:54:38 2011 -0700
769.2 +++ b/src/share/classes/sun/security/x509/X509CRLImpl.java Mon Sep 05 23:58:19 2011 -0700
769.3 @@ -1,5 +1,5 @@
769.4 /*
769.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
769.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
769.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
769.8 *
769.9 * This code is free software; you can redistribute it and/or modify it
769.10 @@ -32,7 +32,6 @@
769.11 import java.security.Principal;
769.12 import java.security.PublicKey;
769.13 import java.security.PrivateKey;
769.14 -import java.security.Security;
769.15 import java.security.Signature;
769.16 import java.security.NoSuchAlgorithmException;
769.17 import java.security.InvalidKeyException;
769.18 @@ -782,7 +781,8 @@
769.19 public KeyIdentifier getAuthKeyId() throws IOException {
769.20 AuthorityKeyIdentifierExtension aki = getAuthKeyIdExtension();
769.21 if (aki != null) {
769.22 - KeyIdentifier keyId = (KeyIdentifier)aki.get(aki.KEY_ID);
769.23 + KeyIdentifier keyId = (KeyIdentifier)aki.get(
769.24 + AuthorityKeyIdentifierExtension.KEY_ID);
769.25 return keyId;
769.26 } else {
769.27 return null;
769.28 @@ -821,7 +821,7 @@
769.29 public BigInteger getCRLNumber() throws IOException {
769.30 CRLNumberExtension numExt = getCRLNumberExtension();
769.31 if (numExt != null) {
769.32 - BigInteger num = (BigInteger)numExt.get(numExt.NUMBER);
769.33 + BigInteger num = numExt.get(CRLNumberExtension.NUMBER);
769.34 return num;
769.35 } else {
769.36 return null;
769.37 @@ -850,7 +850,7 @@
769.38 public BigInteger getBaseCRLNumber() throws IOException {
769.39 DeltaCRLIndicatorExtension dciExt = getDeltaCRLIndicatorExtension();
769.40 if (dciExt != null) {
769.41 - BigInteger num = (BigInteger)dciExt.get(dciExt.NUMBER);
769.42 + BigInteger num = dciExt.get(DeltaCRLIndicatorExtension.NUMBER);
769.43 return num;
769.44 } else {
769.45 return null;
769.46 @@ -961,7 +961,7 @@
769.47 e.hasMoreElements();) {
769.48 ex = e.nextElement();
769.49 inCertOID = ex.getExtensionId();
769.50 - if (inCertOID.equals(findOID)) {
769.51 + if (inCertOID.equals((Object)findOID)) {
769.52 crlExt = ex;
769.53 break;
769.54 }
769.55 @@ -1189,8 +1189,7 @@
769.56 CertificateIssuerExtension ciExt =
769.57 entry.getCertificateIssuerExtension();
769.58 if (ciExt != null) {
769.59 - GeneralNames names = (GeneralNames)
769.60 - ciExt.get(CertificateIssuerExtension.ISSUER);
769.61 + GeneralNames names = ciExt.get(CertificateIssuerExtension.ISSUER);
769.62 X500Name issuerDN = (X500Name) names.get(0).getName();
769.63 return issuerDN.asX500Principal();
769.64 } else {
770.1 --- a/src/share/classes/sun/security/x509/X509CertImpl.java Thu Sep 01 13:54:38 2011 -0700
770.2 +++ b/src/share/classes/sun/security/x509/X509CertImpl.java Mon Sep 05 23:58:19 2011 -0700
770.3 @@ -1,5 +1,5 @@
770.4 /*
770.5 - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
770.6 + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
770.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
770.8 *
770.9 * This code is free software; you can redistribute it and/or modify it
770.10 @@ -196,10 +196,7 @@
770.11 parse(new DerValue(certData));
770.12 } catch (IOException e) {
770.13 signedCert = null;
770.14 - CertificateException ce = new
770.15 - CertificateException("Unable to initialize, " + e);
770.16 - ce.initCause(e);
770.17 - throw ce;
770.18 + throw new CertificateException("Unable to initialize, " + e, e);
770.19 }
770.20 }
770.21
770.22 @@ -231,25 +228,19 @@
770.23 inBuffered.reset();
770.24 der = new DerValue(inBuffered);
770.25 } catch (IOException ioe1) {
770.26 - CertificateException ce = new
770.27 - CertificateException("Input stream must be " +
770.28 - "either DER-encoded bytes " +
770.29 - "or RFC1421 hex-encoded " +
770.30 - "DER-encoded bytes: " +
770.31 - ioe1.getMessage());
770.32 - ce.initCause(ioe1);
770.33 - throw ce;
770.34 + throw new CertificateException("Input stream must be " +
770.35 + "either DER-encoded bytes " +
770.36 + "or RFC1421 hex-encoded " +
770.37 + "DER-encoded bytes: " +
770.38 + ioe1.getMessage(), ioe1);
770.39 }
770.40 }
770.41 try {
770.42 parse(der);
770.43 } catch (IOException ioe) {
770.44 signedCert = null;
770.45 - CertificateException ce = new
770.46 - CertificateException("Unable to parse DER value of " +
770.47 - "certificate, " + ioe);
770.48 - ce.initCause(ioe);
770.49 - throw ce;
770.50 + throw new CertificateException("Unable to parse DER value of " +
770.51 + "certificate, " + ioe, ioe);
770.52 }
770.53 }
770.54
770.55 @@ -320,10 +311,7 @@
770.56 parse(derVal);
770.57 } catch (IOException e) {
770.58 signedCert = null;
770.59 - CertificateException ce = new
770.60 - CertificateException("Unable to initialize, " + e);
770.61 - ce.initCause(e);
770.62 - throw ce;
770.63 + throw new CertificateException("Unable to initialize, " + e, e);
770.64 }
770.65 }
770.66
770.67 @@ -1279,7 +1267,7 @@
770.68 return null;
770.69 } else {
770.70 for (Extension ex : extensions.getAllExtensions()) {
770.71 - if (ex.getExtensionId().equals(oid)) {
770.72 + if (ex.getExtensionId().equals((Object)oid)) {
770.73 //XXXX May want to consider cloning this
770.74 return ex;
770.75 }
770.76 @@ -1434,10 +1422,7 @@
770.77 new ExtendedKeyUsageExtension(Boolean.FALSE, data);
770.78 return Collections.unmodifiableList(ekuExt.getExtendedKeyUsage());
770.79 } catch (IOException ioe) {
770.80 - CertificateParsingException cpe =
770.81 - new CertificateParsingException();
770.82 - cpe.initCause(ioe);
770.83 - throw cpe;
770.84 + throw new CertificateParsingException(ioe);
770.85 }
770.86 }
770.87
770.88 @@ -1578,8 +1563,8 @@
770.89 }
770.90 GeneralNames names;
770.91 try {
770.92 - names = (GeneralNames) subjectAltNameExt.get
770.93 - (SubjectAlternativeNameExtension.SUBJECT_NAME);
770.94 + names = subjectAltNameExt.get(
770.95 + SubjectAlternativeNameExtension.SUBJECT_NAME);
770.96 } catch (IOException ioe) {
770.97 // should not occur
770.98 return Collections.<List<?>>emptySet();
770.99 @@ -1610,18 +1595,15 @@
770.100
770.101 GeneralNames names;
770.102 try {
770.103 - names = (GeneralNames) subjectAltNameExt.get
770.104 - (SubjectAlternativeNameExtension.SUBJECT_NAME);
770.105 + names = subjectAltNameExt.get(
770.106 + SubjectAlternativeNameExtension.SUBJECT_NAME);
770.107 } catch (IOException ioe) {
770.108 // should not occur
770.109 return Collections.<List<?>>emptySet();
770.110 }
770.111 return makeAltNames(names);
770.112 } catch (IOException ioe) {
770.113 - CertificateParsingException cpe =
770.114 - new CertificateParsingException();
770.115 - cpe.initCause(ioe);
770.116 - throw cpe;
770.117 + throw new CertificateParsingException(ioe);
770.118 }
770.119 }
770.120
770.121 @@ -1644,8 +1626,8 @@
770.122 }
770.123 GeneralNames names;
770.124 try {
770.125 - names = (GeneralNames) issuerAltNameExt.get
770.126 - (IssuerAlternativeNameExtension.ISSUER_NAME);
770.127 + names = issuerAltNameExt.get(
770.128 + IssuerAlternativeNameExtension.ISSUER_NAME);
770.129 } catch (IOException ioe) {
770.130 // should not occur
770.131 return Collections.<List<?>>emptySet();
770.132 @@ -1676,18 +1658,15 @@
770.133 data);
770.134 GeneralNames names;
770.135 try {
770.136 - names = (GeneralNames) issuerAltNameExt.get
770.137 - (IssuerAlternativeNameExtension.ISSUER_NAME);
770.138 + names = issuerAltNameExt.get(
770.139 + IssuerAlternativeNameExtension.ISSUER_NAME);
770.140 } catch (IOException ioe) {
770.141 // should not occur
770.142 return Collections.<List<?>>emptySet();
770.143 }
770.144 return makeAltNames(names);
770.145 } catch (IOException ioe) {
770.146 - CertificateParsingException cpe =
770.147 - new CertificateParsingException();
770.148 - cpe.initCause(ioe);
770.149 - throw cpe;
770.150 + throw new CertificateParsingException(ioe);
770.151 }
770.152 }
770.153
771.1 --- a/src/share/classes/sun/security/x509/X509CertInfo.java Thu Sep 01 13:54:38 2011 -0700
771.2 +++ b/src/share/classes/sun/security/x509/X509CertInfo.java Mon Sep 05 23:58:19 2011 -0700
771.3 @@ -1,5 +1,5 @@
771.4 /*
771.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
771.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
771.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
771.8 *
771.9 * This code is free software; you can redistribute it and/or modify it
771.10 @@ -149,10 +149,7 @@
771.11
771.12 parse(in);
771.13 } catch (IOException e) {
771.14 - CertificateParsingException parseException =
771.15 - new CertificateParsingException(e.toString());
771.16 - parseException.initCause(e);
771.17 - throw parseException;
771.18 + throw new CertificateParsingException(e);
771.19 }
771.20 }
771.21
771.22 @@ -168,10 +165,7 @@
771.23 try {
771.24 parse(derVal);
771.25 } catch (IOException e) {
771.26 - CertificateParsingException parseException =
771.27 - new CertificateParsingException(e.toString());
771.28 - parseException.initCause(e);
771.29 - throw parseException;
771.30 + throw new CertificateParsingException(e);
771.31 }
771.32 }
771.33
771.34 @@ -319,12 +313,12 @@
771.35 sb.append(" Subject Id:\n" + subjectUniqueId.toString() + "\n");
771.36 }
771.37 if (extensions != null) {
771.38 - Collection allExts = extensions.getAllExtensions();
771.39 - Object[] objs = allExts.toArray();
771.40 - sb.append("\nCertificate Extensions: " + objs.length);
771.41 - for (int i = 0; i < objs.length; i++) {
771.42 + Collection<Extension> allExts = extensions.getAllExtensions();
771.43 + Extension[] exts = allExts.toArray(new Extension[0]);
771.44 + sb.append("\nCertificate Extensions: " + exts.length);
771.45 + for (int i = 0; i < exts.length; i++) {
771.46 sb.append("\n[" + (i+1) + "]: ");
771.47 - Extension ext = (Extension)objs[i];
771.48 + Extension ext = exts[i];
771.49 try {
771.50 if (OIDMap.getClass(ext.getExtensionId()) == null) {
771.51 sb.append(ext.toString());
771.52 @@ -766,8 +760,8 @@
771.53 try {
771.54 subjectAltNameExt = (SubjectAlternativeNameExtension)
771.55 extensions.get(SubjectAlternativeNameExtension.NAME);
771.56 - names = (GeneralNames) subjectAltNameExt.get
771.57 - (SubjectAlternativeNameExtension.SUBJECT_NAME);
771.58 + names = subjectAltNameExt.get(
771.59 + SubjectAlternativeNameExtension.SUBJECT_NAME);
771.60 } catch (IOException e) {
771.61 throw new CertificateParsingException("X.509 Certificate is " +
771.62 "incomplete: subject field is empty, and " +
772.1 --- a/src/share/classes/sun/security/x509/X509Key.java Thu Sep 01 13:54:38 2011 -0700
772.2 +++ b/src/share/classes/sun/security/x509/X509Key.java Mon Sep 05 23:58:19 2011 -0700
772.3 @@ -1,5 +1,5 @@
772.4 /*
772.5 - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
772.6 + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
772.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
772.8 *
772.9 * This code is free software; you can redistribute it and/or modify it
772.10 @@ -31,7 +31,6 @@
772.11 import java.security.Key;
772.12 import java.security.PublicKey;
772.13 import java.security.KeyFactory;
772.14 -import java.security.KeyRep;
772.15 import java.security.Security;
772.16 import java.security.Provider;
772.17 import java.security.InvalidKeyException;
772.18 @@ -245,7 +244,7 @@
772.19 throw new InstantiationException();
772.20 }
772.21
772.22 - Class keyClass = null;
772.23 + Class<?> keyClass = null;
772.24 try {
772.25 keyClass = Class.forName(classname);
772.26 } catch (ClassNotFoundException e) {
773.1 --- a/src/share/classes/sun/swing/PrintingStatus.java Thu Sep 01 13:54:38 2011 -0700
773.2 +++ b/src/share/classes/sun/swing/PrintingStatus.java Mon Sep 05 23:58:19 2011 -0700
773.3 @@ -43,8 +43,8 @@
773.4 * <p/>
773.5 * Methods of these class are thread safe, although most Swing methods
773.6 * are not. Please see
773.7 - * <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How
773.8 - * to Use Threads</A> for more information.
773.9 + * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
773.10 + * in Swing</A> for more information.
773.11 *
773.12 * @author Alexander Potochkin
773.13 * @since 1.6
774.1 --- a/src/share/classes/sun/tools/jconsole/ProxyClient.java Thu Sep 01 13:54:38 2011 -0700
774.2 +++ b/src/share/classes/sun/tools/jconsole/ProxyClient.java Mon Sep 05 23:58:19 2011 -0700
774.3 @@ -208,7 +208,7 @@
774.4 serverStubClass = Class.forName(rmiServerImplStubClassName).asSubclass(Remote.class);
774.5 } catch (ClassNotFoundException e) {
774.6 // should never reach here
774.7 - throw (InternalError) new InternalError(e.getMessage()).initCause(e);
774.8 + throw new InternalError(e.getMessage(), e);
774.9 }
774.10 rmiServerImplStubClass = serverStubClass;
774.11 }
774.12 @@ -395,18 +395,10 @@
774.13 } catch (MalformedObjectNameException e) {
774.14 // should not reach here
774.15 throw new InternalError(e.getMessage());
774.16 - } catch (IntrospectionException e) {
774.17 - InternalError ie = new InternalError(e.getMessage());
774.18 - ie.initCause(e);
774.19 - throw ie;
774.20 - } catch (InstanceNotFoundException e) {
774.21 - InternalError ie = new InternalError(e.getMessage());
774.22 - ie.initCause(e);
774.23 - throw ie;
774.24 - } catch (ReflectionException e) {
774.25 - InternalError ie = new InternalError(e.getMessage());
774.26 - ie.initCause(e);
774.27 - throw ie;
774.28 + } catch (IntrospectionException |
774.29 + InstanceNotFoundException |
774.30 + ReflectionException e) {
774.31 + throw new InternalError(e.getMessage(), e);
774.32 }
774.33
774.34 if (hasPlatformMXBeans) {
775.1 --- a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java Thu Sep 01 13:54:38 2011 -0700
775.2 +++ b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java Mon Sep 05 23:58:19 2011 -0700
775.3 @@ -40,6 +40,7 @@
775.4
775.5 package com.sun.nio.zipfs;
775.6
775.7 +import java.io.BufferedOutputStream;
775.8 import java.io.ByteArrayInputStream;
775.9 import java.io.ByteArrayOutputStream;
775.10 import java.io.EOFException;
775.11 @@ -1174,7 +1175,6 @@
775.12 // sync the zip file system, if there is any udpate
775.13 private void sync() throws IOException {
775.14 //System.out.printf("->sync(%s) starting....!%n", toString());
775.15 -
775.16 // check ex-closer
775.17 if (!exChClosers.isEmpty()) {
775.18 for (ExChannelCloser ecc : exChClosers) {
775.19 @@ -1188,84 +1188,84 @@
775.20 if (!hasUpdate)
775.21 return;
775.22 Path tmpFile = createTempFileInSameDirectoryAs(zfpath);
775.23 - OutputStream os = Files.newOutputStream(tmpFile, WRITE);
775.24 - ArrayList<Entry> elist = new ArrayList<>(inodes.size());
775.25 - long written = 0;
775.26 - byte[] buf = new byte[8192];
775.27 - Entry e = null;
775.28 + try (OutputStream os = new BufferedOutputStream(Files.newOutputStream(tmpFile, WRITE)))
775.29 + {
775.30 + ArrayList<Entry> elist = new ArrayList<>(inodes.size());
775.31 + long written = 0;
775.32 + byte[] buf = new byte[8192];
775.33 + Entry e = null;
775.34
775.35 - // write loc
775.36 - for (IndexNode inode : inodes.values()) {
775.37 - if (inode instanceof Entry) { // an updated inode
775.38 - e = (Entry)inode;
775.39 - try {
775.40 - if (e.type == Entry.COPY) {
775.41 - // entry copy: the only thing changed is the "name"
775.42 - // and "nlen" in LOC header, so we udpate/rewrite the
775.43 - // LOC in new file and simply copy the rest (data and
775.44 - // ext) without enflating/deflating from the old zip
775.45 - // file LOC entry.
775.46 - written += copyLOCEntry(e, true, os, written, buf);
775.47 - } else { // NEW, FILECH or CEN
775.48 - e.locoff = written;
775.49 - written += e.writeLOC(os); // write loc header
775.50 - if (e.bytes != null) { // in-memory, deflated
775.51 - os.write(e.bytes); // already
775.52 - written += e.bytes.length;
775.53 - } else if (e.file != null) { // tmp file
775.54 - try (InputStream is = Files.newInputStream(e.file)) {
775.55 - int n;
775.56 - if (e.type == Entry.NEW) { // deflated already
775.57 - while ((n = is.read(buf)) != -1) {
775.58 - os.write(buf, 0, n);
775.59 - written += n;
775.60 + // write loc
775.61 + for (IndexNode inode : inodes.values()) {
775.62 + if (inode instanceof Entry) { // an updated inode
775.63 + e = (Entry)inode;
775.64 + try {
775.65 + if (e.type == Entry.COPY) {
775.66 + // entry copy: the only thing changed is the "name"
775.67 + // and "nlen" in LOC header, so we udpate/rewrite the
775.68 + // LOC in new file and simply copy the rest (data and
775.69 + // ext) without enflating/deflating from the old zip
775.70 + // file LOC entry.
775.71 + written += copyLOCEntry(e, true, os, written, buf);
775.72 + } else { // NEW, FILECH or CEN
775.73 + e.locoff = written;
775.74 + written += e.writeLOC(os); // write loc header
775.75 + if (e.bytes != null) { // in-memory, deflated
775.76 + os.write(e.bytes); // already
775.77 + written += e.bytes.length;
775.78 + } else if (e.file != null) { // tmp file
775.79 + try (InputStream is = Files.newInputStream(e.file)) {
775.80 + int n;
775.81 + if (e.type == Entry.NEW) { // deflated already
775.82 + while ((n = is.read(buf)) != -1) {
775.83 + os.write(buf, 0, n);
775.84 + written += n;
775.85 + }
775.86 + } else if (e.type == Entry.FILECH) {
775.87 + // the data are not deflated, use ZEOS
775.88 + try (OutputStream os2 = new EntryOutputStream(e, os)) {
775.89 + while ((n = is.read(buf)) != -1) {
775.90 + os2.write(buf, 0, n);
775.91 + }
775.92 + }
775.93 + written += e.csize;
775.94 + if ((e.flag & FLAG_DATADESCR) != 0)
775.95 + written += e.writeEXT(os);
775.96 }
775.97 - } else if (e.type == Entry.FILECH) {
775.98 - // the data are not deflated, use ZEOS
775.99 - try (OutputStream os2 = new EntryOutputStream(e, os)) {
775.100 - while ((n = is.read(buf)) != -1) {
775.101 - os2.write(buf, 0, n);
775.102 - }
775.103 - }
775.104 - written += e.csize;
775.105 - if ((e.flag & FLAG_DATADESCR) != 0)
775.106 - written += e.writeEXT(os);
775.107 }
775.108 + Files.delete(e.file);
775.109 + tmppaths.remove(e.file);
775.110 + } else {
775.111 + // dir, 0-length data
775.112 }
775.113 - Files.delete(e.file);
775.114 - tmppaths.remove(e.file);
775.115 - } else {
775.116 - // dir, 0-length data
775.117 }
775.118 + elist.add(e);
775.119 + } catch (IOException x) {
775.120 + x.printStackTrace(); // skip any in-accurate entry
775.121 }
775.122 - elist.add(e);
775.123 - } catch (IOException x) {
775.124 - x.printStackTrace(); // skip any in-accurate entry
775.125 - }
775.126 - } else { // unchanged inode
775.127 - if (inode.pos == -1) {
775.128 - continue; // pseudo directory node
775.129 - }
775.130 - e = Entry.readCEN(this, inode.pos);
775.131 - try {
775.132 - written += copyLOCEntry(e, false, os, written, buf);
775.133 - elist.add(e);
775.134 - } catch (IOException x) {
775.135 - x.printStackTrace(); // skip any wrong entry
775.136 + } else { // unchanged inode
775.137 + if (inode.pos == -1) {
775.138 + continue; // pseudo directory node
775.139 + }
775.140 + e = Entry.readCEN(this, inode.pos);
775.141 + try {
775.142 + written += copyLOCEntry(e, false, os, written, buf);
775.143 + elist.add(e);
775.144 + } catch (IOException x) {
775.145 + x.printStackTrace(); // skip any wrong entry
775.146 + }
775.147 }
775.148 }
775.149 +
775.150 + // now write back the cen and end table
775.151 + end.cenoff = written;
775.152 + for (Entry entry : elist) {
775.153 + written += entry.writeCEN(os);
775.154 + }
775.155 + end.centot = elist.size();
775.156 + end.cenlen = written - end.cenoff;
775.157 + end.write(os, written);
775.158 }
775.159 -
775.160 - // now write back the cen and end table
775.161 - end.cenoff = written;
775.162 - for (Entry entry : elist) {
775.163 - written += entry.writeCEN(os);
775.164 - }
775.165 - end.centot = elist.size();
775.166 - end.cenlen = written - end.cenoff;
775.167 - end.write(os, written);
775.168 - os.close();
775.169 -
775.170 if (!streams.isEmpty()) {
775.171 //
775.172 // TBD: ExChannelCloser should not be necessary if we only
775.173 @@ -1968,7 +1968,7 @@
775.174 writeBytes(os, name);
775.175 if (elen64 != 0) {
775.176 writeShort(os, EXTID_ZIP64);// Zip64 extra
775.177 - writeShort(os, elen64); // size of "this" extra block
775.178 + writeShort(os, elen64 - 4); // size of "this" extra block
775.179 if (size0 == ZIP64_MINVAL)
775.180 writeLong(os, size);
775.181 if (csize0 == ZIP64_MINVAL)
776.1 --- a/src/solaris/classes/sun/awt/X11/XToolkit.java Thu Sep 01 13:54:38 2011 -0700
776.2 +++ b/src/solaris/classes/sun/awt/X11/XToolkit.java Mon Sep 05 23:58:19 2011 -0700
776.3 @@ -1532,6 +1532,10 @@
776.4 }
776.5
776.6 public synchronized void addPropertyChangeListener(String name, PropertyChangeListener pcl) {
776.7 + if (name == null) {
776.8 + // See JavaDoc for the Toolkit.addPropertyChangeListener() method
776.9 + return;
776.10 + }
776.11 initXSettingsIfNeeded(name);
776.12 super.addPropertyChangeListener(name, pcl);
776.13 }
777.1 --- a/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java Thu Sep 01 13:54:38 2011 -0700
777.2 +++ b/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java Mon Sep 05 23:58:19 2011 -0700
777.3 @@ -95,11 +95,11 @@
777.4 }
777.5
777.6 // Now check for XRender system property
777.7 - boolean xRenderRequested = false;
777.8 + boolean xRenderRequested = true;
777.9 String xProp = System.getProperty("sun.java2d.xrender");
777.10 if (xProp != null) {
777.11 - if (xProp.equals("true") || xProp.equals("t")) {
777.12 - xRenderRequested = true;
777.13 + if (xProp.equals("false") || xProp.equals("f")) {
777.14 + xRenderRequested = false;
777.15 } else if (xProp.equals("True") || xProp.equals("T")) {
777.16 xRenderRequested = true;
777.17 xRenderVerbose = true;
778.1 --- a/src/solaris/classes/sun/nio/ch/InheritedChannel.java Thu Sep 01 13:54:38 2011 -0700
778.2 +++ b/src/solaris/classes/sun/nio/ch/InheritedChannel.java Mon Sep 05 23:58:19 2011 -0700
778.3 @@ -166,8 +166,8 @@
778.4 // is implemented.
778.5
778.6 Class paramTypes[] = { int.class };
778.7 - Constructor ctr = Reflect.lookupConstructor("java.io.FileDescriptor",
778.8 - paramTypes);
778.9 + Constructor<?> ctr = Reflect.lookupConstructor("java.io.FileDescriptor",
778.10 + paramTypes);
778.11 Object args[] = { new Integer(fdVal) };
778.12 FileDescriptor fd = (FileDescriptor)Reflect.invoke(ctr, args);
778.13
779.1 --- a/src/solaris/classes/sun/nio/fs/LinuxWatchService.java Thu Sep 01 13:54:38 2011 -0700
779.2 +++ b/src/solaris/classes/sun/nio/fs/LinuxWatchService.java Mon Sep 05 23:58:19 2011 -0700
779.3 @@ -58,7 +58,10 @@
779.4 try {
779.5 ifd = inotifyInit();
779.6 } catch (UnixException x) {
779.7 - throw new IOException(x.errorString());
779.8 + String msg = (x.errno() == EMFILE) ?
779.9 + "User limit of inotify instances reached or too many open files" :
779.10 + x.errorString();
779.11 + throw new IOException(msg);
779.12 }
779.13
779.14 // configure inotify to be non-blocking
780.1 --- a/src/solaris/lib/content-types.properties Thu Sep 01 13:54:38 2011 -0700
780.2 +++ b/src/solaris/lib/content-types.properties Mon Sep 05 23:58:19 2011 -0700
780.3 @@ -225,6 +225,10 @@
780.4 icon=png;\
780.5 action=browser
780.6
780.7 +image/bmp: \
780.8 + description=Bitmap Image;\
780.9 + file_extensions=.bmp;
780.10 +
780.11 text/html: \
780.12 description=HTML Document;\
780.13 file_extensions=.htm,.html;\
781.1 --- a/src/solaris/native/sun/nio/fs/genUnixConstants.c Thu Sep 01 13:54:38 2011 -0700
781.2 +++ b/src/solaris/native/sun/nio/fs/genUnixConstants.c Mon Sep 05 23:58:19 2011 -0700
781.3 @@ -108,6 +108,7 @@
781.4 DEF(EROFS);
781.5 DEF(ENODATA);
781.6 DEF(ERANGE);
781.7 + DEF(EMFILE);
781.8
781.9 // flags used with openat/unlinkat/etc.
781.10 #if defined(AT_SYMLINK_NOFOLLOW) && defined(AT_REMOVEDIR)
782.1 --- a/src/windows/classes/sun/awt/windows/WToolkit.java Thu Sep 01 13:54:38 2011 -0700
782.2 +++ b/src/windows/classes/sun/awt/windows/WToolkit.java Mon Sep 05 23:58:19 2011 -0700
782.3 @@ -879,6 +879,10 @@
782.4 }
782.5
782.6 public synchronized void addPropertyChangeListener(String name, PropertyChangeListener pcl) {
782.7 + if (name == null) {
782.8 + // See JavaDoc for the Toolkit.addPropertyChangeListener() method
782.9 + return;
782.10 + }
782.11 if ( WDesktopProperties.isWindowsProperty(name)
782.12 || name.startsWith(awtPrefix)
782.13 || name.startsWith(dndPrefix))
783.1 --- a/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java Thu Sep 01 13:54:38 2011 -0700
783.2 +++ b/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java Mon Sep 05 23:58:19 2011 -0700
783.3 @@ -55,9 +55,7 @@
783.4 try {
783.5 return new Iocp(null, ThreadPool.createDefault()).start();
783.6 } catch (IOException ioe) {
783.7 - InternalError e = new InternalError();
783.8 - e.initCause(ioe);
783.9 - throw e;
783.10 + throw new InternalError(ioe);
783.11 }
783.12 }
783.13 }
784.1 --- a/src/windows/classes/sun/security/mscapi/KeyStore.java Thu Sep 01 13:54:38 2011 -0700
784.2 +++ b/src/windows/classes/sun/security/mscapi/KeyStore.java Mon Sep 05 23:58:19 2011 -0700
784.3 @@ -29,7 +29,6 @@
784.4 import java.io.IOException;
784.5 import java.io.InputStream;
784.6 import java.io.OutputStream;
784.7 -import java.math.BigInteger;
784.8 import java.security.AccessController;
784.9 import java.security.InvalidKeyException;
784.10 import java.security.KeyStoreSpi;
784.11 @@ -40,7 +39,6 @@
784.12 import java.security.cert.X509Certificate;
784.13 import java.security.cert.Certificate;
784.14 import java.security.cert.CertificateException;
784.15 -import java.security.cert.CertificateEncodingException;
784.16 import java.security.cert.CertificateFactory;
784.17 import java.security.interfaces.RSAPrivateCrtKey;
784.18 import java.util.ArrayList;
784.19 @@ -564,20 +562,20 @@
784.20 *
784.21 * @return enumeration of the alias names
784.22 */
784.23 - public Enumeration engineAliases() {
784.24 + public Enumeration<String> engineAliases() {
784.25
784.26 - final Iterator iter = entries.iterator();
784.27 + final Iterator<KeyEntry> iter = entries.iterator();
784.28
784.29 - return new Enumeration()
784.30 + return new Enumeration<String>()
784.31 {
784.32 public boolean hasMoreElements()
784.33 {
784.34 return iter.hasNext();
784.35 }
784.36
784.37 - public Object nextElement()
784.38 + public String nextElement()
784.39 {
784.40 - KeyEntry entry = (KeyEntry) iter.next();
784.41 + KeyEntry entry = iter.next();
784.42 return entry.getAlias();
784.43 }
784.44 };
784.45 @@ -591,10 +589,10 @@
784.46 * @return true if the alias exists, false otherwise
784.47 */
784.48 public boolean engineContainsAlias(String alias) {
784.49 - for (Enumeration enumerator = engineAliases();
784.50 + for (Enumeration<String> enumerator = engineAliases();
784.51 enumerator.hasMoreElements();)
784.52 {
784.53 - String a = (String) enumerator.nextElement();
784.54 + String a = enumerator.nextElement();
784.55
784.56 if (a.equals(alias))
784.57 return true;
784.58 @@ -774,7 +772,8 @@
784.59 * certificates and stores the result into a key entry.
784.60 */
784.61 private void generateCertificateChain(String alias,
784.62 - Collection certCollection, Collection<KeyEntry> entries)
784.63 + Collection<? extends Certificate> certCollection,
784.64 + Collection<KeyEntry> entries)
784.65 {
784.66 try
784.67 {
784.68 @@ -782,7 +781,8 @@
784.69 new X509Certificate[certCollection.size()];
784.70
784.71 int i = 0;
784.72 - for (Iterator iter=certCollection.iterator(); iter.hasNext(); i++)
784.73 + for (Iterator<? extends Certificate> iter =
784.74 + certCollection.iterator(); iter.hasNext(); i++)
784.75 {
784.76 certChain[i] = (X509Certificate) iter.next();
784.77 }
784.78 @@ -805,7 +805,8 @@
784.79 */
784.80 private void generateRSAKeyAndCertificateChain(String alias,
784.81 long hCryptProv, long hCryptKey, int keyLength,
784.82 - Collection certCollection, Collection<KeyEntry> entries)
784.83 + Collection<? extends Certificate> certCollection,
784.84 + Collection<KeyEntry> entries)
784.85 {
784.86 try
784.87 {
784.88 @@ -813,7 +814,8 @@
784.89 new X509Certificate[certCollection.size()];
784.90
784.91 int i = 0;
784.92 - for (Iterator iter=certCollection.iterator(); iter.hasNext(); i++)
784.93 + for (Iterator<? extends Certificate> iter =
784.94 + certCollection.iterator(); iter.hasNext(); i++)
784.95 {
784.96 certChain[i] = (X509Certificate) iter.next();
784.97 }
784.98 @@ -837,8 +839,8 @@
784.99 * @param data Byte data.
784.100 * @param certCollection Collection of certificates.
784.101 */
784.102 - private void generateCertificate(byte[] data, Collection certCollection)
784.103 - {
784.104 + private void generateCertificate(byte[] data,
784.105 + Collection<Certificate> certCollection) {
784.106 try
784.107 {
784.108 ByteArrayInputStream bis = new ByteArrayInputStream(data);
784.109 @@ -849,7 +851,8 @@
784.110 }
784.111
784.112 // Generate certificate
784.113 - Collection c = certificateFactory.generateCertificates(bis);
784.114 + Collection<? extends Certificate> c =
784.115 + certificateFactory.generateCertificates(bis);
784.116 certCollection.addAll(c);
784.117 }
784.118 catch (CertificateException e)
785.1 --- a/src/windows/classes/sun/security/mscapi/PRNG.java Thu Sep 01 13:54:38 2011 -0700
785.2 +++ b/src/windows/classes/sun/security/mscapi/PRNG.java Mon Sep 05 23:58:19 2011 -0700
785.3 @@ -1,5 +1,5 @@
785.4 /*
785.5 - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
785.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
785.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
785.8 *
785.9 * This code is free software; you can redistribute it and/or modify it
785.10 @@ -37,8 +37,7 @@
785.11 public final class PRNG extends SecureRandomSpi
785.12 implements java.io.Serializable {
785.13
785.14 - // TODO - generate the serialVersionUID
785.15 - //private static final long serialVersionUID = XXX;
785.16 + private static final long serialVersionUID = 4129268715132691532L;
785.17
785.18 /*
785.19 * The CryptGenRandom function fills a buffer with cryptographically random
786.1 --- a/src/windows/classes/sun/security/mscapi/RSAPrivateKey.java Thu Sep 01 13:54:38 2011 -0700
786.2 +++ b/src/windows/classes/sun/security/mscapi/RSAPrivateKey.java Mon Sep 05 23:58:19 2011 -0700
786.3 @@ -1,5 +1,5 @@
786.4 /*
786.5 - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
786.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
786.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
786.8 *
786.9 * This code is free software; you can redistribute it and/or modify it
786.10 @@ -35,6 +35,8 @@
786.11 */
786.12 class RSAPrivateKey extends Key implements PrivateKey
786.13 {
786.14 + private static final long serialVersionUID = 8113152807912338063L;
786.15 +
786.16 /**
786.17 * Construct an RSAPrivateKey object.
786.18 */
787.1 --- a/src/windows/classes/sun/security/mscapi/RSAPublicKey.java Thu Sep 01 13:54:38 2011 -0700
787.2 +++ b/src/windows/classes/sun/security/mscapi/RSAPublicKey.java Mon Sep 05 23:58:19 2011 -0700
787.3 @@ -26,11 +26,9 @@
787.4 package sun.security.mscapi;
787.5
787.6 import java.math.BigInteger;
787.7 -import java.security.InvalidKeyException;
787.8 import java.security.KeyException;
787.9 import java.security.KeyRep;
787.10 import java.security.ProviderException;
787.11 -import java.security.PublicKey;
787.12
787.13 import sun.security.rsa.RSAPublicKeyImpl;
787.14
787.15 @@ -41,6 +39,8 @@
787.16 */
787.17 class RSAPublicKey extends Key implements java.security.interfaces.RSAPublicKey
787.18 {
787.19 + private static final long serialVersionUID = -2289561342425825391L;
787.20 +
787.21 private byte[] publicKeyBlob = null;
787.22 private byte[] encoding = null;
787.23 private BigInteger modulus = null;
788.1 --- a/src/windows/classes/sun/security/mscapi/RSASignature.java Thu Sep 01 13:54:38 2011 -0700
788.2 +++ b/src/windows/classes/sun/security/mscapi/RSASignature.java Mon Sep 05 23:58:19 2011 -0700
788.3 @@ -30,14 +30,10 @@
788.4 import java.security.PrivateKey;
788.5 import java.security.InvalidKeyException;
788.6 import java.security.InvalidParameterException;
788.7 -import java.security.InvalidAlgorithmParameterException;
788.8 import java.security.KeyStoreException;
788.9 import java.security.NoSuchAlgorithmException;
788.10 import java.security.ProviderException;
788.11 import java.security.MessageDigest;
788.12 -import java.security.SecureRandom;
788.13 -import java.security.Signature;
788.14 -import java.security.SignatureSpi;
788.15 import java.security.SignatureException;
788.16 import java.math.BigInteger;
788.17
788.18 @@ -474,6 +470,7 @@
788.19 * #engineSetParameter(java.security.spec.AlgorithmParameterSpec)
788.20 * engineSetParameter}.
788.21 */
788.22 + @Deprecated
788.23 protected void engineSetParameter(String param, Object value)
788.24 throws InvalidParameterException
788.25 {
788.26 @@ -503,6 +500,7 @@
788.27 *
788.28 * @deprecated
788.29 */
788.30 + @Deprecated
788.31 protected Object engineGetParameter(String param)
788.32 throws InvalidParameterException
788.33 {
789.1 --- a/src/windows/classes/sun/security/mscapi/SunMSCAPI.java Thu Sep 01 13:54:38 2011 -0700
789.2 +++ b/src/windows/classes/sun/security/mscapi/SunMSCAPI.java Mon Sep 05 23:58:19 2011 -0700
789.3 @@ -28,7 +28,6 @@
789.4 import java.security.AccessController;
789.5 import java.security.PrivilegedAction;
789.6 import java.security.Provider;
789.7 -import java.security.ProviderException;
789.8 import java.util.HashMap;
789.9 import java.util.Map;
789.10
789.11 @@ -62,8 +61,9 @@
789.12 // if there is no security manager installed, put directly into
789.13 // the provider. Otherwise, create a temporary map and use a
789.14 // doPrivileged() call at the end to transfer the contents
789.15 - final Map map = (System.getSecurityManager() == null)
789.16 - ? (Map)this : new HashMap();
789.17 + final Map<Object, Object> map =
789.18 + (System.getSecurityManager() == null)
789.19 + ? this : new HashMap<Object, Object>();
789.20
789.21 /*
789.22 * Secure random
790.1 --- a/src/windows/lib/content-types.properties Thu Sep 01 13:54:38 2011 -0700
790.2 +++ b/src/windows/lib/content-types.properties Mon Sep 05 23:58:19 2011 -0700
790.3 @@ -222,6 +222,10 @@
790.4 icon=png;\
790.5 action=browser
790.6
790.7 +image/bmp: \
790.8 + description=Bitmap Image;\
790.9 + file_extensions=.bmp;
790.10 +
790.11 text/html: \
790.12 description=HTML Document;\
790.13 file_extensions=.htm,.html;\
791.1 --- a/src/windows/native/java/lang/java_props_md.c Thu Sep 01 13:54:38 2011 -0700
791.2 +++ b/src/windows/native/java/lang/java_props_md.c Mon Sep 05 23:58:19 2011 -0700
791.3 @@ -563,6 +563,18 @@
791.4 {
791.5 char * display_encoding;
791.6
791.7 + // Windows UI Language selection list only cares "language"
791.8 + // information of the UI Language. For example, the list
791.9 + // just lists "English" but it actually means "en_US", and
791.10 + // the user cannot select "en_GB" (if exists) in the list.
791.11 + // So, this hack is to use the user LCID region information
791.12 + // for the UI Language, if the "language" portion of those
791.13 + // two locales are the same.
791.14 + if (PRIMARYLANGID(LANGIDFROMLCID(userDefaultLCID)) ==
791.15 + PRIMARYLANGID(LANGIDFROMLCID(userDefaultUILang))) {
791.16 + userDefaultUILang = userDefaultLCID;
791.17 + }
791.18 +
791.19 SetupI18nProps(userDefaultUILang,
791.20 &sprops.language,
791.21 &sprops.script,
792.1 --- a/test/Makefile Thu Sep 01 13:54:38 2011 -0700
792.2 +++ b/test/Makefile Mon Sep 05 23:58:19 2011 -0700
792.3 @@ -544,7 +544,7 @@
792.4 jdk_security3: $(call TestDirs, com/sun/security lib/security \
792.5 javax/security sun/security)
792.6 $(call SharedLibraryPermissions,sun/security)
792.7 - $(call RunOthervmBatch)
792.8 + $(call RunSamevmBatch)
792.9
792.10 # All security tests
792.11 jdk_security: jdk_security1 jdk_security2 jdk_security3
793.1 --- a/test/ProblemList.txt Thu Sep 01 13:54:38 2011 -0700
793.2 +++ b/test/ProblemList.txt Mon Sep 05 23:58:19 2011 -0700
793.3 @@ -198,10 +198,19 @@
793.4 # requires junit
793.5 java/lang/invoke/InvokeDynamicPrintArgs.java generic-all
793.6
793.7 +# 7079093
793.8 +java/lang/instrument/ManifestTest.sh windows-all
793.9 +
793.10 ############################################################################
793.11
793.12 # jdk_management
793.13
793.14 +# 6944188
793.15 +java/lang/management/ThreadMXBean/ThreadStateTest.java generic-all
793.16 +
793.17 +# 7067973
793.18 +java/lang/management/MemoryMXBean/CollectionUsageThreshold.java generic-all
793.19 +
793.20 # Failing, bug was filed: 6959636
793.21 javax/management/loading/LibraryLoader/LibraryLoaderTest.java generic-all
793.22
793.23 @@ -362,6 +371,15 @@
793.24 # Filed 7036666
793.25 com/sun/net/httpserver/Test9a.java generic-all
793.26
793.27 +# 7079145 java/net/ipv6tests/UdpTest.java hang at IPv6 only data exchange
793.28 +java/net/ipv6tests/UdpTest.java linux-all
793.29 +
793.30 +# 7079012
793.31 +java/net/NetworkInterface/NetParamsTest.java solaris-all
793.32 +
793.33 +# 7081476
793.34 +java/net/InetSocketAddress/B6469803.java generic-all
793.35 +
793.36 ############################################################################
793.37
793.38 # jdk_io
793.39 @@ -369,6 +387,12 @@
793.40 # 6962637
793.41 java/io/File/MaxPathLength.java windows-all
793.42
793.43 +# 6671616
793.44 +java/io/File/BlockIsDirectory.java solaris-all
793.45 +
793.46 +# 7076644
793.47 +java/io/File/Basic.java windows-all
793.48 +
793.49 ############################################################################
793.50
793.51 # jdk_nio
793.52 @@ -376,6 +400,9 @@
793.53 # 6963118
793.54 java/nio/channels/Selector/Wakeup.java windows-all
793.55
793.56 +# 7076700
793.57 +java/nio/channels/SocketChannel/AdaptSocket.java generic-all
793.58 +
793.59 ############################################################################
793.60
793.61 # jdk_rmi
793.62 @@ -450,73 +477,20 @@
793.63
793.64 # jdk_security
793.65
793.66 -# Filed 6986868
793.67 -sun/security/tools/jarsigner/crl.sh generic-all
793.68 -
793.69 -# Filed 6951285, not sure how often this fails, last was Linux 64bit Fedora 9
793.70 -sun/security/krb5/auto/MaxRetries.java generic-all
793.71 -
793.72 -# Filed 6950930, fails on windows 32bit c1 and windows 64bit
793.73 -sun/security/krb5/auto/IgnoreChannelBinding.java windows-all
793.74 -
793.75 -# Filed 6950931, failing on all windows systems
793.76 -sun/security/tools/jarsigner/crl.sh windows-all
793.77 -
793.78 -# Filed 6950929, only seemed to fail on solaris sparcv9 (-d64)
793.79 -# Failed on Linux -server 32bit too, making generic
793.80 -sun/security/krb5/auto/BadKdc4.java generic-all
793.81 -
793.82 # Failing on Solaris i586, 3/9/2010, not a -samevm issue (jdk_security3)
793.83 sun/security/pkcs11/Secmod/AddPrivateKey.java solaris-i586
793.84 sun/security/pkcs11/ec/ReadCertificates.java solaris-i586
793.85 sun/security/pkcs11/ec/ReadPKCS12.java solaris-i586
793.86 sun/security/pkcs11/ec/TestCurves.java solaris-i586
793.87 sun/security/pkcs11/ec/TestECDSA.java solaris-i586
793.88 -sun/security/pkcs11/ec/TestECGenSpec.java solaris-i586
793.89 -sun/security/pkcs11/ec/TestKeyFactory.java solaris-i586
793.90 +#sun/security/pkcs11/ec/TestECGenSpec.java solaris-i586
793.91 +#sun/security/pkcs11/ec/TestKeyFactory.java solaris-i586
793.92 +sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java solaris-i586
793.93
793.94 -# Failing on Solaris X64 (-d64 -server) with:
793.95 -# GSSException: Failure unspecified at GSS-API level
793.96 -# (Mechanism level: Specified version of key is not available (44))
793.97 -sun/security/krb5/auto/BasicKrb5Test.java generic-all
793.98 +# Directly references PKCS11 class
793.99 +sun/security/pkcs11/Provider/Absolute.java windows-x64
793.100
793.101 -# Solaris X86 failures, readjar.jks: No such file or directory
793.102 -sun/security/tools/keytool/readjar.sh generic-all
793.103 -
793.104 -# Fails with -ea -esa, but only on Solaris sparc? Suspect it is timing out
793.105 -sun/security/tools/keytool/standard.sh generic-all
793.106 -
793.107 -# Fails on Solaris 10 X64, address already in use
793.108 -sun/security/krb5/auto/HttpNegotiateServer.java generic-all
793.109 -
793.110 -# Fails on almost all platforms
793.111 -# java.lang.UnsupportedClassVersionError: SerialTest :
793.112 -# Unsupported major.minor version 51.0
793.113 -# at java.lang.ClassLoader.defineClass1(Native Method)
793.114 -sun/security/util/Oid/S11N.sh generic-all
793.115 -
793.116 -# Fails on Fedora 9 32bit
793.117 -# GSSException: Failure unspecified at GSS-API level (Mechanism level:
793.118 -# Invalid argument (400) - Cannot find key of appropriate type to decrypt
793.119 -# AP REP - DES CBC mode with MD5)
793.120 -# at sun.security.jgss.krb5.Krb5Context.acceptSecContext(Krb5Context.java:778)
793.121 -sun/security/krb5/auto/NonMutualSpnego.java generic-all
793.122 -
793.123 -# Fails on Solaris 10 sparc, GSSException: Failure unspecified at GSS-API level
793.124 -# Also fails on Windows 2000 similar way
793.125 -sun/security/krb5/auto/ok-as-delegate.sh generic-all
793.126 -
793.127 -# Fails on Windows 2000, GSSException: Failure unspecified at GSS-API level
793.128 -# (Mechanism level: Request is a replay (34))
793.129 -sun/security/krb5/auto/ok-as-delegate-xrealm.sh generic-all
793.130 -
793.131 -# Fails on Windows 2000, ExceptionInInitializerError
793.132 -sun/security/mscapi/AccessKeyStore.sh generic-all
793.133 -
793.134 -# Fails on Solaris 10, KrbException: Additional pre-authentication required (25)
793.135 -sun/security/krb5/auto/basic.sh generic-all
793.136 -
793.137 -# Fails on Fedora 9 64bit, PKCS11Exception: CKR_DEVICE_ERROR
793.138 +# Fails on Fedora 9/Ubuntu 10.04 64bit, PKCS11Exception: CKR_DEVICE_ERROR
793.139 sun/security/pkcs11/KeyAgreement/TestDH.java generic-all
793.140
793.141 # Run too slow on Solaris 10 sparc
793.142 @@ -525,18 +499,10 @@
793.143 sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ServerTimeout.java solaris-sparc
793.144 sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/ReadTimeout.java solaris-sparc
793.145 sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh solaris-sparc
793.146 -sun/security/tools/keytool/AltProviderPath.sh solaris-sparc
793.147
793.148 # Solaris 10 sparc, passed/failed confusion? java.security.ProviderException: update() failed
793.149 sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/AsyncSSLSocketClose.java generic-all
793.150
793.151 -# Seem really slow on Solaris sparc, being excluded just for timing reasons
793.152 -sun/security/tools/jarsigner/AlgOptions.sh solaris-sparc
793.153 -sun/security/tools/jarsigner/nameclash.sh solaris-sparc
793.154 -sun/security/krb5/auto/basic.sh solaris-sparc
793.155 -sun/security/provider/PolicyFile/getinstance/getinstance.sh solaris-sparc
793.156 -sun/security/tools/jarsigner/samename.sh solaris-sparc
793.157 -
793.158 # Othervm, sparc, NoRouteToHostException: Cannot assign requested address
793.159 sun/security/ssl/javax/net/ssl/NewAPIs/SessionCacheSizeTests.java generic-all
793.160
793.161 @@ -544,48 +510,21 @@
793.162 # Solaris sparc and sparcv9 -server, timeout
793.163 sun/security/ssl/javax/net/ssl/NewAPIs/SessionTimeOutTests.java generic-all
793.164
793.165 -# Failed on solaris 10 sparc, othervm mode, "js.jks: No such file or directory"
793.166 -# Also, cannot verify signature on solaris i586 -server
793.167 -sun/security/tools/jarsigner/concise_jarsigner.sh generic-all
793.168 -
793.169 # Various failures on Linux Fedora 9 X64, othervm mode
793.170 -lib/security/cacerts/VerifyCACerts.java generic-all
793.171 sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/TestAllSuites.java generic-all
793.172 sun/security/ssl/sanity/ciphersuites/CheckCipherSuites.java generic-all
793.173 -sun/security/tools/jarsigner/oldsig.sh generic-all
793.174
793.175 # Various failures on Linux Fedora 9 X64, othervm mode
793.176 sun/security/ssl/sanity/interop/ClientJSSEServerJSSE.java generic-all
793.177
793.178 -# Solaris sparcv9: Failed to parse input emptysubject.jks: No such file or directory
793.179 -sun/security/tools/keytool/emptysubject.sh generic-all
793.180 +# 7079203 sun/security/tools/keytool/printssl.sh fails on solaris with timeout
793.181 +sun/security/tools/keytool/printssl.sh solaris-all
793.182
793.183 -# Fails on OpenSolaris, missing classes, slow on Solaris sparc
793.184 -sun/security/ec/TestEC.java generic-all
793.185 +# 7054637
793.186 +sun/security/tools/jarsigner/ec.sh solaris-all
793.187
793.188 -# Problems with windows x64
793.189 -sun/security/mscapi/IsSunMSCAPIAvailable.sh windows-x64
793.190 -sun/security/mscapi/RSAEncryptDecrypt.sh windows-x64
793.191 -
793.192 -# Exception in test solaris-sparc -client -server, no windows
793.193 -sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java solaris-all
793.194 -
793.195 -# Solaris sparc client, fails to compile?
793.196 -sun/security/pkcs11/KeyStore/SecretKeysBasic.sh solaris-all
793.197 -
793.198 -# Fails on OpenSolaris java.net.BindException: Address already in use
793.199 -sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java generic-all
793.200 -
793.201 -# Timeout on solaris-sparcv9 or ArrayIndexOutOfBoundsException?
793.202 -sun/security/rsa/TestKeyPairGeneratorLength.java solaris-all
793.203 -sun/security/rsa/TestSignatures.java solaris-all
793.204 -
793.205 -# Do not seem to run on windows machines? dll missing?
793.206 -sun/security/tools/jarsigner/emptymanifest.sh windows-all
793.207 -
793.208 -# Files does not exist or no encoding? solaris-sparcv9
793.209 -sun/security/tools/keytool/importreadall.sh solaris-all
793.210 -sun/security/tools/keytool/selfissued.sh solaris-all
793.211 +# 7081817
793.212 +sun/security/provider/certpath/X509CertPath/IllegalCertiticates.java generic-all
793.213
793.214 ############################################################################
793.215
794.1 --- a/test/com/sun/security/auth/login/ConfigFile/IllegalURL.java Thu Sep 01 13:54:38 2011 -0700
794.2 +++ b/test/com/sun/security/auth/login/ConfigFile/IllegalURL.java Mon Sep 05 23:58:19 2011 -0700
794.3 @@ -43,8 +43,9 @@
794.4 static void use(String f) throws Exception {
794.5 System.out.println("Testing " + f + "...");
794.6 System.setProperty("java.security.auth.login.config", f);
794.7 - try {
794.8 - new FileInputStream(new URL(f).getFile().replace('/', File.separatorChar));
794.9 + try (FileInputStream fis =
794.10 + new FileInputStream(new URL(f).getFile().replace('/', File.separatorChar))) {
794.11 + // do nothing
794.12 } catch (Exception e) {
794.13 System.out.println("Even old implementation does not support it. Ignored.");
794.14 return;
795.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
795.2 +++ b/test/com/sun/security/sasl/ntlm/Conformance.java Mon Sep 05 23:58:19 2011 -0700
795.3 @@ -0,0 +1,104 @@
795.4 +/*
795.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
795.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
795.7 + *
795.8 + * This code is free software; you can redistribute it and/or modify it
795.9 + * under the terms of the GNU General Public License version 2 only, as
795.10 + * published by the Free Software Foundation.
795.11 + *
795.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
795.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
795.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
795.15 + * version 2 for more details (a copy is included in the LICENSE file that
795.16 + * accompanied this code).
795.17 + *
795.18 + * You should have received a copy of the GNU General Public License version
795.19 + * 2 along with this work; if not, write to the Free Software Foundation,
795.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
795.21 + *
795.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
795.23 + * or visit www.oracle.com if you need additional information or have any
795.24 + * questions.
795.25 + */
795.26 +
795.27 +/*
795.28 + * @test
795.29 + * @bug 7043847 7043860 7043882 7043938 7043959
795.30 + * @summary NTML impl of SaslServer conformance errors
795.31 + */
795.32 +import java.io.IOException;
795.33 +import javax.security.sasl.*;
795.34 +import java.util.*;
795.35 +import javax.security.auth.callback.Callback;
795.36 +import javax.security.auth.callback.CallbackHandler;
795.37 +import javax.security.auth.callback.UnsupportedCallbackException;
795.38 +
795.39 +public class Conformance {
795.40 +
795.41 + public static void main(String[] args) throws Exception {
795.42 + try {
795.43 + Sasl.createSaslClient(new String[] {"NTLM"}, "abc", "ldap",
795.44 + "server", new HashMap<String, Object>(), null);
795.45 + } catch (SaslException se) {
795.46 + System.out.println(se);
795.47 + }
795.48 + try {
795.49 + Sasl.createSaslServer("NTLM", "ldap",
795.50 + "server", new HashMap<String, Object>(), null);
795.51 + } catch (SaslException se) {
795.52 + System.out.println(se);
795.53 + }
795.54 + try {
795.55 + Sasl.createSaslClient(new String[] {"NTLM"}, "abc", "ldap",
795.56 + "server", null, new CallbackHandler() {
795.57 + @Override
795.58 + public void handle(Callback[] callbacks) throws
795.59 + IOException, UnsupportedCallbackException { }
795.60 + });
795.61 + } catch (SaslException se) {
795.62 + System.out.println(se);
795.63 + }
795.64 + try {
795.65 + SaslServer saslServer =
795.66 + Sasl.createSaslServer("NTLM", "ldap", "abc", null, new CallbackHandler() {
795.67 + @Override
795.68 + public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { }
795.69 + });
795.70 + System.err.println("saslServer = " + saslServer);
795.71 + System.err.println("saslServer.isComplete() = " + saslServer.isComplete());
795.72 + // IllegalStateException is expected here
795.73 + saslServer.getNegotiatedProperty("prop");
795.74 + System.err.println("No IllegalStateException");
795.75 + } catch (IllegalStateException se) {
795.76 + System.out.println(se);
795.77 + }
795.78 + try {
795.79 + SaslServer saslServer =
795.80 + Sasl.createSaslServer("NTLM", "ldap", "abc", null, new CallbackHandler() {
795.81 + @Override
795.82 + public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { }
795.83 + });
795.84 + System.err.println("saslServer = " + saslServer);
795.85 + System.err.println("saslServer.isComplete() = " + saslServer.isComplete());
795.86 + // IllegalStateException is expected here
795.87 + saslServer.getAuthorizationID();
795.88 + System.err.println("No IllegalStateException");
795.89 + } catch (IllegalStateException se) {
795.90 + System.out.println(se);
795.91 + }
795.92 + try {
795.93 + SaslServer saslServer =
795.94 + Sasl.createSaslServer("NTLM", "ldap", "abc", null, new CallbackHandler() {
795.95 + @Override
795.96 + public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { }
795.97 + });
795.98 + System.err.println("saslServer = " + saslServer);
795.99 + System.err.println("saslServer.isComplete() = " + saslServer.isComplete());
795.100 + // IllegalStateException is expected here
795.101 + saslServer.wrap(new byte[0], 0, 0);
795.102 + System.err.println("No IllegalStateException");
795.103 + } catch (IllegalStateException se) {
795.104 + System.out.println(se);
795.105 + }
795.106 + }
795.107 +}
796.1 --- a/test/java/io/IOException/LastErrorString.java Thu Sep 01 13:54:38 2011 -0700
796.2 +++ b/test/java/io/IOException/LastErrorString.java Mon Sep 05 23:58:19 2011 -0700
796.3 @@ -23,6 +23,7 @@
796.4
796.5 /* @test
796.6 @bug 4167937
796.7 + @ignore Test truncates system files when run as root, see 7042603
796.8 @summary Test code paths that use the JVM_LastErrorString procedure
796.9 */
796.10
797.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
797.2 +++ b/test/java/io/etc/FailingFlushAndClose.java Mon Sep 05 23:58:19 2011 -0700
797.3 @@ -0,0 +1,268 @@
797.4 +/*
797.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
797.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
797.7 + *
797.8 + * This code is free software; you can redistribute it and/or modify it
797.9 + * under the terms of the GNU General Public License version 2 only, as
797.10 + * published by the Free Software Foundation.
797.11 + *
797.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
797.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
797.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
797.15 + * version 2 for more details (a copy is included in the LICENSE file that
797.16 + * accompanied this code).
797.17 + *
797.18 + * You should have received a copy of the GNU General Public License version
797.19 + * 2 along with this work; if not, write to the Free Software Foundation,
797.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
797.21 + *
797.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
797.23 + * or visit www.oracle.com if you need additional information or have any
797.24 + * questions.
797.25 + */
797.26 +
797.27 +import java.io.*;
797.28 +
797.29 +/**
797.30 + * @test
797.31 + * @bug 7015589
797.32 + * @summary Test that buffering streams are considered closed even when the
797.33 + * close or flush from the underlying stream fails.
797.34 + */
797.35 +
797.36 +public class FailingFlushAndClose {
797.37 +
797.38 + static int failed;
797.39 +
797.40 + static void fail(String msg) {
797.41 + System.err.println("FAIL: " + msg);
797.42 + failed++;
797.43 + }
797.44 +
797.45 + static void failWithIOE(String msg) throws IOException {
797.46 + fail(msg);
797.47 + throw new IOException(msg);
797.48 + }
797.49 +
797.50 + static class FailingCloseInputStream extends InputStream {
797.51 + boolean closed;
797.52 + @Override
797.53 + public int read()throws IOException {
797.54 + if (closed)
797.55 + failWithIOE("input stream is closed");
797.56 + return 1;
797.57 + }
797.58 + @Override
797.59 + public void close() throws IOException {
797.60 + if (!closed) {
797.61 + closed = true;
797.62 + throw new IOException("close failed");
797.63 + }
797.64 + }
797.65 + }
797.66 +
797.67 + static class FailingCloseOutputStream extends OutputStream {
797.68 + boolean closed;
797.69 + @Override
797.70 + public void write(int b) throws IOException {
797.71 + if (closed)
797.72 + failWithIOE("output stream is closed");
797.73 + }
797.74 + @Override
797.75 + public void flush() throws IOException {
797.76 + if (closed)
797.77 + failWithIOE("output stream is closed");
797.78 + }
797.79 + @Override
797.80 + public void close() throws IOException {
797.81 + if (!closed) {
797.82 + closed = true;
797.83 + throw new IOException("close failed");
797.84 + }
797.85 + }
797.86 + }
797.87 +
797.88 + static class FailingFlushOutputStream extends OutputStream {
797.89 + boolean closed;
797.90 + @Override
797.91 + public void write(int b) throws IOException {
797.92 + if (closed)
797.93 + failWithIOE("output stream is closed");
797.94 + }
797.95 + @Override
797.96 + public void flush() throws IOException {
797.97 + if (closed) {
797.98 + failWithIOE("output stream is closed");
797.99 + } else {
797.100 + throw new IOException("flush failed");
797.101 + }
797.102 + }
797.103 + @Override
797.104 + public void close() throws IOException {
797.105 + closed = true;
797.106 + }
797.107 + }
797.108 +
797.109 + static class FailingCloseReader extends Reader {
797.110 + boolean closed;
797.111 + @Override
797.112 + public int read(char[] cbuf, int off, int len) throws IOException {
797.113 + if (closed)
797.114 + failWithIOE("reader is closed");
797.115 + return 1;
797.116 + }
797.117 + @Override
797.118 + public void close() throws IOException {
797.119 + if (!closed) {
797.120 + closed = true;
797.121 + throw new IOException("close failed");
797.122 + }
797.123 + }
797.124 + }
797.125 +
797.126 + static class FailingCloseWriter extends Writer {
797.127 + boolean closed;
797.128 + @Override
797.129 + public void write(char[] cbuf, int off, int len) throws IOException {
797.130 + if (closed)
797.131 + failWithIOE("writer is closed");
797.132 + }
797.133 + @Override
797.134 + public void flush() throws IOException {
797.135 + if (closed)
797.136 + failWithIOE("writer is closed");
797.137 + }
797.138 + @Override
797.139 + public void close() throws IOException {
797.140 + if (!closed) {
797.141 + closed = true;
797.142 + throw new IOException("close failed");
797.143 + }
797.144 + }
797.145 + }
797.146 +
797.147 + static class FailingFlushWriter extends Writer {
797.148 + boolean closed;
797.149 + @Override
797.150 + public void write(char[] cbuf, int off, int len) throws IOException {
797.151 + if (closed)
797.152 + failWithIOE("writer is closed");
797.153 + }
797.154 + @Override
797.155 + public void flush() throws IOException {
797.156 + if (closed) {
797.157 + failWithIOE("writer is closed");
797.158 + } else {
797.159 + throw new IOException("flush failed");
797.160 + }
797.161 + }
797.162 + @Override
797.163 + public void close() throws IOException {
797.164 + if (!closed) {
797.165 + closed = true;
797.166 + throw new IOException("close failed");
797.167 + }
797.168 + }
797.169 + }
797.170 +
797.171 + static void testFailingClose(InputStream in) throws IOException {
797.172 + System.out.println(in.getClass());
797.173 + in.read(new byte[100]);
797.174 + try {
797.175 + in.close();
797.176 + fail("close did not fail");
797.177 + } catch (IOException expected) { }
797.178 + try {
797.179 + in.read(new byte[100]);
797.180 + fail("read did not fail");
797.181 + } catch (IOException expected) { }
797.182 + }
797.183 +
797.184 + static void testFailingClose(OutputStream out) throws IOException {
797.185 + System.out.println(out.getClass());
797.186 + out.write(1);
797.187 + try {
797.188 + out.close();
797.189 + fail("close did not fail");
797.190 + } catch (IOException expected) { }
797.191 + try {
797.192 + out.write(1);
797.193 + if (!(out instanceof BufferedOutputStream))
797.194 + fail("write did not fail");
797.195 + } catch (IOException expected) { }
797.196 + }
797.197 +
797.198 + static void testFailingFlush(OutputStream out) throws IOException {
797.199 + System.out.println(out.getClass());
797.200 + out.write(1);
797.201 + try {
797.202 + out.flush();
797.203 + fail("flush did not fail");
797.204 + } catch (IOException expected) { }
797.205 + if (out instanceof BufferedOutputStream) {
797.206 + out.write(1);
797.207 + try {
797.208 + out.close();
797.209 + fail("close did not fail");
797.210 + } catch (IOException expected) { }
797.211 + }
797.212 + }
797.213 +
797.214 + static void testFailingClose(Reader r) throws IOException {
797.215 + System.out.println(r.getClass());
797.216 + r.read(new char[100]);
797.217 + try {
797.218 + r.close();
797.219 + fail("close did not fail");
797.220 + } catch (IOException expected) { }
797.221 + try {
797.222 + r.read(new char[100]);
797.223 + fail("read did not fail");
797.224 + } catch (IOException expected) { }
797.225 + }
797.226 +
797.227 + static void testFailingClose(Writer w) throws IOException {
797.228 + System.out.println(w.getClass());
797.229 + w.write("message");
797.230 + try {
797.231 + w.close();
797.232 + fail("close did not fail");
797.233 + } catch (IOException expected) { }
797.234 + try {
797.235 + w.write("another message");
797.236 + fail("write did not fail");
797.237 + } catch (IOException expected) { }
797.238 + }
797.239 +
797.240 + static void testFailingFlush(Writer w) throws IOException {
797.241 + System.out.println(w.getClass());
797.242 + w.write("message");
797.243 + try {
797.244 + w.flush();
797.245 + fail("flush did not fail");
797.246 + } catch (IOException expected) { }
797.247 + if (w instanceof BufferedWriter) {
797.248 + // assume this message will be buffered
797.249 + w.write("another message");
797.250 + try {
797.251 + w.close();
797.252 + fail("close did not fail");
797.253 + } catch (IOException expected) { }
797.254 + }
797.255 + }
797.256 +
797.257 + public static void main(String[] args) throws IOException {
797.258 +
797.259 + testFailingClose(new BufferedInputStream(new FailingCloseInputStream()));
797.260 + testFailingClose(new BufferedOutputStream(new FailingCloseOutputStream()));
797.261 +
797.262 + testFailingClose(new BufferedReader(new FailingCloseReader()));
797.263 + testFailingClose(new BufferedWriter(new FailingCloseWriter()));
797.264 +
797.265 + testFailingFlush(new BufferedOutputStream(new FailingFlushOutputStream()));
797.266 + testFailingFlush(new BufferedWriter(new FailingFlushWriter()));
797.267 +
797.268 + if (failed > 0)
797.269 + throw new RuntimeException(failed + " test(s) failed - see log for details");
797.270 + }
797.271 +}
798.1 --- a/test/java/lang/Math/Tests.java Thu Sep 01 13:54:38 2011 -0700
798.2 +++ b/test/java/lang/Math/Tests.java Mon Sep 05 23:58:19 2011 -0700
798.3 @@ -1,5 +1,5 @@
798.4 /*
798.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
798.6 + * Copyright (c) 2003, 2011 Oracle and/or its affiliates. All rights reserved.
798.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
798.8 *
798.9 * This code is free software; you can redistribute it and/or modify it
798.10 @@ -35,20 +35,30 @@
798.11 public class Tests {
798.12 private Tests(){}; // do not instantiate
798.13
798.14 - private static String toHexString(float f) {
798.15 + public static String toHexString(float f) {
798.16 if (!Float.isNaN(f))
798.17 return Float.toHexString(f);
798.18 else
798.19 return "NaN(0x" + Integer.toHexString(Float.floatToRawIntBits(f)) + ")";
798.20 }
798.21
798.22 - private static String toHexString(double d) {
798.23 + public static String toHexString(double d) {
798.24 if (!Double.isNaN(d))
798.25 return Double.toHexString(d);
798.26 else
798.27 return "NaN(0x" + Long.toHexString(Double.doubleToRawLongBits(d)) + ")";
798.28 }
798.29
798.30 + /**
798.31 + * Return the floating-point value next larger in magnitude.
798.32 + */
798.33 + public static double nextOut(double d) {
798.34 + if (d > 0.0)
798.35 + return Math.nextUp(d);
798.36 + else
798.37 + return -Math.nextUp(-d);
798.38 + }
798.39 +
798.40 public static int test(String testName, float input,
798.41 boolean result, boolean expected) {
798.42 if (expected != result) {
798.43 @@ -338,4 +348,24 @@
798.44 else
798.45 return 0;
798.46 }
798.47 +
798.48 + // For a successful test, the result must be within the upper and
798.49 + // lower bounds.
798.50 + public static int testBounds(String testName, double input, double result,
798.51 + double bound1, double bound2) {
798.52 + if ((result >= bound1 && result <= bound2) ||
798.53 + (result <= bound1 && result >= bound2))
798.54 + return 0;
798.55 + else {
798.56 + double lowerBound = Math.min(bound1, bound2);
798.57 + double upperBound = Math.max(bound1, bound2);
798.58 + System.err.println("Failure for " + testName + ":\n" +
798.59 + "\tFor input " + input + "\t(" + toHexString(input) + ")\n" +
798.60 + "\tgot " + result + "\t(" + toHexString(result) + ");\n" +
798.61 + "\toutside of range\n" +
798.62 + "\t[" + lowerBound + "\t(" + toHexString(lowerBound) + "), " +
798.63 + upperBound + "\t(" + toHexString(upperBound) + ")]");
798.64 + return 1;
798.65 + }
798.66 + }
798.67 }
799.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
799.2 +++ b/test/java/lang/Math/WorstCaseTests.java Mon Sep 05 23:58:19 2011 -0700
799.3 @@ -0,0 +1,435 @@
799.4 +/*
799.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
799.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
799.7 + *
799.8 + * This code is free software; you can redistribute it and/or modify it
799.9 + * under the terms of the GNU General Public License version 2 only, as
799.10 + * published by the Free Software Foundation.
799.11 + *
799.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
799.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
799.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
799.15 + * version 2 for more details (a copy is included in the LICENSE file that
799.16 + * accompanied this code).
799.17 + *
799.18 + * You should have received a copy of the GNU General Public License version
799.19 + * 2 along with this work; if not, write to the Free Software Foundation,
799.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
799.21 + *
799.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
799.23 + * or visit www.oracle.com if you need additional information or have any
799.24 + * questions.
799.25 + */
799.26 +
799.27 +/*
799.28 + * @test
799.29 + * @bug 4900206
799.30 + * @summary Test worst case behavior of exp, log, sin, cos, etc.
799.31 + * @build Tests
799.32 + * @build WorstCaseTests
799.33 + * @run main WorstCaseTests
799.34 + * @run main/othervm -Xcomp WorstCaseTests
799.35 + * @author Joseph D. Darcy
799.36 + */
799.37 +
799.38 +/**
799.39 + * Use "Table Maker's Dilemma" results from Jean-Michel Muller and
799.40 + * Vincent Lefèvre, to test the math library. See
799.41 + * http://perso.ens-lyon.fr/jean-michel.muller/TMD.html for original
799.42 + * test vectors from 2000 and see
799.43 + * http://perso.ens-lyon.fr/jean-michel.muller/TMDworstcases.pdf with
799.44 + * additional test vectors from 2003. The latter link also contains
799.45 + * some information about the methodology used to produce the test
799.46 + * vectors.
799.47 + *
799.48 + * Most of the Java math library methods tested here have a 1-ulp
799.49 + * error bound from their specifications. This implies the returned
799.50 + * value must be one of the two representable floating-point numbers
799.51 + * bracketing the exact result. The expected value in the test
799.52 + * vectors below is the truncation of the exact value. Therefore, the
799.53 + * computed result must either be that value or the value next larger
799.54 + * in magnitude. The hyperbolic transcendental functions sinh and cosh
799.55 + * have a larger 2.5 ulp error bound in their specification, but the
799.56 + * JDK implementation complies with a 1 ulp bound on the worst-case
799.57 + * values. Therefore, no addition leeway is afforded when testing
799.58 + * sinh and cosh.
799.59 + */
799.60 +public class WorstCaseTests {
799.61 + private WorstCaseTests() {throw new AssertionError("No instances for you.");}
799.62 +
799.63 + public static void main(String... args) {
799.64 + int failures = 0;
799.65 +
799.66 + failures += testWorstExp();
799.67 + failures += testWorstLog();
799.68 + failures += testWorstSin();
799.69 + failures += testWorstAsin();
799.70 + failures += testWorstCos();
799.71 + failures += testWorstAcos();
799.72 + failures += testWorstTan();
799.73 + failures += testWorstAtan();
799.74 + failures += testWorstPow2();
799.75 + failures += testWorstSinh();
799.76 + failures += testWorstCosh();
799.77 +
799.78 + if (failures > 0) {
799.79 + System.err.printf("Testing worst cases incurred %d failures.%n", failures);
799.80 + throw new RuntimeException();
799.81 + }
799.82 + }
799.83 +
799.84 + private static int testWorstExp() {
799.85 + int failures = 0;
799.86 + double [][] testCases = {
799.87 + {-0x1.E8BDBFCD9144Ep3, 0x1.F3E558CF4DE54p-23},
799.88 + {-0x1.71E0B869B5E79p2, 0x1.951C6DC5D24E2p-9},
799.89 + {-0x1.02393D5976769p1, 0x1.1064B2C103DDAp-3},
799.90 + {-0x1.2A9CAD9998262p0, 0x1.3EF1E9B3A81C7p-2},
799.91 + {-0x1.CC37EF7DE7501p0, 0x1.534D4DE870713p-3},
799.92 + {-0x1.22E24FA3D5CF9p-1, 0x1.2217147B85EA9p-1},
799.93 + {-0x1.DC2B5DF1F7D3Dp-1, 0x1.9403FD0EE51C8p-2},
799.94 + {-0x1.290EA09E36479p-3, 0x1.BADED30CBF1C3p-1},
799.95 + {-0x1.A2FEFEFD580DFp-13, 0x1.FFE5D0BB7EABFp-1},
799.96 + {-0x1.ED318EFB627EAp-27, 0x1.FFFFFF84B39C4p-1},
799.97 + {-0x1.4BD46601AE1EFp-31, 0x1.FFFFFFFAD0AE6p-1},
799.98 + {-0x1.1000000000242p-42, 0x1.FFFFFFFFFF780p-1},
799.99 + {-0x1.2000000000288p-42, 0x1.FFFFFFFFFF700p-1},
799.100 + {-0x1.8000000000012p-48, 0x1.FFFFFFFFFFFD0p-1},
799.101 + {-0x1.0000000000001p-51, 0x1.FFFFFFFFFFFFCp-1},
799.102 +
799.103 + {+0x1.FFFFFFFFFFFFFp-53, 0x1.0000000000000p0},
799.104 + {+0x1.FFFFFFFFFFFE0p-48, 0x1.000000000001Fp0},
799.105 + {+0x1.7FFE7FFEE0024p-32, 0x1.000000017FFE8p0},
799.106 + {+0x1.80017FFEDFFDCp-32, 0x1.0000000180017p0},
799.107 + {+0x1.9E9CBBFD6080Bp-31, 0x1.000000033D397p0},
799.108 + {+0x1.D7A7D893609E5p-26, 0x1.00000075E9F64p0},
799.109 + {+0x1.BA07D73250DE7p-14, 0x1.0006E83736F8Cp0},
799.110 + {+0x1.D77FD13D27FFFp-11, 0x1.003AF6C37C1D3p0},
799.111 + {+0x1.6A4D1AF9CC989p-8, 0x1.016B4DF3299D7p0},
799.112 + {+0x1.ACCFBE46B4EF0p-1, 0x2.4F85C9783DCE0p0},
799.113 + {+0x1.ACA7AE8DA5A7Bp0, 0x5.55F52B35F955Ap0},
799.114 + {+0x1.D6336A88077AAp0, 0x6.46A37FD503FDCp0},
799.115 + {+0x2.85DC78FB8928Cp0, 0xC.76F2496CB038Fp0},
799.116 + {+0x1.76E7E5D7B6EACp3, 0x1.DE7CD6751029Ap16},
799.117 + {+0x1.A8EAD058BC6B8p3, 0x1.1D71965F516ADp19},
799.118 + {+0x1.1D5C2DAEBE367p4, 0x1.A8C02E974C314p25},
799.119 + {+0x1.C44CE0D716A1Ap4, 0x1.B890CA8637AE1p40},
799.120 + };
799.121 +
799.122 + for(double[] testCase: testCases) {
799.123 + failures += testExpCase(testCase[0], testCase[1]);
799.124 + }
799.125 +
799.126 + return failures;
799.127 + }
799.128 +
799.129 + private static int testExpCase(double input, double expected) {
799.130 + int failures = 0;
799.131 + double out = Tests.nextOut(expected);
799.132 + failures += Tests.testBounds("Math.exp", input, Math.exp(input), expected, out);
799.133 + failures += Tests.testBounds("StrictMath.exp", input, StrictMath.exp(input), expected, out);
799.134 + return failures;
799.135 + }
799.136 +
799.137 + private static int testWorstLog() {
799.138 + int failures = 0;
799.139 + double [][] testCases = {
799.140 + {+0x1.0000000000001p0, +0x1.FFFFFFFFFFFFFp-53},
799.141 + {+0x2.0012ECB039C9Cp0, +0x1.62F71C4656B60p-1},
799.142 + {+0x6.46A37FD503FDCp0, +0x1.D6336A88077A9p+0},
799.143 + {+0x7.78DFECC7F57Fp0, +0x2.02DD059DB46Bp+0},
799.144 + {+0x9.588CCF24BB9C8p0, +0x2.3C24DEBB2BE7p+0},
799.145 + {+0xA.AF87550D97E4p0, +0x2.5E706595A7ABEp+0},
799.146 + {+0xC.76F2496CB039p0, +0x2.85DC78FB8928Cp+0},
799.147 + {+0x11.1867637CBD03p0, +0x2.D6BBEFC79A842p+0},
799.148 + {+0x13.D9D7D597A9DDp0, +0x2.FCFE12AE07DDCp+0},
799.149 + {+0x17.F3825778AAAFp0, +0x3.2D0F907F5E00Cp+0},
799.150 + {+0x1AC.50B409C8AEEp0, +0x6.0F52F37AECFCCp+0},
799.151 + {+0x1.DE7CD6751029Ap16, +0x1.76E7E5D7B6EABp+3},
799.152 + };
799.153 +
799.154 + for(double[] testCase: testCases) {
799.155 + failures += testLogCase(testCase[0], testCase[1]);
799.156 + }
799.157 +
799.158 + return failures;
799.159 + }
799.160 +
799.161 + private static int testLogCase(double input, double expected) {
799.162 + int failures = 0;
799.163 + double out = Tests.nextOut(expected);
799.164 + failures += Tests.testBounds("Math.log", input, Math.log(input), expected, out);
799.165 + failures += Tests.testBounds("StrictMath.log", input, StrictMath.log(input), expected, out);
799.166 + return failures;
799.167 + }
799.168 +
799.169 + private static int testWorstSin() {
799.170 + int failures = 0;
799.171 + double [][] testCases = {
799.172 + {+0x1.E0000000001C2p-20, +0x1.DFFFFFFFFF02Ep-20},
799.173 + {+0x1.598BAE9E632F6p-7, +0x1.598A0AEA48996p-7},
799.174 +
799.175 + {+0x1.9283586503FEp-5, +0x1.9259E3708BD39p-5},
799.176 + {+0x1.D7BDCD778049Fp-5, +0x1.D77B117F230D5p-5},
799.177 + {+0x1.A202B3FB84788p-4, +0x1.A1490C8C06BA6p-4},
799.178 + {+0x1.D037CB27EE6DFp-3, +0x1.CC40C3805229Ap-3},
799.179 + {+0x1.D5064E6FE82C5p-3, +0x1.D0EF799001BA9p-3},
799.180 + {+0x1.FE767739D0F6Dp-2, +0x1.E9950730C4695p-2},
799.181 + {+0x1.D98C4C612718Dp-1, +0x1.98DCD09337792p-1},
799.182 + {+0x1.921FB54442D18p-0, +0x1.FFFFFFFFFFFFFp-1},
799.183 +
799.184 + {+0x1.6756745770A51p+1, +0x1.4FF350E412821p-2},
799.185 + };
799.186 +
799.187 + for(double[] testCase: testCases) {
799.188 + failures += testSinCase(testCase[0], testCase[1]);
799.189 + }
799.190 +
799.191 + return failures;
799.192 + }
799.193 +
799.194 + private static int testSinCase(double input, double expected) {
799.195 + int failures = 0;
799.196 + double out = Tests.nextOut(expected);
799.197 + failures += Tests.testBounds("Math.sin", input, Math.sin(input), expected, out);
799.198 + failures += Tests.testBounds("StrictMath.sin", input, StrictMath.sin(input), expected, out);
799.199 + return failures;
799.200 + }
799.201 +
799.202 + private static int testWorstAsin() {
799.203 + int failures = 0;
799.204 + double [][] testCases = {
799.205 + {+0x1.DFFFFFFFFF02Ep-20, +0x1.E0000000001C1p-20},
799.206 + {+0x1.DFFFFFFFFC0B8p-19, +0x1.E000000000707p-19},
799.207 +
799.208 + {+0x1.9259E3708BD3Ap-5, +0x1.9283586503FEp-5},
799.209 + {+0x1.D77B117F230D6p-5, +0x1.D7BDCD778049Fp-5},
799.210 + {+0x1.A1490C8C06BA7p-4, +0x1.A202B3FB84788p-4},
799.211 + {+0x1.9697CB602C582p-3, +0x1.994FFB5DAF0F9p-3},
799.212 + {+0x1.D0EF799001BA9p-3, +0x1.D5064E6FE82C4p-3},
799.213 + {+0x1.E9950730C4696p-2, +0x1.FE767739D0F6Dp-2},
799.214 + {+0x1.1ED06D50F7E88p-1, +0x1.30706F699466Dp-1},
799.215 + {+0x1.D5B05A89D3E77p-1, +0x1.29517AB4C132Ap+0},
799.216 + {+0x1.E264357EA0E29p-1, +0x1.3AA301F6EBB1Dp+0},
799.217 + };
799.218 +
799.219 + for(double[] testCase: testCases) {
799.220 + failures += testAsinCase(testCase[0], testCase[1]);
799.221 + }
799.222 +
799.223 + return failures;
799.224 + }
799.225 +
799.226 + private static int testAsinCase(double input, double expected) {
799.227 + int failures = 0;
799.228 + double out = Tests.nextOut(expected);
799.229 + failures += Tests.testBounds("Math.asin", input, Math.asin(input), expected, out);
799.230 + failures += Tests.testBounds("StrictMath.asin", input, StrictMath.asin(input), expected, out);
799.231 + return failures;
799.232 + }
799.233 +
799.234 + private static int testWorstCos() {
799.235 + int failures = 0;
799.236 + double [][] testCases = {
799.237 + {+0x1.8000000000009p-23, +0x0.FFFFFFFFFFFB8p+0},
799.238 + {+0x1.8000000000024p-22, +0x0.FFFFFFFFFFEE0p+0},
799.239 + {+0x1.2000000000F30p-18, +0x0.FFFFFFFFF5E00p+0},
799.240 + {+0x1.06B505550E6B2p-9, +0x0.FFFFDE4D1FDFFp+0},
799.241 + {+0x1.97CCD3D2C438Fp-6, +0x0.FFEBB35D43854p+0},
799.242 +
799.243 + {+0x1.549EC0C0C5AFAp-5, +0x1.FF8EB6A91ECB0p-1},
799.244 + {+0x1.16E534EE36580p-4, +0x1.FED0476FC75C9p-1},
799.245 + {+0x1.EFEEF61D39AC2p-3, +0x1.F10FC61E2C78Ep-1},
799.246 + {+0x1.FEB1F7920E248p-2, +0x1.C1A27AE836F12p-1},
799.247 + {+0x1.7CB7648526F99p-1, +0x1.78DAF01036D0Cp-1},
799.248 + {+0x1.C65A170474549p-1, +0x1.434A3645BE208p-1},
799.249 + {+0x1.6B8A6273D7C21p+0, +0x1.337FC5B072C52p-3},
799.250 + };
799.251 +
799.252 + for(double[] testCase: testCases) {
799.253 + failures += testCosCase(testCase[0], testCase[1]);
799.254 + }
799.255 +
799.256 + return failures;
799.257 + }
799.258 +
799.259 + private static int testCosCase(double input, double expected) {
799.260 + int failures = 0;
799.261 + double out = Tests.nextOut(expected);
799.262 + failures += Tests.testBounds("Math.cos", input, Math.cos(input), expected, out);
799.263 + failures += Tests.testBounds("StrictMath.cos", input, StrictMath.cos(input), expected, out);
799.264 + return failures;
799.265 + }
799.266 +
799.267 + private static int testWorstAcos() {
799.268 + int failures = 0;
799.269 + double [][] testCases = {
799.270 + {+0x1.FD737BE914578p-11, +0x1.91E006D41D8D8p+0},
799.271 + {+0x1.4182199998587p-1, +0x1.C8A538AE83D1Fp-1},
799.272 + {+0x1.E45A1C93651ECp-1, +0x1.520DC553F6B23p-2},
799.273 + {+0x1.F10FC61E2C78Fp-1, +0x1.EFEEF61D39AC1p-3},
799.274 + };
799.275 +
799.276 + for(double[] testCase: testCases) {
799.277 + failures += testAcosCase(testCase[0], testCase[1]);
799.278 + }
799.279 +
799.280 + return failures;
799.281 + }
799.282 +
799.283 + private static int testAcosCase(double input, double expected) {
799.284 + int failures = 0;
799.285 + double out = Tests.nextOut(expected);
799.286 + failures += Tests.testBounds("Math.acos", input, Math.acos(input), expected, out);
799.287 + failures += Tests.testBounds("StrictMath.acos", input, StrictMath.acos(input), expected, out);
799.288 + return failures;
799.289 + }
799.290 +
799.291 + private static int testWorstTan() {
799.292 + int failures = 0;
799.293 + double [][] testCases = {
799.294 + {+0x1.DFFFFFFFFFF1Fp-22, +0x1.E000000000151p-22},
799.295 + {+0x1.67FFFFFFFA114p-18, +0x1.6800000008E61p-18},
799.296 +
799.297 + {+0x1.50486B2F87014p-5, +0x1.5078CEBFF9C72p-5},
799.298 + {+0x1.52C39EF070CADp-4, +0x1.5389E6DF41978p-4},
799.299 + {+0x1.A33F32AC5CEB5p-3, +0x1.A933FE176B375p-3},
799.300 + {+0x1.D696BFA988DB9p-2, +0x1.FAC71CD34EEA6p-2},
799.301 + {+0x1.46AC372243536p-1, +0x1.7BA49F739829Ep-1},
799.302 + {+0x0.A3561B9121A9Bp+0, +0x0.BDD24FB9CC14Fp+0},
799.303 + };
799.304 +
799.305 + for(double[] testCase: testCases) {
799.306 + failures += testTanCase(testCase[0], testCase[1]);
799.307 + }
799.308 +
799.309 + return failures;
799.310 + }
799.311 +
799.312 + private static int testTanCase(double input, double expected) {
799.313 + int failures = 0;
799.314 + double out = Tests.nextOut(expected);
799.315 + failures += Tests.testBounds("Math.tan", input, Math.tan(input), expected, out);
799.316 + failures += Tests.testBounds("StrictMath.tan", input, StrictMath.tan(input), expected, out);
799.317 + return failures;
799.318 + }
799.319 +
799.320 + private static int testWorstAtan() {
799.321 + int failures = 0;
799.322 + double [][] testCases = {
799.323 + {+0x1.E000000000546p-21, +0x1.DFFFFFFFFFC7Cp-21},
799.324 + {+0x1.22E8D75E2BC7Fp-11, +0x1.22E8D5694AD2Bp-11},
799.325 +
799.326 + {+0x1.0FC9F1FABE658p-5, +0x1.0FB06EDE9973Ap-5},
799.327 + {+0x1.1BBE9C255698Dp-5, +0x1.1BA1951DB1D6Dp-5},
799.328 + {+0x1.8DDD25AB90CA1p-5, +0x1.8D8D2D4BD6FA2p-5},
799.329 + {+0x1.5389E6DF41979p-4, +0x1.52C39EF070CADp-4},
799.330 + {+0x1.A933FE176B375p-3, +0x1.A33F32AC5CEB4p-3},
799.331 + {+0x1.0F6E5D9960397p-2, +0x1.09544B71AD4A6p-2},
799.332 + {+0x1.7BA49F739829Fp-1, +0x1.46AC372243536p-1},
799.333 +
799.334 + {+0x0.BDD24FB9CC14F8p+0, +0x0.A3561B9121A9Bp+0},
799.335 + };
799.336 +
799.337 + for(double[] testCase: testCases) {
799.338 + failures += testAtanCase(testCase[0], testCase[1]);
799.339 + }
799.340 +
799.341 + return failures;
799.342 + }
799.343 +
799.344 + private static int testAtanCase(double input, double expected) {
799.345 + int failures = 0;
799.346 + double out = Tests.nextOut(expected);
799.347 + failures += Tests.testBounds("Math.atan", input, Math.atan(input), expected, out);
799.348 + failures += Tests.testBounds("StrictMath.atan", input, StrictMath.atan(input), expected, out);
799.349 + return failures;
799.350 + }
799.351 +
799.352 + private static int testWorstPow2() {
799.353 + int failures = 0;
799.354 + double [][] testCases = {
799.355 + {+0x1.16A76EC41B516p-1, +0x1.7550685A42C63p+0},
799.356 + {+0x1.3E34FA6AB969Ep-1, +0x1.89D948A94FE16p+0},
799.357 + {+0x1.4A63FF1D53F53p-1, +0x1.90661DA12D528p+0},
799.358 + {+0x1.B32A6C92D1185p-1, +0x1.CD6B37EDECEAFp+0},
799.359 +
799.360 + {+0x1.25DD9EEDAC79Ap+0, +0x1.1BA39FF28E3E9p+1},
799.361 + };
799.362 +
799.363 + for(double[] testCase: testCases) {
799.364 + failures += testPow2Case(testCase[0], testCase[1]);
799.365 + }
799.366 +
799.367 + return failures;
799.368 + }
799.369 +
799.370 + private static int testPow2Case(double input, double expected) {
799.371 + int failures = 0;
799.372 + double out = Tests.nextOut(expected);
799.373 + failures += Tests.testBounds("Math.pow2", input, Math.pow(2, input), expected, out);
799.374 + failures += Tests.testBounds("StrictMath.pow2", input, StrictMath.pow(2, input), expected, out);
799.375 + return failures;
799.376 + }
799.377 +
799.378 + // 2.5 ulp error bound in the specification; the implementation
799.379 + // does better on the tested values.
799.380 + private static int testWorstSinh() {
799.381 + int failures = 0;
799.382 + double [][] testCases = {
799.383 + {+0x1.DFFFFFFFFFE3Ep-20, +0x1.E000000000FD1p-20},
799.384 + {+0x1.DFFFFFFFFE3E0p-18, +0x1.E00000000FD1Fp-18},
799.385 + {+0x1.135E31FDD05D3p-5, +0x1.136B78B25CC57p-5},
799.386 + {+0x1.0DC68D5E8F959p-3, +0x1.0E8E73DC4FEE3p-3},
799.387 + {+0x1.616CC75D49226p-2, +0x1.687BD068C1C1Ep-2},
799.388 + {+0x1.3FFC12B81CBC2p+0, +0x1.9A0FF413A1AF2p+0},
799.389 + {+0x2.FE008C44BACA2p+0, +0x9.F08A43ED03AEp+0},
799.390 + {+0x1.C089FCF166171p+4, +0x1.5C452E0E37569p+39},
799.391 + {+0x1.E07E71BFCF06Fp+5, +0x1.91EC4412C344Fp+85},
799.392 + {+0x1.54CD1FEA7663Ap+7, +0x1.C90810D354618p+244},
799.393 + {+0x1.D6479EBA7C971p+8, +0x1.62A88613629B5p+677},
799.394 + };
799.395 +
799.396 + for(double[] testCase: testCases) {
799.397 + failures += testSinhCase(testCase[0], testCase[1]);
799.398 + }
799.399 +
799.400 + return failures;
799.401 + }
799.402 +
799.403 + private static int testSinhCase(double input, double expected) {
799.404 + int failures = 0;
799.405 + double out = Tests.nextOut(expected);
799.406 + failures += Tests.testBounds("Math.sinh", input, Math.sinh(input), expected, out);
799.407 + failures += Tests.testBounds("StrictMath.sinh", input, StrictMath.sinh(input), expected, out);
799.408 + return failures;
799.409 + }
799.410 +
799.411 + // 2.5 ulp error bound in the specification; the implementation
799.412 + // does better on the tested values.
799.413 + private static int testWorstCosh() {
799.414 + int failures = 0;
799.415 + double [][] testCases = {
799.416 + {+0x1.17D8A9F206217p-6, +0x1.00098F5F09BE3p+0},
799.417 + {+0x1.BF0305E2C6C37p-3, +0x1.061F4C39E16F2p+0},
799.418 + {+0x1.03923F2B47C07p-1, +0x1.219C1989E3372p+0},
799.419 + {+0x1.A6031CD5F93BAp-1, +0x1.5BFF041B260FDp+0},
799.420 + {+0x1.104B648F113A1p+0, +0x1.9EFDCA62B7009p+0},
799.421 + {+0x1.EA5F2F2E4B0C5p+1, +0x17.10DB0CD0FED5p+0},
799.422 + };
799.423 +
799.424 + for(double[] testCase: testCases) {
799.425 + failures += testCoshCase(testCase[0], testCase[1]);
799.426 + }
799.427 +
799.428 + return failures;
799.429 + }
799.430 +
799.431 + private static int testCoshCase(double input, double expected) {
799.432 + int failures = 0;
799.433 + double out = Tests.nextOut(expected);
799.434 + failures += Tests.testBounds("Math.cosh", input, Math.cosh(input), expected, out);
799.435 + failures += Tests.testBounds("StrictMath.cosh", input, StrictMath.cosh(input), expected, out);
799.436 + return failures;
799.437 + }
799.438 +}
800.1 --- a/test/java/lang/ProcessBuilder/Basic.java Thu Sep 01 13:54:38 2011 -0700
800.2 +++ b/test/java/lang/ProcessBuilder/Basic.java Mon Sep 05 23:58:19 2011 -0700
800.3 @@ -1803,7 +1803,7 @@
800.4
800.5 p.getInputStream().close();
800.6 p.getErrorStream().close();
800.7 - p.getOutputStream().close();
800.8 + try { p.getOutputStream().close(); } catch (IOException flushFailed) { }
800.9
800.10 InputStream[] streams = { p.getInputStream(), p.getErrorStream() };
800.11 for (final InputStream in : streams) {
801.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
801.2 +++ b/test/java/lang/management/ManagementFactory/GetObjectName.java Mon Sep 05 23:58:19 2011 -0700
801.3 @@ -0,0 +1,75 @@
801.4 +/*
801.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
801.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
801.7 + *
801.8 + * This code is free software; you can redistribute it and/or modify it
801.9 + * under the terms of the GNU General Public License version 2 only, as
801.10 + * published by the Free Software Foundation.
801.11 + *
801.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
801.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
801.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
801.15 + * version 2 for more details (a copy is included in the LICENSE file that
801.16 + * accompanied this code).
801.17 + *
801.18 + * You should have received a copy of the GNU General Public License version
801.19 + * 2 along with this work; if not, write to the Free Software Foundation,
801.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
801.21 + *
801.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
801.23 + * or visit www.oracle.com if you need additional information or have any
801.24 + * questions.
801.25 + */
801.26 +
801.27 +/* @test
801.28 + * @bug 7068328
801.29 + * @summary Test if getObjectName handles properly when called by
801.30 + * multiple threads simultaneously. Run in othervm mode to
801.31 + * make sure the object name is not initialized to begin with.
801.32 + * @run main/othervm GetObjectName
801.33 + */
801.34 +
801.35 +import java.lang.management.BufferPoolMXBean;
801.36 +import java.lang.management.ManagementFactory;
801.37 +import java.lang.management.PlatformLoggingMXBean;
801.38 +import java.lang.management.PlatformManagedObject;
801.39 +import java.util.ArrayList;
801.40 +import java.util.List;
801.41 +import java.util.concurrent.ExecutorService;
801.42 +import java.util.concurrent.Executors;
801.43 +import java.util.concurrent.LinkedBlockingQueue;
801.44 +import java.util.concurrent.TimeUnit;
801.45 +
801.46 +public class GetObjectName {
801.47 + private static boolean failed = false;
801.48 + public static void main(String[] args) throws Exception {
801.49 + int tasks = 10000;
801.50 + ExecutorService executor = Executors.newFixedThreadPool(10);
801.51 + submitTasks(executor, tasks);
801.52 + executor.shutdown();
801.53 + executor.awaitTermination(10, TimeUnit.SECONDS);
801.54 + if (!failed) {
801.55 + System.out.println("Test passed.");
801.56 + }
801.57 + }
801.58 +
801.59 + static void submitTasks(ExecutorService executor, int count) {
801.60 + for (int i=0; i < count && !failed; i++) {
801.61 + executor.execute(new Runnable() {
801.62 + @Override
801.63 + public void run() {
801.64 + List<PlatformManagedObject> mbeans = new ArrayList<>();
801.65 + mbeans.add(ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class));
801.66 + mbeans.addAll(ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class));
801.67 + for (PlatformManagedObject pmo : mbeans) {
801.68 + // Name should not be null
801.69 + if (pmo.getObjectName() == null) {
801.70 + failed = true;
801.71 + throw new RuntimeException("TEST FAILED: getObjectName() returns null");
801.72 + }
801.73 + }
801.74 + }
801.75 + });
801.76 + }
801.77 + }
801.78 +}
802.1 --- a/test/java/lang/reflect/Generics/Probe.java Thu Sep 01 13:54:38 2011 -0700
802.2 +++ b/test/java/lang/reflect/Generics/Probe.java Mon Sep 05 23:58:19 2011 -0700
802.3 @@ -1,5 +1,5 @@
802.4 /*
802.5 - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
802.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
802.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
802.8 *
802.9 * This code is free software; you can redistribute it and/or modify it
802.10 @@ -23,7 +23,7 @@
802.11
802.12 /*
802.13 * @test
802.14 - * @bug 5003916 6704655 6873951
802.15 + * @bug 5003916 6704655 6873951 6476261
802.16 * @summary Testing parsing of signatures attributes of nested classes
802.17 * @author Joseph D. Darcy
802.18 */
802.19 @@ -38,12 +38,12 @@
802.20 "java.util.concurrent.ConcurrentHashMap$KeyIterator",
802.21 "java.util.concurrent.ConcurrentHashMap$ValueIterator",
802.22 "java.util.AbstractList$ListItr",
802.23 -// "java.util.EnumMap$EntryIterator",
802.24 -// "java.util.EnumMap$KeyIterator",
802.25 -// "java.util.EnumMap$ValueIterator",
802.26 -// "java.util.IdentityHashMap$EntryIterator",
802.27 -// "java.util.IdentityHashMap$KeyIterator",
802.28 -// "java.util.IdentityHashMap$ValueIterator",
802.29 + "java.util.EnumMap$EntryIterator",
802.30 + "java.util.EnumMap$KeyIterator",
802.31 + "java.util.EnumMap$ValueIterator",
802.32 + "java.util.IdentityHashMap$EntryIterator",
802.33 + "java.util.IdentityHashMap$KeyIterator",
802.34 + "java.util.IdentityHashMap$ValueIterator",
802.35 "java.util.WeakHashMap$EntryIterator",
802.36 "java.util.WeakHashMap$KeyIterator",
802.37 "java.util.WeakHashMap$ValueIterator",
802.38 @@ -52,12 +52,12 @@
802.39 "java.util.HashMap$ValueIterator",
802.40 "java.util.LinkedHashMap$EntryIterator",
802.41 "java.util.LinkedHashMap$KeyIterator",
802.42 - "java.util.LinkedHashMap$ValueIterator"})
802.43 + "java.util.LinkedHashMap$ValueIterator",
802.44 + "javax.swing.JComboBox$AccessibleJComboBox"})
802.45 public class Probe {
802.46 public static void main (String... args) throws Throwable {
802.47 Classes classesAnnotation = (Probe.class).getAnnotation(Classes.class);
802.48 - List<String> names =
802.49 - new ArrayList<String>(asList(classesAnnotation.value()));
802.50 + List<String> names = new ArrayList<>(asList(classesAnnotation.value()));
802.51
802.52 int errs = 0;
802.53 for(String name: names) {
803.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
803.2 +++ b/test/java/lang/reflect/Generics/SignatureTest.java Mon Sep 05 23:58:19 2011 -0700
803.3 @@ -0,0 +1,50 @@
803.4 +/*
803.5 + * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
803.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
803.7 + *
803.8 + * This code is free software; you can redistribute it and/or modify it
803.9 + * under the terms of the GNU General Public License version 2 only, as
803.10 + * published by the Free Software Foundation.
803.11 + *
803.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
803.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
803.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
803.15 + * version 2 for more details (a copy is included in the LICENSE file that
803.16 + * accompanied this code).
803.17 + *
803.18 + * You should have received a copy of the GNU General Public License version
803.19 + * 2 along with this work; if not, write to the Free Software Foundation,
803.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
803.21 + *
803.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
803.23 + * or visit www.oracle.com if you need additional information or have any
803.24 + * questions.
803.25 + */
803.26 +
803.27 +/*
803.28 + * @test
803.29 + * @bug 6476261
803.30 + * @summary More testing of parsing of signatures attributes of nested classes
803.31 + */
803.32 +
803.33 +import java.lang.reflect.*;
803.34 +
803.35 +public class SignatureTest<T> {
803.36 + class Inner1 {
803.37 + class Inner11 {
803.38 + }
803.39 + }
803.40 +
803.41 + public void f(SignatureTest<String>.Inner1.Inner11 x) {}
803.42 + public void g(SignatureTest<String>.Inner1 x) {}
803.43 +
803.44 + public static void main(String[] args) throws Exception {
803.45 + Class clazz = SignatureTest.class;
803.46 + for (Method m : clazz.getDeclaredMethods()) {
803.47 + System.out.println();
803.48 + System.out.println(m.toString());
803.49 + System.out.println(m.toGenericString());
803.50 + System.out.println(m.getGenericParameterTypes());
803.51 + }
803.52 + }
803.53 +}
804.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
804.2 +++ b/test/java/lang/reflect/Generics/TestBadSignatures.java Mon Sep 05 23:58:19 2011 -0700
804.3 @@ -0,0 +1,54 @@
804.4 +/*
804.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
804.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
804.7 + *
804.8 + * This code is free software; you can redistribute it and/or modify it
804.9 + * under the terms of the GNU General Public License version 2 only, as
804.10 + * published by the Free Software Foundation.
804.11 + *
804.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
804.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
804.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
804.15 + * version 2 for more details (a copy is included in the LICENSE file that
804.16 + * accompanied this code).
804.17 + *
804.18 + * You should have received a copy of the GNU General Public License version
804.19 + * 2 along with this work; if not, write to the Free Software Foundation,
804.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
804.21 + *
804.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
804.23 + * or visit www.oracle.com if you need additional information or have any
804.24 + * questions.
804.25 + */
804.26 +
804.27 +/*
804.28 + * @test
804.29 + * @bug 6832374 7052898
804.30 + * @summary Test bad signatures get a GenericSignatureFormatError thrown.
804.31 + * @author Joseph D. Darcy
804.32 + */
804.33 +
804.34 +import java.lang.reflect.*;
804.35 +import sun.reflect.generics.parser.SignatureParser;
804.36 +
804.37 +public class TestBadSignatures {
804.38 + public static void main(String[] args) {
804.39 + String[] badSignatures = {
804.40 + // Missing ":" after first type bound
804.41 + "<T:Lfoo/tools/nsc/symtab/Names;Lfoo/tools/nsc/symtab/Symbols;",
804.42 +
804.43 + // Arrays improperly indicated for exception information
804.44 + "<E:Ljava/lang/Exception;>(TE;[Ljava/lang/RuntimeException;)V^[TE;",
804.45 + };
804.46 +
804.47 + for(String badSig : badSignatures) {
804.48 + try {
804.49 + SignatureParser.make().parseMethodSig(badSig);
804.50 + throw new RuntimeException("Expected GenericSignatureFormatError for " +
804.51 + badSig);
804.52 + } catch(GenericSignatureFormatError gsfe) {
804.53 + System.out.println(gsfe.toString()); // Expected
804.54 + }
804.55 + }
804.56 + }
804.57 +}
805.1 --- a/test/java/net/CookieHandler/TestHttpCookie.java Thu Sep 01 13:54:38 2011 -0700
805.2 +++ b/test/java/net/CookieHandler/TestHttpCookie.java Mon Sep 05 23:58:19 2011 -0700
805.3 @@ -362,12 +362,13 @@
805.4 eq(c1, c2, false);
805.5
805.6 header("Test domainMatches()");
805.7 - dm(".foo.com", "y.x.foo.com", false);
805.8 - dm(".foo.com", "x.foo.com", true);
805.9 - dm(".com", "whatever.com", false);
805.10 - dm(".com.", "whatever.com", false);
805.11 - dm(".ajax.com", "ajax.com", true);
805.12 - dm(".local", "example.local", true);
805.13 + dm(".foo.com", "y.x.foo.com", false);
805.14 + dm(".foo.com", "x.foo.com", true);
805.15 + dm(".com", "whatever.com", false);
805.16 + dm(".com.", "whatever.com", false);
805.17 + dm(".ajax.com", "ajax.com", true);
805.18 + dm(".local", "example.local", true);
805.19 + dm("example.local", "example", true);
805.20
805.21 // bug 6277808
805.22 testCount++;
806.1 --- a/test/java/net/NetworkInterface/NetParamsTest.java Thu Sep 01 13:54:38 2011 -0700
806.2 +++ b/test/java/net/NetworkInterface/NetParamsTest.java Mon Sep 05 23:58:19 2011 -0700
806.3 @@ -45,7 +45,9 @@
806.4 System.out.println("\tPoint to Point: " + netif.isPointToPoint());
806.5 System.out.println("\tVirtual: " + netif.isVirtual());
806.6 if (netif.isVirtual()) {
806.7 - System.out.println("\tParent Interface: " + netif.getParent().getName());
806.8 + NetworkInterface parent = netif.getParent();
806.9 + String parentName = parent == null ? "null" : parent.getName();
806.10 + System.out.println("\tParent Interface: " + parentName);
806.11 }
806.12 System.out.println("\tMulticast: " + netif.supportsMulticast());
806.13
807.1 --- a/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java Thu Sep 01 13:54:38 2011 -0700
807.2 +++ b/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java Mon Sep 05 23:58:19 2011 -0700
807.3 @@ -57,11 +57,22 @@
807.4 return ip6Interfaces.get(nif);
807.5 }
807.6
807.7 + // IPv6 not supported for Windows XP/Server 2003
807.8 + static boolean isIPv6Supported() {
807.9 + if (System.getProperty("os.name").startsWith("Windows")) {
807.10 + String ver = System.getProperty("os.version");
807.11 + int major = Integer.parseInt(ver.split("\\.")[0]);
807.12 + return (major >= 6);
807.13 + }
807.14 + return true;
807.15 + }
807.16 +
807.17 static NetworkConfiguration probe() throws IOException {
807.18 Map<NetworkInterface,List<InetAddress>> ip4Interfaces =
807.19 new HashMap<NetworkInterface,List<InetAddress>>();
807.20 Map<NetworkInterface,List<InetAddress>> ip6Interfaces =
807.21 new HashMap<NetworkInterface,List<InetAddress>>();
807.22 + boolean isIPv6Supported = isIPv6Supported();
807.23
807.24 // find the interfaces that support IPv4 and IPv6
807.25 List<NetworkInterface> nifs = Collections
807.26 @@ -81,7 +92,7 @@
807.27 }
807.28 list.add(addr);
807.29 ip4Interfaces.put(nif, list);
807.30 - } else if (addr instanceof Inet6Address) {
807.31 + } else if (isIPv6Supported && (addr instanceof Inet6Address)) {
807.32 List<InetAddress> list = ip6Interfaces.get(nif);
807.33 if (list == null) {
807.34 list = new LinkedList<InetAddress>();
808.1 --- a/test/java/nio/channels/DatagramChannel/SelectWhenRefused.java Thu Sep 01 13:54:38 2011 -0700
808.2 +++ b/test/java/nio/channels/DatagramChannel/SelectWhenRefused.java Mon Sep 05 23:58:19 2011 -0700
808.3 @@ -22,7 +22,7 @@
808.4 */
808.5
808.6 /* @test
808.7 - * @bug 6935563
808.8 + * @bug 6935563 7044870
808.9 * @summary Test that Selector does not select an unconnected DatagramChannel when
808.10 * ICMP port unreachable received
808.11 */
808.12 @@ -35,14 +35,15 @@
808.13 public class SelectWhenRefused {
808.14
808.15 public static void main(String[] args) throws IOException {
808.16 - DatagramChannel dc = DatagramChannel.open().bind(new InetSocketAddress(0));
808.17 - int port = dc.socket().getLocalPort();
808.18 - dc.close();
808.19 + DatagramChannel dc1 = DatagramChannel.open().bind(new InetSocketAddress(0));
808.20 + int port = dc1.socket().getLocalPort();
808.21
808.22 // datagram sent to this address should be refused
808.23 SocketAddress refuser = new InetSocketAddress(InetAddress.getLocalHost(), port);
808.24
808.25 - dc = DatagramChannel.open().bind(new InetSocketAddress(0));
808.26 + DatagramChannel dc = DatagramChannel.open().bind(new InetSocketAddress(0));
808.27 + dc1.close();
808.28 +
808.29 Selector sel = Selector.open();
808.30 try {
808.31 dc.configureBlocking(false);
808.32 @@ -52,6 +53,10 @@
808.33 sendDatagram(dc, refuser);
808.34 int n = sel.select(2000);
808.35 if (n > 0) {
808.36 + sel.selectedKeys().clear();
808.37 + // BindException will be thrown if another service is using
808.38 + // our expected refuser port, cannot run just exit.
808.39 + DatagramChannel.open().bind(refuser).close();
808.40 throw new RuntimeException("Unexpected wakeup");
808.41 }
808.42
808.43 @@ -80,6 +85,8 @@
808.44 throw new RuntimeException("Unexpected wakeup after disconnect");
808.45 }
808.46
808.47 + } catch(BindException e) {
808.48 + // Do nothing, some other test has used this port
808.49 } finally {
808.50 sel.close();
808.51 dc.close();
809.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
809.2 +++ b/test/java/security/testlibrary/Providers.java Mon Sep 05 23:58:19 2011 -0700
809.3 @@ -0,0 +1,36 @@
809.4 +/*
809.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
809.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
809.7 + *
809.8 + * This code is free software; you can redistribute it and/or modify it
809.9 + * under the terms of the GNU General Public License version 2 only, as
809.10 + * published by the Free Software Foundation.
809.11 + *
809.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
809.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
809.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
809.15 + * version 2 for more details (a copy is included in the LICENSE file that
809.16 + * accompanied this code).
809.17 + *
809.18 + * You should have received a copy of the GNU General Public License version
809.19 + * 2 along with this work; if not, write to the Free Software Foundation,
809.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
809.21 + *
809.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
809.23 + * or visit www.oracle.com if you need additional information or have any
809.24 + * questions.
809.25 + */
809.26 +
809.27 +import java.security.Provider;
809.28 +import java.security.Security;
809.29 +
809.30 +public class Providers {
809.31 + public static void setAt(Provider p, int pos) throws Exception {
809.32 + if (Security.getProvider(p.getName()) != null) {
809.33 + Security.removeProvider(p.getName());
809.34 + }
809.35 + if (Security.insertProviderAt(p, pos) == -1) {
809.36 + throw new Exception("cannot setAt");
809.37 + }
809.38 + }
809.39 +}
810.1 --- a/test/java/util/Locale/LocaleCategory.java Thu Sep 01 13:54:38 2011 -0700
810.2 +++ b/test/java/util/Locale/LocaleCategory.java Mon Sep 05 23:58:19 2011 -0700
810.3 @@ -56,6 +56,7 @@
810.4 Locale.getDefault().getVariant())).build();
810.5 checkDefault();
810.6 testGetSetDefault();
810.7 + testBug7079486();
810.8 } finally {
810.9 // restore the reserved locale
810.10 Locale.setDefault(reservedLocale);
810.11 @@ -82,5 +83,24 @@
810.12 throw new RuntimeException("setDefault() should set all default locales for all categories");
810.13 }
810.14 }
810.15 +
810.16 + static void testBug7079486() {
810.17 + Locale zh_Hans_CN = Locale.forLanguageTag("zh-Hans-CN");
810.18 +
810.19 + // make sure JRE has zh_Hans_CN localized string
810.20 + if (zh_Hans_CN.getDisplayScript(Locale.US).equals(zh_Hans_CN.getDisplayScript(zh_Hans_CN))) {
810.21 + return;
810.22 + }
810.23 +
810.24 + Locale.setDefault(Locale.US);
810.25 + String en_script = zh_Hans_CN.getDisplayScript();
810.26 +
810.27 + Locale.setDefault(Locale.Category.DISPLAY, zh_Hans_CN);
810.28 + String zh_script = zh_Hans_CN.getDisplayScript();
810.29 +
810.30 + if (en_script.equals(zh_script)) {
810.31 + throw new RuntimeException("Locale.getDisplayScript() (no args) does not honor default DISPLAY locale");
810.32 + }
810.33 + }
810.34 }
810.35
811.1 --- a/test/java/util/Locale/LocaleCategory.sh Thu Sep 01 13:54:38 2011 -0700
811.2 +++ b/test/java/util/Locale/LocaleCategory.sh Mon Sep 05 23:58:19 2011 -0700
811.3 @@ -1,7 +1,7 @@
811.4 #!/bin/sh
811.5 #
811.6 # @test
811.7 -# @bug 4700857 6997928
811.8 +# @bug 4700857 6997928 7079486
811.9 # @summary tests for Locale.getDefault(Locale.Category) and
811.10 # Locale.setDefault(Locale.Category, Locale)
811.11 # @build LocaleCategory
812.1 --- a/test/java/util/zip/LargeZip.java Thu Sep 01 13:54:38 2011 -0700
812.2 +++ b/test/java/util/zip/LargeZip.java Mon Sep 05 23:58:19 2011 -0700
812.3 @@ -25,173 +25,242 @@
812.4
812.5 import java.io.*;
812.6 import java.nio.*;
812.7 +import java.nio.file.*;
812.8 +import java.nio.file.attribute.*;
812.9 +import java.nio.file.spi.*;
812.10 import java.util.*;
812.11 import java.util.zip.*;
812.12
812.13 +import static java.nio.file.StandardCopyOption.*;
812.14 +
812.15 public class LargeZip {
812.16 - // If true, don't delete large ZIP file created for test.
812.17 - static final boolean debug = System.getProperty("debug") != null;
812.18 + // If true, don't delete large ZIP file created for test.
812.19 + static final boolean debug = System.getProperty("debug") != null;
812.20
812.21 - //static final int DATA_LEN = 1024 * 1024;
812.22 - static final int DATA_LEN = 80 * 1024;
812.23 - static final int DATA_SIZE = 8;
812.24 + //static final int DATA_LEN = 1024 * 1024;
812.25 + static final int DATA_LEN = 80 * 1024;
812.26 + static final int DATA_SIZE = 8;
812.27
812.28 - static long fileSize = 6L * 1024L * 1024L * 1024L; // 6GB
812.29 + static long fileSize = 6L * 1024L * 1024L * 1024L; // 6GB
812.30
812.31 - static boolean userFile = false;
812.32 + static boolean userFile = false;
812.33 + static byte[] data;
812.34 + static File largeFile;
812.35 + static String lastEntryName;
812.36
812.37 - static byte[] data;
812.38 - static File largeFile;
812.39 - static String lastEntryName;
812.40 + /* args can be empty, in which case check a 3 GB file which is created for
812.41 + * this test (and then deleted). Or it can be a number, in which case
812.42 + * that designates the size of the file that's created for this test (and
812.43 + * then deleted). Or it can be the name of a file to use for the test, in
812.44 + * which case it is *not* deleted. Note that in this last case, the data
812.45 + * comparison might fail.
812.46 + */
812.47 + static void realMain (String[] args) throws Throwable {
812.48 + if (args.length > 0) {
812.49 + try {
812.50 + fileSize = Long.parseLong(args[0]);
812.51 + System.out.println("Testing with file of size " + fileSize);
812.52 + } catch (NumberFormatException ex) {
812.53 + largeFile = new File(args[0]);
812.54 + if (!largeFile.exists()) {
812.55 + throw new Exception("Specified file " + args[0] + " does not exist");
812.56 + }
812.57 + userFile = true;
812.58 + System.out.println("Testing with user-provided file " + largeFile);
812.59 + }
812.60 + }
812.61 + File testDir = null;
812.62 + if (largeFile == null) {
812.63 + testDir = new File(System.getProperty("test.scratch", "."),
812.64 + "LargeZip");
812.65 + if (testDir.exists()) {
812.66 + if (!testDir.delete()) {
812.67 + throw new Exception("Cannot delete already-existing test directory");
812.68 + }
812.69 + }
812.70 + check(!testDir.exists() && testDir.mkdirs());
812.71 + largeFile = new File(testDir, "largezip.zip");
812.72 + createLargeZip();
812.73 + } else {
812.74 + if (args.length > 1)
812.75 + updateLargeZip(args[1]); // add new entry with zfs
812.76 + }
812.77 + readLargeZip1();
812.78 + readLargeZip2();
812.79
812.80 - /* args can be empty, in which case check a 3 GB file which is created for
812.81 - * this test (and then deleted). Or it can be a number, in which case
812.82 - * that designates the size of the file that's created for this test (and
812.83 - * then deleted). Or it can be the name of a file to use for the test, in
812.84 - * which case it is *not* deleted. Note that in this last case, the data
812.85 - * comparison might fail.
812.86 - */
812.87 - static void realMain (String[] args) throws Throwable {
812.88 - if (args.length > 0) {
812.89 - try {
812.90 - fileSize = Long.parseLong(args[0]);
812.91 - System.out.println("Testing with file of size " + fileSize);
812.92 - } catch (NumberFormatException ex) {
812.93 - largeFile = new File(args[0]);
812.94 - if (!largeFile.exists()) {
812.95 - throw new Exception("Specified file " + args[0] + " does not exist");
812.96 - }
812.97 - userFile = true;
812.98 - System.out.println("Testing with user-provided file " + largeFile);
812.99 - }
812.100 - }
812.101 - File testDir = null;
812.102 - if (largeFile == null) {
812.103 - testDir = new File(System.getProperty("test.scratch", "."),
812.104 - "LargeZip");
812.105 - if (testDir.exists()) {
812.106 - if (!testDir.delete()) {
812.107 - throw new Exception("Cannot delete already-existing test directory");
812.108 - }
812.109 - }
812.110 - check(!testDir.exists() && testDir.mkdirs());
812.111 - largeFile = new File(testDir, "largezip.zip");
812.112 - createLargeZip();
812.113 - }
812.114 + if (!userFile && !debug) {
812.115 + check(largeFile.delete());
812.116 + check(testDir.delete());
812.117 + }
812.118 + }
812.119
812.120 - readLargeZip1();
812.121 - readLargeZip2();
812.122 + static void createLargeZip() throws Throwable {
812.123 + int iterations = DATA_LEN / DATA_SIZE;
812.124 + ByteBuffer bb = ByteBuffer.allocate(DATA_SIZE);
812.125 + ByteArrayOutputStream baos = new ByteArrayOutputStream();
812.126 + for (int i = 0; i < iterations; i++) {
812.127 + bb.putDouble(0, Math.random());
812.128 + baos.write(bb.array(), 0, DATA_SIZE);
812.129 + }
812.130 + data = baos.toByteArray();
812.131
812.132 - if (!userFile && !debug) {
812.133 - check(largeFile.delete());
812.134 - check(testDir.delete());
812.135 - }
812.136 - }
812.137 + try (FileOutputStream fos = new FileOutputStream(largeFile);
812.138 + BufferedOutputStream bos = new BufferedOutputStream(fos);
812.139 + ZipOutputStream zos = new ZipOutputStream(bos))
812.140 + {
812.141 + long length = 0;
812.142 + while (length < fileSize) {
812.143 + ZipEntry ze = new ZipEntry("entry-" + length);
812.144 + lastEntryName = ze.getName();
812.145 + zos.putNextEntry(ze);
812.146 + zos.write(data, 0, data.length);
812.147 + zos.closeEntry();
812.148 + length = largeFile.length();
812.149 + }
812.150 + System.out.println("Last entry written is " + lastEntryName);
812.151 + }
812.152 + }
812.153
812.154 - static void createLargeZip() throws Throwable {
812.155 - int iterations = DATA_LEN / DATA_SIZE;
812.156 - ByteBuffer bb = ByteBuffer.allocate(DATA_SIZE);
812.157 - ByteArrayOutputStream baos = new ByteArrayOutputStream();
812.158 - for (int i = 0; i < iterations; i++) {
812.159 - bb.putDouble(0, Math.random());
812.160 - baos.write(bb.array(), 0, DATA_SIZE);
812.161 - }
812.162 - data = baos.toByteArray();
812.163 + private static byte buf[] = new byte[4096];
812.164
812.165 - try (FileOutputStream fos = new FileOutputStream(largeFile);
812.166 - BufferedOutputStream bos = new BufferedOutputStream(fos);
812.167 - ZipOutputStream zos = new ZipOutputStream(bos))
812.168 - {
812.169 - long length = 0;
812.170 - while (length < fileSize) {
812.171 - ZipEntry ze = new ZipEntry("entry-" + length);
812.172 - lastEntryName = ze.getName();
812.173 - zos.putNextEntry(ze);
812.174 - zos.write(data, 0, data.length);
812.175 - zos.closeEntry();
812.176 - length = largeFile.length();
812.177 - }
812.178 - System.out.println("Last entry written is " + lastEntryName);
812.179 - }
812.180 - }
812.181 + static void checkEntry(ZipEntry e, InputStream is) throws Throwable {
812.182 + long N = 0;
812.183 + int n = 0;
812.184 + while ((n = is.read(buf)) >= 0) {
812.185 + N += n;
812.186 + }
812.187 + check(N == e.getSize());
812.188 + }
812.189
812.190 - static void readLargeZip1() throws Throwable {
812.191 - ZipFile zipFile = new ZipFile(largeFile);
812.192 - ZipEntry entry = null;
812.193 - String entryName = null;
812.194 - int count = 0;
812.195 - Enumeration<? extends ZipEntry> entries = zipFile.entries();
812.196 - while (entries.hasMoreElements()) {
812.197 - entry = entries.nextElement();
812.198 - entryName = entry.getName();
812.199 - count++;
812.200 - }
812.201 - System.out.println("Number of entries read: " + count);
812.202 - System.out.println("Last entry read is " + entryName);
812.203 - check(!entry.isDirectory());
812.204 - if (check(entryName.equals(lastEntryName))) {
812.205 - ByteArrayOutputStream baos = new ByteArrayOutputStream();
812.206 - InputStream is = zipFile.getInputStream(entry);
812.207 - byte buf[] = new byte[4096];
812.208 - int len;
812.209 - while ((len = is.read(buf)) >= 0) {
812.210 - baos.write(buf, 0, len);
812.211 - }
812.212 - baos.close();
812.213 - is.close();
812.214 - check(Arrays.equals(data, baos.toByteArray()));
812.215 - }
812.216 - }
812.217 + static void readLargeZip1() throws Throwable {
812.218 + ZipFile zipFile = new ZipFile(largeFile);
812.219 + ZipEntry entry = null;
812.220 + String entryName = null;
812.221 + int count = 0;
812.222 + System.out.println("ZipFile:");
812.223 + Enumeration<? extends ZipEntry> entries = zipFile.entries();
812.224 + while (entries.hasMoreElements()) {
812.225 + entry = entries.nextElement();
812.226 + entryName = entry.getName();
812.227 + System.out.println(" checking " + entryName);
812.228 + if (!entry.isDirectory()) {
812.229 + try (InputStream zeis = zipFile.getInputStream(entry)) {
812.230 + checkEntry(entry, zeis);
812.231 + }
812.232 + }
812.233 + count++;
812.234 + }
812.235 + System.out.println("Number of entries read: " + count);
812.236 + check(!entry.isDirectory());
812.237 + if (userFile || check(entryName.equals(lastEntryName))) {
812.238 + ByteArrayOutputStream baos = new ByteArrayOutputStream();
812.239 + InputStream is = zipFile.getInputStream(entry);
812.240 + int len;
812.241 + while ((len = is.read(buf)) >= 0) {
812.242 + baos.write(buf, 0, len);
812.243 + }
812.244 + baos.close();
812.245 + is.close();
812.246 + if (!userFile)
812.247 + check(Arrays.equals(data, baos.toByteArray()));
812.248 + }
812.249 + }
812.250
812.251 + static void readLargeZip2() throws Throwable {
812.252 + System.out.println("ZipInputStream:");
812.253 + try (FileInputStream fis = new FileInputStream(largeFile);
812.254 + BufferedInputStream bis = new BufferedInputStream(fis);
812.255 + ZipInputStream zis = new ZipInputStream(bis))
812.256 + {
812.257 + ZipEntry entry = null;
812.258 + String entryName = null;
812.259 + int count = 0;
812.260 + while ((entry = zis.getNextEntry()) != null) {
812.261 + entryName = entry.getName();
812.262
812.263 - static void readLargeZip2() throws Throwable {
812.264 - try (FileInputStream fis = new FileInputStream(largeFile);
812.265 - BufferedInputStream bis = new BufferedInputStream(fis);
812.266 - ZipInputStream zis = new ZipInputStream(bis))
812.267 - {
812.268 - ZipEntry entry = null;
812.269 - String entryName = null;
812.270 - int count = 0;
812.271 - while ((entry = zis.getNextEntry()) != null) {
812.272 - entryName = entry.getName();
812.273 - if (entryName.equals(lastEntryName)) {
812.274 - break;
812.275 - }
812.276 - count++;
812.277 - }
812.278 - System.out.println("Number of entries read: " + count);
812.279 - System.out.println("Last entry read is " + entryName);
812.280 - check(!entry.isDirectory());
812.281 + System.out.println(" checking " + entryName +
812.282 + ", method=" + entry.getMethod());
812.283 + if (entryName.equals(lastEntryName)) {
812.284 + break;
812.285 + }
812.286 + if (!entry.isDirectory()) {
812.287 + checkEntry(entry, zis);
812.288 + }
812.289 + count++;
812.290 + }
812.291 + System.out.println("Number of entries read: " + count);
812.292 + System.out.println("Last entry read is " + entryName);
812.293 + if (!userFile) {
812.294 + check(!entry.isDirectory());
812.295 + ByteArrayOutputStream baos = new ByteArrayOutputStream();
812.296 + byte buf[] = new byte[4096];
812.297 + int len;
812.298 + while ((len = zis.read(buf)) >= 0) {
812.299 + baos.write(buf, 0, len);
812.300 + }
812.301 + baos.close();
812.302 + check(Arrays.equals(data, baos.toByteArray()));
812.303 + check(zis.getNextEntry() == null);
812.304 + }
812.305 + }
812.306 + }
812.307
812.308 - ByteArrayOutputStream baos = new ByteArrayOutputStream();
812.309 + private static void updateFile(FileSystem fs, Path src) throws IOException {
812.310 + Path dst = fs.getPath(src.toString());
812.311 + Path parent = dst.getParent();
812.312 + if (parent != null && Files.notExists(parent))
812.313 + Files.createDirectories(parent);
812.314 + Files.copy(src, dst, REPLACE_EXISTING);
812.315 + }
812.316
812.317 - byte buf[] = new byte[4096];
812.318 - int len;
812.319 - while ((len = zis.read(buf)) >= 0) {
812.320 - baos.write(buf, 0, len);
812.321 - }
812.322 - baos.close();
812.323 - check(Arrays.equals(data, baos.toByteArray()));
812.324 - check(zis.getNextEntry() == null);
812.325 - }
812.326 - }
812.327 + private static FileSystemProvider getZipFSProvider() {
812.328 + for (FileSystemProvider provider : FileSystemProvider.installedProviders()) {
812.329 + if ("jar".equalsIgnoreCase(provider.getScheme()))
812.330 + return provider;
812.331 + }
812.332 + return null;
812.333 + }
812.334
812.335 + static void updateLargeZip(String pName) throws Throwable {
812.336 + FileSystemProvider provider = getZipFSProvider();
812.337 + if (provider == null) {
812.338 + System.err.println("ZIP filesystem provider is not installed");
812.339 + System.exit(1);
812.340 + }
812.341 + Map<String, Object> env = env = new HashMap<>();
812.342 + try (FileSystem fs = provider.newFileSystem(largeFile.toPath(), env)) {
812.343 + Path path = FileSystems.getDefault().getPath(pName);
812.344 + Files.walkFileTree(
812.345 + path,
812.346 + new SimpleFileVisitor<Path>() {
812.347 + @Override
812.348 + public FileVisitResult visitFile(Path file,
812.349 + BasicFileAttributes attrs)
812.350 + throws IOException
812.351 + {
812.352 + updateFile(fs, file);
812.353 + return FileVisitResult.CONTINUE;
812.354 + }
812.355 + });
812.356 + }
812.357 + }
812.358
812.359 - //--------------------- Infrastructure ---------------------------
812.360 - static volatile int passed = 0, failed = 0;
812.361 - static void pass() {passed++;}
812.362 - static void pass(String msg) {System.out.println(msg); passed++;}
812.363 - static void fail() {failed++; Thread.dumpStack();}
812.364 - static void fail(String msg) {System.out.println(msg); fail();}
812.365 - static void unexpected(Throwable t) {failed++; t.printStackTrace();}
812.366 - static void unexpected(Throwable t, String msg) {
812.367 - System.out.println(msg); failed++; t.printStackTrace();}
812.368 - static boolean check(boolean cond) {if (cond) pass(); else fail(); return cond;}
812.369 - static void equal(Object x, Object y) {
812.370 - if (x == null ? y == null : x.equals(y)) pass();
812.371 - else fail(x + " not equal to " + y);}
812.372 - public static void main(String[] args) throws Throwable {
812.373 - try {realMain(args);} catch (Throwable t) {unexpected(t);}
812.374 - System.out.println("\nPassed = " + passed + " failed = " + failed);
812.375 - if (failed > 0) throw new AssertionError("Some tests failed");}
812.376 +
812.377 + //--------------------- Infrastructure ---------------------------
812.378 + static volatile int passed = 0, failed = 0;
812.379 + static void pass() {passed++;}
812.380 + static void pass(String msg) {System.out.println(msg); passed++;}
812.381 + static void fail() {failed++; Thread.dumpStack();}
812.382 + static void fail(String msg) {System.out.println(msg); fail();}
812.383 + static void unexpected(Throwable t) {failed++; t.printStackTrace();}
812.384 + static void unexpected(Throwable t, String msg) {
812.385 + System.out.println(msg); failed++; t.printStackTrace();}
812.386 + static boolean check(boolean cond) {if (cond) pass(); else fail(); return cond;}
812.387 + static void equal(Object x, Object y) {
812.388 + if (x == null ? y == null : x.equals(y)) pass();
812.389 + else fail(x + " not equal to " + y);}
812.390 + public static void main(String[] args) throws Throwable {
812.391 + try {realMain(args);} catch (Throwable t) {unexpected(t);}
812.392 + System.out.println("\nPassed = " + passed + " failed = " + failed);
812.393 + if (failed > 0) throw new AssertionError("Some tests failed");}
812.394 }
813.1 --- a/test/javax/naming/ldap/LdapName/CompareToEqualsTests.java Thu Sep 01 13:54:38 2011 -0700
813.2 +++ b/test/javax/naming/ldap/LdapName/CompareToEqualsTests.java Mon Sep 05 23:58:19 2011 -0700
813.3 @@ -1,5 +1,5 @@
813.4 /*
813.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
813.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
813.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
813.8 *
813.9 * This code is free software; you can redistribute it and/or modify it
813.10 @@ -23,12 +23,14 @@
813.11
813.12 /*
813.13 * @test
813.14 - * @bug 4635618
813.15 + * @bug 4635618 7059542
813.16 * @summary Support for manipulating LDAP Names
813.17 + * JNDI name operations should be locale independent
813.18 */
813.19
813.20 import javax.naming.ldap.*;
813.21 import java.util.ArrayList;
813.22 +import java.util.Locale;
813.23 import java.util.List;
813.24 import javax.naming.InvalidNameException;
813.25
813.26 @@ -39,52 +41,61 @@
813.27
813.28 public static void main(String args[])
813.29 throws Exception {
813.30 -
813.31 - /**
813.32 - * Test cases:
813.33 - * 1) Same RDNs.
813.34 - * 2) same RDN sequence with an AVA ordered differently.
813.35 - * 3) RDN sequences of a differing AVA.
813.36 - * 4) RDN sequence of different length.
813.37 - * 5) RDN sequence of different Case.
813.38 - * 6) Matching binary return values.
813.39 - * 7) Binary values that don't match.
813.40 - */
813.41 - String names1[] = new String [] {
813.42 + Locale reservedLocale = Locale.getDefault();
813.43 + try {
813.44 + /**
813.45 + * Test cases:
813.46 + * 1) Same RDNs.
813.47 + * 2) same RDN sequence with an AVA ordered differently.
813.48 + * 3) RDN sequences of a differing AVA.
813.49 + * 4) RDN sequence of different length.
813.50 + * 5) RDN sequence of different Case.
813.51 + * 6) Matching binary return values.
813.52 + * 7) Binary values that don't match.
813.53 + */
813.54 + String names1[] = new String [] {
813.55 "ou=Sales+cn=Bob", "ou=Sales+cn=Bob", "ou=Sales+cn=Bob",
813.56 "ou=Sales+cn=Scott+c=US", "cn=config"};
813.57
813.58 - String names2[] = new String [] {
813.59 + String names2[] = new String [] {
813.60 "ou=Sales+cn=Bob", "cn=Bob+ou=Sales", "ou=Sales+cn=Scott",
813.61 "ou=Sales+cn=Scott", "Cn=COnFIG"};
813.62
813.63 - int expectedResults[] = {0, 0, -1, -1, 0};
813.64 + int expectedResults[] = {0, 0, -1, -1, 0};
813.65
813.66 + for (Locale locale : Locale.getAvailableLocales()) {
813.67 + // reset the default locale
813.68 + Locale.setDefault(locale);
813.69
813.70 - for (int i = 0; i < names1.length; i++) {
813.71 - checkResults(new LdapName(names1[i]),
813.72 + for (int i = 0; i < names1.length; i++) {
813.73 + checkResults(new LdapName(names1[i]),
813.74 new LdapName(names2[i]), expectedResults[i]);
813.75 + }
813.76 +
813.77 + byte[] value = "abcxyz".getBytes();
813.78 + Rdn rdn1 = new Rdn("binary", value);
813.79 + ArrayList rdns1 = new ArrayList();
813.80 + rdns1.add(rdn1);
813.81 + LdapName l1 = new LdapName(rdns1);
813.82 +
813.83 + Rdn rdn2 = new Rdn("binary", value);
813.84 + ArrayList rdns2 = new ArrayList();
813.85 + rdns2.add(rdn2);
813.86 + LdapName l2 = new LdapName(rdns2);
813.87 + checkResults(l1, l2, 0);
813.88 +
813.89 + l2 = new LdapName("binary=#61626378797A");
813.90 + checkResults(l1, l2, 0);
813.91 +
813.92 + l2 = new LdapName("binary=#61626378797B");
813.93 + checkResults(l1, l2, -1);
813.94 +
813.95 + System.out.println("Tests passed");
813.96 + }
813.97 + } finally {
813.98 + // restore the reserved locale
813.99 + Locale.setDefault(reservedLocale);
813.100 }
813.101 -
813.102 - byte[] value = "abcxyz".getBytes();
813.103 - Rdn rdn1 = new Rdn("binary", value);
813.104 - ArrayList rdns1 = new ArrayList();
813.105 - rdns1.add(rdn1);
813.106 - LdapName l1 = new LdapName(rdns1);
813.107 -
813.108 - Rdn rdn2 = new Rdn("binary", value);
813.109 - ArrayList rdns2 = new ArrayList();
813.110 - rdns2.add(rdn2);
813.111 - LdapName l2 = new LdapName(rdns2);
813.112 - checkResults(l1, l2, 0);
813.113 -
813.114 - l2 = new LdapName("binary=#61626378797A");
813.115 - checkResults(l1, l2, 0);
813.116 -
813.117 - l2 = new LdapName("binary=#61626378797B");
813.118 - checkResults(l1, l2, -1);
813.119 -
813.120 - System.out.println("Tests passed");
813.121 }
813.122
813.123
814.1 --- a/test/javax/security/auth/login/LoginContext/ResetConfigModule.java Thu Sep 01 13:54:38 2011 -0700
814.2 +++ b/test/javax/security/auth/login/LoginContext/ResetConfigModule.java Mon Sep 05 23:58:19 2011 -0700
814.3 @@ -25,7 +25,6 @@
814.4 * @test
814.5 * @bug 4633622
814.6 * @summary bug in LoginContext when Configuration is subclassed
814.7 - *
814.8 * @build ResetConfigModule ResetModule
814.9 * @run main ResetConfigModule
814.10 */
814.11 @@ -40,32 +39,42 @@
814.12
814.13 public static void main(String[] args) throws Exception {
814.14
814.15 - Configuration.setConfiguration(new MyConfig());
814.16 + Configuration previousConf = Configuration.getConfiguration();
814.17 + ClassLoader previousCL = Thread.currentThread().getContextClassLoader();
814.18
814.19 - LoginContext lc = new LoginContext("test");
814.20 try {
814.21 - lc.login();
814.22 - throw new SecurityException("test 1 failed");
814.23 - } catch (LoginException le) {
814.24 - if (le.getCause() != null &&
814.25 - le.getCause() instanceof SecurityException) {
814.26 - System.out.println("good so far");
814.27 - } else {
814.28 - throw le;
814.29 + Thread.currentThread().setContextClassLoader(
814.30 + ResetConfigModule.class.getClassLoader());
814.31 + Configuration.setConfiguration(new MyConfig());
814.32 +
814.33 + LoginContext lc = new LoginContext("test");
814.34 + try {
814.35 + lc.login();
814.36 + throw new SecurityException("test 1 failed");
814.37 + } catch (LoginException le) {
814.38 + if (le.getCause() != null &&
814.39 + le.getCause() instanceof SecurityException) {
814.40 + System.out.println("good so far");
814.41 + } else {
814.42 + throw le;
814.43 + }
814.44 }
814.45 - }
814.46
814.47 - LoginContext lc2 = new LoginContext("test2");
814.48 - try {
814.49 - lc2.login();
814.50 - throw new SecurityException("test 2 failed");
814.51 - } catch (LoginException le) {
814.52 - if (le.getCause() != null &&
814.53 - le.getCause() instanceof SecurityException) {
814.54 - System.out.println("test succeeded");
814.55 - } else {
814.56 - throw le;
814.57 + LoginContext lc2 = new LoginContext("test2");
814.58 + try {
814.59 + lc2.login();
814.60 + throw new SecurityException("test 2 failed");
814.61 + } catch (LoginException le) {
814.62 + if (le.getCause() != null &&
814.63 + le.getCause() instanceof SecurityException) {
814.64 + System.out.println("test succeeded");
814.65 + } else {
814.66 + throw le;
814.67 + }
814.68 }
814.69 + } finally {
814.70 + Configuration.setConfiguration(previousConf);
814.71 + Thread.currentThread().setContextClassLoader(previousCL);
814.72 }
814.73 }
814.74 }
815.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
815.2 +++ b/test/javax/security/auth/x500/X500Principal/Parse.java Mon Sep 05 23:58:19 2011 -0700
815.3 @@ -0,0 +1,73 @@
815.4 +/*
815.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
815.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
815.7 + *
815.8 + * This code is free software; you can redistribute it and/or modify it
815.9 + * under the terms of the GNU General Public License version 2 only, as
815.10 + * published by the Free Software Foundation.
815.11 + *
815.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
815.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
815.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
815.15 + * version 2 for more details (a copy is included in the LICENSE file that
815.16 + * accompanied this code).
815.17 + *
815.18 + * You should have received a copy of the GNU General Public License version
815.19 + * 2 along with this work; if not, write to the Free Software Foundation,
815.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
815.21 + *
815.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
815.23 + * or visit www.oracle.com if you need additional information or have any
815.24 + * questions.
815.25 + */
815.26 +
815.27 +/*
815.28 + * @test
815.29 + * @bug 7024771
815.30 + * @summary various X500Principal DN parsing tests
815.31 + */
815.32 +
815.33 +import javax.security.auth.x500.X500Principal;
815.34 +
815.35 +public class Parse {
815.36 +
815.37 + private static TestCase[] testCases = {
815.38 + new TestCase("CN=prefix\\<>suffix", false)
815.39 + };
815.40 +
815.41 + public static void main(String args[]) throws Exception {
815.42 + for (int i = 0; i < testCases.length; i++) {
815.43 + testCases[i].run();
815.44 + }
815.45 + System.out.println("Test completed ok.");
815.46 + }
815.47 +}
815.48 +
815.49 +class TestCase {
815.50 +
815.51 + private String name;
815.52 + private boolean expectedResult;
815.53 +
815.54 + TestCase(String name, boolean expectedResult) {
815.55 + this.name = name;
815.56 + this.expectedResult = expectedResult;
815.57 + }
815.58 +
815.59 + void run() throws Exception {
815.60 + Exception f = null;
815.61 + try {
815.62 + System.out.println("Parsing: \"" + name + "\"");
815.63 + new X500Principal(name);
815.64 + if (expectedResult == false) {
815.65 + f = new Exception("Successfully parsed invalid name");
815.66 + }
815.67 + } catch (IllegalArgumentException e) {
815.68 + if (expectedResult == true) {
815.69 + throw e;
815.70 + }
815.71 + }
815.72 + if (f != null) {
815.73 + throw f;
815.74 + }
815.75 + }
815.76 +}
816.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
816.2 +++ b/test/javax/sql/rowset/serial/SerialBlob/SetBinaryStream.java Mon Sep 05 23:58:19 2011 -0700
816.3 @@ -0,0 +1,42 @@
816.4 +/*
816.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
816.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
816.7 + *
816.8 + * This code is free software; you can redistribute it and/or modify it
816.9 + * under the terms of the GNU General Public License version 2 only, as
816.10 + * published by the Free Software Foundation.
816.11 + *
816.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
816.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
816.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
816.15 + * version 2 for more details (a copy is included in the LICENSE file that
816.16 + * accompanied this code).
816.17 + *
816.18 + * You should have received a copy of the GNU General Public License version
816.19 + * 2 along with this work; if not, write to the Free Software Foundation,
816.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
816.21 + *
816.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
816.23 + * or visit www.oracle.com if you need additional information or have any
816.24 + * questions.
816.25 + */
816.26 +import javax.sql.rowset.serial.SerialBlob;
816.27 +import javax.sql.rowset.serial.SerialException;
816.28 +
816.29 +/**
816.30 + * @test
816.31 + * @bug 7077451
816.32 + * @summary tests if the correct exception is thrown when calling method setBinaryStream() on SerialBlob
816.33 + */
816.34 +public class SetBinaryStream {
816.35 +
816.36 + public static void main(String[] args) throws Exception {
816.37 + SerialBlob blob = new SerialBlob(new byte[0]);
816.38 + try {
816.39 + blob.setBinaryStream(0);
816.40 + } catch (SerialException e) {
816.41 + System.out.println("Test PASSED");
816.42 + }
816.43 + }
816.44 +
816.45 +}
817.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
817.2 +++ b/test/javax/sql/rowset/serial/SerialClob/SetAsciiStream.java Mon Sep 05 23:58:19 2011 -0700
817.3 @@ -0,0 +1,42 @@
817.4 +/*
817.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
817.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
817.7 + *
817.8 + * This code is free software; you can redistribute it and/or modify it
817.9 + * under the terms of the GNU General Public License version 2 only, as
817.10 + * published by the Free Software Foundation.
817.11 + *
817.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
817.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
817.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
817.15 + * version 2 for more details (a copy is included in the LICENSE file that
817.16 + * accompanied this code).
817.17 + *
817.18 + * You should have received a copy of the GNU General Public License version
817.19 + * 2 along with this work; if not, write to the Free Software Foundation,
817.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
817.21 + *
817.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
817.23 + * or visit www.oracle.com if you need additional information or have any
817.24 + * questions.
817.25 + */
817.26 +import javax.sql.rowset.serial.SerialClob;
817.27 +import javax.sql.rowset.serial.SerialException;
817.28 +
817.29 +/**
817.30 + * @test
817.31 + * @bug 7077451
817.32 + * @summary tests if the correct exception is thrown when calling method setAsciiStream() on SerialClob
817.33 + */
817.34 +public class SetAsciiStream {
817.35 +
817.36 + public static void main(String[] args) throws Exception {
817.37 + SerialClob clob = new SerialClob(new char[0]);
817.38 + try {
817.39 + clob.setAsciiStream(0);
817.40 + } catch (SerialException e) {
817.41 + System.out.println("Test PASSED");
817.42 + }
817.43 + }
817.44 +
817.45 +}
818.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
818.2 +++ b/test/javax/sql/rowset/serial/SerialClob/SetCharacterStream.java Mon Sep 05 23:58:19 2011 -0700
818.3 @@ -0,0 +1,42 @@
818.4 +/*
818.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
818.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
818.7 + *
818.8 + * This code is free software; you can redistribute it and/or modify it
818.9 + * under the terms of the GNU General Public License version 2 only, as
818.10 + * published by the Free Software Foundation.
818.11 + *
818.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
818.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
818.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
818.15 + * version 2 for more details (a copy is included in the LICENSE file that
818.16 + * accompanied this code).
818.17 + *
818.18 + * You should have received a copy of the GNU General Public License version
818.19 + * 2 along with this work; if not, write to the Free Software Foundation,
818.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
818.21 + *
818.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
818.23 + * or visit www.oracle.com if you need additional information or have any
818.24 + * questions.
818.25 + */
818.26 +import javax.sql.rowset.serial.SerialClob;
818.27 +import javax.sql.rowset.serial.SerialException;
818.28 +
818.29 +/**
818.30 + * @test
818.31 + * @bug 7077451
818.32 + * @summary tests if the correct exception is thrown when calling method setCharacterStream() on SerialClob
818.33 + */
818.34 +public class SetCharacterStream {
818.35 +
818.36 + public static void main(String[] args) throws Exception {
818.37 + SerialClob clob = new SerialClob(new char[0]);
818.38 + try {
818.39 + clob.setCharacterStream(0);
818.40 + } catch (SerialException e) {
818.41 + System.out.println("Test PASSED");
818.42 + }
818.43 + }
818.44 +
818.45 +}
819.1 --- a/test/javax/swing/JPopupMenu/6694823/bug6694823.java Thu Sep 01 13:54:38 2011 -0700
819.2 +++ b/test/javax/swing/JPopupMenu/6694823/bug6694823.java Mon Sep 05 23:58:19 2011 -0700
819.3 @@ -69,7 +69,12 @@
819.4
819.5 toolkit.realSync();
819.6 System.out.println("Test passed!");
819.7 - frame.dispose();
819.8 +
819.9 + SwingUtilities.invokeAndWait(new Runnable() {
819.10 + public void run() {
819.11 + frame.dispose();
819.12 + }
819.13 + });
819.14 }
819.15
819.16 private static void createGui() {
819.17 @@ -88,30 +93,44 @@
819.18 frame.setSize(200, 200);
819.19 }
819.20
819.21 - private static void showPopup(final boolean shouldBeShifted) {
819.22 - SwingUtilities.invokeLater(new Runnable() {
819.23 + private static void showPopup(final boolean shouldBeShifted) throws Exception {
819.24 + SwingUtilities.invokeAndWait(new Runnable() {
819.25 public void run() {
819.26 // Place frame just above the task bar
819.27 Dimension screenSize = toolkit.getScreenSize();
819.28 frame.setLocation(screenSize.width / 2,
819.29 screenSize.height - frame.getHeight() - screenInsets.bottom);
819.30 frame.setVisible(true);
819.31 + }
819.32 + });
819.33
819.34 + // Ensure frame is visible
819.35 + toolkit.realSync();
819.36 +
819.37 + final Point point = new Point();
819.38 + SwingUtilities.invokeAndWait(new Runnable() {
819.39 + public void run() {
819.40 // Place popup over the task bar
819.41 + point.x = 0;
819.42 + point.y = frame.getHeight() - popup.getPreferredSize().height + screenInsets.bottom;
819.43 + popup.show(frame, point.x, point.y);
819.44 + }
819.45 + });
819.46 +
819.47 + // Ensure popup is visible
819.48 + toolkit.realSync();
819.49 +
819.50 + SwingUtilities.invokeAndWait(new Runnable() {
819.51 + public void run() {
819.52 Point frameLoc = frame.getLocationOnScreen();
819.53 - int x = 0;
819.54 - int y = frame.getHeight()
819.55 - - popup.getPreferredSize().height + screenInsets.bottom;
819.56 - popup.show(frame, x, y);
819.57 -
819.58 if (shouldBeShifted) {
819.59 if (popup.getLocationOnScreen()
819.60 - .equals(new Point(frameLoc.x, frameLoc.y + y))) {
819.61 + .equals(new Point(frameLoc.x, frameLoc.y + point.y))) {
819.62 throw new RuntimeException("Popup is not shifted");
819.63 }
819.64 } else {
819.65 if (!popup.getLocationOnScreen()
819.66 - .equals(new Point(frameLoc.x, frameLoc.y + y))) {
819.67 + .equals(new Point(frameLoc.x, frameLoc.y + point.y))) {
819.68 throw new RuntimeException("Popup is unexpectedly shifted");
819.69 }
819.70 }
820.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
820.2 +++ b/test/javax/swing/text/html/TableView/7030332/bug7030332.html Mon Sep 05 23:58:19 2011 -0700
820.3 @@ -0,0 +1,12 @@
820.4 +<html>
820.5 +<body>
820.6 +<applet code="bug7030332.class" width=600 height=400></applet>
820.7 +
820.8 +Compare Golden Images with rendered JEditorPane.
820.9 +They should looks simalar in each line. Pay attention to:
820.10 +
820.11 +1. Border width around tables
820.12 +2. Border width around cells
820.13 +
820.14 +</body>
820.15 +</html>
821.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
821.2 +++ b/test/javax/swing/text/html/TableView/7030332/bug7030332.java Mon Sep 05 23:58:19 2011 -0700
821.3 @@ -0,0 +1,98 @@
821.4 +/*
821.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
821.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
821.7 + *
821.8 + * This code is free software; you can redistribute it and/or modify it
821.9 + * under the terms of the GNU General Public License version 2 only, as
821.10 + * published by the Free Software Foundation.
821.11 + *
821.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
821.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
821.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
821.15 + * version 2 for more details (a copy is included in the LICENSE file that
821.16 + * accompanied this code).
821.17 + *
821.18 + * You should have received a copy of the GNU General Public License version
821.19 + * 2 along with this work; if not, write to the Free Software Foundation,
821.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
821.21 + *
821.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
821.23 + * or visit www.oracle.com if you need additional information or have any
821.24 + * questions.
821.25 + */
821.26 +
821.27 +/* @test
821.28 + @bug 7030332
821.29 + @summary Default borders in tables looks incorrect JEditorPane
821.30 + @author Pavel Porvatov
821.31 + * @run applet/manual=yesno bug7030332.html
821.32 +*/
821.33 +
821.34 +import javax.swing.*;
821.35 +import java.awt.*;
821.36 +import java.net.URL;
821.37 +
821.38 +public class bug7030332 extends JApplet {
821.39 + public static final String[] HTML_SAMPLES = new String[]{
821.40 + "<table border><tr><th>Column1</th><th>Column2</th></tr></table>",
821.41 + "<table border=\"\"><tr><th>Column1</th><th>Column2</th></tr></table>",
821.42 + "<table border=\"1\"><tr><th>Column1</th><th>Column2</th></tr></table>",
821.43 + "<table border=\"2\"><tr><th>Column1</th><th>Column2</th></tr></table>",
821.44 + };
821.45 +
821.46 + public static void main(String[] args) throws Exception {
821.47 + SwingUtilities.invokeLater(new Runnable() {
821.48 + public void run() {
821.49 + JFrame frame = new JFrame();
821.50 +
821.51 + frame.setContentPane(createContentPane());
821.52 + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
821.53 + frame.setSize(600, 400);
821.54 + frame.setLocationRelativeTo(null);
821.55 +
821.56 + frame.setVisible(true);
821.57 +
821.58 + }
821.59 + });
821.60 + }
821.61 +
821.62 + public void init() {
821.63 + try {
821.64 + SwingUtilities.invokeAndWait(new Runnable() {
821.65 + public void run() {
821.66 + setContentPane(createContentPane());
821.67 + }
821.68 + });
821.69 + } catch (Exception e) {
821.70 + throw new RuntimeException(e);
821.71 + }
821.72 + }
821.73 +
821.74 + private static Container createContentPane() {
821.75 + JPanel result = new JPanel(new GridLayout(HTML_SAMPLES.length + 1, 3, 10, 10));
821.76 +
821.77 + result.add(new JLabel("Html code"));
821.78 + result.add(new JLabel("Golden image"));
821.79 + result.add(new JLabel("JEditorPane"));
821.80 +
821.81 + for (int i = 0; i < HTML_SAMPLES.length; i++) {
821.82 + String htmlSample = HTML_SAMPLES[i];
821.83 +
821.84 + JTextArea textArea = new JTextArea(htmlSample);
821.85 +
821.86 + textArea.setLineWrap(true);
821.87 +
821.88 + result.add(textArea);
821.89 +
821.90 + String imageName = "sample" + i + ".png";
821.91 + URL resource = bug7030332.class.getResource(imageName);
821.92 +
821.93 + result.add(resource == null ? new JLabel(imageName + " not found") :
821.94 + new JLabel(new ImageIcon(resource), SwingConstants.LEFT));
821.95 +
821.96 + result.add(new JEditorPane("text/html", htmlSample));
821.97 + }
821.98 +
821.99 + return result;
821.100 + }
821.101 +}
822.1 Binary file test/javax/swing/text/html/TableView/7030332/sample0.png has changed
823.1 Binary file test/javax/swing/text/html/TableView/7030332/sample1.png has changed
824.1 Binary file test/javax/swing/text/html/TableView/7030332/sample2.png has changed
825.1 Binary file test/javax/swing/text/html/TableView/7030332/sample3.png has changed
826.1 Binary file test/javax/swing/text/html/TableView/7030332/sample4.png has changed
827.1 --- a/test/sun/net/www/protocol/file/DirPermissionDenied.sh Thu Sep 01 13:54:38 2011 -0700
827.2 +++ b/test/sun/net/www/protocol/file/DirPermissionDenied.sh Mon Sep 05 23:58:19 2011 -0700
827.3 @@ -37,5 +37,9 @@
827.4
827.5 $TESTJAVA/bin/java -classpath $TESTCLASSES DirPermissionDenied ${TESTDIR}
827.6 result=$?
827.7 +
827.8 +# Add back read access for user, otherwise not removable on some systems
827.9 +chmod u+r ${TESTDIR}
827.10 +
827.11 rm -rf ${TESTDIR}
827.12 exit $result
828.1 --- a/test/sun/nio/cs/TestCp834_SBCS.java Thu Sep 01 13:54:38 2011 -0700
828.2 +++ b/test/sun/nio/cs/TestCp834_SBCS.java Mon Sep 05 23:58:19 2011 -0700
828.3 @@ -26,7 +26,6 @@
828.4 @summary Check all Cp933 SBCS characters are not supported in Cp834
828.5 */
828.6
828.7 -import sun.io.*;
828.8 import java.io.*;
828.9 import java.nio.*;
828.10 import java.nio.charset.*;
828.11 @@ -36,8 +35,6 @@
828.12 // The correctness of 1:1 mapping is Coverted by CoderTest.java
828.13 // and TestConv.java, we only need to verify that SBCS characters
828.14 // are not supported by this charset.
828.15 - CharToByteConverter cb834 = CharToByteConverter.getConverter("Cp834");
828.16 - ByteToCharConverter bc834 = ByteToCharConverter.getConverter("Cp834");
828.17 CharsetEncoder enc834 = Charset.forName("Cp834")
828.18 .newEncoder()
828.19 .onUnmappableCharacter(CodingErrorAction.REPLACE)
828.20 @@ -73,27 +70,6 @@
828.21 ByteBuffer bb = enc834.encode(CharBuffer.wrap(ca));
828.22 if (bb.get() != (byte)0xfe || bb.get() != (byte)0xfe)
828.23 throw new Exception("SBCS is supported in IBM834 encoder");
828.24 -
828.25 - boolean isMalformed = false;
828.26 - int ret = 0;
828.27 - bc834.reset();
828.28 - try {
828.29 - ret = bc834.convert(ba, 0, 1, ca, 0, 1);
828.30 - } catch (sun.io.MalformedInputException x) { isMalformed = true; }
828.31 - if (!isMalformed && ret != 0 && ca[0] != '\ufffd') {
828.32 - // three scenarios (1)malformed (2)held as an incomplete
828.33 - // input or (3)return replacement all mean "no sbcs"
828.34 - throw new Exception("SBCS is supported in Cp834 b2c");
828.35 - }
828.36 -
828.37 - if (cb834.canConvert(c))
828.38 - throw new Exception("SBCS can be converted in Cp834 c2b ");
828.39 -
828.40 - ca[0] = c;
828.41 - if (cb834.convert(ca, 0, 1, ba2, 0, 2) != 2 ||
828.42 - ba2[0] != (byte)0xfe || ba2[1] != (byte)0xfe) {
828.43 - throw new Exception("SBCS is supported in Cp834 c2b");
828.44 - }
828.45 }
828.46 }
828.47 }
829.1 --- a/test/sun/nio/cs/TestISCII91.java Thu Sep 01 13:54:38 2011 -0700
829.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
829.3 @@ -1,71 +0,0 @@
829.4 -/*
829.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
829.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
829.7 - *
829.8 - * This code is free software; you can redistribute it and/or modify it
829.9 - * under the terms of the GNU General Public License version 2 only, as
829.10 - * published by the Free Software Foundation.
829.11 - *
829.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
829.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
829.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
829.15 - * version 2 for more details (a copy is included in the LICENSE file that
829.16 - * accompanied this code).
829.17 - *
829.18 - * You should have received a copy of the GNU General Public License version
829.19 - * 2 along with this work; if not, write to the Free Software Foundation,
829.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
829.21 - *
829.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
829.23 - * or visit www.oracle.com if you need additional information or have any
829.24 - * questions.
829.25 - */
829.26 -
829.27 -/* @test
829.28 - @bug 6431650
829.29 - @summary Check charset ISCII91 and C2B/B2CISCII91 yield same encoding/decoding result
829.30 - */
829.31 -
829.32 -
829.33 -import java.nio.*;
829.34 -import java.nio.charset.*;
829.35 -import sun.io.*;
829.36 -
829.37 -public class TestISCII91 {
829.38 - public static void main(String[] args) throws Throwable{
829.39 - CharToByteConverter c2b = new CharToByteISCII91();
829.40 - ByteToCharConverter b2c = new ByteToCharISCII91();
829.41 - Charset cs = Charset.forName("ISCII91");
829.42 - String charsToEncode = getCharsForEncoding("ISCII91");
829.43 -
829.44 - byte [] c2bBytes = c2b.convertAll(charsToEncode.toCharArray());
829.45 - byte [] csBytes = cs.encode(charsToEncode).array();
829.46 - for (int i = 0; i < c2bBytes.length; ++i) {
829.47 - if (c2bBytes[i] != csBytes[i])
829.48 - throw new RuntimeException("ISCII91 encoding failed!");
829.49 - }
829.50 -
829.51 - char[] c2bChars = b2c.convertAll(c2bBytes);
829.52 - char[] csChars = cs.decode(ByteBuffer.wrap(csBytes)).array();
829.53 - for (int i = 0; i < c2bChars.length; ++i) {
829.54 - if (c2bChars[i] != csChars[i])
829.55 - throw new RuntimeException("ISCII91 decoding failed!");
829.56 - }
829.57 - }
829.58 -
829.59 -
829.60 - static String getCharsForEncoding(String encodingName)
829.61 - throws CharacterCodingException{
829.62 - Charset set = Charset.forName(encodingName);
829.63 - CharBuffer chars = CharBuffer.allocate(300);
829.64 - CharsetEncoder encoder = set.newEncoder();
829.65 - for (int c = 0; chars.remaining() > 0 && c < Character.MAX_VALUE; ++c) {
829.66 - if (Character.isDefined((char) c) && !Character.isISOControl((char) c) && encoder.canEncode((char) c)) {
829.67 - chars.put((char) c);
829.68 - }
829.69 - }
829.70 - chars.limit(chars.position());
829.71 - chars.rewind();
829.72 - return chars.toString();
829.73 - }
829.74 -}
830.1 --- a/test/sun/security/ec/TestEC.java Thu Sep 01 13:54:38 2011 -0700
830.2 +++ b/test/sun/security/ec/TestEC.java Mon Sep 05 23:58:19 2011 -0700
830.3 @@ -28,11 +28,13 @@
830.4 * @library ../pkcs11
830.5 * @library ../pkcs11/ec
830.6 * @library ../pkcs11/sslecc
830.7 + * @library ../../../java/security/testlibrary
830.8 * @compile -XDignore.symbol.file TestEC.java
830.9 * @run main TestEC
830.10 */
830.11
830.12 import java.security.Provider;
830.13 +import java.security.Security;
830.14
830.15 /*
830.16 * Leverage the collection of EC tests used by PKCS11
830.17 @@ -51,6 +53,15 @@
830.18 public class TestEC {
830.19
830.20 public static void main(String[] args) throws Exception {
830.21 + ProvidersSnapshot snapshot = ProvidersSnapshot.create();
830.22 + try {
830.23 + main0(args);
830.24 + } finally {
830.25 + snapshot.restore();
830.26 + }
830.27 + }
830.28 +
830.29 + public static void main0(String[] args) throws Exception {
830.30 Provider p = new sun.security.ec.SunEC();
830.31 System.out.println("Running tests with " + p.getName() +
830.32 " provider...\n");
830.33 @@ -67,6 +78,11 @@
830.34 new TestECGenSpec().main(p);
830.35 new ReadPKCS12().main(p);
830.36 new ReadCertificates().main(p);
830.37 +
830.38 + // ClientJSSEServerJSSE fails on Solaris 11 when both SunEC and
830.39 + // SunPKCS11-Solaris providers are enabled.
830.40 + // Workaround:
830.41 + // Security.removeProvider("SunPKCS11-Solaris");
830.42 new ClientJSSEServerJSSE().main(p);
830.43
830.44 long stop = System.currentTimeMillis();
831.1 --- a/test/sun/security/jgss/spnego/NoSpnegoAsDefMech.java Thu Sep 01 13:54:38 2011 -0700
831.2 +++ b/test/sun/security/jgss/spnego/NoSpnegoAsDefMech.java Mon Sep 05 23:58:19 2011 -0700
831.3 @@ -36,7 +36,7 @@
831.4 public static void main(String[] argv) throws Exception {
831.5 System.setProperty("sun.security.jgss.mechanism", GSSUtil.GSS_SPNEGO_MECH_OID.toString());
831.6 try {
831.7 - GSSManager.getInstance().createName("service@host", GSSName.NT_HOSTBASED_SERVICE, new Oid("1.3.6.1.5.5.2"));
831.8 + GSSManager.getInstance().createName("service@localhost", GSSName.NT_HOSTBASED_SERVICE, new Oid("1.3.6.1.5.5.2"));
831.9 } catch (GSSException e) {
831.10 // This is OK, for example, krb5.conf is missing or other problems
831.11 }
832.1 --- a/test/sun/security/krb5/Krb5NameEquals.java Thu Sep 01 13:54:38 2011 -0700
832.2 +++ b/test/sun/security/krb5/Krb5NameEquals.java Mon Sep 05 23:58:19 2011 -0700
832.3 @@ -31,8 +31,8 @@
832.4
832.5 public class Krb5NameEquals {
832.6
832.7 - private static String NAME_STR1 = "service@host";
832.8 - private static String NAME_STR2 = "service@host2";
832.9 + private static String NAME_STR1 = "service@localhost";
832.10 + private static String NAME_STR2 = "service2@localhost";
832.11 private static final Oid MECH;
832.12
832.13 static {
832.14 @@ -57,7 +57,7 @@
832.15 GSSName name3 = mgr.createName(NAME_STR1,
832.16 GSSName.NT_HOSTBASED_SERVICE, MECH);
832.17
832.18 - if (!name1.equals(name3) || !name1.equals(name3) ||
832.19 + if (!name1.equals(name1) || !name1.equals(name3) ||
832.20 !name1.equals((Object) name1) ||
832.21 !name1.equals((Object) name3)) {
832.22 System.out.println("Error: should be the same name");
833.1 --- a/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh Thu Sep 01 13:54:38 2011 -0700
833.2 +++ b/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh Mon Sep 05 23:58:19 2011 -0700
833.3 @@ -25,6 +25,8 @@
833.4 # @bug 6599979
833.5 # @summary Ensure that re-assigning the alias works
833.6 #
833.7 +# @library ..
833.8 +# @build SecretKeysBasic
833.9 # @run shell SecretKeysBasic.sh
833.10 #
833.11 # To run by hand:
833.12 @@ -43,10 +45,9 @@
833.13 if [ "${TESTCLASSES}" = "" ] ; then
833.14 TESTCLASSES=`pwd`
833.15 fi
833.16 -
833.17 -# if running by hand on windows, change this to appropriate value
833.18 if [ "${TESTJAVA}" = "" ] ; then
833.19 - TESTJAVA="/net/shimmer/export/valeriep/jdk7/build/solaris-sparc"
833.20 + JAVAC_CMD=`which javac`
833.21 + TESTJAVA=`dirname $JAVAC_CMD`/..
833.22 fi
833.23 echo TESTSRC=${TESTSRC}
833.24 echo TESTCLASSES=${TESTCLASSES}
833.25 @@ -63,19 +64,41 @@
833.26 SunOS )
833.27 FS="/"
833.28 PS=":"
833.29 - SCCS="${FS}usr${FS}ccs${FS}bin${FS}sccs"
833.30 - CP="${FS}bin${FS}cp -f"
833.31 - RM="${FS}bin${FS}rm -rf"
833.32 - MKDIR="${FS}bin${FS}mkdir -p"
833.33 - CHMOD="${FS}bin${FS}chmod"
833.34 + OS_VERSION=`uname -r`
833.35 + case "${OS_VERSION}" in
833.36 + 5.1* )
833.37 + SOFTTOKEN_DIR=${TESTCLASSES}
833.38 + export SOFTTOKEN_DIR
833.39 + TOKENS="nss solaris"
833.40 + ;;
833.41 + * )
833.42 + # SunPKCS11-Solaris Test only runs on Solaris 5.10 and later
833.43 + TOKENS="nss"
833.44 + ;;
833.45 + esac
833.46 + ;;
833.47 + Windows_* )
833.48 + FS="\\"
833.49 + PS=";"
833.50 + TOKENS="nss"
833.51 + ;;
833.52 + CYGWIN* )
833.53 + FS="/"
833.54 + PS=";"
833.55 + TOKENS="nss"
833.56 ;;
833.57 * )
833.58 - echo "Unsupported System ${OS} - Test only runs on Solaris"
833.59 - exit 0;
833.60 + FS="/"
833.61 + PS=":"
833.62 + TOKENS="nss"
833.63 ;;
833.64 esac
833.65
833.66 -TOKENS="nss solaris"
833.67 +CP="cp -f"
833.68 +RM="rm -rf"
833.69 +MKDIR="mkdir -p"
833.70 +CHMOD="chmod"
833.71 +
833.72 STATUS=0
833.73 for token in ${TOKENS}
833.74 do
833.75 @@ -91,18 +114,6 @@
833.76 USED_FILE_LIST="${TESTCLASSES}${FS}cert8.db ${TESTCLASSES}${FS}key3.db"
833.77 elif [ ${token} = "solaris" ]
833.78 then
833.79 - OS_VERSION=`uname -r`
833.80 - case "${OS_VERSION}" in
833.81 - 5.1* )
833.82 - SOFTTOKEN_DIR=${TESTCLASSES}
833.83 - export SOFTTOKEN_DIR
833.84 - ;;
833.85 - * )
833.86 - echo "Unsupported Version ${OS_VERSION} - Test only runs on Solaris"
833.87 - exit 0;
833.88 - ;;
833.89 - esac
833.90 -
833.91 # copy keystore into write-able location
833.92 if [ -d ${TESTCLASSES}${FS}pkcs11_softtoken ]
833.93 then
833.94 @@ -127,12 +138,6 @@
833.95 USED_FILE_LIST="${TESTCLASSES}${FS}pkcs11_softtoken"
833.96 fi
833.97
833.98 -cd ${TESTCLASSES}
833.99 -${TESTJAVA}${FS}bin${FS}javac \
833.100 - -classpath ${TESTCLASSES} \
833.101 - -d ${TESTCLASSES} \
833.102 - ${TESTSRC}${FS}SecretKeysBasic.java
833.103 -
833.104 # run test
833.105 cd ${TESTSRC}
833.106 ${TESTJAVA}${FS}bin${FS}java \
834.1 --- a/test/sun/security/pkcs11/PKCS11Test.java Thu Sep 01 13:54:38 2011 -0700
834.2 +++ b/test/sun/security/pkcs11/PKCS11Test.java Mon Sep 05 23:58:19 2011 -0700
834.3 @@ -72,10 +72,33 @@
834.4 }
834.5
834.6 public static void main(PKCS11Test test) throws Exception {
834.7 - System.out.println("Beginning test run " + test.getClass().getName() + "...");
834.8 - testDefault(test);
834.9 - testNSS(test);
834.10 - testDeimos(test);
834.11 + Provider[] oldProviders = Security.getProviders();
834.12 + try {
834.13 + System.out.println("Beginning test run " + test.getClass().getName() + "...");
834.14 + testDefault(test);
834.15 + testNSS(test);
834.16 + testDeimos(test);
834.17 + } finally {
834.18 + Provider[] newProviders = Security.getProviders();
834.19 + // Do not restore providers if nothing changed. This is especailly
834.20 + // useful for ./Provider/Login.sh, where a SecurityManager exists.
834.21 + if (oldProviders.length == newProviders.length) {
834.22 + boolean found = false;
834.23 + for (int i = 0; i<oldProviders.length; i++) {
834.24 + if (oldProviders[i] != newProviders[i]) {
834.25 + found = true;
834.26 + break;
834.27 + }
834.28 + }
834.29 + if (!found) return;
834.30 + }
834.31 + for (Provider p: newProviders) {
834.32 + Security.removeProvider(p.getName());
834.33 + }
834.34 + for (Provider p: oldProviders) {
834.35 + Security.addProvider(p);
834.36 + }
834.37 + }
834.38 }
834.39
834.40 public static void testDeimos(PKCS11Test test) throws Exception {
834.41 @@ -153,21 +176,21 @@
834.42 return libdir;
834.43 }
834.44
834.45 + protected static void safeReload(String lib) throws Exception {
834.46 + try {
834.47 + System.load(lib);
834.48 + } catch (UnsatisfiedLinkError e) {
834.49 + if (e.getMessage().contains("already loaded")) {
834.50 + return;
834.51 + }
834.52 + }
834.53 + }
834.54 +
834.55 static boolean loadNSPR(String libdir) throws Exception {
834.56 // load NSS softoken dependencies in advance to avoid resolver issues
834.57 - try {
834.58 - System.load(libdir + System.mapLibraryName(NSPR_PREFIX + "nspr4"));
834.59 - } catch (UnsatisfiedLinkError e) {
834.60 - // GLIBC problem on older linux-amd64 machines
834.61 - if (libdir.contains("linux-amd64")) {
834.62 - System.out.println(e);
834.63 - System.out.println("NSS does not work on this platform, skipping.");
834.64 - return false;
834.65 - }
834.66 - throw e;
834.67 - }
834.68 - System.load(libdir + System.mapLibraryName(NSPR_PREFIX + "plc4"));
834.69 - System.load(libdir + System.mapLibraryName(NSPR_PREFIX + "plds4"));
834.70 + safeReload(libdir + System.mapLibraryName(NSPR_PREFIX + "nspr4"));
834.71 + safeReload(libdir + System.mapLibraryName(NSPR_PREFIX + "plc4"));
834.72 + safeReload(libdir + System.mapLibraryName(NSPR_PREFIX + "plds4"));
834.73 return true;
834.74 }
834.75
835.1 --- a/test/sun/security/pkcs11/Secmod/AddPrivateKey.java Thu Sep 01 13:54:38 2011 -0700
835.2 +++ b/test/sun/security/pkcs11/Secmod/AddPrivateKey.java Mon Sep 05 23:58:19 2011 -0700
835.3 @@ -27,6 +27,7 @@
835.4 * @summary Test that the PKCS#11 KeyStore handles RSA, DSA, and EC keys
835.5 * @author Andreas Sterbenz
835.6 * @library ..
835.7 + * @run main/othervm AddPrivateKey
835.8 */
835.9
835.10 import java.io.*;
836.1 --- a/test/sun/security/pkcs11/Secmod/AddTrustedCert.java Thu Sep 01 13:54:38 2011 -0700
836.2 +++ b/test/sun/security/pkcs11/Secmod/AddTrustedCert.java Mon Sep 05 23:58:19 2011 -0700
836.3 @@ -27,6 +27,7 @@
836.4 * @summary make sure we can add a trusted cert to the NSS KeyStore module
836.5 * @author Andreas Sterbenz
836.6 * @library ..
836.7 + * @run main/othervm AddTrustedCert
836.8 */
836.9
836.10 import java.io.*;
837.1 --- a/test/sun/security/pkcs11/Secmod/Crypto.java Thu Sep 01 13:54:38 2011 -0700
837.2 +++ b/test/sun/security/pkcs11/Secmod/Crypto.java Mon Sep 05 23:58:19 2011 -0700
837.3 @@ -27,6 +27,7 @@
837.4 * @summary verify that NSS no-db mode works correctly
837.5 * @author Andreas Sterbenz
837.6 * @library ..
837.7 + * @run main/othervm Crypto
837.8 */
837.9
837.10 import java.util.*;
838.1 --- a/test/sun/security/pkcs11/Secmod/GetPrivateKey.java Thu Sep 01 13:54:38 2011 -0700
838.2 +++ b/test/sun/security/pkcs11/Secmod/GetPrivateKey.java Mon Sep 05 23:58:19 2011 -0700
838.3 @@ -27,6 +27,7 @@
838.4 * @summary make sure we can access the NSS softtoken KeyStore and use a private key
838.5 * @author Andreas Sterbenz
838.6 * @library ..
838.7 + * @run main/othervm GetPrivateKey
838.8 */
838.9
838.10 import java.util.*;
839.1 --- a/test/sun/security/pkcs11/Secmod/JksSetPrivateKey.java Thu Sep 01 13:54:38 2011 -0700
839.2 +++ b/test/sun/security/pkcs11/Secmod/JksSetPrivateKey.java Mon Sep 05 23:58:19 2011 -0700
839.3 @@ -27,6 +27,7 @@
839.4 * @summary store a NSS PKCS11 PrivateKeyEntry to JKS KeyStore throws confusing NPE
839.5 * @author Wang Weijun
839.6 * @library ..
839.7 + * @run main/othervm JksSetPrivateKey
839.8 */
839.9
839.10 import java.util.*;
840.1 --- a/test/sun/security/pkcs11/Secmod/TrustAnchors.java Thu Sep 01 13:54:38 2011 -0700
840.2 +++ b/test/sun/security/pkcs11/Secmod/TrustAnchors.java Mon Sep 05 23:58:19 2011 -0700
840.3 @@ -27,6 +27,7 @@
840.4 * @summary make sure we can access the NSS trust anchor module
840.5 * @author Andreas Sterbenz
840.6 * @library ..
840.7 + * @run main/othervm TrustAnchors
840.8 */
840.9
840.10 import java.util.*;
841.1 --- a/test/sun/security/pkcs11/SecmodTest.java Thu Sep 01 13:54:38 2011 -0700
841.2 +++ b/test/sun/security/pkcs11/SecmodTest.java Mon Sep 05 23:58:19 2011 -0700
841.3 @@ -44,8 +44,8 @@
841.4 if (loadNSPR(LIBPATH) == false) {
841.5 return false;
841.6 }
841.7 - System.load(LIBPATH + System.mapLibraryName("softokn3"));
841.8 - System.load(LIBPATH + System.mapLibraryName("nssckbi"));
841.9 + safeReload(LIBPATH + System.mapLibraryName("softokn3"));
841.10 + safeReload(LIBPATH + System.mapLibraryName("nssckbi"));
841.11
841.12 DBDIR = System.getProperty("test.classes", ".") + SEP + "tmpdb";
841.13 System.setProperty("pkcs11test.nss.db", DBDIR);
842.1 --- a/test/sun/security/pkcs11/ec/ReadCertificates.java Thu Sep 01 13:54:38 2011 -0700
842.2 +++ b/test/sun/security/pkcs11/ec/ReadCertificates.java Mon Sep 05 23:58:19 2011 -0700
842.3 @@ -28,6 +28,7 @@
842.4 * and verify their signatures
842.5 * @author Andreas Sterbenz
842.6 * @library ..
842.7 + * @library ../../../../java/security/testlibrary
842.8 */
842.9
842.10 import java.io.*;
842.11 @@ -62,7 +63,7 @@
842.12 System.out.println("Provider does not support ECDSA, skipping...");
842.13 return;
842.14 }
842.15 - Security.insertProviderAt(p, 1);
842.16 + Providers.setAt(p, 1);
842.17
842.18 random = new SecureRandom();
842.19 factory = CertificateFactory.getInstance("X.509");
843.1 --- a/test/sun/security/pkcs11/ec/ReadPKCS12.java Thu Sep 01 13:54:38 2011 -0700
843.2 +++ b/test/sun/security/pkcs11/ec/ReadPKCS12.java Mon Sep 05 23:58:19 2011 -0700
843.3 @@ -27,6 +27,7 @@
843.4 * @summary Verify that we can parse ECPrivateKeys from PKCS#12 and use them
843.5 * @author Andreas Sterbenz
843.6 * @library ..
843.7 + * @library ../../../../java/security/testlibrary
843.8 */
843.9
843.10 import java.io.*;
843.11 @@ -52,7 +53,7 @@
843.12 System.out.println("Provider does not support ECDSA, skipping...");
843.13 return;
843.14 }
843.15 - Security.insertProviderAt(p, 1);
843.16 + Providers.setAt(p, 1);
843.17
843.18 CertificateFactory factory = CertificateFactory.getInstance("X.509");
843.19 try {
844.1 --- a/test/sun/security/pkcs11/ec/TestECDH.java Thu Sep 01 13:54:38 2011 -0700
844.2 +++ b/test/sun/security/pkcs11/ec/TestECDH.java Mon Sep 05 23:58:19 2011 -0700
844.3 @@ -27,6 +27,7 @@
844.4 * @summary Basic known answer test for ECDH
844.5 * @author Andreas Sterbenz
844.6 * @library ..
844.7 + * @library ../../../../java/security/testlibrary
844.8 */
844.9
844.10 import java.io.*;
844.11 @@ -59,7 +60,7 @@
844.12 System.out.println("Provider does not support ECDH, skipping");
844.13 return;
844.14 }
844.15 - Security.insertProviderAt(p, 1);
844.16 + Providers.setAt(p, 1);
844.17
844.18 if (false) {
844.19 KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", p);
845.1 --- a/test/sun/security/pkcs11/ec/TestECDSA.java Thu Sep 01 13:54:38 2011 -0700
845.2 +++ b/test/sun/security/pkcs11/ec/TestECDSA.java Mon Sep 05 23:58:19 2011 -0700
845.3 @@ -27,6 +27,7 @@
845.4 * @summary basic test of SHA1withECDSA and NONEwithECDSA signing/verifying
845.5 * @author Andreas Sterbenz
845.6 * @library ..
845.7 + * @library ../../../../java/security/testlibrary
845.8 */
845.9
845.10 import java.io.*;
845.11 @@ -115,7 +116,7 @@
845.12 System.out.println("ECDSA not supported, skipping");
845.13 return;
845.14 }
845.15 - Security.insertProviderAt(provider, 1);
845.16 + Providers.setAt(provider, 1);
845.17
845.18 if (false) {
845.19 KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", provider);
846.1 --- a/test/sun/security/pkcs11/fips/CipherTest.java Thu Sep 01 13:54:38 2011 -0700
846.2 +++ b/test/sun/security/pkcs11/fips/CipherTest.java Mon Sep 05 23:58:19 2011 -0700
846.3 @@ -394,47 +394,52 @@
846.4
846.5 public static void main(PeerFactory peerFactory, KeyStore keyStore,
846.6 String[] args) throws Exception {
846.7 + SSLContext reservedSSLContext = SSLContext.getDefault();
846.8 + try {
846.9 + long time = System.currentTimeMillis();
846.10 + String relPath;
846.11 + if ((args != null) && (args.length > 0) && args[0].equals("sh")) {
846.12 + relPath = pathToStoresSH;
846.13 + } else {
846.14 + relPath = pathToStores;
846.15 + }
846.16 + PATH = new File(System.getProperty("test.src", "."), relPath);
846.17 + CipherTest.peerFactory = peerFactory;
846.18 + System.out.print(
846.19 + "Initializing test '" + peerFactory.getName() + "'...");
846.20 +// secureRandom = new SecureRandom();
846.21 +// secureRandom.nextInt();
846.22 +// trustStore = readKeyStore(trustStoreFile);
846.23 + CipherTest.keyStore = keyStore;
846.24 +// keyStore = readKeyStore(keyStoreFile);
846.25 + KeyManagerFactory keyFactory =
846.26 + KeyManagerFactory.getInstance(
846.27 + KeyManagerFactory.getDefaultAlgorithm());
846.28 + keyFactory.init(keyStore, "test12".toCharArray());
846.29 + keyManager = (X509ExtendedKeyManager)keyFactory.getKeyManagers()[0];
846.30
846.31 - long time = System.currentTimeMillis();
846.32 - String relPath;
846.33 - if ((args != null) && (args.length > 0) && args[0].equals("sh")) {
846.34 - relPath = pathToStoresSH;
846.35 - } else {
846.36 - relPath = pathToStores;
846.37 + TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
846.38 + tmf.init(keyStore);
846.39 + trustManager = (X509TrustManager)tmf.getTrustManagers()[0];
846.40 +
846.41 +// trustManager = new AlwaysTrustManager();
846.42 + SSLContext context = SSLContext.getInstance("TLS");
846.43 + context.init(new KeyManager[] {keyManager},
846.44 + new TrustManager[] {trustManager}, null);
846.45 + SSLContext.setDefault(context);
846.46 +
846.47 + CipherTest cipherTest = new CipherTest(peerFactory);
846.48 + Thread serverThread = new Thread(peerFactory.newServer(cipherTest),
846.49 + "Server");
846.50 + serverThread.setDaemon(true);
846.51 + serverThread.start();
846.52 + System.out.println("Done");
846.53 + cipherTest.run();
846.54 + time = System.currentTimeMillis() - time;
846.55 + System.out.println("Done. (" + time + " ms)");
846.56 + } finally {
846.57 + SSLContext.setDefault(reservedSSLContext);
846.58 }
846.59 - PATH = new File(System.getProperty("test.src", "."), relPath);
846.60 - CipherTest.peerFactory = peerFactory;
846.61 - System.out.print(
846.62 - "Initializing test '" + peerFactory.getName() + "'...");
846.63 -// secureRandom = new SecureRandom();
846.64 -// secureRandom.nextInt();
846.65 -// trustStore = readKeyStore(trustStoreFile);
846.66 - CipherTest.keyStore = keyStore;
846.67 -// keyStore = readKeyStore(keyStoreFile);
846.68 - KeyManagerFactory keyFactory =
846.69 - KeyManagerFactory.getInstance(
846.70 - KeyManagerFactory.getDefaultAlgorithm());
846.71 - keyFactory.init(keyStore, "test12".toCharArray());
846.72 - keyManager = (X509ExtendedKeyManager)keyFactory.getKeyManagers()[0];
846.73 -
846.74 - TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
846.75 - tmf.init(keyStore);
846.76 - trustManager = (X509TrustManager)tmf.getTrustManagers()[0];
846.77 -
846.78 -// trustManager = new AlwaysTrustManager();
846.79 - SSLContext context = SSLContext.getInstance("TLS");
846.80 - context.init(new KeyManager[] {keyManager}, new TrustManager[] {trustManager}, null);
846.81 - SSLContext.setDefault(context);
846.82 -
846.83 - CipherTest cipherTest = new CipherTest(peerFactory);
846.84 - Thread serverThread = new Thread(peerFactory.newServer(cipherTest),
846.85 - "Server");
846.86 - serverThread.setDaemon(true);
846.87 - serverThread.start();
846.88 - System.out.println("Done");
846.89 - cipherTest.run();
846.90 - time = System.currentTimeMillis() - time;
846.91 - System.out.println("Done. (" + time + " ms)");
846.92 }
846.93
846.94 static abstract class PeerFactory {
847.1 --- a/test/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java Thu Sep 01 13:54:38 2011 -0700
847.2 +++ b/test/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java Mon Sep 05 23:58:19 2011 -0700
847.3 @@ -26,6 +26,7 @@
847.4 * @bug 6313675 6323647
847.5 * @summary Verify that all ciphersuites work in FIPS mode
847.6 * @library ..
847.7 + * @run main/othervm ClientJSSEServerJSSE
847.8 * @ignore JSSE supported cipher suites are changed with CR 6916074,
847.9 * need to update this test case in JDK 7 soon
847.10 * @author Andreas Sterbenz
848.1 --- a/test/sun/security/pkcs11/fips/TrustManagerTest.java Thu Sep 01 13:54:38 2011 -0700
848.2 +++ b/test/sun/security/pkcs11/fips/TrustManagerTest.java Mon Sep 05 23:58:19 2011 -0700
848.3 @@ -27,6 +27,7 @@
848.4 * @summary Verify that the SunJSSE trustmanager works correctly in FIPS mode
848.5 * @author Andreas Sterbenz
848.6 * @library ..
848.7 + * @run main/othervm TrustManagerTest
848.8 */
848.9
848.10 import java.io.*;
849.1 --- a/test/sun/security/pkcs11/rsa/TestCACerts.java Thu Sep 01 13:54:38 2011 -0700
849.2 +++ b/test/sun/security/pkcs11/rsa/TestCACerts.java Mon Sep 05 23:58:19 2011 -0700
849.3 @@ -48,32 +48,35 @@
849.4 public void main(Provider p) throws Exception {
849.5 long start = System.currentTimeMillis();
849.6 Security.addProvider(p);
849.7 - String PROVIDER = p.getName();
849.8 - String javaHome = System.getProperty("java.home");
849.9 - String caCerts = javaHome + SEP + "lib" + SEP + "security" + SEP + "cacerts";
849.10 - InputStream in = new FileInputStream(caCerts);
849.11 - KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
849.12 - ks.load(in, null);
849.13 - in.close();
849.14 - for (Enumeration e = ks.aliases(); e.hasMoreElements(); ) {
849.15 - String alias = (String)e.nextElement();
849.16 - if (ks.isCertificateEntry(alias)) {
849.17 - System.out.println("* Testing " + alias + "...");
849.18 - X509Certificate cert = (X509Certificate)ks.getCertificate(alias);
849.19 - PublicKey key = cert.getPublicKey();
849.20 - String alg = key.getAlgorithm();
849.21 - if (alg.equals("RSA")) {
849.22 - System.out.println("Signature algorithm: " + cert.getSigAlgName());
849.23 - cert.verify(key, PROVIDER);
849.24 + try {
849.25 + String PROVIDER = p.getName();
849.26 + String javaHome = System.getProperty("java.home");
849.27 + String caCerts = javaHome + SEP + "lib" + SEP + "security" + SEP + "cacerts";
849.28 + InputStream in = new FileInputStream(caCerts);
849.29 + KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
849.30 + ks.load(in, null);
849.31 + in.close();
849.32 + for (Enumeration e = ks.aliases(); e.hasMoreElements(); ) {
849.33 + String alias = (String)e.nextElement();
849.34 + if (ks.isCertificateEntry(alias)) {
849.35 + System.out.println("* Testing " + alias + "...");
849.36 + X509Certificate cert = (X509Certificate)ks.getCertificate(alias);
849.37 + PublicKey key = cert.getPublicKey();
849.38 + String alg = key.getAlgorithm();
849.39 + if (alg.equals("RSA")) {
849.40 + System.out.println("Signature algorithm: " + cert.getSigAlgName());
849.41 + cert.verify(key, PROVIDER);
849.42 + } else {
849.43 + System.out.println("Skipping cert with key: " + alg);
849.44 + }
849.45 } else {
849.46 - System.out.println("Skipping cert with key: " + alg);
849.47 + System.out.println("Skipping alias " + alias);
849.48 }
849.49 - } else {
849.50 - System.out.println("Skipping alias " + alias);
849.51 }
849.52 + long stop = System.currentTimeMillis();
849.53 + System.out.println("All tests passed (" + (stop - start) + " ms).");
849.54 + } finally {
849.55 + Security.removeProvider(p.getName());
849.56 }
849.57 - long stop = System.currentTimeMillis();
849.58 - System.out.println("All tests passed (" + (stop - start) + " ms).");
849.59 }
849.60 -
849.61 }
850.1 --- a/test/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java Thu Sep 01 13:54:38 2011 -0700
850.2 +++ b/test/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java Mon Sep 05 23:58:19 2011 -0700
850.3 @@ -27,6 +27,7 @@
850.4 * @summary Verify that all ciphersuites work (incl. ECC using NSS crypto)
850.5 * @author Andreas Sterbenz
850.6 * @library ..
850.7 + * @library ../../../../java/security/testlibrary
850.8 */
850.9
850.10 import java.security.*;
850.11 @@ -45,7 +46,7 @@
850.12 System.out.println("Provider does not support EC, skipping");
850.13 return;
850.14 }
850.15 - Security.insertProviderAt(p, 1);
850.16 + Providers.setAt(p, 1);
850.17 CipherTest.main(new JSSEFactory(), cmdArgs);
850.18 Security.removeProvider(p.getName());
850.19 }
851.1 --- a/test/sun/security/pkcs12/PKCS12SameKeyId.java Thu Sep 01 13:54:38 2011 -0700
851.2 +++ b/test/sun/security/pkcs12/PKCS12SameKeyId.java Mon Sep 05 23:58:19 2011 -0700
851.3 @@ -86,7 +86,9 @@
851.4
851.5 // Reads from JKS keystore and pre-calculate
851.6 KeyStore ks = KeyStore.getInstance("jks");
851.7 - ks.load(new FileInputStream(JKSFILE), PASSWORD);
851.8 + try (FileInputStream fis = new FileInputStream(JKSFILE)) {
851.9 + ks.load(fis, PASSWORD);
851.10 + }
851.11 for (int i=0; i<SIZE; i++) {
851.12 aliases[i] = "p" + i;
851.13 byte[] enckey = cipher.doFinal(
851.14 @@ -103,11 +105,15 @@
851.15 for (int i=0; i<SIZE; i++) {
851.16 p12.setKeyEntry(aliases[i], keys[i], certChains[i]);
851.17 }
851.18 - p12.store(new FileOutputStream(P12FILE), PASSWORD);
851.19 + try (FileOutputStream fos = new FileOutputStream(P12FILE)) {
851.20 + p12.store(fos, PASSWORD);
851.21 + }
851.22
851.23 // Check private keys still match certs
851.24 p12 = KeyStore.getInstance("pkcs12");
851.25 - p12.load(new FileInputStream(P12FILE), PASSWORD);
851.26 + try (FileInputStream fis = new FileInputStream(P12FILE)) {
851.27 + p12.load(fis, PASSWORD);
851.28 + }
851.29 for (int i=0; i<SIZE; i++) {
851.30 String a = "p" + i;
851.31 X509Certificate x = (X509Certificate)p12.getCertificate(a);
852.1 --- a/test/sun/security/provider/PolicyFile/Comparator.java Thu Sep 01 13:54:38 2011 -0700
852.2 +++ b/test/sun/security/provider/PolicyFile/Comparator.java Mon Sep 05 23:58:19 2011 -0700
852.3 @@ -24,6 +24,7 @@
852.4 /*
852.5 * @test
852.6 * @bug 5037004
852.7 + * @run main/othervm Comparator
852.8 * @summary Frivolous ClassCastExceptions thrown by SubjectCodeSource.implies
852.9 *
852.10 * Note: if you want to see the java.security.debug output,
853.1 --- a/test/sun/security/ssl/com/sun/net/ssl/SSLSecurity/ProviderTest.java Thu Sep 01 13:54:38 2011 -0700
853.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/SSLSecurity/ProviderTest.java Mon Sep 05 23:58:19 2011 -0700
853.3 @@ -40,28 +40,32 @@
853.4 TrustManagerFactory tmf;
853.5 KeyManagerFactory kmf;
853.6
853.7 - Security.addProvider(new MyProvider());
853.8 + Provider extraProvider = new MyProvider();
853.9 + Security.addProvider(extraProvider);
853.10 + try {
853.11 + System.out.println("getting a javax SSLContext");
853.12 + sslc = SSLContext.getInstance("javax");
853.13 + sslc.init(null, null, null);
853.14 + System.out.println("\ngetting a com SSLContext");
853.15 + sslc = SSLContext.getInstance("com");
853.16 + sslc.init(null, null, null);
853.17
853.18 - System.out.println("getting a javax SSLContext");
853.19 - sslc = SSLContext.getInstance("javax");
853.20 - sslc.init(null, null, null);
853.21 - System.out.println("\ngetting a com SSLContext");
853.22 - sslc = SSLContext.getInstance("com");
853.23 - sslc.init(null, null, null);
853.24 + System.out.println("\ngetting a javax TrustManagerFactory");
853.25 + tmf = TrustManagerFactory.getInstance("javax");
853.26 + tmf.init((KeyStore) null);
853.27 + System.out.println("\ngetting a com TrustManagerFactory");
853.28 + tmf = TrustManagerFactory.getInstance("com");
853.29 + tmf.init((KeyStore) null);
853.30
853.31 - System.out.println("\ngetting a javax TrustManagerFactory");
853.32 - tmf = TrustManagerFactory.getInstance("javax");
853.33 - tmf.init((KeyStore) null);
853.34 - System.out.println("\ngetting a com TrustManagerFactory");
853.35 - tmf = TrustManagerFactory.getInstance("com");
853.36 - tmf.init((KeyStore) null);
853.37 -
853.38 - System.out.println("\ngetting a javax KeyManagerFactory");
853.39 - kmf = KeyManagerFactory.getInstance("javax");
853.40 - kmf.init((KeyStore) null, null);
853.41 - System.out.println("\ngetting a com KeyManagerFactory");
853.42 - kmf = KeyManagerFactory.getInstance("com");
853.43 - kmf.init((KeyStore) null, null);
853.44 + System.out.println("\ngetting a javax KeyManagerFactory");
853.45 + kmf = KeyManagerFactory.getInstance("javax");
853.46 + kmf.init((KeyStore) null, null);
853.47 + System.out.println("\ngetting a com KeyManagerFactory");
853.48 + kmf = KeyManagerFactory.getInstance("com");
853.49 + kmf.init((KeyStore) null, null);
853.50 + } finally {
853.51 + Security.removeProvider(extraProvider.getName());
853.52 + }
853.53 }
853.54 }
853.55
854.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppInputStream/ReadBlocksClose.java Thu Sep 01 13:54:38 2011 -0700
854.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppInputStream/ReadBlocksClose.java Mon Sep 05 23:58:19 2011 -0700
854.3 @@ -25,6 +25,10 @@
854.4 * @test
854.5 * @bug 4814140
854.6 * @summary AppInputStream: read can block a close
854.7 + * @run main/othervm ReadBlocksClose
854.8 + *
854.9 + * SunJSSE does not support dynamic system properties, no way to re-use
854.10 + * system properties in samevm/agentvm mode.
854.11 * @author Brad Wetmore
854.12 */
854.13
855.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppInputStream/ReadHandshake.java Thu Sep 01 13:54:38 2011 -0700
855.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppInputStream/ReadHandshake.java Mon Sep 05 23:58:19 2011 -0700
855.3 @@ -25,6 +25,10 @@
855.4 * @test
855.5 * @bug 4514971
855.6 * @summary Verify applications do not read handshake data after failure
855.7 + * @run main/othervm ReadHandshake
855.8 + *
855.9 + * SunJSSE does not support dynamic system properties, no way to re-use
855.10 + * system properties in samevm/agentvm mode.
855.11 */
855.12
855.13 import java.io.*;
856.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppInputStream/ReadZeroBytes.java Thu Sep 01 13:54:38 2011 -0700
856.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppInputStream/ReadZeroBytes.java Mon Sep 05 23:58:19 2011 -0700
856.3 @@ -25,6 +25,10 @@
856.4 * @test
856.5 * @bug 6697270
856.6 * @summary Inputstream dosent behave correct
856.7 + * @run main/othervm ReadZeroBytes
856.8 + *
856.9 + * SunJSSE does not support dynamic system properties, no way to re-use
856.10 + * system properties in samevm/agentvm mode.
856.11 */
856.12
856.13 import java.io.*;
857.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppInputStream/RemoveMarkReset.java Thu Sep 01 13:54:38 2011 -0700
857.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppInputStream/RemoveMarkReset.java Mon Sep 05 23:58:19 2011 -0700
857.3 @@ -25,6 +25,10 @@
857.4 * @test
857.5 * @bug 4413664
857.6 * @summary remove mark/reset functionality from AppInputStream
857.7 + * @run main/othervm RemoveMarkReset
857.8 + *
857.9 + * SunJSSE does not support dynamic system properties, no way to re-use
857.10 + * system properties in samevm/agentvm mode.
857.11 * @author Brad Wetmore
857.12 */
857.13
858.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppOutputStream/NoExceptionOnClose.java Thu Sep 01 13:54:38 2011 -0700
858.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppOutputStream/NoExceptionOnClose.java Mon Sep 05 23:58:19 2011 -0700
858.3 @@ -25,6 +25,10 @@
858.4 * @test 1.3 01/03/08
858.5 * @bug 4378397
858.6 * @summary JSSE socket output stream doesn't throw after socket is closed
858.7 + * @run main/othervm NoExceptionOnClose
858.8 + *
858.9 + * SunJSSE does not support dynamic system properties, no way to re-use
858.10 + * system properties in samevm/agentvm mode.
858.11 * @author Jaya Hangal
858.12 */
858.13
859.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ClientHandshaker/CipherSuiteOrder.java Thu Sep 01 13:54:38 2011 -0700
859.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ClientHandshaker/CipherSuiteOrder.java Mon Sep 05 23:58:19 2011 -0700
859.3 @@ -26,6 +26,10 @@
859.4 * @bug 4330535
859.5 * @summary Client should follow suite order in
859.6 * SSLSocket.setEnabledCipherSuites()
859.7 + * @run main/othervm CipherSuiteOrder
859.8 + *
859.9 + * SunJSSE does not support dynamic system properties, no way to re-use
859.10 + * system properties in samevm/agentvm mode.
859.11 * @author Jaya Hangal
859.12 */
859.13
860.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ClientHandshaker/RSAExport.java Thu Sep 01 13:54:38 2011 -0700
860.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ClientHandshaker/RSAExport.java Mon Sep 05 23:58:19 2011 -0700
860.3 @@ -25,6 +25,10 @@
860.4 * @test
860.5 * @bug 6690018
860.6 * @summary RSAClientKeyExchange NullPointerException
860.7 + * @run main/othervm RSAExport
860.8 + *
860.9 + * SunJSSE does not support dynamic system properties, no way to re-use
860.10 + * system properties in samevm/agentvm mode.
860.11 */
860.12
860.13 /*
861.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/GenSSLConfigs/main.java Thu Sep 01 13:54:38 2011 -0700
861.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/GenSSLConfigs/main.java Mon Sep 05 23:58:19 2011 -0700
861.3 @@ -1,7 +1,10 @@
861.4 /*
861.5 * @test
861.6 * @build TestThread Traffic Handler ServerHandler ServerThread ClientThread
861.7 - * @run main/timeout=140 main
861.8 + * @run main/othervm/timeout=140 main
861.9 + *
861.10 + * SunJSSE does not support dynamic system properties, no way to re-use
861.11 + * system properties in samevm/agentvm mode.
861.12 * @summary Make sure that different configurations of SSL sockets work
861.13 */
861.14
862.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/HandshakeOutStream/NullCerts.java Thu Sep 01 13:54:38 2011 -0700
862.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/HandshakeOutStream/NullCerts.java Mon Sep 05 23:58:19 2011 -0700
862.3 @@ -24,7 +24,12 @@
862.4 /*
862.5 * @test
862.6 * @bug 4453053
862.7 - * @summary If a server shuts down correctly during handshaking, the client doesn't see it.
862.8 + * @summary If a server shuts down correctly during handshaking, the client
862.9 + * doesn't see it.
862.10 + * @run main/othervm NullCerts
862.11 + *
862.12 + * SunJSSE does not support dynamic system properties, no way to re-use
862.13 + * system properties in samevm/agentvm mode.
862.14 * @author Brad Wetmore
862.15 */
862.16
863.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/ClientHelloRead.java Thu Sep 01 13:54:38 2011 -0700
863.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/ClientHelloRead.java Mon Sep 05 23:58:19 2011 -0700
863.3 @@ -1,5 +1,5 @@
863.4 /*
863.5 - * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
863.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
863.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
863.8 *
863.9 * This code is free software; you can redistribute it and/or modify it
863.10 @@ -25,6 +25,10 @@
863.11 * @test
863.12 * @bug 4432868
863.13 * @summary A client-hello message may not always be read correctly
863.14 + * @run main/othervm ClientHelloRead
863.15 + *
863.16 + * SunJSSE does not support dynamic system properties, no way to re-use
863.17 + * system properties in samevm/agentvm mode.
863.18 */
863.19
863.20 import java.io.*;
863.21 @@ -154,23 +158,29 @@
863.22 * we want to avoid URLspoofCheck failures in cases where the cert
863.23 * DN name does not match the hostname in the URL.
863.24 */
863.25 - HttpsURLConnection.setDefaultHostnameVerifier(
863.26 - new NameVerifier());
863.27 - URL url = new URL("https://" + "localhost:" + serverPort
863.28 - + "/index.html");
863.29 - BufferedReader in = null;
863.30 + HostnameVerifier reservedHV =
863.31 + HttpsURLConnection.getDefaultHostnameVerifier();
863.32 try {
863.33 - in = new BufferedReader(new InputStreamReader(
863.34 - url.openStream()));
863.35 - String inputLine;
863.36 - System.out.print("Client recieved from the server: ");
863.37 - while ((inputLine = in.readLine()) != null)
863.38 - System.out.println(inputLine);
863.39 - in.close();
863.40 - } catch (SSLException e) {
863.41 - if (in != null)
863.42 + HttpsURLConnection.setDefaultHostnameVerifier(
863.43 + new NameVerifier());
863.44 + URL url = new URL("https://" + "localhost:" + serverPort
863.45 + + "/index.html");
863.46 + BufferedReader in = null;
863.47 + try {
863.48 + in = new BufferedReader(new InputStreamReader(
863.49 + url.openStream()));
863.50 + String inputLine;
863.51 + System.out.print("Client recieved from the server: ");
863.52 + while ((inputLine = in.readLine()) != null)
863.53 + System.out.println(inputLine);
863.54 in.close();
863.55 - throw e;
863.56 + } catch (SSLException e) {
863.57 + if (in != null)
863.58 + in.close();
863.59 + throw e;
863.60 + }
863.61 + } finally {
863.62 + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV);
863.63 }
863.64 }
863.65
864.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/SSLSocketTimeoutNulls.java Thu Sep 01 13:54:38 2011 -0700
864.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/SSLSocketTimeoutNulls.java Mon Sep 05 23:58:19 2011 -0700
864.3 @@ -27,7 +27,10 @@
864.4 * @summary Setting timeouts on SSLSockets immediately return null
864.5 * after timeout occurs. This bug was fixed as part of 4393337,
864.6 * but this is another bug we want to check regressions against.
864.7 - * @run main/timeout=140 SSLSocketTimeoutNulls
864.8 + * @run main/othervm/timeout=140 SSLSocketTimeoutNulls
864.9 + *
864.10 + * SunJSSE does not support dynamic system properties, no way to re-use
864.11 + * system properties in samevm/agentvm mode.
864.12 * @author Brad Wetmore
864.13 */
864.14
865.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ProtocolVersion/HttpsProtocols.java Thu Sep 01 13:54:38 2011 -0700
865.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ProtocolVersion/HttpsProtocols.java Mon Sep 05 23:58:19 2011 -0700
865.3 @@ -1,5 +1,5 @@
865.4 /*
865.5 - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
865.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
865.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
865.8 *
865.9 * This code is free software; you can redistribute it and/or modify it
865.10 @@ -147,12 +147,18 @@
865.11 Thread.sleep(50);
865.12 }
865.13
865.14 - HttpsURLConnection.setDefaultHostnameVerifier(this);
865.15 + HostnameVerifier reservedHV =
865.16 + HttpsURLConnection.getDefaultHostnameVerifier();
865.17 + try {
865.18 + HttpsURLConnection.setDefaultHostnameVerifier(this);
865.19
865.20 - URL url = new URL("https://localhost:" + serverPort + "/");
865.21 - HttpURLConnection urlc = (HttpURLConnection) url.openConnection();
865.22 + URL url = new URL("https://localhost:" + serverPort + "/");
865.23 + HttpURLConnection urlc = (HttpURLConnection) url.openConnection();
865.24
865.25 - System.out.println("response is " + urlc.getResponseCode());
865.26 + System.out.println("response is " + urlc.getResponseCode());
865.27 + } finally {
865.28 + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV);
865.29 + }
865.30 }
865.31
865.32 public boolean verify(String hostname, SSLSession session) {
866.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLContextImpl/BadKSProvider.java Thu Sep 01 13:54:38 2011 -0700
866.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLContextImpl/BadKSProvider.java Mon Sep 05 23:58:19 2011 -0700
866.3 @@ -25,6 +25,10 @@
866.4 * @test
866.5 * @bug 4919147
866.6 * @summary Support for token-based KeyStores
866.7 + * @run main/othervm BadKSProvider
866.8 + *
866.9 + * SunJSSE does not support dynamic system properties, no way to re-use
866.10 + * system properties in samevm/agentvm mode.
866.11 */
866.12
866.13 import java.io.*;
867.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLContextImpl/BadTSProvider.java Thu Sep 01 13:54:38 2011 -0700
867.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLContextImpl/BadTSProvider.java Mon Sep 05 23:58:19 2011 -0700
867.3 @@ -25,6 +25,10 @@
867.4 * @test
867.5 * @bug 4919147
867.6 * @summary Support for token-based KeyStores
867.7 + * @run main/othervm BadTSProvider
867.8 + *
867.9 + * SunJSSE does not support dynamic system properties, no way to re-use
867.10 + * system properties in samevm/agentvm mode.
867.11 */
867.12
867.13 import java.io.*;
868.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLContextImpl/GoodProvider.java Thu Sep 01 13:54:38 2011 -0700
868.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLContextImpl/GoodProvider.java Mon Sep 05 23:58:19 2011 -0700
868.3 @@ -25,6 +25,10 @@
868.4 * @test
868.5 * @bug 4919147
868.6 * @summary Support for token-based KeyStores
868.7 + * @run main/othervm GoodProvider
868.8 + *
868.9 + * SunJSSE does not support dynamic system properties, no way to re-use
868.10 + * system properties in samevm/agentvm mode.
868.11 */
868.12
868.13 import java.io.*;
869.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/RehandshakeFinished.java Thu Sep 01 13:54:38 2011 -0700
869.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/RehandshakeFinished.java Mon Sep 05 23:58:19 2011 -0700
869.3 @@ -26,6 +26,10 @@
869.4 * @bug 6207322
869.5 * @summary SSLEngine is returning a premature FINISHED message when doing
869.6 * an abbreviated handshake.
869.7 + * @run main/othervm RehandshakeFinished
869.8 + *
869.9 + * SunJSSE does not support dynamic system properties, no way to re-use
869.10 + * system properties in samevm/agentvm mode.
869.11 *
869.12 * This test may need some updating if the messages change order.
869.13 * Currently I'm expecting that there is a simple renegotiation, with
870.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/SSLEngineDeadlock.java Thu Sep 01 13:54:38 2011 -0700
870.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/SSLEngineDeadlock.java Mon Sep 05 23:58:19 2011 -0700
870.3 @@ -25,6 +25,10 @@
870.4 * @test
870.5 * @bug 6492872
870.6 * @summary Deadlock in SSLEngine
870.7 + * @run main/othervm SSLEngineDeadlock
870.8 + *
870.9 + * SunJSSE does not support dynamic system properties, no way to re-use
870.10 + * system properties in samevm/agentvm mode.
870.11 *
870.12 * @author Brad R. Wetmore
870.13 */
871.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSessionImpl/HashCodeMissing.java Thu Sep 01 13:54:38 2011 -0700
871.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSessionImpl/HashCodeMissing.java Mon Sep 05 23:58:19 2011 -0700
871.3 @@ -25,6 +25,10 @@
871.4 * @test
871.5 * @bug 4910892
871.6 * @summary 4518403 was not properly fixed. hashcode should be hashCode.
871.7 + * @run main/othervm HashCodeMissing
871.8 + *
871.9 + * SunJSSE does not support dynamic system properties, no way to re-use
871.10 + * system properties in samevm/agentvm mode.
871.11 * @author Brad Wetmore
871.12 */
871.13
872.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/AsyncSSLSocketClose.java Thu Sep 01 13:54:38 2011 -0700
872.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/AsyncSSLSocketClose.java Mon Sep 05 23:58:19 2011 -0700
872.3 @@ -26,6 +26,10 @@
872.4 * @bug 6447412
872.5 * @summary Issue with socket.close() for ssl sockets when poweroff on
872.6 * other system
872.7 + * @run main/othervm AsyncSSLSocketClose
872.8 + *
872.9 + * SunJSSE does not support dynamic system properties, no way to re-use
872.10 + * system properties in samevm/agentvm mode.
872.11 */
872.12
872.13 import javax.net.ssl.*;
873.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ClientModeClientAuth.java Thu Sep 01 13:54:38 2011 -0700
873.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ClientModeClientAuth.java Mon Sep 05 23:58:19 2011 -0700
873.3 @@ -24,8 +24,11 @@
873.4 /*
873.5 * @test
873.6 * @bug 4390659
873.7 - * @run main/othervm -Djavax.net.debug=all ClientModeClientAuth
873.8 * @summary setNeedClientAuth() isn't working after a handshaker is established
873.9 + * @run main/othervm ClientModeClientAuth
873.10 + *
873.11 + * SunJSSE does not support dynamic system properties, no way to re-use
873.12 + * system properties in samevm/agentvm mode.
873.13 * @author Brad Wetmore
873.14 */
873.15
874.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ClientTimeout.java Thu Sep 01 13:54:38 2011 -0700
874.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ClientTimeout.java Mon Sep 05 23:58:19 2011 -0700
874.3 @@ -25,6 +25,10 @@
874.4 * @test
874.5 * @bug 4836493
874.6 * @summary Socket timeouts for SSLSockets causes data corruption.
874.7 + * @run main/othervm ClientTimeout
874.8 + *
874.9 + * SunJSSE does not support dynamic system properties, no way to re-use
874.10 + * system properties in samevm/agentvm mode.
874.11 */
874.12
874.13 import java.io.*;
875.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/CloseSocketException.java Thu Sep 01 13:54:38 2011 -0700
875.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/CloseSocketException.java Mon Sep 05 23:58:19 2011 -0700
875.3 @@ -26,6 +26,10 @@
875.4 * @bug 4969799
875.5 * @summary javax.net.ssl.SSLSocket.SSLSocket(InetAddress,int) shouldn't
875.6 * throw exception
875.7 + * @run main/othervm CloseSocketException
875.8 + *
875.9 + * SunJSSE does not support dynamic system properties, no way to re-use
875.10 + * system properties in samevm/agentvm mode.
875.11 *
875.12 * This is making sure that starting a new handshake throws the right
875.13 * exception. There is a similar test for SSLEngine.
876.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/InvalidateServerSessionRenegotiate.java Thu Sep 01 13:54:38 2011 -0700
876.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/InvalidateServerSessionRenegotiate.java Mon Sep 05 23:58:19 2011 -0700
876.3 @@ -25,6 +25,10 @@
876.4 * @test
876.5 * @bug 4403428
876.6 * @summary Invalidating JSSE session on server causes SSLProtocolException
876.7 + * @run main/othervm InvalidateServerSessionRenegotiate
876.8 + *
876.9 + * SunJSSE does not support dynamic system properties, no way to re-use
876.10 + * system properties in samevm/agentvm mode.
876.11 * @author Brad Wetmore
876.12 */
876.13
877.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NewSocketMethods.java Thu Sep 01 13:54:38 2011 -0700
877.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NewSocketMethods.java Mon Sep 05 23:58:19 2011 -0700
877.3 @@ -25,6 +25,10 @@
877.4 * @test
877.5 * @bug 4429176
877.6 * @summary need to sync up SSL sockets with merlin java.net changes
877.7 + * @run main/othervm NewSocketMethods
877.8 + *
877.9 + * SunJSSE does not support dynamic system properties, no way to re-use
877.10 + * system properties in samevm/agentvm mode.
877.11 */
877.12
877.13 import java.io.*;
878.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NonAutoClose.java Thu Sep 01 13:54:38 2011 -0700
878.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NonAutoClose.java Mon Sep 05 23:58:19 2011 -0700
878.3 @@ -25,6 +25,10 @@
878.4 * @test
878.5 * @bug 4404399
878.6 * @summary When a layered SSL socket is closed, it should wait for close_notify
878.7 + * @run main/othervm NonAutoClose
878.8 + *
878.9 + * SunJSSE does not support dynamic system properties, no way to re-use
878.10 + * system properties in samevm/agentvm mode.
878.11 * @author Brad Wetmore
878.12 */
878.13
879.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ReuseAddr.java Thu Sep 01 13:54:38 2011 -0700
879.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ReuseAddr.java Mon Sep 05 23:58:19 2011 -0700
879.3 @@ -25,6 +25,10 @@
879.4 * @test
879.5 * @bug 4482446
879.6 * @summary java.net.SocketTimeoutException on 98, NT, 2000 for JSSE
879.7 + * @run main/othervm ReuseAddr
879.8 + *
879.9 + * SunJSSE does not support dynamic system properties, no way to re-use
879.10 + * system properties in samevm/agentvm mode.
879.11 * @author Brad Wetmore
879.12 */
879.13
880.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ReverseNameLookup.java Thu Sep 01 13:54:38 2011 -0700
880.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ReverseNameLookup.java Mon Sep 05 23:58:19 2011 -0700
880.3 @@ -25,6 +25,10 @@
880.4 * @test
880.5 * @bug 4748292
880.6 * @summary Prevent/Disable reverse name lookups with JSSE SSL sockets
880.7 + * @run main/othervm ReverseNameLookup
880.8 + *
880.9 + * SunJSSE does not support dynamic system properties, no way to re-use
880.10 + * system properties in samevm/agentvm mode.
880.11 */
880.12
880.13 import java.io.*;
881.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/SSLSocketImplThrowsWrongExceptions.java Thu Sep 01 13:54:38 2011 -0700
881.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/SSLSocketImplThrowsWrongExceptions.java Mon Sep 05 23:58:19 2011 -0700
881.3 @@ -26,6 +26,10 @@
881.4 * @bug 4361124 4325806
881.5 * @summary SSLServerSocket isn't throwing exceptions when negotiations are
881.6 * failing & java.net.SocketException: occures in Auth and clientmode
881.7 + * @run main/othervm SSLSocketImplThrowsWrongExceptions
881.8 + *
881.9 + * SunJSSE does not support dynamic system properties, no way to re-use
881.10 + * system properties in samevm/agentvm mode.
881.11 * @author Brad Wetmore
881.12 */
881.13
882.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ServerTimeout.java Thu Sep 01 13:54:38 2011 -0700
882.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ServerTimeout.java Mon Sep 05 23:58:19 2011 -0700
882.3 @@ -25,6 +25,10 @@
882.4 * @test
882.5 * @bug 4836493
882.6 * @summary Socket timeouts for SSLSockets causes data corruption.
882.7 + * @run main/othervm ServerTimeout
882.8 + *
882.9 + * SunJSSE does not support dynamic system properties, no way to re-use
882.10 + * system properties in samevm/agentvm mode.
882.11 */
882.12
882.13 import java.io.*;
883.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/SetClientMode.java Thu Sep 01 13:54:38 2011 -0700
883.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/SetClientMode.java Mon Sep 05 23:58:19 2011 -0700
883.3 @@ -26,6 +26,10 @@
883.4 * @bug 6223624
883.5 * @summary SSLSocket.setUseClientMode() fails to throw expected
883.6 * IllegalArgumentException
883.7 + * @run main/othervm SetClientMode
883.8 + *
883.9 + * SunJSSE does not support dynamic system properties, no way to re-use
883.10 + * system properties in samevm/agentvm mode.
883.11 */
883.12
883.13 /*
884.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/UnconnectedSocketWrongExceptions.java Thu Sep 01 13:54:38 2011 -0700
884.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/UnconnectedSocketWrongExceptions.java Mon Sep 05 23:58:19 2011 -0700
884.3 @@ -25,6 +25,11 @@
884.4 * @test
884.5 * @bug 4480441
884.6 * @summary startHandshake giving wrong message when unconnected.
884.7 + * @run main/othervm UnconnectedSocketWrongExceptions
884.8 + *
884.9 + * SunJSSE does not support dynamic system properties, no way to re-use
884.10 + * system properties in samevm/agentvm mode.
884.11 + *
884.12 * @author Brad Wetmore
884.13 */
884.14
885.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ServerHandshaker/AnonCipherWithWantClientAuth.java Thu Sep 01 13:54:38 2011 -0700
885.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ServerHandshaker/AnonCipherWithWantClientAuth.java Mon Sep 05 23:58:19 2011 -0700
885.3 @@ -25,7 +25,10 @@
885.4 * @test
885.5 * @bug 4392475
885.6 * @summary Calling setWantClientAuth(true) disables anonymous suites
885.7 - * @run main/timeout=180 AnonCipherWithWantClientAuth
885.8 + * @run main/othervm/timeout=180 AnonCipherWithWantClientAuth
885.9 + *
885.10 + * SunJSSE does not support dynamic system properties, no way to re-use
885.11 + * system properties in samevm/agentvm mode.
885.12 */
885.13
885.14 import java.io.*;
886.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ServerHandshaker/GetPeerHost.java Thu Sep 01 13:54:38 2011 -0700
886.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ServerHandshaker/GetPeerHost.java Mon Sep 05 23:58:19 2011 -0700
886.3 @@ -22,10 +22,13 @@
886.4 */
886.5
886.6 /**
886.7 - *@test
886.8 - *@bug 4302026
886.9 - *@run main GetPeerHost
886.10 - *@summary make sure the server side doesn't do DNS lookup.
886.11 + * @test
886.12 + * @bug 4302026
886.13 + * @run main/othervm GetPeerHost
886.14 + *
886.15 + * SunJSSE does not support dynamic system properties, no way to re-use
886.16 + * system properties in samevm/agentvm mode.
886.17 + * @summary make sure the server side doesn't do DNS lookup.
886.18 */
886.19 import javax.net.*;
886.20
887.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SocketCreation/SocketCreation.java Thu Sep 01 13:54:38 2011 -0700
887.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SocketCreation/SocketCreation.java Mon Sep 05 23:58:19 2011 -0700
887.3 @@ -27,7 +27,10 @@
887.4 * @summary This test tries all the different ways in which an SSL
887.5 * connection can be established to exercise different SSLSocketImpl
887.6 * constructors.
887.7 - * @run main/timeout=300 SocketCreation
887.8 + * @run main/othervm/timeout=300 SocketCreation
887.9 + *
887.10 + * SunJSSE does not support dynamic system properties, no way to re-use
887.11 + * system properties in samevm/agentvm mode.
887.12 */
887.13
887.14 import java.io.*;
888.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/ClientServer.java Thu Sep 01 13:54:38 2011 -0700
888.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/ClientServer.java Mon Sep 05 23:58:19 2011 -0700
888.3 @@ -25,6 +25,10 @@
888.4 * @test
888.5 * @bug 4717766
888.6 * @summary 1.0.3 JsseX509TrustManager erroneously calls isClientTrusted()
888.7 + * @run main/othervm ClientServer
888.8 + *
888.9 + * SunJSSE does not support dynamic system properties, no way to re-use
888.10 + * system properties in samevm/agentvm mode.
888.11 * @ignore JSSE supports algorithm constraints with CR 6916074,
888.12 * need to update this test case in JDK 7 soon
888.13 * @author Brad Wetmore
889.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/PKIXExtendedTM.java Thu Sep 01 13:54:38 2011 -0700
889.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/PKIXExtendedTM.java Mon Sep 05 23:58:19 2011 -0700
889.3 @@ -26,6 +26,10 @@
889.4 * @test
889.5 * @bug 6916074
889.6 * @summary Add support for TLS 1.2
889.7 + * @run main/othervm PKIXExtendedTM
889.8 + *
889.9 + * SunJSSE does not support dynamic system properties, no way to re-use
889.10 + * system properties in samevm/agentvm mode.
889.11 */
889.12
889.13 import java.net.*;
890.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/SelfIssuedCert.java Thu Sep 01 13:54:38 2011 -0700
890.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/SelfIssuedCert.java Mon Sep 05 23:58:19 2011 -0700
890.3 @@ -27,6 +27,9 @@
890.4 * @summary support self-issued certificate
890.5 * @run main/othervm SelfIssuedCert PKIX
890.6 * @run main/othervm SelfIssuedCert SunX509
890.7 + *
890.8 + * SunJSSE does not support dynamic system properties, no way to re-use
890.9 + * system properties in samevm/agentvm mode.
890.10 * @author Xuelei Fan
890.11 */
890.12
891.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/SunX509ExtendedTM.java Thu Sep 01 13:54:38 2011 -0700
891.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/SunX509ExtendedTM.java Mon Sep 05 23:58:19 2011 -0700
891.3 @@ -24,8 +24,11 @@
891.4 /*
891.5 * @test
891.6 * @bug 6916074
891.7 - * @run main/othervm -Djavax.net.debug=all SunX509ExtendedTM
891.8 * @summary Add support for TLS 1.2
891.9 + * @run main/othervm SunX509ExtendedTM
891.10 + *
891.11 + * SunJSSE does not support dynamic system properties, no way to re-use
891.12 + * system properties in samevm/agentvm mode.
891.13 */
891.14
891.15 import java.net.*;
892.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/X509ExtendedTMEnabled.java Thu Sep 01 13:54:38 2011 -0700
892.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/X509ExtendedTMEnabled.java Mon Sep 05 23:58:19 2011 -0700
892.3 @@ -25,6 +25,10 @@
892.4 * @test
892.5 * @bug 6916074
892.6 * @summary Add support for TLS 1.2
892.7 + * @run main/othervm X509ExtendedTMEnabled
892.8 + *
892.9 + * SunJSSE does not support dynamic system properties, no way to re-use
892.10 + * system properties in samevm/agentvm mode.
892.11 *
892.12 * Ensure that the SunJSSE provider enables the X509ExtendedTrustManager.
892.13 */
893.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/spi/ProviderInit.java Thu Sep 01 13:54:38 2011 -0700
893.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/spi/ProviderInit.java Mon Sep 05 23:58:19 2011 -0700
893.3 @@ -26,6 +26,10 @@
893.4 * @bug 4522550
893.5 * @summary SSLContext TrustMananagerFactory and KeyManagerFactory
893.6 * should throw if not init
893.7 + * @run main/othervm ProviderInit
893.8 + *
893.9 + * SunJSSE does not support dynamic system properties, no way to re-use
893.10 + * system properties in samevm/agentvm mode.
893.11 * @author Jaya Hangal
893.12 */
893.13
894.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/www/protocol/https/HttpsClient/ProxyAuthTest.java Thu Sep 01 13:54:38 2011 -0700
894.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/www/protocol/https/HttpsClient/ProxyAuthTest.java Mon Sep 05 23:58:19 2011 -0700
894.3 @@ -1,5 +1,5 @@
894.4 /*
894.5 - * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
894.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
894.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
894.8 *
894.9 * This code is free software; you can redistribute it and/or modify it
894.10 @@ -25,7 +25,11 @@
894.11 * @test
894.12 * @bug 4323990 4413069
894.13 * @summary HttpsURLConnection doesn't send Proxy-Authorization on CONNECT
894.14 - * Incorrect checking of proxy server response
894.15 + * Incorrect checking of proxy server response
894.16 + * @run main/othervm ProxyAuthTest
894.17 + *
894.18 + * No way to reserve and restore java.lang.Authenticator, need to run this
894.19 + * test in othervm mode.
894.20 */
894.21
894.22 import java.io.*;
894.23 @@ -77,8 +81,7 @@
894.24 /*
894.25 * Main method to create the server and the client
894.26 */
894.27 - public static void main(String args[]) throws Exception
894.28 - {
894.29 + public static void main(String args[]) throws Exception {
894.30 String keyFilename =
894.31 System.getProperty("test.src", "./") + "/" + pathToStores +
894.32 "/" + keyStoreFile;
894.33 @@ -110,10 +113,9 @@
894.34 try {
894.35 doClientSide();
894.36 } catch (Exception e) {
894.37 - System.out.println("Client side failed: " +
894.38 - e.getMessage());
894.39 + System.out.println("Client side failed: " + e.getMessage());
894.40 throw e;
894.41 - }
894.42 + }
894.43 }
894.44
894.45 private static ServerSocketFactory getServerSocketFactory
895.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/www/protocol/https/HttpsClient/ServerIdentityTest.java Thu Sep 01 13:54:38 2011 -0700
895.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/www/protocol/https/HttpsClient/ServerIdentityTest.java Mon Sep 05 23:58:19 2011 -0700
895.3 @@ -1,5 +1,5 @@
895.4 /*
895.5 - * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
895.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
895.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
895.8 *
895.9 * This code is free software; you can redistribute it and/or modify it
895.10 @@ -26,6 +26,11 @@
895.11 * @bug 4328195
895.12 * @summary Need to include the alternate subject DN for certs,
895.13 * https should check for this
895.14 + * @run main/othervm ServerIdentityTest
895.15 + *
895.16 + * SunJSSE does not support dynamic system properties, no way to re-use
895.17 + * system properties in samevm/agentvm mode.
895.18 + *
895.19 * @author Yingxian Wang
895.20 */
895.21
895.22 @@ -136,39 +141,45 @@
895.23 volatile Exception clientException = null;
895.24
895.25 public static void main(String[] args) throws Exception {
895.26 - for (int i = 0; i < keyStoreFiles.length; i++) {
895.27 - String keyFilename =
895.28 - System.getProperty("test.src", ".") + "/" + pathToStores +
895.29 - "/" + keyStoreFiles[i];
895.30 - String trustFilename =
895.31 - System.getProperty("test.src", ".") + "/" + pathToStores +
895.32 - "/" + trustStoreFiles[i];
895.33 + SSLSocketFactory reservedSFactory =
895.34 + HttpsURLConnection.getDefaultSSLSocketFactory();
895.35 + try {
895.36 + for (int i = 0; i < keyStoreFiles.length; i++) {
895.37 + String keyFilename =
895.38 + System.getProperty("test.src", ".") + "/" + pathToStores +
895.39 + "/" + keyStoreFiles[i];
895.40 + String trustFilename =
895.41 + System.getProperty("test.src", ".") + "/" + pathToStores +
895.42 + "/" + trustStoreFiles[i];
895.43
895.44 - System.setProperty("javax.net.ssl.keyStore", keyFilename);
895.45 - System.setProperty("javax.net.ssl.keyStorePassword", passwd);
895.46 - System.setProperty("javax.net.ssl.trustStore", trustFilename);
895.47 - System.setProperty("javax.net.ssl.trustStorePassword", passwd);
895.48 + System.setProperty("javax.net.ssl.keyStore", keyFilename);
895.49 + System.setProperty("javax.net.ssl.keyStorePassword", passwd);
895.50 + System.setProperty("javax.net.ssl.trustStore", trustFilename);
895.51 + System.setProperty("javax.net.ssl.trustStorePassword", passwd);
895.52
895.53 - if (debug)
895.54 - System.setProperty("javax.net.debug", "all");
895.55 - SSLContext context = SSLContext.getInstance("SSL");
895.56 + if (debug)
895.57 + System.setProperty("javax.net.debug", "all");
895.58 + SSLContext context = SSLContext.getInstance("SSL");
895.59
895.60 - KeyManager[] kms = new KeyManager[1];
895.61 - KeyStore ks = KeyStore.getInstance("JKS");
895.62 - FileInputStream fis = new FileInputStream(keyFilename);
895.63 - ks.load(fis, passwd.toCharArray());
895.64 - fis.close();
895.65 - KeyManager km = new MyKeyManager(ks, passwd.toCharArray());
895.66 - kms[0] = km;
895.67 - context.init(kms, null, null);
895.68 - HttpsURLConnection.setDefaultSSLSocketFactory(
895.69 - context.getSocketFactory());
895.70 + KeyManager[] kms = new KeyManager[1];
895.71 + KeyStore ks = KeyStore.getInstance("JKS");
895.72 + FileInputStream fis = new FileInputStream(keyFilename);
895.73 + ks.load(fis, passwd.toCharArray());
895.74 + fis.close();
895.75 + KeyManager km = new MyKeyManager(ks, passwd.toCharArray());
895.76 + kms[0] = km;
895.77 + context.init(kms, null, null);
895.78 + HttpsURLConnection.setDefaultSSLSocketFactory(
895.79 + context.getSocketFactory());
895.80
895.81 - /*
895.82 - * Start the tests.
895.83 - */
895.84 - System.out.println("Testing " + keyFilename);
895.85 - new ServerIdentityTest(context, keyStoreFiles[i]);
895.86 + /*
895.87 + * Start the tests.
895.88 + */
895.89 + System.out.println("Testing " + keyFilename);
895.90 + new ServerIdentityTest(context, keyStoreFiles[i]);
895.91 + }
895.92 + } finally {
895.93 + HttpsURLConnection.setDefaultSSLSocketFactory(reservedSFactory);
895.94 }
895.95 }
895.96
896.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnection/CriticalSubjectAltName.java Thu Sep 01 13:54:38 2011 -0700
896.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnection/CriticalSubjectAltName.java Mon Sep 05 23:58:19 2011 -0700
896.3 @@ -26,6 +26,11 @@
896.4 * @bug 6668231
896.5 * @summary Presence of a critical subjectAltName causes JSSE's SunX509 to
896.6 * fail trusted checks
896.7 + * @run main/othervm CriticalSubjectAltName
896.8 + *
896.9 + * SunJSSE does not support dynamic system properties, no way to re-use
896.10 + * system properties in samevm/agentvm mode.
896.11 + *
896.12 * @author Xuelei Fan
896.13 *
896.14 * This test depends on binary keystore, crisubn.jks and trusted.jks. Because
897.1 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnection/GetResponseCode.java Thu Sep 01 13:54:38 2011 -0700
897.2 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnection/GetResponseCode.java Mon Sep 05 23:58:19 2011 -0700
897.3 @@ -25,6 +25,11 @@
897.4 * @test
897.5 * @bug 4482187
897.6 * @summary HttpsClient tests are failing for build 71
897.7 + * @run main/othervm GetResponseCode
897.8 + *
897.9 + * SunJSSE does not support dynamic system properties, no way to re-use
897.10 + * system properties in samevm/agentvm mode.
897.11 + *
897.12 * @author Yingxian Wang
897.13 */
897.14 import java.io.*;
898.1 --- a/test/sun/security/ssl/javax/net/ssl/Fix5070632.java Thu Sep 01 13:54:38 2011 -0700
898.2 +++ b/test/sun/security/ssl/javax/net/ssl/Fix5070632.java Mon Sep 05 23:58:19 2011 -0700
898.3 @@ -1,5 +1,5 @@
898.4 /*
898.5 - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
898.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
898.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
898.8 *
898.9 * This code is free software; you can redistribute it and/or modify it
898.10 @@ -25,6 +25,10 @@
898.11 * @test
898.12 * @bug 5070632
898.13 * @summary Default SSLSockeFactory override createSocket() now
898.14 + * @run main/othervm Fix5070632
898.15 + *
898.16 + * SunJSSE does not support dynamic system properties, no way to re-use
898.17 + * system properties in samevm/agentvm mode.
898.18 * @author Weijun Wang
898.19 */
898.20
898.21 @@ -35,8 +39,13 @@
898.22
898.23 public class Fix5070632 {
898.24 public static void main(String[] args) throws Exception {
898.25 + // reserve the security properties
898.26 + String reservedSFacProvider =
898.27 + Security.getProperty("ssl.SocketFactory.provider");
898.28 +
898.29 // use a non-existing provider so that the DefaultSSLSocketFactory
898.30 // will be used, and then test against it.
898.31 +
898.32 Security.setProperty("ssl.SocketFactory.provider", "foo.NonExistant");
898.33 SSLSocketFactory fac = (SSLSocketFactory)SSLSocketFactory.getDefault();
898.34 try {
898.35 @@ -46,8 +55,16 @@
898.36 System.out.println("Throw SocketException");
898.37 se.printStackTrace();
898.38 return;
898.39 + } finally {
898.40 + // restore the security properties
898.41 + if (reservedSFacProvider == null) {
898.42 + reservedSFacProvider = "";
898.43 + }
898.44 + Security.setProperty("ssl.SocketFactory.provider",
898.45 + reservedSFacProvider);
898.46 }
898.47 +
898.48 + // if not caught, or other exception caught, then it's error
898.49 throw new Exception("should throw SocketException");
898.50 - // if not caught, or other exception caught, then it's error
898.51 }
898.52 }
899.1 --- a/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/ComURLNulls.java Thu Sep 01 13:54:38 2011 -0700
899.2 +++ b/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/ComURLNulls.java Mon Sep 05 23:58:19 2011 -0700
899.3 @@ -1,5 +1,5 @@
899.4 /*
899.5 - * Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved.
899.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
899.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
899.8 *
899.9 * This code is free software; you can redistribute it and/or modify it
899.10 @@ -27,6 +27,10 @@
899.11 * @summary Need to revisit the javadocs for JSSE, especially the
899.12 * promoted classes, and HttpsURLConnection.getCipherSuite throws
899.13 * NullPointerException
899.14 + * @run main/othervm ComURLNulls
899.15 + *
899.16 + * SunJSSE does not support dynamic system properties, no way to re-use
899.17 + * system properties in samevm/agentvm mode.
899.18 * @author Brad Wetmore
899.19 */
899.20
899.21 @@ -34,6 +38,7 @@
899.22 import java.io.*;
899.23 import javax.net.ssl.*;
899.24 import com.sun.net.ssl.HttpsURLConnection;
899.25 +import com.sun.net.ssl.HostnameVerifier;
899.26
899.27 /*
899.28 * Tests that the com null argument changes made it in ok.
899.29 @@ -42,59 +47,64 @@
899.30 public class ComURLNulls {
899.31
899.32 public static void main(String[] args) throws Exception {
899.33 + HostnameVerifier reservedHV =
899.34 + HttpsURLConnection.getDefaultHostnameVerifier();
899.35 + try {
899.36 + System.setProperty("java.protocol.handler.pkgs",
899.37 + "com.sun.net.ssl.internal.www.protocol");
899.38 + /**
899.39 + * This test does not establish any connection to the specified
899.40 + * URL, hence a dummy URL is used.
899.41 + */
899.42 + URL foobar = new URL("https://example.com/");
899.43
899.44 - System.setProperty("java.protocol.handler.pkgs",
899.45 - "com.sun.net.ssl.internal.www.protocol");
899.46 - /**
899.47 - * This test does not establish any connection to the specified
899.48 - * URL, hence a dummy URL is used.
899.49 - */
899.50 - URL foobar = new URL("https://example.com/");
899.51 + HttpsURLConnection urlc =
899.52 + (HttpsURLConnection) foobar.openConnection();
899.53
899.54 - HttpsURLConnection urlc =
899.55 - (HttpsURLConnection) foobar.openConnection();
899.56 + try {
899.57 + urlc.getCipherSuite();
899.58 + } catch (IllegalStateException e) {
899.59 + System.out.print("Caught proper exception: ");
899.60 + System.out.println(e.getMessage());
899.61 + }
899.62
899.63 - try {
899.64 - urlc.getCipherSuite();
899.65 - } catch (IllegalStateException e) {
899.66 - System.out.print("Caught proper exception: ");
899.67 - System.out.println(e.getMessage());
899.68 + try {
899.69 + urlc.getServerCertificateChain();
899.70 + } catch (IllegalStateException e) {
899.71 + System.out.print("Caught proper exception: ");
899.72 + System.out.println(e.getMessage());
899.73 + }
899.74 +
899.75 + try {
899.76 + urlc.setDefaultHostnameVerifier(null);
899.77 + } catch (IllegalArgumentException e) {
899.78 + System.out.print("Caught proper exception: ");
899.79 + System.out.println(e.getMessage());
899.80 + }
899.81 +
899.82 + try {
899.83 + urlc.setHostnameVerifier(null);
899.84 + } catch (IllegalArgumentException e) {
899.85 + System.out.print("Caught proper exception: ");
899.86 + System.out.println(e.getMessage());
899.87 + }
899.88 +
899.89 + try {
899.90 + urlc.setDefaultSSLSocketFactory(null);
899.91 + } catch (IllegalArgumentException e) {
899.92 + System.out.print("Caught proper exception: ");
899.93 + System.out.println(e.getMessage());
899.94 + }
899.95 +
899.96 + try {
899.97 + urlc.setSSLSocketFactory(null);
899.98 + } catch (IllegalArgumentException e) {
899.99 + System.out.print("Caught proper exception");
899.100 + System.out.println(e.getMessage());
899.101 + }
899.102 + System.out.println("TESTS PASSED");
899.103 + } finally {
899.104 + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV);
899.105 }
899.106 -
899.107 - try {
899.108 - urlc.getServerCertificateChain();
899.109 - } catch (IllegalStateException e) {
899.110 - System.out.print("Caught proper exception: ");
899.111 - System.out.println(e.getMessage());
899.112 - }
899.113 -
899.114 - try {
899.115 - urlc.setDefaultHostnameVerifier(null);
899.116 - } catch (IllegalArgumentException e) {
899.117 - System.out.print("Caught proper exception: ");
899.118 - System.out.println(e.getMessage());
899.119 - }
899.120 -
899.121 - try {
899.122 - urlc.setHostnameVerifier(null);
899.123 - } catch (IllegalArgumentException e) {
899.124 - System.out.print("Caught proper exception: ");
899.125 - System.out.println(e.getMessage());
899.126 - }
899.127 -
899.128 - try {
899.129 - urlc.setDefaultSSLSocketFactory(null);
899.130 - } catch (IllegalArgumentException e) {
899.131 - System.out.print("Caught proper exception: ");
899.132 - System.out.println(e.getMessage());
899.133 - }
899.134 -
899.135 - try {
899.136 - urlc.setSSLSocketFactory(null);
899.137 - } catch (IllegalArgumentException e) {
899.138 - System.out.print("Caught proper exception");
899.139 - System.out.println(e.getMessage());
899.140 - }
899.141 - System.out.println("TESTS PASSED");
899.142 }
899.143 }
900.1 --- a/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/ImplicitHandshake.java Thu Sep 01 13:54:38 2011 -0700
900.2 +++ b/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/ImplicitHandshake.java Mon Sep 05 23:58:19 2011 -0700
900.3 @@ -26,6 +26,10 @@
900.4 * @bug 4387882
900.5 * @summary Need to revisit the javadocs for JSSE, especially the
900.6 * promoted classes.
900.7 + * @run main/othervm ImplicitHandshake
900.8 + *
900.9 + * SunJSSE does not support dynamic system properties, no way to re-use
900.10 + * system properties in samevm/agentvm mode.
900.11 * @author Brad Wetmore
900.12 */
900.13
901.1 --- a/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/JavaxURLNulls.java Thu Sep 01 13:54:38 2011 -0700
901.2 +++ b/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/JavaxURLNulls.java Mon Sep 05 23:58:19 2011 -0700
901.3 @@ -1,5 +1,5 @@
901.4 /*
901.5 - * Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved.
901.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
901.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
901.8 *
901.9 * This code is free software; you can redistribute it and/or modify it
901.10 @@ -42,63 +42,69 @@
901.11
901.12 public static void main(String[] args) throws Exception {
901.13
901.14 - /**
901.15 - * This test does not establish any connection to the specified
901.16 - * URL, hence a dummy URL is used.
901.17 - */
901.18 - URL foobar = new URL("https://example.com/");
901.19 + HostnameVerifier reservedHV =
901.20 + HttpsURLConnection.getDefaultHostnameVerifier();
901.21 + try {
901.22 + /**
901.23 + * This test does not establish any connection to the specified
901.24 + * URL, hence a dummy URL is used.
901.25 + */
901.26 + URL foobar = new URL("https://example.com/");
901.27
901.28 - HttpsURLConnection urlc =
901.29 - (HttpsURLConnection) foobar.openConnection();
901.30 + HttpsURLConnection urlc =
901.31 + (HttpsURLConnection) foobar.openConnection();
901.32
901.33 - try {
901.34 - urlc.getCipherSuite();
901.35 - } catch (IllegalStateException e) {
901.36 - System.out.print("Caught proper exception: ");
901.37 - System.out.println(e.getMessage());
901.38 + try {
901.39 + urlc.getCipherSuite();
901.40 + } catch (IllegalStateException e) {
901.41 + System.out.print("Caught proper exception: ");
901.42 + System.out.println(e.getMessage());
901.43 + }
901.44 +
901.45 + try {
901.46 + urlc.getLocalCertificates();
901.47 + } catch (IllegalStateException e) {
901.48 + System.out.print("Caught proper exception: ");
901.49 + System.out.println(e.getMessage());
901.50 + }
901.51 +
901.52 + try {
901.53 + urlc.getServerCertificates();
901.54 + } catch (IllegalStateException e) {
901.55 + System.out.print("Caught proper exception: ");
901.56 + System.out.println(e.getMessage());
901.57 + }
901.58 +
901.59 + try {
901.60 + urlc.setDefaultHostnameVerifier(null);
901.61 + } catch (IllegalArgumentException e) {
901.62 + System.out.print("Caught proper exception: ");
901.63 + System.out.println(e.getMessage());
901.64 + }
901.65 +
901.66 + try {
901.67 + urlc.setHostnameVerifier(null);
901.68 + } catch (IllegalArgumentException e) {
901.69 + System.out.print("Caught proper exception: ");
901.70 + System.out.println(e.getMessage());
901.71 + }
901.72 +
901.73 + try {
901.74 + urlc.setDefaultSSLSocketFactory(null);
901.75 + } catch (IllegalArgumentException e) {
901.76 + System.out.print("Caught proper exception: ");
901.77 + System.out.println(e.getMessage());
901.78 + }
901.79 +
901.80 + try {
901.81 + urlc.setSSLSocketFactory(null);
901.82 + } catch (IllegalArgumentException e) {
901.83 + System.out.print("Caught proper exception: ");
901.84 + System.out.println(e.getMessage());
901.85 + }
901.86 + System.out.println("TESTS PASSED");
901.87 + } finally {
901.88 + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV);
901.89 }
901.90 -
901.91 - try {
901.92 - urlc.getLocalCertificates();
901.93 - } catch (IllegalStateException e) {
901.94 - System.out.print("Caught proper exception: ");
901.95 - System.out.println(e.getMessage());
901.96 - }
901.97 -
901.98 - try {
901.99 - urlc.getServerCertificates();
901.100 - } catch (IllegalStateException e) {
901.101 - System.out.print("Caught proper exception: ");
901.102 - System.out.println(e.getMessage());
901.103 - }
901.104 -
901.105 - try {
901.106 - urlc.setDefaultHostnameVerifier(null);
901.107 - } catch (IllegalArgumentException e) {
901.108 - System.out.print("Caught proper exception: ");
901.109 - System.out.println(e.getMessage());
901.110 - }
901.111 -
901.112 - try {
901.113 - urlc.setHostnameVerifier(null);
901.114 - } catch (IllegalArgumentException e) {
901.115 - System.out.print("Caught proper exception: ");
901.116 - System.out.println(e.getMessage());
901.117 - }
901.118 -
901.119 - try {
901.120 - urlc.setDefaultSSLSocketFactory(null);
901.121 - } catch (IllegalArgumentException e) {
901.122 - System.out.print("Caught proper exception: ");
901.123 - System.out.println(e.getMessage());
901.124 - }
901.125 -
901.126 - try {
901.127 - urlc.setSSLSocketFactory(null);
901.128 - } catch (IllegalArgumentException e) {
901.129 - System.out.print("Caught proper exception: ");
901.130 - System.out.println(e.getMessage());
901.131 - }
901.132 - System.out.println("TESTS PASSED");
901.133 }
901.134 }
902.1 --- a/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/SSLSessionNulls.java Thu Sep 01 13:54:38 2011 -0700
902.2 +++ b/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/SSLSessionNulls.java Mon Sep 05 23:58:19 2011 -0700
902.3 @@ -26,6 +26,10 @@
902.4 * @bug 4387882
902.5 * @summary Need to revisit the javadocs for JSSE, especially the
902.6 * promoted classes.
902.7 + * @run main/othervm SSLSessionNulls
902.8 + *
902.9 + * SunJSSE does not support dynamic system properties, no way to re-use
902.10 + * system properties in samevm/agentvm mode.
902.11 * @author Brad Wetmore
902.12 */
902.13
903.1 --- a/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/SSLSocketInherit.java Thu Sep 01 13:54:38 2011 -0700
903.2 +++ b/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/SSLSocketInherit.java Mon Sep 05 23:58:19 2011 -0700
903.3 @@ -27,6 +27,10 @@
903.4 * @summary Need to revisit the javadocs for JSSE, especially the
903.5 * promoted classes. This test checks to see if the settings
903.6 * on the server sockets get propagated to the sockets.
903.7 + * @run main/othervm SSLSocketInherit
903.8 + *
903.9 + * SunJSSE does not support dynamic system properties, no way to re-use
903.10 + * system properties in samevm/agentvm mode.
903.11 * @author Brad Wetmore
903.12 */
903.13
904.1 --- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/CheckMyTrustedKeystore.java Thu Sep 01 13:54:38 2011 -0700
904.2 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/CheckMyTrustedKeystore.java Mon Sep 05 23:58:19 2011 -0700
904.3 @@ -26,6 +26,10 @@
904.4 * @bug 4329114
904.5 * @summary Need better way of reflecting the reason when a chain is
904.6 * rejected as untrusted.
904.7 + * @run main/othervm CheckMyTrustedKeystore
904.8 + *
904.9 + * SunJSSE does not support dynamic system properties, no way to re-use
904.10 + * system properties in samevm/agentvm mode.
904.11 * @ignore JSSE supports algorithm constraints with CR 6916074,
904.12 * need to update this test case in JDK 7 soon
904.13 * This is a serious hack job!
905.1 --- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/HttpsURLConnectionLocalCertificateChain.java Thu Sep 01 13:54:38 2011 -0700
905.2 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/HttpsURLConnectionLocalCertificateChain.java Mon Sep 05 23:58:19 2011 -0700
905.3 @@ -30,6 +30,10 @@
905.4 * Fixed 4354003: Need API to get client certificate chain
905.5 * Fixed 4387961: HostnameVerifier needs to pass various hostnames
905.6 * Fixed 4395266: HttpsURLConnection should be made protected
905.7 + * @run main/othervm HttpsURLConnectionLocalCertificateChain
905.8 + *
905.9 + * SunJSSE does not support dynamic system properties, no way to re-use
905.10 + * system properties in samevm/agentvm mode.
905.11 * @author Brad Wetmore
905.12 */
905.13
906.1 --- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/JSSERenegotiate.java Thu Sep 01 13:54:38 2011 -0700
906.2 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/JSSERenegotiate.java Mon Sep 05 23:58:19 2011 -0700
906.3 @@ -26,6 +26,10 @@
906.4 * @bug 4280338
906.5 * @summary "Unsupported SSL message version" SSLProtocolException
906.6 * w/SSL_RSA_WITH_NULL_MD5
906.7 + * @run main/othervm JSSERenegotiate
906.8 + *
906.9 + * SunJSSE does not support dynamic system properties, no way to re-use
906.10 + * system properties in samevm/agentvm mode.
906.11 *
906.12 * @author Ram Marti
906.13 * @author Brad Wetmore
907.1 --- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/KeyManagerTrustManager.java Thu Sep 01 13:54:38 2011 -0700
907.2 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/KeyManagerTrustManager.java Mon Sep 05 23:58:19 2011 -0700
907.3 @@ -1,5 +1,5 @@
907.4 /*
907.5 - * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
907.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
907.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
907.8 *
907.9 * This code is free software; you can redistribute it and/or modify it
907.10 @@ -35,6 +35,10 @@
907.11 * 4396290: Need a way to pass algorithm specific parameters to TM's and KM's
907.12 * 4395286: The property for setting the default
907.13 * KeyManagerFactory/TrustManagerFactory algorithms needs real name
907.14 + * @run main/othervm KeyManagerTrustManager
907.15 + *
907.16 + * SunJSSE does not support dynamic system properties, no way to re-use
907.17 + * system properties in samevm/agentvm mode.
907.18 * @author Brad Wetmore
907.19 */
907.20
907.21 @@ -77,17 +81,40 @@
907.22 String kmfAlg = null;
907.23 String tmfAlg = null;
907.24
907.25 - Security.setProperty("ssl.KeyManagerFactory.algorithm", "hello");
907.26 - Security.setProperty("ssl.TrustManagerFactory.algorithm", "goodbye");
907.27 + // reserve the security properties
907.28 + String reservedKMFacAlg =
907.29 + Security.getProperty("ssl.KeyManagerFactory.algorithm");
907.30 + String reservedTMFacAlg =
907.31 + Security.getProperty("ssl.TrustManagerFactory.algorithm");
907.32
907.33 - kmfAlg = KeyManagerFactory.getDefaultAlgorithm();
907.34 - tmfAlg = TrustManagerFactory.getDefaultAlgorithm();
907.35 + try {
907.36 + Security.setProperty("ssl.KeyManagerFactory.algorithm", "hello");
907.37 + Security.setProperty("ssl.TrustManagerFactory.algorithm",
907.38 + "goodbye");
907.39
907.40 - if (!kmfAlg.equals("hello")) {
907.41 - throw new Exception("ssl.KeyManagerFactory.algorithm not set");
907.42 - }
907.43 - if (!tmfAlg.equals("goodbye")) {
907.44 - throw new Exception("ssl.TrustManagerFactory.algorithm not set");
907.45 + kmfAlg = KeyManagerFactory.getDefaultAlgorithm();
907.46 + tmfAlg = TrustManagerFactory.getDefaultAlgorithm();
907.47 +
907.48 + if (!kmfAlg.equals("hello")) {
907.49 + throw new Exception("ssl.KeyManagerFactory.algorithm not set");
907.50 + }
907.51 + if (!tmfAlg.equals("goodbye")) {
907.52 + throw new Exception(
907.53 + "ssl.TrustManagerFactory.algorithm not set");
907.54 + }
907.55 + } finally {
907.56 + // restore the security properties
907.57 + if (reservedKMFacAlg == null) {
907.58 + reservedKMFacAlg = "";
907.59 + }
907.60 +
907.61 + if (reservedTMFacAlg == null) {
907.62 + reservedTMFacAlg = "";
907.63 + }
907.64 + Security.setProperty("ssl.KeyManagerFactory.algorithm",
907.65 + reservedKMFacAlg);
907.66 + Security.setProperty("ssl.TrustManagerFactory.algorithm",
907.67 + reservedTMFacAlg);
907.68 }
907.69 }
907.70 }
908.1 --- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLCtxAccessToSessCtx.java Thu Sep 01 13:54:38 2011 -0700
908.2 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLCtxAccessToSessCtx.java Mon Sep 05 23:58:19 2011 -0700
908.3 @@ -25,6 +25,10 @@
908.4 * @test
908.5 * @bug 4473210
908.6 * @summary SSLSessionContext should be accessible from SSLContext
908.7 + * @run main/othervm SSLCtxAccessToSessCtx
908.8 + *
908.9 + * SunJSSE does not support dynamic system properties, no way to re-use
908.10 + * system properties in samevm/agentvm mode.
908.11 */
908.12
908.13 import java.io.*;
909.1 --- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/AcceptLargeFragments.java Thu Sep 01 13:54:38 2011 -0700
909.2 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/AcceptLargeFragments.java Mon Sep 05 23:58:19 2011 -0700
909.3 @@ -26,6 +26,10 @@
909.4 * @bug 6388456
909.5 * @summary Need adjustable TLS max record size for interoperability
909.6 * with non-compliant stacks
909.7 + * @run main/othervm AcceptLargeFragments
909.8 + *
909.9 + * SunJSSE does not support dynamic system properties, no way to re-use
909.10 + * system properties in samevm/agentvm mode.
909.11 *
909.12 * Check the system property "jsse.SSLEngine.acceptLargeFragments"
909.13 *
910.1 --- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/ExtendedKeySocket.java Thu Sep 01 13:54:38 2011 -0700
910.2 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/ExtendedKeySocket.java Mon Sep 05 23:58:19 2011 -0700
910.3 @@ -25,6 +25,10 @@
910.4 * @test
910.5 * @bug 4981697
910.6 * @summary Rework the X509KeyManager to avoid incompatibility issues
910.7 + * @run main/othervm ExtendedKeySocket
910.8 + *
910.9 + * SunJSSE does not support dynamic system properties, no way to re-use
910.10 + * system properties in samevm/agentvm mode.
910.11 * @author Brad R. Wetmore
910.12 */
910.13
911.1 --- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/LargePacket.java Thu Sep 01 13:54:38 2011 -0700
911.2 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/LargePacket.java Mon Sep 05 23:58:19 2011 -0700
911.3 @@ -27,6 +27,10 @@
911.4 * @bug 6388456
911.5 * @summary Need adjustable TLS max record size for interoperability
911.6 * with non-compliant
911.7 + * @run main/othervm LargePacket
911.8 + *
911.9 + * SunJSSE does not support dynamic system properties, no way to re-use
911.10 + * system properties in samevm/agentvm mode.
911.11 *
911.12 * @author Xuelei Fan
911.13 */
912.1 --- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/NoAuthClientAuth.java Thu Sep 01 13:54:38 2011 -0700
912.2 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/NoAuthClientAuth.java Mon Sep 05 23:58:19 2011 -0700
912.3 @@ -25,6 +25,10 @@
912.4 * @test
912.5 * @bug 4495742
912.6 * @summary Demonstrate SSLEngine switch from no client auth to client auth.
912.7 + * @run main/othervm NoAuthClientAuth
912.8 + *
912.9 + * SunJSSE does not support dynamic system properties, no way to re-use
912.10 + * system properties in samevm/agentvm mode.
912.11 *
912.12 * @author Brad R. Wetmore
912.13 */
913.1 --- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SessionCacheSizeTests.java Thu Sep 01 13:54:38 2011 -0700
913.2 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SessionCacheSizeTests.java Mon Sep 05 23:58:19 2011 -0700
913.3 @@ -25,6 +25,10 @@
913.4 * @test
913.5 * @bug 4366807
913.6 * @summary Need new APIs to get/set session timeout and session cache size.
913.7 + * @run main/othervm SessionCacheSizeTests
913.8 + *
913.9 + * SunJSSE does not support dynamic system properties, no way to re-use
913.10 + * system properties in samevm/agentvm mode.
913.11 */
913.12
913.13 import java.io.*;
914.1 --- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SessionTimeOutTests.java Thu Sep 01 13:54:38 2011 -0700
914.2 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SessionTimeOutTests.java Mon Sep 05 23:58:19 2011 -0700
914.3 @@ -25,6 +25,10 @@
914.4 * @test
914.5 * @bug 4366807
914.6 * @summary Need new APIs to get/set session timeout and session cache size.
914.7 + * @run main/othervm SessionTimeOutTests
914.8 + *
914.9 + * SunJSSE does not support dynamic system properties, no way to re-use
914.10 + * system properties in samevm/agentvm mode.
914.11 */
914.12
914.13 import java.io.*;
914.14 @@ -207,7 +211,7 @@
914.15 timeout = sessCtx.getSessionTimeout();
914.16 System.out.println("timeout is changed to: " + timeout);
914.17 System.out.println();
914.18 - }
914.19 + }
914.20 }
914.21
914.22 // check the ids returned by the enumerator
915.1 --- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/testEnabledProtocols.java Thu Sep 01 13:54:38 2011 -0700
915.2 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/testEnabledProtocols.java Mon Sep 05 23:58:19 2011 -0700
915.3 @@ -30,6 +30,10 @@
915.4 * session
915.5 * 4701722 protocol mismatch exceptions should be consistent between
915.6 * SSLv3 and TLSv1
915.7 + * @run main/othervm testEnabledProtocols
915.8 + *
915.9 + * SunJSSE does not support dynamic system properties, no way to re-use
915.10 + * system properties in samevm/agentvm mode.
915.11 * @author Ram Marti
915.12 */
915.13
916.1 --- a/test/sun/security/ssl/javax/net/ssl/SSLServerSocket/DefaultSSLServSocketFac.java Thu Sep 01 13:54:38 2011 -0700
916.2 +++ b/test/sun/security/ssl/javax/net/ssl/SSLServerSocket/DefaultSSLServSocketFac.java Mon Sep 05 23:58:19 2011 -0700
916.3 @@ -1,5 +1,5 @@
916.4 /*
916.5 - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
916.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
916.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
916.8 *
916.9 * This code is free software; you can redistribute it and/or modify it
916.10 @@ -25,6 +25,10 @@
916.11 * @test
916.12 * @bug 6449579
916.13 * @summary DefaultSSLServerSocketFactory does not override createServerSocket()
916.14 + * @run main/othervm DefaultSSLServSocketFac
916.15 + *
916.16 + * SunJSSE does not support dynamic system properties, no way to re-use
916.17 + * system properties in samevm/agentvm mode.
916.18 */
916.19 import java.security.Security;
916.20 import javax.net.ServerSocketFactory;
916.21 @@ -33,6 +37,10 @@
916.22
916.23 public class DefaultSSLServSocketFac {
916.24 public static void main(String[] args) throws Exception {
916.25 + // reserve the security properties
916.26 + String reservedSSFacProvider =
916.27 + Security.getProperty("ssl.ServerSocketFactory.provider");
916.28 +
916.29 try {
916.30 Security.setProperty("ssl.ServerSocketFactory.provider", "oops");
916.31 ServerSocketFactory ssocketFactory =
916.32 @@ -44,6 +52,13 @@
916.33 throw e;
916.34 }
916.35 // get the expected exception
916.36 + } finally {
916.37 + // restore the security properties
916.38 + if (reservedSSFacProvider == null) {
916.39 + reservedSSFacProvider = "";
916.40 + }
916.41 + Security.setProperty("ssl.ServerSocketFactory.provider",
916.42 + reservedSSFacProvider);
916.43 }
916.44 }
916.45 }
917.1 --- a/test/sun/security/ssl/javax/net/ssl/TLSv11/EmptyCertificateAuthorities.java Thu Sep 01 13:54:38 2011 -0700
917.2 +++ b/test/sun/security/ssl/javax/net/ssl/TLSv11/EmptyCertificateAuthorities.java Mon Sep 05 23:58:19 2011 -0700
917.3 @@ -27,7 +27,10 @@
917.4 * @test
917.5 * @bug 4873188
917.6 * @summary Support TLS 1.1
917.7 - * @run main/othervm -Djavax.net.debug=all EmptyCertificateAuthorities
917.8 + * @run main/othervm EmptyCertificateAuthorities
917.9 + *
917.10 + * SunJSSE does not support dynamic system properties, no way to re-use
917.11 + * system properties in samevm/agentvm mode.
917.12 *
917.13 * @author Xuelei Fan
917.14 */
918.1 --- a/test/sun/security/ssl/javax/net/ssl/TLSv11/ExportableBlockCipher.java Thu Sep 01 13:54:38 2011 -0700
918.2 +++ b/test/sun/security/ssl/javax/net/ssl/TLSv11/ExportableBlockCipher.java Mon Sep 05 23:58:19 2011 -0700
918.3 @@ -27,7 +27,10 @@
918.4 * @test
918.5 * @bug 4873188
918.6 * @summary Support TLS 1.1
918.7 - * @run main/othervm -Djavax.net.debug=all ExportableBlockCipher
918.8 + * @run main/othervm ExportableBlockCipher
918.9 + *
918.10 + * SunJSSE does not support dynamic system properties, no way to re-use
918.11 + * system properties in samevm/agentvm mode.
918.12 *
918.13 * @author Xuelei Fan
918.14 */
919.1 --- a/test/sun/security/ssl/javax/net/ssl/TLSv11/ExportableStreamCipher.java Thu Sep 01 13:54:38 2011 -0700
919.2 +++ b/test/sun/security/ssl/javax/net/ssl/TLSv11/ExportableStreamCipher.java Mon Sep 05 23:58:19 2011 -0700
919.3 @@ -27,7 +27,10 @@
919.4 * @test
919.5 * @bug 4873188
919.6 * @summary Support TLS 1.1
919.7 - * @run main/othervm -Djavax.net.debug=all ExportableStreamCipher
919.8 + * @run main/othervm ExportableStreamCipher
919.9 + *
919.10 + * SunJSSE does not support dynamic system properties, no way to re-use
919.11 + * system properties in samevm/agentvm mode.
919.12 *
919.13 * @author Xuelei Fan
919.14 */
920.1 --- a/test/sun/security/ssl/javax/net/ssl/TLSv11/GenericBlockCipher.java Thu Sep 01 13:54:38 2011 -0700
920.2 +++ b/test/sun/security/ssl/javax/net/ssl/TLSv11/GenericBlockCipher.java Mon Sep 05 23:58:19 2011 -0700
920.3 @@ -27,7 +27,10 @@
920.4 * @test
920.5 * @bug 4873188
920.6 * @summary Support TLS 1.1
920.7 - * @run main/othervm -Djavax.net.debug=all GenericBlockCipher
920.8 + * @run main/othervm GenericBlockCipher
920.9 + *
920.10 + * SunJSSE does not support dynamic system properties, no way to re-use
920.11 + * system properties in samevm/agentvm mode.
920.12 *
920.13 * @author Xuelei Fan
920.14 */
921.1 --- a/test/sun/security/ssl/javax/net/ssl/TLSv11/GenericStreamCipher.java Thu Sep 01 13:54:38 2011 -0700
921.2 +++ b/test/sun/security/ssl/javax/net/ssl/TLSv11/GenericStreamCipher.java Mon Sep 05 23:58:19 2011 -0700
921.3 @@ -27,7 +27,10 @@
921.4 * @test
921.5 * @bug 4873188
921.6 * @summary Support TLS 1.1
921.7 - * @run main/othervm -Djavax.net.debug=all GenericStreamCipher
921.8 + * @run main/othervm GenericStreamCipher
921.9 + *
921.10 + * SunJSSE does not support dynamic system properties, no way to re-use
921.11 + * system properties in samevm/agentvm mode.
921.12 *
921.13 * @author Xuelei Fan
921.14 */
922.1 --- a/test/sun/security/ssl/sanity/pluggability/CheckSSLContextExport.java Thu Sep 01 13:54:38 2011 -0700
922.2 +++ b/test/sun/security/ssl/sanity/pluggability/CheckSSLContextExport.java Mon Sep 05 23:58:19 2011 -0700
922.3 @@ -64,8 +64,8 @@
922.4 default:
922.5 throw new Exception("Internal Test Error!");
922.6 }
922.7 - System.out.println("Testing with " + (standardCiphers ? "standard" : "custom") +
922.8 - " cipher suites");
922.9 + System.out.println("Testing with " +
922.10 + (standardCiphers ? "standard" : "custom") + " cipher suites");
922.11 for (int j = 0; j < 4; j++) {
922.12 String clsName = null;
922.13 try {
922.14 @@ -107,11 +107,16 @@
922.15
922.16 public static void main(String[] argv) throws Exception {
922.17 String protocols[] = { "SSL", "TLS" };
922.18 - Security.insertProviderAt(new CheckSSLContextExport(protocols), 1);
922.19 - for (int i = 0; i < protocols.length; i++) {
922.20 - System.out.println("Testing " + protocols[i] + "'s SSLContext");
922.21 - test(protocols[i]);
922.22 + Provider extraProvider = new CheckSSLContextExport(protocols);
922.23 + Security.insertProviderAt(extraProvider, 1);
922.24 + try {
922.25 + for (int i = 0; i < protocols.length; i++) {
922.26 + System.out.println("Testing " + protocols[i] + "'s SSLContext");
922.27 + test(protocols[i]);
922.28 + }
922.29 + System.out.println("Test Passed");
922.30 + } finally {
922.31 + Security.removeProvider(extraProvider.getName());
922.32 }
922.33 - System.out.println("Test Passed");
922.34 }
922.35 }
923.1 --- a/test/sun/security/ssl/sanity/pluggability/CheckSockFacExport1.java Thu Sep 01 13:54:38 2011 -0700
923.2 +++ b/test/sun/security/ssl/sanity/pluggability/CheckSockFacExport1.java Mon Sep 05 23:58:19 2011 -0700
923.3 @@ -1,5 +1,5 @@
923.4 /*
923.5 - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
923.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
923.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
923.8 *
923.9 * This code is free software; you can redistribute it and/or modify it
923.10 @@ -26,6 +26,10 @@
923.11 * @bug 4635454 6208022
923.12 * @summary Check pluggability of SSLSocketFactory and
923.13 * SSLServerSocketFactory classes.
923.14 + * @run main/othervm CheckSockFacExport1
923.15 + *
923.16 + * SunJSSE does not support dynamic system properties, no way to re-use
923.17 + * system properties in samevm/agentvm mode.
923.18 */
923.19
923.20 import java.util.*;
923.21 @@ -37,36 +41,57 @@
923.22 public class CheckSockFacExport1 {
923.23
923.24 public static void main(String argv[]) throws Exception {
923.25 - Security.setProperty("ssl.SocketFactory.provider",
923.26 - "MySSLSocketFacImpl");
923.27 - MySSLSocketFacImpl.useCustomCipherSuites();
923.28 - Security.setProperty("ssl.ServerSocketFactory.provider",
923.29 - "MySSLServerSocketFacImpl");
923.30 - MySSLServerSocketFacImpl.useCustomCipherSuites();
923.31 + // reserve the security properties
923.32 + String reservedSFacAlg =
923.33 + Security.getProperty("ssl.SocketFactory.provider");
923.34 + String reservedSSFacAlg =
923.35 + Security.getProperty("ssl.ServerSocketFactory.provider");
923.36
923.37 - String[] supportedCS = null;
923.38 - for (int i = 0; i < 2; i++) {
923.39 - switch (i) {
923.40 - case 0:
923.41 - System.out.println("Testing SSLSocketFactory:");
923.42 - SSLSocketFactory sf = (SSLSocketFactory)
923.43 - SSLSocketFactory.getDefault();
923.44 - supportedCS = sf.getSupportedCipherSuites();
923.45 - break;
923.46 - case 1:
923.47 - System.out.println("Testing SSLServerSocketFactory:");
923.48 - SSLServerSocketFactory ssf = (SSLServerSocketFactory)
923.49 - SSLServerSocketFactory.getDefault();
923.50 - supportedCS = ssf.getSupportedCipherSuites();
923.51 - break;
923.52 - default:
923.53 - throw new Exception("Internal Test Error");
923.54 + try {
923.55 + Security.setProperty("ssl.SocketFactory.provider",
923.56 + "MySSLSocketFacImpl");
923.57 + MySSLSocketFacImpl.useCustomCipherSuites();
923.58 + Security.setProperty("ssl.ServerSocketFactory.provider",
923.59 + "MySSLServerSocketFacImpl");
923.60 + MySSLServerSocketFacImpl.useCustomCipherSuites();
923.61 +
923.62 + String[] supportedCS = null;
923.63 + for (int i = 0; i < 2; i++) {
923.64 + switch (i) {
923.65 + case 0:
923.66 + System.out.println("Testing SSLSocketFactory:");
923.67 + SSLSocketFactory sf = (SSLSocketFactory)
923.68 + SSLSocketFactory.getDefault();
923.69 + supportedCS = sf.getSupportedCipherSuites();
923.70 + break;
923.71 + case 1:
923.72 + System.out.println("Testing SSLServerSocketFactory:");
923.73 + SSLServerSocketFactory ssf = (SSLServerSocketFactory)
923.74 + SSLServerSocketFactory.getDefault();
923.75 + supportedCS = ssf.getSupportedCipherSuites();
923.76 + break;
923.77 + default:
923.78 + throw new Exception("Internal Test Error");
923.79 + }
923.80 + System.out.println(Arrays.asList(supportedCS));
923.81 + if (supportedCS.length == 0) {
923.82 + throw new Exception("supported ciphersuites are empty");
923.83 + }
923.84 }
923.85 - System.out.println(Arrays.asList(supportedCS));
923.86 - if (supportedCS.length == 0) {
923.87 - throw new Exception("supported ciphersuites are empty");
923.88 + System.out.println("Test Passed");
923.89 + } finally {
923.90 + // restore the security properties
923.91 + if (reservedSFacAlg == null) {
923.92 + reservedSFacAlg = "";
923.93 }
923.94 +
923.95 + if (reservedSSFacAlg == null) {
923.96 + reservedSSFacAlg = "";
923.97 + }
923.98 + Security.setProperty("ssl.SocketFactory.provider",
923.99 + reservedSFacAlg);
923.100 + Security.setProperty("ssl.ServerSocketFactory.provider",
923.101 + reservedSSFacAlg);
923.102 }
923.103 - System.out.println("Test Passed");
923.104 }
923.105 }
924.1 --- a/test/sun/security/ssl/sanity/pluggability/CheckSockFacExport2.java Thu Sep 01 13:54:38 2011 -0700
924.2 +++ b/test/sun/security/ssl/sanity/pluggability/CheckSockFacExport2.java Mon Sep 05 23:58:19 2011 -0700
924.3 @@ -1,5 +1,5 @@
924.4 /*
924.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
924.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
924.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
924.8 *
924.9 * This code is free software; you can redistribute it and/or modify it
924.10 @@ -25,7 +25,11 @@
924.11 * @test
924.12 * @bug 4635454
924.13 * @summary Check pluggability of SSLSocketFactory and
924.14 - * SSLServerSocketFactory classes.
924.15 + * SSLServerSocketFactory classes.
924.16 + * @run main/othervm CheckSockFacExport2
924.17 + *
924.18 + * SunJSSE does not support dynamic system properties, no way to re-use
924.19 + * system properties in samevm/agentvm mode.
924.20 */
924.21 import java.security.*;
924.22 import java.net.*;
924.23 @@ -34,38 +38,59 @@
924.24 public class CheckSockFacExport2 {
924.25
924.26 public static void main(String argv[]) throws Exception {
924.27 - Security.setProperty("ssl.SocketFactory.provider",
924.28 - "MySSLSocketFacImpl");
924.29 - MySSLSocketFacImpl.useStandardCipherSuites();
924.30 - Security.setProperty("ssl.ServerSocketFactory.provider",
924.31 - "MySSLServerSocketFacImpl");
924.32 - MySSLServerSocketFacImpl.useStandardCipherSuites();
924.33 + // reserve the security properties
924.34 + String reservedSFacAlg =
924.35 + Security.getProperty("ssl.SocketFactory.provider");
924.36 + String reservedSSFacAlg =
924.37 + Security.getProperty("ssl.ServerSocketFactory.provider");
924.38
924.39 - boolean result = false;
924.40 - for (int i = 0; i < 2; i++) {
924.41 - switch (i) {
924.42 - case 0:
924.43 - System.out.println("Testing SSLSocketFactory:");
924.44 - SSLSocketFactory sf = (SSLSocketFactory)
924.45 - SSLSocketFactory.getDefault();
924.46 - result = (sf instanceof MySSLSocketFacImpl);
924.47 - break;
924.48 + try {
924.49 + Security.setProperty("ssl.SocketFactory.provider",
924.50 + "MySSLSocketFacImpl");
924.51 + MySSLSocketFacImpl.useStandardCipherSuites();
924.52 + Security.setProperty("ssl.ServerSocketFactory.provider",
924.53 + "MySSLServerSocketFacImpl");
924.54 + MySSLServerSocketFacImpl.useStandardCipherSuites();
924.55
924.56 - case 1:
924.57 - System.out.println("Testing SSLServerSocketFactory:");
924.58 - SSLServerSocketFactory ssf = (SSLServerSocketFactory)
924.59 - SSLServerSocketFactory.getDefault();
924.60 - result = (ssf instanceof MySSLServerSocketFacImpl);
924.61 - break;
924.62 - default:
924.63 - throw new Exception("Internal Test Error");
924.64 + boolean result = false;
924.65 + for (int i = 0; i < 2; i++) {
924.66 + switch (i) {
924.67 + case 0:
924.68 + System.out.println("Testing SSLSocketFactory:");
924.69 + SSLSocketFactory sf = (SSLSocketFactory)
924.70 + SSLSocketFactory.getDefault();
924.71 + result = (sf instanceof MySSLSocketFacImpl);
924.72 + break;
924.73 +
924.74 + case 1:
924.75 + System.out.println("Testing SSLServerSocketFactory:");
924.76 + SSLServerSocketFactory ssf = (SSLServerSocketFactory)
924.77 + SSLServerSocketFactory.getDefault();
924.78 + result = (ssf instanceof MySSLServerSocketFacImpl);
924.79 + break;
924.80 + default:
924.81 + throw new Exception("Internal Test Error");
924.82 + }
924.83 + if (result) {
924.84 + System.out.println("...accepted valid SFs");
924.85 + } else {
924.86 + throw new Exception("...wrong SF is used");
924.87 + }
924.88 }
924.89 - if (result) {
924.90 - System.out.println("...accepted valid SFs");
924.91 - } else {
924.92 - throw new Exception("...wrong SF is used");
924.93 + System.out.println("Test Passed");
924.94 + } finally {
924.95 + // restore the security properties
924.96 + if (reservedSFacAlg == null) {
924.97 + reservedSFacAlg = "";
924.98 }
924.99 +
924.100 + if (reservedSSFacAlg == null) {
924.101 + reservedSSFacAlg = "";
924.102 + }
924.103 + Security.setProperty("ssl.SocketFactory.provider",
924.104 + reservedSFacAlg);
924.105 + Security.setProperty("ssl.ServerSocketFactory.provider",
924.106 + reservedSSFacAlg);
924.107 }
924.108 - System.out.println("Test Passed");
924.109 }
924.110 }
925.1 --- a/test/sun/security/ssl/sun/net/www/http/ChunkedOutputStream/Test.java Thu Sep 01 13:54:38 2011 -0700
925.2 +++ b/test/sun/security/ssl/sun/net/www/http/ChunkedOutputStream/Test.java Mon Sep 05 23:58:19 2011 -0700
925.3 @@ -1,5 +1,5 @@
925.4 /*
925.5 - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
925.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
925.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
925.8 *
925.9 * This code is free software; you can redistribute it and/or modify it
925.10 @@ -26,6 +26,9 @@
925.11 * @bug 5026745
925.12 * @library ../../httpstest/
925.13 * @run main/othervm Test
925.14 + *
925.15 + * SunJSSE does not support dynamic system properties, no way to re-use
925.16 + * system properties in samevm/agentvm mode.
925.17 * @summary Cannot flush output stream when writing to an HttpUrlConnection
925.18 */
925.19
925.20 @@ -283,31 +286,37 @@
925.21 System.getProperty("test.src", "./") + "/" + pathToStores +
925.22 "/" + trustStoreFile;
925.23
925.24 - System.setProperty("javax.net.ssl.keyStore", keyFilename);
925.25 - System.setProperty("javax.net.ssl.keyStorePassword", passwd);
925.26 - System.setProperty("javax.net.ssl.trustStore", trustFilename);
925.27 - System.setProperty("javax.net.ssl.trustStorePassword", passwd);
925.28 - HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier());
925.29 + HostnameVerifier reservedHV =
925.30 + HttpsURLConnection.getDefaultHostnameVerifier();
925.31 + try {
925.32 + System.setProperty("javax.net.ssl.keyStore", keyFilename);
925.33 + System.setProperty("javax.net.ssl.keyStorePassword", passwd);
925.34 + System.setProperty("javax.net.ssl.trustStore", trustFilename);
925.35 + System.setProperty("javax.net.ssl.trustStorePassword", passwd);
925.36 + HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier());
925.37
925.38 - try {
925.39 - server = new HttpServer (new Test(), 1, 10, 0);
925.40 - System.out.println ("Server started: listening on port: " + server.getLocalPort());
925.41 - // the test server doesn't support keep-alive yet
925.42 - // test1("http://localhost:"+server.getLocalPort()+"/d0");
925.43 - test1("https://localhost:"+server.getLocalPort()+"/d01");
925.44 - test3("https://localhost:"+server.getLocalPort()+"/d3");
925.45 - test4("https://localhost:"+server.getLocalPort()+"/d4");
925.46 - test5("https://localhost:"+server.getLocalPort()+"/d5");
925.47 - test6("https://localhost:"+server.getLocalPort()+"/d6");
925.48 - test7("https://localhost:"+server.getLocalPort()+"/d7");
925.49 - test8("https://localhost:"+server.getLocalPort()+"/d8");
925.50 - } catch (Exception e) {
925.51 - if (server != null) {
925.52 - server.terminate();
925.53 + try {
925.54 + server = new HttpServer (new Test(), 1, 10, 0);
925.55 + System.out.println ("Server started: listening on port: " + server.getLocalPort());
925.56 + // the test server doesn't support keep-alive yet
925.57 + // test1("http://localhost:"+server.getLocalPort()+"/d0");
925.58 + test1("https://localhost:"+server.getLocalPort()+"/d01");
925.59 + test3("https://localhost:"+server.getLocalPort()+"/d3");
925.60 + test4("https://localhost:"+server.getLocalPort()+"/d4");
925.61 + test5("https://localhost:"+server.getLocalPort()+"/d5");
925.62 + test6("https://localhost:"+server.getLocalPort()+"/d6");
925.63 + test7("https://localhost:"+server.getLocalPort()+"/d7");
925.64 + test8("https://localhost:"+server.getLocalPort()+"/d8");
925.65 + } catch (Exception e) {
925.66 + if (server != null) {
925.67 + server.terminate();
925.68 + }
925.69 + throw e;
925.70 }
925.71 - throw e;
925.72 + server.terminate();
925.73 + } finally {
925.74 + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV);
925.75 }
925.76 - server.terminate();
925.77 }
925.78
925.79 static class NameVerifier implements HostnameVerifier {
926.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java Thu Sep 01 13:54:38 2011 -0700
926.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java Mon Sep 05 23:58:19 2011 -0700
926.3 @@ -1,5 +1,5 @@
926.4 /*
926.5 - * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
926.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
926.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
926.8 *
926.9 * This code is free software; you can redistribute it and/or modify it
926.10 @@ -26,9 +26,12 @@
926.11 * @bug 6216082
926.12 * @library ../../../httpstest/
926.13 * @build HttpCallback HttpServer ClosedChannelList HttpTransaction TunnelProxy
926.14 + * @summary Redirect problem with HttpsURLConnection using a proxy
926.15 * @run main/othervm B6216082
926.16 - * @summary Redirect problem with HttpsURLConnection using a proxy
926.17 -*/
926.18 + *
926.19 + * SunJSSE does not support dynamic system properties, no way to re-use
926.20 + * system properties in samevm/agentvm mode.
926.21 + */
926.22
926.23 import java.io.*;
926.24 import java.net.*;
926.25 @@ -46,20 +49,27 @@
926.26 static InetAddress firstNonLoAddress = null;
926.27
926.28 public static void main(String[] args) throws Exception {
926.29 - // XXX workaround for CNFE
926.30 - Class.forName("java.nio.channels.ClosedByInterruptException");
926.31 - setupEnv();
926.32 + HostnameVerifier reservedHV =
926.33 + HttpsURLConnection.getDefaultHostnameVerifier();
926.34 + try {
926.35 + // XXX workaround for CNFE
926.36 + Class.forName("java.nio.channels.ClosedByInterruptException");
926.37 + setupEnv();
926.38
926.39 - startHttpServer();
926.40 + startHttpServer();
926.41
926.42 - // https.proxyPort can only be set after the TunnelProxy has been
926.43 - // created as it will use an ephemeral port.
926.44 - System.setProperty( "https.proxyPort", (new Integer(proxy.getLocalPort())).toString() );
926.45 + // https.proxyPort can only be set after the TunnelProxy has been
926.46 + // created as it will use an ephemeral port.
926.47 + System.setProperty("https.proxyPort",
926.48 + (new Integer(proxy.getLocalPort())).toString() );
926.49
926.50 - makeHttpCall();
926.51 + makeHttpCall();
926.52
926.53 - if (httpTrans.hasBadRequest) {
926.54 - throw new RuntimeException("Test failed : bad http request");
926.55 + if (httpTrans.hasBadRequest) {
926.56 + throw new RuntimeException("Test failed : bad http request");
926.57 + }
926.58 + } finally {
926.59 + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV);
926.60 }
926.61 }
926.62
927.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/CloseKeepAliveCached.java Thu Sep 01 13:54:38 2011 -0700
927.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/CloseKeepAliveCached.java Mon Sep 05 23:58:19 2011 -0700
927.3 @@ -1,5 +1,5 @@
927.4 /*
927.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
927.6 + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
927.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
927.8 *
927.9 * This code is free software; you can redistribute it and/or modify it
927.10 @@ -26,7 +26,10 @@
927.11 * @bug 6618387
927.12 * @summary SSL client sessions do not close cleanly. A TCP reset occurs
927.13 * instead of a close_notify alert.
927.14 - * @run main/othervm -Djavax.net.debug=ssl CloseKeepAliveCached
927.15 + * @run main/othervm CloseKeepAliveCached
927.16 + *
927.17 + * SunJSSE does not support dynamic system properties, no way to re-use
927.18 + * system properties in samevm/agentvm mode.
927.19 *
927.20 * @ignore
927.21 * After run the test manually, at the end of the debug output,
927.22 @@ -140,13 +143,15 @@
927.23 * to avoid infinite hangs.
927.24 */
927.25 void doClientSide() throws Exception {
927.26 -
927.27 /*
927.28 * Wait for server to get started.
927.29 */
927.30 while (!serverReady) {
927.31 Thread.sleep(50);
927.32 }
927.33 +
927.34 + HostnameVerifier reservedHV =
927.35 + HttpsURLConnection.getDefaultHostnameVerifier();
927.36 try {
927.37 HttpsURLConnection http = null;
927.38
927.39 @@ -180,6 +185,8 @@
927.40 if (sslServerSocket != null)
927.41 sslServerSocket.close();
927.42 throw ioex;
927.43 + } finally {
927.44 + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV);
927.45 }
927.46 }
927.47
928.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/CookieHandlerTest.java Thu Sep 01 13:54:38 2011 -0700
928.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/CookieHandlerTest.java Mon Sep 05 23:58:19 2011 -0700
928.3 @@ -22,8 +22,12 @@
928.4 */
928.5
928.6 /* @test
928.7 + * @bug 4696506 4942650
928.8 * @summary Unit test for java.net.CookieHandler
928.9 - * @bug 4696506 4942650
928.10 + * @run main/othervm CookieHandlerTest
928.11 + *
928.12 + * SunJSSE does not support dynamic system properties, no way to re-use
928.13 + * system properties in samevm/agentvm mode.
928.14 * @author Yingxian Wang
928.15 */
928.16
928.17 @@ -182,26 +186,34 @@
928.18 System.getProperty("test.src", "./") + "/" + pathToStores +
928.19 "/" + trustStoreFile;
928.20
928.21 - System.setProperty("javax.net.ssl.keyStore", keyFilename);
928.22 - System.setProperty("javax.net.ssl.keyStorePassword", passwd);
928.23 - System.setProperty("javax.net.ssl.trustStore", trustFilename);
928.24 - System.setProperty("javax.net.ssl.trustStorePassword", passwd);
928.25 + CookieHandler reservedCookieHandler = CookieHandler.getDefault();
928.26 + HostnameVerifier reservedHV =
928.27 + HttpsURLConnection.getDefaultHostnameVerifier();
928.28 + try {
928.29 + System.setProperty("javax.net.ssl.keyStore", keyFilename);
928.30 + System.setProperty("javax.net.ssl.keyStorePassword", passwd);
928.31 + System.setProperty("javax.net.ssl.trustStore", trustFilename);
928.32 + System.setProperty("javax.net.ssl.trustStorePassword", passwd);
928.33
928.34 - if (debug)
928.35 - System.setProperty("javax.net.debug", "all");
928.36 + if (debug)
928.37 + System.setProperty("javax.net.debug", "all");
928.38
928.39 - /*
928.40 - * Start the tests.
928.41 - */
928.42 - cookies = new HashMap<String, String>();
928.43 - cookies.put("Cookie",
928.44 - "$Version=\"1\"; Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"");
928.45 - cookies.put("Set-Cookie2",
928.46 - "$Version=\"1\"; Part_Number=\"Riding_Rocket_0023\"; " +
928.47 - "$Path=\"/acme/ammo\"; Part_Number=\"Rocket_Launcher_0001\"; "+
928.48 - "$Path=\"/acme\"");
928.49 - CookieHandler.setDefault(new MyCookieHandler());
928.50 - new CookieHandlerTest();
928.51 + /*
928.52 + * Start the tests.
928.53 + */
928.54 + cookies = new HashMap<String, String>();
928.55 + cookies.put("Cookie",
928.56 + "$Version=\"1\"; Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"");
928.57 + cookies.put("Set-Cookie2",
928.58 + "$Version=\"1\"; Part_Number=\"Riding_Rocket_0023\"; " +
928.59 + "$Path=\"/acme/ammo\"; Part_Number=\"Rocket_Launcher_0001\"; "+
928.60 + "$Path=\"/acme\"");
928.61 + CookieHandler.setDefault(new MyCookieHandler());
928.62 + new CookieHandlerTest();
928.63 + } finally {
928.64 + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV);
928.65 + CookieHandler.setDefault(reservedCookieHandler);
928.66 + }
928.67 }
928.68
928.69 Thread clientThread = null;
929.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/DNSIdentities.java Thu Sep 01 13:54:38 2011 -0700
929.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/DNSIdentities.java Mon Sep 05 23:58:19 2011 -0700
929.3 @@ -22,8 +22,12 @@
929.4 */
929.5
929.6 /* @test
929.7 + * @bug 6766775
929.8 * @summary X509 certificate hostname checking is broken in JDK1.6.0_10
929.9 - * @bug 6766775
929.10 + * @run main/othervm DNSIdentities
929.11 + *
929.12 + * SunJSSE does not support dynamic system properties, no way to re-use
929.13 + * system properties in samevm/agentvm mode.
929.14 * @author Xuelei Fan
929.15 */
929.16
929.17 @@ -691,34 +695,39 @@
929.18 * to avoid infinite hangs.
929.19 */
929.20 void doClientSide() throws Exception {
929.21 - SSLContext context = getSSLContext(trusedCertStr, clientCertStr,
929.22 - clientModulus, clientPrivateExponent, passphrase);
929.23 + SSLContext reservedSSLContext = SSLContext.getDefault();
929.24 + try {
929.25 + SSLContext context = getSSLContext(trusedCertStr, clientCertStr,
929.26 + clientModulus, clientPrivateExponent, passphrase);
929.27
929.28 - SSLContext.setDefault(context);
929.29 + SSLContext.setDefault(context);
929.30
929.31 - /*
929.32 - * Wait for server to get started.
929.33 - */
929.34 - while (!serverReady) {
929.35 - Thread.sleep(50);
929.36 - }
929.37 + /*
929.38 + * Wait for server to get started.
929.39 + */
929.40 + while (!serverReady) {
929.41 + Thread.sleep(50);
929.42 + }
929.43
929.44 - HttpsURLConnection http = null;
929.45 + HttpsURLConnection http = null;
929.46
929.47 - /* establish http connection to server */
929.48 - URL url = new URL("https://localhost:" + serverPort+"/");
929.49 - System.out.println("url is "+url.toString());
929.50 + /* establish http connection to server */
929.51 + URL url = new URL("https://localhost:" + serverPort+"/");
929.52 + System.out.println("url is "+url.toString());
929.53
929.54 - try {
929.55 - http = (HttpsURLConnection)url.openConnection();
929.56 + try {
929.57 + http = (HttpsURLConnection)url.openConnection();
929.58
929.59 - int respCode = http.getResponseCode();
929.60 - System.out.println("respCode = "+respCode);
929.61 + int respCode = http.getResponseCode();
929.62 + System.out.println("respCode = "+respCode);
929.63 + } finally {
929.64 + if (http != null) {
929.65 + http.disconnect();
929.66 + }
929.67 + closeReady = true;
929.68 + }
929.69 } finally {
929.70 - if (http != null) {
929.71 - http.disconnect();
929.72 - }
929.73 - closeReady = true;
929.74 + SSLContext.setDefault(reservedSSLContext);
929.75 }
929.76 }
929.77
930.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsCreateSockTest.java Thu Sep 01 13:54:38 2011 -0700
930.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsCreateSockTest.java Mon Sep 05 23:58:19 2011 -0700
930.3 @@ -24,7 +24,12 @@
930.4 /**
930.5 * @test
930.6 * @bug 6771432
930.7 - * @summary createSocket() - smpatch fails using 1.6.0_10 because of "Unconnected sockets not implemented"
930.8 + * @summary createSocket() - smpatch fails using 1.6.0_10 because of
930.9 + * "Unconnected sockets not implemented"
930.10 + * @run main/othervm HttpsCreateSockTest
930.11 + *
930.12 + * SunJSSE does not support dynamic system properties, no way to re-use
930.13 + * system properties in samevm/agentvm mode.
930.14 */
930.15
930.16 import javax.net.SocketFactory;
931.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsPost.java Thu Sep 01 13:54:38 2011 -0700
931.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsPost.java Mon Sep 05 23:58:19 2011 -0700
931.3 @@ -1,5 +1,5 @@
931.4 /*
931.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
931.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
931.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
931.8 *
931.9 * This code is free software; you can redistribute it and/or modify it
931.10 @@ -26,6 +26,10 @@
931.11 * @bug 4423074
931.12 * @summary Need to rebase all the duplicated classes from Merlin.
931.13 * This test will check out http POST
931.14 + * @run main/othervm HttpsPost
931.15 + *
931.16 + * SunJSSE does not support dynamic system properties, no way to re-use
931.17 + * system properties in samevm/agentvm mode.
931.18 */
931.19
931.20 import java.io.*;
931.21 @@ -140,34 +144,38 @@
931.22 * to avoid infinite hangs.
931.23 */
931.24 void doClientSide() throws Exception {
931.25 + HostnameVerifier reservedHV =
931.26 + HttpsURLConnection.getDefaultHostnameVerifier();
931.27 + try {
931.28 + /*
931.29 + * Wait for server to get started.
931.30 + */
931.31 + while (!serverReady) {
931.32 + Thread.sleep(50);
931.33 + }
931.34
931.35 - /*
931.36 - * Wait for server to get started.
931.37 - */
931.38 - while (!serverReady) {
931.39 - Thread.sleep(50);
931.40 - }
931.41 + // Send HTTP POST request to server
931.42 + URL url = new URL("https://localhost:"+serverPort);
931.43
931.44 - // Send HTTP POST request to server
931.45 - URL url = new URL("https://localhost:"+serverPort);
931.46 + HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier());
931.47 + HttpsURLConnection http = (HttpsURLConnection)url.openConnection();
931.48 + http.setDoOutput(true);
931.49
931.50 - HttpsURLConnection.setDefaultHostnameVerifier(
931.51 - new NameVerifier());
931.52 - HttpsURLConnection http = (HttpsURLConnection)url.openConnection();
931.53 - http.setDoOutput(true);
931.54 -
931.55 - http.setRequestMethod("POST");
931.56 - PrintStream ps = new PrintStream(http.getOutputStream());
931.57 - try {
931.58 - ps.println(postMsg);
931.59 - ps.flush();
931.60 - if (http.getResponseCode() != 200) {
931.61 - throw new RuntimeException("test Failed");
931.62 + http.setRequestMethod("POST");
931.63 + PrintStream ps = new PrintStream(http.getOutputStream());
931.64 + try {
931.65 + ps.println(postMsg);
931.66 + ps.flush();
931.67 + if (http.getResponseCode() != 200) {
931.68 + throw new RuntimeException("test Failed");
931.69 + }
931.70 + } finally {
931.71 + ps.close();
931.72 + http.disconnect();
931.73 + closeReady = true;
931.74 }
931.75 } finally {
931.76 - ps.close();
931.77 - http.disconnect();
931.78 - closeReady = true;
931.79 + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV);
931.80 }
931.81 }
931.82
932.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsProxyStackOverflow.java Thu Sep 01 13:54:38 2011 -0700
932.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsProxyStackOverflow.java Mon Sep 05 23:58:19 2011 -0700
932.3 @@ -25,6 +25,9 @@
932.4 * @test
932.5 * @bug 6670868
932.6 * @summary StackOverFlow with bad authenticated Proxy tunnels
932.7 + * @run main/othervm HttpsProxyStackOverflow
932.8 + *
932.9 + * No way to reserve default Authenticator, need to run in othervm mode.
932.10 */
932.11
932.12 import java.io.IOException;
933.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsSocketFacTest.java Thu Sep 01 13:54:38 2011 -0700
933.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsSocketFacTest.java Mon Sep 05 23:58:19 2011 -0700
933.3 @@ -26,6 +26,9 @@
933.4 * @bug 6614957
933.5 * @summary HttpsURLConnection not using the set SSLSocketFactory for creating all its Sockets
933.6 * @run main/othervm HttpsSocketFacTest
933.7 + *
933.8 + * SunJSSE does not support dynamic system properties, no way to re-use
933.9 + * system properties in samevm/agentvm mode.
933.10 */
933.11
933.12 import javax.net.SocketFactory;
934.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPAddressDNSIdentities.java Thu Sep 01 13:54:38 2011 -0700
934.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPAddressDNSIdentities.java Mon Sep 05 23:58:19 2011 -0700
934.3 @@ -1,5 +1,5 @@
934.4 /*
934.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
934.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
934.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
934.8 *
934.9 * This code is free software; you can redistribute it and/or modify it
934.10 @@ -22,8 +22,12 @@
934.11 */
934.12
934.13 /* @test
934.14 + * @bug 6766775
934.15 * @summary X509 certificate hostname checking is broken in JDK1.6.0_10
934.16 - * @bug 6766775
934.17 + * @run main/othervm IPAddressDNSIdentities
934.18 + *
934.19 + * SunJSSE does not support dynamic system properties, no way to re-use
934.20 + * system properties in samevm/agentvm mode.
934.21 * @author Xuelei Fan
934.22 */
934.23
934.24 @@ -691,43 +695,48 @@
934.25 * to avoid infinite hangs.
934.26 */
934.27 void doClientSide() throws Exception {
934.28 - SSLContext context = getSSLContext(trusedCertStr, clientCertStr,
934.29 - clientModulus, clientPrivateExponent, passphrase);
934.30 + SSLContext reservedSSLContext = SSLContext.getDefault();
934.31 + try {
934.32 + SSLContext context = getSSLContext(trusedCertStr, clientCertStr,
934.33 + clientModulus, clientPrivateExponent, passphrase);
934.34
934.35 - SSLContext.setDefault(context);
934.36 + SSLContext.setDefault(context);
934.37
934.38 - /*
934.39 - * Wait for server to get started.
934.40 - */
934.41 - while (!serverReady) {
934.42 - Thread.sleep(50);
934.43 - }
934.44 + /*
934.45 + * Wait for server to get started.
934.46 + */
934.47 + while (!serverReady) {
934.48 + Thread.sleep(50);
934.49 + }
934.50
934.51 - HttpsURLConnection http = null;
934.52 + HttpsURLConnection http = null;
934.53
934.54 - /* establish http connection to server */
934.55 - URL url = new URL("https://127.0.0.1:" + serverPort+"/");
934.56 - System.out.println("url is "+url.toString());
934.57 + /* establish http connection to server */
934.58 + URL url = new URL("https://127.0.0.1:" + serverPort+"/");
934.59 + System.out.println("url is "+url.toString());
934.60
934.61 - try {
934.62 - http = (HttpsURLConnection)url.openConnection();
934.63 + try {
934.64 + http = (HttpsURLConnection)url.openConnection();
934.65
934.66 - int respCode = http.getResponseCode();
934.67 - System.out.println("respCode = " + respCode);
934.68 + int respCode = http.getResponseCode();
934.69 + System.out.println("respCode = " + respCode);
934.70
934.71 - throw new Exception("Unexpectly found subject alternative name " +
934.72 - "matching IP address");
934.73 - } catch (SSLHandshakeException sslhe) {
934.74 - // no subject alternative names matching IP address 127.0.0.1 found
934.75 - // that's the expected exception, ignore it.
934.76 - } catch (IOException ioe) {
934.77 - // HttpsClient may throw IOE during checking URL spoofing,
934.78 - // that's the expected exception, ignore it.
934.79 + throw new Exception("Unexpectly found " +
934.80 + "subject alternative name matching IP address");
934.81 + } catch (SSLHandshakeException sslhe) {
934.82 + // no subject alternative names matching IP address 127.0.0.1
934.83 + // found that's the expected exception, ignore it.
934.84 + } catch (IOException ioe) {
934.85 + // HttpsClient may throw IOE during checking URL spoofing,
934.86 + // that's the expected exception, ignore it.
934.87 + } finally {
934.88 + if (http != null) {
934.89 + http.disconnect();
934.90 + }
934.91 + closeReady = true;
934.92 + }
934.93 } finally {
934.94 - if (http != null) {
934.95 - http.disconnect();
934.96 - }
934.97 - closeReady = true;
934.98 + SSLContext.setDefault(reservedSSLContext);
934.99 }
934.100 }
934.101
935.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPAddressIPIdentities.java Thu Sep 01 13:54:38 2011 -0700
935.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPAddressIPIdentities.java Mon Sep 05 23:58:19 2011 -0700
935.3 @@ -1,5 +1,5 @@
935.4 /*
935.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
935.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
935.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
935.8 *
935.9 * This code is free software; you can redistribute it and/or modify it
935.10 @@ -24,6 +24,10 @@
935.11 /* @test
935.12 * @summary X509 certificate hostname checking is broken in JDK1.6.0_10
935.13 * @bug 6766775
935.14 + * @run main/othervm IPAddressIPIdentities
935.15 + *
935.16 + * SunJSSE does not support dynamic system properties, no way to re-use
935.17 + * system properties in samevm/agentvm mode.
935.18 * @author Xuelei Fan
935.19 */
935.20
935.21 @@ -692,34 +696,39 @@
935.22 * to avoid infinite hangs.
935.23 */
935.24 void doClientSide() throws Exception {
935.25 - SSLContext context = getSSLContext(trusedCertStr, clientCertStr,
935.26 - clientModulus, clientPrivateExponent, passphrase);
935.27 + SSLContext reservedSSLContext = SSLContext.getDefault();
935.28 + try {
935.29 + SSLContext context = getSSLContext(trusedCertStr, clientCertStr,
935.30 + clientModulus, clientPrivateExponent, passphrase);
935.31
935.32 - SSLContext.setDefault(context);
935.33 + SSLContext.setDefault(context);
935.34
935.35 - /*
935.36 - * Wait for server to get started.
935.37 - */
935.38 - while (!serverReady) {
935.39 - Thread.sleep(50);
935.40 - }
935.41 + /*
935.42 + * Wait for server to get started.
935.43 + */
935.44 + while (!serverReady) {
935.45 + Thread.sleep(50);
935.46 + }
935.47
935.48 - HttpsURLConnection http = null;
935.49 + HttpsURLConnection http = null;
935.50
935.51 - /* establish http connection to server */
935.52 - URL url = new URL("https://127.0.0.1:" + serverPort+"/");
935.53 - System.out.println("url is "+url.toString());
935.54 + /* establish http connection to server */
935.55 + URL url = new URL("https://127.0.0.1:" + serverPort+"/");
935.56 + System.out.println("url is "+url.toString());
935.57
935.58 - try {
935.59 - http = (HttpsURLConnection)url.openConnection();
935.60 + try {
935.61 + http = (HttpsURLConnection)url.openConnection();
935.62
935.63 - int respCode = http.getResponseCode();
935.64 - System.out.println("respCode = "+respCode);
935.65 + int respCode = http.getResponseCode();
935.66 + System.out.println("respCode = "+respCode);
935.67 + } finally {
935.68 + if (http != null) {
935.69 + http.disconnect();
935.70 + }
935.71 + closeReady = true;
935.72 + }
935.73 } finally {
935.74 - if (http != null) {
935.75 - http.disconnect();
935.76 - }
935.77 - closeReady = true;
935.78 + SSLContext.setDefault(reservedSSLContext);
935.79 }
935.80 }
935.81
936.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPIdentities.java Thu Sep 01 13:54:38 2011 -0700
936.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPIdentities.java Mon Sep 05 23:58:19 2011 -0700
936.3 @@ -1,5 +1,5 @@
936.4 /*
936.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
936.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
936.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
936.8 *
936.9 * This code is free software; you can redistribute it and/or modify it
936.10 @@ -24,6 +24,10 @@
936.11 /* @test
936.12 * @summary X509 certificate hostname checking is broken in JDK1.6.0_10
936.13 * @bug 6766775
936.14 + * @run main/othervm IPIdentities
936.15 + *
936.16 + * SunJSSE does not support dynamic system properties, no way to re-use
936.17 + * system properties in samevm/agentvm mode.
936.18 * @author Xuelei Fan
936.19 */
936.20
936.21 @@ -692,34 +696,38 @@
936.22 * to avoid infinite hangs.
936.23 */
936.24 void doClientSide() throws Exception {
936.25 - SSLContext context = getSSLContext(trusedCertStr, clientCertStr,
936.26 - clientModulus, clientPrivateExponent, passphrase);
936.27 + SSLContext reservedSSLContext = SSLContext.getDefault();
936.28 + try {
936.29 + SSLContext context = getSSLContext(trusedCertStr, clientCertStr,
936.30 + clientModulus, clientPrivateExponent, passphrase);
936.31 + SSLContext.setDefault(context);
936.32
936.33 - SSLContext.setDefault(context);
936.34 + /*
936.35 + * Wait for server to get started.
936.36 + */
936.37 + while (!serverReady) {
936.38 + Thread.sleep(50);
936.39 + }
936.40
936.41 - /*
936.42 - * Wait for server to get started.
936.43 - */
936.44 - while (!serverReady) {
936.45 - Thread.sleep(50);
936.46 - }
936.47 + HttpsURLConnection http = null;
936.48
936.49 - HttpsURLConnection http = null;
936.50 + /* establish http connection to server */
936.51 + URL url = new URL("https://localhost:" + serverPort+"/");
936.52 + System.out.println("url is "+url.toString());
936.53
936.54 - /* establish http connection to server */
936.55 - URL url = new URL("https://localhost:" + serverPort+"/");
936.56 - System.out.println("url is "+url.toString());
936.57 + try {
936.58 + http = (HttpsURLConnection)url.openConnection();
936.59
936.60 - try {
936.61 - http = (HttpsURLConnection)url.openConnection();
936.62 -
936.63 - int respCode = http.getResponseCode();
936.64 - System.out.println("respCode = "+respCode);
936.65 + int respCode = http.getResponseCode();
936.66 + System.out.println("respCode = "+respCode);
936.67 + } finally {
936.68 + if (http != null) {
936.69 + http.disconnect();
936.70 + }
936.71 + closeReady = true;
936.72 + }
936.73 } finally {
936.74 - if (http != null) {
936.75 - http.disconnect();
936.76 - }
936.77 - closeReady = true;
936.78 + SSLContext.setDefault(reservedSSLContext);
936.79 }
936.80 }
936.81
937.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/Identities.java Thu Sep 01 13:54:38 2011 -0700
937.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/Identities.java Mon Sep 05 23:58:19 2011 -0700
937.3 @@ -1,5 +1,5 @@
937.4 /*
937.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
937.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
937.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
937.8 *
937.9 * This code is free software; you can redistribute it and/or modify it
937.10 @@ -22,8 +22,12 @@
937.11 */
937.12
937.13 /* @test
937.14 + * @bug 6766775
937.15 * @summary X509 certificate hostname checking is broken in JDK1.6.0_10
937.16 - * @bug 6766775
937.17 + * @run main/othervm Identities
937.18 + *
937.19 + * SunJSSE does not support dynamic system properties, no way to re-use
937.20 + * system properties in samevm/agentvm mode.
937.21 * @author Xuelei Fan
937.22 */
937.23
937.24 @@ -691,34 +695,39 @@
937.25 * to avoid infinite hangs.
937.26 */
937.27 void doClientSide() throws Exception {
937.28 - SSLContext context = getSSLContext(trusedCertStr, clientCertStr,
937.29 - clientModulus, clientPrivateExponent, passphrase);
937.30 + SSLContext reservedSSLContext = SSLContext.getDefault();
937.31 + try {
937.32 + SSLContext context = getSSLContext(trusedCertStr, clientCertStr,
937.33 + clientModulus, clientPrivateExponent, passphrase);
937.34
937.35 - SSLContext.setDefault(context);
937.36 + SSLContext.setDefault(context);
937.37
937.38 - /*
937.39 - * Wait for server to get started.
937.40 - */
937.41 - while (!serverReady) {
937.42 - Thread.sleep(50);
937.43 - }
937.44 + /*
937.45 + * Wait for server to get started.
937.46 + */
937.47 + while (!serverReady) {
937.48 + Thread.sleep(50);
937.49 + }
937.50
937.51 - HttpsURLConnection http = null;
937.52 + HttpsURLConnection http = null;
937.53
937.54 - /* establish http connection to server */
937.55 - URL url = new URL("https://localhost:" + serverPort+"/");
937.56 - System.out.println("url is "+url.toString());
937.57 + /* establish http connection to server */
937.58 + URL url = new URL("https://localhost:" + serverPort+"/");
937.59 + System.out.println("url is "+url.toString());
937.60
937.61 - try {
937.62 - http = (HttpsURLConnection)url.openConnection();
937.63 + try {
937.64 + http = (HttpsURLConnection)url.openConnection();
937.65
937.66 - int respCode = http.getResponseCode();
937.67 - System.out.println("respCode = "+respCode);
937.68 + int respCode = http.getResponseCode();
937.69 + System.out.println("respCode = "+respCode);
937.70 + } finally {
937.71 + if (http != null) {
937.72 + http.disconnect();
937.73 + }
937.74 + closeReady = true;
937.75 + }
937.76 } finally {
937.77 - if (http != null) {
937.78 - http.disconnect();
937.79 - }
937.80 - closeReady = true;
937.81 + SSLContext.setDefault(reservedSSLContext);
937.82 }
937.83 }
937.84
938.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.java Thu Sep 01 13:54:38 2011 -0700
938.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.java Mon Sep 05 23:58:19 2011 -0700
938.3 @@ -1,5 +1,5 @@
938.4 /*
938.5 - * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
938.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
938.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
938.8 *
938.9 * This code is free software; you can redistribute it and/or modify it
938.10 @@ -147,44 +147,50 @@
938.11 static String postMsg = "Testing HTTP post on a https server";
938.12
938.13 static void doClientSide(String hostname) throws Exception {
938.14 - /*
938.15 - * setup up a proxy
938.16 - */
938.17 - setupProxy();
938.18 + HostnameVerifier reservedHV =
938.19 + HttpsURLConnection.getDefaultHostnameVerifier();
938.20 + try {
938.21 + /*
938.22 + * setup up a proxy
938.23 + */
938.24 + setupProxy();
938.25
938.26 - /*
938.27 - * we want to avoid URLspoofCheck failures in cases where the cert
938.28 - * DN name does not match the hostname in the URL.
938.29 - */
938.30 - HttpsURLConnection.setDefaultHostnameVerifier(
938.31 - new NameVerifier());
938.32 - URL url = new URL("https://" + hostname+ ":" + serverPort);
938.33 + /*
938.34 + * we want to avoid URLspoofCheck failures in cases where the cert
938.35 + * DN name does not match the hostname in the URL.
938.36 + */
938.37 + HttpsURLConnection.setDefaultHostnameVerifier(
938.38 + new NameVerifier());
938.39 + URL url = new URL("https://" + hostname+ ":" + serverPort);
938.40
938.41 - HttpsURLConnection https = (HttpsURLConnection)url.openConnection();
938.42 - https.setDoOutput(true);
938.43 - https.setRequestMethod("POST");
938.44 - PrintStream ps = null;
938.45 - try {
938.46 - ps = new PrintStream(https.getOutputStream());
938.47 - ps.println(postMsg);
938.48 - ps.flush();
938.49 - if (https.getResponseCode() != 200) {
938.50 - throw new RuntimeException("test Failed");
938.51 - }
938.52 - ps.close();
938.53 + HttpsURLConnection https = (HttpsURLConnection)url.openConnection();
938.54 + https.setDoOutput(true);
938.55 + https.setRequestMethod("POST");
938.56 + PrintStream ps = null;
938.57 + try {
938.58 + ps = new PrintStream(https.getOutputStream());
938.59 + ps.println(postMsg);
938.60 + ps.flush();
938.61 + if (https.getResponseCode() != 200) {
938.62 + throw new RuntimeException("test Failed");
938.63 + }
938.64 + ps.close();
938.65
938.66 - // clear the pipe
938.67 - BufferedReader in = new BufferedReader(
938.68 - new InputStreamReader(
938.69 - https.getInputStream()));
938.70 - String inputLine;
938.71 - while ((inputLine = in.readLine()) != null)
938.72 - System.out.println("Client received: " + inputLine);
938.73 - in.close();
938.74 - } catch (SSLException e) {
938.75 - if (ps != null)
938.76 - ps.close();
938.77 - throw e;
938.78 + // clear the pipe
938.79 + BufferedReader in = new BufferedReader(
938.80 + new InputStreamReader(
938.81 + https.getInputStream()));
938.82 + String inputLine;
938.83 + while ((inputLine = in.readLine()) != null)
938.84 + System.out.println("Client received: " + inputLine);
938.85 + in.close();
938.86 + } catch (SSLException e) {
938.87 + if (ps != null)
938.88 + ps.close();
938.89 + throw e;
938.90 + }
938.91 + } finally {
938.92 + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV);
938.93 }
938.94 }
938.95
939.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/ReadTimeout.java Thu Sep 01 13:54:38 2011 -0700
939.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/ReadTimeout.java Mon Sep 05 23:58:19 2011 -0700
939.3 @@ -1,5 +1,5 @@
939.4 /*
939.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
939.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
939.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
939.8 *
939.9 * This code is free software; you can redistribute it and/or modify it
939.10 @@ -24,7 +24,13 @@
939.11 /*
939.12 * @test
939.13 * @bug 4811482 4700777 4905410
939.14 - * @summary sun.net.client.defaultConnectTimeout should work with HttpsURLConnection; HTTP client: Connect and read timeouts; Https needs to support new tiger features that went into http
939.15 + * @summary sun.net.client.defaultConnectTimeout should work with
939.16 + * HttpsURLConnection; HTTP client: Connect and read timeouts;
939.17 + * Https needs to support new tiger features that went into http
939.18 + * @run main/othervm ReadTimeout
939.19 + *
939.20 + * SunJSSE does not support dynamic system properties, no way to re-use
939.21 + * system properties in samevm/agentvm mode.
939.22 */
939.23
939.24 import java.io.*;
939.25 @@ -143,44 +149,48 @@
939.26 * to avoid infinite hangs.
939.27 */
939.28 void doClientSide() throws Exception {
939.29 + HostnameVerifier reservedHV =
939.30 + HttpsURLConnection.getDefaultHostnameVerifier();
939.31 + try {
939.32 + /*
939.33 + * Wait for server to get started.
939.34 + */
939.35 + while (!serverReady) {
939.36 + Thread.sleep(50);
939.37 + }
939.38 + HttpsURLConnection http = null;
939.39 + try {
939.40 + URL url = new URL("https://localhost:"+serverPort);
939.41
939.42 - /*
939.43 - * Wait for server to get started.
939.44 - */
939.45 - while (!serverReady) {
939.46 - Thread.sleep(50);
939.47 + // set read timeout through system property
939.48 + System.setProperty("sun.net.client.defaultReadTimeout", "2000");
939.49 + HttpsURLConnection.setDefaultHostnameVerifier(
939.50 + new NameVerifier());
939.51 + http = (HttpsURLConnection)url.openConnection();
939.52 +
939.53 + InputStream is = http.getInputStream ();
939.54 + } catch (SocketTimeoutException stex) {
939.55 + done();
939.56 + http.disconnect();
939.57 + }
939.58 +
939.59 + try {
939.60 + URL url = new URL("https://localhost:"+serverPort);
939.61 +
939.62 + HttpsURLConnection.setDefaultHostnameVerifier(
939.63 + new NameVerifier());
939.64 + http = (HttpsURLConnection)url.openConnection();
939.65 + // set read timeout through API
939.66 + http.setReadTimeout(2000);
939.67 +
939.68 + InputStream is = http.getInputStream ();
939.69 + } catch (SocketTimeoutException stex) {
939.70 + done();
939.71 + http.disconnect();
939.72 + }
939.73 + } finally {
939.74 + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV);
939.75 }
939.76 - HttpsURLConnection http = null;
939.77 - try {
939.78 - URL url = new URL("https://localhost:"+serverPort);
939.79 -
939.80 - // set read timeout through system property
939.81 - System.setProperty("sun.net.client.defaultReadTimeout", "2000");
939.82 - HttpsURLConnection.setDefaultHostnameVerifier(
939.83 - new NameVerifier());
939.84 - http = (HttpsURLConnection)url.openConnection();
939.85 -
939.86 - InputStream is = http.getInputStream ();
939.87 - } catch (SocketTimeoutException stex) {
939.88 - done();
939.89 - http.disconnect();
939.90 - }
939.91 -
939.92 - try {
939.93 - URL url = new URL("https://localhost:"+serverPort);
939.94 -
939.95 - HttpsURLConnection.setDefaultHostnameVerifier(
939.96 - new NameVerifier());
939.97 - http = (HttpsURLConnection)url.openConnection();
939.98 - // set read timeout through API
939.99 - http.setReadTimeout(2000);
939.100 -
939.101 - InputStream is = http.getInputStream ();
939.102 - } catch (SocketTimeoutException stex) {
939.103 - done();
939.104 - http.disconnect();
939.105 - }
939.106 -
939.107 }
939.108
939.109 static class NameVerifier implements HostnameVerifier {
940.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/Redirect.java Thu Sep 01 13:54:38 2011 -0700
940.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/Redirect.java Mon Sep 05 23:58:19 2011 -0700
940.3 @@ -1,5 +1,5 @@
940.4 /*
940.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
940.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
940.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
940.8 *
940.9 * This code is free software; you can redistribute it and/or modify it
940.10 @@ -26,6 +26,10 @@
940.11 * @bug 4423074
940.12 * @summary Need to rebase all the duplicated classes from Merlin.
940.13 * This test will check out http POST
940.14 + * @run main/othervm Redirect
940.15 + *
940.16 + * SunJSSE does not support dynamic system properties, no way to re-use
940.17 + * system properties in samevm/agentvm mode.
940.18 */
940.19
940.20 import java.io.*;
940.21 @@ -139,28 +143,33 @@
940.22 * to avoid infinite hangs.
940.23 */
940.24 void doClientSide() throws Exception {
940.25 + HostnameVerifier reservedHV =
940.26 + HttpsURLConnection.getDefaultHostnameVerifier();
940.27 + try {
940.28 + /*
940.29 + * Wait for server to get started.
940.30 + */
940.31 + while (!serverReady) {
940.32 + Thread.sleep(50);
940.33 + }
940.34
940.35 - /*
940.36 - * Wait for server to get started.
940.37 - */
940.38 - while (!serverReady) {
940.39 - Thread.sleep(50);
940.40 - }
940.41 + // Send HTTP POST request to server
940.42 + URL url = new URL("https://localhost:"+serverPort);
940.43
940.44 - // Send HTTP POST request to server
940.45 - URL url = new URL("https://localhost:"+serverPort);
940.46 -
940.47 - HttpsURLConnection.setDefaultHostnameVerifier(
940.48 - new NameVerifier());
940.49 - HttpsURLConnection http = (HttpsURLConnection)url.openConnection();
940.50 - try {
940.51 - System.out.println("response header: "+http.getHeaderField(0));
940.52 - if (http.getResponseCode() != 200) {
940.53 - throw new RuntimeException("test Failed");
940.54 + HttpsURLConnection.setDefaultHostnameVerifier(
940.55 + new NameVerifier());
940.56 + HttpsURLConnection http = (HttpsURLConnection)url.openConnection();
940.57 + try {
940.58 + System.out.println("response header: "+http.getHeaderField(0));
940.59 + if (http.getResponseCode() != 200) {
940.60 + throw new RuntimeException("test Failed");
940.61 + }
940.62 + } finally {
940.63 + http.disconnect();
940.64 + closeReady = true;
940.65 }
940.66 } finally {
940.67 - http.disconnect();
940.68 - closeReady = true;
940.69 + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV);
940.70 }
940.71 }
940.72
941.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/RetryHttps.java Thu Sep 01 13:54:38 2011 -0700
941.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/RetryHttps.java Mon Sep 05 23:58:19 2011 -0700
941.3 @@ -1,5 +1,5 @@
941.4 /*
941.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
941.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
941.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
941.8 *
941.9 * This code is free software; you can redistribute it and/or modify it
941.10 @@ -22,8 +22,12 @@
941.11 */
941.12
941.13 /* @test
941.14 + * @bug 4799427
941.15 * @summary Https can not retry request
941.16 - * @bug 4799427
941.17 + * @run main/othervm RetryHttps
941.18 + *
941.19 + * SunJSSE does not support dynamic system properties, no way to re-use
941.20 + * system properties in samevm/agentvm mode.
941.21 * @author Yingxian Wang
941.22 */
941.23
941.24 @@ -129,36 +133,41 @@
941.25 * to avoid infinite hangs.
941.26 */
941.27 void doClientSide() throws Exception {
941.28 -
941.29 - /*
941.30 - * Wait for server to get started.
941.31 - */
941.32 - while (!serverReady) {
941.33 - Thread.sleep(50);
941.34 - }
941.35 + HostnameVerifier reservedHV =
941.36 + HttpsURLConnection.getDefaultHostnameVerifier();
941.37 try {
941.38 - HttpsURLConnection http = null;
941.39 - /* establish http connection to server */
941.40 - URL url = new URL("https://localhost:" + serverPort+"/file1");
941.41 - System.out.println("url is "+url.toString());
941.42 - HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier());
941.43 - http = (HttpsURLConnection)url.openConnection();
941.44 - int respCode = http.getResponseCode();
941.45 - int cl = http.getContentLength();
941.46 - InputStream is = http.getInputStream ();
941.47 - int count = 0;
941.48 - while (is.read() != -1 && count++ < cl);
941.49 - System.out.println("respCode1 = "+respCode);
941.50 - Thread.sleep(2000);
941.51 - url = new URL("https://localhost:" + serverPort+"/file2");
941.52 - http = (HttpsURLConnection)url.openConnection();
941.53 - respCode = http.getResponseCode();
941.54 - System.out.println("respCode2 = "+respCode);
941.55 -
941.56 - } catch (IOException ioex) {
941.57 - if (sslServerSocket != null)
941.58 - sslServerSocket.close();
941.59 - throw ioex;
941.60 + /*
941.61 + * Wait for server to get started.
941.62 + */
941.63 + while (!serverReady) {
941.64 + Thread.sleep(50);
941.65 + }
941.66 + try {
941.67 + HttpsURLConnection http = null;
941.68 + /* establish http connection to server */
941.69 + URL url = new URL("https://localhost:" + serverPort+"/file1");
941.70 + System.out.println("url is "+url.toString());
941.71 + HttpsURLConnection.setDefaultHostnameVerifier(
941.72 + new NameVerifier());
941.73 + http = (HttpsURLConnection)url.openConnection();
941.74 + int respCode = http.getResponseCode();
941.75 + int cl = http.getContentLength();
941.76 + InputStream is = http.getInputStream ();
941.77 + int count = 0;
941.78 + while (is.read() != -1 && count++ < cl);
941.79 + System.out.println("respCode1 = "+respCode);
941.80 + Thread.sleep(2000);
941.81 + url = new URL("https://localhost:" + serverPort+"/file2");
941.82 + http = (HttpsURLConnection)url.openConnection();
941.83 + respCode = http.getResponseCode();
941.84 + System.out.println("respCode2 = "+respCode);
941.85 + } catch (IOException ioex) {
941.86 + if (sslServerSocket != null)
941.87 + sslServerSocket.close();
941.88 + throw ioex;
941.89 + }
941.90 + } finally {
941.91 + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV);
941.92 }
941.93 }
941.94
942.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/NewImpl/ComHTTPSConnection.java Thu Sep 01 13:54:38 2011 -0700
942.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/NewImpl/ComHTTPSConnection.java Mon Sep 05 23:58:19 2011 -0700
942.3 @@ -1,5 +1,5 @@
942.4 /*
942.5 - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
942.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
942.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
942.8 *
942.9 * This code is free software; you can redistribute it and/or modify it
942.10 @@ -25,6 +25,10 @@
942.11 * @test
942.12 * @bug 4474255
942.13 * @summary Can no longer obtain a com.sun.net.ssl.HttpsURLConnection
942.14 + * @run main/othervm ComHTTPSConnection
942.15 + *
942.16 + * SunJSSE does not support dynamic system properties, no way to re-use
942.17 + * system properties in samevm/agentvm mode.
942.18 * @author Brad Wetmore
942.19 */
942.20
942.21 @@ -198,44 +202,50 @@
942.22 Thread.sleep(50);
942.23 }
942.24
942.25 - System.setProperty("java.protocol.handler.pkgs",
942.26 - "com.sun.net.ssl.internal.www.protocol");
942.27 - HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier());
942.28 + HostnameVerifier reservedHV =
942.29 + HttpsURLConnection.getDefaultHostnameVerifier();
942.30 + try {
942.31 + System.setProperty("java.protocol.handler.pkgs",
942.32 + "com.sun.net.ssl.internal.www.protocol");
942.33 + HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier());
942.34
942.35 - URL url = new URL("https://" + "localhost:" + serverPort +
942.36 - "/etc/hosts");
942.37 - URLConnection urlc = url.openConnection();
942.38 + URL url = new URL("https://" + "localhost:" + serverPort +
942.39 + "/etc/hosts");
942.40 + URLConnection urlc = url.openConnection();
942.41
942.42 - if (!(urlc instanceof com.sun.net.ssl.HttpsURLConnection)) {
942.43 - throw new Exception(
942.44 - "URLConnection ! instanceof " +
942.45 - "com.sun.net.ssl.HttpsURLConnection");
942.46 - }
942.47 -
942.48 - BufferedReader in = null;
942.49 - try {
942.50 - in = new BufferedReader(new InputStreamReader(
942.51 - urlc.getInputStream()));
942.52 - String inputLine;
942.53 - System.out.print("Client reading... ");
942.54 - while ((inputLine = in.readLine()) != null)
942.55 - System.out.println(inputLine);
942.56 -
942.57 - System.out.println("Cipher Suite: " +
942.58 - ((HttpsURLConnection)urlc).getCipherSuite());
942.59 - X509Certificate[] certs =
942.60 - ((HttpsURLConnection)urlc).getServerCertificateChain();
942.61 - for (int i = 0; i < certs.length; i++) {
942.62 - System.out.println(certs[0]);
942.63 + if (!(urlc instanceof com.sun.net.ssl.HttpsURLConnection)) {
942.64 + throw new Exception(
942.65 + "URLConnection ! instanceof " +
942.66 + "com.sun.net.ssl.HttpsURLConnection");
942.67 }
942.68
942.69 - in.close();
942.70 - } catch (SSLException e) {
942.71 - if (in != null)
942.72 + BufferedReader in = null;
942.73 + try {
942.74 + in = new BufferedReader(new InputStreamReader(
942.75 + urlc.getInputStream()));
942.76 + String inputLine;
942.77 + System.out.print("Client reading... ");
942.78 + while ((inputLine = in.readLine()) != null)
942.79 + System.out.println(inputLine);
942.80 +
942.81 + System.out.println("Cipher Suite: " +
942.82 + ((HttpsURLConnection)urlc).getCipherSuite());
942.83 + X509Certificate[] certs =
942.84 + ((HttpsURLConnection)urlc).getServerCertificateChain();
942.85 + for (int i = 0; i < certs.length; i++) {
942.86 + System.out.println(certs[0]);
942.87 + }
942.88 +
942.89 in.close();
942.90 - throw e;
942.91 + } catch (SSLException e) {
942.92 + if (in != null)
942.93 + in.close();
942.94 + throw e;
942.95 + }
942.96 + System.out.println("Client reports: SUCCESS");
942.97 + } finally {
942.98 + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV);
942.99 }
942.100 - System.out.println("Client reports: SUCCESS");
942.101 }
942.102
942.103 static class NameVerifier implements HostnameVerifier {
943.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/NewImpl/ComHostnameVerifier.java Thu Sep 01 13:54:38 2011 -0700
943.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/NewImpl/ComHostnameVerifier.java Mon Sep 05 23:58:19 2011 -0700
943.3 @@ -28,6 +28,10 @@
943.4 * @bug 4484246
943.5 * @summary When an application enables anonymous SSL cipher suite,
943.6 * Hostname verification is not required
943.7 + * @run main/othervm ComHostnameVerifier
943.8 + *
943.9 + * SunJSSE does not support dynamic system properties, no way to re-use
943.10 + * system properties in samevm/agentvm mode.
943.11 */
943.12
943.13 import java.io.*;
944.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/NewImpl/JavaxHTTPSConnection.java Thu Sep 01 13:54:38 2011 -0700
944.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/NewImpl/JavaxHTTPSConnection.java Mon Sep 05 23:58:19 2011 -0700
944.3 @@ -1,5 +1,5 @@
944.4 /*
944.5 - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
944.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
944.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
944.8 *
944.9 * This code is free software; you can redistribute it and/or modify it
944.10 @@ -25,6 +25,10 @@
944.11 * @test
944.12 * @bug 4474255
944.13 * @summary Can no longer obtain a com.sun.net.ssl.HttpsURLConnection
944.14 + * @run main/othervm JavaxHTTPSConnection
944.15 + *
944.16 + * SunJSSE does not support dynamic system properties, no way to re-use
944.17 + * system properties in samevm/agentvm mode.
944.18 * @author Brad Wetmore
944.19 */
944.20
944.21 @@ -189,47 +193,53 @@
944.22 * to avoid infinite hangs.
944.23 */
944.24 void doClientSide() throws Exception {
944.25 - /*
944.26 - * Wait for server to get started.
944.27 - */
944.28 - while (!serverReady) {
944.29 - Thread.sleep(50);
944.30 - }
944.31 -
944.32 - HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier());
944.33 - URL url = new URL("https://" + "localhost:" + serverPort +
944.34 - "/etc/hosts");
944.35 - URLConnection urlc = url.openConnection();
944.36 -
944.37 - if (!(urlc instanceof javax.net.ssl.HttpsURLConnection)) {
944.38 - throw new Exception(
944.39 - "URLConnection ! instanceof javax.net.ssl.HttpsURLConnection");
944.40 - }
944.41 -
944.42 - BufferedReader in = null;
944.43 + HostnameVerifier reservedHV =
944.44 + HttpsURLConnection.getDefaultHostnameVerifier();
944.45 try {
944.46 - in = new BufferedReader(new InputStreamReader(
944.47 - urlc.getInputStream()));
944.48 - String inputLine;
944.49 - System.out.print("Client reading... ");
944.50 - while ((inputLine = in.readLine()) != null)
944.51 - System.out.println(inputLine);
944.52 -
944.53 - System.out.println("Cipher Suite: " +
944.54 - ((HttpsURLConnection)urlc).getCipherSuite());
944.55 - Certificate[] certs =
944.56 - ((HttpsURLConnection)urlc).getServerCertificates();
944.57 - for (int i = 0; i < certs.length; i++) {
944.58 - System.out.println(certs[0]);
944.59 + /*
944.60 + * Wait for server to get started.
944.61 + */
944.62 + while (!serverReady) {
944.63 + Thread.sleep(50);
944.64 }
944.65
944.66 - in.close();
944.67 - } catch (SSLException e) {
944.68 - if (in != null)
944.69 + HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier());
944.70 + URL url = new URL("https://" + "localhost:" + serverPort +
944.71 + "/etc/hosts");
944.72 + URLConnection urlc = url.openConnection();
944.73 +
944.74 + if (!(urlc instanceof javax.net.ssl.HttpsURLConnection)) {
944.75 + throw new Exception("URLConnection ! instanceof " +
944.76 + "javax.net.ssl.HttpsURLConnection");
944.77 + }
944.78 +
944.79 + BufferedReader in = null;
944.80 + try {
944.81 + in = new BufferedReader(new InputStreamReader(
944.82 + urlc.getInputStream()));
944.83 + String inputLine;
944.84 + System.out.print("Client reading... ");
944.85 + while ((inputLine = in.readLine()) != null)
944.86 + System.out.println(inputLine);
944.87 +
944.88 + System.out.println("Cipher Suite: " +
944.89 + ((HttpsURLConnection)urlc).getCipherSuite());
944.90 + Certificate[] certs =
944.91 + ((HttpsURLConnection)urlc).getServerCertificates();
944.92 + for (int i = 0; i < certs.length; i++) {
944.93 + System.out.println(certs[0]);
944.94 + }
944.95 +
944.96 in.close();
944.97 - throw e;
944.98 + } catch (SSLException e) {
944.99 + if (in != null)
944.100 + in.close();
944.101 + throw e;
944.102 + }
944.103 + System.out.println("Client reports: SUCCESS");
944.104 + } finally {
944.105 + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV);
944.106 }
944.107 - System.out.println("Client reports: SUCCESS");
944.108 }
944.109
944.110 static class NameVerifier implements HostnameVerifier {
945.1 --- a/test/sun/security/ssl/sun/net/www/protocol/https/NewImpl/JavaxHostnameVerifier.java Thu Sep 01 13:54:38 2011 -0700
945.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/NewImpl/JavaxHostnameVerifier.java Mon Sep 05 23:58:19 2011 -0700
945.3 @@ -28,6 +28,10 @@
945.4 * @bug 4484246
945.5 * @summary When an application enables anonymous SSL cipher suite,
945.6 * Hostname verification is not required
945.7 + * @run main/othervm JavaxHostnameVerifier
945.8 + *
945.9 + * SunJSSE does not support dynamic system properties, no way to re-use
945.10 + * system properties in samevm/agentvm mode.
945.11 */
945.12
945.13 import java.io.*;
946.1 --- a/test/sun/security/ssl/templates/SSLEngineTemplate.java Thu Sep 01 13:54:38 2011 -0700
946.2 +++ b/test/sun/security/ssl/templates/SSLEngineTemplate.java Mon Sep 05 23:58:19 2011 -0700
946.3 @@ -25,7 +25,10 @@
946.4 * @test
946.5 * @bug 1234567
946.6 * @summary SSLEngine has not yet caused Solaris kernel to panic
946.7 + * @run main/othervm SSLEngineTemplate
946.8 *
946.9 + * SunJSSE does not support dynamic system properties, no way to re-use
946.10 + * system properties in samevm/agentvm mode.
946.11 */
946.12
946.13 /**
947.1 --- a/test/sun/security/ssl/templates/SSLSocketTemplate.java Thu Sep 01 13:54:38 2011 -0700
947.2 +++ b/test/sun/security/ssl/templates/SSLSocketTemplate.java Mon Sep 05 23:58:19 2011 -0700
947.3 @@ -25,6 +25,10 @@
947.4 * @test
947.5 * @bug 1234567
947.6 * @summary Use this template to help speed your client/server tests.
947.7 + * @run main/othervm SSLSocketTemplate
947.8 + *
947.9 + * SunJSSE does not support dynamic system properties, no way to re-use
947.10 + * system properties in samevm/agentvm mode.
947.11 * @author Brad Wetmore
947.12 */
947.13
948.1 --- a/test/sun/security/tools/jarsigner/concise_jarsigner.sh Thu Sep 01 13:54:38 2011 -0700
948.2 +++ b/test/sun/security/tools/jarsigner/concise_jarsigner.sh Mon Sep 05 23:58:19 2011 -0700
948.3 @@ -44,7 +44,10 @@
948.4 ;;
948.5 esac
948.6
948.7 -KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore js.jks"
948.8 +# Choose 512-bit RSA to make sure it runs fine and fast on all platforms. In fact,
948.9 +# every keyalg/keysize combination is OK for this test.
948.10 +
948.11 +KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore js.jks -keyalg rsa -keysize 512"
948.12 JAR=$TESTJAVA${FS}bin${FS}jar
948.13 JARSIGNER=$TESTJAVA${FS}bin${FS}jarsigner
948.14 JAVAC=$TESTJAVA${FS}bin${FS}javac
949.1 --- a/test/sun/security/tools/keytool/StartDateTest.java Thu Sep 01 13:54:38 2011 -0700
949.2 +++ b/test/sun/security/tools/keytool/StartDateTest.java Mon Sep 05 23:58:19 2011 -0700
949.3 @@ -132,7 +132,9 @@
949.4
949.5 static Date getIssueDate() throws Exception {
949.6 KeyStore ks = KeyStore.getInstance("jks");
949.7 - ks.load(new FileInputStream("jks"), "changeit".toCharArray());
949.8 + try (FileInputStream fis = new FileInputStream("jks")) {
949.9 + ks.load(fis, "changeit".toCharArray());
949.10 + }
949.11 X509Certificate cert = (X509Certificate)ks.getCertificate("me");
949.12 return cert.getNotBefore();
949.13 }
950.1 --- a/test/sun/security/x509/AlgorithmId/ExtensibleAlgorithmId.java Thu Sep 01 13:54:38 2011 -0700
950.2 +++ b/test/sun/security/x509/AlgorithmId/ExtensibleAlgorithmId.java Mon Sep 05 23:58:19 2011 -0700
950.3 @@ -24,9 +24,12 @@
950.4 /*
950.5 * @test
950.6 * @bug 4162868
950.7 + * @run main/othervm ExtensibleAlgorithmId
950.8 * @summary Algorithm Name-to-OID mapping needs to be made extensible.
950.9 */
950.10
950.11 +// Run in othervm, coz AlgorithmId.oidTable is only initialized once
950.12 +
950.13 import java.security.*;
950.14 import sun.security.x509.AlgorithmId;
950.15