提交 215b1588 编写于 作者: L lana

Merge

...@@ -93,4 +93,6 @@ e250cef36ea05e627e7e6f7d75e5e19f529e2ba3 jdk7-b114 ...@@ -93,4 +93,6 @@ e250cef36ea05e627e7e6f7d75e5e19f529e2ba3 jdk7-b114
1657ed4e1d86c8aa2028ab5a41f9da1ac4a369f8 jdk7-b116 1657ed4e1d86c8aa2028ab5a41f9da1ac4a369f8 jdk7-b116
3e6726bbf80a4254ecd01051c8ed77ee19325e46 jdk7-b117 3e6726bbf80a4254ecd01051c8ed77ee19325e46 jdk7-b117
b357910aa04aead2a16b6d6ff395a8df4b51d1dd jdk7-b118 b357910aa04aead2a16b6d6ff395a8df4b51d1dd jdk7-b118
ecab7eefb8f2326fd90fb632f47f1b6f81e928f8 jdk7-b119
37d74e29687cf07c2bf9411af58c7e42440855c3 jdk7-b120 37d74e29687cf07c2bf9411af58c7e42440855c3 jdk7-b120
a661d8587b5d8986aacae086f5df66af9e1a96b1 jdk7-b121
...@@ -83,14 +83,19 @@ ifndef CLOSED_SRC ...@@ -83,14 +83,19 @@ ifndef CLOSED_SRC
CLOSED_SRC = $(BUILDDIR)/../src/closed CLOSED_SRC = $(BUILDDIR)/../src/closed
endif endif
# If we have no closed directory, force it to an openjdk build # If CLOSE_SRC_INCLUDED isn't set to true, check if there's any
CLOSED_SRC_DIR_EXISTS := $(shell \ # closed directory.
ifneq ($(CLOSED_SRC_INCLUDED), true)
CLOSED_SRC_INCLUDED := $(shell \
if [ -d $(CLOSED_SRC) ] ; then \ if [ -d $(CLOSED_SRC) ] ; then \
echo true; \ echo true; \
else \ else \
echo false; \ echo false; \
fi) fi)
ifeq ($(CLOSED_SRC_DIR_EXISTS), false) endif
# Set OPENJDK based on CLOSED_SRC_INCLUDED
ifeq ($(CLOSED_SRC_INCLUDED), false)
OPENJDK = true OPENJDK = true
endif endif
......
...@@ -85,6 +85,7 @@ FILES_src = \ ...@@ -85,6 +85,7 @@ FILES_src = \
sun/io/ByteToCharCp500.java \ sun/io/ByteToCharCp500.java \
sun/io/ByteToCharCp737.java \ sun/io/ByteToCharCp737.java \
sun/io/ByteToCharCp775.java \ sun/io/ByteToCharCp775.java \
sun/io/ByteToCharCp833.java \
sun/io/ByteToCharCp834.java \ sun/io/ByteToCharCp834.java \
sun/io/ByteToCharCp838.java \ sun/io/ByteToCharCp838.java \
sun/io/ByteToCharCp850.java \ sun/io/ByteToCharCp850.java \
...@@ -214,6 +215,7 @@ FILES_src = \ ...@@ -214,6 +215,7 @@ FILES_src = \
sun/io/CharToByteCp500.java \ sun/io/CharToByteCp500.java \
sun/io/CharToByteCp737.java \ sun/io/CharToByteCp737.java \
sun/io/CharToByteCp775.java \ sun/io/CharToByteCp775.java \
sun/io/CharToByteCp833.java \
sun/io/CharToByteCp834.java \ sun/io/CharToByteCp834.java \
sun/io/CharToByteCp838.java \ sun/io/CharToByteCp838.java \
sun/io/CharToByteCp850.java \ sun/io/CharToByteCp850.java \
...@@ -331,6 +333,7 @@ FILES_gen_extcs = \ ...@@ -331,6 +333,7 @@ FILES_gen_extcs = \
sun/nio/cs/ext/IBM420.java \ sun/nio/cs/ext/IBM420.java \
sun/nio/cs/ext/IBM424.java \ sun/nio/cs/ext/IBM424.java \
sun/nio/cs/ext/IBM500.java \ sun/nio/cs/ext/IBM500.java \
sun/nio/cs/ext/IBM833.java \
sun/nio/cs/ext/IBM838.java \ sun/nio/cs/ext/IBM838.java \
sun/nio/cs/ext/IBM856.java \ sun/nio/cs/ext/IBM856.java \
sun/nio/cs/ext/IBM860.java \ sun/nio/cs/ext/IBM860.java \
......
0x5A U+FF01
0x7F U+FF02
0x7B U+FF03
0x5B U+FF04
0x6C U+FF05
0x50 U+FF06
0x7D U+FF07
0x4D U+FF08
0x5D U+FF09
0x5C U+FF0A
0x4E U+FF0B
0x6B U+FF0C
0x60 U+FF0D
0x4B U+FF0E
0x61 U+FF0F
0xF0 U+FF10
0xF1 U+FF11
0xF2 U+FF12
0xF3 U+FF13
0xF4 U+FF14
0xF5 U+FF15
0xF6 U+FF16
0xF7 U+FF17
0xF8 U+FF18
0xF9 U+FF19
0x7A U+FF1A
0x5E U+FF1B
0x4C U+FF1C
0x7E U+FF1D
0x6E U+FF1E
0x6F U+FF1F
0x7C U+FF20
0xC1 U+FF21
0xC2 U+FF22
0xC3 U+FF23
0xC4 U+FF24
0xC5 U+FF25
0xC6 U+FF26
0xC7 U+FF27
0xC8 U+FF28
0xC9 U+FF29
0xD1 U+FF2A
0xD2 U+FF2B
0xD3 U+FF2C
0xD4 U+FF2D
0xD5 U+FF2E
0xD6 U+FF2F
0xD7 U+FF30
0xD8 U+FF31
0xD9 U+FF32
0xE2 U+FF33
0xE3 U+FF34
0xE4 U+FF35
0xE5 U+FF36
0xE6 U+FF37
0xE7 U+FF38
0xE8 U+FF39
0xE9 U+FF3A
0x70 U+FF3B
0xB2 U+FF3C
0x80 U+FF3D
0xB0 U+FF3E
0x6D U+FF3F
0x79 U+FF40
0x81 U+FF41
0x82 U+FF42
0x83 U+FF43
0x84 U+FF44
0x85 U+FF45
0x86 U+FF46
0x87 U+FF47
0x88 U+FF48
0x89 U+FF49
0x91 U+FF4A
0x92 U+FF4B
0x93 U+FF4C
0x94 U+FF4D
0x95 U+FF4E
0x96 U+FF4F
0x97 U+FF50
0x98 U+FF51
0x99 U+FF52
0xA2 U+FF53
0xA3 U+FF54
0xA4 U+FF55
0xA5 U+FF56
0xA6 U+FF57
0xA7 U+FF58
0xA8 U+FF59
0xA9 U+FF5A
0xC0 U+FF5B
0x4F U+FF5C
0xD0 U+FF5D
0xA1 U+FF5E
0x00 U+0000
0x01 U+0001
0x02 U+0002
0x03 U+0003
0x37 U+0004
0x2D U+0005
0x2E U+0006
0x2F U+0007
0x16 U+0008
0x05 U+0009
0x25 U+000A
0x0B U+000B
0x0C U+000C
0x0D U+000D
0x0E U+000E
0x0F U+000F
0x10 U+0010
0x11 U+0011
0x12 U+0012
0x13 U+0013
0x3C U+0014
0x3D U+0015
0x32 U+0016
0x26 U+0017
0x18 U+0018
0x19 U+0019
0x3F U+001A
0x27 U+001B
0x1C U+001C
0x1D U+001D
0x1E U+001E
0x1F U+001F
0x40 U+0020
0x5A U+0021
0x7F U+0022
0x7B U+0023
0x5B U+0024
0x6C U+0025
0x50 U+0026
0x7D U+0027
0x4D U+0028
0x5D U+0029
0x5C U+002A
0x4E U+002B
0x6B U+002C
0x60 U+002D
0x4B U+002E
0x61 U+002F
0xF0 U+0030
0xF1 U+0031
0xF2 U+0032
0xF3 U+0033
0xF4 U+0034
0xF5 U+0035
0xF6 U+0036
0xF7 U+0037
0xF8 U+0038
0xF9 U+0039
0x7A U+003A
0x5E U+003B
0x4C U+003C
0x7E U+003D
0x6E U+003E
0x6F U+003F
0x7C U+0040
0xC1 U+0041
0xC2 U+0042
0xC3 U+0043
0xC4 U+0044
0xC5 U+0045
0xC6 U+0046
0xC7 U+0047
0xC8 U+0048
0xC9 U+0049
0xD1 U+004A
0xD2 U+004B
0xD3 U+004C
0xD4 U+004D
0xD5 U+004E
0xD6 U+004F
0xD7 U+0050
0xD8 U+0051
0xD9 U+0052
0xE2 U+0053
0xE3 U+0054
0xE4 U+0055
0xE5 U+0056
0xE6 U+0057
0xE7 U+0058
0xE8 U+0059
0xE9 U+005A
0x70 U+005B
0xB2 U+005C
0x80 U+005D
0xB0 U+005E
0x6D U+005F
0x79 U+0060
0x81 U+0061
0x82 U+0062
0x83 U+0063
0x84 U+0064
0x85 U+0065
0x86 U+0066
0x87 U+0067
0x88 U+0068
0x89 U+0069
0x91 U+006A
0x92 U+006B
0x93 U+006C
0x94 U+006D
0x95 U+006E
0x96 U+006F
0x97 U+0070
0x98 U+0071
0x99 U+0072
0xA2 U+0073
0xA3 U+0074
0xA4 U+0075
0xA5 U+0076
0xA6 U+0077
0xA7 U+0078
0xA8 U+0079
0xA9 U+007A
0xC0 U+007B
0x4F U+007C
0xD0 U+007D
0xA1 U+007E
0x07 U+007F
0x20 U+0080
0x21 U+0081
0x22 U+0082
0x23 U+0083
0x24 U+0084
0x15 U+0085
0x06 U+0086
0x17 U+0087
0x28 U+0088
0x29 U+0089
0x2A U+008A
0x2B U+008B
0x2C U+008C
0x09 U+008D
0x0A U+008E
0x1B U+008F
0x30 U+0090
0x31 U+0091
0x1A U+0092
0x33 U+0093
0x34 U+0094
0x35 U+0095
0x36 U+0096
0x08 U+0097
0x38 U+0098
0x39 U+0099
0x3A U+009A
0x3B U+009B
0x04 U+009C
0x14 U+009D
0x3E U+009E
0xFF U+009F
0x4A U+00A2
0x6A U+00A6
0x5F U+00AC
0xA0 U+203E
0xE0 U+20A9
0x42 U+FFA0
0x43 U+FFA1
0x44 U+FFA2
0x45 U+FFA3
0x46 U+FFA4
0x47 U+FFA5
0x48 U+FFA6
0x49 U+FFA7
0x52 U+FFA8
0x53 U+FFA9
0x54 U+FFAA
0x55 U+FFAB
0x56 U+FFAC
0x57 U+FFAD
0x58 U+FFAE
0x59 U+FFAF
0x62 U+FFB0
0x63 U+FFB1
0x64 U+FFB2
0x65 U+FFB3
0x66 U+FFB4
0x67 U+FFB5
0x68 U+FFB6
0x69 U+FFB7
0x72 U+FFB8
0x73 U+FFB9
0x74 U+FFBA
0x75 U+FFBB
0x76 U+FFBC
0x77 U+FFBD
0x78 U+FFBE
0x8A U+FFC2
0x8B U+FFC3
0x8C U+FFC4
0x8D U+FFC5
0x8E U+FFC6
0x8F U+FFC7
0x9A U+FFCA
0x9B U+FFCB
0x9C U+FFCC
0x9D U+FFCD
0x9E U+FFCE
0x9F U+FFCF
0xAA U+FFD2
0xAB U+FFD3
0xAC U+FFD4
0xAD U+FFD5
0xAE U+FFD6
0xAF U+FFD7
0xBA U+FFDA
0xBB U+FFDB
0xBC U+FFDC
...@@ -32,6 +32,7 @@ IBM297 IBM297 Cp297 false sun.nio.cs.ext ...@@ -32,6 +32,7 @@ IBM297 IBM297 Cp297 false sun.nio.cs.ext
IBM420 IBM420 Cp420 false sun.nio.cs.ext IBM420 IBM420 Cp420 false sun.nio.cs.ext
IBM424 IBM424 Cp424 false sun.nio.cs.ext IBM424 IBM424 Cp424 false sun.nio.cs.ext
IBM500 IBM500 Cp500 false sun.nio.cs.ext IBM500 IBM500 Cp500 false sun.nio.cs.ext
IBM833 x-IBM833 Cp833 false sun.nio.cs.ext
IBM838 IBM-Thai Cp838 false sun.nio.cs.ext IBM838 IBM-Thai Cp838 false sun.nio.cs.ext
IBM856 x-IBM856 Cp856 false sun.nio.cs.ext IBM856 x-IBM856 Cp856 false sun.nio.cs.ext
IBM860 IBM860 Cp860 false sun.nio.cs.ext IBM860 IBM860 Cp860 false sun.nio.cs.ext
......
/* /*
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2010, Oracle and/or its affiliates. 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
...@@ -192,7 +192,11 @@ class CharacterData00 extends CharacterData { ...@@ -192,7 +192,11 @@ class CharacterData00 extends CharacterData {
case 0x2C6D : mapChar = 0x0251; break; case 0x2C6D : mapChar = 0x0251; break;
case 0x2C6E : mapChar = 0x0271; break; case 0x2C6E : mapChar = 0x0271; break;
case 0x2C6F : mapChar = 0x0250; break; case 0x2C6F : mapChar = 0x0250; break;
case 0x2C70 : mapChar = 0x0252; break;
case 0x2C7E : mapChar = 0x023F; break;
case 0x2C7F : mapChar = 0x0240; break;
case 0xA77D : mapChar = 0x1D79; break; case 0xA77D : mapChar = 0x1D79; break;
case 0xA78D : mapChar = 0x0265; break;
// default mapChar is already set, so no // default mapChar is already set, so no
// need to redo it here. // need to redo it here.
// default : mapChar = ch; // default : mapChar = ch;
...@@ -246,8 +250,12 @@ class CharacterData00 extends CharacterData { ...@@ -246,8 +250,12 @@ class CharacterData00 extends CharacterData {
case 0x1FC3 : mapChar = 0x1FCC; break; case 0x1FC3 : mapChar = 0x1FCC; break;
case 0x1FF3 : mapChar = 0x1FFC; break; case 0x1FF3 : mapChar = 0x1FFC; break;
case 0x023F : mapChar = 0x2C7E; break;
case 0x0240 : mapChar = 0x2C7F; break;
case 0x0250 : mapChar = 0x2C6F; break; case 0x0250 : mapChar = 0x2C6F; break;
case 0x0251 : mapChar = 0x2C6D; break; case 0x0251 : mapChar = 0x2C6D; break;
case 0x0252 : mapChar = 0x2C70; break;
case 0x0265 : mapChar = 0xA78D; break;
case 0x026B : mapChar = 0x2C62; break; case 0x026B : mapChar = 0x2C62; break;
case 0x0271 : mapChar = 0x2C6E; break; case 0x0271 : mapChar = 0x2C6E; break;
case 0x027D : mapChar = 0x2C64; break; case 0x027D : mapChar = 0x2C64; break;
...@@ -487,8 +495,12 @@ class CharacterData00 extends CharacterData { ...@@ -487,8 +495,12 @@ class CharacterData00 extends CharacterData {
case 0x017F : mapChar = 0x0053; break; case 0x017F : mapChar = 0x0053; break;
case 0x1FBE : mapChar = 0x0399; break; case 0x1FBE : mapChar = 0x0399; break;
case 0x023F : mapChar = 0x2C7E; break;
case 0x0240 : mapChar = 0x2C7F; break;
case 0x0250 : mapChar = 0x2C6F; break; case 0x0250 : mapChar = 0x2C6F; break;
case 0x0251 : mapChar = 0x2C6D; break; case 0x0251 : mapChar = 0x2C6D; break;
case 0x0252 : mapChar = 0x2C70; break;
case 0x0265 : mapChar = 0xA78D; break;
case 0x026B : mapChar = 0x2C62; break; case 0x026B : mapChar = 0x2C62; break;
case 0x0271 : mapChar = 0x2C6E; break; case 0x0271 : mapChar = 0x2C6E; break;
case 0x027D : mapChar = 0x2C64; break; case 0x027D : mapChar = 0x2C64; break;
......
/* /*
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2010, Oracle and/or its affiliates. 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
...@@ -251,9 +251,40 @@ class CharacterData01 extends CharacterData { ...@@ -251,9 +251,40 @@ class CharacterData01 extends CharacterData {
case 0x010341: retval = 90; break; // GOTHIC LETTER NINETY case 0x010341: retval = 90; break; // GOTHIC LETTER NINETY
case 0x01034A: retval = 900; break; // GOTHIC LETTER NINE HUNDRED case 0x01034A: retval = 900; break; // GOTHIC LETTER NINE HUNDRED
case 0x0103D5: retval = 100; break; // OLD PERSIAN NUMBER HUNDRED case 0x0103D5: retval = 100; break; // OLD PERSIAN NUMBER HUNDRED
case 0x01085D: retval = 100; break; // IMPERIAL ARAMAIC NUMBER ONE HUNDRED
case 0x01085E: retval = 1000; break; // IMPERIAL ARAMAIC NUMBER ONE THOUSAND
case 0x01085F: retval = 10000; break; // IMPERIAL ARAMAIC NUMBER TEN THOUSAND
case 0x010919: retval = 100; break; // PHOENICIAN NUMBER ONE HUNDRED case 0x010919: retval = 100; break; // PHOENICIAN NUMBER ONE HUNDRED
case 0x010A46: retval = 100; break; // KHAROSHTHI NUMBER ONE HUNDRED case 0x010A46: retval = 100; break; // KHAROSHTHI NUMBER ONE HUNDRED
case 0x010A47: retval = 1000; break; // KHAROSHTHI NUMBER ONE THOUSAND case 0x010A47: retval = 1000; break; // KHAROSHTHI NUMBER ONE THOUSAND
case 0x010A7E: retval = 50; break; // OLD SOUTH ARABIAN NUMBER FIFTY
case 0x010B5E: retval = 100; break; // INSCRIPTIONAL PARTHIAN NUMBER ONE HUNDRED
case 0x010B5F: retval = 1000; break; // INSCRIPTIONAL PARTHIAN NUMBER ONE THOUSAND
case 0x010B7E: retval = 100; break; // INSCRIPTIONAL PAHLAVI NUMBER ONE HUNDRED
case 0x010B7F: retval = 1000; break; // INSCRIPTIONAL PAHLAVI NUMBER ONE THOUSAND
case 0x010E6C: retval = 40; break; // RUMI NUMBER FORTY
case 0x010E6D: retval = 50; break; // RUMI NUMBER FIFTY
case 0x010E6E: retval = 60; break; // RUMI NUMBER SIXTY
case 0x010E6F: retval = 70; break; // RUMI NUMBER SEVENTY
case 0x010E70: retval = 80; break; // RUMI NUMBER EIGHTY
case 0x010E71: retval = 90; break; // RUMI NUMBER NINETY
case 0x010E72: retval = 100; break; // RUMI NUMBER ONE HUNDRED
case 0x010E73: retval = 200; break; // RUMI NUMBER TWO HUNDRED
case 0x010E74: retval = 300; break; // RUMI NUMBER THREE HUNDRED
case 0x010E75: retval = 400; break; // RUMI NUMBER FOUR HUNDRED
case 0x010E76: retval = 500; break; // RUMI NUMBER FIVE HUNDRED
case 0x010E77: retval = 600; break; // RUMI NUMBER SIX HUNDRED
case 0x010E78: retval = 700; break; // RUMI NUMBER SEVEN HUNDRED
case 0x010E79: retval = 800; break; // RUMI NUMBER EIGHT HUNDRED
case 0x010E7A: retval = 900; break; // RUMI NUMBER NINE HUNDRED
case 0x01105E: retval = 40; break; // BRAHMI NUMBER FORTY
case 0x01105F: retval = 50; break; // BRAHMI NUMBER FIFTY
case 0x011060: retval = 60; break; // BRAHMI NUMBER SIXTY
case 0x011061: retval = 70; break; // BRAHMI NUMBER SEVENTY
case 0x011062: retval = 80; break; // BRAHMI NUMBER EIGHTY
case 0x011063: retval = 90; break; // BRAHMI NUMBER NINETY
case 0x011064: retval = 100; break; // BRAHMI NUMBER ONE HUNDRED
case 0x011065: retval = 1000; break; // BRAHMI NUMBER ONE THOUSAND
case 0x01D36C: retval = 40; break; // COUNTING ROD TENS DIGIT FOUR case 0x01D36C: retval = 40; break; // COUNTING ROD TENS DIGIT FOUR
case 0x01D36D: retval = 50; break; // COUNTING ROD TENS DIGIT FIVE case 0x01D36D: retval = 50; break; // COUNTING ROD TENS DIGIT FIVE
case 0x01D36E: retval = 60; break; // COUNTING ROD TENS DIGIT SIX case 0x01D36E: retval = 60; break; // COUNTING ROD TENS DIGIT SIX
......
此差异已折叠。
# SpecialCasing-5.1.0.txt # SpecialCasing-6.0.0.txt
# Date: 2008-03-03, 21:58:10 GMT [MD] # Date: 2010-05-18, 00:49:39 GMT [MD]
# #
# Unicode Character Database # Unicode Character Database
# Copyright (c) 1991-2008 Unicode, Inc. # Copyright (c) 1991-2010 Unicode, Inc.
# For terms of use, see http://www.unicode.org/terms_of_use.html # For terms of use, see http://www.unicode.org/terms_of_use.html
# For documentation, see UCD.html # For documentation, see http://www.unicode.org/reports/tr44/
# #
# Special Casing Properties # Special Casing Properties
# #
...@@ -106,11 +106,11 @@ FB17; FB17; 0544 056D; 0544 053D; # ARMENIAN SMALL LIGATURE MEN XEH ...@@ -106,11 +106,11 @@ FB17; FB17; 0544 056D; 0544 053D; # ARMENIAN SMALL LIGATURE MEN XEH
1FE7; 1FE7; 03A5 0308 0342; 03A5 0308 0342; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND PERISPOMENI 1FE7; 1FE7; 03A5 0308 0342; 03A5 0308 0342; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND PERISPOMENI
1FF6; 1FF6; 03A9 0342; 03A9 0342; # GREEK SMALL LETTER OMEGA WITH PERISPOMENI 1FF6; 1FF6; 03A9 0342; 03A9 0342; # GREEK SMALL LETTER OMEGA WITH PERISPOMENI
# IMPORTANT-when capitalizing iota-subscript (0345) # IMPORTANT-when iota-subscript (0345) is uppercased or titlecased,
# It MUST be in normalized form--moved to the end of any sequence of combining marks. # the result will be incorrect unless the iota-subscript is moved to the end
# This is because logically it represents a following base character! # of any sequence of combining marks. Otherwise, the accents will go on the capital iota.
# E.g. <iota_subscript> (<Mn> | <Mc> | <Me>)+ => (<Mn> | <Mc> | <Me>)+ <iota_subscript> # This process can be achieved by first transforming the text to NFC before casing.
# It should never be the first character in a word, so in titlecasing it can be left as is. # E.g. <alpha><iota_subscript><acute> is uppercased to <ALPHA><acute><IOTA>
# The following cases are already in the UnicodeData file, so are only commented here. # The following cases are already in the UnicodeData file, so are only commented here.
......
...@@ -65,6 +65,7 @@ static jboolean printVersion = JNI_FALSE; /* print and exit */ ...@@ -65,6 +65,7 @@ static jboolean printVersion = JNI_FALSE; /* print and exit */
static jboolean showVersion = JNI_FALSE; /* print but continue */ static jboolean showVersion = JNI_FALSE; /* print but continue */
static jboolean printUsage = JNI_FALSE; /* print and exit*/ static jboolean printUsage = JNI_FALSE; /* print and exit*/
static jboolean printXUsage = JNI_FALSE; /* print and exit*/ static jboolean printXUsage = JNI_FALSE; /* print and exit*/
static char *showSettings = NULL; /* print but continue */
static const char *_program_name; static const char *_program_name;
static const char *_launcher_name; static const char *_launcher_name;
...@@ -109,6 +110,7 @@ static void SetApplicationClassPath(const char**); ...@@ -109,6 +110,7 @@ static void SetApplicationClassPath(const char**);
static void PrintJavaVersion(JNIEnv *env, jboolean extraLF); static void PrintJavaVersion(JNIEnv *env, jboolean extraLF);
static void PrintUsage(JNIEnv* env, jboolean doXUsage); static void PrintUsage(JNIEnv* env, jboolean doXUsage);
static void ShowSettings(JNIEnv* env, char *optString);
static void SetPaths(int argc, char **argv); static void SetPaths(int argc, char **argv);
...@@ -157,6 +159,7 @@ static jboolean IsWildCardEnabled(); ...@@ -157,6 +159,7 @@ static jboolean IsWildCardEnabled();
* create a new thread to invoke JVM. See 6316197 for more information. * create a new thread to invoke JVM. See 6316197 for more information.
*/ */
static jlong threadStackSize = 0; /* stack size of the new thread */ static jlong threadStackSize = 0; /* stack size of the new thread */
static jlong heapSize = 0; /* heap size */
int JNICALL JavaMain(void * args); /* entry point */ int JNICALL JavaMain(void * args); /* entry point */
...@@ -376,6 +379,10 @@ JavaMain(void * _args) ...@@ -376,6 +379,10 @@ JavaMain(void * _args)
} }
} }
if (showSettings != NULL) {
ShowSettings(env, showSettings);
CHECK_EXCEPTION_LEAVE(0);
}
/* If the user specified neither a class name nor a JAR file */ /* If the user specified neither a class name nor a JAR file */
if (printXUsage || printUsage || (jarfile == 0 && classname == 0)) { if (printXUsage || printUsage || (jarfile == 0 && classname == 0)) {
PrintUsage(env, printXUsage); PrintUsage(env, printXUsage);
...@@ -611,7 +618,7 @@ CheckJvmType(int *pargc, char ***argv, jboolean speculative) { ...@@ -611,7 +618,7 @@ CheckJvmType(int *pargc, char ***argv, jboolean speculative) {
/* copied from HotSpot function "atomll()" */ /* copied from HotSpot function "atomll()" */
static int static int
parse_stack_size(const char *s, jlong *result) { parse_size(const char *s, jlong *result) {
jlong n = 0; jlong n = 0;
int args_read = sscanf(s, jlong_format_specifier(), &n); int args_read = sscanf(s, jlong_format_specifier(), &n);
if (args_read != 1) { if (args_read != 1) {
...@@ -674,10 +681,17 @@ AddOption(char *str, void *info) ...@@ -674,10 +681,17 @@ AddOption(char *str, void *info)
if (JLI_StrCCmp(str, "-Xss") == 0) { if (JLI_StrCCmp(str, "-Xss") == 0) {
jlong tmp; jlong tmp;
if (parse_stack_size(str + 4, &tmp)) { if (parse_size(str + 4, &tmp)) {
threadStackSize = tmp; threadStackSize = tmp;
} }
} }
if (JLI_StrCCmp(str, "-Xmx") == 0) {
jlong tmp;
if (parse_size(str + 4, &tmp)) {
heapSize = tmp;
}
}
} }
static void static void
...@@ -1014,6 +1028,13 @@ ParseArguments(int *pargc, char ***pargv, char **pjarfile, ...@@ -1014,6 +1028,13 @@ ParseArguments(int *pargc, char ***pargv, char **pjarfile,
} else if (JLI_StrCmp(arg, "-X") == 0) { } else if (JLI_StrCmp(arg, "-X") == 0) {
printXUsage = JNI_TRUE; printXUsage = JNI_TRUE;
return JNI_TRUE; return JNI_TRUE;
/*
* The following case checks for -XshowSettings OR -XshowSetting:SUBOPT.
* In the latter case, any SUBOPT value not recognized will default to "all"
*/
} else if (JLI_StrCmp(arg, "-XshowSettings") == 0 ||
JLI_StrCCmp(arg, "-XshowSettings:") == 0) {
showSettings = arg;
/* /*
* The following case provide backward compatibility with old-style * The following case provide backward compatibility with old-style
* command line options. * command line options.
...@@ -1474,6 +1495,27 @@ PrintJavaVersion(JNIEnv *env, jboolean extraLF) ...@@ -1474,6 +1495,27 @@ PrintJavaVersion(JNIEnv *env, jboolean extraLF)
(*env)->CallStaticVoidMethod(env, ver, print); (*env)->CallStaticVoidMethod(env, ver, print);
} }
/*
* Prints all the Java settings, see the java implementation for more details.
*/
static void
ShowSettings(JNIEnv *env, char *optString)
{
jclass cls;
jmethodID showSettingsID;
jstring joptString;
NULL_CHECK(cls = FindBootStrapClass(env, "sun/launcher/LauncherHelper"));
NULL_CHECK(showSettingsID = (*env)->GetStaticMethodID(env, cls,
"showSettings", "(ZLjava/lang/String;JJZ)V"));
joptString = (*env)->NewStringUTF(env, optString);
(*env)->CallStaticVoidMethod(env, cls, showSettingsID,
JNI_TRUE,
joptString,
(jlong)heapSize,
(jlong)threadStackSize,
ServerClassMachine());
}
/* /*
* Prints default usage or the Xusage message, see sun.launcher.LauncherHelper.java * Prints default usage or the Xusage message, see sun.launcher.LauncherHelper.java
*/ */
......
...@@ -91,6 +91,7 @@ public class HttpsConfigurator { ...@@ -91,6 +91,7 @@ public class HttpsConfigurator {
return context; return context;
} }
//BEGIN_TIGER_EXCLUDE
/** /**
* Called by the HttpsServer to configure the parameters * Called by the HttpsServer to configure the parameters
* for a https connection currently being established. * for a https connection currently being established.
...@@ -111,4 +112,5 @@ public class HttpsConfigurator { ...@@ -111,4 +112,5 @@ public class HttpsConfigurator {
public void configure (HttpsParameters params) { public void configure (HttpsParameters params) {
params.setSSLParameters (getSSLContext().getDefaultSSLParameters()); params.setSSLParameters (getSSLContext().getDefaultSSLParameters());
} }
//END_TIGER_EXCLUDE
} }
...@@ -25,7 +25,9 @@ ...@@ -25,7 +25,9 @@
package com.sun.net.httpserver; package com.sun.net.httpserver;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
//BEGIN_TIGER_EXCLUDE
import javax.net.ssl.SSLParameters; import javax.net.ssl.SSLParameters;
//END_TIGER_EXCLUDE
/** /**
* Represents the set of parameters for each https * Represents the set of parameters for each https
...@@ -67,6 +69,7 @@ public abstract class HttpsParameters { ...@@ -67,6 +69,7 @@ public abstract class HttpsParameters {
*/ */
public abstract InetSocketAddress getClientAddress(); public abstract InetSocketAddress getClientAddress();
//BEGIN_TIGER_EXCLUDE
/** /**
* Sets the SSLParameters to use for this HttpsParameters. * Sets the SSLParameters to use for this HttpsParameters.
* The parameters must be supported by the SSLContext contained * The parameters must be supported by the SSLContext contained
...@@ -79,6 +82,7 @@ public abstract class HttpsParameters { ...@@ -79,6 +82,7 @@ public abstract class HttpsParameters {
* invalid or unsupported. * invalid or unsupported.
*/ */
public abstract void setSSLParameters (SSLParameters params); public abstract void setSSLParameters (SSLParameters params);
//END_TIGER_EXCLUDE
/** /**
* Returns a copy of the array of ciphersuites or null if none * Returns a copy of the array of ciphersuites or null if none
......
# #
# Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2005, 2010, Oracle and/or its affiliates. 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
...@@ -140,7 +140,7 @@ syncrsimpl.valtores = Value to be resolved can either be in the database or in c ...@@ -140,7 +140,7 @@ syncrsimpl.valtores = Value to be resolved can either be in the database or in c
#WebRowSetXmlReader exception #WebRowSetXmlReader exception
wrsxmlreader.invalidcp = End of RowSet reached. Invalid cursor position wrsxmlreader.invalidcp = End of RowSet reached. Invalid cursor position
wrsxmlreader.readxml = readXML : {0} wrsxmlreader.readxml = readXML : {0}
wrsxmlreader.parseerr = ** Parsing Error : {0} , line : {0} , uri : {0} wrsxmlreader.parseerr = ** Parsing Error : {0} , line : {1} , uri : {2}
#WebRowSetXmlWriter exceptions #WebRowSetXmlWriter exceptions
wrsxmlwriter.ioex = IOException : {0} wrsxmlwriter.ioex = IOException : {0}
...@@ -151,7 +151,7 @@ wsrxmlwriter.notproper = Not a proper type ...@@ -151,7 +151,7 @@ wsrxmlwriter.notproper = Not a proper type
#XmlReaderContentHandler exceptions #XmlReaderContentHandler exceptions
xmlrch.errmap = Error setting Map : {0} xmlrch.errmap = Error setting Map : {0}
xmlrch.errmetadata = Error setting metadata : {0} xmlrch.errmetadata = Error setting metadata : {0}
xmlrch.errinsert = Error inserting values : {0} xmlrch.errinsertval = Error inserting values : {0}
xmlrch.errconstr = Error constructing row : {0} xmlrch.errconstr = Error constructing row : {0}
xmlrch.errdel = Error deleting row : {0} xmlrch.errdel = Error deleting row : {0}
xmlrch.errinsert = Error constructing insert row : {0} xmlrch.errinsert = Error constructing insert row : {0}
...@@ -161,7 +161,7 @@ xmlrch.errupdrow = Error updating row : {0} ...@@ -161,7 +161,7 @@ xmlrch.errupdrow = Error updating row : {0}
xmlrch.chars = characters : xmlrch.chars = characters :
xmlrch.badvalue = Bad value ; non-nullable property xmlrch.badvalue = Bad value ; non-nullable property
xmlrch.badvalue1 = Bad value ; non-nullable metadata xmlrch.badvalue1 = Bad value ; non-nullable metadata
xmlrch.warning = ** Warning : {0} , line : {0} , uri : {0} xmlrch.warning = ** Warning : {0} , line : {1} , uri : {2}
#RIOptimisticProvider Exceptions #RIOptimisticProvider Exceptions
riop.locking = Locking classification is not supported riop.locking = Locking classification is not supported
......
...@@ -738,7 +738,7 @@ public class XmlReaderContentHandler extends DefaultHandler { ...@@ -738,7 +738,7 @@ public class XmlReaderContentHandler extends DefaultHandler {
// columnValue now need to be reset to the empty string // columnValue now need to be reset to the empty string
columnValue = ""; columnValue = "";
} catch (SQLException ex) { } catch (SQLException ex) {
throw new SAXException(MessageFormat.format(resBundle.handleGetObject("xmlrch.errinsert").toString(), ex.getMessage())); throw new SAXException(MessageFormat.format(resBundle.handleGetObject("xmlrch.errinsertval").toString(), ex.getMessage()));
} }
break; break;
case RowTag: case RowTag:
......
/* /*
* Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2010, Oracle and/or its affiliates. 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
...@@ -262,7 +262,23 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -262,7 +262,23 @@ public final class NumericShaper implements java.io.Serializable {
/** /**
* The Cham range with the Cham digits. * The Cham range with the Cham digits.
*/ */
CHAM ('\uaa50', '\uaa00', '\uaa60'); CHAM ('\uaa50', '\uaa00', '\uaa60'),
/**
* The Tai Tham Hora range with the Tai Tham Hora digits.
*/
TAI_THAM_HORA ('\u1a80', '\u1a20', '\u1ab0'),
/**
* The Tai Tham Tham range with the Tai Tham Tham digits.
*/
TAI_THAM_THAM ('\u1a90', '\u1a20', '\u1ab0'),
/**
* The Javanese range with the Javanese digits.
*/
JAVANESE ('\ua9d0', '\ua980', '\ua9e0'),
/**
* The Meetei Mayek range with the Meetei Mayek digits.
*/
MEETEI_MAYEK ('\uabf0', '\uabc0', '\uac00');
private static int toRangeIndex(Range script) { private static int toRangeIndex(Range script) {
int index = script.ordinal(); int index = script.ordinal();
...@@ -592,10 +608,16 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -592,10 +608,16 @@ public final class NumericShaper implements java.io.Serializable {
0x07a6, 0x07b1, 0x07a6, 0x07b1,
0x07eb, 0x07f4, 0x07eb, 0x07f4,
0x07f6, 0x07fa, 0x07f6, 0x07fa,
0x0901, 0x0903, 0x0816, 0x081a,
0x081b, 0x0824,
0x0825, 0x0828,
0x0829, 0x0830,
0x0859, 0x085e,
0x0900, 0x0903,
0x093a, 0x093b,
0x093c, 0x093d, 0x093c, 0x093d,
0x0941, 0x0949, 0x0941, 0x0949,
0x094d, 0x0950, 0x094d, 0x094e,
0x0951, 0x0958, 0x0951, 0x0958,
0x0962, 0x0964, 0x0962, 0x0964,
0x0981, 0x0982, 0x0981, 0x0982,
...@@ -604,7 +626,7 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -604,7 +626,7 @@ public final class NumericShaper implements java.io.Serializable {
0x09cd, 0x09ce, 0x09cd, 0x09ce,
0x09e2, 0x09e6, 0x09e2, 0x09e6,
0x09f2, 0x09f4, 0x09f2, 0x09f4,
0x0a01, 0x0a03, 0x09fb, 0x0a03,
0x0a3c, 0x0a3e, 0x0a3c, 0x0a3e,
0x0a41, 0x0a59, 0x0a41, 0x0a59,
0x0a70, 0x0a72, 0x0a70, 0x0a72,
...@@ -630,9 +652,8 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -630,9 +652,8 @@ public final class NumericShaper implements java.io.Serializable {
0x0cbc, 0x0cbd, 0x0cbc, 0x0cbd,
0x0ccc, 0x0cd5, 0x0ccc, 0x0cd5,
0x0ce2, 0x0ce6, 0x0ce2, 0x0ce6,
0x0cf1, 0x0d02,
0x0d41, 0x0d46, 0x0d41, 0x0d46,
0x0d4d, 0x0d57, 0x0d4d, 0x0d4e,
0x0d62, 0x0d66, 0x0d62, 0x0d66,
0x0dca, 0x0dcf, 0x0dca, 0x0dcf,
0x0dd2, 0x0dd8, 0x0dd2, 0x0dd8,
...@@ -649,7 +670,7 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -649,7 +670,7 @@ public final class NumericShaper implements java.io.Serializable {
0x0f71, 0x0f7f, 0x0f71, 0x0f7f,
0x0f80, 0x0f85, 0x0f80, 0x0f85,
0x0f86, 0x0f88, 0x0f86, 0x0f88,
0x0f90, 0x0fbe, 0x0f8d, 0x0fbe,
0x0fc6, 0x0fc7, 0x0fc6, 0x0fc7,
0x102d, 0x1031, 0x102d, 0x1031,
0x1032, 0x1038, 0x1032, 0x1038,
...@@ -661,8 +682,10 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -661,8 +682,10 @@ public final class NumericShaper implements java.io.Serializable {
0x1082, 0x1083, 0x1082, 0x1083,
0x1085, 0x1087, 0x1085, 0x1087,
0x108d, 0x108e, 0x108d, 0x108e,
0x135f, 0x1360, 0x109d, 0x109e,
0x135d, 0x1360,
0x1390, 0x13a0, 0x1390, 0x13a0,
0x1400, 0x1401,
0x1680, 0x1681, 0x1680, 0x1681,
0x169b, 0x16a0, 0x169b, 0x16a0,
0x1712, 0x1720, 0x1712, 0x1720,
...@@ -682,6 +705,11 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -682,6 +705,11 @@ public final class NumericShaper implements java.io.Serializable {
0x1939, 0x1946, 0x1939, 0x1946,
0x19de, 0x1a00, 0x19de, 0x1a00,
0x1a17, 0x1a19, 0x1a17, 0x1a19,
0x1a56, 0x1a57,
0x1a58, 0x1a61,
0x1a62, 0x1a63,
0x1a65, 0x1a6d,
0x1a73, 0x1a80,
0x1b00, 0x1b04, 0x1b00, 0x1b04,
0x1b34, 0x1b35, 0x1b34, 0x1b35,
0x1b36, 0x1b3b, 0x1b36, 0x1b3b,
...@@ -691,8 +719,16 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -691,8 +719,16 @@ public final class NumericShaper implements java.io.Serializable {
0x1b80, 0x1b82, 0x1b80, 0x1b82,
0x1ba2, 0x1ba6, 0x1ba2, 0x1ba6,
0x1ba8, 0x1baa, 0x1ba8, 0x1baa,
0x1be6, 0x1be7,
0x1be8, 0x1bea,
0x1bed, 0x1bee,
0x1bef, 0x1bf2,
0x1c2c, 0x1c34, 0x1c2c, 0x1c34,
0x1c36, 0x1c3b, 0x1c36, 0x1c3b,
0x1cd0, 0x1cd3,
0x1cd4, 0x1ce1,
0x1ce2, 0x1ce9,
0x1ced, 0x1cee,
0x1dc0, 0x1e00, 0x1dc0, 0x1e00,
0x1fbd, 0x1fbe, 0x1fbd, 0x1fbe,
0x1fbf, 0x1fc2, 0x1fbf, 0x1fc2,
...@@ -716,14 +752,16 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -716,14 +752,16 @@ public final class NumericShaper implements java.io.Serializable {
0x213a, 0x213c, 0x213a, 0x213c,
0x2140, 0x2145, 0x2140, 0x2145,
0x214a, 0x214e, 0x214a, 0x214e,
0x2153, 0x2160, 0x2150, 0x2160,
0x2190, 0x2336, 0x2189, 0x2336,
0x237b, 0x2395, 0x237b, 0x2395,
0x2396, 0x249c, 0x2396, 0x249c,
0x24ea, 0x26ac, 0x24ea, 0x26ac,
0x26ad, 0x2800, 0x26ad, 0x2800,
0x2900, 0x2c00, 0x2900, 0x2c00,
0x2ce5, 0x2d00, 0x2ce5, 0x2ceb,
0x2cef, 0x2d00,
0x2d7f, 0x2d80,
0x2de0, 0x3005, 0x2de0, 0x3005,
0x3008, 0x3021, 0x3008, 0x3021,
0x302a, 0x3031, 0x302a, 0x3031,
...@@ -742,25 +780,40 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -742,25 +780,40 @@ public final class NumericShaper implements java.io.Serializable {
0x33de, 0x33e0, 0x33de, 0x33e0,
0x33ff, 0x3400, 0x33ff, 0x3400,
0x4dc0, 0x4e00, 0x4dc0, 0x4e00,
0xa490, 0xa500, 0xa490, 0xa4d0,
0xa60d, 0xa610, 0xa60d, 0xa610,
0xa66f, 0xa680, 0xa66f, 0xa680,
0xa6f0, 0xa6f2,
0xa700, 0xa722, 0xa700, 0xa722,
0xa788, 0xa789, 0xa788, 0xa789,
0xa802, 0xa803, 0xa802, 0xa803,
0xa806, 0xa807, 0xa806, 0xa807,
0xa80b, 0xa80c, 0xa80b, 0xa80c,
0xa825, 0xa827, 0xa825, 0xa827,
0xa828, 0xa840, 0xa828, 0xa830,
0xa838, 0xa840,
0xa874, 0xa880, 0xa874, 0xa880,
0xa8c4, 0xa8ce, 0xa8c4, 0xa8ce,
0xa8e0, 0xa8f2,
0xa926, 0xa92e, 0xa926, 0xa92e,
0xa947, 0xa952, 0xa947, 0xa952,
0xa980, 0xa983,
0xa9b3, 0xa9b4,
0xa9b6, 0xa9ba,
0xa9bc, 0xa9bd,
0xaa29, 0xaa2f, 0xaa29, 0xaa2f,
0xaa31, 0xaa33, 0xaa31, 0xaa33,
0xaa35, 0xaa40, 0xaa35, 0xaa40,
0xaa43, 0xaa44, 0xaa43, 0xaa44,
0xaa4c, 0xaa4d, 0xaa4c, 0xaa4d,
0xaab0, 0xaab1,
0xaab2, 0xaab5,
0xaab7, 0xaab9,
0xaabe, 0xaac0,
0xaac1, 0xaac2,
0xabe5, 0xabe6,
0xabe8, 0xabe9,
0xabed, 0xabf0,
0xfb1e, 0xfb1f, 0xfb1e, 0xfb1f,
0xfb29, 0xfb2a, 0xfb29, 0xfb2a,
0xfd3e, 0xfd50, 0xfd3e, 0xfd50,
...@@ -775,12 +828,28 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -775,12 +828,28 @@ public final class NumericShaper implements java.io.Serializable {
0x1091f, 0x10920, 0x1091f, 0x10920,
0x10a01, 0x10a10, 0x10a01, 0x10a10,
0x10a38, 0x10a40, 0x10a38, 0x10a40,
0x10b39, 0x10b40,
0x10e60, 0x11000,
0x11001, 0x11002,
0x11038, 0x11047,
0x11052, 0x11066,
0x11080, 0x11082,
0x110b3, 0x110b7,
0x110b9, 0x110bb,
0x1d167, 0x1d16a, 0x1d167, 0x1d16a,
0x1d173, 0x1d183, 0x1d173, 0x1d183,
0x1d185, 0x1d18c, 0x1d185, 0x1d18c,
0x1d1aa, 0x1d1ae, 0x1d1aa, 0x1d1ae,
0x1d200, 0x1d360, 0x1d200, 0x1d360,
0x1d7ce, 0x20000, 0x1d6db, 0x1d6dc,
0x1d715, 0x1d716,
0x1d74f, 0x1d750,
0x1d789, 0x1d78a,
0x1d7c3, 0x1d7c4,
0x1d7ce, 0x1f110,
0x1f300, 0x1f48c,
0x1f48d, 0x1f524,
0x1f525, 0x20000,
0xe0001, 0xf0000, 0xe0001, 0xf0000,
0x10fffe, 0x10ffff // sentinel 0x10fffe, 0x10ffff // sentinel
}; };
...@@ -947,6 +1016,14 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -947,6 +1016,14 @@ public final class NumericShaper implements java.io.Serializable {
&& rangeSet.contains(Range.ARABIC)) { && rangeSet.contains(Range.ARABIC)) {
rangeSet.remove(Range.ARABIC); rangeSet.remove(Range.ARABIC);
} }
// As well as the above case, give precedance to TAI_THAM_THAM if both
// TAI_THAM_HORA and TAI_THAM_THAM are specified.
if (rangeSet.contains(Range.TAI_THAM_THAM)
&& rangeSet.contains(Range.TAI_THAM_HORA)) {
rangeSet.remove(Range.TAI_THAM_HORA);
}
rangeArray = rangeSet.toArray(new Range[rangeSet.size()]); rangeArray = rangeSet.toArray(new Range[rangeSet.size()]);
if (rangeArray.length > BSEARCH_THRESHOLD) { if (rangeArray.length > BSEARCH_THRESHOLD) {
// sort rangeArray for binary search // sort rangeArray for binary search
......
...@@ -29,6 +29,8 @@ import com.sun.beans.WeakCache; ...@@ -29,6 +29,8 @@ import com.sun.beans.WeakCache;
import com.sun.beans.finder.BeanInfoFinder; import com.sun.beans.finder.BeanInfoFinder;
import com.sun.beans.finder.ClassFinder; import com.sun.beans.finder.ClassFinder;
import java.awt.Component;
import java.lang.ref.Reference; import java.lang.ref.Reference;
import java.lang.ref.SoftReference; import java.lang.ref.SoftReference;
import java.lang.reflect.Method; import java.lang.reflect.Method;
...@@ -39,6 +41,7 @@ import java.util.ArrayList; ...@@ -39,6 +41,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.EventListener; import java.util.EventListener;
import java.util.EventObject;
import java.util.List; import java.util.List;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.WeakHashMap; import java.util.WeakHashMap;
...@@ -1234,7 +1237,23 @@ public class Introspector { ...@@ -1234,7 +1237,23 @@ public class Introspector {
} }
} }
// OK, fabricate a default BeanDescriptor. // OK, fabricate a default BeanDescriptor.
return (new BeanDescriptor(beanClass)); return new BeanDescriptor(this.beanClass, findCustomizerClass(this.beanClass));
}
private static Class<?> findCustomizerClass(Class<?> type) {
String name = type.getName() + "Customizer";
try {
type = ClassFinder.findClass(name, type.getClassLoader());
// Each customizer should inherit java.awt.Component and implement java.beans.Customizer
// according to the section 9.3 of JavaBeans specification
if (Component.class.isAssignableFrom(type) && Customizer.class.isAssignableFrom(type)) {
return type;
}
}
catch (Exception exception) {
// ignore any exceptions
}
return null;
} }
private boolean isEventHandler(Method m) { private boolean isEventHandler(Method m) {
...@@ -1244,10 +1263,7 @@ public class Introspector { ...@@ -1244,10 +1263,7 @@ public class Introspector {
if (argTypes.length != 1) { if (argTypes.length != 1) {
return false; return false;
} }
if (isSubclass(argTypes[0], java.util.EventObject.class)) { return isSubclass(argTypes[0], EventObject.class);
return true;
}
return false;
} }
/* /*
......
...@@ -395,7 +395,11 @@ class BufferedInputStream extends FilterInputStream { ...@@ -395,7 +395,11 @@ class BufferedInputStream extends FilterInputStream {
* or an I/O error occurs. * or an I/O error occurs.
*/ */
public synchronized int available() throws IOException { public synchronized int available() throws IOException {
return getInIfOpen().available() + (count - pos); int n = count - pos;
int avail = getInIfOpen().available();
return n > (Integer.MAX_VALUE - avail)
? Integer.MAX_VALUE
: n + avail;
} }
/** /**
......
...@@ -273,7 +273,11 @@ class PushbackInputStream extends FilterInputStream { ...@@ -273,7 +273,11 @@ class PushbackInputStream extends FilterInputStream {
*/ */
public int available() throws IOException { public int available() throws IOException {
ensureOpen(); ensureOpen();
return (buf.length - pos) + super.available(); int n = buf.length - pos;
int avail = super.available();
return n > (Integer.MAX_VALUE - avail)
? Integer.MAX_VALUE
: n + avail;
} }
/** /**
......
...@@ -44,11 +44,11 @@ public interface Readable { ...@@ -44,11 +44,11 @@ public interface Readable {
* rewinding of the buffer is performed. * rewinding of the buffer is performed.
* *
* @param cb the buffer to read characters into * @param cb the buffer to read characters into
* @return @return The number of <tt>char</tt> values added to the buffer, * @return The number of {@code char} values added to the buffer,
* or -1 if this source of characters is at its end * or -1 if this source of characters is at its end
* @throws IOException if an I/O error occurs * @throws IOException if an I/O error occurs
* @throws NullPointerException if cb is null * @throws NullPointerException if cb is null
* @throws ReadOnlyBufferException if cb is a read only buffer * @throws java.nio.ReadOnlyBufferException if cb is a read only buffer
*/ */
public int read(java.nio.CharBuffer cb) throws IOException; public int read(java.nio.CharBuffer cb) throws IOException;
......
...@@ -47,7 +47,7 @@ class StringCharBuffer // package-private ...@@ -47,7 +47,7 @@ class StringCharBuffer // package-private
0, 0,
this.remaining(), this.remaining(),
this.remaining(), this.remaining(),
this.position()); offset + this.position());
} }
private StringCharBuffer(CharSequence s, private StringCharBuffer(CharSequence s,
......
...@@ -110,7 +110,8 @@ import java.nio.ByteBuffer; ...@@ -110,7 +110,8 @@ import java.nio.ByteBuffer;
* state of the {@link ByteBuffer}, or the sequence of buffers, for the I/O * state of the {@link ByteBuffer}, or the sequence of buffers, for the I/O
* operation is not defined. Buffers should be discarded or at least care must * operation is not defined. Buffers should be discarded or at least care must
* be taken to ensure that the buffers are not accessed while the channel remains * be taken to ensure that the buffers are not accessed while the channel remains
* open. * open. All methods that accept timeout parameters treat values less than or
* equal to zero to mean that the I/O operation does not timeout.
* *
* @since 1.7 * @since 1.7
*/ */
...@@ -367,7 +368,7 @@ public abstract class AsynchronousSocketChannel ...@@ -367,7 +368,7 @@ public abstract class AsynchronousSocketChannel
* @param dst * @param dst
* The buffer into which bytes are to be transferred * The buffer into which bytes are to be transferred
* @param timeout * @param timeout
* The timeout, or {@code 0L} for no timeout * The maximum time for the I/O operation to complete
* @param unit * @param unit
* The time unit of the {@code timeout} argument * The time unit of the {@code timeout} argument
* @param attachment * @param attachment
...@@ -376,8 +377,7 @@ public abstract class AsynchronousSocketChannel ...@@ -376,8 +377,7 @@ public abstract class AsynchronousSocketChannel
* The handler for consuming the result * The handler for consuming the result
* *
* @throws IllegalArgumentException * @throws IllegalArgumentException
* If the {@code timeout} parameter is negative or the buffer is * If the buffer is read-only
* read-only
* @throws ReadPendingException * @throws ReadPendingException
* If a read operation is already in progress on this channel * If a read operation is already in progress on this channel
* @throws NotYetConnectedException * @throws NotYetConnectedException
...@@ -471,7 +471,7 @@ public abstract class AsynchronousSocketChannel ...@@ -471,7 +471,7 @@ public abstract class AsynchronousSocketChannel
* The maximum number of buffers to be accessed; must be non-negative * The maximum number of buffers to be accessed; must be non-negative
* and no larger than {@code dsts.length - offset} * and no larger than {@code dsts.length - offset}
* @param timeout * @param timeout
* The timeout, or {@code 0L} for no timeout * The maximum time for the I/O operation to complete
* @param unit * @param unit
* The time unit of the {@code timeout} argument * The time unit of the {@code timeout} argument
* @param attachment * @param attachment
...@@ -483,8 +483,7 @@ public abstract class AsynchronousSocketChannel ...@@ -483,8 +483,7 @@ public abstract class AsynchronousSocketChannel
* If the pre-conditions for the {@code offset} and {@code length} * If the pre-conditions for the {@code offset} and {@code length}
* parameter aren't met * parameter aren't met
* @throws IllegalArgumentException * @throws IllegalArgumentException
* If the {@code timeout} parameter is negative, or a buffer is * If the buffer is read-only
* read-only
* @throws ReadPendingException * @throws ReadPendingException
* If a read operation is already in progress on this channel * If a read operation is already in progress on this channel
* @throws NotYetConnectedException * @throws NotYetConnectedException
...@@ -524,7 +523,7 @@ public abstract class AsynchronousSocketChannel ...@@ -524,7 +523,7 @@ public abstract class AsynchronousSocketChannel
* @param src * @param src
* The buffer from which bytes are to be retrieved * The buffer from which bytes are to be retrieved
* @param timeout * @param timeout
* The timeout, or {@code 0L} for no timeout * The maximum time for the I/O operation to complete
* @param unit * @param unit
* The time unit of the {@code timeout} argument * The time unit of the {@code timeout} argument
* @param attachment * @param attachment
...@@ -532,8 +531,6 @@ public abstract class AsynchronousSocketChannel ...@@ -532,8 +531,6 @@ public abstract class AsynchronousSocketChannel
* @param handler * @param handler
* The handler for consuming the result * The handler for consuming the result
* *
* @throws IllegalArgumentException
* If the {@code timeout} parameter is negative
* @throws WritePendingException * @throws WritePendingException
* If a write operation is already in progress on this channel * If a write operation is already in progress on this channel
* @throws NotYetConnectedException * @throws NotYetConnectedException
...@@ -623,7 +620,7 @@ public abstract class AsynchronousSocketChannel ...@@ -623,7 +620,7 @@ public abstract class AsynchronousSocketChannel
* The maximum number of buffers to be accessed; must be non-negative * The maximum number of buffers to be accessed; must be non-negative
* and no larger than {@code srcs.length - offset} * and no larger than {@code srcs.length - offset}
* @param timeout * @param timeout
* The timeout, or {@code 0L} for no timeout * The maximum time for the I/O operation to complete
* @param unit * @param unit
* The time unit of the {@code timeout} argument * The time unit of the {@code timeout} argument
* @param attachment * @param attachment
...@@ -634,8 +631,6 @@ public abstract class AsynchronousSocketChannel ...@@ -634,8 +631,6 @@ public abstract class AsynchronousSocketChannel
* @throws IndexOutOfBoundsException * @throws IndexOutOfBoundsException
* If the pre-conditions for the {@code offset} and {@code length} * If the pre-conditions for the {@code offset} and {@code length}
* parameter aren't met * parameter aren't met
* @throws IllegalArgumentException
* If the {@code timeout} parameter is negative
* @throws WritePendingException * @throws WritePendingException
* If a write operation is already in progress on this channel * If a write operation is already in progress on this channel
* @throws NotYetConnectedException * @throws NotYetConnectedException
......
...@@ -84,7 +84,7 @@ import java.security.*; ...@@ -84,7 +84,7 @@ import java.security.*;
* {@code setJNDIContext} and {@code setLogger}</td> * {@code setJNDIContext} and {@code setLogger}</td>
* <td>Permits an application to specify the JNDI context from which the * <td>Permits an application to specify the JNDI context from which the
* {@code SyncProvider} implementations can be retrieved from and the logging * {@code SyncProvider} implementations can be retrieved from and the logging
* object to be used by the{@codeSyncProvider} implementation.</td> * object to be used by the {@code SyncProvider} implementation.</td>
* </tr> * </tr>
* *
* <tr> * <tr>
......
...@@ -1581,6 +1581,7 @@ import sun.misc.FormattedFloatingDecimal; ...@@ -1581,6 +1581,7 @@ import sun.misc.FormattedFloatingDecimal;
* instance of the Java virtual machine. * instance of the Java virtual machine.
* *
* <tr><td valign="top">{@code 'Z'} * <tr><td valign="top">{@code 'Z'}
* <td valign="top"> <tt>'&#92;u005a'</tt>
* <td> A string representing the abbreviation for the time zone. This * <td> A string representing the abbreviation for the time zone. This
* value will be adjusted as necessary for Daylight Saving Time. For * value will be adjusted as necessary for Daylight Saving Time. For
* {@code long}, {@link Long}, and {@link Date} the time zone used is * {@code long}, {@link Long}, and {@link Date} the time zone used is
......
...@@ -25,7 +25,9 @@ ...@@ -25,7 +25,9 @@
package java.util.spi; package java.util.spi;
import java.util.Arrays;
import java.util.Currency; import java.util.Currency;
import java.util.List;
import java.util.Locale; import java.util.Locale;
/** /**
...@@ -95,6 +97,23 @@ public abstract class CurrencyNameProvider extends LocaleServiceProvider { ...@@ -95,6 +97,23 @@ public abstract class CurrencyNameProvider extends LocaleServiceProvider {
throw new NullPointerException(); throw new NullPointerException();
} }
// Check whether the currencyCode is valid
char[] charray = currencyCode.toCharArray();
if (charray.length != 3) {
throw new IllegalArgumentException("The currencyCode is not in the form of three upper-case letters.");
}
for (char c : charray) {
if (c < 'A' || c > 'Z') {
throw new IllegalArgumentException("The currencyCode is not in the form of three upper-case letters.");
}
}
// Check whether the locale is valid
List<Locale> avail = Arrays.asList(getAvailableLocales());
if (!avail.contains(locale)) {
throw new IllegalArgumentException("The locale is not available");
}
return null; return null;
} }
} }
...@@ -94,7 +94,9 @@ public abstract class LocaleNameProvider extends LocaleServiceProvider { ...@@ -94,7 +94,9 @@ public abstract class LocaleNameProvider extends LocaleServiceProvider {
* @see java.util.Locale#getDisplayScript(java.util.Locale) * @see java.util.Locale#getDisplayScript(java.util.Locale)
* @since 1.7 * @since 1.7
*/ */
public abstract String getDisplayScript(String scriptCode, Locale locale); public String getDisplayScript(String scriptCode, Locale locale) {
return null;
}
/** /**
* Returns a localized name for the given <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt"> * Returns a localized name for the given <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">
......
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
package javax.security.auth; package javax.security.auth;
import java.security.Security;
import sun.security.util.Debug;
/** /**
* <p> This is an abstract class for representing the system policy for * <p> This is an abstract class for representing the system policy for
* Subject-based authorization. A subclass implementation * Subject-based authorization. A subclass implementation
...@@ -159,6 +162,10 @@ public abstract class Policy { ...@@ -159,6 +162,10 @@ public abstract class Policy {
private static Policy policy; private static Policy policy;
private static ClassLoader contextClassLoader; private static ClassLoader contextClassLoader;
// true if a custom (not com.sun.security.auth.PolicyFile) system-wide
// policy object is set
private static boolean isCustomPolicy;
static { static {
contextClassLoader = java.security.AccessController.doPrivileged contextClassLoader = java.security.AccessController.doPrivileged
(new java.security.PrivilegedAction<ClassLoader>() { (new java.security.PrivilegedAction<ClassLoader>() {
...@@ -234,6 +241,8 @@ public abstract class Policy { ...@@ -234,6 +241,8 @@ public abstract class Policy {
contextClassLoader).newInstance(); contextClassLoader).newInstance();
} }
}); });
isCustomPolicy =
!finalClass.equals("com.sun.security.auth.PolicyFile");
} catch (Exception e) { } catch (Exception e) {
throw new SecurityException throw new SecurityException
(sun.security.util.ResourcesMgr.getString (sun.security.util.ResourcesMgr.getString
...@@ -265,6 +274,46 @@ public abstract class Policy { ...@@ -265,6 +274,46 @@ public abstract class Policy {
java.lang.SecurityManager sm = System.getSecurityManager(); java.lang.SecurityManager sm = System.getSecurityManager();
if (sm != null) sm.checkPermission(new AuthPermission("setPolicy")); if (sm != null) sm.checkPermission(new AuthPermission("setPolicy"));
Policy.policy = policy; Policy.policy = policy;
// all non-null policy objects are assumed to be custom
isCustomPolicy = policy != null ? true : false;
}
/**
* Returns true if a custom (not com.sun.security.auth.PolicyFile)
* system-wide policy object has been set or installed. This method is
* called by SubjectDomainCombiner to provide backwards compatibility for
* developers that provide their own javax.security.auth.Policy
* implementations.
*
* @return true if a custom (not com.sun.security.auth.PolicyFile)
* system-wide policy object has been set; false otherwise
*/
static boolean isCustomPolicySet(Debug debug) {
if (policy != null) {
if (debug != null && isCustomPolicy) {
debug.println("Providing backwards compatibility for " +
"javax.security.auth.policy implementation: " +
policy.toString());
}
return isCustomPolicy;
}
// check if custom policy has been set using auth.policy.provider prop
String policyClass = java.security.AccessController.doPrivileged
(new java.security.PrivilegedAction<String>() {
public String run() {
return Security.getProperty("auth.policy.provider");
}
});
if (policyClass != null
&& !policyClass.equals("com.sun.security.auth.PolicyFile")) {
if (debug != null) {
debug.println("Providing backwards compatibility for " +
"javax.security.auth.policy implementation: " +
policyClass);
}
return true;
}
return false;
} }
/** /**
......
/* /*
* Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2010, Oracle and/or its affiliates. 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,8 +26,6 @@ ...@@ -26,8 +26,6 @@
package javax.security.auth; package javax.security.auth;
import java.security.AccessController; import java.security.AccessController;
import java.security.AccessControlContext;
import java.security.AllPermission;
import java.security.Permission; import java.security.Permission;
import java.security.Permissions; import java.security.Permissions;
import java.security.PermissionCollection; import java.security.PermissionCollection;
...@@ -35,10 +33,8 @@ import java.security.Policy; ...@@ -35,10 +33,8 @@ import java.security.Policy;
import java.security.Principal; import java.security.Principal;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import java.security.ProtectionDomain; import java.security.ProtectionDomain;
import java.lang.ClassLoader;
import java.security.Security; import java.security.Security;
import java.util.Set; import java.util.Set;
import java.util.Iterator;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
...@@ -61,7 +57,8 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner { ...@@ -61,7 +57,8 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
"\t[SubjectDomainCombiner]"); "\t[SubjectDomainCombiner]");
// Note: check only at classloading time, not dynamically during combine() // Note: check only at classloading time, not dynamically during combine()
private static final boolean useJavaxPolicy = compatPolicy(); private static final boolean useJavaxPolicy =
javax.security.auth.Policy.isCustomPolicySet(debug);
// Relevant only when useJavaxPolicy is true // Relevant only when useJavaxPolicy is true
private static final boolean allowCaching = private static final boolean allowCaching =
...@@ -202,8 +199,8 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner { ...@@ -202,8 +199,8 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
return null; return null;
} }
// maintain backwards compatibility for people who provide // maintain backwards compatibility for developers who provide
// their own javax.security.auth.Policy implementations // their own custom javax.security.auth.Policy implementations
if (useJavaxPolicy) { if (useJavaxPolicy) {
return combineJavaxPolicy(currentDomains, assignedDomains); return combineJavaxPolicy(currentDomains, assignedDomains);
} }
...@@ -476,8 +473,7 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner { ...@@ -476,8 +473,7 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
String s = AccessController.doPrivileged String s = AccessController.doPrivileged
(new PrivilegedAction<String>() { (new PrivilegedAction<String>() {
public String run() { public String run() {
return java.security.Security.getProperty return Security.getProperty("cache.auth.policy");
("cache.auth.policy");
} }
}); });
if (s != null) { if (s != null) {
...@@ -488,29 +484,6 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner { ...@@ -488,29 +484,6 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
return true; return true;
} }
// maintain backwards compatibility for people who provide
// their own javax.security.auth.Policy implementations
private static boolean compatPolicy() {
javax.security.auth.Policy javaxPolicy = AccessController.doPrivileged
(new PrivilegedAction<javax.security.auth.Policy>() {
public javax.security.auth.Policy run() {
return javax.security.auth.Policy.getPolicy();
}
});
if (!(javaxPolicy instanceof com.sun.security.auth.PolicyFile)) {
if (debug != null) {
debug.println("Providing backwards compatibility for " +
"javax.security.auth.policy implementation: " +
javaxPolicy.toString());
}
return true;
} else {
return false;
}
}
private static void printInputDomains(ProtectionDomain[] currentDomains, private static void printInputDomains(ProtectionDomain[] currentDomains,
ProtectionDomain[] assignedDomains) { ProtectionDomain[] assignedDomains) {
if (currentDomains == null || currentDomains.length == 0) { if (currentDomains == null || currentDomains.length == 0) {
......
...@@ -1379,6 +1379,10 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl ...@@ -1379,6 +1379,10 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl
* If <code>true</code> and the button has a border, * If <code>true</code> and the button has a border,
* the border is painted. The default value for the * the border is painted. The default value for the
* <code>borderPainted</code> property is <code>true</code>. * <code>borderPainted</code> property is <code>true</code>.
* <p/>
* Some look and feels might not support
* the <code>borderPainted</code> property,
* in which case they ignore this.
* *
* @param b if true and border property is not <code>null</code>, * @param b if true and border property is not <code>null</code>,
* the border is painted * the border is painted
......
...@@ -273,7 +273,7 @@ public class BorderFactory ...@@ -273,7 +273,7 @@ public class BorderFactory
* @since 1.7 * @since 1.7
*/ */
public static Border createSoftBevelBorder(int type, Color highlight, Color shadow) { public static Border createSoftBevelBorder(int type, Color highlight, Color shadow) {
return new BevelBorder(type, highlight, shadow); return new SoftBevelBorder(type, highlight, shadow);
} }
/** /**
...@@ -295,7 +295,7 @@ public class BorderFactory ...@@ -295,7 +295,7 @@ public class BorderFactory
* @since 1.7 * @since 1.7
*/ */
public static Border createSoftBevelBorder(int type, Color highlightOuter, Color highlightInner, Color shadowOuter, Color shadowInner) { public static Border createSoftBevelBorder(int type, Color highlightOuter, Color highlightInner, Color shadowOuter, Color shadowInner) {
return new BevelBorder(type, highlightOuter, highlightInner, shadowOuter, shadowInner); return new SoftBevelBorder(type, highlightOuter, highlightInner, shadowOuter, shadowInner);
} }
//// EtchedBorder /////////////////////////////////////////////////////////// //// EtchedBorder ///////////////////////////////////////////////////////////
......
...@@ -322,7 +322,7 @@ public final class JLayer<V extends Component> ...@@ -322,7 +322,7 @@ public final class JLayer<V extends Component>
} }
/** /**
* A non-{@code null] border, or non-zero insets, isn't supported, to prevent the geometry * A non-{@code null} border, or non-zero insets, isn't supported, to prevent the geometry
* of this component from becoming complex enough to inhibit * of this component from becoming complex enough to inhibit
* subclassing of {@code LayerUI} class. To create a {@code JLayer} with a border, * subclassing of {@code LayerUI} class. To create a {@code JLayer} with a border,
* add it to a {@code JPanel} that has a border. * add it to a {@code JPanel} that has a border.
...@@ -373,9 +373,13 @@ public final class JLayer<V extends Component> ...@@ -373,9 +373,13 @@ public final class JLayer<V extends Component>
* {@inheritDoc} * {@inheritDoc}
*/ */
public void removeAll() { public void removeAll() {
if (view != null) {
setView(null); setView(null);
}
if (glassPane != null) {
setGlassPane(null); setGlassPane(null);
} }
}
/** /**
* Always returns {@code true} to cause painting to originate from {@code JLayer}, * Always returns {@code true} to cause painting to originate from {@code JLayer},
......
...@@ -1443,6 +1443,10 @@ public class JTabbedPane extends JComponent ...@@ -1443,6 +1443,10 @@ public class JTabbedPane extends JComponent
* which can be <code>null</code>, in which case the tab's background color * which can be <code>null</code>, in which case the tab's background color
* will default to the background color of the <code>tabbedpane</code>. * will default to the background color of the <code>tabbedpane</code>.
* An internal exception is raised if there is no tab at that index. * An internal exception is raised if there is no tab at that index.
* <p/>
* It is up to the look and feel to honor this property, some may
* choose to ignore it.
*
* @param index the tab index where the background should be set * @param index the tab index where the background should be set
* @param background the color to be displayed in the tab's background * @param background the color to be displayed in the tab's background
* @exception IndexOutOfBoundsException if index is out of range * @exception IndexOutOfBoundsException if index is out of range
...@@ -1472,6 +1476,9 @@ public class JTabbedPane extends JComponent ...@@ -1472,6 +1476,9 @@ public class JTabbedPane extends JComponent
* <code>null</code>, in which case the tab's foreground color * <code>null</code>, in which case the tab's foreground color
* will default to the foreground color of this <code>tabbedpane</code>. * will default to the foreground color of this <code>tabbedpane</code>.
* An internal exception is raised if there is no tab at that index. * An internal exception is raised if there is no tab at that index.
* <p/>
* It is up to the look and feel to honor this property, some may
* choose to ignore it.
* *
* @param index the tab index where the foreground should be set * @param index the tab index where the foreground should be set
* @param foreground the color to be displayed as the tab's foreground * @param foreground the color to be displayed as the tab's foreground
......
...@@ -234,7 +234,7 @@ public class TitledBorder extends AbstractBorder ...@@ -234,7 +234,7 @@ public class TitledBorder extends AbstractBorder
* @param height the height of the painted border * @param height the height of the painted border
*/ */
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Border border = getBorderUI(); Border border = getBorder();
String title = getTitle(); String title = getTitle();
if ((title != null) && !title.isEmpty()) { if ((title != null) && !title.isEmpty()) {
int edge = (border instanceof TitledBorder) ? 0 : EDGE_SPACING; int edge = (border instanceof TitledBorder) ? 0 : EDGE_SPACING;
...@@ -347,7 +347,7 @@ public class TitledBorder extends AbstractBorder ...@@ -347,7 +347,7 @@ public class TitledBorder extends AbstractBorder
* @param insets the object to be reinitialized * @param insets the object to be reinitialized
*/ */
public Insets getBorderInsets(Component c, Insets insets) { public Insets getBorderInsets(Component c, Insets insets) {
Border border = getBorderUI(); Border border = getBorder();
if (border == null) { if (border == null) {
insets.set(0, 0, 0, 0); insets.set(0, 0, 0, 0);
} }
...@@ -402,22 +402,34 @@ public class TitledBorder extends AbstractBorder ...@@ -402,22 +402,34 @@ public class TitledBorder extends AbstractBorder
/** /**
* Returns whether or not the border is opaque. * Returns whether or not the border is opaque.
*/ */
public boolean isBorderOpaque() { return false; } public boolean isBorderOpaque() {
return false;
}
/** /**
* Returns the title of the titled border. * Returns the title of the titled border.
*
* @return the title of the titled border
*/ */
public String getTitle() { return title; } public String getTitle() {
return title;
}
/** /**
* Returns the border of the titled border. * Returns the border of the titled border.
*
* @return the border of the titled border
*/ */
public Border getBorder() { public Border getBorder() {
return border; return border != null
? border
: UIManager.getBorder("TitledBorder.border");
} }
/** /**
* Returns the title-position of the titled border. * Returns the title-position of the titled border.
*
* @return the title-position of the titled border
*/ */
public int getTitlePosition() { public int getTitlePosition() {
return titlePosition; return titlePosition;
...@@ -425,11 +437,17 @@ public class TitledBorder extends AbstractBorder ...@@ -425,11 +437,17 @@ public class TitledBorder extends AbstractBorder
/** /**
* Returns the title-justification of the titled border. * Returns the title-justification of the titled border.
*
* @return the title-justification of the titled border
*/ */
public int getTitleJustification() { return titleJustification; } public int getTitleJustification() {
return titleJustification;
}
/** /**
* Returns the title-font of the titled border. * Returns the title-font of the titled border.
*
* @return the title-font of the titled border
*/ */
public Font getTitleFont() { public Font getTitleFont() {
return titleFont; return titleFont;
...@@ -437,6 +455,8 @@ public class TitledBorder extends AbstractBorder ...@@ -437,6 +455,8 @@ public class TitledBorder extends AbstractBorder
/** /**
* Returns the title-color of the titled border. * Returns the title-color of the titled border.
*
* @return the title-color of the titled border
*/ */
public Color getTitleColor() { public Color getTitleColor() {
return titleColor; return titleColor;
...@@ -447,15 +467,19 @@ public class TitledBorder extends AbstractBorder ...@@ -447,15 +467,19 @@ public class TitledBorder extends AbstractBorder
/** /**
* Sets the title of the titled border. * Sets the title of the titled border.
* param title the title for the border * @param title the title for the border
*/ */
public void setTitle(String title) { this.title = title; } public void setTitle(String title) {
this.title = title;
}
/** /**
* Sets the border of the titled border. * Sets the border of the titled border.
* @param border the border * @param border the border
*/ */
public void setBorder(Border border) { this.border = border; } public void setBorder(Border border) {
this.border = border;
}
/** /**
* Sets the title-position of the titled border. * Sets the title-position of the titled border.
...@@ -518,6 +542,7 @@ public class TitledBorder extends AbstractBorder ...@@ -518,6 +542,7 @@ public class TitledBorder extends AbstractBorder
* Returns the minimum dimensions this border requires * Returns the minimum dimensions this border requires
* in order to fully display the border and title. * in order to fully display the border and title.
* @param c the component where this border will be drawn * @param c the component where this border will be drawn
* @return the {@code Dimension} object
*/ */
public Dimension getMinimumSize(Component c) { public Dimension getMinimumSize(Component c) {
Insets insets = getBorderInsets(c); Insets insets = getBorderInsets(c);
...@@ -557,7 +582,7 @@ public class TitledBorder extends AbstractBorder ...@@ -557,7 +582,7 @@ public class TitledBorder extends AbstractBorder
if (height < 0) { if (height < 0) {
throw new IllegalArgumentException("Height must be >= 0"); throw new IllegalArgumentException("Height must be >= 0");
} }
Border border = getBorderUI(); Border border = getBorder();
String title = getTitle(); String title = getTitle();
if ((title != null) && !title.isEmpty()) { if ((title != null) && !title.isEmpty()) {
int edge = (border instanceof TitledBorder) ? 0 : EDGE_SPACING; int edge = (border instanceof TitledBorder) ? 0 : EDGE_SPACING;
...@@ -616,13 +641,6 @@ public class TitledBorder extends AbstractBorder ...@@ -616,13 +641,6 @@ public class TitledBorder extends AbstractBorder
return Component.BaselineResizeBehavior.OTHER; return Component.BaselineResizeBehavior.OTHER;
} }
private Border getBorderUI() {
Border border = getBorder();
return border != null
? border
: UIManager.getBorder("TitledBorder.border");
}
private int getPosition() { private int getPosition() {
int position = getTitlePosition(); int position = getTitlePosition();
if (position != DEFAULT_POSITION) { if (position != DEFAULT_POSITION) {
......
...@@ -449,8 +449,8 @@ public class LayerUI<V extends Component> ...@@ -449,8 +449,8 @@ public class LayerUI<V extends Component>
/** /**
* Configures the {@code JLayer} this {@code LayerUI} is set to. * Configures the {@code JLayer} this {@code LayerUI} is set to.
* The default implementation registers the {@code LayerUI} * The default implementation registers the passed {@code JLayer} component
* as a property change listener for the passed {@code JLayer} component. * as a {@code PropertyChangeListener} for the property changes of this {@code LayerUI}.
* *
* @param c the {@code JLayer} component where this UI delegate is being installed * @param c the {@code JLayer} component where this UI delegate is being installed
*/ */
...@@ -461,8 +461,8 @@ public class LayerUI<V extends Component> ...@@ -461,8 +461,8 @@ public class LayerUI<V extends Component>
/** /**
* Reverses the configuration which was previously set * Reverses the configuration which was previously set
* in the {@link #installUI(JComponent)} method. * in the {@link #installUI(JComponent)} method.
* The default implementation unregisters the property change listener * The default implementation unregisters the passed {@code JLayer} component
* for the passed JLayer component. * as a {@code PropertyChangeListener} for the property changes of this {@code LayerUI}.
* *
* @param c the component from which this UI delegate is being removed. * @param c the component from which this UI delegate is being removed.
*/ */
......
...@@ -196,6 +196,10 @@ public class BasicMenuUI extends BasicMenuItemUI ...@@ -196,6 +196,10 @@ public class BasicMenuUI extends BasicMenuItemUI
return getHandler(); return getHandler();
} }
protected MenuKeyListener createMenuKeyListener(JComponent c) {
return (MenuKeyListener)getHandler();
}
public Dimension getMaximumSize(JComponent c) { public Dimension getMaximumSize(JComponent c) {
if (((JMenu)menuItem).isTopLevelMenu() == true) { if (((JMenu)menuItem).isTopLevelMenu() == true) {
Dimension d = c.getPreferredSize(); Dimension d = c.getPreferredSize();
...@@ -397,7 +401,7 @@ public class BasicMenuUI extends BasicMenuItemUI ...@@ -397,7 +401,7 @@ public class BasicMenuUI extends BasicMenuItemUI
public void stateChanged(ChangeEvent e) { } public void stateChanged(ChangeEvent e) { }
} }
private class Handler extends BasicMenuItemUI.Handler { private class Handler extends BasicMenuItemUI.Handler implements MenuKeyListener {
// //
// PropertyChangeListener // PropertyChangeListener
// //
...@@ -580,5 +584,48 @@ public class BasicMenuUI extends BasicMenuItemUI ...@@ -580,5 +584,48 @@ public class BasicMenuUI extends BasicMenuItemUI
} }
public void menuDragMouseExited(MenuDragMouseEvent e) {} public void menuDragMouseExited(MenuDragMouseEvent e) {}
public void menuDragMouseReleased(MenuDragMouseEvent e) {} public void menuDragMouseReleased(MenuDragMouseEvent e) {}
//
// MenuKeyListener
//
/**
* Open the Menu
*/
public void menuKeyTyped(MenuKeyEvent e) {
if (!crossMenuMnemonic && BasicPopupMenuUI.getLastPopup() != null) {
// when crossMenuMnemonic is not set, we don't open a toplevel
// menu if another toplevel menu is already open
return;
}
if (BasicPopupMenuUI.getPopups().size() != 0) {
//Fix 6939261: to return in case not on the main menu
//and has a pop-up.
//after return code will be handled in BasicPopupMenuUI.java
return;
}
char key = Character.toLowerCase((char)menuItem.getMnemonic());
MenuElement path[] = e.getPath();
if (key == Character.toLowerCase(e.getKeyChar())) {
JPopupMenu popupMenu = ((JMenu)menuItem).getPopupMenu();
ArrayList newList = new ArrayList(Arrays.asList(path));
newList.add(popupMenu);
MenuElement subs[] = popupMenu.getSubElements();
MenuElement sub =
BasicPopupMenuUI.findEnabledChild(subs, -1, true);
if(sub != null) {
newList.add(sub);
}
MenuSelectionManager manager = e.getMenuSelectionManager();
MenuElement newPath[] = new MenuElement[0];;
newPath = (MenuElement[]) newList.toArray(newPath);
manager.setSelectedPath(newPath);
e.consume();
}
}
public void menuKeyPressed(MenuKeyEvent e) {}
public void menuKeyReleased(MenuKeyEvent e) {}
} }
} }
...@@ -81,17 +81,26 @@ public class MetalScrollPaneUI extends BasicScrollPaneUI ...@@ -81,17 +81,26 @@ public class MetalScrollPaneUI extends BasicScrollPaneUI
} }
} }
public void installListeners(JScrollPane scrollPane) { public void installListeners(JScrollPane scrollPane) {
super.installListeners(scrollPane); super.installListeners(scrollPane);
scrollBarSwapListener = createScrollBarSwapListener(); scrollBarSwapListener = createScrollBarSwapListener();
scrollPane.addPropertyChangeListener(scrollBarSwapListener); scrollPane.addPropertyChangeListener(scrollBarSwapListener);
} }
/**
* {@inheritDoc}
*/
protected void uninstallListeners(JComponent c) {
super.uninstallListeners(c);
c.removePropertyChangeListener(scrollBarSwapListener);
}
/**
* @deprecated - Replaced by {@link #uninstallListeners(JComponent)}
*/
@Deprecated
public void uninstallListeners(JScrollPane scrollPane) { public void uninstallListeners(JScrollPane scrollPane) {
super.uninstallListeners(scrollPane); super.uninstallListeners(scrollPane);
scrollPane.removePropertyChangeListener(scrollBarSwapListener); scrollPane.removePropertyChangeListener(scrollBarSwapListener);
} }
......
/*
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.io;
import sun.nio.cs.ext.IBM833;
public class ByteToCharCp833 extends ByteToCharSingleByte {
private final static IBM833 nioCoder = new IBM833();
public String getCharacterEncoding() {
return "Cp833";
}
public ByteToCharCp833() {
super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
}
}
/*
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.io;
import sun.nio.cs.ext.IBM833;
public class CharToByteCp833 extends CharToByteSingleByte {
private final static IBM833 nioCoder = new IBM833();
public String getCharacterEncoding() {
return "Cp833";
}
public CharToByteCp833() {
super.mask1 = 0xFF00;
super.mask2 = 0x00FF;
super.shift = 8;
super.index1 = nioCoder.getEncoderIndex1();
super.index2 = nioCoder.getEncoderIndex2();
}
}
/* /*
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2010, Oracle and/or its affiliates. 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
...@@ -406,6 +406,11 @@ public class CharacterEncoding { ...@@ -406,6 +406,11 @@ public class CharacterEncoding {
aliasTable.put("cp775", "Cp775"); aliasTable.put("cp775", "Cp775");
aliasTable.put("775", "Cp775"); aliasTable.put("775", "Cp775");
aliasTable.put("ibm833", "Cp833");
aliasTable.put("ibm-833", "Cp833");
aliasTable.put("cp833", "Cp833");
aliasTable.put("833", "Cp833");
aliasTable.put("ibm834", "Cp834"); aliasTable.put("ibm834", "Cp834");
aliasTable.put("ibm-834", "Cp834"); aliasTable.put("ibm-834", "Cp834");
aliasTable.put("cp834", "Cp834"); aliasTable.put("cp834", "Cp834");
......
...@@ -44,8 +44,16 @@ import java.io.IOException; ...@@ -44,8 +44,16 @@ import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Properties;
import java.util.jar.Attributes; import java.util.jar.Attributes;
import java.util.jar.JarFile; import java.util.jar.JarFile;
import java.util.jar.Manifest; import java.util.jar.Manifest;
...@@ -59,6 +67,17 @@ public enum LauncherHelper { ...@@ -59,6 +67,17 @@ public enum LauncherHelper {
private static StringBuilder outBuf = new StringBuilder(); private static StringBuilder outBuf = new StringBuilder();
private static ResourceBundle javarb = null; private static ResourceBundle javarb = null;
private static final String INDENT = " ";
private static final String VM_SETTINGS = "VM settings:";
private static final String PROP_SETTINGS = "Property settings:";
private static final String LOCALE_SETTINGS = "Locale settings:";
private static final long K = 1024;
private static final long M = K * K;
private static final long G = M * K;
private static final long T = G * K;
private static synchronized ResourceBundle getLauncherResourceBundle() { private static synchronized ResourceBundle getLauncherResourceBundle() {
if (javarb == null) { if (javarb == null) {
javarb = ResourceBundle.getBundle(defaultBundleName); javarb = ResourceBundle.getBundle(defaultBundleName);
...@@ -66,6 +85,184 @@ public enum LauncherHelper { ...@@ -66,6 +85,184 @@ public enum LauncherHelper {
return javarb; return javarb;
} }
/*
* A method called by the launcher to print out the standard settings,
* by default -XshowSettings is equivalent to -XshowSettings:all,
* Specific information may be gotten by using suboptions with possible
* values vm, properties and locale.
*
* printToStderr: choose between stdout and stderr
*
* optionFlag: specifies which options to print default is all other
* possible values are vm, properties, locale.
*
* maxHeapSize: in bytes, as set by the launcher, a zero-value indicates
* this code should determine this value, using a suitable method.
*
* stackSize: in bytes, as set by the launcher, a zero-value indicates
* this code determine this value, using a suitable method.
*/
static void showSettings(boolean printToStderr, String optionFlag,
long maxHeapSize, long stackSize, boolean isServer) {
PrintStream ostream = (printToStderr) ? System.err : System.out;
String opts[] = optionFlag.split(":");
String optStr = (opts.length > 1 && opts[1] != null)
? opts[1].trim()
: "all";
switch (optStr) {
case "vm":
printVmSettings(ostream, maxHeapSize, stackSize, isServer);
break;
case "properties":
printProperties(ostream);
break;
case "locale":
printLocale(ostream);
break;
default:
printVmSettings(ostream, maxHeapSize, stackSize, isServer);
printProperties(ostream);
printLocale(ostream);
break;
}
}
/*
* prints the main vm settings subopt/section
*/
private static void printVmSettings(PrintStream ostream, long maxHeapSize,
long stackSize, boolean isServer) {
ostream.println(VM_SETTINGS);
if (stackSize != 0L) {
ostream.println(INDENT + "Stack Size: " + scaleValue(stackSize));
}
if (maxHeapSize != 0L) {
ostream.println(INDENT + "Max. Heap Size: " + scaleValue(maxHeapSize));
} else {
ostream.println(INDENT + "Max. Heap Size (Estimated): "
+ scaleValue(Runtime.getRuntime().maxMemory()));
}
ostream.println(INDENT + "Ergonomics Machine Class: "
+ ((isServer) ? "server" : "client"));
ostream.println(INDENT + "Using VM: "
+ System.getProperty("java.vm.name"));
ostream.println();
}
/*
* scale the incoming values to a human readable form, represented as
* K, M, G and T, see java.c parse_size for the scaled values and
* suffixes.
*/
private static String scaleValue(double v) {
MathContext mc2 = new MathContext(3, RoundingMode.HALF_EVEN);
if (v >= K && v < M) {
return (new BigDecimal(v / K, mc2)).toPlainString() + "K";
} else if (v >= M && v < G) {
return (new BigDecimal(v / M, mc2)).toPlainString() + "M";
} else if (v >= G && v < T) {
return (new BigDecimal(v / G, mc2)).toPlainString() + "G";
} else if (v >= T) {
return (new BigDecimal(v / T, mc2)).toPlainString() + "T";
} else {
return String.format("%.0f", v);
}
}
/*
* prints the properties subopt/section
*/
private static void printProperties(PrintStream ostream) {
Properties p = System.getProperties();
ostream.println(PROP_SETTINGS);
List<String> sortedPropertyKeys = new ArrayList<>();
sortedPropertyKeys.addAll(p.stringPropertyNames());
Collections.sort(sortedPropertyKeys);
for (String x : sortedPropertyKeys) {
printPropertyValue(ostream, x, p.getProperty(x));
}
ostream.println();
}
private static boolean isPath(String key) {
return key.endsWith(".dirs") || key.endsWith(".path");
}
private static void printPropertyValue(PrintStream ostream,
String key, String value) {
ostream.print(INDENT + key + " = ");
if (key.equals("line.separator")) {
byte[] bytes = value.getBytes();
for (byte b : bytes) {
switch (b) {
case 0xd:
ostream.print("CR ");
break;
case 0xa:
ostream.print("LF ");
break;
default:
ostream.printf("0x%02X", b & 0xff);
break;
}
}
ostream.println();
return;
}
if (!isPath(key)) {
ostream.println(value);
return;
}
// pretty print the path values as a list
String[] values = value.split(System.getProperty("path.separator"));
int len = values.length;
for (int i = 0 ; i < len ; i++) {
if (i == 0) { // first line treated specially
ostream.println(values[i]);
} else { // following lines prefix with indents
ostream.print(INDENT + INDENT);
ostream.println(values[i]);
}
}
}
/*
* prints the locale subopt/section
*/
private static void printLocale(PrintStream ostream) {
Locale locale = Locale.getDefault();
ostream.println(LOCALE_SETTINGS);
ostream.println(INDENT + "default locale = " + locale.getDisplayLanguage());
printLocales(ostream);
ostream.println();
}
private static void printLocales(PrintStream ostream) {
Locale[] locales = Locale.getAvailableLocales();
final int len = locales == null ? 0 : locales.length;
if (len < 1 ) {
return;
}
ostream.print(INDENT + "available locales = ");
final int last = len - 1 ;
for (int i = 0; i < last ; i++) {
ostream.print(locales[i]);
if (i != last) {
ostream.print(", ");
}
// print columns of 8
if ((i + 1) % 8 == 0) {
ostream.println();
ostream.print(INDENT + INDENT);
}
}
ostream.println(locales[last]);
}
/** /**
* A private helper method to get a localized message and also * A private helper method to get a localized message and also
* apply any arguments that we might pass. * apply any arguments that we might pass.
......
# #
# Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2007, 2010, Oracle and/or its affiliates. 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
...@@ -97,7 +97,15 @@ java.launcher.X.usage=\ ...@@ -97,7 +97,15 @@ java.launcher.X.usage=\
\ -Xcheck:jni perform additional checks for JNI functions\n\ \ -Xcheck:jni perform additional checks for JNI functions\n\
\ -Xshare:off do not attempt to use shared class data\n\ \ -Xshare:off do not attempt to use shared class data\n\
\ -Xshare:auto use shared class data if possible (default)\n\ \ -Xshare:auto use shared class data if possible (default)\n\
\ -Xshare:on require using shared class data, otherwise fail.\n\n\ \ -Xshare:on require using shared class data, otherwise fail.\n\
\ -XshowSettings show all settings and continue\n\
\ -XshowSettings:all\n\
\ show all settings and continue\n\
\ -XshowSettings:vm show all vm related settings and continue\n\
\ -XshowSettings:properties\n\
\ show all property settings and continue\n\
\ -XshowSettings:locale\n\
\ show all locale related settings and continue\n\n\
The -X options are non-standard and subject to change without notice.\n The -X options are non-standard and subject to change without notice.\n
java.launcher.cls.error1=\ java.launcher.cls.error1=\
......
...@@ -110,6 +110,7 @@ class ChunkedInputStream extends LeftOverInputStream { ...@@ -110,6 +110,7 @@ class ChunkedInputStream extends LeftOverInputStream {
if (remaining == 0) { if (remaining == 0) {
eof = true; eof = true;
consumeCRLF(); consumeCRLF();
t.getServerImpl().requestCompleted (t.getConnection());
return -1; return -1;
} }
needToReadHeader = false; needToReadHeader = false;
......
...@@ -40,5 +40,7 @@ class Event { ...@@ -40,5 +40,7 @@ class Event {
class WriteFinishedEvent extends Event { class WriteFinishedEvent extends Event {
WriteFinishedEvent (ExchangeImpl t) { WriteFinishedEvent (ExchangeImpl t) {
super (t); super (t);
assert !t.writefinished;
t.writefinished = true;
} }
} }
...@@ -38,6 +38,7 @@ class ExchangeImpl { ...@@ -38,6 +38,7 @@ class ExchangeImpl {
Headers reqHdrs, rspHdrs; Headers reqHdrs, rspHdrs;
Request req; Request req;
String method; String method;
boolean writefinished;
URI uri; URI uri;
HttpConnection connection; HttpConnection connection;
long reqContentLen; long reqContentLen;
......
...@@ -56,6 +56,9 @@ class FixedLengthInputStream extends LeftOverInputStream { ...@@ -56,6 +56,9 @@ class FixedLengthInputStream extends LeftOverInputStream {
int n = in.read(b, off, len); int n = in.read(b, off, len);
if (n > -1) { if (n > -1) {
remaining -= n; remaining -= n;
if (remaining == 0) {
t.getServerImpl().requestCompleted (t.getConnection());
}
} }
return n; return n;
} }
......
...@@ -55,10 +55,15 @@ class HttpConnection { ...@@ -55,10 +55,15 @@ class HttpConnection {
SelectionKey selectionKey; SelectionKey selectionKey;
String protocol; String protocol;
long time; long time;
volatile long creationTime; // time this connection was created
volatile long rspStartedTime; // time we started writing the response
int remaining; int remaining;
boolean closed = false; boolean closed = false;
Logger logger; Logger logger;
public enum State {IDLE, REQUEST, RESPONSE};
volatile State state;
public String toString() { public String toString() {
String s = null; String s = null;
if (chan != null) { if (chan != null) {
...@@ -78,6 +83,14 @@ class HttpConnection { ...@@ -78,6 +83,14 @@ class HttpConnection {
context = ctx; context = ctx;
} }
State getState() {
return state;
}
void setState (State s) {
state = s;
}
void setParameters ( void setParameters (
InputStream in, OutputStream rawout, SocketChannel chan, InputStream in, OutputStream rawout, SocketChannel chan,
SSLEngine engine, SSLStreams sslStreams, SSLContext sslContext, String protocol, SSLEngine engine, SSLStreams sslStreams, SSLContext sslContext, String protocol,
......
...@@ -201,32 +201,22 @@ class Request { ...@@ -201,32 +201,22 @@ class Request {
static class ReadStream extends InputStream { static class ReadStream extends InputStream {
SocketChannel channel; SocketChannel channel;
SelectorCache sc;
Selector selector;
ByteBuffer chanbuf; ByteBuffer chanbuf;
SelectionKey key;
int available;
byte[] one; byte[] one;
boolean closed = false, eof = false; private boolean closed = false, eof = false;
ByteBuffer markBuf; /* reads may be satisifed from this buffer */ ByteBuffer markBuf; /* reads may be satisifed from this buffer */
boolean marked; boolean marked;
boolean reset; boolean reset;
int readlimit; int readlimit;
static long readTimeout; static long readTimeout;
ServerImpl server; ServerImpl server;
final static int BUFSIZE = 8 * 1024;
static {
readTimeout = ServerConfig.getReadTimeout();
}
public ReadStream (ServerImpl server, SocketChannel chan) throws IOException { public ReadStream (ServerImpl server, SocketChannel chan) throws IOException {
this.channel = chan; this.channel = chan;
this.server = server; this.server = server;
sc = SelectorCache.getSelectorCache(); chanbuf = ByteBuffer.allocate (BUFSIZE);
selector = sc.getSelector(); chanbuf.clear();
chanbuf = ByteBuffer.allocate (8* 1024);
key = chan.register (selector, SelectionKey.OP_READ);
available = 0;
one = new byte[1]; one = new byte[1];
closed = marked = reset = false; closed = marked = reset = false;
} }
...@@ -255,6 +245,12 @@ class Request { ...@@ -255,6 +245,12 @@ class Request {
return -1; return -1;
} }
assert channel.isBlocking();
if (off < 0 || srclen < 0|| srclen > (b.length-off)) {
throw new IndexOutOfBoundsException ();
}
if (reset) { /* satisfy from markBuf */ if (reset) { /* satisfy from markBuf */
canreturn = markBuf.remaining (); canreturn = markBuf.remaining ();
willreturn = canreturn>srclen ? srclen : canreturn; willreturn = canreturn>srclen ? srclen : canreturn;
...@@ -263,17 +259,19 @@ class Request { ...@@ -263,17 +259,19 @@ class Request {
reset = false; reset = false;
} }
} else { /* satisfy from channel */ } else { /* satisfy from channel */
canreturn = available(); chanbuf.clear ();
while (canreturn == 0 && !eof) { if (srclen < BUFSIZE) {
block (); chanbuf.limit (srclen);
canreturn = available();
} }
if (eof) { do {
willreturn = channel.read (chanbuf);
} while (willreturn == 0);
if (willreturn == -1) {
eof = true;
return -1; return -1;
} }
willreturn = canreturn>srclen ? srclen : canreturn; chanbuf.flip ();
chanbuf.get(b, off, willreturn); chanbuf.get(b, off, willreturn);
available -= willreturn;
if (marked) { /* copy into markBuf */ if (marked) { /* copy into markBuf */
try { try {
...@@ -286,6 +284,11 @@ class Request { ...@@ -286,6 +284,11 @@ class Request {
return willreturn; return willreturn;
} }
public boolean markSupported () {
return true;
}
/* Does not query the OS socket */
public synchronized int available () throws IOException { public synchronized int available () throws IOException {
if (closed) if (closed)
throw new IOException ("Stream is closed"); throw new IOException ("Stream is closed");
...@@ -296,36 +299,7 @@ class Request { ...@@ -296,36 +299,7 @@ class Request {
if (reset) if (reset)
return markBuf.remaining(); return markBuf.remaining();
if (available > 0) return chanbuf.remaining();
return available;
chanbuf.clear ();
available = channel.read (chanbuf);
if (available > 0) {
chanbuf.flip();
} else if (available == -1) {
eof = true;
available = 0;
}
return available;
}
/**
* block() only called when available==0 and buf is empty
*/
private synchronized void block () throws IOException {
long currtime = server.getTime();
long maxtime = currtime + readTimeout;
while (currtime < maxtime) {
if (selector.select (readTimeout) == 1) {
selector.selectedKeys().clear();
available ();
return;
}
currtime = server.getTime();
}
throw new SocketTimeoutException ("no data received");
} }
public void close () throws IOException { public void close () throws IOException {
...@@ -333,8 +307,6 @@ class Request { ...@@ -333,8 +307,6 @@ class Request {
return; return;
} }
channel.close (); channel.close ();
selector.selectNow();
sc.freeSelector(selector);
closed = true; closed = true;
} }
...@@ -362,23 +334,14 @@ class Request { ...@@ -362,23 +334,14 @@ class Request {
SocketChannel channel; SocketChannel channel;
ByteBuffer buf; ByteBuffer buf;
SelectionKey key; SelectionKey key;
SelectorCache sc;
Selector selector;
boolean closed; boolean closed;
byte[] one; byte[] one;
ServerImpl server; ServerImpl server;
static long writeTimeout;
static {
writeTimeout = ServerConfig.getWriteTimeout();
}
public WriteStream (ServerImpl server, SocketChannel channel) throws IOException { public WriteStream (ServerImpl server, SocketChannel channel) throws IOException {
this.channel = channel; this.channel = channel;
this.server = server; this.server = server;
sc = SelectorCache.getSelectorCache(); assert channel.isBlocking();
selector = sc.getSelector();
key = channel.register (selector, SelectionKey.OP_WRITE);
closed = false; closed = false;
one = new byte [1]; one = new byte [1];
buf = ByteBuffer.allocate (4096); buf = ByteBuffer.allocate (4096);
...@@ -411,31 +374,14 @@ class Request { ...@@ -411,31 +374,14 @@ class Request {
l -= n; l -= n;
if (l == 0) if (l == 0)
return; return;
block();
}
}
void block () throws IOException {
long currtime = server.getTime();
long maxtime = currtime + writeTimeout;
while (currtime < maxtime) {
if (selector.select (writeTimeout) == 1) {
selector.selectedKeys().clear ();
return;
} }
currtime = server.getTime();
} }
throw new SocketTimeoutException ("write blocked too long");
}
public void close () throws IOException { public void close () throws IOException {
if (closed) if (closed)
return; return;
//server.logStackTrace ("Request.OS.close: isOpen="+channel.isOpen());
channel.close (); channel.close ();
selector.selectNow();
sc.freeSelector(selector);
closed = true; closed = true;
} }
} }
......
...@@ -53,8 +53,6 @@ class SSLStreams { ...@@ -53,8 +53,6 @@ class SSLStreams {
EngineWrapper wrapper; EngineWrapper wrapper;
OutputStream os; OutputStream os;
InputStream is; InputStream is;
static long readTimeout = ServerConfig.getReadTimeout();
static long writeTimeout = ServerConfig.getWriteTimeout();
/* held by thread doing the hand-shake on this connection */ /* held by thread doing the hand-shake on this connection */
Lock handshaking = new ReentrantLock(); Lock handshaking = new ReentrantLock();
...@@ -77,10 +75,13 @@ class SSLStreams { ...@@ -77,10 +75,13 @@ class SSLStreams {
if (cfg != null) { if (cfg != null) {
Parameters params = new Parameters (cfg, addr); Parameters params = new Parameters (cfg, addr);
cfg.configure (params); cfg.configure (params);
//BEGIN_TIGER_EXCLUDE
SSLParameters sslParams = params.getSSLParameters(); SSLParameters sslParams = params.getSSLParameters();
if (sslParams != null) { if (sslParams != null) {
engine.setSSLParameters (sslParams); engine.setSSLParameters (sslParams);
} else { } else
//END_TIGER_EXCLUDE
{
/* tiger compatibility */ /* tiger compatibility */
if (params.getCipherSuites() != null) { if (params.getCipherSuites() != null) {
try { try {
...@@ -104,7 +105,6 @@ class SSLStreams { ...@@ -104,7 +105,6 @@ class SSLStreams {
class Parameters extends HttpsParameters { class Parameters extends HttpsParameters {
InetSocketAddress addr; InetSocketAddress addr;
SSLParameters params;
HttpsConfigurator cfg; HttpsConfigurator cfg;
Parameters (HttpsConfigurator cfg, InetSocketAddress addr) { Parameters (HttpsConfigurator cfg, InetSocketAddress addr) {
...@@ -117,12 +117,15 @@ class SSLStreams { ...@@ -117,12 +117,15 @@ class SSLStreams {
public HttpsConfigurator getHttpsConfigurator() { public HttpsConfigurator getHttpsConfigurator() {
return cfg; return cfg;
} }
//BEGIN_TIGER_EXCLUDE
SSLParameters params;
public void setSSLParameters (SSLParameters p) { public void setSSLParameters (SSLParameters p) {
params = p; params = p;
} }
SSLParameters getSSLParameters () { SSLParameters getSSLParameters () {
return params; return params;
} }
//END_TIGER_EXCLUDE
} }
/** /**
...@@ -245,9 +248,6 @@ class SSLStreams { ...@@ -245,9 +248,6 @@ class SSLStreams {
SocketChannel chan; SocketChannel chan;
SSLEngine engine; SSLEngine engine;
SelectorCache sc;
Selector write_selector, read_selector;
SelectionKey wkey, rkey;
Object wrapLock, unwrapLock; Object wrapLock, unwrapLock;
ByteBuffer unwrap_src, wrap_dst; ByteBuffer unwrap_src, wrap_dst;
boolean closed = false; boolean closed = false;
...@@ -260,16 +260,9 @@ class SSLStreams { ...@@ -260,16 +260,9 @@ class SSLStreams {
unwrapLock = new Object(); unwrapLock = new Object();
unwrap_src = allocate(BufType.PACKET); unwrap_src = allocate(BufType.PACKET);
wrap_dst = allocate(BufType.PACKET); wrap_dst = allocate(BufType.PACKET);
sc = SelectorCache.getSelectorCache();
write_selector = sc.getSelector();
wkey = chan.register (write_selector, SelectionKey.OP_WRITE);
read_selector = sc.getSelector();
wkey = chan.register (read_selector, SelectionKey.OP_READ);
} }
void close () throws IOException { void close () throws IOException {
sc.freeSelector (write_selector);
sc.freeSelector (read_selector);
} }
/* try to wrap and send the data in src. Handles OVERFLOW. /* try to wrap and send the data in src. Handles OVERFLOW.
...@@ -304,15 +297,7 @@ class SSLStreams { ...@@ -304,15 +297,7 @@ class SSLStreams {
wrap_dst.flip(); wrap_dst.flip();
int l = wrap_dst.remaining(); int l = wrap_dst.remaining();
assert l == r.result.bytesProduced(); assert l == r.result.bytesProduced();
long currtime = time.getTime();
long maxtime = currtime + writeTimeout;
while (l>0) { while (l>0) {
write_selector.select(writeTimeout); // timeout
currtime = time.getTime();
if (currtime > maxtime) {
throw new SocketTimeoutException ("write timed out");
}
write_selector.selectedKeys().clear();
l -= chan.write (wrap_dst); l -= chan.write (wrap_dst);
} }
} }
...@@ -342,20 +327,12 @@ class SSLStreams { ...@@ -342,20 +327,12 @@ class SSLStreams {
needData = true; needData = true;
} }
synchronized (unwrapLock) { synchronized (unwrapLock) {
int x,y; int x;
do { do {
if (needData) { if (needData) {
long currTime = time.getTime();
long maxtime = currTime + readTimeout;
do { do {
if (currTime > maxtime) {
throw new SocketTimeoutException ("read timedout");
}
y = read_selector.select (readTimeout);
currTime = time.getTime();
} while (y != 1);
read_selector.selectedKeys().clear();
x = chan.read (unwrap_src); x = chan.read (unwrap_src);
} while (x == 0);
if (x == -1) { if (x == -1) {
throw new IOException ("connection closed for reading"); throw new IOException ("connection closed for reading");
} }
......
/*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.net.httpserver;
import java.util.*;
import java.nio.*;
import java.net.*;
import java.io.*;
import java.security.*;
import java.nio.channels.*;
/*
* Implements a cache of java.nio.channels.Selector
* where Selectors are allocated on demand and placed
* in a temporary cache for a period of time, so they
* can be reused. If a period of between 2 and 4 minutes
* elapses without being used, then they are closed.
*/
public class SelectorCache {
static SelectorCache cache = null;
private SelectorCache () {
freeSelectors = new LinkedList<SelectorWrapper>();
CacheCleaner c = AccessController.doPrivileged(
new PrivilegedAction<CacheCleaner>() {
public CacheCleaner run() {
CacheCleaner cleaner = new CacheCleaner();
cleaner.setDaemon (true);
return cleaner;
}
});
c.start();
}
/**
* factory method for creating single instance
*/
public static SelectorCache getSelectorCache () {
synchronized (SelectorCache.class) {
if (cache == null) {
cache = new SelectorCache ();
}
}
return cache;
}
private static class SelectorWrapper {
private Selector sel;
private boolean deleteFlag;
private SelectorWrapper (Selector sel) {
this.sel = sel;
this.deleteFlag = false;
}
public Selector getSelector() { return sel;}
public boolean getDeleteFlag () {return deleteFlag;}
public void setDeleteFlag (boolean b) {deleteFlag = b;}
}
/* list of free selectors. Can be re-allocated for a period
* of time, after which if not allocated will be closed
* and removed from the list (by CacheCleaner thread)
*/
LinkedList<SelectorWrapper> freeSelectors;
synchronized Selector getSelector () throws IOException {
SelectorWrapper wrapper = null;
Selector selector;
if (freeSelectors.size() > 0) {
wrapper = freeSelectors.remove();
selector = wrapper.getSelector();
} else {
selector = Selector.open();
}
return selector;
}
synchronized void freeSelector (Selector selector) {
freeSelectors.add (new SelectorWrapper (selector));
}
/* Thread ensures that entries on freeSelector list
* remain there for at least 2 minutes and no longer
* than 4 minutes.
*/
class CacheCleaner extends Thread {
public void run () {
long timeout = ServerConfig.getSelCacheTimeout() * 1000;
while (true) {
try {Thread.sleep (timeout); } catch (Exception e) {}
synchronized (freeSelectors) {
ListIterator<SelectorWrapper> l = freeSelectors.listIterator();
while (l.hasNext()) {
SelectorWrapper w = l.next();
if (w.getDeleteFlag()) {
/* 2nd pass. Close the selector */
try {
w.getSelector().close();
} catch (IOException e) {}
l.remove();
} else {
/* 1st pass. Set the flag */
w.setDeleteFlag (true);
}
}
}
}
}
}
}
...@@ -27,6 +27,8 @@ package sun.net.httpserver; ...@@ -27,6 +27,8 @@ package sun.net.httpserver;
import com.sun.net.httpserver.*; import com.sun.net.httpserver.*;
import com.sun.net.httpserver.spi.*; import com.sun.net.httpserver.spi.*;
import java.util.logging.Logger;
import java.security.PrivilegedAction;
/** /**
* Parameters that users will not likely need to set * Parameters that users will not likely need to set
...@@ -37,23 +39,26 @@ class ServerConfig { ...@@ -37,23 +39,26 @@ class ServerConfig {
static int clockTick; static int clockTick;
static int defaultClockTick = 10000 ; // 10 sec. static final int DEFAULT_CLOCK_TICK = 10000 ; // 10 sec.
/* These values must be a reasonable multiple of clockTick */ /* These values must be a reasonable multiple of clockTick */
static long defaultReadTimeout = 20 ; // 20 sec. static final long DEFAULT_IDLE_INTERVAL = 300 ; // 5 min
static long defaultWriteTimeout = 60 ; // 60 sec. static final int DEFAULT_MAX_IDLE_CONNECTIONS = 200 ;
static long defaultIdleInterval = 300 ; // 5 min
static long defaultSelCacheTimeout = 120 ; // seconds
static int defaultMaxIdleConnections = 200 ;
static long defaultDrainAmount = 64 * 1024; static final long DEFAULT_MAX_REQ_TIME = -1; // default: forever
static final long DEFAULT_MAX_RSP_TIME = -1; // default: forever
static final long DEFAULT_TIMER_MILLIS = 1000;
static final long DEFAULT_DRAIN_AMOUNT = 64 * 1024;
static long readTimeout;
static long writeTimeout;
static long idleInterval; static long idleInterval;
static long selCacheTimeout;
static long drainAmount; // max # of bytes to drain from an inputstream static long drainAmount; // max # of bytes to drain from an inputstream
static int maxIdleConnections; static int maxIdleConnections;
// max time a request or response is allowed to take
static long maxReqTime;
static long maxRspTime;
static long timerMillis;
static boolean debug = false; static boolean debug = false;
static { static {
...@@ -61,49 +66,79 @@ class ServerConfig { ...@@ -61,49 +66,79 @@ class ServerConfig {
idleInterval = ((Long)java.security.AccessController.doPrivileged( idleInterval = ((Long)java.security.AccessController.doPrivileged(
new sun.security.action.GetLongAction( new sun.security.action.GetLongAction(
"sun.net.httpserver.idleInterval", "sun.net.httpserver.idleInterval",
defaultIdleInterval))).longValue() * 1000; DEFAULT_IDLE_INTERVAL))).longValue() * 1000;
clockTick = ((Integer)java.security.AccessController.doPrivileged( clockTick = ((Integer)java.security.AccessController.doPrivileged(
new sun.security.action.GetIntegerAction( new sun.security.action.GetIntegerAction(
"sun.net.httpserver.clockTick", "sun.net.httpserver.clockTick",
defaultClockTick))).intValue(); DEFAULT_CLOCK_TICK))).intValue();
maxIdleConnections = ((Integer)java.security.AccessController.doPrivileged( maxIdleConnections = ((Integer)java.security.AccessController.doPrivileged(
new sun.security.action.GetIntegerAction( new sun.security.action.GetIntegerAction(
"sun.net.httpserver.maxIdleConnections", "sun.net.httpserver.maxIdleConnections",
defaultMaxIdleConnections))).intValue(); DEFAULT_MAX_IDLE_CONNECTIONS))).intValue();
readTimeout = ((Long)java.security.AccessController.doPrivileged( drainAmount = ((Long)java.security.AccessController.doPrivileged(
new sun.security.action.GetLongAction( new sun.security.action.GetLongAction(
"sun.net.httpserver.readTimeout", "sun.net.httpserver.drainAmount",
defaultReadTimeout))).longValue()* 1000; DEFAULT_DRAIN_AMOUNT))).longValue();
selCacheTimeout = ((Long)java.security.AccessController.doPrivileged( maxReqTime = ((Long)java.security.AccessController.doPrivileged(
new sun.security.action.GetLongAction( new sun.security.action.GetLongAction(
"sun.net.httpserver.selCacheTimeout", "sun.net.httpserver.maxReqTime",
defaultSelCacheTimeout))).longValue()* 1000; DEFAULT_MAX_REQ_TIME))).longValue();
writeTimeout = ((Long)java.security.AccessController.doPrivileged( maxRspTime = ((Long)java.security.AccessController.doPrivileged(
new sun.security.action.GetLongAction( new sun.security.action.GetLongAction(
"sun.net.httpserver.writeTimeout", "sun.net.httpserver.maxRspTime",
defaultWriteTimeout))).longValue()* 1000; DEFAULT_MAX_RSP_TIME))).longValue();
drainAmount = ((Long)java.security.AccessController.doPrivileged( timerMillis = ((Long)java.security.AccessController.doPrivileged(
new sun.security.action.GetLongAction( new sun.security.action.GetLongAction(
"sun.net.httpserver.drainAmount", "sun.net.httpserver.timerMillis",
defaultDrainAmount))).longValue(); DEFAULT_TIMER_MILLIS))).longValue();
debug = ((Boolean)java.security.AccessController.doPrivileged( debug = ((Boolean)java.security.AccessController.doPrivileged(
new sun.security.action.GetBooleanAction( new sun.security.action.GetBooleanAction(
"sun.net.httpserver.debug"))).booleanValue(); "sun.net.httpserver.debug"))).booleanValue();
} }
static long getReadTimeout () {
return readTimeout;
}
static long getSelCacheTimeout () { static void checkLegacyProperties (final Logger logger) {
return selCacheTimeout;
// legacy properties that are no longer used
// print a warning to logger if they are set.
java.security.AccessController.doPrivileged(
new PrivilegedAction<Void>() {
public Void run () {
if (System.getProperty("sun.net.httpserver.readTimeout")
!=null)
{
logger.warning ("sun.net.httpserver.readTimeout "+
"property is no longer used. "+
"Use sun.net.httpserver.maxReqTime instead."
);
}
if (System.getProperty("sun.net.httpserver.writeTimeout")
!=null)
{
logger.warning ("sun.net.httpserver.writeTimeout "+
"property is no longer used. Use "+
"sun.net.httpserver.maxRspTime instead."
);
}
if (System.getProperty("sun.net.httpserver.selCacheTimeout")
!=null)
{
logger.warning ("sun.net.httpserver.selCacheTimeout "+
"property is no longer used."
);
}
return null;
}
}
);
} }
static boolean debugEnabled () { static boolean debugEnabled () {
...@@ -122,11 +157,19 @@ class ServerConfig { ...@@ -122,11 +157,19 @@ class ServerConfig {
return maxIdleConnections; return maxIdleConnections;
} }
static long getWriteTimeout () {
return writeTimeout;
}
static long getDrainAmount () { static long getDrainAmount () {
return drainAmount; return drainAmount;
} }
static long getMaxReqTime () {
return maxReqTime;
}
static long getMaxRspTime () {
return maxRspTime;
}
static long getTimerMillis () {
return timerMillis;
}
} }
...@@ -37,6 +37,7 @@ import java.util.logging.Level; ...@@ -37,6 +37,7 @@ import java.util.logging.Level;
import javax.net.ssl.*; import javax.net.ssl.*;
import com.sun.net.httpserver.*; import com.sun.net.httpserver.*;
import com.sun.net.httpserver.spi.*; import com.sun.net.httpserver.spi.*;
import sun.net.httpserver.HttpConnection.State;
/** /**
* Provides implementation for both HTTP and HTTPS * Provides implementation for both HTTP and HTTPS
...@@ -55,6 +56,12 @@ class ServerImpl implements TimeSource { ...@@ -55,6 +56,12 @@ class ServerImpl implements TimeSource {
private SelectionKey listenerKey; private SelectionKey listenerKey;
private Set<HttpConnection> idleConnections; private Set<HttpConnection> idleConnections;
private Set<HttpConnection> allConnections; private Set<HttpConnection> allConnections;
/* following two are used to keep track of the times
* when a connection/request is first received
* and when we start to send the response
*/
private Set<HttpConnection> reqConnections;
private Set<HttpConnection> rspConnections;
private List<Event> events; private List<Event> events;
private Object lolock = new Object(); private Object lolock = new Object();
private volatile boolean finished = false; private volatile boolean finished = false;
...@@ -62,14 +69,19 @@ class ServerImpl implements TimeSource { ...@@ -62,14 +69,19 @@ class ServerImpl implements TimeSource {
private boolean bound = false; private boolean bound = false;
private boolean started = false; private boolean started = false;
private volatile long time; /* current time */ private volatile long time; /* current time */
private volatile long subticks = 0;
private volatile long ticks; /* number of clock ticks since server started */ private volatile long ticks; /* number of clock ticks since server started */
private HttpServer wrapper; private HttpServer wrapper;
final static int CLOCK_TICK = ServerConfig.getClockTick(); final static int CLOCK_TICK = ServerConfig.getClockTick();
final static long IDLE_INTERVAL = ServerConfig.getIdleInterval(); final static long IDLE_INTERVAL = ServerConfig.getIdleInterval();
final static int MAX_IDLE_CONNECTIONS = ServerConfig.getMaxIdleConnections(); final static int MAX_IDLE_CONNECTIONS = ServerConfig.getMaxIdleConnections();
final static long TIMER_MILLIS = ServerConfig.getTimerMillis ();
final static long MAX_REQ_TIME=getTimeMillis(ServerConfig.getMaxReqTime());
final static long MAX_RSP_TIME=getTimeMillis(ServerConfig.getMaxRspTime());
final static boolean timer1Enabled = MAX_REQ_TIME != -1 || MAX_RSP_TIME != -1;
private Timer timer; private Timer timer, timer1;
private Logger logger; private Logger logger;
ServerImpl ( ServerImpl (
...@@ -79,6 +91,7 @@ class ServerImpl implements TimeSource { ...@@ -79,6 +91,7 @@ class ServerImpl implements TimeSource {
this.protocol = protocol; this.protocol = protocol;
this.wrapper = wrapper; this.wrapper = wrapper;
this.logger = Logger.getLogger ("com.sun.net.httpserver"); this.logger = Logger.getLogger ("com.sun.net.httpserver");
ServerConfig.checkLegacyProperties (logger);
https = protocol.equalsIgnoreCase ("https"); https = protocol.equalsIgnoreCase ("https");
this.address = addr; this.address = addr;
contexts = new ContextList(); contexts = new ContextList();
...@@ -94,9 +107,18 @@ class ServerImpl implements TimeSource { ...@@ -94,9 +107,18 @@ class ServerImpl implements TimeSource {
dispatcher = new Dispatcher(); dispatcher = new Dispatcher();
idleConnections = Collections.synchronizedSet (new HashSet<HttpConnection>()); idleConnections = Collections.synchronizedSet (new HashSet<HttpConnection>());
allConnections = Collections.synchronizedSet (new HashSet<HttpConnection>()); allConnections = Collections.synchronizedSet (new HashSet<HttpConnection>());
reqConnections = Collections.synchronizedSet (new HashSet<HttpConnection>());
rspConnections = Collections.synchronizedSet (new HashSet<HttpConnection>());
time = System.currentTimeMillis(); time = System.currentTimeMillis();
timer = new Timer ("server-timer", true); timer = new Timer ("server-timer", true);
timer.schedule (new ServerTimerTask(), CLOCK_TICK, CLOCK_TICK); timer.schedule (new ServerTimerTask(), CLOCK_TICK, CLOCK_TICK);
if (timer1Enabled) {
timer1 = new Timer ("server-timer1", true);
timer1.schedule (new ServerTimerTask1(),TIMER_MILLIS,TIMER_MILLIS);
logger.config ("HttpServer timer1 enabled period in ms: "+TIMER_MILLIS);
logger.config ("MAX_REQ_TIME: "+MAX_REQ_TIME);
logger.config ("MAX_RSP_TIME: "+MAX_RSP_TIME);
}
events = new LinkedList<Event>(); events = new LinkedList<Event>();
logger.config ("HttpServer created "+protocol+" "+ addr); logger.config ("HttpServer created "+protocol+" "+ addr);
} }
...@@ -181,6 +203,9 @@ class ServerImpl implements TimeSource { ...@@ -181,6 +203,9 @@ class ServerImpl implements TimeSource {
allConnections.clear(); allConnections.clear();
idleConnections.clear(); idleConnections.clear();
timer.cancel(); timer.cancel();
if (timer1Enabled) {
timer1.cancel();
}
} }
Dispatcher dispatcher; Dispatcher dispatcher;
...@@ -236,13 +261,6 @@ class ServerImpl implements TimeSource { ...@@ -236,13 +261,6 @@ class ServerImpl implements TimeSource {
} }
} }
int resultSize () {
synchronized (lolock) {
return events.size ();
}
}
/* main server listener task */ /* main server listener task */
class Dispatcher implements Runnable { class Dispatcher implements Runnable {
...@@ -257,7 +275,7 @@ class ServerImpl implements TimeSource { ...@@ -257,7 +275,7 @@ class ServerImpl implements TimeSource {
if (terminating && exchanges == 0) { if (terminating && exchanges == 0) {
finished = true; finished = true;
} }
SocketChannel chan = c.getChannel(); responseCompleted (c);
LeftOverInputStream is = t.getOriginalInputStream(); LeftOverInputStream is = t.getOriginalInputStream();
if (!is.isEOF()) { if (!is.isEOF()) {
t.close = true; t.close = true;
...@@ -268,17 +286,10 @@ class ServerImpl implements TimeSource { ...@@ -268,17 +286,10 @@ class ServerImpl implements TimeSource {
} else { } else {
if (is.isDataBuffered()) { if (is.isDataBuffered()) {
/* don't re-enable the interestops, just handle it */ /* don't re-enable the interestops, just handle it */
requestStarted (c);
handle (c.getChannel(), c); handle (c.getChannel(), c);
} else { } else {
/* re-enable interestops */ connsToRegister.add (c);
SelectionKey key = c.getSelectionKey();
if (key.isValid()) {
key.interestOps (
key.interestOps()|SelectionKey.OP_READ
);
}
c.time = getTime() + IDLE_INTERVAL;
idleConnections.add (c);
} }
} }
} }
...@@ -290,21 +301,50 @@ class ServerImpl implements TimeSource { ...@@ -290,21 +301,50 @@ class ServerImpl implements TimeSource {
} }
} }
final LinkedList<HttpConnection> connsToRegister =
new LinkedList<HttpConnection>();
void reRegister (HttpConnection c) {
/* re-register with selector */
try {
SocketChannel chan = c.getChannel();
chan.configureBlocking (false);
SelectionKey key = chan.register (selector, SelectionKey.OP_READ);
key.attach (c);
c.selectionKey = key;
c.time = getTime() + IDLE_INTERVAL;
idleConnections.add (c);
} catch (IOException e) {
dprint(e);
logger.log(Level.FINER, "Dispatcher(8)", e);
c.close();
}
}
public void run() { public void run() {
while (!finished) { while (!finished) {
try { try {
ListIterator<HttpConnection> li =
connsToRegister.listIterator();
for (HttpConnection c : connsToRegister) {
reRegister(c);
}
connsToRegister.clear();
/* process the events list first */ List<Event> list = null;
selector.select(1000);
while (resultSize() > 0) {
Event r;
synchronized (lolock) { synchronized (lolock) {
r = events.remove(0); if (events.size() > 0) {
handleEvent (r); list = events;
events = new LinkedList<Event>();
} }
} }
selector.select(1000); if (list != null) {
for (Event r: list) {
handleEvent (r);
}
}
/* process the selected list now */ /* process the selected list now */
...@@ -327,6 +367,7 @@ class ServerImpl implements TimeSource { ...@@ -327,6 +367,7 @@ class ServerImpl implements TimeSource {
c.selectionKey = newkey; c.selectionKey = newkey;
c.setChannel (chan); c.setChannel (chan);
newkey.attach (c); newkey.attach (c);
requestStarted (c);
allConnections.add (c); allConnections.add (c);
} else { } else {
try { try {
...@@ -334,27 +375,44 @@ class ServerImpl implements TimeSource { ...@@ -334,27 +375,44 @@ class ServerImpl implements TimeSource {
boolean closed; boolean closed;
SocketChannel chan = (SocketChannel)key.channel(); SocketChannel chan = (SocketChannel)key.channel();
HttpConnection conn = (HttpConnection)key.attachment(); HttpConnection conn = (HttpConnection)key.attachment();
// interestOps will be restored at end of read
key.interestOps (0); key.cancel();
chan.configureBlocking (true);
if (idleConnections.remove(conn)) {
// was an idle connection so add it
// to reqConnections set.
requestStarted (conn);
}
handle (chan, conn); handle (chan, conn);
} else { } else {
assert false; assert false;
} }
} catch (CancelledKeyException e) {
handleException(key, null);
} catch (IOException e) { } catch (IOException e) {
HttpConnection conn = (HttpConnection)key.attachment(); handleException(key, e);
logger.log (
Level.FINER, "Dispatcher (2)", e
);
conn.close();
} }
} }
} }
// call the selector just to process the cancelled keys
selector.selectNow();
} catch (IOException e) {
logger.log (Level.FINER, "Dispatcher (4)", e);
} catch (Exception e) { } catch (Exception e) {
logger.log (Level.FINER, "Dispatcher (3)", e); e.printStackTrace();
logger.log (Level.FINER, "Dispatcher (7)", e);
} }
} }
} }
private void handleException (SelectionKey key, Exception e) {
HttpConnection conn = (HttpConnection)key.attachment();
if (e != null) {
logger.log (Level.FINER, "Dispatcher (2)", e);
}
closeConnection(conn);
}
public void handle (SocketChannel chan, HttpConnection conn) public void handle (SocketChannel chan, HttpConnection conn)
throws IOException throws IOException
{ {
...@@ -363,10 +421,10 @@ class ServerImpl implements TimeSource { ...@@ -363,10 +421,10 @@ class ServerImpl implements TimeSource {
executor.execute (t); executor.execute (t);
} catch (HttpError e1) { } catch (HttpError e1) {
logger.log (Level.FINER, "Dispatcher (4)", e1); logger.log (Level.FINER, "Dispatcher (4)", e1);
conn.close(); closeConnection(conn);
} catch (IOException e) { } catch (IOException e) {
logger.log (Level.FINER, "Dispatcher (5)", e); logger.log (Level.FINER, "Dispatcher (5)", e);
conn.close(); closeConnection(conn);
} }
} }
} }
...@@ -390,6 +448,25 @@ class ServerImpl implements TimeSource { ...@@ -390,6 +448,25 @@ class ServerImpl implements TimeSource {
return logger; return logger;
} }
private void closeConnection(HttpConnection conn) {
conn.close();
allConnections.remove(conn);
switch (conn.getState()) {
case REQUEST:
reqConnections.remove(conn);
break;
case RESPONSE:
rspConnections.remove(conn);
break;
case IDLE:
idleConnections.remove(conn);
break;
}
assert !reqConnections.remove(conn);
assert !rspConnections.remove(conn);
assert !idleConnections.remove(conn);
}
/* per exchange task */ /* per exchange task */
class Exchange implements Runnable { class Exchange implements Runnable {
...@@ -450,8 +527,7 @@ class ServerImpl implements TimeSource { ...@@ -450,8 +527,7 @@ class ServerImpl implements TimeSource {
requestLine = req.requestLine(); requestLine = req.requestLine();
if (requestLine == null) { if (requestLine == null) {
/* connection closed */ /* connection closed */
connection.close(); closeConnection(connection);
allConnections.remove(connection);
return; return;
} }
int space = requestLine.indexOf (' '); int space = requestLine.indexOf (' ');
...@@ -482,6 +558,9 @@ class ServerImpl implements TimeSource { ...@@ -482,6 +558,9 @@ class ServerImpl implements TimeSource {
if (s != null) { if (s != null) {
clen = Long.parseLong(s); clen = Long.parseLong(s);
} }
if (clen == 0) {
requestCompleted (connection);
}
} }
ctx = contexts.findContext (protocol, uri.getPath()); ctx = contexts.findContext (protocol, uri.getPath());
if (ctx == null) { if (ctx == null) {
...@@ -560,7 +639,7 @@ class ServerImpl implements TimeSource { ...@@ -560,7 +639,7 @@ class ServerImpl implements TimeSource {
} catch (IOException e1) { } catch (IOException e1) {
logger.log (Level.FINER, "ServerImpl.Exchange (1)", e1); logger.log (Level.FINER, "ServerImpl.Exchange (1)", e1);
connection.close(); closeConnection(connection);
} catch (NumberFormatException e3) { } catch (NumberFormatException e3) {
reject (Code.HTTP_BAD_REQUEST, reject (Code.HTTP_BAD_REQUEST,
requestLine, "NumberFormatException thrown"); requestLine, "NumberFormatException thrown");
...@@ -569,7 +648,7 @@ class ServerImpl implements TimeSource { ...@@ -569,7 +648,7 @@ class ServerImpl implements TimeSource {
requestLine, "URISyntaxException thrown"); requestLine, "URISyntaxException thrown");
} catch (Exception e4) { } catch (Exception e4) {
logger.log (Level.FINER, "ServerImpl.Exchange (2)", e4); logger.log (Level.FINER, "ServerImpl.Exchange (2)", e4);
connection.close(); closeConnection(connection);
} }
} }
...@@ -591,47 +670,60 @@ class ServerImpl implements TimeSource { ...@@ -591,47 +670,60 @@ class ServerImpl implements TimeSource {
rejected = true; rejected = true;
logReply (code, requestStr, message); logReply (code, requestStr, message);
sendReply ( sendReply (
code, true, "<h1>"+code+Code.msg(code)+"</h1>"+message code, false, "<h1>"+code+Code.msg(code)+"</h1>"+message
); );
/* connection is already closed by sendReply, now remove it */ closeConnection(connection);
allConnections.remove(connection);
} }
void sendReply ( void sendReply (
int code, boolean closeNow, String text) int code, boolean closeNow, String text)
{ {
try { try {
String s = "HTTP/1.1 " + code + Code.msg(code) + "\r\n"; StringBuilder builder = new StringBuilder (512);
builder.append ("HTTP/1.1 ")
.append (code).append (Code.msg(code)).append ("\r\n");
if (text != null && text.length() != 0) { if (text != null && text.length() != 0) {
s = s + "Content-Length: "+text.length()+"\r\n"; builder.append ("Content-Length: ")
s = s + "Content-Type: text/html\r\n"; .append (text.length()).append ("\r\n")
.append ("Content-Type: text/html\r\n");
} else { } else {
s = s + "Content-Length: 0\r\n"; builder.append ("Content-Length: 0\r\n");
text = ""; text = "";
} }
if (closeNow) { if (closeNow) {
s = s + "Connection: close\r\n"; builder.append ("Connection: close\r\n");
} }
s = s + "\r\n" + text; builder.append ("\r\n").append (text);
String s = builder.toString();
byte[] b = s.getBytes("ISO8859_1"); byte[] b = s.getBytes("ISO8859_1");
rawout.write (b); rawout.write (b);
rawout.flush(); rawout.flush();
if (closeNow) { if (closeNow) {
connection.close(); closeConnection(connection);
} }
} catch (IOException e) { } catch (IOException e) {
logger.log (Level.FINER, "ServerImpl.sendReply", e); logger.log (Level.FINER, "ServerImpl.sendReply", e);
connection.close(); closeConnection(connection);
} }
} }
} }
void logReply (int code, String requestStr, String text) { void logReply (int code, String requestStr, String text) {
if (!logger.isLoggable(Level.FINE)) {
return;
}
if (text == null) { if (text == null) {
text = ""; text = "";
} }
String message = requestStr + " [" + code + " " + String r;
if (requestStr.length() > 80) {
r = requestStr.substring (0, 80) + "<TRUNCATED>";
} else {
r = requestStr;
}
String message = r + " [" + code + " " +
Code.msg(code) + "] ("+text+")"; Code.msg(code) + "] ("+text+")";
logger.fine (message); logger.fine (message);
} }
...@@ -667,6 +759,34 @@ class ServerImpl implements TimeSource { ...@@ -667,6 +759,34 @@ class ServerImpl implements TimeSource {
return wrapper; return wrapper;
} }
void requestStarted (HttpConnection c) {
c.creationTime = getTime();
c.setState (State.REQUEST);
reqConnections.add (c);
}
// called after a request has been completely read
// by the server. This stops the timer which would
// close the connection if the request doesn't arrive
// quickly enough. It then starts the timer
// that ensures the client reads the response in a timely
// fashion.
void requestCompleted (HttpConnection c) {
assert c.getState() == State.REQUEST;
reqConnections.remove (c);
c.rspStartedTime = getTime();
rspConnections.add (c);
c.setState (State.RESPONSE);
}
// called after response has been sent
void responseCompleted (HttpConnection c) {
assert c.getState() == State.RESPONSE;
rspConnections.remove (c);
c.setState (State.IDLE);
}
/** /**
* TimerTask run every CLOCK_TICK ms * TimerTask run every CLOCK_TICK ms
*/ */
...@@ -689,4 +809,62 @@ class ServerImpl implements TimeSource { ...@@ -689,4 +809,62 @@ class ServerImpl implements TimeSource {
} }
} }
} }
class ServerTimerTask1 extends TimerTask {
// runs every TIMER_MILLIS
public void run () {
LinkedList<HttpConnection> toClose = new LinkedList<HttpConnection>();
time = System.currentTimeMillis();
synchronized (reqConnections) {
if (MAX_REQ_TIME != -1) {
for (HttpConnection c : reqConnections) {
if (c.creationTime + TIMER_MILLIS + MAX_REQ_TIME <= time) {
toClose.add (c);
}
}
for (HttpConnection c : toClose) {
logger.log (Level.FINE, "closing: no request: " + c);
reqConnections.remove (c);
allConnections.remove (c);
c.close();
}
}
}
toClose = new LinkedList<HttpConnection>();
synchronized (rspConnections) {
if (MAX_RSP_TIME != -1) {
for (HttpConnection c : rspConnections) {
if (c.rspStartedTime + TIMER_MILLIS +MAX_RSP_TIME <= time) {
toClose.add (c);
}
}
for (HttpConnection c : toClose) {
logger.log (Level.FINE, "closing: no response: " + c);
rspConnections.remove (c);
allConnections.remove (c);
c.close();
}
}
}
}
}
void logStackTrace (String s) {
logger.finest (s);
StringBuilder b = new StringBuilder ();
StackTraceElement[] e = Thread.currentThread().getStackTrace();
for (int i=0; i<e.length; i++) {
b.append (e[i].toString()).append("\n");
}
logger.finest (b.toString());
}
static long getTimeMillis(long secs) {
if (secs == -1) {
return -1;
} else {
return secs * 1000;
}
}
} }
...@@ -235,8 +235,6 @@ abstract class AsynchronousSocketChannelImpl ...@@ -235,8 +235,6 @@ abstract class AsynchronousSocketChannelImpl
if (remoteAddress == null) if (remoteAddress == null)
throw new NotYetConnectedException(); throw new NotYetConnectedException();
if (timeout < 0L)
throw new IllegalArgumentException("Negative timeout");
boolean hasSpaceToRead = isScatteringRead || dst.hasRemaining(); boolean hasSpaceToRead = isScatteringRead || dst.hasRemaining();
boolean shutdown = false; boolean shutdown = false;
...@@ -342,8 +340,6 @@ abstract class AsynchronousSocketChannelImpl ...@@ -342,8 +340,6 @@ abstract class AsynchronousSocketChannelImpl
if (isOpen()) { if (isOpen()) {
if (remoteAddress == null) if (remoteAddress == null)
throw new NotYetConnectedException(); throw new NotYetConnectedException();
if (timeout < 0L)
throw new IllegalArgumentException("Negative timeout");
// check and update state // check and update state
synchronized (writeLock) { synchronized (writeLock) {
if (writeKilled) if (writeKilled)
......
...@@ -358,7 +358,7 @@ class UTF_8 extends Unicode ...@@ -358,7 +358,7 @@ class UTF_8 extends Unicode
private static class Encoder extends CharsetEncoder { private static class Encoder extends CharsetEncoder {
private Encoder(Charset cs) { private Encoder(Charset cs) {
super(cs, 1.1f, 4.0f); super(cs, 1.1f, 3.0f);
} }
public boolean canEncode(char c) { public boolean canEncode(char c) {
......
...@@ -778,6 +778,13 @@ public class ExtendedCharsets ...@@ -778,6 +778,13 @@ public class ExtendedCharsets
"csIBM500" "csIBM500"
}); });
charset("x-IBM833", "IBM833",
new String[] {
"cp833",
"ibm833",
"ibm-833"
});
//EBCDIC DBCS-only Korean //EBCDIC DBCS-only Korean
charset("x-IBM834", "IBM834", charset("x-IBM834", "IBM834",
new String[] { new String[] {
......
...@@ -250,16 +250,16 @@ public class CCacheInputStream extends KrbDataInputStream implements FileCCacheC ...@@ -250,16 +250,16 @@ public class CCacheInputStream extends KrbDataInputStream implements FileCCacheC
else return null; else return null;
} }
Ticket readData() throws IOException, RealmException, KrbApErrException, Asn1Exception { byte[] readData() throws IOException {
int length; int length;
length = read(4); length = read(4);
if (length > 0) { if (length == 0) {
return null;
} else {
byte[] bytes = new byte[length]; byte[] bytes = new byte[length];
read(bytes, 0, length); read(bytes, 0, length);
Ticket ticket = new Ticket(bytes); return bytes;
return ticket;
} }
else return null;
} }
boolean[] readFlags() throws IOException { boolean[] readFlags() throws IOException {
...@@ -328,6 +328,17 @@ public class CCacheInputStream extends KrbDataInputStream implements FileCCacheC ...@@ -328,6 +328,17 @@ public class CCacheInputStream extends KrbDataInputStream implements FileCCacheC
} }
return flags; return flags;
} }
/**
* Reads the next cred in stream.
* @return the next cred, null if ticket or second_ticket unparseable.
*
* Note: MIT krb5 1.8.1 might generate a config entry with server principal
* X-CACHECONF:/krb5_ccache_conf_data/fast_avail/krbtgt/REALM@REALM. The
* entry is used by KDC to inform the client that it support certain
* features. Its ticket is not a valid krb5 ticket and thus this method
* returns null.
*/
Credentials readCred(int version) throws IOException,RealmException, KrbApErrException, Asn1Exception { Credentials readCred(int version) throws IOException,RealmException, KrbApErrException, Asn1Exception {
PrincipalName cpname = readPrincipal(version); PrincipalName cpname = readPrincipal(version);
if (DEBUG) if (DEBUG)
...@@ -367,17 +378,17 @@ public class CCacheInputStream extends KrbDataInputStream implements FileCCacheC ...@@ -367,17 +378,17 @@ public class CCacheInputStream extends KrbDataInputStream implements FileCCacheC
if (auData != null) { if (auData != null) {
auData = new AuthorizationData(auDataEntry); auData = new AuthorizationData(auDataEntry);
} }
Ticket ticket = readData(); byte[] ticketData = readData();
if (DEBUG) { byte[] ticketData2 = readData();
System.out.println(">>>DEBUG <CCacheInputStream>");
if (ticket == null) { try {
System.out.println("///ticket is null"); return new Credentials(cpname, spname, key, authtime, starttime,
}
}
Ticket secTicket = readData();
Credentials cred = new Credentials(cpname, spname, key, authtime, starttime,
endtime, renewTill, skey, tFlags, endtime, renewTill, skey, tFlags,
addrs, auData, ticket, secTicket); addrs, auData,
return cred; ticketData != null ? new Ticket(ticketData) : null,
ticketData2 != null ? new Ticket(ticketData2) : null);
} catch (Exception e) { // If any of new Ticket(*) fails.
return null;
}
} }
} }
/* /*
* Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2010, Oracle and/or its affiliates. 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
...@@ -186,7 +186,10 @@ public class FileCredentialsCache extends CredentialsCache ...@@ -186,7 +186,10 @@ public class FileCredentialsCache extends CredentialsCache
primaryRealm = primaryPrincipal.getRealm(); primaryRealm = primaryPrincipal.getRealm();
credentialsList = new Vector<Credentials> (); credentialsList = new Vector<Credentials> ();
while (cis.available() > 0) { while (cis.available() > 0) {
credentialsList.addElement(cis.readCred(version)); Credentials cred = cis.readCred(version);
if (cred != null) {
credentialsList.addElement(cred);
}
} }
cis.close(); cis.close();
} }
......
...@@ -74,7 +74,7 @@ final class P11Cipher extends CipherSpi { ...@@ -74,7 +74,7 @@ final class P11Cipher extends CipherSpi {
// DEC: return the length of trailing padding bytes given the specified // DEC: return the length of trailing padding bytes given the specified
// padded data // padded data
int unpad(byte[] paddedData, int len) int unpad(byte[] paddedData, int len)
throws BadPaddingException; throws BadPaddingException, IllegalBlockSizeException;
} }
private static class PKCS5Padding implements Padding { private static class PKCS5Padding implements Padding {
...@@ -96,9 +96,10 @@ final class P11Cipher extends CipherSpi { ...@@ -96,9 +96,10 @@ final class P11Cipher extends CipherSpi {
} }
public int unpad(byte[] paddedData, int len) public int unpad(byte[] paddedData, int len)
throws BadPaddingException { throws BadPaddingException, IllegalBlockSizeException {
if (len < 1 || len > paddedData.length) { if ((len < 1) || (len % blockSize != 0)) {
throw new BadPaddingException("Invalid pad array length!"); throw new IllegalBlockSizeException
("Input length must be multiples of " + blockSize);
} }
byte padValue = paddedData[len - 1]; byte padValue = paddedData[len - 1];
if (padValue < 1 || padValue > blockSize) { if (padValue < 1 || padValue > blockSize) {
......
/* /*
* Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2010, Oracle and/or its affiliates. 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
...@@ -1472,19 +1472,9 @@ public final class NormalizerImpl { ...@@ -1472,19 +1472,9 @@ public final class NormalizerImpl {
} }
--remove; --remove;
} }
} else if(value2!=0) { } else if(value2!=0) { // for U+1109A, U+1109C, and U+110AB
/* the composition is longer than the starter,
* move the intermediate characters back one */
starterIsSupplementary=true; starterIsSupplementary=true;
/* temporarily increment for the loop boundary */ args.source[starter+1]=(char)value2;
++starter;
q=remove;
r=++remove;
while(starter<q) {
args.source[--r]=args.source[--q];
}
args.source[starter]=(char)value2;
--starter; /* undo the temporary increment */
/* } else { both are on the BMP, nothing more to do */ /* } else { both are on the BMP, nothing more to do */
} }
......
...@@ -75,7 +75,8 @@ public class J2DBench { ...@@ -75,7 +75,8 @@ public class J2DBench {
static JFrame guiFrame; static JFrame guiFrame;
static final SimpleDateFormat sdf = new SimpleDateFormat("MM.dd.yyyy 'at' HH:mm aaa z"); static final SimpleDateFormat sdf =
new SimpleDateFormat("MM.dd.yyyy 'at' HH:mm aaa z");
public static void init() { public static void init() {
progoptroot = new Group("prog", "Program Options"); progoptroot = new Group("prog", "Program Options");
...@@ -176,6 +177,8 @@ public class J2DBench { ...@@ -176,6 +177,8 @@ public class J2DBench {
public static void main(String argv[]) { public static void main(String argv[]) {
init(); init();
TestEnvironment.init(); TestEnvironment.init();
Result.init();
Destinations.init(); Destinations.init();
GraphicsTests.init(); GraphicsTests.init();
RenderTests.init(); RenderTests.init();
...@@ -323,7 +326,7 @@ public class J2DBench { ...@@ -323,7 +326,7 @@ public class J2DBench {
} else if (type.equalsIgnoreCase("m")) { } else if (type.equalsIgnoreCase("m")) {
multiplyWith = 60; multiplyWith = 60;
} else { } else {
System.out.println("Invalid \"-loop\" option specified."); System.err.println("Invalid \"-loop\" option specified.");
usage(1); usage(1);
} }
...@@ -331,32 +334,20 @@ public class J2DBench { ...@@ -331,32 +334,20 @@ public class J2DBench {
try { try {
val = Integer.parseInt(argv[i].substring(0, argv[i].length() - 1)); val = Integer.parseInt(argv[i].substring(0, argv[i].length() - 1));
} catch(Exception e) { } catch(Exception e) {
System.out.println("Invalid \"-loop\" option specified."); System.err.println("Invalid \"-loop\" option specified.");
usage(1); usage(1);
} }
requiredLoopTime = val * multiplyWith * 1000; requiredLoopTime = val * multiplyWith * 1000;
} }
} else if (arg.length() > 7 && } else if (arg.length() > 8 &&
arg.substring(0, 7).equalsIgnoreCase("-report")) arg.substring(0, 8).equalsIgnoreCase("-report:"))
{ {
for (int j = 7; j < arg.length(); j++) { String error = Result.parseRateOpt(arg.substring(8));
char c = arg.charAt(j); if (error != null) {
switch (c) { System.err.println("Invalid rate: "+error);
case 'N': Result.unitScale = Result.UNITS_WHOLE; break; usage(1);
case 'M': Result.unitScale = Result.UNITS_MILLIONS; break;
case 'K': Result.unitScale = Result.UNITS_THOUSANDS; break;
case 'A': Result.unitScale = Result.UNITS_AUTO; break;
case 'U': Result.useUnits = true; break;
case 'O': Result.useUnits = false; break;
case 's': Result.timeScale = Result.SECONDS_WHOLE; break;
case 'm': Result.timeScale = Result.SECONDS_MILLIS; break;
case 'u': Result.timeScale = Result.SECONDS_MICROS; break;
case 'n': Result.timeScale = Result.SECONDS_NANOS; break;
case 'a': Result.timeScale = Result.SECONDS_AUTO; break;
case '/': Result.invertRate = !Result.invertRate; break;
}
} }
} else { } else {
String reason = Group.root.setOption(arg); String reason = Group.root.setOption(arg);
...@@ -411,7 +402,7 @@ public class J2DBench { ...@@ -411,7 +402,7 @@ public class J2DBench {
writer.flush(); writer.flush();
} catch(IOException ioe) { } catch(IOException ioe) {
ioe.printStackTrace(); ioe.printStackTrace();
System.out.println("\nERROR : Could not create Loop-Report. Exit"); System.err.println("\nERROR : Could not create Loop-Report. Exit");
System.exit(1); System.exit(1);
} }
} }
...@@ -466,7 +457,7 @@ public class J2DBench { ...@@ -466,7 +457,7 @@ public class J2DBench {
} while(J2DBench.looping); } while(J2DBench.looping);
if(J2DBench.looping) { if (J2DBench.looping) {
writer.println("</html>"); writer.println("</html>");
writer.flush(); writer.flush();
writer.close(); writer.close();
......
...@@ -61,6 +61,8 @@ public class J2DAnalyzer { ...@@ -61,6 +61,8 @@ public class J2DAnalyzer {
"the following result sets are combined into a group"); "the following result sets are combined into a group");
out.println(" -NoGroup "+ out.println(" -NoGroup "+
"the following result sets stand on their own"); "the following result sets stand on their own");
out.println(" -ShowUncontested "+
"show results even when only result set has a result");
out.println(" -Graph "+ out.println(" -Graph "+
"graph the results visually (using lines of *'s)"); "graph the results visually (using lines of *'s)");
out.println(" -Best "+ out.println(" -Best "+
...@@ -83,6 +85,7 @@ public class J2DAnalyzer { ...@@ -83,6 +85,7 @@ public class J2DAnalyzer {
public static void main(String argv[]) { public static void main(String argv[]) {
boolean gavehelp = false; boolean gavehelp = false;
boolean graph = false; boolean graph = false;
boolean ignoreuncontested = true;
if (argv.length > 0 && argv[0].equalsIgnoreCase("-html")) { if (argv.length > 0 && argv[0].equalsIgnoreCase("-html")) {
String newargs[] = new String[argv.length-1]; String newargs[] = new String[argv.length-1];
System.arraycopy(argv, 1, newargs, 0, newargs.length); System.arraycopy(argv, 1, newargs, 0, newargs.length);
...@@ -97,6 +100,8 @@ public class J2DAnalyzer { ...@@ -97,6 +100,8 @@ public class J2DAnalyzer {
results.add(groupHolder); results.add(groupHolder);
} else if (arg.equalsIgnoreCase("-NoGroup")) { } else if (arg.equalsIgnoreCase("-NoGroup")) {
groupHolder = null; groupHolder = null;
} else if (arg.equalsIgnoreCase("-ShowUncontested")) {
ignoreuncontested = false;
} else if (arg.equalsIgnoreCase("-Graph")) { } else if (arg.equalsIgnoreCase("-Graph")) {
graph = true; graph = true;
} else if (arg.equalsIgnoreCase("-Best")) { } else if (arg.equalsIgnoreCase("-Best")) {
...@@ -171,18 +176,23 @@ public class J2DAnalyzer { ...@@ -171,18 +176,23 @@ public class J2DAnalyzer {
String key = keys[k]; String key = keys[k];
ResultHolder rh = base.getResultByKey(key); ResultHolder rh = base.getResultByKey(key);
double score = rh.getScore(); double score = rh.getScore();
System.out.println(rh.getShortKey()+":");
double maxscore = score; double maxscore = score;
if (graph) { int numcontesting = 0;
for (int i = 0; i < numsets; i++) { for (int i = 0; i < numsets; i++) {
ResultSetHolder rsh = ResultSetHolder rsh =
(ResultSetHolder) results.elementAt(i); (ResultSetHolder) results.elementAt(i);
ResultHolder rh2 = rsh.getResultByKey(key); ResultHolder rh2 = rsh.getResultByKey(key);
if (rh2 != null) { if (rh2 != null) {
if (graph) {
maxscore = Math.max(maxscore, rh2.getBestScore()); maxscore = Math.max(maxscore, rh2.getBestScore());
} }
numcontesting++;
} }
} }
if (ignoreuncontested && numcontesting < 2) {
continue;
}
System.out.println(rh.getShortKey()+":");
for (int i = 0; i < numsets; i++) { for (int i = 0; i < numsets; i++) {
ResultSetHolder rsh = (ResultSetHolder) results.elementAt(i); ResultSetHolder rsh = (ResultSetHolder) results.elementAt(i);
System.out.print(rsh.getTitle()+": "); System.out.print(rsh.getTitle()+": ");
......
...@@ -454,7 +454,7 @@ public abstract class TextTests extends Test { ...@@ -454,7 +454,7 @@ public abstract class TextTests extends Test {
taaNames, taaHints, taaNames, taaHints,
taaNames, taaNames, taaNames, taaNames,
0x1); 0x1);
((Option.ObjectList) taaList).setNumRows(2); ((Option.ObjectList) taaList).setNumRows(6);
// add special TextAAOpt for backwards compatibility with // add special TextAAOpt for backwards compatibility with
// older options files // older options files
new TextAAOpt(); new TextAAOpt();
...@@ -707,3 +707,4 @@ public abstract class TextTests extends Test { ...@@ -707,3 +707,4 @@ public abstract class TextTests extends Test {
} }
} }
} }
...@@ -31,5 +31,9 @@ disabledMechanisms = { ...@@ -31,5 +31,9 @@ disabledMechanisms = {
CKM_SHA256_RSA_PKCS CKM_SHA256_RSA_PKCS
CKM_SHA384_RSA_PKCS CKM_SHA384_RSA_PKCS
CKM_SHA512_RSA_PKCS CKM_SHA512_RSA_PKCS
# the following mechanisms are disabled to ensure backward compatibility (Solaris bug 6545046)
CKM_DES_CBC_PAD
CKM_DES3_CBC_PAD
CKM_AES_CBC_PAD
} }
...@@ -132,6 +132,8 @@ Java_java_util_zip_Deflater_deflateBytes(JNIEnv *env, jobject this, jlong addr, ...@@ -132,6 +132,8 @@ Java_java_util_zip_Deflater_deflateBytes(JNIEnv *env, jobject this, jlong addr,
in_buf = (jbyte *) malloc(this_len); in_buf = (jbyte *) malloc(this_len);
if (in_buf == 0) { if (in_buf == 0) {
// Throw OOME only when length is not zero
if (this_len != 0)
JNU_ThrowOutOfMemoryError(env, 0); JNU_ThrowOutOfMemoryError(env, 0);
return 0; return 0;
} }
...@@ -139,6 +141,7 @@ Java_java_util_zip_Deflater_deflateBytes(JNIEnv *env, jobject this, jlong addr, ...@@ -139,6 +141,7 @@ Java_java_util_zip_Deflater_deflateBytes(JNIEnv *env, jobject this, jlong addr,
out_buf = (jbyte *) malloc(len); out_buf = (jbyte *) malloc(len);
if (out_buf == 0) { if (out_buf == 0) {
free(in_buf); free(in_buf);
if (len != 0)
JNU_ThrowOutOfMemoryError(env, 0); JNU_ThrowOutOfMemoryError(env, 0);
return 0; return 0;
} }
...@@ -173,6 +176,7 @@ Java_java_util_zip_Deflater_deflateBytes(JNIEnv *env, jobject this, jlong addr, ...@@ -173,6 +176,7 @@ Java_java_util_zip_Deflater_deflateBytes(JNIEnv *env, jobject this, jlong addr,
jboolean finish = (*env)->GetBooleanField(env, this, finishID); jboolean finish = (*env)->GetBooleanField(env, this, finishID);
in_buf = (jbyte *) malloc(this_len); in_buf = (jbyte *) malloc(this_len);
if (in_buf == 0) { if (in_buf == 0) {
if (this_len != 0)
JNU_ThrowOutOfMemoryError(env, 0); JNU_ThrowOutOfMemoryError(env, 0);
return 0; return 0;
} }
...@@ -181,6 +185,7 @@ Java_java_util_zip_Deflater_deflateBytes(JNIEnv *env, jobject this, jlong addr, ...@@ -181,6 +185,7 @@ Java_java_util_zip_Deflater_deflateBytes(JNIEnv *env, jobject this, jlong addr,
out_buf = (jbyte *) malloc(len); out_buf = (jbyte *) malloc(len);
if (out_buf == 0) { if (out_buf == 0) {
free(in_buf); free(in_buf);
if (len != 0)
JNU_ThrowOutOfMemoryError(env, 0); JNU_ThrowOutOfMemoryError(env, 0);
return 0; return 0;
} }
......
...@@ -135,6 +135,7 @@ Java_java_util_zip_Inflater_inflateBytes(JNIEnv *env, jobject this, jlong addr, ...@@ -135,6 +135,7 @@ Java_java_util_zip_Inflater_inflateBytes(JNIEnv *env, jobject this, jlong addr,
in_buf = (jbyte *) malloc(in_len); in_buf = (jbyte *) malloc(in_len);
if (in_buf == 0) { if (in_buf == 0) {
if (in_len != 0)
JNU_ThrowOutOfMemoryError(env, 0); JNU_ThrowOutOfMemoryError(env, 0);
return 0; return 0;
} }
...@@ -143,6 +144,7 @@ Java_java_util_zip_Inflater_inflateBytes(JNIEnv *env, jobject this, jlong addr, ...@@ -143,6 +144,7 @@ Java_java_util_zip_Inflater_inflateBytes(JNIEnv *env, jobject this, jlong addr,
out_buf = (jbyte *) malloc(len); out_buf = (jbyte *) malloc(len);
if (out_buf == 0) { if (out_buf == 0) {
free(in_buf); free(in_buf);
if (len != 0)
JNU_ThrowOutOfMemoryError(env, 0); JNU_ThrowOutOfMemoryError(env, 0);
return 0; return 0;
} }
......
...@@ -75,7 +75,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) ...@@ -75,7 +75,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
deflateEnd(&stream); deflateEnd(&stream);
return err == Z_OK ? Z_BUF_ERROR : err; return err == Z_OK ? Z_BUF_ERROR : err;
} }
*destLen = stream.total_out; *destLen = (uLong)stream.total_out;
err = deflateEnd(&stream); err = deflateEnd(&stream);
return err; return err;
......
...@@ -78,7 +78,7 @@ int ZEXPORT uncompress (dest, destLen, source, sourceLen) ...@@ -78,7 +78,7 @@ int ZEXPORT uncompress (dest, destLen, source, sourceLen)
return Z_DATA_ERROR; return Z_DATA_ERROR;
return err; return err;
} }
*destLen = stream.total_out; *destLen = (uLong)stream.total_out;
err = inflateEnd(&stream); err = inflateEnd(&stream);
return err; return err;
......
...@@ -70,7 +70,11 @@ static void EnsureJreInstallation(const char *jrepath); ...@@ -70,7 +70,11 @@ static void EnsureJreInstallation(const char *jrepath);
*/ */
#undef ENABLE_AWT_PRELOAD #undef ENABLE_AWT_PRELOAD
#ifndef JAVA_ARGS /* turn off AWT preloading for javac, jar, etc */ #ifndef JAVA_ARGS /* turn off AWT preloading for javac, jar, etc */
/* CR6999872: fastdebug crashes if awt library is loaded before JVM is
* initialized*/
#if !defined(DEBUG)
#define ENABLE_AWT_PRELOAD #define ENABLE_AWT_PRELOAD
#endif
#endif #endif
#ifdef ENABLE_AWT_PRELOAD #ifdef ENABLE_AWT_PRELOAD
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册