Merge
This commit is contained in:
commit
a946839dd1
@ -62,3 +62,4 @@ e1176f86805fe07fd9fb9da065dc51b47712ce76 jdk7-b82
|
||||
cf26288a114be67c39f2758959ce50b60f5ae330 jdk7-b85
|
||||
433a60a9c0bf1b26ee7e65cebaa89c541f497aed jdk7-b86
|
||||
6b1069f53fbc30663ccef49d78c31bb7d6967bde jdk7-b87
|
||||
82135c848d5fcddb065e98ae77b81077c858f593 jdk7-b88
|
||||
|
@ -62,3 +62,4 @@ fde0df7a2384f7fe33204a79678989807d9c2b98 jdk7-b83
|
||||
c67a9df7bc0ca291f08f9a9cc05cb78ea15d25e6 jdk7-b85
|
||||
6253e28826d16cf1aecc39ce04c8de1f6bf2df5f jdk7-b86
|
||||
09a41111a401d327f65e453384d976a10154d9ea jdk7-b87
|
||||
39e14d2da687c7e592142137517aaf689544820f jdk7-b88
|
||||
|
@ -86,3 +86,4 @@ ffc8d176b84bcfb5ac21302b4feb3b0c0d69b97c jdk7-b84
|
||||
bf823ef06b4f211e66988d76a2e2669be5c0820e jdk7-b86
|
||||
07226e9eab8f74b37346b32715f829a2ef2c3188 hs18-b01
|
||||
e7e7e36ccdb5d56edd47e5744351202d38f3b7ad jdk7-b87
|
||||
4b60f23c42231f7ecd62ad1fcb6a9ca26fa57d1b jdk7-b88
|
||||
|
@ -385,11 +385,6 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass,
|
||||
KILL_COMPILE_ON_FATAL_(fail_type));
|
||||
}
|
||||
|
||||
if (found_klass != NULL) {
|
||||
// Found it. Build a CI handle.
|
||||
return get_object(found_klass)->as_klass();
|
||||
}
|
||||
|
||||
// If we fail to find an array klass, look again for its element type.
|
||||
// The element type may be available either locally or via constraints.
|
||||
// In either case, if we can find the element type in the system dictionary,
|
||||
@ -414,6 +409,11 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass,
|
||||
}
|
||||
}
|
||||
|
||||
if (found_klass != NULL) {
|
||||
// Found it. Build a CI handle.
|
||||
return get_object(found_klass)->as_klass();
|
||||
}
|
||||
|
||||
if (require_local) return NULL;
|
||||
// Not yet loaded into the VM, or not governed by loader constraints.
|
||||
// Make a CI representative for it.
|
||||
|
@ -334,33 +334,6 @@ klassOop LoaderConstraintTable::find_constrained_klass(symbolHandle name,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
klassOop LoaderConstraintTable::find_constrained_elem_klass(symbolHandle name,
|
||||
symbolHandle elem_name,
|
||||
Handle loader,
|
||||
TRAPS) {
|
||||
LoaderConstraintEntry *p = *(find_loader_constraint(name, loader));
|
||||
if (p != NULL) {
|
||||
assert(p->klass() == NULL, "Expecting null array klass");
|
||||
|
||||
// The array name has a constraint, but it will not have a class. Check
|
||||
// each loader for an associated elem
|
||||
for (int i = 0; i < p->num_loaders(); i++) {
|
||||
Handle no_protection_domain;
|
||||
|
||||
klassOop k = SystemDictionary::find(elem_name, p->loader(i), no_protection_domain, THREAD);
|
||||
if (k != NULL) {
|
||||
// Return the first elem klass found.
|
||||
return k;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// No constraints, or else no klass loaded yet.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void LoaderConstraintTable::ensure_loader_constraint_capacity(
|
||||
LoaderConstraintEntry *p,
|
||||
int nfree) {
|
||||
|
@ -66,9 +66,6 @@ public:
|
||||
// bool is_method, TRAPS)
|
||||
|
||||
klassOop find_constrained_klass(symbolHandle name, Handle loader);
|
||||
klassOop find_constrained_elem_klass(symbolHandle name, symbolHandle elem_name,
|
||||
Handle loader, TRAPS);
|
||||
|
||||
|
||||
// Class loader constraints
|
||||
|
||||
|
@ -2178,9 +2178,8 @@ klassOop SystemDictionary::find_constrained_instance_or_array_klass(
|
||||
// a loader constraint that would require this loader to return the
|
||||
// klass that is already loaded.
|
||||
if (FieldType::is_array(class_name())) {
|
||||
// Array classes are hard because their klassOops are not kept in the
|
||||
// constraint table. The array klass may be constrained, but the elem class
|
||||
// may not be.
|
||||
// For array classes, their klassOops are not kept in the
|
||||
// constraint table. The element klassOops are.
|
||||
jint dimension;
|
||||
symbolOop object_key;
|
||||
BasicType t = FieldType::get_array_info(class_name(), &dimension,
|
||||
@ -2190,8 +2189,9 @@ klassOop SystemDictionary::find_constrained_instance_or_array_klass(
|
||||
} else {
|
||||
symbolHandle elem_name(THREAD, object_key);
|
||||
MutexLocker mu(SystemDictionary_lock, THREAD);
|
||||
klass = constraints()->find_constrained_elem_klass(class_name, elem_name, class_loader, THREAD);
|
||||
klass = constraints()->find_constrained_klass(elem_name, class_loader);
|
||||
}
|
||||
// If element class already loaded, allocate array klass
|
||||
if (klass != NULL) {
|
||||
klass = Klass::cast(klass)->array_klass_or_null(dimension);
|
||||
}
|
||||
@ -2209,22 +2209,38 @@ bool SystemDictionary::add_loader_constraint(symbolHandle class_name,
|
||||
Handle class_loader1,
|
||||
Handle class_loader2,
|
||||
Thread* THREAD) {
|
||||
unsigned int d_hash1 = dictionary()->compute_hash(class_name, class_loader1);
|
||||
symbolHandle constraint_name;
|
||||
if (!FieldType::is_array(class_name())) {
|
||||
constraint_name = class_name;
|
||||
} else {
|
||||
// For array classes, their klassOops are not kept in the
|
||||
// constraint table. The element classes are.
|
||||
jint dimension;
|
||||
symbolOop object_key;
|
||||
BasicType t = FieldType::get_array_info(class_name(), &dimension,
|
||||
&object_key, CHECK_(false));
|
||||
// primitive types always pass
|
||||
if (t != T_OBJECT) {
|
||||
return true;
|
||||
} else {
|
||||
constraint_name = symbolHandle(THREAD, object_key);
|
||||
}
|
||||
}
|
||||
unsigned int d_hash1 = dictionary()->compute_hash(constraint_name, class_loader1);
|
||||
int d_index1 = dictionary()->hash_to_index(d_hash1);
|
||||
|
||||
unsigned int d_hash2 = dictionary()->compute_hash(class_name, class_loader2);
|
||||
unsigned int d_hash2 = dictionary()->compute_hash(constraint_name, class_loader2);
|
||||
int d_index2 = dictionary()->hash_to_index(d_hash2);
|
||||
|
||||
{
|
||||
MutexLocker mu_s(SystemDictionary_lock, THREAD);
|
||||
MutexLocker mu_s(SystemDictionary_lock, THREAD);
|
||||
|
||||
// Better never do a GC while we're holding these oops
|
||||
No_Safepoint_Verifier nosafepoint;
|
||||
// Better never do a GC while we're holding these oops
|
||||
No_Safepoint_Verifier nosafepoint;
|
||||
|
||||
klassOop klass1 = find_class(d_index1, d_hash1, class_name, class_loader1);
|
||||
klassOop klass2 = find_class(d_index2, d_hash2, class_name, class_loader2);
|
||||
return constraints()->add_entry(class_name, klass1, class_loader1,
|
||||
klass2, class_loader2);
|
||||
klassOop klass1 = find_class(d_index1, d_hash1, constraint_name, class_loader1);
|
||||
klassOop klass2 = find_class(d_index2, d_hash2, constraint_name, class_loader2);
|
||||
return constraints()->add_entry(constraint_name, klass1, class_loader1,
|
||||
klass2, class_loader2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2301,6 +2317,7 @@ symbolOop SystemDictionary::find_resolution_error(constantPoolHandle pool, int w
|
||||
// Returns the name of the type that failed a loader constraint check, or
|
||||
// NULL if no constraint failed. The returned C string needs cleaning up
|
||||
// with a ResourceMark in the caller. No exception except OOME is thrown.
|
||||
// Arrays are not added to the loader constraint table, their elements are.
|
||||
char* SystemDictionary::check_signature_loaders(symbolHandle signature,
|
||||
Handle loader1, Handle loader2,
|
||||
bool is_method, TRAPS) {
|
||||
|
@ -123,16 +123,16 @@ void typeArrayKlass::copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos
|
||||
|| (((unsigned int) length + (unsigned int) dst_pos) > (unsigned int) d->length()) ) {
|
||||
THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
|
||||
}
|
||||
// Check zero copy
|
||||
if (length == 0)
|
||||
return;
|
||||
|
||||
// This is an attempt to make the copy_array fast.
|
||||
// NB: memmove takes care of overlapping memory segments.
|
||||
// Potential problem: memmove is not guaranteed to be word atomic
|
||||
// Revisit in Merlin
|
||||
int l2es = log2_element_size();
|
||||
int ihs = array_header_in_bytes() / wordSize;
|
||||
char* src = (char*) ((oop*)s + ihs) + (src_pos << l2es);
|
||||
char* dst = (char*) ((oop*)d + ihs) + (dst_pos << l2es);
|
||||
memmove(dst, src, length << l2es);
|
||||
char* src = (char*) ((oop*)s + ihs) + ((size_t)src_pos << l2es);
|
||||
char* dst = (char*) ((oop*)d + ihs) + ((size_t)dst_pos << l2es);
|
||||
Copy::conjoint_memory_atomic(src, dst, (size_t)length << l2es);
|
||||
}
|
||||
|
||||
|
||||
|
@ -956,6 +956,7 @@ const Type *PhiNode::Value( PhaseTransform *phase ) const {
|
||||
}
|
||||
if( jtkp && ttkp ) {
|
||||
if( jtkp->is_loaded() && jtkp->klass()->is_interface() &&
|
||||
!jtkp->klass_is_exact() && // Keep exact interface klass (6894807)
|
||||
ttkp->is_loaded() && !ttkp->klass()->is_interface() ) {
|
||||
assert(ft == ttkp->cast_to_ptr_type(jtkp->ptr()) ||
|
||||
ft->isa_narrowoop() && ft->make_ptr() == ttkp->cast_to_ptr_type(jtkp->ptr()), "");
|
||||
|
@ -2545,12 +2545,15 @@ const Type *TypeOopPtr::filter( const Type *kills ) const {
|
||||
ftip->is_loaded() && ftip->klass()->is_interface() &&
|
||||
ktip->is_loaded() && !ktip->klass()->is_interface()) {
|
||||
// Happens in a CTW of rt.jar, 320-341, no extra flags
|
||||
assert(!ftip->klass_is_exact(), "interface could not be exact");
|
||||
return ktip->cast_to_ptr_type(ftip->ptr());
|
||||
}
|
||||
// Interface klass type could be exact in opposite to interface type,
|
||||
// return it here instead of incorrect Constant ptr J/L/Object (6894807).
|
||||
if (ftkp != NULL && ktkp != NULL &&
|
||||
ftkp->is_loaded() && ftkp->klass()->is_interface() &&
|
||||
!ftkp->klass_is_exact() && // Keep exact interface klass
|
||||
ktkp->is_loaded() && !ktkp->klass()->is_interface()) {
|
||||
// Happens in a CTW of rt.jar, 320-341, no extra flags
|
||||
return ktkp->cast_to_ptr_type(ftkp->ptr());
|
||||
}
|
||||
|
||||
|
65
hotspot/test/compiler/6892265/Test.java
Normal file
65
hotspot/test/compiler/6892265/Test.java
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 6892265
|
||||
* @summary System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
|
||||
*
|
||||
* @run main/othervm Test
|
||||
*/
|
||||
|
||||
public class Test {
|
||||
static final int NCOPY = 1;
|
||||
static final int OVERFLOW = 1;
|
||||
static int[] src2 = new int[NCOPY];
|
||||
static int[] dst2;
|
||||
|
||||
static void test() {
|
||||
int N;
|
||||
int SIZE;
|
||||
|
||||
N = Integer.MAX_VALUE/4 + OVERFLOW;
|
||||
System.arraycopy(src2, 0, dst2, N, NCOPY);
|
||||
System.arraycopy(dst2, N, src2, 0, NCOPY);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
dst2 = new int[NCOPY + Integer.MAX_VALUE/4 + OVERFLOW];
|
||||
} catch (OutOfMemoryError e) {
|
||||
System.exit(95); // Not enough memory
|
||||
}
|
||||
System.out.println("warmup");
|
||||
for (int i=0; i <11000; i++) {
|
||||
test();
|
||||
}
|
||||
System.out.println("start");
|
||||
for (int i=0; i <1000; i++) {
|
||||
test();
|
||||
}
|
||||
System.out.println("finish");
|
||||
}
|
||||
|
||||
}
|
@ -62,3 +62,4 @@ c876ad22e4bf9d3c6460080db7ace478e29a3ff9 jdk7-b82
|
||||
6c0ccabb430dacdcd4479f8b197980d5da4eeb66 jdk7-b85
|
||||
81c0f115bbe5d3bcf59864465b5eca5538567c79 jdk7-b86
|
||||
8b493f1aa136d86de0885fcba15262c4fa2b1412 jdk7-b87
|
||||
d8ebd15910034f2ba50b2f129f959f86cca01419 jdk7-b88
|
||||
|
@ -62,3 +62,4 @@ f051045fe94a48fae1097f90cbd9227e6aae6b7e jdk7-b81
|
||||
8424512588ff95362c1f1e5f11c6efd4e7f7db6e jdk7-b85
|
||||
512b0e924a5ae0c0b7ad326182cae0dc0e4d1aa8 jdk7-b86
|
||||
3febd6fab2ac8ffddbaf7bed00d11290262af153 jdk7-b87
|
||||
8c666f8f3565974e301ccb58b7538912551a6e26 jdk7-b88
|
||||
|
@ -62,3 +62,4 @@ e6a5d095c356a547cf5b3c8885885aca5e91e09b jdk7-b77
|
||||
b396584a3e64988839cca21ea1f7fbdcc9248783 jdk7-b85
|
||||
eae6e9ab26064d9ba0e7665dd646a1fd2506fcc1 jdk7-b86
|
||||
2cafbbe9825e911a6ca6c17d9a18eb1f0bf0873c jdk7-b87
|
||||
b3c69282f6d3c90ec21056cd1ab70dc0c895b069 jdk7-b88
|
||||
|
@ -21,4 +21,4 @@
|
||||
# CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
# have any questions.
|
||||
#
|
||||
tzdata2010b
|
||||
tzdata2010g
|
||||
|
@ -79,6 +79,33 @@ Rule ChileAQ 1999 only - Apr 4 3:00u 0 -
|
||||
Rule ChileAQ 1999 max - Oct Sun>=9 4:00u 1:00 S
|
||||
Rule ChileAQ 2000 max - Mar Sun>=9 3:00u 0 -
|
||||
|
||||
# These rules are stolen from the `australasia' file.
|
||||
Rule AusAQ 1917 only - Jan 1 0:01 1:00 -
|
||||
Rule AusAQ 1917 only - Mar 25 2:00 0 -
|
||||
Rule AusAQ 1942 only - Jan 1 2:00 1:00 -
|
||||
Rule AusAQ 1942 only - Mar 29 2:00 0 -
|
||||
Rule AusAQ 1942 only - Sep 27 2:00 1:00 -
|
||||
Rule AusAQ 1943 1944 - Mar lastSun 2:00 0 -
|
||||
Rule AusAQ 1943 only - Oct 3 2:00 1:00 -
|
||||
Rule ATAQ 1967 only - Oct Sun>=1 2:00s 1:00 -
|
||||
Rule ATAQ 1968 only - Mar lastSun 2:00s 0 -
|
||||
Rule ATAQ 1968 1985 - Oct lastSun 2:00s 1:00 -
|
||||
Rule ATAQ 1969 1971 - Mar Sun>=8 2:00s 0 -
|
||||
Rule ATAQ 1972 only - Feb lastSun 2:00s 0 -
|
||||
Rule ATAQ 1973 1981 - Mar Sun>=1 2:00s 0 -
|
||||
Rule ATAQ 1982 1983 - Mar lastSun 2:00s 0 -
|
||||
Rule ATAQ 1984 1986 - Mar Sun>=1 2:00s 0 -
|
||||
Rule ATAQ 1986 only - Oct Sun>=15 2:00s 1:00 -
|
||||
Rule ATAQ 1987 1990 - Mar Sun>=15 2:00s 0 -
|
||||
Rule ATAQ 1987 only - Oct Sun>=22 2:00s 1:00 -
|
||||
Rule ATAQ 1988 1990 - Oct lastSun 2:00s 1:00 -
|
||||
Rule ATAQ 1991 1999 - Oct Sun>=1 2:00s 1:00 -
|
||||
Rule ATAQ 1991 2005 - Mar lastSun 2:00s 0 -
|
||||
Rule ATAQ 2000 only - Aug lastSun 2:00s 1:00 -
|
||||
Rule ATAQ 2001 max - Oct Sun>=1 2:00s 1:00 -
|
||||
Rule ATAQ 2006 only - Apr Sun>=1 2:00s 0 -
|
||||
Rule ATAQ 2007 only - Mar lastSun 2:00s 0 -
|
||||
Rule ATAQ 2008 max - Apr Sun>=1 2:00s 0 -
|
||||
|
||||
# Argentina - year-round bases
|
||||
# Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05
|
||||
@ -120,20 +147,52 @@ Rule ChileAQ 2000 max - Mar Sun>=9 3:00u 0 -
|
||||
# http://www.timeanddate.com/news/time/antarctica-new-times.html
|
||||
# </a>
|
||||
|
||||
# From Steffen Thorsen (2010-03-10):
|
||||
# We got these changes from the Australian Antarctic Division:
|
||||
# - Macquarie Island will stay on UTC+11 for winter and therefore not
|
||||
# switch back from daylight savings time when other parts of Australia do
|
||||
# on 4 April.
|
||||
#
|
||||
# - Casey station reverted to its normal time of UTC+8 on 5 March 2010.
|
||||
# The change to UTC+11 is being considered as a regular summer thing but
|
||||
# has not been decided yet.
|
||||
#
|
||||
# - Davis station will revert to its normal time of UTC+7 at 10 March 2010
|
||||
# 20:00 UTC.
|
||||
#
|
||||
# - Mawson station stays on UTC+5.
|
||||
#
|
||||
# In addition to the Rule changes for Casey/Davis, it means that Macquarie
|
||||
# will no longer be like Hobart and will have to have its own Zone created.
|
||||
#
|
||||
# Background:
|
||||
# <a href="http://www.timeanddate.com/news/time/antartica-time-changes-2010.html">
|
||||
# http://www.timeanddate.com/news/time/antartica-time-changes-2010.html
|
||||
# </a>
|
||||
|
||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||
Zone Antarctica/Casey 0 - zzz 1969
|
||||
8:00 - WST 2009 Oct 18 2:00
|
||||
# Western (Aus) Standard Time
|
||||
11:00 - CAST # Casey Time
|
||||
11:00 - CAST 2010 Mar 5 2:00
|
||||
# Casey Time
|
||||
8:00 - WST
|
||||
Zone Antarctica/Davis 0 - zzz 1957 Jan 13
|
||||
7:00 - DAVT 1964 Nov # Davis Time
|
||||
0 - zzz 1969 Feb
|
||||
7:00 - DAVT 2009 Oct 18 2:00
|
||||
5:00 - DAVT
|
||||
5:00 - DAVT 2010 Mar 10 20:00u
|
||||
7:00 - DAVT
|
||||
Zone Antarctica/Mawson 0 - zzz 1954 Feb 13
|
||||
6:00 - MAWT 2009 Oct 18 2:00
|
||||
# Mawson Time
|
||||
5:00 - MAWT
|
||||
Zone Antarctica/Macquarie 0 - zzz 1911
|
||||
10:00 - EST 1916 Oct 1 2:00
|
||||
10:00 1:00 EST 1917 Feb
|
||||
10:00 AusAQ EST 1967
|
||||
10:00 ATAQ EST 2010 Apr 4 3:00
|
||||
11:00 - MIST # Macquarie Island Time
|
||||
# References:
|
||||
# <a href="http://www.antdiv.gov.au/aad/exop/sfo/casey/casey_aws.html">
|
||||
# Casey Weather (1998-02-26)
|
||||
|
@ -236,22 +236,20 @@ Zone Asia/Bahrain 3:22:20 - LMT 1920 # Al Manamah
|
||||
# 2010 midnight. The decision came at a cabinet meeting at the Prime
|
||||
# Minister's Office last night..."
|
||||
|
||||
# From Danvin Ruangchan (2009-12-24):
|
||||
# ...the news mentions DST will be turned off again 7 months after March
|
||||
# 31st on Oct 31, 2010.
|
||||
|
||||
# From Arthur David Olson (2009-12-26):
|
||||
# Indeed, "The government will advance again the Banglasdesh Standard
|
||||
# Time by one one hour on March 31 next year by enforcing the Daylight
|
||||
# Saving Time (DST) for seven months. It will continue till October 31
|
||||
# until further notice." I take that last sentence as the
|
||||
# establishment of a rule.
|
||||
# From Alexander Krivenyshev (2010-03-22):
|
||||
# According to Bangladesh newspaper "The Daily Star,"
|
||||
# Cabinet cancels Daylight Saving Time
|
||||
# <a href="http://www.thedailystar.net/newDesign/latest_news.php?nid=22817">
|
||||
# http://www.thedailystar.net/newDesign/latest_news.php?nid=22817
|
||||
# </a>
|
||||
# or
|
||||
# <a href="http://www.worldtimezone.com/dst_news/dst_news_bangladesh06.html">
|
||||
# http://www.worldtimezone.com/dst_news/dst_news_bangladesh06.html
|
||||
# </a>
|
||||
|
||||
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
||||
Rule Dhaka 2009 only - Jun 19 23:00 1:00 S
|
||||
Rule Dhaka 2010 only - Jan 1 0:00 0 -
|
||||
Rule Dhaka 2010 max - Mar 31 23:00 1:00 S
|
||||
Rule Dhaka 2010 max - Nov 1 0:00 0 -
|
||||
Rule Dhaka 2009 only - Dec 31 23:59 0 -
|
||||
|
||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||
Zone Asia/Dhaka 6:01:40 - LMT 1890
|
||||
@ -2131,6 +2129,32 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
|
||||
# http://www.worldtimezone.com/dst_news/dst_news_gazastrip02.html
|
||||
# </a>
|
||||
|
||||
# From Alexander Krivenyshev (2010-03-19):
|
||||
# According to Voice of Palestine DST will last for 191 days, from March
|
||||
# 26, 2010 till "the last Sunday before the tenth day of Tishri
|
||||
# (October), each year" (October 03, 2010?)
|
||||
#
|
||||
# <a href="http://palvoice.org/forums/showthread.php?t=245697">
|
||||
# http://palvoice.org/forums/showthread.php?t=245697
|
||||
# </a>
|
||||
# (in Arabic)
|
||||
# or
|
||||
# <a href="http://www.worldtimezone.com/dst_news/dst_news_westbank03.html">
|
||||
# http://www.worldtimezone.com/dst_news/dst_news_westbank03.html
|
||||
# </a>
|
||||
|
||||
# From Steffen Thorsen (2010-03-24):
|
||||
# ...Ma'an News Agency reports that Hamas cabinet has decided it will
|
||||
# start one day later, at 12:01am. Not sure if they really mean 12:01am or
|
||||
# noon though:
|
||||
#
|
||||
# <a href="http://www.maannews.net/eng/ViewDetails.aspx?ID=271178">
|
||||
# http://www.maannews.net/eng/ViewDetails.aspx?ID=271178
|
||||
# </a>
|
||||
# (Ma'an News Agency)
|
||||
# "At 12:01am Friday, clocks in Israel and the West Bank will change to
|
||||
# 1:01am, while Gaza clocks will change at 12:01am Saturday morning."
|
||||
|
||||
# The rules for Egypt are stolen from the `africa' file.
|
||||
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
||||
Rule EgyptAsia 1957 only - May 10 0:00 1:00 S
|
||||
@ -2148,7 +2172,8 @@ Rule Palestine 2006 2008 - Apr 1 0:00 1:00 S
|
||||
Rule Palestine 2006 only - Sep 22 0:00 0 -
|
||||
Rule Palestine 2007 only - Sep Thu>=8 2:00 0 -
|
||||
Rule Palestine 2008 only - Aug lastFri 2:00 0 -
|
||||
Rule Palestine 2009 max - Mar lastFri 0:00 1:00 S
|
||||
Rule Palestine 2009 only - Mar lastFri 0:00 1:00 S
|
||||
Rule Palestine 2010 max - Mar lastSat 0:01 1:00 S
|
||||
Rule Palestine 2009 max - Sep Fri>=1 2:00 0 -
|
||||
|
||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||
@ -2440,9 +2465,18 @@ Rule Syria 2007 only - Nov Fri>=1 0:00 0 -
|
||||
# Thursday of the month or the start of the last Friday of the month or
|
||||
# something else. For now, use the start of the last Friday.
|
||||
|
||||
# From Steffen Thorsen (2010-03-17):
|
||||
# The "Syrian News Station" reported on 2010-03-16 that the Council of
|
||||
# Ministers has decided that Syria will start DST on midnight Thursday
|
||||
# 2010-04-01: (midnight between Thursday and Friday):
|
||||
# <a href="http://sns.sy/sns/?path=news/read/11421">
|
||||
# http://sns.sy/sns/?path=news/read/11421 (Arabic)
|
||||
# </a>
|
||||
|
||||
Rule Syria 2008 only - Apr Fri>=1 0:00 1:00 S
|
||||
Rule Syria 2008 only - Nov 1 0:00 0 -
|
||||
Rule Syria 2009 max - Mar lastFri 0:00 1:00 S
|
||||
Rule Syria 2009 only - Mar lastFri 0:00 1:00 S
|
||||
Rule Syria 2010 max - Apr Fri>=1 0:00 1:00 S
|
||||
Rule Syria 2009 max - Oct lastFri 0:00 0 -
|
||||
|
||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||
|
@ -289,11 +289,30 @@ Zone Indian/Cocos 6:27:40 - LMT 1900
|
||||
# <a href="http://www.fiji.gov.fj/publish/page_16198.shtml">
|
||||
# http://www.fiji.gov.fj/publish/page_16198.shtml
|
||||
# </a>
|
||||
|
||||
# From Steffen Thorsen (2010-03-03):
|
||||
# The Cabinet in Fiji has decided to end DST about a month early, on
|
||||
# 2010-03-28 at 03:00.
|
||||
# The plan is to observe DST again, from 2010-10-24 to sometime in March
|
||||
# 2011 (last Sunday a good guess?).
|
||||
#
|
||||
# Official source:
|
||||
# <a href="http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=1096:3310-cabinet-approves-change-in-daylight-savings-dates&catid=49:cabinet-releases&Itemid=166">
|
||||
# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=1096:3310-cabinet-approves-change-in-daylight-savings-dates&catid=49:cabinet-releases&Itemid=166
|
||||
# </a>
|
||||
#
|
||||
# A bit more background info here:
|
||||
# <a href="http://www.timeanddate.com/news/time/fiji-dst-ends-march-2010.html">
|
||||
# http://www.timeanddate.com/news/time/fiji-dst-ends-march-2010.html
|
||||
# </a>
|
||||
|
||||
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
||||
Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 S
|
||||
Rule Fiji 1999 2000 - Feb lastSun 3:00 0 -
|
||||
Rule Fiji 2009 only - Nov 29 2:00 1:00 S
|
||||
Rule Fiji 2010 only - Apr 25 3:00 0 -
|
||||
Rule Fiji 2010 only - Mar lastSun 3:00 0 -
|
||||
Rule Fiji 2010 only - Oct 24 2:00 1:00 S
|
||||
Rule Fiji 2011 only - Mar lastSun 3:00 0 -
|
||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||
Zone Pacific/Fiji 11:53:40 - LMT 1915 Oct 26 # Suva
|
||||
12:00 Fiji FJ%sT # Fiji Time
|
||||
@ -471,70 +490,30 @@ Zone Pacific/Pago_Pago 12:37:12 - LMT 1879 Jul 5
|
||||
|
||||
# Samoa
|
||||
|
||||
# From Alexander Krivenyshev (2008-12-06):
|
||||
# The Samoa government (Western Samoa) may implement DST on the first Sunday of
|
||||
# October 2009 (October 4, 2009) until the last Sunday of March 2010 (March 28,
|
||||
# 2010).
|
||||
#
|
||||
# "Selected Committee reports to Cabinet on Daylight Saving Time",
|
||||
# Government of Samoa:
|
||||
# <a href="http://www.govt.ws/pr_article.cfm?pr_id=560">
|
||||
# http://www.govt.ws/pr_article.cfm?pr_id=560
|
||||
# </a>
|
||||
# or
|
||||
# <a href="http://www.worldtimezone.com/dst_news/dst_news_samoa01.html">
|
||||
# http://www.worldtimezone.com/dst_news/dst_news_samoa01.html
|
||||
# </a>
|
||||
|
||||
# From Steffen Thorsen (2009-08-27):
|
||||
# Samoa's parliament passed the Daylight Saving Bill 2009, and will start
|
||||
# daylight saving time on the first Sunday of October 2009 and end on the
|
||||
# last Sunday of March 2010. We hope that the full text will be published
|
||||
# soon, but we believe that the bill is only valid for 2009-2010. Samoa's
|
||||
# Daylight Saving Act 2009 will be enforced as soon as the Head of State
|
||||
# executes a proclamation publicizing this Act.
|
||||
# From Steffen Thorsen (2009-10-16):
|
||||
# We have been in contact with the government of Samoa again, and received
|
||||
# the following info:
|
||||
#
|
||||
# Some background information here, which will be updated once we have
|
||||
# more details:
|
||||
# "Cabinet has now approved Daylight Saving to be effected next year
|
||||
# commencing from the last Sunday of September 2010 and conclude first
|
||||
# Sunday of April 2011."
|
||||
#
|
||||
# Background info:
|
||||
# <a href="http://www.timeanddate.com/news/time/samoa-dst-plan-2009.html">
|
||||
# http://www.timeanddate.com/news/time/samoa-dst-plan-2009.html
|
||||
# </a>
|
||||
|
||||
# From Alexander Krivenyshev (2009-10-03):
|
||||
# First, my deepest condolences to people of Samoa islands and all families and
|
||||
# loved ones around the world who lost their lives in the earthquake and tsunami.
|
||||
#
|
||||
# Considering the recent devastation on Samoa by earthquake and tsunami and that
|
||||
# many government offices/ ministers are closed- not sure if "Daylight Saving
|
||||
# Bill 2009" will be implemented in next few days- on October 4, 2009.
|
||||
#
|
||||
# Here is reply from Consulate-General of Samoa in New Zealand
|
||||
# ---------------------------
|
||||
# Consul General
|
||||
# consulgeneral@samoaconsulate.org.nz
|
||||
#
|
||||
# Talofa Alexander,
|
||||
#
|
||||
# Thank you for your sympathy for our country but at this time we have not
|
||||
# been informed about the Daylight Savings Time Change. Most Ministries in
|
||||
# Apia are closed or relocating due to weather concerns.
|
||||
#
|
||||
# When we do find out if they are still proceeding with the time change we
|
||||
# will advise you soonest.
|
||||
#
|
||||
# Kind Regards,
|
||||
# Lana
|
||||
# for: Consul General
|
||||
|
||||
# From Steffen Thorsen (2009-10-05):
|
||||
# We have called a hotel in Samoa and asked about local time there - they
|
||||
# are still on standard time.
|
||||
# Samoa's Daylight Saving Time Act 2009 is available here, but does not
|
||||
# contain any dates:
|
||||
# <a href="http://www.parliament.gov.ws/documents/acts/Daylight%20Saving%20Act%20%202009%20%28English%29%20-%20Final%207-7-091.pdf">
|
||||
# http://www.parliament.gov.ws/documents/acts/Daylight%20Saving%20Act%20%202009%20%28English%29%20-%20Final%207-7-091.pdf
|
||||
# </a>
|
||||
|
||||
Zone Pacific/Apia 12:33:04 - LMT 1879 Jul 5
|
||||
-11:26:56 - LMT 1911
|
||||
-11:30 - SAMT 1950 # Samoa Time
|
||||
-11:00 - WST 2009 Oct 4
|
||||
-11:00 1:00 WSDT 2010 Mar 28
|
||||
-11:00 - WST 2010 Sep 26
|
||||
-11:00 1:00 WSDT 2011 Apr 3
|
||||
-11:00 - WST
|
||||
|
||||
# Solomon Is
|
||||
|
@ -2063,7 +2063,9 @@ Zone Europe/Samara 3:20:36 - LMT 1919 Jul 1 2:00
|
||||
3:00 Russia KUY%sT 1991 Mar 31 2:00s
|
||||
2:00 Russia KUY%sT 1991 Sep 29 2:00s
|
||||
3:00 - KUYT 1991 Oct 20 3:00
|
||||
4:00 Russia SAM%sT # Samara Time
|
||||
4:00 Russia SAM%sT 2010 Mar 28 2:00s # Samara Time
|
||||
3:00 Russia SAM%sT
|
||||
|
||||
#
|
||||
# From Oscar van Vlijmen (2001-08-25): [This region consists of]
|
||||
# Respublika Bashkortostan, Komi-Permyatskij avtonomnyj okrug,
|
||||
@ -2216,7 +2218,8 @@ Zone Asia/Kamchatka 10:34:36 - LMT 1922 Nov 10
|
||||
11:00 - PETT 1930 Jun 21 # P-K Time
|
||||
12:00 Russia PET%sT 1991 Mar 31 2:00s
|
||||
11:00 Russia PET%sT 1992 Jan 19 2:00s
|
||||
12:00 Russia PET%sT
|
||||
12:00 Russia PET%sT 2010 Mar 28 2:00s
|
||||
11:00 Russia PET%sT
|
||||
#
|
||||
# Chukotskij avtonomnyj okrug
|
||||
Zone Asia/Anadyr 11:49:56 - LMT 1924 May 2
|
||||
@ -2224,7 +2227,8 @@ Zone Asia/Anadyr 11:49:56 - LMT 1924 May 2
|
||||
13:00 Russia ANA%sT 1982 Apr 1 0:00s
|
||||
12:00 Russia ANA%sT 1991 Mar 31 2:00s
|
||||
11:00 Russia ANA%sT 1992 Jan 19 2:00s
|
||||
12:00 Russia ANA%sT
|
||||
12:00 Russia ANA%sT 2010 Mar 28 2:00s
|
||||
11:00 Russia ANA%sT
|
||||
|
||||
# Serbia
|
||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||
|
@ -1143,6 +1143,18 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914
|
||||
# http://www.shoa.cl/noticias/2008/04hora/hora.htm
|
||||
# </a>.
|
||||
|
||||
# From Angel Chiang (2010-03-04):
|
||||
# Subject: DST in Chile exceptionally extended to 3 April due to earthquake
|
||||
# <a href="http://www.gobiernodechile.cl/viewNoticia.aspx?idArticulo=30098">
|
||||
# http://www.gobiernodechile.cl/viewNoticia.aspx?idArticulo=30098
|
||||
# </a>
|
||||
# (in Spanish, last paragraph).
|
||||
#
|
||||
# This is breaking news. There should be more information available later.
|
||||
|
||||
# From Arthur Daivd Olson (2010-03-06):
|
||||
# Angel Chiang's message confirmed by Julio Pacheco; Julio provided a patch.
|
||||
|
||||
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
||||
Rule Chile 1927 1932 - Sep 1 0:00 1:00 S
|
||||
Rule Chile 1928 1932 - Apr 1 0:00 0 -
|
||||
@ -1177,7 +1189,9 @@ Rule Chile 2000 2007 - Mar Sun>=9 3:00u 0 -
|
||||
# N.B.: the end of March 29 in Chile is March 30 in Universal time,
|
||||
# which is used below in specifying the transition.
|
||||
Rule Chile 2008 only - Mar 30 3:00u 0 -
|
||||
Rule Chile 2009 max - Mar Sun>=9 3:00u 0 -
|
||||
Rule Chile 2009 only - Mar Sun>=9 3:00u 0 -
|
||||
Rule Chile 2010 only - Apr 4 3:00u 0 -
|
||||
Rule Chile 2011 max - Mar Sun>=9 3:00u 0 -
|
||||
# IATA SSIM anomalies: (1992-02) says 1992-03-14;
|
||||
# (1996-09) says 1998-03-08. Ignore these.
|
||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||
@ -1386,8 +1400,24 @@ Rule Para 2002 2003 - Sep Sun>=1 0:00 1:00 S
|
||||
# Decree 1,867 (2004-03-05)
|
||||
# From Carlos Raul Perasso via Jesper Norgaard Welen (2006-10-13)
|
||||
# <http://www.presidencia.gov.py/decretos/D1867.pdf>
|
||||
Rule Para 2004 max - Oct Sun>=15 0:00 1:00 S
|
||||
Rule Para 2005 max - Mar Sun>=8 0:00 0 -
|
||||
Rule Para 2004 2009 - Oct Sun>=15 0:00 1:00 S
|
||||
Rule Para 2005 2009 - Mar Sun>=8 0:00 0 -
|
||||
# From Carlos Raul Perasso (2010-02-18):
|
||||
# By decree number 3958 issued yesterday (
|
||||
# <a href="http://www.presidencia.gov.py/v1/wp-content/uploads/2010/02/decreto3958.pdf">
|
||||
# http://www.presidencia.gov.py/v1/wp-content/uploads/2010/02/decreto3958.pdf
|
||||
# </a>
|
||||
# )
|
||||
# Paraguay changes its DST schedule, postponing the March rule to April and
|
||||
# modifying the October date. The decree reads:
|
||||
# ...
|
||||
# Art. 1. It is hereby established that from the second Sunday of the month of
|
||||
# April of this year (2010), the official time is to be set back 60 minutes,
|
||||
# and that on the first Sunday of the month of October, it is to be set
|
||||
# forward 60 minutes, in all the territory of the Paraguayan Republic.
|
||||
# ...
|
||||
Rule Para 2010 max - Oct Sun>=1 0:00 1:00 S
|
||||
Rule Para 2010 max - Apr Sun>=8 0:00 0 -
|
||||
|
||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||
Zone America/Asuncion -3:50:40 - LMT 1890
|
||||
|
@ -66,6 +66,7 @@ AQ -6617+11031 Antarctica/Casey Casey Station, Bailey Peninsula
|
||||
AQ -7824+10654 Antarctica/Vostok Vostok Station, S Magnetic Pole
|
||||
AQ -6640+14001 Antarctica/DumontDUrville Dumont-d'Urville Station, Terre Adelie
|
||||
AQ -690022+0393524 Antarctica/Syowa Syowa Station, E Ongul I
|
||||
AQ -5430+15857 Antarctica/Macquarie Macquarie Island Station, Macquarie Island
|
||||
AR -3436-05827 America/Argentina/Buenos_Aires Buenos Aires (BA, CF)
|
||||
AR -3124-06411 America/Argentina/Cordoba most locations (CB, CC, CN, ER, FM, MN, SE, SF)
|
||||
AR -2447-06525 America/Argentina/Salta (SA, LP, NQ, RN)
|
||||
@ -351,7 +352,7 @@ RS +4450+02030 Europe/Belgrade
|
||||
RU +5443+02030 Europe/Kaliningrad Moscow-01 - Kaliningrad
|
||||
RU +5545+03735 Europe/Moscow Moscow+00 - west Russia
|
||||
RU +4844+04425 Europe/Volgograd Moscow+00 - Caspian Sea
|
||||
RU +5312+05009 Europe/Samara Moscow+01 - Samara, Udmurtia
|
||||
RU +5312+05009 Europe/Samara Moscow - Samara, Udmurtia
|
||||
RU +5651+06036 Asia/Yekaterinburg Moscow+02 - Urals
|
||||
RU +5500+07324 Asia/Omsk Moscow+03 - west Siberia
|
||||
RU +5502+08255 Asia/Novosibirsk Moscow+03 - Novosibirsk
|
||||
@ -362,8 +363,8 @@ RU +6200+12940 Asia/Yakutsk Moscow+06 - Lena River
|
||||
RU +4310+13156 Asia/Vladivostok Moscow+07 - Amur River
|
||||
RU +4658+14242 Asia/Sakhalin Moscow+07 - Sakhalin Island
|
||||
RU +5934+15048 Asia/Magadan Moscow+08 - Magadan
|
||||
RU +5301+15839 Asia/Kamchatka Moscow+09 - Kamchatka
|
||||
RU +6445+17729 Asia/Anadyr Moscow+10 - Bering Sea
|
||||
RU +5301+15839 Asia/Kamchatka Moscow+08 - Kamchatka
|
||||
RU +6445+17729 Asia/Anadyr Moscow+08 - Bering Sea
|
||||
RW -0157+03004 Africa/Kigali
|
||||
SA +2438+04643 Asia/Riyadh
|
||||
SB -0932+16012 Pacific/Guadalcanal
|
||||
|
@ -42,8 +42,6 @@ FILES_src = \
|
||||
sun/io/ByteToCharBig5_Solaris.java \
|
||||
sun/io/ByteToCharBig5_HKSCS.java \
|
||||
sun/io/ByteToCharMS950_HKSCS.java \
|
||||
sun/io/ByteToCharHKSCS.java \
|
||||
sun/io/ByteToCharHKSCS_2001.java \
|
||||
sun/io/ByteToCharGB18030.java \
|
||||
sun/io/ByteToCharGB18030DB.java \
|
||||
sun/io/ByteToCharCp037.java \
|
||||
@ -173,8 +171,6 @@ FILES_src = \
|
||||
sun/io/CharToByteBig5.java \
|
||||
sun/io/CharToByteBig5_Solaris.java \
|
||||
sun/io/CharToByteBig5_HKSCS.java \
|
||||
sun/io/CharToByteHKSCS.java \
|
||||
sun/io/CharToByteHKSCS_2001.java \
|
||||
sun/io/CharToByteMS950_HKSCS.java \
|
||||
sun/io/CharToByteGB18030.java \
|
||||
sun/io/CharToByteCp037.java \
|
||||
@ -374,6 +370,9 @@ FILES_gen_extcs = \
|
||||
sun/nio/cs/ext/MacUkraine.java \
|
||||
sun/nio/cs/ext/TIS_620.java \
|
||||
sun/nio/cs/ext/EUC_TWMapping.java \
|
||||
sun/nio/cs/ext/HKSCSMapping.java \
|
||||
sun/nio/cs/ext/HKSCS2001Mapping.java \
|
||||
sun/nio/cs/ext/HKSCS_XPMapping.java \
|
||||
sun/nio/cs/ext/IBM1381.java \
|
||||
sun/nio/cs/ext/IBM1383.java \
|
||||
sun/nio/cs/ext/IBM930.java \
|
||||
@ -394,7 +393,8 @@ FILES_gen_extcs = \
|
||||
sun/nio/cs/ext/MS936.java \
|
||||
sun/nio/cs/ext/MS949.java \
|
||||
sun/nio/cs/ext/MS950.java \
|
||||
sun/nio/cs/ext/GBK.java
|
||||
sun/nio/cs/ext/GBK.java \
|
||||
sun/nio/cs/ext/Big5.java
|
||||
|
||||
FILES_java = $(FILES_src) $(FILES_gen_extcs)
|
||||
|
||||
|
@ -93,7 +93,9 @@ $(FILES_genout_extcs): \
|
||||
$(MKDIR) -p $(GENCSEXT)
|
||||
$(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) extsbcs
|
||||
$(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) euctw \
|
||||
$(GENCSSRCDIR)/GenerateEUC_TW.java
|
||||
$(GENCSSRCDIR)/EUC_TW.java
|
||||
$(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) hkscs \
|
||||
$(GENCSSRCDIR)/HKSCS.java
|
||||
$(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) dbcs
|
||||
|
||||
$(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH): \
|
||||
|
8
jdk/make/tools/CharsetMapping/Big5.c2b
Normal file
8
jdk/make/tools/CharsetMapping/Big5.c2b
Normal file
@ -0,0 +1,8 @@
|
||||
#Add the following 5 characters which are duplicated
|
||||
#or have conflicts with other characters.
|
||||
0xA1C4 0xFF3F #REGWARN Fallback 0xA1C4 SPACING UNDERSCORE
|
||||
0xA2AC 0x2571 #REGWARN Fallback 0xA2AC LT DIAG UP RIGHT TO LOW LEFT
|
||||
0xA2AD 0x2572 #REGWARN Fallback 0xA2AD LT DIAG UP LEFT TO LOW RIGHT
|
||||
0xA451 0x5341 #REGWARN Fallback 0xA451 HANGZHOU NUMERAL TEN
|
||||
0xA4CA 0x5345 #REGWARN Fallback 0xA4CA HANGZHOU NUMERAL THIRTY
|
||||
#
|
13837
jdk/make/tools/CharsetMapping/Big5.map
Normal file
13837
jdk/make/tools/CharsetMapping/Big5.map
Normal file
File diff suppressed because it is too large
Load Diff
5
jdk/make/tools/CharsetMapping/Big5.nr
Normal file
5
jdk/make/tools/CharsetMapping/Big5.nr
Normal file
@ -0,0 +1,5 @@
|
||||
0xA15A 0xFF3F #SPACING UNDERSCORE
|
||||
0xA1FE 0x2571 #LT DIAG UP RIGHT TO LOW LEFT
|
||||
0xA240 0x2572 #LT DIAG UP LEFT TO LOW RIGHTG
|
||||
0xA2CC 0x5341 #HANGHZOU NUMERAL TEN
|
||||
0xA2CE 0x5345 #HANGZHOU NUMERAL THIRTY
|
2187
jdk/make/tools/CharsetMapping/HKSCS2001.c2b
Normal file
2187
jdk/make/tools/CharsetMapping/HKSCS2001.c2b
Normal file
File diff suppressed because it is too large
Load Diff
4821
jdk/make/tools/CharsetMapping/HKSCS2001.map
Normal file
4821
jdk/make/tools/CharsetMapping/HKSCS2001.map
Normal file
File diff suppressed because it is too large
Load Diff
4969
jdk/make/tools/CharsetMapping/HKSCS2008.c2b
Normal file
4969
jdk/make/tools/CharsetMapping/HKSCS2008.c2b
Normal file
File diff suppressed because it is too large
Load Diff
5019
jdk/make/tools/CharsetMapping/HKSCS2008.map
Normal file
5019
jdk/make/tools/CharsetMapping/HKSCS2008.map
Normal file
File diff suppressed because it is too large
Load Diff
529
jdk/make/tools/CharsetMapping/HKSCS_XP.c2b
Normal file
529
jdk/make/tools/CharsetMapping/HKSCS_XP.c2b
Normal file
@ -0,0 +1,529 @@
|
||||
# Generated from HKSCS.Encoder
|
||||
#
|
||||
0xFA45 0xE005
|
||||
0xFA48 0xE008
|
||||
0xFA68 0xE028
|
||||
0xFA6B 0xE02B
|
||||
0xFAA5 0xE043
|
||||
0xFACC 0xE06A
|
||||
0xFACD 0xE06B
|
||||
0xFAD0 0xE06E
|
||||
0xFAE0 0xE07E
|
||||
0xFAE8 0xE086
|
||||
0xFAFA 0xE098
|
||||
0xFAFD 0xE09B
|
||||
0xFB43 0xE0A0
|
||||
0xFB4B 0xE0A8
|
||||
0xFB5E 0xE0BB
|
||||
0xFB65 0xE0C2
|
||||
0xFB70 0xE0CD
|
||||
0xFB7A 0xE0D7
|
||||
0xFB7D 0xE0DA
|
||||
0xFBB6 0xE0F1
|
||||
0xFBB9 0xE0F4
|
||||
0xFBBF 0xE0FA
|
||||
0xFBC1 0xE0FC
|
||||
0xFBC9 0xE104
|
||||
0xFBCA 0xE105
|
||||
0xFBD3 0xE10E
|
||||
0xFBDC 0xE117
|
||||
0xFBEA 0xE125
|
||||
0xFBEF 0xE12A
|
||||
0xFBF0 0xE12B
|
||||
0xFC42 0xE13C
|
||||
0xFC49 0xE143
|
||||
0xFC4A 0xE144
|
||||
0xFC59 0xE153
|
||||
0xFC64 0xE15E
|
||||
0xFC65 0xE15F
|
||||
0xFC66 0xE160
|
||||
0xFC6A 0xE164
|
||||
0xFCA6 0xE17E
|
||||
0xFCB4 0xE18C
|
||||
0xFCC2 0xE19A
|
||||
0xFCC4 0xE19C
|
||||
0xFCCF 0xE1A7
|
||||
0xFCD1 0xE1A9
|
||||
0xFCEE 0xE1C6
|
||||
0xFCF7 0xE1CF
|
||||
0xFD49 0xE1E0
|
||||
0xFD4A 0xE1E1
|
||||
0xFD4C 0xE1E3
|
||||
0xFD50 0xE1E7
|
||||
0xFD53 0xE1EA
|
||||
0xFD5D 0xE1F4
|
||||
0xFD61 0xE1F8
|
||||
0xFD6C 0xE203
|
||||
0xFD7A 0xE211
|
||||
0xFDA2 0xE217
|
||||
0xFDA3 0xE218
|
||||
0xFDC4 0xE239
|
||||
0xFDCA 0xE23F
|
||||
0xFDCE 0xE243
|
||||
0xFDD1 0xE246
|
||||
0xFDE8 0xE25D
|
||||
0xFDE9 0xE25E
|
||||
0xFE4D 0xE281
|
||||
0xFE56 0xE28A
|
||||
0xFE64 0xE298
|
||||
0xFE6E 0xE2A2
|
||||
0xFE78 0xE2AC
|
||||
0xFE7D 0xE2B1
|
||||
0xFEB6 0xE2C8
|
||||
0xFEC5 0xE2D7
|
||||
0xFEFB 0xE30D
|
||||
0x8E45 0xE316
|
||||
0x8E55 0xE326
|
||||
0x8E59 0xE32A
|
||||
0x8E6B 0xE33C
|
||||
0x8EA2 0xE351
|
||||
0x8EAF 0xE35E
|
||||
0x8EB9 0xE368
|
||||
0x8EC7 0xE376
|
||||
0x8EC9 0xE378
|
||||
0x8ED8 0xE387
|
||||
0x8EED 0xE39C
|
||||
0x8EFE 0xE3AD
|
||||
0x8F45 0xE3B3
|
||||
0x8F50 0xE3BE
|
||||
0x8F54 0xE3C2
|
||||
0x8F59 0xE3C7
|
||||
0x8F5D 0xE3CB
|
||||
0x8F63 0xE3D1
|
||||
0x8F64 0xE3D2
|
||||
0x8F70 0xE3DE
|
||||
0x8F74 0xE3E2
|
||||
0x8F76 0xE3E4
|
||||
0x8F7A 0xE3E8
|
||||
0x8F7C 0xE3EA
|
||||
0x8FA9 0xE3F5
|
||||
0x8FAB 0xE3F7
|
||||
0x8FBA 0xE406
|
||||
0x8FC2 0xE40E
|
||||
0x8FDB 0xE427
|
||||
0x8FEB 0xE437
|
||||
0x8FF1 0xE43D
|
||||
0x8FFD 0xE449
|
||||
0x9044 0xE44F
|
||||
0x9055 0xE460
|
||||
0x9060 0xE46B
|
||||
0x906F 0xE47A
|
||||
0x90AA 0xE493
|
||||
0x90B7 0xE4A0
|
||||
0x90BC 0xE4A5
|
||||
0x90C0 0xE4A9
|
||||
0x90C9 0xE4B2
|
||||
0x90D5 0xE4BE
|
||||
0x90D6 0xE4BF
|
||||
0x90D7 0xE4C0
|
||||
0x90F5 0xE4DE
|
||||
0x90FA 0xE4E3
|
||||
0x90FC 0xE4E5
|
||||
0x9145 0xE4ED
|
||||
0x914F 0xE4F7
|
||||
0x9158 0xE500
|
||||
0x915F 0xE507
|
||||
0x9166 0xE50E
|
||||
0x91AE 0xE534
|
||||
0x91B3 0xE539
|
||||
0x91B4 0xE53A
|
||||
0x91B5 0xE53B
|
||||
0x91B7 0xE53D
|
||||
0x91BB 0xE541
|
||||
0x91CD 0xE553
|
||||
0x91E3 0xE569
|
||||
0x91EE 0xE574
|
||||
0x91F2 0xE578
|
||||
0x91F5 0xE57B
|
||||
0x91F9 0xE57F
|
||||
0x924C 0xE591
|
||||
0x9251 0xE596
|
||||
0x9252 0xE597
|
||||
0x9253 0xE598
|
||||
0x9257 0xE59C
|
||||
0x9269 0xE5AE
|
||||
0x9274 0xE5B9
|
||||
0x9277 0xE5BC
|
||||
0x92BD 0xE5E0
|
||||
0x92C9 0xE5EC
|
||||
0x92D2 0xE5F5
|
||||
0x92D7 0xE5FA
|
||||
0x92DB 0xE5FE
|
||||
0x92E9 0xE60C
|
||||
0x92FA 0xE61D
|
||||
0x9347 0xE629
|
||||
0x934B 0xE62D
|
||||
0x9357 0xE639
|
||||
0x9359 0xE63B
|
||||
0x935B 0xE63D
|
||||
0x936F 0xE651
|
||||
0x93A4 0xE664
|
||||
0x93B5 0xE675
|
||||
0x93C1 0xE681
|
||||
0x93C2 0xE682
|
||||
0x93CD 0xE68D
|
||||
0x93D4 0xE694
|
||||
0x93DD 0xE69D
|
||||
0x93E0 0xE6A0
|
||||
0x93E4 0xE6A4
|
||||
0x93E9 0xE6A9
|
||||
0x93EB 0xE6AB
|
||||
0x93F6 0xE6B6
|
||||
0x9449 0xE6C8
|
||||
0x9463 0xE6E2
|
||||
0x9464 0xE6E3
|
||||
0x9469 0xE6E8
|
||||
0x946E 0xE6ED
|
||||
0x9470 0xE6EF
|
||||
0x9472 0xE6F1
|
||||
0x9475 0xE6F4
|
||||
0x9479 0xE6F8
|
||||
0x947E 0xE6FD
|
||||
0x94A1 0xE6FE
|
||||
0x94A3 0xE700
|
||||
0x94B5 0xE712
|
||||
0x94B9 0xE716
|
||||
0x94BC 0xE719
|
||||
0x94C9 0xE726
|
||||
0x94D1 0xE72E
|
||||
0x94D3 0xE730
|
||||
0x94DB 0xE738
|
||||
0x94DD 0xE73A
|
||||
0x94DE 0xE73B
|
||||
0x94EC 0xE749
|
||||
0x94EF 0xE74C
|
||||
0x9544 0xE760
|
||||
0x955A 0xE776
|
||||
0x9562 0xE77E
|
||||
0x9564 0xE780
|
||||
0x9573 0xE78F
|
||||
0x95B0 0xE7AA
|
||||
0x95B2 0xE7AC
|
||||
0x95B3 0xE7AD
|
||||
0x95B4 0xE7AE
|
||||
0x95C6 0xE7C0
|
||||
0x95C7 0xE7C1
|
||||
0x95CD 0xE7C7
|
||||
0x95D1 0xE7CB
|
||||
0x95D6 0xE7D0
|
||||
0x95DB 0xE7D5
|
||||
0x95DF 0xE7D9
|
||||
0x95EC 0xE7E6
|
||||
0x95F0 0xE7EA
|
||||
0x95F6 0xE7F0
|
||||
0x95FC 0xE7F6
|
||||
0x9641 0xE7FA
|
||||
0x964D 0xE806
|
||||
0x965C 0xE815
|
||||
0x9662 0xE81B
|
||||
0x9664 0xE81D
|
||||
0x9669 0xE822
|
||||
0x966B 0xE824
|
||||
0x9675 0xE82E
|
||||
0x9678 0xE831
|
||||
0x9679 0xE832
|
||||
0x96A6 0xE83D
|
||||
0x96A8 0xE83F
|
||||
0x96B9 0xE850
|
||||
0x96BC 0xE853
|
||||
0x96C8 0xE85F
|
||||
0x96D4 0xE86B
|
||||
0x96D6 0xE86D
|
||||
0x96DF 0xE876
|
||||
0x96E9 0xE880
|
||||
0x96F7 0xE88E
|
||||
0x9743 0xE899
|
||||
0x9745 0xE89B
|
||||
0x9746 0xE89C
|
||||
0x975D 0xE8B3
|
||||
0x9761 0xE8B7
|
||||
0x9766 0xE8BC
|
||||
0x977C 0xE8D2
|
||||
0x97AE 0xE8E2
|
||||
0x97B0 0xE8E4
|
||||
0x97B8 0xE8EC
|
||||
0x97BA 0xE8EE
|
||||
0x97C0 0xE8F4
|
||||
0x97C2 0xE8F6
|
||||
0x97C3 0xE8F7
|
||||
0x97C5 0xE8F9
|
||||
0x97C6 0xE8FA
|
||||
0x97C9 0xE8FD
|
||||
0x97CD 0xE901
|
||||
0x97D2 0xE906
|
||||
0x97D7 0xE90B
|
||||
0x97DA 0xE90E
|
||||
0x97DB 0xE90F
|
||||
0x97DC 0xE910
|
||||
0x97DD 0xE911
|
||||
0x97DE 0xE912
|
||||
0x97E1 0xE915
|
||||
0x97E7 0xE91B
|
||||
0x97FD 0xE931
|
||||
0x97FE 0xE932
|
||||
0x9853 0xE946
|
||||
0x9856 0xE949
|
||||
0x9872 0xE965
|
||||
0x9879 0xE96C
|
||||
0x98A8 0xE979
|
||||
0x98BC 0xE98D
|
||||
0x98C3 0xE994
|
||||
0x98C5 0xE996
|
||||
0x98CB 0xE99C
|
||||
0x98CC 0xE99D
|
||||
0x98CD 0xE99E
|
||||
0x98CE 0xE99F
|
||||
0x98D0 0xE9A1
|
||||
0x98D1 0xE9A2
|
||||
0x98D6 0xE9A7
|
||||
0x98D9 0xE9AA
|
||||
0x98DB 0xE9AC
|
||||
0x98DD 0xE9AE
|
||||
0x98E4 0xE9B5
|
||||
0x98E6 0xE9B7
|
||||
0x98E8 0xE9B9
|
||||
0x98E9 0xE9BA
|
||||
0x98EB 0xE9BC
|
||||
0x98EC 0xE9BD
|
||||
0x98F4 0xE9C5
|
||||
0x98FE 0xE9CF
|
||||
0x9940 0xE9D0
|
||||
0x9946 0xE9D6
|
||||
0x9948 0xE9D8
|
||||
0x994B 0xE9DB
|
||||
0x994E 0xE9DE
|
||||
0x9955 0xE9E5
|
||||
0x9956 0xE9E6
|
||||
0x9959 0xE9E9
|
||||
0x995B 0xE9EB
|
||||
0x9967 0xE9F7
|
||||
0x996E 0xE9FE
|
||||
0x9973 0xEA03
|
||||
0x997A 0xEA0A
|
||||
0x997B 0xEA0B
|
||||
0x99A1 0xEA0F
|
||||
0x99A5 0xEA13
|
||||
0x99A7 0xEA15
|
||||
0x99AD 0xEA1B
|
||||
0x99B3 0xEA21
|
||||
0x99BC 0xEA2A
|
||||
0x99C3 0xEA31
|
||||
0x99C7 0xEA35
|
||||
0x99CE 0xEA3C
|
||||
0x99CF 0xEA3D
|
||||
0x99DE 0xEA4C
|
||||
0x99E1 0xEA4F
|
||||
0x99E9 0xEA57
|
||||
0x99F5 0xEA63
|
||||
0x99F8 0xEA66
|
||||
0x9A48 0xEA75
|
||||
0x9A49 0xEA76
|
||||
0x9A50 0xEA7D
|
||||
0x9A55 0xEA82
|
||||
0x9A58 0xEA85
|
||||
0x9A5A 0xEA87
|
||||
0x9A5C 0xEA89
|
||||
0x9A60 0xEA8D
|
||||
0x9A63 0xEA90
|
||||
0x9A6E 0xEA9B
|
||||
0x9A70 0xEA9D
|
||||
0x9A79 0xEAA6
|
||||
0x9A7B 0xEAA8
|
||||
0x9ABD 0xEAC8
|
||||
0x9AEC 0xEAF7
|
||||
0x9B4D 0xEB17
|
||||
0x9BA9 0xEB51
|
||||
0x9BAA 0xEB52
|
||||
0x9BB8 0xEB60
|
||||
0x9BBE 0xEB66
|
||||
0x9BC2 0xEB6A
|
||||
0x9BDF 0xEB87
|
||||
0x9BE3 0xEB8B
|
||||
0x9BEA 0xEB92
|
||||
0x9BEE 0xEB96
|
||||
0x9C4A 0xEBB1
|
||||
0x9C5C 0xEBC3
|
||||
0x9C6F 0xEBD6
|
||||
0x9C79 0xEBE0
|
||||
0x9CA1 0xEBE6
|
||||
0x9CA5 0xEBEA
|
||||
0x9CBA 0xEBFF
|
||||
0x9CBB 0xEC00
|
||||
0x9CBE 0xEC03
|
||||
0x9CC6 0xEC0B
|
||||
0x9CC8 0xEC0D
|
||||
0x9CD1 0xEC16
|
||||
0x9CF8 0xEC3D
|
||||
0x9D46 0xEC4A
|
||||
0x9D49 0xEC4D
|
||||
0x9D4F 0xEC53
|
||||
0x9D51 0xEC55
|
||||
0x9D5D 0xEC61
|
||||
0x9D73 0xEC77
|
||||
0x9D78 0xEC7C
|
||||
0x9D7B 0xEC7F
|
||||
0x9DA5 0xEC87
|
||||
0x9DAA 0xEC8C
|
||||
0x9DAD 0xEC8F
|
||||
0x9DB5 0xEC97
|
||||
0x9DCC 0xECAE
|
||||
0x9DCE 0xECB0
|
||||
0x9DEE 0xECD0
|
||||
0x9DF3 0xECD5
|
||||
0x9E53 0xECF4
|
||||
0x9E64 0xED05
|
||||
0x9E7A 0xED1B
|
||||
0x9E7E 0xED1F
|
||||
0x9EA4 0xED23
|
||||
0x9EB4 0xED33
|
||||
0x9EB8 0xED37
|
||||
0x9EB9 0xED38
|
||||
0x9EBB 0xED3A
|
||||
0x9EC5 0xED44
|
||||
0x9EC9 0xED48
|
||||
0x9ECD 0xED4C
|
||||
0x9EDA 0xED59
|
||||
0x9EDD 0xED5C
|
||||
0x9EDE 0xED5D
|
||||
0x9EDF 0xED5E
|
||||
0x9EE5 0xED64
|
||||
0x9EE7 0xED66
|
||||
0x9EEE 0xED6D
|
||||
0x9EF0 0xED6F
|
||||
0x9EFC 0xED7B
|
||||
0x9F70 0xEDAE
|
||||
0x9FA5 0xEDC1
|
||||
0x9FD7 0xEDF3
|
||||
0x9FD9 0xEDF5
|
||||
0xA053 0xEE2E
|
||||
0xA068 0xEE43
|
||||
0xA06A 0xEE45
|
||||
0xA06F 0xEE4A
|
||||
0xA078 0xEE53
|
||||
0xA07E 0xEE59
|
||||
0xA0AC 0xEE65
|
||||
0xA0D0 0xEE89
|
||||
0xA0DA 0xEE93
|
||||
0xA0DE 0xEE97
|
||||
0xA0E6 0xEE9F
|
||||
0xA0F9 0xEEB2
|
||||
0x89B7 0xF3F5
|
||||
0x89BA 0xF3F8
|
||||
0x89BF 0xF3FD
|
||||
0x89C5 0xF403
|
||||
0x89D5 0xF413
|
||||
0x89D7 0xF415
|
||||
0x89DA 0xF418
|
||||
0x89DB 0xF419
|
||||
0x89DC 0xF41A
|
||||
0x89E6 0xF424
|
||||
0x89E8 0xF426
|
||||
0x89EA 0xF428
|
||||
0x89ED 0xF42B
|
||||
0x89EE 0xF42C
|
||||
0x89EF 0xF42D
|
||||
0x89F9 0xF437
|
||||
0x89FB 0xF439
|
||||
0x89FC 0xF43A
|
||||
0x89FE 0xF43C
|
||||
0x8A48 0xF445
|
||||
0x8A4D 0xF44A
|
||||
0x8A51 0xF44E
|
||||
0x8A52 0xF44F
|
||||
0x8A67 0xF464
|
||||
0x8A6B 0xF468
|
||||
0x8A6D 0xF46A
|
||||
0x8A6E 0xF46B
|
||||
0x8A76 0xF473
|
||||
0x8A7D 0xF47A
|
||||
0x8AAC 0xF487
|
||||
0x8AAE 0xF489
|
||||
0x8AB8 0xF493
|
||||
0x8AB9 0xF494
|
||||
0x8ABB 0xF496
|
||||
0x8AC2 0xF49D
|
||||
0x8AC7 0xF4A2
|
||||
0x8AD0 0xF4AB
|
||||
0x8AD1 0xF4AC
|
||||
0x8AD3 0xF4AE
|
||||
0x8ADA 0xF4B5
|
||||
0x8AEB 0xF4C6
|
||||
0x8AF0 0xF4CB
|
||||
0x8AFB 0xF4D6
|
||||
0x8B47 0xF4E1
|
||||
0x8B60 0xF4FA
|
||||
0x8B68 0xF502
|
||||
0x8B6A 0xF504
|
||||
0x8BA6 0xF51E
|
||||
0x8BB1 0xF529
|
||||
0x8BB5 0xF52D
|
||||
0x8BB6 0xF52E
|
||||
0x8BB8 0xF530
|
||||
0x8BBE 0xF536
|
||||
0x8BC8 0xF540
|
||||
0x8BCC 0xF544
|
||||
0x8BDC 0xF554
|
||||
0x8D63 0xF637
|
||||
0x8D64 0xF638
|
||||
0x8D67 0xF63B
|
||||
0x8D68 0xF63C
|
||||
0x8D6D 0xF641
|
||||
0x8D6E 0xF642
|
||||
0x8D6F 0xF643
|
||||
0x8D70 0xF644
|
||||
0x8D74 0xF648
|
||||
0x8D78 0xF64C
|
||||
0x8D7D 0xF651
|
||||
0x8DA1 0xF653
|
||||
0x8DA6 0xF658
|
||||
0x8DAB 0xF65D
|
||||
0x8DAD 0xF65F
|
||||
0x8DB0 0xF662
|
||||
0x8DB2 0xF664
|
||||
0x8DB4 0xF666
|
||||
0x8DB7 0xF669
|
||||
0x8DBA 0xF66C
|
||||
0x8DBB 0xF66D
|
||||
0x8DBC 0xF66E
|
||||
0x8DC3 0xF675
|
||||
0x8DC5 0xF677
|
||||
0x8DCA 0xF67C
|
||||
0x8DCC 0xF67E
|
||||
0x8DD6 0xF688
|
||||
0x8DDB 0xF68D
|
||||
0x8DEB 0xF69D
|
||||
0x8DEF 0xF6A1
|
||||
0x8DF0 0xF6A2
|
||||
0x8DF3 0xF6A5
|
||||
0x8DF5 0xF6A7
|
||||
0x8DFC 0xF6AE
|
||||
0x8DFD 0xF6AF
|
||||
0xC6CD 0xF6DD
|
||||
0xC8D6 0xF820
|
||||
0xC8D7 0xF821
|
||||
0xC8D8 0xF822
|
||||
0xC8D9 0xF823
|
||||
0xC8DA 0xF824
|
||||
0xC8DB 0xF825
|
||||
0xC8DC 0xF826
|
||||
0xC8DD 0xF827
|
||||
0xC8DE 0xF828
|
||||
0xC8DF 0xF829
|
||||
0xC8E0 0xF82A
|
||||
0xC8E1 0xF82B
|
||||
0xC8E2 0xF82C
|
||||
0xC8E3 0xF82D
|
||||
0xC8E4 0xF82E
|
||||
0xC8E5 0xF82F
|
||||
0xC8E6 0xF830
|
||||
0xC8E7 0xF831
|
||||
0xC8E8 0xF832
|
||||
0xC8E9 0xF833
|
||||
0xC8EA 0xF834
|
||||
0xC8EB 0xF835
|
||||
0xC8EC 0xF836
|
||||
0xC8ED 0xF837
|
||||
0xC8EE 0xF838
|
||||
0xC8EF 0xF839
|
||||
0xC8F0 0xF83A
|
||||
0xC8F1 0xF83B
|
4704
jdk/make/tools/CharsetMapping/HKSCS_XP.map
Normal file
4704
jdk/make/tools/CharsetMapping/HKSCS_XP.map
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@
|
||||
#
|
||||
#clzName csName hisName dbtype pkg ascii b1min b1max b2min b2max
|
||||
#
|
||||
Big5 Big5 Big5 basic sun.nio.cs.ext true 0xa1 0xf9 0x40 0xfe
|
||||
Johab x-Johab x-Johab basic sun.nio.cs.ext true 0x84 0xf9 0x31 0xfe
|
||||
EUC_CN GB2312 EUC_CN basic sun.nio.cs.ext true 0xa1 0xf7 0xa1 0xfe
|
||||
EUC_KR EUC-KR EUC_KR basic sun.nio.cs.ext true 0xa1 0xfd 0xa1 0xfe
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -31,12 +31,13 @@ import java.util.Scanner;
|
||||
import java.util.Formatter;
|
||||
import java.util.regex.*;
|
||||
import java.nio.charset.*;
|
||||
import static build.tools.charsetmapping.CharsetMapping.*;
|
||||
import static build.tools.charsetmapping.Utils.*;
|
||||
|
||||
public class GenerateDBCS {
|
||||
public class DBCS {
|
||||
// pattern used by this class to read in mapping table
|
||||
static Pattern mPattern = Pattern.compile("(?:0x)?(\\p{XDigit}++)\\s++(?:0x)?(\\p{XDigit}++)(?:\\s++#.*)?");
|
||||
public static void genDBCS(String args[]) throws Exception {
|
||||
|
||||
public static void genClass(String args[]) throws Exception {
|
||||
|
||||
Scanner s = new Scanner(new File(args[0], args[2]));
|
||||
while (s.hasNextLine()) {
|
||||
@ -63,81 +64,29 @@ public class GenerateDBCS {
|
||||
int b2Min = toInteger(fields[8]);
|
||||
int b2Max = toInteger(fields[9]);
|
||||
System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
|
||||
genClass(args[0], args[1], "DoubleByte-X.java.template",
|
||||
genClass0(args[0], args[1], "DoubleByte-X.java.template",
|
||||
clzName, csName, hisName, pkgName,
|
||||
isASCII, type,
|
||||
b1Min, b1Max, b2Min, b2Max);
|
||||
}
|
||||
}
|
||||
|
||||
private static int toInteger(String s) {
|
||||
static int toInteger(String s) {
|
||||
if (s.startsWith("0x") || s.startsWith("0X"))
|
||||
return Integer.valueOf(s.substring(2), 16);
|
||||
else
|
||||
return Integer.valueOf(s);
|
||||
}
|
||||
|
||||
private static void outString(Formatter out,
|
||||
char[] cc, int off, int end,
|
||||
String closure)
|
||||
{
|
||||
while (off < end) {
|
||||
out.format(" \"");
|
||||
for (int j = 0; j < 8; j++) {
|
||||
if (off == end)
|
||||
break;
|
||||
char c = cc[off++];
|
||||
switch (c) {
|
||||
case '\b':
|
||||
out.format("\\b"); break;
|
||||
case '\t':
|
||||
out.format("\\t"); break;
|
||||
case '\n':
|
||||
out.format("\\n"); break;
|
||||
case '\f':
|
||||
out.format("\\f"); break;
|
||||
case '\r':
|
||||
out.format("\\r"); break;
|
||||
case '\"':
|
||||
out.format("\\\""); break;
|
||||
case '\'':
|
||||
out.format("\\'"); break;
|
||||
case '\\':
|
||||
out.format("\\\\"); break;
|
||||
default:
|
||||
out.format("\\u%04X", c & 0xffff);
|
||||
}
|
||||
}
|
||||
if (off == end)
|
||||
out.format("\" %s%n", closure);
|
||||
else
|
||||
out.format("\" + %n");
|
||||
}
|
||||
}
|
||||
|
||||
private static void outString(Formatter out,
|
||||
char[] db,
|
||||
int b1,
|
||||
int b2Min, int b2Max,
|
||||
String closure)
|
||||
{
|
||||
char[] cc = new char[b2Max - b2Min + 1];
|
||||
int off = 0;
|
||||
for (int b2 = b2Min; b2 <= b2Max; b2++) {
|
||||
cc[off++] = db[(b1 << 8) | b2];
|
||||
}
|
||||
outString(out, cc, 0, cc.length, closure);
|
||||
}
|
||||
|
||||
private static void genClass(String srcDir, String dstDir, String template,
|
||||
String clzName,
|
||||
String csName,
|
||||
String hisName,
|
||||
String pkgName,
|
||||
boolean isASCII,
|
||||
String type,
|
||||
int b1Min, int b1Max,
|
||||
int b2Min, int b2Max)
|
||||
private static void genClass0(String srcDir, String dstDir, String template,
|
||||
String clzName,
|
||||
String csName,
|
||||
String hisName,
|
||||
String pkgName,
|
||||
boolean isASCII,
|
||||
String type,
|
||||
int b1Min, int b1Max,
|
||||
int b2Min, int b2Max)
|
||||
throws Exception
|
||||
{
|
||||
|
||||
@ -172,21 +121,21 @@ public class GenerateDBCS {
|
||||
c2bIndex[e.cp>>8] = 1;
|
||||
}
|
||||
}
|
||||
Formatter fm = new Formatter(b2cSB);
|
||||
fm.format("%n static final String b2cSBStr =%n");
|
||||
outString(fm, db, 0x00, 0x100, ";");
|
||||
Output out = new Output(new Formatter(b2cSB));
|
||||
out.format("%n static final String b2cSBStr =%n");
|
||||
out.format(db, 0x00, 0x100, ";");
|
||||
|
||||
fm.format("%n static final String[] b2cStr = {%n");
|
||||
out.format("%n static final String[] b2cStr = {%n");
|
||||
for (int i = 0; i < 0x100; i++) {
|
||||
if (b2cIndex[i] == UNMAPPABLE_DECODING) {
|
||||
fm.format(" null,%n"); //unmappable segments
|
||||
out.format(" null,%n"); //unmappable segments
|
||||
} else {
|
||||
outString(fm, db, i, b2Min, b2Max, ",");
|
||||
out.format(db, i, b2Min, b2Max, ",");
|
||||
}
|
||||
}
|
||||
|
||||
fm.format(" };%n");
|
||||
fm.close();
|
||||
out.format(" };%n");
|
||||
out.close();
|
||||
|
||||
// (2)now parse the .nr file which includes "b->c" non-roundtrip entries
|
||||
File f = new File(srcDir, clzName + ".nr");
|
||||
@ -201,10 +150,10 @@ public class GenerateDBCS {
|
||||
sb.append((char)e.cp);
|
||||
}
|
||||
char[] nr = sb.toString().toCharArray();
|
||||
fm = new Formatter(b2cNRSB);
|
||||
fm.format("String b2cNR =%n");
|
||||
outString(fm, nr, 0, nr.length, ";");
|
||||
fm.close();
|
||||
out = new Output(new Formatter(b2cNRSB));
|
||||
out.format("String b2cNR =%n");
|
||||
out.format(nr, 0, nr.length, ";");
|
||||
out.close();
|
||||
} else {
|
||||
b2cNRSB.append("String b2cNR = null;");
|
||||
}
|
||||
@ -226,10 +175,10 @@ public class GenerateDBCS {
|
||||
sb.append((char)e.cp);
|
||||
}
|
||||
char[] nr = sb.toString().toCharArray();
|
||||
fm = new Formatter(c2bNRSB);
|
||||
fm.format("String c2bNR =%n");
|
||||
outString(fm, nr, 0, nr.length, ";");
|
||||
fm.close();
|
||||
out = new Output(new Formatter(c2bNRSB));
|
||||
out.format("String c2bNR =%n");
|
||||
out.format(nr, 0, nr.length, ";");
|
||||
out.close();
|
||||
} else {
|
||||
c2bNRSB.append("String c2bNR = null;");
|
||||
}
|
||||
@ -240,15 +189,15 @@ public class GenerateDBCS {
|
||||
String c2bNR = c2bNRSB.toString();
|
||||
|
||||
Scanner s = new Scanner(new File(srcDir, template));
|
||||
PrintStream out = new PrintStream(new FileOutputStream(
|
||||
new File(dstDir, clzName + ".java")));
|
||||
PrintStream ops = new PrintStream(new FileOutputStream(
|
||||
new File(dstDir, clzName + ".java")));
|
||||
if (hisName == null)
|
||||
hisName = "";
|
||||
|
||||
while (s.hasNextLine()) {
|
||||
String line = s.nextLine();
|
||||
if (line.indexOf("$") == -1) {
|
||||
out.println(line);
|
||||
ops.println(line);
|
||||
continue;
|
||||
}
|
||||
line = line.replace("$PACKAGE$" , pkgName)
|
||||
@ -280,8 +229,8 @@ public class GenerateDBCS {
|
||||
.replace("$NONROUNDTRIP_B2C$", b2cNR)
|
||||
.replace("$NONROUNDTRIP_C2B$", c2bNR);
|
||||
|
||||
out.println(line);
|
||||
ops.println(line);
|
||||
}
|
||||
out.close();
|
||||
ops.close();
|
||||
}
|
||||
}
|
177
jdk/make/tools/src/build/tools/charsetmapping/EUC_TW.java
Normal file
177
jdk/make/tools/src/build/tools/charsetmapping/EUC_TW.java
Normal file
@ -0,0 +1,177 @@
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
import java.util.Formatter;
|
||||
import java.util.regex.*;
|
||||
import java.nio.charset.*;
|
||||
import static build.tools.charsetmapping.Utils.*;
|
||||
|
||||
public class EUC_TW {
|
||||
|
||||
static char[] toCharArray(int[] db,
|
||||
int b1Min, int b1Max,
|
||||
int b2Min, int b2Max)
|
||||
{
|
||||
char[] ca = new char[(b1Max - b1Min + 1) * (b2Max - b2Min + 1)];
|
||||
int off = 0;
|
||||
for (int b1 = b1Min; b1 <= b1Max; b1++) {
|
||||
for (int b2 = b2Min; b2 <= b2Max; b2++) {
|
||||
ca[off++] = (char)(db[b1 * 256 + b2] & 0xffff);
|
||||
}
|
||||
}
|
||||
return ca;
|
||||
}
|
||||
|
||||
static char[] toCharArray(byte[] ba,
|
||||
int b1Min, int b1Max,
|
||||
int b2Min, int b2Max)
|
||||
{
|
||||
char[] ca = new char[(b1Max - b1Min + 1) * (b2Max - b2Min + 1)];
|
||||
int off = 0;
|
||||
for (int b1 = b1Min; b1 <= b1Max; b1++) {
|
||||
int b2 = b2Min;
|
||||
while (b2 <= b2Max) {
|
||||
ca[off++] = (char)(((ba[b1 * 256 + b2++] & 0xff) << 8) |
|
||||
(ba[b1 * 256 + b2++] & 0xff));
|
||||
}
|
||||
}
|
||||
return ca;
|
||||
}
|
||||
|
||||
private static int initC2BIndex(char[] index) {
|
||||
int off = 0;
|
||||
for (int i = 0; i < index.length; i++) {
|
||||
if (index[i] != 0) {
|
||||
index[i] = (char)off;
|
||||
off += 0x100;
|
||||
} else {
|
||||
index[i] = UNMAPPABLE_ENCODING;
|
||||
}
|
||||
}
|
||||
return off;
|
||||
}
|
||||
|
||||
private static Pattern euctw = Pattern.compile("(?:8ea)?(\\p{XDigit}++)\\s++(\\p{XDigit}++)?\\s*+.*");
|
||||
|
||||
static void genClass(String args[]) throws Exception
|
||||
{
|
||||
InputStream is = new FileInputStream(new File(args[0], "euc_tw.map"));
|
||||
PrintStream ps = new PrintStream(new File(args[1], "EUC_TWMapping.java"),
|
||||
"ISO-8859-1");
|
||||
String copyright = getCopyright(new File(args[3]));
|
||||
|
||||
|
||||
// ranges of byte1 and byte2, something should come from a "config" file
|
||||
int b1Min = 0xa1;
|
||||
int b1Max = 0xfe;
|
||||
int b2Min = 0xa1;
|
||||
int b2Max = 0xfe;
|
||||
|
||||
try {
|
||||
int[][] db = new int[8][0x10000]; // doublebyte
|
||||
byte[] suppFlag = new byte[0x10000]; // doublebyte
|
||||
char[] indexC2B = new char[256];
|
||||
char[] indexC2BSupp = new char[256];
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
for (int j = 0; j < 0x10000; j++)
|
||||
db[i][j] = UNMAPPABLE_DECODING;
|
||||
|
||||
Parser p = new Parser(is, euctw);
|
||||
Entry e = null;
|
||||
while ((e = p.next()) != null) {
|
||||
int plane = 0;
|
||||
if (e.bs >= 0x10000) {
|
||||
plane = ((e.bs >> 16) & 0xff) - 1;
|
||||
if (plane >= 14)
|
||||
plane = 7;
|
||||
e.bs = e.bs & 0xffff;
|
||||
}
|
||||
db[plane][e.bs] = e.cp;
|
||||
if (e.cp < 0x10000) {
|
||||
indexC2B[e.cp>>8] = 1;
|
||||
} else {
|
||||
indexC2BSupp[(e.cp&0xffff)>>8] = 1;
|
||||
suppFlag[e.bs] |= (1 << plane);
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Output out = new Output(new Formatter(sb));
|
||||
|
||||
out.format(copyright);
|
||||
out.format("%n// -- This file was mechanically generated: Do not edit! -- //%n");
|
||||
out.format("package sun.nio.cs.ext;%n%n");
|
||||
out.format("class EUC_TWMapping {%n%n");
|
||||
|
||||
// boundaries
|
||||
out.format(" final static int b1Min = 0x%x;%n", b1Min);
|
||||
out.format(" final static int b1Max = 0x%x;%n", b1Max);
|
||||
out.format(" final static int b2Min = 0x%x;%n", b2Min);
|
||||
out.format(" final static int b2Max = 0x%x;%n", b2Max);
|
||||
|
||||
// b2c tables
|
||||
out.format("%n final static String[] b2c = {%n");
|
||||
for (int plane = 0; plane < 8; plane++) {
|
||||
out.format(" // Plane %d%n", plane);
|
||||
out.format(toCharArray(db[plane], b1Min, b1Max, b2Min, b2Max),
|
||||
",");
|
||||
out.format("%n");
|
||||
}
|
||||
out.format(" };%n");
|
||||
|
||||
// c2bIndex
|
||||
out.format("%n static final int C2BSIZE = 0x%x;%n",
|
||||
initC2BIndex(indexC2B));
|
||||
out.format("%n static char[] c2bIndex = new char[] {%n");
|
||||
out.format(indexC2B);
|
||||
out.format(" };%n");
|
||||
|
||||
// c2bIndexSupp
|
||||
out.format("%n static final int C2BSUPPSIZE = 0x%x;%n",
|
||||
initC2BIndex(indexC2BSupp));
|
||||
out.format("%n static char[] c2bSuppIndex = new char[] {%n");
|
||||
out.format(indexC2BSupp);
|
||||
out.format(" };%n");
|
||||
|
||||
// suppFlags
|
||||
out.format("%n static String b2cIsSuppStr =%n");
|
||||
out.format(toCharArray(suppFlag, b1Min, b1Max, b2Min, b2Max),
|
||||
";");
|
||||
out.format("}");
|
||||
out.close();
|
||||
|
||||
ps.println(sb.toString());
|
||||
ps.close();
|
||||
} catch (Exception x) {
|
||||
x.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,246 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
import java.util.Formatter;
|
||||
import java.util.regex.*;
|
||||
import java.nio.charset.*;
|
||||
import static build.tools.charsetmapping.CharsetMapping.*;
|
||||
|
||||
public class GenerateEUC_TW {
|
||||
|
||||
public static void genEUC_TW(String args[]) throws Exception {
|
||||
genClass(new FileInputStream(new File(args[0], "euc_tw.map")),
|
||||
new PrintStream(new File(args[1], "EUC_TWMapping.java"), "ISO-8859-1"),
|
||||
getCopyright(new File(args[3])));
|
||||
}
|
||||
|
||||
private static String getCopyright(File f) throws IOException {
|
||||
Scanner s = new Scanner(f, "ISO-8859-1");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (s.hasNextLine()) {
|
||||
String ln = s.nextLine();
|
||||
sb.append(ln + "\n");
|
||||
// assume we have the copyright as the first comment
|
||||
if (ln.matches("^\\s\\*\\/$"))
|
||||
break;
|
||||
}
|
||||
s.close();
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static char[] toCharArray(int[] db,
|
||||
int b1Min, int b1Max,
|
||||
int b2Min, int b2Max)
|
||||
{
|
||||
char[] ca = new char[(b1Max - b1Min + 1) * (b2Max - b2Min + 1)];
|
||||
int off = 0;
|
||||
for (int b1 = b1Min; b1 <= b1Max; b1++) {
|
||||
for (int b2 = b2Min; b2 <= b2Max; b2++) {
|
||||
ca[off++] = (char)(db[b1 * 256 + b2] & 0xffff);
|
||||
}
|
||||
}
|
||||
return ca;
|
||||
}
|
||||
|
||||
private static void toChar(Formatter out, String fmt, char c) {
|
||||
switch (c) {
|
||||
case '\b':
|
||||
out.format("\\b"); break;
|
||||
case '\t':
|
||||
out.format("\\t"); break;
|
||||
case '\n':
|
||||
out.format("\\n"); break;
|
||||
case '\f':
|
||||
out.format("\\f"); break;
|
||||
case '\r':
|
||||
out.format("\\r"); break;
|
||||
case '\"':
|
||||
out.format("\\\""); break;
|
||||
case '\'':
|
||||
out.format("\\'"); break;
|
||||
case '\\':
|
||||
out.format("\\\\"); break;
|
||||
default:
|
||||
out.format(fmt, c & 0xffff);
|
||||
}
|
||||
}
|
||||
|
||||
private static void toString(Formatter out, char[] date, String endStr)
|
||||
{
|
||||
int off = 0;
|
||||
int end = date.length;
|
||||
while (off < end) {
|
||||
out.format(" \"");
|
||||
for (int j = 0; j < 8 && off < end; j++) {
|
||||
toChar(out, "\\u%04X", date[off++]);
|
||||
}
|
||||
if (off == end)
|
||||
out.format("\"%s%n", endStr);
|
||||
else
|
||||
out.format("\" +%n");
|
||||
}
|
||||
}
|
||||
|
||||
private static char[] toCharArray(byte[] ba,
|
||||
int b1Min, int b1Max,
|
||||
int b2Min, int b2Max)
|
||||
{
|
||||
char[] ca = new char[(b1Max - b1Min + 1) * (b2Max - b2Min + 1)];
|
||||
int off = 0;
|
||||
for (int b1 = b1Min; b1 <= b1Max; b1++) {
|
||||
int b2 = b2Min;
|
||||
while (b2 <= b2Max) {
|
||||
ca[off++] = (char)(((ba[b1 * 256 + b2++] & 0xff) << 8) |
|
||||
(ba[b1 * 256 + b2++] & 0xff));
|
||||
}
|
||||
}
|
||||
return ca;
|
||||
}
|
||||
|
||||
private static void toCharArray(Formatter out, char[] date) {
|
||||
int off = 0;
|
||||
int end = date.length;
|
||||
while (off < end) {
|
||||
out.format(" ");
|
||||
for (int j = 0; j < 8 && off < end; j++) {
|
||||
toChar(out, "'\\u%04X',", date[off++]);
|
||||
}
|
||||
out.format("%n");
|
||||
}
|
||||
}
|
||||
|
||||
private static int initC2BIndex(char[] index) {
|
||||
int off = 0;
|
||||
for (int i = 0; i < index.length; i++) {
|
||||
if (index[i] != 0) {
|
||||
index[i] = (char)off;
|
||||
off += 0x100;
|
||||
} else {
|
||||
index[i] = CharsetMapping.UNMAPPABLE_ENCODING;
|
||||
}
|
||||
}
|
||||
return off;
|
||||
}
|
||||
|
||||
private static Pattern euctw = Pattern.compile("(?:8ea)?(\\p{XDigit}++)\\s++(\\p{XDigit}++)?\\s*+.*");
|
||||
|
||||
private static void genClass(InputStream is, PrintStream ps, String copyright)
|
||||
throws Exception
|
||||
{
|
||||
// ranges of byte1 and byte2, something should come from a "config" file
|
||||
int b1Min = 0xa1;
|
||||
int b1Max = 0xfe;
|
||||
int b2Min = 0xa1;
|
||||
int b2Max = 0xfe;
|
||||
|
||||
try {
|
||||
int[][] db = new int[8][0x10000]; // doublebyte
|
||||
byte[] suppFlag = new byte[0x10000]; // doublebyte
|
||||
char[] indexC2B = new char[256];
|
||||
char[] indexC2BSupp = new char[256];
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
for (int j = 0; j < 0x10000; j++)
|
||||
db[i][j] = CharsetMapping.UNMAPPABLE_DECODING;
|
||||
|
||||
CharsetMapping.Parser p = new CharsetMapping.Parser(is, euctw);
|
||||
CharsetMapping.Entry e = null;
|
||||
while ((e = p.next()) != null) {
|
||||
int plane = 0;
|
||||
if (e.bs >= 0x10000) {
|
||||
plane = ((e.bs >> 16) & 0xff) - 1;
|
||||
if (plane >= 14)
|
||||
plane = 7;
|
||||
e.bs = e.bs & 0xffff;
|
||||
}
|
||||
db[plane][e.bs] = e.cp;
|
||||
if (e.cp < 0x10000) {
|
||||
indexC2B[e.cp>>8] = 1;
|
||||
} else {
|
||||
indexC2BSupp[(e.cp&0xffff)>>8] = 1;
|
||||
suppFlag[e.bs] |= (1 << plane);
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder out = new StringBuilder();
|
||||
Formatter fm = new Formatter(out);
|
||||
|
||||
fm.format(copyright);
|
||||
fm.format("%n// -- This file was mechanically generated: Do not edit! -- //%n");
|
||||
fm.format("package sun.nio.cs.ext;%n%n");
|
||||
fm.format("class EUC_TWMapping {%n%n");
|
||||
|
||||
// boundaries
|
||||
fm.format(" final static int b1Min = 0x%x;%n", b1Min);
|
||||
fm.format(" final static int b1Max = 0x%x;%n", b1Max);
|
||||
fm.format(" final static int b2Min = 0x%x;%n", b2Min);
|
||||
fm.format(" final static int b2Max = 0x%x;%n", b2Max);
|
||||
|
||||
// b2c tables
|
||||
fm.format("%n final static String[] b2c = {%n");
|
||||
for (int plane = 0; plane < 8; plane++) {
|
||||
fm.format(" // Plane %d%n", plane);
|
||||
toString(fm, toCharArray(db[plane],
|
||||
b1Min, b1Max, b2Min, b2Max),
|
||||
",");
|
||||
fm.format("%n");
|
||||
}
|
||||
fm.format(" };%n");
|
||||
|
||||
// c2bIndex
|
||||
fm.format("%n static final int C2BSIZE = 0x%x;%n",
|
||||
initC2BIndex(indexC2B));
|
||||
fm.format("%n static char[] c2bIndex = new char[] {%n");
|
||||
toCharArray(fm, indexC2B);
|
||||
fm.format(" };%n");
|
||||
|
||||
// c2bIndexSupp
|
||||
fm.format("%n static final int C2BSUPPSIZE = 0x%x;%n",
|
||||
initC2BIndex(indexC2BSupp));
|
||||
fm.format("%n static char[] c2bSuppIndex = new char[] {%n");
|
||||
toCharArray(fm, indexC2BSupp);
|
||||
fm.format(" };%n");
|
||||
|
||||
// suppFlags
|
||||
fm.format("%n static String b2cIsSuppStr =%n");
|
||||
toString(fm, toCharArray(suppFlag,
|
||||
b1Min, b1Max, b2Min, b2Max),
|
||||
";");
|
||||
|
||||
fm.format("}");
|
||||
fm.close();
|
||||
|
||||
ps.println(out.toString());
|
||||
ps.close();
|
||||
} catch (Exception x) {
|
||||
x.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.regex.*;
|
||||
import static build.tools.charsetmapping.CharsetMapping.*;
|
||||
|
||||
public class GenerateMapping {
|
||||
|
||||
public static void genMapping(String argv[]) throws IOException {
|
||||
genDataJIS0213(new FileInputStream(argv[0]),
|
||||
new FileOutputStream(argv[1]));
|
||||
}
|
||||
|
||||
// regex pattern to parse the "jis0213.map" file
|
||||
static Pattern sjis0213 = Pattern.compile("0x(\\p{XDigit}++)\\s++U\\+(\\p{XDigit}++)(?:\\+(\\p{XDigit}++))?\\s++#.*");
|
||||
private static void genDataJIS0213(InputStream in, OutputStream out)
|
||||
{
|
||||
int[] sb = new int[0x100]; // singlebyte
|
||||
int[] db = new int[0x10000]; // doublebyte
|
||||
int[] indexC2B = new int[256];
|
||||
Entry[] supp = new Entry[0x10000];
|
||||
Entry[] comp = new Entry[0x100];
|
||||
int suppTotal = 0;
|
||||
int compTotal = 0;
|
||||
|
||||
int b1Min1 = 0x81;
|
||||
int b1Max1 = 0x9f;
|
||||
int b1Min2 = 0xe0;
|
||||
int b1Max2 = 0xfc;
|
||||
int b2Min = 0x40;
|
||||
int b2Max = 0xfe;
|
||||
|
||||
//init
|
||||
for (int i = 0; i < 0x80; i++) sb[i] = i;
|
||||
for (int i = 0x80; i < 0x100; i++) sb[i] = UNMAPPABLE_DECODING;
|
||||
for (int i = 0; i < 0x10000; i++) db[i] = UNMAPPABLE_DECODING;
|
||||
try {
|
||||
Parser p = new Parser(in, sjis0213);
|
||||
Entry e = null;
|
||||
while ((e = p.next()) != null) {
|
||||
if (e.cp2 != 0) {
|
||||
comp[compTotal++] = e;
|
||||
} else {
|
||||
if (e.cp <= 0xffff) {
|
||||
if (e.bs <= 0xff)
|
||||
sb[e.bs] = e.cp;
|
||||
else
|
||||
db[e.bs] = e.cp;
|
||||
indexC2B[e.cp>>8] = 1;
|
||||
} else {
|
||||
supp[suppTotal++] = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
// c2b Index Table, always the first one
|
||||
writeINDEXC2B(baos, indexC2B);
|
||||
writeSINGLEBYTE(baos, sb);
|
||||
writeDOUBLEBYTE1(baos, db, b1Min1, b1Max1, b2Min, b2Max);
|
||||
writeDOUBLEBYTE2(baos, db, b1Min2, b1Max2, b2Min, b2Max);
|
||||
writeSUPPLEMENT(baos, supp, suppTotal);
|
||||
writeCOMPOSITE(baos, comp, compTotal);
|
||||
writeSIZE(out, baos.size());
|
||||
baos.writeTo(out);
|
||||
out.close();
|
||||
} catch (Exception x) {
|
||||
x.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
190
jdk/make/tools/src/build/tools/charsetmapping/HKSCS.java
Normal file
190
jdk/make/tools/src/build/tools/charsetmapping/HKSCS.java
Normal file
@ -0,0 +1,190 @@
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
import java.util.Formatter;
|
||||
import java.util.regex.*;
|
||||
import java.nio.charset.*;
|
||||
import static build.tools.charsetmapping.Utils.*;
|
||||
|
||||
public class HKSCS {
|
||||
|
||||
// HKSCS2001.map has the third column for "UnicodeAlternate", which
|
||||
// is for c->b non-roundtrip mapping.
|
||||
// For HKSCS2008, those non-roundtrip mappings are in .nr file
|
||||
private static Pattern hkscs =
|
||||
Pattern.compile("(?:0x)?+(\\p{XDigit}++)\\s++(?:0x|U\\+)?+(\\p{XDigit}++)?\\s*+(?:0x|U\\+)?(\\p{XDigit}++)?\\s*+.*");
|
||||
|
||||
static void genClass(String args[]) throws Exception {
|
||||
|
||||
// hkscs2008
|
||||
genClass0(new FileInputStream(new File(args[0], "HKSCS2008.map")),
|
||||
new FileInputStream(new File(args[0], "HKSCS2008.c2b")),
|
||||
new PrintStream(new File(args[1], "HKSCSMapping.java"),
|
||||
"ISO-8859-1"),
|
||||
"HKSCSMapping",
|
||||
getCopyright(new File(args[3])));
|
||||
|
||||
|
||||
// xp2001
|
||||
genClass0(new FileInputStream(new File(args[0], "HKSCS_XP.map")),
|
||||
null,
|
||||
new PrintStream(new File(args[1], "HKSCS_XPMapping.java"),
|
||||
"ISO-8859-1"),
|
||||
"HKSCS_XPMapping",
|
||||
getCopyright(new File(args[3])));
|
||||
|
||||
// hkscs2001
|
||||
genClass0(new FileInputStream(new File(args[0], "HKSCS2001.map")),
|
||||
new FileInputStream(new File(args[0], "HKSCS2001.c2b")),
|
||||
new PrintStream(new File(args[1], "HKSCS2001Mapping.java"),
|
||||
"ISO-8859-1"),
|
||||
"HKSCS2001Mapping",
|
||||
getCopyright(new File(args[3])));
|
||||
}
|
||||
|
||||
static void genClass0(InputStream isB2C,
|
||||
InputStream isC2B,
|
||||
PrintStream ps,
|
||||
String clzName,
|
||||
String copyright)
|
||||
throws Exception
|
||||
{
|
||||
// ranges of byte1 and byte2, something should come from a "config" file
|
||||
int b1Min = 0x87;
|
||||
int b1Max = 0xfe;
|
||||
int b2Min = 0x40;
|
||||
int b2Max = 0xfe;
|
||||
|
||||
try {
|
||||
char[] bmp = new char[0x10000];
|
||||
char[] supp = new char[0x10000];
|
||||
|
||||
boolean[] b2cBmp = new boolean[0x100];
|
||||
boolean[] b2cSupp = new boolean[0x100];
|
||||
// pua should be in range of e000-f8ff. Expand
|
||||
// it to 0xf93b becase the hkscs2001.c2b has
|
||||
// the f920-f93b filled
|
||||
//char[] pua = new char[0xF8FF - 0xE000 + 1];
|
||||
char[] pua = new char[0xF93b - 0xE000 + 1];
|
||||
boolean hasSupp = false;
|
||||
boolean hasPua = false;
|
||||
|
||||
Arrays.fill(bmp, UNMAPPABLE_DECODING);
|
||||
Arrays.fill(supp, UNMAPPABLE_DECODING);
|
||||
Arrays.fill(pua, UNMAPPABLE_DECODING);
|
||||
|
||||
Parser p = new Parser(isB2C, hkscs);
|
||||
Entry e = null;
|
||||
while ((e = p.next()) != null) {
|
||||
if (e.cp >= 0x10000) {
|
||||
supp[e.bs] = (char)e.cp;
|
||||
b2cSupp[e.bs>>8] = true;
|
||||
hasSupp = true;
|
||||
} else {
|
||||
bmp[e.bs] = (char)e.cp;
|
||||
b2cBmp[e.bs>>8] = true;
|
||||
}
|
||||
if (e.cp2 != 0 && e.cp2 >= 0xe000 && e.cp2 <= 0xf8ff) {
|
||||
hasPua = true;
|
||||
pua[e.cp2 - 0xE000] = (char)e.bs;
|
||||
}
|
||||
}
|
||||
|
||||
if (isC2B != null) {
|
||||
p = new Parser(isC2B, hkscs);
|
||||
e = null;
|
||||
while ((e = p.next()) != null) {
|
||||
pua[e.cp - 0xE000] = (char)e.bs;
|
||||
}
|
||||
hasPua = true;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Output out = new Output(new Formatter(sb));
|
||||
|
||||
out.format(copyright);
|
||||
out.format("%n// -- This file was mechanically generated: Do not edit! -- //%n");
|
||||
out.format("package sun.nio.cs.ext;%n%n");
|
||||
out.format("class %s {%n%n", clzName);
|
||||
|
||||
/* hardcoded in sun.nio.cs.ext.HKSCS.java
|
||||
out.format(" final static int b1Min = 0x%x;%n", b1Min);
|
||||
out.format(" final static int b1Max = 0x%x;%n", b1Max);
|
||||
out.format(" final static int b2Min = 0x%x;%n", b2Min);
|
||||
out.format(" final static int b2Max = 0x%x;%n", b2Max);
|
||||
*/
|
||||
|
||||
// bmp tables
|
||||
out.format("%n static final String[] b2cBmpStr = new String[] {%n");
|
||||
for (int i = 0; i < 0x100; i++) {
|
||||
if (b2cBmp[i])
|
||||
out.format(bmp, i, b2Min, b2Max, ",");
|
||||
else
|
||||
out.format(" null,%n"); //unmappable segments
|
||||
}
|
||||
out.format(" };%n");
|
||||
|
||||
// supp tables
|
||||
out.format("%n static final String[] b2cSuppStr =");
|
||||
if (hasSupp) {
|
||||
out.format(" new String[] {%n");
|
||||
for (int i = 0; i < 0x100; i++) {
|
||||
if (b2cSupp[i])
|
||||
out.format(supp, i, b2Min, b2Max, ",");
|
||||
else
|
||||
out.format(" null,%n"); //unmappable segments
|
||||
}
|
||||
out.format(" };%n");
|
||||
} else {
|
||||
out.format(" null;%n");
|
||||
}
|
||||
|
||||
// private area tables
|
||||
out.format("%n final static String pua =");
|
||||
if (hasPua) {
|
||||
out.format("%n");
|
||||
out.format(pua, 0, pua.length, ";");
|
||||
} else {
|
||||
out.format(" null;%n");
|
||||
}
|
||||
out.format("%n");
|
||||
out.format("}");
|
||||
|
||||
out.close();
|
||||
|
||||
ps.println(sb.toString());
|
||||
ps.close();
|
||||
|
||||
} catch (Exception x) {
|
||||
x.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -25,29 +25,71 @@
|
||||
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.io.*;
|
||||
import java.util.regex.*;
|
||||
import java.util.*;
|
||||
import static build.tools.charsetmapping.Utils.*;
|
||||
|
||||
public class CharsetMapping {
|
||||
public final static char UNMAPPABLE_DECODING = '\uFFFD';
|
||||
public final static int UNMAPPABLE_ENCODING = 0xFFFD;
|
||||
public class JIS0213 {
|
||||
|
||||
public static class Entry {
|
||||
public int bs; //byte sequence reps
|
||||
public int cp; //Unicode codepoint
|
||||
public int cp2; //CC of composite
|
||||
// regex pattern to parse the "jis0213.map" file
|
||||
static Pattern sjis0213 = Pattern.compile("0x(\\p{XDigit}++)\\s++U\\+(\\p{XDigit}++)(?:\\+(\\p{XDigit}++))?\\s++#.*");
|
||||
|
||||
public Entry () {}
|
||||
public Entry (int bytes, int cp, int cp2) {
|
||||
this.bs = bytes;
|
||||
this.cp = cp;
|
||||
this.cp2 = cp2;
|
||||
static void genClass(String argv[]) throws IOException
|
||||
{
|
||||
InputStream in = new FileInputStream(argv[0]) ;
|
||||
OutputStream out = new FileOutputStream(argv[1]);
|
||||
|
||||
int[] sb = new int[0x100]; // singlebyte
|
||||
int[] db = new int[0x10000]; // doublebyte
|
||||
int[] indexC2B = new int[256];
|
||||
Entry[] supp = new Entry[0x10000];
|
||||
Entry[] comp = new Entry[0x100];
|
||||
int suppTotal = 0;
|
||||
int compTotal = 0;
|
||||
|
||||
int b1Min1 = 0x81;
|
||||
int b1Max1 = 0x9f;
|
||||
int b1Min2 = 0xe0;
|
||||
int b1Max2 = 0xfc;
|
||||
int b2Min = 0x40;
|
||||
int b2Max = 0xfe;
|
||||
|
||||
//init
|
||||
for (int i = 0; i < 0x80; i++) sb[i] = i;
|
||||
for (int i = 0x80; i < 0x100; i++) sb[i] = UNMAPPABLE_DECODING;
|
||||
for (int i = 0; i < 0x10000; i++) db[i] = UNMAPPABLE_DECODING;
|
||||
try {
|
||||
Parser p = new Parser(in, sjis0213);
|
||||
Entry e = null;
|
||||
while ((e = p.next()) != null) {
|
||||
if (e.cp2 != 0) {
|
||||
comp[compTotal++] = e;
|
||||
} else {
|
||||
if (e.cp <= 0xffff) {
|
||||
if (e.bs <= 0xff)
|
||||
sb[e.bs] = e.cp;
|
||||
else
|
||||
db[e.bs] = e.cp;
|
||||
indexC2B[e.cp>>8] = 1;
|
||||
} else {
|
||||
supp[suppTotal++] = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
// c2b Index Table, always the first one
|
||||
writeINDEXC2B(baos, indexC2B);
|
||||
writeSINGLEBYTE(baos, sb);
|
||||
writeDOUBLEBYTE1(baos, db, b1Min1, b1Max1, b2Min, b2Max);
|
||||
writeDOUBLEBYTE2(baos, db, b1Min2, b1Max2, b2Min, b2Max);
|
||||
writeSUPPLEMENT(baos, supp, suppTotal);
|
||||
writeCOMPOSITE(baos, comp, compTotal);
|
||||
writeSIZE(out, baos.size());
|
||||
baos.writeTo(out);
|
||||
out.close();
|
||||
} catch (Exception x) {
|
||||
x.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,76 +103,6 @@ public class CharsetMapping {
|
||||
}
|
||||
};
|
||||
|
||||
public static class Parser {
|
||||
static final Pattern basic = Pattern.compile("(?:0x)?(\\p{XDigit}++)\\s++(?:0x)?(\\p{XDigit}++)?\\s*+.*");
|
||||
static final int gBS = 1;
|
||||
static final int gCP = 2;
|
||||
static final int gCP2 = 3;
|
||||
|
||||
BufferedReader reader;
|
||||
boolean closed;
|
||||
Matcher matcher;
|
||||
int gbs, gcp, gcp2;
|
||||
|
||||
public Parser (InputStream in, Pattern p, int gbs, int gcp, int gcp2)
|
||||
throws IOException
|
||||
{
|
||||
this.reader = new BufferedReader(new InputStreamReader(in));
|
||||
this.closed = false;
|
||||
this.matcher = p.matcher("");
|
||||
this.gbs = gbs;
|
||||
this.gcp = gcp;
|
||||
this.gcp2 = gcp2;
|
||||
}
|
||||
|
||||
public Parser (InputStream in, Pattern p) throws IOException {
|
||||
this(in, p, gBS, gCP, gCP2);
|
||||
}
|
||||
|
||||
public Parser (InputStream in) throws IOException {
|
||||
this(in, basic, gBS, gCP, gCP2);
|
||||
}
|
||||
|
||||
protected boolean isDirective(String line) {
|
||||
return line.startsWith("#");
|
||||
}
|
||||
|
||||
protected Entry parse(Matcher matcher, Entry mapping) {
|
||||
mapping.bs = Integer.parseInt(matcher.group(gbs), 16);
|
||||
mapping.cp = Integer.parseInt(matcher.group(gcp), 16);
|
||||
if (gcp2 <= matcher.groupCount() &&
|
||||
matcher.group(gcp2) != null)
|
||||
mapping.cp2 = Integer.parseInt(matcher.group(gcp2), 16);
|
||||
else
|
||||
mapping.cp2 = 0;
|
||||
return mapping;
|
||||
}
|
||||
|
||||
public Entry next() throws Exception {
|
||||
return next(new Entry());
|
||||
}
|
||||
|
||||
// returns null and closes the input stream if the eof has beenreached.
|
||||
public Entry next(Entry mapping) throws Exception {
|
||||
if (closed)
|
||||
return null;
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if (isDirective(line))
|
||||
continue;
|
||||
matcher.reset(line);
|
||||
if (!matcher.lookingAt()) {
|
||||
//System.out.println("Missed: " + line);
|
||||
continue;
|
||||
}
|
||||
return parse(matcher, mapping);
|
||||
}
|
||||
reader.close();
|
||||
closed = true;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// tags of different charset mapping tables
|
||||
private final static int MAP_SINGLEBYTE = 0x1; // 0..256 : c
|
||||
private final static int MAP_DOUBLEBYTE1 = 0x2; // min..max: c
|
||||
@ -161,7 +133,7 @@ public class CharsetMapping {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void writeSIZE(OutputStream out, int data)
|
||||
private static final void writeSIZE(OutputStream out, int data)
|
||||
throws IOException
|
||||
{
|
||||
out.write((data >>> 24) & 0xFF);
|
||||
@ -170,7 +142,7 @@ public class CharsetMapping {
|
||||
out.write((data ) & 0xFF);
|
||||
}
|
||||
|
||||
public static void writeINDEXC2B(OutputStream out, int[] indexC2B)
|
||||
private static void writeINDEXC2B(OutputStream out, int[] indexC2B)
|
||||
throws IOException
|
||||
{
|
||||
writeShort(out, MAP_INDEXC2B);
|
||||
@ -186,7 +158,7 @@ public class CharsetMapping {
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeSINGLEBYTE(OutputStream out, int[] sb)
|
||||
private static void writeSINGLEBYTE(OutputStream out, int[] sb)
|
||||
throws IOException
|
||||
{
|
||||
writeShortArray(out, MAP_SINGLEBYTE, sb, 0, 256);
|
||||
@ -212,7 +184,8 @@ public class CharsetMapping {
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void writeDOUBLEBYTE1(OutputStream out,
|
||||
|
||||
private static void writeDOUBLEBYTE1(OutputStream out,
|
||||
int[] db,
|
||||
int b1Min, int b1Max,
|
||||
int b2Min, int b2Max)
|
||||
@ -221,7 +194,7 @@ public class CharsetMapping {
|
||||
writeDOUBLEBYTE(out, MAP_DOUBLEBYTE1, db, b1Min, b1Max, b2Min, b2Max);
|
||||
}
|
||||
|
||||
public static void writeDOUBLEBYTE2(OutputStream out,
|
||||
private static void writeDOUBLEBYTE2(OutputStream out,
|
||||
int[] db,
|
||||
int b1Min, int b1Max,
|
||||
int b2Min, int b2Max)
|
||||
@ -231,7 +204,7 @@ public class CharsetMapping {
|
||||
}
|
||||
|
||||
// the c2b table is output as well
|
||||
public static void writeSUPPLEMENT(OutputStream out, Entry[] supp, int size)
|
||||
private static void writeSUPPLEMENT(OutputStream out, Entry[] supp, int size)
|
||||
throws IOException
|
||||
{
|
||||
writeShort(out, MAP_SUPPLEMENT);
|
||||
@ -256,7 +229,7 @@ public class CharsetMapping {
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeCOMPOSITE(OutputStream out, Entry[] comp, int size)
|
||||
private static void writeCOMPOSITE(OutputStream out, Entry[] comp, int size)
|
||||
throws IOException
|
||||
{
|
||||
writeShort(out, MAP_COMPOSITE);
|
@ -32,23 +32,19 @@ public class Main {
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
if (args.length < 3 ) {
|
||||
System.out.println("Usage: java -jar charsetmapping.jar src dst mType...");
|
||||
System.out.println("Usage: java -jar charsetmapping.jar src dst mType [copyrightSrc]");
|
||||
System.exit(1);
|
||||
}
|
||||
if ("sbcs".equals(args[2]) || "extsbcs".equals(args[2])) {
|
||||
GenerateSBCS.genSBCS(args);
|
||||
SBCS.genClass(args);
|
||||
} else if ("dbcs".equals(args[2])) {
|
||||
GenerateDBCS.genDBCS(args);
|
||||
|
||||
DBCS.genClass(args);
|
||||
} else if ("euctw".equals(args[2])) {
|
||||
if (args.length != 4) {
|
||||
System.out.println("Usage: java -jar charsetmapping.jar srcDir dstDir euctw copyrightSrc");
|
||||
System.exit(1);
|
||||
}
|
||||
GenerateEUC_TW.genEUC_TW(args);
|
||||
EUC_TW.genClass(args);
|
||||
} else if ("sjis0213".equals(args[2])) {
|
||||
GenerateMapping.genMapping(args);
|
||||
JIS0213.genClass(args);
|
||||
} else if ("hkscs".equals(args[2])) {
|
||||
HKSCS.genClass(args);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,11 +32,11 @@ import java.util.Scanner;
|
||||
import java.util.Formatter;
|
||||
import java.util.regex.*;
|
||||
import java.nio.charset.*;
|
||||
import static build.tools.charsetmapping.CharsetMapping.*;
|
||||
import static build.tools.charsetmapping.Utils.*;
|
||||
|
||||
public class GenerateSBCS {
|
||||
public class SBCS {
|
||||
|
||||
public static void genSBCS(String args[]) throws Exception {
|
||||
public static void genClass(String args[]) throws Exception {
|
||||
|
||||
Scanner s = new Scanner(new File(args[0], args[2]));
|
||||
while (s.hasNextLine()) {
|
||||
@ -55,8 +55,8 @@ public class GenerateSBCS {
|
||||
String pkgName = fields[4];
|
||||
System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
|
||||
|
||||
genClass(args[0], args[1], "SingleByte-X.java.template",
|
||||
clzName, csName, hisName, pkgName, isASCII);
|
||||
genClass0(args[0], args[1], "SingleByte-X.java.template",
|
||||
clzName, csName, hisName, pkgName, isASCII);
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,13 +108,13 @@ public class GenerateSBCS {
|
||||
|
||||
static Pattern sbmap = Pattern.compile("0x(\\p{XDigit}++)\\s++U\\+(\\p{XDigit}++)(\\s++#.*)?");
|
||||
|
||||
private static void genClass(String srcDir, String dstDir,
|
||||
String template,
|
||||
String clzName,
|
||||
String csName,
|
||||
String hisName,
|
||||
String pkgName,
|
||||
boolean isASCII)
|
||||
private static void genClass0(String srcDir, String dstDir,
|
||||
String template,
|
||||
String clzName,
|
||||
String csName,
|
||||
String hisName,
|
||||
String pkgName,
|
||||
boolean isASCII)
|
||||
throws Exception
|
||||
{
|
||||
StringBuilder b2cSB = new StringBuilder();
|
221
jdk/make/tools/src/build/tools/charsetmapping/Utils.java
Normal file
221
jdk/make/tools/src/build/tools/charsetmapping/Utils.java
Normal file
@ -0,0 +1,221 @@
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.Scanner;
|
||||
import java.util.Formatter;
|
||||
|
||||
public class Utils {
|
||||
|
||||
public final static char UNMAPPABLE_DECODING = '\uFFFD';
|
||||
public final static int UNMAPPABLE_ENCODING = 0xFFFD;
|
||||
|
||||
public static class Entry {
|
||||
public int bs; //byte sequence reps
|
||||
public int cp; //Unicode codepoint
|
||||
public int cp2; //CC of composite
|
||||
|
||||
public Entry () {}
|
||||
public Entry (int bytes, int cp, int cp2) {
|
||||
this.bs = bytes;
|
||||
this.cp = cp;
|
||||
this.cp2 = cp2;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Parser {
|
||||
static final Pattern basic = Pattern.compile("(?:0x)?(\\p{XDigit}++)\\s++(?:0x)?(\\p{XDigit}++)?\\s*+.*");
|
||||
static final int gBS = 1;
|
||||
static final int gCP = 2;
|
||||
static final int gCP2 = 3;
|
||||
|
||||
BufferedReader reader;
|
||||
boolean closed;
|
||||
Matcher matcher;
|
||||
int gbs, gcp, gcp2;
|
||||
|
||||
public Parser (InputStream in, Pattern p, int gbs, int gcp, int gcp2)
|
||||
throws IOException
|
||||
{
|
||||
this.reader = new BufferedReader(new InputStreamReader(in));
|
||||
this.closed = false;
|
||||
this.matcher = p.matcher("");
|
||||
this.gbs = gbs;
|
||||
this.gcp = gcp;
|
||||
this.gcp2 = gcp2;
|
||||
}
|
||||
|
||||
public Parser (InputStream in, Pattern p) throws IOException {
|
||||
this(in, p, gBS, gCP, gCP2);
|
||||
}
|
||||
|
||||
public Parser (InputStream in) throws IOException {
|
||||
this(in, basic, gBS, gCP, gCP2);
|
||||
}
|
||||
|
||||
protected boolean isDirective(String line) {
|
||||
return line.startsWith("#");
|
||||
}
|
||||
|
||||
protected Entry parse(Matcher matcher, Entry mapping) {
|
||||
mapping.bs = Integer.parseInt(matcher.group(gbs), 16);
|
||||
mapping.cp = Integer.parseInt(matcher.group(gcp), 16);
|
||||
if (gcp2 <= matcher.groupCount() &&
|
||||
matcher.group(gcp2) != null)
|
||||
mapping.cp2 = Integer.parseInt(matcher.group(gcp2), 16);
|
||||
else
|
||||
mapping.cp2 = 0;
|
||||
return mapping;
|
||||
}
|
||||
|
||||
public Entry next() throws Exception {
|
||||
return next(new Entry());
|
||||
}
|
||||
|
||||
// returns null and closes the input stream if the eof has beenreached.
|
||||
public Entry next(Entry mapping) throws Exception {
|
||||
if (closed)
|
||||
return null;
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if (isDirective(line))
|
||||
continue;
|
||||
matcher.reset(line);
|
||||
if (!matcher.lookingAt()) {
|
||||
//System.out.println("Missed: " + line);
|
||||
continue;
|
||||
}
|
||||
return parse(matcher, mapping);
|
||||
}
|
||||
reader.close();
|
||||
closed = true;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Output {
|
||||
private Formatter out;
|
||||
|
||||
public Output(Formatter out) {
|
||||
this.out = out;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
out.close();
|
||||
}
|
||||
|
||||
private void toChar(String fmt, char c) {
|
||||
switch (c) {
|
||||
case '\b':
|
||||
out.format("\\b"); break;
|
||||
case '\t':
|
||||
out.format("\\t"); break;
|
||||
case '\n':
|
||||
out.format("\\n"); break;
|
||||
case '\f':
|
||||
out.format("\\f"); break;
|
||||
case '\r':
|
||||
out.format("\\r"); break;
|
||||
case '\"':
|
||||
out.format("\\\""); break;
|
||||
case '\'':
|
||||
out.format("\\'"); break;
|
||||
case '\\':
|
||||
out.format("\\\\"); break;
|
||||
default:
|
||||
out.format(fmt, c & 0xffff);
|
||||
}
|
||||
}
|
||||
|
||||
public void format(String fmt, Object ... args) {
|
||||
out.format(fmt, args);
|
||||
}
|
||||
|
||||
public void format(char[] cc, int off, int end, String closure) {
|
||||
while (off < end) {
|
||||
out.format(" \"");
|
||||
for (int j = 0; j < 8; j++) {
|
||||
if (off == end)
|
||||
break;
|
||||
toChar("\\u%04X", cc[off++]);
|
||||
}
|
||||
if (off == end)
|
||||
out.format("\" %s%n", closure);
|
||||
else
|
||||
out.format("\" + %n");
|
||||
}
|
||||
}
|
||||
|
||||
public void format(char[] cc, String closure) {
|
||||
format(cc, 0, cc.length, closure);
|
||||
}
|
||||
|
||||
public void format(char[] db, int b1, int b2Min, int b2Max,
|
||||
String closure)
|
||||
{
|
||||
char[] cc = new char[b2Max - b2Min + 1];
|
||||
int off = 0;
|
||||
for (int b2 = b2Min; b2 <= b2Max; b2++) {
|
||||
cc[off++] = db[(b1 << 8) | b2];
|
||||
}
|
||||
format(cc, 0, cc.length, closure);
|
||||
}
|
||||
|
||||
public void format(char[] date) {
|
||||
int off = 0;
|
||||
int end = date.length;
|
||||
while (off < end) {
|
||||
out.format(" ");
|
||||
for (int j = 0; j < 8 && off < end; j++) {
|
||||
toChar("'\\u%04X',", date[off++]);
|
||||
}
|
||||
out.format("%n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static String getCopyright(File f) throws IOException {
|
||||
Scanner s = new Scanner(f, "ISO-8859-1");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (s.hasNextLine()) {
|
||||
String ln = s.nextLine();
|
||||
sb.append(ln + "\n");
|
||||
// assume we have the copyright as the first comment
|
||||
if (ln.matches("^\\s\\*\\/$"))
|
||||
break;
|
||||
}
|
||||
s.close();
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -139,7 +139,7 @@ class RuleDay {
|
||||
if (isLast()) {
|
||||
return -1;
|
||||
}
|
||||
return getDay();
|
||||
return isEarlier() ? -getDay() : getDay();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,13 +147,10 @@ class RuleDay {
|
||||
* @return the SimpleTimeZone day-of-week rule value
|
||||
*/
|
||||
int getDayOfWeekForSimpleTimeZoneInt() {
|
||||
if (!isLater() && !isEarlier() && !isLast()) {
|
||||
return 0;
|
||||
}
|
||||
if (isLater()) {
|
||||
if (isEarlier() || isLater()) {
|
||||
return -getDayOfWeekNum();
|
||||
}
|
||||
return getDayOfWeekNum();
|
||||
return isLast() ? getDayOfWeekNum() : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,7 +32,6 @@ import java.security.AccessControlContext;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import java.util.EventObject;
|
||||
import sun.reflect.misc.MethodUtil;
|
||||
|
||||
/**
|
||||
@ -279,9 +278,9 @@ import sun.reflect.misc.MethodUtil;
|
||||
public class EventHandler implements InvocationHandler {
|
||||
private Object target;
|
||||
private String action;
|
||||
private String eventPropertyName;
|
||||
private String listenerMethodName;
|
||||
private AccessControlContext acc;
|
||||
private final String eventPropertyName;
|
||||
private final String listenerMethodName;
|
||||
private final AccessControlContext acc = AccessController.getContext();
|
||||
|
||||
/**
|
||||
* Creates a new <code>EventHandler</code> object;
|
||||
@ -310,7 +309,6 @@ public class EventHandler implements InvocationHandler {
|
||||
*/
|
||||
@ConstructorProperties({"target", "action", "eventPropertyName", "listenerMethodName"})
|
||||
public EventHandler(Object target, String action, String eventPropertyName, String listenerMethodName) {
|
||||
this.acc = AccessController.getContext();
|
||||
this.target = target;
|
||||
this.action = action;
|
||||
if (target == null) {
|
||||
@ -422,7 +420,11 @@ public class EventHandler implements InvocationHandler {
|
||||
* @see EventHandler
|
||||
*/
|
||||
public Object invoke(final Object proxy, final Method method, final Object[] arguments) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction() {
|
||||
AccessControlContext acc = this.acc;
|
||||
if ((acc == null) && (System.getSecurityManager() != null)) {
|
||||
throw new SecurityException("AccessControlContext is not set");
|
||||
}
|
||||
return AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
return invokeInternal(proxy, method, arguments);
|
||||
}
|
||||
@ -482,7 +484,10 @@ public class EventHandler implements InvocationHandler {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
catch (InvocationTargetException ex) {
|
||||
throw new RuntimeException(ex.getTargetException());
|
||||
Throwable th = ex.getTargetException();
|
||||
throw (th instanceof RuntimeException)
|
||||
? (RuntimeException) th
|
||||
: new RuntimeException(th);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -98,6 +98,29 @@ public class Expression extends Statement {
|
||||
setValue(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <p>
|
||||
* If the invoked method completes normally,
|
||||
* the value it returns is copied in the {@code value} property.
|
||||
* Note that the {@code value} property is set to {@code null},
|
||||
* if the return type of the underlying method is {@code void}.
|
||||
*
|
||||
* @throws NullPointerException if the value of the {@code target} or
|
||||
* {@code methodName} property is {@code null}
|
||||
* @throws NoSuchMethodException if a matching method is not found
|
||||
* @throws SecurityException if a security manager exists and
|
||||
* it denies the method invocation
|
||||
* @throws Exception that is thrown by the invoked method
|
||||
*
|
||||
* @see java.lang.reflect.Method
|
||||
* @since 1.7
|
||||
*/
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
setValue(invoke());
|
||||
}
|
||||
|
||||
/**
|
||||
* If the value property of this instance is not already set,
|
||||
* this method dynamically finds the method with the specified
|
||||
|
@ -29,6 +29,10 @@ import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.security.AccessControlContext;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
|
||||
import com.sun.beans.finder.ClassFinder;
|
||||
import com.sun.beans.finder.ConstructorFinder;
|
||||
@ -63,9 +67,10 @@ public class Statement {
|
||||
}
|
||||
};
|
||||
|
||||
Object target;
|
||||
String methodName;
|
||||
Object[] arguments;
|
||||
private final AccessControlContext acc = AccessController.getContext();
|
||||
private final Object target;
|
||||
private final String methodName;
|
||||
private final Object[] arguments;
|
||||
ClassLoader loader;
|
||||
|
||||
/**
|
||||
@ -127,8 +132,8 @@ public class Statement {
|
||||
}
|
||||
|
||||
/**
|
||||
* The execute method finds a method whose name is the same
|
||||
* as the methodName property, and invokes the method on
|
||||
* The {@code execute} method finds a method whose name is the same
|
||||
* as the {@code methodName} property, and invokes the method on
|
||||
* the target.
|
||||
*
|
||||
* When the target's class defines many methods with the given name
|
||||
@ -136,7 +141,7 @@ public class Statement {
|
||||
* the algorithm specified in the Java Language Specification
|
||||
* (15.11). The dynamic class of the target and arguments are used
|
||||
* in place of the compile-time type information and, like the
|
||||
* <code>java.lang.reflect.Method</code> class itself, conversion between
|
||||
* {@link java.lang.reflect.Method} class itself, conversion between
|
||||
* primitive values and their associated wrapper classes is handled
|
||||
* internally.
|
||||
* <p>
|
||||
@ -147,19 +152,48 @@ public class Statement {
|
||||
* <li>
|
||||
* The reserved method name "new" may be used to call a class's constructor
|
||||
* as if all classes defined static "new" methods. Constructor invocations
|
||||
* are typically considered <code>Expression</code>s rather than <code>Statement</code>s
|
||||
* are typically considered {@code Expression}s rather than {@code Statement}s
|
||||
* as they return a value.
|
||||
* <li>
|
||||
* The method names "get" and "set" defined in the <code>java.util.List</code>
|
||||
* The method names "get" and "set" defined in the {@link java.util.List}
|
||||
* interface may also be applied to array instances, mapping to
|
||||
* the static methods of the same name in the <code>Array</code> class.
|
||||
* the static methods of the same name in the {@code Array} class.
|
||||
* </ul>
|
||||
*
|
||||
* @throws NullPointerException if the value of the {@code target} or
|
||||
* {@code methodName} property is {@code null}
|
||||
* @throws NoSuchMethodException if a matching method is not found
|
||||
* @throws SecurityException if a security manager exists and
|
||||
* it denies the method invocation
|
||||
* @throws Exception that is thrown by the invoked method
|
||||
*
|
||||
* @see java.lang.reflect.Method
|
||||
*/
|
||||
public void execute() throws Exception {
|
||||
invoke();
|
||||
}
|
||||
|
||||
Object invoke() throws Exception {
|
||||
AccessControlContext acc = this.acc;
|
||||
if ((acc == null) && (System.getSecurityManager() != null)) {
|
||||
throw new SecurityException("AccessControlContext is not set");
|
||||
}
|
||||
try {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction<Object>() {
|
||||
public Object run() throws Exception {
|
||||
return invokeInternal();
|
||||
}
|
||||
},
|
||||
acc
|
||||
);
|
||||
}
|
||||
catch (PrivilegedActionException exception) {
|
||||
throw exception.getException();
|
||||
}
|
||||
}
|
||||
|
||||
private Object invokeInternal() throws Exception {
|
||||
Object target = getTarget();
|
||||
String methodName = getMethodName();
|
||||
|
||||
|
@ -2064,11 +2064,12 @@ public class File
|
||||
private synchronized void readObject(java.io.ObjectInputStream s)
|
||||
throws IOException, ClassNotFoundException
|
||||
{
|
||||
s.defaultReadObject();
|
||||
ObjectInputStream.GetField fields = s.readFields();
|
||||
String pathField = (String)fields.get("path", null);
|
||||
char sep = s.readChar(); // read the previous separator char
|
||||
if (sep != separatorChar)
|
||||
this.path = this.path.replace(sep, separatorChar);
|
||||
this.path = fs.normalize(this.path);
|
||||
pathField = pathField.replace(sep, separatorChar);
|
||||
this.path = fs.normalize(pathField);
|
||||
this.prefixLength = fs.prefixLength(this.path);
|
||||
}
|
||||
|
||||
|
@ -134,9 +134,18 @@ class FilterInputStream extends InputStream {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* Skips over and discards <code>n</code> bytes of data from the
|
||||
* input stream. The <code>skip</code> method may, for a variety of
|
||||
* reasons, end up skipping over some smaller number of bytes,
|
||||
* possibly <code>0</code>. The actual number of bytes skipped is
|
||||
* returned.
|
||||
* <p>
|
||||
* This method simply performs <code>in.skip(n)</code>.
|
||||
*
|
||||
* @param n the number of bytes to be skipped.
|
||||
* @return the actual number of bytes skipped.
|
||||
* @exception IOException if the stream does not support seek,
|
||||
* or if some other I/O error occurs.
|
||||
*/
|
||||
public long skip(long n) throws IOException {
|
||||
return in.skip(n);
|
||||
|
@ -994,6 +994,8 @@ public final class ProcessBuilder
|
||||
// Must convert to array first -- a malicious user-supplied
|
||||
// list might try to circumvent the security check.
|
||||
String[] cmdarray = command.toArray(new String[command.size()]);
|
||||
cmdarray = cmdarray.clone();
|
||||
|
||||
for (String arg : cmdarray)
|
||||
if (arg == null)
|
||||
throw new NullPointerException();
|
||||
|
@ -55,7 +55,7 @@ import sun.misc.VM;
|
||||
*/
|
||||
public
|
||||
class ThreadGroup implements Thread.UncaughtExceptionHandler {
|
||||
ThreadGroup parent;
|
||||
private final ThreadGroup parent;
|
||||
String name;
|
||||
int maxPriority;
|
||||
boolean destroyed;
|
||||
@ -76,6 +76,7 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler {
|
||||
private ThreadGroup() { // called from C code
|
||||
this.name = "system";
|
||||
this.maxPriority = Thread.MAX_PRIORITY;
|
||||
this.parent = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -113,10 +114,10 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler {
|
||||
* @since JDK1.0
|
||||
*/
|
||||
public ThreadGroup(ThreadGroup parent, String name) {
|
||||
if (parent == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
parent.checkAccess();
|
||||
this(checkParentAccess(parent), parent, name);
|
||||
}
|
||||
|
||||
private ThreadGroup(Void unused, ThreadGroup parent, String name) {
|
||||
this.name = name;
|
||||
this.maxPriority = parent.maxPriority;
|
||||
this.daemon = parent.daemon;
|
||||
@ -125,6 +126,16 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler {
|
||||
parent.add(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* @throws NullPointerException if the parent argument is {@code null}
|
||||
* @throws SecurityException if the current thread cannot create a
|
||||
* thread in the specified thread group.
|
||||
*/
|
||||
private static Void checkParentAccess(ThreadGroup parent) {
|
||||
parent.checkAccess();
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of this thread group.
|
||||
*
|
||||
|
@ -118,6 +118,7 @@ class DatagramSocket implements java.io.Closeable {
|
||||
if (address == null) {
|
||||
throw new IllegalArgumentException("connect: null address");
|
||||
}
|
||||
checkAddress (address, "connect");
|
||||
if (isClosed())
|
||||
return;
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
@ -363,13 +364,15 @@ class DatagramSocket implements java.io.Closeable {
|
||||
InetSocketAddress epoint = (InetSocketAddress) addr;
|
||||
if (epoint.isUnresolved())
|
||||
throw new SocketException("Unresolved address");
|
||||
InetAddress iaddr = epoint.getAddress();
|
||||
int port = epoint.getPort();
|
||||
checkAddress(iaddr, "bind");
|
||||
SecurityManager sec = System.getSecurityManager();
|
||||
if (sec != null) {
|
||||
sec.checkListen(epoint.getPort());
|
||||
sec.checkListen(port);
|
||||
}
|
||||
try {
|
||||
getImpl().bind(epoint.getPort(),
|
||||
epoint.getAddress());
|
||||
getImpl().bind(port, iaddr);
|
||||
} catch (SocketException e) {
|
||||
getImpl().close();
|
||||
throw e;
|
||||
@ -377,6 +380,15 @@ class DatagramSocket implements java.io.Closeable {
|
||||
bound = true;
|
||||
}
|
||||
|
||||
void checkAddress (InetAddress addr, String op) {
|
||||
if (addr == null) {
|
||||
return;
|
||||
}
|
||||
if (!(addr instanceof Inet4Address || addr instanceof Inet6Address)) {
|
||||
throw new IllegalArgumentException(op + ": invalid address type");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Connects the socket to a remote address for this socket. When a
|
||||
* socket is connected to a remote address, packets may only be
|
||||
@ -603,6 +615,7 @@ class DatagramSocket implements java.io.Closeable {
|
||||
synchronized (p) {
|
||||
if (isClosed())
|
||||
throw new SocketException("Socket is closed");
|
||||
checkAddress (p.getAddress(), "send");
|
||||
if (connectState == ST_NOT_CONNECTED) {
|
||||
// check the address is ok wiht the security manager on every send.
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
|
@ -35,6 +35,7 @@ import java.util.ArrayList;
|
||||
import java.security.AccessController;
|
||||
import java.io.ObjectStreamException;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import sun.security.action.*;
|
||||
import sun.net.InetAddressCachePolicy;
|
||||
import sun.net.util.IPAddressUtil;
|
||||
@ -1472,6 +1473,23 @@ class InetAddress implements java.io.Serializable {
|
||||
|
||||
return impl;
|
||||
}
|
||||
|
||||
private void readObjectNoData (ObjectInputStream s) throws
|
||||
IOException, ClassNotFoundException {
|
||||
if (getClass().getClassLoader() != null) {
|
||||
throw new SecurityException ("invalid address type");
|
||||
}
|
||||
}
|
||||
|
||||
private void readObject (ObjectInputStream s) throws
|
||||
IOException, ClassNotFoundException {
|
||||
s.defaultReadObject ();
|
||||
if (getClass().getClassLoader() != null) {
|
||||
hostName = null;
|
||||
address = 0;
|
||||
throw new SecurityException ("invalid address type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -289,6 +289,7 @@ class MulticastSocket extends DatagramSocket {
|
||||
throw new SocketException("Socket is closed");
|
||||
}
|
||||
|
||||
checkAddress(mcastaddr, "joinGroup");
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkMulticast(mcastaddr);
|
||||
@ -323,6 +324,7 @@ class MulticastSocket extends DatagramSocket {
|
||||
throw new SocketException("Socket is closed");
|
||||
}
|
||||
|
||||
checkAddress(mcastaddr, "leaveGroup");
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkMulticast(mcastaddr);
|
||||
@ -370,6 +372,7 @@ class MulticastSocket extends DatagramSocket {
|
||||
if (oldImpl)
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
checkAddress(((InetSocketAddress)mcastaddr).getAddress(), "joinGroup");
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkMulticast(((InetSocketAddress)mcastaddr).getAddress());
|
||||
@ -416,6 +419,7 @@ class MulticastSocket extends DatagramSocket {
|
||||
if (oldImpl)
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
checkAddress(((InetSocketAddress)mcastaddr).getAddress(), "leaveGroup");
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkMulticast(((InetSocketAddress)mcastaddr).getAddress());
|
||||
@ -441,6 +445,7 @@ class MulticastSocket extends DatagramSocket {
|
||||
if (isClosed()) {
|
||||
throw new SocketException("Socket is closed");
|
||||
}
|
||||
checkAddress(inf, "setInterface");
|
||||
synchronized (infLock) {
|
||||
getImpl().setOption(SocketOptions.IP_MULTICAST_IF, inf);
|
||||
infAddress = inf;
|
||||
@ -632,6 +637,7 @@ class MulticastSocket extends DatagramSocket {
|
||||
throws IOException {
|
||||
if (isClosed())
|
||||
throw new SocketException("Socket is closed");
|
||||
checkAddress(p.getAddress(), "send");
|
||||
synchronized(ttlLock) {
|
||||
synchronized(p) {
|
||||
if (connectState == ST_NOT_CONNECTED) {
|
||||
|
@ -290,8 +290,12 @@ public final class NetworkInterface {
|
||||
* If the specified address is <tt>null</tt>.
|
||||
*/
|
||||
public static NetworkInterface getByInetAddress(InetAddress addr) throws SocketException {
|
||||
if (addr == null)
|
||||
if (addr == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (!(addr instanceof Inet4Address || addr instanceof Inet6Address)) {
|
||||
throw new IllegalArgumentException ("invalid address type");
|
||||
}
|
||||
return getByInetAddress0(addr);
|
||||
}
|
||||
|
||||
|
@ -122,6 +122,9 @@ class Socket implements java.io.Closeable {
|
||||
if (p.type() == Proxy.Type.SOCKS) {
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
InetSocketAddress epoint = (InetSocketAddress) p.address();
|
||||
if (epoint.getAddress() != null) {
|
||||
checkAddress (epoint.getAddress(), "Socket");
|
||||
}
|
||||
if (security != null) {
|
||||
if (epoint.isUnresolved())
|
||||
security.checkConnect(epoint.getHostName(),
|
||||
@ -558,15 +561,16 @@ class Socket implements java.io.Closeable {
|
||||
throw new IllegalArgumentException("Unsupported address type");
|
||||
|
||||
InetSocketAddress epoint = (InetSocketAddress) endpoint;
|
||||
InetAddress addr = epoint.getAddress ();
|
||||
int port = epoint.getPort();
|
||||
checkAddress(addr, "connect");
|
||||
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
if (epoint.isUnresolved())
|
||||
security.checkConnect(epoint.getHostName(),
|
||||
epoint.getPort());
|
||||
security.checkConnect(epoint.getHostName(), port);
|
||||
else
|
||||
security.checkConnect(epoint.getAddress().getHostAddress(),
|
||||
epoint.getPort());
|
||||
security.checkConnect(addr.getHostAddress(), port);
|
||||
}
|
||||
if (!created)
|
||||
createImpl(true);
|
||||
@ -574,10 +578,9 @@ class Socket implements java.io.Closeable {
|
||||
impl.connect(epoint, timeout);
|
||||
else if (timeout == 0) {
|
||||
if (epoint.isUnresolved())
|
||||
impl.connect(epoint.getAddress().getHostName(),
|
||||
epoint.getPort());
|
||||
impl.connect(addr.getHostName(), port);
|
||||
else
|
||||
impl.connect(epoint.getAddress(), epoint.getPort());
|
||||
impl.connect(addr, port);
|
||||
} else
|
||||
throw new UnsupportedOperationException("SocketImpl.connect(addr, timeout)");
|
||||
connected = true;
|
||||
@ -614,14 +617,25 @@ class Socket implements java.io.Closeable {
|
||||
InetSocketAddress epoint = (InetSocketAddress) bindpoint;
|
||||
if (epoint != null && epoint.isUnresolved())
|
||||
throw new SocketException("Unresolved address");
|
||||
if (bindpoint == null)
|
||||
getImpl().bind(InetAddress.anyLocalAddress(), 0);
|
||||
else
|
||||
getImpl().bind(epoint.getAddress(),
|
||||
epoint.getPort());
|
||||
if (epoint == null) {
|
||||
epoint = new InetSocketAddress(0);
|
||||
}
|
||||
InetAddress addr = epoint.getAddress();
|
||||
int port = epoint.getPort();
|
||||
checkAddress (addr, "bind");
|
||||
getImpl().bind (addr, port);
|
||||
bound = true;
|
||||
}
|
||||
|
||||
private void checkAddress (InetAddress addr, String op) {
|
||||
if (addr == null) {
|
||||
return;
|
||||
}
|
||||
if (!(addr instanceof Inet4Address || addr instanceof Inet6Address)) {
|
||||
throw new IllegalArgumentException(op + ": invalid address type");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* set the flags after an accept() call.
|
||||
*/
|
||||
|
@ -118,6 +118,10 @@ class SocketInputStream extends FileInputStream
|
||||
* @exception IOException If an I/O error has occurred.
|
||||
*/
|
||||
public int read(byte b[], int off, int length) throws IOException {
|
||||
return read(b, off, length, impl.getTimeout());
|
||||
}
|
||||
|
||||
int read(byte b[], int off, int length, int timeout) throws IOException {
|
||||
int n;
|
||||
|
||||
// EOF already encountered
|
||||
@ -143,7 +147,7 @@ class SocketInputStream extends FileInputStream
|
||||
// acquire file descriptor and do the read
|
||||
FileDescriptor fd = impl.acquireFD();
|
||||
try {
|
||||
n = socketRead0(fd, b, off, length, impl.getTimeout());
|
||||
n = socketRead0(fd, b, off, length, timeout);
|
||||
if (n > 0) {
|
||||
return n;
|
||||
}
|
||||
@ -161,7 +165,7 @@ class SocketInputStream extends FileInputStream
|
||||
impl.setConnectionResetPending();
|
||||
impl.acquireFD();
|
||||
try {
|
||||
n = socketRead0(fd, b, off, length, impl.getTimeout());
|
||||
n = socketRead0(fd, b, off, length, timeout);
|
||||
if (n > 0) {
|
||||
return n;
|
||||
}
|
||||
|
@ -98,11 +98,31 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
||||
super.connect(new InetSocketAddress(host, port), timeout);
|
||||
}
|
||||
|
||||
private static int remainingMillis(long deadlineMillis) throws IOException {
|
||||
if (deadlineMillis == 0L)
|
||||
return 0;
|
||||
|
||||
final long remaining = deadlineMillis - System.currentTimeMillis();
|
||||
if (remaining > 0)
|
||||
return (int) remaining;
|
||||
|
||||
throw new SocketTimeoutException();
|
||||
}
|
||||
|
||||
private int readSocksReply(InputStream in, byte[] data) throws IOException {
|
||||
return readSocksReply(in, data, 0L);
|
||||
}
|
||||
|
||||
private int readSocksReply(InputStream in, byte[] data, long deadlineMillis) throws IOException {
|
||||
int len = data.length;
|
||||
int received = 0;
|
||||
for (int attempts = 0; received < len && attempts < 3; attempts++) {
|
||||
int count = in.read(data, received, len - received);
|
||||
int count;
|
||||
try {
|
||||
count = ((SocketInputStream)in).read(data, received, len - received, remainingMillis(deadlineMillis));
|
||||
} catch (SocketTimeoutException e) {
|
||||
throw new SocketTimeoutException("Connect timed out");
|
||||
}
|
||||
if (count < 0)
|
||||
throw new SocketException("Malformed reply from SOCKS server");
|
||||
received += count;
|
||||
@ -115,6 +135,12 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
||||
*/
|
||||
private boolean authenticate(byte method, InputStream in,
|
||||
BufferedOutputStream out) throws IOException {
|
||||
return authenticate(method, in, out, 0L);
|
||||
}
|
||||
|
||||
private boolean authenticate(byte method, InputStream in,
|
||||
BufferedOutputStream out,
|
||||
long deadlineMillis) throws IOException {
|
||||
// No Authentication required. We're done then!
|
||||
if (method == NO_AUTH)
|
||||
return true;
|
||||
@ -162,7 +188,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
||||
out.write(0);
|
||||
out.flush();
|
||||
byte[] data = new byte[2];
|
||||
int i = readSocksReply(in, data);
|
||||
int i = readSocksReply(in, data, deadlineMillis);
|
||||
if (i != 2 || data[1] != 0) {
|
||||
/* RFC 1929 specifies that the connection MUST be closed if
|
||||
authentication fails */
|
||||
@ -201,18 +227,18 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
||||
// out.write(outToken);
|
||||
// out.flush();
|
||||
// data = new byte[2];
|
||||
// i = readSocksReply(in, data);
|
||||
// i = readSocksReply(in, data, deadlineMillis);
|
||||
// if (i != 2 || data[1] == 0xff) {
|
||||
// in.close();
|
||||
// out.close();
|
||||
// return false;
|
||||
// }
|
||||
// i = readSocksReply(in, data);
|
||||
// i = readSocksReply(in, data, deadlineMillis);
|
||||
// int len = 0;
|
||||
// len = ((int)data[0] & 0xff) << 8;
|
||||
// len += data[1];
|
||||
// data = new byte[len];
|
||||
// i = readSocksReply(in, data);
|
||||
// i = readSocksReply(in, data, deadlineMillis);
|
||||
// if (i == len)
|
||||
// return true;
|
||||
// in.close();
|
||||
@ -231,7 +257,8 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
||||
}
|
||||
|
||||
private void connectV4(InputStream in, OutputStream out,
|
||||
InetSocketAddress endpoint) throws IOException {
|
||||
InetSocketAddress endpoint,
|
||||
long deadlineMillis) throws IOException {
|
||||
if (!(endpoint.getAddress() instanceof Inet4Address)) {
|
||||
throw new SocketException("SOCKS V4 requires IPv4 only addresses");
|
||||
}
|
||||
@ -249,7 +276,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
||||
out.write(0);
|
||||
out.flush();
|
||||
byte[] data = new byte[8];
|
||||
int n = readSocksReply(in, data);
|
||||
int n = readSocksReply(in, data, deadlineMillis);
|
||||
if (n != 8)
|
||||
throw new SocketException("Reply from SOCKS server has bad length: " + n);
|
||||
if (data[0] != 0 && data[0] != 4)
|
||||
@ -296,6 +323,15 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
||||
*/
|
||||
@Override
|
||||
protected void connect(SocketAddress endpoint, int timeout) throws IOException {
|
||||
final long deadlineMillis;
|
||||
|
||||
if (timeout == 0) {
|
||||
deadlineMillis = 0L;
|
||||
} else {
|
||||
long finish = System.currentTimeMillis() + timeout;
|
||||
deadlineMillis = finish < 0 ? Long.MAX_VALUE : finish;
|
||||
}
|
||||
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (endpoint == null || !(endpoint instanceof InetSocketAddress))
|
||||
throw new IllegalArgumentException("Unsupported address type");
|
||||
@ -322,7 +358,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
||||
/*
|
||||
* No default proxySelector --> direct connection
|
||||
*/
|
||||
super.connect(epoint, timeout);
|
||||
super.connect(epoint, remainingMillis(deadlineMillis));
|
||||
return;
|
||||
}
|
||||
URI uri;
|
||||
@ -345,13 +381,13 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
||||
java.util.Iterator<Proxy> iProxy = null;
|
||||
iProxy = sel.select(uri).iterator();
|
||||
if (iProxy == null || !(iProxy.hasNext())) {
|
||||
super.connect(epoint, timeout);
|
||||
super.connect(epoint, remainingMillis(deadlineMillis));
|
||||
return;
|
||||
}
|
||||
while (iProxy.hasNext()) {
|
||||
p = iProxy.next();
|
||||
if (p == null || p == Proxy.NO_PROXY) {
|
||||
super.connect(epoint, timeout);
|
||||
super.connect(epoint, remainingMillis(deadlineMillis));
|
||||
return;
|
||||
}
|
||||
if (p.type() != Proxy.Type.SOCKS)
|
||||
@ -364,7 +400,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
||||
|
||||
// Connects to the SOCKS server
|
||||
try {
|
||||
privilegedConnect(server, serverPort, timeout);
|
||||
privilegedConnect(server, serverPort, remainingMillis(deadlineMillis));
|
||||
// Worked, let's get outta here
|
||||
break;
|
||||
} catch (IOException e) {
|
||||
@ -388,7 +424,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
||||
} else {
|
||||
// Connects to the SOCKS server
|
||||
try {
|
||||
privilegedConnect(server, serverPort, timeout);
|
||||
privilegedConnect(server, serverPort, remainingMillis(deadlineMillis));
|
||||
} catch (IOException e) {
|
||||
throw new SocketException(e.getMessage());
|
||||
}
|
||||
@ -403,7 +439,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
||||
// DOMAIN type of addresses (unresolved addresses here)
|
||||
if (epoint.isUnresolved())
|
||||
throw new UnknownHostException(epoint.toString());
|
||||
connectV4(in, out, epoint);
|
||||
connectV4(in, out, epoint, deadlineMillis);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -414,7 +450,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
||||
out.write(USER_PASSW);
|
||||
out.flush();
|
||||
byte[] data = new byte[2];
|
||||
int i = readSocksReply(in, data);
|
||||
int i = readSocksReply(in, data, deadlineMillis);
|
||||
if (i != 2 || ((int)data[0]) != PROTO_VERS) {
|
||||
// Maybe it's not a V5 sever after all
|
||||
// Let's try V4 before we give up
|
||||
@ -422,12 +458,12 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
||||
// DOMAIN type of addresses (unresolved addresses here)
|
||||
if (epoint.isUnresolved())
|
||||
throw new UnknownHostException(epoint.toString());
|
||||
connectV4(in, out, epoint);
|
||||
connectV4(in, out, epoint, deadlineMillis);
|
||||
return;
|
||||
}
|
||||
if (((int)data[1]) == NO_METHODS)
|
||||
throw new SocketException("SOCKS : No acceptable methods");
|
||||
if (!authenticate(data[1], in, out)) {
|
||||
if (!authenticate(data[1], in, out, deadlineMillis)) {
|
||||
throw new SocketException("SOCKS : authentication failed");
|
||||
}
|
||||
out.write(PROTO_VERS);
|
||||
@ -457,7 +493,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
||||
}
|
||||
out.flush();
|
||||
data = new byte[4];
|
||||
i = readSocksReply(in, data);
|
||||
i = readSocksReply(in, data, deadlineMillis);
|
||||
if (i != 4)
|
||||
throw new SocketException("Reply from SOCKS server has bad length");
|
||||
SocketException ex = null;
|
||||
@ -469,33 +505,33 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
||||
switch(data[3]) {
|
||||
case IPV4:
|
||||
addr = new byte[4];
|
||||
i = readSocksReply(in, addr);
|
||||
i = readSocksReply(in, addr, deadlineMillis);
|
||||
if (i != 4)
|
||||
throw new SocketException("Reply from SOCKS server badly formatted");
|
||||
data = new byte[2];
|
||||
i = readSocksReply(in, data);
|
||||
i = readSocksReply(in, data, deadlineMillis);
|
||||
if (i != 2)
|
||||
throw new SocketException("Reply from SOCKS server badly formatted");
|
||||
break;
|
||||
case DOMAIN_NAME:
|
||||
len = data[1];
|
||||
byte[] host = new byte[len];
|
||||
i = readSocksReply(in, host);
|
||||
i = readSocksReply(in, host, deadlineMillis);
|
||||
if (i != len)
|
||||
throw new SocketException("Reply from SOCKS server badly formatted");
|
||||
data = new byte[2];
|
||||
i = readSocksReply(in, data);
|
||||
i = readSocksReply(in, data, deadlineMillis);
|
||||
if (i != 2)
|
||||
throw new SocketException("Reply from SOCKS server badly formatted");
|
||||
break;
|
||||
case IPV6:
|
||||
len = data[1];
|
||||
addr = new byte[len];
|
||||
i = readSocksReply(in, addr);
|
||||
i = readSocksReply(in, addr, deadlineMillis);
|
||||
if (i != len)
|
||||
throw new SocketException("Reply from SOCKS server badly formatted");
|
||||
data = new byte[2];
|
||||
i = readSocksReply(in, data);
|
||||
i = readSocksReply(in, data, deadlineMillis);
|
||||
if (i != 2)
|
||||
throw new SocketException("Reply from SOCKS server badly formatted");
|
||||
break;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -28,19 +28,17 @@ package java.security;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.RuntimePermission;
|
||||
import java.lang.reflect.*;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.PropertyPermission;
|
||||
|
||||
import java.lang.reflect.*;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Vector;
|
||||
import java.util.WeakHashMap;
|
||||
import sun.security.util.Debug;
|
||||
import sun.security.jca.GetInstance;
|
||||
import sun.security.util.Debug;
|
||||
import sun.security.util.SecurityConstants;
|
||||
|
||||
|
||||
@ -113,8 +111,8 @@ public abstract class Policy {
|
||||
|
||||
private static final Debug debug = Debug.getInstance("policy");
|
||||
|
||||
// Cache mapping ProtectionDomain to PermissionCollection
|
||||
private WeakHashMap<ProtectionDomain, PermissionCollection> pdMapping;
|
||||
// Cache mapping ProtectionDomain.Key to PermissionCollection
|
||||
private WeakHashMap<ProtectionDomain.Key, PermissionCollection> pdMapping;
|
||||
|
||||
/** package private for AccessControlContext */
|
||||
static boolean isSet()
|
||||
@ -307,7 +305,7 @@ public abstract class Policy {
|
||||
synchronized (p) {
|
||||
if (p.pdMapping == null) {
|
||||
p.pdMapping =
|
||||
new WeakHashMap<ProtectionDomain, PermissionCollection>();
|
||||
new WeakHashMap<ProtectionDomain.Key, PermissionCollection>();
|
||||
}
|
||||
}
|
||||
|
||||
@ -323,7 +321,7 @@ public abstract class Policy {
|
||||
|
||||
synchronized (p.pdMapping) {
|
||||
// cache of pd to permissions
|
||||
p.pdMapping.put(policyDomain, policyPerms);
|
||||
p.pdMapping.put(policyDomain.key, policyPerms);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@ -638,7 +636,7 @@ public abstract class Policy {
|
||||
}
|
||||
|
||||
synchronized (pdMapping) {
|
||||
pc = pdMapping.get(domain);
|
||||
pc = pdMapping.get(domain.key);
|
||||
}
|
||||
|
||||
if (pc != null) {
|
||||
@ -697,7 +695,7 @@ public abstract class Policy {
|
||||
}
|
||||
|
||||
synchronized (pdMapping) {
|
||||
pc = pdMapping.get(domain);
|
||||
pc = pdMapping.get(domain.key);
|
||||
}
|
||||
|
||||
if (pc != null) {
|
||||
@ -711,7 +709,7 @@ public abstract class Policy {
|
||||
|
||||
synchronized (pdMapping) {
|
||||
// cache it
|
||||
pdMapping.put(domain, pc);
|
||||
pdMapping.put(domain.key, pc);
|
||||
}
|
||||
|
||||
return pc.implies(permission);
|
||||
@ -747,21 +745,25 @@ public abstract class Policy {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public String getType() { return type; }
|
||||
@Override public String getType() { return type; }
|
||||
|
||||
public Policy.Parameters getParameters() { return params; }
|
||||
@Override public Policy.Parameters getParameters() { return params; }
|
||||
|
||||
public Provider getProvider() { return p; }
|
||||
@Override public Provider getProvider() { return p; }
|
||||
|
||||
@Override
|
||||
public PermissionCollection getPermissions(CodeSource codesource) {
|
||||
return spi.engineGetPermissions(codesource);
|
||||
}
|
||||
@Override
|
||||
public PermissionCollection getPermissions(ProtectionDomain domain) {
|
||||
return spi.engineGetPermissions(domain);
|
||||
}
|
||||
@Override
|
||||
public boolean implies(ProtectionDomain domain, Permission perm) {
|
||||
return spi.engineImplies(domain, perm);
|
||||
}
|
||||
@Override
|
||||
public void refresh() {
|
||||
spi.engineRefresh();
|
||||
}
|
||||
@ -803,7 +805,7 @@ public abstract class Policy {
|
||||
* @exception SecurityException - if this PermissionCollection object
|
||||
* has been marked readonly
|
||||
*/
|
||||
public void add(Permission permission) {
|
||||
@Override public void add(Permission permission) {
|
||||
perms.add(permission);
|
||||
}
|
||||
|
||||
@ -816,7 +818,7 @@ public abstract class Policy {
|
||||
* @return true if "permission" is implied by the permissions in
|
||||
* the collection, false if not.
|
||||
*/
|
||||
public boolean implies(Permission permission) {
|
||||
@Override public boolean implies(Permission permission) {
|
||||
return perms.implies(permission);
|
||||
}
|
||||
|
||||
@ -826,7 +828,7 @@ public abstract class Policy {
|
||||
*
|
||||
* @return an enumeration of all the Permissions.
|
||||
*/
|
||||
public Enumeration<Permission> elements() {
|
||||
@Override public Enumeration<Permission> elements() {
|
||||
return perms.elements();
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,9 +25,15 @@
|
||||
|
||||
package java.security;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
import sun.misc.JavaSecurityProtectionDomainAccess;
|
||||
import static sun.misc.JavaSecurityProtectionDomainAccess.ProtectionDomainCache;
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.security.util.Debug;
|
||||
import sun.security.util.SecurityConstants;
|
||||
|
||||
@ -72,6 +78,11 @@ public class ProtectionDomain {
|
||||
or dynamic (via a policy refresh) */
|
||||
private boolean staticPermissions;
|
||||
|
||||
/*
|
||||
* An object used as a key when the ProtectionDomain is stored in a Map.
|
||||
*/
|
||||
final Key key = new Key();
|
||||
|
||||
private static final Debug debug = Debug.getInstance("domain");
|
||||
|
||||
/**
|
||||
@ -238,7 +249,7 @@ public class ProtectionDomain {
|
||||
/**
|
||||
* Convert a ProtectionDomain to a String.
|
||||
*/
|
||||
public String toString() {
|
||||
@Override public String toString() {
|
||||
String pals = "<no principals>";
|
||||
if (principals != null && principals.length > 0) {
|
||||
StringBuilder palBuf = new StringBuilder("(principals ");
|
||||
@ -396,4 +407,29 @@ public class ProtectionDomain {
|
||||
|
||||
return mergedPerms;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for storing ProtectionDomains as keys in a Map.
|
||||
*/
|
||||
final class Key {}
|
||||
|
||||
static {
|
||||
SharedSecrets.setJavaSecurityProtectionDomainAccess(
|
||||
new JavaSecurityProtectionDomainAccess() {
|
||||
public ProtectionDomainCache getProtectionDomainCache() {
|
||||
return new ProtectionDomainCache() {
|
||||
private final Map<Key, PermissionCollection> map =
|
||||
Collections.synchronizedMap
|
||||
(new WeakHashMap<Key, PermissionCollection>());
|
||||
public void put(ProtectionDomain pd,
|
||||
PermissionCollection pc) {
|
||||
map.put((pd == null ? null : pd.key), pc);
|
||||
}
|
||||
public PermissionCollection get(ProtectionDomain pd) {
|
||||
return pd == null ? map.get(null) : map.get(pd.key);
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -191,8 +191,11 @@ public class Semaphore implements java.io.Serializable {
|
||||
|
||||
protected final boolean tryReleaseShared(int releases) {
|
||||
for (;;) {
|
||||
int p = getState();
|
||||
if (compareAndSetState(p, p + releases))
|
||||
int current = getState();
|
||||
int next = current + releases;
|
||||
if (next < current) // overflow
|
||||
throw new Error("Maximum permit count exceeded");
|
||||
if (compareAndSetState(current, next))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -201,6 +204,8 @@ public class Semaphore implements java.io.Serializable {
|
||||
for (;;) {
|
||||
int current = getState();
|
||||
int next = current - reductions;
|
||||
if (next > current) // underflow
|
||||
throw new Error("Permit count underflow");
|
||||
if (compareAndSetState(current, next))
|
||||
return;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class AtomicIntegerArray implements java.io.Serializable {
|
||||
private long rawIndex(int i) {
|
||||
if (i < 0 || i >= array.length)
|
||||
throw new IndexOutOfBoundsException("index " + i);
|
||||
return base + i * scale;
|
||||
return base + (long) i * scale;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,7 +56,7 @@ public class AtomicLongArray implements java.io.Serializable {
|
||||
private long rawIndex(int i) {
|
||||
if (i < 0 || i >= array.length)
|
||||
throw new IndexOutOfBoundsException("index " + i);
|
||||
return base + i * scale;
|
||||
return base + (long) i * scale;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,7 +57,7 @@ public class AtomicReferenceArray<E> implements java.io.Serializable {
|
||||
private long rawIndex(int i) {
|
||||
if (i < 0 || i >= array.length)
|
||||
throw new IndexOutOfBoundsException("index " + i);
|
||||
return base + i * scale;
|
||||
return base + (long) i * scale;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1996-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -72,7 +72,8 @@ package java.util.zip;
|
||||
*/
|
||||
public
|
||||
class Deflater {
|
||||
private long strm;
|
||||
|
||||
private final ZStreamRef zsRef;
|
||||
private byte[] buf = new byte[0];
|
||||
private int off, len;
|
||||
private int level, strategy;
|
||||
@ -165,7 +166,7 @@ class Deflater {
|
||||
public Deflater(int level, boolean nowrap) {
|
||||
this.level = level;
|
||||
this.strategy = DEFAULT_STRATEGY;
|
||||
strm = init(level, DEFAULT_STRATEGY, nowrap);
|
||||
this.zsRef = new ZStreamRef(init(level, DEFAULT_STRATEGY, nowrap));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -193,16 +194,18 @@ class Deflater {
|
||||
* @param len the length of the data
|
||||
* @see Deflater#needsInput
|
||||
*/
|
||||
public synchronized void setInput(byte[] b, int off, int len) {
|
||||
public void setInput(byte[] b, int off, int len) {
|
||||
if (b== null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (off < 0 || len < 0 || off > b.length - len) {
|
||||
throw new ArrayIndexOutOfBoundsException();
|
||||
}
|
||||
this.buf = b;
|
||||
this.off = off;
|
||||
this.len = len;
|
||||
synchronized (zsRef) {
|
||||
this.buf = b;
|
||||
this.off = off;
|
||||
this.len = len;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -227,14 +230,17 @@ class Deflater {
|
||||
* @see Inflater#inflate
|
||||
* @see Inflater#getAdler
|
||||
*/
|
||||
public synchronized void setDictionary(byte[] b, int off, int len) {
|
||||
if (strm == 0 || b == null) {
|
||||
public void setDictionary(byte[] b, int off, int len) {
|
||||
if (b == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (off < 0 || len < 0 || off > b.length - len) {
|
||||
throw new ArrayIndexOutOfBoundsException();
|
||||
}
|
||||
setDictionary(strm, b, off, len);
|
||||
synchronized (zsRef) {
|
||||
ensureOpen();
|
||||
setDictionary(zsRef.address(), b, off, len);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -257,7 +263,7 @@ class Deflater {
|
||||
* @exception IllegalArgumentException if the compression strategy is
|
||||
* invalid
|
||||
*/
|
||||
public synchronized void setStrategy(int strategy) {
|
||||
public void setStrategy(int strategy) {
|
||||
switch (strategy) {
|
||||
case DEFAULT_STRATEGY:
|
||||
case FILTERED:
|
||||
@ -266,9 +272,11 @@ class Deflater {
|
||||
default:
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (this.strategy != strategy) {
|
||||
this.strategy = strategy;
|
||||
setParams = true;
|
||||
synchronized (zsRef) {
|
||||
if (this.strategy != strategy) {
|
||||
this.strategy = strategy;
|
||||
setParams = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -277,13 +285,15 @@ class Deflater {
|
||||
* @param level the new compression level (0-9)
|
||||
* @exception IllegalArgumentException if the compression level is invalid
|
||||
*/
|
||||
public synchronized void setLevel(int level) {
|
||||
public void setLevel(int level) {
|
||||
if ((level < 0 || level > 9) && level != DEFAULT_COMPRESSION) {
|
||||
throw new IllegalArgumentException("invalid compression level");
|
||||
}
|
||||
if (this.level != level) {
|
||||
this.level = level;
|
||||
setParams = true;
|
||||
synchronized (zsRef) {
|
||||
if (this.level != level) {
|
||||
this.level = level;
|
||||
setParams = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -301,8 +311,10 @@ class Deflater {
|
||||
* When called, indicates that compression should end with the current
|
||||
* contents of the input buffer.
|
||||
*/
|
||||
public synchronized void finish() {
|
||||
finish = true;
|
||||
public void finish() {
|
||||
synchronized (zsRef) {
|
||||
finish = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -311,8 +323,10 @@ class Deflater {
|
||||
* @return true if the end of the compressed data output stream has
|
||||
* been reached
|
||||
*/
|
||||
public synchronized boolean finished() {
|
||||
return finished;
|
||||
public boolean finished() {
|
||||
synchronized (zsRef) {
|
||||
return finished;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -399,26 +413,31 @@ class Deflater {
|
||||
* @throws IllegalArgumentException if the flush mode is invalid
|
||||
* @since 1.7
|
||||
*/
|
||||
public synchronized int deflate(byte[] b, int off, int len, int flush) {
|
||||
public int deflate(byte[] b, int off, int len, int flush) {
|
||||
if (b == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (off < 0 || len < 0 || off > b.length - len) {
|
||||
throw new ArrayIndexOutOfBoundsException();
|
||||
}
|
||||
if (flush == NO_FLUSH || flush == SYNC_FLUSH ||
|
||||
flush == FULL_FLUSH)
|
||||
return deflateBytes(b, off, len, flush);
|
||||
throw new IllegalArgumentException();
|
||||
synchronized (zsRef) {
|
||||
ensureOpen();
|
||||
if (flush == NO_FLUSH || flush == SYNC_FLUSH ||
|
||||
flush == FULL_FLUSH)
|
||||
return deflateBytes(zsRef.address(), b, off, len, flush);
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ADLER-32 value of the uncompressed data.
|
||||
* @return the ADLER-32 value of the uncompressed data
|
||||
*/
|
||||
public synchronized int getAdler() {
|
||||
ensureOpen();
|
||||
return getAdler(strm);
|
||||
public int getAdler() {
|
||||
synchronized (zsRef) {
|
||||
ensureOpen();
|
||||
return getAdler(zsRef.address());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -440,9 +459,11 @@ class Deflater {
|
||||
* @return the total (non-negative) number of uncompressed bytes input so far
|
||||
* @since 1.5
|
||||
*/
|
||||
public synchronized long getBytesRead() {
|
||||
ensureOpen();
|
||||
return getBytesRead(strm);
|
||||
public long getBytesRead() {
|
||||
synchronized (zsRef) {
|
||||
ensureOpen();
|
||||
return getBytesRead(zsRef.address());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -464,21 +485,25 @@ class Deflater {
|
||||
* @return the total (non-negative) number of compressed bytes output so far
|
||||
* @since 1.5
|
||||
*/
|
||||
public synchronized long getBytesWritten() {
|
||||
ensureOpen();
|
||||
return getBytesWritten(strm);
|
||||
public long getBytesWritten() {
|
||||
synchronized (zsRef) {
|
||||
ensureOpen();
|
||||
return getBytesWritten(zsRef.address());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets deflater so that a new set of input data can be processed.
|
||||
* Keeps current compression level and strategy settings.
|
||||
*/
|
||||
public synchronized void reset() {
|
||||
ensureOpen();
|
||||
reset(strm);
|
||||
finish = false;
|
||||
finished = false;
|
||||
off = len = 0;
|
||||
public void reset() {
|
||||
synchronized (zsRef) {
|
||||
ensureOpen();
|
||||
reset(zsRef.address());
|
||||
finish = false;
|
||||
finished = false;
|
||||
off = len = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -488,11 +513,14 @@ class Deflater {
|
||||
* finalize() method. Once this method is called, the behavior
|
||||
* of the Deflater object is undefined.
|
||||
*/
|
||||
public synchronized void end() {
|
||||
if (strm != 0) {
|
||||
end(strm);
|
||||
strm = 0;
|
||||
buf = null;
|
||||
public void end() {
|
||||
synchronized (zsRef) {
|
||||
long addr = zsRef.address();
|
||||
zsRef.clear();
|
||||
if (addr != 0) {
|
||||
end(addr);
|
||||
buf = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -504,18 +532,19 @@ class Deflater {
|
||||
}
|
||||
|
||||
private void ensureOpen() {
|
||||
if (strm == 0)
|
||||
throw new NullPointerException();
|
||||
assert Thread.holdsLock(zsRef);
|
||||
if (zsRef.address() == 0)
|
||||
throw new NullPointerException("Deflater has been closed");
|
||||
}
|
||||
|
||||
private static native void initIDs();
|
||||
private native static long init(int level, int strategy, boolean nowrap);
|
||||
private native static void setDictionary(long strm, byte[] b, int off,
|
||||
int len);
|
||||
private native int deflateBytes(byte[] b, int off, int len, int flush);
|
||||
private native static int getAdler(long strm);
|
||||
private native static long getBytesRead(long strm);
|
||||
private native static long getBytesWritten(long strm);
|
||||
private native static void reset(long strm);
|
||||
private native static void end(long strm);
|
||||
private native static void setDictionary(long addr, byte[] b, int off, int len);
|
||||
private native int deflateBytes(long addr, byte[] b, int off, int len,
|
||||
int flush);
|
||||
private native static int getAdler(long addr);
|
||||
private native static long getBytesRead(long addr);
|
||||
private native static long getBytesWritten(long addr);
|
||||
private native static void reset(long addr);
|
||||
private native static void end(long addr);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1996-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -72,7 +72,8 @@ package java.util.zip;
|
||||
*/
|
||||
public
|
||||
class Inflater {
|
||||
private long strm;
|
||||
|
||||
private final ZStreamRef zsRef;
|
||||
private byte[] buf = defaultBuf;
|
||||
private int off, len;
|
||||
private boolean finished;
|
||||
@ -97,7 +98,7 @@ class Inflater {
|
||||
* @param nowrap if true then support GZIP compatible compression
|
||||
*/
|
||||
public Inflater(boolean nowrap) {
|
||||
strm = init(nowrap);
|
||||
zsRef = new ZStreamRef(init(nowrap));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -116,16 +117,18 @@ class Inflater {
|
||||
* @param len the length of the input data
|
||||
* @see Inflater#needsInput
|
||||
*/
|
||||
public synchronized void setInput(byte[] b, int off, int len) {
|
||||
public void setInput(byte[] b, int off, int len) {
|
||||
if (b == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (off < 0 || len < 0 || off > b.length - len) {
|
||||
throw new ArrayIndexOutOfBoundsException();
|
||||
}
|
||||
this.buf = b;
|
||||
this.off = off;
|
||||
this.len = len;
|
||||
synchronized (zsRef) {
|
||||
this.buf = b;
|
||||
this.off = off;
|
||||
this.len = len;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,15 +153,18 @@ class Inflater {
|
||||
* @see Inflater#needsDictionary
|
||||
* @see Inflater#getAdler
|
||||
*/
|
||||
public synchronized void setDictionary(byte[] b, int off, int len) {
|
||||
if (strm == 0 || b == null) {
|
||||
public void setDictionary(byte[] b, int off, int len) {
|
||||
if (b == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (off < 0 || len < 0 || off > b.length - len) {
|
||||
throw new ArrayIndexOutOfBoundsException();
|
||||
}
|
||||
setDictionary(strm, b, off, len);
|
||||
needDict = false;
|
||||
synchronized (zsRef) {
|
||||
ensureOpen();
|
||||
setDictionary(zsRef.address(), b, off, len);
|
||||
needDict = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -180,8 +186,10 @@ class Inflater {
|
||||
* buffer after decompression has finished.
|
||||
* @return the total number of bytes remaining in the input buffer
|
||||
*/
|
||||
public synchronized int getRemaining() {
|
||||
return len;
|
||||
public int getRemaining() {
|
||||
synchronized (zsRef) {
|
||||
return len;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -190,8 +198,10 @@ class Inflater {
|
||||
* to provide more input.
|
||||
* @return true if no data remains in the input buffer
|
||||
*/
|
||||
public synchronized boolean needsInput() {
|
||||
return len <= 0;
|
||||
public boolean needsInput() {
|
||||
synchronized (zsRef) {
|
||||
return len <= 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -199,8 +209,10 @@ class Inflater {
|
||||
* @return true if a preset dictionary is needed for decompression
|
||||
* @see Inflater#setDictionary
|
||||
*/
|
||||
public synchronized boolean needsDictionary() {
|
||||
return needDict;
|
||||
public boolean needsDictionary() {
|
||||
synchronized (zsRef) {
|
||||
return needDict;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -209,8 +221,10 @@ class Inflater {
|
||||
* @return true if the end of the compressed data stream has been
|
||||
* reached
|
||||
*/
|
||||
public synchronized boolean finished() {
|
||||
return finished;
|
||||
public boolean finished() {
|
||||
synchronized (zsRef) {
|
||||
return finished;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -228,7 +242,7 @@ class Inflater {
|
||||
* @see Inflater#needsInput
|
||||
* @see Inflater#needsDictionary
|
||||
*/
|
||||
public synchronized int inflate(byte[] b, int off, int len)
|
||||
public int inflate(byte[] b, int off, int len)
|
||||
throws DataFormatException
|
||||
{
|
||||
if (b == null) {
|
||||
@ -237,7 +251,10 @@ class Inflater {
|
||||
if (off < 0 || len < 0 || off > b.length - len) {
|
||||
throw new ArrayIndexOutOfBoundsException();
|
||||
}
|
||||
return inflateBytes(b, off, len);
|
||||
synchronized (zsRef) {
|
||||
ensureOpen();
|
||||
return inflateBytes(zsRef.address(), b, off, len);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -261,9 +278,11 @@ class Inflater {
|
||||
* Returns the ADLER-32 value of the uncompressed data.
|
||||
* @return the ADLER-32 value of the uncompressed data
|
||||
*/
|
||||
public synchronized int getAdler() {
|
||||
ensureOpen();
|
||||
return getAdler(strm);
|
||||
public int getAdler() {
|
||||
synchronized (zsRef) {
|
||||
ensureOpen();
|
||||
return getAdler(zsRef.address());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -285,9 +304,11 @@ class Inflater {
|
||||
* @return the total (non-negative) number of compressed bytes input so far
|
||||
* @since 1.5
|
||||
*/
|
||||
public synchronized long getBytesRead() {
|
||||
ensureOpen();
|
||||
return getBytesRead(strm);
|
||||
public long getBytesRead() {
|
||||
synchronized (zsRef) {
|
||||
ensureOpen();
|
||||
return getBytesRead(zsRef.address());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -309,21 +330,25 @@ class Inflater {
|
||||
* @return the total (non-negative) number of uncompressed bytes output so far
|
||||
* @since 1.5
|
||||
*/
|
||||
public synchronized long getBytesWritten() {
|
||||
ensureOpen();
|
||||
return getBytesWritten(strm);
|
||||
public long getBytesWritten() {
|
||||
synchronized (zsRef) {
|
||||
ensureOpen();
|
||||
return getBytesWritten(zsRef.address());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets inflater so that a new set of input data can be processed.
|
||||
*/
|
||||
public synchronized void reset() {
|
||||
ensureOpen();
|
||||
reset(strm);
|
||||
buf = defaultBuf;
|
||||
finished = false;
|
||||
needDict = false;
|
||||
off = len = 0;
|
||||
public void reset() {
|
||||
synchronized (zsRef) {
|
||||
ensureOpen();
|
||||
reset(zsRef.address());
|
||||
buf = defaultBuf;
|
||||
finished = false;
|
||||
needDict = false;
|
||||
off = len = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -333,11 +358,14 @@ class Inflater {
|
||||
* method. Once this method is called, the behavior of the Inflater
|
||||
* object is undefined.
|
||||
*/
|
||||
public synchronized void end() {
|
||||
if (strm != 0) {
|
||||
end(strm);
|
||||
strm = 0;
|
||||
buf = null;
|
||||
public void end() {
|
||||
synchronized (zsRef) {
|
||||
long addr = zsRef.address();
|
||||
zsRef.clear();
|
||||
if (addr != 0) {
|
||||
end(addr);
|
||||
buf = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -349,19 +377,20 @@ class Inflater {
|
||||
}
|
||||
|
||||
private void ensureOpen () {
|
||||
if (strm == 0)
|
||||
throw new NullPointerException();
|
||||
assert Thread.holdsLock(zsRef);
|
||||
if (zsRef.address() == 0)
|
||||
throw new NullPointerException("Inflater has been closed");
|
||||
}
|
||||
|
||||
private native static void initIDs();
|
||||
private native static long init(boolean nowrap);
|
||||
private native static void setDictionary(long strm, byte[] b, int off,
|
||||
private native static void setDictionary(long addr, byte[] b, int off,
|
||||
int len);
|
||||
private native int inflateBytes(byte[] b, int off, int len)
|
||||
private native int inflateBytes(long addr, byte[] b, int off, int len)
|
||||
throws DataFormatException;
|
||||
private native static int getAdler(long strm);
|
||||
private native static long getBytesRead(long strm);
|
||||
private native static long getBytesWritten(long strm);
|
||||
private native static void reset(long strm);
|
||||
private native static void end(long strm);
|
||||
private native static int getAdler(long addr);
|
||||
private native static long getBytesRead(long addr);
|
||||
private native static long getBytesWritten(long addr);
|
||||
private native static void reset(long addr);
|
||||
private native static void end(long addr);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,26 +23,24 @@
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.HKSCS;
|
||||
package java.util.zip;
|
||||
|
||||
/**
|
||||
* Tables and data to convert Unicode to HKSCS
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
* A reference to the native zlib's z_stream structure.
|
||||
*/
|
||||
|
||||
public class CharToByteHKSCS extends CharToByteDoubleByte {
|
||||
class ZStreamRef {
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "HKSCS";
|
||||
private long address;
|
||||
ZStreamRef (long address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public CharToByteHKSCS() {
|
||||
super.index1 = HKSCS.getEncoderIndex1();
|
||||
super.index2 = HKSCS.getEncoderIndex2();
|
||||
long address() {
|
||||
return address;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
address = 0;
|
||||
}
|
||||
}
|
@ -36,6 +36,8 @@ import java.util.Enumeration;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.security.AccessController;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
import static java.util.zip.ZipConstants64.*;
|
||||
|
||||
/**
|
||||
@ -78,6 +80,17 @@ class ZipFile implements ZipConstants, Closeable {
|
||||
|
||||
private static native void initIDs();
|
||||
|
||||
private static final boolean usemmap;
|
||||
|
||||
static {
|
||||
// A system prpperty to disable mmap use to avoid vm crash when
|
||||
// in-use zip file is accidently overwritten by others.
|
||||
String prop = AccessController.doPrivileged(
|
||||
new GetPropertyAction("sun.zip.disableMemoryMapping"));
|
||||
usemmap = (prop == null ||
|
||||
!(prop.length() == 0 || prop.equalsIgnoreCase("true")));
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a zip file for reading.
|
||||
*
|
||||
@ -196,7 +209,7 @@ class ZipFile implements ZipConstants, Closeable {
|
||||
throw new NullPointerException("charset is null");
|
||||
this.zc = ZipCoder.get(charset);
|
||||
long t0 = System.nanoTime();
|
||||
jzfile = open(name, mode, file.lastModified());
|
||||
jzfile = open(name, mode, file.lastModified(), usemmap);
|
||||
sun.misc.PerfCounter.getZipFileOpenTime().addElapsedTimeFrom(t0);
|
||||
sun.misc.PerfCounter.getZipFileCount().increment();
|
||||
this.name = name;
|
||||
@ -673,8 +686,8 @@ class ZipFile implements ZipConstants, Closeable {
|
||||
}
|
||||
|
||||
|
||||
private static native long open(String name, int mode, long lastModified)
|
||||
throws IOException;
|
||||
private static native long open(String name, int mode, long lastModified,
|
||||
boolean usemmap) throws IOException;
|
||||
private static native int getTotal(long jzfile);
|
||||
private static native int read(long jzfile, long jzentry,
|
||||
long pos, byte[] b, int off, int len);
|
||||
|
@ -1271,6 +1271,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
|
||||
*
|
||||
* @return a String representation of this object.
|
||||
**/
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + ": connectionId=" + connectionId;
|
||||
}
|
||||
@ -1514,6 +1515,21 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
|
||||
}
|
||||
}
|
||||
|
||||
private static class SetCcl implements PrivilegedExceptionAction<ClassLoader> {
|
||||
private final ClassLoader classLoader;
|
||||
|
||||
SetCcl(ClassLoader classLoader) {
|
||||
this.classLoader = classLoader;
|
||||
}
|
||||
|
||||
public ClassLoader run() {
|
||||
Thread currentThread = Thread.currentThread();
|
||||
ClassLoader old = currentThread.getContextClassLoader();
|
||||
currentThread.setContextClassLoader(classLoader);
|
||||
return old;
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> T unwrap(final MarshalledObject<?> mo,
|
||||
final ClassLoader cl,
|
||||
final Class<T> wrappedClass)
|
||||
@ -1522,22 +1538,14 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction<T>() {
|
||||
public T run()
|
||||
throws IOException {
|
||||
final ClassLoader old =
|
||||
Thread.currentThread().getContextClassLoader();
|
||||
Thread.currentThread().setContextClassLoader(cl);
|
||||
try {
|
||||
return wrappedClass.cast(mo.get());
|
||||
} catch (ClassNotFoundException cnfe) {
|
||||
throw new UnmarshalException(cnfe.toString(), cnfe);
|
||||
} finally {
|
||||
Thread.currentThread().setContextClassLoader(old);
|
||||
}
|
||||
}
|
||||
});
|
||||
final ClassLoader old = AccessController.doPrivileged(new SetCcl(cl));
|
||||
try {
|
||||
return wrappedClass.cast(mo.get());
|
||||
} catch (ClassNotFoundException cnfe) {
|
||||
throw new UnmarshalException(cnfe.toString(), cnfe);
|
||||
} finally {
|
||||
AccessController.doPrivileged(new SetCcl(old));
|
||||
}
|
||||
} catch (PrivilegedActionException pe) {
|
||||
Exception e = extractException(pe);
|
||||
if (e instanceof IOException) {
|
||||
@ -1561,14 +1569,14 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction<T>() {
|
||||
public T run()
|
||||
throws IOException {
|
||||
return unwrap(mo, new OrderClassLoaders(cl1, cl2),
|
||||
wrappedClass);
|
||||
}
|
||||
});
|
||||
ClassLoader orderCL = AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction<ClassLoader>() {
|
||||
public ClassLoader run() throws Exception {
|
||||
return new OrderClassLoaders(cl1, cl2);
|
||||
}
|
||||
}
|
||||
);
|
||||
return unwrap(mo, orderCL, wrappedClass);
|
||||
} catch (PrivilegedActionException pe) {
|
||||
Exception e = extractException(pe);
|
||||
if (e instanceof IOException) {
|
||||
|
@ -27,8 +27,10 @@
|
||||
package javax.net;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.*;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* This class creates sockets. It may be subclassed by other factories,
|
||||
@ -113,7 +115,17 @@ public abstract class SocketFactory
|
||||
* @see java.net.Socket#Socket()
|
||||
*/
|
||||
public Socket createSocket() throws IOException {
|
||||
throw new SocketException("Unconnected sockets not implemented");
|
||||
//
|
||||
// bug 6771432:
|
||||
// The Exception is used by HttpsClient to signal that
|
||||
// unconnected sockets have not been implemented.
|
||||
//
|
||||
UnsupportedOperationException uop = new
|
||||
UnsupportedOperationException();
|
||||
SocketException se = new SocketException(
|
||||
"Unconnected sockets not implemented");
|
||||
se.initCause(uop);
|
||||
throw se;
|
||||
}
|
||||
|
||||
|
||||
|
@ -246,8 +246,7 @@ public class JSplitPane extends JComponent implements Accessible
|
||||
* layout, using two buttons for the components.
|
||||
*/
|
||||
public JSplitPane() {
|
||||
this(JSplitPane.HORIZONTAL_SPLIT,
|
||||
UIManager.getBoolean("SplitPane.continuousLayout"),
|
||||
this(JSplitPane.HORIZONTAL_SPLIT, false,
|
||||
new JButton(UIManager.getString("SplitPane.leftButtonText")),
|
||||
new JButton(UIManager.getString("SplitPane.rightButtonText")));
|
||||
}
|
||||
@ -264,8 +263,7 @@ public class JSplitPane extends JComponent implements Accessible
|
||||
*/
|
||||
@ConstructorProperties({"orientation"})
|
||||
public JSplitPane(int newOrientation) {
|
||||
this(newOrientation,
|
||||
UIManager.getBoolean("SplitPane.continuousLayout"));
|
||||
this(newOrientation, false);
|
||||
}
|
||||
|
||||
|
||||
@ -309,9 +307,7 @@ public class JSplitPane extends JComponent implements Accessible
|
||||
public JSplitPane(int newOrientation,
|
||||
Component newLeftComponent,
|
||||
Component newRightComponent){
|
||||
this(newOrientation,
|
||||
UIManager.getBoolean("SplitPane.continuousLayout"),
|
||||
newLeftComponent, newRightComponent);
|
||||
this(newOrientation, false, newLeftComponent, newRightComponent);
|
||||
}
|
||||
|
||||
|
||||
|
@ -762,7 +762,9 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
|
||||
* component's background color to be painted.
|
||||
* <li>
|
||||
* Installs the default caret and highlighter into the
|
||||
* associated component.
|
||||
* associated component. These properties are only set if their
|
||||
* current value is either {@code null} or an instance of
|
||||
* {@link UIResource}.
|
||||
* <li>
|
||||
* Attaches to the editor and model. If there is no
|
||||
* model, a default one is created.
|
||||
|
@ -21276,7 +21276,6 @@
|
||||
<uiProperty name="centerOneTouchButtons" type="BOOLEAN" value="true"/>
|
||||
<uiProperty name="oneTouchButtonOffset" type="INT" value="30"/>
|
||||
<uiProperty name="oneTouchExpandable" type="BOOLEAN" value="false"/>
|
||||
<uiProperty name="continuousLayout" type="BOOLEAN" value="true"/>
|
||||
</uiproperties>
|
||||
</style>
|
||||
<backgroundStates>
|
||||
|
@ -648,6 +648,14 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
|
||||
table.put("ColorChooser.swatchesDefaultRecentColor", Color.RED);
|
||||
table.put("ColorChooser.swatchesSwatchSize", new Dimension(10, 10));
|
||||
|
||||
// These need to be defined for ImageView.
|
||||
table.put("html.pendingImage", SwingUtilities2.makeIcon(getClass(),
|
||||
BasicLookAndFeel.class,
|
||||
"icons/image-delayed.png"));
|
||||
table.put("html.missingImage", SwingUtilities2.makeIcon(getClass(),
|
||||
BasicLookAndFeel.class,
|
||||
"icons/image-failed.png"));
|
||||
|
||||
// These are needed for PopupMenu.
|
||||
table.put("PopupMenu.selectedWindowInputMapBindings", new Object[] {
|
||||
"ESCAPE", "cancel",
|
||||
|
@ -489,23 +489,6 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@Override
|
||||
protected void paintTabArea(Graphics g, int tabPlacement,
|
||||
int selectedIndex) {
|
||||
// This can be invoked from ScrollabeTabPanel
|
||||
Insets insets = tabPane.getInsets();
|
||||
int x = insets.left;
|
||||
int y = insets.top;
|
||||
int width = tabPane.getWidth() - insets.left - insets.right;
|
||||
int height = tabPane.getHeight() - insets.top - insets.bottom;
|
||||
|
||||
paintTabArea(tabAreaContext, g, tabPlacement, selectedIndex,
|
||||
new Rectangle(x, y, width, height));
|
||||
}
|
||||
|
||||
private void paintTabArea(SynthContext ss, Graphics g,
|
||||
int tabPlacement, int selectedIndex,
|
||||
Rectangle tabAreaBounds) {
|
||||
|
@ -34,7 +34,7 @@ import java.nio.charset.CharsetDecoder;
|
||||
ExtendedCharsets class, because if we want to have a public HKSCS,
|
||||
it probably should be HKSCS_2001 not HKSCS.
|
||||
*/
|
||||
public class HKSCS extends sun.nio.cs.ext.HKSCS {
|
||||
public class HKSCS extends sun.nio.cs.ext.MS950_HKSCS_XP {
|
||||
public HKSCS () {
|
||||
super();
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ import sun.awt.AppContext;
|
||||
import sun.awt.SunToolkit;
|
||||
import sun.awt.datatransfer.DataTransferer;
|
||||
import sun.awt.datatransfer.ToolkitThreadBlockedHandler;
|
||||
import sun.security.util.SecurityConstants;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -216,6 +217,18 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer,
|
||||
throws UnsupportedFlavorException, IOException,
|
||||
InvalidDnDOperationException
|
||||
{
|
||||
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
try {
|
||||
if (!dropComplete && sm != null) {
|
||||
sm.checkSystemClipboardAccess();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Thread currentThread = Thread.currentThread();
|
||||
currentThread.getUncaughtExceptionHandler().uncaughtException(currentThread, e);
|
||||
return null;
|
||||
}
|
||||
|
||||
Long lFormat = null;
|
||||
Transferable localTransferable = local;
|
||||
|
||||
|
@ -333,10 +333,10 @@ public class ImageRepresentation extends ImageWatched implements ImageConsumer
|
||||
hints = h;
|
||||
}
|
||||
|
||||
public native void setICMpixels(int x, int y, int w, int h, int[] lut,
|
||||
private native void setICMpixels(int x, int y, int w, int h, int[] lut,
|
||||
byte[] pix, int off, int scansize,
|
||||
IntegerComponentRaster ict);
|
||||
public native int setDiffICM(int x, int y, int w, int h, int[] lut,
|
||||
private native int setDiffICM(int x, int y, int w, int h, int[] lut,
|
||||
int transPix, int numLut, IndexColorModel icm,
|
||||
byte[] pix, int off, int scansize,
|
||||
ByteComponentRaster bct, int chanOff);
|
||||
@ -361,6 +361,64 @@ public class ImageRepresentation extends ImageWatched implements ImageConsumer
|
||||
}
|
||||
createBufferedImage();
|
||||
}
|
||||
|
||||
if (w <= 0 || h <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int biWidth = biRaster.getWidth();
|
||||
int biHeight = biRaster.getHeight();
|
||||
|
||||
int x1 = x+w; // Overflow protection below
|
||||
int y1 = y+h; // Overflow protection below
|
||||
if (x < 0) {
|
||||
off -= x;
|
||||
x = 0;
|
||||
} else if (x1 < 0) {
|
||||
x1 = biWidth; // Must be overflow
|
||||
}
|
||||
if (y < 0) {
|
||||
off -= y*scansize;
|
||||
y = 0;
|
||||
} else if (y1 < 0) {
|
||||
y1 = biHeight; // Must be overflow
|
||||
}
|
||||
if (x1 > biWidth) {
|
||||
x1 = biWidth;
|
||||
}
|
||||
if (y1 > biHeight) {
|
||||
y1 = biHeight;
|
||||
}
|
||||
if (x >= x1 || y >= y1) {
|
||||
return;
|
||||
}
|
||||
// x,y,x1,y1 are all >= 0, so w,h must be >= 0
|
||||
w = x1-x;
|
||||
h = y1-y;
|
||||
// off is first pixel read so it must be in bounds
|
||||
if (off < 0 || off >= pix.length) {
|
||||
// They overflowed their own array
|
||||
throw new ArrayIndexOutOfBoundsException("Data offset out of bounds.");
|
||||
}
|
||||
// pix.length and off are >= 0 so remainder >= 0
|
||||
int remainder = pix.length - off;
|
||||
if (remainder < w) {
|
||||
// They overflowed their own array
|
||||
throw new ArrayIndexOutOfBoundsException("Data array is too short.");
|
||||
}
|
||||
int num;
|
||||
if (scansize < 0) {
|
||||
num = (off / -scansize) + 1;
|
||||
} else if (scansize > 0) {
|
||||
num = ((remainder-w) / scansize) + 1;
|
||||
} else {
|
||||
num = h;
|
||||
}
|
||||
if (h > num) {
|
||||
// They overflowed their own array.
|
||||
throw new ArrayIndexOutOfBoundsException("Data array is too short.");
|
||||
}
|
||||
|
||||
if (isSameCM && (cmodel != model) && (srcLUT != null) &&
|
||||
(model instanceof IndexColorModel) &&
|
||||
(biRaster instanceof ByteComponentRaster))
|
||||
|
@ -26,26 +26,24 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.DoubleByte;
|
||||
import sun.nio.cs.ext.Big5;
|
||||
|
||||
/**
|
||||
* Tables and data to convert Big5 to Unicode
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
|
||||
public class ByteToCharBig5 extends ByteToCharDoubleByte {
|
||||
public class ByteToCharBig5 extends ByteToCharDBCS_ASCII {
|
||||
|
||||
private final static Big5 nioCoder = new Big5();
|
||||
private static DoubleByte.Decoder dec =
|
||||
(DoubleByte.Decoder)new Big5().newDecoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "Big5";
|
||||
}
|
||||
|
||||
public ByteToCharBig5() {
|
||||
super.index1 = nioCoder.getDecoderIndex1();
|
||||
super.index2 = nioCoder.getDecoderIndex2();
|
||||
start = 0x40;
|
||||
end = 0xFE;
|
||||
super(dec);
|
||||
}
|
||||
}
|
||||
|
@ -25,15 +25,28 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
public class ByteToCharBig5_HKSCS extends ByteToCharHKSCS_2001 {
|
||||
ByteToCharBig5 bcBig5 = new ByteToCharBig5();
|
||||
import sun.nio.cs.ext.Big5_HKSCS;
|
||||
import sun.nio.cs.ext.HKSCS;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class ByteToCharBig5_HKSCS extends ByteToCharDBCS_ASCII {
|
||||
|
||||
protected static HKSCS.Decoder dec =
|
||||
(HKSCS.Decoder)new Big5_HKSCS().newDecoder();
|
||||
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "Big5_HKSCS";
|
||||
}
|
||||
|
||||
protected char getUnicode(int byte1, int byte2) {
|
||||
char c = super.getUnicode(byte1, byte2);
|
||||
return (c != REPLACE_CHAR) ? c : bcBig5.getUnicode(byte1, byte2);
|
||||
public ByteToCharBig5_HKSCS() {
|
||||
super(dec);
|
||||
}
|
||||
|
||||
protected char decodeDouble(int byte1, int byte2) {
|
||||
char c = dec.decodeDouble(byte1, byte2);
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
c = dec.decodeBig5(byte1, byte2);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
@ -25,49 +25,19 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ByteToCharBig5_Solaris extends ByteToCharBig5 {
|
||||
public ByteToCharBig5_Solaris() {}
|
||||
import sun.nio.cs.ext.DoubleByte;
|
||||
import sun.nio.cs.ext.Big5_Solaris;
|
||||
|
||||
public class ByteToCharBig5_Solaris extends ByteToCharDBCS_ASCII {
|
||||
|
||||
private static DoubleByte.Decoder dec =
|
||||
(DoubleByte.Decoder)new Big5_Solaris().newDecoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "Big5_Solaris";
|
||||
}
|
||||
|
||||
protected char getUnicode(int byte1, int byte2) {
|
||||
//
|
||||
char c = super.getUnicode(byte1, byte2);
|
||||
if (c == REPLACE_CHAR) {
|
||||
if (byte1 == 0xf9) {
|
||||
switch (byte2) {
|
||||
case 0xD6:
|
||||
c = (char)0x7881;
|
||||
break;
|
||||
case 0xD7:
|
||||
c = (char)0x92B9;
|
||||
break;
|
||||
case 0xD8:
|
||||
c = (char)0x88CF;
|
||||
break;
|
||||
case 0xD9:
|
||||
c = (char)0x58BB;
|
||||
break;
|
||||
case 0xDA:
|
||||
c = (char)0x6052;
|
||||
break;
|
||||
case 0xDB:
|
||||
c = (char)0x7CA7;
|
||||
break;
|
||||
case 0xDC:
|
||||
c = (char)0x5AFA;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return c;
|
||||
public ByteToCharBig5_Solaris() {
|
||||
super(dec);
|
||||
}
|
||||
}
|
||||
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.HKSCS_2001;
|
||||
|
||||
/**
|
||||
* Tables and data to convert HKSCS (2001 revision) to Unicode
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
|
||||
public class ByteToCharHKSCS_2001 extends ByteToCharDoubleByte {
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "HKSCS_2001";
|
||||
}
|
||||
|
||||
public ByteToCharHKSCS_2001() {
|
||||
super.index1 = HKSCS_2001.getDecoderIndex1();
|
||||
super.index2= HKSCS_2001.getDecoderIndex2();
|
||||
start = 0x40;
|
||||
end = 0xFE;
|
||||
}
|
||||
}
|
@ -25,15 +25,27 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
public class ByteToCharMS950_HKSCS extends ByteToCharHKSCS {
|
||||
ByteToCharMS950 bcMS950 = new ByteToCharMS950();
|
||||
import sun.nio.cs.ext.HKSCS;
|
||||
import sun.nio.cs.ext.MS950_HKSCS;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class ByteToCharMS950_HKSCS extends ByteToCharDBCS_ASCII {
|
||||
|
||||
private static HKSCS.Decoder dec =
|
||||
(HKSCS.Decoder)new MS950_HKSCS().newDecoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "MS950_HKSCS";
|
||||
}
|
||||
|
||||
protected char getUnicode(int byte1, int byte2) {
|
||||
char c = super.getUnicode(byte1, byte2);
|
||||
return (c != REPLACE_CHAR) ? c : bcMS950.decodeDouble(byte1, byte2);
|
||||
public ByteToCharMS950_HKSCS() {
|
||||
super(dec);
|
||||
}
|
||||
|
||||
protected char decodeDouble(int byte1, int byte2) {
|
||||
char c = dec.decodeDouble(byte1, byte2);
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
c = dec.decodeBig5(byte1, byte2);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
@ -26,24 +26,24 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.DoubleByte;
|
||||
import sun.nio.cs.ext.Big5;
|
||||
|
||||
/**
|
||||
* Tables and data to convert Unicode to Big5
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
|
||||
public class CharToByteBig5 extends CharToByteDoubleByte {
|
||||
public class CharToByteBig5 extends CharToByteDBCS_ASCII {
|
||||
|
||||
private static final Big5 nioCoder = new Big5();
|
||||
private static DoubleByte.Encoder enc =
|
||||
(DoubleByte.Encoder)new Big5().newEncoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "Big5";
|
||||
}
|
||||
|
||||
public CharToByteBig5() {
|
||||
super.index1 = nioCoder.getEncoderIndex1();
|
||||
super.index2 = nioCoder.getEncoderIndex2();
|
||||
super(enc);
|
||||
}
|
||||
}
|
||||
|
@ -25,15 +25,18 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
public class CharToByteBig5_HKSCS extends CharToByteHKSCS_2001 {
|
||||
CharToByteBig5 cbBig5 = new CharToByteBig5();
|
||||
import sun.nio.cs.ext.DoubleByte;
|
||||
import sun.nio.cs.ext.Big5_HKSCS;
|
||||
|
||||
public class CharToByteBig5_HKSCS extends CharToByteDBCS_ASCII {
|
||||
private static DoubleByte.Encoder enc =
|
||||
(DoubleByte.Encoder)new Big5_HKSCS().newEncoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "Big5_HKSCS";
|
||||
}
|
||||
|
||||
protected int getNative(char ch) {
|
||||
int r = super.getNative(ch);
|
||||
return (r != 0) ? r : cbBig5.getNative(ch);
|
||||
public CharToByteBig5_HKSCS() {
|
||||
super(enc);
|
||||
}
|
||||
}
|
||||
|
@ -23,48 +23,21 @@
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
|
||||
package sun.io;
|
||||
|
||||
/**
|
||||
*/
|
||||
import sun.nio.cs.ext.DoubleByte;
|
||||
import sun.nio.cs.ext.Big5_Solaris;
|
||||
|
||||
public class CharToByteBig5_Solaris extends CharToByteBig5 {
|
||||
public class CharToByteBig5_Solaris extends CharToByteDBCS_ASCII {
|
||||
|
||||
private static DoubleByte.Encoder enc =
|
||||
(DoubleByte.Encoder)new Big5_Solaris().newEncoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "Big5_Solaris";
|
||||
}
|
||||
|
||||
protected int getNative(char ch) {
|
||||
int nativeVal;
|
||||
|
||||
if ((nativeVal = super.getNative(ch)) != 0) {
|
||||
return nativeVal;
|
||||
}
|
||||
|
||||
switch (ch) {
|
||||
case 0x7881:
|
||||
nativeVal = 0xF9D6;
|
||||
break;
|
||||
case 0x92B9:
|
||||
nativeVal = 0xF9D7;
|
||||
break;
|
||||
case 0x88CF:
|
||||
nativeVal = 0xF9D8;
|
||||
break;
|
||||
case 0x58BB:
|
||||
nativeVal = 0xF9D9;
|
||||
break;
|
||||
case 0x6052:
|
||||
nativeVal = 0xF9DA;
|
||||
break;
|
||||
case 0x7CA7:
|
||||
nativeVal = 0xF9DB;
|
||||
break;
|
||||
case 0x5AFA:
|
||||
nativeVal = 0xF9DC;
|
||||
break;
|
||||
}
|
||||
return nativeVal;
|
||||
public CharToByteBig5_Solaris() {
|
||||
super(enc);
|
||||
}
|
||||
}
|
||||
|
@ -25,15 +25,19 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
public class CharToByteMS950_HKSCS extends CharToByteHKSCS {
|
||||
CharToByteMS950 cbMS950 = new CharToByteMS950();
|
||||
import sun.nio.cs.ext.DoubleByte;
|
||||
import sun.nio.cs.ext.MS950_HKSCS;
|
||||
|
||||
public class CharToByteMS950_HKSCS extends CharToByteDBCS_ASCII {
|
||||
|
||||
private static DoubleByte.Encoder enc =
|
||||
(DoubleByte.Encoder)new MS950_HKSCS().newEncoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "MS950_HKSCS";
|
||||
}
|
||||
|
||||
protected int getNative(char ch) {
|
||||
int r = super.getNative(ch);
|
||||
return (r != 0) ? r : cbMS950.encodeChar(ch);
|
||||
public CharToByteMS950_HKSCS() {
|
||||
super(enc);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -22,27 +22,18 @@
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
package sun.misc;
|
||||
|
||||
package sun.io;
|
||||
import java.security.PermissionCollection;
|
||||
import java.security.ProtectionDomain;
|
||||
|
||||
import sun.nio.cs.ext.HKSCS;
|
||||
|
||||
/**
|
||||
* Tables and data to convert HKSCS to Unicode
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
|
||||
public class ByteToCharHKSCS extends ByteToCharDoubleByte {
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "HKSCS";
|
||||
}
|
||||
|
||||
public ByteToCharHKSCS() {
|
||||
super.index1 = HKSCS.getDecoderIndex1();
|
||||
super.index2= HKSCS.getDecoderIndex2();
|
||||
start = 0x40;
|
||||
end = 0xFE;
|
||||
public interface JavaSecurityProtectionDomainAccess {
|
||||
interface ProtectionDomainCache {
|
||||
void put(ProtectionDomain pd, PermissionCollection pc);
|
||||
PermissionCollection get(ProtectionDomain pd);
|
||||
}
|
||||
/**
|
||||
* Returns the ProtectionDomainCache.
|
||||
*/
|
||||
ProtectionDomainCache getProtectionDomainCache();
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -47,6 +47,7 @@ public class SharedSecrets {
|
||||
private static JavaNetAccess javaNetAccess;
|
||||
private static JavaNioAccess javaNioAccess;
|
||||
private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess;
|
||||
private static JavaSecurityProtectionDomainAccess javaSecurityProtectionDomainAccess;
|
||||
|
||||
public static JavaUtilJarAccess javaUtilJarAccess() {
|
||||
if (javaUtilJarAccess == null) {
|
||||
@ -113,4 +114,13 @@ public class SharedSecrets {
|
||||
return javaIOFileDescriptorAccess;
|
||||
}
|
||||
|
||||
public static void setJavaSecurityProtectionDomainAccess
|
||||
(JavaSecurityProtectionDomainAccess jspda) {
|
||||
javaSecurityProtectionDomainAccess = jspda;
|
||||
}
|
||||
|
||||
public static JavaSecurityProtectionDomainAccess
|
||||
getJavaSecurityProtectionDomainAccess() {
|
||||
return javaSecurityProtectionDomainAccess;
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ import java.net.Socket;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.net.URL;
|
||||
import java.net.Proxy;
|
||||
import java.util.Arrays;
|
||||
import java.security.AccessController;
|
||||
@ -157,10 +156,15 @@ public class NetworkClient {
|
||||
public Socket run() {
|
||||
return new Socket(proxy);
|
||||
}});
|
||||
} else
|
||||
} else if (proxy.type() == Proxy.Type.DIRECT) {
|
||||
s = createSocket();
|
||||
} else {
|
||||
// Still connecting through a proxy
|
||||
// server & port will be the proxy address and port
|
||||
s = new Socket(Proxy.NO_PROXY);
|
||||
}
|
||||
} else
|
||||
s = new Socket();
|
||||
s = createSocket();
|
||||
// Instance specific timeouts do have priority, that means
|
||||
// connectTimeout & readTimeout (-1 means not set)
|
||||
// Then global default timeouts
|
||||
@ -182,6 +186,15 @@ public class NetworkClient {
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* The following method, createSocket, is provided to allow the
|
||||
* https client to override it so that it may use its socket factory
|
||||
* to create the socket.
|
||||
*/
|
||||
protected Socket createSocket() throws IOException {
|
||||
return new java.net.Socket();
|
||||
}
|
||||
|
||||
protected InetAddress getLocalAddress() throws IOException {
|
||||
if (serverSocket == null)
|
||||
throw new IOException("not connected");
|
||||
|
@ -270,13 +270,17 @@ public abstract class AuthenticationInfo extends AuthCacheValue implements Clone
|
||||
* In this case we do not use the path because the protection space
|
||||
* is identified by the host:port:realm only
|
||||
*/
|
||||
static AuthenticationInfo getServerAuth(URL url, String realm, AuthScheme scheme) {
|
||||
static String getServerAuthKey(URL url, String realm, AuthScheme scheme) {
|
||||
int port = url.getPort();
|
||||
if (port == -1) {
|
||||
port = url.getDefaultPort();
|
||||
}
|
||||
String key = SERVER_AUTHENTICATION + ":" + scheme + ":" + url.getProtocol().toLowerCase()
|
||||
+ ":" + url.getHost().toLowerCase() + ":" + port + ":" + realm;
|
||||
return key;
|
||||
}
|
||||
|
||||
static AuthenticationInfo getServerAuth(String key) {
|
||||
AuthenticationInfo cached = getAuth(key, null);
|
||||
if ((cached == null) && requestIsInProgress (key)) {
|
||||
/* check the cache again, it might contain an entry */
|
||||
@ -314,9 +318,13 @@ public abstract class AuthenticationInfo extends AuthCacheValue implements Clone
|
||||
* Used in response to a challenge. Note, the protocol field is always
|
||||
* blank for proxies.
|
||||
*/
|
||||
static AuthenticationInfo getProxyAuth(String host, int port, String realm, AuthScheme scheme) {
|
||||
static String getProxyAuthKey(String host, int port, String realm, AuthScheme scheme) {
|
||||
String key = PROXY_AUTHENTICATION + ":" + scheme + "::" + host.toLowerCase()
|
||||
+ ":" + port + ":" + realm;
|
||||
return key;
|
||||
}
|
||||
|
||||
static AuthenticationInfo getProxyAuth(String key) {
|
||||
AuthenticationInfo cached = (AuthenticationInfo) cache.get(key, null);
|
||||
if ((cached == null) && requestIsInProgress (key)) {
|
||||
/* check the cache again, it might contain an entry */
|
||||
@ -330,19 +338,20 @@ public abstract class AuthenticationInfo extends AuthCacheValue implements Clone
|
||||
* Add this authentication to the cache
|
||||
*/
|
||||
void addToCache() {
|
||||
cache.put (cacheKey(true), this);
|
||||
String key = cacheKey(true);
|
||||
cache.put(key, this);
|
||||
if (supportsPreemptiveAuthorization()) {
|
||||
cache.put (cacheKey(false), this);
|
||||
cache.put(cacheKey(false), this);
|
||||
}
|
||||
endAuthRequest();
|
||||
endAuthRequest(key);
|
||||
}
|
||||
|
||||
void endAuthRequest () {
|
||||
static void endAuthRequest (String key) {
|
||||
if (!serializeAuth) {
|
||||
return;
|
||||
}
|
||||
synchronized (requests) {
|
||||
requestCompleted (cacheKey(true));
|
||||
requestCompleted(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1995-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -249,6 +249,8 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
||||
boolean isUserServerAuth;
|
||||
boolean isUserProxyAuth;
|
||||
|
||||
String serverAuthKey, proxyAuthKey;
|
||||
|
||||
/* Progress source */
|
||||
protected ProgressSource pi;
|
||||
|
||||
@ -1258,6 +1260,11 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
||||
doingNTLMp2ndStage = false;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
inNegotiateProxy = false;
|
||||
doingNTLMp2ndStage = false;
|
||||
if (!isUserProxyAuth)
|
||||
requests.remove("Proxy-Authorization");
|
||||
}
|
||||
|
||||
// cache proxy authentication info
|
||||
@ -1303,7 +1310,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
||||
serverAuthentication.getAuthScheme() != NTLM) {
|
||||
if (serverAuthentication.isAuthorizationStale (raw)) {
|
||||
/* we can retry with the current credentials */
|
||||
disconnectInternal();
|
||||
disconnectWeb();
|
||||
redirects++;
|
||||
requests.set(serverAuthentication.getHeaderName(),
|
||||
serverAuthentication.getHeaderValue(url, method));
|
||||
@ -1318,7 +1325,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
||||
currentServerCredentials = serverAuthentication;
|
||||
|
||||
if (serverAuthentication != null) {
|
||||
disconnectInternal();
|
||||
disconnectWeb();
|
||||
redirects++; // don't let things loop ad nauseum
|
||||
setCookieHeader();
|
||||
continue;
|
||||
@ -1327,7 +1334,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
||||
reset ();
|
||||
/* header not used for ntlm */
|
||||
if (!serverAuthentication.setHeaders(this, null, raw)) {
|
||||
disconnectInternal();
|
||||
disconnectWeb();
|
||||
throw new IOException ("Authentication failure");
|
||||
}
|
||||
doingNTLM2ndStage = false;
|
||||
@ -1498,11 +1505,11 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
||||
}
|
||||
throw e;
|
||||
} finally {
|
||||
if (respCode == HTTP_PROXY_AUTH && proxyAuthentication != null) {
|
||||
proxyAuthentication.endAuthRequest();
|
||||
if (proxyAuthKey != null) {
|
||||
AuthenticationInfo.endAuthRequest(proxyAuthKey);
|
||||
}
|
||||
else if (respCode == HTTP_UNAUTHORIZED && serverAuthentication != null) {
|
||||
serverAuthentication.endAuthRequest();
|
||||
if (serverAuthKey != null) {
|
||||
AuthenticationInfo.endAuthRequest(serverAuthKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1715,8 +1722,8 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
||||
statusLine + "\"");
|
||||
}
|
||||
} finally {
|
||||
if (respCode == HTTP_PROXY_AUTH && proxyAuthentication != null) {
|
||||
proxyAuthentication.endAuthRequest();
|
||||
if (proxyAuthKey != null) {
|
||||
AuthenticationInfo.endAuthRequest(proxyAuthKey);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1832,10 +1839,8 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
||||
|
||||
if (realm == null)
|
||||
realm = "";
|
||||
ret = AuthenticationInfo.getProxyAuth(host,
|
||||
port,
|
||||
realm,
|
||||
authScheme);
|
||||
proxyAuthKey = AuthenticationInfo.getProxyAuthKey(host, port, realm, authScheme);
|
||||
ret = AuthenticationInfo.getProxyAuth(proxyAuthKey);
|
||||
if (ret == null) {
|
||||
switch (authScheme) {
|
||||
case BASIC:
|
||||
@ -1976,7 +1981,8 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
||||
domain = p.findValue ("domain");
|
||||
if (realm == null)
|
||||
realm = "";
|
||||
ret = AuthenticationInfo.getServerAuth(url, realm, authScheme);
|
||||
serverAuthKey = AuthenticationInfo.getServerAuthKey(url, realm, authScheme);
|
||||
ret = AuthenticationInfo.getServerAuth(serverAuthKey);
|
||||
InetAddress addr = null;
|
||||
if (ret == null) {
|
||||
try {
|
||||
@ -2319,6 +2325,22 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
||||
connected = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect from the web server at the first 401 error. Do not
|
||||
* disconnect when using a proxy, a good proxy should have already
|
||||
* closed the connection to the web server.
|
||||
*/
|
||||
private void disconnectWeb() throws IOException {
|
||||
if (usingProxy()) {
|
||||
responseCode = -1;
|
||||
// clean up, particularly, skip the content part
|
||||
// of a 401 error response
|
||||
reset();
|
||||
} else {
|
||||
disconnectInternal();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect from the server (for internal use)
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 2005-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -45,43 +45,50 @@ public class NegotiateCallbackHandler implements CallbackHandler {
|
||||
private String username;
|
||||
private char[] password;
|
||||
|
||||
/**
|
||||
* Authenticator asks for username and password in a single prompt,
|
||||
* but CallbackHandler checks one by one. So, no matter which callback
|
||||
* gets handled first, make sure Authenticator is only called once.
|
||||
*/
|
||||
private boolean answered;
|
||||
|
||||
private final HttpCallerInfo hci;
|
||||
|
||||
public NegotiateCallbackHandler(HttpCallerInfo hci) {
|
||||
this.hci = hci;
|
||||
}
|
||||
|
||||
private void getAnswer() {
|
||||
if (!answered) {
|
||||
answered = true;
|
||||
PasswordAuthentication passAuth =
|
||||
Authenticator.requestPasswordAuthentication(
|
||||
hci.host, hci.addr, hci.port, hci.protocol,
|
||||
hci.prompt, hci.scheme, hci.url, hci.authType);
|
||||
/**
|
||||
* To be compatible with existing callback handler implementations,
|
||||
* when the underlying Authenticator is canceled, username and
|
||||
* password are assigned null. No exception is thrown.
|
||||
*/
|
||||
if (passAuth != null) {
|
||||
username = passAuth.getUserName();
|
||||
password = passAuth.getPassword();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handle(Callback[] callbacks) throws
|
||||
UnsupportedCallbackException, IOException {
|
||||
for (int i=0; i<callbacks.length; i++) {
|
||||
Callback callBack = callbacks[i];
|
||||
|
||||
if (callBack instanceof NameCallback) {
|
||||
if (username == null) {
|
||||
PasswordAuthentication passAuth =
|
||||
Authenticator.requestPasswordAuthentication(
|
||||
hci.host, hci.addr, hci.port, hci.protocol,
|
||||
hci.prompt, hci.scheme, hci.url, hci.authType);
|
||||
username = passAuth.getUserName();
|
||||
password = passAuth.getPassword();
|
||||
}
|
||||
NameCallback nameCallback =
|
||||
(NameCallback)callBack;
|
||||
nameCallback.setName(username);
|
||||
|
||||
getAnswer();
|
||||
((NameCallback)callBack).setName(username);
|
||||
} else if (callBack instanceof PasswordCallback) {
|
||||
PasswordCallback passwordCallback =
|
||||
(PasswordCallback)callBack;
|
||||
if (password == null) {
|
||||
PasswordAuthentication passAuth =
|
||||
Authenticator.requestPasswordAuthentication(
|
||||
hci.host, hci.addr, hci.port, hci.protocol,
|
||||
hci.prompt, hci.scheme, hci.url, hci.authType);
|
||||
username = passAuth.getUserName();
|
||||
password = passAuth.getPassword();
|
||||
}
|
||||
passwordCallback.setPassword(password);
|
||||
Arrays.fill(password, ' ');
|
||||
getAnswer();
|
||||
((PasswordCallback)callBack).setPassword(password);
|
||||
if (password != null) Arrays.fill(password, ' ');
|
||||
} else {
|
||||
throw new UnsupportedCallbackException(callBack,
|
||||
"Call back not supported");
|
||||
|
@ -28,39 +28,24 @@ package sun.net.www.protocol.https;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.net.URL;
|
||||
import java.net.UnknownHostException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Proxy;
|
||||
import java.net.CookieHandler;
|
||||
import java.net.Authenticator;
|
||||
import java.net.PasswordAuthentication;
|
||||
import java.security.Principal;
|
||||
import java.security.KeyStore;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.cert.*;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Vector;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.security.AccessController;
|
||||
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
|
||||
import javax.net.ssl.*;
|
||||
import sun.security.x509.X500Name;
|
||||
import sun.misc.Regexp;
|
||||
import sun.misc.RegexpPool;
|
||||
import sun.net.www.HeaderParser;
|
||||
import sun.net.www.MessageHeader;
|
||||
import sun.net.www.http.HttpClient;
|
||||
import sun.security.action.*;
|
||||
|
||||
@ -125,6 +110,7 @@ final class HttpsClient extends HttpClient
|
||||
private static final int httpsPortNumber = 443;
|
||||
|
||||
/** Returns the default HTTPS port (443) */
|
||||
@Override
|
||||
protected int getDefaultPort() { return httpsPortNumber; }
|
||||
|
||||
private HostnameVerifier hv;
|
||||
@ -368,11 +354,39 @@ final class HttpsClient extends HttpClient
|
||||
return sslSocketFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* The following method, createSocket, is defined in NetworkClient
|
||||
* and overridden here so that the socket facroty is used to create
|
||||
* new sockets.
|
||||
*/
|
||||
@Override
|
||||
protected Socket createSocket() throws IOException {
|
||||
try {
|
||||
return sslSocketFactory.createSocket();
|
||||
} catch (SocketException se) {
|
||||
//
|
||||
// bug 6771432
|
||||
// javax.net.SocketFactory throws a SocketException with an
|
||||
// UnsupportedOperationException as its cause to indicate that
|
||||
// unconnected sockets have not been implemented.
|
||||
//
|
||||
Throwable t = se.getCause();
|
||||
if (t != null && t instanceof UnsupportedOperationException) {
|
||||
return super.createSocket();
|
||||
} else {
|
||||
throw se;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean needsTunneling() {
|
||||
return (proxy != null && proxy.type() != Proxy.Type.DIRECT
|
||||
&& proxy.type() != Proxy.Type.SOCKS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterConnect() throws IOException, UnknownHostException {
|
||||
if (!isCachedConnection()) {
|
||||
SSLSocket s = null;
|
||||
@ -383,6 +397,9 @@ final class HttpsClient extends HttpClient
|
||||
host, port, true);
|
||||
} else {
|
||||
s = (SSLSocket)serverSocket;
|
||||
if (s instanceof SSLSocketImpl) {
|
||||
((SSLSocketImpl)s).setHost(host);
|
||||
}
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
// If we fail to connect through the tunnel, try it
|
||||
@ -451,7 +468,6 @@ final class HttpsClient extends HttpClient
|
||||
//
|
||||
// Get authenticated server name, if any
|
||||
//
|
||||
boolean done = false;
|
||||
String host = url.getHost();
|
||||
|
||||
// if IPv6 strip off the "[]"
|
||||
@ -467,7 +483,7 @@ final class HttpsClient extends HttpClient
|
||||
|
||||
// Use ciphersuite to determine whether Kerberos is present.
|
||||
if (cipher.startsWith("TLS_KRB5")) {
|
||||
if (!checker.match(host, getPeerPrincipal())) {
|
||||
if (!HostnameChecker.match(host, getPeerPrincipal())) {
|
||||
throw new SSLPeerUnverifiedException("Hostname checker" +
|
||||
" failed for Kerberos");
|
||||
}
|
||||
@ -514,6 +530,7 @@ final class HttpsClient extends HttpClient
|
||||
+ url.getHost() + ">");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void putInKeepAliveCache() {
|
||||
kac.put(url, sslSocketFactory, this);
|
||||
}
|
||||
@ -521,6 +538,7 @@ final class HttpsClient extends HttpClient
|
||||
/*
|
||||
* Close an idle connection to this URL (if it exists in the cache).
|
||||
*/
|
||||
@Override
|
||||
public void closeIdleConnection() {
|
||||
HttpClient http = (HttpClient) kac.get(url, sslSocketFactory);
|
||||
if (http != null) {
|
||||
@ -626,11 +644,12 @@ final class HttpsClient extends HttpClient
|
||||
* @return the proxy host being used for this client, or null
|
||||
* if we're not going through a proxy
|
||||
*/
|
||||
@Override
|
||||
public String getProxyHostUsed() {
|
||||
if (!needsTunneling()) {
|
||||
return null;
|
||||
} else {
|
||||
return ((InetSocketAddress)proxy.address()).getHostName();
|
||||
return super.getProxyHostUsed();
|
||||
}
|
||||
}
|
||||
|
||||
@ -638,6 +657,7 @@ final class HttpsClient extends HttpClient
|
||||
* @return the proxy port being used for this client. Meaningless
|
||||
* if getProxyHostUsed() gives null.
|
||||
*/
|
||||
@Override
|
||||
public int getProxyPortUsed() {
|
||||
return (proxy == null || proxy.type() == Proxy.Type.DIRECT ||
|
||||
proxy.type() == Proxy.Type.SOCKS)? -1:
|
||||
|
@ -68,6 +68,9 @@ class Net { // package-private
|
||||
InetSocketAddress isa = (InetSocketAddress)sa;
|
||||
if (isa.isUnresolved())
|
||||
throw new UnresolvedAddressException(); // ## needs arg
|
||||
InetAddress addr = isa.getAddress();
|
||||
if (!(addr instanceof Inet4Address || addr instanceof Inet6Address))
|
||||
throw new IllegalArgumentException("Invalid address type");
|
||||
return isa;
|
||||
}
|
||||
|
||||
|
@ -78,8 +78,8 @@ public class Surrogate {
|
||||
* Tells whether or not the given UCS-4 character is in the Basic
|
||||
* Multilingual Plane, and can be represented using a single char.
|
||||
*/
|
||||
public static boolean isBMP(int uc) {
|
||||
return (int) (char) uc == uc;
|
||||
public static boolean isBMPCodePoint(int uc) {
|
||||
return uc >> 16 == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -290,7 +290,7 @@ public class Surrogate {
|
||||
* error() will return a descriptive result object
|
||||
*/
|
||||
public int generate(int uc, int len, CharBuffer dst) {
|
||||
if (Surrogate.isBMP(uc)) {
|
||||
if (Surrogate.isBMPCodePoint(uc)) {
|
||||
if (Surrogate.is(uc)) {
|
||||
error = CoderResult.malformedForLength(len);
|
||||
return -1;
|
||||
@ -334,7 +334,7 @@ public class Surrogate {
|
||||
* error() will return a descriptive result object
|
||||
*/
|
||||
public int generate(int uc, int len, char[] da, int dp, int dl) {
|
||||
if (Surrogate.isBMP(uc)) {
|
||||
if (Surrogate.isBMPCodePoint(uc)) {
|
||||
if (Surrogate.is(uc)) {
|
||||
error = CoderResult.malformedForLength(len);
|
||||
return -1;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2004 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,15 +23,13 @@
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class Big5_HKSCS extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
@ -57,33 +55,35 @@ public class Big5_HKSCS extends Charset implements HistoricallyNamedCharset
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
private static class Decoder extends HKSCS_2001.Decoder {
|
||||
static class Decoder extends HKSCS.Decoder {
|
||||
private static DoubleByte.Decoder big5 =
|
||||
(DoubleByte.Decoder)new Big5().newDecoder();
|
||||
|
||||
Big5.Decoder big5Dec;
|
||||
|
||||
protected char decodeDouble(int byte1, int byte2) {
|
||||
char c = super.decodeDouble(byte1, byte2);
|
||||
return (c != REPLACE_CHAR) ? c : big5Dec.decodeDouble(byte1, byte2);
|
||||
private static char[][] b2cBmp = new char[0x100][];
|
||||
private static char[][] b2cSupp = new char[0x100][];
|
||||
static {
|
||||
initb2c(b2cBmp, HKSCSMapping.b2cBmpStr);
|
||||
initb2c(b2cSupp, HKSCSMapping.b2cSuppStr);
|
||||
}
|
||||
|
||||
private Decoder(Charset cs) {
|
||||
super(cs);
|
||||
big5Dec = new Big5.Decoder(cs);
|
||||
super(cs, big5, b2cBmp, b2cSupp);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Encoder extends HKSCS_2001.Encoder {
|
||||
static class Encoder extends HKSCS.Encoder {
|
||||
private static DoubleByte.Encoder big5 =
|
||||
(DoubleByte.Encoder)new Big5().newEncoder();
|
||||
|
||||
private Big5.Encoder big5Enc;
|
||||
|
||||
protected int encodeDouble(char ch) {
|
||||
int r = super.encodeDouble(ch);
|
||||
return (r != 0) ? r : big5Enc.encodeDouble(ch);
|
||||
static char[][] c2bBmp = new char[0x100][];
|
||||
static char[][] c2bSupp = new char[0x100][];
|
||||
static {
|
||||
initc2b(c2bBmp, HKSCSMapping.b2cBmpStr, HKSCSMapping.pua);
|
||||
initc2b(c2bSupp, HKSCSMapping.b2cSuppStr, null);
|
||||
}
|
||||
|
||||
private Encoder(Charset cs) {
|
||||
super(cs);
|
||||
big5Enc = new Big5.Encoder(cs);
|
||||
super(cs, big5, c2bBmp, c2bSupp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
85
jdk/src/share/classes/sun/nio/cs/ext/Big5_HKSCS_2001.java
Normal file
85
jdk/src/share/classes/sun/nio/cs/ext/Big5_HKSCS_2001.java
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright 2002-2004 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
|
||||
public class Big5_HKSCS_2001 extends Charset
|
||||
{
|
||||
public Big5_HKSCS_2001() {
|
||||
super("x-Big5-HKSCS-2001", ExtendedCharsets.aliasesFor("x-Big5-HKSCS-2001"));
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof Big5)
|
||||
|| (cs instanceof Big5_HKSCS_2001));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
private static class Decoder extends HKSCS.Decoder {
|
||||
private static DoubleByte.Decoder big5 =
|
||||
(DoubleByte.Decoder)new Big5().newDecoder();
|
||||
|
||||
private static char[][] b2cBmp = new char[0x100][];
|
||||
private static char[][] b2cSupp = new char[0x100][];
|
||||
static {
|
||||
initb2c(b2cBmp, HKSCS2001Mapping.b2cBmpStr);
|
||||
initb2c(b2cSupp, HKSCS2001Mapping.b2cSuppStr);
|
||||
}
|
||||
|
||||
private Decoder(Charset cs) {
|
||||
super(cs, big5, b2cBmp, b2cSupp);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Encoder extends HKSCS.Encoder {
|
||||
private static DoubleByte.Encoder big5 =
|
||||
(DoubleByte.Encoder)new Big5().newEncoder();
|
||||
|
||||
static char[][] c2bBmp = new char[0x100][];
|
||||
static char[][] c2bSupp = new char[0x100][];
|
||||
static {
|
||||
initc2b(c2bBmp, HKSCS2001Mapping.b2cBmpStr,
|
||||
HKSCS2001Mapping.pua);
|
||||
initc2b(c2bSupp, HKSCS2001Mapping.b2cSuppStr, null);
|
||||
}
|
||||
|
||||
private Encoder(Charset cs) {
|
||||
super(cs, big5, c2bBmp, c2bSupp);
|
||||
}
|
||||
}
|
||||
}
|
@ -23,15 +23,14 @@
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import java.util.Arrays;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class Big5_Solaris extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
@ -50,90 +49,78 @@ public class Big5_Solaris extends Charset implements HistoricallyNamedCharset
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this);
|
||||
initb2c();
|
||||
return new DoubleByte.Decoder(this, b2c, b2cSB, 0x40, 0xfe);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
initc2b();
|
||||
return new DoubleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private static class Decoder extends Big5.Decoder {
|
||||
|
||||
protected char decodeDouble(int byte1, int byte2) {
|
||||
char c = super.decodeDouble(byte1, byte2);
|
||||
static char[][] b2c;
|
||||
static char[] b2cSB;
|
||||
private static volatile boolean b2cInitialized = false;
|
||||
|
||||
static void initb2c() {
|
||||
if (b2cInitialized)
|
||||
return;
|
||||
synchronized (Big5_Solaris.class) {
|
||||
if (b2cInitialized)
|
||||
return;
|
||||
Big5.initb2c();
|
||||
b2c = Big5.b2c.clone();
|
||||
// Big5 Solaris implementation has 7 additional mappings
|
||||
|
||||
if (c == REPLACE_CHAR) {
|
||||
if (byte1 == 0xf9) {
|
||||
switch (byte2) {
|
||||
case 0xD6:
|
||||
c = (char)0x7881;
|
||||
break;
|
||||
case 0xD7:
|
||||
c = (char)0x92B9;
|
||||
break;
|
||||
case 0xD8:
|
||||
c = (char)0x88CF;
|
||||
break;
|
||||
case 0xD9:
|
||||
c = (char)0x58BB;
|
||||
break;
|
||||
case 0xDA:
|
||||
c = (char)0x6052;
|
||||
break;
|
||||
case 0xDB:
|
||||
c = (char)0x7CA7;
|
||||
break;
|
||||
case 0xDC:
|
||||
c = (char)0x5AFA;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int[] sol = new int[] {
|
||||
0xF9D6, 0x7881,
|
||||
0xF9D7, 0x92B9,
|
||||
0xF9D8, 0x88CF,
|
||||
0xF9D9, 0x58BB,
|
||||
0xF9DA, 0x6052,
|
||||
0xF9DB, 0x7CA7,
|
||||
0xF9DC, 0x5AFA };
|
||||
if (b2c[0xf9] == DoubleByte.B2C_UNMAPPABLE) {
|
||||
b2c[0xf9] = new char[0xfe - 0x40 + 1];
|
||||
Arrays.fill(b2c[0xf9], UNMAPPABLE_DECODING);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
private Decoder(Charset cs) {
|
||||
super(cs);
|
||||
for (int i = 0; i < sol.length;) {
|
||||
b2c[0xf9][sol[i++] & 0xff - 0x40] = (char)sol[i++];
|
||||
}
|
||||
b2cSB = Big5.b2cSB;
|
||||
b2cInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static class Encoder extends Big5.Encoder {
|
||||
static char[] c2b;
|
||||
static char[] c2bIndex;
|
||||
private static volatile boolean c2bInitialized = false;
|
||||
|
||||
protected int encodeDouble(char ch) {
|
||||
int r = super.encodeDouble(ch);
|
||||
static void initc2b() {
|
||||
if (c2bInitialized)
|
||||
return;
|
||||
synchronized (Big5_Solaris.class) {
|
||||
if (c2bInitialized)
|
||||
return;
|
||||
Big5.initc2b();
|
||||
c2b = Big5.c2b.clone();
|
||||
c2bIndex = Big5.c2bIndex.clone();
|
||||
int[] sol = new int[] {
|
||||
0x7881, 0xF9D6,
|
||||
0x92B9, 0xF9D7,
|
||||
0x88CF, 0xF9D8,
|
||||
0x58BB, 0xF9D9,
|
||||
0x6052, 0xF9DA,
|
||||
0x7CA7, 0xF9DB,
|
||||
0x5AFA, 0xF9DC };
|
||||
|
||||
if (r == 0) {
|
||||
switch (ch) {
|
||||
case 0x7881:
|
||||
r = 0xF9D6;
|
||||
break;
|
||||
case 0x92B9:
|
||||
r = 0xF9D7;
|
||||
break;
|
||||
case 0x88CF:
|
||||
r = 0xF9D8;
|
||||
break;
|
||||
case 0x58BB:
|
||||
r = 0xF9D9;
|
||||
break;
|
||||
case 0x6052:
|
||||
r = 0xF9DA;
|
||||
break;
|
||||
case 0x7CA7:
|
||||
r = 0xF9DB;
|
||||
break;
|
||||
case 0x5AFA:
|
||||
r = 0xF9DC;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
private Encoder(Charset cs) {
|
||||
super(cs);
|
||||
for (int i = 0; i < sol.length;) {
|
||||
int c = sol[i++];
|
||||
// no need to check c2bIndex[c >>8], we know it points
|
||||
// to the appropriate place.
|
||||
c2b[c2bIndex[c >> 8] + (c & 0xff)] = (char)sol[i++];
|
||||
}
|
||||
c2bInitialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,10 +55,15 @@ public class ExtendedCharsets
|
||||
"csBig5"
|
||||
});
|
||||
|
||||
charset("x-MS950-HKSCS-XP", "MS950_HKSCS_XP",
|
||||
new String[] {
|
||||
"MS950_HKSCS_XP" // JDK historical;
|
||||
});
|
||||
|
||||
charset("x-MS950-HKSCS", "MS950_HKSCS",
|
||||
new String[] {
|
||||
// IANA aliases
|
||||
"MS950_HKSCS" // JDK historical;
|
||||
"MS950_HKSCS" // JDK historical;
|
||||
});
|
||||
|
||||
charset("x-windows-950", "MS950",
|
||||
@ -86,8 +91,16 @@ public class ExtendedCharsets
|
||||
"Big5_HKSCS", // JDK historical
|
||||
"big5hk",
|
||||
"big5-hkscs",
|
||||
"big5hkscs" // Linux alias
|
||||
});
|
||||
|
||||
charset("x-Big5-HKSCS-2001", "Big5_HKSCS_2001",
|
||||
new String[] {
|
||||
"Big5_HKSCS_2001",
|
||||
"big5hk-2001",
|
||||
"big5-hkscs-2001",
|
||||
"big5-hkscs:unicode3.0",
|
||||
"big5hkscs" // Linux alias
|
||||
"big5hkscs-2001",
|
||||
});
|
||||
|
||||
charset("x-Big5-Solaris", "Big5_Solaris",
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user