提交 21df5611 编写于 作者: T tbell

Merge

...@@ -97,7 +97,7 @@ else ...@@ -97,7 +97,7 @@ else
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
LICENSE_DOCLIST_JDK = $(subst $(LICENSE_VERSION),,\ LICENSE_DOCLIST_JDK = $(subst $(LICENSE_VERSION),,\
$(shell $(CD) $(SHARE_JDK_DOC_SRC) && \ $(shell $(CD) $(SHARE_JDK_DOC_SRC) && \
$(LS) *LICENSE*$(LICENSE_VERSION))) $(LS) *LICENSE*$(LICENSE_VERSION)))
LICENSE_DOCLIST_JRE = $(subst $(LICENSE_VERSION),,\ LICENSE_DOCLIST_JRE = $(subst $(LICENSE_VERSION),,\
$(shell $(CD) $(SHARE_JRE_DOC_SRC) && \ $(shell $(CD) $(SHARE_JRE_DOC_SRC) && \
$(LS) *LICENSE*$(LICENSE_VERSION))) $(LS) *LICENSE*$(LICENSE_VERSION)))
...@@ -401,7 +401,7 @@ TOOLS = \ ...@@ -401,7 +401,7 @@ TOOLS = \
sun/tools/jstack \ sun/tools/jstack \
sun/tools/jinfo \ sun/tools/jinfo \
sun/tools/jmap sun/tools/jmap
# classes that go into jsse.jar # classes that go into jsse.jar
JSSE_CLASSES_DIRS = \ JSSE_CLASSES_DIRS = \
sun/security/provider/Sun.class \ sun/security/provider/Sun.class \
...@@ -645,7 +645,7 @@ $(RT_JAR_FILELIST) + $(RES_JAR_FILELIST): \ ...@@ -645,7 +645,7 @@ $(RT_JAR_FILELIST) + $(RES_JAR_FILELIST): \
@$(java-vm-cleanup) @$(java-vm-cleanup)
# Create the manifest file. # Create the manifest file.
JAR_MANIFEST_FILE=$(TEMPDIR)/manifest.tmp JAR_MANIFEST_FILE=$(ABS_TEMPDIR)/manifest.tmp
$(JAR_MANIFEST_FILE): $(MAINMANIFEST) $(BEANMANIFEST) $(JAR_MANIFEST_FILE): $(MAINMANIFEST) $(BEANMANIFEST)
$(prep-target) $(prep-target)
$(SED) -e "s/@@RELEASE@@/$(RELEASE)/" $(MAINMANIFEST) >> $@ $(SED) -e "s/@@RELEASE@@/$(RELEASE)/" $(MAINMANIFEST) >> $@
...@@ -653,25 +653,22 @@ $(JAR_MANIFEST_FILE): $(MAINMANIFEST) $(BEANMANIFEST) ...@@ -653,25 +653,22 @@ $(JAR_MANIFEST_FILE): $(MAINMANIFEST) $(BEANMANIFEST)
$(CAT) $(BEANMANIFEST) >> $@ $(CAT) $(BEANMANIFEST) >> $@
# Create resources.jar containing non-class files # Create resources.jar containing non-class files
RESOURCES_JAR=$(TEMPDIR)/resources-orig.jar RESOURCES_JAR=$(ABS_TEMPDIR)/resources-orig.jar
RES_JAR_ARGLIST=$(RES_JAR_FILELIST)_args $(RESOURCES_JAR): $(RES_JAR_FILELIST) $(JAR_MANIFEST_FILE)
$(RES_JAR_ARGLIST): $(RES_JAR_FILELIST)
$(prep-target) $(prep-target)
$(SED) -e "s@^@-C $(CLASSBINDIR) @" $< > $@ $(CD) $(CLASSBINDIR) && \
$(RESOURCES_JAR): $(RES_JAR_ARGLIST) $(JAR_MANIFEST_FILE) $(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \
$(prep-target) @$(RES_JAR_FILELIST) $(BOOT_JAR_JFLAGS)
$(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \ @$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
@$(RES_JAR_ARGLIST) $(BOOT_JAR_JFLAGS)
@$(java-vm-cleanup)
# Create jsse.jar containing SunJSSE implementation classes # Create jsse.jar containing SunJSSE implementation classes
JSSE_JAR=$(TEMPDIR)/jsse-orig.jar JSSE_JAR=$(ABS_TEMPDIR)/jsse-orig.jar
$(JSSE_JAR): $(JAR_MANIFEST_FILE) $(JSSE_JAR): $(JAR_MANIFEST_FILE)
$(prep-target) $(prep-target)
$(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \ $(CD) $(CLASSBINDIR) && \
$(JSSE_CLASSES_DIRS:%=-C $(CLASSBINDIR) %) \ $(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \
$(BOOT_JAR_JFLAGS) $(JSSE_CLASSES_DIRS) $(BOOT_JAR_JFLAGS)
@$(java-vm-cleanup) @$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
# Create sec-bin.zip # Create sec-bin.zip
SEC_FILES_ZIP=$(ABS_TEMPDIR)/sec-bin.zip SEC_FILES_ZIP=$(ABS_TEMPDIR)/sec-bin.zip
...@@ -713,15 +710,12 @@ endif ...@@ -713,15 +710,12 @@ endif
# Create rt.jar # Create rt.jar
RT_JAR=$(ABS_TEMPDIR)/rt-orig.jar RT_JAR=$(ABS_TEMPDIR)/rt-orig.jar
RT_JAR_ARGLIST=$(RT_JAR_FILELIST)_args $(RT_JAR): $(RT_JAR_FILELIST) $(JAR_MANIFEST_FILE)
$(RT_JAR_ARGLIST): $(RT_JAR_FILELIST)
$(prep-target)
$(SED) -e "s@^@-C $(CLASSBINDIR) @" $< > $@
$(RT_JAR): $(RT_JAR_ARGLIST) $(JAR_MANIFEST_FILE)
$(prep-target) $(prep-target)
$(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \ $(CD) $(CLASSBINDIR) && \
@$(RT_JAR_ARGLIST) $(BOOT_JAR_JFLAGS) $(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \
@$(java-vm-cleanup) @$(RT_JAR_FILELIST) $(BOOT_JAR_JFLAGS)
@$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
# Meta-index construction to make core class loaders lazier # Meta-index construction to make core class loaders lazier
...@@ -944,10 +938,10 @@ initial-image-jdk:: initial-image-jdk-setup \ ...@@ -944,10 +938,10 @@ initial-image-jdk:: initial-image-jdk-setup \
@# @#
@# lib/tools.jar @# lib/tools.jar
@# @#
$(BOOT_JAR_CMD) c0f $(LIBDIR)/tools.jar $(addprefix \ $(CD) $(CLASSBINDIR) && \
-C $(CLASSBINDIR) , $(TOOLS)) \ $(BOOT_JAR_CMD) c0f $(ABS_LIBDIR)/tools.jar \
$(BOOT_JAR_JFLAGS) $(TOOLS) $(BOOT_JAR_JFLAGS)
@$(java-vm-cleanup) @$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
$(CP) $(LIBDIR)/tools.jar $(JDK_IMAGE_DIR)/lib/tools.jar $(CP) $(LIBDIR)/tools.jar $(JDK_IMAGE_DIR)/lib/tools.jar
@# @#
@# lib/ct.sym @# lib/ct.sym
......
...@@ -151,7 +151,6 @@ FILES_src = \ ...@@ -151,7 +151,6 @@ FILES_src = \
sun/io/ByteToCharJISAutoDetect.java \ sun/io/ByteToCharJISAutoDetect.java \
sun/io/ByteToCharJohab.java \ sun/io/ByteToCharJohab.java \
sun/io/ByteToCharMS874.java \ sun/io/ByteToCharMS874.java \
sun/io/ByteToCharMS932DB.java \
sun/io/ByteToCharMS932.java \ sun/io/ByteToCharMS932.java \
sun/io/ByteToCharMS936.java \ sun/io/ByteToCharMS936.java \
sun/io/ByteToCharMS949.java \ sun/io/ByteToCharMS949.java \
...@@ -283,7 +282,6 @@ FILES_src = \ ...@@ -283,7 +282,6 @@ FILES_src = \
sun/io/CharToByteISO8859_8.java \ sun/io/CharToByteISO8859_8.java \
sun/io/CharToByteJohab.java \ sun/io/CharToByteJohab.java \
sun/io/CharToByteMS874.java \ sun/io/CharToByteMS874.java \
sun/io/CharToByteMS932DB.java \
sun/io/CharToByteMS932.java \ sun/io/CharToByteMS932.java \
sun/io/CharToByteMS936.java \ sun/io/CharToByteMS936.java \
sun/io/CharToByteMS949.java \ sun/io/CharToByteMS949.java \
...@@ -388,7 +386,15 @@ FILES_gen_extcs = \ ...@@ -388,7 +386,15 @@ FILES_gen_extcs = \
sun/nio/cs/ext/IBM948.java \ sun/nio/cs/ext/IBM948.java \
sun/nio/cs/ext/IBM949.java \ sun/nio/cs/ext/IBM949.java \
sun/nio/cs/ext/IBM950.java \ sun/nio/cs/ext/IBM950.java \
sun/nio/cs/ext/IBM970.java sun/nio/cs/ext/IBM970.java \
sun/nio/cs/ext/EUC_CN.java \
sun/nio/cs/ext/EUC_KR.java \
sun/nio/cs/ext/Johab.java \
sun/nio/cs/ext/MS932.java \
sun/nio/cs/ext/MS936.java \
sun/nio/cs/ext/MS949.java \
sun/nio/cs/ext/MS950.java \
sun/nio/cs/ext/GBK.java
FILES_java = $(FILES_src) $(FILES_gen_extcs) FILES_java = $(FILES_src) $(FILES_gen_extcs)
...@@ -105,7 +105,7 @@ $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH): \ ...@@ -105,7 +105,7 @@ $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH): \
$(install-file) $(install-file)
$(CHARSETS_JAR): $(FILES_class) $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH) $(FILES_DAT) $(CHARSETS_JAR): $(FILES_class) $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH) $(FILES_DAT)
$(BOOT_JAR_CMD) cf $(CHARSETS_JAR) \ $(BOOT_JAR_CMD) cf0 $(CHARSETS_JAR) \
-C $(CLASSDESTDIR) sun \ -C $(CLASSDESTDIR) sun \
-C $(CLASSDESTDIR) $(SERVICE_DESCRIPTION_PATH) \ -C $(CLASSDESTDIR) $(SERVICE_DESCRIPTION_PATH) \
$(BOOT_JAR_JFLAGS) $(BOOT_JAR_JFLAGS)
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
#
# (1)entries that exist only in MS932DB.c2b.private
# (diff result of MS932DB.b2c.private and MS932DB.c2b.private)
# (2)added the jis0201 c->b only entries
# u+203e -> 0x7e
# u+00a5 -> 0x5c
#
0x7e 0x203e
0x5c 0x00a5
#
0x8143 0x00b8 # CEDILLA
0x8145 0x00b7 # MIDDLE DOT
0x8150 0x00af # MACRON
0x8191 0x00a2 # CENT SIGN
0x8192 0x00a3 # POUND SIGN
0x81ca 0x00ac # NOT SIGN
0x81e1 0x00ab # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
0x81e2 0x00bb # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
0x8394 0x3094 # HIRAGANA LETTER VU
0x83ca 0x00b5 # MICRO SIGN
此差异已折叠。
#
# These are the entries exist only in MS932DB.b2c.private
# (diff result of MS932DB.b2c.private and MS932DB.c2b.private)
#
0x8790 0x2252 # APPROXIMATELY EQUAL TO OR THE IMAGE OF
0x8791 0x2261 # IDENTICAL TO
0x8792 0x222b # INTEGRAL
0x8795 0x221a # SQUARE ROOT
0x8796 0x22a5 # UP TACK
0x8797 0x2220 # ANGLE
0x879a 0x2235 # BECAUSE
0x879b 0x2229 # INTERSECTION
0x879c 0x222a # UNION
0xed40 0x7e8a # CJK UNIFIED IDEOGRAPH-7E8A
0xed41 0x891c # CJK UNIFIED IDEOGRAPH-891C
0xed42 0x9348 # CJK UNIFIED IDEOGRAPH-9348
0xed43 0x9288 # CJK UNIFIED IDEOGRAPH-9288
0xed44 0x84dc # CJK UNIFIED IDEOGRAPH-84DC
0xed45 0x4fc9 # CJK UNIFIED IDEOGRAPH-4FC9
0xed46 0x70bb # CJK UNIFIED IDEOGRAPH-70BB
0xed47 0x6631 # CJK UNIFIED IDEOGRAPH-6631
0xed48 0x68c8 # CJK UNIFIED IDEOGRAPH-68C8
0xed49 0x92f9 # CJK UNIFIED IDEOGRAPH-92F9
0xed4a 0x66fb # CJK UNIFIED IDEOGRAPH-66FB
0xed4b 0x5f45 # CJK UNIFIED IDEOGRAPH-5F45
0xed4c 0x4e28 # CJK UNIFIED IDEOGRAPH-4E28
0xed4d 0x4ee1 # CJK UNIFIED IDEOGRAPH-4EE1
0xed4e 0x4efc # CJK UNIFIED IDEOGRAPH-4EFC
0xed4f 0x4f00 # CJK UNIFIED IDEOGRAPH-4F00
0xed50 0x4f03 # CJK UNIFIED IDEOGRAPH-4F03
0xed51 0x4f39 # CJK UNIFIED IDEOGRAPH-4F39
0xed52 0x4f56 # CJK UNIFIED IDEOGRAPH-4F56
0xed53 0x4f92 # CJK UNIFIED IDEOGRAPH-4F92
0xed54 0x4f8a # CJK UNIFIED IDEOGRAPH-4F8A
0xed55 0x4f9a # CJK UNIFIED IDEOGRAPH-4F9A
0xed56 0x4f94 # CJK UNIFIED IDEOGRAPH-4F94
0xed57 0x4fcd # CJK UNIFIED IDEOGRAPH-4FCD
0xed58 0x5040 # CJK UNIFIED IDEOGRAPH-5040
0xed59 0x5022 # CJK UNIFIED IDEOGRAPH-5022
0xed5a 0x4fff # CJK UNIFIED IDEOGRAPH-4FFF
0xed5b 0x501e # CJK UNIFIED IDEOGRAPH-501E
0xed5c 0x5046 # CJK UNIFIED IDEOGRAPH-5046
0xed5d 0x5070 # CJK UNIFIED IDEOGRAPH-5070
0xed5e 0x5042 # CJK UNIFIED IDEOGRAPH-5042
0xed5f 0x5094 # CJK UNIFIED IDEOGRAPH-5094
0xed60 0x50f4 # CJK UNIFIED IDEOGRAPH-50F4
0xed61 0x50d8 # CJK UNIFIED IDEOGRAPH-50D8
0xed62 0x514a # CJK UNIFIED IDEOGRAPH-514A
0xed63 0x5164 # CJK UNIFIED IDEOGRAPH-5164
0xed64 0x519d # CJK UNIFIED IDEOGRAPH-519D
0xed65 0x51be # CJK UNIFIED IDEOGRAPH-51BE
0xed66 0x51ec # CJK UNIFIED IDEOGRAPH-51EC
0xed67 0x5215 # CJK UNIFIED IDEOGRAPH-5215
0xed68 0x529c # CJK UNIFIED IDEOGRAPH-529C
0xed69 0x52a6 # CJK UNIFIED IDEOGRAPH-52A6
0xed6a 0x52c0 # CJK UNIFIED IDEOGRAPH-52C0
0xed6b 0x52db # CJK UNIFIED IDEOGRAPH-52DB
0xed6c 0x5300 # CJK UNIFIED IDEOGRAPH-5300
0xed6d 0x5307 # CJK UNIFIED IDEOGRAPH-5307
0xed6e 0x5324 # CJK UNIFIED IDEOGRAPH-5324
0xed6f 0x5372 # CJK UNIFIED IDEOGRAPH-5372
0xed70 0x5393 # CJK UNIFIED IDEOGRAPH-5393
0xed71 0x53b2 # CJK UNIFIED IDEOGRAPH-53B2
0xed72 0x53dd # CJK UNIFIED IDEOGRAPH-53DD
0xed73 0xfa0e # CJK COMPATIBILITY IDEOGRAPH-FA0E
0xed74 0x549c # CJK UNIFIED IDEOGRAPH-549C
0xed75 0x548a # CJK UNIFIED IDEOGRAPH-548A
0xed76 0x54a9 # CJK UNIFIED IDEOGRAPH-54A9
0xed77 0x54ff # CJK UNIFIED IDEOGRAPH-54FF
0xed78 0x5586 # CJK UNIFIED IDEOGRAPH-5586
0xed79 0x5759 # CJK UNIFIED IDEOGRAPH-5759
0xed7a 0x5765 # CJK UNIFIED IDEOGRAPH-5765
0xed7b 0x57ac # CJK UNIFIED IDEOGRAPH-57AC
0xed7c 0x57c8 # CJK UNIFIED IDEOGRAPH-57C8
0xed7d 0x57c7 # CJK UNIFIED IDEOGRAPH-57C7
0xed7e 0xfa0f # CJK COMPATIBILITY IDEOGRAPH-FA0F
0xed80 0xfa10 # CJK COMPATIBILITY IDEOGRAPH-FA10
0xed81 0x589e # CJK UNIFIED IDEOGRAPH-589E
0xed82 0x58b2 # CJK UNIFIED IDEOGRAPH-58B2
0xed83 0x590b # CJK UNIFIED IDEOGRAPH-590B
0xed84 0x5953 # CJK UNIFIED IDEOGRAPH-5953
0xed85 0x595b # CJK UNIFIED IDEOGRAPH-595B
0xed86 0x595d # CJK UNIFIED IDEOGRAPH-595D
0xed87 0x5963 # CJK UNIFIED IDEOGRAPH-5963
0xed88 0x59a4 # CJK UNIFIED IDEOGRAPH-59A4
0xed89 0x59ba # CJK UNIFIED IDEOGRAPH-59BA
0xed8a 0x5b56 # CJK UNIFIED IDEOGRAPH-5B56
0xed8b 0x5bc0 # CJK UNIFIED IDEOGRAPH-5BC0
0xed8c 0x752f # CJK UNIFIED IDEOGRAPH-752F
0xed8d 0x5bd8 # CJK UNIFIED IDEOGRAPH-5BD8
0xed8e 0x5bec # CJK UNIFIED IDEOGRAPH-5BEC
0xed8f 0x5c1e # CJK UNIFIED IDEOGRAPH-5C1E
0xed90 0x5ca6 # CJK UNIFIED IDEOGRAPH-5CA6
0xed91 0x5cba # CJK UNIFIED IDEOGRAPH-5CBA
0xed92 0x5cf5 # CJK UNIFIED IDEOGRAPH-5CF5
0xed93 0x5d27 # CJK UNIFIED IDEOGRAPH-5D27
0xed94 0x5d53 # CJK UNIFIED IDEOGRAPH-5D53
0xed95 0xfa11 # CJK COMPATIBILITY IDEOGRAPH-FA11
0xed96 0x5d42 # CJK UNIFIED IDEOGRAPH-5D42
0xed97 0x5d6d # CJK UNIFIED IDEOGRAPH-5D6D
0xed98 0x5db8 # CJK UNIFIED IDEOGRAPH-5DB8
0xed99 0x5db9 # CJK UNIFIED IDEOGRAPH-5DB9
0xed9a 0x5dd0 # CJK UNIFIED IDEOGRAPH-5DD0
0xed9b 0x5f21 # CJK UNIFIED IDEOGRAPH-5F21
0xed9c 0x5f34 # CJK UNIFIED IDEOGRAPH-5F34
0xed9d 0x5f67 # CJK UNIFIED IDEOGRAPH-5F67
0xed9e 0x5fb7 # CJK UNIFIED IDEOGRAPH-5FB7
0xed9f 0x5fde # CJK UNIFIED IDEOGRAPH-5FDE
0xeda0 0x605d # CJK UNIFIED IDEOGRAPH-605D
0xeda1 0x6085 # CJK UNIFIED IDEOGRAPH-6085
0xeda2 0x608a # CJK UNIFIED IDEOGRAPH-608A
0xeda3 0x60de # CJK UNIFIED IDEOGRAPH-60DE
0xeda4 0x60d5 # CJK UNIFIED IDEOGRAPH-60D5
0xeda5 0x6120 # CJK UNIFIED IDEOGRAPH-6120
0xeda6 0x60f2 # CJK UNIFIED IDEOGRAPH-60F2
0xeda7 0x6111 # CJK UNIFIED IDEOGRAPH-6111
0xeda8 0x6137 # CJK UNIFIED IDEOGRAPH-6137
0xeda9 0x6130 # CJK UNIFIED IDEOGRAPH-6130
0xedaa 0x6198 # CJK UNIFIED IDEOGRAPH-6198
0xedab 0x6213 # CJK UNIFIED IDEOGRAPH-6213
0xedac 0x62a6 # CJK UNIFIED IDEOGRAPH-62A6
0xedad 0x63f5 # CJK UNIFIED IDEOGRAPH-63F5
0xedae 0x6460 # CJK UNIFIED IDEOGRAPH-6460
0xedaf 0x649d # CJK UNIFIED IDEOGRAPH-649D
0xedb0 0x64ce # CJK UNIFIED IDEOGRAPH-64CE
0xedb1 0x654e # CJK UNIFIED IDEOGRAPH-654E
0xedb2 0x6600 # CJK UNIFIED IDEOGRAPH-6600
0xedb3 0x6615 # CJK UNIFIED IDEOGRAPH-6615
0xedb4 0x663b # CJK UNIFIED IDEOGRAPH-663B
0xedb5 0x6609 # CJK UNIFIED IDEOGRAPH-6609
0xedb6 0x662e # CJK UNIFIED IDEOGRAPH-662E
0xedb7 0x661e # CJK UNIFIED IDEOGRAPH-661E
0xedb8 0x6624 # CJK UNIFIED IDEOGRAPH-6624
0xedb9 0x6665 # CJK UNIFIED IDEOGRAPH-6665
0xedba 0x6657 # CJK UNIFIED IDEOGRAPH-6657
0xedbb 0x6659 # CJK UNIFIED IDEOGRAPH-6659
0xedbc 0xfa12 # CJK COMPATIBILITY IDEOGRAPH-FA12
0xedbd 0x6673 # CJK UNIFIED IDEOGRAPH-6673
0xedbe 0x6699 # CJK UNIFIED IDEOGRAPH-6699
0xedbf 0x66a0 # CJK UNIFIED IDEOGRAPH-66A0
0xedc0 0x66b2 # CJK UNIFIED IDEOGRAPH-66B2
0xedc1 0x66bf # CJK UNIFIED IDEOGRAPH-66BF
0xedc2 0x66fa # CJK UNIFIED IDEOGRAPH-66FA
0xedc3 0x670e # CJK UNIFIED IDEOGRAPH-670E
0xedc4 0xf929 # CJK COMPATIBILITY IDEOGRAPH-F929
0xedc5 0x6766 # CJK UNIFIED IDEOGRAPH-6766
0xedc6 0x67bb # CJK UNIFIED IDEOGRAPH-67BB
0xedc7 0x6852 # CJK UNIFIED IDEOGRAPH-6852
0xedc8 0x67c0 # CJK UNIFIED IDEOGRAPH-67C0
0xedc9 0x6801 # CJK UNIFIED IDEOGRAPH-6801
0xedca 0x6844 # CJK UNIFIED IDEOGRAPH-6844
0xedcb 0x68cf # CJK UNIFIED IDEOGRAPH-68CF
0xedcc 0xfa13 # CJK COMPATIBILITY IDEOGRAPH-FA13
0xedcd 0x6968 # CJK UNIFIED IDEOGRAPH-6968
0xedce 0xfa14 # CJK COMPATIBILITY IDEOGRAPH-FA14
0xedcf 0x6998 # CJK UNIFIED IDEOGRAPH-6998
0xedd0 0x69e2 # CJK UNIFIED IDEOGRAPH-69E2
0xedd1 0x6a30 # CJK UNIFIED IDEOGRAPH-6A30
0xedd2 0x6a6b # CJK UNIFIED IDEOGRAPH-6A6B
0xedd3 0x6a46 # CJK UNIFIED IDEOGRAPH-6A46
0xedd4 0x6a73 # CJK UNIFIED IDEOGRAPH-6A73
0xedd5 0x6a7e # CJK UNIFIED IDEOGRAPH-6A7E
0xedd6 0x6ae2 # CJK UNIFIED IDEOGRAPH-6AE2
0xedd7 0x6ae4 # CJK UNIFIED IDEOGRAPH-6AE4
0xedd8 0x6bd6 # CJK UNIFIED IDEOGRAPH-6BD6
0xedd9 0x6c3f # CJK UNIFIED IDEOGRAPH-6C3F
0xedda 0x6c5c # CJK UNIFIED IDEOGRAPH-6C5C
0xeddb 0x6c86 # CJK UNIFIED IDEOGRAPH-6C86
0xeddc 0x6c6f # CJK UNIFIED IDEOGRAPH-6C6F
0xeddd 0x6cda # CJK UNIFIED IDEOGRAPH-6CDA
0xedde 0x6d04 # CJK UNIFIED IDEOGRAPH-6D04
0xeddf 0x6d87 # CJK UNIFIED IDEOGRAPH-6D87
0xede0 0x6d6f # CJK UNIFIED IDEOGRAPH-6D6F
0xede1 0x6d96 # CJK UNIFIED IDEOGRAPH-6D96
0xede2 0x6dac # CJK UNIFIED IDEOGRAPH-6DAC
0xede3 0x6dcf # CJK UNIFIED IDEOGRAPH-6DCF
0xede4 0x6df8 # CJK UNIFIED IDEOGRAPH-6DF8
0xede5 0x6df2 # CJK UNIFIED IDEOGRAPH-6DF2
0xede6 0x6dfc # CJK UNIFIED IDEOGRAPH-6DFC
0xede7 0x6e39 # CJK UNIFIED IDEOGRAPH-6E39
0xede8 0x6e5c # CJK UNIFIED IDEOGRAPH-6E5C
0xede9 0x6e27 # CJK UNIFIED IDEOGRAPH-6E27
0xedea 0x6e3c # CJK UNIFIED IDEOGRAPH-6E3C
0xedeb 0x6ebf # CJK UNIFIED IDEOGRAPH-6EBF
0xedec 0x6f88 # CJK UNIFIED IDEOGRAPH-6F88
0xeded 0x6fb5 # CJK UNIFIED IDEOGRAPH-6FB5
0xedee 0x6ff5 # CJK UNIFIED IDEOGRAPH-6FF5
0xedef 0x7005 # CJK UNIFIED IDEOGRAPH-7005
0xedf0 0x7007 # CJK UNIFIED IDEOGRAPH-7007
0xedf1 0x7028 # CJK UNIFIED IDEOGRAPH-7028
0xedf2 0x7085 # CJK UNIFIED IDEOGRAPH-7085
0xedf3 0x70ab # CJK UNIFIED IDEOGRAPH-70AB
0xedf4 0x710f # CJK UNIFIED IDEOGRAPH-710F
0xedf5 0x7104 # CJK UNIFIED IDEOGRAPH-7104
0xedf6 0x715c # CJK UNIFIED IDEOGRAPH-715C
0xedf7 0x7146 # CJK UNIFIED IDEOGRAPH-7146
0xedf8 0x7147 # CJK UNIFIED IDEOGRAPH-7147
0xedf9 0xfa15 # CJK COMPATIBILITY IDEOGRAPH-FA15
0xedfa 0x71c1 # CJK UNIFIED IDEOGRAPH-71C1
0xedfb 0x71fe # CJK UNIFIED IDEOGRAPH-71FE
0xedfc 0x72b1 # CJK UNIFIED IDEOGRAPH-72B1
0xee40 0x72be # CJK UNIFIED IDEOGRAPH-72BE
0xee41 0x7324 # CJK UNIFIED IDEOGRAPH-7324
0xee42 0xfa16 # CJK COMPATIBILITY IDEOGRAPH-FA16
0xee43 0x7377 # CJK UNIFIED IDEOGRAPH-7377
0xee44 0x73bd # CJK UNIFIED IDEOGRAPH-73BD
0xee45 0x73c9 # CJK UNIFIED IDEOGRAPH-73C9
0xee46 0x73d6 # CJK UNIFIED IDEOGRAPH-73D6
0xee47 0x73e3 # CJK UNIFIED IDEOGRAPH-73E3
0xee48 0x73d2 # CJK UNIFIED IDEOGRAPH-73D2
0xee49 0x7407 # CJK UNIFIED IDEOGRAPH-7407
0xee4a 0x73f5 # CJK UNIFIED IDEOGRAPH-73F5
0xee4b 0x7426 # CJK UNIFIED IDEOGRAPH-7426
0xee4c 0x742a # CJK UNIFIED IDEOGRAPH-742A
0xee4d 0x7429 # CJK UNIFIED IDEOGRAPH-7429
0xee4e 0x742e # CJK UNIFIED IDEOGRAPH-742E
0xee4f 0x7462 # CJK UNIFIED IDEOGRAPH-7462
0xee50 0x7489 # CJK UNIFIED IDEOGRAPH-7489
0xee51 0x749f # CJK UNIFIED IDEOGRAPH-749F
0xee52 0x7501 # CJK UNIFIED IDEOGRAPH-7501
0xee53 0x756f # CJK UNIFIED IDEOGRAPH-756F
0xee54 0x7682 # CJK UNIFIED IDEOGRAPH-7682
0xee55 0x769c # CJK UNIFIED IDEOGRAPH-769C
0xee56 0x769e # CJK UNIFIED IDEOGRAPH-769E
0xee57 0x769b # CJK UNIFIED IDEOGRAPH-769B
0xee58 0x76a6 # CJK UNIFIED IDEOGRAPH-76A6
0xee59 0xfa17 # CJK COMPATIBILITY IDEOGRAPH-FA17
0xee5a 0x7746 # CJK UNIFIED IDEOGRAPH-7746
0xee5b 0x52af # CJK UNIFIED IDEOGRAPH-52AF
0xee5c 0x7821 # CJK UNIFIED IDEOGRAPH-7821
0xee5d 0x784e # CJK UNIFIED IDEOGRAPH-784E
0xee5e 0x7864 # CJK UNIFIED IDEOGRAPH-7864
0xee5f 0x787a # CJK UNIFIED IDEOGRAPH-787A
0xee60 0x7930 # CJK UNIFIED IDEOGRAPH-7930
0xee61 0xfa18 # CJK COMPATIBILITY IDEOGRAPH-FA18
0xee62 0xfa19 # CJK COMPATIBILITY IDEOGRAPH-FA19
0xee63 0xfa1a # CJK COMPATIBILITY IDEOGRAPH-FA1A
0xee64 0x7994 # CJK UNIFIED IDEOGRAPH-7994
0xee65 0xfa1b # CJK COMPATIBILITY IDEOGRAPH-FA1B
0xee66 0x799b # CJK UNIFIED IDEOGRAPH-799B
0xee67 0x7ad1 # CJK UNIFIED IDEOGRAPH-7AD1
0xee68 0x7ae7 # CJK UNIFIED IDEOGRAPH-7AE7
0xee69 0xfa1c # CJK COMPATIBILITY IDEOGRAPH-FA1C
0xee6a 0x7aeb # CJK UNIFIED IDEOGRAPH-7AEB
0xee6b 0x7b9e # CJK UNIFIED IDEOGRAPH-7B9E
0xee6c 0xfa1d # CJK COMPATIBILITY IDEOGRAPH-FA1D
0xee6d 0x7d48 # CJK UNIFIED IDEOGRAPH-7D48
0xee6e 0x7d5c # CJK UNIFIED IDEOGRAPH-7D5C
0xee6f 0x7db7 # CJK UNIFIED IDEOGRAPH-7DB7
0xee70 0x7da0 # CJK UNIFIED IDEOGRAPH-7DA0
0xee71 0x7dd6 # CJK UNIFIED IDEOGRAPH-7DD6
0xee72 0x7e52 # CJK UNIFIED IDEOGRAPH-7E52
0xee73 0x7f47 # CJK UNIFIED IDEOGRAPH-7F47
0xee74 0x7fa1 # CJK UNIFIED IDEOGRAPH-7FA1
0xee75 0xfa1e # CJK COMPATIBILITY IDEOGRAPH-FA1E
0xee76 0x8301 # CJK UNIFIED IDEOGRAPH-8301
0xee77 0x8362 # CJK UNIFIED IDEOGRAPH-8362
0xee78 0x837f # CJK UNIFIED IDEOGRAPH-837F
0xee79 0x83c7 # CJK UNIFIED IDEOGRAPH-83C7
0xee7a 0x83f6 # CJK UNIFIED IDEOGRAPH-83F6
0xee7b 0x8448 # CJK UNIFIED IDEOGRAPH-8448
0xee7c 0x84b4 # CJK UNIFIED IDEOGRAPH-84B4
0xee7d 0x8553 # CJK UNIFIED IDEOGRAPH-8553
0xee7e 0x8559 # CJK UNIFIED IDEOGRAPH-8559
0xee80 0x856b # CJK UNIFIED IDEOGRAPH-856B
0xee81 0xfa1f # CJK COMPATIBILITY IDEOGRAPH-FA1F
0xee82 0x85b0 # CJK UNIFIED IDEOGRAPH-85B0
0xee83 0xfa20 # CJK COMPATIBILITY IDEOGRAPH-FA20
0xee84 0xfa21 # CJK COMPATIBILITY IDEOGRAPH-FA21
0xee85 0x8807 # CJK UNIFIED IDEOGRAPH-8807
0xee86 0x88f5 # CJK UNIFIED IDEOGRAPH-88F5
0xee87 0x8a12 # CJK UNIFIED IDEOGRAPH-8A12
0xee88 0x8a37 # CJK UNIFIED IDEOGRAPH-8A37
0xee89 0x8a79 # CJK UNIFIED IDEOGRAPH-8A79
0xee8a 0x8aa7 # CJK UNIFIED IDEOGRAPH-8AA7
0xee8b 0x8abe # CJK UNIFIED IDEOGRAPH-8ABE
0xee8c 0x8adf # CJK UNIFIED IDEOGRAPH-8ADF
0xee8d 0xfa22 # CJK COMPATIBILITY IDEOGRAPH-FA22
0xee8e 0x8af6 # CJK UNIFIED IDEOGRAPH-8AF6
0xee8f 0x8b53 # CJK UNIFIED IDEOGRAPH-8B53
0xee90 0x8b7f # CJK UNIFIED IDEOGRAPH-8B7F
0xee91 0x8cf0 # CJK UNIFIED IDEOGRAPH-8CF0
0xee92 0x8cf4 # CJK UNIFIED IDEOGRAPH-8CF4
0xee93 0x8d12 # CJK UNIFIED IDEOGRAPH-8D12
0xee94 0x8d76 # CJK UNIFIED IDEOGRAPH-8D76
0xee95 0xfa23 # CJK COMPATIBILITY IDEOGRAPH-FA23
0xee96 0x8ecf # CJK UNIFIED IDEOGRAPH-8ECF
0xee97 0xfa24 # CJK COMPATIBILITY IDEOGRAPH-FA24
0xee98 0xfa25 # CJK COMPATIBILITY IDEOGRAPH-FA25
0xee99 0x9067 # CJK UNIFIED IDEOGRAPH-9067
0xee9a 0x90de # CJK UNIFIED IDEOGRAPH-90DE
0xee9b 0xfa26 # CJK COMPATIBILITY IDEOGRAPH-FA26
0xee9c 0x9115 # CJK UNIFIED IDEOGRAPH-9115
0xee9d 0x9127 # CJK UNIFIED IDEOGRAPH-9127
0xee9e 0x91da # CJK UNIFIED IDEOGRAPH-91DA
0xee9f 0x91d7 # CJK UNIFIED IDEOGRAPH-91D7
0xeea0 0x91de # CJK UNIFIED IDEOGRAPH-91DE
0xeea1 0x91ed # CJK UNIFIED IDEOGRAPH-91ED
0xeea2 0x91ee # CJK UNIFIED IDEOGRAPH-91EE
0xeea3 0x91e4 # CJK UNIFIED IDEOGRAPH-91E4
0xeea4 0x91e5 # CJK UNIFIED IDEOGRAPH-91E5
0xeea5 0x9206 # CJK UNIFIED IDEOGRAPH-9206
0xeea6 0x9210 # CJK UNIFIED IDEOGRAPH-9210
0xeea7 0x920a # CJK UNIFIED IDEOGRAPH-920A
0xeea8 0x923a # CJK UNIFIED IDEOGRAPH-923A
0xeea9 0x9240 # CJK UNIFIED IDEOGRAPH-9240
0xeeaa 0x923c # CJK UNIFIED IDEOGRAPH-923C
0xeeab 0x924e # CJK UNIFIED IDEOGRAPH-924E
0xeeac 0x9259 # CJK UNIFIED IDEOGRAPH-9259
0xeead 0x9251 # CJK UNIFIED IDEOGRAPH-9251
0xeeae 0x9239 # CJK UNIFIED IDEOGRAPH-9239
0xeeaf 0x9267 # CJK UNIFIED IDEOGRAPH-9267
0xeeb0 0x92a7 # CJK UNIFIED IDEOGRAPH-92A7
0xeeb1 0x9277 # CJK UNIFIED IDEOGRAPH-9277
0xeeb2 0x9278 # CJK UNIFIED IDEOGRAPH-9278
0xeeb3 0x92e7 # CJK UNIFIED IDEOGRAPH-92E7
0xeeb4 0x92d7 # CJK UNIFIED IDEOGRAPH-92D7
0xeeb5 0x92d9 # CJK UNIFIED IDEOGRAPH-92D9
0xeeb6 0x92d0 # CJK UNIFIED IDEOGRAPH-92D0
0xeeb7 0xfa27 # CJK COMPATIBILITY IDEOGRAPH-FA27
0xeeb8 0x92d5 # CJK UNIFIED IDEOGRAPH-92D5
0xeeb9 0x92e0 # CJK UNIFIED IDEOGRAPH-92E0
0xeeba 0x92d3 # CJK UNIFIED IDEOGRAPH-92D3
0xeebb 0x9325 # CJK UNIFIED IDEOGRAPH-9325
0xeebc 0x9321 # CJK UNIFIED IDEOGRAPH-9321
0xeebd 0x92fb # CJK UNIFIED IDEOGRAPH-92FB
0xeebe 0xfa28 # CJK COMPATIBILITY IDEOGRAPH-FA28
0xeebf 0x931e # CJK UNIFIED IDEOGRAPH-931E
0xeec0 0x92ff # CJK UNIFIED IDEOGRAPH-92FF
0xeec1 0x931d # CJK UNIFIED IDEOGRAPH-931D
0xeec2 0x9302 # CJK UNIFIED IDEOGRAPH-9302
0xeec3 0x9370 # CJK UNIFIED IDEOGRAPH-9370
0xeec4 0x9357 # CJK UNIFIED IDEOGRAPH-9357
0xeec5 0x93a4 # CJK UNIFIED IDEOGRAPH-93A4
0xeec6 0x93c6 # CJK UNIFIED IDEOGRAPH-93C6
0xeec7 0x93de # CJK UNIFIED IDEOGRAPH-93DE
0xeec8 0x93f8 # CJK UNIFIED IDEOGRAPH-93F8
0xeec9 0x9431 # CJK UNIFIED IDEOGRAPH-9431
0xeeca 0x9445 # CJK UNIFIED IDEOGRAPH-9445
0xeecb 0x9448 # CJK UNIFIED IDEOGRAPH-9448
0xeecc 0x9592 # CJK UNIFIED IDEOGRAPH-9592
0xeecd 0xf9dc # CJK COMPATIBILITY IDEOGRAPH-F9DC
0xeece 0xfa29 # CJK COMPATIBILITY IDEOGRAPH-FA29
0xeecf 0x969d # CJK UNIFIED IDEOGRAPH-969D
0xeed0 0x96af # CJK UNIFIED IDEOGRAPH-96AF
0xeed1 0x9733 # CJK UNIFIED IDEOGRAPH-9733
0xeed2 0x973b # CJK UNIFIED IDEOGRAPH-973B
0xeed3 0x9743 # CJK UNIFIED IDEOGRAPH-9743
0xeed4 0x974d # CJK UNIFIED IDEOGRAPH-974D
0xeed5 0x974f # CJK UNIFIED IDEOGRAPH-974F
0xeed6 0x9751 # CJK UNIFIED IDEOGRAPH-9751
0xeed7 0x9755 # CJK UNIFIED IDEOGRAPH-9755
0xeed8 0x9857 # CJK UNIFIED IDEOGRAPH-9857
0xeed9 0x9865 # CJK UNIFIED IDEOGRAPH-9865
0xeeda 0xfa2a # CJK COMPATIBILITY IDEOGRAPH-FA2A
0xeedb 0xfa2b # CJK COMPATIBILITY IDEOGRAPH-FA2B
0xeedc 0x9927 # CJK UNIFIED IDEOGRAPH-9927
0xeedd 0xfa2c # CJK COMPATIBILITY IDEOGRAPH-FA2C
0xeede 0x999e # CJK UNIFIED IDEOGRAPH-999E
0xeedf 0x9a4e # CJK UNIFIED IDEOGRAPH-9A4E
0xeee0 0x9ad9 # CJK UNIFIED IDEOGRAPH-9AD9
0xeee1 0x9adc # CJK UNIFIED IDEOGRAPH-9ADC
0xeee2 0x9b75 # CJK UNIFIED IDEOGRAPH-9B75
0xeee3 0x9b72 # CJK UNIFIED IDEOGRAPH-9B72
0xeee4 0x9b8f # CJK UNIFIED IDEOGRAPH-9B8F
0xeee5 0x9bb1 # CJK UNIFIED IDEOGRAPH-9BB1
0xeee6 0x9bbb # CJK UNIFIED IDEOGRAPH-9BBB
0xeee7 0x9c00 # CJK UNIFIED IDEOGRAPH-9C00
0xeee8 0x9d70 # CJK UNIFIED IDEOGRAPH-9D70
0xeee9 0x9d6b # CJK UNIFIED IDEOGRAPH-9D6B
0xeeea 0xfa2d # CJK COMPATIBILITY IDEOGRAPH-FA2D
0xeeeb 0x9e19 # CJK UNIFIED IDEOGRAPH-9E19
0xeeec 0x9ed1 # CJK UNIFIED IDEOGRAPH-9ED1
0xeeef 0x2170 # SMALL ROMAN NUMERAL ONE
0xeef0 0x2171 # SMALL ROMAN NUMERAL TWO
0xeef1 0x2172 # SMALL ROMAN NUMERAL THREE
0xeef2 0x2173 # SMALL ROMAN NUMERAL FOUR
0xeef3 0x2174 # SMALL ROMAN NUMERAL FIVE
0xeef4 0x2175 # SMALL ROMAN NUMERAL SIX
0xeef5 0x2176 # SMALL ROMAN NUMERAL SEVEN
0xeef6 0x2177 # SMALL ROMAN NUMERAL EIGHT
0xeef7 0x2178 # SMALL ROMAN NUMERAL NINE
0xeef8 0x2179 # SMALL ROMAN NUMERAL TEN
0xeef9 0xffe2 # FULLWIDTH NOT SIGN
0xeefa 0xffe4 # FULLWIDTH BROKEN BAR
0xeefb 0xff07 # FULLWIDTH APOSTROPHE
0xeefc 0xff02 # FULLWIDTH QUOTATION MARK
0xfa4a 0x2160 # ROMAN NUMERAL ONE
0xfa4b 0x2161 # ROMAN NUMERAL TWO
0xfa4c 0x2162 # ROMAN NUMERAL THREE
0xfa4d 0x2163 # ROMAN NUMERAL FOUR
0xfa4e 0x2164 # ROMAN NUMERAL FIVE
0xfa4f 0x2165 # ROMAN NUMERAL SIX
0xfa50 0x2166 # ROMAN NUMERAL SEVEN
0xfa51 0x2167 # ROMAN NUMERAL EIGHT
0xfa52 0x2168 # ROMAN NUMERAL NINE
0xfa53 0x2169 # ROMAN NUMERAL TEN
0xfa54 0xffe2 # FULLWIDTH NOT SIGN
0xfa58 0x3231 # PARENTHESIZED IDEOGRAPH STOCK
0xfa59 0x2116 # NUMERO SIGN
0xfa5a 0x2121 # TELEPHONE SIGN
0xfa5b 0x2235 # BECAUSE
此差异已折叠。
此差异已折叠。
此差异已折叠。
#
# copy/paste of MS950.b2c-irreversible
#
# removed the entries of MS950.c2b-irreversible etries, this .nr
# table only includes "b->c only" entries
# (we don't need a MS950.c2b, the entries of MS950.c2b-irreversible
# are added in MS950.b2c already)
#
0xF9FA 0x256D
0xF9FB 0x256E
0xF9FC 0x2570
0xF9FD 0x256F
0xA2CC 0x5341
0xA2CE 0x5345
0xF9F9 0x2550
0xF9E9 0x255E
0xF9EA 0x256A
0xF9EB 0x2561
# #
#clzName csName hisName dbtype pkg ascii b1min b1max b2min b2max #clzName csName hisName dbtype pkg ascii b1min b1max b2min b2max
# #
Johab x-Johab x-Johab basic sun.nio.cs.ext true 0x84 0xf9 0x31 0xfe
EUC_CN GB2312 EUC_CN basic sun.nio.cs.ext true 0xa1 0xf7 0xa1 0xfe
EUC_KR EUC-KR EUC_KR basic sun.nio.cs.ext true 0xa1 0xfd 0xa1 0xfe
MS932 windows-31j MS932 basic sun.nio.cs.ext true 0x81 0xfc 0x40 0xfc
MS936 x-mswin-936 MS936 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
MS949 x-windows-949 MS949 basic sun.nio.cs.ext true 0x81 0xfe 0x41 0xfe
MS950 x-windows-950 MS950 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
GBK GBK GBK basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
IBM1381 x-IBM1381 Cp1381 basic sun.nio.cs.ext true 0x8c 0xf7 0xa1 0xfe IBM1381 x-IBM1381 Cp1381 basic sun.nio.cs.ext true 0x8c 0xf7 0xa1 0xfe
IBM1383 x-IBM1383 Cp1383 euc_sim sun.nio.cs.ext true 0xa1 0xfe 0xa1 0xfe IBM1383 x-IBM1383 Cp1383 euc_sim sun.nio.cs.ext true 0xa1 0xfe 0xa1 0xfe
IBM930 x-IBM930 Cp930 ebcdic sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe IBM930 x-IBM930 Cp930 ebcdic sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
......
...@@ -35,7 +35,7 @@ import static build.tools.charsetmapping.CharsetMapping.*; ...@@ -35,7 +35,7 @@ import static build.tools.charsetmapping.CharsetMapping.*;
public class GenerateDBCS { public class GenerateDBCS {
// pattern used by this class to read in mapping table // pattern used by this class to read in mapping table
static Pattern mPattern = Pattern.compile("(\\p{XDigit}++)\\s++(\\p{XDigit}++)(\\s++#.*)?"); static Pattern mPattern = Pattern.compile("(?:0x)?(\\p{XDigit}++)\\s++(?:0x)?(\\p{XDigit}++)(?:\\s++#.*)?");
public static void genDBCS(String args[]) throws Exception { public static void genDBCS(String args[]) throws Exception {
Scanner s = new Scanner(new File(args[0], args[2])); Scanner s = new Scanner(new File(args[0], args[2]));
...@@ -260,10 +260,12 @@ public class GenerateDBCS { ...@@ -260,10 +260,12 @@ public class GenerateDBCS {
"StandardCharsets.aliases_" + clzName : "StandardCharsets.aliases_" + clzName :
"ExtendedCharsets.aliasesFor(\"" + csName + "\")") "ExtendedCharsets.aliasesFor(\"" + csName + "\")")
.replace("$NAME_CS$" , csName) .replace("$NAME_CS$" , csName)
.replace("$CONTAINS$", isASCII ? .replace("$CONTAINS$",
" return ((cs.name().equals(\"US-ASCII\")) || (cs instanceof " "MS932".equals(clzName)?
+ clzName + "));": "return ((cs.name().equals(\"US-ASCII\")) || (cs instanceof JIS_X_0201) || (cs instanceof " + clzName + "));":
" return (cs instanceof " + clzName + ");") (isASCII ?
"return ((cs.name().equals(\"US-ASCII\")) || (cs instanceof " + clzName + "));":
"return (cs instanceof " + clzName + ");"))
.replace("$HISTORICALNAME$", .replace("$HISTORICALNAME$",
(hisName == null)? "" : (hisName == null)? "" :
" public String historicalName() { return \"" + hisName + "\"; }") " public String historicalName() { return \"" + hisName + "\"; }")
......
...@@ -683,10 +683,16 @@ static void ...@@ -683,10 +683,16 @@ static void
SetClassPath(const char *s) SetClassPath(const char *s)
{ {
char *def; char *def;
const char *orig = s;
static const char format[] = "-Djava.class.path=%s";
s = JLI_WildcardExpandClasspath(s); s = JLI_WildcardExpandClasspath(s);
def = JLI_MemAlloc(JLI_StrLen(s) + 40); def = JLI_MemAlloc(sizeof(format)
sprintf(def, "-Djava.class.path=%s", s); - 2 /* strlen("%s") */
+ JLI_StrLen(s));
sprintf(def, format, s);
AddOption(def, NULL); AddOption(def, NULL);
if (s != orig)
JLI_MemFree((char *) s);
} }
/* /*
......
...@@ -1101,7 +1101,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> { ...@@ -1101,7 +1101,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
// See "Hacker's Delight" section 2-12 for explanation of // See "Hacker's Delight" section 2-12 for explanation of
// the overflow test. // the overflow test.
if ( (((sum ^ xs) & (sum ^ ys))) >= 0L) // not overflowed if ( (((sum ^ xs) & (sum ^ ys))) >= 0L) // not overflowed
return new BigDecimal(null, sum, rscale, 0); return BigDecimal.valueOf(sum, rscale);
} }
if (fst == null) if (fst == null)
fst = BigInteger.valueOf(xs); fst = BigInteger.valueOf(xs);
...@@ -1311,9 +1311,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> { ...@@ -1311,9 +1311,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
* would occur since division is expensive on most CPUs. * would occur since division is expensive on most CPUs.
*/ */
long product = x * y; long product = x * y;
int prec = this.precision() + multiplicand.precision(); long prec = this.precision() + multiplicand.precision();
if (prec < 19 || (prec < 21 && (y == 0 || product / y == x))) if (prec < 19 || (prec < 21 && (y == 0 || product / y == x)))
return new BigDecimal(null, product, productScale, 0); return BigDecimal.valueOf(product, productScale);
return new BigDecimal(BigInteger.valueOf(x).multiply(y), INFLATED, return new BigDecimal(BigInteger.valueOf(x).multiply(y), INFLATED,
productScale, 0); productScale, 0);
} }
...@@ -1584,7 +1584,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> { ...@@ -1584,7 +1584,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
return (preferredScale >= 0 && return (preferredScale >= 0 &&
preferredScale < ZERO_SCALED_BY.length) ? preferredScale < ZERO_SCALED_BY.length) ?
ZERO_SCALED_BY[preferredScale] : ZERO_SCALED_BY[preferredScale] :
new BigDecimal(null, 0, preferredScale, 1); BigDecimal.valueOf(0, preferredScale);
else { else {
this.inflate(); this.inflate();
divisor.inflate(); divisor.inflate();
......
...@@ -29,7 +29,6 @@ import java.io.OutputStream; ...@@ -29,7 +29,6 @@ import java.io.OutputStream;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
import java.security.AccessController; import java.security.AccessController;
import java.security.PrivilegedExceptionAction; import java.security.PrivilegedExceptionAction;
import java.util.prefs.Preferences;
import sun.net.www.ParseUtil; import sun.net.www.ParseUtil;
/* import org.ietf.jgss.*; */ /* import org.ietf.jgss.*; */
...@@ -41,7 +40,7 @@ import sun.net.www.ParseUtil; ...@@ -41,7 +40,7 @@ import sun.net.www.ParseUtil;
class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
private String server = null; private String server = null;
private int port = DEFAULT_PORT; private int serverPort = DEFAULT_PORT;
private InetSocketAddress external_address; private InetSocketAddress external_address;
private boolean useV4 = false; private boolean useV4 = false;
private Socket cmdsock = null; private Socket cmdsock = null;
...@@ -54,7 +53,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -54,7 +53,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
SocksSocketImpl(String server, int port) { SocksSocketImpl(String server, int port) {
this.server = server; this.server = server;
this.port = (port == -1 ? DEFAULT_PORT : port); this.serverPort = (port == -1 ? DEFAULT_PORT : port);
} }
SocksSocketImpl(Proxy proxy) { SocksSocketImpl(Proxy proxy) {
...@@ -63,7 +62,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -63,7 +62,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
InetSocketAddress ad = (InetSocketAddress) a; InetSocketAddress ad = (InetSocketAddress) a;
// Use getHostString() to avoid reverse lookups // Use getHostString() to avoid reverse lookups
server = ad.getHostString(); server = ad.getHostString();
port = ad.getPort(); serverPort = ad.getPort();
} }
} }
...@@ -113,16 +112,12 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -113,16 +112,12 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
*/ */
private boolean authenticate(byte method, InputStream in, private boolean authenticate(byte method, InputStream in,
BufferedOutputStream out) throws IOException { BufferedOutputStream out) throws IOException {
byte[] data = null;
int i;
// No Authentication required. We're done then! // No Authentication required. We're done then!
if (method == NO_AUTH) if (method == NO_AUTH)
return true; return true;
/** /**
* User/Password authentication. Try, in that order : * User/Password authentication. Try, in that order :
* - The application provided Authenticator, if any * - The application provided Authenticator, if any
* - The user preferences java.net.socks.username &
* java.net.socks.password
* - the user.name & no password (backward compatibility behavior). * - the user.name & no password (backward compatibility behavior).
*/ */
if (method == USER_PASSW) { if (method == USER_PASSW) {
...@@ -134,40 +129,15 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -134,40 +129,15 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
new java.security.PrivilegedAction<PasswordAuthentication>() { new java.security.PrivilegedAction<PasswordAuthentication>() {
public PasswordAuthentication run() { public PasswordAuthentication run() {
return Authenticator.requestPasswordAuthentication( return Authenticator.requestPasswordAuthentication(
server, addr, port, "SOCKS5", "SOCKS authentication", null); server, addr, serverPort, "SOCKS5", "SOCKS authentication", null);
} }
}); });
if (pw != null) { if (pw != null) {
userName = pw.getUserName(); userName = pw.getUserName();
password = new String(pw.getPassword()); password = new String(pw.getPassword());
} else { } else {
final Preferences prefs = Preferences.userRoot().node("/java/net/socks"); userName = java.security.AccessController.doPrivileged(
try {
userName = AccessController.doPrivileged(
new java.security.PrivilegedExceptionAction<String>() {
public String run() throws IOException {
return prefs.get("username", null);
}
});
} catch (java.security.PrivilegedActionException pae) {
throw (IOException) pae.getException();
}
if (userName != null) {
try {
password = AccessController.doPrivileged(
new java.security.PrivilegedExceptionAction<String>() {
public String run() throws IOException {
return prefs.get("password", null);
}
});
} catch (java.security.PrivilegedActionException pae) {
throw (IOException) pae.getException();
}
} else {
userName = java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("user.name")); new sun.security.action.GetPropertyAction("user.name"));
}
} }
if (userName == null) if (userName == null)
return false; return false;
...@@ -188,8 +158,8 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -188,8 +158,8 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
} else } else
out.write(0); out.write(0);
out.flush(); out.flush();
data = new byte[2]; byte[] data = new byte[2];
i = readSocksReply(in, data); int i = readSocksReply(in, data);
if (i != 2 || data[1] != 0) { if (i != 2 || data[1] != 0) {
/* RFC 1929 specifies that the connection MUST be closed if /* RFC 1929 specifies that the connection MUST be closed if
authentication fails */ authentication fails */
...@@ -322,6 +292,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -322,6 +292,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
* @throws IllegalArgumentException if endpoint is null or a * @throws IllegalArgumentException if endpoint is null or a
* SocketAddress subclass not supported by this socket * SocketAddress subclass not supported by this socket
*/ */
@Override
protected void connect(SocketAddress endpoint, int timeout) throws IOException { protected void connect(SocketAddress endpoint, int timeout) throws IOException {
SecurityManager security = System.getSecurityManager(); SecurityManager security = System.getSecurityManager();
if (endpoint == null || !(endpoint instanceof InetSocketAddress)) if (endpoint == null || !(endpoint instanceof InetSocketAddress))
...@@ -352,7 +323,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -352,7 +323,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
super.connect(epoint, timeout); super.connect(epoint, timeout);
return; return;
} }
URI uri = null; URI uri;
// Use getHostString() to avoid reverse lookups // Use getHostString() to avoid reverse lookups
String host = epoint.getHostString(); String host = epoint.getHostString();
// IPv6 litteral? // IPv6 litteral?
...@@ -365,6 +336,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -365,6 +336,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
// This shouldn't happen // This shouldn't happen
assert false : e; assert false : e;
uri = null;
} }
Proxy p = null; Proxy p = null;
IOException savedExc = null; IOException savedExc = null;
...@@ -386,18 +358,18 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -386,18 +358,18 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
throw new SocketException("Unknow address type for proxy: " + p); throw new SocketException("Unknow address type for proxy: " + p);
// Use getHostString() to avoid reverse lookups // Use getHostString() to avoid reverse lookups
server = ((InetSocketAddress) p.address()).getHostString(); server = ((InetSocketAddress) p.address()).getHostString();
port = ((InetSocketAddress) p.address()).getPort(); serverPort = ((InetSocketAddress) p.address()).getPort();
// Connects to the SOCKS server // Connects to the SOCKS server
try { try {
privilegedConnect(server, port, timeout); privilegedConnect(server, serverPort, timeout);
// Worked, let's get outta here // Worked, let's get outta here
break; break;
} catch (IOException e) { } catch (IOException e) {
// Ooops, let's notify the ProxySelector // Ooops, let's notify the ProxySelector
sel.connectFailed(uri,p.address(),e); sel.connectFailed(uri,p.address(),e);
server = null; server = null;
port = -1; serverPort = -1;
savedExc = e; savedExc = e;
// Will continue the while loop and try the next proxy // Will continue the while loop and try the next proxy
} }
...@@ -414,7 +386,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -414,7 +386,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
} else { } else {
// Connects to the SOCKS server // Connects to the SOCKS server
try { try {
privilegedConnect(server, port, timeout); privilegedConnect(server, serverPort, timeout);
} catch (IOException e) { } catch (IOException e) {
throw new SocketException(e.getMessage()); throw new SocketException(e.getMessage());
} }
...@@ -487,7 +459,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -487,7 +459,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
if (i != 4) if (i != 4)
throw new SocketException("Reply from SOCKS server has bad length"); throw new SocketException("Reply from SOCKS server has bad length");
SocketException ex = null; SocketException ex = null;
int nport, len; int len;
byte[] addr; byte[] addr;
switch (data[1]) { switch (data[1]) {
case REQUEST_OK: case REQUEST_OK:
...@@ -502,8 +474,6 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -502,8 +474,6 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
i = readSocksReply(in, data); i = readSocksReply(in, data);
if (i != 2) if (i != 2)
throw new SocketException("Reply from SOCKS server badly formatted"); throw new SocketException("Reply from SOCKS server badly formatted");
nport = ((int)data[0] & 0xff) << 8;
nport += ((int)data[1] & 0xff);
break; break;
case DOMAIN_NAME: case DOMAIN_NAME:
len = data[1]; len = data[1];
...@@ -515,8 +485,6 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -515,8 +485,6 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
i = readSocksReply(in, data); i = readSocksReply(in, data);
if (i != 2) if (i != 2)
throw new SocketException("Reply from SOCKS server badly formatted"); throw new SocketException("Reply from SOCKS server badly formatted");
nport = ((int)data[0] & 0xff) << 8;
nport += ((int)data[1] & 0xff);
break; break;
case IPV6: case IPV6:
len = data[1]; len = data[1];
...@@ -528,8 +496,6 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -528,8 +496,6 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
i = readSocksReply(in, data); i = readSocksReply(in, data);
if (i != 2) if (i != 2)
throw new SocketException("Reply from SOCKS server badly formatted"); throw new SocketException("Reply from SOCKS server badly formatted");
nport = ((int)data[0] & 0xff) << 8;
nport += ((int)data[1] & 0xff);
break; break;
default: default:
ex = new SocketException("Reply from SOCKS server contains wrong code"); ex = new SocketException("Reply from SOCKS server contains wrong code");
...@@ -663,7 +629,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -663,7 +629,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
*/ */
return; return;
} }
URI uri = null; URI uri;
// Use getHostString() to avoid reverse lookups // Use getHostString() to avoid reverse lookups
String host = saddr.getHostString(); String host = saddr.getHostString();
// IPv6 litteral? // IPv6 litteral?
...@@ -676,6 +642,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -676,6 +642,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
// This shouldn't happen // This shouldn't happen
assert false : e; assert false : e;
uri = null;
} }
Proxy p = null; Proxy p = null;
Exception savedExc = null; Exception savedExc = null;
...@@ -695,7 +662,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -695,7 +662,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
throw new SocketException("Unknow address type for proxy: " + p); throw new SocketException("Unknow address type for proxy: " + p);
// Use getHostString() to avoid reverse lookups // Use getHostString() to avoid reverse lookups
server = ((InetSocketAddress) p.address()).getHostString(); server = ((InetSocketAddress) p.address()).getHostString();
port = ((InetSocketAddress) p.address()).getPort(); serverPort = ((InetSocketAddress) p.address()).getPort();
// Connects to the SOCKS server // Connects to the SOCKS server
try { try {
...@@ -703,7 +670,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -703,7 +670,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
new PrivilegedExceptionAction<Void>() { new PrivilegedExceptionAction<Void>() {
public Void run() throws Exception { public Void run() throws Exception {
cmdsock = new Socket(new PlainSocketImpl()); cmdsock = new Socket(new PlainSocketImpl());
cmdsock.connect(new InetSocketAddress(server, port)); cmdsock.connect(new InetSocketAddress(server, serverPort));
cmdIn = cmdsock.getInputStream(); cmdIn = cmdsock.getInputStream();
cmdOut = cmdsock.getOutputStream(); cmdOut = cmdsock.getOutputStream();
return null; return null;
...@@ -713,7 +680,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -713,7 +680,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
// Ooops, let's notify the ProxySelector // Ooops, let's notify the ProxySelector
sel.connectFailed(uri,p.address(),new SocketException(e.getMessage())); sel.connectFailed(uri,p.address(),new SocketException(e.getMessage()));
server = null; server = null;
port = -1; serverPort = -1;
cmdsock = null; cmdsock = null;
savedExc = e; savedExc = e;
// Will continue the while loop and try the next proxy // Will continue the while loop and try the next proxy
...@@ -734,7 +701,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -734,7 +701,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
new PrivilegedExceptionAction<Void>() { new PrivilegedExceptionAction<Void>() {
public Void run() throws Exception { public Void run() throws Exception {
cmdsock = new Socket(new PlainSocketImpl()); cmdsock = new Socket(new PlainSocketImpl());
cmdsock.connect(new InetSocketAddress(server, port)); cmdsock.connect(new InetSocketAddress(server, serverPort));
cmdIn = cmdsock.getInputStream(); cmdIn = cmdsock.getInputStream();
cmdOut = cmdsock.getOutputStream(); cmdOut = cmdsock.getOutputStream();
return null; return null;
...@@ -809,7 +776,6 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -809,7 +776,6 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
switch (data[1]) { switch (data[1]) {
case REQUEST_OK: case REQUEST_OK:
// success! // success!
InetSocketAddress real_end = null;
switch(data[3]) { switch(data[3]) {
case IPV4: case IPV4:
addr = new byte[4]; addr = new byte[4];
...@@ -1016,6 +982,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -1016,6 +982,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
* @return the value of this socket's <code>address</code> field. * @return the value of this socket's <code>address</code> field.
* @see java.net.SocketImpl#address * @see java.net.SocketImpl#address
*/ */
@Override
protected InetAddress getInetAddress() { protected InetAddress getInetAddress() {
if (external_address != null) if (external_address != null)
return external_address.getAddress(); return external_address.getAddress();
...@@ -1029,6 +996,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -1029,6 +996,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
* @return the value of this socket's <code>port</code> field. * @return the value of this socket's <code>port</code> field.
* @see java.net.SocketImpl#port * @see java.net.SocketImpl#port
*/ */
@Override
protected int getPort() { protected int getPort() {
if (external_address != null) if (external_address != null)
return external_address.getPort(); return external_address.getPort();
...@@ -1036,6 +1004,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -1036,6 +1004,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
return super.getPort(); return super.getPort();
} }
@Override
protected int getLocalPort() { protected int getLocalPort() {
if (socket != null) if (socket != null)
return super.getLocalPort(); return super.getLocalPort();
...@@ -1045,6 +1014,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -1045,6 +1014,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
return super.getLocalPort(); return super.getLocalPort();
} }
@Override
protected void close() throws IOException { protected void close() throws IOException {
if (cmdsock != null) if (cmdsock != null)
cmdsock.close(); cmdsock.close();
......
...@@ -25,26 +25,18 @@ ...@@ -25,26 +25,18 @@
package sun.io; package sun.io;
import sun.nio.cs.ext.EUC_CN; import sun.nio.cs.ext.*;
/** public class ByteToCharEUC_CN extends ByteToCharDBCS_ASCII {
* Tables and data to convert EUC_CN to Unicode
*
* @author ConverterGenerator tool
*/
public class ByteToCharEUC_CN extends ByteToCharDoubleByte {
private EUC_CN nioCoder = new EUC_CN(); private static DoubleByte.Decoder dec =
(DoubleByte.Decoder)new EUC_CN().newDecoder();
public String getCharacterEncoding() { public String getCharacterEncoding() {
return "EUC_CN"; return "EUC_CN";
} }
public ByteToCharEUC_CN() { public ByteToCharEUC_CN() {
super.index1 = nioCoder.getDecoderIndex1(); super(dec);
super.index2 = nioCoder.getDecoderIndex2();
start = 0xA1;
end = 0xFE;
} }
} }
...@@ -26,26 +26,18 @@ ...@@ -26,26 +26,18 @@
package sun.io; package sun.io;
import sun.nio.cs.ext.EUC_KR; import sun.nio.cs.ext.*;
/** public class ByteToCharEUC_KR extends ByteToCharDBCS_ASCII {
* Tables and data to convert EUC_KR to Unicode
*
* @author ConverterGenerator tool
*/
public class ByteToCharEUC_KR extends ByteToCharDoubleByte {
private final static EUC_KR nioCoder = new EUC_KR(); private static DoubleByte.Decoder dec =
(DoubleByte.Decoder)new EUC_KR().newDecoder();
public String getCharacterEncoding() { public String getCharacterEncoding() {
return "EUC_KR"; return "EUC_KR";
} }
public ByteToCharEUC_KR() { public ByteToCharEUC_KR() {
super.index1 = nioCoder.getDecoderIndex1(); super(dec);
super.index2 = nioCoder.getDecoderIndex2();
start = 0xA1;
end = 0xFE;
} }
} }
...@@ -26,26 +26,18 @@ ...@@ -26,26 +26,18 @@
package sun.io; package sun.io;
import sun.nio.cs.ext.GBK; import sun.nio.cs.ext.*;
/** public class ByteToCharGBK extends ByteToCharDBCS_ASCII {
* Tables and data to convert GBK to Unicode
*
* @author ConverterGenerator tool
*/
public class ByteToCharGBK extends ByteToCharDoubleByte {
private final static GBK nioCoder = new GBK(); private static DoubleByte.Decoder dec =
(DoubleByte.Decoder)new GBK().newDecoder();
public String getCharacterEncoding() { public String getCharacterEncoding() {
return "GBK"; return "GBK";
} }
public ByteToCharGBK() { public ByteToCharGBK() {
super.index1 = nioCoder.getDecoderIndex1(); super(dec);
super.index2 = nioCoder.getDecoderIndex2();
start = 0x40;
end = 0xFE;
} }
} }
...@@ -26,26 +26,18 @@ ...@@ -26,26 +26,18 @@
package sun.io; package sun.io;
import sun.nio.cs.ext.Johab; import sun.nio.cs.ext.*;
/** public class ByteToCharJohab extends ByteToCharDBCS_ASCII {
* Tables and data to convert Johab to Unicode
*
* @author ConverterGenerator tool
*/
public class ByteToCharJohab extends ByteToCharDoubleByte {
private final static Johab nioCoder = new Johab(); private static DoubleByte.Decoder dec =
(DoubleByte.Decoder)new Johab().newDecoder();
public String getCharacterEncoding() { public String getCharacterEncoding() {
return "Johab"; return "Johab";
} }
public ByteToCharJohab() { public ByteToCharJohab() {
super.index1 = nioCoder.getDecoderIndex1(); super(dec);
super.index2 = nioCoder.getDecoderIndex2();
start = 0x20;
end = 0xFE;
} }
} }
...@@ -25,29 +25,19 @@ ...@@ -25,29 +25,19 @@
package sun.io; package sun.io;
/** import sun.nio.cs.ext.*;
* Tables and data to convert MS932 to Unicode
*
* @author Limin Shi
* @author Mark Son-Bell
*/
public class ByteToCharMS932 extends ByteToCharMS932DB { public class ByteToCharMS932 extends ByteToCharDBCS_ASCII {
ByteToCharJIS0201 bcJIS0201 = new ByteToCharJIS0201();
private static DoubleByte.Decoder dec =
(DoubleByte.Decoder)new MS932().newDecoder();
public String getCharacterEncoding() { public String getCharacterEncoding() {
return "MS932"; return "MS932";
} }
protected char convSingleByte(int b) { public ByteToCharMS932() {
// If the high bits are all off, it's ASCII == Unicode super(dec);
if ((b & 0xFF80) == 0) {
return (char)b;
}
return bcJIS0201.getUnicode(b);
} }
String prt(int i) {
return Integer.toString(i,16);
}
} }
...@@ -25,26 +25,18 @@ ...@@ -25,26 +25,18 @@
package sun.io; package sun.io;
import sun.nio.cs.ext.MS936; import sun.nio.cs.ext.*;
/** public class ByteToCharMS936 extends ByteToCharDBCS_ASCII {
* Tables and data to convert MS936 to Unicode
*
* @author ConverterGenerator tool
*/
public class ByteToCharMS936 extends ByteToCharDoubleByte {
private final static MS936 nioCoder = new MS936(); private static DoubleByte.Decoder dec =
(DoubleByte.Decoder)new MS936().newDecoder();
public String getCharacterEncoding() { public String getCharacterEncoding() {
return "MS936"; return "MS936";
} }
public ByteToCharMS936() { public ByteToCharMS936() {
super.index1 = nioCoder.getDecoderIndex1(); super(dec);
super.index2 = nioCoder.getDecoderIndex2();
start = 0x40;
end = 0xFE;
} }
} }
...@@ -26,25 +26,19 @@ ...@@ -26,25 +26,19 @@
package sun.io; package sun.io;
import sun.nio.cs.ext.MS949; import sun.nio.cs.ext.*;
/** public class ByteToCharMS949 extends ByteToCharDBCS_ASCII {
* Tables and data to convert MS949 to Unicode
* private static DoubleByte.Decoder dec =
* @author ConverterGenerator tool (DoubleByte.Decoder)new MS949().newDecoder();
*/
public class ByteToCharMS949 extends ByteToCharDoubleByte {
private static final MS949 nioCoder = new MS949();
public String getCharacterEncoding() { public String getCharacterEncoding() {
return "MS949"; return "MS949";
} }
public ByteToCharMS949() { public ByteToCharMS949() {
super.index1 = nioCoder.getDecoderIndex1(); super(dec);
super.index2 = nioCoder.getDecoderIndex2();
start = 0x41;
end = 0xFE;
} }
} }
...@@ -26,26 +26,18 @@ ...@@ -26,26 +26,18 @@
package sun.io; package sun.io;
import sun.nio.cs.ext.MS950; import sun.nio.cs.ext.*;
/** public class ByteToCharMS950 extends ByteToCharDBCS_ASCII {
* Tables and data to convert MS950 to Unicode
*
* @author ConverterGenerator tool
*/
public class ByteToCharMS950 extends ByteToCharDoubleByte {
private final static MS950 nioCoder = new MS950(); private static DoubleByte.Decoder dec =
(DoubleByte.Decoder)new MS950().newDecoder();
public String getCharacterEncoding() { public String getCharacterEncoding() {
return "MS950"; return "MS950";
} }
public ByteToCharMS950() { public ByteToCharMS950() {
super.index1 = nioCoder.getDecoderIndex1(); super(dec);
super.index2 = nioCoder.getDecoderIndex2();
start = 0x40;
end = 0xFE;
} }
} }
...@@ -34,6 +34,6 @@ public class ByteToCharMS950_HKSCS extends ByteToCharHKSCS { ...@@ -34,6 +34,6 @@ public class ByteToCharMS950_HKSCS extends ByteToCharHKSCS {
protected char getUnicode(int byte1, int byte2) { protected char getUnicode(int byte1, int byte2) {
char c = super.getUnicode(byte1, byte2); char c = super.getUnicode(byte1, byte2);
return (c != REPLACE_CHAR) ? c : bcMS950.getUnicode(byte1, byte2); return (c != REPLACE_CHAR) ? c : bcMS950.decodeDouble(byte1, byte2);
} }
} }
...@@ -25,24 +25,18 @@ ...@@ -25,24 +25,18 @@
package sun.io; package sun.io;
import sun.nio.cs.ext.EUC_CN; import sun.nio.cs.ext.*;
/** public class CharToByteEUC_CN extends CharToByteDBCS_ASCII {
* Tables and data to convert Unicode to EUC_CN
*
* @author ConverterGenerator tool
*/
public class CharToByteEUC_CN extends CharToByteDoubleByte {
private final static EUC_CN nioCoder = new EUC_CN(); private static DoubleByte.Encoder enc =
(DoubleByte.Encoder)new EUC_CN().newEncoder();
public String getCharacterEncoding() { public String getCharacterEncoding() {
return "EUC_CN"; return "EUC_CN";
} }
public CharToByteEUC_CN() { public CharToByteEUC_CN() {
super.index1 = nioCoder.getEncoderIndex1(); super(enc);
super.index2 = nioCoder.getEncoderIndex2();
} }
} }
...@@ -23,27 +23,20 @@ ...@@ -23,27 +23,20 @@
* have any questions. * have any questions.
*/ */
package sun.io; package sun.io;
import sun.nio.cs.ext.EUC_KR; import sun.nio.cs.ext.*;
/**
* Tables and data to convert Unicode to EUC_KR
*
* @author ConverterGenerator tool
*/
public class CharToByteEUC_KR extends CharToByteDoubleByte { public class CharToByteEUC_KR extends CharToByteDBCS_ASCII {
private final static EUC_KR nioCoder = new EUC_KR(); private static DoubleByte.Encoder enc =
(DoubleByte.Encoder)new EUC_KR().newEncoder();
public String getCharacterEncoding() { public String getCharacterEncoding() {
return "EUC_KR"; return "EUC_KR";
} }
public CharToByteEUC_KR() { public CharToByteEUC_KR() {
super.index1 = nioCoder.getEncoderIndex1(); super(enc);
super.index2 = nioCoder.getEncoderIndex2();
} }
} }
...@@ -26,24 +26,18 @@ ...@@ -26,24 +26,18 @@
package sun.io; package sun.io;
import sun.nio.cs.ext.GBK; import sun.nio.cs.ext.*;
/** public class CharToByteGBK extends CharToByteDBCS_ASCII {
* Tables and data to convert Unicode to GBK
*
* @author ConverterGenerator tool
*/
public class CharToByteGBK extends CharToByteDoubleByte {
private final static GBK nioCoder = new GBK(); private static DoubleByte.Encoder enc =
(DoubleByte.Encoder)new GBK().newEncoder();
public String getCharacterEncoding() { public String getCharacterEncoding() {
return "GBK"; return "GBK";
} }
public CharToByteGBK() { public CharToByteGBK() {
super.index1 = nioCoder.getEncoderIndex1(); super(enc);
super.index2 = nioCoder.getEncoderIndex2();
} }
} }
...@@ -26,24 +26,18 @@ ...@@ -26,24 +26,18 @@
package sun.io; package sun.io;
import sun.nio.cs.ext.Johab; import sun.nio.cs.ext.*;
/** public class CharToByteJohab extends CharToByteDBCS_ASCII {
* Tables and data to convert Unicode to Johab
*
* @author ConverterGenerator tool
*/
public class CharToByteJohab extends CharToByteDoubleByte {
private final static Johab nioCoder = new Johab(); private static DoubleByte.Encoder enc =
(DoubleByte.Encoder)new Johab().newEncoder();
public String getCharacterEncoding() { public String getCharacterEncoding() {
return "Johab"; return "Johab";
} }
public CharToByteJohab() { public CharToByteJohab() {
super.index1 = nioCoder.getEncoderIndex1(); super(enc);
super.index2 = nioCoder.getEncoderIndex2();
} }
} }
...@@ -25,32 +25,18 @@ ...@@ -25,32 +25,18 @@
package sun.io; package sun.io;
/** import sun.nio.cs.ext.*;
* Tables and data to convert Unicode to MS932
* public class CharToByteMS932 extends CharToByteDBCS_ASCII {
* @author ConverterGenerator tool
*/
public class CharToByteMS932 extends CharToByteMS932DB { private static DoubleByte.Encoder enc =
CharToByteJIS0201 cbJIS0201 = new CharToByteJIS0201(); (DoubleByte.Encoder)new MS932().newEncoder();
public String getCharacterEncoding() { public String getCharacterEncoding() {
return "MS932"; return "MS932";
} }
protected int convSingleByte(char inputChar, byte[] outputByte) { public CharToByteMS932() {
byte b; super(enc);
// \u0000 - \u007F map straight through
if ((inputChar &0xFF80) == 0) {
outputByte[0] = (byte)inputChar;
return 1;
}
if ((b = cbJIS0201.getNative(inputChar)) == 0)
return 0;
outputByte[0] = b;
return 1;
} }
} }
...@@ -25,24 +25,18 @@ ...@@ -25,24 +25,18 @@
package sun.io; package sun.io;
import sun.nio.cs.ext.MS936; import sun.nio.cs.ext.*;
/** public class CharToByteMS936 extends CharToByteDBCS_ASCII {
* Tables and data to convert Unicode to MS936
*
* @author ConverterGenerator tool
*/
public class CharToByteMS936 extends CharToByteDoubleByte {
private final static MS936 nioCoder = new MS936(); private static DoubleByte.Encoder enc =
(DoubleByte.Encoder)new MS936().newEncoder();
public String getCharacterEncoding() { public String getCharacterEncoding() {
return "MS936"; return "MS936";
} }
public CharToByteMS936() { public CharToByteMS936() {
super.index1 = nioCoder.getEncoderIndex1(); super(enc);
super.index2 = nioCoder.getEncoderIndex2();
} }
} }
...@@ -26,24 +26,18 @@ ...@@ -26,24 +26,18 @@
package sun.io; package sun.io;
import sun.nio.cs.ext.MS949; import sun.nio.cs.ext.*;
/** public class CharToByteMS949 extends CharToByteDBCS_ASCII {
* Tables and data to convert Unicode to MS949
*
* @author ConverterGenerator tool
*/
public class CharToByteMS949 extends CharToByteDoubleByte {
private final static MS949 nioCoder = new MS949(); private static DoubleByte.Encoder enc =
(DoubleByte.Encoder)new MS949().newEncoder();
public String getCharacterEncoding() { public String getCharacterEncoding() {
return "MS949"; return "MS949";
} }
public CharToByteMS949() { public CharToByteMS949() {
super.index1 = nioCoder.getEncoderIndex1(); super(enc);
super.index2 = nioCoder.getEncoderIndex2();
} }
} }
...@@ -26,24 +26,18 @@ ...@@ -26,24 +26,18 @@
package sun.io; package sun.io;
import sun.nio.cs.ext.MS950; import sun.nio.cs.ext.*;
/** public class CharToByteMS950 extends CharToByteDBCS_ASCII {
* Tables and data to convert Unicode to MS950
*
* @author ConverterGenerator tool
*/
public class CharToByteMS950 extends CharToByteDoubleByte {
private final static MS950 nioCoder = new MS950(); private static DoubleByte.Encoder enc =
(DoubleByte.Encoder)new MS950().newEncoder();
public String getCharacterEncoding() { public String getCharacterEncoding() {
return "MS950"; return "MS950";
} }
public CharToByteMS950() { public CharToByteMS950() {
super.index1 = nioCoder.getEncoderIndex1(); super(enc);
super.index2 = nioCoder.getEncoderIndex2();
} }
} }
...@@ -34,6 +34,6 @@ public class CharToByteMS950_HKSCS extends CharToByteHKSCS { ...@@ -34,6 +34,6 @@ public class CharToByteMS950_HKSCS extends CharToByteHKSCS {
protected int getNative(char ch) { protected int getNative(char ch) {
int r = super.getNative(ch); int r = super.getNative(ch);
return (r != 0) ? r : cbMS950.getNative(ch); return (r != 0) ? r : cbMS950.encodeChar(ch);
} }
} }
...@@ -142,7 +142,7 @@ class ISO_8859_1 ...@@ -142,7 +142,7 @@ class ISO_8859_1
} }
public boolean isLegalReplacement(byte[] repl) { public boolean isLegalReplacement(byte[] repl) {
return (repl.length == 1); // we accept any byte value return true; // we accept any byte value
} }
private final Surrogate.Parser sgp = new Surrogate.Parser(); private final Surrogate.Parser sgp = new Surrogate.Parser();
......
...@@ -160,7 +160,8 @@ public class US_ASCII ...@@ -160,7 +160,8 @@ public class US_ASCII
} }
public boolean isLegalReplacement(byte[] repl) { public boolean isLegalReplacement(byte[] repl) {
return (repl.length == 1 && repl[0] >= 0); return (repl.length == 1 && repl[0] >= 0) ||
super.isLegalReplacement(repl);
} }
private final Surrogate.Parser sgp = new Surrogate.Parser(); private final Surrogate.Parser sgp = new Surrogate.Parser();
......
...@@ -106,7 +106,10 @@ public class DoubleByte { ...@@ -106,7 +106,10 @@ public class DoubleByte {
Arrays.fill(B2C_UNMAPPABLE, (char)UNMAPPABLE_DECODING); Arrays.fill(B2C_UNMAPPABLE, (char)UNMAPPABLE_DECODING);
} }
public static class Decoder extends CharsetDecoder { public static class Decoder extends CharsetDecoder
implements DelegatableDecoder
{
final char[][] b2c; final char[][] b2c;
final char[] b2cSB; final char[] b2cSB;
final int b2Min; final int b2Min;
...@@ -174,6 +177,7 @@ public class DoubleByte { ...@@ -174,6 +177,7 @@ public class DoubleByte {
protected CoderResult decodeBufferLoop(ByteBuffer src, CharBuffer dst) { protected CoderResult decodeBufferLoop(ByteBuffer src, CharBuffer dst) {
int mark = src.position(); int mark = src.position();
try { try {
while (src.hasRemaining() && dst.hasRemaining()) { while (src.hasRemaining() && dst.hasRemaining()) {
int b1 = src.get() & 0xff; int b1 = src.get() & 0xff;
char c = b2cSB[b1]; char c = b2cSB[b1];
...@@ -197,13 +201,22 @@ public class DoubleByte { ...@@ -197,13 +201,22 @@ public class DoubleByte {
} }
} }
protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) { // Make some protected methods public for use by JISAutoDetect
public CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
if (src.hasArray() && dst.hasArray()) if (src.hasArray() && dst.hasArray())
return decodeArrayLoop(src, dst); return decodeArrayLoop(src, dst);
else else
return decodeBufferLoop(src, dst); return decodeBufferLoop(src, dst);
} }
public void implReset() {
super.implReset();
}
public CoderResult implFlush(CharBuffer out) {
return super.implFlush(out);
}
// decode loops are not using decodeSingle/Double() for performance // decode loops are not using decodeSingle/Double() for performance
// reason. // reason.
public char decodeSingle(int b) { public char decodeSingle(int b) {
...@@ -230,7 +243,7 @@ public class DoubleByte { ...@@ -230,7 +243,7 @@ public class DoubleByte {
super(cs, b2c, b2cSB, b2Min, b2Max); super(cs, b2c, b2cSB, b2Min, b2Max);
} }
protected void implReset() { public void implReset() {
currentState = SBCS; currentState = SBCS;
} }
...@@ -400,7 +413,7 @@ public class DoubleByte { ...@@ -400,7 +413,7 @@ public class DoubleByte {
private final char[] c2bIndex; private final char[] c2bIndex;
Surrogate.Parser sgp; Surrogate.Parser sgp;
Encoder(Charset cs, char[] c2b, char[] c2bIndex) { protected Encoder(Charset cs, char[] c2b, char[] c2bIndex) {
super(cs, 2.0f, 2.0f); super(cs, 2.0f, 2.0f);
this.c2b = c2b; this.c2b = c2b;
this.c2bIndex = c2bIndex; this.c2bIndex = c2bIndex;
......
...@@ -86,14 +86,14 @@ public class ISO2022_CN ...@@ -86,14 +86,14 @@ public class ISO2022_CN
private static final Charset gb2312 = new EUC_CN(); private static final Charset gb2312 = new EUC_CN();
private static final Charset cns = new EUC_TW(); private static final Charset cns = new EUC_TW();
private final EUC_CN.Decoder gb2312Decoder; private final DoubleByte.Decoder gb2312Decoder;
private final EUC_TW.Decoder cnsDecoder; private final EUC_TW.Decoder cnsDecoder;
Decoder(Charset cs) { Decoder(Charset cs) {
super(cs, 1.0f, 1.0f); super(cs, 1.0f, 1.0f);
shiftOut = false; shiftOut = false;
currentSODesig = SODesigGB; currentSODesig = SODesigGB;
gb2312Decoder = (EUC_CN.Decoder)gb2312.newDecoder(); gb2312Decoder = (DoubleByte.Decoder)gb2312.newDecoder();
cnsDecoder = (EUC_TW.Decoder)cns.newDecoder(); cnsDecoder = (EUC_TW.Decoder)cns.newDecoder();
} }
......
...@@ -28,6 +28,7 @@ package sun.nio.cs.ext; ...@@ -28,6 +28,7 @@ package sun.nio.cs.ext;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder; import java.nio.charset.CharsetEncoder;
import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetDecoder;
import static sun.nio.cs.CharsetMapping.*;
public class MS932_0213 extends Charset { public class MS932_0213 extends Charset {
public MS932_0213() { public MS932_0213() {
...@@ -49,30 +50,31 @@ public class MS932_0213 extends Charset { ...@@ -49,30 +50,31 @@ public class MS932_0213 extends Charset {
} }
protected static class Decoder extends SJIS_0213.Decoder { protected static class Decoder extends SJIS_0213.Decoder {
MS932DB.Decoder decMS932; static DoubleByte.Decoder decMS932 =
(DoubleByte.Decoder)new MS932().newDecoder();
protected Decoder(Charset cs) { protected Decoder(Charset cs) {
super(cs); super(cs);
decMS932 = new MS932DB.Decoder(cs);
} }
protected char decodeDouble(int b1, int b2) { protected char decodeDouble(int b1, int b2) {
char c = decMS932.decodeDouble(b1, b2); char c = decMS932.decodeDouble(b1, b2);
if (c == DoubleByteDecoder.REPLACE_CHAR) if (c == UNMAPPABLE_DECODING)
return super.decodeDouble(b1, b2); return super.decodeDouble(b1, b2);
return c; return c;
} }
} }
protected static class Encoder extends SJIS_0213.Encoder { protected static class Encoder extends SJIS_0213.Encoder {
MS932DB.Encoder encMS932; // we only use its encodeChar() method
static DoubleByte.Encoder encMS932 =
(DoubleByte.Encoder)new MS932().newEncoder();
protected Encoder(Charset cs) { protected Encoder(Charset cs) {
super(cs); super(cs);
encMS932 = new MS932DB.Encoder(cs);
} }
protected int encodeChar(char ch) { protected int encodeChar(char ch) {
int db = encMS932.encodeDouble(ch); int db = encMS932.encodeChar(ch);
if (db == 0) if (db == UNMAPPABLE_ENCODING)
return super.encodeChar(ch); return super.encodeChar(ch);
return db; return db;
} }
......
...@@ -23,15 +23,13 @@ ...@@ -23,15 +23,13 @@
* have any questions. * have any questions.
*/ */
/*
*/
package sun.nio.cs.ext; package sun.nio.cs.ext;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder; import java.nio.charset.CharsetEncoder;
import sun.nio.cs.HistoricallyNamedCharset; import sun.nio.cs.HistoricallyNamedCharset;
import static sun.nio.cs.CharsetMapping.*;
public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset
{ {
...@@ -59,8 +57,8 @@ public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset ...@@ -59,8 +57,8 @@ public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset
private static class Decoder extends HKSCS.Decoder { private static class Decoder extends HKSCS.Decoder {
private MS950.Decoder ms950Dec; private static DoubleByte.Decoder ms950Dec =
(DoubleByte.Decoder)new MS950().newDecoder();
/* /*
* Note current decoder decodes 0x8BC2 --> U+F53A * Note current decoder decodes 0x8BC2 --> U+F53A
...@@ -73,18 +71,18 @@ public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset ...@@ -73,18 +71,18 @@ public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset
protected char decodeDouble(int byte1, int byte2) { protected char decodeDouble(int byte1, int byte2) {
char c = super.decodeDouble(byte1, byte2); char c = super.decodeDouble(byte1, byte2);
return (c != REPLACE_CHAR) ? c : ms950Dec.decodeDouble(byte1, byte2); return (c != UNMAPPABLE_DECODING) ? c : ms950Dec.decodeDouble(byte1, byte2);
} }
private Decoder(Charset cs) { private Decoder(Charset cs) {
super(cs); super(cs);
ms950Dec = new MS950.Decoder(cs);
} }
} }
private static class Encoder extends HKSCS.Encoder { private static class Encoder extends HKSCS.Encoder {
private MS950.Encoder ms950Enc; private static DoubleByte.Encoder ms950Enc =
(DoubleByte.Encoder)new MS950().newEncoder();
/* /*
* Note current encoder encodes U+F53A --> 0x8BC2 * Note current encoder encodes U+F53A --> 0x8BC2
...@@ -93,12 +91,11 @@ public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset ...@@ -93,12 +91,11 @@ public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset
*/ */
protected int encodeDouble(char ch) { protected int encodeDouble(char ch) {
int r = super.encodeDouble(ch); int r = super.encodeDouble(ch);
return (r != 0) ? r : ms950Enc.encodeDouble(ch); return (r != UNMAPPABLE_ENCODING) ? r : ms950Enc.encodeChar(ch);
} }
private Encoder(Charset cs) { private Encoder(Charset cs) {
super(cs); super(cs);
ms950Enc = new MS950.Encoder(cs);
} }
} }
} }
...@@ -33,6 +33,7 @@ import java.net.Inet4Address; ...@@ -33,6 +33,7 @@ import java.net.Inet4Address;
import java.net.Inet6Address; import java.net.Inet6Address;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import sun.security.krb5.*; import sun.security.krb5.*;
import sun.security.jgss.HttpCaller; import sun.security.jgss.HttpCaller;
import sun.security.krb5.internal.Krb5; import sun.security.krb5.internal.Krb5;
...@@ -219,43 +220,35 @@ abstract class InitialToken extends Krb5Token { ...@@ -219,43 +220,35 @@ abstract class InitialToken extends Krb5Token {
"Incorrect checksum"); "Incorrect checksum");
} }
byte[] remoteBindingBytes = new byte[CHECKSUM_BINDINGS_SIZE];
System.arraycopy(checksumBytes, 4, remoteBindingBytes, 0,
CHECKSUM_BINDINGS_SIZE);
byte[] noBindings = new byte[CHECKSUM_BINDINGS_SIZE];
boolean tokenContainsBindings =
(!java.util.Arrays.equals(noBindings, remoteBindingBytes));
ChannelBinding localBindings = context.getChannelBinding(); ChannelBinding localBindings = context.getChannelBinding();
if (tokenContainsBindings || // Ignore remote channel binding info when not requested at
localBindings != null) { // local side (RFC 4121 4.1.1.2: the acceptor MAY ignore...).
//
boolean badBindings = false; // All major krb5 implementors implement this "MAY",
String errorMessage = null; // and some applications depend on it as a workaround
// for not having a way to negotiate the use of channel
// binding -- the initiator application always uses CB
// and hopes the acceptor will ignore the CB if the
// acceptor doesn't support CB.
if (localBindings != null) {
byte[] remoteBindingBytes = new byte[CHECKSUM_BINDINGS_SIZE];
System.arraycopy(checksumBytes, 4, remoteBindingBytes, 0,
CHECKSUM_BINDINGS_SIZE);
if (tokenContainsBindings && byte[] noBindings = new byte[CHECKSUM_BINDINGS_SIZE];
localBindings != null) { if (!Arrays.equals(noBindings, remoteBindingBytes)) {
byte[] localBindingsBytes = byte[] localBindingsBytes =
computeChannelBinding(localBindings); computeChannelBinding(localBindings);
// System.out.println("ChannelBinding hash: " if (!Arrays.equals(localBindingsBytes,
// + getHexBytes(localBindingsBytes)); remoteBindingBytes)) {
badBindings = throw new GSSException(GSSException.BAD_BINDINGS, -1,
(!java.util.Arrays.equals(localBindingsBytes, "Bytes mismatch!");
remoteBindingBytes)); }
errorMessage = "Bytes mismatch!";
} else if (localBindings == null) {
errorMessage = "ChannelBinding not provided!";
badBindings = true;
} else { } else {
errorMessage = "Token missing ChannelBinding!";
badBindings = true;
}
if (badBindings)
throw new GSSException(GSSException.BAD_BINDINGS, -1, throw new GSSException(GSSException.BAD_BINDINGS, -1,
errorMessage); "Token missing ChannelBinding!");
}
} }
flags = readLittleEndian(checksumBytes, 20, 4); flags = readLittleEndian(checksumBytes, 20, 4);
......
...@@ -1402,9 +1402,14 @@ public class JarSigner { ...@@ -1402,9 +1402,14 @@ public class JarSigner {
} }
/** /**
* Find the position of \r\n\r\n inside bs * Find the position of an empty line inside bs
*/ */
private int findHeaderEnd(byte[] bs) { private int findHeaderEnd(byte[] bs) {
// An empty line can be at the beginning...
if (bs.length > 1 && bs[0] == '\r' && bs[1] == '\n') {
return 0;
}
// ... or after another line
for (int i=0; i<bs.length-3; i++) { for (int i=0; i<bs.length-3; i++) {
if (bs[i] == '\r' && bs[i+1] == '\n' && if (bs[i] == '\r' && bs[i+1] == '\n' &&
bs[i+2] == '\r' && bs[i+3] == '\n') { bs[i+2] == '\r' && bs[i+3] == '\n') {
......
/* /*
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -129,7 +129,7 @@ public class ManifestDigester { ...@@ -129,7 +129,7 @@ public class ManifestDigester {
if (len > 6) { if (len > 6) {
if (isNameAttr(bytes, start)) { if (isNameAttr(bytes, start)) {
StringBuilder nameBuf = new StringBuilder(); StringBuilder nameBuf = new StringBuilder(sectionLen);
try { try {
nameBuf.append( nameBuf.append(
......
...@@ -28,7 +28,6 @@ package sun.security.x509; ...@@ -28,7 +28,6 @@ package sun.security.x509;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.Date;
import java.util.Enumeration; import java.util.Enumeration;
import sun.security.util.*; import sun.security.util.*;
......
...@@ -140,7 +140,11 @@ public class InvalidityDateExtension extends Extension ...@@ -140,7 +140,11 @@ public class InvalidityDateExtension extends Extension
*/ */
public Object get(String name) throws IOException { public Object get(String name) throws IOException {
if (name.equalsIgnoreCase(DATE)) { if (name.equalsIgnoreCase(DATE)) {
return date; if (date == null) {
return null;
} else {
return (new Date(date.getTime())); // clone
}
} else { } else {
throw new IOException throw new IOException
("Name not supported by InvalidityDateExtension"); ("Name not supported by InvalidityDateExtension");
......
...@@ -56,7 +56,7 @@ class Main { ...@@ -56,7 +56,7 @@ class Main {
Set<File> entries = new LinkedHashSet<File>(); Set<File> entries = new LinkedHashSet<File>();
// Directories specified by "-C" operation. // Directories specified by "-C" operation.
List<String> paths = new ArrayList<String>(); Set<String> paths = new HashSet<String>();
CRC32 crc32 = new CRC32(); CRC32 crc32 = new CRC32();
/* /*
......
...@@ -28,7 +28,8 @@ package sun.awt.motif; ...@@ -28,7 +28,8 @@ package sun.awt.motif;
import java.nio.CharBuffer; import java.nio.CharBuffer;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.charset.*; import java.nio.charset.*;
import sun.nio.cs.ext.EUC_CN; import sun.nio.cs.ext.*;
import static sun.nio.cs.CharsetMapping.*;
public class X11GB2312 extends Charset { public class X11GB2312 extends Charset {
public X11GB2312 () { public X11GB2312 () {
...@@ -45,16 +46,22 @@ public class X11GB2312 extends Charset { ...@@ -45,16 +46,22 @@ public class X11GB2312 extends Charset {
return cs instanceof X11GB2312; return cs instanceof X11GB2312;
} }
private class Encoder extends EUC_CN.Encoder { private class Encoder extends CharsetEncoder {
private DoubleByte.Encoder enc = (DoubleByte.Encoder)new EUC_CN().newEncoder();
public Encoder(Charset cs) { public Encoder(Charset cs) {
super(cs); super(cs, 2.0f, 2.0f);
} }
public boolean canEncode(char c) { public boolean canEncode(char c) {
if (c <= 0x7F) { if (c <= 0x7F) {
return false; return false;
} }
return super.canEncode(c); return enc.canEncode(c);
}
protected int encodeDouble(char c) {
return enc.encodeChar(c);
} }
protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) { protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
...@@ -91,9 +98,15 @@ public class X11GB2312 extends Charset { ...@@ -91,9 +98,15 @@ public class X11GB2312 extends Charset {
} }
} }
private class Decoder extends EUC_CN.Decoder { private class Decoder extends CharsetDecoder {
private DoubleByte.Decoder dec = (DoubleByte.Decoder)new EUC_CN().newDecoder();
public Decoder(Charset cs) { public Decoder(Charset cs) {
super(cs); super(cs, 0.5f, 1.0f);
}
protected char decodeDouble(int b1, int b2) {
return dec.decodeDouble(b1, b2);
} }
protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) { protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
...@@ -116,7 +129,7 @@ public class X11GB2312 extends Charset { ...@@ -116,7 +129,7 @@ public class X11GB2312 extends Charset {
int b1 = sa[sp] & 0xFF | 0x80; int b1 = sa[sp] & 0xFF | 0x80;
int b2 = sa[sp + 1] & 0xFF | 0x80; int b2 = sa[sp + 1] & 0xFF | 0x80;
char c = decodeDouble(b1, b2); char c = decodeDouble(b1, b2);
if (c == replacement().charAt(0)) { if (c == UNMAPPABLE_DECODING) {
return CoderResult.unmappableForLength(2); return CoderResult.unmappableForLength(2);
} }
if (dl - dp < 1) if (dl - dp < 1)
......
...@@ -25,10 +25,9 @@ ...@@ -25,10 +25,9 @@
package sun.awt.motif; package sun.awt.motif;
import java.nio.charset.Charset; import java.nio.charset.*;
import java.nio.charset.CharsetEncoder; import sun.nio.cs.ext.*;
import java.nio.charset.CharsetDecoder; import static sun.nio.cs.CharsetMapping.*;
import sun.nio.cs.ext.GBK;
public class X11GBK extends Charset { public class X11GBK extends Charset {
public X11GBK () { public X11GBK () {
...@@ -38,20 +37,30 @@ public class X11GBK extends Charset { ...@@ -38,20 +37,30 @@ public class X11GBK extends Charset {
return new Encoder(this); return new Encoder(this);
} }
public CharsetDecoder newDecoder() { public CharsetDecoder newDecoder() {
return new GBK.Decoder(this); return new GBK().newDecoder();
} }
public boolean contains(Charset cs) { public boolean contains(Charset cs) {
return cs instanceof X11GBK; return cs instanceof X11GBK;
} }
private class Encoder extends GBK.Encoder { private class Encoder extends DoubleByte.Encoder {
public Encoder(Charset cs) {
super(cs); private DoubleByte.Encoder enc = (DoubleByte.Encoder)new GBK().newEncoder();
Encoder(Charset cs) {
super(cs, (char[])null, (char[])null);
} }
public boolean canEncode(char ch){ public boolean canEncode(char ch){
if (ch < 0x80) return false; if (ch < 0x80) return false;
return super.canEncode(ch); return enc.canEncode(ch);
}
public int encodeChar(char ch) {
if (ch < 0x80)
return UNMAPPABLE_ENCODING;
return enc.encodeChar(ch);
} }
} }
} }
...@@ -28,7 +28,8 @@ package sun.awt.motif; ...@@ -28,7 +28,8 @@ package sun.awt.motif;
import java.nio.CharBuffer; import java.nio.CharBuffer;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.charset.*; import java.nio.charset.*;
import sun.nio.cs.ext.EUC_KR; import sun.nio.cs.ext.*;
import static sun.nio.cs.CharsetMapping.*;
public class X11KSC5601 extends Charset { public class X11KSC5601 extends Charset {
public X11KSC5601 () { public X11KSC5601 () {
...@@ -45,16 +46,22 @@ public class X11KSC5601 extends Charset { ...@@ -45,16 +46,22 @@ public class X11KSC5601 extends Charset {
return cs instanceof X11KSC5601; return cs instanceof X11KSC5601;
} }
private class Encoder extends EUC_KR.Encoder { private class Encoder extends CharsetEncoder {
private DoubleByte.Encoder enc = (DoubleByte.Encoder)new EUC_KR().newEncoder();
public Encoder(Charset cs) { public Encoder(Charset cs) {
super(cs); super(cs, 2.0f, 2.0f);
} }
public boolean canEncode(char c) { public boolean canEncode(char c) {
if (c <= 0x7F) { if (c <= 0x7F) {
return false; return false;
} }
return super.canEncode(c); return enc.canEncode(c);
}
protected int encodeDouble(char c) {
return enc.encodeChar(c);
} }
protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) { protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
...@@ -90,9 +97,15 @@ public class X11KSC5601 extends Charset { ...@@ -90,9 +97,15 @@ public class X11KSC5601 extends Charset {
} }
} }
private class Decoder extends EUC_KR.Decoder { private class Decoder extends CharsetDecoder {
private DoubleByte.Decoder dec = (DoubleByte.Decoder)new EUC_KR().newDecoder();
public Decoder(Charset cs) { public Decoder(Charset cs) {
super(cs); super(cs, 0.5f, 1.0f);
}
protected char decodeDouble(int b1, int b2) {
return dec.decodeDouble(b1, b2);
} }
protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) { protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
...@@ -116,7 +129,7 @@ public class X11KSC5601 extends Charset { ...@@ -116,7 +129,7 @@ public class X11KSC5601 extends Charset {
int b1 = sa[sp] & 0xFF | 0x80; int b1 = sa[sp] & 0xFF | 0x80;
int b2 = sa[sp + 1] & 0xFF | 0x80; int b2 = sa[sp + 1] & 0xFF | 0x80;
char c = decodeDouble(b1, b2); char c = decodeDouble(b1, b2);
if (c == replacement().charAt(0)) { if (c == UNMAPPABLE_DECODING) {
return CoderResult.unmappableForLength(2); return CoderResult.unmappableForLength(2);
} }
if (dl - dp < 1) if (dl - dp < 1)
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 1234567 * @bug 6850606
* @summary Test BigDecimal.multiply(BigDecimal) * @summary Test BigDecimal.multiply(BigDecimal)
* @author xlu * @author xlu
*/ */
...@@ -72,6 +72,16 @@ public class MultiplyTests { ...@@ -72,6 +72,16 @@ public class MultiplyTests {
} }
} }
} }
BigDecimal x = BigDecimal.valueOf(8L, 1);
BigDecimal xPower = BigDecimal.valueOf(-1L);
try {
for (int i = 0; i < 100; i++) {
xPower = xPower.multiply(x);
}
} catch (Exception ex) {
failures++;
}
return failures; return failures;
} }
......
/* /*
* Copyright 1998-2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as * under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this * published by the Free Software Foundation.
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
* *
* This code is distributed in the hope that it will be useful, but WITHOUT * This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
...@@ -23,20 +21,39 @@ ...@@ -23,20 +21,39 @@
* have any questions. * have any questions.
*/ */
package sun.io; /* @test
* @bug 6847092
* @summary test if isLegalReplacement() works correctly for ascii charsets
*/
import sun.nio.cs.ext.MS932DB; import java.util.*;
import java.nio.*;
import java.nio.charset.*;
/** public class FindASCIIReplBugs {
* Tables and data to convert Unicode to MS932 private static int failures = 0;
*
* @author ConverterGenerator tool
*/
abstract class CharToByteMS932DB extends CharToByteDoubleByte { public static void main(String[] args) throws Exception {
Charset ascii = Charset.forName("ASCII");
for (Map.Entry<String,Charset> e
: Charset.availableCharsets().entrySet()) {
String csn = e.getKey();
Charset cs = e.getValue();
if (!cs.contains(ascii) ||
csn.matches(".*2022.*") || //iso2022 family
csn.matches(".*UTF-[16|32].*")) //multi-bytes
continue;
if (! cs.canEncode()) continue;
public CharToByteMS932DB() { byte[] sc_subs = { 'A'};
super.index1 = MS932DB.Encoder.index1; byte[] mc_subs = { 'A', 'S'};
super.index2 = MS932DB.Encoder.index2; if (!cs.newEncoder().isLegalReplacement (sc_subs) ||
!cs.newEncoder().isLegalReplacement (mc_subs)) {
System.out.printf(" %s: isLegalReplacement failed!%n", csn);
failures++;
}
}
if (failures > 0)
throw new Exception(failures + "tests failed");
} }
} }
/*
* Copyright 2002-2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
*/
//package sun.nio.cs.ext;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CoderResult;
abstract class DoubleByteDecoder
extends CharsetDecoder
{
private short index1[];
/*
* 2nd level index, provided by subclass
* every string has 0x10*(end-start+1) characters.
*/
private String index2[];
protected int start;
protected int end;
protected static final char REPLACE_CHAR = '\uFFFD';
protected char highSurrogate;
protected char lowSurrogate;
protected DoubleByteDecoder(Charset cs, short[] index1, String[] index2,
int start, int end ) {
super(cs, 0.5f, 1.0f);
this.index1 = index1;
this.index2 = index2;
this.start = start;
this.end = end;
}
private CoderResult decodeArrayLoop(ByteBuffer src, CharBuffer dst) {
byte[] sa = src.array();
int sp = src.arrayOffset() + src.position();
int sl = src.arrayOffset() + src.limit();
assert (sp <= sl);
sp = (sp <= sl ? sp : sl);
char[] da = dst.array();
int dp = dst.arrayOffset() + dst.position();
int dl = dst.arrayOffset() + dst.limit();
assert (dp <= dl);
dp = (dp <= dl ? dp : dl);
try {
while (sp < sl) {
int b1, b2;
b1 = sa[sp];
int inputSize = 1;
int outputSize = 1;
highSurrogate = lowSurrogate = 0;
char c = decodeSingle(b1);
if (c == REPLACE_CHAR) {
b1 &= 0xff;
if (sl - sp < 2)
return CoderResult.UNDERFLOW;
b2 = sa[sp + 1] & 0xff;
c = decodeDouble(b1, b2);
inputSize = 2;
if (c == REPLACE_CHAR)
return CoderResult.unmappableForLength(inputSize);
outputSize = (highSurrogate > 0) ? 2: 1;
}
if (dl - dp < outputSize)
return CoderResult.OVERFLOW;
if (outputSize == 2) {
da[dp++] = highSurrogate;
da[dp++] = lowSurrogate;
} else {
da[dp++] = c;
}
sp += inputSize;
}
return CoderResult.UNDERFLOW;
} finally {
src.position(sp - src.arrayOffset());
dst.position(dp - dst.arrayOffset());
}
}
private CoderResult decodeBufferLoop(ByteBuffer src, CharBuffer dst) {
int mark = src.position();
int inputSize = 0;
int outputSize = 0;
try {
while (src.hasRemaining()) {
int b1 = src.get();
inputSize = 1;
outputSize = 1;
highSurrogate = lowSurrogate = 0;
char c = decodeSingle(b1);
if (c == REPLACE_CHAR) {
if (src.remaining() < 1)
return CoderResult.UNDERFLOW;
b1 &= 0xff;
int b2 = src.get() & 0xff;
inputSize = 2;
c = decodeDouble(b1, b2);
if (c == REPLACE_CHAR)
return CoderResult.unmappableForLength(2);
outputSize = (highSurrogate > 0) ? 2: 1;
}
if (dst.remaining() < outputSize)
return CoderResult.OVERFLOW;
mark += inputSize;
if (outputSize == 2) {
dst.put(highSurrogate);
dst.put(lowSurrogate);
} else {
dst.put(c);
}
}
return CoderResult.UNDERFLOW;
} finally {
src.position(mark);
}
}
protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
if (src.hasArray() && dst.hasArray())
return decodeArrayLoop(src, dst);
else
return decodeBufferLoop(src, dst);
}
/*
* Can be changed by subclass
*/
protected char decodeSingle(int b) {
if (b >= 0)
return (char) b;
return REPLACE_CHAR;
}
protected char decodeDouble(int byte1, int byte2) {
if (((byte1 < 0) || (byte1 > index1.length))
|| ((byte2 < start) || (byte2 > end)))
return REPLACE_CHAR;
int n = (index1[byte1] & 0xf) * (end - start + 1) + (byte2 - start);
return index2[index1[byte1] >> 4].charAt(n);
}
}
/*
* Copyright 2002-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
*/
//package sun.nio.cs.ext;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.CoderResult;
import sun.nio.cs.Surrogate;
public abstract class DoubleByteEncoder
extends CharsetEncoder
{
private short index1[];
private String index2[];
private final Surrogate.Parser sgp = new Surrogate.Parser();
protected DoubleByteEncoder(Charset cs,
short[] index1, String[] index2)
{
super(cs, 2.0f, 2.0f);
this.index1 = index1;
this.index2 = index2;
}
protected DoubleByteEncoder(Charset cs,
short[] index1, String[] index2,
float avg, float max)
{
super(cs, avg, max);
this.index1 = index1;
this.index2 = index2;
}
protected DoubleByteEncoder(Charset cs,
short[] index1, String[] index2, byte[] repl)
{
super(cs, 2.0f, 2.0f, repl);
this.index1 = index1;
this.index2 = index2;
}
protected DoubleByteEncoder(Charset cs,
short[] index1, String[] index2,
byte[] repl, float avg, float max)
{
super(cs, avg, max,repl);
this.index1 = index1;
this.index2 = index2;
}
public boolean canEncode(char c) {
return (encodeSingle(c) != -1 ||
encodeDouble(c) != 0);
}
private CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) {
char[] sa = src.array();
int sp = src.arrayOffset() + src.position();
int sl = src.arrayOffset() + src.limit();
byte[] da = dst.array();
int dp = dst.arrayOffset() + dst.position();
int dl = dst.arrayOffset() + dst.limit();
try {
while (sp < sl) {
char c = sa[sp];
if (Surrogate.is(c)) {
if (sgp.parse(c, sa, sp, sl) < 0)
return sgp.error();
if (sl - sp < 2)
return CoderResult.UNDERFLOW;
char c2 = sa[sp + 1];
byte[] outputBytes = new byte[2];
outputBytes = encodeSurrogate(c, c2);
if (outputBytes == null) {
return sgp.unmappableResult();
}
else {
if (dl - dp < 2)
return CoderResult.OVERFLOW;
da[dp++] = outputBytes[0];
da[dp++] = outputBytes[1];
sp += 2;
continue;
}
}
if (c >= '\uFFFE')
return CoderResult.unmappableForLength(1);
int b = encodeSingle(c);
if (b != -1) { // Single Byte
if (dl - dp < 1)
return CoderResult.OVERFLOW;
da[dp++] = (byte)b;
sp++;
continue;
}
int ncode = encodeDouble(c);
if (ncode != 0 && c != '\u0000' ) {
if (dl - dp < 2)
return CoderResult.OVERFLOW;
da[dp++] = (byte) ((ncode & 0xff00) >> 8);
da[dp++] = (byte) (ncode & 0xff);
sp++;
continue;
}
return CoderResult.unmappableForLength(1);
}
return CoderResult.UNDERFLOW;
} finally {
src.position(sp - src.arrayOffset());
dst.position(dp - dst.arrayOffset());
}
}
private CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) {
int mark = src.position();
try {
while (src.hasRemaining()) {
char c = src.get();
if (Surrogate.is(c)) {
int surr;
if ((surr = sgp.parse(c, src)) < 0)
return sgp.error();
char c2 = Surrogate.low(surr);
byte[] outputBytes = new byte[2];
outputBytes = encodeSurrogate(c, c2);
if (outputBytes == null) {
return sgp.unmappableResult();
} else {
if (dst.remaining() < 2)
return CoderResult.OVERFLOW;
mark += 2;
dst.put(outputBytes[0]);
dst.put(outputBytes[1]);
continue;
}
}
if (c >= '\uFFFE')
return CoderResult.unmappableForLength(1);
int b = encodeSingle(c);
if (b != -1) { // Single-byte character
if (dst.remaining() < 1)
return CoderResult.OVERFLOW;
mark++;
dst.put((byte)b);
continue;
}
// Double Byte character
int ncode = encodeDouble(c);
if (ncode != 0 && c != '\u0000') {
if (dst.remaining() < 2)
return CoderResult.OVERFLOW;
mark++;
dst.put((byte) ((ncode & 0xff00) >> 8));
dst.put((byte) ncode);
continue;
}
return CoderResult.unmappableForLength(1);
}
return CoderResult.UNDERFLOW;
} finally {
src.position(mark);
}
}
protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
if (true && src.hasArray() && dst.hasArray())
return encodeArrayLoop(src, dst);
else
return encodeBufferLoop(src, dst);
}
/*
* Can be changed by subclass
*/
protected int encodeDouble(char ch) {
int offset = index1[((ch & 0xff00) >> 8 )] << 8;
return index2[offset >> 12].charAt((offset & 0xfff) + (ch & 0xff));
}
/*
* Can be changed by subclass
*/
protected int encodeSingle(char inputChar) {
if (inputChar < 0x80)
return (byte)inputChar;
else
return -1;
}
/**
* Protected method which should be overridden by concrete DBCS
* CharsetEncoder classes which included supplementary characters
* within their mapping coverage.
* null return value indicates surrogate values could not be
* handled or encoded.
*/
protected byte[] encodeSurrogate(char highSurrogate, char lowSurrogate) {
return null;
}
}
...@@ -23,23 +23,18 @@ ...@@ -23,23 +23,18 @@
* have any questions. * have any questions.
*/ */
/*
*/
package sun.nio.cs.ext;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder; import java.nio.charset.CharsetEncoder;
import sun.nio.cs.HistoricallyNamedCharset; import sun.nio.cs.HistoricallyNamedCharset;
public class EUC_CN public class EUC_CN_OLD
extends Charset extends Charset
implements HistoricallyNamedCharset implements HistoricallyNamedCharset
{ {
public EUC_CN() { public EUC_CN_OLD() {
super("GB2312", ExtendedCharsets.aliasesFor("GB2312")); super("GB2312-OLD", null);
} }
public String historicalName() { public String historicalName() {
...@@ -47,7 +42,7 @@ public class EUC_CN ...@@ -47,7 +42,7 @@ public class EUC_CN
} }
public boolean contains(Charset cs) { public boolean contains(Charset cs) {
return ((cs instanceof EUC_CN) return ((cs instanceof EUC_CN_OLD)
|| (cs.name().equals("US-ASCII"))); || (cs.name().equals("US-ASCII")));
} }
...@@ -60,16 +55,16 @@ public class EUC_CN ...@@ -60,16 +55,16 @@ public class EUC_CN
} }
public short[] getDecoderIndex1() { public short[] getDecoderIndex1() {
return EUC_CN.Decoder.index1; return Decoder.index1;
} }
public String[] getDecoderIndex2() { public String[] getDecoderIndex2() {
return EUC_CN.Decoder.index2; return Decoder.index2;
} }
public short[] getEncoderIndex1() { public short[] getEncoderIndex1() {
return EUC_CN.Encoder.index1; return Encoder.index1;
} }
public String[] getEncoderIndex2() { public String[] getEncoderIndex2() {
return EUC_CN.Encoder.index2; return Encoder.index2;
} }
public static class Decoder extends DoubleByteDecoder { public static class Decoder extends DoubleByteDecoder {
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
/* /*
*/ */
package sun.nio.cs.ext; //package sun.nio.cs.ext;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetDecoder;
...@@ -35,12 +35,12 @@ import java.nio.charset.CharsetEncoder; ...@@ -35,12 +35,12 @@ import java.nio.charset.CharsetEncoder;
import java.nio.charset.CharacterCodingException; import java.nio.charset.CharacterCodingException;
import sun.nio.cs.HistoricallyNamedCharset; import sun.nio.cs.HistoricallyNamedCharset;
public class EUC_KR public class EUC_KR_OLD
extends Charset extends Charset
implements HistoricallyNamedCharset implements HistoricallyNamedCharset
{ {
public EUC_KR() { public EUC_KR_OLD() {
super("EUC-KR", ExtendedCharsets.aliasesFor("EUC-KR")); super("EUC-KR-OLD", null);
} }
public String historicalName() { public String historicalName() {
...@@ -48,7 +48,7 @@ public class EUC_KR ...@@ -48,7 +48,7 @@ public class EUC_KR
} }
public boolean contains(Charset cs) { public boolean contains(Charset cs) {
return ((cs instanceof EUC_KR) return ((cs instanceof EUC_KR_OLD)
|| (cs.name().equals("US-ASCII"))); || (cs.name().equals("US-ASCII")));
} }
......
...@@ -27,24 +27,22 @@ ...@@ -27,24 +27,22 @@
/* /*
*/ */
package sun.nio.cs.ext;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder; import java.nio.charset.CharsetEncoder;
import java.nio.charset.CharacterCodingException; import java.nio.charset.CharacterCodingException;
public class GBK public class GBK_OLD
extends Charset extends Charset
{ {
public GBK() { public GBK_OLD() {
super("GBK", ExtendedCharsets.aliasesFor("GBK")); super("GBK-OLD", null);
} }
public boolean contains(Charset cs) { public boolean contains(Charset cs) {
return ((cs.name().equals("US-ASCII")) return ((cs.name().equals("US-ASCII"))
|| (cs instanceof GBK)); || (cs instanceof GBK_OLD));
} }
public CharsetDecoder newDecoder() { public CharsetDecoder newDecoder() {
......
/* /*
* Copyright 2002-2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2002-2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
...@@ -27,24 +26,23 @@ ...@@ -27,24 +26,23 @@
/* /*
*/ */
package sun.nio.cs.ext; //package sun.nio.cs.ext;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder; import java.nio.charset.CharsetEncoder;
import java.nio.charset.CharacterCodingException; import java.nio.charset.CharacterCodingException;
public class Johab public class Johab_OLD extends Charset
extends Charset
{ {
public Johab() { public Johab_OLD() {
super("x-Johab", ExtendedCharsets.aliasesFor("x-Johab")); super("x-Johab-OLD", null);
} }
public boolean contains(Charset cs) { public boolean contains(Charset cs) {
return ((cs.name().equals("US-ASCII")) return ((cs.name().equals("US-ASCII"))
|| (cs instanceof Johab)); || (cs instanceof Johab_OLD));
} }
public CharsetDecoder newDecoder() { public CharsetDecoder newDecoder() {
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
/* /*
*/ */
package sun.nio.cs.ext;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetDecoder;
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
*/ */
package sun.nio.cs.ext;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.CharBuffer; import java.nio.CharBuffer;
import java.nio.charset.Charset; import java.nio.charset.Charset;
...@@ -33,11 +31,12 @@ import java.nio.charset.CharsetDecoder; ...@@ -33,11 +31,12 @@ import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder; import java.nio.charset.CharsetEncoder;
import java.nio.charset.CoderResult; import java.nio.charset.CoderResult;
import sun.nio.cs.HistoricallyNamedCharset; import sun.nio.cs.HistoricallyNamedCharset;
import sun.nio.cs.ext.*;
public class MS932 extends Charset implements HistoricallyNamedCharset public class MS932_OLD extends Charset implements HistoricallyNamedCharset
{ {
public MS932() { public MS932_OLD() {
super("windows-31j", ExtendedCharsets.aliasesFor("windows-31j")); super("windows-31j-OLD", null);
} }
public String historicalName() { public String historicalName() {
...@@ -47,7 +46,7 @@ public class MS932 extends Charset implements HistoricallyNamedCharset ...@@ -47,7 +46,7 @@ public class MS932 extends Charset implements HistoricallyNamedCharset
public boolean contains(Charset cs) { public boolean contains(Charset cs) {
return ((cs.name().equals("US-ASCII")) return ((cs.name().equals("US-ASCII"))
|| (cs instanceof JIS_X_0201) || (cs instanceof JIS_X_0201)
|| (cs instanceof MS932)); || (cs instanceof MS932_OLD));
} }
public CharsetDecoder newDecoder() { public CharsetDecoder newDecoder() {
...@@ -59,7 +58,8 @@ public class MS932 extends Charset implements HistoricallyNamedCharset ...@@ -59,7 +58,8 @@ public class MS932 extends Charset implements HistoricallyNamedCharset
} }
private static class Decoder extends MS932DB.Decoder private static class Decoder extends MS932DB.Decoder
implements DelegatableDecoder { // implements DelegatableDecoder
{
JIS_X_0201.Decoder jisDec0201; JIS_X_0201.Decoder jisDec0201;
......
...@@ -27,20 +27,19 @@ ...@@ -27,20 +27,19 @@
/* /*
*/ */
package sun.nio.cs.ext; //package sun.nio.cs.ext;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder; import java.nio.charset.CharsetEncoder;
import sun.nio.cs.HistoricallyNamedCharset; import sun.nio.cs.HistoricallyNamedCharset;
public class MS936 public class MS936_OLD extends Charset
extends Charset
implements HistoricallyNamedCharset implements HistoricallyNamedCharset
{ {
public MS936() { public MS936_OLD() {
super("x-mswin-936", ExtendedCharsets.aliasesFor("x-mswin-936")); super("x-mswin-936-OLD", null);
} }
public String historicalName() { public String historicalName() {
...@@ -49,7 +48,7 @@ public class MS936 ...@@ -49,7 +48,7 @@ public class MS936
public boolean contains(Charset cs) { public boolean contains(Charset cs) {
return ((cs.name().equals("US-ASCII")) return ((cs.name().equals("US-ASCII"))
|| (cs instanceof MS936)); || (cs instanceof MS936_OLD));
} }
public CharsetDecoder newDecoder() { public CharsetDecoder newDecoder() {
...@@ -70,16 +69,16 @@ public class MS936 ...@@ -70,16 +69,16 @@ public class MS936
*/ */
public short[] getDecoderIndex1() { public short[] getDecoderIndex1() {
return MS936.Decoder.index1; return Decoder.index1;
} }
public String[] getDecoderIndex2() { public String[] getDecoderIndex2() {
return MS936.Decoder.index2; return Decoder.index2;
} }
public short[] getEncoderIndex1() { public short[] getEncoderIndex1() {
return MS936.Encoder.index1; return Encoder.index1;
} }
public String[] getEncoderIndex2() { public String[] getEncoderIndex2() {
return MS936.Encoder.index2; return Encoder.index2;
} }
private static class Decoder extends DoubleByteDecoder { private static class Decoder extends DoubleByteDecoder {
......
...@@ -27,20 +27,18 @@ ...@@ -27,20 +27,18 @@
/* /*
*/ */
package sun.nio.cs.ext;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder; import java.nio.charset.CharsetEncoder;
import sun.nio.cs.HistoricallyNamedCharset; import sun.nio.cs.HistoricallyNamedCharset;
import sun.nio.cs.HistoricallyNamedCharset; import sun.nio.cs.HistoricallyNamedCharset;
public class MS949 public class MS949_OLD
extends Charset implements HistoricallyNamedCharset extends Charset implements HistoricallyNamedCharset
{ {
public MS949() { public MS949_OLD() {
super("x-windows-949", ExtendedCharsets.aliasesFor("x-windows-949")); super("x-windows-949-OLD", null);
} }
public String historicalName() { public String historicalName() {
...@@ -49,7 +47,7 @@ public class MS949 ...@@ -49,7 +47,7 @@ public class MS949
public boolean contains(Charset cs) { public boolean contains(Charset cs) {
return ((cs.name().equals("US-ASCII")) return ((cs.name().equals("US-ASCII"))
|| (cs instanceof MS949)); || (cs instanceof MS949_OLD));
} }
public CharsetDecoder newDecoder() { public CharsetDecoder newDecoder() {
...@@ -70,16 +68,16 @@ public class MS949 ...@@ -70,16 +68,16 @@ public class MS949
*/ */
public short[] getDecoderIndex1() { public short[] getDecoderIndex1() {
return MS949.Decoder.index1; return Decoder.index1;
} }
public String[] getDecoderIndex2() { public String[] getDecoderIndex2() {
return MS949.Decoder.index2; return Decoder.index2;
} }
public short[] getEncoderIndex1() { public short[] getEncoderIndex1() {
return MS949.Encoder.index1; return Encoder.index1;
} }
public String[] getEncoderIndex2() { public String[] getEncoderIndex2() {
return MS949.Encoder.index2; return Encoder.index2;
} }
......
/* /*
* Copyright 2002-2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2002-2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
...@@ -27,20 +26,18 @@ ...@@ -27,20 +26,18 @@
/* /*
*/ */
package sun.nio.cs.ext;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder; import java.nio.charset.CharsetEncoder;
import sun.nio.cs.HistoricallyNamedCharset; import sun.nio.cs.HistoricallyNamedCharset;
public class MS950 public class MS950_OLD
extends Charset extends Charset
implements HistoricallyNamedCharset implements HistoricallyNamedCharset
{ {
public MS950() { public MS950_OLD() {
super("x-windows-950", ExtendedCharsets.aliasesFor("x-windows-950")); super("x-windows-950-OLD", null);
} }
public String historicalName() { public String historicalName() {
...@@ -49,7 +46,7 @@ public class MS950 ...@@ -49,7 +46,7 @@ public class MS950
public boolean contains(Charset cs) { public boolean contains(Charset cs) {
return ((cs.name().equals("US-ASCII")) return ((cs.name().equals("US-ASCII"))
|| (cs instanceof MS950)); || (cs instanceof MS950_OLD));
} }
public CharsetDecoder newDecoder() { public CharsetDecoder newDecoder() {
...@@ -70,19 +67,19 @@ public class MS950 ...@@ -70,19 +67,19 @@ public class MS950
*/ */
public short[] getDecoderIndex1() { public short[] getDecoderIndex1() {
return MS950.Decoder.index1; return Decoder.index1;
} }
public String[] getDecoderIndex2() { public String[] getDecoderIndex2() {
return MS950.Decoder.index2; return Decoder.index2;
} }
public short[] getEncoderIndex1() { public short[] getEncoderIndex1() {
return MS950.Encoder.index1; return Encoder.index1;
} }
public String[] getEncoderIndex2() { public String[] getEncoderIndex2() {
return MS950.Encoder.index2; return Encoder.index2;
} }
protected static class Decoder extends DoubleByteDecoder { protected static class Decoder extends DoubleByteDecoder {
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* @test * @test
* @bug 6843578 * @bug 6843578
* @summary Test IBM DB charsets * @summary Test IBM DB charsets
* @build IBM930_OLD IBM933_OLD IBM935_OLD IBM937_OLD IBM939_OLD IBM942_OLD IBM943_OLD IBM948_OLD IBM949_OLD IBM950_OLD IBM970_OLD IBM942C_OLD IBM943C_OLD IBM949C_OLD IBM1381_OLD IBM1383_OLD * @build IBM930_OLD IBM933_OLD IBM935_OLD IBM937_OLD IBM939_OLD IBM942_OLD IBM943_OLD IBM948_OLD IBM949_OLD IBM950_OLD IBM970_OLD IBM942C_OLD IBM943C_OLD IBM949C_OLD IBM1381_OLD IBM1383_OLD EUC_CN_OLD EUC_KR_OLD GBK_OLD Johab_OLD MS932_OLD MS936_OLD MS949_OLD MS950_OLD
*/ */
import java.nio.charset.*; import java.nio.charset.*;
...@@ -36,7 +36,7 @@ public class TestIBMDB { ...@@ -36,7 +36,7 @@ public class TestIBMDB {
static class Time { static class Time {
long t; long t;
} }
static int iteration = 100; static int iteration = 200;
static char[] decode(byte[] bb, Charset cs, boolean testDirect, Time t) static char[] decode(byte[] bb, Charset cs, boolean testDirect, Time t)
throws Exception { throws Exception {
...@@ -181,20 +181,21 @@ public class TestIBMDB { ...@@ -181,20 +181,21 @@ public class TestIBMDB {
boolean canOld = encOLD.canEncode(c); boolean canOld = encOLD.canEncode(c);
boolean canNew = encNew.canEncode(c); boolean canNew = encNew.canEncode(c);
if (is970 && c == 0x2299) if (is970 && c == 0x2299)
continue; continue;
if (canOld != canNew) { if (canOld != canNew) {
if (canNew) { if (canNew) {
System.out.printf(" NEW(only): "); System.out.printf(" NEW(only): ");
printEntry(c, newCS); printEntry(c, newCS);
} else { } else {
if (is970) { if (is970) {
byte[] bb = new String(new char[] {c}).getBytes(oldCS); byte[] bb = new String(new char[] {c}).getBytes(oldCS);
if (bb.length == 2 && bb[0] == (byte)0xa2 && bb[1] == (byte)0xc1) { if (bb.length == 2 && bb[0] == (byte)0xa2 && bb[1] == (byte)0xc1) {
// we know 970 has bogus nnnn -> a2c1 -> 2299 // we know 970 has bogus nnnn -> a2c1 -> 2299
continue; continue;
} }
} }
System.out.printf(" OLD(only): "); System.out.printf(" OLD(only): ");
printEntry(c, oldCS); printEntry(c, oldCS);
} }
...@@ -240,8 +241,10 @@ if (is970) { ...@@ -240,8 +241,10 @@ if (is970) {
String sOld = new String(bb, oldCS); String sOld = new String(bb, oldCS);
String sNew = new String(bb, newCS); String sNew = new String(bb, newCS);
if (!sOld.equals(sNew)) { if (!sOld.equals(sNew)) {
System.out.printf(" b=%x: %x %x%n", System.out.printf(" b=%x: %x/%d(old) %x/%d(new)%n",
b& 0xff, sOld.charAt(0) & 0xffff, sNew.charAt(0) & 0xffff); b& 0xff,
sOld.charAt(0) & 0xffff, sOld.length(),
sNew.charAt(0) & 0xffff, sNew.length());
} }
} }
...@@ -250,6 +253,22 @@ if (is970) { ...@@ -250,6 +253,22 @@ if (is970) {
int b1Min = 0x40; int b1Min = 0x40;
int b1Max = 0xfe; int b1Max = 0xfe;
for (int b1 = 0x40; b1 < 0xff; b1++) { for (int b1 = 0x40; b1 < 0xff; b1++) {
if (!isEBCDIC) {
// decodable singlebyte b1
bb[0] = (byte)b1;
String sOld = new String(bb, oldCS);
String sNew = new String(bb, newCS);
if (!sOld.equals(sNew)) {
if (sOld.length() != 2 && sOld.charAt(0) != 0) {
// only prints we are NOT expected. above two are known issue
System.out.printf(" b1=%x: %x/%d(old) %x/%d(new)%n",
b1 & 0xff,
sOld.charAt(0) & 0xffff, sOld.length(),
sNew.charAt(0) & 0xffff, sNew.length());
continue;
}
}
}
for (int b2 = 0x40; b2 < 0xff; b2++) { for (int b2 = 0x40; b2 < 0xff; b2++) {
if (isEBCDIC) { if (isEBCDIC) {
bb[0] = 0x0e; bb[0] = 0x0e;
...@@ -268,7 +287,7 @@ if (is970) { ...@@ -268,7 +287,7 @@ if (is970) {
if (sOld.charAt(0) == 0 && sNew.charAt(0) == 0xfffd) if (sOld.charAt(0) == 0 && sNew.charAt(0) == 0xfffd)
continue; // known issude in old implementation continue; // known issude in old implementation
System.out.printf(" bb=<%x,%x> %x, %x%n", System.out.printf(" bb=<%x,%x> c(old)=%x, c(new)=%x%n",
b1, b2, sOld.charAt(0) & 0xffff, sNew.charAt(0) & 0xffff); b1, b2, sOld.charAt(0) & 0xffff, sNew.charAt(0) & 0xffff);
} }
} }
...@@ -486,6 +505,15 @@ if (sOld.charAt(0) == 0 && sNew.charAt(0) == 0xfffd) ...@@ -486,6 +505,15 @@ if (sOld.charAt(0) == 0 && sNew.charAt(0) == 0xfffd)
"IBM949C", "IBM949C",
"IBM1381", "IBM1381",
"IBM1383", "IBM1383",
"EUC_CN",
"EUC_KR",
"GBK",
"Johab",
"MS932",
"MS936",
"MS949",
"MS950",
}; };
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
......
/*
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 1234567
* @summary Test updated X11 charsets
* @build X11GB2312_OLD X11GBK_OLD X11KSC5601_OLD
*/
import java.nio.charset.*;
import java.nio.*;
import java.util.*;
public class TestX11CS {
static char[] decode(byte[] bb, Charset cs)
throws Exception {
CharsetDecoder dec = cs.newDecoder();
ByteBuffer bbf = ByteBuffer.wrap(bb);
CharBuffer cbf = CharBuffer.allocate(bb.length);
CoderResult cr = dec.decode(bbf, cbf, true);
if (cr != CoderResult.UNDERFLOW) {
System.out.println("DEC-----------------");
int pos = bbf.position();
System.out.printf(" cr=%s, bbf.pos=%d, bb[pos]=%x,%x,%x,%x%n",
cr.toString(), pos,
bb[pos++]&0xff, bb[pos++]&0xff,bb[pos++]&0xff, bb[pos++]&0xff);
throw new RuntimeException("Decoding err: " + cs.name());
}
char[] cc = new char[cbf.position()];
cbf.flip(); cbf.get(cc);
return cc;
}
static byte[] encode(char[] cc, Charset cs)
throws Exception {
ByteBuffer bbf = ByteBuffer.allocate(cc.length * 4);
CharBuffer cbf = CharBuffer.wrap(cc);
CharsetEncoder enc = cs.newEncoder();
CoderResult cr = enc.encode(cbf, bbf, true);
if (cr != CoderResult.UNDERFLOW) {
System.out.println("ENC-----------------");
int pos = cbf.position();
System.out.printf(" cr=%s, cbf.pos=%d, cc[pos]=%x%n",
cr.toString(), pos, cc[pos]&0xffff);
throw new RuntimeException("Encoding err: " + cs.name());
}
byte[] bb = new byte[bbf.position()];
bbf.flip(); bbf.get(bb);
return bb;
}
static char[] getChars(Charset newCS, Charset oldCS) {
CharsetEncoder enc = oldCS.newEncoder();
CharsetEncoder encNew = newCS.newEncoder();
char[] cc = new char[0x10000];
int pos = 0;
int i = 0;
while (i < 0x10000) {
if (enc.canEncode((char)i) != encNew.canEncode((char)i)) {
System.out.printf(" Err i=%x%n", i);
//throw new RuntimeException("canEncode() err!");
}
if (enc.canEncode((char)i)) {
cc[pos++] = (char)i;
}
i++;
}
return Arrays.copyOf(cc, pos);
}
static void compare(Charset newCS, Charset oldCS) throws Exception {
System.out.printf(" Diff <%s> <%s>...%n", newCS.name(), oldCS.name());
char[] cc = getChars(newCS, oldCS);
byte[] bb1 = encode(cc, newCS);
byte[] bb2 = encode(cc, oldCS);
if (!Arrays.equals(bb1, bb2)) {
System.out.printf(" encoding failed!%n");
}
char[] cc1 = decode(bb1, newCS);
char[] cc2 = decode(bb1, oldCS);
if (!Arrays.equals(cc1, cc2)) {
for (int i = 0; i < cc1.length; i++) {
if (cc1[i] != cc2[i]) {
System.out.printf("i=%d, cc1=%x cc2=%x, bb=<%x%x>%n",
i,
cc1[i]&0xffff, cc2[i]&0xffff,
bb1[i*2]&0xff, bb1[i*2+1]&0xff);
}
}
System.out.printf(" decoding failed%n");
}
}
public static void main(String[] args) throws Exception {
compare(new sun.awt.motif.X11GBK(),
new X11GBK_OLD());
compare(new sun.awt.motif.X11GB2312(),
new X11GB2312_OLD());
compare(new sun.awt.motif.X11KSC5601(),
new X11KSC5601_OLD());
}
}
/*
* Copyright 1996-2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
import java.nio.CharBuffer;
import java.nio.ByteBuffer;
import java.nio.charset.*;
import sun.nio.cs.ext.EUC_CN;
public class X11GB2312_OLD extends Charset {
public X11GB2312_OLD () {
super("X11GB2312-OLD", null);
}
public CharsetEncoder newEncoder() {
return new Encoder(this);
}
public CharsetDecoder newDecoder() {
return new Decoder(this);
}
public boolean contains(Charset cs) {
return cs instanceof X11GB2312_OLD;
}
private class Encoder extends EUC_CN_OLD.Encoder {
public Encoder(Charset cs) {
super(cs);
}
public boolean canEncode(char c) {
if (c <= 0x7F) {
return false;
}
return super.canEncode(c);
}
protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
char[] sa = src.array();
int sp = src.arrayOffset() + src.position();
int sl = src.arrayOffset() + src.limit();
byte[] da = dst.array();
int dp = dst.arrayOffset() + dst.position();
int dl = dst.arrayOffset() + dst.limit();
try {
while (sp < sl) {
char c = sa[sp];
if (c <= '\u007f')
return CoderResult.unmappableForLength(1);
int ncode = encodeDouble(c);
if (ncode != 0 && c != '\u0000' ) {
da[dp++] = (byte) ((ncode >> 8) & 0x7f);
da[dp++] = (byte) (ncode & 0x7f);
sp++;
continue;
}
return CoderResult.unmappableForLength(1);
}
return CoderResult.UNDERFLOW;
} finally {
src.position(sp - src.arrayOffset());
dst.position(dp - dst.arrayOffset());
}
}
public boolean isLegalReplacement(byte[] repl) {
return true;
}
}
private class Decoder extends EUC_CN_OLD.Decoder {
public Decoder(Charset cs) {
super(cs);
}
protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
byte[] sa = src.array();
int sp = src.arrayOffset() + src.position();
int sl = src.arrayOffset() + src.limit();
assert (sp <= sl);
sp = (sp <= sl ? sp : sl);
char[] da = dst.array();
int dp = dst.arrayOffset() + dst.position();
int dl = dst.arrayOffset() + dst.limit();
assert (dp <= dl);
dp = (dp <= dl ? dp : dl);
try {
while (sp < sl) {
if ( sl - sp < 2) {
return CoderResult.UNDERFLOW;
}
int b1 = sa[sp] & 0xFF | 0x80;
int b2 = sa[sp + 1] & 0xFF | 0x80;
char c = decodeDouble(b1, b2);
if (c == replacement().charAt(0)) {
return CoderResult.unmappableForLength(2);
}
if (dl - dp < 1)
return CoderResult.OVERFLOW;
da[dp++] = c;
sp +=2;
}
return CoderResult.UNDERFLOW;
} finally {
src.position(sp - src.arrayOffset());
dst.position(dp - dst.arrayOffset());
}
}
}
}
/* /*
* Copyright 1998-2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1999-2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -23,22 +23,34 @@ ...@@ -23,22 +23,34 @@
* have any questions. * have any questions.
*/ */
package sun.io;
import sun.nio.cs.ext.MS932DB; import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.CharsetDecoder;
import sun.nio.cs.ext.GBK;
/** public class X11GBK_OLD extends Charset {
* Tables and data to convert MS932 to Unicode public X11GBK_OLD () {
* super("X11GBK-OLD", null);
* @author ConverterGenerator tool }
*/ public CharsetEncoder newEncoder() {
return new Encoder(this);
}
public CharsetDecoder newDecoder() {
return new GBK_OLD.Decoder(this);
}
abstract class ByteToCharMS932DB extends ByteToCharDoubleByte { public boolean contains(Charset cs) {
return cs instanceof X11GBK_OLD;
}
public ByteToCharMS932DB() { private class Encoder extends GBK_OLD.Encoder {
super.index1 = MS932DB.Decoder.index1; public Encoder(Charset cs) {
super.index2 = MS932DB.Decoder.index2; super(cs);
start = 0x40; }
end = 0xFC; public boolean canEncode(char ch){
if (ch < 0x80) return false;
return super.canEncode(ch);
}
} }
} }
/*
* Copyright 1996-2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
import java.nio.CharBuffer;
import java.nio.ByteBuffer;
import java.nio.charset.*;
import sun.nio.cs.ext.EUC_KR;
public class X11KSC5601_OLD extends Charset {
public X11KSC5601_OLD () {
super("X11KSC5601-OLD", null);
}
public CharsetEncoder newEncoder() {
return new Encoder(this);
}
public CharsetDecoder newDecoder() {
return new Decoder(this);
}
public boolean contains(Charset cs) {
return cs instanceof X11KSC5601_OLD;
}
private class Encoder extends EUC_KR_OLD.Encoder {
public Encoder(Charset cs) {
super(cs);
}
public boolean canEncode(char c) {
if (c <= 0x7F) {
return false;
}
return super.canEncode(c);
}
protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
char[] sa = src.array();
int sp = src.arrayOffset() + src.position();
int sl = src.arrayOffset() + src.limit();
byte[] da = dst.array();
int dp = dst.arrayOffset() + dst.position();
int dl = dst.arrayOffset() + dst.limit();
try {
while (sp < sl) {
char c = sa[sp];
if (c <= '\u007f')
return CoderResult.unmappableForLength(1);
int ncode = encodeDouble(c);
if (ncode != 0 && c != '\u0000' ) {
da[dp++] = (byte) ((ncode >> 8) & 0x7f);
da[dp++] = (byte) (ncode & 0x7f);
sp++;
continue;
}
return CoderResult.unmappableForLength(1);
}
return CoderResult.UNDERFLOW;
} finally {
src.position(sp - src.arrayOffset());
dst.position(dp - dst.arrayOffset());
}
}
public boolean isLegalReplacement(byte[] repl) {
return true;
}
}
private class Decoder extends EUC_KR_OLD.Decoder {
public Decoder(Charset cs) {
super(cs);
}
protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
byte[] sa = src.array();
int sp = src.arrayOffset() + src.position();
int sl = src.arrayOffset() + src.limit();
assert (sp <= sl);
sp = (sp <= sl ? sp : sl);
char[] da = dst.array();
int dp = dst.arrayOffset() + dst.position();
int dl = dst.arrayOffset() + dst.limit();
assert (dp <= dl);
dp = (dp <= dl ? dp : dl);
try {
while (sp < sl) {
if ( sl - sp < 2) {
return CoderResult.UNDERFLOW;
}
int b1 = sa[sp] & 0xFF | 0x80;
int b2 = sa[sp + 1] & 0xFF | 0x80;
char c = decodeDouble(b1, b2);
if (c == replacement().charAt(0)) {
return CoderResult.unmappableForLength(2);
}
if (dl - dp < 1)
return CoderResult.OVERFLOW;
da[dp++] = c;
sp +=2;
}
return CoderResult.UNDERFLOW;
} finally {
src.position(sp - src.arrayOffset());
dst.position(dp - dst.arrayOffset());
}
}
}
}
/* /*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2008-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
* @bug 6706974 * @bug 6706974
* @summary Add krb5 test infrastructure * @summary Add krb5 test infrastructure
*/ */
import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.security.Security; import java.security.Security;
...@@ -50,17 +51,20 @@ public class CrossRealm implements CallbackHandler { ...@@ -50,17 +51,20 @@ public class CrossRealm implements CallbackHandler {
KDC kdc1 = KDC.create("RABBIT.HOLE"); KDC kdc1 = KDC.create("RABBIT.HOLE");
kdc1.addPrincipal("dummy", "bogus".toCharArray()); kdc1.addPrincipal("dummy", "bogus".toCharArray());
kdc1.addPrincipalRandKey("krbtgt/RABBIT.HOLE"); kdc1.addPrincipalRandKey("krbtgt/RABBIT.HOLE");
kdc1.addPrincipal("krbtgt/SNAKE.HOLE", "sharedsec".toCharArray()); kdc1.addPrincipal("krbtgt/SNAKE.HOLE@RABBIT.HOLE",
"rabbit->snake".toCharArray());
KDC kdc2 = KDC.create("SNAKE.HOLE"); KDC kdc2 = KDC.create("SNAKE.HOLE");
kdc2.addPrincipalRandKey("krbtgt/SNAKE.HOLE"); kdc2.addPrincipalRandKey("krbtgt/SNAKE.HOLE");
kdc2.addPrincipal("krbtgt/RABBIT.HOLE", "sharedsec".toCharArray()); kdc2.addPrincipal("krbtgt/SNAKE.HOLE@RABBIT.HOLE",
"rabbit->snake".toCharArray());
kdc2.addPrincipalRandKey("host/www.snake.hole"); kdc2.addPrincipalRandKey("host/www.snake.hole");
KDC.saveConfig("krb5-localkdc.conf", kdc1, kdc2, KDC.saveConfig("krb5-localkdc.conf", kdc1, kdc2,
"forwardable=true", "forwardable=true",
"[domain_realm]", "[domain_realm]",
".snake.hole=SNAKE.HOLE"); ".snake.hole=SNAKE.HOLE");
new File("krb5-localkdc.conf").deleteOnExit();
System.setProperty("java.security.krb5.conf", "krb5-localkdc.conf"); System.setProperty("java.security.krb5.conf", "krb5-localkdc.conf");
} }
...@@ -68,6 +72,7 @@ public class CrossRealm implements CallbackHandler { ...@@ -68,6 +72,7 @@ public class CrossRealm implements CallbackHandler {
Security.setProperty("auth.login.defaultCallbackHandler", "CrossRealm"); Security.setProperty("auth.login.defaultCallbackHandler", "CrossRealm");
System.setProperty("java.security.auth.login.config", "jaas-localkdc.conf"); System.setProperty("java.security.auth.login.config", "jaas-localkdc.conf");
System.setProperty("javax.security.auth.useSubjectCredsOnly", "false"); System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
new File("jaas-localkdc.conf").deleteOnExit();
FileOutputStream fos = new FileOutputStream("jaas-localkdc.conf"); FileOutputStream fos = new FileOutputStream("jaas-localkdc.conf");
fos.write(("com.sun.security.jgss.krb5.initiate {\n" + fos.write(("com.sun.security.jgss.krb5.initiate {\n" +
" com.sun.security.auth.module.Krb5LoginModule\n" + " com.sun.security.auth.module.Krb5LoginModule\n" +
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
* @test * @test
* @bug 6578647 * @bug 6578647
* @summary Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication() * @summary Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
* @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock HttpNegotiateServer
*/ */
import com.sun.net.httpserver.Headers; import com.sun.net.httpserver.Headers;
...@@ -40,12 +39,10 @@ import java.io.IOException; ...@@ -40,12 +39,10 @@ import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.InetAddress;
import java.net.PasswordAuthentication; import java.net.PasswordAuthentication;
import java.net.Proxy; import java.net.Proxy;
import java.net.URL; import java.net.URL;
import java.security.PrivilegedExceptionAction; import java.security.PrivilegedExceptionAction;
import java.net.UnknownHostException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javax.security.auth.Subject; import javax.security.auth.Subject;
...@@ -53,8 +50,6 @@ import org.ietf.jgss.GSSContext; ...@@ -53,8 +50,6 @@ import org.ietf.jgss.GSSContext;
import org.ietf.jgss.GSSCredential; import org.ietf.jgss.GSSCredential;
import org.ietf.jgss.GSSManager; import org.ietf.jgss.GSSManager;
import sun.security.jgss.GSSUtil; import sun.security.jgss.GSSUtil;
import sun.net.spi.nameservice.NameService;
import sun.net.spi.nameservice.NameServiceDescriptor;
import sun.security.krb5.Config; import sun.security.krb5.Config;
/** /**
...@@ -62,7 +57,7 @@ import sun.security.krb5.Config; ...@@ -62,7 +57,7 @@ import sun.security.krb5.Config;
* party uses JAAS login to get subjects and executes JGSS calls using * party uses JAAS login to get subjects and executes JGSS calls using
* Subject.doAs. * Subject.doAs.
*/ */
public class HttpNegotiateServer implements NameServiceDescriptor { public class HttpNegotiateServer {
// Two realm, web server in one, proxy server in another // Two realm, web server in one, proxy server in another
final static String REALM_WEB = "WEB.DOMAIN"; final static String REALM_WEB = "WEB.DOMAIN";
...@@ -142,12 +137,12 @@ public class HttpNegotiateServer implements NameServiceDescriptor { ...@@ -142,12 +137,12 @@ public class HttpNegotiateServer implements NameServiceDescriptor {
public static void main(String[] args) public static void main(String[] args)
throws Exception { throws Exception {
KDC kdcw = new KDC(REALM_WEB, 0, true); KDC kdcw = KDC.create(REALM_WEB);
kdcw.addPrincipal(WEB_USER, WEB_PASS); kdcw.addPrincipal(WEB_USER, WEB_PASS);
kdcw.addPrincipalRandKey("krbtgt/" + REALM_WEB); kdcw.addPrincipalRandKey("krbtgt/" + REALM_WEB);
kdcw.addPrincipalRandKey("HTTP/" + WEB_HOST); kdcw.addPrincipalRandKey("HTTP/" + WEB_HOST);
KDC kdcp = new KDC(REALM_PROXY, 0, true); KDC kdcp = KDC.create(REALM_PROXY);
kdcp.addPrincipal(PROXY_USER, PROXY_PASS); kdcp.addPrincipal(PROXY_USER, PROXY_PASS);
kdcp.addPrincipalRandKey("krbtgt/" + REALM_PROXY); kdcp.addPrincipalRandKey("krbtgt/" + REALM_PROXY);
kdcp.addPrincipalRandKey("HTTP/" + PROXY_HOST); kdcp.addPrincipalRandKey("HTTP/" + PROXY_HOST);
...@@ -306,36 +301,5 @@ public class HttpNegotiateServer implements NameServiceDescriptor { ...@@ -306,36 +301,5 @@ public class HttpNegotiateServer implements NameServiceDescriptor {
} }
} }
} }
@Override
public NameService createNameService() throws Exception {
NameService ns = new NameService() {
@Override
public InetAddress[] lookupAllHostAddr(String host)
throws UnknownHostException {
// Everything is localhost
return new InetAddress[]{
InetAddress.getByAddress(host, new byte[]{127,0,0,1})
};
}
@Override
public String getHostByAddr(byte[] addr)
throws UnknownHostException {
// No reverse lookup
throw new UnknownHostException();
}
};
return ns;
}
@Override
public String getProviderName() {
return "mock";
}
@Override
public String getType() {
return "ns";
}
} }
/*
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6851973
* @summary ignore incoming channel binding if acceptor does not set one
*/
import java.net.InetAddress;
import org.ietf.jgss.ChannelBinding;
import org.ietf.jgss.GSSException;
import sun.security.jgss.GSSUtil;
public class IgnoreChannelBinding {
public static void main(String[] args)
throws Exception {
new OneKDC(null).writeJAASConf();
Context c = Context.fromJAAS("client");
Context s = Context.fromJAAS("server");
// All silent
c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
Context.handshake(c, s);
// Initiator req, acceptor ignore
c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
c.x().setChannelBinding(new ChannelBinding(
InetAddress.getByName("client.rabbit.hole"),
InetAddress.getByName("host.rabbit.hole"),
new byte[0]
));
s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
Context.handshake(c, s);
// Both req, and match
c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
c.x().setChannelBinding(new ChannelBinding(
InetAddress.getByName("client.rabbit.hole"),
InetAddress.getByName("host.rabbit.hole"),
new byte[0]
));
s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
s.x().setChannelBinding(new ChannelBinding(
InetAddress.getByName("client.rabbit.hole"),
InetAddress.getByName("host.rabbit.hole"),
new byte[0]
));
Context.handshake(c, s);
// Both req, NOT match
c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
c.x().setChannelBinding(new ChannelBinding(
InetAddress.getByName("client.rabbit.hole"),
InetAddress.getByName("host.rabbit.hole"),
new byte[0]
));
s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
s.x().setChannelBinding(new ChannelBinding(
InetAddress.getByName("client.rabbit.hole"),
InetAddress.getByName("host.rabbit.hole"),
new byte[1] // 0 -> 1
));
try {
Context.handshake(c, s);
throw new Exception("Acceptor should reject initiator");
} catch (GSSException ge) {
// Expected bahavior
}
// Acceptor req, reject
c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
s.x().setChannelBinding(new ChannelBinding(
InetAddress.getByName("client.rabbit.hole"),
InetAddress.getByName("host.rabbit.hole"),
new byte[0]
));
try {
Context.handshake(c, s);
throw new Exception("Acceptor should reject initiator");
} catch (GSSException ge) {
// Expected bahavior
if (ge.getMajor() != GSSException.BAD_BINDINGS) {
throw ge;
}
}
}
}
...@@ -30,6 +30,8 @@ import java.lang.reflect.Method; ...@@ -30,6 +30,8 @@ import java.lang.reflect.Method;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import sun.net.spi.nameservice.NameService;
import sun.net.spi.nameservice.NameServiceDescriptor;
import sun.security.krb5.*; import sun.security.krb5.*;
import sun.security.krb5.internal.*; import sun.security.krb5.internal.*;
import sun.security.krb5.internal.ccache.CredentialsCache; import sun.security.krb5.internal.ccache.CredentialsCache;
...@@ -118,14 +120,16 @@ public class KDC { ...@@ -118,14 +120,16 @@ public class KDC {
// The random generator to generate random keys (including session keys) // The random generator to generate random keys (including session keys)
private static SecureRandom secureRandom = new SecureRandom(); private static SecureRandom secureRandom = new SecureRandom();
// Principal db // Principal db. principal -> pass
private Map<String,char[]> passwords = new HashMap<String,char[]>(); private Map<String,char[]> passwords = new HashMap<String,char[]>();
// Realm name // Realm name
private String realm; private String realm;
// The request/response job queue // KDC
private BlockingQueue<Job> q = new ArrayBlockingQueue<Job>(100); private String kdc;
// Service port number // Service port number
private int port; private int port;
// The request/response job queue
private BlockingQueue<Job> q = new ArrayBlockingQueue<Job>(100);
// Options // Options
private Map<Option,Object> options = new HashMap<Option,Object>(); private Map<Option,Object> options = new HashMap<Option,Object>();
...@@ -139,33 +143,21 @@ public class KDC { ...@@ -139,33 +143,21 @@ public class KDC {
PREAUTH_REQUIRED, PREAUTH_REQUIRED,
}; };
static {
System.setProperty("sun.net.spi.nameservice.provider.1", "ns,mock");
}
/** /**
* A standalone KDC server. * A standalone KDC server.
* @param args
* @throws java.lang.Exception
*/ */
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
if (args.length > 0) { KDC kdc = create("RABBIT.HOLE", "kdc.rabbit,hole", 0, false);
if (args[0].equals("-help") || args[0].equals("--help")) {
System.out.println("Usage:");
System.out.println(" java " + KDC.class + " " +
"Start KDC on port 8888");
return;
}
}
String localhost = "localhost";
try {
localhost = InetAddress.getByName(localhost)
.getCanonicalHostName();
} catch (UnknownHostException uhe) {
; // Ignore, localhost is still "localhost"
}
KDC kdc = create("RABBIT.HOLE", 8888, false);
kdc.addPrincipal("dummy", "bogus".toCharArray()); kdc.addPrincipal("dummy", "bogus".toCharArray());
kdc.addPrincipal("foo", "bar".toCharArray()); kdc.addPrincipal("foo", "bar".toCharArray());
kdc.addPrincipalRandKey("krbtgt/" + kdc.realm); kdc.addPrincipalRandKey("krbtgt/RABBIT.HOLE");
kdc.addPrincipalRandKey("server/" + localhost); kdc.addPrincipalRandKey("server/host.rabbit.hole");
kdc.addPrincipalRandKey("backend/" + localhost); kdc.addPrincipalRandKey("backend/host.rabbit.hole");
KDC.saveConfig("krb5.conf", kdc, "forwardable = true");
} }
/** /**
...@@ -175,7 +167,7 @@ public class KDC { ...@@ -175,7 +167,7 @@ public class KDC {
* @throws java.io.IOException for any socket creation error * @throws java.io.IOException for any socket creation error
*/ */
public static KDC create(String realm) throws IOException { public static KDC create(String realm) throws IOException {
return create(realm, 0, true); return create(realm, "kdc." + realm.toLowerCase(), 0, true);
} }
/** /**
...@@ -187,8 +179,8 @@ public class KDC { ...@@ -187,8 +179,8 @@ public class KDC {
* @return the running KDC instance * @return the running KDC instance
* @throws java.io.IOException for any socket creation error * @throws java.io.IOException for any socket creation error
*/ */
public static KDC create(String realm, int port, boolean asDaemon) throws IOException { public static KDC create(String realm, String kdc, int port, boolean asDaemon) throws IOException {
return new KDC(realm, port, asDaemon); return new KDC(realm, kdc, port, asDaemon);
} }
/** /**
...@@ -228,10 +220,7 @@ public class KDC { ...@@ -228,10 +220,7 @@ public class KDC {
KeyTab ktab = KeyTab.create(tab); KeyTab ktab = KeyTab.create(tab);
for (KDC kdc: kdcs) { for (KDC kdc: kdcs) {
for (String name : kdc.passwords.keySet()) { for (String name : kdc.passwords.keySet()) {
if (name.equals("krbtgt/" + kdc.realm)) { ktab.addEntry(new PrincipalName(name,
continue;
}
ktab.addEntry(new PrincipalName(name + "@" + kdc.realm,
name.indexOf('/') < 0 ? name.indexOf('/') < 0 ?
PrincipalName.KRB_NT_UNKNOWN : PrincipalName.KRB_NT_UNKNOWN :
PrincipalName.KRB_NT_SRV_HST), PrincipalName.KRB_NT_SRV_HST),
...@@ -255,6 +244,9 @@ public class KDC { ...@@ -255,6 +244,9 @@ public class KDC {
* @param pass the password for the principal * @param pass the password for the principal
*/ */
public void addPrincipal(String user, char[] pass) { public void addPrincipal(String user, char[] pass) {
if (user.indexOf('@') < 0) {
user = user + "@" + realm;
}
passwords.put(user, pass); passwords.put(user, pass);
} }
...@@ -264,7 +256,7 @@ public class KDC { ...@@ -264,7 +256,7 @@ public class KDC {
* form of host/f.q.d.n * form of host/f.q.d.n
*/ */
public void addPrincipalRandKey(String user) { public void addPrincipalRandKey(String user) {
passwords.put(user, randomPassword()); addPrincipal(user, randomPassword());
} }
/** /**
...@@ -275,6 +267,14 @@ public class KDC { ...@@ -275,6 +267,14 @@ public class KDC {
return realm; return realm;
} }
/**
* Returns the name of kdc
* @return the name of kdc
*/
public String getKDC() {
return kdc;
}
/** /**
* Writes a krb5.conf for one or more KDC that includes KDC locations for * Writes a krb5.conf for one or more KDC that includes KDC locations for
* each realm and the default realm name. You can also add extra strings * each realm and the default realm name. You can also add extra strings
...@@ -299,7 +299,7 @@ public class KDC { ...@@ -299,7 +299,7 @@ public class KDC {
* *
* [realms] * [realms]
* REALM.NAME = { * REALM.NAME = {
* kdc = localhost:port_number * kdc = host:port_number
* } * }
* </pre> * </pre>
* *
...@@ -320,10 +320,10 @@ public class KDC { ...@@ -320,10 +320,10 @@ public class KDC {
* *
* [realms] * [realms]
* KDC1.NAME = { * KDC1.NAME = {
* kdc = localhost:port1 * kdc = host:port1
* } * }
* KDC2.NAME = { * KDC2.NAME = {
* kdc = localhost:port2 * kdc = host:port2
* } * }
* </pre> * </pre>
* @param file the name of the file to write into * @param file the name of the file to write into
...@@ -372,16 +372,17 @@ public class KDC { ...@@ -372,16 +372,17 @@ public class KDC {
* Private constructor, cannot be called outside. * Private constructor, cannot be called outside.
* @param realm * @param realm
*/ */
private KDC(String realm) { private KDC(String realm, String kdc) {
this.realm = realm; this.realm = realm;
this.kdc = kdc;
} }
/** /**
* A constructor that starts the KDC service also. * A constructor that starts the KDC service also.
*/ */
protected KDC(String realm, int port, boolean asDaemon) protected KDC(String realm, String kdc, int port, boolean asDaemon)
throws IOException { throws IOException {
this(realm); this(realm, kdc);
startServer(port, asDaemon); startServer(port, asDaemon);
} }
/** /**
...@@ -426,7 +427,11 @@ public class KDC { ...@@ -426,7 +427,11 @@ public class KDC {
* the database. * the database.
*/ */
private char[] getPassword(PrincipalName p) throws KrbException { private char[] getPassword(PrincipalName p) throws KrbException {
char[] pass = passwords.get(p.getNameString()); String pn = p.toString();
if (p.getRealmString() == null) {
pn = pn + "@" + getRealm();
}
char[] pass = passwords.get(pn);
if (pass == null) { if (pass == null) {
throw new KrbException(Krb5.KDC_ERR_C_PRINCIPAL_UNKNOWN); throw new KrbException(Krb5.KDC_ERR_C_PRINCIPAL_UNKNOWN);
} }
...@@ -434,29 +439,18 @@ public class KDC { ...@@ -434,29 +439,18 @@ public class KDC {
} }
/** /**
* Returns the salt string for the principal. For normal users, the * Returns the salt string for the principal.
* concatenation for the realm name and the sections of the principal;
* for krgtgt/A@B and krbtgt/B@A, always return AB (so that inter-realm
* principals have the same key).
* @param p principal * @param p principal
* @return the salt * @return the salt
*/ */
private String getSalt(PrincipalName p) { private String getSalt(PrincipalName p) {
String[] ns = p.getNameStrings(); String[] ns = p.getNameStrings();
if (ns[0].equals("krbtgt") && ns.length > 1) { String s = p.getRealmString();
// Shared cross-realm keys must be the same if (s == null) s = getRealm();
if (ns[1].compareTo(realm) < 0) { for (String n: p.getNameStrings()) {
return ns[1] + realm; s += n;
} else {
return realm + ns[1];
}
} else {
String s = getRealm();
for (String n: p.getNameStrings()) {
s += n;
}
return s;
} }
return s;
} }
/** /**
...@@ -525,14 +519,8 @@ public class KDC { ...@@ -525,14 +519,8 @@ public class KDC {
EncryptedData ed = apReq.authenticator; EncryptedData ed = apReq.authenticator;
tkt = apReq.ticket; tkt = apReq.ticket;
etype = tkt.encPart.getEType(); etype = tkt.encPart.getEType();
EncryptionKey kkey = null; tkt.sname.setRealm(tkt.realm);
if (!tkt.realm.toString().equals(realm)) { EncryptionKey kkey = keyForUser(tkt.sname, etype);
if (tkt.sname.getNameString().equals("krbtgt/" + realm)) {
kkey = keyForUser(new PrincipalName("krbtgt/" + tkt.realm.toString(), realm), etype);
}
} else {
kkey = keyForUser(tkt.sname, etype);
}
byte[] bb = tkt.encPart.decrypt(kkey, KeyUsage.KU_TICKET); byte[] bb = tkt.encPart.decrypt(kkey, KeyUsage.KU_TICKET);
DerInputStream derIn = new DerInputStream(bb); DerInputStream derIn = new DerInputStream(bb);
DerValue der = derIn.getDerValue(); DerValue der = derIn.getDerValue();
...@@ -857,10 +845,13 @@ public class KDC { ...@@ -857,10 +845,13 @@ public class KDC {
/** /**
* Generates a line for a KDC to put inside [realms] of krb5.conf * Generates a line for a KDC to put inside [realms] of krb5.conf
* @param kdc the KDC * @param kdc the KDC
* @return REALM.NAME = { kdc = localhost:port } * @return REALM.NAME = { kdc = host:port }
*/ */
private static String realmLineForKDC(KDC kdc) { private static String realmLineForKDC(KDC kdc) {
return String.format(" %s = {\n kdc = localhost:%d\n }\n", kdc.realm, kdc.port); return String.format(" %s = {\n kdc = %s:%d\n }\n",
kdc.realm,
kdc.kdc,
kdc.port);
} }
/** /**
...@@ -1000,4 +991,37 @@ public class KDC { ...@@ -1000,4 +991,37 @@ public class KDC {
} }
} }
} }
public static class KDCNameService implements NameServiceDescriptor {
@Override
public NameService createNameService() throws Exception {
NameService ns = new NameService() {
@Override
public InetAddress[] lookupAllHostAddr(String host)
throws UnknownHostException {
// Everything is localhost
return new InetAddress[]{
InetAddress.getByAddress(host, new byte[]{127,0,0,1})
};
}
@Override
public String getHostByAddr(byte[] addr)
throws UnknownHostException {
// No reverse lookup, PrincipalName use original string
throw new UnknownHostException();
}
};
return ns;
}
@Override
public String getProviderName() {
return "mock";
}
@Override
public String getType() {
return "ns";
}
}
} }
/* /*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2008-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -46,35 +46,22 @@ import sun.security.krb5.Config; ...@@ -46,35 +46,22 @@ import sun.security.krb5.Config;
*/ */
public class OneKDC extends KDC { public class OneKDC extends KDC {
// The krb5 codes would try to canonicalize hostnames before creating
// a service principal name, so let's find out the canonicalized form
// of localhost first. The following codes mimic the process inside
// PrincipalName.java.
static String localhost = "localhost";
static {
try {
localhost = InetAddress.getByName(localhost)
.getCanonicalHostName();
} catch (UnknownHostException uhe) {
; // Ignore, localhost is still "localhost"
}
}
public static final String USER = "dummy"; public static final String USER = "dummy";
public static final char[] PASS = "bogus".toCharArray(); public static final char[] PASS = "bogus".toCharArray();
public static String SERVER = "server/" + localhost;
public static String BACKEND = "backend/" + localhost;
public static final String KRB5_CONF = "localkdc-krb5.conf"; public static final String KRB5_CONF = "localkdc-krb5.conf";
public static final String KTAB = "localkdc.ktab"; public static final String KTAB = "localkdc.ktab";
public static final String JAAS_CONF = "localkdc-jaas.conf"; public static final String JAAS_CONF = "localkdc-jaas.conf";
public static final String REALM = "RABBIT.HOLE"; public static final String REALM = "RABBIT.HOLE";
public static String SERVER = "server/host." + REALM.toLowerCase();
public static String BACKEND = "backend/host." + REALM.toLowerCase();
public static String KDCHOST = "kdc." + REALM.toLowerCase();
/** /**
* Creates the KDC and starts it. * Creates the KDC and starts it.
* @param etype Encryption type, null if not specified * @param etype Encryption type, null if not specified
* @throws java.lang.Exception if there's anything wrong * @throws java.lang.Exception if there's anything wrong
*/ */
public OneKDC(String etype) throws Exception { public OneKDC(String etype) throws Exception {
super(REALM, 0, true); super(REALM, KDCHOST, 0, true);
addPrincipal(USER, PASS); addPrincipal(USER, PASS);
addPrincipalRandKey("krbtgt/" + REALM); addPrincipalRandKey("krbtgt/" + REALM);
addPrincipalRandKey(SERVER); addPrincipalRandKey(SERVER);
......
# #
# Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. # Copyright 2008-2009 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -41,25 +41,31 @@ OS=`uname -s` ...@@ -41,25 +41,31 @@ OS=`uname -s`
case "$OS" in case "$OS" in
Windows_* ) Windows_* )
FS="\\" FS="\\"
SEP=";"
;; ;;
* ) * )
FS="/" FS="/"
SEP=":"
;; ;;
esac esac
${TESTJAVA}${FS}bin${FS}javac -d . \ ${TESTJAVA}${FS}bin${FS}javac -XDignore.symbol.file -d . \
${TESTSRC}${FS}BasicKrb5Test.java \ ${TESTSRC}${FS}BasicKrb5Test.java \
${TESTSRC}${FS}KDC.java \ ${TESTSRC}${FS}KDC.java \
${TESTSRC}${FS}OneKDC.java \ ${TESTSRC}${FS}OneKDC.java \
${TESTSRC}${FS}Action.java \ ${TESTSRC}${FS}Action.java \
${TESTSRC}${FS}Context.java \ ${TESTSRC}${FS}Context.java \
|| exit 10 || exit 10
${TESTJAVA}${FS}bin${FS}java -Dtest.src=$TESTSRC BasicKrb5Test || exit 100
${TESTJAVA}${FS}bin${FS}java -Dtest.src=$TESTSRC BasicKrb5Test des-cbc-crc || exit 1 # Add $TESTSRC to classpath so that customized nameservice can be used
${TESTJAVA}${FS}bin${FS}java -Dtest.src=$TESTSRC BasicKrb5Test des-cbc-md5 || exit 3 J="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}. BasicKrb5Test"
${TESTJAVA}${FS}bin${FS}java -Dtest.src=$TESTSRC BasicKrb5Test des3-cbc-sha1 || exit 16
${TESTJAVA}${FS}bin${FS}java -Dtest.src=$TESTSRC BasicKrb5Test aes128-cts || exit 17 $J || exit 100
${TESTJAVA}${FS}bin${FS}java -Dtest.src=$TESTSRC BasicKrb5Test aes256-cts || exit 18 $J des-cbc-crc || exit 1
${TESTJAVA}${FS}bin${FS}java -Dtest.src=$TESTSRC BasicKrb5Test rc4-hmac || exit 23 $J des-cbc-md5 || exit 3
$J des3-cbc-sha1 || exit 16
$J aes128-cts || exit 17
$J aes256-cts || exit 18
$J rc4-hmac || exit 23
exit 0 exit 0
#
# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# @test
# @bug 6712755
# @summary jarsigner fails to sign itextasian.jar since 1.5.0_b14, it works with 1.5.0_13
#
# @run shell emptymanifest.sh
#
if [ "${TESTJAVA}" = "" ] ; then
JAVAC_CMD=`which javac`
TESTJAVA=`dirname $JAVAC_CMD`/..
fi
# set platform-dependent variables
OS=`uname -s`
case "$OS" in
Windows_* )
FS="\\"
;;
* )
FS="/"
;;
esac
KS=emptymanifest.jks
JFILE=em.jar
KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS"
JAR=$TESTJAVA${FS}bin${FS}jar
JARSIGNER=$TESTJAVA${FS}bin${FS}jarsigner
rm $KS $JFILE
echo A > A
echo B > B
mkdir META-INF
printf "\r\n" > META-INF${FS}MANIFEST.MF
zip $JFILE META-INF${FS}MANIFEST.MF A B
$KT -alias a -dname CN=a -keyalg rsa -genkey -validity 300
$JARSIGNER -keystore $KS -storepass changeit $JFILE a || exit 1
$JARSIGNER -keystore $KS -verify -debug -strict $JFILE || exit 2
exit 0
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册