# HG changeset patch # User duke # Date 1499269325 -7200 # Node ID 3ea0814d38859efc0ee75b95d283464be4adbcbe # Parent 8370375335441c92a059b58408295330f825e02c# Parent e047ae34aacd0794c521610799e9f68bec57e217 Merge diff -r 837037533544 -r 3ea0814d3885 .hgtags-top-repo --- a/.hgtags-top-repo Thu Apr 21 15:32:48 2011 -0700 +++ b/.hgtags-top-repo Wed Jul 05 17:42:05 2017 +0200 @@ -113,3 +113,4 @@ 2fe76e73adaa5133ac559f0b3c2c0707eca04580 jdk7-b136 7654afc6a29e43cb0a1343ce7f1287bf690d5e5f jdk7-b137 fc47c97bbbd91b1f774d855c48a7e285eb1a351a jdk7-b138 +7ed6d0b9aaa12320832a7ddadb88d6d8d0dda4c1 jdk7-b139 diff -r 837037533544 -r 3ea0814d3885 hotspot/.hgtags --- a/hotspot/.hgtags Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/.hgtags Wed Jul 05 17:42:05 2017 +0200 @@ -164,3 +164,5 @@ 2dbcb4a4d8dace5fe78ceb563b134f1fb296cd8f hs21-b07 0930dc920c185afbf40fed9a655290b8e5b16783 jdk7-b138 0930dc920c185afbf40fed9a655290b8e5b16783 hs21-b08 +611e19a16519d6fb5deea9ab565336e6e6ee475d jdk7-b139 +611e19a16519d6fb5deea9ab565336e6e6ee475d hs21-b09 diff -r 837037533544 -r 3ea0814d3885 hotspot/make/hotspot_version --- a/hotspot/make/hotspot_version Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/make/hotspot_version Wed Jul 05 17:42:05 2017 +0200 @@ -35,7 +35,7 @@ HS_MAJOR_VER=21 HS_MINOR_VER=0 -HS_BUILD_NUMBER=09 +HS_BUILD_NUMBER=10 JDK_MAJOR_VER=1 JDK_MINOR_VER=7 diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/sparc/vm/assembler_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -4257,34 +4257,14 @@ /////////////////////////////////////////////////////////////////////////////////// #ifndef SERIALGC -static uint num_stores = 0; -static uint num_null_pre_stores = 0; - -static void count_null_pre_vals(void* pre_val) { - num_stores++; - if (pre_val == NULL) num_null_pre_stores++; - if ((num_stores % 1000000) == 0) { - tty->print_cr(UINT32_FORMAT " stores, " UINT32_FORMAT " (%5.2f%%) with null pre-vals.", - num_stores, num_null_pre_stores, - 100.0*(float)num_null_pre_stores/(float)num_stores); - } -} - -static address satb_log_enqueue_with_frame = 0; -static u_char* satb_log_enqueue_with_frame_end = 0; - -static address satb_log_enqueue_frameless = 0; -static u_char* satb_log_enqueue_frameless_end = 0; +static address satb_log_enqueue_with_frame = NULL; +static u_char* satb_log_enqueue_with_frame_end = NULL; + +static address satb_log_enqueue_frameless = NULL; +static u_char* satb_log_enqueue_frameless_end = NULL; static int EnqueueCodeSize = 128 DEBUG_ONLY( + 256); // Instructions? -// The calls to this don't work. We'd need to do a fair amount of work to -// make it work. -static void check_index(int ind) { - assert(0 <= ind && ind <= 64*K && ((ind % oopSize) == 0), - "Invariants."); -} - static void generate_satb_log_enqueue(bool with_frame) { BufferBlob* bb = BufferBlob::create("enqueue_with_frame", EnqueueCodeSize); CodeBuffer buf(bb); @@ -4388,13 +4368,27 @@ } } -void MacroAssembler::g1_write_barrier_pre(Register obj, Register index, int offset, Register tmp, bool preserve_o_regs) { - assert(offset == 0 || index == noreg, "choose one"); - - if (G1DisablePreBarrier) return; - // satb_log_barrier(tmp, obj, offset, preserve_o_regs); +void MacroAssembler::g1_write_barrier_pre(Register obj, + Register index, + int offset, + Register pre_val, + Register tmp, + bool preserve_o_regs) { Label filtered; - // satb_log_barrier_work0(tmp, filtered); + + if (obj == noreg) { + // We are not loading the previous value so make + // sure that we don't trash the value in pre_val + // with the code below. + assert_different_registers(pre_val, tmp); + } else { + // We will be loading the previous value + // in this code so... + assert(offset == 0 || index == noreg, "choose one"); + assert(pre_val == noreg, "check this code"); + } + + // Is marking active? if (in_bytes(PtrQueue::byte_width_of_active()) == 4) { ld(G2, in_bytes(JavaThread::satb_mark_queue_offset() + @@ -4413,61 +4407,46 @@ br_on_reg_cond(rc_z, /*annul*/false, Assembler::pt, tmp, filtered); delayed() -> nop(); - // satb_log_barrier_work1(tmp, offset); - if (index == noreg) { - if (Assembler::is_simm13(offset)) { - load_heap_oop(obj, offset, tmp); + // Do we need to load the previous value? + if (obj != noreg) { + // Load the previous value... + if (index == noreg) { + if (Assembler::is_simm13(offset)) { + load_heap_oop(obj, offset, tmp); + } else { + set(offset, tmp); + load_heap_oop(obj, tmp, tmp); + } } else { - set(offset, tmp); - load_heap_oop(obj, tmp, tmp); + load_heap_oop(obj, index, tmp); } - } else { - load_heap_oop(obj, index, tmp); + // Previous value has been loaded into tmp + pre_val = tmp; } - // satb_log_barrier_work2(obj, tmp, offset); - - // satb_log_barrier_work3(tmp, filtered, preserve_o_regs); - - const Register pre_val = tmp; - - if (G1SATBBarrierPrintNullPreVals) { - save_frame(0); - mov(pre_val, O0); - // Save G-regs that target may use. - mov(G1, L1); - mov(G2, L2); - mov(G3, L3); - mov(G4, L4); - mov(G5, L5); - call(CAST_FROM_FN_PTR(address, &count_null_pre_vals)); - delayed()->nop(); - // Restore G-regs that target may have used. - mov(L1, G1); - mov(L2, G2); - mov(L3, G3); - mov(L4, G4); - mov(L5, G5); - restore(G0, G0, G0); - } - + assert(pre_val != noreg, "must have a real register"); + + // Is the previous value null? // Check on whether to annul. br_on_reg_cond(rc_z, /*annul*/false, Assembler::pt, pre_val, filtered); delayed() -> nop(); // OK, it's not filtered, so we'll need to call enqueue. In the normal - // case, pre_val will be a scratch G-reg, but there's some cases in which - // it's an O-reg. In the first case, do a normal call. In the latter, - // do a save here and call the frameless version. + // case, pre_val will be a scratch G-reg, but there are some cases in + // which it's an O-reg. In the first case, do a normal call. In the + // latter, do a save here and call the frameless version. guarantee(pre_val->is_global() || pre_val->is_out(), "Or we need to think harder."); + if (pre_val->is_global() && !preserve_o_regs) { - generate_satb_log_enqueue_if_necessary(true); // with frame. + generate_satb_log_enqueue_if_necessary(true); // with frame + call(satb_log_enqueue_with_frame); delayed()->mov(pre_val, O0); } else { - generate_satb_log_enqueue_if_necessary(false); // with frameless. + generate_satb_log_enqueue_if_necessary(false); // frameless + save_frame(0); call(satb_log_enqueue_frameless); delayed()->mov(pre_val->after_save(), O0); @@ -4614,7 +4593,6 @@ MacroAssembler* post_filter_masm = this; if (new_val == G0) return; - if (G1DisablePostBarrier) return; G1SATBCardTableModRefBS* bs = (G1SATBCardTableModRefBS*) Universe::heap()->barrier_set(); assert(bs->kind() == BarrierSet::G1SATBCT || @@ -4626,6 +4604,7 @@ #else srl(tmp, HeapRegion::LogOfHRGrainBytes, tmp); #endif + if (G1PrintCTFilterStats) { guarantee(tmp->is_global(), "Or stats won't work..."); // This is a sleazy hack: I'm temporarily hijacking G2, which I diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/sparc/vm/assembler_sparc.hpp --- a/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -2210,15 +2210,11 @@ void card_write_barrier_post(Register store_addr, Register new_val, Register tmp); #ifndef SERIALGC - // Array store and offset - void g1_write_barrier_pre(Register obj, Register index, int offset, Register tmp, bool preserve_o_regs); - + // General G1 pre-barrier generator. + void g1_write_barrier_pre(Register obj, Register index, int offset, Register pre_val, Register tmp, bool preserve_o_regs); + + // General G1 post-barrier generator void g1_write_barrier_post(Register store_addr, Register new_val, Register tmp); - - // May do filtering, depending on the boolean arguments. - void g1_card_table_write(jbyte* byte_map_base, - Register tmp, Register obj, Register new_val, - bool region_filter, bool null_filter); #endif // SERIALGC // pushes double TOS element of FPU stack on CPU stack; pops from FPU stack diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -408,13 +408,20 @@ #ifndef SERIALGC void G1PreBarrierStub::emit_code(LIR_Assembler* ce) { + // At this point we know that marking is in progress. + // If do_load() is true then we have to emit the + // load of the previous value; otherwise it has already + // been loaded into _pre_val. + __ bind(_entry); assert(pre_val()->is_register(), "Precondition."); - Register pre_val_reg = pre_val()->as_register(); - ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/); + if (do_load()) { + ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/); + } + if (__ is_in_wdisp16_range(_continuation)) { __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, pre_val_reg, _continuation); @@ -431,6 +438,96 @@ } +void G1UnsafeGetObjSATBBarrierStub::emit_code(LIR_Assembler* ce) { + // At this point we know that offset == referent_offset. + // + // So we might have to emit: + // if (src == null) goto continuation. + // + // and we definitely have to emit: + // if (klass(src).reference_type == REF_NONE) goto continuation + // if (!marking_active) goto continuation + // if (pre_val == null) goto continuation + // call pre_barrier(pre_val) + // goto continuation + // + __ bind(_entry); + + assert(src()->is_register(), "sanity"); + Register src_reg = src()->as_register(); + + if (gen_src_check()) { + // The original src operand was not a constant. + // Generate src == null? + if (__ is_in_wdisp16_range(_continuation)) { + __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, + src_reg, _continuation); + } else { + __ cmp(src_reg, G0); + __ brx(Assembler::equal, false, Assembler::pt, _continuation); + } + __ delayed()->nop(); + } + + // Generate src->_klass->_reference_type() == REF_NONE)? + assert(tmp()->is_register(), "sanity"); + Register tmp_reg = tmp()->as_register(); + + __ load_klass(src_reg, tmp_reg); + + Address ref_type_adr(tmp_reg, instanceKlass::reference_type_offset_in_bytes() + sizeof(oopDesc)); + __ ld(ref_type_adr, tmp_reg); + + if (__ is_in_wdisp16_range(_continuation)) { + __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, + tmp_reg, _continuation); + } else { + __ cmp(tmp_reg, G0); + __ brx(Assembler::equal, false, Assembler::pt, _continuation); + } + __ delayed()->nop(); + + // Is marking active? + assert(thread()->is_register(), "precondition"); + Register thread_reg = thread()->as_pointer_register(); + + Address in_progress(thread_reg, in_bytes(JavaThread::satb_mark_queue_offset() + + PtrQueue::byte_offset_of_active())); + + if (in_bytes(PtrQueue::byte_width_of_active()) == 4) { + __ ld(in_progress, tmp_reg); + } else { + assert(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption"); + __ ldsb(in_progress, tmp_reg); + } + if (__ is_in_wdisp16_range(_continuation)) { + __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, + tmp_reg, _continuation); + } else { + __ cmp(tmp_reg, G0); + __ brx(Assembler::equal, false, Assembler::pt, _continuation); + } + __ delayed()->nop(); + + // val == null? + assert(val()->is_register(), "Precondition."); + Register val_reg = val()->as_register(); + + if (__ is_in_wdisp16_range(_continuation)) { + __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, + val_reg, _continuation); + } else { + __ cmp(val_reg, G0); + __ brx(Assembler::equal, false, Assembler::pt, _continuation); + } + __ delayed()->nop(); + + __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_pre_barrier_slow_id)); + __ delayed()->mov(val_reg, G4); + __ br(Assembler::always, false, Assembler::pt, _continuation); + __ delayed()->nop(); +} + jbyte* G1PostBarrierStub::_byte_map_base = NULL; jbyte* G1PostBarrierStub::byte_map_base_slow() { diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -387,7 +387,8 @@ if (obj_store) { // Needs GC write barriers. - pre_barrier(LIR_OprFact::address(array_addr), false, NULL); + pre_barrier(LIR_OprFact::address(array_addr), LIR_OprFact::illegalOpr /* pre_val */, + true /* do_load */, false /* patch */, NULL); } __ move(value.result(), array_addr, null_check_info); if (obj_store) { @@ -687,7 +688,8 @@ __ add(obj.result(), offset.result(), addr); if (type == objectType) { // Write-barrier needed for Object fields. - pre_barrier(addr, false, NULL); + pre_barrier(addr, LIR_OprFact::illegalOpr /* pre_val */, + true /* do_load */, false /* patch */, NULL); } if (type == objectType) @@ -1187,7 +1189,8 @@ } if (is_obj) { - pre_barrier(LIR_OprFact::address(addr), false, NULL); + pre_barrier(LIR_OprFact::address(addr), LIR_OprFact::illegalOpr /* pre_val */, + true /* do_load */, false /* patch */, NULL); // _bs->c1_write_barrier_pre(this, LIR_OprFact::address(addr)); } __ move(data, addr); diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -551,6 +551,26 @@ return NULL; } +address InterpreterGenerator::generate_Reference_get_entry(void) { +#ifndef SERIALGC + if (UseG1GC) { + // We need to generate have a routine that generates code to: + // * load the value in the referent field + // * passes that value to the pre-barrier. + // + // In the case of G1 this will record the value of the + // referent in an SATB buffer if marking is active. + // This will cause concurrent marking to mark the referent + // field as live. + Unimplemented(); + } +#endif // SERIALGC + + // If G1 is not enabled then attempt to go through the accessor entry point + // Reference.get is an accessor + return generate_accessor_entry(); +} + // // Interpreter stub for calling a native method. (C++ interpreter) // This sets up a somewhat different looking stack for calling the native method diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/sparc/vm/interpreterGenerator_sparc.hpp --- a/hotspot/src/cpu/sparc/vm/interpreterGenerator_sparc.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/sparc/vm/interpreterGenerator_sparc.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,6 +36,7 @@ address generate_math_entry(AbstractInterpreter::MethodKind kind); address generate_empty_entry(void); address generate_accessor_entry(void); + address generate_Reference_get_entry(void); void lock_method(void); void save_native_result(void); void restore_native_result(void); diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -407,6 +407,8 @@ case Interpreter::java_lang_math_abs : break; case Interpreter::java_lang_math_log : break; case Interpreter::java_lang_math_log10 : break; + case Interpreter::java_lang_ref_reference_get + : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break; default : ShouldNotReachHere(); break; } diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -763,6 +763,87 @@ return NULL; } +// Method entry for java.lang.ref.Reference.get. +address InterpreterGenerator::generate_Reference_get_entry(void) { +#ifndef SERIALGC + // Code: _aload_0, _getfield, _areturn + // parameter size = 1 + // + // The code that gets generated by this routine is split into 2 parts: + // 1. The "intrinsified" code for G1 (or any SATB based GC), + // 2. The slow path - which is an expansion of the regular method entry. + // + // Notes:- + // * In the G1 code we do not check whether we need to block for + // a safepoint. If G1 is enabled then we must execute the specialized + // code for Reference.get (except when the Reference object is null) + // so that we can log the value in the referent field with an SATB + // update buffer. + // If the code for the getfield template is modified so that the + // G1 pre-barrier code is executed when the current method is + // Reference.get() then going through the normal method entry + // will be fine. + // * The G1 code can, however, check the receiver object (the instance + // of java.lang.Reference) and jump to the slow path if null. If the + // Reference object is null then we obviously cannot fetch the referent + // and so we don't need to call the G1 pre-barrier. Thus we can use the + // regular method entry code to generate the NPE. + // + // This code is based on generate_accessor_enty. + + address entry = __ pc(); + + const int referent_offset = java_lang_ref_Reference::referent_offset; + guarantee(referent_offset > 0, "referent offset not initialized"); + + if (UseG1GC) { + Label slow_path; + + // In the G1 code we don't check if we need to reach a safepoint. We + // continue and the thread will safepoint at the next bytecode dispatch. + + // Check if local 0 != NULL + // If the receiver is null then it is OK to jump to the slow path. + __ ld_ptr(Gargs, G0, Otos_i ); // get local 0 + __ tst(Otos_i); // check if local 0 == NULL and go the slow path + __ brx(Assembler::zero, false, Assembler::pn, slow_path); + __ delayed()->nop(); + + + // Load the value of the referent field. + if (Assembler::is_simm13(referent_offset)) { + __ load_heap_oop(Otos_i, referent_offset, Otos_i); + } else { + __ set(referent_offset, G3_scratch); + __ load_heap_oop(Otos_i, G3_scratch, Otos_i); + } + + // Generate the G1 pre-barrier code to log the value of + // the referent field in an SATB buffer. Note with + // these parameters the pre-barrier does not generate + // the load of the previous value + + __ g1_write_barrier_pre(noreg /* obj */, noreg /* index */, 0 /* offset */, + Otos_i /* pre_val */, + G3_scratch /* tmp */, + true /* preserve_o_regs */); + + // _areturn + __ retl(); // return from leaf routine + __ delayed()->mov(O5_savedSP, SP); + + // Generate regular method entry + __ bind(slow_path); + (void) generate_normal_entry(false); + return entry; + } +#endif // SERIALGC + + // If G1 is not enabled then attempt to go through the accessor entry point + // Reference.get is an accessor + return generate_accessor_entry(); +} + // // Interpreter stub for calling a native method. (asm interpreter) // This sets up a somewhat different looking stack for calling the native method diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -57,7 +57,11 @@ case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: { - __ g1_write_barrier_pre( base, index, offset, tmp, /*preserve_o_regs*/true); + // Load and record the previous value. + __ g1_write_barrier_pre(base, index, offset, + noreg /* pre_val */, + tmp, true /*preserve_o_regs*/); + if (index == noreg ) { assert(Assembler::is_simm13(offset), "fix this code"); __ store_heap_oop(val, base, offset); diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/x86/vm/assembler_x86.cpp --- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -6902,26 +6902,39 @@ #ifndef SERIALGC void MacroAssembler::g1_write_barrier_pre(Register obj, -#ifndef _LP64 + Register pre_val, Register thread, -#endif Register tmp, - Register tmp2, - bool tosca_live) { - LP64_ONLY(Register thread = r15_thread;) + bool tosca_live, + bool expand_call) { + + // If expand_call is true then we expand the call_VM_leaf macro + // directly to skip generating the check by + // InterpreterMacroAssembler::call_VM_leaf_base that checks _last_sp. + +#ifdef _LP64 + assert(thread == r15_thread, "must be"); +#endif // _LP64 + + Label done; + Label runtime; + + assert(pre_val != noreg, "check this code"); + + if (obj != noreg) { + assert_different_registers(obj, pre_val, tmp); + assert(pre_val != rax, "check this code"); + } + Address in_progress(thread, in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_active())); - Address index(thread, in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_index())); Address buffer(thread, in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_buf())); - Label done; - Label runtime; - - // if (!marking_in_progress) goto done; + // Is marking active? if (in_bytes(PtrQueue::byte_width_of_active()) == 4) { cmpl(in_progress, 0); } else { @@ -6930,65 +6943,92 @@ } jcc(Assembler::equal, done); - // if (x.f == NULL) goto done; -#ifdef _LP64 - load_heap_oop(tmp2, Address(obj, 0)); -#else - movptr(tmp2, Address(obj, 0)); -#endif - cmpptr(tmp2, (int32_t) NULL_WORD); + // Do we need to load the previous value? + if (obj != noreg) { + load_heap_oop(pre_val, Address(obj, 0)); + } + + // Is the previous value null? + cmpptr(pre_val, (int32_t) NULL_WORD); jcc(Assembler::equal, done); // Can we store original value in the thread's buffer? - -#ifdef _LP64 - movslq(tmp, index); - cmpq(tmp, 0); -#else - cmpl(index, 0); -#endif - jcc(Assembler::equal, runtime); -#ifdef _LP64 - subq(tmp, wordSize); - movl(index, tmp); - addq(tmp, buffer); -#else - subl(index, wordSize); - movl(tmp, buffer); - addl(tmp, index); -#endif - movptr(Address(tmp, 0), tmp2); + // Is index == 0? + // (The index field is typed as size_t.) + + movptr(tmp, index); // tmp := *index_adr + cmpptr(tmp, 0); // tmp == 0? + jcc(Assembler::equal, runtime); // If yes, goto runtime + + subptr(tmp, wordSize); // tmp := tmp - wordSize + movptr(index, tmp); // *index_adr := tmp + addptr(tmp, buffer); // tmp := tmp + *buffer_adr + + // Record the previous value + movptr(Address(tmp, 0), pre_val); jmp(done); + bind(runtime); // save the live input values if(tosca_live) push(rax); - push(obj); -#ifdef _LP64 - call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), tmp2, r15_thread); -#else - push(thread); - call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), tmp2, thread); - pop(thread); -#endif - pop(obj); + + if (obj != noreg && obj != rax) + push(obj); + + if (pre_val != rax) + push(pre_val); + + // Calling the runtime using the regular call_VM_leaf mechanism generates + // code (generated by InterpreterMacroAssember::call_VM_leaf_base) + // that checks that the *(ebp+frame::interpreter_frame_last_sp) == NULL. + // + // If we care generating the pre-barrier without a frame (e.g. in the + // intrinsified Reference.get() routine) then ebp might be pointing to + // the caller frame and so this check will most likely fail at runtime. + // + // Expanding the call directly bypasses the generation of the check. + // So when we do not have have a full interpreter frame on the stack + // expand_call should be passed true. + + NOT_LP64( push(thread); ) + + if (expand_call) { + LP64_ONLY( assert(pre_val != c_rarg1, "smashed arg"); ) + pass_arg1(this, thread); + pass_arg0(this, pre_val); + MacroAssembler::call_VM_leaf_base(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), 2); + } else { + call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), pre_val, thread); + } + + NOT_LP64( pop(thread); ) + + // save the live input values + if (pre_val != rax) + pop(pre_val); + + if (obj != noreg && obj != rax) + pop(obj); + if(tosca_live) pop(rax); + bind(done); - } void MacroAssembler::g1_write_barrier_post(Register store_addr, Register new_val, -#ifndef _LP64 Register thread, -#endif Register tmp, Register tmp2) { - - LP64_ONLY(Register thread = r15_thread;) +#ifdef _LP64 + assert(thread == r15_thread, "must be"); +#endif // _LP64 + Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_index())); Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_buf())); + BarrierSet* bs = Universe::heap()->barrier_set(); CardTableModRefBS* ct = (CardTableModRefBS*)bs; Label done; @@ -7067,7 +7107,6 @@ pop(store_addr); bind(done); - } #endif // SERIALGC diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/x86/vm/assembler_x86.hpp --- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -1453,6 +1453,7 @@ class MacroAssembler: public Assembler { friend class LIR_Assembler; friend class Runtime1; // as_Address() + protected: Address as_Address(AddressLiteral adr); @@ -1674,21 +1675,22 @@ void store_check(Register obj); // store check for obj - register is destroyed afterwards void store_check(Register obj, Address dst); // same as above, dst is exact store location (reg. is destroyed) +#ifndef SERIALGC + void g1_write_barrier_pre(Register obj, -#ifndef _LP64 + Register pre_val, Register thread, -#endif Register tmp, - Register tmp2, - bool tosca_live); + bool tosca_live, + bool expand_call); + void g1_write_barrier_post(Register store_addr, Register new_val, -#ifndef _LP64 Register thread, -#endif Register tmp, Register tmp2); +#endif // SERIALGC // split store_check(Register obj) to enhance instruction interleaving void store_check_part_1(Register obj); diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp --- a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -466,15 +466,19 @@ #ifndef SERIALGC void G1PreBarrierStub::emit_code(LIR_Assembler* ce) { - - // At this point we know that marking is in progress + // At this point we know that marking is in progress. + // If do_load() is true then we have to emit the + // load of the previous value; otherwise it has already + // been loaded into _pre_val. __ bind(_entry); assert(pre_val()->is_register(), "Precondition."); Register pre_val_reg = pre_val()->as_register(); - ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/); + if (do_load()) { + ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/); + } __ cmpptr(pre_val_reg, (int32_t) NULL_WORD); __ jcc(Assembler::equal, _continuation); @@ -484,6 +488,68 @@ } +void G1UnsafeGetObjSATBBarrierStub::emit_code(LIR_Assembler* ce) { + // At this point we know that offset == referent_offset. + // + // So we might have to emit: + // if (src == null) goto continuation. + // + // and we definitely have to emit: + // if (klass(src).reference_type == REF_NONE) goto continuation + // if (!marking_active) goto continuation + // if (pre_val == null) goto continuation + // call pre_barrier(pre_val) + // goto continuation + // + __ bind(_entry); + + assert(src()->is_register(), "sanity"); + Register src_reg = src()->as_register(); + + if (gen_src_check()) { + // The original src operand was not a constant. + // Generate src == null? + __ cmpptr(src_reg, (int32_t) NULL_WORD); + __ jcc(Assembler::equal, _continuation); + } + + // Generate src->_klass->_reference_type == REF_NONE)? + assert(tmp()->is_register(), "sanity"); + Register tmp_reg = tmp()->as_register(); + + __ load_klass(tmp_reg, src_reg); + + Address ref_type_adr(tmp_reg, instanceKlass::reference_type_offset_in_bytes() + sizeof(oopDesc)); + __ cmpl(ref_type_adr, REF_NONE); + __ jcc(Assembler::equal, _continuation); + + // Is marking active? + assert(thread()->is_register(), "precondition"); + Register thread_reg = thread()->as_pointer_register(); + + Address in_progress(thread_reg, in_bytes(JavaThread::satb_mark_queue_offset() + + PtrQueue::byte_offset_of_active())); + + if (in_bytes(PtrQueue::byte_width_of_active()) == 4) { + __ cmpl(in_progress, 0); + } else { + assert(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption"); + __ cmpb(in_progress, 0); + } + __ jcc(Assembler::equal, _continuation); + + // val == null? + assert(val()->is_register(), "Precondition."); + Register val_reg = val()->as_register(); + + __ cmpptr(val_reg, (int32_t) NULL_WORD); + __ jcc(Assembler::equal, _continuation); + + ce->store_parameter(val()->as_register(), 0); + __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::g1_pre_barrier_slow_id))); + __ jmp(_continuation); +} + jbyte* G1PostBarrierStub::_byte_map_base = NULL; jbyte* G1PostBarrierStub::byte_map_base_slow() { diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp --- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -326,7 +326,8 @@ if (obj_store) { // Needs GC write barriers. - pre_barrier(LIR_OprFact::address(array_addr), false, NULL); + pre_barrier(LIR_OprFact::address(array_addr), LIR_OprFact::illegalOpr /* pre_val */, + true /* do_load */, false /* patch */, NULL); __ move(value.result(), array_addr, null_check_info); // Seems to be a precise post_barrier(LIR_OprFact::address(array_addr), value.result()); @@ -794,7 +795,8 @@ if (type == objectType) { // Write-barrier needed for Object fields. // Do the pre-write barrier, if any. - pre_barrier(addr, false, NULL); + pre_barrier(addr, LIR_OprFact::illegalOpr /* pre_val */, + true /* do_load */, false /* patch */, NULL); } LIR_Opr ill = LIR_OprFact::illegalOpr; // for convenience @@ -1339,7 +1341,8 @@ bool is_obj = (type == T_ARRAY || type == T_OBJECT); if (is_obj) { // Do the pre-write barrier, if any. - pre_barrier(LIR_OprFact::address(addr), false, NULL); + pre_barrier(LIR_OprFact::address(addr), LIR_OprFact::illegalOpr /* pre_val */, + true /* do_load */, false /* patch */, NULL); __ move(data, addr); assert(src->is_register(), "must be register"); // Seems to be a precise address diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/x86/vm/cppInterpreterGenerator_x86.hpp --- a/hotspot/src/cpu/x86/vm/cppInterpreterGenerator_x86.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/x86/vm/cppInterpreterGenerator_x86.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,7 @@ address generate_math_entry(AbstractInterpreter::MethodKind kind); address generate_empty_entry(void); address generate_accessor_entry(void); + address generate_Reference_get_entry(void); void lock_method(void); void generate_stack_overflow_check(void); diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp --- a/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -936,6 +936,26 @@ } +address InterpreterGenerator::generate_Reference_get_entry(void) { +#ifndef SERIALGC + if (UseG1GC) { + // We need to generate have a routine that generates code to: + // * load the value in the referent field + // * passes that value to the pre-barrier. + // + // In the case of G1 this will record the value of the + // referent in an SATB buffer if marking is active. + // This will cause concurrent marking to mark the referent + // field as live. + Unimplemented(); + } +#endif // SERIALGC + + // If G1 is not enabled then attempt to go through the accessor entry point + // Reference.get is an accessor + return generate_accessor_entry(); +} + // // C++ Interpreter stub for calling a native method. // This sets up a somewhat different looking stack for calling the native method @@ -2210,6 +2230,8 @@ case Interpreter::java_lang_math_log : // fall thru case Interpreter::java_lang_math_log10 : // fall thru case Interpreter::java_lang_math_sqrt : entry_point = ((InterpreterGenerator*)this)->generate_math_entry(kind); break; + case Interpreter::java_lang_ref_reference_get + : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break; default : ShouldNotReachHere(); break; } diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/x86/vm/interpreterGenerator_x86.hpp --- a/hotspot/src/cpu/x86/vm/interpreterGenerator_x86.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/x86/vm/interpreterGenerator_x86.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,7 @@ address generate_math_entry(AbstractInterpreter::MethodKind kind); address generate_empty_entry(void); address generate_accessor_entry(void); + address generate_Reference_get_entry(); void lock_method(void); void generate_stack_overflow_check(void); diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -776,6 +776,98 @@ } +// Method entry for java.lang.ref.Reference.get. +address InterpreterGenerator::generate_Reference_get_entry(void) { +#ifndef SERIALGC + // Code: _aload_0, _getfield, _areturn + // parameter size = 1 + // + // The code that gets generated by this routine is split into 2 parts: + // 1. The "intrinsified" code for G1 (or any SATB based GC), + // 2. The slow path - which is an expansion of the regular method entry. + // + // Notes:- + // * In the G1 code we do not check whether we need to block for + // a safepoint. If G1 is enabled then we must execute the specialized + // code for Reference.get (except when the Reference object is null) + // so that we can log the value in the referent field with an SATB + // update buffer. + // If the code for the getfield template is modified so that the + // G1 pre-barrier code is executed when the current method is + // Reference.get() then going through the normal method entry + // will be fine. + // * The G1 code below can, however, check the receiver object (the instance + // of java.lang.Reference) and jump to the slow path if null. If the + // Reference object is null then we obviously cannot fetch the referent + // and so we don't need to call the G1 pre-barrier. Thus we can use the + // regular method entry code to generate the NPE. + // + // This code is based on generate_accessor_enty. + + // rbx,: methodOop + // rcx: receiver (preserve for slow entry into asm interpreter) + + // rsi: senderSP must preserved for slow path, set SP to it on fast path + + address entry = __ pc(); + + const int referent_offset = java_lang_ref_Reference::referent_offset; + guarantee(referent_offset > 0, "referent offset not initialized"); + + if (UseG1GC) { + Label slow_path; + + // Check if local 0 != NULL + // If the receiver is null then it is OK to jump to the slow path. + __ movptr(rax, Address(rsp, wordSize)); + __ testptr(rax, rax); + __ jcc(Assembler::zero, slow_path); + + // rax: local 0 (must be preserved across the G1 barrier call) + // + // rbx: method (at this point it's scratch) + // rcx: receiver (at this point it's scratch) + // rdx: scratch + // rdi: scratch + // + // rsi: sender sp + + // Preserve the sender sp in case the pre-barrier + // calls the runtime + __ push(rsi); + + // Load the value of the referent field. + const Address field_address(rax, referent_offset); + __ movptr(rax, field_address); + + // Generate the G1 pre-barrier code to log the value of + // the referent field in an SATB buffer. + __ get_thread(rcx); + __ g1_write_barrier_pre(noreg /* obj */, + rax /* pre_val */, + rcx /* thread */, + rbx /* tmp */, + true /* tosca_save */, + true /* expand_call */); + + // _areturn + __ pop(rsi); // get sender sp + __ pop(rdi); // get return address + __ mov(rsp, rsi); // set sp to sender sp + __ jmp(rdi); + + __ bind(slow_path); + (void) generate_normal_entry(false); + + return entry; + } +#endif // SERIALGC + + // If G1 is not enabled then attempt to go through the accessor entry point + // Reference.get is an accessor + return generate_accessor_entry(); +} + // // Interpreter stub for calling a native method. (asm interpreter) // This sets up a somewhat different looking stack for calling the native method @@ -1444,6 +1536,8 @@ case Interpreter::java_lang_math_log : // fall thru case Interpreter::java_lang_math_log10 : // fall thru case Interpreter::java_lang_math_sqrt : entry_point = ((InterpreterGenerator*)this)->generate_math_entry(kind); break; + case Interpreter::java_lang_ref_reference_get + : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break; default : ShouldNotReachHere(); break; } diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -757,6 +757,95 @@ return entry_point; } +// Method entry for java.lang.ref.Reference.get. +address InterpreterGenerator::generate_Reference_get_entry(void) { +#ifndef SERIALGC + // Code: _aload_0, _getfield, _areturn + // parameter size = 1 + // + // The code that gets generated by this routine is split into 2 parts: + // 1. The "intrinsified" code for G1 (or any SATB based GC), + // 2. The slow path - which is an expansion of the regular method entry. + // + // Notes:- + // * In the G1 code we do not check whether we need to block for + // a safepoint. If G1 is enabled then we must execute the specialized + // code for Reference.get (except when the Reference object is null) + // so that we can log the value in the referent field with an SATB + // update buffer. + // If the code for the getfield template is modified so that the + // G1 pre-barrier code is executed when the current method is + // Reference.get() then going through the normal method entry + // will be fine. + // * The G1 code can, however, check the receiver object (the instance + // of java.lang.Reference) and jump to the slow path if null. If the + // Reference object is null then we obviously cannot fetch the referent + // and so we don't need to call the G1 pre-barrier. Thus we can use the + // regular method entry code to generate the NPE. + // + // This code is based on generate_accessor_enty. + // + // rbx: methodOop + + // r13: senderSP must preserve for slow path, set SP to it on fast path + + address entry = __ pc(); + + const int referent_offset = java_lang_ref_Reference::referent_offset; + guarantee(referent_offset > 0, "referent offset not initialized"); + + if (UseG1GC) { + Label slow_path; + // rbx: method + + // Check if local 0 != NULL + // If the receiver is null then it is OK to jump to the slow path. + __ movptr(rax, Address(rsp, wordSize)); + + __ testptr(rax, rax); + __ jcc(Assembler::zero, slow_path); + + // rax: local 0 + // rbx: method (but can be used as scratch now) + // rdx: scratch + // rdi: scratch + + // Generate the G1 pre-barrier code to log the value of + // the referent field in an SATB buffer. + + // Load the value of the referent field. + const Address field_address(rax, referent_offset); + __ load_heap_oop(rax, field_address); + + // Generate the G1 pre-barrier code to log the value of + // the referent field in an SATB buffer. + __ g1_write_barrier_pre(noreg /* obj */, + rax /* pre_val */, + r15_thread /* thread */, + rbx /* tmp */, + true /* tosca_live */, + true /* expand_call */); + + // _areturn + __ pop(rdi); // get return address + __ mov(rsp, r13); // set sp to sender sp + __ jmp(rdi); + __ ret(0); + + // generate a vanilla interpreter entry as the slow path + __ bind(slow_path); + (void) generate_normal_entry(false); + + return entry; + } +#endif // SERIALGC + + // If G1 is not enabled then attempt to go through the accessor entry point + // Reference.get is an accessor + return generate_accessor_entry(); +} + + // Interpreter stub for calling a native method. (asm interpreter) // This sets up a somewhat different looking stack for calling the // native method than the typical interpreter frame setup. @@ -1463,6 +1552,8 @@ case Interpreter::java_lang_math_log : // fall thru case Interpreter::java_lang_math_log10 : // fall thru case Interpreter::java_lang_math_sqrt : entry_point = ((InterpreterGenerator*) this)->generate_math_entry(kind); break; + case Interpreter::java_lang_ref_reference_get + : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break; default : ShouldNotReachHere(); break; } diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -140,7 +140,12 @@ } __ get_thread(rcx); __ save_bcp(); - __ g1_write_barrier_pre(rdx, rcx, rsi, rbx, val != noreg); + __ g1_write_barrier_pre(rdx /* obj */, + rbx /* pre_val */, + rcx /* thread */, + rsi /* tmp */, + val != noreg /* tosca_live */, + false /* expand_call */); // Do the actual store // noreg means NULL @@ -149,7 +154,11 @@ // No post barrier for NULL } else { __ movl(Address(rdx, 0), val); - __ g1_write_barrier_post(rdx, rax, rcx, rbx, rsi); + __ g1_write_barrier_post(rdx /* store_adr */, + val /* new_val */, + rcx /* thread */, + rbx /* tmp */, + rsi /* tmp2 */); } __ restore_bcp(); diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -147,12 +147,21 @@ } else { __ leaq(rdx, obj); } - __ g1_write_barrier_pre(rdx, r8, rbx, val != noreg); + __ g1_write_barrier_pre(rdx /* obj */, + rbx /* pre_val */, + r15_thread /* thread */, + r8 /* tmp */, + val != noreg /* tosca_live */, + false /* expand_call */); if (val == noreg) { __ store_heap_oop_null(Address(rdx, 0)); } else { __ store_heap_oop(Address(rdx, 0), val); - __ g1_write_barrier_post(rdx, val, r8, rbx); + __ g1_write_barrier_post(rdx /* store_adr */, + val /* new_val */, + r15_thread /* thread */, + r8 /* tmp */, + rbx /* tmp2 */); } } diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp --- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -1302,6 +1302,26 @@ return generate_entry((address) CppInterpreter::accessor_entry); } +address InterpreterGenerator::generate_Reference_get_entry(void) { +#ifndef SERIALGC + if (UseG1GC) { + // We need to generate have a routine that generates code to: + // * load the value in the referent field + // * passes that value to the pre-barrier. + // + // In the case of G1 this will record the value of the + // referent in an SATB buffer if marking is active. + // This will cause concurrent marking to mark the referent + // field as live. + Unimplemented(); + } +#endif // SERIALGC + + // If G1 is not enabled then attempt to go through the accessor entry point + // Reference.get is an accessor + return generate_accessor_entry(); +} + address InterpreterGenerator::generate_native_entry(bool synchronized) { assert(synchronized == false, "should be"); @@ -1357,6 +1377,10 @@ entry_point = ((InterpreterGenerator*) this)->generate_math_entry(kind); break; + case Interpreter::java_lang_ref_reference_get: + entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); + break; + default: ShouldNotReachHere(); } diff -r 837037533544 -r 3ea0814d3885 hotspot/src/cpu/zero/vm/interpreterGenerator_zero.hpp --- a/hotspot/src/cpu/zero/vm/interpreterGenerator_zero.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/cpu/zero/vm/interpreterGenerator_zero.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright 2007 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -37,6 +37,7 @@ address generate_math_entry(AbstractInterpreter::MethodKind kind); address generate_empty_entry(); address generate_accessor_entry(); + address generate_Reference_get_entry(); address generate_method_handle_entry(); #endif // CPU_ZERO_VM_INTERPRETERGENERATOR_ZERO_HPP diff -r 837037533544 -r 3ea0814d3885 hotspot/src/os/windows/vm/os_windows.cpp --- a/hotspot/src/os/windows/vm/os_windows.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/os/windows/vm/os_windows.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -921,6 +921,8 @@ HINSTANCE dbghelp; EXCEPTION_POINTERS ep; MINIDUMP_EXCEPTION_INFORMATION mei; + MINIDUMP_EXCEPTION_INFORMATION* pmei; + HANDLE hProcess = GetCurrentProcess(); DWORD processId = GetCurrentProcessId(); HANDLE dumpFile; @@ -971,17 +973,22 @@ VMError::report_coredump_status("Failed to create file for dumping", false); return; } - - ep.ContextRecord = (PCONTEXT) contextRecord; - ep.ExceptionRecord = (PEXCEPTION_RECORD) exceptionRecord; - - mei.ThreadId = GetCurrentThreadId(); - mei.ExceptionPointers = &ep; + if (exceptionRecord != NULL && contextRecord != NULL) { + ep.ContextRecord = (PCONTEXT) contextRecord; + ep.ExceptionRecord = (PEXCEPTION_RECORD) exceptionRecord; + + mei.ThreadId = GetCurrentThreadId(); + mei.ExceptionPointers = &ep; + pmei = &mei; + } else { + pmei = NULL; + } + // Older versions of dbghelp.dll (the one shipped with Win2003 for example) may not support all // the dump types we really want. If first call fails, lets fall back to just use MiniDumpWithFullMemory then. - if (_MiniDumpWriteDump(hProcess, processId, dumpFile, dumpType, &mei, NULL, NULL) == false && - _MiniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, &mei, NULL, NULL) == false) { + if (_MiniDumpWriteDump(hProcess, processId, dumpFile, dumpType, pmei, NULL, NULL) == false && + _MiniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, pmei, NULL, NULL) == false) { VMError::report_coredump_status("Call to MiniDumpWriteDump() failed", false); } else { VMError::report_coredump_status(buffer, true); diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/c1/c1_CodeStubs.hpp --- a/hotspot/src/share/vm/c1/c1_CodeStubs.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -519,42 +519,126 @@ // Code stubs for Garbage-First barriers. class G1PreBarrierStub: public CodeStub { private: + bool _do_load; LIR_Opr _addr; LIR_Opr _pre_val; LIR_PatchCode _patch_code; CodeEmitInfo* _info; public: - // pre_val (a temporary register) must be a register; + // Version that _does_ generate a load of the previous value from addr. // addr (the address of the field to be read) must be a LIR_Address + // pre_val (a temporary register) must be a register; G1PreBarrierStub(LIR_Opr addr, LIR_Opr pre_val, LIR_PatchCode patch_code, CodeEmitInfo* info) : - _addr(addr), _pre_val(pre_val), _patch_code(patch_code), _info(info) + _addr(addr), _pre_val(pre_val), _do_load(true), + _patch_code(patch_code), _info(info) { assert(_pre_val->is_register(), "should be temporary register"); assert(_addr->is_address(), "should be the address of the field"); } + // Version that _does not_ generate load of the previous value; the + // previous value is assumed to have already been loaded into pre_val. + G1PreBarrierStub(LIR_Opr pre_val) : + _addr(LIR_OprFact::illegalOpr), _pre_val(pre_val), _do_load(false), + _patch_code(lir_patch_none), _info(NULL) + { + assert(_pre_val->is_register(), "should be a register"); + } + LIR_Opr addr() const { return _addr; } LIR_Opr pre_val() const { return _pre_val; } LIR_PatchCode patch_code() const { return _patch_code; } CodeEmitInfo* info() const { return _info; } + bool do_load() const { return _do_load; } virtual void emit_code(LIR_Assembler* e); virtual void visit(LIR_OpVisitState* visitor) { - // don't pass in the code emit info since it's processed in the fast - // path - if (_info != NULL) - visitor->do_slow_case(_info); - else + if (_do_load) { + // don't pass in the code emit info since it's processed in the fast + // path + if (_info != NULL) + visitor->do_slow_case(_info); + else + visitor->do_slow_case(); + + visitor->do_input(_addr); + visitor->do_temp(_pre_val); + } else { visitor->do_slow_case(); - visitor->do_input(_addr); - visitor->do_temp(_pre_val); + visitor->do_input(_pre_val); + } } #ifndef PRODUCT virtual void print_name(outputStream* out) const { out->print("G1PreBarrierStub"); } #endif // PRODUCT }; +// This G1 barrier code stub is used in Unsafe.getObject. +// It generates a sequence of guards around the SATB +// barrier code that are used to detect when we have +// the referent field of a Reference object. +// The first check is assumed to have been generated +// in the code generated for Unsafe.getObject(). + +class G1UnsafeGetObjSATBBarrierStub: public CodeStub { + private: + LIR_Opr _val; + LIR_Opr _src; + + LIR_Opr _tmp; + LIR_Opr _thread; + + bool _gen_src_check; + + public: + // A G1 barrier that is guarded by generated guards that determine whether + // val (which is the result of Unsafe.getObject() should be recorded in an + // SATB log buffer. We could be reading the referent field of a Reference object + // using Unsafe.getObject() and we need to record the referent. + // + // * val is the operand returned by the unsafe.getObject routine. + // * src is the base object + // * tmp is a temp used to load the klass of src, and then reference type + // * thread is the thread object. + + G1UnsafeGetObjSATBBarrierStub(LIR_Opr val, LIR_Opr src, + LIR_Opr tmp, LIR_Opr thread, + bool gen_src_check) : + _val(val), _src(src), + _tmp(tmp), _thread(thread), + _gen_src_check(gen_src_check) + { + assert(_val->is_register(), "should have already been loaded"); + assert(_src->is_register(), "should have already been loaded"); + + assert(_tmp->is_register(), "should be a temporary register"); + } + + LIR_Opr val() const { return _val; } + LIR_Opr src() const { return _src; } + + LIR_Opr tmp() const { return _tmp; } + LIR_Opr thread() const { return _thread; } + + bool gen_src_check() const { return _gen_src_check; } + + virtual void emit_code(LIR_Assembler* e); + + virtual void visit(LIR_OpVisitState* visitor) { + visitor->do_slow_case(); + visitor->do_input(_val); + visitor->do_input(_src); + visitor->do_input(_thread); + + visitor->do_temp(_tmp); + } + +#ifndef PRODUCT + virtual void print_name(outputStream* out) const { out->print("G1UnsafeGetObjSATBBarrierStub"); } +#endif // PRODUCT +}; + class G1PostBarrierStub: public CodeStub { private: LIR_Opr _addr; diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/c1/c1_GraphBuilder.cpp --- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -2913,6 +2913,46 @@ block()->set_end(end); break; } + + case vmIntrinsics::_Reference_get: + { + if (UseG1GC) { + // With java.lang.ref.reference.get() we must go through the + // intrinsic - when G1 is enabled - even when get() is the root + // method of the compile so that, if necessary, the value in + // the referent field of the reference object gets recorded by + // the pre-barrier code. + // Specifically, if G1 is enabled, the value in the referent + // field is recorded by the G1 SATB pre barrier. This will + // result in the referent being marked live and the reference + // object removed from the list of discovered references during + // reference processing. + + // Set up a stream so that appending instructions works properly. + ciBytecodeStream s(scope->method()); + s.reset_to_bci(0); + scope_data()->set_stream(&s); + s.next(); + + // setup the initial block state + _block = start_block; + _state = start_block->state()->copy_for_parsing(); + _last = start_block; + load_local(objectType, 0); + + // Emit the intrinsic node. + bool result = try_inline_intrinsics(scope->method()); + if (!result) BAILOUT("failed to inline intrinsic"); + method_return(apop()); + + // connect the begin and end blocks and we're all done. + BlockEnd* end = last()->as_BlockEnd(); + block()->set_end(end); + break; + } + // Otherwise, fall thru + } + default: scope_data()->add_to_work_list(start_block); iterate_all_blocks(); @@ -3150,6 +3190,15 @@ append_unsafe_CAS(callee); return true; + case vmIntrinsics::_Reference_get: + // It is only when G1 is enabled that we absolutely + // need to use the intrinsic version of Reference.get() + // so that the value in the referent field, if necessary, + // can be registered by the pre-barrier code. + if (!UseG1GC) return false; + preserves_state = true; + break; + default : return false; // do not inline } // create intrinsic node diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/c1/c1_Instruction.cpp --- a/hotspot/src/share/vm/c1/c1_Instruction.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/c1/c1_Instruction.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -596,7 +596,7 @@ // of the inserted block, without recomputing the values of the other blocks // in the CFG. Therefore the value of "depth_first_number" in BlockBegin becomes meaningless. BlockBegin* BlockBegin::insert_block_between(BlockBegin* sux) { - BlockBegin* new_sux = new BlockBegin(-99); + BlockBegin* new_sux = new BlockBegin(end()->state()->bci()); // mark this block (special treatment when block order is computed) new_sux->set(critical_edge_split_flag); diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/c1/c1_LIRGenerator.cpp --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -1209,6 +1209,38 @@ set_no_result(x); } +// Examble: ref.get() +// Combination of LoadField and g1 pre-write barrier +void LIRGenerator::do_Reference_get(Intrinsic* x) { + + const int referent_offset = java_lang_ref_Reference::referent_offset; + guarantee(referent_offset > 0, "referent offset not initialized"); + + assert(x->number_of_arguments() == 1, "wrong type"); + + LIRItem reference(x->argument_at(0), this); + reference.load_item(); + + // need to perform the null check on the reference objecy + CodeEmitInfo* info = NULL; + if (x->needs_null_check()) { + info = state_for(x); + } + + LIR_Address* referent_field_adr = + new LIR_Address(reference.result(), referent_offset, T_OBJECT); + + LIR_Opr result = rlock_result(x); + + __ load(referent_field_adr, result, info); + + // Register the value in the referent field with the pre-barrier + pre_barrier(LIR_OprFact::illegalOpr /* addr_opr */, + result /* pre_val */, + false /* do_load */, + false /* patch */, + NULL /* info */); +} // Example: object.getClass () void LIRGenerator::do_getClass(Intrinsic* x) { @@ -1351,13 +1383,14 @@ // Various barriers -void LIRGenerator::pre_barrier(LIR_Opr addr_opr, bool patch, CodeEmitInfo* info) { +void LIRGenerator::pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val, + bool do_load, bool patch, CodeEmitInfo* info) { // Do the pre-write barrier, if any. switch (_bs->kind()) { #ifndef SERIALGC case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: - G1SATBCardTableModRef_pre_barrier(addr_opr, patch, info); + G1SATBCardTableModRef_pre_barrier(addr_opr, pre_val, do_load, patch, info); break; #endif // SERIALGC case BarrierSet::CardTableModRef: @@ -1398,9 +1431,8 @@ //////////////////////////////////////////////////////////////////////// #ifndef SERIALGC -void LIRGenerator::G1SATBCardTableModRef_pre_barrier(LIR_Opr addr_opr, bool patch, CodeEmitInfo* info) { - if (G1DisablePreBarrier) return; - +void LIRGenerator::G1SATBCardTableModRef_pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val, + bool do_load, bool patch, CodeEmitInfo* info) { // First we test whether marking is in progress. BasicType flag_type; if (in_bytes(PtrQueue::byte_width_of_active()) == 4) { @@ -1419,26 +1451,40 @@ // Read the marking-in-progress flag. LIR_Opr flag_val = new_register(T_INT); __ load(mark_active_flag_addr, flag_val); - - LIR_PatchCode pre_val_patch_code = - patch ? lir_patch_normal : lir_patch_none; - - LIR_Opr pre_val = new_register(T_OBJECT); - __ cmp(lir_cond_notEqual, flag_val, LIR_OprFact::intConst(0)); - if (!addr_opr->is_address()) { - assert(addr_opr->is_register(), "must be"); - addr_opr = LIR_OprFact::address(new LIR_Address(addr_opr, T_OBJECT)); + + LIR_PatchCode pre_val_patch_code = lir_patch_none; + + CodeStub* slow; + + if (do_load) { + assert(pre_val == LIR_OprFact::illegalOpr, "sanity"); + assert(addr_opr != LIR_OprFact::illegalOpr, "sanity"); + + if (patch) + pre_val_patch_code = lir_patch_normal; + + pre_val = new_register(T_OBJECT); + + if (!addr_opr->is_address()) { + assert(addr_opr->is_register(), "must be"); + addr_opr = LIR_OprFact::address(new LIR_Address(addr_opr, T_OBJECT)); + } + slow = new G1PreBarrierStub(addr_opr, pre_val, pre_val_patch_code, info); + } else { + assert(addr_opr == LIR_OprFact::illegalOpr, "sanity"); + assert(pre_val->is_register(), "must be"); + assert(pre_val->type() == T_OBJECT, "must be an object"); + assert(info == NULL, "sanity"); + + slow = new G1PreBarrierStub(pre_val); } - CodeStub* slow = new G1PreBarrierStub(addr_opr, pre_val, pre_val_patch_code, - info); + __ branch(lir_cond_notEqual, T_INT, slow); __ branch_destination(slow->continuation()); } void LIRGenerator::G1SATBCardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) { - if (G1DisablePostBarrier) return; - // If the "new_val" is a constant NULL, no barrier is necessary. if (new_val->is_constant() && new_val->as_constant_ptr()->as_jobject() == NULL) return; @@ -1662,6 +1708,8 @@ if (is_oop) { // Do the pre-write barrier, if any. pre_barrier(LIR_OprFact::address(address), + LIR_OprFact::illegalOpr /* pre_val */, + true /* do_load*/, needs_patching, (info ? new CodeEmitInfo(info) : NULL)); } @@ -2091,9 +2139,144 @@ off.load_item(); src.load_item(); - LIR_Opr reg = reg = rlock_result(x, x->basic_type()); + LIR_Opr reg = rlock_result(x, x->basic_type()); get_Object_unsafe(reg, src.result(), off.result(), type, x->is_volatile()); + +#ifndef SERIALGC + // We might be reading the value of the referent field of a + // Reference object in order to attach it back to the live + // object graph. If G1 is enabled then we need to record + // the value that is being returned in an SATB log buffer. + // + // We need to generate code similar to the following... + // + // if (offset == java_lang_ref_Reference::referent_offset) { + // if (src != NULL) { + // if (klass(src)->reference_type() != REF_NONE) { + // pre_barrier(..., reg, ...); + // } + // } + // } + // + // The first non-constant check of either the offset or + // the src operand will be done here; the remainder + // will take place in the generated code stub. + + if (UseG1GC && type == T_OBJECT) { + bool gen_code_stub = true; // Assume we need to generate the slow code stub. + bool gen_offset_check = true; // Assume the code stub has to generate the offset guard. + bool gen_source_check = true; // Assume the code stub has to check the src object for null. + + if (off.is_constant()) { + jlong off_con = (off.type()->is_int() ? + (jlong) off.get_jint_constant() : + off.get_jlong_constant()); + + + if (off_con != (jlong) java_lang_ref_Reference::referent_offset) { + // The constant offset is something other than referent_offset. + // We can skip generating/checking the remaining guards and + // skip generation of the code stub. + gen_code_stub = false; + } else { + // The constant offset is the same as referent_offset - + // we do not need to generate a runtime offset check. + gen_offset_check = false; + } + } + + // We don't need to generate stub if the source object is an array + if (gen_code_stub && src.type()->is_array()) { + gen_code_stub = false; + } + + if (gen_code_stub) { + // We still need to continue with the checks. + if (src.is_constant()) { + ciObject* src_con = src.get_jobject_constant(); + + if (src_con->is_null_object()) { + // The constant src object is null - We can skip + // generating the code stub. + gen_code_stub = false; + } else { + // Non-null constant source object. We still have to generate + // the slow stub - but we don't need to generate the runtime + // null object check. + gen_source_check = false; + } + } + } + + if (gen_code_stub) { + // Temoraries. + LIR_Opr src_klass = new_register(T_OBJECT); + + // Get the thread pointer for the pre-barrier + LIR_Opr thread = getThreadPointer(); + + CodeStub* stub; + + // We can have generate one runtime check here. Let's start with + // the offset check. + if (gen_offset_check) { + // if (offset == referent_offset) -> slow code stub + // If offset is an int then we can do the comparison with the + // referent_offset constant; otherwise we need to move + // referent_offset into a temporary register and generate + // a reg-reg compare. + + LIR_Opr referent_off; + + if (off.type()->is_int()) { + referent_off = LIR_OprFact::intConst(java_lang_ref_Reference::referent_offset); + } else { + assert(off.type()->is_long(), "what else?"); + referent_off = new_register(T_LONG); + __ move(LIR_OprFact::longConst(java_lang_ref_Reference::referent_offset), referent_off); + } + + __ cmp(lir_cond_equal, off.result(), referent_off); + + // Optionally generate "src == null" check. + stub = new G1UnsafeGetObjSATBBarrierStub(reg, src.result(), + src_klass, thread, + gen_source_check); + + __ branch(lir_cond_equal, as_BasicType(off.type()), stub); + } else { + if (gen_source_check) { + // offset is a const and equals referent offset + // if (source != null) -> slow code stub + __ cmp(lir_cond_notEqual, src.result(), LIR_OprFact::oopConst(NULL)); + + // Since we are generating the "if src == null" guard here, + // there is no need to generate the "src == null" check again. + stub = new G1UnsafeGetObjSATBBarrierStub(reg, src.result(), + src_klass, thread, + false); + + __ branch(lir_cond_notEqual, T_OBJECT, stub); + } else { + // We have statically determined that offset == referent_offset + // && src != null so we unconditionally branch to code stub + // to perform the guards and record reg in the SATB log buffer. + + stub = new G1UnsafeGetObjSATBBarrierStub(reg, src.result(), + src_klass, thread, + false); + + __ branch(lir_cond_always, T_ILLEGAL, stub); + } + } + + // Continuation point + __ branch_destination(stub->continuation()); + } + } +#endif // SERIALGC + if (x->is_volatile() && os::is_MP()) __ membar_acquire(); } @@ -2759,6 +2942,10 @@ do_AttemptUpdate(x); break; + case vmIntrinsics::_Reference_get: + do_Reference_get(x); + break; + default: ShouldNotReachHere(); break; } } diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/c1/c1_LIRGenerator.hpp --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -246,6 +246,7 @@ void do_AttemptUpdate(Intrinsic* x); void do_NIOCheckIndex(Intrinsic* x); void do_FPIntrinsics(Intrinsic* x); + void do_Reference_get(Intrinsic* x); void do_UnsafePrefetch(UnsafePrefetch* x, bool is_store); @@ -260,13 +261,14 @@ // generic interface - void pre_barrier(LIR_Opr addr_opr, bool patch, CodeEmitInfo* info); + void pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val, bool do_load, bool patch, CodeEmitInfo* info); void post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val); // specific implementations // pre barriers - void G1SATBCardTableModRef_pre_barrier(LIR_Opr addr_opr, bool patch, CodeEmitInfo* info); + void G1SATBCardTableModRef_pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val, + bool do_load, bool patch, CodeEmitInfo* info); // post barriers diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/classfile/classFileParser.cpp --- a/hotspot/src/share/vm/classfile/classFileParser.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/classfile/classFileParser.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -2196,11 +2196,12 @@ TRAPS) { typeArrayHandle nullHandle; int length = methods()->length(); - // If JVMTI original method ordering is enabled we have to + // If JVMTI original method ordering or sharing is enabled we have to // remember the original class file ordering. // We temporarily use the vtable_index field in the methodOop to store the // class file index, so we can read in after calling qsort. - if (JvmtiExport::can_maintain_original_method_order()) { + // Put the method ordering in the shared archive. + if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces) { for (int index = 0; index < length; index++) { methodOop m = methodOop(methods->obj_at(index)); assert(!m->valid_vtable_index(), "vtable index should not be set"); @@ -2214,8 +2215,9 @@ methods_parameter_annotations(), methods_default_annotations()); - // If JVMTI original method ordering is enabled construct int array remembering the original ordering - if (JvmtiExport::can_maintain_original_method_order()) { + // If JVMTI original method ordering or sharing is enabled construct int + // array remembering the original ordering + if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces) { typeArrayOop new_ordering = oopFactory::new_permanent_intArray(length, CHECK_(nullHandle)); typeArrayHandle method_ordering(THREAD, new_ordering); for (int index = 0; index < length; index++) { diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/classfile/systemDictionary.cpp --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -1255,6 +1255,16 @@ methodHandle m(THREAD, methodOop(methods->obj_at(index2))); m()->link_method(m, CHECK_(nh)); } + if (JvmtiExport::has_redefined_a_class()) { + // Reinitialize vtable because RedefineClasses may have changed some + // entries in this vtable for super classes so the CDS vtable might + // point to old or obsolete entries. RedefineClasses doesn't fix up + // vtables in the shared system dictionary, only the main one. + // It also redefines the itable too so fix that too. + ResourceMark rm(THREAD); + ik->vtable()->initialize_vtable(false, CHECK_(nh)); + ik->itable()->initialize_itable(false, CHECK_(nh)); + } } if (TraceClassLoading) { diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/classfile/vmSymbols.hpp --- a/hotspot/src/share/vm/classfile/vmSymbols.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -678,6 +678,10 @@ do_intrinsic(_checkIndex, java_nio_Buffer, checkIndex_name, int_int_signature, F_R) \ do_name( checkIndex_name, "checkIndex") \ \ + /* java/lang/ref/Reference */ \ + do_intrinsic(_Reference_get, java_lang_ref_Reference, get_name, void_object_signature, F_R) \ + \ + \ do_class(sun_misc_AtomicLongCSImpl, "sun/misc/AtomicLongCSImpl") \ do_intrinsic(_get_AtomicLong, sun_misc_AtomicLongCSImpl, get_name, void_long_signature, F_R) \ /* (symbols get_name and void_long_signature defined above) */ \ diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -172,7 +172,7 @@ // hash a given key (index of card_ptr) with the specified size static unsigned int hash(size_t key, size_t size) { - return (unsigned int) key % size; + return (unsigned int) (key % size); } // hash a given key (index of card_ptr) @@ -180,11 +180,11 @@ return hash(key, _n_card_counts); } - unsigned ptr_2_card_num(jbyte* card_ptr) { - return (unsigned) (card_ptr - _ct_bot); + unsigned int ptr_2_card_num(jbyte* card_ptr) { + return (unsigned int) (card_ptr - _ct_bot); } - jbyte* card_num_2_ptr(unsigned card_num) { + jbyte* card_num_2_ptr(unsigned int card_num) { return (jbyte*) (_ct_bot + card_num); } diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,7 +47,9 @@ void G1SATBCardTableModRefBS::enqueue(oop pre_val) { - assert(pre_val->is_oop_or_null(true), "Error"); + // Nulls should have been already filtered. + assert(pre_val->is_oop(true), "Error"); + if (!JavaThread::satb_mark_queue_set().is_active()) return; Thread* thr = Thread::current(); if (thr->is_Java_thread()) { @@ -59,20 +61,6 @@ } } -// When we know the current java thread: -template void -G1SATBCardTableModRefBS::write_ref_field_pre_static(T* field, - oop new_val, - JavaThread* jt) { - if (!JavaThread::satb_mark_queue_set().is_active()) return; - T heap_oop = oopDesc::load_heap_oop(field); - if (!oopDesc::is_null(heap_oop)) { - oop pre_val = oopDesc::decode_heap_oop_not_null(heap_oop); - assert(pre_val->is_oop(true /* ignore mark word */), "Error"); - jt->satb_mark_queue().enqueue(pre_val); - } -} - template void G1SATBCardTableModRefBS::write_ref_array_pre_work(T* dst, int count) { if (!JavaThread::satb_mark_queue_set().is_active()) return; diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -37,12 +37,11 @@ // snapshot-at-the-beginning marking. class G1SATBCardTableModRefBS: public CardTableModRefBSForCTRS { -private: +public: // Add "pre_val" to a set of objects that may have been disconnected from the // pre-marking object graph. static void enqueue(oop pre_val); -public: G1SATBCardTableModRefBS(MemRegion whole_heap, int max_covered_regions); @@ -61,10 +60,6 @@ } } - // When we know the current java thread: - template static void write_ref_field_pre_static(T* field, oop newVal, - JavaThread* jt); - // We export this to make it available in cases where the static // type of the barrier set is known. Note that it is non-virtual. template inline void inline_write_ref_field_pre(T* field, oop newVal) { diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -89,13 +89,9 @@ "The number of discovered reference objects to process before " \ "draining concurrent marking work queues.") \ \ - experimental(bool, G1UseConcMarkReferenceProcessing, false, \ + experimental(bool, G1UseConcMarkReferenceProcessing, true, \ "If true, enable reference discovery during concurrent " \ - "marking and reference processing at the end of remark " \ - "(unsafe).") \ - \ - develop(bool, G1SATBBarrierPrintNullPreVals, false, \ - "If true, count frac of ptr writes with null pre-vals.") \ + "marking and reference processing at the end of remark.") \ \ product(intx, G1SATBBufferSize, 1*K, \ "Number of entries in an SATB log buffer.") \ @@ -150,12 +146,6 @@ develop(bool, G1PrintParCleanupStats, false, \ "When true, print extra stats about parallel cleanup.") \ \ - develop(bool, G1DisablePreBarrier, false, \ - "Disable generation of pre-barrier (i.e., marking barrier) ") \ - \ - develop(bool, G1DisablePostBarrier, false, \ - "Disable generation of post-barrier (i.e., RS barrier) ") \ - \ product(intx, G1UpdateBufferSize, 256, \ "Size of an update buffer") \ \ diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp --- a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011 Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,6 @@ void CardTableModRefBS::par_non_clean_card_iterate_work(Space* sp, MemRegion mr, DirtyCardToOopClosure* dcto_cl, MemRegionClosure* cl, - bool clear, int n_threads) { if (n_threads > 0) { assert((n_threads == 1 && ParallelGCThreads == 0) || @@ -57,7 +56,7 @@ int stride = 0; while (!pst->is_task_claimed(/* reference */ stride)) { - process_stride(sp, mr, stride, n_strides, dcto_cl, cl, clear, + process_stride(sp, mr, stride, n_strides, dcto_cl, cl, lowest_non_clean, lowest_non_clean_base_chunk_index, lowest_non_clean_chunk_size); @@ -83,7 +82,6 @@ jint stride, int n_strides, DirtyCardToOopClosure* dcto_cl, MemRegionClosure* cl, - bool clear, jbyte** lowest_non_clean, uintptr_t lowest_non_clean_base_chunk_index, size_t lowest_non_clean_chunk_size) { @@ -129,7 +127,7 @@ lowest_non_clean_base_chunk_index, lowest_non_clean_chunk_size); - non_clean_card_iterate_work(chunk_mr, cl, clear); + non_clean_card_iterate_work(chunk_mr, cl); // Find the next chunk of the stride. chunk_card_start += CardsPerStrideChunk * n_strides; diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -176,10 +176,6 @@ object_mark_sweep()->compact(ZapUnusedHeapArea); } -void PSOldGen::move_and_update(ParCompactionManager* cm) { - PSParallelCompact::move_and_update(cm, PSParallelCompact::old_space_id); -} - size_t PSOldGen::contiguous_available() const { return object_space()->free_in_bytes() + virtual_space()->uncommitted_size(); } diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -143,9 +143,6 @@ void adjust_pointers(); void compact(); - // Parallel old - virtual void move_and_update(ParCompactionManager* cm); - // Size info size_t capacity_in_bytes() const { return object_space()->capacity_in_bytes(); } size_t used_in_bytes() const { return object_space()->used_in_bytes(); } diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -2104,11 +2104,7 @@ // klasses are used in the update of an object? compact_perm(vmthread_cm); - if (UseParallelOldGCCompacting) { - compact(); - } else { - compact_serial(vmthread_cm); - } + compact(); // Reset the mark bitmap, summary data, and do other bookkeeping. Must be // done before resizing. @@ -2582,18 +2578,16 @@ // each thread? if (total_dense_prefix_regions > 0) { uint tasks_for_dense_prefix = 1; - if (UseParallelDensePrefixUpdate) { - if (total_dense_prefix_regions <= - (parallel_gc_threads * PAR_OLD_DENSE_PREFIX_OVER_PARTITIONING)) { - // Don't over partition. This assumes that - // PAR_OLD_DENSE_PREFIX_OVER_PARTITIONING is a small integer value - // so there are not many regions to process. - tasks_for_dense_prefix = parallel_gc_threads; - } else { - // Over partition - tasks_for_dense_prefix = parallel_gc_threads * - PAR_OLD_DENSE_PREFIX_OVER_PARTITIONING; - } + if (total_dense_prefix_regions <= + (parallel_gc_threads * PAR_OLD_DENSE_PREFIX_OVER_PARTITIONING)) { + // Don't over partition. This assumes that + // PAR_OLD_DENSE_PREFIX_OVER_PARTITIONING is a small integer value + // so there are not many regions to process. + tasks_for_dense_prefix = parallel_gc_threads; + } else { + // Over partition + tasks_for_dense_prefix = parallel_gc_threads * + PAR_OLD_DENSE_PREFIX_OVER_PARTITIONING; } size_t regions_per_thread = total_dense_prefix_regions / tasks_for_dense_prefix; @@ -2733,21 +2727,6 @@ } #endif // #ifdef ASSERT -void PSParallelCompact::compact_serial(ParCompactionManager* cm) { - EventMark m("5 compact serial"); - TraceTime tm("compact serial", print_phases(), true, gclog_or_tty); - - ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); - assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); - - PSYoungGen* young_gen = heap->young_gen(); - PSOldGen* old_gen = heap->old_gen(); - - old_gen->start_array()->reset(); - old_gen->move_and_update(cm); - young_gen->move_and_update(cm); -} - void PSParallelCompact::follow_weak_klass_links() { // All klasses on the revisit stack are marked at this point. @@ -3530,11 +3509,8 @@ "Object liveness is wrong."); return ParMarkBitMap::incomplete; } - assert(UseParallelOldGCDensePrefix || - (HeapMaximumCompactionInterval > 1) || - (MarkSweepAlwaysCompactCount > 1) || - (forwarding_ptr == new_pointer), - "Calculation of new location is incorrect"); + assert(HeapMaximumCompactionInterval > 1 || MarkSweepAlwaysCompactCount > 1 || + forwarding_ptr == new_pointer, "new location is incorrect"); return ParMarkBitMap::incomplete; } diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -1027,9 +1027,6 @@ ParallelTaskTerminator* terminator_ptr, uint parallel_gc_threads); - // For debugging only - compacts the old gen serially - static void compact_serial(ParCompactionManager* cm); - // If objects are left in eden after a collection, try to move the boundary // and absorb them into the old gen. Returns true if eden was emptied. static bool absorb_live_data_from_eden(PSAdaptiveSizePolicy* size_policy, diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -121,12 +121,6 @@ } } - - -void PSPermGen::move_and_update(ParCompactionManager* cm) { - PSParallelCompact::move_and_update(cm, PSParallelCompact::perm_space_id); -} - void PSPermGen::precompact() { // Reset start array first. _start_array.reset(); diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.hpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,9 +51,6 @@ // MarkSweep code virtual void precompact(); - // Parallel old - virtual void move_and_update(ParCompactionManager* cm); - virtual const char* name() const { return "PSPermGen"; } }; diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -792,12 +792,6 @@ to_mark_sweep()->compact(false); } -void PSYoungGen::move_and_update(ParCompactionManager* cm) { - PSParallelCompact::move_and_update(cm, PSParallelCompact::eden_space_id); - PSParallelCompact::move_and_update(cm, PSParallelCompact::from_space_id); - PSParallelCompact::move_and_update(cm, PSParallelCompact::to_space_id); -} - void PSYoungGen::print() const { print_on(tty); } void PSYoungGen::print_on(outputStream* st) const { st->print(" %-15s", "PSYoungGen"); diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.hpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -127,9 +127,6 @@ void adjust_pointers(); void compact(); - // Parallel Old - void move_and_update(ParCompactionManager* cm); - // Called during/after gc void swap_spaces(); diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp --- a/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -76,7 +76,7 @@ _beforeSweep = 0; _coalBirths = 0; _coalDeaths = 0; - _splitBirths = split_birth? 1 : 0; + _splitBirths = (split_birth ? 1 : 0); _splitDeaths = 0; _returnedBytes = 0; } diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/interpreter/abstractInterpreter.hpp --- a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -104,6 +104,7 @@ java_lang_math_sqrt, // implementation of java.lang.Math.sqrt (x) java_lang_math_log, // implementation of java.lang.Math.log (x) java_lang_math_log10, // implementation of java.lang.Math.log10 (x) + java_lang_ref_reference_get, // implementation of java.lang.ref.Reference.get() number_of_method_entries, invalid = -1 }; @@ -140,7 +141,7 @@ // Method activation static MethodKind method_kind(methodHandle m); static address entry_for_kind(MethodKind k) { assert(0 <= k && k < number_of_method_entries, "illegal kind"); return _entry_table[k]; } - static address entry_for_method(methodHandle m) { return _entry_table[method_kind(m)]; } + static address entry_for_method(methodHandle m) { return entry_for_kind(method_kind(m)); } static void print_method_kind(MethodKind kind) PRODUCT_RETURN; diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/interpreter/cppInterpreter.cpp --- a/hotspot/src/share/vm/interpreter/cppInterpreter.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/interpreter/cppInterpreter.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -125,6 +125,7 @@ method_entry(java_lang_math_sqrt ); method_entry(java_lang_math_log ); method_entry(java_lang_math_log10 ); + method_entry(java_lang_ref_reference_get); Interpreter::_native_entry_begin = Interpreter::code()->code_end(); method_entry(native); method_entry(native_synchronized); diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/interpreter/interpreter.cpp --- a/hotspot/src/share/vm/interpreter/interpreter.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/interpreter/interpreter.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -208,12 +208,6 @@ return empty; } - // Accessor method? - if (m->is_accessor()) { - assert(m->size_of_parameters() == 1, "fast code for accessors assumes parameter size = 1"); - return accessor; - } - // Special intrinsic method? // Note: This test must come _after_ the test for native methods, // otherwise we will run into problems with JDK 1.2, see also @@ -227,6 +221,15 @@ case vmIntrinsics::_dsqrt : return java_lang_math_sqrt ; case vmIntrinsics::_dlog : return java_lang_math_log ; case vmIntrinsics::_dlog10: return java_lang_math_log10; + + case vmIntrinsics::_Reference_get: + return java_lang_ref_reference_get; + } + + // Accessor method? + if (m->is_accessor()) { + assert(m->size_of_parameters() == 1, "fast code for accessors assumes parameter size = 1"); + return accessor; } // Note: for now: zero locals for all non-empty methods diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/interpreter/templateInterpreter.cpp --- a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -372,6 +372,7 @@ method_entry(java_lang_math_sqrt ) method_entry(java_lang_math_log ) method_entry(java_lang_math_log10) + method_entry(java_lang_ref_reference_get) // all native method kinds (must be one contiguous block) Interpreter::_native_entry_begin = Interpreter::code()->code_end(); diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/memory/cardTableModRefBS.cpp --- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -459,18 +459,17 @@ void CardTableModRefBS::non_clean_card_iterate(Space* sp, MemRegion mr, DirtyCardToOopClosure* dcto_cl, - MemRegionClosure* cl, - bool clear) { + MemRegionClosure* cl) { if (!mr.is_empty()) { int n_threads = SharedHeap::heap()->n_par_threads(); if (n_threads > 0) { #ifndef SERIALGC - par_non_clean_card_iterate_work(sp, mr, dcto_cl, cl, clear, n_threads); + par_non_clean_card_iterate_work(sp, mr, dcto_cl, cl, n_threads); #else // SERIALGC fatal("Parallel gc not supported here."); #endif // SERIALGC } else { - non_clean_card_iterate_work(mr, cl, clear); + non_clean_card_iterate_work(mr, cl); } } } @@ -481,10 +480,7 @@ // cards (and miss those marked precleaned). In that sense, // the name precleaned is currently somewhat of a misnomer. void CardTableModRefBS::non_clean_card_iterate_work(MemRegion mr, - MemRegionClosure* cl, - bool clear) { - // Figure out whether we have to worry about parallelism. - bool is_par = (SharedHeap::heap()->n_par_threads() > 1); + MemRegionClosure* cl) { for (int i = 0; i < _cur_covered_regions; i++) { MemRegion mri = mr.intersection(_covered[i]); if (mri.word_size() > 0) { @@ -506,22 +502,6 @@ MemRegion cur_cards(addr_for(cur_entry), non_clean_cards * card_size_in_words); MemRegion dirty_region = cur_cards.intersection(mri); - if (clear) { - for (size_t i = 0; i < non_clean_cards; i++) { - // Clean the dirty cards (but leave the other non-clean - // alone.) If parallel, do the cleaning atomically. - jbyte cur_entry_val = cur_entry[i]; - if (card_is_dirty_wrt_gen_iter(cur_entry_val)) { - if (is_par) { - jbyte res = Atomic::cmpxchg(clean_card, &cur_entry[i], cur_entry_val); - assert(res != clean_card, - "Dirty card mysteriously cleaned"); - } else { - cur_entry[i] = clean_card; - } - } - } - } cl->do_MemRegion(dirty_region); } cur_entry = next_entry; @@ -530,22 +510,6 @@ } } -void CardTableModRefBS::mod_oop_in_space_iterate(Space* sp, - OopClosure* cl, - bool clear, - bool before_save_marks) { - // Note that dcto_cl is resource-allocated, so there is no - // corresponding "delete". - DirtyCardToOopClosure* dcto_cl = sp->new_dcto_cl(cl, precision()); - MemRegion used_mr; - if (before_save_marks) { - used_mr = sp->used_region_at_save_marks(); - } else { - used_mr = sp->used_region(); - } - non_clean_card_iterate(sp, used_mr, dcto_cl, dcto_cl, clear); -} - void CardTableModRefBS::dirty_MemRegion(MemRegion mr) { assert((HeapWord*)align_size_down((uintptr_t)mr.start(), HeapWordSize) == mr.start(), "Unaligned start"); assert((HeapWord*)align_size_up ((uintptr_t)mr.end(), HeapWordSize) == mr.end(), "Unaligned end" ); @@ -593,9 +557,8 @@ memset(first, dirty_card, last-first); } -// NOTES: -// (1) Unlike mod_oop_in_space_iterate() above, dirty_card_iterate() -// iterates over dirty cards ranges in increasing address order. +// Unlike several other card table methods, dirty_card_iterate() +// iterates over dirty cards ranges in increasing address order. void CardTableModRefBS::dirty_card_iterate(MemRegion mr, MemRegionClosure* cl) { for (int i = 0; i < _cur_covered_regions; i++) { @@ -698,7 +661,7 @@ void CardTableModRefBS::verify_clean_region(MemRegion mr) { GuaranteeNotModClosure blk(this); - non_clean_card_iterate_work(mr, &blk, false); + non_clean_card_iterate_work(mr, &blk); } // To verify a MemRegion is entirely dirty this closure is passed to diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/memory/cardTableModRefBS.hpp --- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -171,17 +171,14 @@ // mode if worker threads are available. void non_clean_card_iterate(Space* sp, MemRegion mr, DirtyCardToOopClosure* dcto_cl, - MemRegionClosure* cl, - bool clear); + MemRegionClosure* cl); // Utility function used to implement the other versions below. - void non_clean_card_iterate_work(MemRegion mr, MemRegionClosure* cl, - bool clear); + void non_clean_card_iterate_work(MemRegion mr, MemRegionClosure* cl); void par_non_clean_card_iterate_work(Space* sp, MemRegion mr, DirtyCardToOopClosure* dcto_cl, MemRegionClosure* cl, - bool clear, int n_threads); // Dirty the bytes corresponding to "mr" (not all of which must be @@ -241,7 +238,6 @@ jint stride, int n_strides, DirtyCardToOopClosure* dcto_cl, MemRegionClosure* cl, - bool clear, jbyte** lowest_non_clean, uintptr_t lowest_non_clean_base_chunk_index, size_t lowest_non_clean_chunk_size); @@ -402,9 +398,6 @@ virtual void invalidate(MemRegion mr, bool whole_heap = false); void clear(MemRegion mr); void dirty(MemRegion mr); - void mod_oop_in_space_iterate(Space* sp, OopClosure* cl, - bool clear = false, - bool before_save_marks = false); // *** Card-table-RemSet-specific things. @@ -415,18 +408,15 @@ // *decreasing* address order. (This order aids with imprecise card // marking, where a dirty card may cause scanning, and summarization // marking, of objects that extend onto subsequent cards.) - // If "clear" is true, the card is (conceptually) marked unmodified before - // applying the closure. - void mod_card_iterate(MemRegionClosure* cl, bool clear = false) { - non_clean_card_iterate_work(_whole_heap, cl, clear); + void mod_card_iterate(MemRegionClosure* cl) { + non_clean_card_iterate_work(_whole_heap, cl); } // Like the "mod_cards_iterate" above, except only invokes the closure // for cards within the MemRegion "mr" (which is required to be // card-aligned and sized.) - void mod_card_iterate(MemRegion mr, MemRegionClosure* cl, - bool clear = false) { - non_clean_card_iterate_work(mr, cl, clear); + void mod_card_iterate(MemRegion mr, MemRegionClosure* cl) { + non_clean_card_iterate_work(mr, cl); } static uintx ct_max_alignment_constraint(); diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/memory/cardTableRS.cpp --- a/hotspot/src/share/vm/memory/cardTableRS.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/memory/cardTableRS.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -247,7 +247,7 @@ ClearNoncleanCardWrapper clear_cl(dcto_cl, this); _ct_bs->non_clean_card_iterate(sp, sp->used_region_at_save_marks(), - dcto_cl, &clear_cl, false); + dcto_cl, &clear_cl); } void CardTableRS::clear_into_younger(Generation* gen, bool clear_perm) { diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/memory/dump.cpp --- a/hotspot/src/share/vm/memory/dump.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/memory/dump.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -623,24 +623,48 @@ } }; -// Itable indices are calculated based on methods array order -// (see klassItable::compute_itable_index()). Must reinitialize +// Vtable and Itable indices are calculated based on methods array +// order (see klassItable::compute_itable_index()). Must reinitialize // after ALL methods of ALL classes have been reordered. // We assume that since checkconstraints is false, this method // cannot throw an exception. An exception here would be // problematic since this is the VMThread, not a JavaThread. -class ReinitializeItables: public ObjectClosure { +class ReinitializeTables: public ObjectClosure { private: Thread* _thread; public: - ReinitializeItables(Thread* thread) : _thread(thread) {} + ReinitializeTables(Thread* thread) : _thread(thread) {} + + // Initialize super vtable first, check if already initialized to avoid + // quadradic behavior. The vtable is cleared in remove_unshareable_info. + void reinitialize_vtables(klassOop k) { + if (k->blueprint()->oop_is_instanceKlass()) { + instanceKlass* ik = instanceKlass::cast(k); + if (ik->vtable()->is_initialized()) return; + if (ik->super() != NULL) { + reinitialize_vtables(ik->super()); + } + ik->vtable()->initialize_vtable(false, _thread); + } + } void do_object(oop obj) { if (obj->blueprint()->oop_is_instanceKlass()) { instanceKlass* ik = instanceKlass::cast((klassOop)obj); + ResourceMark rm(_thread); ik->itable()->initialize_itable(false, _thread); + reinitialize_vtables((klassOop)obj); +#ifdef ASSERT + ik->vtable()->verify(tty, true); +#endif // ASSERT + } else if (obj->blueprint()->oop_is_arrayKlass()) { + // The vtable for array klasses are that of its super class, + // ie. java.lang.Object. + arrayKlass* ak = arrayKlass::cast((klassOop)obj); + if (ak->vtable()->is_initialized()) return; + ak->vtable()->initialize_vtable(false, _thread); } } }; @@ -1205,9 +1229,9 @@ gen->ro_space()->object_iterate(&sort); gen->rw_space()->object_iterate(&sort); - ReinitializeItables reinit_itables(THREAD); - gen->ro_space()->object_iterate(&reinit_itables); - gen->rw_space()->object_iterate(&reinit_itables); + ReinitializeTables reinit_tables(THREAD); + gen->ro_space()->object_iterate(&reinit_tables); + gen->rw_space()->object_iterate(&reinit_tables); tty->print_cr("done. "); tty->cr(); diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/memory/modRefBarrierSet.hpp --- a/hotspot/src/share/vm/memory/modRefBarrierSet.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/memory/modRefBarrierSet.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -88,15 +88,6 @@ assert(false, "can't call"); } - // Invoke "cl->do_oop" on (the address of) every possibly-modifed - // reference field in objects in "sp". If "clear" is "true", the oops - // are no longer considered possibly modified after application of the - // closure. If' "before_save_marks" is true, oops in objects allocated - // after the last call to "save_marks" on "sp" will not be considered. - virtual void mod_oop_in_space_iterate(Space* sp, OopClosure* cl, - bool clear = false, - bool before_save_marks = false) = 0; - // Causes all refs in "mr" to be assumed to be modified. If "whole_heap" // is true, the caller asserts that the entire heap is being invalidated, // which may admit an optimized implementation for some barriers. diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/oops/instanceKlass.hpp --- a/hotspot/src/share/vm/oops/instanceKlass.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/oops/instanceKlass.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -401,6 +401,8 @@ ReferenceType reference_type() const { return _reference_type; } void set_reference_type(ReferenceType t) { _reference_type = t; } + static int reference_type_offset_in_bytes() { return offset_of(instanceKlass, _reference_type); } + // find local field, returns true if found bool find_local_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const; // find field in direct superinterfaces, returns the interface in which the field is defined diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/oops/instanceKlassKlass.cpp --- a/hotspot/src/share/vm/oops/instanceKlassKlass.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/oops/instanceKlassKlass.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -690,7 +690,8 @@ guarantee(method_ordering->is_perm(), "should be in permspace"); guarantee(method_ordering->is_typeArray(), "should be type array"); int length = method_ordering->length(); - if (JvmtiExport::can_maintain_original_method_order()) { + if (JvmtiExport::can_maintain_original_method_order() || + (UseSharedSpaces && length != 0)) { guarantee(length == methods->length(), "invalid method ordering length"); jlong sum = 0; for (j = 0; j < length; j++) { diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/oops/klass.cpp --- a/hotspot/src/share/vm/oops/klass.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/oops/klass.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -453,6 +453,14 @@ ik->unlink_class(); } } + // Clear the Java vtable if the oop has one. + // The vtable isn't shareable because it's in the wrong order wrt the methods + // once the method names get moved and resorted. + klassVtable* vt = vtable(); + if (vt != NULL) { + assert(oop_is_instance() || oop_is_array(), "nothing else has vtable"); + vt->clear_vtable(); + } set_subklass(NULL); set_next_sibling(NULL); } diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/oops/klassVtable.cpp --- a/hotspot/src/share/vm/oops/klassVtable.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/oops/klassVtable.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -645,6 +645,15 @@ } } +// CDS/RedefineClasses support - clear vtables so they can be reinitialized +void klassVtable::clear_vtable() { + for (int i = 0; i < _length; i++) table()[i].clear(); +} + +bool klassVtable::is_initialized() { + return _length == 0 || table()[0].method() != NULL; +} + // Garbage collection void klassVtable::oop_follow_contents() { diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/oops/klassVtable.hpp --- a/hotspot/src/share/vm/oops/klassVtable.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/oops/klassVtable.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -75,7 +75,15 @@ void initialize_vtable(bool checkconstraints, TRAPS); // initialize vtable of a new klass - // conputes vtable length (in words) and the number of miranda methods + // CDS/RedefineClasses support - clear vtables so they can be reinitialized + // at dump time. Clearing gives us an easy way to tell if the vtable has + // already been reinitialized at dump time (see dump.cpp). Vtables can + // be initialized at run time by RedefineClasses so dumping the right order + // is necessary. + void clear_vtable(); + bool is_initialized(); + + // computes vtable length (in words) and the number of miranda methods static void compute_vtable_size_and_num_mirandas(int &vtable_length, int &num_miranda_methods, klassOop super, objArrayOop methods, AccessFlags class_flags, Handle classloader, diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/opto/compile.cpp --- a/hotspot/src/share/vm/opto/compile.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/opto/compile.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -629,7 +629,7 @@ initial_gvn()->transform_no_reclaim(top()); // Set up tf(), start(), and find a CallGenerator. - CallGenerator* cg; + CallGenerator* cg = NULL; if (is_osr_compilation()) { const TypeTuple *domain = StartOSRNode::osr_domain(); const TypeTuple *range = TypeTuple::make_range(method()->signature()); @@ -644,9 +644,24 @@ StartNode* s = new (this, 2) StartNode(root(), tf()->domain()); initial_gvn()->set_type_bottom(s); init_start(s); - float past_uses = method()->interpreter_invocation_count(); - float expected_uses = past_uses; - cg = CallGenerator::for_inline(method(), expected_uses); + if (method()->intrinsic_id() == vmIntrinsics::_Reference_get && UseG1GC) { + // With java.lang.ref.reference.get() we must go through the + // intrinsic when G1 is enabled - even when get() is the root + // method of the compile - so that, if necessary, the value in + // the referent field of the reference object gets recorded by + // the pre-barrier code. + // Specifically, if G1 is enabled, the value in the referent + // field is recorded by the G1 SATB pre barrier. This will + // result in the referent being marked live and the reference + // object removed from the list of discovered references during + // reference processing. + cg = find_intrinsic(method(), false); + } + if (cg == NULL) { + float past_uses = method()->interpreter_invocation_count(); + float expected_uses = past_uses; + cg = CallGenerator::for_inline(method(), expected_uses); + } } if (failing()) return; if (cg == NULL) { @@ -2041,6 +2056,52 @@ // Note that OffsetBot and OffsetTop are very negative. } +// Eliminate trivially redundant StoreCMs and accumulate their +// precedence edges. +static void eliminate_redundant_card_marks(Node* n) { + assert(n->Opcode() == Op_StoreCM, "expected StoreCM"); + if (n->in(MemNode::Address)->outcnt() > 1) { + // There are multiple users of the same address so it might be + // possible to eliminate some of the StoreCMs + Node* mem = n->in(MemNode::Memory); + Node* adr = n->in(MemNode::Address); + Node* val = n->in(MemNode::ValueIn); + Node* prev = n; + bool done = false; + // Walk the chain of StoreCMs eliminating ones that match. As + // long as it's a chain of single users then the optimization is + // safe. Eliminating partially redundant StoreCMs would require + // cloning copies down the other paths. + while (mem->Opcode() == Op_StoreCM && mem->outcnt() == 1 && !done) { + if (adr == mem->in(MemNode::Address) && + val == mem->in(MemNode::ValueIn)) { + // redundant StoreCM + if (mem->req() > MemNode::OopStore) { + // Hasn't been processed by this code yet. + n->add_prec(mem->in(MemNode::OopStore)); + } else { + // Already converted to precedence edge + for (uint i = mem->req(); i < mem->len(); i++) { + // Accumulate any precedence edges + if (mem->in(i) != NULL) { + n->add_prec(mem->in(i)); + } + } + // Everything above this point has been processed. + done = true; + } + // Eliminate the previous StoreCM + prev->set_req(MemNode::Memory, mem->in(MemNode::Memory)); + assert(mem->outcnt() == 0, "should be dead"); + mem->disconnect_inputs(NULL); + } else { + prev = mem; + } + mem = prev->in(MemNode::Memory); + } + } +} + //------------------------------final_graph_reshaping_impl---------------------- // Implement items 1-5 from final_graph_reshaping below. static void final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc ) { @@ -2167,9 +2228,19 @@ frc.inc_float_count(); goto handle_mem; + case Op_StoreCM: + { + // Convert OopStore dependence into precedence edge + Node* prec = n->in(MemNode::OopStore); + n->del_req(MemNode::OopStore); + n->add_prec(prec); + eliminate_redundant_card_marks(n); + } + + // fall through + case Op_StoreB: case Op_StoreC: - case Op_StoreCM: case Op_StorePConditional: case Op_StoreI: case Op_StoreL: diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/opto/graphKit.cpp --- a/hotspot/src/share/vm/opto/graphKit.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/opto/graphKit.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -1457,19 +1457,22 @@ } -void GraphKit::pre_barrier(Node* ctl, +void GraphKit::pre_barrier(bool do_load, + Node* ctl, Node* obj, Node* adr, uint adr_idx, Node* val, const TypeOopPtr* val_type, + Node* pre_val, BasicType bt) { + BarrierSet* bs = Universe::heap()->barrier_set(); set_control(ctl); switch (bs->kind()) { case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: - g1_write_barrier_pre(obj, adr, adr_idx, val, val_type, bt); + g1_write_barrier_pre(do_load, obj, adr, adr_idx, val, val_type, pre_val, bt); break; case BarrierSet::CardTableModRef: @@ -1532,7 +1535,11 @@ uint adr_idx = C->get_alias_index(adr_type); assert(adr_idx != Compile::AliasIdxTop, "use other store_to_memory factory" ); - pre_barrier(control(), obj, adr, adr_idx, val, val_type, bt); + pre_barrier(true /* do_load */, + control(), obj, adr, adr_idx, val, val_type, + NULL /* pre_val */, + bt); + Node* store = store_to_memory(control(), adr, val, bt, adr_idx); post_barrier(control(), store, obj, adr, adr_idx, val, bt, use_precise); return store; @@ -3470,12 +3477,31 @@ } // G1 pre/post barriers -void GraphKit::g1_write_barrier_pre(Node* obj, +void GraphKit::g1_write_barrier_pre(bool do_load, + Node* obj, Node* adr, uint alias_idx, Node* val, const TypeOopPtr* val_type, + Node* pre_val, BasicType bt) { + + // Some sanity checks + // Note: val is unused in this routine. + + if (do_load) { + // We need to generate the load of the previous value + assert(obj != NULL, "must have a base"); + assert(adr != NULL, "where are loading from?"); + assert(pre_val == NULL, "loaded already?"); + assert(val_type != NULL, "need a type"); + } else { + // In this case both val_type and alias_idx are unused. + assert(pre_val != NULL, "must be loaded already"); + assert(pre_val->bottom_type()->basic_type() == T_OBJECT, "or we shouldn't be here"); + } + assert(bt == T_OBJECT, "or we shouldn't be here"); + IdealKit ideal(this, true); Node* tls = __ thread(); // ThreadLocalStorage @@ -3497,32 +3523,28 @@ PtrQueue::byte_offset_of_index()); const int buffer_offset = in_bytes(JavaThread::satb_mark_queue_offset() + // 652 PtrQueue::byte_offset_of_buf()); + // Now the actual pointers into the thread - - // set_control( ctl); - Node* marking_adr = __ AddP(no_base, tls, __ ConX(marking_offset)); Node* buffer_adr = __ AddP(no_base, tls, __ ConX(buffer_offset)); Node* index_adr = __ AddP(no_base, tls, __ ConX(index_offset)); // Now some of the values - Node* marking = __ load(__ ctrl(), marking_adr, TypeInt::INT, active_type, Compile::AliasIdxRaw); // if (!marking) __ if_then(marking, BoolTest::ne, zero); { Node* index = __ load(__ ctrl(), index_adr, TypeInt::INT, T_INT, Compile::AliasIdxRaw); - const Type* t1 = adr->bottom_type(); - const Type* t2 = val->bottom_type(); - - Node* orig = __ load(no_ctrl, adr, val_type, bt, alias_idx); - // if (orig != NULL) - __ if_then(orig, BoolTest::ne, null()); { - Node* buffer = __ load(__ ctrl(), buffer_adr, TypeRawPtr::NOTNULL, T_ADDRESS, Compile::AliasIdxRaw); - + if (do_load) { // load original value // alias_idx correct?? + pre_val = __ load(no_ctrl, adr, val_type, bt, alias_idx); + } + + // if (pre_val != NULL) + __ if_then(pre_val, BoolTest::ne, null()); { + Node* buffer = __ load(__ ctrl(), buffer_adr, TypeRawPtr::NOTNULL, T_ADDRESS, Compile::AliasIdxRaw); // is the queue for this thread full? __ if_then(index, BoolTest::ne, zero, likely); { @@ -3536,10 +3558,9 @@ next_indexX = _gvn.transform( new (C, 2) ConvI2LNode(next_index, TypeLong::make(0, max_jlong, Type::WidenMax)) ); #endif - // Now get the buffer location we will log the original value into and store it + // Now get the buffer location we will log the previous value into and store it Node *log_addr = __ AddP(no_base, buffer, next_indexX); - __ store(__ ctrl(), log_addr, orig, T_OBJECT, Compile::AliasIdxRaw); - + __ store(__ ctrl(), log_addr, pre_val, T_OBJECT, Compile::AliasIdxRaw); // update the index __ store(__ ctrl(), index_adr, next_index, T_INT, Compile::AliasIdxRaw); @@ -3547,9 +3568,9 @@ // logging buffer is full, call the runtime const TypeFunc *tf = OptoRuntime::g1_wb_pre_Type(); - __ make_leaf_call(tf, CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), "g1_wb_pre", orig, tls); + __ make_leaf_call(tf, CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), "g1_wb_pre", pre_val, tls); } __ end_if(); // (!index) - } __ end_if(); // (orig != NULL) + } __ end_if(); // (pre_val != NULL) } __ end_if(); // (!marking) // Final sync IdealKit and GraphKit. diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/opto/graphKit.hpp --- a/hotspot/src/share/vm/opto/graphKit.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/opto/graphKit.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -544,8 +544,10 @@ BasicType bt); // For the few case where the barriers need special help - void pre_barrier(Node* ctl, Node* obj, Node* adr, uint adr_idx, - Node* val, const TypeOopPtr* val_type, BasicType bt); + void pre_barrier(bool do_load, Node* ctl, + Node* obj, Node* adr, uint adr_idx, Node* val, const TypeOopPtr* val_type, + Node* pre_val, + BasicType bt); void post_barrier(Node* ctl, Node* store, Node* obj, Node* adr, uint adr_idx, Node* val, BasicType bt, bool use_precise); @@ -671,11 +673,13 @@ Node* adr, uint adr_idx, Node* val, bool use_precise); // G1 pre/post barriers - void g1_write_barrier_pre(Node* obj, + void g1_write_barrier_pre(bool do_load, + Node* obj, Node* adr, uint alias_idx, Node* val, const TypeOopPtr* val_type, + Node* pre_val, BasicType bt); void g1_write_barrier_post(Node* store, diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/opto/lcm.cpp --- a/hotspot/src/share/vm/opto/lcm.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/opto/lcm.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -688,20 +688,22 @@ } ready_cnt[n->_idx] = local; // Count em up - // A few node types require changing a required edge to a precedence edge - // before allocation. +#ifdef ASSERT if( UseConcMarkSweepGC || UseG1GC ) { if( n->is_Mach() && n->as_Mach()->ideal_Opcode() == Op_StoreCM ) { - // Note: Required edges with an index greater than oper_input_base - // are not supported by the allocator. - // Note2: Can only depend on unmatched edge being last, - // can not depend on its absolute position. - Node *oop_store = n->in(n->req() - 1); - n->del_req(n->req() - 1); - n->add_prec(oop_store); - assert(cfg->_bbs[oop_store->_idx]->_dom_depth <= this->_dom_depth, "oop_store must dominate card-mark"); + // Check the precedence edges + for (uint prec = n->req(); prec < n->len(); prec++) { + Node* oop_store = n->in(prec); + if (oop_store != NULL) { + assert(cfg->_bbs[oop_store->_idx]->_dom_depth <= this->_dom_depth, "oop_store must dominate card-mark"); + } + } } } +#endif + + // A few node types require changing a required edge to a precedence edge + // before allocation. if( n->is_Mach() && n->req() > TypeFunc::Parms && (n->as_Mach()->ideal_Opcode() == Op_MemBarAcquire || n->as_Mach()->ideal_Opcode() == Op_MemBarVolatile) ) { diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/opto/library_call.cpp --- a/hotspot/src/share/vm/opto/library_call.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/opto/library_call.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -166,6 +166,10 @@ // This returns Type::AnyPtr, RawPtr, or OopPtr. int classify_unsafe_addr(Node* &base, Node* &offset); Node* make_unsafe_address(Node* base, Node* offset); + // Helper for inline_unsafe_access. + // Generates the guards that check whether the result of + // Unsafe.getObject should be recorded in an SATB log buffer. + void insert_g1_pre_barrier(Node* base_oop, Node* offset, Node* pre_val); bool inline_unsafe_access(bool is_native_ptr, bool is_store, BasicType type, bool is_volatile); bool inline_unsafe_prefetch(bool is_native_ptr, bool is_store, bool is_static); bool inline_unsafe_allocate(); @@ -240,6 +244,8 @@ bool inline_numberOfTrailingZeros(vmIntrinsics::ID id); bool inline_bitCount(vmIntrinsics::ID id); bool inline_reverseBytes(vmIntrinsics::ID id); + + bool inline_reference_get(); }; @@ -336,6 +342,14 @@ if (!UsePopCountInstruction) return NULL; break; + case vmIntrinsics::_Reference_get: + // It is only when G1 is enabled that we absolutely + // need to use the intrinsic version of Reference.get() + // so that the value in the referent field, if necessary, + // can be registered by the pre-barrier code. + if (!UseG1GC) return NULL; + break; + default: assert(id <= vmIntrinsics::LAST_COMPILER_INLINE, "caller responsibility"); assert(id != vmIntrinsics::_Object_init && id != vmIntrinsics::_invoke, "enum out of order?"); @@ -387,6 +401,7 @@ tty->print_cr("Intrinsic %s", str); } #endif + if (kit.try_to_inline()) { if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) { CompileTask::print_inlining(kit.callee(), jvms->depth() - 1, kit.bci(), is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)"); @@ -402,11 +417,19 @@ } if (PrintIntrinsics) { - tty->print("Did not inline intrinsic %s%s at bci:%d in", + if (jvms->has_method()) { + // Not a root compile. + tty->print("Did not inline intrinsic %s%s at bci:%d in", + vmIntrinsics::name_at(intrinsic_id()), + (is_virtual() ? " (virtual)" : ""), kit.bci()); + kit.caller()->print_short_name(tty); + tty->print_cr(" (%d bytes)", kit.caller()->code_size()); + } else { + // Root compile + tty->print("Did not generate intrinsic %s%s at bci:%d in", vmIntrinsics::name_at(intrinsic_id()), (is_virtual() ? " (virtual)" : ""), kit.bci()); - kit.caller()->print_short_name(tty); - tty->print_cr(" (%d bytes)", kit.caller()->code_size()); + } } C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_failed); return NULL; @@ -418,6 +441,14 @@ const bool is_native_ptr = true; const bool is_static = true; + if (!jvms()->has_method()) { + // Root JVMState has a null method. + assert(map()->memory()->Opcode() == Op_Parm, ""); + // Insert the memory aliasing node + set_all_memory(reset_memory()); + } + assert(merged_memory(), ""); + switch (intrinsic_id()) { case vmIntrinsics::_hashCode: return inline_native_hashcode(intrinsic()->is_virtual(), !is_static); @@ -658,6 +689,9 @@ case vmIntrinsics::_getCallerClass: return inline_native_Reflection_getCallerClass(); + case vmIntrinsics::_Reference_get: + return inline_reference_get(); + default: // If you get here, it may be that someone has added a new intrinsic // to the list in vmSymbols.hpp without implementing it here. @@ -2076,6 +2110,106 @@ const static BasicType T_ADDRESS_HOLDER = T_LONG; +// Helper that guards and inserts a G1 pre-barrier. +void LibraryCallKit::insert_g1_pre_barrier(Node* base_oop, Node* offset, Node* pre_val) { + assert(UseG1GC, "should not call this otherwise"); + + // We could be accessing the referent field of a reference object. If so, when G1 + // is enabled, we need to log the value in the referent field in an SATB buffer. + // This routine performs some compile time filters and generates suitable + // runtime filters that guard the pre-barrier code. + + // Some compile time checks. + + // If offset is a constant, is it java_lang_ref_Reference::_reference_offset? + const TypeX* otype = offset->find_intptr_t_type(); + if (otype != NULL && otype->is_con() && + otype->get_con() != java_lang_ref_Reference::referent_offset) { + // Constant offset but not the reference_offset so just return + return; + } + + // We only need to generate the runtime guards for instances. + const TypeOopPtr* btype = base_oop->bottom_type()->isa_oopptr(); + if (btype != NULL) { + if (btype->isa_aryptr()) { + // Array type so nothing to do + return; + } + + const TypeInstPtr* itype = btype->isa_instptr(); + if (itype != NULL) { + // Can the klass of base_oop be statically determined + // to be _not_ a sub-class of Reference? + ciKlass* klass = itype->klass(); + if (klass->is_subtype_of(env()->Reference_klass()) && + !env()->Reference_klass()->is_subtype_of(klass)) { + return; + } + } + } + + // The compile time filters did not reject base_oop/offset so + // we need to generate the following runtime filters + // + // if (offset == java_lang_ref_Reference::_reference_offset) { + // if (base != null) { + // if (klass(base)->reference_type() != REF_NONE)) { + // pre_barrier(_, pre_val, ...); + // } + // } + // } + + float likely = PROB_LIKELY(0.999); + float unlikely = PROB_UNLIKELY(0.999); + + IdealKit ideal(this); +#define __ ideal. + + const int reference_type_offset = instanceKlass::reference_type_offset_in_bytes() + + sizeof(oopDesc); + + Node* referent_off = __ ConX(java_lang_ref_Reference::referent_offset); + + __ if_then(offset, BoolTest::eq, referent_off, unlikely); { + __ if_then(base_oop, BoolTest::ne, null(), likely); { + + // Update graphKit memory and control from IdealKit. + sync_kit(ideal); + + Node* ref_klass_con = makecon(TypeKlassPtr::make(env()->Reference_klass())); + Node* is_instof = gen_instanceof(base_oop, ref_klass_con); + + // Update IdealKit memory and control from graphKit. + __ sync_kit(this); + + Node* one = __ ConI(1); + + __ if_then(is_instof, BoolTest::eq, one, unlikely); { + + // Update graphKit from IdeakKit. + sync_kit(ideal); + + // Use the pre-barrier to record the value in the referent field + pre_barrier(false /* do_load */, + __ ctrl(), + NULL /* obj */, NULL /* adr */, max_juint /* alias_idx */, NULL /* val */, NULL /* val_type */, + pre_val /* pre_val */, + T_OBJECT); + + // Update IdealKit from graphKit. + __ sync_kit(this); + + } __ end_if(); // _ref_type != ref_none + } __ end_if(); // base != NULL + } __ end_if(); // offset == referent_offset + + // Final sync IdealKit and GraphKit. + final_sync(ideal); +#undef __ +} + + // Interpret Unsafe.fieldOffset cookies correctly: extern jlong Unsafe_field_offset_to_byte_offset(jlong field_offset); @@ -2152,9 +2286,11 @@ // Build address expression. See the code in inline_unsafe_prefetch. Node *adr; Node *heap_base_oop = top(); + Node* offset = top(); + if (!is_native_ptr) { // The offset is a value produced by Unsafe.staticFieldOffset or Unsafe.objectFieldOffset - Node* offset = pop_pair(); + offset = pop_pair(); // The base is either a Java object or a value produced by Unsafe.staticFieldBase Node* base = pop(); // We currently rely on the cookies produced by Unsafe.xxxFieldOffset @@ -2195,6 +2331,13 @@ // or Compile::must_alias will throw a diagnostic assert.) bool need_mem_bar = (alias_type->adr_type() == TypeOopPtr::BOTTOM); + // If we are reading the value of the referent field of a Reference + // object (either by using Unsafe directly or through reflection) + // then, if G1 is enabled, we need to record the referent in an + // SATB log buffer using the pre-barrier mechanism. + bool need_read_barrier = UseG1GC && !is_native_ptr && !is_store && + offset != top() && heap_base_oop != top(); + if (!is_store && type == T_OBJECT) { // Attempt to infer a sharper value type from the offset and base type. ciKlass* sharpened_klass = NULL; @@ -2278,8 +2421,13 @@ case T_SHORT: case T_INT: case T_FLOAT: + push(p); + break; case T_OBJECT: - push( p ); + if (need_read_barrier) { + insert_g1_pre_barrier(heap_base_oop, offset, p); + } + push(p); break; case T_ADDRESS: // Cast to an int type. @@ -2534,7 +2682,10 @@ case T_OBJECT: // reference stores need a store barrier. // (They don't if CAS fails, but it isn't worth checking.) - pre_barrier(control(), base, adr, alias_idx, newval, value_type->make_oopptr(), T_OBJECT); + pre_barrier(true /* do_load*/, + control(), base, adr, alias_idx, newval, value_type->make_oopptr(), + NULL /* pre_val*/, + T_OBJECT); #ifdef _LP64 if (adr->bottom_type()->is_ptr_to_narrowoop()) { Node *newval_enc = _gvn.transform(new (C, 2) EncodePNode(newval, newval->bottom_type()->make_narrowoop())); @@ -5235,3 +5386,44 @@ copyfunc_addr, copyfunc_name, adr_type, src_start, dest_start, copy_length XTOP); } + +//----------------------------inline_reference_get---------------------------- + +bool LibraryCallKit::inline_reference_get() { + const int nargs = 1; // self + + guarantee(java_lang_ref_Reference::referent_offset > 0, + "should have already been set"); + + int referent_offset = java_lang_ref_Reference::referent_offset; + + // Restore the stack and pop off the argument + _sp += nargs; + Node *reference_obj = pop(); + + // Null check on self without removing any arguments. + _sp += nargs; + reference_obj = do_null_check(reference_obj, T_OBJECT); + _sp -= nargs;; + + if (stopped()) return true; + + Node *adr = basic_plus_adr(reference_obj, reference_obj, referent_offset); + + ciInstanceKlass* klass = env()->Object_klass(); + const TypeOopPtr* object_type = TypeOopPtr::make_from_klass(klass); + + Node* no_ctrl = NULL; + Node *result = make_load(no_ctrl, adr, object_type, T_OBJECT); + + // Use the pre-barrier to record the value in the referent field + pre_barrier(false /* do_load */, + control(), + NULL /* obj */, NULL /* adr */, max_juint /* alias_idx */, NULL /* val */, NULL /* val_type */, + result /* pre_val */, + T_OBJECT); + + push(result); + return true; +} + diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/opto/memnode.cpp --- a/hotspot/src/share/vm/opto/memnode.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/opto/memnode.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -2159,9 +2159,12 @@ Node* mem = in(MemNode::Memory); Node* address = in(MemNode::Address); - // Back-to-back stores to same address? Fold em up. - // Generally unsafe if I have intervening uses... - if (mem->is_Store() && phase->eqv_uncast(mem->in(MemNode::Address), address)) { + // Back-to-back stores to same address? Fold em up. Generally + // unsafe if I have intervening uses... Also disallowed for StoreCM + // since they must follow each StoreP operation. Redundant StoreCMs + // are eliminated just before matching in final_graph_reshape. + if (mem->is_Store() && phase->eqv_uncast(mem->in(MemNode::Address), address) && + mem->Opcode() != Op_StoreCM) { // Looking at a dead closed cycle of memory? assert(mem != mem->in(MemNode::Memory), "dead loop in StoreNode::Ideal"); diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/opto/output.cpp --- a/hotspot/src/share/vm/opto/output.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/opto/output.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -1354,15 +1354,20 @@ // Check that oop-store precedes the card-mark else if( mach->ideal_Opcode() == Op_StoreCM ) { uint storeCM_idx = j; - Node *oop_store = mach->in(mach->_cnt); // First precedence edge - assert( oop_store != NULL, "storeCM expects a precedence edge"); - uint i4; - for( i4 = 0; i4 < last_inst; ++i4 ) { - if( b->_nodes[i4] == oop_store ) break; + int count = 0; + for (uint prec = mach->req(); prec < mach->len(); prec++) { + Node *oop_store = mach->in(prec); // Precedence edge + if (oop_store == NULL) continue; + count++; + uint i4; + for( i4 = 0; i4 < last_inst; ++i4 ) { + if( b->_nodes[i4] == oop_store ) break; + } + // Note: This test can provide a false failure if other precedence + // edges have been added to the storeCMNode. + assert( i4 == last_inst || i4 < storeCM_idx, "CM card-mark executes before oop-store"); } - // Note: This test can provide a false failure if other precedence - // edges have been added to the storeCMNode. - assert( i4 == last_inst || i4 < storeCM_idx, "CM card-mark executes before oop-store"); + assert(count > 0, "storeCM expects at least one precedence edge"); } #endif diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/prims/jni.cpp --- a/hotspot/src/share/vm/prims/jni.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/prims/jni.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -29,6 +29,9 @@ #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "interpreter/linkResolver.hpp" +#ifndef SERIALGC +#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" +#endif // SERIALGC #include "memory/allocation.inline.hpp" #include "memory/gcLocker.inline.hpp" #include "memory/oopFactory.hpp" @@ -1724,6 +1727,26 @@ o = JvmtiExport::jni_GetField_probe(thread, obj, o, k, fieldID, false); } jobject ret = JNIHandles::make_local(env, o->obj_field(offset)); +#ifndef SERIALGC + // If G1 is enabled and we are accessing the value of the referent + // field in a reference object then we need to register a non-null + // referent with the SATB barrier. + if (UseG1GC) { + bool needs_barrier = false; + + if (ret != NULL && + offset == java_lang_ref_Reference::referent_offset && + instanceKlass::cast(k)->reference_type() != REF_NONE) { + assert(instanceKlass::cast(k)->is_subclass_of(SystemDictionary::Reference_klass()), "sanity"); + needs_barrier = true; + } + + if (needs_barrier) { + oop referent = JNIHandles::resolve(ret); + G1SATBCardTableModRefBS::enqueue(referent); + } + } +#endif // SERIALGC DTRACE_PROBE1(hotspot_jni, GetObjectField__return, ret); return ret; JNI_END diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/prims/jvmtiEnv.cpp --- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -525,7 +525,7 @@ ObjectLocker ol(loader, THREAD); // need the path as java.lang.String - Handle path = java_lang_String::create_from_str(segment, THREAD); + Handle path = java_lang_String::create_from_platform_dependent_str(segment, THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_EXCEPTION; return JVMTI_ERROR_INTERNAL; diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/prims/unsafe.cpp --- a/hotspot/src/share/vm/prims/unsafe.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/prims/unsafe.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -24,6 +24,9 @@ #include "precompiled.hpp" #include "classfile/vmSymbols.hpp" +#ifndef SERIALGC +#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" +#endif // SERIALGC #include "memory/allocation.inline.hpp" #include "prims/jni.h" #include "prims/jvm.h" @@ -193,7 +196,32 @@ UnsafeWrapper("Unsafe_GetObject"); if (obj == NULL) THROW_0(vmSymbols::java_lang_NullPointerException()); GET_OOP_FIELD(obj, offset, v) - return JNIHandles::make_local(env, v); + jobject ret = JNIHandles::make_local(env, v); +#ifndef SERIALGC + // We could be accessing the referent field in a reference + // object. If G1 is enabled then we need to register a non-null + // referent with the SATB barrier. + if (UseG1GC) { + bool needs_barrier = false; + + if (ret != NULL) { + if (offset == java_lang_ref_Reference::referent_offset) { + oop o = JNIHandles::resolve_non_null(obj); + klassOop k = o->klass(); + if (instanceKlass::cast(k)->reference_type() != REF_NONE) { + assert(instanceKlass::cast(k)->is_subclass_of(SystemDictionary::Reference_klass()), "sanity"); + needs_barrier = true; + } + } + } + + if (needs_barrier) { + oop referent = JNIHandles::resolve(ret); + G1SATBCardTableModRefBS::enqueue(referent); + } + } +#endif // SERIALGC + return ret; UNSAFE_END UNSAFE_ENTRY(void, Unsafe_SetObject140(JNIEnv *env, jobject unsafe, jobject obj, jint offset, jobject x_h)) @@ -226,7 +254,32 @@ UNSAFE_ENTRY(jobject, Unsafe_GetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset)) UnsafeWrapper("Unsafe_GetObject"); GET_OOP_FIELD(obj, offset, v) - return JNIHandles::make_local(env, v); + jobject ret = JNIHandles::make_local(env, v); +#ifndef SERIALGC + // We could be accessing the referent field in a reference + // object. If G1 is enabled then we need to register non-null + // referent with the SATB barrier. + if (UseG1GC) { + bool needs_barrier = false; + + if (ret != NULL) { + if (offset == java_lang_ref_Reference::referent_offset && obj != NULL) { + oop o = JNIHandles::resolve(obj); + klassOop k = o->klass(); + if (instanceKlass::cast(k)->reference_type() != REF_NONE) { + assert(instanceKlass::cast(k)->is_subclass_of(SystemDictionary::Reference_klass()), "sanity"); + needs_barrier = true; + } + } + } + + if (needs_barrier) { + oop referent = JNIHandles::resolve(ret); + G1SATBCardTableModRefBS::enqueue(referent); + } + } +#endif // SERIALGC + return ret; UNSAFE_END UNSAFE_ENTRY(void, Unsafe_SetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h)) diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/runtime/arguments.cpp --- a/hotspot/src/share/vm/runtime/arguments.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/runtime/arguments.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -244,6 +244,12 @@ { "MaxLiveObjectEvacuationRatio", JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) }, { "ForceSharedSpaces", JDK_Version::jdk_update(6,25), JDK_Version::jdk(8) }, + { "UseParallelOldGCCompacting", + JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) }, + { "UseParallelDensePrefixUpdate", + JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) }, + { "UseParallelOldGCDensePrefix", + JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) }, { "AllowTransitionalJSR292", JDK_Version::jdk(7), JDK_Version::jdk(8) }, { NULL, JDK_Version(0), JDK_Version(0) } }; @@ -801,26 +807,22 @@ JDK_Version since = JDK_Version(); - if (parse_argument(arg, origin)) { - // do nothing - } else if (is_newly_obsolete(arg, &since)) { - enum { bufsize = 256 }; - char buffer[bufsize]; - since.to_string(buffer, bufsize); - jio_fprintf(defaultStream::error_stream(), - "Warning: The flag %s has been EOL'd as of %s and will" - " be ignored\n", arg, buffer); - } else { - if (!ignore_unrecognized) { - jio_fprintf(defaultStream::error_stream(), - "Unrecognized VM option '%s'\n", arg); - // allow for commandline "commenting out" options like -XX:#+Verbose - if (strlen(arg) == 0 || arg[0] != '#') { - return false; - } - } + if (parse_argument(arg, origin) || ignore_unrecognized) { + return true; } - return true; + + const char * const argname = *arg == '+' || *arg == '-' ? arg + 1 : arg; + if (is_newly_obsolete(arg, &since)) { + char version[256]; + since.to_string(version, sizeof(version)); + warning("ignoring option %s; support was removed in %s", argname, version); + return true; + } + + jio_fprintf(defaultStream::error_stream(), + "Unrecognized VM option '%s'\n", argname); + // allow for commandline "commenting out" options like -XX:#+Verbose + return arg[0] == '#'; } bool Arguments::process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized) { diff -r 837037533544 -r 3ea0814d3885 hotspot/src/share/vm/runtime/globals.hpp --- a/hotspot/src/share/vm/runtime/globals.hpp Thu Apr 21 15:32:48 2011 -0700 +++ b/hotspot/src/share/vm/runtime/globals.hpp Wed Jul 05 17:42:05 2017 +0200 @@ -1355,13 +1355,6 @@ product(bool, UseParallelOldGC, false, \ "Use the Parallel Old garbage collector") \ \ - product(bool, UseParallelOldGCCompacting, true, \ - "In the Parallel Old garbage collector use parallel compaction") \ - \ - product(bool, UseParallelDensePrefixUpdate, true, \ - "In the Parallel Old garbage collector use parallel dense" \ - " prefix update") \ - \ product(uintx, HeapMaximumCompactionInterval, 20, \ "How often should we maximally compact the heap (not allowing " \ "any dead space)") \ @@ -1381,9 +1374,6 @@ "The standard deviation used by the par compact dead wood" \ "limiter (a number between 0-100).") \ \ - product(bool, UseParallelOldGCDensePrefix, true, \ - "Use a dense prefix with the Parallel Old garbage collector") \ - \ product(uintx, ParallelGCThreads, 0, \ "Number of parallel threads parallel gc will use") \ \ diff -r 837037533544 -r 3ea0814d3885 jdk/.hgtags --- a/jdk/.hgtags Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/.hgtags Wed Jul 05 17:42:05 2017 +0200 @@ -113,3 +113,4 @@ aa13e7702cd9d8aca9aa38f1227f966990866944 jdk7-b136 29296ea6529a418037ccce95903249665ef31c11 jdk7-b137 60d3d55dcc9c31a30ced9caa6ef5c0dcd7db031d jdk7-b138 +d80954a89b49fda47c0c5cace65a17f5a758b8bd jdk7-b139 diff -r 837037533544 -r 3ea0814d3885 jdk/make/com/sun/java/pack/Makefile --- a/jdk/make/com/sun/java/pack/Makefile Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/make/com/sun/java/pack/Makefile Wed Jul 05 17:42:05 2017 +0200 @@ -56,10 +56,6 @@ vpath %.cpp $(SHARE_SRC)/native/$(PKGDIR) - - - - ifeq ($(STANDALONE),true) ZIPOBJDIR = $(OUTPUTDIR)/tmp/sun/java.util.zip/zip/$(OBJDIRNAME) @@ -131,8 +127,9 @@ pack200-tool: $(call make-launcher, pack200, com.sun.java.util.jar.pack.Driver, , --pack) +# ignore mapfile for non-product binary unpacker: - $(MAKE) $(UNPACK_EXE) STANDALONE=true LDMAPFLAGS_OPT= LDMAPFLAGS_DBG= + $(MAKE) $(UNPACK_EXE) STANDALONE=true LDMAPFLAGS_DBG= ifeq ($(PLATFORM), windows) IMVERSIONVALUE=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VER).$(COOKED_BUILD_NUMBER) @@ -147,8 +144,14 @@ $(ECHO) "Resource files not required for Unix" endif +# Mapfile-vers.gmk, does not copy over the mapfile-vers-unpack200, when +# the make utiliy is re-invoked, as in this case. In order to workaround +# this special case, the mapfile required for the unpack200 command, is +# explicitly copied over to the expected location. $(UNPACK_EXE): $(UNPACK_EXE_FILES_o) updatefiles winres $(prep-target) + $(RM) $(TEMPDIR)/mapfile-vers + $(CP) mapfile-vers-unpack200 $(TEMPDIR)/mapfile-vers $(LINKER) $(LDDFLAGS) $(UNPACK_EXE_FILES_o) $(RES) $(LIBCXX) $(LDOUTPUT)$(TEMPDIR)/unpack200$(EXE_SUFFIX) ifdef MT $(MT) /manifest $(OBJDIR)/unpack200$(EXE_SUFFIX).manifest /outputresource:$(TEMPDIR)/unpack200$(EXE_SUFFIX);#1 diff -r 837037533544 -r 3ea0814d3885 jdk/make/com/sun/java/pack/mapfile-vers-unpack200 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/make/com/sun/java/pack/mapfile-vers-unpack200 Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,31 @@ +# +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# Define library interface. + +SUNWprivate_1.1 { + local: + *; +}; diff -r 837037533544 -r 3ea0814d3885 jdk/make/common/Mapfile-vers.gmk --- a/jdk/make/common/Mapfile-vers.gmk Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/make/common/Mapfile-vers.gmk Wed Jul 05 17:42:05 2017 +0200 @@ -52,8 +52,8 @@ endif # If we are re-ordering functions in this solaris library, we need to make - # sure that -xF is added to the compile lines. This option is critical and - # enables the functions to be reordered. + # sure that -xF is added to the compile lines. This option is critical and + # enables the functions to be reordered. ifdef FILES_reorder CFLAGS_OPT += -xF CXXFLAGS_OPT += -xF @@ -76,7 +76,6 @@ endif # PLATFORM - ifeq ($(PLATFORM), linux) ifeq ($(VARIANT), OPT) diff -r 837037533544 -r 3ea0814d3885 jdk/make/common/Program.gmk --- a/jdk/make/common/Program.gmk Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/make/common/Program.gmk Wed Jul 05 17:42:05 2017 +0200 @@ -55,6 +55,11 @@ program: $(ACTUAL_PROGRAM) +# reuse the mapfiles in the launcher's directory, the same should +# be applicable to the tool launchers as well. +FILES_m = $(BUILDDIR)/java/main/java/mapfile-$(ARCH) +include $(BUILDDIR)/common/Mapfile-vers.gmk + include $(JDK_TOPDIR)/make/common/Rules.gmk ifdef NEVER_ACT_AS_SERVER_CLASS_MACHINE diff -r 837037533544 -r 3ea0814d3885 jdk/make/common/Release.gmk --- a/jdk/make/common/Release.gmk Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/make/common/Release.gmk Wed Jul 05 17:42:05 2017 +0200 @@ -885,12 +885,18 @@ ABS_DB_PATH :=$(call FullPath,$(CLOSED_SHARE_SRC)/db) DB_ZIP_LIST = $(shell $(LS) $(ABS_DB_PATH)/*.zip 2>/dev/null) +# Java DB image. Move the Java DB demo directory into the JDK's demo +# dir and in the process, rename it to db. Also remove index.html, +# since it presumes docs are co-located. Also remove register.html (no +# longer relevant). initial-image-jdk-db: $(DB_ZIP_LIST) $(MKDIR) -p $(JDK_IMAGE_DIR)/db for d in $(DB_ZIP_LIST); do \ ($(CD) $(JDK_IMAGE_DIR)/db && $(UNZIP) -o $$d); \ done - + $(RM) -rf $(DEMODIR)/db + $(MV) $(JDK_IMAGE_DIR)/db/demo $(DEMODIR)/db + $(RM) $(JDK_IMAGE_DIR)/db/index.html $(JDK_IMAGE_DIR)/db/register.html endif # Standard jdk image diff -r 837037533544 -r 3ea0814d3885 jdk/make/docs/Makefile --- a/jdk/make/docs/Makefile Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/make/docs/Makefile Wed Jul 05 17:42:05 2017 +0200 @@ -53,7 +53,7 @@ DEV_DOCS_URL = $(DEV_DOCS_URL-$(JDK_MINOR_VERSION)) # Url to Java Language Spec -JLS3_URL = http://java.sun.com/docs/books/jls/ +#JLS3_URL = http://java.sun.com/docs/books/jls/ # Common Java trademark line JAVA_TRADEMARK_LINE = Java is a trademark or registered trademark of \ @@ -293,8 +293,8 @@ Java$(TRADEMARK) Platform
Standard Ed. $(JDK_MINOR_VERSION)
# Java language specification cite -TAG_JLS3 = jls3:a:See \ -The Java Language Specification, Third Edition: +TAG_JLS = jls:a:See \ +The Java™ Language Specification: # Overview file for core apis COREAPI_OVERVIEW = $(SHARE_SRC)/classes/overview-core.html @@ -329,7 +329,7 @@ $(call OptionPair,-tag,specdefault:X) ; \ $(call OptionPair,-tag,Note:X) ; \ $(call OptionPair,-tag,ToDo:X) ; \ - $(call OptionPair,-tag,$(TAG_JLS3)) ; \ + $(call OptionPair,-tag,$(TAG_JLS)) ; \ $(call OptionOnly,-splitIndex) ; \ $(call OptionPair,-overview,$(COREAPI_OVERVIEW)) ; \ $(call OptionPair,-doctitle,$(COREAPI_DOCTITLE)) ; \ @@ -1081,6 +1081,7 @@ $(call OptionPair,-doctitle,$(TREEAPI_DOCTITLE)) ; \ $(call OptionPair,-windowtitle,$(TREEAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\ $(call OptionPair,-header,$(TREEAPI_HEADER)$(DRAFT_HEADER)) ; \ + $(call OptionPair,-tag,$(TAG_JLS)) ; \ $(call OptionPair,-bottom,$(TREEAPI_BOTTOM)$(DRAFT_BOTTOM)) ; \ $(call OptionTrip,-group,$(TREEAPI_GROUPNAME),$(TREEAPI_REGEXP)); \ $(call OptionTrip,-linkoffline,$(TREEAPI2COREAPI),$(COREAPI_DOCSDIR)/); \ diff -r 837037533544 -r 3ea0814d3885 jdk/make/java/java/FILES_java.gmk --- a/jdk/make/java/java/FILES_java.gmk Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/make/java/java/FILES_java.gmk Wed Jul 05 17:42:05 2017 +0200 @@ -189,7 +189,6 @@ java/util/ListResourceBundle.java \ sun/util/EmptyListResourceBundle.java \ java/util/Locale.java \ - sun/util/locale/AsciiUtil.java \ sun/util/locale/BaseLocale.java \ sun/util/locale/Extension.java \ sun/util/locale/InternalLocaleBuilder.java \ @@ -197,6 +196,7 @@ sun/util/locale/LocaleExtensions.java \ sun/util/locale/LocaleObjectCache.java \ sun/util/locale/LocaleSyntaxException.java \ + sun/util/locale/LocaleUtils.java \ sun/util/locale/ParseStatus.java \ sun/util/locale/StringTokenIterator.java \ sun/util/locale/UnicodeLocaleExtension.java \ diff -r 837037533544 -r 3ea0814d3885 jdk/make/java/main/java/Makefile --- a/jdk/make/java/main/java/Makefile Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/make/java/main/java/Makefile Wed Jul 05 17:42:05 2017 +0200 @@ -61,5 +61,4 @@ ifeq ($(PLATFORM), solaris) LDFLAGS += -R$(OPENWIN_LIB) -LDFLAGS += -M mapfile-$(ARCH) endif diff -r 837037533544 -r 3ea0814d3885 jdk/make/java/main/java/mapfile-amd64 --- a/jdk/make/java/main/java/mapfile-amd64 Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/make/java/main/java/mapfile-amd64 Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ # interested in declaring a version, simply scoping the file is sufficient. # -{ +SUNWprivate_1.1 { global: main; # Provides basic adb symbol offsets environ; # Public symbols and required by Java run time diff -r 837037533544 -r 3ea0814d3885 jdk/make/java/main/java/mapfile-i586 --- a/jdk/make/java/main/java/mapfile-i586 Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/make/java/main/java/mapfile-i586 Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ # interested in declaring a version, simply scoping the file is sufficient. # -{ +SUNWprivate_1.1 { global: main; # Provides basic adb symbol offsets environ; # Public symbols and required by Java run time diff -r 837037533544 -r 3ea0814d3885 jdk/make/java/main/java/mapfile-sparc --- a/jdk/make/java/main/java/mapfile-sparc Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/make/java/main/java/mapfile-sparc Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ # interested in declaring a version, simply scoping the file is sufficient. # -{ +SUNWprivate_1.1 { global: main; # Provides basic adb symbol offsets environ; # Public symbols and required by Java run time diff -r 837037533544 -r 3ea0814d3885 jdk/make/java/main/java/mapfile-sparcv9 --- a/jdk/make/java/main/java/mapfile-sparcv9 Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/make/java/main/java/mapfile-sparcv9 Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ # interested in declaring a version, simply scoping the file is sufficient. # -{ +SUNWprivate_1.1 { global: main; # Provides basic adb symbol offsets environ; # Public symbols and required by Java run time diff -r 837037533544 -r 3ea0814d3885 jdk/make/javax/crypto/Defs-jce.gmk --- a/jdk/make/javax/crypto/Defs-jce.gmk Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/make/javax/crypto/Defs-jce.gmk Wed Jul 05 17:42:05 2017 +0200 @@ -58,7 +58,7 @@ SIGNING_KEY_DIR = /security/ws/JCE-signing/src SIGNING_KEYSTORE = $(SIGNING_KEY_DIR)/KeyStore.jks SIGNING_PASSPHRASE = $(SIGNING_KEY_DIR)/passphrase.txt -SIGNING_ALIAS = jce_rsa +SIGNING_ALIAS = oracle_jce_rsa # # Defines for signing the various jar files. diff -r 837037533544 -r 3ea0814d3885 jdk/make/jpda/jdwp/jdwp.spec --- a/jdk/make/jpda/jdwp/jdwp.spec Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/make/jpda/jdwp/jdwp.spec Wed Jul 05 17:42:05 2017 +0200 @@ -519,9 +519,8 @@ "Both the JNI signature and the generic signature are " "returned for each class. " "Generic signatures are described in the signature attribute " - "section in the " - " - "Java Virtual Machine Specification, 3rd Edition. " + "section in " + "The Java™ Virtual Machine Specification. " "Since JDWP version 1.5." (Out ) @@ -623,8 +622,8 @@ (referenceType refType "The reference type ID.") ) (Reply - (int modBits "Modifier bits as defined in the " - "VM Specification") + (int modBits "Modifier bits as defined in Chapter 4 of " + "The Java™ Virtual Machine Specification") ) (ErrorSet (Error INVALID_CLASS "refType is not the ID of a reference " @@ -651,8 +650,8 @@ (int modBits "The modifier bit flags (also known as access flags) " "which provide additional information on the " "field declaration. Individual flag values are " - "defined in the " - "VM Specification." + "defined in Chapter 4 of " + "The Java™ Virtual Machine Specification. " "In addition, The 0xf0000000 bit identifies " "the field as synthetic, if the synthetic attribute " "capability is available.") @@ -686,8 +685,8 @@ (int modBits "The modifier bit flags (also known as access flags) " "which provide additional information on the " "method declaration. Individual flag values are " - "defined in the " - "VM Specification." + "defined in Chapter 4 of " + "The Java™ Virtual Machine Specification. " "In addition, The 0xf0000000 bit identifies " "the method as synthetic, if the synthetic attribute " "capability is available.") @@ -773,8 +772,8 @@ (Command Status=9 "Returns the current status of the reference type. The status " "indicates the extent to which the reference type has been " - "initialized, as described in the " - "VM specification. " + "initialized, as described in section 2.1.6 of " + "The Java™ Virtual Machine Specification. " "If the class is linked the PREPARED and VERIFIED bits in the returned status bits " "will be set. If the class is initialized the INITIALIZED bit in the returned " "status bits will be set. If an error occured during initialization then the " @@ -852,9 +851,8 @@ "Returns the JNI signature of a reference type along with the " "generic signature if there is one. " "Generic signatures are described in the signature attribute " - "section in the " - " - "Java Virtual Machine Specification, 3rd Edition. " + "section in " + "The Java™ Virtual Machine Specification. " "Since JDWP version 1.5." "

(Out @@ -882,9 +880,8 @@ "by the compiler. " "Fields are returned in the order they occur in the class file. " "Generic signatures are described in the signature attribute " - "section in the " - " - "Java Virtual Machine Specification, 3rd Edition. " + "section in " + "The Java™ Virtual Machine Specification. " "Since JDWP version 1.5." (Out (referenceType refType "The reference type ID.") @@ -900,8 +897,8 @@ (int modBits "The modifier bit flags (also known as access flags) " "which provide additional information on the " "field declaration. Individual flag values are " - "defined in the " - "VM Specification." + "defined in Chapter 4 of " + "The Java™ Virtual Machine Specification. " "In addition, The 0xf0000000 bit identifies " "the field as synthetic, if the synthetic attribute " "capability is available.") @@ -925,9 +922,8 @@ "if present, and any synthetic methods created by the compiler. " "Methods are returned in the order they occur in the class file. " "Generic signatures are described in the signature attribute " - "section in the " - " - "Java Virtual Machine Specification, 3rd Edition. " + "section in " + "The Java™ Virtual Machine Specification. " "Since JDWP version 1.5." (Out (referenceType refType "The reference type ID.") @@ -943,8 +939,8 @@ (int modBits "The modifier bit flags (also known as access flags) " "which provide additional information on the " "method declaration. Individual flag values are " - "defined in the " - "VM Specification." + "defined in Chapter 4 of " + "The Java™ Virtual Machine Specification. " "In addition, The 0xf0000000 bit identifies " "the method as synthetic, if the synthetic attribute " "capability is available.") @@ -1006,8 +1002,8 @@ ) (Command ConstantPool=18 "Return the raw bytes of the constant pool in the format of the " - "constant_pool item of the Class File Format in the " - "Java Virtual Machine Specification. " + "constant_pool item of the Class File Format in " + "The Java™ Virtual Machine Specification. " "

Since JDWP version 1.6. Requires canGetConstantPool capability - see " "CapabilitiesNew."" (Out @@ -1016,7 +1012,8 @@ (Reply (int count "Total number of constant pool entries plus one. This " "corresponds to the constant_pool_count item of the " - "Class File Format in the Java Virtual Machine Specification. ") + "Class File Format in " + "The Java™ Virtual Machine Specification. ") (Repeat bytes (byte cpbytes "Raw bytes of constant pool") ) @@ -1324,7 +1321,8 @@ ) ) (Command Bytecodes=3 - "Retrieve the method's bytecodes as defined in the JVM Specification." + "Retrieve the method's bytecodes as defined in " + "The Java™ Virtual Machine Specification. " "Requires canGetBytecodes capability - see " "CapabilitiesNew." (Out @@ -1379,9 +1377,8 @@ "instance methods, the \"this\" reference is included in the " "table. Also, synthetic variables may be present. " "Generic signatures are described in the signature attribute " - "section in the " - " - "Java Virtual Machine Specification, 3rd Edition. " + "section in " + "The Java™ Virtual Machine Specification. " "Since JDWP version 1.5." (Out (referenceType refType "The class.") @@ -1970,8 +1967,9 @@ "

" "The method which will return early is referred to as the " "called method. The called method is the current method (as " - "defined by the Frames section in the Java Virtual Machine " - "Specification) for the specified thread at the time this command " + "defined by the Frames section in " + "The Java™ Virtual Machine Specification) " + "for the specified thread at the time this command " "is received. " "

" "The specified thread must be suspended. " diff -r 837037533544 -r 3ea0814d3885 jdk/make/mksample/Makefile --- a/jdk/make/mksample/Makefile Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/make/mksample/Makefile Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ endif SUBDIRS = -SUBDIRS_misc = nio scripting nbproject +SUBDIRS_misc = nio scripting nbproject forkjoin SUBDIRS_enterprise = $(WEBSERVICES_SUBDIR) SUBDIRS_management = jmx diff -r 837037533544 -r 3ea0814d3885 jdk/make/mksample/forkjoin/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/make/mksample/forkjoin/Makefile Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,41 @@ +# +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# +# Makefile for building all the samples under the forkjoin subdirectory. +# + +BUILDDIR = ../.. +PRODUCT = java +include $(BUILDDIR)/common/Defs.gmk + +SUBDIRS = mergesort +include $(BUILDDIR)/common/Subdirs.gmk + +all build clean clobber:: + $(SUBDIRS-loop) + +clobber clean :: + $(RM) -r $(SAMPLEDIR)/forkjoin diff -r 837037533544 -r 3ea0814d3885 jdk/make/mksample/forkjoin/mergesort/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/make/mksample/forkjoin/mergesort/Makefile Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,51 @@ +# +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# +# Makefile for the forkjoin/mergesort sample code +# + +BUILDDIR = ../../.. + +PRODUCT = java + +include $(BUILDDIR)/common/Defs.gmk + +SAMPLE_SRC_DIR = $(SHARE_SRC)/sample/forkjoin/mergesort +SAMPLE_DST_DIR = $(SAMPLEDIR)/forkjoin/mergesort + +SAMPLE_FILES = \ + $(SAMPLE_DST_DIR)/MergeDemo.java \ + $(SAMPLE_DST_DIR)/MergeSort.java + +all build: $(SAMPLE_FILES) + +$(SAMPLE_DST_DIR)/%: $(SAMPLE_SRC_DIR)/% + $(install-file) + +clean clobber: + $(RM) -r $(SAMPLE_DST_DIR) + +.PHONY: all build clean clobber diff -r 837037533544 -r 3ea0814d3885 jdk/make/mksample/nio/Makefile --- a/jdk/make/mksample/nio/Makefile Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/make/mksample/nio/Makefile Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ PRODUCT = java include $(BUILDDIR)/common/Defs.gmk -SUBDIRS = file multicast server +SUBDIRS = chatserver file multicast server include $(BUILDDIR)/common/Subdirs.gmk all build clean clobber:: diff -r 837037533544 -r 3ea0814d3885 jdk/make/mksample/nio/chatserver/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/make/mksample/nio/chatserver/Makefile Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,56 @@ +# +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# +# Makefile for the nio/chatserver sample code +# + +BUILDDIR = ../../.. + +PRODUCT = java + +include $(BUILDDIR)/common/Defs.gmk + +SAMPLE_SRC_DIR = $(SHARE_SRC)/sample/nio/chatserver +SAMPLE_DST_DIR = $(SAMPLEDIR)/nio/chatserver + +SAMPLE_FILES = \ + $(SAMPLE_DST_DIR)/ChatServer.java \ + $(SAMPLE_DST_DIR)/Client.java \ + $(SAMPLE_DST_DIR)/ClientReader.java \ + $(SAMPLE_DST_DIR)/DataReader.java \ + $(SAMPLE_DST_DIR)/MessageReader.java \ + $(SAMPLE_DST_DIR)/NameReader.java \ + $(SAMPLE_DST_DIR)/README.txt + +all build: $(SAMPLE_FILES) + +$(SAMPLE_DST_DIR)/%: $(SAMPLE_SRC_DIR)/% + $(install-file) + +clean clobber: + $(RM) -r $(SAMPLE_DST_DIR) + +.PHONY: all build clean clobber diff -r 837037533544 -r 3ea0814d3885 jdk/make/sun/Makefile --- a/jdk/make/sun/Makefile Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/make/sun/Makefile Wed Jul 05 17:42:05 2017 +0200 @@ -83,6 +83,11 @@ SUBDIRS_management = management SUBDIRS_misc = $(ORG_SUBDIR) rmi $(JDBC_SUBDIR) tracing SUBDIRS_tools = native2ascii serialver tools jconsole + +ifndef OPENJDK + SUBDIRS += usagetracker +endif + include $(BUILDDIR)/common/Subdirs.gmk all build clean clobber:: diff -r 837037533544 -r 3ea0814d3885 jdk/make/sun/jpeg/Makefile diff -r 837037533544 -r 3ea0814d3885 jdk/make/sun/usagetracker/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/make/sun/usagetracker/Makefile Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,40 @@ +# +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +BUILDDIR = ../.. +PACKAGE = sun.usagetracker +PRODUCT = sun +include $(BUILDDIR)/common/Defs.gmk + +# +# Files +# +AUTO_FILES_JAVA_DIRS = sun/usagetracker + +# +# Rules +# +include $(BUILDDIR)/common/Classes.gmk + diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/bin/jli_util.h --- a/jdk/src/share/bin/jli_util.h Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/bin/jli_util.h Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,6 @@ void JLI_MemFree(void *ptr); int JLI_StrCCmp(const char *s1, const char* s2); - #define JLI_StrLen(p1) strlen((p1)) #define JLI_StrChr(p1, p2) strchr((p1), (p2)) #define JLI_StrRChr(p1, p2) strrchr((p1), (p2)) @@ -48,6 +47,7 @@ #define JLI_StrSpn(p1, p2) strspn((p1), (p2)) #define JLI_StrCSpn(p1, p2) strcspn((p1), (p2)) #define JLI_StrPBrk(p1, p2) strpbrk((p1), (p2)) +#define JLI_StrTok(p1, p2) strtok((p1), (p2)) /* On Windows lseek() is in io.h rather than the location dictated by POSIX. */ #ifdef _WIN32 diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/beans/TypeResolver.java --- a/jdk/src/share/classes/com/sun/beans/TypeResolver.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/beans/TypeResolver.java Wed Jul 05 17:42:05 2017 +0200 @@ -175,8 +175,8 @@ /** * Converts the given {@code type} to the corresponding class. * This method implements the concept of type erasure, - * that is described in section 4.6 - * of Java Language Specification. + * that is described in section 4.6 of + * The Java™ Language Specification. * * @param type the array of types to convert * @return a corresponding class diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/java/util/jar/pack/package.html --- a/jdk/src/share/classes/com/sun/java/util/jar/pack/package.html Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/package.html Wed Jul 05 17:42:05 2017 +0200 @@ -88,8 +88,8 @@ http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html

  • -Java Virtual Machine Specification : -http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html
  • +Class File Specification: Chapter 4 of +The Java™ Virtual Machine Specification
  • Hypertext Transfer Protocol -- HTTP/1.1 : diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/jdi/Accessible.java --- a/jdk/src/share/classes/com/sun/jdi/Accessible.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/jdi/Accessible.java Wed Jul 05 17:42:05 2017 +0200 @@ -42,12 +42,9 @@ * Returns the JavaTM * programming language modifiers, encoded in an integer. *

    - * The modifier encodings are defined in the - * Java Virtual Machine - * Specification, in the access_flag tables for - * classes, - * fields, and - * methods. + * The modifier encodings are defined in + * The Java™ Virtual Machine Specification + * in the access_flag tables for classes(section 4.1), fields(section 4.5), and methods(section 4.6). */ public int modifiers(); diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/jdi/ArrayType.java --- a/jdk/src/share/classes/com/sun/jdi/ArrayType.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/jdi/ArrayType.java Wed Jul 05 17:42:05 2017 +0200 @@ -77,11 +77,9 @@ * as specified in the array declaration. *

    * Note: The component type of a array will always be - * created or loaded before the array - see the - * Java Virtual - * Machine Specification, section - * 5.3.3 - * Creating Array Classes. + * created or loaded before the array - see + * The Java™ Virtual Machine Specification, + * section 5.3.3 - Creating Array Classes. * However, although the component type will be loaded it may * not yet be prepared, in which case the type will be returned * but attempts to perform some operations on the returned type diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/jdi/ClassLoaderReference.java --- a/jdk/src/share/classes/com/sun/jdi/ClassLoaderReference.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/jdi/ClassLoaderReference.java Wed Jul 05 17:42:05 2017 +0200 @@ -71,11 +71,9 @@ *

    * No ordering of the returned list is guaranteed. *

    - * See the revised - * Java - * Virtual Machine Specification section - * 5.3 - * Creation and Loading + * See + * The Java™ Virtual Machine Specification, + * section 5.3 - Creation and Loading * for more information on the initiating classloader. *

    * Note that unlike {@link #definedClasses()} diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/jdi/ClassNotLoadedException.java --- a/jdk/src/share/classes/com/sun/jdi/ClassNotLoadedException.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/jdi/ClassNotLoadedException.java Wed Jul 05 17:42:05 2017 +0200 @@ -60,9 +60,9 @@ * is visible to the class loader of enclosing class. (That is, the * class loader of the enclosing class must be an initiating class * loader for the class in question.) - * See the Java - * Virtual Machine Specification for - * more details. + * See + * The Java™ Virtual Machine Specification + * for more details. * * @author Gordon Hirsch * @since 1.3 diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/jdi/ClassType.java --- a/jdk/src/share/classes/com/sun/jdi/ClassType.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/jdi/ClassType.java Wed Jul 05 17:42:05 2017 +0200 @@ -164,10 +164,8 @@ * component type is passed. The component type can be a primitive type. * Autoboxing is not supported. * - * See the - * Java Language Specification. - * section - * 5.2 + * See Section 5.2 of + * The Java™ Language Specification * for more information on assignment compatibility. *

    * By default, all threads in the target VM are resumed while @@ -280,10 +278,8 @@ * component type is passed. The component type can be a primitive type. * Autoboxing is not supported. * - * See the - * Java Language Specification. - * section - * 5.2 + * See section 5.2 of + * The Java™ Language Specification * for more information on assignment compatibility. *

    * By default, all threads in the target VM are resumed while diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/jdi/LocalVariable.java --- a/jdk/src/share/classes/com/sun/jdi/LocalVariable.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/jdi/LocalVariable.java Wed Jul 05 17:42:05 2017 +0200 @@ -102,9 +102,7 @@ /** * Gets the generic signature for this variable if there is one. * Generic signatures are described in the - * - * "JavaTM - * Virtual Machine Specification, 3rd Edition. + * The Java™ Virtual Machine Specification. * * @return a string containing the generic signature, or null * if there is no generic signature. diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/jdi/Method.java --- a/jdk/src/share/classes/com/sun/jdi/Method.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/jdi/Method.java Wed Jul 05 17:42:05 2017 +0200 @@ -164,10 +164,8 @@ /** * Determine if this method is a bridge method. Bridge - * methods are defined in the - * - * "JavaTM - * Language Specification, 3rd Edition. + * methods are defined in + * The Java™ Language Specification. * * @return true if the method is a bridge method, * false otherwise. diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/jdi/ObjectReference.java --- a/jdk/src/share/classes/com/sun/jdi/ObjectReference.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/jdi/ObjectReference.java Wed Jul 05 17:42:05 2017 +0200 @@ -118,10 +118,8 @@ * enclosing class's class loader). Primitive values must be * either assignment compatible with the field type or must be * convertible to the field type without loss of information. - * See the - * JavaTM Language Specification. - * section - * 5.2 + * See section 5.2 of + * The Java™ Language Specification * for more information on assignment * compatibility. * @@ -182,18 +180,13 @@ * component type is passed. The component type can be a primitive type. * Autoboxing is not supported. * - * See the - * Java Language Specification. - * section - * 5.2 + * See section 5.2 of + * The Java™ Language Specification * for more information on assignment compatibility. *

    * By default, the method is invoked using dynamic lookup as - * documented in the - * - * Java Language Specification - * second edition, section - * 15.12.4.4; + * documented in section 15.12.4.4 of + * The Java™ Language Specification * in particular, overriding based on the runtime type of the object * mirrored by this {@link ObjectReference} will occur. This * behavior can be changed by specifying the diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/jdi/ReferenceType.java --- a/jdk/src/share/classes/com/sun/jdi/ReferenceType.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/jdi/ReferenceType.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,9 +30,8 @@ /** * The type of an object in a target VM. ReferenceType encompasses - * classes, interfaces, and array types as defined in the - * - * JavaTM Language Specification. + * classes, interfaces, and array types as defined in + * The Java™ Language Specification. * All ReferenceType objects belong to one of the following * subinterfaces: * {@link ClassType} for classes, @@ -98,9 +97,7 @@ /** * Gets the generic signature for this type if there is one. * Generic signatures are described in the - * - * "JavaTM - * Virtual Machine Specification, 3rd Edition. + * The Java™ Virtual Machine Specification. * * @return a string containing the generic signature, or null * if there is no generic signature. diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/jdi/TypeComponent.java --- a/jdk/src/share/classes/com/sun/jdi/TypeComponent.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/jdi/TypeComponent.java Wed Jul 05 17:42:05 2017 +0200 @@ -74,9 +74,7 @@ /** * Gets the generic signature for this TypeComponent if there is one. * Generic signatures are described in the - * - * "JavaTM - * Virtual Machine Specification, 3rd Edition. + * The Java™ Virtual Machine Specification. * * @return a string containing the generic signature, or null * if there is no generic signature. diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/media/sound/DLSInstrument.java --- a/jdk/src/share/classes/com/sun/media/sound/DLSInstrument.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/media/sound/DLSInstrument.java Wed Jul 05 17:42:05 2017 +0200 @@ -25,6 +25,7 @@ package com.sun.media.sound; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -439,10 +440,10 @@ } public byte[] getGuid() { - return guid; + return guid == null ? null : Arrays.copyOf(guid, guid.length); } public void setGuid(byte[] guid) { - this.guid = guid; + this.guid = guid == null ? null : Arrays.copyOf(guid, guid.length); } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/media/sound/DLSSample.java --- a/jdk/src/share/classes/com/sun/media/sound/DLSSample.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/media/sound/DLSSample.java Wed Jul 05 17:42:05 2017 +0200 @@ -25,6 +25,7 @@ package com.sun.media.sound; import java.io.InputStream; +import java.util.Arrays; import javax.sound.midi.Soundbank; import javax.sound.midi.SoundbankResource; import javax.sound.sampled.AudioFormat; @@ -113,10 +114,10 @@ } public byte[] getGuid() { - return guid; + return guid == null ? null : Arrays.copyOf(guid, guid.length); } public void setGuid(byte[] guid) { - this.guid = guid; + this.guid = guid == null ? null : Arrays.copyOf(guid, guid.length); } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java --- a/jdk/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java Wed Jul 05 17:42:05 2017 +0200 @@ -24,6 +24,8 @@ */ package com.sun.media.sound; +import java.util.Arrays; + /** * Connection blocks are used to connect source variable * to a destination variable. @@ -117,19 +119,17 @@ } public ModelSource[] getSources() { - return sources; + return Arrays.copyOf(sources, sources.length); } public void setSources(ModelSource[] source) { - this.sources = source; + this.sources = source == null ? no_sources : Arrays.copyOf(source, source.length); } public void addSource(ModelSource source) { ModelSource[] oldsources = sources; sources = new ModelSource[oldsources.length + 1]; - for (int i = 0; i < oldsources.length; i++) { - sources[i] = oldsources[i]; - } + System.arraycopy(oldsources, 0, sources, 0, oldsources.length); sources[sources.length - 1] = source; } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/media/sound/SoftChannel.java --- a/jdk/src/share/classes/com/sun/media/sound/SoftChannel.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/media/sound/SoftChannel.java Wed Jul 05 17:42:05 2017 +0200 @@ -503,7 +503,7 @@ firstVoice = true; voiceNo = 0; - int tunedKey = (int)(Math.round(tuning.getTuning()[noteNumber]/100.0)); + int tunedKey = (int)(Math.round(tuning.getTuning(noteNumber)/100.0)); play_noteNumber = noteNumber; play_velocity = velocity; play_delay = delay; @@ -607,7 +607,7 @@ firstVoice = true; voiceNo = 0; - int tunedKey = (int)(Math.round(tuning.getTuning()[noteNumber]/100.0)); + int tunedKey = (int)(Math.round(tuning.getTuning(noteNumber)/100.0)); play_noteNumber = noteNumber; play_velocity = lastVelocity[noteNumber]; play_releasetriggered = true; @@ -632,7 +632,7 @@ int delay = play_delay; boolean releasetriggered = play_releasetriggered; - SoftPerformer p = current_instrument.getPerformers()[performerIndex]; + SoftPerformer p = current_instrument.getPerformer(performerIndex); if (firstVoice) { firstVoice = false; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/media/sound/SoftInstrument.java --- a/jdk/src/share/classes/com/sun/media/sound/SoftInstrument.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/media/sound/SoftInstrument.java Wed Jul 05 17:42:05 2017 +0200 @@ -76,7 +76,12 @@ return data; } + /* am: currently getPerformers() is not used (replaced with getPerformer(int)) public SoftPerformer[] getPerformers() { return performers; } + */ + public SoftPerformer getPerformer(int index) { + return performers[index]; + } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java --- a/jdk/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java Wed Jul 05 17:42:05 2017 +0200 @@ -505,7 +505,7 @@ } public Control[] getControls() { - return controls; + return Arrays.copyOf(controls, controls.length); } public boolean isControlSupported(Type control) { diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/media/sound/SoftProvider.java --- a/jdk/src/share/classes/com/sun/media/sound/SoftProvider.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/media/sound/SoftProvider.java Wed Jul 05 17:42:05 2017 +0200 @@ -24,6 +24,7 @@ */ package com.sun.media.sound; +import java.util.Arrays; import javax.sound.midi.MidiDevice; import javax.sound.midi.MidiDevice.Info; import javax.sound.midi.spi.MidiDeviceProvider; @@ -39,7 +40,7 @@ private static Info[] softinfos = {softinfo}; public MidiDevice.Info[] getDeviceInfo() { - return softinfos; + return Arrays.copyOf(softinfos, softinfos.length); } public MidiDevice getDevice(MidiDevice.Info info) { diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/media/sound/SoftTuning.java --- a/jdk/src/share/classes/com/sun/media/sound/SoftTuning.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/media/sound/SoftTuning.java Wed Jul 05 17:42:05 2017 +0200 @@ -25,6 +25,7 @@ package com.sun.media.sound; import java.io.UnsupportedEncodingException; +import java.util.Arrays; import javax.sound.midi.Patch; @@ -234,8 +235,10 @@ } } + // am: getTuning(int) is more effective. + // currently getTuning() is used only by tests public double[] getTuning() { - return tuning; + return Arrays.copyOf(tuning, tuning.length); } public double getTuning(int noteNumber) { diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java --- a/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -111,13 +111,13 @@ */ private String tableName; - /** * A Vector object containing the Row * objects that comprise this CachedRowSetImpl object. * @serial */ - private Vector rvh; + private Vector rvh; + /** * The current postion of the cursor in this CachedRowSetImpl * object. @@ -293,12 +293,12 @@ /** * The Vector holding the Match Columns */ - private Vector iMatchColumns; + private Vector iMatchColumns; /** * The Vector that will hold the Match Column names. */ - private Vector strMatchColumns; + private Vector strMatchColumns; /** * Trigger that indicates whether the active SyncProvider is exposes the @@ -484,7 +484,7 @@ */ private void initContainer() { - rvh = new Vector(100); + rvh = new Vector(100); cursorPos = 0; absolutePos = 0; numRows = 0; @@ -523,12 +523,12 @@ //Instantiating the vector for MatchColumns - iMatchColumns = new Vector(10); + iMatchColumns = new Vector(10); for(int i = 0; i < 10 ; i++) { iMatchColumns.add(i,Integer.valueOf(-1)); } - strMatchColumns = new Vector(10); + strMatchColumns = new Vector(10); for(int j = 0; j < 10; j++) { strMatchColumns.add(j,null); } @@ -622,7 +622,7 @@ Row currentRow; int numCols; int i; - Map map = getTypeMap(); + Map> map = getTypeMap(); Object obj; int mRows; @@ -939,14 +939,9 @@ */ public void acceptChanges(Connection con) throws SyncProviderException{ - try{ - setConnection(con); - acceptChanges(); - } catch (SyncProviderException spe) { - throw spe; - } catch(SQLException sqle){ - throw new SyncProviderException(sqle.getMessage()); - } + setConnection(con); + acceptChanges(); + } /** @@ -1289,14 +1284,7 @@ */ public Collection toCollection() throws SQLException { - TreeMap tMap; - int count = 0; - Row origRow; - Vector newRow; - - int colCount = ((RowSetMetaDataImpl)this.getMetaData()).getColumnCount(); - - tMap = new TreeMap(); + TreeMap tMap = new TreeMap<>(); for (int i = 0; i toCollection(int column) throws SQLException { - Vector vec; - Row origRow; int nRows = numRows; - vec = new Vector(nRows); + Vector vec = new Vector<>(nRows); // create a copy CachedRowSetImpl crsTemp; @@ -2953,7 +2939,7 @@ */ public Object getObject(int columnIndex) throws SQLException { Object value; - java.util.Map map; + Map> map; // sanity check. checkIndex(columnIndex); @@ -7257,7 +7243,7 @@ Row currentRow; int numCols; int i; - Map map = getTypeMap(); + Map> map = getTypeMap(); Object obj; int mRows; @@ -7304,11 +7290,11 @@ resultSet.absolute(start -1); } if( pageSize == 0) { - rvh = new Vector(getMaxRows()); + rvh = new Vector(getMaxRows()); } else{ - rvh = new Vector(getPageSize()); + rvh = new Vector(getPageSize()); } if (data == null) { diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java --- a/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -93,12 +93,12 @@ /** * The Vector holding the Match Columns */ - private Vector iMatchColumns; + private Vector iMatchColumns; /** * The Vector that will hold the Match Column names. */ - private Vector strMatchColumns; + private Vector strMatchColumns; protected transient JdbcRowSetResourceBundle resBundle; @@ -213,12 +213,12 @@ //Instantiating the vector for MatchColumns - iMatchColumns = new Vector(10); + iMatchColumns = new Vector(10); for(int i = 0; i < 10 ; i++) { iMatchColumns.add(i,Integer.valueOf(-1)); } - strMatchColumns = new Vector(10); + strMatchColumns = new Vector(10); for(int j = 0; j < 10; j++) { strMatchColumns.add(j,null); } @@ -286,12 +286,12 @@ //Instantiating the vector for MatchColumns - iMatchColumns = new Vector(10); + iMatchColumns = new Vector(10); for(int i = 0; i < 10 ; i++) { iMatchColumns.add(i,Integer.valueOf(-1)); } - strMatchColumns = new Vector(10); + strMatchColumns = new Vector(10); for(int j = 0; j < 10; j++) { strMatchColumns.add(j,null); } @@ -373,12 +373,12 @@ //Instantiating the vector for MatchColumns - iMatchColumns = new Vector(10); + iMatchColumns = new Vector(10); for(int i = 0; i < 10 ; i++) { iMatchColumns.add(i,Integer.valueOf(-1)); } - strMatchColumns = new Vector(10); + strMatchColumns = new Vector(10); for(int j = 0; j < 10; j++) { strMatchColumns.add(j,null); } @@ -463,12 +463,12 @@ //Instantiating the vector for MatchColumns - iMatchColumns = new Vector(10); + iMatchColumns = new Vector(10); for(int i = 0; i < 10 ; i++) { iMatchColumns.add(i,Integer.valueOf(-1)); } - strMatchColumns = new Vector(10); + strMatchColumns = new Vector(10); for(int j = 0; j < 10; j++) { strMatchColumns.add(j,null); } @@ -675,7 +675,7 @@ try { - Map aMap = getTypeMap(); + Map> aMap = getTypeMap(); if( aMap != null) { conn.setTypeMap(aMap); } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java --- a/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,8 +59,8 @@ /** * A Vector object that contains the RowSet objects * that have been added to this JoinRowSet object. - */ - private Vector vecRowSetsInJOIN; + */ + private Vector vecRowSetsInJOIN; /** * The CachedRowSet object that encapsulates this @@ -78,13 +78,13 @@ * for this JoinRowSet object. * The last join type set forms the basis of succeeding joins. */ - private Vector vecJoinType; + private Vector vecJoinType; /** * A Vector object containing the names of all the tables entering * the join. */ - private Vector vecTableNames; + private Vector vecTableNames; /** * An int that indicates the column index of the match column. @@ -121,10 +121,10 @@ */ public JoinRowSetImpl() throws SQLException { - vecRowSetsInJOIN = new Vector(); + vecRowSetsInJOIN = new Vector(); crsInternal = new CachedRowSetImpl(); - vecJoinType = new Vector(); - vecTableNames = new Vector(); + vecJoinType = new Vector(); + vecTableNames = new Vector(); iMatchKey = -1; strMatchKey = null; supportedJOINs = @@ -222,7 +222,7 @@ // either of the setter methods have been set. if(boolColId){ // - ArrayList indices = new ArrayList(); + ArrayList indices = new ArrayList<>(); for(int i=0;i *

    - * Simulated full-screen mode resizes - * the window to the size of the screen and positions it at (0,0). + * The simulated full-screen mode places and resizes the window to the maximum + * possible visible area of the screen. However, the native windowing system + * may modify the requested geometry-related data, so that the {@code Window} object + * is placed and sized in a way that corresponds closely to the desktop settings. *

    * When entering full-screen mode, if the window to be used as a * full-screen window is not visible, this method will make it visible. diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/awt/Toolkit.java --- a/jdk/src/share/classes/java/awt/Toolkit.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/awt/Toolkit.java Wed Jul 05 17:42:05 2017 +0200 @@ -466,6 +466,10 @@ */ protected void loadSystemColors(int[] systemColors) throws HeadlessException { + if (GraphicsEnvironment.isHeadless()){ + throw new HeadlessException(); + } + } /** @@ -500,6 +504,10 @@ */ public void setDynamicLayout(boolean dynamic) throws HeadlessException { + if (GraphicsEnvironment.isHeadless()){ + throw new HeadlessException(); + } + } /** @@ -523,6 +531,9 @@ */ protected boolean isDynamicLayoutSet() throws HeadlessException { + if (GraphicsEnvironment.isHeadless()){ + throw new HeadlessException(); + } if (this != Toolkit.getDefaultToolkit()) { return Toolkit.getDefaultToolkit().isDynamicLayoutSet(); } else { @@ -558,6 +569,9 @@ */ public boolean isDynamicLayoutActive() throws HeadlessException { + if (GraphicsEnvironment.isHeadless()){ + throw new HeadlessException(); + } if (this != Toolkit.getDefaultToolkit()) { return Toolkit.getDefaultToolkit().isDynamicLayoutActive(); } else { @@ -601,6 +615,9 @@ */ public Insets getScreenInsets(GraphicsConfiguration gc) throws HeadlessException { + if (GraphicsEnvironment.isHeadless()){ + throw new HeadlessException(); + } if (this != Toolkit.getDefaultToolkit()) { return Toolkit.getDefaultToolkit().getScreenInsets(gc); } else { @@ -1342,6 +1359,9 @@ * @since 1.4 */ public Clipboard getSystemSelection() throws HeadlessException { + if (GraphicsEnvironment.isHeadless()){ + throw new HeadlessException(); + } if (this != Toolkit.getDefaultToolkit()) { return Toolkit.getDefaultToolkit().getSystemSelection(); } else { @@ -1371,6 +1391,10 @@ * @since JDK1.1 */ public int getMenuShortcutKeyMask() throws HeadlessException { + if (GraphicsEnvironment.isHeadless()){ + throw new HeadlessException(); + } + return Event.CTRL_MASK; } @@ -1499,6 +1523,9 @@ */ public Dimension getBestCursorSize(int preferredWidth, int preferredHeight) throws HeadlessException { + if (GraphicsEnvironment.isHeadless()){ + throw new HeadlessException(); + } // Override to implement custom cursor support. if (this != Toolkit.getDefaultToolkit()) { return Toolkit.getDefaultToolkit(). @@ -1526,6 +1553,9 @@ * @since 1.2 */ public int getMaximumCursorColors() throws HeadlessException { + if (GraphicsEnvironment.isHeadless()){ + throw new HeadlessException(); + } // Override to implement custom cursor support. if (this != Toolkit.getDefaultToolkit()) { return Toolkit.getDefaultToolkit().getMaximumCursorColors(); @@ -2561,8 +2591,6 @@ * initialized with {@code true}. * Changing this value after the {@code Toolkit} class initialization will have no effect. *

    - * The current value could be queried by using the - * {@code System.getProperty("sun.awt.enableExtraMouseButtons")} method. * @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true * @return {@code true} if events from extra mouse buttons are allowed to be processed and posted; * {@code false} otherwise @@ -2572,6 +2600,9 @@ * @since 1.7 */ public boolean areExtraMouseButtonsEnabled() throws HeadlessException { + if (GraphicsEnvironment.isHeadless()){ + throw new HeadlessException(); + } return Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled(); } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/awt/Window.java --- a/jdk/src/share/classes/java/awt/Window.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/awt/Window.java Wed Jul 05 17:42:05 2017 +0200 @@ -870,6 +870,11 @@ * are automatically enlarged if either is less than * the minimum size as specified by previous call to * {@code setMinimumSize}. + *

    + * The method changes the geometry-related data. Therefore, + * the native windowing system may ignore such requests, or it may modify + * the requested data, so that the {@code Window} object is placed and sized + * in a way that corresponds closely to the desktop settings. * * @see #getSize * @see #setBounds @@ -887,6 +892,11 @@ * are automatically enlarged if either is less than * the minimum size as specified by previous call to * {@code setMinimumSize}. + *

    + * The method changes the geometry-related data. Therefore, + * the native windowing system may ignore such requests, or it may modify + * the requested data, so that the {@code Window} object is placed and sized + * in a way that corresponds closely to the desktop settings. * * @see #getSize * @see #setBounds @@ -898,6 +908,32 @@ } /** + * {@inheritDoc} + *

    + * The method changes the geometry-related data. Therefore, + * the native windowing system may ignore such requests, or it may modify + * the requested data, so that the {@code Window} object is placed and sized + * in a way that corresponds closely to the desktop settings. + */ + @Override + public void setLocation(int x, int y) { + super.setLocation(x, y); + } + + /** + * {@inheritDoc} + *

    + * The method changes the geometry-related data. Therefore, + * the native windowing system may ignore such requests, or it may modify + * the requested data, so that the {@code Window} object is placed and sized + * in a way that corresponds closely to the desktop settings. + */ + @Override + public void setLocation(Point p) { + super.setLocation(p); + } + + /** * @deprecated As of JDK version 1.1, * replaced by setBounds(int, int, int, int). */ @@ -3147,6 +3183,11 @@ * placed at the left side of the screen. The similar placement * will occur if both top and bottom edges are out of the screen. * In that case, the window is placed at the top side of the screen. + *

    + * The method changes the geometry-related data. Therefore, + * the native windowing system may ignore such requests, or it may modify + * the requested data, so that the {@code Window} object is placed and sized + * in a way that corresponds closely to the desktop settings. * * @param c the component in relation to which the window's location * is determined @@ -3395,6 +3436,11 @@ * are automatically enlarged if either is less than * the minimum size as specified by previous call to * {@code setMinimumSize}. + *

    + * The method changes the geometry-related data. Therefore, + * the native windowing system may ignore such requests, or it may modify + * the requested data, so that the {@code Window} object is placed and sized + * in a way that corresponds closely to the desktop settings. * * @see #getBounds * @see #setLocation(int, int) @@ -3424,6 +3470,11 @@ * will be automatically enlarged if either is less than * the minimum size as specified by previous call to * {@code setMinimumSize}. + *

    + * The method changes the geometry-related data. Therefore, + * the native windowing system may ignore such requests, or it may modify + * the requested data, so that the {@code Window} object is placed and sized + * in a way that corresponds closely to the desktop settings. * * @see #getBounds * @see #setLocation(int, int) diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/awt/doc-files/AWTThreadIssues.html --- a/jdk/src/share/classes/java/awt/doc-files/AWTThreadIssues.html Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/awt/doc-files/AWTThreadIssues.html Wed Jul 05 17:42:05 2017 +0200 @@ -40,10 +40,9 @@

    Auto-shutdown

    -According to The -JavaTM Virtual Machine Specification, -Second edition (see §2.17.9 -and §2.19), +According to +The Java™ Virtual Machine Specification, +sections 2.17.9 and 2.19, the Java virtual machine (JVM) initially starts up with a single non-daemon thread, which typically calls the main method of some class. The virtual machine terminates all its activity and exits when @@ -183,7 +182,8 @@ <...> -The Java Virtual Machine Specification guarantees +The Java™ Virtual Machine Specification + guarantees that the JVM doesn't exit until this thread terminates. diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/io/Console.java --- a/jdk/src/share/classes/java/io/Console.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/io/Console.java Wed Jul 05 17:42:05 2017 +0200 @@ -148,8 +148,8 @@ * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by - * the Java - * Virtual Machine Specification. The behaviour on a + * The Java™ Virtual Machine Specification. + * The behaviour on a * null argument depends on the conversion. * @@ -187,8 +187,8 @@ * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by - * the Java - * Virtual Machine Specification. The behaviour on a + * The Java™ Virtual Machine Specification. + * The behaviour on a * null argument depends on the conversion. * @@ -220,8 +220,7 @@ * string. If there are more arguments than format specifiers, the * extra arguments are ignored. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by - * the Java - * Virtual Machine Specification. + * The Java™ Virtual Machine Specification. * * @throws IllegalFormatException * If a format string contains an illegal syntax, a format @@ -285,8 +284,7 @@ * string. If there are more arguments than format specifiers, the * extra arguments are ignored. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by - * the Java - * Virtual Machine Specification. + * The Java™ Virtual Machine Specification. * * @throws IllegalFormatException * If a format string contains an illegal syntax, a format diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/io/PrintStream.java --- a/jdk/src/share/classes/java/io/PrintStream.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/io/PrintStream.java Wed Jul 05 17:42:05 2017 +0200 @@ -846,8 +846,8 @@ * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by - * the Java - * Virtual Machine Specification. The behaviour on a + * The Java™ Virtual Machine Specification. + * The behaviour on a * null argument depends on the conversion. * @@ -896,8 +896,8 @@ * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by - * the Java - * Virtual Machine Specification. The behaviour on a + * The Java™ Virtual Machine Specification. + * The behaviour on a * null argument depends on the conversion. * @@ -939,8 +939,8 @@ * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by - * the Java - * Virtual Machine Specification. The behaviour on a + * The Java™ Virtual Machine Specification. + * The behaviour on a * null argument depends on the conversion. * @@ -996,8 +996,8 @@ * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by - * the Java - * Virtual Machine Specification. The behaviour on a + * The Java™ Virtual Machine Specification. + * The behaviour on a * null argument depends on the conversion. * diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/io/PrintWriter.java --- a/jdk/src/share/classes/java/io/PrintWriter.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/io/PrintWriter.java Wed Jul 05 17:42:05 2017 +0200 @@ -779,8 +779,8 @@ * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by - * the Java - * Virtual Machine Specification. The behaviour on a + * The Java™ Virtual Machine Specification. + * The behaviour on a * null argument depends on the conversion. * @@ -830,8 +830,8 @@ * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by - * the Java - * Virtual Machine Specification. The behaviour on a + * The Java™ Virtual Machine Specification. + * The behaviour on a * null argument depends on the conversion. * @@ -874,8 +874,8 @@ * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by - * the Java - * Virtual Machine Specification. The behaviour on a + * The Java™ Virtual Machine Specification. + * The behaviour on a * null argument depends on the conversion. * @@ -934,8 +934,8 @@ * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by - * the Java - * Virtual Machine Specification. The behaviour on a + * The Java™ Virtual Machine Specification. + * The behaviour on a * null argument depends on the conversion. * diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/AssertionError.java --- a/jdk/src/share/classes/java/lang/AssertionError.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/AssertionError.java Wed Jul 05 17:42:05 2017 +0200 @@ -34,11 +34,9 @@ * new AssertionError(expression) * * has as its detail message the string conversion of - * expression (as defined in - * The Java Language Specification, Second Edition, - * - * Section 15.18.1.1), regardless of the type of expression. + * expression (as defined in section 15.18.1.1 of + * The Java™ Language Specification), + * regardless of the type of expression. * * @since 1.4 */ @@ -63,8 +61,8 @@ /** * Constructs an AssertionError with its detail message derived * from the specified object, which is converted to a string as - * defined in The Java Language Specification, Second - * Edition, Section 15.18.1.1. + * defined in section 15.18.1.1 of + * The Java™ Language Specification. *

    * If the specified object is an instance of {@code Throwable}, it * becomes the cause of the newly constructed assertion error. @@ -81,8 +79,8 @@ /** * Constructs an AssertionError with its detail message derived * from the specified boolean, which is converted to - * a string as defined in The Java Language Specification, - * Second Edition, Section 15.18.1.1. + * a string as defined in section 15.18.1.1 of + * The Java™ Language Specification. * * @param detailMessage value to be used in constructing detail message */ @@ -93,8 +91,8 @@ /** * Constructs an AssertionError with its detail message derived * from the specified char, which is converted to a - * string as defined in The Java Language Specification, Second - * Edition, Section 15.18.1.1. + * string as defined in section 15.18.1.1 of + * The Java™ Language Specification. * * @param detailMessage value to be used in constructing detail message */ @@ -105,8 +103,8 @@ /** * Constructs an AssertionError with its detail message derived * from the specified int, which is converted to a - * string as defined in The Java Language Specification, Second - * Edition, Section 15.18.1.1. + * string as defined in section 15.18.1.1 of + * The Java™ Language Specification. * * @param detailMessage value to be used in constructing detail message */ @@ -117,8 +115,8 @@ /** * Constructs an AssertionError with its detail message derived * from the specified long, which is converted to a - * string as defined in The Java Language Specification, Second - * Edition, Section 15.18.1.1. + * string as defined in section 15.18.1.1 of + * The Java™ Language Specification. * * @param detailMessage value to be used in constructing detail message */ @@ -129,8 +127,8 @@ /** * Constructs an AssertionError with its detail message derived * from the specified float, which is converted to a - * string as defined in The Java Language Specification, Second - * Edition, Section 15.18.1.1. + * string as defined in section 15.18.1.1 of + * The Java™ Language Specification. * * @param detailMessage value to be used in constructing detail message */ @@ -141,8 +139,8 @@ /** * Constructs an AssertionError with its detail message derived * from the specified double, which is converted to a - * string as defined in The Java Language Specification, Second - * Edition, Section 15.18.1.1. + * string as defined in section 15.18.1.1 of + * The Java™ Language Specification. * * @param detailMessage value to be used in constructing detail message */ diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/Byte.java --- a/jdk/src/share/classes/java/lang/Byte.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/Byte.java Wed Jul 05 17:42:05 2017 +0200 @@ -251,9 +251,9 @@ * * * DecimalNumeral, HexDigits, and OctalDigits - * are defined in §3.10.1 - * of the Java - * Language Specification. + * are as defined in section 3.10.1 of + * The Java™ Language Specification, + * except that underscores are not accepted between digits. * *

    The sequence of characters following an optional * sign and/or radix specifier ("{@code 0x}", "{@code 0X}", diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/Character.java --- a/jdk/src/share/classes/java/lang/Character.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/Character.java Wed Jul 05 17:42:05 2017 +0200 @@ -4182,9 +4182,11 @@ aliases.put("AVST", AVESTAN); aliases.put("BALI", BALINESE); aliases.put("BAMU", BAMUM); + aliases.put("BATK", BATAK); aliases.put("BENG", BENGALI); aliases.put("BOPO", BOPOMOFO); aliases.put("BRAI", BRAILLE); + aliases.put("BRAH", BRAHMI); aliases.put("BUGI", BUGINESE); aliases.put("BUHD", BUHID); aliases.put("CANS", CANADIAN_ABORIGINAL); @@ -4228,6 +4230,7 @@ aliases.put("LISU", LISU); aliases.put("LYCI", LYCIAN); aliases.put("LYDI", LYDIAN); + aliases.put("MAND", MANDAIC); aliases.put("MLYM", MALAYALAM); aliases.put("MONG", MONGOLIAN); aliases.put("MTEI", MEETEI_MAYEK); diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/Class.java --- a/jdk/src/share/classes/java/lang/Class.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/Class.java Wed Jul 05 17:42:05 2017 +0200 @@ -95,8 +95,8 @@ * * *

    It is also possible to get the {@code Class} object for a named - * type (or for void) using a class literal - * (JLS Section 15.8.2). + * type (or for void) using a class literal. See Section 15.8.2 of + * The Java™ Language Specification. * For example: * *

    @@ -521,7 +521,8 @@ * *

    If this class object represents a reference type that is not an * array type then the binary name of the class is returned, as specified - * by the Java Language Specification, Second Edition. + * by + * The Java™ Language Specification. * *

    If this class object represents a primitive type or void, then the * name returned is a {@code String} equal to the Java language @@ -630,8 +631,8 @@ * the type variables declared by this generic declaration * @throws java.lang.reflect.GenericSignatureFormatError if the generic * signature of this generic declaration does not conform to - * the format specified in the Java Virtual Machine Specification, - * 3rd edition + * the format specified in + * The Java™ Virtual Machine Specification * @since 1.5 */ public TypeVariable>[] getTypeParameters() { @@ -675,8 +676,8 @@ * returned. * * @throws java.lang.reflect.GenericSignatureFormatError if the generic - * class signature does not conform to the format specified in the - * Java Virtual Machine Specification, 3rd edition + * class signature does not conform to the format specified in + * The Java™ Virtual Machine Specification * @throws TypeNotPresentException if the generic superclass * refers to a non-existent type declaration * @throws java.lang.reflect.MalformedParameterizedTypeException if the @@ -798,7 +799,8 @@ * * @throws java.lang.reflect.GenericSignatureFormatError * if the generic class signature does not conform to the format - * specified in the Java Virtual Machine Specification, 3rd edition + * specified in + * The Java™ Virtual Machine Specification * @throws TypeNotPresentException if any of the generic * superinterfaces refers to a non-existent type declaration * @throws java.lang.reflect.MalformedParameterizedTypeException diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/ClassLoader.java --- a/jdk/src/share/classes/java/lang/ClassLoader.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/ClassLoader.java Wed Jul 05 17:42:05 2017 +0200 @@ -160,8 +160,8 @@ *

    Binary names

    * *

    Any class name provided as a {@link String} parameter to methods in - * ClassLoader must be a binary name as defined by the Java Language Specification. + * ClassLoader must be a binary name as defined by + * The Java™ Language Specification. * *

    Examples of valid class names include: *

    @@ -531,9 +531,8 @@
          * @param  b
          *         The bytes that make up the class data.  The bytes in positions
          *         off through off+len-1 should have the format
    -     *         of a valid class file as defined by the Java Virtual
    -     *         Machine Specification.
    +     *         of a valid class file as defined by
    +     *         The Java™ Virtual Machine Specification.
          *
          * @param  off
          *         The start offset in b of the class data
    @@ -597,9 +596,8 @@
          * @param  b
          *         The bytes that make up the class data.  The bytes in positions
          *         off through off+len-1 should have the format
    -     *         of a valid class file as defined by the Java Virtual
    -     *         Machine Specification.
    +     *         of a valid class file as defined by
    +     *         The Java™ Virtual Machine Specification.
          *
          * @param  off
          *         The start offset in b of the class data
    @@ -748,9 +746,8 @@
          * @param  b
          *         The bytes that make up the class data. The bytes in positions
          *         off through off+len-1 should have the format
    -     *         of a valid class file as defined by the Java Virtual
    -     *         Machine Specification.
    +     *         of a valid class file as defined by
    +     *         The Java™ Virtual Machine Specification.
          *
          * @param  off
          *         The start offset in b of the class data
    @@ -838,8 +835,7 @@
          *         The bytes that make up the class data. The bytes from positions
          *         b.position() through b.position() + b.limit() -1
          *          should have the format of a valid class file as defined by
    -     *         the Java Virtual
    -     *         Machine Specification.
    +     *         The Java™ Virtual Machine Specification.
          *
          * @param  protectionDomain
          *         The ProtectionDomain of the class, or null.
    @@ -998,9 +994,8 @@
          * Links the specified class.  This (misleadingly named) method may be
          * used by a class loader to link a class.  If the class c has
          * already been linked, then this method simply returns. Otherwise, the
    -     * class is linked as described in the "Execution" chapter of the Java Language
    -     * Specification.
    +     * class is linked as described in the "Execution" chapter of
    +     * The Java™ Language Specification.
          * 

    * * @param c @@ -2034,8 +2029,8 @@ * The name of the package whose package default assertion status * is to be set. A null value indicates the unnamed * package that is "current" - * (Java Language - * Specification, section 7.4.2). + * (see section 7.4.2 of + * The Java™ Language Specification.) * * @param enabled * true if classes loaded by this classloader and diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/Double.java --- a/jdk/src/share/classes/java/lang/Double.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/Double.java Wed Jul 05 17:42:05 2017 +0200 @@ -392,9 +392,10 @@ * where Sign, FloatingPointLiteral, * HexNumeral, HexDigits, SignedInteger and * FloatTypeSuffix are as defined in the lexical structure - * sections of the Java Language - * Specification. If {@code s} does not have the form of + * sections of + * The Java™ Language Specification, + * except that underscores are not accepted between digits. + * If {@code s} does not have the form of * a FloatValue, then a {@code NumberFormatException} * is thrown. Otherwise, {@code s} is regarded as * representing an exact decimal value in the usual @@ -464,8 +465,8 @@ * // Since this method allows integer-only strings as input * // in addition to strings of floating-point literals, the * // two sub-patterns below are simplifications of the grammar - * // productions from the Java Language Specification, 2nd - * // edition, section 3.10.2. + * // productions from section 3.10.2 of + * // The Java™ Language Specification. * * // Digits ._opt Digits_opt ExponentPart_opt FloatTypeSuffix_opt * "((("+Digits+"(\\.)?("+Digits+"?)("+Exp+")?)|"+ diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/Enum.java --- a/jdk/src/share/classes/java/lang/Enum.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/Enum.java Wed Jul 05 17:42:05 2017 +0200 @@ -36,9 +36,8 @@ * * More information about enums, including descriptions of the * implicitly declared methods synthesized by the compiler, can be - * found in The Java™ Language Specification, Third - * Edition, §8.9. + * found in section 8.9 of + * The Java™ Language Specification. * *

    Note that when using an enumeration type as the type of a set * or as the type of the keys in a map, specialized and efficient diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/Error.java --- a/jdk/src/share/classes/java/lang/Error.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/Error.java Wed Jul 05 17:42:05 2017 +0200 @@ -43,7 +43,7 @@ * * @author Frank Yellin * @see java.lang.ThreadDeath - * @jls3 11.2 Compile-Time Checking of Exceptions + * @jls 11.2 Compile-Time Checking of Exceptions * @since JDK1.0 */ public class Error extends Throwable { diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/Exception.java --- a/jdk/src/share/classes/java/lang/Exception.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/Exception.java Wed Jul 05 17:42:05 2017 +0200 @@ -39,7 +39,7 @@ * * @author Frank Yellin * @see java.lang.Error - * @jls3 11.2 Compile-Time Checking of Exceptions + * @jls 11.2 Compile-Time Checking of Exceptions * @since JDK1.0 */ public class Exception extends Throwable { diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/Float.java --- a/jdk/src/share/classes/java/lang/Float.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/Float.java Wed Jul 05 17:42:05 2017 +0200 @@ -353,9 +353,10 @@ * where Sign, FloatingPointLiteral, * HexNumeral, HexDigits, SignedInteger and * FloatTypeSuffix are as defined in the lexical structure - * sections of the Java Language - * Specification. If {@code s} does not have the form of + * sections of + * The Java™ Language Specification, + * except that underscores are not accepted between digits. + * If {@code s} does not have the form of * a FloatValue, then a {@code NumberFormatException} * is thrown. Otherwise, {@code s} is regarded as * representing an exact decimal value in the usual diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/Integer.java --- a/jdk/src/share/classes/java/lang/Integer.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/Integer.java Wed Jul 05 17:42:05 2017 +0200 @@ -918,9 +918,9 @@ *

    * * DecimalNumeral, HexDigits, and OctalDigits - * are defined in §3.10.1 - * of the Java - * Language Specification. + * are as defined in section 3.10.1 of + * The Java™ Language Specification, + * except that underscores are not accepted between digits. * *

    The sequence of characters following an optional * sign and/or radix specifier ("{@code 0x}", "{@code 0X}", diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/Long.java --- a/jdk/src/share/classes/java/lang/Long.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/Long.java Wed Jul 05 17:42:05 2017 +0200 @@ -598,9 +598,9 @@ *

    * * DecimalNumeral, HexDigits, and OctalDigits - * are defined in §3.10.1 - * of the Java - * Language Specification. + * are as defined in section 3.10.1 of + * The Java™ Language Specification, + * except that underscores are not accepted between digits. * *

    The sequence of characters following an optional * sign and/or radix specifier ("{@code 0x}", "{@code 0X}", diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/Math.java --- a/jdk/src/share/classes/java/lang/Math.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/Math.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -627,11 +627,9 @@ } /** - * Returns the closest {@code int} to the argument. The - * result is rounded to an integer by adding 1/2, taking the - * floor of the result, and casting the result to type {@code int}. - * In other words, the result is equal to the value of the expression: - *

    {@code (int)Math.floor(a + 0.5f)} + * Returns the closest {@code int} to the argument, with ties + * rounding up. + * *

    * Special cases: *

    • If the argument is NaN, the result is 0. @@ -649,17 +647,17 @@ * @see java.lang.Integer#MIN_VALUE */ public static int round(float a) { - return (int)floor(a + 0.5f); + if (a != 0x1.fffffep-2f) // greatest float value less than 0.5 + return (int)floor(a + 0.5f); + else + return 0; } /** - * Returns the closest {@code long} to the argument. The result - * is rounded to an integer by adding 1/2, taking the floor of the - * result, and casting the result to type {@code long}. In other - * words, the result is equal to the value of the expression: - *

      {@code (long)Math.floor(a + 0.5d)} - *

      - * Special cases: + * Returns the closest {@code long} to the argument, with ties + * rounding up. + * + *

      Special cases: *

      • If the argument is NaN, the result is 0. *
      • If the argument is negative infinity or any value less than or * equal to the value of {@code Long.MIN_VALUE}, the result is @@ -676,7 +674,10 @@ * @see java.lang.Long#MIN_VALUE */ public static long round(double a) { - return (long)floor(a + 0.5d); + if (a != 0x1.fffffffffffffp-2) // greatest double value less than 0.5 + return (long)floor(a + 0.5d); + else + return 0; } private static Random randomNumberGenerator; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/Object.java --- a/jdk/src/share/classes/java/lang/Object.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/Object.java Wed Jul 05 17:42:05 2017 +0200 @@ -58,9 +58,8 @@ * * @return The {@code Class} object that represents the runtime * class of this object. - * @see The Java - * Language Specification, Third Edition (15.8.2 Class - * Literals) + * @see Class Literals, section 15.8.2 of + * The Java™ Language Specification. */ public final native Class getClass(); diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/Override.java --- a/jdk/src/share/classes/java/lang/Override.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/Override.java Wed Jul 05 17:42:05 2017 +0200 @@ -43,7 +43,7 @@ * * @author Peter von der Ahé * @author Joshua Bloch - * @jls3 9.6.1.4 Override + * @jls 9.6.1.4 Override * @since 1.5 */ @Target(ElementType.METHOD) diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/Package.java --- a/jdk/src/share/classes/java/lang/Package.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/Package.java Wed Jul 05 17:42:05 2017 +0200 @@ -109,10 +109,9 @@ /** * Return the name of this package. * - * @return The fully-qualified name of this package as defined in the - * Java Language Specification, Third Edition - * - * §6.5.3, for example, {@code java.lang} + * @return The fully-qualified name of this package as defined in section 6.5.3 of + * The Java™ Language Specification, + * for example, {@code java.lang} */ public String getName() { return pkgName; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/RuntimeException.java --- a/jdk/src/share/classes/java/lang/RuntimeException.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/RuntimeException.java Wed Jul 05 17:42:05 2017 +0200 @@ -37,7 +37,7 @@ * propagate outside the method or constructor boundary. * * @author Frank Yellin - * @jls3 11.2 Compile-Time Checking of Exceptions + * @jls 11.2 Compile-Time Checking of Exceptions * @since JDK1.0 */ public class RuntimeException extends Exception { diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/SafeVarargs.java --- a/jdk/src/share/classes/java/lang/SafeVarargs.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/SafeVarargs.java Wed Jul 05 17:42:05 2017 +0200 @@ -70,8 +70,8 @@ * *
      * - * @jls3 4.7 Reifiable Types - * @jls3 8.4.1 Formal Parameters + * @jls 4.7 Reifiable Types + * @jls 8.4.1 Formal Parameters */ @Documented @Retention(RetentionPolicy.RUNTIME) diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/Short.java --- a/jdk/src/share/classes/java/lang/Short.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/Short.java Wed Jul 05 17:42:05 2017 +0200 @@ -256,9 +256,9 @@ * * * DecimalNumeral, HexDigits, and OctalDigits - * are defined in §3.10.1 - * of the Java - * Language Specification. + * are as defined in section 3.10.1 of + * The Java™ Language Specification, + * except that underscores are not accepted between digits. * *

      The sequence of characters following an optional * sign and/or radix specifier ("{@code 0x}", "{@code 0X}", diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/StrictMath.java --- a/jdk/src/share/classes/java/lang/StrictMath.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/StrictMath.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -613,11 +613,8 @@ public static native double pow(double a, double b); /** - * Returns the closest {@code int} to the argument. The - * result is rounded to an integer by adding 1/2, taking the - * floor of the result, and casting the result to type {@code int}. - * In other words, the result is equal to the value of the expression: - *

      {@code (int)Math.floor(a + 0.5f)} + * Returns the closest {@code int} to the argument, with ties + * rounding up. * *

      Special cases: *

      • If the argument is NaN, the result is 0. @@ -635,15 +632,12 @@ * @see java.lang.Integer#MIN_VALUE */ public static int round(float a) { - return (int)floor(a + 0.5f); + return Math.round(a); } /** - * Returns the closest {@code long} to the argument. The result - * is rounded to an integer by adding 1/2, taking the floor of the - * result, and casting the result to type {@code long}. In other - * words, the result is equal to the value of the expression: - *

        {@code (long)Math.floor(a + 0.5d)} + * Returns the closest {@code long} to the argument, with ties + * rounding up. * *

        Special cases: *

        • If the argument is NaN, the result is 0. @@ -662,7 +656,7 @@ * @see java.lang.Long#MIN_VALUE */ public static long round(double a) { - return (long)floor(a + 0.5d); + return Math.round(a); } private static Random randomNumberGenerator; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/String.java --- a/jdk/src/share/classes/java/lang/String.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/String.java Wed Jul 05 17:42:05 2017 +0200 @@ -2819,8 +2819,8 @@ * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by - * the Java - * Virtual Machine Specification. The behaviour on a + * The Java™ Virtual Machine Specification. + * The behaviour on a * null argument depends on the conversion. * @@ -2863,8 +2863,8 @@ * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by - * the Java - * Virtual Machine Specification. The behaviour on a + * The Java™ Virtual Machine Specification. + * The behaviour on a * null argument depends on the conversion. * @@ -3066,9 +3066,8 @@ * if and only if s.equals(t) is true. *

          * All literal strings and string-valued constant expressions are - * interned. String literals are defined in §3.10.5 of the - * Java Language - * Specification + * interned. String literals are defined in section 3.10.5 of the + * The Java™ Language Specification. * * @return a string that has the same contents as this string, but is * guaranteed to be from a pool of unique strings. diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/Throwable.java --- a/jdk/src/share/classes/java/lang/Throwable.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/Throwable.java Wed Jul 05 17:42:05 2017 +0200 @@ -108,7 +108,7 @@ * @author unascribed * @author Josh Bloch (Added exception chaining and programmatic access to * stack trace in 1.4.) - * @jls3 11.2 Compile-Time Checking of Exceptions + * @jls 11.2 Compile-Time Checking of Exceptions * @since JDK1.0 */ public class Throwable implements Serializable { diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/annotation/Annotation.java --- a/jdk/src/share/classes/java/lang/annotation/Annotation.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/annotation/Annotation.java Wed Jul 05 17:42:05 2017 +0200 @@ -31,9 +31,8 @@ * an annotation type. Also note that this interface does not itself * define an annotation type. * - * More information about annotation types can be found in The - * Java™ Language Specification, Third Edition, §9.6. + * More information about annotation types can be found in section 9.6 of + * The Java™ Language Specification. * * @author Josh Bloch * @since 1.5 diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/instrument/ClassFileTransformer.java --- a/jdk/src/share/classes/java/lang/instrument/ClassFileTransformer.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/instrument/ClassFileTransformer.java Wed Jul 05 17:42:05 2017 +0200 @@ -36,9 +36,9 @@ * to transform class files. * The transformation occurs before the class is defined by the JVM. *

          - * Note the term class file is used as defined in the chapter - * The class File Format - * of The Java Virtual Machine Specification, to mean a sequence + * Note the term class file is used as defined in section 3.1 of + * The Java™ Virtual Machine Specification, + * to mean a sequence * of bytes in class file format, whether or not they reside in a file. * * @see java.lang.instrument.Instrumentation diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/instrument/Instrumentation.java --- a/jdk/src/share/classes/java/lang/instrument/Instrumentation.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/instrument/Instrumentation.java Wed Jul 05 17:42:05 2017 +0200 @@ -434,8 +434,9 @@ * avoiding these types of issues, is to use a unique package name for the * instrumentation classes. * - *

          The Java Virtual Machine - * Specification specifies that a subsequent attempt to resolve a symbolic + *

          + * The Java™ Virtual Machine Specification + * specifies that a subsequent attempt to resolve a symbolic * reference that the Java virtual machine has previously unsuccessfully attempted * to resolve always fails with the same error that was thrown as a result of the * initial resolution attempt. Consequently, if the JAR file contains an entry @@ -487,8 +488,9 @@ * getName()} method on the jarfile and this is provided as the * parameter to the appendToClassPathForInstrumentation method. * - *

          The Java Virtual Machine - * Specification specifies that a subsequent attempt to resolve a symbolic + *

          + * The Java™ Virtual Machine Specification + * specifies that a subsequent attempt to resolve a symbolic * reference that the Java virtual machine has previously unsuccessfully attempted * to resolve always fails with the same error that was thrown as a result of the * initial resolution attempt. Consequently, if the JAR file contains an entry diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/invoke/package-info.java --- a/jdk/src/share/classes/java/lang/invoke/package-info.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/package-info.java Wed Jul 05 17:42:05 2017 +0200 @@ -194,8 +194,8 @@ * Method handle constants for subtags {@code REF_getStatic}, {@code REF_putStatic}, and {@code REF_invokeStatic} * may force class initialization on their first invocation, just like the corresponding bytecodes. *

          - * The rules of section 5.4.3 of the - * JVM Specification + * The rules of section 5.4.3 of + * The Java™ Virtual Machine Specification * apply to the resolution of {@code CONSTANT_MethodType}, {@code CONSTANT_MethodHandle}, * and {@code CONSTANT_InvokeDynamic} constants, * by the execution of {@code invokedynamic} and {@code ldc} instructions. diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/reflect/Constructor.java --- a/jdk/src/share/classes/java/lang/reflect/Constructor.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/reflect/Constructor.java Wed Jul 05 17:42:05 2017 +0200 @@ -186,8 +186,8 @@ * the type variables declared by this generic declaration * @throws GenericSignatureFormatError if the generic * signature of this generic declaration does not conform to - * the format specified in the Java Virtual Machine Specification, - * 3rd edition + * the format specified in + * The Java™ Virtual Machine Specification * @since 1.5 */ public TypeVariable>[] getTypeParameters() { @@ -229,7 +229,8 @@ * parameter types of the underlying method, in declaration order * @throws GenericSignatureFormatError * if the generic method signature does not conform to the format - * specified in the Java Virtual Machine Specification, 3rd edition + * specified in + * The Java™ Virtual Machine Specification * @throws TypeNotPresentException if any of the parameter * types of the underlying method refers to a non-existent type * declaration @@ -273,7 +274,8 @@ * thrown by the underlying method * @throws GenericSignatureFormatError * if the generic method signature does not conform to the format - * specified in the Java Virtual Machine Specification, 3rd edition + * specified in + * The Java™ Virtual Machine Specification * @throws TypeNotPresentException if the underlying method's * {@code throws} clause refers to a non-existent type declaration * @throws MalformedParameterizedTypeException if @@ -468,8 +470,8 @@ * *

          If the constructor's declaring class is an inner class in a * non-static context, the first argument to the constructor needs - * to be the enclosing instance; see The Java Language - * Specification, section 15.9.3. + * to be the enclosing instance; see section 15.9.3 of + * The Java™ Language Specification. * *

          If the required access and argument checks succeed and the * instantiation will proceed, the constructor's declaring class @@ -541,7 +543,8 @@ * constructor; returns {@code false} otherwise. * * @return true if and only if this constructor is a synthetic - * constructor as defined by the Java Language Specification. + * constructor as defined by + * The Java™ Language Specification. * @since 1.5 */ public boolean isSynthetic() { diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/reflect/Field.java --- a/jdk/src/share/classes/java/lang/reflect/Field.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/reflect/Field.java Wed Jul 05 17:42:05 2017 +0200 @@ -221,8 +221,8 @@ * @return a {@code Type} object that represents the declared type for * the field represented by this {@code Field} object * @throws GenericSignatureFormatError if the generic field - * signature does not conform to the format specified in the Java - * Virtual Machine Specification, 3rd edition + * signature does not conform to the format specified in + * The Java™ Virtual Machine Specification * @throws TypeNotPresentException if the generic type * signature of the underlying field refers to a non-existent * type declaration diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/reflect/GenericDeclaration.java --- a/jdk/src/share/classes/java/lang/reflect/GenericDeclaration.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/reflect/GenericDeclaration.java Wed Jul 05 17:42:05 2017 +0200 @@ -42,8 +42,8 @@ * the type variables declared by this generic declaration * @throws GenericSignatureFormatError if the generic * signature of this generic declaration does not conform to - * the format specified in the Java Virtual Machine Specification, - * 3rd edition + * the format specified in + * The Java™ Virtual Machine Specification */ public TypeVariable[] getTypeParameters(); } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/reflect/Method.java --- a/jdk/src/share/classes/java/lang/reflect/Method.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/reflect/Method.java Wed Jul 05 17:42:05 2017 +0200 @@ -194,8 +194,8 @@ * the type variables declared by this generic declaration * @throws GenericSignatureFormatError if the generic * signature of this generic declaration does not conform to - * the format specified in the Java Virtual Machine Specification, - * 3rd edition + * the format specified in + * The Java™ Virtual Machine Specification * @since 1.5 */ public TypeVariable[] getTypeParameters() { @@ -230,7 +230,8 @@ * type of the underlying method * @throws GenericSignatureFormatError * if the generic method signature does not conform to the format - * specified in the Java Virtual Machine Specification, 3rd edition + * specified in + * The Java™ Virtual Machine Specification * @throws TypeNotPresentException if the underlying method's * return type refers to a non-existent type declaration * @throws MalformedParameterizedTypeException if the @@ -275,7 +276,8 @@ * parameter types of the underlying method, in declaration order * @throws GenericSignatureFormatError * if the generic method signature does not conform to the format - * specified in the Java Virtual Machine Specification, 3rd edition + * specified in + * The Java™ Virtual Machine Specification * @throws TypeNotPresentException if any of the parameter * types of the underlying method refers to a non-existent type * declaration @@ -319,7 +321,8 @@ * thrown by the underlying method * @throws GenericSignatureFormatError * if the generic method signature does not conform to the format - * specified in the Java Virtual Machine Specification, 3rd edition + * specified in + * The Java™ Virtual Machine Specification * @throws TypeNotPresentException if the underlying method's * {@code throws} clause refers to a non-existent type declaration * @throws MalformedParameterizedTypeException if diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/lang/reflect/Modifier.java --- a/jdk/src/share/classes/java/lang/reflect/Modifier.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/lang/reflect/Modifier.java Wed Jul 05 17:42:05 2017 +0200 @@ -34,14 +34,8 @@ * constants to decode class and member access modifiers. The sets of * modifiers are represented as integers with distinct bit positions * representing different modifiers. The values for the constants - * representing the modifiers are taken from The - * JavaTM Virtual Machine Specification, Second - * edition tables - * 4.1, - * 4.4, - * 4.5, and - * 4.7. + * representing the modifiers are taken from the tables in sections 4.1, 4.4, 4.5, and 4.7 of + * The Java™ Virtual Machine Specification. * * @see Class#getModifiers() * @see Member#getModifiers() @@ -214,14 +208,8 @@ * public final synchronized strictfp * * The modifier names are returned in an order consistent with the - * suggested modifier orderings given in The - * Java Language Specification, Second Edition sections - * §8.1.1, - * §8.3.1, - * §8.4.3, - * §8.8.3, and - * §9.1.1. + * suggested modifier orderings given in sections 8.1.1, 8.3.1, 8.4.3, 8.8.3, and 9.1.1 of + * The Java™ Language Specification. * The full modifier ordering used by this method is: *

          {@code * public protected private abstract static final transient @@ -269,9 +257,8 @@ } /* - * Access modifier flag constants from The Java Virtual - * Machine Specification, Second Edition, tables 4.1, 4.4, - * 4.5, and 4.7. + * Access modifier flag constants from tables 4.1, 4.4, 4.5, and 4.7 of + * The Java™ Virtual Machine Specification */ /** @@ -403,7 +390,7 @@ * @return an {@code int} value OR-ing together the source language * modifiers that can be applied to a class. * - * @jls3 8.1.1 Class Modifiers + * @jls 8.1.1 Class Modifiers * @since 1.7 */ public static int classModifiers() { @@ -416,7 +403,7 @@ * @return an {@code int} value OR-ing together the source language * modifiers that can be applied to an inteface. * - * @jls3 9.1.1 Interface Modifiers + * @jls 9.1.1 Interface Modifiers * @since 1.7 */ public static int interfaceModifiers() { @@ -429,7 +416,7 @@ * @return an {@code int} value OR-ing together the source language * modifiers that can be applied to a constructor. * - * @jls3 8.8.3 Constructor Modifiers + * @jls 8.8.3 Constructor Modifiers * @since 1.7 */ public static int constructorModifiers() { @@ -442,7 +429,7 @@ * @return an {@code int} value OR-ing together the source language * modifiers that can be applied to a method. * - * @jls3 8.4.3 Method Modifiers + * @jls 8.4.3 Method Modifiers * @since 1.7 */ public static int methodModifiers() { @@ -456,7 +443,7 @@ * @return an {@code int} value OR-ing together the source language * modifiers that can be applied to a field. * - * @jls3 8.3.1 Field Modifiers + * @jls 8.3.1 Field Modifiers * @since 1.7 */ public static int fieldModifiers() { diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/math/BigDecimal.java --- a/jdk/src/share/classes/java/math/BigDecimal.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/math/BigDecimal.java Wed Jul 05 17:42:05 2017 +0200 @@ -2905,12 +2905,11 @@ /** * Converts this {@code BigDecimal} to a {@code BigInteger}. - * This conversion is analogous to a narrowing - * primitive conversion from {@code double} to - * {@code long} as defined in the Java Language - * Specification: any fractional part of this + * This conversion is analogous to the + * narrowing primitive conversion from {@code double} to + * {@code long} as defined in section 5.1.3 of + * The Java™ Language Specification: + * any fractional part of this * {@code BigDecimal} will be discarded. Note that this * conversion can lose information about the precision of the * {@code BigDecimal} value. @@ -2942,13 +2941,12 @@ } /** - * Converts this {@code BigDecimal} to a {@code long}. This - * conversion is analogous to a narrowing - * primitive conversion from {@code double} to - * {@code short} as defined in the Java Language - * Specification: any fractional part of this + * Converts this {@code BigDecimal} to a {@code long}. + * This conversion is analogous to the + * narrowing primitive conversion from {@code double} to + * {@code short} as defined in section 5.1.3 of + * The Java™ Language Specification: + * any fractional part of this * {@code BigDecimal} will be discarded, and if the resulting * "{@code BigInteger}" is too big to fit in a * {@code long}, only the low-order 64 bits are returned. @@ -3011,13 +3009,12 @@ } /** - * Converts this {@code BigDecimal} to an {@code int}. This - * conversion is analogous to a narrowing - * primitive conversion from {@code double} to - * {@code short} as defined in the Java Language - * Specification: any fractional part of this + * Converts this {@code BigDecimal} to an {@code int}. + * This conversion is analogous to the + * narrowing primitive conversion from {@code double} to + * {@code short} as defined in section 5.1.3 of + * The Java™ Language Specification: + * any fractional part of this * {@code BigDecimal} will be discarded, and if the resulting * "{@code BigInteger}" is too big to fit in an * {@code int}, only the low-order 32 bits are returned. @@ -3095,12 +3092,11 @@ /** * Converts this {@code BigDecimal} to a {@code float}. - * This conversion is similar to the narrowing - * primitive conversion from {@code double} to - * {@code float} defined in the Java Language - * Specification: if this {@code BigDecimal} has too great a + * This conversion is similar to the + * narrowing primitive conversion from {@code double} to + * {@code float} as defined in section 5.1.3 of + * The Java™ Language Specification: + * if this {@code BigDecimal} has too great a * magnitude to represent as a {@code float}, it will be * converted to {@link Float#NEGATIVE_INFINITY} or {@link * Float#POSITIVE_INFINITY} as appropriate. Note that even when @@ -3119,12 +3115,11 @@ /** * Converts this {@code BigDecimal} to a {@code double}. - * This conversion is similar to the narrowing - * primitive conversion from {@code double} to - * {@code float} as defined in the Java Language - * Specification: if this {@code BigDecimal} has too great a + * This conversion is similar to the + * narrowing primitive conversion from {@code double} to + * {@code float} as defined in section 5.1.3 of + * The Java™ Language Specification: + * if this {@code BigDecimal} has too great a * magnitude represent as a {@code double}, it will be * converted to {@link Double#NEGATIVE_INFINITY} or {@link * Double#POSITIVE_INFINITY} as appropriate. Note that even when diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/math/BigInteger.java --- a/jdk/src/share/classes/java/math/BigInteger.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/math/BigInteger.java Wed Jul 05 17:42:05 2017 +0200 @@ -2719,12 +2719,11 @@ /** * Converts this BigInteger to an {@code int}. This - * conversion is analogous to a narrowing - * primitive conversion from {@code long} to - * {@code int} as defined in the Java Language - * Specification: if this BigInteger is too big to fit in an + * conversion is analogous to a + * narrowing primitive conversion from {@code long} to + * {@code int} as defined in section 5.1.3 of + * The Java™ Language Specification: + * if this BigInteger is too big to fit in an * {@code int}, only the low-order 32 bits are returned. * Note that this conversion can lose information about the * overall magnitude of the BigInteger value as well as return a @@ -2740,12 +2739,11 @@ /** * Converts this BigInteger to a {@code long}. This - * conversion is analogous to a narrowing - * primitive conversion from {@code long} to - * {@code int} as defined in the Java Language - * Specification: if this BigInteger is too big to fit in a + * conversion is analogous to a + * narrowing primitive conversion from {@code long} to + * {@code int} as defined in section 5.1.3 of + * The Java™ Language Specification: + * if this BigInteger is too big to fit in a * {@code long}, only the low-order 64 bits are returned. * Note that this conversion can lose information about the * overall magnitude of the BigInteger value as well as return a @@ -2763,12 +2761,11 @@ /** * Converts this BigInteger to a {@code float}. This - * conversion is similar to the narrowing - * primitive conversion from {@code double} to - * {@code float} defined in the Java Language - * Specification: if this BigInteger has too great a magnitude + * conversion is similar to the + * narrowing primitive conversion from {@code double} to + * {@code float} as defined in section 5.1.3 of + * The Java™ Language Specification: + * if this BigInteger has too great a magnitude * to represent as a {@code float}, it will be converted to * {@link Float#NEGATIVE_INFINITY} or {@link * Float#POSITIVE_INFINITY} as appropriate. Note that even when @@ -2784,12 +2781,11 @@ /** * Converts this BigInteger to a {@code double}. This - * conversion is similar to the narrowing - * primitive conversion from {@code double} to - * {@code float} defined in the Java Language - * Specification: if this BigInteger has too great a magnitude + * conversion is similar to the + * narrowing primitive conversion from {@code double} to + * {@code float} as defined in section 5.1.3 of + * The Java™ Language Specification: + * if this BigInteger has too great a magnitude * to represent as a {@code double}, it will be converted to * {@link Double#NEGATIVE_INFINITY} or {@link * Double#POSITIVE_INFINITY} as appropriate. Note that even when diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/security/SecureClassLoader.java --- a/jdk/src/share/classes/java/security/SecureClassLoader.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/security/SecureClassLoader.java Wed Jul 05 17:42:05 2017 +0200 @@ -118,10 +118,8 @@ * and without a trailing ".class" suffix. * @param b the bytes that make up the class data. The bytes in * positions off through off+len-1 - * should have the format of a valid class file as defined - * by the - * Java - * Virtual Machine Specification. + * should have the format of a valid class file as defined by + * The Java™ Virtual Machine Specification. * @param off the start offset in b of the class data * @param len the length of the class data * @param cs the associated CodeSource, or null if none @@ -157,9 +155,8 @@ * and without a trailing ".class" suffix. * @param b the bytes that make up the class data. The bytes from positions * b.position() through b.position() + b.limit() -1 - * should have the format of a valid class file as defined by the - * Java Virtual - * Machine Specification. + * should have the format of a valid class file as defined by + * The Java™ Virtual Machine Specification. * @param cs the associated CodeSource, or null if none * @return the Class object created from the data, * and optional CodeSource. diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/sql/DriverManager.java --- a/jdk/src/share/classes/java/sql/DriverManager.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/sql/DriverManager.java Wed Jul 05 17:42:05 2017 +0200 @@ -80,7 +80,7 @@ // List of registered JDBC drivers - private final static CopyOnWriteArrayList registeredDrivers = new CopyOnWriteArrayList(); + private final static CopyOnWriteArrayList registeredDrivers = new CopyOnWriteArrayList(); private static volatile int loginTimeout = 0; private static volatile java.io.PrintWriter logWriter = null; private static volatile java.io.PrintStream logStream = null; @@ -265,22 +265,22 @@ // Walk through the loaded registeredDrivers attempting to locate someone // who understands the given URL. - for (Driver aDriver : registeredDrivers) { + for (DriverInfo aDriver : registeredDrivers) { // If the caller does not have permission to load the driver then // skip it. - if(isDriverAllowed(aDriver, callerCL)) { + if(isDriverAllowed(aDriver.driver, callerCL)) { try { - if(aDriver.acceptsURL(url)) { + if(aDriver.driver.acceptsURL(url)) { // Success! - println("getDriver returning " + aDriver.getClass().getName()); - return (aDriver); + println("getDriver returning " + aDriver.driver.getClass().getName()); + return (aDriver.driver); } } catch(SQLException sqe) { // Drop through and try the next driver. } } else { - println(" skipping: " + aDriver.getClass().getName()); + println(" skipping: " + aDriver.driver.getClass().getName()); } } @@ -305,7 +305,7 @@ /* Register the driver if it has not already been added to our list */ if(driver != null) { - registeredDrivers.addIfAbsent(driver); + registeredDrivers.addIfAbsent(new DriverInfo(driver)); } else { // This is for compatibility with the original DriverManager throw new NullPointerException(); @@ -333,9 +333,10 @@ ClassLoader callerCL = DriverManager.getCallerClassLoader(); println("DriverManager.deregisterDriver: " + driver); - if(registeredDrivers.contains(driver)) { + DriverInfo aDriver = new DriverInfo(driver); + if(registeredDrivers.contains(aDriver)) { if (isDriverAllowed(driver, callerCL)) { - registeredDrivers.remove(driver); + registeredDrivers.remove(aDriver); } else { // If the caller does not have permission to load the driver then // throw a SecurityException. @@ -363,11 +364,11 @@ ClassLoader callerCL = DriverManager.getCallerClassLoader(); // Walk through the loaded registeredDrivers. - for(Driver aDriver : registeredDrivers) { + for(DriverInfo aDriver : registeredDrivers) { // If the caller does not have permission to load the driver then // skip it. - if(isDriverAllowed(aDriver, callerCL)) { - result.addElement(aDriver); + if(isDriverAllowed(aDriver.driver, callerCL)) { + result.addElement(aDriver.driver); } else { println(" skipping: " + aDriver.getClass().getName()); } @@ -482,8 +483,8 @@ private static void loadInitialDrivers() { String drivers; try { - drivers = (String) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + drivers = AccessController.doPrivileged(new PrivilegedAction() { + public String run() { return System.getProperty("jdbc.drivers"); } }); @@ -495,8 +496,8 @@ // exposed as a java.sql.Driver.class service. // ServiceLoader.load() replaces the sun.misc.Providers() - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction() { + public Void run() { ServiceLoader loadedDrivers = ServiceLoader.load(Driver.class); Iterator driversIterator = loadedDrivers.iterator(); @@ -569,16 +570,16 @@ // Remember the first exception that gets raised so we can reraise it. SQLException reason = null; - for(Driver aDriver : registeredDrivers) { + for(DriverInfo aDriver : registeredDrivers) { // If the caller does not have permission to load the driver then // skip it. - if(isDriverAllowed(aDriver, callerCL)) { + if(isDriverAllowed(aDriver.driver, callerCL)) { try { - println(" trying " + aDriver.getClass().getName()); - Connection con = aDriver.connect(url, info); + println(" trying " + aDriver.driver.getClass().getName()); + Connection con = aDriver.driver.connect(url, info); if (con != null) { // Success! - println("getConnection returning " + aDriver.getClass().getName()); + println("getConnection returning " + aDriver.driver.getClass().getName()); return (con); } } catch (SQLException ex) { @@ -607,3 +608,29 @@ private static native ClassLoader getCallerClassLoader(); } + +/* + * Wrapper class for registered Drivers in order to not expose Driver.equals() + * to avoid the capture of the Driver it being compared to as it might not + * normally have access. + */ +class DriverInfo { + + final Driver driver; + DriverInfo(Driver driver) { + this.driver = driver; + } + + public boolean equals(Object other) { + return (other instanceof DriverInfo) + && this.driver == ((DriverInfo) other).driver; + } + + public int hashCode() { + return driver.hashCode(); + } + + public String toString() { + return ("driver[className=" + driver + "]"); + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/sql/ResultSet.java --- a/jdk/src/share/classes/java/sql/ResultSet.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/sql/ResultSet.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -137,7 +137,7 @@ * to retrieve the next result from a sequence of multiple results. * *

          The number, types and properties of a ResultSet - * object's columns are provided by the ResulSetMetaData + * object's columns are provided by the ResultSetMetaData * object returned by the ResultSet.getMetaData method. * * @see Statement#executeQuery @@ -422,7 +422,7 @@ * of this ResultSet object as * a stream of ASCII characters. The value can then be read in chunks from the * stream. This method is particularly - * suitable for retrieving large LONGVARCHAR values. + * suitable for retrieving large LONGVARCHAR values. * The JDBC driver will * do any necessary conversion from the database format into ASCII. * diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/sql/SQLPermission.java --- a/jdk/src/share/classes/java/sql/SQLPermission.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/sql/SQLPermission.java Wed Jul 05 17:42:05 2017 +0200 @@ -116,11 +116,11 @@ /** * Creates a new SQLPermission object with the specified name. - * The name is the symbolic name of the SQLPermission; currently, - * the only name allowed is "setLog". + * The name is the symbolic name of the SQLPermission. * * @param name the name of this SQLPermission object, which must - * be setLog + * be either {@code setLog}, {@code callAbort}, {@code setSyncFactory}, + * or {@code setNetworkTimeout} * @throws NullPointerException if name is null. * @throws IllegalArgumentException if name is empty. @@ -134,10 +134,11 @@ * Creates a new SQLPermission object with the specified name. * The name is the symbolic name of the SQLPermission; the * actions String is currently unused and should be - * null. + * null. * * @param name the name of this SQLPermission object, which must - * be setLog + * be either {@code setLog}, {@code callAbort}, {@code setSyncFactory}, + * or {@code setNetworkTimeout} * @param actions should be null * @throws NullPointerException if name is null. * @throws IllegalArgumentException if name is empty. diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/sql/Timestamp.java --- a/jdk/src/share/classes/java/sql/Timestamp.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/sql/Timestamp.java Wed Jul 05 17:42:05 2017 +0200 @@ -54,7 +54,7 @@ * As a result, the Timestamp.equals(Object) * method is not symmetric with respect to the * java.util.Date.equals(Object) - * method. Also, the hashcode method uses the underlying + * method. Also, the hashCode method uses the underlying * java.util.Date * implementation and therefore does not include nanos in its computation. *

          @@ -515,6 +515,18 @@ } } + /** + * {@inheritDoc} + * + * The {@code hashCode} method uses the underlying {@code java.util.Date} + * implementation and therefore does not include nanos in its computation. + * + */ + @Override + public int hashCode() { + return super.hashCode(); + } + static final long serialVersionUID = 2745179027874758501L; } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/text/ChoiceFormat.java --- a/jdk/src/share/classes/java/text/ChoiceFormat.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/text/ChoiceFormat.java Wed Jul 05 17:42:05 2017 +0200 @@ -136,8 +136,8 @@ * *

          * And the output result would be like the following: + *
          *
          - * 
          * Format with -INF : is negative * Format with -1.0 : is negative * Format with 0 : is zero or fraction diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/AbstractQueue.java --- a/jdk/src/share/classes/java/util/AbstractQueue.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/AbstractQueue.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/ArrayDeque.java --- a/jdk/src/share/classes/java/util/ArrayDeque.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/ArrayDeque.java Wed Jul 05 17:42:05 2017 +0200 @@ -29,7 +29,7 @@ * file: * * Written by Josh Bloch of Google Inc. and released to the public domain, - * as explained at http://creativecommons.org/licenses/publicdomain. + * as explained at http://creativecommons.org/publicdomain/zero/1.0/. */ package java.util; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/Deque.java --- a/jdk/src/share/classes/java/util/Deque.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/Deque.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea and Josh Bloch with assistance from members of * JCP JSR-166 Expert Group and released to the public domain, as explained - * at http://creativecommons.org/licenses/publicdomain + * at http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/EnumMap.java --- a/jdk/src/share/classes/java/util/EnumMap.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/EnumMap.java Wed Jul 05 17:42:05 2017 +0200 @@ -106,7 +106,7 @@ /** * Distinguished non-null value for representing null values. */ - private static final Object NULL = new Object(); + private static final Object NULL = new Integer(0); private Object maskNull(Object value) { return (value == null ? NULL : value); @@ -116,7 +116,7 @@ return (V) (value == NULL ? null : value); } - private static Enum[] ZERO_LENGTH_ENUM_ARRAY = new Enum[0]; + private static final Enum[] ZERO_LENGTH_ENUM_ARRAY = new Enum[0]; /** * Creates an empty enum map with the specified key type. @@ -464,6 +464,7 @@ public Iterator> iterator() { return new EntryIterator(); } + public boolean contains(Object o) { if (!(o instanceof Map.Entry)) return false; @@ -552,70 +553,82 @@ } } - /** - * Since we don't use Entry objects, we use the Iterator itself as entry. - */ - private class EntryIterator extends EnumMapIterator> - implements Map.Entry - { + private class EntryIterator extends EnumMapIterator> { + private Entry lastReturnedEntry = null; + public Map.Entry next() { if (!hasNext()) throw new NoSuchElementException(); - lastReturnedIndex = index++; - return this; - } - - public K getKey() { - checkLastReturnedIndexForEntryUse(); - return keyUniverse[lastReturnedIndex]; + lastReturnedEntry = new Entry(index++); + return lastReturnedEntry; } - public V getValue() { - checkLastReturnedIndexForEntryUse(); - return unmaskNull(vals[lastReturnedIndex]); - } - - public V setValue(V value) { - checkLastReturnedIndexForEntryUse(); - V oldValue = unmaskNull(vals[lastReturnedIndex]); - vals[lastReturnedIndex] = maskNull(value); - return oldValue; + public void remove() { + lastReturnedIndex = + ((null == lastReturnedEntry) ? -1 : lastReturnedEntry.index); + super.remove(); + lastReturnedEntry.index = lastReturnedIndex; + lastReturnedEntry = null; } - public boolean equals(Object o) { - if (lastReturnedIndex < 0) - return o == this; + private class Entry implements Map.Entry { + private int index; + + private Entry(int index) { + this.index = index; + } + + public K getKey() { + checkIndexForEntryUse(); + return keyUniverse[index]; + } - if (!(o instanceof Map.Entry)) - return false; - Map.Entry e = (Map.Entry)o; - V ourValue = unmaskNull(vals[lastReturnedIndex]); - Object hisValue = e.getValue(); - return e.getKey() == keyUniverse[lastReturnedIndex] && - (ourValue == hisValue || - (ourValue != null && ourValue.equals(hisValue))); - } + public V getValue() { + checkIndexForEntryUse(); + return unmaskNull(vals[index]); + } + + public V setValue(V value) { + checkIndexForEntryUse(); + V oldValue = unmaskNull(vals[index]); + vals[index] = maskNull(value); + return oldValue; + } + + public boolean equals(Object o) { + if (index < 0) + return o == this; - public int hashCode() { - if (lastReturnedIndex < 0) - return super.hashCode(); + if (!(o instanceof Map.Entry)) + return false; - Object value = vals[lastReturnedIndex]; - return keyUniverse[lastReturnedIndex].hashCode() - ^ (value == NULL ? 0 : value.hashCode()); - } + Map.Entry e = (Map.Entry)o; + V ourValue = unmaskNull(vals[index]); + Object hisValue = e.getValue(); + return (e.getKey() == keyUniverse[index] && + (ourValue == hisValue || + (ourValue != null && ourValue.equals(hisValue)))); + } + + public int hashCode() { + if (index < 0) + return super.hashCode(); - public String toString() { - if (lastReturnedIndex < 0) - return super.toString(); + return entryHashCode(index); + } + + public String toString() { + if (index < 0) + return super.toString(); - return keyUniverse[lastReturnedIndex] + "=" - + unmaskNull(vals[lastReturnedIndex]); - } + return keyUniverse[index] + "=" + + unmaskNull(vals[index]); + } - private void checkLastReturnedIndexForEntryUse() { - if (lastReturnedIndex < 0) - throw new IllegalStateException("Entry was removed"); + private void checkIndexForEntryUse() { + if (index < 0) + throw new IllegalStateException("Entry was removed"); + } } } @@ -631,10 +644,35 @@ * @return true if the specified object is equal to this map */ public boolean equals(Object o) { - if (!(o instanceof EnumMap)) - return super.equals(o); + if (this == o) + return true; + if (o instanceof EnumMap) + return equals((EnumMap)o); + if (!(o instanceof Map)) + return false; + + Map m = (Map)o; + if (size != m.size()) + return false; - EnumMap em = (EnumMap)o; + for (int i = 0; i < keyUniverse.length; i++) { + if (null != vals[i]) { + K key = keyUniverse[i]; + V value = unmaskNull(vals[i]); + if (null == value) { + if (!((null == m.get(key)) && m.containsKey(key))) + return false; + } else { + if (!value.equals(m.get(key))) + return false; + } + } + } + + return true; + } + + private boolean equals(EnumMap em) { if (em.keyType != keyType) return size == 0 && em.size == 0; @@ -650,6 +688,26 @@ } /** + * Returns the hash code value for this map. The hash code of a map is + * defined to be the sum of the hash codes of each entry in the map. + */ + public int hashCode() { + int h = 0; + + for (int i = 0; i < keyUniverse.length; i++) { + if (null != vals[i]) { + h += entryHashCode(i); + } + } + + return h; + } + + private int entryHashCode(int index) { + return (keyUniverse[index].hashCode() ^ vals[index].hashCode()); + } + + /** * Returns a shallow copy of this enum map. (The values themselves * are not cloned. * @@ -705,9 +763,13 @@ s.writeInt(size); // Write out keys and values (alternating) - for (Map.Entry e : entrySet()) { - s.writeObject(e.getKey()); - s.writeObject(e.getValue()); + int entriesToBeWritten = size; + for (int i = 0; entriesToBeWritten > 0; i++) { + if (null != vals[i]) { + s.writeObject(keyUniverse[i]); + s.writeObject(unmaskNull(vals[i])); + entriesToBeWritten--; + } } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/Formatter.java --- a/jdk/src/share/classes/java/util/Formatter.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/Formatter.java Wed Jul 05 17:42:05 2017 +0200 @@ -1818,9 +1818,9 @@ *
          * *

          The maximum number of arguments is limited by the maximum dimension of a - * Java array as defined by the Java Virtual Machine - * Specification. If the argument index is does not correspond to an + * Java array as defined by + * The Java™ Virtual Machine Specification. + * If the argument index is does not correspond to an * available argument, then a {@link MissingFormatArgumentException} is thrown. * *

          If there are more arguments than format specifiers, the extra arguments @@ -2403,8 +2403,7 @@ * string. If there are more arguments than format specifiers, the * extra arguments are ignored. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by - * the Java - * Virtual Machine Specification. + * The Java™ Virtual Machine Specification. * * @throws IllegalFormatException * If a format string contains an illegal syntax, a format @@ -2443,8 +2442,7 @@ * string. If there are more arguments than format specifiers, the * extra arguments are ignored. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by - * the Java - * Virtual Machine Specification + * The Java™ Virtual Machine Specification. * * @throws IllegalFormatException * If a format string contains an illegal syntax, a format diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/IdentityHashMap.java --- a/jdk/src/share/classes/java/util/IdentityHashMap.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/IdentityHashMap.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -829,71 +829,82 @@ } } - /** - * Since we don't use Entry objects, we use the Iterator - * itself as an entry. - */ private class EntryIterator extends IdentityHashMapIterator> - implements Map.Entry { + private Entry lastReturnedEntry = null; + public Map.Entry next() { - nextIndex(); - return this; + lastReturnedEntry = new Entry(nextIndex()); + return lastReturnedEntry; } - public K getKey() { - // Provide a better exception than out of bounds index - if (lastReturnedIndex < 0) - throw new IllegalStateException("Entry was removed"); - - return (K) unmaskNull(traversalTable[lastReturnedIndex]); - } - - public V getValue() { - // Provide a better exception than out of bounds index - if (lastReturnedIndex < 0) - throw new IllegalStateException("Entry was removed"); - - return (V) traversalTable[lastReturnedIndex+1]; + public void remove() { + lastReturnedIndex = + ((null == lastReturnedEntry) ? -1 : lastReturnedEntry.index); + super.remove(); + lastReturnedEntry.index = lastReturnedIndex; + lastReturnedEntry = null; } - public V setValue(V value) { - // It would be mean-spirited to proceed here if remove() called - if (lastReturnedIndex < 0) - throw new IllegalStateException("Entry was removed"); - V oldValue = (V) traversalTable[lastReturnedIndex+1]; - traversalTable[lastReturnedIndex+1] = value; - // if shadowing, force into main table - if (traversalTable != IdentityHashMap.this.table) - put((K) traversalTable[lastReturnedIndex], value); - return oldValue; - } + private class Entry implements Map.Entry { + private int index; + + private Entry(int index) { + this.index = index; + } + + public K getKey() { + checkIndexForEntryUse(); + return (K) unmaskNull(traversalTable[index]); + } - public boolean equals(Object o) { - if (lastReturnedIndex < 0) - return super.equals(o); + public V getValue() { + checkIndexForEntryUse(); + return (V) traversalTable[index+1]; + } + + public V setValue(V value) { + checkIndexForEntryUse(); + V oldValue = (V) traversalTable[index+1]; + traversalTable[index+1] = value; + // if shadowing, force into main table + if (traversalTable != IdentityHashMap.this.table) + put((K) traversalTable[index], value); + return oldValue; + } - if (!(o instanceof Map.Entry)) - return false; - Map.Entry e = (Map.Entry)o; - return e.getKey() == getKey() && - e.getValue() == getValue(); - } + public boolean equals(Object o) { + if (index < 0) + return super.equals(o); + + if (!(o instanceof Map.Entry)) + return false; + Map.Entry e = (Map.Entry)o; + return (e.getKey() == unmaskNull(traversalTable[index]) && + e.getValue() == traversalTable[index+1]); + } + + public int hashCode() { + if (lastReturnedIndex < 0) + return super.hashCode(); - public int hashCode() { - if (lastReturnedIndex < 0) - return super.hashCode(); + return (System.identityHashCode(unmaskNull(traversalTable[index])) ^ + System.identityHashCode(traversalTable[index+1])); + } + + public String toString() { + if (index < 0) + return super.toString(); - return System.identityHashCode(getKey()) ^ - System.identityHashCode(getValue()); - } + return (unmaskNull(traversalTable[index]) + "=" + + traversalTable[index+1]); + } - public String toString() { - if (lastReturnedIndex < 0) - return super.toString(); - - return getKey() + "=" + getValue(); + private void checkIndexForEntryUse() { + if (index < 0) + throw new IllegalStateException("Entry was removed"); + } } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/Locale.java --- a/jdk/src/share/classes/java/util/Locale.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/Locale.java Wed Jul 05 17:42:05 2017 +0200 @@ -51,13 +51,13 @@ import sun.security.action.GetPropertyAction; import sun.util.LocaleServiceProviderPool; -import sun.util.locale.AsciiUtil; import sun.util.locale.BaseLocale; import sun.util.locale.InternalLocaleBuilder; import sun.util.locale.LanguageTag; import sun.util.locale.LocaleExtensions; import sun.util.locale.LocaleObjectCache; import sun.util.locale.LocaleSyntaxException; +import sun.util.locale.LocaleUtils; import sun.util.locale.ParseStatus; import sun.util.locale.UnicodeLocaleExtension; import sun.util.resources.LocaleData; @@ -412,59 +412,59 @@ /** Useful constant for language. */ - static public final Locale ENGLISH = getInstance("en", "", ""); + static public final Locale ENGLISH = createConstant("en", ""); /** Useful constant for language. */ - static public final Locale FRENCH = getInstance("fr", "", ""); + static public final Locale FRENCH = createConstant("fr", ""); /** Useful constant for language. */ - static public final Locale GERMAN = getInstance("de", "", ""); + static public final Locale GERMAN = createConstant("de", ""); /** Useful constant for language. */ - static public final Locale ITALIAN = getInstance("it", "", ""); + static public final Locale ITALIAN = createConstant("it", ""); /** Useful constant for language. */ - static public final Locale JAPANESE = getInstance("ja", "", ""); + static public final Locale JAPANESE = createConstant("ja", ""); /** Useful constant for language. */ - static public final Locale KOREAN = getInstance("ko", "", ""); + static public final Locale KOREAN = createConstant("ko", ""); /** Useful constant for language. */ - static public final Locale CHINESE = getInstance("zh", "", ""); + static public final Locale CHINESE = createConstant("zh", ""); /** Useful constant for language. */ - static public final Locale SIMPLIFIED_CHINESE = getInstance("zh", "CN", ""); + static public final Locale SIMPLIFIED_CHINESE = createConstant("zh", "CN"); /** Useful constant for language. */ - static public final Locale TRADITIONAL_CHINESE = getInstance("zh", "TW", ""); + static public final Locale TRADITIONAL_CHINESE = createConstant("zh", "TW"); /** Useful constant for country. */ - static public final Locale FRANCE = getInstance("fr", "FR", ""); + static public final Locale FRANCE = createConstant("fr", "FR"); /** Useful constant for country. */ - static public final Locale GERMANY = getInstance("de", "DE", ""); + static public final Locale GERMANY = createConstant("de", "DE"); /** Useful constant for country. */ - static public final Locale ITALY = getInstance("it", "IT", ""); + static public final Locale ITALY = createConstant("it", "IT"); /** Useful constant for country. */ - static public final Locale JAPAN = getInstance("ja", "JP", ""); + static public final Locale JAPAN = createConstant("ja", "JP"); /** Useful constant for country. */ - static public final Locale KOREA = getInstance("ko", "KR", ""); + static public final Locale KOREA = createConstant("ko", "KR"); /** Useful constant for country. */ @@ -480,19 +480,19 @@ /** Useful constant for country. */ - static public final Locale UK = getInstance("en", "GB", ""); + static public final Locale UK = createConstant("en", "GB"); /** Useful constant for country. */ - static public final Locale US = getInstance("en", "US", ""); + static public final Locale US = createConstant("en", "US"); /** Useful constant for country. */ - static public final Locale CANADA = getInstance("en", "CA", ""); + static public final Locale CANADA = createConstant("en", "CA"); /** Useful constant for country. */ - static public final Locale CANADA_FRENCH = getInstance("fr", "CA", ""); + static public final Locale CANADA_FRENCH = createConstant("fr", "CA"); /** * Useful constant for the root locale. The root locale is the locale whose @@ -502,7 +502,7 @@ * * @since 1.6 */ - static public final Locale ROOT = getInstance("", "", ""); + static public final Locale ROOT = createConstant("", ""); /** * The key for the private use extension ('x'). @@ -532,14 +532,14 @@ private static final int DISPLAY_LANGUAGE = 0; private static final int DISPLAY_COUNTRY = 1; private static final int DISPLAY_VARIANT = 2; - private static final int DISPLAY_SCRIPT = 3; + private static final int DISPLAY_SCRIPT = 3; /** * Private constructor used by getInstance method */ private Locale(BaseLocale baseLocale, LocaleExtensions extensions) { - _baseLocale = baseLocale; - _extensions = extensions; + this.baseLocale = baseLocale; + this.localeExtensions = extensions; } /** @@ -572,8 +572,8 @@ if (language== null || country == null || variant == null) { throw new NullPointerException(); } - _baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), "", country, variant); - _extensions = getCompatibilityExtensions(language, "", country, variant); + baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), "", country, variant); + localeExtensions = getCompatibilityExtensions(language, "", country, variant); } /** @@ -627,6 +627,15 @@ } /** + * This method must be called only for creating the Locale.* + * constants due to making shortcuts. + */ + private static Locale createConstant(String lang, String country) { + BaseLocale base = BaseLocale.createInstance(lang, country); + return getInstance(base, null); + } + + /** * Returns a Locale constructed from the given * language, country and * variant. If the same Locale instance @@ -641,7 +650,7 @@ * @exception NullPointerException if any argument is null. */ static Locale getInstance(String language, String country, String variant) { - return getInstance(language, "", country, variant, LocaleExtensions.EMPTY_EXTENSIONS); + return getInstance(language, "", country, variant, null); } static Locale getInstance(String language, String script, String country, @@ -651,10 +660,6 @@ } if (extensions == null) { - extensions = LocaleExtensions.EMPTY_EXTENSIONS; - } - - if (extensions.equals(LocaleExtensions.EMPTY_EXTENSIONS)) { extensions = getCompatibilityExtensions(language, script, country, variant); } @@ -668,22 +673,33 @@ } private static class Cache extends LocaleObjectCache { - public Cache() { + private Cache() { } + + @Override protected Locale createObject(LocaleKey key) { - return new Locale(key._base, key._exts); + return new Locale(key.base, key.exts); } } - private static class LocaleKey { - private BaseLocale _base; - private LocaleExtensions _exts; + private static final class LocaleKey { + private final BaseLocale base; + private final LocaleExtensions exts; + private final int hash; private LocaleKey(BaseLocale baseLocale, LocaleExtensions extensions) { - _base = baseLocale; - _exts = extensions; + base = baseLocale; + exts = extensions; + + // Calculate the hash value here because it's always used. + int h = base.hashCode(); + if (exts != null) { + h ^= exts.hashCode(); + } + hash = h; } + @Override public boolean equals(Object obj) { if (this == obj) { return true; @@ -692,11 +708,18 @@ return false; } LocaleKey other = (LocaleKey)obj; - return _base.equals(other._base) && _exts.equals(other._exts); + if (hash != other.hash || !base.equals(other.base)) { + return false; + } + if (exts == null) { + return other.exts == null; + } + return exts.equals(other.exts); } + @Override public int hashCode() { - return _base.hashCode() ^ _exts.hashCode(); + return hash; } } @@ -981,7 +1004,7 @@ * @see #getDisplayLanguage */ public String getLanguage() { - return _baseLocale.getLanguage(); + return baseLocale.getLanguage(); } /** @@ -995,7 +1018,7 @@ * @since 1.7 */ public String getScript() { - return _baseLocale.getScript(); + return baseLocale.getScript(); } /** @@ -1007,7 +1030,7 @@ * @see #getDisplayCountry */ public String getCountry() { - return _baseLocale.getRegion(); + return baseLocale.getRegion(); } /** @@ -1017,7 +1040,7 @@ * @see #getDisplayVariant */ public String getVariant() { - return _baseLocale.getVariant(); + return baseLocale.getVariant(); } /** @@ -1039,7 +1062,7 @@ if (!LocaleExtensions.isValidKey(key)) { throw new IllegalArgumentException("Ill-formed extension key: " + key); } - return _extensions.getExtensionValue(key); + return (localeExtensions == null) ? null : localeExtensions.getExtensionValue(key); } /** @@ -1052,7 +1075,10 @@ * @since 1.7 */ public Set getExtensionKeys() { - return _extensions.getKeys(); + if (localeExtensions == null) { + return Collections.emptySet(); + } + return localeExtensions.getKeys(); } /** @@ -1064,7 +1090,10 @@ * @since 1.7 */ public Set getUnicodeLocaleAttributes() { - return _extensions.getUnicodeLocaleAttributes(); + if (localeExtensions == null) { + return Collections.emptySet(); + } + return localeExtensions.getUnicodeLocaleAttributes(); } /** @@ -1085,7 +1114,7 @@ if (!UnicodeLocaleExtension.isKey(key)) { throw new IllegalArgumentException("Ill-formed Unicode locale key: " + key); } - return _extensions.getUnicodeLocaleType(key); + return (localeExtensions == null) ? null : localeExtensions.getUnicodeLocaleType(key); } /** @@ -1097,7 +1126,10 @@ * @since 1.7 */ public Set getUnicodeLocaleKeys() { - return _extensions.getUnicodeLocaleKeys(); + if (localeExtensions == null) { + return Collections.emptySet(); + } + return localeExtensions.getUnicodeLocaleKeys(); } /** @@ -1106,16 +1138,17 @@ * @return base locale of this Locale */ BaseLocale getBaseLocale() { - return _baseLocale; + return baseLocale; } /** - * Package local method returning the Locale's LocaleExtensions, - * used by ResourceBundle - * @return locale exnteions of this Locale + * Package private method returning the Locale's LocaleExtensions, + * used by ResourceBundle. + * @return locale exnteions of this Locale, + * or {@code null} if no extensions are defined */ LocaleExtensions getLocaleExtensions() { - return _extensions; + return localeExtensions; } /** @@ -1160,26 +1193,27 @@ * @see #getDisplayName * @see #toLanguageTag */ + @Override public final String toString() { - boolean l = (_baseLocale.getLanguage().length() != 0); - boolean s = (_baseLocale.getScript().length() != 0); - boolean r = (_baseLocale.getRegion().length() != 0); - boolean v = (_baseLocale.getVariant().length() != 0); - boolean e = (_extensions.getID().length() != 0); + boolean l = (baseLocale.getLanguage().length() != 0); + boolean s = (baseLocale.getScript().length() != 0); + boolean r = (baseLocale.getRegion().length() != 0); + boolean v = (baseLocale.getVariant().length() != 0); + boolean e = (localeExtensions != null && localeExtensions.getID().length() != 0); - StringBuilder result = new StringBuilder(_baseLocale.getLanguage()); + StringBuilder result = new StringBuilder(baseLocale.getLanguage()); if (r || (l && (v || s || e))) { result.append('_') - .append(_baseLocale.getRegion()); // This may just append '_' + .append(baseLocale.getRegion()); // This may just append '_' } if (v && (l || r)) { result.append('_') - .append(_baseLocale.getVariant()); + .append(baseLocale.getVariant()); } if (s && (l || r)) { result.append("_#") - .append(_baseLocale.getScript()); + .append(baseLocale.getScript()); } if (e && (l || r)) { @@ -1187,7 +1221,7 @@ if (!s) { result.append('#'); } - result.append(_extensions.getID()); + result.append(localeExtensions.getID()); } return result.toString(); @@ -1261,7 +1295,7 @@ * @since 1.7 */ public String toLanguageTag() { - LanguageTag tag = LanguageTag.parseLocale(_baseLocale, _extensions); + LanguageTag tag = LanguageTag.parseLocale(baseLocale, localeExtensions); StringBuilder buf = new StringBuilder(); String subtag = tag.getLanguage(); @@ -1433,8 +1467,9 @@ bldr.setLanguageTag(tag); BaseLocale base = bldr.getBaseLocale(); LocaleExtensions exts = bldr.getLocaleExtensions(); - if (exts.isEmpty() && base.getVariant().length() > 0) { - exts = getCompatibilityExtensions(base.getLanguage(), base.getScript(), base.getRegion(), base.getVariant()); + if (exts == null && base.getVariant().length() > 0) { + exts = getCompatibilityExtensions(base.getLanguage(), base.getScript(), + base.getRegion(), base.getVariant()); } return getInstance(base, exts); } @@ -1454,7 +1489,7 @@ * three-letter language abbreviation is not available for this locale. */ public String getISO3Language() throws MissingResourceException { - String lang = _baseLocale.getLanguage(); + String lang = baseLocale.getLanguage(); if (lang.length() == 3) { return lang; } @@ -1481,10 +1516,10 @@ * three-letter country abbreviation is not available for this locale. */ public String getISO3Country() throws MissingResourceException { - String country3 = getISO3Code(_baseLocale.getRegion(), LocaleISOData.isoCountryTable); + String country3 = getISO3Code(baseLocale.getRegion(), LocaleISOData.isoCountryTable); if (country3 == null) { throw new MissingResourceException("Couldn't find 3-letter country code for " - + _baseLocale.getRegion(), "FormatData_" + toString(), "ShortCountry"); + + baseLocale.getRegion(), "FormatData_" + toString(), "ShortCountry"); } return country3; } @@ -1542,7 +1577,7 @@ * @exception NullPointerException if inLocale is null */ public String getDisplayLanguage(Locale inLocale) { - return getDisplayString(_baseLocale.getLanguage(), inLocale, DISPLAY_LANGUAGE); + return getDisplayString(baseLocale.getLanguage(), inLocale, DISPLAY_LANGUAGE); } /** @@ -1568,7 +1603,7 @@ * @since 1.7 */ public String getDisplayScript(Locale inLocale) { - return getDisplayString(_baseLocale.getScript(), inLocale, DISPLAY_SCRIPT); + return getDisplayString(baseLocale.getScript(), inLocale, DISPLAY_SCRIPT); } /** @@ -1603,7 +1638,7 @@ * @exception NullPointerException if inLocale is null */ public String getDisplayCountry(Locale inLocale) { - return getDisplayString(_baseLocale.getRegion(), inLocale, DISPLAY_COUNTRY); + return getDisplayString(baseLocale.getRegion(), inLocale, DISPLAY_COUNTRY); } private String getDisplayString(String code, Locale inLocale, int type) { @@ -1662,7 +1697,7 @@ * @exception NullPointerException if inLocale is null */ public String getDisplayVariant(Locale inLocale) { - if (_baseLocale.getVariant().length() == 0) + if (baseLocale.getVariant().length() == 0) return ""; OpenListResourceBundle bundle = LocaleData.getLocaleNames(inLocale); @@ -1758,7 +1793,7 @@ return formatList(variantNames, listPattern, listCompositionPattern); } } - ArrayList names = new ArrayList(4); + ArrayList names = new ArrayList<>(4); if (languageName.length() != 0) { names.add(languageName); } @@ -1833,10 +1868,14 @@ * Since Locales are often used in hashtables, caches the value * for speed. */ + @Override public int hashCode() { int hc = hashCodeValue; if (hc == 0) { - hc = _baseLocale.hashCode() ^ _extensions.hashCode(); + hc = baseLocale.hashCode(); + if (localeExtensions != null) { + hc ^= localeExtensions.hashCode(); + } hashCodeValue = hc; } return hc; @@ -1851,21 +1890,26 @@ * * @return true if this Locale is equal to the specified object. */ - + @Override public boolean equals(Object obj) { if (this == obj) // quick check return true; if (!(obj instanceof Locale)) return false; - BaseLocale otherBase = ((Locale)obj)._baseLocale; - LocaleExtensions otherExt = ((Locale)obj)._extensions; - return _baseLocale.equals(otherBase) && _extensions.equals(otherExt); + BaseLocale otherBase = ((Locale)obj).baseLocale; + if (!baseLocale.equals(otherBase)) { + return false; + } + if (localeExtensions == null) { + return ((Locale)obj).localeExtensions == null; + } + return localeExtensions.equals(((Locale)obj).localeExtensions); } // ================= privates ===================================== - private transient BaseLocale _baseLocale; - private transient LocaleExtensions _extensions; + private transient BaseLocale baseLocale; + private transient LocaleExtensions localeExtensions; /** * Calculated hashcode @@ -1883,7 +1927,7 @@ */ private String[] getDisplayVariantArray(OpenListResourceBundle bundle, Locale inLocale) { // Split the variant name into tokens separated by '_'. - StringTokenizer tokenizer = new StringTokenizer(_baseLocale.getVariant(), "_"); + StringTokenizer tokenizer = new StringTokenizer(baseLocale.getVariant(), "_"); String[] names = new String[tokenizer.countTokens()]; // For each variant token, lookup the display name. If @@ -1996,11 +2040,11 @@ */ private void writeObject(ObjectOutputStream out) throws IOException { ObjectOutputStream.PutField fields = out.putFields(); - fields.put("language", _baseLocale.getLanguage()); - fields.put("script", _baseLocale.getScript()); - fields.put("country", _baseLocale.getRegion()); - fields.put("variant", _baseLocale.getVariant()); - fields.put("extensions", _extensions.getID()); + fields.put("language", baseLocale.getLanguage()); + fields.put("script", baseLocale.getScript()); + fields.put("country", baseLocale.getRegion()); + fields.put("variant", baseLocale.getVariant()); + fields.put("extensions", localeExtensions == null ? "" : localeExtensions.getID()); fields.put("hashcode", -1); // place holder just for backward support out.writeFields(); } @@ -2020,13 +2064,17 @@ String country = (String)fields.get("country", ""); String variant = (String)fields.get("variant", ""); String extStr = (String)fields.get("extensions", ""); - _baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), script, country, variant); - try { - InternalLocaleBuilder bldr = new InternalLocaleBuilder(); - bldr.setExtensions(extStr); - _extensions = bldr.getLocaleExtensions(); - } catch (LocaleSyntaxException e) { - throw new IllformedLocaleException(e.getMessage()); + baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), script, country, variant); + if (extStr.length() > 0) { + try { + InternalLocaleBuilder bldr = new InternalLocaleBuilder(); + bldr.setExtensions(extStr); + localeExtensions = bldr.getLocaleExtensions(); + } catch (LocaleSyntaxException e) { + throw new IllformedLocaleException(e.getMessage()); + } + } else { + localeExtensions = null; } } @@ -2045,8 +2093,8 @@ * @throws java.io.ObjectStreamException */ private Object readResolve() throws java.io.ObjectStreamException { - return getInstance(_baseLocale.getLanguage(), _baseLocale.getScript(), - _baseLocale.getRegion(), _baseLocale.getVariant(), _extensions); + return getInstance(baseLocale.getLanguage(), baseLocale.getScript(), + baseLocale.getRegion(), baseLocale.getVariant(), localeExtensions); } private static volatile String[] isoLanguages = null; @@ -2056,7 +2104,7 @@ private static String convertOldISOCodes(String language) { // we accept both the old and the new ISO codes for the languages whose ISO // codes have changed, but we always store the OLD code, for backward compatibility - language = AsciiUtil.toLowerString(language).intern(); + language = LocaleUtils.toLowerString(language).intern(); if (language == "he") { return "iw"; } else if (language == "yi") { @@ -2068,19 +2116,22 @@ } } - private static LocaleExtensions getCompatibilityExtensions(String language, String script, String country, String variant) { - LocaleExtensions extensions = LocaleExtensions.EMPTY_EXTENSIONS; + private static LocaleExtensions getCompatibilityExtensions(String language, + String script, + String country, + String variant) { + LocaleExtensions extensions = null; // Special cases for backward compatibility support - if (AsciiUtil.caseIgnoreMatch(language, "ja") + if (LocaleUtils.caseIgnoreMatch(language, "ja") && script.length() == 0 - && AsciiUtil.caseIgnoreMatch(country, "JP") - && AsciiUtil.caseIgnoreMatch(variant, "JP")) { + && LocaleUtils.caseIgnoreMatch(country, "jp") + && "JP".equals(variant)) { // ja_JP_JP -> u-ca-japanese (calendar = japanese) extensions = LocaleExtensions.CALENDAR_JAPANESE; - } else if (AsciiUtil.caseIgnoreMatch(language, "th") + } else if (LocaleUtils.caseIgnoreMatch(language, "th") && script.length() == 0 - && AsciiUtil.caseIgnoreMatch(country, "TH") - && AsciiUtil.caseIgnoreMatch(variant, "TH")) { + && LocaleUtils.caseIgnoreMatch(country, "th") + && "TH".equals(variant)) { // th_TH_TH -> u-nu-thai (numbersystem = thai) extensions = LocaleExtensions.NUMBER_THAI; } @@ -2196,7 +2247,7 @@ * @since 1.7 */ public static final class Builder { - private InternalLocaleBuilder _locbld; + private final InternalLocaleBuilder localeBuilder; /** * Constructs an empty Builder. The default value of all @@ -2204,7 +2255,7 @@ * empty string. */ public Builder() { - _locbld = new InternalLocaleBuilder(); + localeBuilder = new InternalLocaleBuilder(); } /** @@ -2229,7 +2280,7 @@ */ public Builder setLocale(Locale locale) { try { - _locbld.setLocale(locale._baseLocale, locale._extensions); + localeBuilder.setLocale(locale.baseLocale, locale.localeExtensions); } catch (LocaleSyntaxException e) { throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex()); } @@ -2259,8 +2310,7 @@ if (sts.isError()) { throw new IllformedLocaleException(sts.getErrorMessage(), sts.getErrorIndex()); } - _locbld.setLanguageTag(tag); - + localeBuilder.setLanguageTag(tag); return this; } @@ -2279,7 +2329,7 @@ */ public Builder setLanguage(String language) { try { - _locbld.setLanguage(language); + localeBuilder.setLanguage(language); } catch (LocaleSyntaxException e) { throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex()); } @@ -2300,7 +2350,7 @@ */ public Builder setScript(String script) { try { - _locbld.setScript(script); + localeBuilder.setScript(script); } catch (LocaleSyntaxException e) { throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex()); } @@ -2325,7 +2375,7 @@ */ public Builder setRegion(String region) { try { - _locbld.setRegion(region); + localeBuilder.setRegion(region); } catch (LocaleSyntaxException e) { throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex()); } @@ -2352,7 +2402,7 @@ */ public Builder setVariant(String variant) { try { - _locbld.setVariant(variant); + localeBuilder.setVariant(variant); } catch (LocaleSyntaxException e) { throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex()); } @@ -2384,7 +2434,7 @@ */ public Builder setExtension(char key, String value) { try { - _locbld.setExtension(key, value); + localeBuilder.setExtension(key, value); } catch (LocaleSyntaxException e) { throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex()); } @@ -2414,7 +2464,7 @@ */ public Builder setUnicodeLocaleKeyword(String key, String type) { try { - _locbld.setUnicodeLocaleKeyword(key, type); + localeBuilder.setUnicodeLocaleKeyword(key, type); } catch (LocaleSyntaxException e) { throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex()); } @@ -2435,7 +2485,7 @@ */ public Builder addUnicodeLocaleAttribute(String attribute) { try { - _locbld.addUnicodeLocaleAttribute(attribute); + localeBuilder.addUnicodeLocaleAttribute(attribute); } catch (LocaleSyntaxException e) { throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex()); } @@ -2458,7 +2508,7 @@ */ public Builder removeUnicodeLocaleAttribute(String attribute) { try { - _locbld.removeUnicodeLocaleAttribute(attribute); + localeBuilder.removeUnicodeLocaleAttribute(attribute); } catch (LocaleSyntaxException e) { throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex()); } @@ -2471,7 +2521,7 @@ * @return This builder. */ public Builder clear() { - _locbld.clear(); + localeBuilder.clear(); return this; } @@ -2483,7 +2533,7 @@ * @see #setExtension(char, String) */ public Builder clearExtensions() { - _locbld.clearExtensions(); + localeBuilder.clearExtensions(); return this; } @@ -2498,9 +2548,9 @@ * @return A Locale. */ public Locale build() { - BaseLocale baseloc = _locbld.getBaseLocale(); - LocaleExtensions extensions = _locbld.getLocaleExtensions(); - if (extensions.isEmpty() && baseloc.getVariant().length() > 0) { + BaseLocale baseloc = localeBuilder.getBaseLocale(); + LocaleExtensions extensions = localeBuilder.getLocaleExtensions(); + if (extensions == null && baseloc.getVariant().length() > 0) { extensions = getCompatibilityExtensions(baseloc.getLanguage(), baseloc.getScript(), baseloc.getRegion(), baseloc.getVariant()); } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/NavigableMap.java --- a/jdk/src/share/classes/java/util/NavigableMap.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/NavigableMap.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea and Josh Bloch with assistance from members of JCP * JSR-166 Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/NavigableSet.java --- a/jdk/src/share/classes/java/util/NavigableSet.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/NavigableSet.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea and Josh Bloch with assistance from members of JCP * JSR-166 Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/Properties.java --- a/jdk/src/share/classes/java/util/Properties.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/Properties.java Wed Jul 05 17:42:05 2017 +0200 @@ -68,8 +68,9 @@ * methods work the same way as the load(Reader)/store(Writer, String) pair, except * the input/output stream is encoded in ISO 8859-1 character encoding. * Characters that cannot be directly represented in this encoding can be written using - * Unicode escapes - * ; only a single 'u' character is allowed in an escape + * Unicode escapes as defined in section 3.3 of + * The Java™ Language Specification; + * only a single 'u' character is allowed in an escape * sequence. The native2ascii tool can be used to convert property files to and * from other character encodings. * @@ -272,11 +273,8 @@ * * Characters in keys and elements can be represented in escape * sequences similar to those used for character and string literals - * (see §3.3 - * and §3.10.6 - * of the Java Language Specification). + * (see sections 3.3 and 3.10.6 of + * The Java™ Language Specification). * * The differences from the character escape sequences and Unicode * escapes used for characters and strings are: @@ -326,8 +324,9 @@ * {@link #load(java.io.Reader) load(Reader)} and is assumed to use * the ISO 8859-1 character encoding; that is each byte is one Latin1 * character. Characters not in Latin1, and certain special characters, - * are represented in keys and elements using - * Unicode escapes. + * are represented in keys and elements using Unicode escapes as defined in + * section 3.3 of + * The Java™ Language Specification. *

          * The specified stream remains open after this method returns. * diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/PropertyResourceBundle.java --- a/jdk/src/share/classes/java/util/PropertyResourceBundle.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/PropertyResourceBundle.java Wed Jul 05 17:42:05 2017 +0200 @@ -104,8 +104,9 @@ * from an InputStream or a Reader, which represents a property file. * Constructing a PropertyResourceBundle instance from an InputStream requires * that the input stream be encoded in ISO-8859-1. In that case, characters - * that cannot be represented in ISO-8859-1 encoding must be represented by - * Unicode Escapes, + * that cannot be represented in ISO-8859-1 encoding must be represented by Unicode Escapes + * as defined in section 3.3 of + * The Java™ Language Specification * whereas the other constructor which takes a Reader does not have that limitation. * * @see ResourceBundle diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/Queue.java --- a/jdk/src/share/classes/java/util/Queue.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/Queue.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/ResourceBundle.java --- a/jdk/src/share/classes/java/util/ResourceBundle.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/ResourceBundle.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,7 +57,6 @@ import java.util.jar.JarEntry; import sun.util.locale.BaseLocale; -import sun.util.locale.LocaleExtensions; import sun.util.locale.LocaleObjectCache; @@ -290,7 +289,7 @@ * name for compatibility with some workarounds for bug 4212439. */ private static final ConcurrentMap cacheList - = new ConcurrentHashMap(INITIAL_CACHE_SIZE); + = new ConcurrentHashMap<>(INITIAL_CACHE_SIZE); /** * Queue for reference objects referring to class loaders or bundles. @@ -1755,7 +1754,7 @@ * @since 1.6 */ public Set keySet() { - Set keys = new HashSet(); + Set keys = new HashSet<>(); for (ResourceBundle rb = this; rb != null; rb = rb.parent) { keys.addAll(rb.handleKeySet()); } @@ -1783,7 +1782,7 @@ if (keySet == null) { synchronized (this) { if (keySet == null) { - Set keys = new HashSet(); + Set keys = new HashSet<>(); Enumeration enumKeys = getKeys(); while (enumKeys.hasMoreElements()) { String key = enumKeys.nextElement(); @@ -2301,7 +2300,7 @@ if (baseName == null) { throw new NullPointerException(); } - return new ArrayList(CANDIDATES_CACHE.get(locale.getBaseLocale())); + return new ArrayList<>(CANDIDATES_CACHE.get(locale.getBaseLocale())); } private static final CandidateListCache CANDIDATES_CACHE = new CandidateListCache(); @@ -2327,14 +2326,14 @@ if (language.equals("nb") || isNorwegianBokmal) { List tmpList = getDefaultList("nb", script, region, variant); // Insert a locale replacing "nb" with "no" for every list entry - List bokmalList = new LinkedList(); + List bokmalList = new LinkedList<>(); for (Locale l : tmpList) { bokmalList.add(l); if (l.getLanguage().length() == 0) { break; } bokmalList.add(Locale.getInstance("no", l.getScript(), l.getCountry(), - l.getVariant(), LocaleExtensions.EMPTY_EXTENSIONS)); + l.getVariant(), null)); } return bokmalList; } else if (language.equals("nn") || isNorwegianNynorsk) { @@ -2374,7 +2373,7 @@ List variants = null; if (variant.length() > 0) { - variants = new LinkedList(); + variants = new LinkedList<>(); int idx = variant.length(); while (idx != -1) { variants.add(variant.substring(0, idx)); @@ -2382,32 +2381,32 @@ } } - LinkedList list = new LinkedList(); + List list = new LinkedList<>(); if (variants != null) { for (String v : variants) { - list.add(Locale.getInstance(language, script, region, v, LocaleExtensions.EMPTY_EXTENSIONS)); + list.add(Locale.getInstance(language, script, region, v, null)); } } if (region.length() > 0) { - list.add(Locale.getInstance(language, script, region, "", LocaleExtensions.EMPTY_EXTENSIONS)); + list.add(Locale.getInstance(language, script, region, "", null)); } if (script.length() > 0) { - list.add(Locale.getInstance(language, script, "", "", LocaleExtensions.EMPTY_EXTENSIONS)); + list.add(Locale.getInstance(language, script, "", "", null)); // With script, after truncating variant, region and script, // start over without script. if (variants != null) { for (String v : variants) { - list.add(Locale.getInstance(language, "", region, v, LocaleExtensions.EMPTY_EXTENSIONS)); + list.add(Locale.getInstance(language, "", region, v, null)); } } if (region.length() > 0) { - list.add(Locale.getInstance(language, "", region, "", LocaleExtensions.EMPTY_EXTENSIONS)); + list.add(Locale.getInstance(language, "", region, "", null)); } } if (language.length() > 0) { - list.add(Locale.getInstance(language, "", "", "", LocaleExtensions.EMPTY_EXTENSIONS)); + list.add(Locale.getInstance(language, "", "", "", null)); } // Add root locale at the end list.add(Locale.ROOT); diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/AbstractExecutorService.java --- a/jdk/src/share/classes/java/util/concurrent/AbstractExecutorService.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/AbstractExecutorService.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java --- a/jdk/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/BlockingDeque.java --- a/jdk/src/share/classes/java/util/concurrent/BlockingDeque.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/BlockingDeque.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/BlockingQueue.java --- a/jdk/src/share/classes/java/util/concurrent/BlockingQueue.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/BlockingQueue.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/BrokenBarrierException.java --- a/jdk/src/share/classes/java/util/concurrent/BrokenBarrierException.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/BrokenBarrierException.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/Callable.java --- a/jdk/src/share/classes/java/util/concurrent/Callable.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/Callable.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/CancellationException.java --- a/jdk/src/share/classes/java/util/concurrent/CancellationException.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/CancellationException.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/CompletionService.java --- a/jdk/src/share/classes/java/util/concurrent/CompletionService.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/CompletionService.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; @@ -105,7 +105,25 @@ /* * The basic strategy is to subdivide the table among Segments, - * each of which itself is a concurrently readable hash table. + * each of which itself is a concurrently readable hash table. To + * reduce footprint, all but one segments are constructed only + * when first needed (see ensureSegment). To maintain visibility + * in the presence of lazy construction, accesses to segments as + * well as elements of segment's table must use volatile access, + * which is done via Unsafe within methods segmentAt etc + * below. These provide the functionality of AtomicReferenceArrays + * but reduce the levels of indirection. Additionally, + * volatile-writes of table elements and entry "next" fields + * within locked operations use the cheaper "lazySet" forms of + * writes (via putOrderedObject) because these writes are always + * followed by lock releases that maintain sequential consistency + * of table updates. + * + * Historical note: The previous version of this class relied + * heavily on "final" fields, which avoided some volatile reads at + * the expense of a large initial footprint. Some remnants of + * that design (including forced construction of segment 0) exist + * to ensure serialization compatibility. */ /* ---------------- Constants -------------- */ @@ -137,8 +155,15 @@ static final int MAXIMUM_CAPACITY = 1 << 30; /** + * The minimum capacity for per-segment tables. Must be a power + * of two, at least two to avoid immediate resizing on next use + * after lazy construction. + */ + static final int MIN_SEGMENT_TABLE_CAPACITY = 2; + + /** * The maximum number of segments to allow; used to bound - * constructor arguments. + * constructor arguments. Must be power of two less than 1 << 24. */ static final int MAX_SEGMENTS = 1 << 16; // slightly conservative @@ -164,7 +189,7 @@ final int segmentShift; /** - * The segments, each of which is a specialized hash table + * The segments, each of which is a specialized hash table. */ final Segment[] segments; @@ -172,7 +197,65 @@ transient Set> entrySet; transient Collection values; - /* ---------------- Small Utilities -------------- */ + /** + * ConcurrentHashMap list entry. Note that this is never exported + * out as a user-visible Map.Entry. + */ + static final class HashEntry { + final int hash; + final K key; + volatile V value; + volatile HashEntry next; + + HashEntry(int hash, K key, V value, HashEntry next) { + this.hash = hash; + this.key = key; + this.value = value; + this.next = next; + } + + /** + * Sets next field with volatile write semantics. (See above + * about use of putOrderedObject.) + */ + final void setNext(HashEntry n) { + UNSAFE.putOrderedObject(this, nextOffset, n); + } + + // Unsafe mechanics + static final sun.misc.Unsafe UNSAFE; + static final long nextOffset; + static { + try { + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class k = HashEntry.class; + nextOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("next")); + } catch (Exception e) { + throw new Error(e); + } + } + } + + /** + * Gets the ith element of given table (if nonnull) with volatile + * read semantics. + */ + @SuppressWarnings("unchecked") + static final HashEntry entryAt(HashEntry[] tab, int i) { + return (tab == null) ? null : + (HashEntry) UNSAFE.getObjectVolatile + (tab, ((long)i << TSHIFT) + TBASE); + } + + /** + * Sets the ith element of given table, with volatile write + * semantics. (See above about use of putOrderedObject.) + */ + static final void setEntryAt(HashEntry[] tab, int i, + HashEntry e) { + UNSAFE.putOrderedObject(tab, ((long)i << TSHIFT) + TBASE, e); + } /** * Applies a supplemental hash function to a given hashCode, which @@ -193,104 +276,67 @@ } /** - * Returns the segment that should be used for key with given hash - * @param hash the hash code for the key - * @return the segment - */ - final Segment segmentFor(int hash) { - return segments[(hash >>> segmentShift) & segmentMask]; - } - - /* ---------------- Inner Classes -------------- */ - - /** - * ConcurrentHashMap list entry. Note that this is never exported - * out as a user-visible Map.Entry. - * - * Because the value field is volatile, not final, it is legal wrt - * the Java Memory Model for an unsynchronized reader to see null - * instead of initial value when read via a data race. Although a - * reordering leading to this is not likely to ever actually - * occur, the Segment.readValueUnderLock method is used as a - * backup in case a null (pre-initialized) value is ever seen in - * an unsynchronized access method. - */ - static final class HashEntry { - final K key; - final int hash; - volatile V value; - final HashEntry next; - - HashEntry(K key, int hash, HashEntry next, V value) { - this.key = key; - this.hash = hash; - this.next = next; - this.value = value; - } - - @SuppressWarnings("unchecked") - static final HashEntry[] newArray(int i) { - return new HashEntry[i]; - } - } - - /** * Segments are specialized versions of hash tables. This * subclasses from ReentrantLock opportunistically, just to * simplify some locking and avoid separate construction. */ static final class Segment extends ReentrantLock implements Serializable { /* - * Segments maintain a table of entry lists that are ALWAYS - * kept in a consistent state, so can be read without locking. - * Next fields of nodes are immutable (final). All list - * additions are performed at the front of each bin. This - * makes it easy to check changes, and also fast to traverse. - * When nodes would otherwise be changed, new nodes are - * created to replace them. This works well for hash tables - * since the bin lists tend to be short. (The average length - * is less than two for the default load factor threshold.) + * Segments maintain a table of entry lists that are always + * kept in a consistent state, so can be read (via volatile + * reads of segments and tables) without locking. This + * requires replicating nodes when necessary during table + * resizing, so the old lists can be traversed by readers + * still using old version of table. * - * Read operations can thus proceed without locking, but rely - * on selected uses of volatiles to ensure that completed - * write operations performed by other threads are - * noticed. For most purposes, the "count" field, tracking the - * number of elements, serves as that volatile variable - * ensuring visibility. This is convenient because this field - * needs to be read in many read operations anyway: - * - * - All (unsynchronized) read operations must first read the - * "count" field, and should not look at table entries if - * it is 0. - * - * - All (synchronized) write operations should write to - * the "count" field after structurally changing any bin. - * The operations must not take any action that could even - * momentarily cause a concurrent read operation to see - * inconsistent data. This is made easier by the nature of - * the read operations in Map. For example, no operation - * can reveal that the table has grown but the threshold - * has not yet been updated, so there are no atomicity - * requirements for this with respect to reads. - * - * As a guide, all critical volatile reads and writes to the - * count field are marked in code comments. + * This class defines only mutative methods requiring locking. + * Except as noted, the methods of this class perform the + * per-segment versions of ConcurrentHashMap methods. (Other + * methods are integrated directly into ConcurrentHashMap + * methods.) These mutative methods use a form of controlled + * spinning on contention via methods scanAndLock and + * scanAndLockForPut. These intersperse tryLocks with + * traversals to locate nodes. The main benefit is to absorb + * cache misses (which are very common for hash tables) while + * obtaining locks so that traversal is faster once + * acquired. We do not actually use the found nodes since they + * must be re-acquired under lock anyway to ensure sequential + * consistency of updates (and in any case may be undetectably + * stale), but they will normally be much faster to re-locate. + * Also, scanAndLockForPut speculatively creates a fresh node + * to use in put if no node is found. */ private static final long serialVersionUID = 2249069246763182397L; /** - * The number of elements in this segment's region. + * The maximum number of times to tryLock in a prescan before + * possibly blocking on acquire in preparation for a locked + * segment operation. On multiprocessors, using a bounded + * number of retries maintains cache acquired while locating + * nodes. */ - transient volatile int count; + static final int MAX_SCAN_RETRIES = + Runtime.getRuntime().availableProcessors() > 1 ? 64 : 1; /** - * Number of updates that alter the size of the table. This is - * used during bulk-read methods to make sure they see a - * consistent snapshot: If modCounts change during a traversal - * of segments computing size or checking containsValue, then - * we might have an inconsistent view of state so (usually) - * must retry. + * The per-segment table. Elements are accessed via + * entryAt/setEntryAt providing volatile semantics. + */ + transient volatile HashEntry[] table; + + /** + * The number of elements. Accessed only either within locks + * or among other volatile reads that maintain visibility. + */ + transient int count; + + /** + * The total number of mutative operations in this segment. + * Even though this may overflows 32 bits, it provides + * sufficient accuracy for stability checks in CHM isEmpty() + * and size() methods. Accessed only either within locks or + * among other volatile reads that maintain visibility. */ transient int modCount; @@ -302,11 +348,6 @@ transient int threshold; /** - * The per-segment table. - */ - transient volatile HashEntry[] table; - - /** * The load factor for the hash table. Even though this value * is same for all segments, it is replicated to avoid needing * links to outer object. @@ -314,202 +355,94 @@ */ final float loadFactor; - Segment(int initialCapacity, float lf) { - loadFactor = lf; - setTable(HashEntry.newArray(initialCapacity)); - } - - @SuppressWarnings("unchecked") - static final Segment[] newArray(int i) { - return new Segment[i]; - } - - /** - * Sets table to new HashEntry array. - * Call only while holding lock or in constructor. - */ - void setTable(HashEntry[] newTable) { - threshold = (int)(newTable.length * loadFactor); - table = newTable; + Segment(float lf, int threshold, HashEntry[] tab) { + this.loadFactor = lf; + this.threshold = threshold; + this.table = tab; } - /** - * Returns properly casted first entry of bin for given hash. - */ - HashEntry getFirst(int hash) { - HashEntry[] tab = table; - return tab[hash & (tab.length - 1)]; - } - - /** - * Reads value field of an entry under lock. Called if value - * field ever appears to be null. This is possible only if a - * compiler happens to reorder a HashEntry initialization with - * its table assignment, which is legal under memory model - * but is not known to ever occur. - */ - V readValueUnderLock(HashEntry e) { - lock(); + final V put(K key, int hash, V value, boolean onlyIfAbsent) { + HashEntry node = tryLock() ? null : + scanAndLockForPut(key, hash, value); + V oldValue; try { - return e.value; + HashEntry[] tab = table; + int index = (tab.length - 1) & hash; + HashEntry first = entryAt(tab, index); + for (HashEntry e = first;;) { + if (e != null) { + K k; + if ((k = e.key) == key || + (e.hash == hash && key.equals(k))) { + oldValue = e.value; + if (!onlyIfAbsent) { + e.value = value; + ++modCount; + } + break; + } + e = e.next; + } + else { + if (node != null) + node.setNext(first); + else + node = new HashEntry(hash, key, value, first); + int c = count + 1; + if (c > threshold && first != null && + tab.length < MAXIMUM_CAPACITY) + rehash(node); + else + setEntryAt(tab, index, node); + ++modCount; + count = c; + oldValue = null; + break; + } + } } finally { unlock(); } - } - - /* Specialized implementations of map methods */ - - V get(Object key, int hash) { - if (count != 0) { // read-volatile - HashEntry e = getFirst(hash); - while (e != null) { - if (e.hash == hash && key.equals(e.key)) { - V v = e.value; - if (v != null) - return v; - return readValueUnderLock(e); // recheck - } - e = e.next; - } - } - return null; - } - - boolean containsKey(Object key, int hash) { - if (count != 0) { // read-volatile - HashEntry e = getFirst(hash); - while (e != null) { - if (e.hash == hash && key.equals(e.key)) - return true; - e = e.next; - } - } - return false; - } - - boolean containsValue(Object value) { - if (count != 0) { // read-volatile - HashEntry[] tab = table; - int len = tab.length; - for (int i = 0 ; i < len; i++) { - for (HashEntry e = tab[i]; e != null; e = e.next) { - V v = e.value; - if (v == null) // recheck - v = readValueUnderLock(e); - if (value.equals(v)) - return true; - } - } - } - return false; - } - - boolean replace(K key, int hash, V oldValue, V newValue) { - lock(); - try { - HashEntry e = getFirst(hash); - while (e != null && (e.hash != hash || !key.equals(e.key))) - e = e.next; - - boolean replaced = false; - if (e != null && oldValue.equals(e.value)) { - replaced = true; - e.value = newValue; - } - return replaced; - } finally { - unlock(); - } + return oldValue; } - V replace(K key, int hash, V newValue) { - lock(); - try { - HashEntry e = getFirst(hash); - while (e != null && (e.hash != hash || !key.equals(e.key))) - e = e.next; - - V oldValue = null; - if (e != null) { - oldValue = e.value; - e.value = newValue; - } - return oldValue; - } finally { - unlock(); - } - } - - - V put(K key, int hash, V value, boolean onlyIfAbsent) { - lock(); - try { - int c = count; - if (c++ > threshold) // ensure capacity - rehash(); - HashEntry[] tab = table; - int index = hash & (tab.length - 1); - HashEntry first = tab[index]; - HashEntry e = first; - while (e != null && (e.hash != hash || !key.equals(e.key))) - e = e.next; - - V oldValue; - if (e != null) { - oldValue = e.value; - if (!onlyIfAbsent) - e.value = value; - } - else { - oldValue = null; - ++modCount; - tab[index] = new HashEntry(key, hash, first, value); - count = c; // write-volatile - } - return oldValue; - } finally { - unlock(); - } - } - - void rehash() { + /** + * Doubles size of table and repacks entries, also adding the + * given node to new table + */ + @SuppressWarnings("unchecked") + private void rehash(HashEntry node) { + /* + * Reclassify nodes in each list to new table. Because we + * are using power-of-two expansion, the elements from + * each bin must either stay at same index, or move with a + * power of two offset. We eliminate unnecessary node + * creation by catching cases where old nodes can be + * reused because their next fields won't change. + * Statistically, at the default threshold, only about + * one-sixth of them need cloning when a table + * doubles. The nodes they replace will be garbage + * collectable as soon as they are no longer referenced by + * any reader thread that may be in the midst of + * concurrently traversing table. Entry accesses use plain + * array indexing because they are followed by volatile + * table write. + */ HashEntry[] oldTable = table; int oldCapacity = oldTable.length; - if (oldCapacity >= MAXIMUM_CAPACITY) - return; - - /* - * Reclassify nodes in each list to new Map. Because we are - * using power-of-two expansion, the elements from each bin - * must either stay at same index, or move with a power of two - * offset. We eliminate unnecessary node creation by catching - * cases where old nodes can be reused because their next - * fields won't change. Statistically, at the default - * threshold, only about one-sixth of them need cloning when - * a table doubles. The nodes they replace will be garbage - * collectable as soon as they are no longer referenced by any - * reader thread that may be in the midst of traversing table - * right now. - */ - - HashEntry[] newTable = HashEntry.newArray(oldCapacity<<1); - threshold = (int)(newTable.length * loadFactor); - int sizeMask = newTable.length - 1; + int newCapacity = oldCapacity << 1; + threshold = (int)(newCapacity * loadFactor); + HashEntry[] newTable = + (HashEntry[]) new HashEntry[newCapacity]; + int sizeMask = newCapacity - 1; for (int i = 0; i < oldCapacity ; i++) { - // We need to guarantee that any existing reads of old Map can - // proceed. So we cannot yet null out each bin. HashEntry e = oldTable[i]; - if (e != null) { HashEntry next = e.next; int idx = e.hash & sizeMask; - - // Single node on list - if (next == null) + if (next == null) // Single node on list newTable[idx] = e; - - else { - // Reuse trailing consecutive sequence at same slot + else { // Reuse consecutive sequence at same slot HashEntry lastRun = e; int lastIdx = idx; for (HashEntry last = next; @@ -522,74 +455,259 @@ } } newTable[lastIdx] = lastRun; - - // Clone all remaining nodes + // Clone remaining nodes for (HashEntry p = e; p != lastRun; p = p.next) { - int k = p.hash & sizeMask; + V v = p.value; + int h = p.hash; + int k = h & sizeMask; HashEntry n = newTable[k]; - newTable[k] = new HashEntry(p.key, p.hash, - n, p.value); + newTable[k] = new HashEntry(h, p.key, v, n); } } } } + int nodeIndex = node.hash & sizeMask; // add the new node + node.setNext(newTable[nodeIndex]); + newTable[nodeIndex] = node; table = newTable; } /** + * Scans for a node containing given key while trying to + * acquire lock, creating and returning one if not found. Upon + * return, guarantees that lock is held. UNlike in most + * methods, calls to method equals are not screened: Since + * traversal speed doesn't matter, we might as well help warm + * up the associated code and accesses as well. + * + * @return a new node if key not found, else null + */ + private HashEntry scanAndLockForPut(K key, int hash, V value) { + HashEntry first = entryForHash(this, hash); + HashEntry e = first; + HashEntry node = null; + int retries = -1; // negative while locating node + while (!tryLock()) { + HashEntry f; // to recheck first below + if (retries < 0) { + if (e == null) { + if (node == null) // speculatively create node + node = new HashEntry(hash, key, value, null); + retries = 0; + } + else if (key.equals(e.key)) + retries = 0; + else + e = e.next; + } + else if (++retries > MAX_SCAN_RETRIES) { + lock(); + break; + } + else if ((retries & 1) == 0 && + (f = entryForHash(this, hash)) != first) { + e = first = f; // re-traverse if entry changed + retries = -1; + } + } + return node; + } + + /** + * Scans for a node containing the given key while trying to + * acquire lock for a remove or replace operation. Upon + * return, guarantees that lock is held. Note that we must + * lock even if the key is not found, to ensure sequential + * consistency of updates. + */ + private void scanAndLock(Object key, int hash) { + // similar to but simpler than scanAndLockForPut + HashEntry first = entryForHash(this, hash); + HashEntry e = first; + int retries = -1; + while (!tryLock()) { + HashEntry f; + if (retries < 0) { + if (e == null || key.equals(e.key)) + retries = 0; + else + e = e.next; + } + else if (++retries > MAX_SCAN_RETRIES) { + lock(); + break; + } + else if ((retries & 1) == 0 && + (f = entryForHash(this, hash)) != first) { + e = first = f; + retries = -1; + } + } + } + + /** * Remove; match on key only if value null, else match both. */ - V remove(Object key, int hash, Object value) { + final V remove(Object key, int hash, Object value) { + if (!tryLock()) + scanAndLock(key, hash); + V oldValue = null; + try { + HashEntry[] tab = table; + int index = (tab.length - 1) & hash; + HashEntry e = entryAt(tab, index); + HashEntry pred = null; + while (e != null) { + K k; + HashEntry next = e.next; + if ((k = e.key) == key || + (e.hash == hash && key.equals(k))) { + V v = e.value; + if (value == null || value == v || value.equals(v)) { + if (pred == null) + setEntryAt(tab, index, next); + else + pred.setNext(next); + ++modCount; + --count; + oldValue = v; + } + break; + } + pred = e; + e = next; + } + } finally { + unlock(); + } + return oldValue; + } + + final boolean replace(K key, int hash, V oldValue, V newValue) { + if (!tryLock()) + scanAndLock(key, hash); + boolean replaced = false; + try { + HashEntry e; + for (e = entryForHash(this, hash); e != null; e = e.next) { + K k; + if ((k = e.key) == key || + (e.hash == hash && key.equals(k))) { + if (oldValue.equals(e.value)) { + e.value = newValue; + ++modCount; + replaced = true; + } + break; + } + } + } finally { + unlock(); + } + return replaced; + } + + final V replace(K key, int hash, V value) { + if (!tryLock()) + scanAndLock(key, hash); + V oldValue = null; + try { + HashEntry e; + for (e = entryForHash(this, hash); e != null; e = e.next) { + K k; + if ((k = e.key) == key || + (e.hash == hash && key.equals(k))) { + oldValue = e.value; + e.value = value; + ++modCount; + break; + } + } + } finally { + unlock(); + } + return oldValue; + } + + final void clear() { lock(); try { - int c = count - 1; HashEntry[] tab = table; - int index = hash & (tab.length - 1); - HashEntry first = tab[index]; - HashEntry e = first; - while (e != null && (e.hash != hash || !key.equals(e.key))) - e = e.next; - - V oldValue = null; - if (e != null) { - V v = e.value; - if (value == null || value.equals(v)) { - oldValue = v; - // All entries following removed node can stay - // in list, but all preceding ones need to be - // cloned. - ++modCount; - HashEntry newFirst = e.next; - for (HashEntry p = first; p != e; p = p.next) - newFirst = new HashEntry(p.key, p.hash, - newFirst, p.value); - tab[index] = newFirst; - count = c; // write-volatile - } - } - return oldValue; + for (int i = 0; i < tab.length ; i++) + setEntryAt(tab, i, null); + ++modCount; + count = 0; } finally { unlock(); } } + } - void clear() { - if (count != 0) { - lock(); - try { - HashEntry[] tab = table; - for (int i = 0; i < tab.length ; i++) - tab[i] = null; - ++modCount; - count = 0; // write-volatile - } finally { - unlock(); + // Accessing segments + + /** + * Gets the jth element of given segment array (if nonnull) with + * volatile element access semantics via Unsafe. + */ + @SuppressWarnings("unchecked") + static final Segment segmentAt(Segment[] ss, int j) { + long u = (j << SSHIFT) + SBASE; + return ss == null ? null : + (Segment) UNSAFE.getObjectVolatile(ss, u); + } + + /** + * Returns the segment for the given index, creating it and + * recording in segment table (via CAS) if not already present. + * + * @param k the index + * @return the segment + */ + @SuppressWarnings("unchecked") + private Segment ensureSegment(int k) { + final Segment[] ss = this.segments; + long u = (k << SSHIFT) + SBASE; // raw offset + Segment seg; + if ((seg = (Segment)UNSAFE.getObjectVolatile(ss, u)) == null) { + Segment proto = ss[0]; // use segment 0 as prototype + int cap = proto.table.length; + float lf = proto.loadFactor; + int threshold = (int)(cap * lf); + HashEntry[] tab = (HashEntry[])new HashEntry[cap]; + if ((seg = (Segment)UNSAFE.getObjectVolatile(ss, u)) + == null) { // recheck + Segment s = new Segment(lf, threshold, tab); + while ((seg = (Segment)UNSAFE.getObjectVolatile(ss, u)) + == null) { + if (UNSAFE.compareAndSwapObject(ss, u, null, seg = s)) + break; } } } + return seg; } + // Hash-based segment and entry accesses + /** + * Get the segment for the given hash + */ + @SuppressWarnings("unchecked") + private Segment segmentForHash(int h) { + long u = (((h >>> segmentShift) & segmentMask) << SSHIFT) + SBASE; + return (Segment) UNSAFE.getObjectVolatile(segments, u); + } + + /** + * Gets the table entry for the given segment and hash + */ + @SuppressWarnings("unchecked") + static final HashEntry entryForHash(Segment seg, int h) { + HashEntry[] tab; + return (seg == null || (tab = seg.table) == null) ? null : + (HashEntry) UNSAFE.getObjectVolatile + (tab, ((long)(((tab.length - 1) & h)) << TSHIFT) + TBASE); + } /* ---------------- Public operations -------------- */ @@ -609,14 +727,13 @@ * negative or the load factor or concurrencyLevel are * nonpositive. */ + @SuppressWarnings("unchecked") public ConcurrentHashMap(int initialCapacity, float loadFactor, int concurrencyLevel) { if (!(loadFactor > 0) || initialCapacity < 0 || concurrencyLevel <= 0) throw new IllegalArgumentException(); - if (concurrencyLevel > MAX_SEGMENTS) concurrencyLevel = MAX_SEGMENTS; - // Find power-of-two sizes best matching arguments int sshift = 0; int ssize = 1; @@ -624,21 +741,23 @@ ++sshift; ssize <<= 1; } - segmentShift = 32 - sshift; - segmentMask = ssize - 1; - this.segments = Segment.newArray(ssize); - + this.segmentShift = 32 - sshift; + this.segmentMask = ssize - 1; if (initialCapacity > MAXIMUM_CAPACITY) initialCapacity = MAXIMUM_CAPACITY; int c = initialCapacity / ssize; if (c * ssize < initialCapacity) ++c; - int cap = 1; + int cap = MIN_SEGMENT_TABLE_CAPACITY; while (cap < c) cap <<= 1; - - for (int i = 0; i < this.segments.length; ++i) - this.segments[i] = new Segment(cap, loadFactor); + // create segments and segments[0] + Segment s0 = + new Segment(loadFactor, (int)(cap * loadFactor), + (HashEntry[])new HashEntry[cap]); + Segment[] ss = (Segment[])new Segment[ssize]; + UNSAFE.putOrderedObject(ss, SBASE, s0); // ordered write of segments[0] + this.segments = ss; } /** @@ -701,33 +820,36 @@ * @return true if this map contains no key-value mappings */ public boolean isEmpty() { - final Segment[] segments = this.segments; /* - * We keep track of per-segment modCounts to avoid ABA - * problems in which an element in one segment was added and - * in another removed during traversal, in which case the - * table was never actually empty at any point. Note the - * similar use of modCounts in the size() and containsValue() - * methods, which are the only other methods also susceptible - * to ABA problems. + * Sum per-segment modCounts to avoid mis-reporting when + * elements are concurrently added and removed in one segment + * while checking another, in which case the table was never + * actually empty at any point. (The sum ensures accuracy up + * through at least 1<<31 per-segment modifications before + * recheck.) Methods size() and containsValue() use similar + * constructions for stability checks. */ - int[] mc = new int[segments.length]; - int mcsum = 0; - for (int i = 0; i < segments.length; ++i) { - if (segments[i].count != 0) - return false; - else - mcsum += mc[i] = segments[i].modCount; + long sum = 0L; + final Segment[] segments = this.segments; + for (int j = 0; j < segments.length; ++j) { + Segment seg = segmentAt(segments, j); + if (seg != null) { + if (seg.count != 0) + return false; + sum += seg.modCount; + } } - // If mcsum happens to be zero, then we know we got a snapshot - // before any modifications at all were made. This is - // probably common enough to bother tracking. - if (mcsum != 0) { - for (int i = 0; i < segments.length; ++i) { - if (segments[i].count != 0 || - mc[i] != segments[i].modCount) - return false; + if (sum != 0L) { // recheck unless no modifications + for (int j = 0; j < segments.length; ++j) { + Segment seg = segmentAt(segments, j); + if (seg != null) { + if (seg.count != 0) + return false; + sum -= seg.modCount; + } } + if (sum != 0L) + return false; } return true; } @@ -740,45 +862,43 @@ * @return the number of key-value mappings in this map */ public int size() { - final Segment[] segments = this.segments; - long sum = 0; - long check = 0; - int[] mc = new int[segments.length]; // Try a few times to get accurate count. On failure due to // continuous async changes in table, resort to locking. - for (int k = 0; k < RETRIES_BEFORE_LOCK; ++k) { - check = 0; - sum = 0; - int mcsum = 0; - for (int i = 0; i < segments.length; ++i) { - sum += segments[i].count; - mcsum += mc[i] = segments[i].modCount; - } - if (mcsum != 0) { - for (int i = 0; i < segments.length; ++i) { - check += segments[i].count; - if (mc[i] != segments[i].modCount) { - check = -1; // force retry - break; + final Segment[] segments = this.segments; + int size; + boolean overflow; // true if size overflows 32 bits + long sum; // sum of modCounts + long last = 0L; // previous sum + int retries = -1; // first iteration isn't retry + try { + for (;;) { + if (retries++ == RETRIES_BEFORE_LOCK) { + for (int j = 0; j < segments.length; ++j) + ensureSegment(j).lock(); // force creation + } + sum = 0L; + size = 0; + overflow = false; + for (int j = 0; j < segments.length; ++j) { + Segment seg = segmentAt(segments, j); + if (seg != null) { + sum += seg.modCount; + int c = seg.count; + if (c < 0 || (size += c) < 0) + overflow = true; } } + if (sum == last) + break; + last = sum; } - if (check == sum) - break; + } finally { + if (retries > RETRIES_BEFORE_LOCK) { + for (int j = 0; j < segments.length; ++j) + segmentAt(segments, j).unlock(); + } } - if (check != sum) { // Resort to locking all segments - sum = 0; - for (int i = 0; i < segments.length; ++i) - segments[i].lock(); - for (int i = 0; i < segments.length; ++i) - sum += segments[i].count; - for (int i = 0; i < segments.length; ++i) - segments[i].unlock(); - } - if (sum > Integer.MAX_VALUE) - return Integer.MAX_VALUE; - else - return (int)sum; + return overflow ? Integer.MAX_VALUE : size; } /** @@ -794,7 +914,13 @@ */ public V get(Object key) { int hash = hash(key.hashCode()); - return segmentFor(hash).get(key, hash); + for (HashEntry e = entryForHash(segmentForHash(hash), hash); + e != null; e = e.next) { + K k; + if ((k = e.key) == key || (e.hash == hash && key.equals(k))) + return e.value; + } + return null; } /** @@ -808,7 +934,13 @@ */ public boolean containsKey(Object key) { int hash = hash(key.hashCode()); - return segmentFor(hash).containsKey(key, hash); + for (HashEntry e = entryForHash(segmentForHash(hash), hash); + e != null; e = e.next) { + K k; + if ((k = e.key) == key || (e.hash == hash && key.equals(k))) + return true; + } + return false; } /** @@ -823,51 +955,47 @@ * @throws NullPointerException if the specified value is null */ public boolean containsValue(Object value) { + // Same idea as size() if (value == null) throw new NullPointerException(); - - // See explanation of modCount use above - final Segment[] segments = this.segments; - int[] mc = new int[segments.length]; - - // Try a few times without locking - for (int k = 0; k < RETRIES_BEFORE_LOCK; ++k) { - int sum = 0; - int mcsum = 0; - for (int i = 0; i < segments.length; ++i) { - int c = segments[i].count; - mcsum += mc[i] = segments[i].modCount; - if (segments[i].containsValue(value)) - return true; - } - boolean cleanSweep = true; - if (mcsum != 0) { - for (int i = 0; i < segments.length; ++i) { - int c = segments[i].count; - if (mc[i] != segments[i].modCount) { - cleanSweep = false; - break; + boolean found = false; + long last = 0; + int retries = -1; + try { + outer: for (;;) { + if (retries++ == RETRIES_BEFORE_LOCK) { + for (int j = 0; j < segments.length; ++j) + ensureSegment(j).lock(); // force creation + } + long hashSum = 0L; + int sum = 0; + for (int j = 0; j < segments.length; ++j) { + HashEntry[] tab; + Segment seg = segmentAt(segments, j); + if (seg != null && (tab = seg.table) != null) { + for (int i = 0 ; i < tab.length; i++) { + HashEntry e; + for (e = entryAt(tab, i); e != null; e = e.next) { + V v = e.value; + if (v != null && value.equals(v)) { + found = true; + break outer; + } + } + } + sum += seg.modCount; } } - } - if (cleanSweep) - return false; - } - // Resort to locking all segments - for (int i = 0; i < segments.length; ++i) - segments[i].lock(); - boolean found = false; - try { - for (int i = 0; i < segments.length; ++i) { - if (segments[i].containsValue(value)) { - found = true; + if (retries > 0 && sum == last) break; - } + last = sum; } } finally { - for (int i = 0; i < segments.length; ++i) - segments[i].unlock(); + if (retries > RETRIES_BEFORE_LOCK) { + for (int j = 0; j < segments.length; ++j) + segmentAt(segments, j).unlock(); + } } return found; } @@ -908,7 +1036,11 @@ if (value == null) throw new NullPointerException(); int hash = hash(key.hashCode()); - return segmentFor(hash).put(key, hash, value, false); + int j = (hash >>> segmentShift) & segmentMask; + Segment s = segmentAt(segments, j); + if (s == null) + s = ensureSegment(j); + return s.put(key, hash, value, false); } /** @@ -922,7 +1054,11 @@ if (value == null) throw new NullPointerException(); int hash = hash(key.hashCode()); - return segmentFor(hash).put(key, hash, value, true); + int j = (hash >>> segmentShift) & segmentMask; + Segment s = segmentAt(segments, j); + if (s == null) + s = ensureSegment(j); + return s.put(key, hash, value, true); } /** @@ -948,7 +1084,8 @@ */ public V remove(Object key) { int hash = hash(key.hashCode()); - return segmentFor(hash).remove(key, hash, null); + Segment s = segmentForHash(hash); + return s == null ? null : s.remove(key, hash, null); } /** @@ -958,9 +1095,9 @@ */ public boolean remove(Object key, Object value) { int hash = hash(key.hashCode()); - if (value == null) - return false; - return segmentFor(hash).remove(key, hash, value) != null; + Segment s; + return value != null && (s = segmentForHash(hash)) != null && + s.remove(key, hash, value) != null; } /** @@ -969,10 +1106,11 @@ * @throws NullPointerException if any of the arguments are null */ public boolean replace(K key, V oldValue, V newValue) { + int hash = hash(key.hashCode()); if (oldValue == null || newValue == null) throw new NullPointerException(); - int hash = hash(key.hashCode()); - return segmentFor(hash).replace(key, hash, oldValue, newValue); + Segment s = segmentForHash(hash); + return s != null && s.replace(key, hash, oldValue, newValue); } /** @@ -983,18 +1121,23 @@ * @throws NullPointerException if the specified key or value is null */ public V replace(K key, V value) { + int hash = hash(key.hashCode()); if (value == null) throw new NullPointerException(); - int hash = hash(key.hashCode()); - return segmentFor(hash).replace(key, hash, value); + Segment s = segmentForHash(hash); + return s == null ? null : s.replace(key, hash, value); } /** * Removes all of the mappings from this map. */ public void clear() { - for (int i = 0; i < segments.length; ++i) - segments[i].clear(); + final Segment[] segments = this.segments; + for (int j = 0; j < segments.length; ++j) { + Segment s = segmentAt(segments, j); + if (s != null) + s.clear(); + } } /** @@ -1095,42 +1238,41 @@ advance(); } - public boolean hasMoreElements() { return hasNext(); } - + /** + * Set nextEntry to first node of next non-empty table + * (in backwards order, to simplify checks). + */ final void advance() { - if (nextEntry != null && (nextEntry = nextEntry.next) != null) - return; - - while (nextTableIndex >= 0) { - if ( (nextEntry = currentTable[nextTableIndex--]) != null) - return; - } - - while (nextSegmentIndex >= 0) { - Segment seg = segments[nextSegmentIndex--]; - if (seg.count != 0) { - currentTable = seg.table; - for (int j = currentTable.length - 1; j >= 0; --j) { - if ( (nextEntry = currentTable[j]) != null) { - nextTableIndex = j - 1; - return; - } - } + for (;;) { + if (nextTableIndex >= 0) { + if ((nextEntry = entryAt(currentTable, + nextTableIndex--)) != null) + break; } + else if (nextSegmentIndex >= 0) { + Segment seg = segmentAt(segments, nextSegmentIndex--); + if (seg != null && (currentTable = seg.table) != null) + nextTableIndex = currentTable.length - 1; + } + else + break; } } - public boolean hasNext() { return nextEntry != null; } - - HashEntry nextEntry() { - if (nextEntry == null) + final HashEntry nextEntry() { + HashEntry e = nextEntry; + if (e == null) throw new NoSuchElementException(); - lastReturned = nextEntry; - advance(); - return lastReturned; + lastReturned = e; // cannot assign until after null check + if ((nextEntry = e.next) == null) + advance(); + return e; } - public void remove() { + public final boolean hasNext() { return nextEntry != null; } + public final boolean hasMoreElements() { return nextEntry != null; } + + public final void remove() { if (lastReturned == null) throw new IllegalStateException(); ConcurrentHashMap.this.remove(lastReturned.key); @@ -1142,16 +1284,16 @@ extends HashIterator implements Iterator, Enumeration { - public K next() { return super.nextEntry().key; } - public K nextElement() { return super.nextEntry().key; } + public final K next() { return super.nextEntry().key; } + public final K nextElement() { return super.nextEntry().key; } } final class ValueIterator extends HashIterator implements Iterator, Enumeration { - public V next() { return super.nextEntry().value; } - public V nextElement() { return super.nextEntry().value; } + public final V next() { return super.nextEntry().value; } + public final V nextElement() { return super.nextEntry().value; } } /** @@ -1271,15 +1413,20 @@ * The key-value mappings are emitted in no particular order. */ private void writeObject(java.io.ObjectOutputStream s) throws IOException { + // force all segments for serialization compatibility + for (int k = 0; k < segments.length; ++k) + ensureSegment(k); s.defaultWriteObject(); + final Segment[] segments = this.segments; for (int k = 0; k < segments.length; ++k) { - Segment seg = segments[k]; + Segment seg = segmentAt(segments, k); seg.lock(); try { HashEntry[] tab = seg.table; for (int i = 0; i < tab.length; ++i) { - for (HashEntry e = tab[i]; e != null; e = e.next) { + HashEntry e; + for (e = entryAt(tab, i); e != null; e = e.next) { s.writeObject(e.key); s.writeObject(e.value); } @@ -1297,13 +1444,20 @@ * stream (i.e., deserialize it). * @param s the stream */ + @SuppressWarnings("unchecked") private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); - // Initialize each segment to be minimally sized, and let grow. - for (int i = 0; i < segments.length; ++i) { - segments[i].setTable(new HashEntry[1]); + // Re-initialize segments to be minimally sized, and let grow. + int cap = MIN_SEGMENT_TABLE_CAPACITY; + final Segment[] segments = this.segments; + for (int k = 0; k < segments.length; ++k) { + Segment seg = segments[k]; + if (seg != null) { + seg.threshold = (int)(cap * seg.loadFactor); + seg.table = (HashEntry[]) new HashEntry[cap]; + } } // Read the keys and values, and put the mappings in the table @@ -1315,4 +1469,31 @@ put(key, value); } } + + // Unsafe mechanics + private static final sun.misc.Unsafe UNSAFE; + private static final long SBASE; + private static final int SSHIFT; + private static final long TBASE; + private static final int TSHIFT; + + static { + int ss, ts; + try { + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class tc = HashEntry[].class; + Class sc = Segment[].class; + TBASE = UNSAFE.arrayBaseOffset(tc); + SBASE = UNSAFE.arrayBaseOffset(sc); + ts = UNSAFE.arrayIndexScale(tc); + ss = UNSAFE.arrayIndexScale(sc); + } catch (Exception e) { + throw new Error(e); + } + if ((ss & (ss-1)) != 0 || (ts & (ts-1)) != 0) + throw new Error("data type scale not a power of two"); + SSHIFT = 31 - Integer.numberOfLeadingZeros(ss); + TSHIFT = 31 - Integer.numberOfLeadingZeros(ts); + } + } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea and Martin Buchholz with assistance from members of * JCP JSR-166 Expert Group and released to the public domain, as explained - * at http://creativecommons.org/licenses/publicdomain + * at http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea and Martin Buchholz with assistance from members of * JCP JSR-166 Expert Group and released to the public domain, as explained - * at http://creativecommons.org/licenses/publicdomain + * at http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ConcurrentMap.java --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentMap.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentMap.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ConcurrentNavigableMap.java --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentNavigableMap.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentNavigableMap.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/CopyOnWriteArraySet.java --- a/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArraySet.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArraySet.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/CountDownLatch.java --- a/jdk/src/share/classes/java/util/concurrent/CountDownLatch.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/CountDownLatch.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/CyclicBarrier.java --- a/jdk/src/share/classes/java/util/concurrent/CyclicBarrier.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/CyclicBarrier.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/DelayQueue.java --- a/jdk/src/share/classes/java/util/concurrent/DelayQueue.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/DelayQueue.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/Delayed.java --- a/jdk/src/share/classes/java/util/concurrent/Delayed.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/Delayed.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/Exchanger.java --- a/jdk/src/share/classes/java/util/concurrent/Exchanger.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/Exchanger.java Wed Jul 05 17:42:05 2017 +0200 @@ -31,7 +31,7 @@ * Written by Doug Lea, Bill Scherer, and Michael Scott with * assistance from members of JCP JSR-166 Expert Group and released to * the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ExecutionException.java --- a/jdk/src/share/classes/java/util/concurrent/ExecutionException.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ExecutionException.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/Executor.java --- a/jdk/src/share/classes/java/util/concurrent/Executor.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/Executor.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ExecutorCompletionService.java --- a/jdk/src/share/classes/java/util/concurrent/ExecutorCompletionService.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ExecutorCompletionService.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ExecutorService.java --- a/jdk/src/share/classes/java/util/concurrent/ExecutorService.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ExecutorService.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/Executors.java --- a/jdk/src/share/classes/java/util/concurrent/Executors.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/Executors.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java --- a/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; @@ -791,18 +791,19 @@ /** * Tries to enqueue worker w in wait queue and await change in - * worker's eventCount. If the pool is quiescent, possibly - * terminates worker upon exit. Otherwise, before blocking, - * rescans queues to avoid missed signals. Upon finding work, - * releases at least one worker (which may be the current - * worker). Rescans restart upon detected staleness or failure to - * release due to contention. Note the unusual conventions about - * Thread.interrupt here and elsewhere: Because interrupts are - * used solely to alert threads to check termination, which is - * checked here anyway, we clear status (using Thread.interrupted) - * before any call to park, so that park does not immediately - * return due to status being set via some other unrelated call to - * interrupt in user code. + * worker's eventCount. If the pool is quiescent and there is + * more than one worker, possibly terminates worker upon exit. + * Otherwise, before blocking, rescans queues to avoid missed + * signals. Upon finding work, releases at least one worker + * (which may be the current worker). Rescans restart upon + * detected staleness or failure to release due to + * contention. Note the unusual conventions about Thread.interrupt + * here and elsewhere: Because interrupts are used solely to alert + * threads to check termination, which is checked here anyway, we + * clear status (using Thread.interrupted) before any call to + * park, so that park does not immediately return due to status + * being set via some other unrelated call to interrupt in user + * code. * * @param w the calling worker * @param c the ctl value on entry @@ -823,7 +824,8 @@ else if (w.eventCount != v) return true; // update next time } - if (parallelism + (int)(nc >> AC_SHIFT) == 0 && + if ((!shutdown || !tryTerminate(false)) && + (int)c != 0 && parallelism + (int)(nc >> AC_SHIFT) == 0 && blockedCount == 0 && quiescerCount == 0) idleAwaitWork(w, nc, c, v); // quiescent for (boolean rescanned = false;;) { @@ -893,7 +895,8 @@ w.parked = false; if (w.eventCount != v) break; - else if (System.nanoTime() - startTime < SHRINK_RATE) + else if (System.nanoTime() - startTime < + SHRINK_RATE - (SHRINK_RATE / 10)) // timing slop Thread.interrupted(); // spurious wakeup else if (UNSAFE.compareAndSwapLong(this, ctlOffset, currentCtl, prevCtl)) { @@ -1022,8 +1025,8 @@ do {} while (!UNSAFE.compareAndSwapLong(this, ctlOffset, // no mask c = ctl, c + AC_UNIT)); int b; - do {} while(!UNSAFE.compareAndSwapInt(this, blockedCountOffset, - b = blockedCount, b - 1)); + do {} while (!UNSAFE.compareAndSwapInt(this, blockedCountOffset, + b = blockedCount, b - 1)); } /** @@ -1175,7 +1178,7 @@ ws[k] = w; nextWorkerIndex = k + 1; int m = g & SMASK; - g = k >= m? ((m << 1) + 1) & SMASK : g + (SG_UNIT<<1); + g = (k > m) ? ((m << 1) + 1) & SMASK : g + (SG_UNIT<<1); } } finally { scanGuard = g; @@ -1358,8 +1361,8 @@ */ final void addQuiescerCount(int delta) { int c; - do {} while(!UNSAFE.compareAndSwapInt(this, quiescerCountOffset, - c = quiescerCount, c + delta)); + do {} while (!UNSAFE.compareAndSwapInt(this, quiescerCountOffset, + c = quiescerCount, c + delta)); } /** @@ -1712,7 +1715,7 @@ */ public int getRunningThreadCount() { int r = parallelism + (int)(ctl >> AC_SHIFT); - return r <= 0? 0 : r; // suppress momentarily negative values + return (r <= 0) ? 0 : r; // suppress momentarily negative values } /** @@ -1724,7 +1727,7 @@ */ public int getActiveThreadCount() { int r = parallelism + (int)(ctl >> AC_SHIFT) + blockedCount; - return r <= 0? 0 : r; // suppress momentarily negative values + return (r <= 0) ? 0 : r; // suppress momentarily negative values } /** @@ -1879,9 +1882,9 @@ int ac = rc + blockedCount; String level; if ((c & STOP_BIT) != 0) - level = (tc == 0)? "Terminated" : "Terminating"; + level = (tc == 0) ? "Terminated" : "Terminating"; else - level = shutdown? "Shutting down" : "Running"; + level = shutdown ? "Shutting down" : "Running"; return super.toString() + "[" + level + ", parallelism = " + pc + diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ForkJoinTask.java --- a/jdk/src/share/classes/java/util/concurrent/ForkJoinTask.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinTask.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java --- a/jdk/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; @@ -361,7 +361,7 @@ protected void onStart() { queue = new ForkJoinTask[INITIAL_QUEUE_CAPACITY]; int r = pool.workerSeedGenerator.nextInt(); - seed = (r == 0)? 1 : r; // must be nonzero + seed = (r == 0) ? 1 : r; // must be nonzero } /** @@ -724,7 +724,7 @@ Thread.yield(); // for politeness } else - retries = helpJoinTask(joinMe)? MAX_HELP : retries - 1; + retries = helpJoinTask(joinMe) ? MAX_HELP : retries - 1; } else { retries = MAX_HELP; // restart if not done @@ -955,7 +955,7 @@ p.addActiveCount(1); } if ((t = (v != this) ? v.deqTask() : - locallyFifo? locallyDeqTask() : popTask()) != null) { + locallyFifo ? locallyDeqTask() : popTask()) != null) { currentSteal = t; t.doExec(); currentSteal = ps; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/Future.java --- a/jdk/src/share/classes/java/util/concurrent/Future.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/Future.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/FutureTask.java --- a/jdk/src/share/classes/java/util/concurrent/FutureTask.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/FutureTask.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/LinkedBlockingDeque.java --- a/jdk/src/share/classes/java/util/concurrent/LinkedBlockingDeque.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/LinkedBlockingDeque.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/LinkedBlockingQueue.java --- a/jdk/src/share/classes/java/util/concurrent/LinkedBlockingQueue.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/LinkedBlockingQueue.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/LinkedTransferQueue.java --- a/jdk/src/share/classes/java/util/concurrent/LinkedTransferQueue.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/LinkedTransferQueue.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/Phaser.java --- a/jdk/src/share/classes/java/util/concurrent/Phaser.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/Phaser.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java --- a/jdk/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/RecursiveAction.java --- a/jdk/src/share/classes/java/util/concurrent/RecursiveAction.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/RecursiveAction.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/RecursiveTask.java --- a/jdk/src/share/classes/java/util/concurrent/RecursiveTask.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/RecursiveTask.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/RejectedExecutionException.java --- a/jdk/src/share/classes/java/util/concurrent/RejectedExecutionException.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/RejectedExecutionException.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/RejectedExecutionHandler.java --- a/jdk/src/share/classes/java/util/concurrent/RejectedExecutionHandler.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/RejectedExecutionHandler.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/RunnableFuture.java --- a/jdk/src/share/classes/java/util/concurrent/RunnableFuture.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/RunnableFuture.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/RunnableScheduledFuture.java --- a/jdk/src/share/classes/java/util/concurrent/RunnableScheduledFuture.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/RunnableScheduledFuture.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ScheduledExecutorService.java --- a/jdk/src/share/classes/java/util/concurrent/ScheduledExecutorService.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ScheduledExecutorService.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ScheduledFuture.java --- a/jdk/src/share/classes/java/util/concurrent/ScheduledFuture.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ScheduledFuture.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java --- a/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/Semaphore.java --- a/jdk/src/share/classes/java/util/concurrent/Semaphore.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/Semaphore.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/SynchronousQueue.java --- a/jdk/src/share/classes/java/util/concurrent/SynchronousQueue.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/SynchronousQueue.java Wed Jul 05 17:42:05 2017 +0200 @@ -31,7 +31,7 @@ * Written by Doug Lea, Bill Scherer, and Michael Scott with * assistance from members of JCP JSR-166 Expert Group and released to * the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ThreadFactory.java --- a/jdk/src/share/classes/java/util/concurrent/ThreadFactory.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ThreadFactory.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java --- a/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java --- a/jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/TimeUnit.java --- a/jdk/src/share/classes/java/util/concurrent/TimeUnit.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/TimeUnit.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/TimeoutException.java --- a/jdk/src/share/classes/java/util/concurrent/TimeoutException.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/TimeoutException.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/TransferQueue.java --- a/jdk/src/share/classes/java/util/concurrent/TransferQueue.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/TransferQueue.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.atomic; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.atomic; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.atomic; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.atomic; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/atomic/AtomicLong.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLong.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLong.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.atomic; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.atomic; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.atomic; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/atomic/AtomicMarkableReference.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicMarkableReference.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicMarkableReference.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.atomic; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/atomic/AtomicReference.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReference.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReference.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.atomic; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.atomic; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.atomic; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.atomic; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/atomic/package-info.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/package-info.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/package-info.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /** @@ -80,9 +80,8 @@ * * *

          The memory effects for accesses and updates of atomics generally - * follow the rules for volatiles, as stated in - * The Java Language - * Specification, Third Edition (17.4 Memory Model): + * follow the rules for volatiles, as stated in section 17.4 of + * The Java™ Language Specification. * *

            * diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/locks/AbstractOwnableSynchronizer.java --- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractOwnableSynchronizer.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractOwnableSynchronizer.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.locks; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java --- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.locks; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java --- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.locks; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/locks/Condition.java --- a/jdk/src/share/classes/java/util/concurrent/locks/Condition.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/locks/Condition.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.locks; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/locks/Lock.java --- a/jdk/src/share/classes/java/util/concurrent/locks/Lock.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/locks/Lock.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.locks; @@ -120,8 +120,8 @@ * *

            All {@code Lock} implementations must enforce the same * memory synchronization semantics as provided by the built-in monitor - * lock, as described in - * The Java Language Specification, Third Edition (17.4 Memory Model): + * lock, as described in section 17.4 of + * The Java™ Language Specification: *

              *
            • A successful {@code lock} operation has the same memory * synchronization effects as a successful Lock action. diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java --- a/jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.locks; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/locks/ReadWriteLock.java --- a/jdk/src/share/classes/java/util/concurrent/locks/ReadWriteLock.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/locks/ReadWriteLock.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.locks; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/locks/ReentrantLock.java --- a/jdk/src/share/classes/java/util/concurrent/locks/ReentrantLock.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/locks/ReentrantLock.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.locks; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java --- a/jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent.locks; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/locks/package-info.java --- a/jdk/src/share/classes/java/util/concurrent/locks/package-info.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/locks/package-info.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /** diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/concurrent/package-info.java --- a/jdk/src/share/classes/java/util/concurrent/package-info.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/package-info.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /** @@ -218,8 +218,9 @@ * *

              Memory Consistency Properties

              * - * - * Chapter 17 of the Java Language Specification defines the + * Chapter 17 of + * The Java™ Language Specification + * defines the * happens-before relation on memory operations such as reads and * writes of shared variables. The results of a write by one thread are * guaranteed to be visible to a read by another thread only if the write diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/jar/JarFile.java --- a/jdk/src/share/classes/java/util/jar/JarFile.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/jar/JarFile.java Wed Jul 05 17:42:05 2017 +0200 @@ -37,6 +37,7 @@ import sun.security.action.GetPropertyAction; import sun.security.util.ManifestEntryVerifier; import sun.misc.SharedSecrets; +import sun.security.util.SignatureFileVerifier; /** * The JarFile class is used to read the contents of a jar file @@ -178,7 +179,7 @@ byte[] b = getBytes(manEntry); man = new Manifest(new ByteArrayInputStream(b)); if (!jvInitialized) { - jv = new JarVerifier(b); + jv = new JarVerifier(b, man); } } else { man = new Manifest(super.getInputStream(manEntry)); @@ -297,10 +298,7 @@ if (names != null) { for (int i = 0; i < names.length; i++) { String name = names[i].toUpperCase(Locale.ENGLISH); - if (name.endsWith(".DSA") || - name.endsWith(".RSA") || - name.endsWith(".EC") || - name.endsWith(".SF")) { + if (SignatureFileVerifier.isBlockOrSF(name)) { // Assume since we found a signature-related file // that the jar is signed and that we therefore // need a JarVerifier and Manifest @@ -329,17 +327,17 @@ if (names != null) { for (int i = 0; i < names.length; i++) { JarEntry e = getJarEntry(names[i]); - if (!e.isDirectory()) { + if (!e.isDirectory() && + SignatureFileVerifier.isBlock(names[i])) { if (mev == null) { mev = new ManifestEntryVerifier (getManifestFromReference()); } - byte[] b = getBytes(e); - if (b != null && b.length > 0) { - jv.beginEntry(e, mev); - jv.update(b.length, b, 0, b.length, mev); - jv.update(-1, null, 0, 0, mev); - } + String key = names[i].substring( + 0, names[i].lastIndexOf(".")); + jv.verifyBlock(names[i], + getBytes(e), + super.getInputStream(getJarEntry(key + ".SF"))); } } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/jar/JarInputStream.java --- a/jdk/src/share/classes/java/util/jar/JarInputStream.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/jar/JarInputStream.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,7 +95,7 @@ man.read(new ByteArrayInputStream(bytes)); closeEntry(); if (doVerify) { - jv = new JarVerifier(bytes); + jv = new JarVerifier(bytes, man); mev = new ManifestEntryVerifier(man); } return (JarEntry)super.getNextEntry(); diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/jar/JarVerifier.java --- a/jdk/src/share/classes/java/util/jar/JarVerifier.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/jar/JarVerifier.java Wed Jul 05 17:42:05 2017 +0200 @@ -48,35 +48,18 @@ /* a table mapping names to code signers, for jar entries that have had their actual hashes verified */ - private Hashtable verifiedSigners; + private Map verifiedSigners; /* a table mapping names to code signers, for jar entries that have passed the .SF/.DSA/.EC -> MANIFEST check */ - private Hashtable sigFileSigners; - - /* a hash table to hold .SF bytes */ - private Hashtable sigFileData; - - /** "queue" of pending PKCS7 blocks that we couldn't parse - * until we parsed the .SF file */ - private ArrayList pendingBlocks; + private Map sigFileSigners; /* cache of CodeSigner objects */ private ArrayList signerCache; - /* Are we parsing a block? */ - private boolean parsingBlockOrSF = false; - - /* Are we done parsing META-INF entries? */ - private boolean parsingMeta = true; - /* Are there are files to verify? */ private boolean anyToVerify = true; - /* The output stream to use when keeping track of files we are interested - in */ - private ByteArrayOutputStream baos; - /** The ManifestDigester object */ private volatile ManifestDigester manDig; @@ -92,20 +75,20 @@ /** collect -DIGEST-MANIFEST values for blacklist */ private List manifestDigests; - public JarVerifier(byte rawBytes[]) { + /** The manifest object */ + Manifest man = null; + + public JarVerifier(byte rawBytes[], Manifest man) { + this.man = man; manifestRawBytes = rawBytes; - sigFileSigners = new Hashtable(); - verifiedSigners = new Hashtable(); - sigFileData = new Hashtable(11); - pendingBlocks = new ArrayList(); - baos = new ByteArrayOutputStream(); + sigFileSigners = new HashMap(); + verifiedSigners = new HashMap(); manifestDigests = new ArrayList(); } /** - * This method scans to see which entry we're parsing and - * keeps various state information depending on what type of - * file is being parsed. + * This method scans to see which entry we're parsing and keeps + * various state information depending on the file being parsed. */ public void beginEntry(JarEntry je, ManifestEntryVerifier mev) throws IOException @@ -129,30 +112,6 @@ * b. digest mismatch between the actual jar entry and the manifest */ - if (parsingMeta) { - String uname = name.toUpperCase(Locale.ENGLISH); - if ((uname.startsWith("META-INF/") || - uname.startsWith("/META-INF/"))) { - - if (je.isDirectory()) { - mev.setEntry(null, je); - return; - } - - if (SignatureFileVerifier.isBlockOrSF(uname)) { - /* We parse only DSA, RSA or EC PKCS7 blocks. */ - parsingBlockOrSF = true; - baos.reset(); - mev.setEntry(null, je); - } - return; - } - } - - if (parsingMeta) { - doneWithMeta(); - } - if (je.isDirectory()) { mev.setEntry(null, je); return; @@ -188,11 +147,7 @@ throws IOException { if (b != -1) { - if (parsingBlockOrSF) { - baos.write(b); - } else { - mev.update((byte)b); - } + mev.update((byte)b); } else { processEntry(mev); } @@ -207,11 +162,7 @@ throws IOException { if (n != -1) { - if (parsingBlockOrSF) { - baos.write(b, off, n); - } else { - mev.update(b, off, n); - } + mev.update(b, off, n); } else { processEntry(mev); } @@ -223,101 +174,10 @@ private void processEntry(ManifestEntryVerifier mev) throws IOException { - if (!parsingBlockOrSF) { - JarEntry je = mev.getEntry(); - if ((je != null) && (je.signers == null)) { - je.signers = mev.verify(verifiedSigners, sigFileSigners); - je.certs = mapSignersToCertArray(je.signers); - } - } else { - - try { - parsingBlockOrSF = false; - - if (debug != null) { - debug.println("processEntry: processing block"); - } - - String uname = mev.getEntry().getName() - .toUpperCase(Locale.ENGLISH); - - if (uname.endsWith(".SF")) { - String key = uname.substring(0, uname.length()-3); - byte bytes[] = baos.toByteArray(); - // add to sigFileData in case future blocks need it - sigFileData.put(key, bytes); - // check pending blocks, we can now process - // anyone waiting for this .SF file - Iterator it = pendingBlocks.iterator(); - while (it.hasNext()) { - SignatureFileVerifier sfv = - (SignatureFileVerifier) it.next(); - if (sfv.needSignatureFile(key)) { - if (debug != null) { - debug.println( - "processEntry: processing pending block"); - } - - sfv.setSignatureFile(bytes); - sfv.process(sigFileSigners, manifestDigests); - } - } - return; - } - - // now we are parsing a signature block file - - String key = uname.substring(0, uname.lastIndexOf(".")); - - if (signerCache == null) - signerCache = new ArrayList(); - - if (manDig == null) { - synchronized(manifestRawBytes) { - if (manDig == null) { - manDig = new ManifestDigester(manifestRawBytes); - manifestRawBytes = null; - } - } - } - - SignatureFileVerifier sfv = - new SignatureFileVerifier(signerCache, - manDig, uname, baos.toByteArray()); - - if (sfv.needSignatureFileBytes()) { - // see if we have already parsed an external .SF file - byte[] bytes = (byte[]) sigFileData.get(key); - - if (bytes == null) { - // put this block on queue for later processing - // since we don't have the .SF bytes yet - // (uname, block); - if (debug != null) { - debug.println("adding pending block"); - } - pendingBlocks.add(sfv); - return; - } else { - sfv.setSignatureFile(bytes); - } - } - sfv.process(sigFileSigners, manifestDigests); - - } catch (IOException ioe) { - // e.g. sun.security.pkcs.ParsingException - if (debug != null) debug.println("processEntry caught: "+ioe); - // ignore and treat as unsigned - } catch (SignatureException se) { - if (debug != null) debug.println("processEntry caught: "+se); - // ignore and treat as unsigned - } catch (NoSuchAlgorithmException nsae) { - if (debug != null) debug.println("processEntry caught: "+nsae); - // ignore and treat as unsigned - } catch (CertificateException ce) { - if (debug != null) debug.println("processEntry caught: "+ce); - // ignore and treat as unsigned - } + JarEntry je = mev.getEntry(); + if ((je != null) && (je.signers == null)) { + je.signers = mev.verify(verifiedSigners, sigFileSigners); + je.certs = mapSignersToCertArray(je.signers); } } @@ -354,15 +214,15 @@ * Force a read of the entry data to generate the * verification hash. */ - try { - InputStream s = jar.getInputStream(entry); + try (InputStream s = jar.getInputStream(entry)) { byte[] buffer = new byte[1024]; int n = buffer.length; while (n != -1) { n = s.read(buffer, 0, buffer.length); } - s.close(); } catch (IOException e) { + // Ignore. When an exception is thrown, code signer + // will not be assigned. } } return getCodeSigners(name); @@ -408,11 +268,7 @@ */ void doneWithMeta() { - parsingMeta = false; anyToVerify = !sigFileSigners.isEmpty(); - baos = null; - sigFileData = null; - pendingBlocks = null; signerCache = null; manDig = null; // MANIFEST.MF is always treated as signed and verified, @@ -423,6 +279,41 @@ } } + /** + * Verifies a PKCS7 SignedData block + * @param key name of block + * @param block the pkcs7 file + * @param ins the clear data + */ + void verifyBlock(String key, byte[] block, InputStream ins) { + try { + if (signerCache == null) + signerCache = new ArrayList(); + + if (manDig == null) { + synchronized(manifestRawBytes) { + if (manDig == null) { + manDig = new ManifestDigester(manifestRawBytes); + manifestRawBytes = null; + } + } + } + SignatureFileVerifier sfv = + new SignatureFileVerifier(signerCache, man, + manDig, key, block); + + if (sfv.needSignatureFile()) { + // see if we have already parsed an external .SF file + sfv.setSignatureFile(ins); + } + sfv.process(sigFileSigners, manifestDigests); + } catch (Exception e) { + if (debug != null) { + e.printStackTrace(); + } + } + } + static class VerifierStream extends java.io.InputStream { private InputStream is; @@ -553,10 +444,7 @@ * but this handles a CodeSource of any type, just in case. */ CodeSource[] sources = mapSignersToCodeSources(cs.getLocation(), getJarCodeSigners(), true); - List sourceList = new ArrayList(); - for (int i = 0; i < sources.length; i++) { - sourceList.add(sources[i]); - } + List sourceList = Arrays.asList(sources); int j = sourceList.indexOf(cs); if (j != -1) { CodeSigner[] match; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/jar/Pack200.java --- a/jdk/src/share/classes/java/util/jar/Pack200.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/jar/Pack200.java Wed Jul 05 17:42:05 2017 +0200 @@ -181,8 +181,8 @@ * The class files will not contain identical bytes, since the unpacker * is free to change minor class file features such as constant pool order. * However, the class files will be semantically identical, - * as specified in the Java Virtual Machine Specification - * http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html. + * as specified in + * The Java™ Virtual Machine Specification. *

              * By default, the packer does not change the order of JAR elements. * Also, the modification time and deflation hint of each diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/logging/FileHandler.java --- a/jdk/src/share/classes/java/util/logging/FileHandler.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/logging/FileHandler.java Wed Jul 05 17:42:05 2017 +0200 @@ -409,22 +409,25 @@ // Try the next file. continue; } + boolean available; try { - FileLock fl = fc.tryLock(); - if (fl == null) { - // We failed to get the lock. Try next file. - continue; - } + available = fc.tryLock() != null; // We got the lock OK. } catch (IOException ix) { // We got an IOException while trying to get the lock. // This normally indicates that locking is not supported // on the target directory. We have to proceed without // getting a lock. Drop through. + available = true; } - // We got the lock. Remember it. - locks.put(lockFileName, lockFileName); - break; + if (available) { + // We got the lock. Remember it. + locks.put(lockFileName, lockFileName); + break; + } + + // We failed to get the lock. Try next file. + fc.close(); } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/regex/Pattern.java --- a/jdk/src/share/classes/java/util/regex/Pattern.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/regex/Pattern.java Wed Jul 05 17:42:05 2017 +0200 @@ -369,13 +369,10 @@ * part of an unescaped construct. * *

              Backslashes within string literals in Java source code are interpreted - * as required by the Java Language - * Specification as either Unicode - * escapes or other character - * escapes. It is therefore necessary to double backslashes in string + * as required by + * The Java™ Language Specification + * as either Unicode escapes (section 3.3) or other character escapes (section 3.10.6) + * It is therefore necessary to double backslashes in string * literals that represent regular expressions to protect them from * interpretation by the Java bytecode compiler. The string literal * "\b", for example, matches a single backspace character when @@ -525,9 +522,9 @@ * Canonical Equivalents. * *

              Unicode escape sequences such as \u2014 in Java source code - * are processed as described in \u00A73.3 - * of the Java Language Specification. Such escape sequences are also + * are processed as described in section 3.3 of + * The Java™ Language Specification. + * Such escape sequences are also * implemented directly by the regular-expression parser so that Unicode * escapes can be used in expressions that are read from files or from the * keyboard. Thus the strings "\u2014" and "\\u2014", diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/java/util/zip/ZipFile.java --- a/jdk/src/share/classes/java/util/zip/ZipFile.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/java/util/zip/ZipFile.java Wed Jul 05 17:42:05 2017 +0200 @@ -31,11 +31,13 @@ import java.io.EOFException; import java.io.File; import java.nio.charset.Charset; -import java.util.Vector; +import java.util.ArrayDeque; +import java.util.Deque; import java.util.Enumeration; -import java.util.Set; -import java.util.HashSet; +import java.util.HashMap; +import java.util.Map; import java.util.NoSuchElementException; +import java.util.WeakHashMap; import java.security.AccessController; import sun.security.action.GetPropertyAction; import static java.util.zip.ZipConstants64.*; @@ -54,7 +56,7 @@ private long jzfile; // address of jzfile data private String name; // zip file name private int total; // total number of entries - private boolean closeRequested; + private volatile boolean closeRequested = false; private static final int STORED = ZipEntry.STORED; private static final int DEFLATED = ZipEntry.DEFLATED; @@ -314,8 +316,9 @@ // freeEntry releases the C jzentry struct. private static native void freeEntry(long jzfile, long jzentry); - // the outstanding inputstreams that need to be closed. - private Set streams = new HashSet<>(); + // the outstanding inputstreams that need to be closed, + // mapped to the inflater objects they use. + private final Map streams = new WeakHashMap<>(); /** * Returns an input stream for reading the contents of the specified @@ -351,51 +354,21 @@ switch (getEntryMethod(jzentry)) { case STORED: - streams.add(in); + synchronized (streams) { + streams.put(in, null); + } return in; case DEFLATED: - final ZipFileInputStream zfin = in; // MORE: Compute good size for inflater stream: long size = getEntrySize(jzentry) + 2; // Inflater likes a bit of slack if (size > 65536) size = 8192; if (size <= 0) size = 4096; - InputStream is = new InflaterInputStream(zfin, getInflater(), (int)size) { - private boolean isClosed = false; - - public void close() throws IOException { - if (!isClosed) { - super.close(); - releaseInflater(inf); - isClosed = true; - } - } - // Override fill() method to provide an extra "dummy" byte - // at the end of the input stream. This is required when - // using the "nowrap" Inflater option. - protected void fill() throws IOException { - if (eof) { - throw new EOFException( - "Unexpected end of ZLIB input stream"); - } - len = this.in.read(buf, 0, buf.length); - if (len == -1) { - buf[0] = 0; - len = 1; - eof = true; - } - inf.setInput(buf, 0, len); - } - private boolean eof; - - public int available() throws IOException { - if (isClosed) - return 0; - long avail = zfin.size() - inf.getBytesWritten(); - return avail > (long) Integer.MAX_VALUE ? - Integer.MAX_VALUE : (int) avail; - } - }; - streams.add(is); + Inflater inf = getInflater(); + InputStream is = + new ZipFileInflaterInputStream(in, inf, (int)size); + synchronized (streams) { + streams.put(is, inf); + } return is; default: throw new ZipException("invalid compression method"); @@ -403,36 +376,91 @@ } } + private class ZipFileInflaterInputStream extends InflaterInputStream { + private volatile boolean closeRequested = false; + private boolean eof = false; + private final ZipFileInputStream zfin; + + ZipFileInflaterInputStream(ZipFileInputStream zfin, Inflater inf, + int size) { + super(zfin, inf, size); + this.zfin = zfin; + } + + public void close() throws IOException { + if (closeRequested) + return; + closeRequested = true; + + super.close(); + Inflater inf; + synchronized (streams) { + inf = streams.remove(this); + } + if (inf != null) { + releaseInflater(inf); + } + } + + // Override fill() method to provide an extra "dummy" byte + // at the end of the input stream. This is required when + // using the "nowrap" Inflater option. + protected void fill() throws IOException { + if (eof) { + throw new EOFException("Unexpected end of ZLIB input stream"); + } + len = in.read(buf, 0, buf.length); + if (len == -1) { + buf[0] = 0; + len = 1; + eof = true; + } + inf.setInput(buf, 0, len); + } + + public int available() throws IOException { + if (closeRequested) + return 0; + long avail = zfin.size() - inf.getBytesWritten(); + return (avail > (long) Integer.MAX_VALUE ? + Integer.MAX_VALUE : (int) avail); + } + + protected void finalize() throws Throwable { + close(); + } + } + /* * Gets an inflater from the list of available inflaters or allocates * a new one. */ private Inflater getInflater() { - synchronized (inflaters) { - int size = inflaters.size(); - if (size > 0) { - Inflater inf = (Inflater)inflaters.remove(size - 1); - return inf; - } else { - return new Inflater(true); + Inflater inf; + synchronized (inflaterCache) { + while (null != (inf = inflaterCache.poll())) { + if (false == inf.ended()) { + return inf; + } } } + return new Inflater(true); } /* * Releases the specified inflater to the list of available inflaters. */ private void releaseInflater(Inflater inf) { - synchronized (inflaters) { - if (inf.ended()) - return; + if (false == inf.ended()) { inf.reset(); - inflaters.add(inf); + synchronized (inflaterCache) { + inflaterCache.add(inf); + } } } // List of available Inflater objects for decompression - private Vector inflaters = new Vector(); + private Deque inflaterCache = new ArrayDeque<>(); /** * Returns the path name of the ZIP file. @@ -540,14 +568,32 @@ * @throws IOException if an I/O error has occurred */ public void close() throws IOException { - synchronized (this) { - closeRequested = true; + if (closeRequested) + return; + closeRequested = true; - if (streams.size() !=0) { - Set copy = streams; - streams = new HashSet<>(); - for (InputStream is: copy) - is.close(); + synchronized (this) { + // Close streams, release their inflaters + synchronized (streams) { + if (false == streams.isEmpty()) { + Map copy = new HashMap<>(streams); + streams.clear(); + for (Map.Entry e : copy.entrySet()) { + e.getKey().close(); + Inflater inf = e.getValue(); + if (inf != null) { + inf.end(); + } + } + } + } + + // Release cached inflaters + Inflater inf; + synchronized (inflaterCache) { + while (null != (inf = inflaterCache.poll())) { + inf.end(); + } } if (jzfile != 0) { @@ -556,23 +602,13 @@ jzfile = 0; close(zf); - - // Release inflaters - synchronized (inflaters) { - int size = inflaters.size(); - for (int i = 0; i < size; i++) { - Inflater inf = (Inflater)inflaters.get(i); - inf.end(); - } - } } } } - /** - * Ensures that the close method of this ZIP file is - * called when there are no more references to it. + * Ensures that the system resources held by this ZipFile object are + * released when there are no more references to it. * *

              * Since the time when GC would invoke this method is undetermined, @@ -611,6 +647,7 @@ * (possibly compressed) zip file entry. */ private class ZipFileInputStream extends InputStream { + private volatile boolean closeRequested = false; protected long jzentry; // address of jzentry data private long pos; // current position within entry data protected long rem; // number of remaining bytes within entry @@ -678,15 +715,25 @@ } public void close() { + if (closeRequested) + return; + closeRequested = true; + rem = 0; synchronized (ZipFile.this) { if (jzentry != 0 && ZipFile.this.jzfile != 0) { freeEntry(ZipFile.this.jzfile, jzentry); jzentry = 0; } + } + synchronized (streams) { streams.remove(this); } } + + protected void finalize() { + close(); + } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/crypto/AEADBadTagException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/classes/javax/crypto/AEADBadTagException.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package javax.crypto; + +/** + * This exception is thrown when a {@link Cipher} operating in + * an AEAD mode (such as GCM/CCM) is unable to verify the supplied + * authentication tag. + * + * @since 1.7 + */ +public class AEADBadTagException extends BadPaddingException { + + private static final long serialVersionUID = -488059093241685509L; + + /** + * Constructs a AEADBadTagException with no detail message. + */ + public AEADBadTagException() { + super(); + } + + /** + * Constructs a AEADBadTagException with the specified + * detail message. + * + * @param msg the detail message. + */ + public AEADBadTagException(String msg) { + super(msg); + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/crypto/Cipher.java --- a/jdk/src/share/classes/javax/crypto/Cipher.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/crypto/Cipher.java Wed Jul 05 17:42:05 2017 +0200 @@ -88,8 +88,35 @@ * example, the SunJCE provider uses a default of 64 bits for DES.) * Thus, block ciphers can be turned into byte-oriented stream ciphers by * using an 8 bit mode such as CFB8 or OFB8. + *

              + * Modes such as Authenticated Encryption with Associated Data (AEAD) + * provide authenticity assurances for both confidential data and + * Additional Associated Data (AAD) that is not encrypted. (Please see + * RFC 5116 for more + * information on AEAD and AEAD algorithms such as GCM/CCM.) Both + * confidential and AAD data can be used when calculating the + * authentication tag (similar to a {@link Mac}). This tag is appended + * to the ciphertext during encryption, and is verified on decryption. + *

              + * AEAD modes such as GCM/CCM perform all AAD authenticity calculations + * before starting the ciphertext authenticity calculations. To avoid + * implementations having to internally buffer ciphertext, all AAD data + * must be supplied to GCM/CCM implementations (via the {@code + * updateAAD} methods) before the ciphertext is processed (via + * the {@code update} and {@code doFinal} methods). * - *

              Every implementation of the Java platform is required to support + *

              + *     GCMParameterSpec s = new GCMParameterSpec(...);
              + *     cipher.init(..., s);
              + *
              + *     // If the GCMParameterSpec is needed again
              + *     cipher.getParameters().getParameterSpec(GCMParameterSpec.class));
              + *
              + *     cipher.updateAAD(...);  // AAD
              + *     cipher.update(...);     // Multi-part update
              + *     cipher.doFinal(...);    // conclusion of operation
              + * 
              + * Every implementation of the Java platform is required to support * the following standard Cipher transformations with the keysizes * in parentheses: *
                @@ -894,7 +921,7 @@ * inputLen (in bytes). * *

                This call takes into account any unprocessed (buffered) data from a - * previous update call, and padding. + * previous update call, padding, and AEAD tagging. * *

                The actual output length of the next update or * doFinal call may be smaller than the length returned by @@ -1090,6 +1117,11 @@ * {@link #getParameters() getParameters} or * {@link #getIV() getIV} (if the parameter is an IV). * + *

                If this cipher requires algorithm parameters that cannot be + * derived from the input parameters, and there are no reasonable + * provider-specific default values, initialization will + * necessarily fail. + * *

                If this cipher (including its underlying feedback or padding scheme) * requires any random bytes (e.g., for parameter generation), it will get * them using the {@link SecureRandom SecureRandom} @@ -1110,8 +1142,8 @@ * @param key the key * * @exception InvalidKeyException if the given key is inappropriate for - * initializing this cipher, or if this cipher is being initialized for - * decryption and requires algorithm parameters that cannot be + * initializing this cipher, or requires + * algorithm parameters that cannot be * determined from the given key, or if the given key has a keysize that * exceeds the maximum allowable keysize (as determined from the * configured jurisdiction policy files). @@ -1138,6 +1170,11 @@ * {@link #getParameters() getParameters} or * {@link #getIV() getIV} (if the parameter is an IV). * + *

                If this cipher requires algorithm parameters that cannot be + * derived from the input parameters, and there are no reasonable + * provider-specific default values, initialization will + * necessarily fail. + * *

                If this cipher (including its underlying feedback or padding scheme) * requires any random bytes (e.g., for parameter generation), it will get * them from random. @@ -1155,8 +1192,8 @@ * @param random the source of randomness * * @exception InvalidKeyException if the given key is inappropriate for - * initializing this cipher, or if this cipher is being initialized for - * decryption and requires algorithm parameters that cannot be + * initializing this cipher, or requires + * algorithm parameters that cannot be * determined from the given key, or if the given key has a keysize that * exceeds the maximum allowable keysize (as determined from the * configured jurisdiction policy files). @@ -1202,6 +1239,11 @@ * {@link #getParameters() getParameters} or * {@link #getIV() getIV} (if the parameter is an IV). * + *

                If this cipher requires algorithm parameters that cannot be + * derived from the input parameters, and there are no reasonable + * provider-specific default values, initialization will + * necessarily fail. + * *

                If this cipher (including its underlying feedback or padding scheme) * requires any random bytes (e.g., for parameter generation), it will get * them using the {@link SecureRandom SecureRandom} @@ -1227,7 +1269,7 @@ * keysize (as determined from the configured jurisdiction policy files). * @exception InvalidAlgorithmParameterException if the given algorithm * parameters are inappropriate for this cipher, - * or this cipher is being initialized for decryption and requires + * or this cipher requires * algorithm parameters and params is null, or the given * algorithm parameters imply a cryptographic strength that would exceed * the legal limits (as determined from the configured jurisdiction @@ -1258,6 +1300,11 @@ * {@link #getParameters() getParameters} or * {@link #getIV() getIV} (if the parameter is an IV). * + *

                If this cipher requires algorithm parameters that cannot be + * derived from the input parameters, and there are no reasonable + * provider-specific default values, initialization will + * necessarily fail. + * *

                If this cipher (including its underlying feedback or padding scheme) * requires any random bytes (e.g., for parameter generation), it will get * them from random. @@ -1280,7 +1327,7 @@ * keysize (as determined from the configured jurisdiction policy files). * @exception InvalidAlgorithmParameterException if the given algorithm * parameters are inappropriate for this cipher, - * or this cipher is being initialized for decryption and requires + * or this cipher requires * algorithm parameters and params is null, or the given * algorithm parameters imply a cryptographic strength that would exceed * the legal limits (as determined from the configured jurisdiction @@ -1323,6 +1370,11 @@ * {@link #getParameters() getParameters} or * {@link #getIV() getIV} (if the parameter is an IV). * + *

                If this cipher requires algorithm parameters that cannot be + * derived from the input parameters, and there are no reasonable + * provider-specific default values, initialization will + * necessarily fail. + * *

                If this cipher (including its underlying feedback or padding scheme) * requires any random bytes (e.g., for parameter generation), it will get * them using the {@link SecureRandom SecureRandom} @@ -1348,7 +1400,7 @@ * keysize (as determined from the configured jurisdiction policy files). * @exception InvalidAlgorithmParameterException if the given algorithm * parameters are inappropriate for this cipher, - * or this cipher is being initialized for decryption and requires + * or this cipher requires * algorithm parameters and params is null, or the given * algorithm parameters imply a cryptographic strength that would exceed * the legal limits (as determined from the configured jurisdiction @@ -1379,6 +1431,11 @@ * {@link #getParameters() getParameters} or * {@link #getIV() getIV} (if the parameter is an IV). * + *

                If this cipher requires algorithm parameters that cannot be + * derived from the input parameters, and there are no reasonable + * provider-specific default values, initialization will + * necessarily fail. + * *

                If this cipher (including its underlying feedback or padding scheme) * requires any random bytes (e.g., for parameter generation), it will get * them from random. @@ -1401,7 +1458,7 @@ * keysize (as determined from the configured jurisdiction policy files). * @exception InvalidAlgorithmParameterException if the given algorithm * parameters are inappropriate for this cipher, - * or this cipher is being initialized for decryption and requires + * or this cipher requires * algorithm parameters and params is null, or the given * algorithm parameters imply a cryptographic strength that would exceed * the legal limits (as determined from the configured jurisdiction @@ -1444,7 +1501,7 @@ * derived from the public key in the given certificate, the underlying * cipher * implementation is supposed to generate the required parameters itself - * (using provider-specific default or ramdom values) if it is being + * (using provider-specific default or random values) if it is being * initialized for encryption or key wrapping, and raise an * InvalidKeyException if it is being initialized for decryption or * key unwrapping. @@ -1452,6 +1509,11 @@ * {@link #getParameters() getParameters} or * {@link #getIV() getIV} (if the parameter is an IV). * + *

                If this cipher requires algorithm parameters that cannot be + * derived from the input parameters, and there are no reasonable + * provider-specific default values, initialization will + * necessarily fail. + * *

                If this cipher (including its underlying feedback or padding scheme) * requires any random bytes (e.g., for parameter generation), it will get * them using the @@ -1474,8 +1536,7 @@ * * @exception InvalidKeyException if the public key in the given * certificate is inappropriate for initializing this cipher, or this - * cipher is being initialized for decryption or unwrapping keys and - * requires algorithm parameters that cannot be determined from the + * cipher requires algorithm parameters that cannot be determined from the * public key in the given certificate, or the keysize of the public key * in the given certificate has a keysize that exceeds the maximum * allowable keysize (as determined by the configured jurisdiction policy @@ -1518,6 +1579,11 @@ * {@link #getParameters() getParameters} or * {@link #getIV() getIV} (if the parameter is an IV). * + *

                If this cipher requires algorithm parameters that cannot be + * derived from the input parameters, and there are no reasonable + * provider-specific default values, initialization will + * necessarily fail. + * *

                If this cipher (including its underlying feedback or padding scheme) * requires any random bytes (e.g., for parameter generation), it will get * them from random. @@ -1536,7 +1602,7 @@ * * @exception InvalidKeyException if the public key in the given * certificate is inappropriate for initializing this cipher, or this - * cipher is being initialized for decryption or unwrapping keys and + * cipher * requires algorithm parameters that cannot be determined from the * public key in the given certificate, or the keysize of the public key * in the given certificate has a keysize that exceeds the maximum @@ -1865,6 +1931,9 @@ *

                Input data that may have been buffered during a previous * update operation is processed, with padding (if requested) * being applied. + * If an AEAD mode such as GCM/CCM is being used, the authentication + * tag is appended in the case of encryption, or verified in the + * case of decryption. * The result is stored in a new buffer. * *

                Upon finishing, this method resets this cipher object to the state @@ -1888,6 +1957,9 @@ * @exception BadPaddingException if this cipher is in decryption mode, * and (un)padding has been requested, but the decrypted data is not * bounded by the appropriate padding bytes + * @exception AEADBadTagException if this cipher is decrypting in an + * AEAD mode (such as GCM/CCM), and the received authentication tag + * does not match the calculated value */ public final byte[] doFinal() throws IllegalBlockSizeException, BadPaddingException { @@ -1904,6 +1976,9 @@ *

                Input data that may have been buffered during a previous * update operation is processed, with padding (if requested) * being applied. + * If an AEAD mode such as GCM/CCM is being used, the authentication + * tag is appended in the case of encryption, or verified in the + * case of decryption. * The result is stored in the output buffer, starting at * outputOffset inclusive. * @@ -1940,6 +2015,9 @@ * @exception BadPaddingException if this cipher is in decryption mode, * and (un)padding has been requested, but the decrypted data is not * bounded by the appropriate padding bytes + * @exception AEADBadTagException if this cipher is decrypting in an + * AEAD mode (such as GCM/CCM), and the received authentication tag + * does not match the calculated value */ public final int doFinal(byte[] output, int outputOffset) throws IllegalBlockSizeException, ShortBufferException, @@ -1963,6 +2041,9 @@ *

                The bytes in the input buffer, and any input bytes that * may have been buffered during a previous update operation, * are processed, with padding (if requested) being applied. + * If an AEAD mode such as GCM/CCM is being used, the authentication + * tag is appended in the case of encryption, or verified in the + * case of decryption. * The result is stored in a new buffer. * *

                Upon finishing, this method resets this cipher object to the state @@ -1988,6 +2069,9 @@ * @exception BadPaddingException if this cipher is in decryption mode, * and (un)padding has been requested, but the decrypted data is not * bounded by the appropriate padding bytes + * @exception AEADBadTagException if this cipher is decrypting in an + * AEAD mode (such as GCM/CCM), and the received authentication tag + * does not match the calculated value */ public final byte[] doFinal(byte[] input) throws IllegalBlockSizeException, BadPaddingException { @@ -2011,6 +2095,9 @@ * buffer, starting at inputOffset inclusive, and any input * bytes that may have been buffered during a previous update * operation, are processed, with padding (if requested) being applied. + * If an AEAD mode such as GCM/CCM is being used, the authentication + * tag is appended in the case of encryption, or verified in the + * case of decryption. * The result is stored in a new buffer. * *

                Upon finishing, this method resets this cipher object to the state @@ -2039,6 +2126,9 @@ * @exception BadPaddingException if this cipher is in decryption mode, * and (un)padding has been requested, but the decrypted data is not * bounded by the appropriate padding bytes + * @exception AEADBadTagException if this cipher is decrypting in an + * AEAD mode (such as GCM/CCM), and the received authentication tag + * does not match the calculated value */ public final byte[] doFinal(byte[] input, int inputOffset, int inputLen) throws IllegalBlockSizeException, BadPaddingException { @@ -2063,6 +2153,9 @@ * buffer, starting at inputOffset inclusive, and any input * bytes that may have been buffered during a previous update * operation, are processed, with padding (if requested) being applied. + * If an AEAD mode such as GCM/CCM is being used, the authentication + * tag is appended in the case of encryption, or verified in the + * case of decryption. * The result is stored in the output buffer. * *

                If the output buffer is too small to hold the result, @@ -2105,6 +2198,9 @@ * @exception BadPaddingException if this cipher is in decryption mode, * and (un)padding has been requested, but the decrypted data is not * bounded by the appropriate padding bytes + * @exception AEADBadTagException if this cipher is decrypting in an + * AEAD mode (such as GCM/CCM), and the received authentication tag + * does not match the calculated value */ public final int doFinal(byte[] input, int inputOffset, int inputLen, byte[] output) @@ -2133,6 +2229,9 @@ * bytes that may have been buffered during a previous * update operation, are processed, with padding * (if requested) being applied. + * If an AEAD mode such as GCM/CCM is being used, the authentication + * tag is appended in the case of encryption, or verified in the + * case of decryption. * The result is stored in the output buffer, starting at * outputOffset inclusive. * @@ -2178,6 +2277,9 @@ * @exception BadPaddingException if this cipher is in decryption mode, * and (un)padding has been requested, but the decrypted data is not * bounded by the appropriate padding bytes + * @exception AEADBadTagException if this cipher is decrypting in an + * AEAD mode (such as GCM/CCM), and the received authentication tag + * does not match the calculated value */ public final int doFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) @@ -2203,8 +2305,11 @@ * depending on how this cipher was initialized. * *

                All input.remaining() bytes starting at - * input.position() are processed. The result is stored - * in the output buffer. + * input.position() are processed. + * If an AEAD mode such as GCM/CCM is being used, the authentication + * tag is appended in the case of encryption, or verified in the + * case of decryption. + * The result is stored in the output buffer. * Upon return, the input buffer's position will be equal * to its limit; its limit will not have changed. The output buffer's * position will have advanced by n, where n is the value returned @@ -2250,6 +2355,10 @@ * @exception BadPaddingException if this cipher is in decryption mode, * and (un)padding has been requested, but the decrypted data is not * bounded by the appropriate padding bytes + * @exception AEADBadTagException if this cipher is decrypting in an + * AEAD mode (such as GCM/CCM), and the received authentication tag + * does not match the calculated value + * * @since 1.5 */ public final int doFinal(ByteBuffer input, ByteBuffer output) @@ -2441,4 +2550,128 @@ CryptoPermission cp = getConfiguredPermission(transformation); return cp.getAlgorithmParameterSpec(); } + + /** + * Continues a multi-part update of the Additional Authentication + * Data (AAD). + *

                + * Calls to this method provide AAD to the cipher when operating in + * modes such as AEAD (GCM/CCM). If this cipher is operating in + * either GCM or CCM mode, all AAD must be supplied before beginning + * operations on the ciphertext (via the {@code update} and {@code + * doFinal} methods). + * + * @param src the buffer containing the Additional Authentication Data + * + * @throws IllegalArgumentException if the {@code src} + * byte array is null + * @throws IllegalStateException if this cipher is in a wrong state + * (e.g., has not been initialized), does not accept AAD, or if + * operating in either GCM or CCM mode and one of the {@code update} + * methods has already been called for the active + * encryption/decryption operation + * @throws UnsupportedOperationException if the corresponding method + * in the {@code CipherSpi} has not been overridden by an + * implementation + * + * @since 1.7 + */ + public final void updateAAD(byte[] src) { + if (src == null) { + throw new IllegalArgumentException("src buffer is null"); + } + + updateAAD(src, 0, src.length); + } + + /** + * Continues a multi-part update of the Additional Authentication + * Data (AAD), using a subset of the provided buffer. + *

                + * Calls to this method provide AAD to the cipher when operating in + * modes such as AEAD (GCM/CCM). If this cipher is operating in + * either GCM or CCM mode, all AAD must be supplied before beginning + * operations on the ciphertext (via the {@code update} and {@code + * doFinal} methods). + * + * @param src the buffer containing the AAD + * @param offset the offset in {@code src} where the AAD input starts + * @param len the number of AAD bytes + * + * @throws IllegalArgumentException if the {@code src} + * byte array is null, or the {@code offset} or {@code length} + * is less than 0, or the sum of the {@code offset} and + * {@code len} is greater than the length of the + * {@code src} byte array + * @throws IllegalStateException if this cipher is in a wrong state + * (e.g., has not been initialized), does not accept AAD, or if + * operating in either GCM or CCM mode and one of the {@code update} + * methods has already been called for the active + * encryption/decryption operation + * @throws UnsupportedOperationException if the corresponding method + * in the {@code CipherSpi} has not been overridden by an + * implementation + * + * @since 1.7 + */ + public final void updateAAD(byte[] src, int offset, int len) { + checkCipherState(); + + // Input sanity check + if ((src == null) || (offset < 0) || (len < 0) + || ((len + offset) > src.length)) { + throw new IllegalArgumentException("Bad arguments"); + } + + chooseFirstProvider(); + if (len == 0) { + return; + } + spi.engineUpdateAAD(src, offset, len); + } + + /** + * Continues a multi-part update of the Additional Authentication + * Data (AAD). + *

                + * Calls to this method provide AAD to the cipher when operating in + * modes such as AEAD (GCM/CCM). If this cipher is operating in + * either GCM or CCM mode, all AAD must be supplied before beginning + * operations on the ciphertext (via the {@code update} and {@code + * doFinal} methods). + *

                + * All {@code src.remaining()} bytes starting at + * {@code src.position()} are processed. + * Upon return, the input buffer's position will be equal + * to its limit; its limit will not have changed. + * + * @param src the buffer containing the AAD + * + * @throws IllegalArgumentException if the {@code src ByteBuffer} + * is null + * @throws IllegalStateException if this cipher is in a wrong state + * (e.g., has not been initialized), does not accept AAD, or if + * operating in either GCM or CCM mode and one of the {@code update} + * methods has already been called for the active + * encryption/decryption operation + * @throws UnsupportedOperationException if the corresponding method + * in the {@code CipherSpi} has not been overridden by an + * implementation + * + * @since 1.7 + */ + public final void updateAAD(ByteBuffer src) { + checkCipherState(); + + // Input sanity check + if (src == null) { + throw new IllegalArgumentException("src ByteBuffer is null"); + } + + chooseFirstProvider(); + if (src.remaining() == 0) { + return; + } + spi.engineUpdateAAD(src); + } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/crypto/CipherSpi.java --- a/jdk/src/share/classes/javax/crypto/CipherSpi.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/crypto/CipherSpi.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -266,7 +266,7 @@ * inputLen (in bytes). * *

                This call takes into account any unprocessed (buffered) data from a - * previous update call, and padding. + * previous update call, padding, and AEAD tagging. * *

                The actual output length of the next update or * doFinal call may be smaller than the length returned by @@ -322,6 +322,11 @@ * {@link #engineGetParameters() engineGetParameters} or * {@link #engineGetIV() engineGetIV} (if the parameter is an IV). * + *

                If this cipher requires algorithm parameters that cannot be + * derived from the input parameters, and there are no reasonable + * provider-specific default values, initialization will + * necessarily fail. + * *

                If this cipher (including its underlying feedback or padding scheme) * requires any random bytes (e.g., for parameter generation), it will get * them from random. @@ -339,8 +344,8 @@ * @param random the source of randomness * * @exception InvalidKeyException if the given key is inappropriate for - * initializing this cipher, or if this cipher is being initialized for - * decryption and requires algorithm parameters that cannot be + * initializing this cipher, or requires + * algorithm parameters that cannot be * determined from the given key. */ protected abstract void engineInit(int opmode, Key key, @@ -366,6 +371,11 @@ * {@link #engineGetParameters() engineGetParameters} or * {@link #engineGetIV() engineGetIV} (if the parameter is an IV). * + *

                If this cipher requires algorithm parameters that cannot be + * derived from the input parameters, and there are no reasonable + * provider-specific default values, initialization will + * necessarily fail. + * *

                If this cipher (including its underlying feedback or padding scheme) * requires any random bytes (e.g., for parameter generation), it will get * them from random. @@ -387,7 +397,7 @@ * initializing this cipher * @exception InvalidAlgorithmParameterException if the given algorithm * parameters are inappropriate for this cipher, - * or if this cipher is being initialized for decryption and requires + * or if this cipher requires * algorithm parameters and params is null. */ protected abstract void engineInit(int opmode, Key key, @@ -414,6 +424,11 @@ * {@link #engineGetParameters() engineGetParameters} or * {@link #engineGetIV() engineGetIV} (if the parameter is an IV). * + *

                If this cipher requires algorithm parameters that cannot be + * derived from the input parameters, and there are no reasonable + * provider-specific default values, initialization will + * necessarily fail. + * *

                If this cipher (including its underlying feedback or padding scheme) * requires any random bytes (e.g., for parameter generation), it will get * them from random. @@ -435,7 +450,7 @@ * initializing this cipher * @exception InvalidAlgorithmParameterException if the given algorithm * parameters are inappropriate for this cipher, - * or if this cipher is being initialized for decryption and requires + * or if this cipher requires * algorithm parameters and params is null. */ protected abstract void engineInit(int opmode, Key key, @@ -548,6 +563,9 @@ * buffer, starting at inputOffset inclusive, and any input * bytes that may have been buffered during a previous update * operation, are processed, with padding (if requested) being applied. + * If an AEAD mode such as GCM/CCM is being used, the authentication + * tag is appended in the case of encryption, or verified in the + * case of decryption. * The result is stored in a new buffer. * *

                Upon finishing, this method resets this cipher object to the state @@ -575,6 +593,9 @@ * @exception BadPaddingException if this cipher is in decryption mode, * and (un)padding has been requested, but the decrypted data is not * bounded by the appropriate padding bytes + * @exception AEADBadTagException if this cipher is decrypting in an + * AEAD mode (such as GCM/CCM), and the received authentication tag + * does not match the calculated value */ protected abstract byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen) @@ -590,6 +611,9 @@ * buffer, starting at inputOffset inclusive, and any input * bytes that may have been buffered during a previous update * operation, are processed, with padding (if requested) being applied. + * If an AEAD mode such as GCM/CCM is being used, the authentication + * tag is appended in the case of encryption, or verified in the + * case of decryption. * The result is stored in the output buffer, starting at * outputOffset inclusive. * @@ -626,6 +650,9 @@ * @exception BadPaddingException if this cipher is in decryption mode, * and (un)padding has been requested, but the decrypted data is not * bounded by the appropriate padding bytes + * @exception AEADBadTagException if this cipher is decrypting in an + * AEAD mode (such as GCM/CCM), and the received authentication tag + * does not match the calculated value */ protected abstract int engineDoFinal(byte[] input, int inputOffset, int inputLen, byte[] output, @@ -640,8 +667,11 @@ * initialized. * *

                All input.remaining() bytes starting at - * input.position() are processed. The result is stored - * in the output buffer. + * input.position() are processed. + * If an AEAD mode such as GCM/CCM is being used, the authentication + * tag is appended in the case of encryption, or verified in the + * case of decryption. + * The result is stored in the output buffer. * Upon return, the input buffer's position will be equal * to its limit; its limit will not have changed. The output buffer's * position will have advanced by n, where n is the value returned @@ -678,6 +708,9 @@ * @exception BadPaddingException if this cipher is in decryption mode, * and (un)padding has been requested, but the decrypted data is not * bounded by the appropriate padding bytes + * @exception AEADBadTagException if this cipher is decrypting in an + * AEAD mode (such as GCM/CCM), and the received authentication tag + * does not match the calculated value * * @throws NullPointerException if either parameter is null * @since 1.5 @@ -892,4 +925,67 @@ { throw new UnsupportedOperationException(); } + + /** + * Continues a multi-part update of the Additional Authentication + * Data (AAD), using a subset of the provided buffer. + *

                + * Calls to this method provide AAD to the cipher when operating in + * modes such as AEAD (GCM/CCM). If this cipher is operating in + * either GCM or CCM mode, all AAD must be supplied before beginning + * operations on the ciphertext (via the {@code update} and {@code + * doFinal} methods). + * + * @param src the buffer containing the AAD + * @param offset the offset in {@code src} where the AAD input starts + * @param len the number of AAD bytes + * + * @throws IllegalStateException if this cipher is in a wrong state + * (e.g., has not been initialized), does not accept AAD, or if + * operating in either GCM or CCM mode and one of the {@code update} + * methods has already been called for the active + * encryption/decryption operation + * @throws UnsupportedOperationException if this method + * has not been overridden by an implementation + * + * @since 1.7 + */ + protected void engineUpdateAAD(byte[] src, int offset, int len) { + throw new UnsupportedOperationException( + "The underlying Cipher implementation " + + "does not support this method"); + } + + /** + * Continues a multi-part update of the Additional Authentication + * Data (AAD). + *

                + * Calls to this method provide AAD to the cipher when operating in + * modes such as AEAD (GCM/CCM). If this cipher is operating in + * either GCM or CCM mode, all AAD must be supplied before beginning + * operations on the ciphertext (via the {@code update} and {@code + * doFinal} methods). + *

                + * All {@code src.remaining()} bytes starting at + * {@code src.position()} are processed. + * Upon return, the input buffer's position will be equal + * to its limit; its limit will not have changed. + * + * @param src the buffer containing the AAD + * + * @throws IllegalStateException if this cipher is in a wrong state + * (e.g., has not been initialized), does not accept AAD, or if + * operating in either GCM or CCM mode and one of the {@code update} + * methods has already been called for the active + * encryption/decryption operation + * @throws UnsupportedOperationException if this method + * has not been overridden by an implementation + * + * @since 1.7 + */ + protected void engineUpdateAAD(ByteBuffer src) { + throw new UnsupportedOperationException( + "The underlying Cipher implementation " + + "does not support this method"); + } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/crypto/spec/GCMParameterSpec.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/classes/javax/crypto/spec/GCMParameterSpec.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package javax.crypto.spec; + +import java.security.spec.AlgorithmParameterSpec; + +/** + * Specifies the set of parameters required by a {@link + * javax.crypto.Cipher} using the Galois/Counter Mode (GCM) mode. + *

                + * Simple block cipher modes (such as CBC) generally require only an + * initialization vector (such as {@code IvParameterSpec}), + * but GCM needs these parameters: + *

                  + *
                • {@code IV}: Initialization Vector (IV)
                • + *
                • {@code tLen}: length (in bits) of authentication tag T
                • + *
                + *

                + * In addition to the parameters described here, other GCM inputs/output + * (Additional Authenticated Data (AAD), Keys, block ciphers, + * plain/ciphertext and authentication tags) are handled in the {@code + * Cipher} class. +

                + * Please see RFC 5116 + * for more information on the Authenticated Encryption with + * Associated Data (AEAD) algorithm, and + * NIST Special Publication 800-38D, "NIST Recommendation for Block + * Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC." + *

                + * The GCM specification states that {@code tLen} may only have the + * values {128, 120, 112, 104, 96}, or {64, 32} for certain + * applications. Other values can be specified for this class, but not + * all CSP implementations will support them. + * + * @see javax.crypto.Cipher + * + * @since 1.7 + */ +public class GCMParameterSpec implements AlgorithmParameterSpec { + + // Initialization Vector. Could use IvParameterSpec, but that + // would add extra copies. + private byte[] iv; + + // Required Tag length (in bits). + private int tLen; + + /** + * Constructs a GCMParameterSpec using the specified authentication + * tag bit-length and IV buffer. + * + * @param tLen the authentication tag length (in bits) + * @param src the IV source buffer. The contents of the buffer are + * copied to protect against subsequent modification. + * + * @throws IllegalArgumentException if {@code tLen} is negative, + * or {@code src} is null. + */ + public GCMParameterSpec(int tLen, byte[] src) { + if (src == null) { + throw new IllegalArgumentException("src array is null"); + } + + init(tLen, src, 0, src.length); + } + + /** + * Constructs a GCMParameterSpec object using the specified + * authentication tag bit-length and a subset of the specified + * buffer as the IV. + * + * @param tLen the authentication tag length (in bits) + * @param src the IV source buffer. The contents of the + * buffer are copied to protect against subsequent modification. + * @param offset the offset in {@code src} where the IV starts + * @param len the number of IV bytes + * + * @throws IllegalArgumentException if {@code tLen} is negative, + * {@code src} is null, {@code len} or {@code offset} is negative, + * or the sum of {@code offset} and {@code len} is greater than the + * length of the {@code src} byte array. + */ + public GCMParameterSpec(int tLen, byte[] src, int offset, int len) { + init(tLen, src, offset, len); + } + + /* + * Check input parameters. + */ + private void init(int tLen, byte[] src, int offset, int len) { + if (tLen < 0) { + throw new IllegalArgumentException( + "Length argument is negative"); + } + this.tLen = tLen; + + // Input sanity check + if ((src == null) ||(len < 0) || (offset < 0) + || ((len + offset) > src.length)) { + throw new IllegalArgumentException("Invalid buffer arguments"); + } + + iv = new byte[len]; + System.arraycopy(src, offset, iv, 0, len); + } + + /** + * Returns the authentication tag length. + * + * @return the authentication tag length (in bits) + */ + public int getTLen() { + return tLen; + } + + /** + * Returns the Initialization Vector (IV). + * + * @return the IV. Creates a new array each time this method + * is called. + */ + public byte[] getIV() { + return iv.clone(); + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/imageio/stream/FileCacheImageOutputStream.java --- a/jdk/src/share/classes/javax/imageio/stream/FileCacheImageOutputStream.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/imageio/stream/FileCacheImageOutputStream.java Wed Jul 05 17:42:05 2017 +0200 @@ -214,7 +214,7 @@ } /** - * Closes this FileCacheImageOututStream. All + * Closes this FileCacheImageOutputStream. All * pending data is flushed to the output, and the cache file * is closed and removed. The destination OutputStream * is not closed. diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/management/remote/package.html --- a/jdk/src/share/classes/javax/management/remote/package.html Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/management/remote/package.html Wed Jul 05 17:42:05 2017 +0200 @@ -154,11 +154,8 @@

                The formal grammar for connection ids that follow this - convention is as follows (using the grammar - notation from The Java Language Specification, Second - Edition):

                - + convention is as follows (using the grammar notation from section 2.4 of + The Java™ Language Specification):

                 ConnectionId:
                     Protocol : ClientAddressopt Space ClientIdopt Space ArbitraryText
                diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/sound/midi/MidiSystem.java
                --- a/jdk/src/share/classes/javax/sound/midi/MidiSystem.java	Thu Apr 21 15:32:48 2011 -0700
                +++ b/jdk/src/share/classes/javax/sound/midi/MidiSystem.java	Wed Jul 05 17:42:05 2017 +0200
                @@ -239,6 +239,12 @@
                      * If a suitable MIDI port is not available, the Receiver is
                      * retrieved from an installed synthesizer.
                      *
                +     * 

                If a native receiver provided by the default device does not implement + * the {@code MidiDeviceReceiver} interface, it will be wrapped in a + * wrapper class that implements the {@code MidiDeviceReceiver} interface. + * The corresponding {@code Receiver} method calls will be forwarded + * to the native receiver. + * *

                If this method returns successfully, the {@link * javax.sound.midi.MidiDevice MidiDevice} the * Receiver belongs to is opened implicitly, if it is @@ -284,7 +290,13 @@ * it is used to identify the device that provides the default transmitter. * For details, refer to the {@link MidiSystem class description}. * - * If this method returns successfully, the {@link + *

                If a native transmitter provided by the default device does not implement + * the {@code MidiDeviceTransmitter} interface, it will be wrapped in a + * wrapper class that implements the {@code MidiDeviceTransmitter} interface. + * The corresponding {@code Transmitter} method calls will be forwarded + * to the native transmitter. + * + *

                If this method returns successfully, the {@link * javax.sound.midi.MidiDevice MidiDevice} the * Transmitter belongs to is opened implicitly, if it * is not already open. It is possible to close an implicitly diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java --- a/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java Wed Jul 05 17:42:05 2017 +0200 @@ -296,32 +296,32 @@ public abstract class BaseRowSet implements Serializable, Cloneable { -/** - * A constant indicating to a RowSetReaderImpl object - * that a given parameter is a Unicode stream. This - * RowSetReaderImpl object is provided as an extension of the - * SyncProvider abstract class defined in the - * SyncFactory static factory SPI mechanism. - */ -public static final int UNICODE_STREAM_PARAM = 0; - -/** - * A constant indicating to a RowSetReaderImpl object - * that a given parameter is a binary stream. A - * RowSetReaderImpl object is provided as an extension of the - * SyncProvider abstract class defined in the - * SyncFactory static factory SPI mechanism. - */ -public static final int BINARY_STREAM_PARAM = 1; - -/** - * A constant indicating to a RowSetReaderImpl object - * that a given parameter is an ASCII stream. A - * RowSetReaderImpl object is provided as an extension of the - * SyncProvider abstract class defined in the - * SyncFactory static factory SPI mechanism. - */ -public static final int ASCII_STREAM_PARAM = 2; + /** + * A constant indicating to a RowSetReaderImpl object + * that a given parameter is a Unicode stream. This + * RowSetReaderImpl object is provided as an extension of the + * SyncProvider abstract class defined in the + * SyncFactory static factory SPI mechanism. + */ + public static final int UNICODE_STREAM_PARAM = 0; + + /** + * A constant indicating to a RowSetReaderImpl object + * that a given parameter is a binary stream. A + * RowSetReaderImpl object is provided as an extension of the + * SyncProvider abstract class defined in the + * SyncFactory static factory SPI mechanism. + */ + public static final int BINARY_STREAM_PARAM = 1; + + /** + * A constant indicating to a RowSetReaderImpl object + * that a given parameter is an ASCII stream. A + * RowSetReaderImpl object is provided as an extension of the + * SyncProvider abstract class defined in the + * SyncFactory static factory SPI mechanism. + */ + public static final int ASCII_STREAM_PARAM = 2; /** * The InputStream object that will be @@ -505,21 +505,21 @@ * custom mapping of user-defined types. * @serial */ - private Map map; + private Map> map; /** * A Vector object that holds the list of listeners * that have registered with this RowSet object. * @serial */ - private Vector listeners; + private Vector listeners; /** * A Vector object that holds the parameters set * for this RowSet object's current command. * @serial */ - private Hashtable params; // could be transient? + private Hashtable params; // could be transient? /** * Constructs a new BaseRowSet object initialized with @@ -529,7 +529,7 @@ */ public BaseRowSet() { // allocate the listeners collection - listeners = new Vector(); + listeners = new Vector(); } /** @@ -542,7 +542,7 @@ * a RowSet implementation extending this class. */ protected void initParams() { - params = new Hashtable(); + params = new Hashtable(); } //-------------------------------------------------------------------- diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java --- a/jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java Wed Jul 05 17:42:05 2017 +0200 @@ -912,7 +912,12 @@ * @since 1.6 */ public T unwrap(java.lang.Class iface) throws java.sql.SQLException { - return (T)this; + + if(isWrapperFor(iface)) { + return iface.cast(this); + } else { + throw new SQLException("unwrap failed for:"+ iface); + } } /** @@ -929,8 +934,9 @@ * @throws java.sql.SQLException if an error occurs while determining whether this is a wrapper * for an object with the given interface. * @since 1.6 - */ public boolean isWrapperFor(Class interfaces) throws SQLException { - return false; + */ + public boolean isWrapperFor(Class interfaces) throws SQLException { + return interfaces.isInstance(this); } static final long serialVersionUID = 6893806403181801867L; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java --- a/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java Wed Jul 05 17:42:05 2017 +0200 @@ -204,9 +204,9 @@ * */ static private ClassLoader getContextClassLoader() throws SecurityException { - return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { + return AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + public ClassLoader run() { ClassLoader cl = null; cl = Thread.currentThread().getContextClassLoader(); @@ -284,9 +284,9 @@ static private String getSystemProperty(final String propName) { String property = null; try { - property = (String) AccessController.doPrivileged(new PrivilegedAction() { + property = AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + public String run() { return System.getProperty(propName); } }); diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/swing/Painter.java --- a/jdk/src/share/classes/javax/swing/Painter.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/swing/Painter.java Wed Jul 05 17:42:05 2017 +0200 @@ -45,14 +45,16 @@ * Painter that only works with subclasses of {@link java.awt.Component}. * In that case, when the Painter is declared, you may declare that * it requires a Component, allowing the paint method to be type safe. Ex: - *

                
                - *     Painter p = new Painter() {
                - *         public void paint(Graphics2D g, Component c, int width, int height) {
                - *             g.setColor(c.getBackground());
                - *             //and so forth
                - *         }
                + * 
                + * {@code
                + * Painter p = new Painter() {
                + *     public void paint(Graphics2D g, Component c, int width, int height) {
                + *         g.setColor(c.getBackground());
                + *         //and so forth
                  *     }
                - * 

                + * } + * } + *

                * *

                This interface makes no guarantees of threadsafety.

                * diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/swing/border/TitledBorder.java --- a/jdk/src/share/classes/javax/swing/border/TitledBorder.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/swing/border/TitledBorder.java Wed Jul 05 17:42:05 2017 +0200 @@ -240,9 +240,7 @@ int edge = (border instanceof TitledBorder) ? 0 : EDGE_SPACING; JLabel label = getLabel(c); Dimension size = label.getPreferredSize(); - Insets insets = (border != null) - ? border.getBorderInsets(c) - : new Insets(0, 0, 0, 0); + Insets insets = getBorderInsets(border, c, new Insets(0, 0, 0, 0)); int borderX = x + edge; int borderY = y + edge; @@ -348,17 +346,8 @@ */ public Insets getBorderInsets(Component c, Insets insets) { Border border = getBorder(); - if (border == null) { - insets.set(0, 0, 0, 0); - } - else if (border instanceof AbstractBorder) { - AbstractBorder ab = (AbstractBorder) border; - insets = ab.getBorderInsets(c, insets); - } - else { - Insets i = border.getBorderInsets(c); - insets.set(i.top, i.left, i.bottom, i.right); - } + insets = getBorderInsets(border, c, insets); + String title = getTitle(); if ((title != null) && !title.isEmpty()) { int edge = (border instanceof TitledBorder) ? 0 : EDGE_SPACING; @@ -588,9 +577,7 @@ int edge = (border instanceof TitledBorder) ? 0 : EDGE_SPACING; JLabel label = getLabel(c); Dimension size = label.getPreferredSize(); - Insets insets = (border != null) - ? border.getBorderInsets(c) - : new Insets(0, 0, 0, 0); + Insets insets = getBorderInsets(border, c, new Insets(0, 0, 0, 0)); int baseline = label.getBaseline(size.width, size.height); switch (getPosition()) { @@ -728,4 +715,19 @@ this.label.setEnabled(c.isEnabled()); return this.label; } + + private static Insets getBorderInsets(Border border, Component c, Insets insets) { + if (border == null) { + insets.set(0, 0, 0, 0); + } + else if (border instanceof AbstractBorder) { + AbstractBorder ab = (AbstractBorder) border; + insets = ab.getBorderInsets(c, insets); + } + else { + Insets i = border.getBorderInsets(c); + insets.set(i.top, i.left, i.bottom, i.right); + } + return insets; + } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/swing/plaf/LayerUI.java --- a/jdk/src/share/classes/javax/swing/plaf/LayerUI.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/LayerUI.java Wed Jul 05 17:42:05 2017 +0200 @@ -708,8 +708,8 @@ * * @param x the x value of the region to be painted * @param y the y value of the region to be painted - * @param w the width of the region to be painted - * @param h the height of the region to be painted + * @param width the width of the region to be painted + * @param height the height of the region to be painted * * @see JComponent#paintImmediately(int, int, int, int) */ diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java Wed Jul 05 17:42:05 2017 +0200 @@ -335,9 +335,8 @@ } /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of . + * Instantiate it only within subclasses of {@code BasicColorChooserUI}. */ public class PropertyHandler implements PropertyChangeListener { public void propertyChange(PropertyChangeEvent e) { diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java Wed Jul 05 17:42:05 2017 +0200 @@ -186,9 +186,8 @@ /** * Listens for mouse movements and acts on them. * - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of . + * Instantiate it only within subclasses of {@code BasicDesktopIconUI}. */ public class MouseInputHandler extends MouseInputAdapter { diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java Wed Jul 05 17:42:05 2017 +0200 @@ -455,6 +455,8 @@ } int dka = label.getDisplayedMnemonic(); inputMap.put(KeyStroke.getKeyStroke(dka, ActionEvent.ALT_MASK, true), RELEASE); + // Need this when the sticky keys are enabled + inputMap.put(KeyStroke.getKeyStroke(dka, 0, true), RELEASE); // Need this if ALT is released before the accelerator inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ALT, 0, true), RELEASE); label.requestFocus(); @@ -467,7 +469,9 @@ InputMap inputMap = SwingUtilities.getUIInputMap(label, JComponent.WHEN_FOCUSED); if (inputMap != null) { // inputMap should never be null. - inputMap.remove(KeyStroke.getKeyStroke(label.getDisplayedMnemonic(), ActionEvent.ALT_MASK, true)); + int dka = label.getDisplayedMnemonic(); + inputMap.remove(KeyStroke.getKeyStroke(dka, ActionEvent.ALT_MASK, true)); + inputMap.remove(KeyStroke.getKeyStroke(dka, 0, true)); inputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_ALT, 0, true)); } if (labelFor instanceof Container && diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java Wed Jul 05 17:42:05 2017 +0200 @@ -1555,9 +1555,8 @@ } /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of BasicTableUI. + * Instantiate it only within subclasses of {@code BasicListUI}. */ public class FocusHandler implements FocusListener { diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java Wed Jul 05 17:42:05 2017 +0200 @@ -911,9 +911,8 @@ * right. If syncAllWidths is true, the widths of each * component will be set to the largest preferred size width. * - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of BasicOptionPaneUI. + * Instantiate it only within subclasses of {@code BasicOptionPaneUI}. */ public static class ButtonAreaLayout implements LayoutManager { protected boolean syncAllWidths; @@ -1115,9 +1114,8 @@ /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of BasicOptionPaneUI. + * Instantiate it only within subclasses of {@code BasicOptionPaneUI}. */ public class PropertyChangeHandler implements PropertyChangeListener { /** @@ -1161,9 +1159,8 @@ } /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of BasicOptionPaneUI. + * Instantiate it only within subclasses of {@code BasicOptionPaneUI}. */ public class ButtonActionListener implements ActionListener { protected int buttonIndex; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java Wed Jul 05 17:42:05 2017 +0200 @@ -1211,9 +1211,8 @@ /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of BasicProgressBarUI. + * Instantiate it only within subclasses of {@code BasicProgressBarUI}. */ public class ChangeHandler implements ChangeListener { // NOTE: This class exists only for backward compatability. All diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java Wed Jul 05 17:42:05 2017 +0200 @@ -88,9 +88,8 @@ }; /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of BasicTableUI. + * Instantiate it only within subclasses of {@code BasicTableHeaderUI}. */ public class MouseInputHandler implements MouseInputListener { diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java Wed Jul 05 17:42:05 2017 +0200 @@ -730,9 +730,8 @@ // /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of BasicTableUI. + * Instantiate it only within subclasses of {@code BasicTableUI}. *

                As of Java 2 platform v1.3 this class is no longer used. * Instead JTable * overrides processKeyBinding to dispatch the event to @@ -761,9 +760,8 @@ // /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of BasicTableUI. + * Instantiate it only within subclasses of {@code BasicTableUI}. */ public class FocusHandler implements FocusListener { // NOTE: This class exists only for backward compatability. All @@ -784,7 +782,6 @@ // /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. * Instantiate it only within subclasses of BasicTableUI. */ diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java Wed Jul 05 17:42:05 2017 +0200 @@ -199,9 +199,8 @@ } /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of . + * Instantiate it only within subclasses of {@code MetalComboBoxUI}. */ public class MetalPropertyChangeListener extends BasicComboBoxUI.PropertyChangeHandler { public void propertyChange(PropertyChangeEvent e) { @@ -244,9 +243,8 @@ } /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of . + * Instantiate it only within subclasses of {@code MetalComboBoxUI}. */ public class MetalComboBoxLayoutManager extends BasicComboBoxUI.ComboBoxLayoutManager { public void layoutContainer( Container parent ) { @@ -356,9 +354,8 @@ } /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of . + * Instantiate it only within subclasses of {@code MetalComboBoxUI}. * * This class is now obsolete and doesn't do anything and * is only included for backwards API compatibility. Do not call or diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java Wed Jul 05 17:42:05 2017 +0200 @@ -1196,9 +1196,8 @@ } /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of MetalTabbedPaneUI. + * Instantiate it only within subclasses of {@code MetalTabbedPaneUI}. */ public class TabbedPaneLayout extends BasicTabbedPaneUI.TabbedPaneLayout { diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/swing/text/GlyphPainter2.java --- a/jdk/src/share/classes/javax/swing/text/GlyphPainter2.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/swing/text/GlyphPainter2.java Wed Jul 05 17:42:05 2017 +0200 @@ -172,6 +172,11 @@ //italic carets and we do not. TextHitInfo hit = layout.hitTestChar(x - (float)alloc.getX(), 0); int pos = hit.getInsertionIndex(); + + if (pos == v.getEndOffset()) { + pos--; + } + biasReturn[0] = hit.isLeadingEdge() ? Position.Bias.Forward : Position.Bias.Backward; return pos + v.getStartOffset(); } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/swing/text/GlyphView.java --- a/jdk/src/share/classes/javax/swing/text/GlyphView.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/swing/text/GlyphView.java Wed Jul 05 17:42:05 2017 +0200 @@ -541,7 +541,30 @@ */ @Override public float getMinimumSpan(int axis) { - return super.getMinimumSpan(axis); + switch (axis) { + case View.X_AXIS: + if (minimumSpan < 0) { + minimumSpan = 0; + int p0 = getStartOffset(); + int p1 = getEndOffset(); + while (p1 > p0) { + int breakSpot = getBreakSpot(p0, p1); + if (breakSpot == BreakIterator.DONE) { + // the rest of the view is non-breakable + breakSpot = p0; + } + minimumSpan = Math.max(minimumSpan, + getPartialSpan(breakSpot, p1)); + // Note: getBreakSpot returns the *last* breakspot + p1 = breakSpot - 1; + } + } + return minimumSpan; + case View.Y_AXIS: + return super.getMinimumSpan(axis); + default: + throw new IllegalArgumentException("Invalid axis: " + axis); + } } /** diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/swing/text/ParagraphView.java --- a/jdk/src/share/classes/javax/swing/text/ParagraphView.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/swing/text/ParagraphView.java Wed Jul 05 17:42:05 2017 +0200 @@ -721,7 +721,34 @@ @Override protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r) { - return super.calculateMinorAxisRequirements(axis, r); + r = super.calculateMinorAxisRequirements(axis, r); + + float min = 0; + float glue = 0; + int n = getLayoutViewCount(); + for (int i = 0; i < n; i++) { + View v = getLayoutView(i); + float span = v.getMinimumSpan(axis); + if (v.getBreakWeight(axis, 0, v.getMaximumSpan(axis)) > View.BadBreakWeight) { + // find the longest non-breakable fragments at the view edges + int p0 = v.getStartOffset(); + int p1 = v.getEndOffset(); + float start = findEdgeSpan(v, axis, p0, p0, p1); + float end = findEdgeSpan(v, axis, p1, p0, p1); + glue += start; + min = Math.max(min, Math.max(span, glue)); + glue = end; + } else { + // non-breakable view + glue += span; + min = Math.max(min, glue); + } + } + r.minimum = Math.max(r.minimum, (int) min); + r.preferred = Math.max(r.minimum, r.preferred); + r.maximum = Math.max(r.preferred, r.maximum); + + return r; } /** diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/swing/text/Utilities.java --- a/jdk/src/share/classes/javax/swing/text/Utilities.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/swing/text/Utilities.java Wed Jul 05 17:42:05 2017 +0200 @@ -395,10 +395,10 @@ // the length of the string measured as a whole may differ from // the sum of individual character lengths, for example if // fractional metrics are enabled; and we must guard from this. - while (metrics.charsWidth(txt, txtOffset, offset + 1) > (x - x0)) { + while (offset > 0 && metrics.charsWidth(txt, txtOffset, offset) > (x - x0)) { offset--; } - return (offset < 0 ? 0 : offset); + return offset; } currX = nextX; } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/swing/text/html/CSS.java --- a/jdk/src/share/classes/javax/swing/text/html/CSS.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/swing/text/html/CSS.java Wed Jul 05 17:42:05 2017 +0200 @@ -62,7 +62,6 @@ *

              • background-repeat *
              • background-position *
              • background - *
              • background-repeat *
              • text-decoration (with the exception of blink and overline) *
              • vertical-align (only sup and super) *
              • text-align (justify is treated as center) @@ -75,7 +74,18 @@ *
              • padding-right *
              • padding-bottom *
              • padding-left + *
              • padding + *
              • border-top-style + *
              • border-right-style + *
              • border-bottom-style + *
              • border-left-style *
              • border-style (only supports inset, outset and none) + *
              • border-top-color + *
              • border-right-color + *
              • border-bottom-color + *
              • border-left-color + *
              • border-color + *
              • list-style-image *
              • list-style-type *
              • list-style-position *
              diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/javax/swing/text/html/parser/Parser.java --- a/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java Wed Jul 05 17:42:05 2017 +0200 @@ -966,6 +966,9 @@ char data[] = {'&'}; return data; } + + boolean semicolon = false; + switch (ch) { case '\n': ln++; @@ -985,6 +988,8 @@ break; case ';': + semicolon = true; + ch = readCh(); break; } @@ -1006,7 +1011,7 @@ return new char[0]; } /* given that there is not a match restore the entity reference */ - String str = "&" + nm + ";"; + String str = "&" + nm + (semicolon ? ";" : ""); char b[] = new char[str.length()]; str.getChars(0, b.length, b, 0); diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/misc/FloatingDecimal.java --- a/jdk/src/share/classes/sun/misc/FloatingDecimal.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/misc/FloatingDecimal.java Wed Jul 05 17:42:05 2017 +0200 @@ -30,7 +30,7 @@ import sun.misc.FloatConsts; import java.util.regex.*; -public class FloatingDecimal{ +public strictfp class FloatingDecimal{ boolean isExceptional; boolean isNegative; int decExponent; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/misc/FormattedFloatingDecimal.java --- a/jdk/src/share/classes/sun/misc/FormattedFloatingDecimal.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/misc/FormattedFloatingDecimal.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ import sun.misc.FloatConsts; import java.util.regex.*; -public class FormattedFloatingDecimal{ +public strictfp class FormattedFloatingDecimal{ boolean isExceptional; boolean isNegative; int decExponent; // value set at construction, then immutable diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/misc/FpUtils.java --- a/jdk/src/share/classes/sun/misc/FpUtils.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/misc/FpUtils.java Wed Jul 05 17:42:05 2017 +0200 @@ -531,10 +531,9 @@ * Return {@code d} × * 2{@code scale_factor} rounded as if performed * by a single correctly rounded floating-point multiply to a - * member of the double value set. See §4.2.3 - * of the Java - * Language Specification for a discussion of floating-point + * member of the double value set. See section 4.2.3 of + * The Java™ Language Specification + * for a discussion of floating-point * value sets. If the exponent of the result is between the * {@code double}'s minimum exponent and maximum exponent, * the answer is calculated exactly. If the exponent of the @@ -641,11 +640,10 @@ * Return {@code f} × * 2{@code scale_factor} rounded as if performed * by a single correctly rounded floating-point multiply to a - * member of the float value set. See §4.2.3 - * of the Java - * Language Specification for a discussion of floating-point - * value set. If the exponent of the result is between the + * member of the float value set. See section 4.2.3 of + * The Java™ Language Specification + * for a discussion of floating-point + * value sets. If the exponent of the result is between the * {@code float}'s minimum exponent and maximum exponent, the * answer is calculated exactly. If the exponent of the result * would be larger than {@code float}'s maximum exponent, an diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/net/www/protocol/jar/Handler.java --- a/jdk/src/share/classes/sun/net/www/protocol/jar/Handler.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/net/www/protocol/jar/Handler.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,8 @@ package sun.net.www.protocol.jar; -import java.io.*; +import java.io.IOException; import java.net.*; -import java.util.*; import sun.net.www.ParseUtil; /* @@ -42,7 +41,7 @@ return new JarURLConnection(u, this); } - private int indexOfBangSlash(String spec) { + private static int indexOfBangSlash(String spec) { int indexOfBang = spec.length(); while((indexOfBang = spec.lastIndexOf('!', indexOfBang)) != -1) { if ((indexOfBang != (spec.length() - 1)) && @@ -55,6 +54,75 @@ return -1; } + /** + * Compare two jar URLs + */ + @Override + protected boolean sameFile(URL u1, URL u2) { + if (!u1.getProtocol().equals("jar") || !u2.getProtocol().equals("jar")) + return false; + + String file1 = u1.getFile(); + String file2 = u2.getFile(); + int sep1 = file1.indexOf(separator); + int sep2 = file2.indexOf(separator); + + if (sep1 == -1 || sep2 == -1) { + return super.sameFile(u1, u2); + } + + String entry1 = file1.substring(sep1 + 2); + String entry2 = file2.substring(sep2 + 2); + + if (!entry1.equals(entry2)) + return false; + + URL enclosedURL1 = null, enclosedURL2 = null; + try { + enclosedURL1 = new URL(file1.substring(0, sep1)); + enclosedURL2 = new URL(file2.substring(0, sep2)); + } catch (MalformedURLException unused) { + return super.sameFile(u1, u2); + } + + if (!super.sameFile(enclosedURL1, enclosedURL2)) { + return false; + } + + return true; + } + + @Override + protected int hashCode(URL u) { + int h = 0; + + String protocol = u.getProtocol(); + if (protocol != null) + h += protocol.hashCode(); + + String file = u.getFile(); + int sep = file.indexOf(separator); + + if (sep == -1) + return h + file.hashCode(); + + URL enclosedURL = null; + String fileWithoutEntry = file.substring(0, sep); + try { + enclosedURL = new URL(fileWithoutEntry); + h += enclosedURL.hashCode(); + } catch (MalformedURLException unused) { + h += fileWithoutEntry.hashCode(); + } + + String entry = file.substring(sep + 2); + h += entry.hashCode(); + + return h; + } + + + @Override protected void parseURL(URL url, String spec, int start, int limit) { String file = null; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java --- a/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java Wed Jul 05 17:42:05 2017 +0200 @@ -388,9 +388,8 @@ // we must instead use a nonempty buffer, otherwise the call // will not block waiting for a datagram on some platforms. int newSize = Math.max(rem, 1); - ByteBuffer bb = null; + ByteBuffer bb = Util.getTemporaryDirectBuffer(newSize); try { - bb = Util.getTemporaryDirectBuffer(newSize); int n = receiveIntoNativeBuffer(fd, bb, newSize, 0); bb.flip(); if (n > 0 && rem > 0) @@ -482,9 +481,8 @@ assert (pos <= lim); int rem = (pos <= lim ? lim - pos : 0); - ByteBuffer bb = null; + ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); try { - bb = Util.getTemporaryDirectBuffer(rem); bb.put(src); bb.flip(); // Do not update src until we see how many bytes were written @@ -766,10 +764,10 @@ // check multicast address is compatible with this socket if (group instanceof Inet4Address) { if (family == StandardProtocolFamily.INET6 && !Net.canIPv6SocketJoinIPv4Group()) - throw new IllegalArgumentException("Group is not IPv4 multicast address"); + throw new IllegalArgumentException("IPv6 socket cannot join IPv4 multicast group"); } else if (group instanceof Inet6Address) { if (family != StandardProtocolFamily.INET6) - throw new IllegalArgumentException("Group is not IPv6 multicast address"); + throw new IllegalArgumentException("Only IPv6 sockets can join IPv6 multicast group"); } else { throw new IllegalArgumentException("Address type not supported"); } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/nio/ch/IOUtil.java --- a/jdk/src/share/classes/sun/nio/ch/IOUtil.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/nio/ch/IOUtil.java Wed Jul 05 17:42:05 2017 +0200 @@ -50,9 +50,8 @@ int lim = src.limit(); assert (pos <= lim); int rem = (pos <= lim ? lim - pos : 0); - ByteBuffer bb = null; + ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); try { - bb = Util.getTemporaryDirectBuffer(rem); bb.put(src); bb.flip(); // Do not update src until we see how many bytes were written @@ -187,9 +186,8 @@ return readIntoNativeBuffer(fd, dst, position, nd, lock); // Substitute a native buffer - ByteBuffer bb = null; + ByteBuffer bb = Util.getTemporaryDirectBuffer(dst.remaining()); try { - bb = Util.getTemporaryDirectBuffer(dst.remaining()); int n = readIntoNativeBuffer(fd, bb, position, nd, lock); bb.flip(); if (n > 0) diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/rmi/transport/ObjectTable.java --- a/jdk/src/share/classes/sun/rmi/transport/ObjectTable.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/rmi/transport/ObjectTable.java Wed Jul 05 17:42:05 2017 +0200 @@ -175,25 +175,26 @@ DGCImpl.dgcLog.log(Log.VERBOSE, "add object " + oe); } - Remote impl = target.getImpl(); - if (impl == null) { - throw new ExportException( - "internal error: attempt to export collected object"); - } + synchronized (tableLock) { + /** + * Do nothing if impl has already been collected (see 6597112). Check while + * holding tableLock to ensure that Reaper cannot process weakImpl in between + * null check and put/increment effects. + */ + if (target.getImpl() != null) { + if (objTable.containsKey(oe)) { + throw new ExportException( + "internal error: ObjID already in use"); + } else if (implTable.containsKey(weakImpl)) { + throw new ExportException("object already exported"); + } - synchronized (tableLock) { - if (objTable.containsKey(oe)) { - throw new ExportException( - "internal error: ObjID already in use"); - } else if (implTable.containsKey(weakImpl)) { - throw new ExportException("object already exported"); - } + objTable.put(oe, target); + implTable.put(weakImpl, target); - objTable.put(oe, target); - implTable.put(weakImpl, target); - - if (!target.isPermanent()) { - incrementKeepAliveCount(); + if (!target.isPermanent()) { + incrementKeepAliveCount(); + } } } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/jgss/krb5/InitSecContextToken.java --- a/jdk/src/share/classes/sun/security/jgss/krb5/InitSecContextToken.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/jgss/krb5/InitSecContextToken.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -127,8 +127,8 @@ //System.out.println("Sub-Session Key Missing in Authenticator.\n"); } - OverloadedChecksum gssChecksum = - new OverloadedChecksum(context, apReq.getChecksum(), sessionKey); + OverloadedChecksum gssChecksum = new OverloadedChecksum( + context, apReq.getChecksum(), sessionKey, subKey); gssChecksum.setContextFlags(context); Credentials delegCred = gssChecksum.getDelegatedCreds(); if (delegCred != null) { diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/jgss/krb5/InitialToken.java --- a/jdk/src/share/classes/sun/security/jgss/krb5/InitialToken.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/jgss/krb5/InitialToken.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -210,8 +210,8 @@ // be passed in if this checksum type denotes a // raw_checksum. In that case, make Checksum class krb5 // internal. - public OverloadedChecksum(Krb5Context context, - Checksum checksum, EncryptionKey key) + public OverloadedChecksum(Krb5Context context, Checksum checksum, + EncryptionKey key, EncryptionKey subKey) throws GSSException, KrbException, IOException { int pos = 0; @@ -283,9 +283,17 @@ new KrbCred(credBytes, EncryptionKey.NULL_KEY). getDelegatedCreds()[0]; } else { - delegCreds = - new KrbCred(credBytes, key). - getDelegatedCreds()[0]; + KrbCred cred; + try { + cred = new KrbCred(credBytes, key); + } catch (KrbException e) { + if (subKey != null) { + cred = new KrbCred(credBytes, subKey); + } else { + throw e; + } + } + delegCreds = cred.getDelegatedCreds()[0]; } } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/krb5/KrbApReq.java --- a/jdk/src/share/classes/sun/security/krb5/KrbApReq.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/krb5/KrbApReq.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,6 +37,7 @@ import java.net.InetAddress; import sun.security.util.*; import java.io.IOException; +import java.util.Arrays; /** * This class encapsulates a KRB-AP-REQ that a client sends to a @@ -54,9 +55,6 @@ private static CacheTable table = new CacheTable(); private static boolean DEBUG = Krb5.DEBUG; - // default is address-less tickets - private boolean KDC_EMPTY_ADDRESSES_ALLOWED = true; - /** * Contructs a AP-REQ message to send to the peer. * @param tgsCred the Credentials to be used to construct the @@ -312,23 +310,19 @@ table.put(client, time, currTime.getTime()); } - // check to use addresses in tickets - if (Config.getInstance().useAddresses()) { - KDC_EMPTY_ADDRESSES_ALLOWED = false; - } - - // sender host address - HostAddress sender = null; if (initiator != null) { - sender = new HostAddress(initiator); - } - - if (sender != null || !KDC_EMPTY_ADDRESSES_ALLOWED) { - if (enc_ticketPart.caddr != null) { - if (sender == null) - throw new KrbApErrException(Krb5.KRB_AP_ERR_BADADDR); - if (!enc_ticketPart.caddr.inList(sender)) - throw new KrbApErrException(Krb5.KRB_AP_ERR_BADADDR); + // sender host address + HostAddress sender = new HostAddress(initiator); + if (enc_ticketPart.caddr != null + && !enc_ticketPart.caddr.inList(sender)) { + if (DEBUG) { + System.out.println(">>> KrbApReq: initiator is " + + sender.getInetAddress() + + ", but caddr is " + + Arrays.toString( + enc_ticketPart.caddr.getInetAddresses())); + } + throw new KrbApErrException(Krb5.KRB_AP_ERR_BADADDR); } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/krb5/internal/NetClient.java --- a/jdk/src/share/classes/sun/security/krb5/internal/NetClient.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/krb5/internal/NetClient.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,7 +59,8 @@ TCPClient(String hostname, int port, int timeout) throws IOException { - tcpSocket = new Socket(hostname, port); + tcpSocket = new Socket(); + tcpSocket.connect(new InetSocketAddress(hostname, port), timeout); out = new BufferedOutputStream(tcpSocket.getOutputStream()); in = new BufferedInputStream(tcpSocket.getInputStream()); tcpSocket.setSoTimeout(timeout); diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/pkcs/PKCS7.java --- a/jdk/src/share/classes/sun/security/pkcs/PKCS7.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/pkcs/PKCS7.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,6 +38,7 @@ import sun.security.util.*; import sun.security.x509.AlgorithmId; import sun.security.x509.CertificateIssuerName; +import sun.security.x509.KeyUsageExtension; import sun.security.x509.X509CertImpl; import sun.security.x509.X509CertInfo; import sun.security.x509.X509CRLImpl; @@ -492,7 +493,7 @@ // CRLs (optional) if (crls != null && crls.length != 0) { // cast to X509CRLImpl[] since X509CRLImpl implements DerEncoder - Set implCRLs = new HashSet(crls.length); + Set implCRLs = new HashSet<>(crls.length); for (X509CRL crl: crls) { if (crl instanceof X509CRLImpl) implCRLs.add((X509CRLImpl) crl); @@ -530,6 +531,168 @@ } /** + * Verifying signed data using an external chunked data source. + */ + public static class PKCS7Verifier { + + private final SignerInfo si; // Signer to verify + private final MessageDigest md; // MessageDigest object for chunks + private final Signature sig; // Signature object for chunks + + private PKCS7Verifier(SignerInfo si, MessageDigest md, Signature sig) { + this.si = si; + this.md = md; + this.sig = sig; + } + + public static PKCS7Verifier from(PKCS7 block, SignerInfo si) throws + SignatureException, NoSuchAlgorithmException { + + try { + MessageDigest md = null; + Signature sig; + + ContentInfo content = block.getContentInfo(); + String digestAlgname = si.getDigestAlgorithmId().getName(); + + // if there are authenticate attributes, feed data chunks to + // the message digest. In this case, pv.md is not null + if (si.authenticatedAttributes != null) { + // first, check content type + ObjectIdentifier contentType = (ObjectIdentifier) + si.authenticatedAttributes.getAttributeValue( + PKCS9Attribute.CONTENT_TYPE_OID); + if (contentType == null || + !contentType.equals(content.contentType)) + return null; // contentType does not match, bad SignerInfo + + // now, check message digest + byte[] messageDigest = (byte[]) + si.authenticatedAttributes.getAttributeValue( + PKCS9Attribute.MESSAGE_DIGEST_OID); + + if (messageDigest == null) // fail if there is no message digest + return null; + + md = MessageDigest.getInstance(digestAlgname); + } + + // put together digest algorithm and encryption algorithm + // to form signing algorithm + String encryptionAlgname = + si.getDigestEncryptionAlgorithmId().getName(); + + // Workaround: sometimes the encryptionAlgname is actually + // a signature name + String tmp = AlgorithmId.getEncAlgFromSigAlg(encryptionAlgname); + if (tmp != null) encryptionAlgname = tmp; + String algname = AlgorithmId.makeSigAlg( + digestAlgname, encryptionAlgname); + + sig = Signature.getInstance(algname); + X509Certificate cert = si.getCertificate(block); + + if (cert == null) { + return null; + } + if (cert.hasUnsupportedCriticalExtension()) { + throw new SignatureException("Certificate has unsupported " + + "critical extension(s)"); + } + + // Make sure that if the usage of the key in the certificate is + // restricted, it can be used for digital signatures. + // XXX We may want to check for additional extensions in the + // future. + boolean[] keyUsageBits = cert.getKeyUsage(); + if (keyUsageBits != null) { + KeyUsageExtension keyUsage; + try { + // We don't care whether or not this extension was marked + // critical in the certificate. + // We're interested only in its value (i.e., the bits set) + // and treat the extension as critical. + keyUsage = new KeyUsageExtension(keyUsageBits); + } catch (IOException ioe) { + throw new SignatureException("Failed to parse keyUsage " + + "extension"); + } + + boolean digSigAllowed = ((Boolean)keyUsage.get( + KeyUsageExtension.DIGITAL_SIGNATURE)).booleanValue(); + + boolean nonRepuAllowed = ((Boolean)keyUsage.get( + KeyUsageExtension.NON_REPUDIATION)).booleanValue(); + + if (!digSigAllowed && !nonRepuAllowed) { + throw new SignatureException("Key usage restricted: " + + "cannot be used for " + + "digital signatures"); + } + } + + PublicKey key = cert.getPublicKey(); + sig.initVerify(key); + return new PKCS7Verifier(si, md, sig); + } catch (IOException e) { + throw new SignatureException("IO error verifying signature:\n" + + e.getMessage()); + + } catch (InvalidKeyException e) { + throw new SignatureException("InvalidKey: " + e.getMessage()); + + } + } + + public void update(byte[] data, int off, int end) + throws SignatureException { + if (md != null) { + md.update(data, off, end-off); + } else { + sig.update(data, off, end-off); + } + } + + public SignerInfo verify() throws SignatureException { + try { + // if there are authenticate attributes, get the message + // digest and compare it with the digest of data + if (md != null) { + // now, check message digest + byte[] messageDigest = (byte[]) + si.authenticatedAttributes.getAttributeValue( + PKCS9Attribute.MESSAGE_DIGEST_OID); + + byte[] computedMessageDigest = md.digest(); + + if (!MessageDigest.isEqual( + messageDigest, computedMessageDigest)) { + return null; + } + + // message digest attribute matched + // digest of original data + + // the data actually signed is the DER encoding of + // the authenticated attributes (tagged with + // the "SET OF" tag, not 0xA0). + byte[] dataSigned = si.authenticatedAttributes.getDerEncoding(); + sig.update(dataSigned); + } + + if (sig.verify(si.getEncryptedDigest())) { + return si; + } + + } catch (IOException e) { + throw new SignatureException("IO error verifying signature:\n" + + e.getMessage()); + } + return null; + } + } + + /** * This verifies a given SignerInfo. * * @param info the signer information. @@ -554,19 +717,16 @@ public SignerInfo[] verify(byte[] bytes) throws NoSuchAlgorithmException, SignatureException { - Vector intResult = new Vector(); + List intResult = new ArrayList<>(); for (int i = 0; i < signerInfos.length; i++) { SignerInfo signerInfo = verify(signerInfos[i], bytes); if (signerInfo != null) { - intResult.addElement(signerInfo); + intResult.add(signerInfo); } } - if (intResult.size() != 0) { - - SignerInfo[] result = new SignerInfo[intResult.size()]; - intResult.copyInto(result); - return result; + if (!intResult.isEmpty()) { + return intResult.toArray(new SignerInfo[intResult.size()]); } return null; } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/pkcs/SignerInfo.java --- a/jdk/src/share/classes/sun/security/pkcs/SignerInfo.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/pkcs/SignerInfo.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -230,7 +230,7 @@ if (userCert == null) return null; - ArrayList certList = new ArrayList(); + ArrayList certList = new ArrayList<>(); certList.add(userCert); X509Certificate[] pkcsCerts = block.getCertificates(); @@ -276,132 +276,20 @@ /* Returns null if verify fails, this signerInfo if verify succeeds. */ SignerInfo verify(PKCS7 block, byte[] data) - throws NoSuchAlgorithmException, SignatureException { - - try { - - ContentInfo content = block.getContentInfo(); - if (data == null) { - data = content.getContentBytes(); - } - - String digestAlgname = getDigestAlgorithmId().getName(); - - byte[] dataSigned; - - // if there are authenticate attributes, get the message - // digest and compare it with the digest of data - if (authenticatedAttributes == null) { - dataSigned = data; - } else { - - // first, check content type - ObjectIdentifier contentType = (ObjectIdentifier) - authenticatedAttributes.getAttributeValue( - PKCS9Attribute.CONTENT_TYPE_OID); - if (contentType == null || - !contentType.equals(content.contentType)) - return null; // contentType does not match, bad SignerInfo - - // now, check message digest - byte[] messageDigest = (byte[]) - authenticatedAttributes.getAttributeValue( - PKCS9Attribute.MESSAGE_DIGEST_OID); - - if (messageDigest == null) // fail if there is no message digest - return null; - - MessageDigest md = MessageDigest.getInstance(digestAlgname); - byte[] computedMessageDigest = md.digest(data); - - if (messageDigest.length != computedMessageDigest.length) - return null; - for (int i = 0; i < messageDigest.length; i++) { - if (messageDigest[i] != computedMessageDigest[i]) - return null; - } - - // message digest attribute matched - // digest of original data - - // the data actually signed is the DER encoding of - // the authenticated attributes (tagged with - // the "SET OF" tag, not 0xA0). - dataSigned = authenticatedAttributes.getDerEncoding(); - } - - // put together digest algorithm and encryption algorithm - // to form signing algorithm - String encryptionAlgname = - getDigestEncryptionAlgorithmId().getName(); + throws NoSuchAlgorithmException, SignatureException { - // Workaround: sometimes the encryptionAlgname is actually - // a signature name - String tmp = AlgorithmId.getEncAlgFromSigAlg(encryptionAlgname); - if (tmp != null) encryptionAlgname = tmp; - String algname = AlgorithmId.makeSigAlg( - digestAlgname, encryptionAlgname); - - Signature sig = Signature.getInstance(algname); - X509Certificate cert = getCertificate(block); - - if (cert == null) { - return null; - } - if (cert.hasUnsupportedCriticalExtension()) { - throw new SignatureException("Certificate has unsupported " - + "critical extension(s)"); + PKCS7.PKCS7Verifier p7v = PKCS7.PKCS7Verifier.from(block, this); + if (p7v == null) return null; + if (data == null) { + try { + data = block.getContentInfo().getContentBytes(); + } catch (IOException e) { + throw new SignatureException("IO error verifying signature:\n" + + e.getMessage()); } - - // Make sure that if the usage of the key in the certificate is - // restricted, it can be used for digital signatures. - // XXX We may want to check for additional extensions in the - // future. - boolean[] keyUsageBits = cert.getKeyUsage(); - if (keyUsageBits != null) { - KeyUsageExtension keyUsage; - try { - // We don't care whether or not this extension was marked - // critical in the certificate. - // We're interested only in its value (i.e., the bits set) - // and treat the extension as critical. - keyUsage = new KeyUsageExtension(keyUsageBits); - } catch (IOException ioe) { - throw new SignatureException("Failed to parse keyUsage " - + "extension"); - } - - boolean digSigAllowed = ((Boolean)keyUsage.get( - KeyUsageExtension.DIGITAL_SIGNATURE)).booleanValue(); - - boolean nonRepuAllowed = ((Boolean)keyUsage.get( - KeyUsageExtension.NON_REPUDIATION)).booleanValue(); - - if (!digSigAllowed && !nonRepuAllowed) { - throw new SignatureException("Key usage restricted: " - + "cannot be used for " - + "digital signatures"); - } - } - - PublicKey key = cert.getPublicKey(); - sig.initVerify(key); - - sig.update(dataSigned); - - if (sig.verify(encryptedDigest)) { - return this; - } - - } catch (IOException e) { - throw new SignatureException("IO error verifying signature:\n" + - e.getMessage()); - - } catch (InvalidKeyException e) { - throw new SignatureException("InvalidKey: " + e.getMessage()); - } - return null; + p7v.update(data, 0, data.length); + return p7v.verify(); } /* Verify the content of the pkcs7 block. */ diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/pkcs11/Config.java --- a/jdk/src/share/classes/sun/security/pkcs11/Config.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/pkcs11/Config.java Wed Jul 05 17:42:05 2017 +0200 @@ -343,6 +343,7 @@ st.wordChars('{', '{'); // need {} for property subst st.wordChars('}', '}'); st.wordChars('*', '*'); + st.wordChars('+', '+'); st.wordChars('~', '~'); // XXX check ASCII table and add all other characters except special diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/pkcs11/SessionManager.java --- a/jdk/src/share/classes/sun/security/pkcs11/SessionManager.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/pkcs11/SessionManager.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -76,6 +76,9 @@ // maximum number of sessions to open with this token private final int maxSessions; + // total number of active sessions + private int activeSessions; + // pool of available object sessions private final Pool objSessions; @@ -115,11 +118,6 @@ return (maxSessions <= DEFAULT_MAX_SESSIONS); } - // returns the total number of active sessions - int totalSessionCount() { - return SessionRef.totalCount(); - } - synchronized Session getObjSession() throws PKCS11Exception { Session session = objSessions.poll(); if (session != null) { @@ -141,7 +139,7 @@ // create a new session rather than re-using an obj session // that avoids potential expensive cancels() for Signatures & RSACipher if (maxSessions == Integer.MAX_VALUE || - totalSessionCount() < maxSessions) { + activeSessions < maxSessions) { session = openSession(); return ensureValid(session); } @@ -164,7 +162,7 @@ if (debug != null) { String location = new Exception().getStackTrace()[2].toString(); System.out.println("Killing session (" + location + ") active: " - + totalSessionCount()); + + activeSessions); } closeSession(session); return null; @@ -189,7 +187,7 @@ } if (debug != null) { System.out.println("Demoting session, active: " + - totalSessionCount()); + activeSessions); } boolean present = objSessions.remove(session); if (present == false) { @@ -202,16 +200,16 @@ private Session openSession() throws PKCS11Exception { if ((maxSessions != Integer.MAX_VALUE) && - (totalSessionCount() >= maxSessions)) { + (activeSessions >= maxSessions)) { throw new ProviderException("No more sessions available"); } long id = token.p11.C_OpenSession (token.provider.slotID, openSessionFlags, null, null); Session session = new Session(token, id); + activeSessions++; if (debug != null) { - int currTotal = totalSessionCount(); - if (currTotal > maxActiveSessions) { - maxActiveSessions = currTotal; + if (activeSessions > maxActiveSessions) { + maxActiveSessions = activeSessions; if (maxActiveSessions % 10 == 0) { System.out.println("Open sessions: " + maxActiveSessions); } @@ -222,6 +220,7 @@ private void closeSession(Session session) { session.close(); + activeSessions--; } private static final class Pool { @@ -275,7 +274,7 @@ } if (debug != null) { System.out.println("Closing " + i + " idle sessions, active: " - + mgr.totalSessionCount()); + + mgr.activeSessions); } List subList = pool.subList(0, i); subList.clear(); diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java --- a/jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -249,7 +249,7 @@ throws CertPathValidatorException { verifyRevocationStatus(currCert, prevKey, signFlag, - allowSeparateKey, null); + allowSeparateKey, null, mParams.getTrustAnchors()); } /** @@ -260,11 +260,12 @@ * circular dependencies, we assume they're * revoked while checking the revocation * status of this cert. + * @param trustAnchors a Set of TrustAnchors */ private void verifyRevocationStatus(X509Certificate currCert, PublicKey prevKey, boolean signFlag, boolean allowSeparateKey, - Set stackedCerts) throws CertPathValidatorException - { + Set stackedCerts, + Set trustAnchors) throws CertPathValidatorException { String msg = "revocation status"; if (debug != null) { @@ -311,7 +312,7 @@ DistributionPointFetcher.getInstance(); // all CRLs returned by the DP Fetcher have also been verified mApprovedCRLs.addAll(store.getCRLs(sel, signFlag, prevKey, - mSigProvider, mStores, reasonsMask, mAnchor)); + mSigProvider, mStores, reasonsMask, trustAnchors)); } catch (Exception e) { if (debug != null) { debug.println("CrlRevocationChecker.verifyRevocationStatus() " @@ -328,7 +329,7 @@ // Now that we have a list of possible CRLs, see which ones can // be approved mApprovedCRLs.addAll(verifyPossibleCRLs(mPossibleCRLs, currCert, - signFlag, prevKey, reasonsMask)); + signFlag, prevKey, reasonsMask, trustAnchors)); } if (debug != null) { debug.println("CrlRevocationChecker.verifyRevocationStatus() " + @@ -353,9 +354,10 @@ // See if the cert is in the set of approved crls. if (debug != null) { BigInteger sn = currCert.getSerialNumber(); - debug.println("starting the final sweep..."); + debug.println("CrlRevocationChecker.verifyRevocationStatus() " + + "starting the final sweep..."); debug.println("CrlRevocationChecker.verifyRevocationStatus" + - " cert SN: " + sn.toString()); + " cert SN: " + sn.toString()); } CRLReason reasonCode = CRLReason.UNSPECIFIED; @@ -497,9 +499,9 @@ certSel.setSubject(currCert.getIssuerX500Principal()); certSel.setKeyUsage(mCrlSignUsage); - Set newAnchors = mAnchor == null - ? mParams.getTrustAnchors() - : Collections.singleton(mAnchor); + Set newAnchors = + (mAnchor == null ? mParams.getTrustAnchors() : + Collections.singleton(mAnchor)); PKIXBuilderParameters builderParams; if (mParams instanceof PKIXBuilderParameters) { @@ -617,8 +619,8 @@ debug.println("CrlRevocationChecker.buildToNewKey()" + " index " + i + " checking " + cert); } - verifyRevocationStatus(cert, prevKey2, signFlag, - true, stackedCerts); + verifyRevocationStatus(cert, prevKey2, signFlag, true, + stackedCerts, newAnchors); signFlag = certCanSignCrl(cert); prevKey2 = cert.getPublicKey(); } @@ -727,12 +729,14 @@ * @param signFlag true if prevKey was trusted to sign CRLs * @param prevKey the public key of the issuer of cert * @param reasonsMask the reason code mask + * @param trustAnchors a Set of TrustAnchors> * @return a collection of approved crls (or an empty collection) */ private Collection verifyPossibleCRLs(Set crls, X509Certificate cert, boolean signFlag, PublicKey prevKey, - boolean[] reasonsMask) throws CertPathValidatorException - { + boolean[] reasonsMask, + Set trustAnchors) throws CertPathValidatorException { + try { X509CertImpl certImpl = X509CertImpl.toImpl(cert); if (debug != null) { @@ -764,7 +768,8 @@ DistributionPoint point = t.next(); for (X509CRL crl : crls) { if (dpf.verifyCRL(certImpl, point, crl, reasonsMask, - signFlag, prevKey, mSigProvider, mAnchor, mStores)) { + signFlag, prevKey, mSigProvider, + trustAnchors, mStores)) { results.add(crl); } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java --- a/jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java Wed Jul 05 17:42:05 2017 +0200 @@ -90,8 +90,9 @@ */ Collection getCRLs(X509CRLSelector selector, boolean signFlag, PublicKey prevKey, String provider, List certStores, - boolean[] reasonsMask, TrustAnchor anchor) throws CertStoreException - { + boolean[] reasonsMask, + Set trustAnchors) throws CertStoreException { + if (USE_CRLDP == false) { return Collections.emptySet(); } @@ -121,7 +122,7 @@ DistributionPoint point = t.next(); Collection crls = getCRLs(selector, certImpl, point, reasonsMask, signFlag, prevKey, provider, - certStores, anchor); + certStores, trustAnchors); results.addAll(crls); } if (debug != null) { @@ -142,8 +143,8 @@ private Collection getCRLs(X509CRLSelector selector, X509CertImpl certImpl, DistributionPoint point, boolean[] reasonsMask, boolean signFlag, PublicKey prevKey, String provider, - List certStores, TrustAnchor anchor) - { + List certStores, Set trustAnchors) { + // check for full name GeneralNames fullName = point.getFullName(); if (fullName == null) { @@ -194,7 +195,7 @@ // we check the issuer in verifyCRLs method selector.setIssuerNames(null); if (selector.match(crl) && verifyCRL(certImpl, point, crl, - reasonsMask, signFlag, prevKey, provider, anchor, + reasonsMask, signFlag, prevKey, provider, trustAnchors, certStores)) { crls.add(crl); } @@ -276,12 +277,17 @@ * @param signFlag true if prevKey can be used to verify the CRL * @param prevKey the public key that verifies the certificate's signature * @param provider the Signature provider to use + * @param trustAnchors a {@code Set} of {@code TrustAnchor}s + * @param certStores a {@code List} of {@code CertStore}s to be used in + * finding certificates and CRLs * @return true if ok, false if not */ boolean verifyCRL(X509CertImpl certImpl, DistributionPoint point, X509CRL crl, boolean[] reasonsMask, boolean signFlag, - PublicKey prevKey, String provider, TrustAnchor anchor, + PublicKey prevKey, String provider, + Set trustAnchors, List certStores) throws CRLException, IOException { + boolean indirectCRL = false; X509CRLImpl crlImpl = X509CRLImpl.toImpl(crl); IssuingDistributionPointExtension idpExt = @@ -335,7 +341,16 @@ byte[] crlAKID = crlImpl.getExtensionValue( PKIXExtensions.AuthorityKey_Id.toString()); - if (!Arrays.equals(certAKID, crlAKID)) { + if (certAKID == null || crlAKID == null) { + // cannot recognize indirect CRL without AKID + + // we accept the case that a CRL issuer provide status + // information for itself. + if (issues(certImpl, crlImpl, provider)) { + // reset the public key used to verify the CRL's signature + prevKey = certImpl.getPublicKey(); + } + } else if (!Arrays.equals(certAKID, crlAKID)) { // we accept the case that a CRL issuer provide status // information for itself. if (issues(certImpl, crlImpl, provider)) { @@ -572,46 +587,19 @@ // Except the performance improvement, another benefit is to break // the dead loop while looking for the issuer back and forth // between the delegated self-issued certificate and its issuer. - Set trustAnchors = new HashSet(); - if (anchor != null) { - trustAnchors.add(anchor); - } + Set newTrustAnchors = new HashSet<>(trustAnchors); if (prevKey != null) { - // if the previous key is of the anchor, don't bother to - // duplicate the trust. - boolean duplicated = false; - PublicKey publicKey = prevKey; + // Add the previous certificate as a trust anchor. X500Principal principal = certImpl.getIssuerX500Principal(); - - if (anchor != null) { - X509Certificate trustedCert = anchor.getTrustedCert(); - X500Principal trustedPrincipal; - PublicKey trustedPublicKey; - if (trustedCert != null) { - trustedPrincipal = trustedCert.getSubjectX500Principal(); - trustedPublicKey = trustedCert.getPublicKey(); - } else { - trustedPrincipal = anchor.getCA(); - trustedPublicKey = anchor.getCAPublicKey(); - } - - if (principal.equals(trustedPrincipal) && - publicKey.equals(trustedPublicKey)) { - duplicated = true; - } - } - - if (!duplicated) { - TrustAnchor temporary = - new TrustAnchor(principal, publicKey, null); - trustAnchors.add(temporary); - } + TrustAnchor temporary = + new TrustAnchor(principal, prevKey, null); + newTrustAnchors.add(temporary); } PKIXBuilderParameters params = null; try { - params = new PKIXBuilderParameters(trustAnchors, certSel); + params = new PKIXBuilderParameters(newTrustAnchors, certSel); } catch (InvalidAlgorithmParameterException iape) { throw new CRLException(iape); } @@ -697,6 +685,8 @@ private static boolean issues(X509CertImpl cert, X509CRLImpl crl, String provider) throws IOException { + boolean matched = false; + AdaptableX509CertSelector issuerSelector = new AdaptableX509CertSelector(); @@ -719,9 +709,24 @@ * and MUST include authority key identifier extension in all CRLs * issued. [section 5.2.1, RFC 2459] */ - issuerSelector.parseAuthorityKeyIdentifierExtension( - crl.getAuthKeyIdExtension()); + AuthorityKeyIdentifierExtension crlAKID = crl.getAuthKeyIdExtension(); + if (crlAKID != null) { + issuerSelector.parseAuthorityKeyIdentifierExtension(crlAKID); + } + + matched = issuerSelector.match(cert); - return issuerSelector.match(cert); + // if AKID is unreliable, verify the CRL signature with the cert + if (matched && (crlAKID == null || + cert.getAuthorityKeyIdentifierExtension() == null)) { + try { + crl.verify(cert.getPublicKey(), provider); + matched = true; + } catch (Exception e) { + matched = false; + } + } + + return matched; } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/ssl/CipherSuiteList.java --- a/jdk/src/share/classes/sun/security/ssl/CipherSuiteList.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/ssl/CipherSuiteList.java Wed Jul 05 17:42:05 2017 +0200 @@ -40,10 +40,6 @@ */ final class CipherSuiteList { - // lists of supported and default enabled ciphersuites - // created on demand - private static CipherSuiteList supportedSuites, defaultSuites; - private final Collection cipherSuites; private String[] suiteNames; @@ -206,57 +202,8 @@ */ static synchronized void clearAvailableCache() { if (CipherSuite.DYNAMIC_AVAILABILITY) { - supportedSuites = null; - defaultSuites = null; CipherSuite.BulkCipher.clearAvailableCache(); JsseJce.clearEcAvailable(); } } - - /** - * Return the list of all available CipherSuites with a priority of - * minPriority or above. - * Should be called with the Class lock held. - */ - private static CipherSuiteList buildAvailableCache(int minPriority) { - // SortedSet automatically arranges ciphersuites in default - // preference order - Set cipherSuites = new TreeSet<>(); - Collection allowedCipherSuites = - CipherSuite.allowedCipherSuites(); - for (CipherSuite c : allowedCipherSuites) { - if ((c.allowed == false) || (c.priority < minPriority)) { - continue; - } - - if (c.isAvailable()) { - cipherSuites.add(c); - } - } - - return new CipherSuiteList(cipherSuites); - } - - /** - * Return supported CipherSuites in preference order. - */ - static synchronized CipherSuiteList getSupported() { - if (supportedSuites == null) { - supportedSuites = - buildAvailableCache(CipherSuite.SUPPORTED_SUITES_PRIORITY); - } - return supportedSuites; - } - - /** - * Return default enabled CipherSuites in preference order. - */ - static synchronized CipherSuiteList getDefault() { - if (defaultSuites == null) { - defaultSuites = - buildAvailableCache(CipherSuite.DEFAULT_SUITES_PRIORITY); - } - return defaultSuites; - } - } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/ssl/DefaultSSLContextImpl.java --- a/jdk/src/share/classes/sun/security/ssl/DefaultSSLContextImpl.java Thu Apr 21 15:32:48 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.security.ssl; - -import java.io.*; -import java.util.*; - -import java.security.*; - -import javax.net.ssl.*; - -/** - * "Default" SSLContext as returned by SSLContext.getDefault(). It comes - * initialized with default KeyManagers and TrustManagers created using - * various system properties. - * - * @since 1.6 - */ -public final class DefaultSSLContextImpl extends SSLContextImpl { - - private static final String NONE = "NONE"; - private static final String P11KEYSTORE = "PKCS11"; - private static final Debug debug = Debug.getInstance("ssl"); - - private static volatile SSLContextImpl defaultImpl; - - private static TrustManager[] defaultTrustManagers; - - private static KeyManager[] defaultKeyManagers; - - public DefaultSSLContextImpl() throws Exception { - super(defaultImpl); - try { - super.engineInit(getDefaultKeyManager(), getDefaultTrustManager(), null); - } catch (Exception e) { - if (debug != null && Debug.isOn("defaultctx")) { - System.out.println("default context init failed: " + e); - } - throw e; - } - if (defaultImpl == null) { - defaultImpl = this; - } - } - - protected void engineInit(KeyManager[] km, TrustManager[] tm, - SecureRandom sr) throws KeyManagementException { - throw new KeyManagementException - ("Default SSLContext is initialized automatically"); - } - - static synchronized SSLContextImpl getDefaultImpl() throws Exception { - if (defaultImpl == null) { - new DefaultSSLContextImpl(); - } - return defaultImpl; - } - - private static synchronized TrustManager[] getDefaultTrustManager() throws Exception { - if (defaultTrustManagers != null) { - return defaultTrustManagers; - } - - KeyStore ks = TrustManagerFactoryImpl.getCacertsKeyStore("defaultctx"); - - TrustManagerFactory tmf = TrustManagerFactory.getInstance( - TrustManagerFactory.getDefaultAlgorithm()); - tmf.init(ks); - defaultTrustManagers = tmf.getTrustManagers(); - return defaultTrustManagers; - } - - private static synchronized KeyManager[] getDefaultKeyManager() throws Exception { - if (defaultKeyManagers != null) { - return defaultKeyManagers; - } - - final Map props = new HashMap<>(); - AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public Object run() throws Exception { - props.put("keyStore", System.getProperty( - "javax.net.ssl.keyStore", "")); - props.put("keyStoreType", System.getProperty( - "javax.net.ssl.keyStoreType", - KeyStore.getDefaultType())); - props.put("keyStoreProvider", System.getProperty( - "javax.net.ssl.keyStoreProvider", "")); - props.put("keyStorePasswd", System.getProperty( - "javax.net.ssl.keyStorePassword", "")); - return null; - } - }); - - final String defaultKeyStore = props.get("keyStore"); - String defaultKeyStoreType = props.get("keyStoreType"); - String defaultKeyStoreProvider = props.get("keyStoreProvider"); - if (debug != null && Debug.isOn("defaultctx")) { - System.out.println("keyStore is : " + defaultKeyStore); - System.out.println("keyStore type is : " + - defaultKeyStoreType); - System.out.println("keyStore provider is : " + - defaultKeyStoreProvider); - } - - if (P11KEYSTORE.equals(defaultKeyStoreType) && - !NONE.equals(defaultKeyStore)) { - throw new IllegalArgumentException("if keyStoreType is " - + P11KEYSTORE + ", then keyStore must be " + NONE); - } - - FileInputStream fs = null; - if (defaultKeyStore.length() != 0 && !NONE.equals(defaultKeyStore)) { - fs = AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public FileInputStream run() throws Exception { - return new FileInputStream(defaultKeyStore); - } - }); - } - - String defaultKeyStorePassword = props.get("keyStorePasswd"); - char[] passwd = null; - if (defaultKeyStorePassword.length() != 0) { - passwd = defaultKeyStorePassword.toCharArray(); - } - - /** - * Try to initialize key store. - */ - KeyStore ks = null; - if ((defaultKeyStoreType.length()) != 0) { - if (debug != null && Debug.isOn("defaultctx")) { - System.out.println("init keystore"); - } - if (defaultKeyStoreProvider.length() == 0) { - ks = KeyStore.getInstance(defaultKeyStoreType); - } else { - ks = KeyStore.getInstance(defaultKeyStoreType, - defaultKeyStoreProvider); - } - - // if defaultKeyStore is NONE, fs will be null - ks.load(fs, passwd); - } - if (fs != null) { - fs.close(); - fs = null; - } - - /* - * Try to initialize key manager. - */ - if (debug != null && Debug.isOn("defaultctx")) { - System.out.println("init keymanager of type " + - KeyManagerFactory.getDefaultAlgorithm()); - } - KeyManagerFactory kmf = KeyManagerFactory.getInstance( - KeyManagerFactory.getDefaultAlgorithm()); - - if (P11KEYSTORE.equals(defaultKeyStoreType)) { - kmf.init(ks, null); // do not pass key passwd if using token - } else { - kmf.init(ks, passwd); - } - - defaultKeyManagers = kmf.getKeyManagers(); - return defaultKeyManagers; - } -} diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/ssl/JsseJce.java --- a/jdk/src/share/classes/sun/security/ssl/JsseJce.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/ssl/JsseJce.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -247,9 +247,9 @@ // the SunJSSE implementation does the actual crypto using // a NONEwithRSA signature obtained from the cryptoProvider. if (cryptoProvider.getService("Signature", algorithm) == null) { - // Calling Signature.getInstance() and catching the exception - // would be cleaner, but exceptions are a little expensive. - // So we check directly via getService(). + // Calling Signature.getInstance() and catching the + // exception would be cleaner, but exceptions are a little + // expensive. So we check directly via getService(). try { return Signature.getInstance(algorithm, "SunJSSE"); } catch (NoSuchProviderException e) { diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/ssl/ProtocolList.java --- a/jdk/src/share/classes/sun/security/ssl/ProtocolList.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/ssl/ProtocolList.java Wed Jul 05 17:42:05 2017 +0200 @@ -37,10 +37,6 @@ */ final class ProtocolList { - private static final ProtocolList SUPPORTED; - private static final ProtocolList CLIENT_DEFAULT; - private static final ProtocolList SERVER_DEFAULT; - // the sorted protocol version list private final ArrayList protocols; @@ -154,66 +150,4 @@ public String toString() { return protocols.toString(); } - - /** - * Return the list of default enabled protocols. - */ - static ProtocolList getDefault(boolean isServer) { - return isServer ? SERVER_DEFAULT : CLIENT_DEFAULT; - } - - /** - * Return whether a protocol list is the original default enabled - * protocols. See: SSLSocket/SSLEngine.setEnabledProtocols() - */ - static boolean isDefaultProtocolList(ProtocolList protocols) { - return protocols == CLIENT_DEFAULT || protocols == SERVER_DEFAULT; - } - - /** - * Return the list of supported protocols. - */ - static ProtocolList getSupported() { - return SUPPORTED; - } - - static { - if (SunJSSE.isFIPS()) { - SUPPORTED = new ProtocolList(new String[] { - ProtocolVersion.TLS10.name, - ProtocolVersion.TLS11.name, - ProtocolVersion.TLS12.name - }); - - SERVER_DEFAULT = SUPPORTED; - CLIENT_DEFAULT = new ProtocolList(new String[] { - ProtocolVersion.TLS10.name - }); - } else { - SUPPORTED = new ProtocolList(new String[] { - ProtocolVersion.SSL20Hello.name, - ProtocolVersion.SSL30.name, - ProtocolVersion.TLS10.name, - ProtocolVersion.TLS11.name, - ProtocolVersion.TLS12.name - }); - - SERVER_DEFAULT = SUPPORTED; - - /* - * RFC 5246 says that sending SSLv2 backward-compatible - * hello SHOULD NOT be done any longer. - * - * We are not enabling TLS 1.1/1.2 by default yet on clients - * out of concern for interop with existing - * SSLv3/TLS1.0-only servers. When these versions of TLS - * gain more traction, we'll enable them. - */ - CLIENT_DEFAULT = new ProtocolList(new String[] { - ProtocolVersion.SSL30.name, - ProtocolVersion.TLS10.name - }); - } - } - } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java --- a/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ import java.net.Socket; +import java.io.*; import java.util.*; import java.security.*; import java.security.cert.*; @@ -36,7 +37,7 @@ import sun.security.provider.certpath.AlgorithmChecker; -public class SSLContextImpl extends SSLContextSpi { +public abstract class SSLContextImpl extends SSLContextSpi { private static final Debug debug = Debug.getInstance("ssl"); @@ -50,20 +51,24 @@ private X509TrustManager trustManager; private SecureRandom secureRandom; - public SSLContextImpl() { - this(null); - } + // The default algrithm constraints + private AlgorithmConstraints defaultAlgorithmConstraints = + new SSLAlgorithmConstraints(null); + + // supported and default protocols + private ProtocolList defaultServerProtocolList; + private ProtocolList defaultClientProtocolList; + private ProtocolList supportedProtocolList; - SSLContextImpl(SSLContextImpl other) { - if (other == null) { - ephemeralKeyManager = new EphemeralKeyManager(); - clientCache = new SSLSessionContextImpl(); - serverCache = new SSLSessionContextImpl(); - } else { - ephemeralKeyManager = other.ephemeralKeyManager; - clientCache = other.clientCache; - serverCache = other.serverCache; - } + // supported and default cipher suites + private CipherSuiteList defaultServerCipherSuiteList; + private CipherSuiteList defaultClientCipherSuiteList; + private CipherSuiteList supportedCipherSuiteList; + + SSLContextImpl() { + ephemeralKeyManager = new EphemeralKeyManager(); + clientCache = new SSLSessionContextImpl(); + serverCache = new SSLSessionContextImpl(); } protected void engineInit(KeyManager[] km, TrustManager[] tm, @@ -177,7 +182,7 @@ throw new IllegalStateException( "SSLContextImpl is not initialized"); } - return new SSLSocketFactoryImpl(this); + return new SSLSocketFactoryImpl(this); } protected SSLServerSocketFactory engineGetServerSocketFactory() { @@ -227,6 +232,535 @@ return ephemeralKeyManager; } + abstract SSLParameters getDefaultServerSSLParams(); + abstract SSLParameters getDefaultClientSSLParams(); + abstract SSLParameters getSupportedSSLParams(); + + // Get suported ProtoclList. + ProtocolList getSuportedProtocolList() { + if (supportedProtocolList == null) { + supportedProtocolList = + new ProtocolList(getSupportedSSLParams().getProtocols()); + } + + return supportedProtocolList; + } + + // Get default ProtoclList. + ProtocolList getDefaultProtocolList(boolean roleIsServer) { + if (roleIsServer) { + if (defaultServerProtocolList == null) { + defaultServerProtocolList = new ProtocolList( + getDefaultServerSSLParams().getProtocols()); + } + + return defaultServerProtocolList; + } else { + if (defaultClientProtocolList == null) { + defaultClientProtocolList = new ProtocolList( + getDefaultClientSSLParams().getProtocols()); + } + + return defaultClientProtocolList; + } + } + + // Get suported CipherSuiteList. + CipherSuiteList getSuportedCipherSuiteList() { + // Clear cache of available ciphersuites. + clearAvailableCache(); + + if (supportedCipherSuiteList == null) { + supportedCipherSuiteList = + getApplicableCipherSuiteList(getSuportedProtocolList(), false); + } + + return supportedCipherSuiteList; + } + + // Get default CipherSuiteList. + CipherSuiteList getDefaultCipherSuiteList(boolean roleIsServer) { + // Clear cache of available ciphersuites. + clearAvailableCache(); + + if (roleIsServer) { + if (defaultServerCipherSuiteList == null) { + defaultServerCipherSuiteList = getApplicableCipherSuiteList( + getDefaultProtocolList(true), true); + } + + return defaultServerCipherSuiteList; + } else { + if (defaultClientCipherSuiteList == null) { + defaultClientCipherSuiteList = getApplicableCipherSuiteList( + getDefaultProtocolList(false), true); + } + + return defaultClientCipherSuiteList; + } + } + + /** + * Return whether a protocol list is the original default enabled + * protocols. See: SSLSocket/SSLEngine.setEnabledProtocols() + */ + boolean isDefaultProtocolList(ProtocolList protocols) { + return (protocols == defaultServerProtocolList) || + (protocols == defaultClientProtocolList); + } + + + /* + * Return the list of all available CipherSuites with a priority of + * minPriority or above. + */ + private CipherSuiteList getApplicableCipherSuiteList( + ProtocolList protocols, boolean onlyEnabled) { + + int minPriority = CipherSuite.SUPPORTED_SUITES_PRIORITY; + if (onlyEnabled) { + minPriority = CipherSuite.DEFAULT_SUITES_PRIORITY; + } + + Collection allowedCipherSuites = + CipherSuite.allowedCipherSuites(); + + ArrayList suites = new ArrayList<>(); + if (!(protocols.collection().isEmpty()) && + protocols.min.v != ProtocolVersion.NONE.v) { + for (CipherSuite suite : allowedCipherSuites) { + if (suite.allowed == false || suite.priority < minPriority) { + continue; + } + + if (suite.isAvailable() && + suite.obsoleted > protocols.min.v && + suite.supported <= protocols.max.v) { + if (defaultAlgorithmConstraints.permits( + EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), + suite.name, null)) { + suites.add(suite); + } + } else if (debug != null && + Debug.isOn("sslctx") && Debug.isOn("verbose")) { + if (suite.obsoleted <= protocols.min.v) { + System.out.println( + "Ignoring obsoleted cipher suite: " + suite); + } else if (suite.supported > protocols.max.v) { + System.out.println( + "Ignoring unsupported cipher suite: " + suite); + } else { + System.out.println( + "Ignoring unavailable cipher suite: " + suite); + } + } + } + } + + return new CipherSuiteList(suites); + } + + /** + * Clear cache of available ciphersuites. If we support all ciphers + * internally, there is no need to clear the cache and calling this + * method has no effect. + */ + synchronized void clearAvailableCache() { + if (CipherSuite.DYNAMIC_AVAILABILITY) { + supportedCipherSuiteList = null; + defaultServerCipherSuiteList = null; + defaultClientCipherSuiteList = null; + CipherSuite.BulkCipher.clearAvailableCache(); + JsseJce.clearEcAvailable(); + } + } + + /* + * The SSLContext implementation for TLS/SSL algorithm + * + * SSL/TLS protocols specify the forward compatibility and version + * roll-back attack protections, however, a number of SSL/TLS server + * vendors did not implement these aspects properly, and some current + * SSL/TLS servers may refuse to talk to a TLS 1.1 or later client. + * + * Considering above interoperability issues, SunJSSE will not set + * TLS 1.1 and TLS 1.2 as the enabled protocols for client by default. + * + * For SSL/TLS servers, there is no such interoperability issues as + * SSL/TLS clients. In SunJSSE, TLS 1.1 or later version will be the + * enabled protocols for server by default. + * + * We may change the behavior when popular TLS/SSL vendors support TLS + * forward compatibility properly. + * + * SSLv2Hello is no longer necessary. This interoperability option was + * put in place in the late 90's when SSLv3/TLS1.0 were relatively new + * and there were a fair number of SSLv2-only servers deployed. Because + * of the security issues in SSLv2, it is rarely (if ever) used, as + * deployments should now be using SSLv3 and TLSv1. + * + * Considering the issues of SSLv2Hello, we should not enable SSLv2Hello + * by default. Applications still can use it by enabling SSLv2Hello with + * the series of setEnabledProtocols APIs. + */ + + /* + * The conservative SSLContext implementation for TLS, SSL, SSLv3 and + * TLS10 algorithm. + * + * This is a super class of DefaultSSLContext and TLS10Context. + * + * @see SSLContext + */ + private static class ConservativeSSLContext extends SSLContextImpl { + // parameters + private static SSLParameters defaultServerSSLParams; + private static SSLParameters defaultClientSSLParams; + private static SSLParameters supportedSSLParams; + + static { + if (SunJSSE.isFIPS()) { + supportedSSLParams = new SSLParameters(); + supportedSSLParams.setProtocols(new String[] { + ProtocolVersion.TLS10.name, + ProtocolVersion.TLS11.name, + ProtocolVersion.TLS12.name + }); + + defaultServerSSLParams = supportedSSLParams; + + defaultClientSSLParams = new SSLParameters(); + defaultClientSSLParams.setProtocols(new String[] { + ProtocolVersion.TLS10.name + }); + + } else { + supportedSSLParams = new SSLParameters(); + supportedSSLParams.setProtocols(new String[] { + ProtocolVersion.SSL20Hello.name, + ProtocolVersion.SSL30.name, + ProtocolVersion.TLS10.name, + ProtocolVersion.TLS11.name, + ProtocolVersion.TLS12.name + }); + + defaultServerSSLParams = supportedSSLParams; + + defaultClientSSLParams = new SSLParameters(); + defaultClientSSLParams.setProtocols(new String[] { + ProtocolVersion.SSL30.name, + ProtocolVersion.TLS10.name + }); + } + } + + SSLParameters getDefaultServerSSLParams() { + return defaultServerSSLParams; + } + + SSLParameters getDefaultClientSSLParams() { + return defaultClientSSLParams; + } + + SSLParameters getSupportedSSLParams() { + return supportedSSLParams; + } + } + + /* + * The SSLContext implementation for default algorithm + * + * @see SSLContext + */ + public static final class DefaultSSLContext extends ConservativeSSLContext { + private static final String NONE = "NONE"; + private static final String P11KEYSTORE = "PKCS11"; + + private static volatile SSLContextImpl defaultImpl; + + private static TrustManager[] defaultTrustManagers; + private static KeyManager[] defaultKeyManagers; + + public DefaultSSLContext() throws Exception { + try { + super.engineInit(getDefaultKeyManager(), + getDefaultTrustManager(), null); + } catch (Exception e) { + if (debug != null && Debug.isOn("defaultctx")) { + System.out.println("default context init failed: " + e); + } + throw e; + } + + if (defaultImpl == null) { + defaultImpl = this; + } + } + + protected void engineInit(KeyManager[] km, TrustManager[] tm, + SecureRandom sr) throws KeyManagementException { + throw new KeyManagementException + ("Default SSLContext is initialized automatically"); + } + + static synchronized SSLContextImpl getDefaultImpl() throws Exception { + if (defaultImpl == null) { + new DefaultSSLContext(); + } + return defaultImpl; + } + + private static synchronized TrustManager[] getDefaultTrustManager() + throws Exception { + if (defaultTrustManagers != null) { + return defaultTrustManagers; + } + + KeyStore ks = + TrustManagerFactoryImpl.getCacertsKeyStore("defaultctx"); + + TrustManagerFactory tmf = TrustManagerFactory.getInstance( + TrustManagerFactory.getDefaultAlgorithm()); + tmf.init(ks); + defaultTrustManagers = tmf.getTrustManagers(); + return defaultTrustManagers; + } + + private static synchronized KeyManager[] getDefaultKeyManager() + throws Exception { + if (defaultKeyManagers != null) { + return defaultKeyManagers; + } + + final Map props = new HashMap<>(); + AccessController.doPrivileged( + new PrivilegedExceptionAction() { + public Object run() throws Exception { + props.put("keyStore", System.getProperty( + "javax.net.ssl.keyStore", "")); + props.put("keyStoreType", System.getProperty( + "javax.net.ssl.keyStoreType", + KeyStore.getDefaultType())); + props.put("keyStoreProvider", System.getProperty( + "javax.net.ssl.keyStoreProvider", "")); + props.put("keyStorePasswd", System.getProperty( + "javax.net.ssl.keyStorePassword", "")); + return null; + } + }); + + final String defaultKeyStore = props.get("keyStore"); + String defaultKeyStoreType = props.get("keyStoreType"); + String defaultKeyStoreProvider = props.get("keyStoreProvider"); + if (debug != null && Debug.isOn("defaultctx")) { + System.out.println("keyStore is : " + defaultKeyStore); + System.out.println("keyStore type is : " + + defaultKeyStoreType); + System.out.println("keyStore provider is : " + + defaultKeyStoreProvider); + } + + if (P11KEYSTORE.equals(defaultKeyStoreType) && + !NONE.equals(defaultKeyStore)) { + throw new IllegalArgumentException("if keyStoreType is " + + P11KEYSTORE + ", then keyStore must be " + NONE); + } + + FileInputStream fs = null; + if (defaultKeyStore.length() != 0 && !NONE.equals(defaultKeyStore)) { + fs = AccessController.doPrivileged( + new PrivilegedExceptionAction() { + public FileInputStream run() throws Exception { + return new FileInputStream(defaultKeyStore); + } + }); + } + + String defaultKeyStorePassword = props.get("keyStorePasswd"); + char[] passwd = null; + if (defaultKeyStorePassword.length() != 0) { + passwd = defaultKeyStorePassword.toCharArray(); + } + + /** + * Try to initialize key store. + */ + KeyStore ks = null; + if ((defaultKeyStoreType.length()) != 0) { + if (debug != null && Debug.isOn("defaultctx")) { + System.out.println("init keystore"); + } + if (defaultKeyStoreProvider.length() == 0) { + ks = KeyStore.getInstance(defaultKeyStoreType); + } else { + ks = KeyStore.getInstance(defaultKeyStoreType, + defaultKeyStoreProvider); + } + + // if defaultKeyStore is NONE, fs will be null + ks.load(fs, passwd); + } + if (fs != null) { + fs.close(); + fs = null; + } + + /* + * Try to initialize key manager. + */ + if (debug != null && Debug.isOn("defaultctx")) { + System.out.println("init keymanager of type " + + KeyManagerFactory.getDefaultAlgorithm()); + } + KeyManagerFactory kmf = KeyManagerFactory.getInstance( + KeyManagerFactory.getDefaultAlgorithm()); + + if (P11KEYSTORE.equals(defaultKeyStoreType)) { + kmf.init(ks, null); // do not pass key passwd if using token + } else { + kmf.init(ks, passwd); + } + + defaultKeyManagers = kmf.getKeyManagers(); + return defaultKeyManagers; + } + } + + /* + * The SSLContext implementation for TLS, SSL, SSLv3 and TLS10 algorithm + * + * @see SSLContext + */ + public static final class TLS10Context extends ConservativeSSLContext { + // use the default constructor and methods + } + + /* + * The SSLContext implementation for TLS11 algorithm + * + * @see SSLContext + */ + public static final class TLS11Context extends SSLContextImpl { + // parameters + private static SSLParameters defaultServerSSLParams; + private static SSLParameters defaultClientSSLParams; + private static SSLParameters supportedSSLParams; + + static { + if (SunJSSE.isFIPS()) { + supportedSSLParams = new SSLParameters(); + supportedSSLParams.setProtocols(new String[] { + ProtocolVersion.TLS10.name, + ProtocolVersion.TLS11.name, + ProtocolVersion.TLS12.name + }); + + defaultServerSSLParams = supportedSSLParams; + + defaultClientSSLParams = new SSLParameters(); + defaultClientSSLParams.setProtocols(new String[] { + ProtocolVersion.TLS10.name, + ProtocolVersion.TLS11.name + }); + + } else { + supportedSSLParams = new SSLParameters(); + supportedSSLParams.setProtocols(new String[] { + ProtocolVersion.SSL20Hello.name, + ProtocolVersion.SSL30.name, + ProtocolVersion.TLS10.name, + ProtocolVersion.TLS11.name, + ProtocolVersion.TLS12.name + }); + + defaultServerSSLParams = supportedSSLParams; + + defaultClientSSLParams = new SSLParameters(); + defaultClientSSLParams.setProtocols(new String[] { + ProtocolVersion.SSL30.name, + ProtocolVersion.TLS10.name, + ProtocolVersion.TLS11.name + }); + } + } + + SSLParameters getDefaultServerSSLParams() { + return defaultServerSSLParams; + } + + SSLParameters getDefaultClientSSLParams() { + return defaultClientSSLParams; + } + + SSLParameters getSupportedSSLParams() { + return supportedSSLParams; + } + } + + /* + * The SSLContext implementation for TLS12 algorithm + * + * @see SSLContext + */ + public static final class TLS12Context extends SSLContextImpl { + // parameters + private static SSLParameters defaultServerSSLParams; + private static SSLParameters defaultClientSSLParams; + private static SSLParameters supportedSSLParams; + + static { + if (SunJSSE.isFIPS()) { + supportedSSLParams = new SSLParameters(); + supportedSSLParams.setProtocols(new String[] { + ProtocolVersion.TLS10.name, + ProtocolVersion.TLS11.name, + ProtocolVersion.TLS12.name + }); + + defaultServerSSLParams = supportedSSLParams; + + defaultClientSSLParams = new SSLParameters(); + defaultClientSSLParams.setProtocols(new String[] { + ProtocolVersion.TLS10.name, + ProtocolVersion.TLS11.name, + ProtocolVersion.TLS12.name + }); + + } else { + supportedSSLParams = new SSLParameters(); + supportedSSLParams.setProtocols(new String[] { + ProtocolVersion.SSL20Hello.name, + ProtocolVersion.SSL30.name, + ProtocolVersion.TLS10.name, + ProtocolVersion.TLS11.name, + ProtocolVersion.TLS12.name + }); + + defaultServerSSLParams = supportedSSLParams; + + defaultClientSSLParams = new SSLParameters(); + defaultClientSSLParams.setProtocols(new String[] { + ProtocolVersion.SSL30.name, + ProtocolVersion.TLS10.name, + ProtocolVersion.TLS11.name, + ProtocolVersion.TLS12.name + }); + } + } + + SSLParameters getDefaultServerSSLParams() { + return defaultServerSSLParams; + } + + SSLParameters getDefaultClientSSLParams() { + return defaultClientSSLParams; + } + + SSLParameters getSupportedSSLParams() { + return supportedSSLParams; + } + } + } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java --- a/jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -374,8 +374,10 @@ clientVerifyData = new byte[0]; serverVerifyData = new byte[0]; - enabledCipherSuites = CipherSuiteList.getDefault(); - enabledProtocols = ProtocolList.getDefault(roleIsServer); + enabledCipherSuites = + sslContext.getDefaultCipherSuiteList(roleIsServer); + enabledProtocols = + sslContext.getDefaultProtocolList(roleIsServer); wrapLock = new Object(); unwrapLock = new Object(); @@ -1883,8 +1885,8 @@ * change them to the corresponding default ones. */ if (roleIsServer != (!flag) && - ProtocolList.isDefaultProtocolList(enabledProtocols)) { - enabledProtocols = ProtocolList.getDefault(!flag); + sslContext.isDefaultProtocolList(enabledProtocols)) { + enabledProtocols = sslContext.getDefaultProtocolList(!flag); } roleIsServer = !flag; @@ -1907,8 +1909,8 @@ * change them to the corresponding default ones. */ if (roleIsServer != (!flag) && - ProtocolList.isDefaultProtocolList(enabledProtocols)) { - enabledProtocols = ProtocolList.getDefault(!flag); + sslContext.isDefaultProtocolList(enabledProtocols)) { + enabledProtocols = sslContext.getDefaultProtocolList(!flag); } roleIsServer = !flag; @@ -1951,8 +1953,7 @@ * @return an array of cipher suite names */ public String[] getSupportedCipherSuites() { - CipherSuiteList.clearAvailableCache(); - return CipherSuiteList.getSupported().toStringArray(); + return sslContext.getSuportedCipherSuiteList().toStringArray(); } /** @@ -1992,7 +1993,7 @@ * @return an array of protocol names. */ public String[] getSupportedProtocols() { - return ProtocolList.getSupported().toStringArray(); + return sslContext.getSuportedProtocolList().toStringArray(); } /** diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/ssl/SSLServerSocketFactoryImpl.java --- a/jdk/src/share/classes/sun/security/ssl/SSLServerSocketFactoryImpl.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/ssl/SSLServerSocketFactoryImpl.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,7 +49,7 @@ * java.security file is set. */ public SSLServerSocketFactoryImpl() throws Exception { - this.context = DefaultSSLContextImpl.getDefaultImpl(); + this.context = SSLContextImpl.DefaultSSLContext.getDefaultImpl(); } /** @@ -99,8 +99,7 @@ * is encrypted to provide confidentiality. */ public String[] getDefaultCipherSuites() { - CipherSuiteList.clearAvailableCache(); - return CipherSuiteList.getDefault().toStringArray(); + return context.getDefaultCipherSuiteList(true).toStringArray(); } /** @@ -114,8 +113,7 @@ * @return an array of cipher suite names */ public String[] getSupportedCipherSuites() { - CipherSuiteList.clearAvailableCache(); - return CipherSuiteList.getSupported().toStringArray(); + return context.getSuportedCipherSuiteList().toStringArray(); } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/ssl/SSLServerSocketImpl.java --- a/jdk/src/share/classes/sun/security/ssl/SSLServerSocketImpl.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/ssl/SSLServerSocketImpl.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -153,8 +153,8 @@ throw new SSLException("No Authentication context given"); } sslContext = context; - enabledCipherSuites = CipherSuiteList.getDefault(); - enabledProtocols = ProtocolList.getDefault(true); + enabledCipherSuites = sslContext.getDefaultCipherSuiteList(true); + enabledProtocols = sslContext.getDefaultProtocolList(true); } /** @@ -168,8 +168,7 @@ * @return an array of cipher suite names */ public String[] getSupportedCipherSuites() { - CipherSuiteList.clearAvailableCache(); - return CipherSuiteList.getSupported().toStringArray(); + return sslContext.getSuportedCipherSuiteList().toStringArray(); } /** @@ -194,7 +193,7 @@ } public String[] getSupportedProtocols() { - return ProtocolList.getSupported().toStringArray(); + return sslContext.getSuportedProtocolList().toStringArray(); } /** @@ -253,8 +252,8 @@ * change them to the corresponding default ones. */ if (useServerMode != (!flag) && - ProtocolList.isDefaultProtocolList(enabledProtocols)) { - enabledProtocols = ProtocolList.getDefault(!flag); + sslContext.isDefaultProtocolList(enabledProtocols)) { + enabledProtocols = sslContext.getDefaultProtocolList(!flag); } useServerMode = !flag; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/ssl/SSLSocketFactoryImpl.java --- a/jdk/src/share/classes/sun/security/ssl/SSLSocketFactoryImpl.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/ssl/SSLSocketFactoryImpl.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,20 +42,18 @@ * * @author David Brownell */ -final -public class SSLSocketFactoryImpl extends SSLSocketFactory -{ +final public class SSLSocketFactoryImpl extends SSLSocketFactory { + private static SSLContextImpl defaultContext; private SSLContextImpl context; - /** * Constructor used to instantiate the default factory. This method is * only called if the old "ssl.SocketFactory.provider" property in the * java.security file is set. */ public SSLSocketFactoryImpl() throws Exception { - this.context = DefaultSSLContextImpl.getDefaultImpl(); + this.context = SSLContextImpl.DefaultSSLContext.getDefaultImpl(); } /** @@ -167,11 +165,9 @@ * is encrypted to provide confidentiality. */ public String[] getDefaultCipherSuites() { - CipherSuiteList.clearAvailableCache(); - return CipherSuiteList.getDefault().toStringArray(); + return context.getDefaultCipherSuiteList(false).toStringArray(); } - /** * Returns the names of the cipher suites which could be enabled for use * on an SSL connection. Normally, only a subset of these will actually @@ -181,7 +177,6 @@ * certain kinds of certificates to use certain cipher suites. */ public String[] getSupportedCipherSuites() { - CipherSuiteList.clearAvailableCache(); - return CipherSuiteList.getSupported().toStringArray(); + return context.getSuportedCipherSuiteList().toStringArray(); } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java --- a/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -562,8 +562,11 @@ clientVerifyData = new byte[0]; serverVerifyData = new byte[0]; - enabledCipherSuites = CipherSuiteList.getDefault(); - enabledProtocols = ProtocolList.getDefault(roleIsServer); + enabledCipherSuites = + sslContext.getDefaultCipherSuiteList(roleIsServer); + enabledProtocols = + sslContext.getDefaultProtocolList(roleIsServer); + inrec = null; // save the acc @@ -2170,8 +2173,8 @@ * change them to the corresponding default ones. */ if (roleIsServer != (!flag) && - ProtocolList.isDefaultProtocolList(enabledProtocols)) { - enabledProtocols = ProtocolList.getDefault(!flag); + sslContext.isDefaultProtocolList(enabledProtocols)) { + enabledProtocols = sslContext.getDefaultProtocolList(!flag); } roleIsServer = !flag; break; @@ -2192,8 +2195,8 @@ * change them to the corresponding default ones. */ if (roleIsServer != (!flag) && - ProtocolList.isDefaultProtocolList(enabledProtocols)) { - enabledProtocols = ProtocolList.getDefault(!flag); + sslContext.isDefaultProtocolList(enabledProtocols)) { + enabledProtocols = sslContext.getDefaultProtocolList(!flag); } roleIsServer = !flag; connectionState = cs_START; @@ -2230,8 +2233,7 @@ * @return an array of cipher suite names */ public String[] getSupportedCipherSuites() { - CipherSuiteList.clearAvailableCache(); - return CipherSuiteList.getSupported().toStringArray(); + return sslContext.getSuportedCipherSuiteList().toStringArray(); } /** @@ -2271,7 +2273,7 @@ * @return an array of protocol names. */ public String[] getSupportedProtocols() { - return ProtocolList.getSupported().toStringArray(); + return sslContext.getSuportedProtocolList().toStringArray(); } /** diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/ssl/SunJSSE.java --- a/jdk/src/share/classes/sun/security/ssl/SunJSSE.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/ssl/SunJSSE.java Wed Jul 05 17:42:05 2017 +0200 @@ -204,22 +204,21 @@ put("Alg.Alias.TrustManagerFactory.SunPKIX", "PKIX"); put("Alg.Alias.TrustManagerFactory.X509", "PKIX"); put("Alg.Alias.TrustManagerFactory.X.509", "PKIX"); + + put("SSLContext.TLSv1", + "sun.security.ssl.SSLContextImpl$TLS10Context"); + put("Alg.Alias.SSLContext.TLS", "TLSv1"); if (isfips == false) { - put("SSLContext.SSL", - "sun.security.ssl.SSLContextImpl"); - put("SSLContext.SSLv3", - "sun.security.ssl.SSLContextImpl"); + put("Alg.Alias.SSLContext.SSL", "TLSv1"); + put("Alg.Alias.SSLContext.SSLv3", "TLSv1"); } - put("SSLContext.TLS", - "sun.security.ssl.SSLContextImpl"); - put("SSLContext.TLSv1", - "sun.security.ssl.SSLContextImpl"); + put("SSLContext.TLSv1.1", - "sun.security.ssl.SSLContextImpl"); + "sun.security.ssl.SSLContextImpl$TLS11Context"); put("SSLContext.TLSv1.2", - "sun.security.ssl.SSLContextImpl"); + "sun.security.ssl.SSLContextImpl$TLS12Context"); put("SSLContext.Default", - "sun.security.ssl.DefaultSSLContextImpl"); + "sun.security.ssl.SSLContextImpl$DefaultSSLContext"); /* * KeyStore diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java --- a/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -191,8 +191,8 @@ * * */ - public CodeSigner[] verify(Hashtable verifiedSigners, - Hashtable sigFileSigners) + public CodeSigner[] verify(Map verifiedSigners, + Map sigFileSigners) throws JarException { if (skip) { diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/security/util/SignatureFileManifest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/classes/sun/security/util/SignatureFileManifest.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,251 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.util; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Arrays; +import java.util.jar.Attributes; +import java.util.jar.Manifest; + +/** + * This class provides streaming mode reading of manifest files. + * Used by {@link SignatureFileVerifier}. + */ +class SignatureFileManifest extends Manifest { + + /* + * Reading a manifest into this object by calling update(byte[]) on chunks. + * During the reading, the bytes are saved in (@code current} until a line + * is complete and the key-value pair is saved in {@code currentAttr}. When + * a section is complete, {@code consumeAttr} is called to merge + * {@code currentAttr} into main attributes or a named entry. + */ + + // Internal state during update() style reading + // 0. not in update mode + // 1, in update mode but main attributes not completed yet + // 2. main attributes completed, still reading the entries + private int state = 0; + + // The partial line read + private byte[] current; + + // Number of bytes in current + private int currentPos = 0; + + // The current Attribute + private Attributes currentAttr; + + /** + * Reads a manifest in chunks. + *

              + * This method must be called in a row, reading chunks from a single + * manifest file by order. After all chunks are read, caller must call + * {@code update(null)} to fully consume the manifest. + *

              + * The entry names and attributes read will be merged in with the current + * manifest entries. The {@link #read} method cannot be called inside a + * row of update calls. + *

              + * Along with the calls, caller can call {@link #getMainAttributes()}, + * {@link #getAttributes(java.lang.String)} or {@link #getEntries()} + * to get already available contents. However, in order not to return + * partial result, when the main attributes in the new manifest is not + * consumed completely, {@link #getMainAttributes()} throws an + * {@code IllegalStateException}. When a certain named entry is not + * consumed completely, {@link #getAttributes(java.lang.String)} + * returns the old {@code Attributes} for the name (if it exists). + * + * @param data null for last call, otherwise, feeding chunks + * @param offset offset into data to begin read + * @param length length of data after offset to read + * @exception IOException if an I/O error has occurred + * @exception IllegalStateException if {@code update(null)} is called + * without any previous {@code update(non-null)} call + */ + public void update(byte[] data, int offset, int length) throws IOException { + + // The last call + if (data == null) { + if (state == 0) { + throw new IllegalStateException("No data to update"); + } + // We accept manifest not ended with \n or \n\n + if (hasLastByte()) { + consumeCurrent(); + } + // We accept empty lines at the end + if (!currentAttr.isEmpty()) { + consumeAttr(); + } + state = 0; // back to non-update state + current = null; + currentAttr = null; + return; + } + + // The first call + if (state == 0) { + current = new byte[1024]; + currentAttr = super.getMainAttributes(); // the main attribute + state = 1; + } + + int end = offset + length; + + while (offset < end) { + switch (data[offset]) { + case '\r': + break; // always skip + case '\n': + if (hasLastByte() && lastByte() == '\n') { // new section + consumeCurrent(); + consumeAttr(); + if (state == 1) { + state = 2; + } + currentAttr = new Attributes(2); + } else { + if (hasLastByte()) { + // save \n into current but do not parse, + // there might be a continuation later + ensureCapacity(); + current[currentPos++] = data[offset]; + } else if (state == 1) { + // there can be multiple empty lines between + // sections, but cannot be at the beginning + throw new IOException("invalid manifest format"); + } + } + break; + case ' ': + if (!hasLastByte()) { + throw new IOException("invalid manifest format"); + } else if (lastByte() == '\n') { + currentPos--; // continuation, remove last \n + } else { // a very normal ' ' + ensureCapacity(); + current[currentPos++] = data[offset]; + } + break; + default: + if (hasLastByte() && lastByte() == '\n') { + // The start of a new pair, not continuation + consumeCurrent(); // the last line read + } + ensureCapacity(); + current[currentPos++] = data[offset]; + break; + } + offset++; + } + } + + /** + * Returns the main Attributes for the Manifest. + * @exception IllegalStateException the main attributes is being read + * @return the main Attributes for the Manifest + */ + public Attributes getMainAttributes() { + if (state == 1) { + throw new IllegalStateException(); + } + return super.getMainAttributes(); + } + + /** + * Reads the Manifest from the specified InputStream. The entry + * names and attributes read will be merged in with the current + * manifest entries. + * + * @param is the input stream + * @exception IOException if an I/O error has occurred + * @exception IllegalStateException if called between two {@link #update} + * calls + */ + public void read(InputStream is) throws IOException { + if (state != 0) { + throw new IllegalStateException("Cannot call read between updates"); + } + super.read(is); + } + + /* + * ---------- Helper methods ----------------- + */ + + private void ensureCapacity() { + if (currentPos >= current.length-1) { + current = Arrays.copyOf(current, current.length*2); + } + } + + private boolean hasLastByte() { + return currentPos > 0; + } + + private byte lastByte() { + return current[currentPos-1]; + } + + // Parse current as key:value and save into currentAttr. + // There MUST be something inside current. + private void consumeCurrent() throws IOException { + // current normally has a \n end, except for the last line + if (current[currentPos-1] == '\n') currentPos--; + for (int i=0; i createdDigests; @@ -83,6 +86,7 @@ * @param rawBytes the raw bytes of the signature block file */ public SignatureFileVerifier(ArrayList signerCache, + Manifest man, ManifestDigester md, String name, byte rawBytes[]) @@ -94,13 +98,18 @@ try { obj = Providers.startJarVerification(); block = new PKCS7(rawBytes); - sfBytes = block.getContentInfo().getData(); + byte[] contentData = block.getContentInfo().getData(); + if (contentData != null) { + sfStream = new ByteArrayInputStream(contentData); + } certificateFactory = CertificateFactory.getInstance("X509"); } finally { Providers.stopJarVerification(obj); } this.name = name.substring(0, name.lastIndexOf(".")) .toUpperCase(Locale.ENGLISH); + + this.man = man; this.md = md; this.signerCache = signerCache; } @@ -108,31 +117,13 @@ /** * returns true if we need the .SF file */ - public boolean needSignatureFileBytes() + public boolean needSignatureFile() { - - return sfBytes == null; + return sfStream == null; } - - /** - * returns true if we need this .SF file. - * - * @param name the name of the .SF file without the extension - * - */ - public boolean needSignatureFile(String name) - { - return this.name.equalsIgnoreCase(name); - } - - /** - * used to set the raw bytes of the .SF file when it - * is external to the signature block file. - */ - public void setSignatureFile(byte sfBytes[]) - { - this.sfBytes = sfBytes; + public void setSignatureFile(InputStream ins) { + this.sfStream = ins; } /** @@ -145,12 +136,18 @@ * Signature File or PKCS7 block file name */ public static boolean isBlockOrSF(String s) { - // we currently only support DSA and RSA PKCS7 blocks - if (s.endsWith(".SF") || s.endsWith(".DSA") || - s.endsWith(".RSA") || s.endsWith(".EC")) { - return true; - } - return false; + return s.endsWith(".SF") || isBlock(s); + } + + /** + * Utility method used by JarVerifier to determine PKCS7 block + * files names that are supported + * + * @param s file name + * @return true if the input file name is a PKCS7 block file name + */ + public static boolean isBlock(String s) { + return s.endsWith(".DSA") || s.endsWith(".RSA") || s.endsWith(".EC"); } /** get digest from cache */ @@ -180,7 +177,7 @@ * * */ - public void process(Hashtable signers, + public void process(Map signers, List manifestDigests) throws IOException, SignatureException, NoSuchAlgorithmException, JarException, CertificateException @@ -197,31 +194,86 @@ } - private void processImpl(Hashtable signers, + private void processImpl(Map signers, List manifestDigests) throws IOException, SignatureException, NoSuchAlgorithmException, JarException, CertificateException { - Manifest sf = new Manifest(); - sf.read(new ByteArrayInputStream(sfBytes)); + SignatureFileManifest sf = new SignatureFileManifest(); + InputStream ins = sfStream; - String version = - sf.getMainAttributes().getValue(Attributes.Name.SIGNATURE_VERSION); + byte[] buffer = new byte[4096]; + int sLen = block.getSignerInfos().length; + boolean mainOK = false; // main attributes of SF is available... + boolean manifestSigned = false; // and it matches MANIFEST.MF + BASE64Decoder decoder = new BASE64Decoder(); - if ((version == null) || !(version.equalsIgnoreCase("1.0"))) { - // XXX: should this be an exception? - // for now we just ignore this signature file - return; + PKCS7.PKCS7Verifier[] pvs = new PKCS7.PKCS7Verifier[sLen]; + for (int i=0; i intResult = new ArrayList<>(sLen); + for (int i = 0; i < sLen; i++) { + if (pvs[i] != null) { + SignerInfo signerInfo = pvs[i].verify(); + if (signerInfo != null) { + intResult.add(signerInfo); + } + } + } + if (intResult.isEmpty()) { throw new SecurityException("cannot verify signature block file " + name); } - BASE64Decoder decoder = new BASE64Decoder(); + SignerInfo[] infos = + intResult.toArray(new SignerInfo[intResult.size()]); CodeSigner[] newSigners = getSigners(infos, block); @@ -229,26 +281,37 @@ if (newSigners == null) return; - Iterator> entries = - sf.getEntries().entrySet().iterator(); - - // see if we can verify the whole manifest first - boolean manifestSigned = verifyManifestHash(sf, md, decoder, manifestDigests); - // verify manifest main attributes if (!manifestSigned && !verifyManifestMainAttrs(sf, md, decoder)) { throw new SecurityException ("Invalid signature file digest for Manifest main attributes"); } - // go through each section in the signature file + Iterator> entries; + + if (manifestSigned) { + if (debug != null) { + debug.println("full manifest signature match, " + + "update signer info from MANIFEST.MF"); + } + entries = man.getEntries().entrySet().iterator(); + } else { + if (debug != null) { + debug.println("full manifest signature unmatch, " + + "update signer info from SF file"); + } + entries = sf.getEntries().entrySet().iterator(); + } + + // go through each section + while(entries.hasNext()) { Map.Entry e = entries.next(); String name = e.getKey(); if (manifestSigned || - (verifySection(e.getValue(), name, md, decoder))) { + (verifySection(e.getValue(), name, md, decoder))) { if (name.startsWith("./")) name = name.substring(2); @@ -593,7 +656,6 @@ if (set == subset) return true; - boolean match; for (int i = 0; i < subset.length; i++) { if (!contains(set, subset[i])) return false; @@ -613,8 +675,6 @@ if ((oldSigners == null) && (signers == newSigners)) return true; - boolean match; - // make sure all oldSigners are in signers if ((oldSigners != null) && !isSubSet(oldSigners, signers)) return false; @@ -638,7 +698,7 @@ } void updateSigners(CodeSigner[] newSigners, - Hashtable signers, String name) { + Map signers, String name) { CodeSigner[] oldSigners = signers.get(name); diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/swing/SwingUtilities2.java --- a/jdk/src/share/classes/sun/swing/SwingUtilities2.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/swing/SwingUtilities2.java Wed Jul 05 17:42:05 2017 +0200 @@ -270,11 +270,10 @@ */ public static int getLeftSideBearing(JComponent c, FontMetrics fm, String string) { - int res = 0; - if (!string.isEmpty()) { - res = getLeftSideBearing(c, fm, string.charAt(0)); + if ((string == null) || (string.length() == 0)) { + return 0; } - return res; + return getLeftSideBearing(c, fm, string.charAt(0)); } /** diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/util/locale/BaseLocale.java --- a/jdk/src/share/classes/sun/util/locale/BaseLocale.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/util/locale/BaseLocale.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,38 +38,46 @@ public static final String SEP = "_"; private static final Cache CACHE = new Cache(); - public static final BaseLocale ROOT = BaseLocale.getInstance("", "", "", ""); + + private final String language; + private final String script; + private final String region; + private final String variant; + + private volatile int hash = 0; - private String _language = ""; - private String _script = ""; - private String _region = ""; - private String _variant = ""; - - private transient volatile int _hash = 0; + // This method must be called only when creating the Locale.* constants. + private BaseLocale(String language, String region) { + this.language = language; + this.script = ""; + this.region = region; + this.variant = ""; + } private BaseLocale(String language, String script, String region, String variant) { - if (language != null) { - _language = AsciiUtil.toLowerString(language).intern(); - } - if (script != null) { - _script = AsciiUtil.toTitleString(script).intern(); - } - if (region != null) { - _region = AsciiUtil.toUpperString(region).intern(); - } - if (variant != null) { - _variant = variant.intern(); - } + this.language = (language != null) ? LocaleUtils.toLowerString(language).intern() : ""; + this.script = (script != null) ? LocaleUtils.toTitleString(script).intern() : ""; + this.region = (region != null) ? LocaleUtils.toUpperString(region).intern() : ""; + this.variant = (variant != null) ? variant.intern() : ""; } - public static BaseLocale getInstance(String language, String script, String region, String variant) { + // Called for creating the Locale.* constants. No argument + // validation is performed. + public static BaseLocale createInstance(String language, String region) { + BaseLocale base = new BaseLocale(language, region); + CACHE.put(new Key(language, region), base); + return base; + } + + public static BaseLocale getInstance(String language, String script, + String region, String variant) { // JDK uses deprecated ISO639.1 language codes for he, yi and id if (language != null) { - if (AsciiUtil.caseIgnoreMatch(language, "he")) { + if (LocaleUtils.caseIgnoreMatch(language, "he")) { language = "iw"; - } else if (AsciiUtil.caseIgnoreMatch(language, "yi")) { + } else if (LocaleUtils.caseIgnoreMatch(language, "yi")) { language = "ji"; - } else if (AsciiUtil.caseIgnoreMatch(language, "id")) { + } else if (LocaleUtils.caseIgnoreMatch(language, "id")) { language = "in"; } } @@ -80,21 +88,22 @@ } public String getLanguage() { - return _language; + return language; } public String getScript() { - return _script; + return script; } public String getRegion() { - return _region; + return region; } public String getVariant() { - return _variant; + return variant; } + @Override public boolean equals(Object obj) { if (this == obj) { return true; @@ -103,138 +112,178 @@ return false; } BaseLocale other = (BaseLocale)obj; - return hashCode() == other.hashCode() - && _language.equals(other._language) - && _script.equals(other._script) - && _region.equals(other._region) - && _variant.equals(other._variant); + return language == other.language + && script == other.script + && region == other.region + && variant == other.variant; } + @Override public String toString() { StringBuilder buf = new StringBuilder(); - if (_language.length() > 0) { + if (language.length() > 0) { buf.append("language="); - buf.append(_language); + buf.append(language); } - if (_script.length() > 0) { + if (script.length() > 0) { if (buf.length() > 0) { buf.append(", "); } buf.append("script="); - buf.append(_script); + buf.append(script); } - if (_region.length() > 0) { + if (region.length() > 0) { if (buf.length() > 0) { buf.append(", "); } buf.append("region="); - buf.append(_region); + buf.append(region); } - if (_variant.length() > 0) { + if (variant.length() > 0) { if (buf.length() > 0) { buf.append(", "); } buf.append("variant="); - buf.append(_variant); + buf.append(variant); } return buf.toString(); } + @Override public int hashCode() { - int h = _hash; + int h = hash; if (h == 0) { // Generating a hash value from language, script, region and variant - for (int i = 0; i < _language.length(); i++) { - h = 31*h + _language.charAt(i); - } - for (int i = 0; i < _script.length(); i++) { - h = 31*h + _script.charAt(i); - } - for (int i = 0; i < _region.length(); i++) { - h = 31*h + _region.charAt(i); - } - for (int i = 0; i < _variant.length(); i++) { - h = 31*h + _variant.charAt(i); - } - _hash = h; + h = language.hashCode(); + h = 31 * h + script.hashCode(); + h = 31 * h + region.hashCode(); + h = 31 * h + variant.hashCode(); + hash = h; } return h; } - private static class Key implements Comparable { - private String _lang = ""; - private String _scrt = ""; - private String _regn = ""; - private String _vart = ""; + private static final class Key implements Comparable { + private final String lang; + private final String scrt; + private final String regn; + private final String vart; + private final boolean normalized; + private final int hash; + + /** + * Creates a Key. language and region must be normalized + * (intern'ed in the proper case). + */ + private Key(String language, String region) { + assert language.intern() == language + && region.intern() == region; - private volatile int _hash; // Default to 0 + lang = language; + scrt = ""; + regn = region; + vart = ""; + this.normalized = true; + + int h = language.hashCode(); + if (region != "") { + int len = region.length(); + for (int i = 0; i < len; i++) { + h = 31 * h + LocaleUtils.toLower(region.charAt(i)); + } + } + hash = h; + } public Key(String language, String script, String region, String variant) { + this(language, script, region, variant, false); + } + + private Key(String language, String script, String region, + String variant, boolean normalized) { + int h = 0; if (language != null) { - _lang = language; + lang = language; + int len = language.length(); + for (int i = 0; i < len; i++) { + h = 31*h + LocaleUtils.toLower(language.charAt(i)); + } + } else { + lang = ""; } if (script != null) { - _scrt = script; + scrt = script; + int len = script.length(); + for (int i = 0; i < len; i++) { + h = 31*h + LocaleUtils.toLower(script.charAt(i)); + } + } else { + scrt = ""; } if (region != null) { - _regn = region; + regn = region; + int len = region.length(); + for (int i = 0; i < len; i++) { + h = 31*h + LocaleUtils.toLower(region.charAt(i)); + } + } else { + regn = ""; } if (variant != null) { - _vart = variant; + vart = variant; + int len = variant.length(); + for (int i = 0; i < len; i++) { + h = 31*h + variant.charAt(i); + } + } else { + vart = ""; } + hash = h; + this.normalized = normalized; } + @Override public boolean equals(Object obj) { return (this == obj) || (obj instanceof Key) - && AsciiUtil.caseIgnoreMatch(((Key)obj)._lang, this._lang) - && AsciiUtil.caseIgnoreMatch(((Key)obj)._scrt, this._scrt) - && AsciiUtil.caseIgnoreMatch(((Key)obj)._regn, this._regn) - && ((Key)obj)._vart.equals(_vart); // variant is case sensitive in JDK! + && this.hash == ((Key)obj).hash + && LocaleUtils.caseIgnoreMatch(((Key)obj).lang, this.lang) + && LocaleUtils.caseIgnoreMatch(((Key)obj).scrt, this.scrt) + && LocaleUtils.caseIgnoreMatch(((Key)obj).regn, this.regn) + && ((Key)obj).vart.equals(vart); // variant is case sensitive in JDK! } + @Override public int compareTo(Key other) { - int res = AsciiUtil.caseIgnoreCompare(this._lang, other._lang); + int res = LocaleUtils.caseIgnoreCompare(this.lang, other.lang); if (res == 0) { - res = AsciiUtil.caseIgnoreCompare(this._scrt, other._scrt); + res = LocaleUtils.caseIgnoreCompare(this.scrt, other.scrt); if (res == 0) { - res = AsciiUtil.caseIgnoreCompare(this._regn, other._regn); + res = LocaleUtils.caseIgnoreCompare(this.regn, other.regn); if (res == 0) { - res = this._vart.compareTo(other._vart); + res = this.vart.compareTo(other.vart); } } } return res; } + @Override public int hashCode() { - int h = _hash; - if (h == 0) { - // Generating a hash value from language, script, region and variant - for (int i = 0; i < _lang.length(); i++) { - h = 31*h + AsciiUtil.toLower(_lang.charAt(i)); - } - for (int i = 0; i < _scrt.length(); i++) { - h = 31*h + AsciiUtil.toLower(_scrt.charAt(i)); - } - for (int i = 0; i < _regn.length(); i++) { - h = 31*h + AsciiUtil.toLower(_regn.charAt(i)); - } - for (int i = 0; i < _vart.length(); i++) { - h = 31*h + _vart.charAt(i); - } - _hash = h; - } - return h; + return hash; } public static Key normalize(Key key) { - String lang = AsciiUtil.toLowerString(key._lang).intern(); - String scrt = AsciiUtil.toTitleString(key._scrt).intern(); - String regn = AsciiUtil.toUpperString(key._regn).intern(); - String vart = key._vart.intern(); // preserve upper/lower cases + if (key.normalized) { + return key; + } - return new Key(lang, scrt, regn, vart); + String lang = LocaleUtils.toLowerString(key.lang).intern(); + String scrt = LocaleUtils.toTitleString(key.scrt).intern(); + String regn = LocaleUtils.toUpperString(key.regn).intern(); + String vart = key.vart.intern(); // preserve upper/lower cases + + return new Key(lang, scrt, regn, vart, true); } } @@ -243,13 +292,14 @@ public Cache() { } + @Override protected Key normalizeKey(Key key) { return Key.normalize(key); } + @Override protected BaseLocale createObject(Key key) { - return new BaseLocale(key._lang, key._scrt, key._regn, key._vart); + return new BaseLocale(key.lang, key.scrt, key.regn, key.vart); } - } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/util/locale/Extension.java --- a/jdk/src/share/classes/sun/util/locale/Extension.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/util/locale/Extension.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,29 +32,34 @@ package sun.util.locale; -public class Extension { - private char _key; - protected String _value; +class Extension { + private final char key; + private String value, id; protected Extension(char key) { - _key = key; + this.key = key; } Extension(char key, String value) { - _key = key; - _value = value; + this.key = key; + setValue(value); + } + + protected void setValue(String value) { + this.value = value; + this.id = key + LanguageTag.SEP + value; } public char getKey() { - return _key; + return key; } public String getValue() { - return _value; + return value; } public String getID() { - return _key + LanguageTag.SEP + _value; + return id; } public String toString() { diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/util/locale/InternalLocaleBuilder.java --- a/jdk/src/share/classes/sun/util/locale/InternalLocaleBuilder.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/util/locale/InternalLocaleBuilder.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,64 +35,66 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; public final class InternalLocaleBuilder { - private String _language = ""; - private String _script = ""; - private String _region = ""; - private String _variant = ""; + private static final CaseInsensitiveChar PRIVATEUSE_KEY + = new CaseInsensitiveChar(LanguageTag.PRIVATEUSE); - private static final CaseInsensitiveChar PRIVUSE_KEY = new CaseInsensitiveChar(LanguageTag.PRIVATEUSE.charAt(0)); + private String language = ""; + private String script = ""; + private String region = ""; + private String variant = ""; - private HashMap _extensions; - private HashSet _uattributes; - private HashMap _ukeywords; + private Map extensions; + private Set uattributes; + private Map ukeywords; public InternalLocaleBuilder() { } public InternalLocaleBuilder setLanguage(String language) throws LocaleSyntaxException { - if (language == null || language.length() == 0) { - _language = ""; + if (LocaleUtils.isEmpty(language)) { + this.language = ""; } else { if (!LanguageTag.isLanguage(language)) { throw new LocaleSyntaxException("Ill-formed language: " + language, 0); } - _language = language; + this.language = language; } return this; } public InternalLocaleBuilder setScript(String script) throws LocaleSyntaxException { - if (script == null || script.length() == 0) { - _script = ""; + if (LocaleUtils.isEmpty(script)) { + this.script = ""; } else { if (!LanguageTag.isScript(script)) { throw new LocaleSyntaxException("Ill-formed script: " + script, 0); } - _script = script; + this.script = script; } return this; } public InternalLocaleBuilder setRegion(String region) throws LocaleSyntaxException { - if (region == null || region.length() == 0) { - _region = ""; + if (LocaleUtils.isEmpty(region)) { + this.region = ""; } else { if (!LanguageTag.isRegion(region)) { throw new LocaleSyntaxException("Ill-formed region: " + region, 0); } - _region = region; + this.region = region; } return this; } public InternalLocaleBuilder setVariant(String variant) throws LocaleSyntaxException { - if (variant == null || variant.length() == 0) { - _variant = ""; + if (LocaleUtils.isEmpty(variant)) { + this.variant = ""; } else { // normalize separators to "_" String var = variant.replaceAll(LanguageTag.SEP, BaseLocale.SEP); @@ -100,7 +102,7 @@ if (errIdx != -1) { throw new LocaleSyntaxException("Ill-formed variant: " + variant, errIdx); } - _variant = var; + this.variant = var; } return this; } @@ -110,10 +112,10 @@ throw new LocaleSyntaxException("Ill-formed Unicode locale attribute: " + attribute); } // Use case insensitive string to prevent duplication - if (_uattributes == null) { - _uattributes = new HashSet(4); + if (uattributes == null) { + uattributes = new HashSet<>(4); } - _uattributes.add(new CaseInsensitiveString(attribute)); + uattributes.add(new CaseInsensitiveString(attribute)); return this; } @@ -121,8 +123,8 @@ if (attribute == null || !UnicodeLocaleExtension.isAttribute(attribute)) { throw new LocaleSyntaxException("Ill-formed Unicode locale attribute: " + attribute); } - if (_uattributes != null) { - _uattributes.remove(new CaseInsensitiveString(attribute)); + if (uattributes != null) { + uattributes.remove(new CaseInsensitiveString(attribute)); } return this; } @@ -134,9 +136,9 @@ CaseInsensitiveString cikey = new CaseInsensitiveString(key); if (type == null) { - if (_ukeywords != null) { + if (ukeywords != null) { // null type is used for remove the key - _ukeywords.remove(cikey); + ukeywords.remove(cikey); } } else { if (type.length() != 0) { @@ -147,15 +149,17 @@ while (!itr.isDone()) { String s = itr.current(); if (!UnicodeLocaleExtension.isTypeSubtag(s)) { - throw new LocaleSyntaxException("Ill-formed Unicode locale keyword type: " + type, itr.currentStart()); + throw new LocaleSyntaxException("Ill-formed Unicode locale keyword type: " + + type, + itr.currentStart()); } itr.next(); } } - if (_ukeywords == null) { - _ukeywords = new HashMap(4); + if (ukeywords == null) { + ukeywords = new HashMap<>(4); } - _ukeywords.put(cikey, type); + ukeywords.put(cikey, type); } return this; } @@ -167,21 +171,21 @@ throw new LocaleSyntaxException("Ill-formed extension key: " + singleton); } - boolean remove = (value == null || value.length() == 0); + boolean remove = LocaleUtils.isEmpty(value); CaseInsensitiveChar key = new CaseInsensitiveChar(singleton); if (remove) { if (UnicodeLocaleExtension.isSingletonChar(key.value())) { // clear entire Unicode locale extension - if (_uattributes != null) { - _uattributes.clear(); + if (uattributes != null) { + uattributes.clear(); } - if (_ukeywords != null) { - _ukeywords.clear(); + if (ukeywords != null) { + ukeywords.clear(); } } else { - if (_extensions != null && _extensions.containsKey(key)) { - _extensions.remove(key); + if (extensions != null && extensions.containsKey(key)) { + extensions.remove(key); } } } else { @@ -197,7 +201,8 @@ validSubtag = LanguageTag.isExtensionSubtag(s); } if (!validSubtag) { - throw new LocaleSyntaxException("Ill-formed extension value: " + s, itr.currentStart()); + throw new LocaleSyntaxException("Ill-formed extension value: " + s, + itr.currentStart()); } itr.next(); } @@ -205,10 +210,10 @@ if (UnicodeLocaleExtension.isSingletonChar(key.value())) { setUnicodeLocaleExtension(val); } else { - if (_extensions == null) { - _extensions = new HashMap(4); + if (extensions == null) { + extensions = new HashMap<>(4); } - _extensions.put(key, val); + extensions.put(key, val); } } return this; @@ -218,7 +223,7 @@ * Set extension/private subtags in a single string representation */ public InternalLocaleBuilder setExtensions(String subtags) throws LocaleSyntaxException { - if (subtags == null || subtags.length() == 0) { + if (LocaleUtils.isEmpty(subtags)) { clearExtensions(); return this; } @@ -252,11 +257,12 @@ } if (parsed < start) { - throw new LocaleSyntaxException("Incomplete extension '" + singleton + "'", start); + throw new LocaleSyntaxException("Incomplete extension '" + singleton + "'", + start); } if (extensions == null) { - extensions = new ArrayList(4); + extensions = new ArrayList<>(4); } extensions.add(sb.toString()); } else { @@ -281,7 +287,9 @@ itr.next(); } if (parsed <= start) { - throw new LocaleSyntaxException("Incomplete privateuse:" + subtags.substring(start), start); + throw new LocaleSyntaxException("Incomplete privateuse:" + + subtags.substring(start), + start); } else { privateuse = sb.toString(); } @@ -289,7 +297,9 @@ } if (!itr.isDone()) { - throw new LocaleSyntaxException("Ill-formed extension subtags:" + subtags.substring(itr.currentStart()), itr.currentStart()); + throw new LocaleSyntaxException("Ill-formed extension subtags:" + + subtags.substring(itr.currentStart()), + itr.currentStart()); } return setExtensions(extensions, privateuse); @@ -302,30 +312,31 @@ private InternalLocaleBuilder setExtensions(List bcpExtensions, String privateuse) { clearExtensions(); - if (bcpExtensions != null && bcpExtensions.size() > 0) { - HashSet processedExntensions = new HashSet(bcpExtensions.size()); + if (!LocaleUtils.isEmpty(bcpExtensions)) { + Set done = new HashSet<>(bcpExtensions.size()); for (String bcpExt : bcpExtensions) { - CaseInsensitiveChar key = new CaseInsensitiveChar(bcpExt.charAt(0)); + CaseInsensitiveChar key = new CaseInsensitiveChar(bcpExt); // ignore duplicates - if (!processedExntensions.contains(key)) { + if (!done.contains(key)) { // each extension string contains singleton, e.g. "a-abc-def" if (UnicodeLocaleExtension.isSingletonChar(key.value())) { setUnicodeLocaleExtension(bcpExt.substring(2)); } else { - if (_extensions == null) { - _extensions = new HashMap(4); + if (extensions == null) { + extensions = new HashMap<>(4); } - _extensions.put(key, bcpExt.substring(2)); + extensions.put(key, bcpExt.substring(2)); } } + done.add(key); } } if (privateuse != null && privateuse.length() > 0) { // privateuse string contains prefix, e.g. "x-abc-def" - if (_extensions == null) { - _extensions = new HashMap(1); + if (extensions == null) { + extensions = new HashMap<>(1); } - _extensions.put(new CaseInsensitiveChar(privateuse.charAt(0)), privateuse.substring(2)); + extensions.put(new CaseInsensitiveChar(privateuse), privateuse.substring(2)); } return this; @@ -336,24 +347,25 @@ */ public InternalLocaleBuilder setLanguageTag(LanguageTag langtag) { clear(); - if (langtag.getExtlangs().size() > 0) { - _language = langtag.getExtlangs().get(0); + if (!langtag.getExtlangs().isEmpty()) { + language = langtag.getExtlangs().get(0); } else { - String language = langtag.getLanguage(); - if (!language.equals(LanguageTag.UNDETERMINED)) { - _language = language; + String lang = langtag.getLanguage(); + if (!lang.equals(LanguageTag.UNDETERMINED)) { + language = lang; } } - _script = langtag.getScript(); - _region = langtag.getRegion(); + script = langtag.getScript(); + region = langtag.getRegion(); List bcpVariants = langtag.getVariants(); - if (bcpVariants.size() > 0) { + if (!bcpVariants.isEmpty()) { StringBuilder var = new StringBuilder(bcpVariants.get(0)); - for (int i = 1; i < bcpVariants.size(); i++) { + int size = bcpVariants.size(); + for (int i = 1; i < size; i++) { var.append(BaseLocale.SEP).append(bcpVariants.get(i)); } - _variant = var.toString(); + variant = var.toString(); } setExtensions(langtag.getExtensions(), langtag.getPrivateuse()); @@ -361,7 +373,7 @@ return this; } - public InternalLocaleBuilder setLocale(BaseLocale base, LocaleExtensions extensions) throws LocaleSyntaxException { + public InternalLocaleBuilder setLocale(BaseLocale base, LocaleExtensions localeExtensions) throws LocaleSyntaxException { String language = base.getLanguage(); String script = base.getScript(); String region = base.getRegion(); @@ -373,14 +385,14 @@ if (language.equals("ja") && region.equals("JP") && variant.equals("JP")) { // When locale ja_JP_JP is created, ca-japanese is always there. // The builder ignores the variant "JP" - assert("japanese".equals(extensions.getUnicodeLocaleType("ca"))); + assert("japanese".equals(localeExtensions.getUnicodeLocaleType("ca"))); variant = ""; } // Exception 2 - th_TH_TH else if (language.equals("th") && region.equals("TH") && variant.equals("TH")) { // When locale th_TH_TH is created, nu-thai is always there. // The builder ignores the variant "TH" - assert("thai".equals(extensions.getUnicodeLocaleType("nu"))); + assert("thai".equals(localeExtensions.getUnicodeLocaleType("nu"))); variant = ""; } // Exception 3 - no_NO_NY @@ -415,36 +427,36 @@ // The input locale is validated at this point. // Now, updating builder's internal fields. - _language = language; - _script = script; - _region = region; - _variant = variant; + this.language = language; + this.script = script; + this.region = region; + this.variant = variant; clearExtensions(); - Set extKeys = (extensions == null) ? null : extensions.getKeys(); + Set extKeys = (localeExtensions == null) ? null : localeExtensions.getKeys(); if (extKeys != null) { - // map extensions back to builder's internal format + // map localeExtensions back to builder's internal format for (Character key : extKeys) { - Extension e = extensions.getExtension(key); + Extension e = localeExtensions.getExtension(key); if (e instanceof UnicodeLocaleExtension) { UnicodeLocaleExtension ue = (UnicodeLocaleExtension)e; for (String uatr : ue.getUnicodeLocaleAttributes()) { - if (_uattributes == null) { - _uattributes = new HashSet(4); + if (uattributes == null) { + uattributes = new HashSet<>(4); } - _uattributes.add(new CaseInsensitiveString(uatr)); + uattributes.add(new CaseInsensitiveString(uatr)); } for (String ukey : ue.getUnicodeLocaleKeys()) { - if (_ukeywords == null) { - _ukeywords = new HashMap(4); + if (ukeywords == null) { + ukeywords = new HashMap<>(4); } - _ukeywords.put(new CaseInsensitiveString(ukey), ue.getUnicodeLocaleType(ukey)); + ukeywords.put(new CaseInsensitiveString(ukey), ue.getUnicodeLocaleType(ukey)); } } else { - if (_extensions == null) { - _extensions = new HashMap(4); + if (extensions == null) { + extensions = new HashMap<>(4); } - _extensions.put(new CaseInsensitiveChar(key.charValue()), e.getValue()); + extensions.put(new CaseInsensitiveChar(key), e.getValue()); } } } @@ -452,37 +464,37 @@ } public InternalLocaleBuilder clear() { - _language = ""; - _script = ""; - _region = ""; - _variant = ""; + language = ""; + script = ""; + region = ""; + variant = ""; clearExtensions(); return this; } public InternalLocaleBuilder clearExtensions() { - if (_extensions != null) { - _extensions.clear(); + if (extensions != null) { + extensions.clear(); } - if (_uattributes != null) { - _uattributes.clear(); + if (uattributes != null) { + uattributes.clear(); } - if (_ukeywords != null) { - _ukeywords.clear(); + if (ukeywords != null) { + ukeywords.clear(); } return this; } public BaseLocale getBaseLocale() { - String language = _language; - String script = _script; - String region = _region; - String variant = _variant; + String language = this.language; + String script = this.script; + String region = this.region; + String variant = this.variant; // Special private use subtag sequence identified by "lvariant" will be // interpreted as Java variant. - if (_extensions != null) { - String privuse = _extensions.get(PRIVUSE_KEY); + if (extensions != null) { + String privuse = extensions.get(PRIVATEUSE_KEY); if (privuse != null) { StringTokenIterator itr = new StringTokenIterator(privuse, LanguageTag.SEP); boolean sawPrefix = false; @@ -492,7 +504,7 @@ privVarStart = itr.currentStart(); break; } - if (AsciiUtil.caseIgnoreMatch(itr.current(), LanguageTag.PRIVUSE_VARIANT_PREFIX)) { + if (LocaleUtils.caseIgnoreMatch(itr.current(), LanguageTag.PRIVUSE_VARIANT_PREFIX)) { sawPrefix = true; } itr.next(); @@ -502,7 +514,8 @@ if (sb.length() != 0) { sb.append(BaseLocale.SEP); } - sb.append(privuse.substring(privVarStart).replaceAll(LanguageTag.SEP, BaseLocale.SEP)); + sb.append(privuse.substring(privVarStart).replaceAll(LanguageTag.SEP, + BaseLocale.SEP)); variant = sb.toString(); } } @@ -512,13 +525,13 @@ } public LocaleExtensions getLocaleExtensions() { - if ((_extensions == null || _extensions.size() == 0) - && (_uattributes == null || _uattributes.size() == 0) - && (_ukeywords == null || _ukeywords.size() == 0)) { - return LocaleExtensions.EMPTY_EXTENSIONS; + if (LocaleUtils.isEmpty(extensions) && LocaleUtils.isEmpty(uattributes) + && LocaleUtils.isEmpty(ukeywords)) { + return null; } - return new LocaleExtensions(_extensions, _uattributes, _ukeywords); + LocaleExtensions lext = new LocaleExtensions(extensions, uattributes, ukeywords); + return lext.isEmpty() ? null : lext; } /* @@ -540,7 +553,7 @@ sawPrivuseVar = true; break; } - if (AsciiUtil.caseIgnoreMatch(itr.current(), LanguageTag.PRIVUSE_VARIANT_PREFIX)) { + if (LocaleUtils.caseIgnoreMatch(itr.current(), LanguageTag.PRIVUSE_VARIANT_PREFIX)) { prefixStart = itr.currentStart(); } itr.next(); @@ -576,11 +589,11 @@ */ private void setUnicodeLocaleExtension(String subtags) { // wipe out existing attributes/keywords - if (_uattributes != null) { - _uattributes.clear(); + if (uattributes != null) { + uattributes.clear(); } - if (_ukeywords != null) { - _ukeywords.clear(); + if (ukeywords != null) { + ukeywords.clear(); } StringTokenIterator itr = new StringTokenIterator(subtags, LanguageTag.SEP); @@ -590,10 +603,10 @@ if (!UnicodeLocaleExtension.isAttribute(itr.current())) { break; } - if (_uattributes == null) { - _uattributes = new HashSet(4); + if (uattributes == null) { + uattributes = new HashSet<>(4); } - _uattributes.add(new CaseInsensitiveString(itr.current())); + uattributes.add(new CaseInsensitiveString(itr.current())); itr.next(); } @@ -608,14 +621,14 @@ // next keyword - emit previous one assert(typeStart == -1 || typeEnd != -1); type = (typeStart == -1) ? "" : subtags.substring(typeStart, typeEnd); - if (_ukeywords == null) { - _ukeywords = new HashMap(4); + if (ukeywords == null) { + ukeywords = new HashMap<>(4); } - _ukeywords.put(key, type); + ukeywords.put(key, type); // reset keyword info CaseInsensitiveString tmpKey = new CaseInsensitiveString(itr.current()); - key = _ukeywords.containsKey(tmpKey) ? null : tmpKey; + key = ukeywords.containsKey(tmpKey) ? null : tmpKey; typeStart = typeEnd = -1; } else { if (typeStart == -1) { @@ -627,7 +640,7 @@ // 1. first keyword or // 2. next keyword, but previous one was duplicate key = new CaseInsensitiveString(itr.current()); - if (_ukeywords != null && _ukeywords.containsKey(key)) { + if (ukeywords != null && ukeywords.containsKey(key)) { // duplicate key = null; } @@ -638,10 +651,10 @@ // last keyword assert(typeStart == -1 || typeEnd != -1); type = (typeStart == -1) ? "" : subtags.substring(typeStart, typeEnd); - if (_ukeywords == null) { - _ukeywords = new HashMap(4); + if (ukeywords == null) { + ukeywords = new HashMap<>(4); } - _ukeywords.put(key, type); + ukeywords.put(key, type); } break; } @@ -650,21 +663,24 @@ } } - static class CaseInsensitiveString { - private String _s; + static final class CaseInsensitiveString { + private final String str, lowerStr; CaseInsensitiveString(String s) { - _s = s; + str = s; + lowerStr = LocaleUtils.toLowerString(s); } public String value() { - return _s; + return str; } + @Override public int hashCode() { - return AsciiUtil.toLowerString(_s).hashCode(); + return lowerStr.hashCode(); } + @Override public boolean equals(Object obj) { if (this == obj) { return true; @@ -672,25 +688,36 @@ if (!(obj instanceof CaseInsensitiveString)) { return false; } - return AsciiUtil.caseIgnoreMatch(_s, ((CaseInsensitiveString)obj).value()); + return lowerStr.equals(((CaseInsensitiveString)obj).lowerStr); } } - static class CaseInsensitiveChar { - private char _c; + static final class CaseInsensitiveChar { + private final char ch, lowerCh; + + /** + * Constructs a CaseInsensitiveChar with the first char of the + * given s. + */ + private CaseInsensitiveChar(String s) { + this(s.charAt(0)); + } CaseInsensitiveChar(char c) { - _c = c; + ch = c; + lowerCh = LocaleUtils.toLower(ch); } public char value() { - return _c; + return ch; } + @Override public int hashCode() { - return AsciiUtil.toLower(_c); + return lowerCh; } + @Override public boolean equals(Object obj) { if (this == obj) { return true; @@ -698,8 +725,7 @@ if (!(obj instanceof CaseInsensitiveChar)) { return false; } - return _c == AsciiUtil.toLower(((CaseInsensitiveChar)obj).value()); + return lowerCh == ((CaseInsensitiveChar)obj).lowerCh; } - } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/util/locale/LanguageTag.java --- a/jdk/src/share/classes/sun/util/locale/LanguageTag.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/util/locale/LanguageTag.java Wed Jul 05 17:42:05 2017 +0200 @@ -44,25 +44,25 @@ // public static final String SEP = "-"; public static final String PRIVATEUSE = "x"; - public static String UNDETERMINED = "und"; + public static final String UNDETERMINED = "und"; public static final String PRIVUSE_VARIANT_PREFIX = "lvariant"; // // Language subtag fields // - private String _language = ""; // language subtag - private String _script = ""; // script subtag - private String _region = ""; // region subtag - private String _privateuse = ""; // privateuse + private String language = ""; // language subtag + private String script = ""; // script subtag + private String region = ""; // region subtag + private String privateuse = ""; // privateuse - private List _extlangs = Collections.emptyList(); // extlang subtags - private List _variants = Collections.emptyList(); // variant subtags - private List _extensions = Collections.emptyList(); // extensions + private List extlangs = Collections.emptyList(); // extlang subtags + private List variants = Collections.emptyList(); // variant subtags + private List extensions = Collections.emptyList(); // extensions // Map contains grandfathered tags and its preferred mappings from // http://www.ietf.org/rfc/rfc5646.txt - private static final Map GRANDFATHERED = - new HashMap(); + // Keys are lower-case strings. + private static final Map GRANDFATHERED = new HashMap<>(); static { // grandfathered = irregular ; non-redundant tags registered @@ -126,7 +126,7 @@ {"zh-xiang", "hsn"}, }; for (String[] e : entries) { - GRANDFATHERED.put(new AsciiUtil.CaseInsensitiveKey(e[0]), e); + GRANDFATHERED.put(LocaleUtils.toLowerString(e[0]), e); } } @@ -188,7 +188,7 @@ StringTokenIterator itr; // Check if the tag is grandfathered - String[] gfmap = GRANDFATHERED.get(new AsciiUtil.CaseInsensitiveKey(languageTag)); + String[] gfmap = GRANDFATHERED.get(LocaleUtils.toLowerString(languageTag)); if (gfmap != null) { // use preferred mapping itr = new StringTokenIterator(gfmap[1], SEP); @@ -210,11 +210,11 @@ if (!itr.isDone() && !sts.isError()) { String s = itr.current(); - sts._errorIndex = itr.currentStart(); + sts.errorIndex = itr.currentStart(); if (s.length() == 0) { - sts._errorMsg = "Empty subtag"; + sts.errorMsg = "Empty subtag"; } else { - sts._errorMsg = "Invalid subtag: " + s; + sts.errorMsg = "Invalid subtag: " + s; } } @@ -235,8 +235,8 @@ String s = itr.current(); if (isLanguage(s)) { found = true; - _language = s; - sts._parseLength = itr.currentEnd(); + language = s; + sts.parseLength = itr.currentEnd(); itr.next(); } @@ -256,14 +256,14 @@ break; } found = true; - if (_extlangs.isEmpty()) { - _extlangs = new ArrayList(3); + if (extlangs.isEmpty()) { + extlangs = new ArrayList<>(3); } - _extlangs.add(s); - sts._parseLength = itr.currentEnd(); + extlangs.add(s); + sts.parseLength = itr.currentEnd(); itr.next(); - if (_extlangs.size() == 3) { + if (extlangs.size() == 3) { // Maximum 3 extlangs break; } @@ -282,8 +282,8 @@ String s = itr.current(); if (isScript(s)) { found = true; - _script = s; - sts._parseLength = itr.currentEnd(); + script = s; + sts.parseLength = itr.currentEnd(); itr.next(); } @@ -300,8 +300,8 @@ String s = itr.current(); if (isRegion(s)) { found = true; - _region = s; - sts._parseLength = itr.currentEnd(); + region = s; + sts.parseLength = itr.currentEnd(); itr.next(); } @@ -321,11 +321,11 @@ break; } found = true; - if (_variants.isEmpty()) { - _variants = new ArrayList(3); + if (variants.isEmpty()) { + variants = new ArrayList<>(3); } - _variants.add(s); - sts._parseLength = itr.currentEnd(); + variants.add(s); + sts.parseLength = itr.currentEnd(); itr.next(); } @@ -351,23 +351,23 @@ s = itr.current(); if (isExtensionSubtag(s)) { sb.append(SEP).append(s); - sts._parseLength = itr.currentEnd(); + sts.parseLength = itr.currentEnd(); } else { break; } itr.next(); } - if (sts._parseLength <= start) { - sts._errorIndex = start; - sts._errorMsg = "Incomplete extension '" + singleton + "'"; + if (sts.parseLength <= start) { + sts.errorIndex = start; + sts.errorMsg = "Incomplete extension '" + singleton + "'"; break; } - if (_extensions.size() == 0) { - _extensions = new ArrayList(4); + if (extensions.isEmpty()) { + extensions = new ArrayList<>(4); } - _extensions.add(sb.toString()); + extensions.add(sb.toString()); found = true; } else { break; @@ -395,17 +395,17 @@ break; } sb.append(SEP).append(s); - sts._parseLength = itr.currentEnd(); + sts.parseLength = itr.currentEnd(); itr.next(); } - if (sts._parseLength <= start) { + if (sts.parseLength <= start) { // need at least 1 private subtag - sts._errorIndex = start; - sts._errorMsg = "Incomplete privateuse"; + sts.errorIndex = start; + sts.errorMsg = "Incomplete privateuse"; } else { - _privateuse = sb.toString(); + privateuse = sb.toString(); found = true; } } @@ -425,9 +425,8 @@ String privuseVar = null; // store ill-formed variant subtags - if (language.length() > 0 && isLanguage(language)) { - // Convert a deprecated language code used by Java to - // a new code + if (isLanguage(language)) { + // Convert a deprecated language code to its new code if (language.equals("iw")) { language = "he"; } else if (language.equals("ji")) { @@ -435,22 +434,22 @@ } else if (language.equals("in")) { language = "id"; } - tag._language = language; + tag.language = language; } - if (script.length() > 0 && isScript(script)) { - tag._script = canonicalizeScript(script); + if (isScript(script)) { + tag.script = canonicalizeScript(script); hasSubtag = true; } - if (region.length() > 0 && isRegion(region)) { - tag._region = canonicalizeRegion(region); + if (isRegion(region)) { + tag.region = canonicalizeRegion(region); hasSubtag = true; } // Special handling for no_NO_NY - use nn_NO for language tag - if (tag._language.equals("no") && tag._region.equals("NO") && variant.equals("NY")) { - tag._language = "nn"; + if (tag.language.equals("no") && tag.region.equals("NO") && variant.equals("NY")) { + tag.language = "nn"; variant = ""; } @@ -463,13 +462,13 @@ break; } if (variants == null) { - variants = new ArrayList(); + variants = new ArrayList<>(); } variants.add(var); // Do not canonicalize! varitr.next(); } if (variants != null) { - tag._variants = variants; + tag.variants = variants; hasSubtag = true; } if (!varitr.isDone()) { @@ -496,21 +495,23 @@ List extensions = null; String privateuse = null; - Set locextKeys = localeExtensions.getKeys(); - for (Character locextKey : locextKeys) { - Extension ext = localeExtensions.getExtension(locextKey); - if (isPrivateusePrefixChar(locextKey.charValue())) { - privateuse = ext.getValue(); - } else { - if (extensions == null) { - extensions = new ArrayList(); + if (localeExtensions != null) { + Set locextKeys = localeExtensions.getKeys(); + for (Character locextKey : locextKeys) { + Extension ext = localeExtensions.getExtension(locextKey); + if (isPrivateusePrefixChar(locextKey)) { + privateuse = ext.getValue(); + } else { + if (extensions == null) { + extensions = new ArrayList<>(); + } + extensions.add(locextKey.toString() + SEP + ext.getValue()); } - extensions.add(locextKey.toString() + SEP + ext.getValue()); } } if (extensions != null) { - tag._extensions = extensions; + tag.extensions = extensions; hasSubtag = true; } @@ -519,19 +520,20 @@ if (privateuse == null) { privateuse = PRIVUSE_VARIANT_PREFIX + SEP + privuseVar; } else { - privateuse = privateuse + SEP + PRIVUSE_VARIANT_PREFIX + SEP + privuseVar.replace(BaseLocale.SEP, SEP); + privateuse = privateuse + SEP + PRIVUSE_VARIANT_PREFIX + + SEP + privuseVar.replace(BaseLocale.SEP, SEP); } } if (privateuse != null) { - tag._privateuse = privateuse; + tag.privateuse = privateuse; } - if (tag._language.length() == 0 && (hasSubtag || privateuse == null)) { + if (tag.language.length() == 0 && (hasSubtag || privateuse == null)) { // use lang "und" when 1) no language is available AND // 2) any of other subtags other than private use are available or // no private use tag is available - tag._language = UNDETERMINED; + tag.language = UNDETERMINED; } return tag; @@ -542,31 +544,40 @@ // public String getLanguage() { - return _language; + return language; } public List getExtlangs() { - return Collections.unmodifiableList(_extlangs); + if (extlangs.isEmpty()) { + return Collections.emptyList(); + } + return Collections.unmodifiableList(extlangs); } public String getScript() { - return _script; + return script; } public String getRegion() { - return _region; + return region; } public List getVariants() { - return Collections.unmodifiableList(_variants); + if (variants.isEmpty()) { + return Collections.emptyList(); + } + return Collections.unmodifiableList(variants); } public List getExtensions() { - return Collections.unmodifiableList(_extensions); + if (extensions.isEmpty()) { + return Collections.emptyList(); + } + return Collections.unmodifiableList(extensions); } public String getPrivateuse() { - return _privateuse; + return privateuse; } // @@ -579,25 +590,26 @@ // ; extended language subtags // / 4ALPHA ; or reserved for future use // / 5*8ALPHA ; or registered language subtag - return (s.length() >= 2) && (s.length() <= 8) && AsciiUtil.isAlphaString(s); + int len = s.length(); + return (len >= 2) && (len <= 8) && LocaleUtils.isAlphaString(s); } public static boolean isExtlang(String s) { // extlang = 3ALPHA ; selected ISO 639 codes // *2("-" 3ALPHA) ; permanently reserved - return (s.length() == 3) && AsciiUtil.isAlphaString(s); + return (s.length() == 3) && LocaleUtils.isAlphaString(s); } public static boolean isScript(String s) { // script = 4ALPHA ; ISO 15924 code - return (s.length() == 4) && AsciiUtil.isAlphaString(s); + return (s.length() == 4) && LocaleUtils.isAlphaString(s); } public static boolean isRegion(String s) { // region = 2ALPHA ; ISO 3166-1 code // / 3DIGIT ; UN M.49 code - return ((s.length() == 2) && AsciiUtil.isAlphaString(s)) - || ((s.length() == 3) && AsciiUtil.isNumericString(s)); + return ((s.length() == 2) && LocaleUtils.isAlphaString(s)) + || ((s.length() == 3) && LocaleUtils.isNumericString(s)); } public static boolean isVariant(String s) { @@ -605,13 +617,13 @@ // / (DIGIT 3alphanum) int len = s.length(); if (len >= 5 && len <= 8) { - return AsciiUtil.isAlphaNumericString(s); + return LocaleUtils.isAlphaNumericString(s); } if (len == 4) { - return AsciiUtil.isNumeric(s.charAt(0)) - && AsciiUtil.isAlphaNumeric(s.charAt(1)) - && AsciiUtil.isAlphaNumeric(s.charAt(2)) - && AsciiUtil.isAlphaNumeric(s.charAt(3)); + return LocaleUtils.isNumeric(s.charAt(0)) + && LocaleUtils.isAlphaNumeric(s.charAt(1)) + && LocaleUtils.isAlphaNumeric(s.charAt(2)) + && LocaleUtils.isAlphaNumeric(s.charAt(3)); } return false; } @@ -624,8 +636,8 @@ // / %x79-7A ; y - z return (s.length() == 1) - && AsciiUtil.isAlphaString(s) - && !AsciiUtil.caseIgnoreMatch(PRIVATEUSE, s); + && LocaleUtils.isAlphaString(s) + && !LocaleUtils.caseIgnoreMatch(PRIVATEUSE, s); } public static boolean isExtensionSingletonChar(char c) { @@ -634,22 +646,24 @@ public static boolean isExtensionSubtag(String s) { // extension = singleton 1*("-" (2*8alphanum)) - return (s.length() >= 2) && (s.length() <= 8) && AsciiUtil.isAlphaNumericString(s); + int len = s.length(); + return (len >= 2) && (len <= 8) && LocaleUtils.isAlphaNumericString(s); } public static boolean isPrivateusePrefix(String s) { // privateuse = "x" 1*("-" (1*8alphanum)) return (s.length() == 1) - && AsciiUtil.caseIgnoreMatch(PRIVATEUSE, s); + && LocaleUtils.caseIgnoreMatch(PRIVATEUSE, s); } public static boolean isPrivateusePrefixChar(char c) { - return (AsciiUtil.caseIgnoreMatch(PRIVATEUSE, String.valueOf(c))); + return (LocaleUtils.caseIgnoreMatch(PRIVATEUSE, String.valueOf(c))); } public static boolean isPrivateuseSubtag(String s) { // privateuse = "x" 1*("-" (1*8alphanum)) - return (s.length() >= 1) && (s.length() <= 8) && AsciiUtil.isAlphaNumericString(s); + int len = s.length(); + return (len >= 1) && (len <= 8) && LocaleUtils.isAlphaNumericString(s); } // @@ -657,76 +671,77 @@ // public static String canonicalizeLanguage(String s) { - return AsciiUtil.toLowerString(s); + return LocaleUtils.toLowerString(s); } public static String canonicalizeExtlang(String s) { - return AsciiUtil.toLowerString(s); + return LocaleUtils.toLowerString(s); } public static String canonicalizeScript(String s) { - return AsciiUtil.toTitleString(s); + return LocaleUtils.toTitleString(s); } public static String canonicalizeRegion(String s) { - return AsciiUtil.toUpperString(s); + return LocaleUtils.toUpperString(s); } public static String canonicalizeVariant(String s) { - return AsciiUtil.toLowerString(s); + return LocaleUtils.toLowerString(s); } public static String canonicalizeExtension(String s) { - return AsciiUtil.toLowerString(s); + return LocaleUtils.toLowerString(s); } public static String canonicalizeExtensionSingleton(String s) { - return AsciiUtil.toLowerString(s); + return LocaleUtils.toLowerString(s); } public static String canonicalizeExtensionSubtag(String s) { - return AsciiUtil.toLowerString(s); + return LocaleUtils.toLowerString(s); } public static String canonicalizePrivateuse(String s) { - return AsciiUtil.toLowerString(s); + return LocaleUtils.toLowerString(s); } public static String canonicalizePrivateuseSubtag(String s) { - return AsciiUtil.toLowerString(s); + return LocaleUtils.toLowerString(s); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); - if (_language.length() > 0) { - sb.append(_language); + if (language.length() > 0) { + sb.append(language); - for (String extlang : _extlangs) { + for (String extlang : extlangs) { sb.append(SEP).append(extlang); } - if (_script.length() > 0) { - sb.append(SEP).append(_script); + if (script.length() > 0) { + sb.append(SEP).append(script); } - if (_region.length() > 0) { - sb.append(SEP).append(_region); + if (region.length() > 0) { + sb.append(SEP).append(region); } - for (String variant : _extlangs) { + for (String variant : variants) { sb.append(SEP).append(variant); } - for (String extension : _extensions) { + for (String extension : extensions) { sb.append(SEP).append(extension); } } - if (_privateuse.length() > 0) { + if (privateuse.length() > 0) { if (sb.length() > 0) { sb.append(SEP); } - sb.append(_privateuse); + sb.append(privateuse); } return sb.toString(); diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/util/locale/LocaleExtensions.java --- a/jdk/src/share/classes/sun/util/locale/LocaleExtensions.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/util/locale/LocaleExtensions.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,6 +36,7 @@ import java.util.Map.Entry; import java.util.Set; import java.util.SortedMap; +import java.util.SortedSet; import java.util.TreeMap; import java.util.TreeSet; @@ -45,55 +46,45 @@ public class LocaleExtensions { - private SortedMap _map; - private String _id; + private final Map extensionMap; + private final String id; - private static final SortedMap EMPTY_MAP = - Collections.unmodifiableSortedMap(new TreeMap()); - - public static final LocaleExtensions EMPTY_EXTENSIONS; - public static final LocaleExtensions CALENDAR_JAPANESE; - public static final LocaleExtensions NUMBER_THAI; + public static final LocaleExtensions CALENDAR_JAPANESE + = new LocaleExtensions("u-ca-japanese", + UnicodeLocaleExtension.SINGLETON, + UnicodeLocaleExtension.CA_JAPANESE); - static { - EMPTY_EXTENSIONS = new LocaleExtensions(); - EMPTY_EXTENSIONS._id = ""; - EMPTY_EXTENSIONS._map = EMPTY_MAP; + public static final LocaleExtensions NUMBER_THAI + = new LocaleExtensions("u-nu-thai", + UnicodeLocaleExtension.SINGLETON, + UnicodeLocaleExtension.NU_THAI); - CALENDAR_JAPANESE = new LocaleExtensions(); - CALENDAR_JAPANESE._id = "u-ca-japanese"; - CALENDAR_JAPANESE._map = new TreeMap(); - CALENDAR_JAPANESE._map.put(Character.valueOf(UnicodeLocaleExtension.SINGLETON), UnicodeLocaleExtension.CA_JAPANESE); - - NUMBER_THAI = new LocaleExtensions(); - NUMBER_THAI._id = "u-nu-thai"; - NUMBER_THAI._map = new TreeMap(); - NUMBER_THAI._map.put(Character.valueOf(UnicodeLocaleExtension.SINGLETON), UnicodeLocaleExtension.NU_THAI); - } - - private LocaleExtensions() { + private LocaleExtensions(String id, Character key, Extension value) { + this.id = id; + this.extensionMap = Collections.singletonMap(key, value); } /* - * Package local constructor, only used by InternalLocaleBuilder. + * Package private constructor, only used by InternalLocaleBuilder. */ LocaleExtensions(Map extensions, - Set uattributes, Map ukeywords) { - boolean hasExtension = (extensions != null && extensions.size() > 0); - boolean hasUAttributes = (uattributes != null && uattributes.size() > 0); - boolean hasUKeywords = (ukeywords != null && ukeywords.size() > 0); + Set uattributes, + Map ukeywords) { + boolean hasExtension = !LocaleUtils.isEmpty(extensions); + boolean hasUAttributes = !LocaleUtils.isEmpty(uattributes); + boolean hasUKeywords = !LocaleUtils.isEmpty(ukeywords); if (!hasExtension && !hasUAttributes && !hasUKeywords) { - _map = EMPTY_MAP; - _id = ""; + id = ""; + extensionMap = Collections.emptyMap(); return; } // Build extension map - _map = new TreeMap(); + SortedMap map = new TreeMap<>(); if (hasExtension) { for (Entry ext : extensions.entrySet()) { - char key = AsciiUtil.toLower(ext.getKey().value()); + char key = LocaleUtils.toLower(ext.getKey().value()); String value = ext.getValue(); if (LanguageTag.isPrivateusePrefixChar(key)) { @@ -104,54 +95,57 @@ } } - Extension e = new Extension(key, AsciiUtil.toLowerString(value)); - _map.put(Character.valueOf(key), e); + map.put(key, new Extension(key, LocaleUtils.toLowerString(value))); } } if (hasUAttributes || hasUKeywords) { - TreeSet uaset = null; - TreeMap ukmap = null; + SortedSet uaset = null; + SortedMap ukmap = null; if (hasUAttributes) { - uaset = new TreeSet(); + uaset = new TreeSet<>(); for (CaseInsensitiveString cis : uattributes) { - uaset.add(AsciiUtil.toLowerString(cis.value())); + uaset.add(LocaleUtils.toLowerString(cis.value())); } } if (hasUKeywords) { - ukmap = new TreeMap(); + ukmap = new TreeMap<>(); for (Entry kwd : ukeywords.entrySet()) { - String key = AsciiUtil.toLowerString(kwd.getKey().value()); - String type = AsciiUtil.toLowerString(kwd.getValue()); + String key = LocaleUtils.toLowerString(kwd.getKey().value()); + String type = LocaleUtils.toLowerString(kwd.getValue()); ukmap.put(key, type); } } UnicodeLocaleExtension ule = new UnicodeLocaleExtension(uaset, ukmap); - _map.put(Character.valueOf(UnicodeLocaleExtension.SINGLETON), ule); + map.put(UnicodeLocaleExtension.SINGLETON, ule); } - if (_map.size() == 0) { + if (map.isEmpty()) { // this could happen when only privuateuse with special variant - _map = EMPTY_MAP; - _id = ""; + id = ""; + extensionMap = Collections.emptyMap(); } else { - _id = toID(_map); + id = toID(map); + extensionMap = map; } } public Set getKeys() { - return Collections.unmodifiableSet(_map.keySet()); + if (extensionMap.isEmpty()) { + return Collections.emptySet(); + } + return Collections.unmodifiableSet(extensionMap.keySet()); } public Extension getExtension(Character key) { - return _map.get(Character.valueOf(AsciiUtil.toLower(key.charValue()))); + return extensionMap.get(LocaleUtils.toLower(key)); } public String getExtensionValue(Character key) { - Extension ext = _map.get(Character.valueOf(AsciiUtil.toLower(key.charValue()))); + Extension ext = extensionMap.get(LocaleUtils.toLower(key)); if (ext == null) { return null; } @@ -159,7 +153,7 @@ } public Set getUnicodeLocaleAttributes() { - Extension ext = _map.get(Character.valueOf(UnicodeLocaleExtension.SINGLETON)); + Extension ext = extensionMap.get(UnicodeLocaleExtension.SINGLETON); if (ext == null) { return Collections.emptySet(); } @@ -168,7 +162,7 @@ } public Set getUnicodeLocaleKeys() { - Extension ext = _map.get(Character.valueOf(UnicodeLocaleExtension.SINGLETON)); + Extension ext = extensionMap.get(UnicodeLocaleExtension.SINGLETON); if (ext == null) { return Collections.emptySet(); } @@ -177,16 +171,16 @@ } public String getUnicodeLocaleType(String unicodeLocaleKey) { - Extension ext = _map.get(Character.valueOf(UnicodeLocaleExtension.SINGLETON)); + Extension ext = extensionMap.get(UnicodeLocaleExtension.SINGLETON); if (ext == null) { return null; } assert (ext instanceof UnicodeLocaleExtension); - return ((UnicodeLocaleExtension)ext).getUnicodeLocaleType(AsciiUtil.toLowerString(unicodeLocaleKey)); + return ((UnicodeLocaleExtension)ext).getUnicodeLocaleType(LocaleUtils.toLowerString(unicodeLocaleKey)); } public boolean isEmpty() { - return _map.isEmpty(); + return extensionMap.isEmpty(); } public static boolean isValidKey(char c) { @@ -201,7 +195,7 @@ StringBuilder buf = new StringBuilder(); Extension privuse = null; for (Entry entry : map.entrySet()) { - char singleton = entry.getKey().charValue(); + char singleton = entry.getKey(); Extension extension = entry.getValue(); if (LanguageTag.isPrivateusePrefixChar(singleton)) { privuse = extension; @@ -221,19 +215,21 @@ return buf.toString(); } - + @Override public String toString() { - return _id; + return id; } public String getID() { - return _id; + return id; } + @Override public int hashCode() { - return _id.hashCode(); + return id.hashCode(); } + @Override public boolean equals(Object other) { if (this == other) { return true; @@ -241,6 +237,6 @@ if (!(other instanceof LocaleExtensions)) { return false; } - return this._id.equals(((LocaleExtensions)other)._id); + return id.equals(((LocaleExtensions)other).id); } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/util/locale/LocaleObjectCache.java --- a/jdk/src/share/classes/sun/util/locale/LocaleObjectCache.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/util/locale/LocaleObjectCache.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,24 +34,25 @@ import java.lang.ref.ReferenceQueue; import java.lang.ref.SoftReference; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; public abstract class LocaleObjectCache { - private ConcurrentHashMap> _map; - private ReferenceQueue _queue = new ReferenceQueue(); + private ConcurrentMap> map; + private ReferenceQueue queue = new ReferenceQueue<>(); public LocaleObjectCache() { this(16, 0.75f, 16); } public LocaleObjectCache(int initialCapacity, float loadFactor, int concurrencyLevel) { - _map = new ConcurrentHashMap>(initialCapacity, loadFactor, concurrencyLevel); + map = new ConcurrentHashMap<>(initialCapacity, loadFactor, concurrencyLevel); } public V get(K key) { V value = null; cleanStaleEntries(); - CacheEntry entry = _map.get(key); + CacheEntry entry = map.get(key); if (entry != null) { value = entry.get(); } @@ -63,11 +64,11 @@ return null; } - CacheEntry newEntry = new CacheEntry(key, newVal, _queue); + CacheEntry newEntry = new CacheEntry<>(key, newVal, queue); while (value == null) { cleanStaleEntries(); - entry = _map.putIfAbsent(key, newEntry); + entry = map.putIfAbsent(key, newEntry); if (entry == null) { value = newVal; break; @@ -79,11 +80,17 @@ return value; } + protected V put(K key, V value) { + CacheEntry entry = new CacheEntry<>(key, value, queue); + CacheEntry oldEntry = map.put(key, entry); + return (oldEntry == null) ? null : oldEntry.get(); + } + @SuppressWarnings("unchecked") private void cleanStaleEntries() { CacheEntry entry; - while ((entry = (CacheEntry)_queue.poll()) != null) { - _map.remove(entry.getKey()); + while ((entry = (CacheEntry)queue.poll()) != null) { + map.remove(entry.getKey()); } } @@ -94,15 +101,15 @@ } private static class CacheEntry extends SoftReference { - private K _key; + private K key; CacheEntry(K key, V value, ReferenceQueue queue) { super(value, queue); - _key = key; + this.key = key; } K getKey() { - return _key; + return key; } } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/util/locale/LocaleSyntaxException.java --- a/jdk/src/share/classes/sun/util/locale/LocaleSyntaxException.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/util/locale/LocaleSyntaxException.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ private static final long serialVersionUID = 1L; - private int _index = -1; + private int index = -1; public LocaleSyntaxException(String msg) { this(msg, 0); @@ -43,10 +43,10 @@ public LocaleSyntaxException(String msg, int errorIndex) { super(msg); - _index = errorIndex; + index = errorIndex; } public int getErrorIndex() { - return _index; + return index; } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/util/locale/LocaleUtils.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/classes/sun/util/locale/LocaleUtils.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + ******************************************************************************* + * Copyright (C) 2009, International Business Machines Corporation and * + * others. All Rights Reserved. * + ******************************************************************************* + */ +package sun.util.locale; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * Collection of static utility methods for Locale support. The + * methods which manipulate characters or strings support ASCII only. + */ +public final class LocaleUtils { + + private LocaleUtils() { + } + + /** + * Compares two ASCII Strings s1 and s2, ignoring case. + */ + public static boolean caseIgnoreMatch(String s1, String s2) { + if (s1 == s2) { + return true; + } + + int len = s1.length(); + if (len != s2.length()) { + return false; + } + + for (int i = 0; i < len; i++) { + char c1 = s1.charAt(i); + char c2 = s2.charAt(i); + if (c1 != c2 && toLower(c1) != toLower(c2)) { + return false; + } + } + return true; + } + + static int caseIgnoreCompare(String s1, String s2) { + if (s1 == s2) { + return 0; + } + return toLowerString(s1).compareTo(toLowerString(s2)); + } + + static char toUpper(char c) { + return isLower(c) ? (char)(c - 0x20) : c; + } + + static char toLower(char c) { + return isUpper(c) ? (char)(c + 0x20) : c; + } + + /** + * Converts the given ASCII String to lower-case. + */ + public static String toLowerString(String s) { + int len = s.length(); + int idx = 0; + for (; idx < len; idx++) { + if (isUpper(s.charAt(idx))) { + break; + } + } + if (idx == len) { + return s; + } + + char[] buf = new char[len]; + for (int i = 0; i < len; i++) { + char c = s.charAt(i); + buf[i] = (i < idx) ? c : toLower(c); + } + return new String(buf); + } + + static String toUpperString(String s) { + int len = s.length(); + int idx = 0; + for (; idx < len; idx++) { + if (isLower(s.charAt(idx))) { + break; + } + } + if (idx == len) { + return s; + } + + char[] buf = new char[len]; + for (int i = 0; i < len; i++) { + char c = s.charAt(i); + buf[i] = (i < idx) ? c : toUpper(c); + } + return new String(buf); + } + + static String toTitleString(String s) { + int len; + if ((len = s.length()) == 0) { + return s; + } + int idx = 0; + if (!isLower(s.charAt(idx))) { + for (idx = 1; idx < len; idx++) { + if (isUpper(s.charAt(idx))) { + break; + } + } + } + if (idx == len) { + return s; + } + + char[] buf = new char[len]; + for (int i = 0; i < len; i++) { + char c = s.charAt(i); + if (i == 0 && idx == 0) { + buf[i] = toUpper(c); + } else if (i < idx) { + buf[i] = c; + } else { + buf[i] = toLower(c); + } + } + return new String(buf); + } + + private static boolean isUpper(char c) { + return c >= 'A' && c <= 'Z'; + } + + private static boolean isLower(char c) { + return c >= 'a' && c <= 'z'; + } + + static boolean isAlpha(char c) { + return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); + } + + static boolean isAlphaString(String s) { + int len = s.length(); + for (int i = 0; i < len; i++) { + if (!isAlpha(s.charAt(i))) { + return false; + } + } + return true; + } + + static boolean isNumeric(char c) { + return (c >= '0' && c <= '9'); + } + + static boolean isNumericString(String s) { + int len = s.length(); + for (int i = 0; i < len; i++) { + if (!isNumeric(s.charAt(i))) { + return false; + } + } + return true; + } + + static boolean isAlphaNumeric(char c) { + return isAlpha(c) || isNumeric(c); + } + + static boolean isAlphaNumericString(String s) { + int len = s.length(); + for (int i = 0; i < len; i++) { + if (!isAlphaNumeric(s.charAt(i))) { + return false; + } + } + return true; + } + + static boolean isEmpty(String str) { + return str == null || str.length() == 0; + } + + static boolean isEmpty(Set set) { + return set == null || set.isEmpty(); + } + + static boolean isEmpty(Map map) { + return map == null || map.isEmpty(); + } + + static boolean isEmpty(List list) { + return list == null || list.isEmpty(); + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/util/locale/ParseStatus.java --- a/jdk/src/share/classes/sun/util/locale/ParseStatus.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/util/locale/ParseStatus.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,29 +32,33 @@ package sun.util.locale; public class ParseStatus { - int _parseLength = 0; - int _errorIndex = -1; - String _errorMsg = null; + int parseLength; + int errorIndex; + String errorMsg; + + public ParseStatus() { + reset(); + } public void reset() { - _parseLength = 0; - _errorIndex = -1; - _errorMsg = null; + parseLength = 0; + errorIndex = -1; + errorMsg = null; } public boolean isError() { - return (_errorIndex >= 0); + return (errorIndex >= 0); } public int getErrorIndex() { - return _errorIndex; + return errorIndex; } public int getParseLength() { - return _parseLength; + return parseLength; } public String getErrorMessage() { - return _errorMsg; + return errorMsg; } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/util/locale/StringTokenIterator.java --- a/jdk/src/share/classes/sun/util/locale/StringTokenIterator.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/util/locale/StringTokenIterator.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,87 +31,99 @@ package sun.util.locale; public class StringTokenIterator { - private String _text; - private String _dlms; + private String text; + private String dlms; // null if a single char delimiter + private char delimiterChar; // delimiter if a single char delimiter - private String _token; - private int _start; - private int _end; - private boolean _done; + private String token; + private int start; + private int end; + private boolean done; public StringTokenIterator(String text, String dlms) { - _text = text; - _dlms = dlms; + this.text = text; + if (dlms.length() == 1) { + delimiterChar = dlms.charAt(0); + } else { + this.dlms = dlms; + } setStart(0); } public String first() { setStart(0); - return _token; + return token; } public String current() { - return _token; + return token; } public int currentStart() { - return _start; + return start; } public int currentEnd() { - return _end; + return end; } public boolean isDone() { - return _done; + return done; } public String next() { if (hasNext()) { - _start = _end + 1; - _end = nextDelimiter(_start); - _token = _text.substring(_start, _end); + start = end + 1; + end = nextDelimiter(start); + token = text.substring(start, end); } else { - _start = _end; - _token = null; - _done = true; + start = end; + token = null; + done = true; } - return _token; + return token; } public boolean hasNext() { - return (_end < _text.length()); + return (end < text.length()); } public StringTokenIterator setStart(int offset) { - if (offset > _text.length()) { + if (offset > text.length()) { throw new IndexOutOfBoundsException(); } - _start = offset; - _end = nextDelimiter(_start); - _token = _text.substring(_start, _end); - _done = false; + start = offset; + end = nextDelimiter(start); + token = text.substring(start, end); + done = false; return this; } public StringTokenIterator setText(String text) { - _text = text; + this.text = text; setStart(0); return this; } private int nextDelimiter(int start) { - int idx = start; - outer: while (idx < _text.length()) { - char c = _text.charAt(idx); - for (int i = 0; i < _dlms.length(); i++) { - if (c == _dlms.charAt(i)) { - break outer; + int textlen = this.text.length(); + if (dlms == null) { + for (int idx = start; idx < textlen; idx++) { + if (text.charAt(idx) == delimiterChar) { + return idx; } } - idx++; + } else { + int dlmslen = dlms.length(); + for (int idx = start; idx < textlen; idx++) { + char c = text.charAt(idx); + for (int i = 0; i < dlmslen; i++) { + if (c == dlms.charAt(i)) { + return idx; + } + } + } } - return idx; + return textlen; } } - diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/util/locale/UnicodeLocaleExtension.java --- a/jdk/src/share/classes/sun/util/locale/UnicodeLocaleExtension.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/util/locale/UnicodeLocaleExtension.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,6 @@ + /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,56 +33,48 @@ package sun.util.locale; import java.util.Collections; +import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.SortedMap; import java.util.SortedSet; -import java.util.TreeMap; -import java.util.TreeSet; public class UnicodeLocaleExtension extends Extension { public static final char SINGLETON = 'u'; - private static final SortedSet EMPTY_SORTED_SET = new TreeSet(); - private static final SortedMap EMPTY_SORTED_MAP = new TreeMap(); - - private SortedSet _attributes = EMPTY_SORTED_SET; - private SortedMap _keywords = EMPTY_SORTED_MAP; - - public static final UnicodeLocaleExtension CA_JAPANESE; - public static final UnicodeLocaleExtension NU_THAI; + private final Set attributes; + private final Map keywords; - static { - CA_JAPANESE = new UnicodeLocaleExtension(); - CA_JAPANESE._keywords = new TreeMap(); - CA_JAPANESE._keywords.put("ca", "japanese"); - CA_JAPANESE._value = "ca-japanese"; + public static final UnicodeLocaleExtension CA_JAPANESE + = new UnicodeLocaleExtension("ca", "japanese"); + public static final UnicodeLocaleExtension NU_THAI + = new UnicodeLocaleExtension("nu", "thai"); - NU_THAI = new UnicodeLocaleExtension(); - NU_THAI._keywords = new TreeMap(); - NU_THAI._keywords.put("nu", "thai"); - NU_THAI._value = "nu-thai"; - } - - private UnicodeLocaleExtension() { - super(SINGLETON); + private UnicodeLocaleExtension(String key, String value) { + super(SINGLETON, key + "-" + value); + attributes = Collections.emptySet(); + keywords = Collections.singletonMap(key, value); } UnicodeLocaleExtension(SortedSet attributes, SortedMap keywords) { - this(); - if (attributes != null && attributes.size() > 0) { - _attributes = attributes; + super(SINGLETON); + if (attributes != null) { + this.attributes = attributes; + } else { + this.attributes = Collections.emptySet(); } - if (keywords != null && keywords.size() > 0) { - _keywords = keywords; + if (keywords != null) { + this.keywords = keywords; + } else { + this.keywords = Collections.emptyMap(); } - if (_attributes.size() > 0 || _keywords.size() > 0) { + if (!this.attributes.isEmpty() || !this.keywords.isEmpty()) { StringBuilder sb = new StringBuilder(); - for (String attribute : _attributes) { + for (String attribute : this.attributes) { sb.append(LanguageTag.SEP).append(attribute); } - for (Entry keyword : _keywords.entrySet()) { + for (Entry keyword : this.keywords.entrySet()) { String key = keyword.getKey(); String value = keyword.getValue(); @@ -90,38 +83,46 @@ sb.append(LanguageTag.SEP).append(value); } } - _value = sb.substring(1); // skip leading '-' + setValue(sb.substring(1)); // skip leading '-' } } public Set getUnicodeLocaleAttributes() { - return Collections.unmodifiableSet(_attributes); + if (attributes == Collections.EMPTY_SET) { + return attributes; + } + return Collections.unmodifiableSet(attributes); } public Set getUnicodeLocaleKeys() { - return Collections.unmodifiableSet(_keywords.keySet()); + if (keywords == Collections.EMPTY_MAP) { + return Collections.emptySet(); + } + return Collections.unmodifiableSet(keywords.keySet()); } public String getUnicodeLocaleType(String unicodeLocaleKey) { - return _keywords.get(unicodeLocaleKey); + return keywords.get(unicodeLocaleKey); } public static boolean isSingletonChar(char c) { - return (SINGLETON == AsciiUtil.toLower(c)); + return (SINGLETON == LocaleUtils.toLower(c)); } public static boolean isAttribute(String s) { // 3*8alphanum - return (s.length() >= 3) && (s.length() <= 8) && AsciiUtil.isAlphaNumericString(s); + int len = s.length(); + return (len >= 3) && (len <= 8) && LocaleUtils.isAlphaNumericString(s); } public static boolean isKey(String s) { // 2alphanum - return (s.length() == 2) && AsciiUtil.isAlphaNumericString(s); + return (s.length() == 2) && LocaleUtils.isAlphaNumericString(s); } public static boolean isTypeSubtag(String s) { // 3*8alphanum - return (s.length() >= 3) && (s.length() <= 8) && AsciiUtil.isAlphaNumericString(s); + int len = s.length(); + return (len >= 3) && (len <= 8) && LocaleUtils.isAlphaNumericString(s); } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java Wed Jul 05 17:42:05 2017 +0200 @@ -43,822 +43,824 @@ public final class TimeZoneNames_pt_BR extends TimeZoneNamesBundle { protected final Object[][] getContents() { - String ACT[] = new String[] {"Fuso hor\u00e1rio do Acre", "ACT", - "Fuso hor\u00e1rio de ver\u00e3o do Acre", "ACST"}; - String ADELAIDE[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central (Austr\u00e1lia do Sul)", "CST", - "Fuso hor\u00e1rio de ver\u00e3o central (Austr\u00e1lia do Sul)", "CST"}; - String AGT[] = new String[] {"Fuso hor\u00e1rio da Argentina", "ART", - "Fuso hor\u00e1rio de ver\u00e3o da Argentina", "ARST"}; - String AKST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Alaska", "AKST", - "Hor\u00e1rio de luz natural do Alaska", "AKDT"}; - String AMT[] = new String[] {"Fuso hor\u00e1rio do Amazonas", "AMT", - "Fuso hor\u00e1rio de ver\u00e3o do Amazonas", "AMST"}; - String ARAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da Ar\u00e1bia", "AST", - "Hor\u00e1rio de luz natural da Ar\u00e1bia", "ADT"}; - String ARMT[] = new String[] {"Fuso hor\u00e1rio da Arm\u00eania", "AMT", - "Fuso hor\u00e1rio de ver\u00e3o da Arm\u00eania", "AMST"}; - String AST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Atl\u00e2ntico", "AST", - "Hor\u00e1rio de luz natural do Atl\u00e2ntico", "ADT"}; - String BDT[] = new String[] {"Fuso hor\u00e1rio de Bangladesh", "BDT", - "Fuso hor\u00e1rio de ver\u00e3o de Bangladesh", "BDST"}; - String BRISBANE[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Queensland)", "EST", - "Fuso hor\u00e1rio de ver\u00e3o oriental (Queensland)", "EST"}; - String BROKEN_HILL[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central (Austr\u00e1lia do Sul/Nova Gales do Sul)", "CST", - "Fuso hor\u00e1rio de ver\u00e3o central (Austr\u00e1lia do Sul/Nova Gales do Sul)", "CST"}; - String BRT[] = new String[] {"Fuso hor\u00e1rio de Bras\u00edlia", "BRT", - "Fuso hor\u00e1rio de ver\u00e3o de Bras\u00edlia", "BRST"}; - String BTT[] = new String[] {"Fuso hor\u00e1rio de But\u00e3o", "BTT", - "Fuso hor\u00e1rio de ver\u00e3o de But\u00e3o", "BTST"}; - String CAT[] = new String[] {"Fuso hor\u00e1rio da \u00c1frica Central", "CAT", - "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica Central", "CAST"}; - String CET[] = new String[] {"Fuso hor\u00e1rio da Europa Central", "CET", - "Fuso hor\u00e1rio de ver\u00e3o da Europa Central", "CEST"}; - String CHAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Chatham", "CHAST", - "Hor\u00e1rio de luz natural de Chatham", "CHADT"}; - String CIT[] = new String[] {"Fuso hor\u00e1rio da Indon\u00e9sia Central", "CIT", - "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Central", "CIST"}; - String CLT[] = new String[] {"Fuso hor\u00e1rio do Chile", "CLT", - "Fuso hor\u00e1rio de ver\u00e3o do Chile", "CLST"}; - String CST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central", "CST", - "Hor\u00e1rio de luz natural central", "CDT"}; - String CTT[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da China", "CST", - "Hor\u00e1rio de luz natural da China", "CDT"}; - String CUBA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Cuba", "CST", - "Hor\u00e1rio de luz natural de Cuba", "CDT"}; - String DARWIN[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central (Territ\u00f3rio do Norte)", "CST", - "Fuso hor\u00e1rio de ver\u00e3o central (Territ\u00f3rio do Norte)", "CST"}; - String DUBLIN[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT", - "Fuso hor\u00e1rio de ver\u00e3o da Irlanda", "IST"}; - String EAT[] = new String[] {"Fuso hor\u00e1rio da \u00c1frica Oriental", "EAT", - "Fuso hor\u00e1rio padr\u00e3o da \u00c1frica Oriental", "EAST"}; - String EASTER[] = new String[] {"Fuso hor\u00e1rio da Ilha de P\u00e1scoa", "EAST", - "Fuso hor\u00e1rio de ver\u00e3o da Ilha de P\u00e1scoa", "EASST"}; - String EET[] = new String[] {"Fuso hor\u00e1rio da Europa Oriental", "EET", - "Fuso hor\u00e1rio de ver\u00e3o da Europa Oriental", "EEST"}; - String EGT[] = new String[] {"Fuso hor\u00e1rio da Groenl\u00e2ndia Oriental", "EGT", - "Fuso hor\u00e1rio de ver\u00e3o da Groenl\u00e2ndia Oriental", "EGST"}; - String EST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental", "EST", - "Hor\u00e1rio de luz natural oriental", "EDT"}; - String EST_NSW[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Nova Gales do Sul)", "EST", - "Fuso hor\u00e1rio de ver\u00e3o oriental (Nova Gales do Sul)", "EST"}; - String GHMT[] = new String[] {"Fuso hor\u00e1rio do meridiano de Gana", "GMT", - "Fuso hor\u00e1rio de ver\u00e3o de Gana", "GHST"}; - String GAMBIER[] = new String[] {"Fuso hor\u00e1rio de Gambier", "GAMT", - "Fuso hor\u00e1rio de ver\u00e3o de Gambier", "GAMST"}; - String GMT[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT", - "Fuso hor\u00e1rio do meridiano de Greenwich", "GMT"}; - String GMTBST[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT", - "Fuso hor\u00e1rio de ver\u00e3o da Gr\u00e3-Bretanha", "BST"}; - String GST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do golfo", "GST", - "Hor\u00e1rio de luz natural do golfo", "GDT"}; - String HAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Hava\u00ed-Aleutian", "HAST", - "Hor\u00e1rio de luz natural do Hava\u00ed-Aleutian", "HADT"}; - String HKT[] = new String[] {"Fuso hor\u00e1rio de Hong Kong", "HKT", - "Fuso hor\u00e1rio de ver\u00e3o de Hong Kong", "HKST"}; - String HST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Hava\u00ed", "HST", - "Hor\u00e1rio de luz natural do Hava\u00ed", "HDT"}; - String ICT[] = new String[] {"Fuso hor\u00e1rio da Indochina", "ICT", - "Fuso hor\u00e1rio de ver\u00e3o da Indochina", "ICST"}; - String IRT[] = new String[] {"Fuso hor\u00e1rio do Ir\u00e3", "IRST", - "Hor\u00e1rio de luz natural do Ir\u00e3", "IRDT"}; - String ISRAEL[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Israel", "IST", - "Hor\u00e1rio de luz natural de Israel", "IDT"}; - String IST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da \u00cdndia", "IST", - "Hor\u00e1rio de luz natural da \u00cdndia", "IDT"}; - String JST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Jap\u00e3o", "JST", - "Hor\u00e1rio de luz natural do Jap\u00e3o", "JDT"}; - String KST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da Coreia", "KST", - "Hor\u00e1rio de luz natural da Coreia", "KDT"}; - String LORD_HOWE[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Lord Howe", "LHST", - "Fuso hor\u00e1rio de ver\u00e3o de Lord Howe", "LHST"}; - String MHT[] = new String[] {"Fuso hor\u00e1rio das Ilhas Marshall", "MHT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Marshall", "MHST"}; - String MSK[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Moscou", "MSK", - "Hor\u00e1rio de luz natural de Moscou", "MSD"}; - String MST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o das montanhas", "MST", - "Hor\u00e1rio de luz natural das montanhas", "MDT"}; - String MYT[] = new String[] {"Fuso hor\u00e1rio da Mal\u00e1sia", "MYT", - "Fuso hor\u00e1rio de ver\u00e3o da Mal\u00e1sia", "MYST"}; - String NORONHA[] = new String[] {"Fuso hor\u00e1rio de Fernando de Noronha", "FNT", - "Fuso hor\u00e1rio de ver\u00e3o de Fernando de Noronha", "FNST"}; - String NOVT[] = new String[] {"Fuso hor\u00e1rio de Novosibirsk", "NOVT", - "Fuso hor\u00e1rio de ver\u00e3o de Novosibirsk", "NOVST"}; + String ACT[] = new String[] {"Fuso hor\u00e1rio do Acre", "ACT", + "Fuso hor\u00e1rio de ver\u00e3o do Acre", "ACST"}; + String ADELAIDE[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central (Austr\u00e1lia do Sul)", "CST", + "Fuso hor\u00e1rio de ver\u00e3o central (Austr\u00e1lia do Sul)", "CST"}; + String AGT[] = new String[] {"Fuso hor\u00e1rio da Argentina", "ART", + "Fuso hor\u00e1rio de ver\u00e3o da Argentina", "ARST"}; + String AKST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Alaska", "AKST", + "Hor\u00e1rio de luz natural do Alaska", "AKDT"}; + String AMT[] = new String[] {"Fuso hor\u00e1rio do Amazonas", "AMT", + "Fuso hor\u00e1rio de ver\u00e3o do Amazonas", "AMST"}; + String ARAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da Ar\u00e1bia", "AST", + "Hor\u00e1rio de luz natural da Ar\u00e1bia", "ADT"}; + String ARMT[] = new String[] {"Fuso hor\u00e1rio da Arm\u00eania", "AMT", + "Fuso hor\u00e1rio de ver\u00e3o da Arm\u00eania", "AMST"}; + String AST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Atl\u00e2ntico", "AST", + "Hor\u00e1rio de luz natural do Atl\u00e2ntico", "ADT"}; + String BDT[] = new String[] {"Fuso hor\u00e1rio de Bangladesh", "BDT", + "Fuso hor\u00e1rio de ver\u00e3o de Bangladesh", "BDST"}; + String BRISBANE[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Queensland)", "EST", + "Fuso hor\u00e1rio de ver\u00e3o oriental (Queensland)", "EST"}; + String BROKEN_HILL[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central (Austr\u00e1lia do Sul/Nova Gales do Sul)", "CST", + "Fuso hor\u00e1rio de ver\u00e3o central (Austr\u00e1lia do Sul/Nova Gales do Sul)", "CST"}; + String BRT[] = new String[] {"Fuso hor\u00e1rio de Bras\u00edlia", "BRT", + "Fuso hor\u00e1rio de ver\u00e3o de Bras\u00edlia", "BRST"}; + String BTT[] = new String[] {"Fuso hor\u00e1rio de But\u00e3o", "BTT", + "Fuso hor\u00e1rio de ver\u00e3o de But\u00e3o", "BTST"}; + String CAT[] = new String[] {"Fuso hor\u00e1rio da \u00c1frica Central", "CAT", + "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica Central", "CAST"}; + String CET[] = new String[] {"Fuso hor\u00e1rio da Europa Central", "CET", + "Fuso hor\u00e1rio de ver\u00e3o da Europa Central", "CEST"}; + String CHAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Chatham", "CHAST", + "Hor\u00e1rio de luz natural de Chatham", "CHADT"}; + String CIT[] = new String[] {"Fuso hor\u00e1rio da Indon\u00e9sia Central", "CIT", + "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Central", "CIST"}; + String CLT[] = new String[] {"Fuso hor\u00e1rio do Chile", "CLT", + "Fuso hor\u00e1rio de ver\u00e3o do Chile", "CLST"}; + String CST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central", "CST", + "Hor\u00e1rio de luz natural central", "CDT"}; + String CTT[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da China", "CST", + "Hor\u00e1rio de luz natural da China", "CDT"}; + String CUBA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Cuba", "CST", + "Hor\u00e1rio de luz natural de Cuba", "CDT"}; + String DARWIN[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central (Territ\u00f3rio do Norte)", "CST", + "Fuso hor\u00e1rio de ver\u00e3o central (Territ\u00f3rio do Norte)", "CST"}; + String DUBLIN[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT", + "Fuso hor\u00e1rio de ver\u00e3o da Irlanda", "IST"}; + String EAT[] = new String[] {"Fuso hor\u00e1rio da \u00c1frica Oriental", "EAT", + "Fuso hor\u00e1rio padr\u00e3o da \u00c1frica Oriental", "EAST"}; + String EASTER[] = new String[] {"Fuso hor\u00e1rio da Ilha de P\u00e1scoa", "EAST", + "Fuso hor\u00e1rio de ver\u00e3o da Ilha de P\u00e1scoa", "EASST"}; + String EET[] = new String[] {"Fuso hor\u00e1rio da Europa Oriental", "EET", + "Fuso hor\u00e1rio de ver\u00e3o da Europa Oriental", "EEST"}; + String EGT[] = new String[] {"Fuso hor\u00e1rio da Groenl\u00e2ndia Oriental", "EGT", + "Fuso hor\u00e1rio de ver\u00e3o da Groenl\u00e2ndia Oriental", "EGST"}; + String EST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental", "EST", + "Hor\u00e1rio de luz natural oriental", "EDT"}; + String EST_NSW[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Nova Gales do Sul)", "EST", + "Fuso hor\u00e1rio de ver\u00e3o oriental (Nova Gales do Sul)", "EST"}; + String GHMT[] = new String[] {"Fuso hor\u00e1rio do meridiano de Gana", "GMT", + "Fuso hor\u00e1rio de ver\u00e3o de Gana", "GHST"}; + String GAMBIER[] = new String[] {"Fuso hor\u00e1rio de Gambier", "GAMT", + "Fuso hor\u00e1rio de ver\u00e3o de Gambier", "GAMST"}; + String GMT[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT", + "Fuso hor\u00e1rio do meridiano de Greenwich", "GMT"}; + String GMTBST[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT", + "Fuso hor\u00e1rio de ver\u00e3o da Gr\u00e3-Bretanha", "BST"}; + String GST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do golfo", "GST", + "Hor\u00e1rio de luz natural do golfo", "GDT"}; + String HAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Hava\u00ed-Aleutian", "HAST", + "Hor\u00e1rio de luz natural do Hava\u00ed-Aleutian", "HADT"}; + String HKT[] = new String[] {"Fuso hor\u00e1rio de Hong Kong", "HKT", + "Fuso hor\u00e1rio de ver\u00e3o de Hong Kong", "HKST"}; + String HST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Hava\u00ed", "HST", + "Hor\u00e1rio de luz natural do Hava\u00ed", "HDT"}; + String ICT[] = new String[] {"Fuso hor\u00e1rio da Indochina", "ICT", + "Fuso hor\u00e1rio de ver\u00e3o da Indochina", "ICST"}; + String IRT[] = new String[] {"Fuso hor\u00e1rio do Ir\u00e3", "IRST", + "Hor\u00e1rio de luz natural do Ir\u00e3", "IRDT"}; + String ISRAEL[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Israel", "IST", + "Hor\u00e1rio de luz natural de Israel", "IDT"}; + String IST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da \u00cdndia", "IST", + "Hor\u00e1rio de luz natural da \u00cdndia", "IDT"}; + String JST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Jap\u00e3o", "JST", + "Hor\u00e1rio de luz natural do Jap\u00e3o", "JDT"}; + String KST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da Coreia", "KST", + "Hor\u00e1rio de luz natural da Coreia", "KDT"}; + String LORD_HOWE[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Lord Howe", "LHST", + "Fuso hor\u00e1rio de ver\u00e3o de Lord Howe", "LHST"}; + String MHT[] = new String[] {"Fuso hor\u00e1rio das Ilhas Marshall", "MHT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Marshall", "MHST"}; + String MSK[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Moscou", "MSK", + "Hor\u00e1rio de luz natural de Moscou", "MSD"}; + String MST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o das montanhas", "MST", + "Hor\u00e1rio de luz natural das montanhas", "MDT"}; + String MYT[] = new String[] {"Fuso hor\u00e1rio da Mal\u00e1sia", "MYT", + "Fuso hor\u00e1rio de ver\u00e3o da Mal\u00e1sia", "MYST"}; + String NORONHA[] = new String[] {"Fuso hor\u00e1rio de Fernando de Noronha", "FNT", + "Fuso hor\u00e1rio de ver\u00e3o de Fernando de Noronha", "FNST"}; + String NOVT[] = new String[] {"Fuso hor\u00e1rio de Novosibirsk", "NOVT", + "Fuso hor\u00e1rio de ver\u00e3o de Novosibirsk", "NOVST"}; String NPT[] = new String[] {"Fuso hor\u00e1rio do Nepal", "NPT", "Fuso hor\u00e1rio de ver\u00e3o do Nepal", "NPST"}; - String NST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Terra Nova", "NST", - "Hor\u00e1rio de luz natural de Terra Nova", "NDT"}; - String NZST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da Nova Zel\u00e2ndia", "NZST", - "Hor\u00e1rio de luz natural da Nova Zel\u00e2ndia", "NZDT"}; + String NST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Terra Nova", "NST", + "Hor\u00e1rio de luz natural de Terra Nova", "NDT"}; + String NZST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da Nova Zel\u00e2ndia", "NZST", + "Hor\u00e1rio de luz natural da Nova Zel\u00e2ndia", "NZDT"}; String PITCAIRN[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Pitcairn", "PST", - "Hor\u00e1rio de luz natural de Pitcairn", "PDT"}; - String PKT[] = new String[] {"Fuso hor\u00e1rio do Paquist\u00e3o", "PKT", - "Fuso hor\u00e1rio de ver\u00e3o do Paquist\u00e3o", "PKST"}; - String PONT[] = new String[] {"Fuso hor\u00e1rio de Pohnpei", "PONT", - "Fuso hor\u00e1rio de ver\u00e3o de Pohnpei", "PONST"}; - String PST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Pac\u00edfico", "PST", - "Hor\u00e1rio de luz natural do Pac\u00edfico", "PDT"}; + "Hor\u00e1rio de luz natural de Pitcairn", "PDT"}; + String PKT[] = new String[] {"Fuso hor\u00e1rio do Paquist\u00e3o", "PKT", + "Fuso hor\u00e1rio de ver\u00e3o do Paquist\u00e3o", "PKST"}; + String PONT[] = new String[] {"Fuso hor\u00e1rio de Pohnpei", "PONT", + "Fuso hor\u00e1rio de ver\u00e3o de Pohnpei", "PONST"}; + String PST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Pac\u00edfico", "PST", + "Hor\u00e1rio de luz natural do Pac\u00edfico", "PDT"}; String RST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental", "EST", "Hor\u00e1rio de luz natural central", "CDT"}; - String SAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da \u00c1frica do Sul", "SAST", - "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica do Sul", "SAST"}; - String SBT[] = new String[] {"Fuso hor\u00e1rio das Ilhas Salom\u00e3o", "SBT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Salom\u00e3o", "SBST"}; - String SGT[] = new String[] {"Fuso hor\u00e1rio de Cingapura", "SGT", - "Fuso hor\u00e1rio de ver\u00e1 de Cingapura", "SGST"}; - String SLST[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT", - "Fuso hor\u00e1rio de ver\u00e3o de Serra Leoa", "SLST"}; - String TASMANIA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Tasm\u00e2nia)", "EST", - "Fuso hor\u00e1rio de ver\u00e3o oriental (Tasm\u00e2nia)", "EST"}; - String TMT[] = new String[] {"Fuso hor\u00e1rio do Turcomenist\u00e3o", "TMT", - "Fuso hor\u00e1rio de ver\u00e3o do Turcomenist\u00e3o", "TMST"}; - String TRUT[] = new String[] {"Fuso hor\u00e1rio de Chuuk", "CHUT", - "Fuso hor\u00e1rio de ver\u00e3o de Chuuk", "CHUST"}; - String ULAT[]= new String[] {"Fuso hor\u00e1rio de Ulan Bator", "ULAT", - "Fuso hor\u00e1rio de ver\u00e3o de Ulan Bator", "ULAST"}; - String WAT[] = new String[] {"Fuso hor\u00e1rio da \u00c1frica Ocidental", "WAT", - "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica Ocidental", "WAST"}; - String WET[] = new String[] {"Fuso hor\u00e1rio da Europa Ocidental", "WET", - "Fuso hor\u00e1rio de ver\u00e3o da Europa Ocidental", "WEST"}; - String WIT[] = new String[] {"Fuso hor\u00e1rio da Indon\u00e9sia Ocidental", "WIT", - "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Ocidental", "WIST"}; - String WST_AUS[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o ocidental (Austr\u00e1lia)", "WST", - "Fuso hor\u00e1rio de ver\u00e3o ocidental (Austr\u00e1lia)", "WST"}; - String SAMOA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Samoa", "SST", - "Hor\u00e1rio de luz natural de Samoa", "SDT"}; - String WST_SAMOA[] = new String[] {"Fuso hor\u00e1rio de Samoa Ocidental", "WST", - "Fuso hor\u00e1rio de ver\u00e3o de Samoa Ocidental", "WSST"}; - String ChST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Chamorro", "ChST", - "Hor\u00e1rio de luz natural de Chamorro", "ChDT"}; - String VICTORIA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Victoria)", "EST", - "Fuso hor\u00e1rio de ver\u00e3o oriental (Victoria)", "EST"}; - String UTC[] = new String[] {"Tempo universal coordenado", "UTC", - "Tempo universal coordenado", "UTC"}; - String UZT[] = new String[] {"Fuso hor\u00e1rio do Uzbequist\u00e3o", "UZT", - "Fuso hor\u00e1rio de ver\u00e3o do Uzbequist\u00e3o", "UZST"}; - String WART[] = new String[] {"Fuso hor\u00e1rio da Argentina Ocidental", "WART", - "Fuso hor\u00e1rio de ver\u00e3o da Argentina Ocidental", "WARST"}; + String SAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da \u00c1frica do Sul", "SAST", + "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica do Sul", "SAST"}; + String SBT[] = new String[] {"Fuso hor\u00e1rio das Ilhas Salom\u00e3o", "SBT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Salom\u00e3o", "SBST"}; + String SGT[] = new String[] {"Fuso hor\u00e1rio de Cingapura", "SGT", + "Fuso hor\u00e1rio de ver\u00e1 de Cingapura", "SGST"}; + String SLST[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT", + "Fuso hor\u00e1rio de ver\u00e3o de Serra Leoa", "SLST"}; + String TASMANIA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Tasm\u00e2nia)", "EST", + "Fuso hor\u00e1rio de ver\u00e3o oriental (Tasm\u00e2nia)", "EST"}; + String TMT[] = new String[] {"Fuso hor\u00e1rio do Turcomenist\u00e3o", "TMT", + "Fuso hor\u00e1rio de ver\u00e3o do Turcomenist\u00e3o", "TMST"}; + String TRUT[] = new String[] {"Fuso hor\u00e1rio de Chuuk", "CHUT", + "Fuso hor\u00e1rio de ver\u00e3o de Chuuk", "CHUST"}; + String ULAT[]= new String[] {"Fuso hor\u00e1rio de Ulan Bator", "ULAT", + "Fuso hor\u00e1rio de ver\u00e3o de Ulan Bator", "ULAST"}; + String WAT[] = new String[] {"Fuso hor\u00e1rio da \u00c1frica Ocidental", "WAT", + "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica Ocidental", "WAST"}; + String WET[] = new String[] {"Fuso hor\u00e1rio da Europa Ocidental", "WET", + "Fuso hor\u00e1rio de ver\u00e3o da Europa Ocidental", "WEST"}; + String WIT[] = new String[] {"Fuso hor\u00e1rio da Indon\u00e9sia Ocidental", "WIT", + "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Ocidental", "WIST"}; + String WST_AUS[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o ocidental (Austr\u00e1lia)", "WST", + "Fuso hor\u00e1rio de ver\u00e3o ocidental (Austr\u00e1lia)", "WST"}; + String SAMOA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Samoa", "SST", + "Hor\u00e1rio de luz natural de Samoa", "SDT"}; + String WST_SAMOA[] = new String[] {"Fuso hor\u00e1rio de Samoa Ocidental", "WST", + "Fuso hor\u00e1rio de ver\u00e3o de Samoa Ocidental", "WSST"}; + String ChST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Chamorro", "ChST", + "Hor\u00e1rio de luz natural de Chamorro", "ChDT"}; + String VICTORIA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Victoria)", "EST", + "Fuso hor\u00e1rio de ver\u00e3o oriental (Victoria)", "EST"}; + String UTC[] = new String[] {"Tempo universal coordenado", "UTC", + "Tempo universal coordenado", "UTC"}; + String UZT[] = new String[] {"Fuso hor\u00e1rio do Uzbequist\u00e3o", "UZT", + "Fuso hor\u00e1rio de ver\u00e3o do Uzbequist\u00e3o", "UZST"}; + String WART[] = new String[] {"Fuso hor\u00e1rio da Argentina Ocidental", "WART", + "Fuso hor\u00e1rio de ver\u00e3o da Argentina Ocidental", "WARST"}; - - return new Object[][] { - {"America/Los_Angeles", PST}, - {"PST", PST}, - {"America/Denver", MST}, - {"MST", MST}, - {"America/Phoenix", MST}, - {"PNT", MST}, - {"America/Chicago", CST}, - {"CST", CST}, - {"America/New_York", EST}, - {"EST", EST}, - {"America/Indianapolis", EST}, - {"IET", EST}, - {"Pacific/Honolulu", HST}, - {"HST", HST}, - {"America/Anchorage", AKST}, - {"AST", AKST}, - {"America/Halifax", AST}, - {"America/Sitka", AKST}, - {"America/St_Johns", NST}, - {"CNT", NST}, - {"Europe/Paris", CET}, - {"ECT", CET}, - {"GMT", GMT}, - {"Africa/Casablanca", WET}, - {"Asia/Jerusalem", ISRAEL}, - {"Asia/Tokyo", JST}, - {"JST", JST}, - {"Europe/Bucharest", EET}, - {"Asia/Shanghai", CTT}, - {"CTT", CTT}, - /* Don't change the order of the above zones - * to keep compatibility with the previous version. - */ + return new Object[][] { + {"America/Los_Angeles", PST}, + {"PST", PST}, + {"America/Denver", MST}, + {"MST", MST}, + {"America/Phoenix", MST}, + {"PNT", MST}, + {"America/Chicago", CST}, + {"CST", CST}, + {"America/New_York", EST}, + {"EST", EST}, + {"America/Indianapolis", EST}, + {"IET", EST}, + {"Pacific/Honolulu", HST}, + {"HST", HST}, + {"America/Anchorage", AKST}, + {"AST", AKST}, + {"America/Halifax", AST}, + {"America/Sitka", AKST}, + {"America/St_Johns", NST}, + {"CNT", NST}, + {"Europe/Paris", CET}, + {"ECT", CET}, + {"GMT", GMT}, + {"Africa/Casablanca", WET}, + {"Asia/Jerusalem", ISRAEL}, + {"Asia/Tokyo", JST}, + {"JST", JST}, + {"Europe/Bucharest", EET}, + {"Asia/Shanghai", CTT}, + {"CTT", CTT}, + /* Don't change the order of the above zones + * to keep compatibility with the previous version. + */ - {"ACT", DARWIN}, - {"AET", EST_NSW}, - {"AGT", AGT}, - {"ART", EET}, - {"Africa/Abidjan", GMT}, - {"Africa/Accra", GHMT}, - {"Africa/Addis_Ababa", EAT}, - {"Africa/Algiers", CET}, - {"Africa/Asmara", EAT}, - {"Africa/Asmera", EAT}, - {"Africa/Bamako", GMT}, - {"Africa/Bangui", WAT}, - {"Africa/Banjul", GMT}, - {"Africa/Bissau", GMT}, - {"Africa/Blantyre", CAT}, - {"Africa/Brazzaville", WAT}, - {"Africa/Bujumbura", CAT}, - {"Africa/Cairo", EET}, - {"Africa/Ceuta", CET}, - {"Africa/Conakry", GMT}, - {"Africa/Dakar", GMT}, - {"Africa/Dar_es_Salaam", EAT}, - {"Africa/Djibouti", EAT}, - {"Africa/Douala", WAT}, - {"Africa/El_Aaiun", WET}, - {"Africa/Freetown", SLST}, - {"Africa/Gaborone", CAT}, - {"Africa/Harare", CAT}, - {"Africa/Johannesburg", SAST}, - {"Africa/Kampala", EAT}, - {"Africa/Khartoum", EAT}, - {"Africa/Kigali", CAT}, - {"Africa/Kinshasa", WAT}, - {"Africa/Lagos", WAT}, - {"Africa/Libreville", WAT}, - {"Africa/Lome", GMT}, - {"Africa/Luanda", WAT}, - {"Africa/Lubumbashi", CAT}, - {"Africa/Lusaka", CAT}, - {"Africa/Malabo", WAT}, - {"Africa/Maputo", CAT}, - {"Africa/Maseru", SAST}, - {"Africa/Mbabane", SAST}, - {"Africa/Mogadishu", EAT}, - {"Africa/Monrovia", GMT}, - {"Africa/Nairobi", EAT}, - {"Africa/Ndjamena", WAT}, - {"Africa/Niamey", WAT}, - {"Africa/Nouakchott", GMT}, - {"Africa/Ouagadougou", GMT}, - {"Africa/Porto-Novo", WAT}, - {"Africa/Sao_Tome", GMT}, - {"Africa/Timbuktu", GMT}, - {"Africa/Tripoli", EET}, - {"Africa/Tunis", CET}, - {"Africa/Windhoek", WAT}, - {"America/Adak", HAST}, - {"America/Anguilla", AST}, - {"America/Antigua", AST}, - {"America/Araguaina", BRT}, - {"America/Argentina/Buenos_Aires", AGT}, - {"America/Argentina/Catamarca", AGT}, - {"America/Argentina/ComodRivadavia", AGT}, - {"America/Argentina/Cordoba", AGT}, - {"America/Argentina/Jujuy", AGT}, - {"America/Argentina/La_Rioja", AGT}, - {"America/Argentina/Mendoza", AGT}, - {"America/Argentina/Rio_Gallegos", AGT}, - {"America/Argentina/Salta", AGT}, - {"America/Argentina/San_Juan", AGT}, - {"America/Argentina/San_Luis", WART}, - {"America/Argentina/Tucuman", AGT}, - {"America/Argentina/Ushuaia", AGT}, - {"America/Aruba", AST}, - {"America/Asuncion", new String[] {"Fuso hor\u00e1rio do Paraguai", "PYT", - "Fuso hor\u00e1rio de ver\u00e3o do Paraguai", "PYST"}}, + {"ACT", DARWIN}, + {"AET", EST_NSW}, + {"AGT", AGT}, + {"ART", EET}, + {"Africa/Abidjan", GMT}, + {"Africa/Accra", GHMT}, + {"Africa/Addis_Ababa", EAT}, + {"Africa/Algiers", CET}, + {"Africa/Asmara", EAT}, + {"Africa/Asmera", EAT}, + {"Africa/Bamako", GMT}, + {"Africa/Bangui", WAT}, + {"Africa/Banjul", GMT}, + {"Africa/Bissau", GMT}, + {"Africa/Blantyre", CAT}, + {"Africa/Brazzaville", WAT}, + {"Africa/Bujumbura", CAT}, + {"Africa/Cairo", EET}, + {"Africa/Ceuta", CET}, + {"Africa/Conakry", GMT}, + {"Africa/Dakar", GMT}, + {"Africa/Dar_es_Salaam", EAT}, + {"Africa/Djibouti", EAT}, + {"Africa/Douala", WAT}, + {"Africa/El_Aaiun", WET}, + {"Africa/Freetown", SLST}, + {"Africa/Gaborone", CAT}, + {"Africa/Harare", CAT}, + {"Africa/Johannesburg", SAST}, + {"Africa/Kampala", EAT}, + {"Africa/Khartoum", EAT}, + {"Africa/Kigali", CAT}, + {"Africa/Kinshasa", WAT}, + {"Africa/Lagos", WAT}, + {"Africa/Libreville", WAT}, + {"Africa/Lome", GMT}, + {"Africa/Luanda", WAT}, + {"Africa/Lubumbashi", CAT}, + {"Africa/Lusaka", CAT}, + {"Africa/Malabo", WAT}, + {"Africa/Maputo", CAT}, + {"Africa/Maseru", SAST}, + {"Africa/Mbabane", SAST}, + {"Africa/Mogadishu", EAT}, + {"Africa/Monrovia", GMT}, + {"Africa/Nairobi", EAT}, + {"Africa/Ndjamena", WAT}, + {"Africa/Niamey", WAT}, + {"Africa/Nouakchott", GMT}, + {"Africa/Ouagadougou", GMT}, + {"Africa/Porto-Novo", WAT}, + {"Africa/Sao_Tome", GMT}, + {"Africa/Timbuktu", GMT}, + {"Africa/Tripoli", EET}, + {"Africa/Tunis", CET}, + {"Africa/Windhoek", WAT}, + {"America/Adak", HAST}, + {"America/Anguilla", AST}, + {"America/Antigua", AST}, + {"America/Araguaina", BRT}, + {"America/Argentina/Buenos_Aires", AGT}, + {"America/Argentina/Catamarca", AGT}, + {"America/Argentina/ComodRivadavia", AGT}, + {"America/Argentina/Cordoba", AGT}, + {"America/Argentina/Jujuy", AGT}, + {"America/Argentina/La_Rioja", AGT}, + {"America/Argentina/Mendoza", AGT}, + {"America/Argentina/Rio_Gallegos", AGT}, + {"America/Argentina/Salta", AGT}, + {"America/Argentina/San_Juan", AGT}, + {"America/Argentina/San_Luis", WART}, + {"America/Argentina/Tucuman", AGT}, + {"America/Argentina/Ushuaia", AGT}, + {"America/Aruba", AST}, + {"America/Asuncion", new String[] {"Fuso hor\u00e1rio do Paraguai", "PYT", + "Fuso hor\u00e1rio de ver\u00e3o do Paraguai", "PYST"}}, {"America/Atikokan", EST}, - {"America/Atka", HAST}, - {"America/Bahia", BRT}, - {"America/Bahia_Banderas", CST}, - {"America/Barbados", AST}, - {"America/Belem", BRT}, - {"America/Belize", CST}, + {"America/Atka", HAST}, + {"America/Bahia", BRT}, + {"America/Bahia_Banderas", CST}, + {"America/Barbados", AST}, + {"America/Belem", BRT}, + {"America/Belize", CST}, {"America/Blanc-Sablon", AST}, - {"America/Boa_Vista", AMT}, - {"America/Bogota", new String[] {"Fuso hor\u00e1rio da Col\u00f4mbia", "COT", - "Fuso hor\u00e1rio de ver\u00e3o da Col\u00f4mbia", "COST"}}, - {"America/Boise", MST}, - {"America/Buenos_Aires", AGT}, - {"America/Cambridge_Bay", MST}, - {"America/Campo_Grande", AMT}, - {"America/Cancun", CST}, - {"America/Caracas", new String[] {"Fuso hor\u00e1rio da Venezuela", "VET", - "Fuso hor\u00e1rio de ver\u00e3o da Venezuela", "VEST"}}, - {"America/Catamarca", AGT}, - {"America/Cayenne", new String[] {"Fuso hor\u00e1rio da Guiana Francesa", "GFT", - "Fuso hor\u00e1rio de ver\u00e3o da Guiana Francesa", "GFST"}}, - {"America/Cayman", EST}, - {"America/Chihuahua", MST}, - {"America/Coral_Harbour", EST}, - {"America/Cordoba", AGT}, - {"America/Costa_Rica", CST}, - {"America/Cuiaba", AMT}, - {"America/Curacao", AST}, - {"America/Danmarkshavn", GMT}, - {"America/Dawson", PST}, - {"America/Dawson_Creek", MST}, - {"America/Detroit", EST}, - {"America/Dominica", AST}, - {"America/Edmonton", MST}, - {"America/Eirunepe", AMT}, - {"America/El_Salvador", CST}, - {"America/Ensenada", PST}, - {"America/Fort_Wayne", EST}, - {"America/Fortaleza", BRT}, - {"America/Glace_Bay", AST}, - {"America/Godthab", new String[] {"Fuso hor\u00e1rio da Groenl\u00e2ndia Ocidental", "WGT", - "Fuso hor\u00e1rio de ver\u00e3o da Groenl\u00e2ndia Ocidental", "WGST"}}, - {"America/Goose_Bay", AST}, - {"America/Grand_Turk", EST}, - {"America/Grenada", AST}, - {"America/Guadeloupe", AST}, - {"America/Guatemala", CST}, - {"America/Guayaquil", new String[] {"Fuso hor\u00e1rio do Equador", "ECT", - "Fuso hor\u00e1rio de ver\u00e3o do Equador", "ECST"}}, - {"America/Guyana", new String[] {"Fuso hor\u00e1rio da Guiana", "GYT", - "Fuso hor\u00e1rio de ver\u00e3o da Guiana", "GYST"}}, - {"America/Havana", CUBA}, - {"America/Hermosillo", MST}, - {"America/Indiana/Indianapolis", EST}, - {"America/Indiana/Knox", CST}, - {"America/Indiana/Marengo", EST}, - {"America/Indiana/Petersburg", EST}, - {"America/Indiana/Tell_City", CST}, - {"America/Indiana/Vevay", EST}, - {"America/Indiana/Vincennes", EST}, - {"America/Indiana/Winamac", EST}, - {"America/Inuvik", MST}, - {"America/Iqaluit", EST}, - {"America/Jamaica", EST}, - {"America/Jujuy", AGT}, - {"America/Juneau", AKST}, - {"America/Kentucky/Louisville", EST}, - {"America/Kentucky/Monticello", EST}, - {"America/Knox_IN", CST}, - {"America/La_Paz", new String[] {"Fuso hor\u00e1rio da Bol\u00edvia", "BOT", - "Fuso hor\u00e1rio de ver\u00e3o da Bol\u00edvia", "BOST"}}, - {"America/Lima", new String[] {"Fuso hor\u00e1rio do Peru", "PET", - "Fuso hor\u00e1rio de ver\u00e3o do Peru", "PEST"}}, - {"America/Louisville", EST}, - {"America/Maceio", BRT}, - {"America/Managua", CST}, - {"America/Manaus", AMT}, - {"America/Marigot", AST}, - {"America/Martinique", AST}, - {"America/Mazatlan", MST}, - {"America/Mendoza", AGT}, - {"America/Menominee", CST}, - {"America/Merida", CST}, - {"America/Metlakatla", new String[] {"Metlakatla Standard Time", "MeST", - "Metlakatla Daylight Time", "MeDT"}}, - {"America/Mexico_City", CST}, - {"America/Miquelon", new String[] {"Fuso hor\u00e1rio padr\u00e3o de S\u00e3o Pedro e Miquelon", "PMST", - "Hor\u00e1rio de luz natural de S\u00e3o Pedro e Miquelon", "PMDT"}}, - {"America/Moncton", AST}, - {"America/Montevideo", new String[] {"Fuso hor\u00e1rio do Uruguai", "UYT", - "Fuso hor\u00e1rio de ver\u00e3o do Uruguai", "UYST"}}, - {"America/Monterrey", CST}, - {"America/Montreal", EST}, - {"America/Montserrat", AST}, - {"America/Nassau", EST}, - {"America/Nipigon", EST}, - {"America/Nome", AKST}, - {"America/Noronha", NORONHA}, + {"America/Boa_Vista", AMT}, + {"America/Bogota", new String[] {"Fuso hor\u00e1rio da Col\u00f4mbia", "COT", + "Fuso hor\u00e1rio de ver\u00e3o da Col\u00f4mbia", "COST"}}, + {"America/Boise", MST}, + {"America/Buenos_Aires", AGT}, + {"America/Cambridge_Bay", MST}, + {"America/Campo_Grande", AMT}, + {"America/Cancun", CST}, + {"America/Caracas", new String[] {"Fuso hor\u00e1rio da Venezuela", "VET", + "Fuso hor\u00e1rio de ver\u00e3o da Venezuela", "VEST"}}, + {"America/Catamarca", AGT}, + {"America/Cayenne", new String[] {"Fuso hor\u00e1rio da Guiana Francesa", "GFT", + "Fuso hor\u00e1rio de ver\u00e3o da Guiana Francesa", "GFST"}}, + {"America/Cayman", EST}, + {"America/Chihuahua", MST}, + {"America/Coral_Harbour", EST}, + {"America/Cordoba", AGT}, + {"America/Costa_Rica", CST}, + {"America/Cuiaba", AMT}, + {"America/Curacao", AST}, + {"America/Danmarkshavn", GMT}, + {"America/Dawson", PST}, + {"America/Dawson_Creek", MST}, + {"America/Detroit", EST}, + {"America/Dominica", AST}, + {"America/Edmonton", MST}, + {"America/Eirunepe", AMT}, + {"America/El_Salvador", CST}, + {"America/Ensenada", PST}, + {"America/Fort_Wayne", EST}, + {"America/Fortaleza", BRT}, + {"America/Glace_Bay", AST}, + {"America/Godthab", new String[] {"Fuso hor\u00e1rio da Groenl\u00e2ndia Ocidental", "WGT", + "Fuso hor\u00e1rio de ver\u00e3o da Groenl\u00e2ndia Ocidental", "WGST"}}, + {"America/Goose_Bay", AST}, + {"America/Grand_Turk", EST}, + {"America/Grenada", AST}, + {"America/Guadeloupe", AST}, + {"America/Guatemala", CST}, + {"America/Guayaquil", new String[] {"Fuso hor\u00e1rio do Equador", "ECT", + "Fuso hor\u00e1rio de ver\u00e3o do Equador", "ECST"}}, + {"America/Guyana", new String[] {"Fuso hor\u00e1rio da Guiana", "GYT", + "Fuso hor\u00e1rio de ver\u00e3o da Guiana", "GYST"}}, + {"America/Havana", CUBA}, + {"America/Hermosillo", MST}, + {"America/Indiana/Indianapolis", EST}, + {"America/Indiana/Knox", CST}, + {"America/Indiana/Marengo", EST}, + {"America/Indiana/Petersburg", EST}, + {"America/Indiana/Tell_City", CST}, + {"America/Indiana/Vevay", EST}, + {"America/Indiana/Vincennes", EST}, + {"America/Indiana/Winamac", EST}, + {"America/Inuvik", MST}, + {"America/Iqaluit", EST}, + {"America/Jamaica", EST}, + {"America/Jujuy", AGT}, + {"America/Juneau", AKST}, + {"America/Kentucky/Louisville", EST}, + {"America/Kentucky/Monticello", EST}, + {"America/Knox_IN", CST}, + {"America/La_Paz", new String[] {"Fuso hor\u00e1rio da Bol\u00edvia", "BOT", + "Fuso hor\u00e1rio de ver\u00e3o da Bol\u00edvia", "BOST"}}, + {"America/Lima", new String[] {"Fuso hor\u00e1rio do Peru", "PET", + "Fuso hor\u00e1rio de ver\u00e3o do Peru", "PEST"}}, + {"America/Louisville", EST}, + {"America/Maceio", BRT}, + {"America/Managua", CST}, + {"America/Manaus", AMT}, + {"America/Marigot", AST}, + {"America/Martinique", AST}, + {"America/Matamoros", CST}, + {"America/Mazatlan", MST}, + {"America/Mendoza", AGT}, + {"America/Menominee", CST}, + {"America/Merida", CST}, + {"America/Metlakatla", new String[] {"Metlakatla Standard Time", "MeST", + "Metlakatla Daylight Time", "MeDT"}}, + {"America/Mexico_City", CST}, + {"America/Miquelon", new String[] {"Fuso hor\u00e1rio padr\u00e3o de S\u00e3o Pedro e Miquelon", "PMST", + "Hor\u00e1rio de luz natural de S\u00e3o Pedro e Miquelon", "PMDT"}}, + {"America/Moncton", AST}, + {"America/Montevideo", new String[] {"Fuso hor\u00e1rio do Uruguai", "UYT", + "Fuso hor\u00e1rio de ver\u00e3o do Uruguai", "UYST"}}, + {"America/Monterrey", CST}, + {"America/Montreal", EST}, + {"America/Montserrat", AST}, + {"America/Nassau", EST}, + {"America/Nipigon", EST}, + {"America/Nome", AKST}, + {"America/Noronha", NORONHA}, {"America/North_Dakota/Beulah", CST}, - {"America/North_Dakota/Center", CST}, + {"America/North_Dakota/Center", CST}, {"America/North_Dakota/New_Salem", CST}, - {"America/Panama", EST}, - {"America/Pangnirtung", EST}, - {"America/Paramaribo", new String[] {"Fuso hor\u00e1rio do Suriname", "SRT", - "Fuso hor\u00e1rio de ver\u00e3o do Suriname", "SRST"}}, - {"America/Port-au-Prince", EST}, - {"America/Port_of_Spain", AST}, - {"America/Porto_Acre", AMT}, - {"America/Porto_Velho", AMT}, - {"America/Puerto_Rico", AST}, - {"America/Rainy_River", CST}, - {"America/Rankin_Inlet", CST}, - {"America/Recife", BRT}, - {"America/Regina", CST}, - {"America/Resolute", RST}, - {"America/Rio_Branco", AMT}, - {"America/Rosario", AGT}, - {"America/Santarem", BRT}, - {"America/Santiago", CLT}, - {"America/Santo_Domingo", AST}, - {"America/Sao_Paulo", BRT}, - {"America/Scoresbysund", EGT}, - {"America/Shiprock", MST}, - {"America/St_Barthelemy", AST}, - {"America/St_Kitts", AST}, - {"America/St_Lucia", AST}, - {"America/St_Thomas", AST}, - {"America/St_Vincent", AST}, - {"America/Swift_Current", CST}, - {"America/Tegucigalpa", CST}, - {"America/Thule", AST}, - {"America/Thunder_Bay", EST}, - {"America/Tijuana", PST}, - {"America/Toronto", EST}, - {"America/Tortola", AST}, - {"America/Vancouver", PST}, - {"America/Virgin", AST}, - {"America/Whitehorse", PST}, - {"America/Winnipeg", CST}, - {"America/Yakutat", AKST}, - {"America/Yellowknife", MST}, - {"Antarctica/Casey", WST_AUS}, - {"Antarctica/Davis", new String[] {"Fuso hor\u00e1rio de Davis", "DAVT", - "Fuso hor\u00e1rio de ver\u00e3o de Davis", "DAVST"}}, - {"Antarctica/DumontDUrville", new String[] {"Fuso hor\u00e1rio de Dumont-d'Urville", "DDUT", - "Fuso hor\u00e1rio de ver\u00e3o de Dumont-d'Urville", "DDUST"}}, - {"Antarctica/Mawson", new String[] {"Fuso hor\u00e1rio de Mawson", "MAWT", - "Fuso hor\u00e1rio de ver\u00e3o de Mawson", "MAWST"}}, - {"Antarctica/McMurdo", NZST}, - {"Antarctica/Palmer", CLT}, - {"Antarctica/Rothera", new String[] {"Fuso hor\u00e1rio de Rothera", "ROTT", - "Fuso hor\u00e1rio de ver\u00e3o de Rothera", "ROTST"}}, - {"Antarctica/South_Pole", NZST}, - {"Antarctica/Syowa", new String[] {"Fuso hor\u00e1rio de Syowa", "SYOT", - "Fuso hor\u00e1rio de ver\u00e3o de Syowa", "SYOST"}}, - {"Antarctica/Vostok", new String[] {"Fuso hor\u00e1rio de Vostok", "VOST", - "Fuso hor\u00e1rio de ver\u00e3o de Vostok", "VOSST"}}, - {"Arctic/Longyearbyen", CET}, - {"Asia/Aden", ARAST}, - {"Asia/Almaty", new String[] {"Fuso hor\u00e1rio de Alma-Ata", "ALMT", - "Fuso hor\u00e1rio de ver\u00e3o de Alma-Ata", "ALMST"}}, - {"Asia/Amman", EET}, - {"Asia/Anadyr", new String[] {"Fuso hor\u00e1rio de Anadyr", "ANAT", - "Fuso hor\u00e1rio de ver\u00e3o de Anadyr", "ANAST"}}, - {"Asia/Aqtau", new String[] {"Fuso hor\u00e1rio de Aqtau", "AQTT", - "Fuso hor\u00e1rio de ver\u00e3o de Aqtau", "AQTST"}}, - {"Asia/Aqtobe", new String[] {"Fuso hor\u00e1rio de Aqtobe", "AQTT", - "Fuso hor\u00e1rio de ver\u00e3o de Aqtobe", "AQTST"}}, - {"Asia/Ashgabat", TMT}, - {"Asia/Ashkhabad", TMT}, - {"Asia/Baghdad", ARAST}, - {"Asia/Bahrain", ARAST}, - {"Asia/Baku", new String[] {"Fuso hor\u00e1rio do Azerbaij\u00e3o", "AZT", - "Fuso hor\u00e1rio de ver\u00e3o do Azerbaij\u00e3o", "AZST"}}, - {"Asia/Bangkok", ICT}, - {"Asia/Beirut", EET}, - {"Asia/Bishkek", new String[] {"Fuso hor\u00e1rio do Quirguist\u00e3o", "KGT", - "Fuso hor\u00e1rio de ver\u00e3o do Quirguist\u00e3o", "KGST"}}, - {"Asia/Brunei", new String[] {"Fuso hor\u00e1rio de Brunei", "BNT", - "Fuso hor\u00e1rio de ver\u00e3o de Brunei", "BNST"}}, - {"Asia/Calcutta", IST}, - {"Asia/Choibalsan", new String[] {"Fuso hor\u00e1rio de Choibalsan", "CHOT", - "Fuso hor\u00e1rio de ver\u00e3o de Choibalsan", "CHOST"}}, - {"Asia/Chongqing", CTT}, - {"Asia/Chungking", CTT}, - {"Asia/Colombo", IST}, - {"Asia/Dacca", BDT}, - {"Asia/Dhaka", BDT}, - {"Asia/Dili", new String[] {"Fuso hor\u00e1rio do Timor-Leste", "TLT", - "Fuso hor\u00e1rio de ver\u00e3o do Timor-Leste", "TLST"}}, - {"Asia/Damascus", EET}, - {"Asia/Dubai", GST}, - {"Asia/Dushanbe", new String[] {"Fuso hor\u00e1rio do Tadjiquist\u00e3o", "TJT", - "Fuso hor\u00e1rio de ver\u00e3o do Tadjiquist\u00e3o", "TJST"}}, - {"Asia/Gaza", EET}, - {"Asia/Harbin", CTT}, - {"Asia/Ho_Chi_Minh", ICT}, - {"Asia/Hong_Kong", HKT}, - {"Asia/Hovd", new String[] {"Fuso hor\u00e1rio de Hovd", "HOVT", - "Fuso hor\u00e1rio de ver\u00e3o de Hovd", "HOVST"}}, - {"Asia/Irkutsk", new String[] {"Fuso hor\u00e1rio de Irkutsk", "IRKT", - "Fuso hor\u00e1rio de ver\u00e3o de Irkutsk", "IRKST"}}, - {"Asia/Istanbul", EET}, - {"Asia/Jakarta", WIT}, - {"Asia/Jayapura", new String[] {"Fuso hor\u00e1rio da Indon\u00e9sia Oriental", "EIT", - "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Oriental", "EIST"}}, - {"Asia/Kabul", new String[] {"Fuso hor\u00e1rio do Afeganist\u00e3o", "AFT", - "Fuso hor\u00e1rio de ver\u00e3o do Afeganist\u00e3o", "AFST"}}, - {"Asia/Kamchatka", new String[] {"Fuso hor\u00e1rio de Petropavlovsk-Kamchatski", "PETT", - "Fuso hor\u00e1rio de ver\u00e3o de Petropavlovsk-Kamchatski", "PETST"}}, - {"Asia/Karachi", PKT}, - {"Asia/Kashgar", CTT}, - {"Asia/Kathmandu", NPT}, - {"Asia/Katmandu", NPT}, - {"Asia/Kolkata", IST}, - {"Asia/Krasnoyarsk", new String[] {"Fuso hor\u00e1rio de Krasnoyarsk", "KRAT", - "Fuso hor\u00e1rio de ver\u00e3o de Krasnoyarsk", "KRAST"}}, - {"Asia/Kuala_Lumpur", MYT}, - {"Asia/Kuching", MYT}, - {"Asia/Kuwait", ARAST}, - {"Asia/Macao", CTT}, - {"Asia/Macau", CTT}, - {"Asia/Magadan", new String[] {"Fuso hor\u00e1rio de Magadan", "MAGT", - "Fuso hor\u00e1rio de ver\u00e3o de Magadan", "MAGST"}}, - {"Asia/Makassar", CIT}, - {"Asia/Manila", new String[] {"Fuso hor\u00e1rio das Filipinas", "PHT", - "Fuso hor\u00e1rio de ver\u00e3o das Filipinas", "PHST"}}, - {"Asia/Muscat", GST}, - {"Asia/Nicosia", EET}, - {"Asia/Novokuznetsk", NOVT}, - {"Asia/Novosibirsk", NOVT}, - {"Asia/Oral", new String[] {"Fuso hor\u00e1rio de Uralsk", "ORAT", - "Fuso hor\u00e1rio de ver\u00e3o de Uralsk", "ORAST"}}, - {"Asia/Omsk", new String[] {"Fuso hor\u00e1rio de Omsk", "OMST", - "Fuso hor\u00e1rio de ver\u00e3o de Omsk", "OMSST"}}, - {"Asia/Phnom_Penh", ICT}, - {"Asia/Pontianak", WIT}, - {"Asia/Pyongyang", KST}, - {"Asia/Qatar", ARAST}, - {"Asia/Qyzylorda", new String[] {"Fuso hor\u00e1rio de Kizil-Orda", "QYZT", - "Fuso hor\u00e1rio de ver\u00e3o de Kizil-Orda", "QYZST"}}, - {"Asia/Rangoon", new String[] {"Fuso hor\u00e1rio de Mianmar", "MMT", - "Fuso hor\u00e1rio de ver\u00e3o de Mianmar", "MMST"}}, - {"Asia/Riyadh", ARAST}, - {"Asia/Saigon", ICT}, - {"Asia/Sakhalin", new String[] {"Fuso hor\u00e1rio de Sakhalina", "SAKT", - "Fuso hor\u00e1rio de ver\u00e3o de Sakhalina", "SAKST"}}, - {"Asia/Samarkand", UZT}, - {"Asia/Seoul", KST}, - {"Asia/Singapore", SGT}, - {"Asia/Taipei", CTT}, - {"Asia/Tel_Aviv", ISRAEL}, - {"Asia/Tashkent", UZT}, - {"Asia/Tbilisi", new String[] {"Fuso hor\u00e1rio da Ge\u00f3rgia", "GET", - "Fuso hor\u00e1rio de ver\u00e3o da Ge\u00f3rgia", "GEST"}}, - {"Asia/Tehran", IRT}, - {"Asia/Thimbu", BTT}, - {"Asia/Thimphu", BTT}, - {"Asia/Ujung_Pandang", CIT}, - {"Asia/Ulaanbaatar", ULAT}, - {"Asia/Ulan_Bator", ULAT}, - {"Asia/Urumqi", CTT}, - {"Asia/Vientiane", ICT}, - {"Asia/Vladivostok", new String[] {"Fuso hor\u00e1rio de Vladivostok", "VLAT", - "Fuso hor\u00e1rio de ver\u00e3o de Vladivostok", "VLAST"}}, - {"Asia/Yakutsk", new String[] {"Fuso hor\u00e1rio de Yakutsk", "YAKT", - "Fuso hor\u00e1rio de ver\u00e3o de Yakutsk", "YAKST"}}, - {"Asia/Yekaterinburg", new String[] {"Fuso hor\u00e1rio de Yekaterinburgo", "YEKT", - "Fuso hor\u00e1rio de ver\u00e3o de Yekaterinburgo", "YEKST"}}, - {"Asia/Yerevan", ARMT}, - {"Atlantic/Azores", new String[] {"Fuso hor\u00e1rio das A\u00e7ores", "AZOT", - "Fuso hor\u00e1rio de ver\u00e3o das A\u00e7ores", "AZOST"}}, - {"Atlantic/Bermuda", AST}, - {"Atlantic/Canary", WET}, - {"Atlantic/Cape_Verde", new String[] {"Fuso hor\u00e1rio de Cabo Verde", "CVT", - "Fuso hor\u00e1rio de ver\u00e3o de Cabo Verde", "CVST"}}, - {"Atlantic/Faeroe", WET}, - {"Atlantic/Faroe", WET}, - {"Atlantic/Jan_Mayen", CET}, - {"Atlantic/Madeira", WET}, - {"Atlantic/Reykjavik", GMT}, - {"Atlantic/South_Georgia", new String[] {"Fuso hor\u00e1rio padr\u00e3o da Ge\u00f3rgia do Sul", "GST", - "Hor\u00e1rio de luz natural da Ge\u00f3rgia do Sul", "GDT"}}, - {"Atlantic/St_Helena", GMT}, - {"Atlantic/Stanley", new String[] {"Fuso hor\u00e1rio das Ilhas Falkland", "FKT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Falkland", "FKST"}}, - {"Australia/ACT", EST_NSW}, - {"Australia/Adelaide", ADELAIDE}, - {"Australia/Brisbane", BRISBANE}, - {"Australia/Broken_Hill", BROKEN_HILL}, - {"Australia/Canberra", EST_NSW}, - {"Australia/Currie", EST_NSW}, - {"Australia/Darwin", DARWIN}, - {"Australia/Eucla", new String[] {"Fuso hor\u00e1rio ocidental central (Austr\u00e1lia)", "CWST", - "Fuso hor\u00e1rio de ver\u00e3o ocidental central (Austr\u00e1lia)", "CWST"}}, - {"Australia/Hobart", TASMANIA}, - {"Australia/LHI", LORD_HOWE}, - {"Australia/Lindeman", BRISBANE}, - {"Australia/Lord_Howe", LORD_HOWE}, - {"Australia/Melbourne", VICTORIA}, - {"Australia/North", DARWIN}, - {"Australia/NSW", EST_NSW}, - {"Australia/Perth", WST_AUS}, - {"Australia/Queensland", BRISBANE}, - {"Australia/South", ADELAIDE}, - {"Australia/Sydney", EST_NSW}, - {"Australia/Tasmania", TASMANIA}, - {"Australia/Victoria", VICTORIA}, - {"Australia/West", WST_AUS}, - {"Australia/Yancowinna", BROKEN_HILL}, - {"BET", BRT}, - {"BST", BDT}, - {"Brazil/Acre", AMT}, - {"Brazil/DeNoronha", NORONHA}, - {"Brazil/East", BRT}, - {"Brazil/West", AMT}, - {"Canada/Atlantic", AST}, - {"Canada/Central", CST}, - {"Canada/East-Saskatchewan", CST}, - {"Canada/Eastern", EST}, - {"Canada/Mountain", MST}, - {"Canada/Newfoundland", NST}, - {"Canada/Pacific", PST}, - {"Canada/Yukon", PST}, - {"Canada/Saskatchewan", CST}, - {"CAT", CAT}, - {"CET", CET}, - {"Chile/Continental", CLT}, - {"Chile/EasterIsland", EASTER}, - {"CST6CDT", CST}, - {"Cuba", CUBA}, - {"EAT", EAT}, - {"EET", EET}, - {"Egypt", EET}, - {"Eire", DUBLIN}, - {"EST5EDT", EST}, - {"Etc/Greenwich", GMT}, - {"Etc/UCT", UTC}, - {"Etc/Universal", UTC}, - {"Etc/UTC", UTC}, - {"Etc/Zulu", UTC}, - {"Europe/Amsterdam", CET}, - {"Europe/Andorra", CET}, - {"Europe/Athens", EET}, - {"Europe/Belfast", GMTBST}, - {"Europe/Belgrade", CET}, - {"Europe/Berlin", CET}, - {"Europe/Bratislava", CET}, - {"Europe/Brussels", CET}, - {"Europe/Budapest", CET}, - {"Europe/Chisinau", EET}, - {"Europe/Copenhagen", CET}, - {"Europe/Dublin", DUBLIN}, - {"Europe/Gibraltar", CET}, + {"America/Ojinaga", MST}, + {"America/Panama", EST}, + {"America/Pangnirtung", EST}, + {"America/Paramaribo", new String[] {"Fuso hor\u00e1rio do Suriname", "SRT", + "Fuso hor\u00e1rio de ver\u00e3o do Suriname", "SRST"}}, + {"America/Port-au-Prince", EST}, + {"America/Port_of_Spain", AST}, + {"America/Porto_Acre", AMT}, + {"America/Porto_Velho", AMT}, + {"America/Puerto_Rico", AST}, + {"America/Rainy_River", CST}, + {"America/Rankin_Inlet", CST}, + {"America/Recife", BRT}, + {"America/Regina", CST}, + {"America/Resolute", RST}, + {"America/Rio_Branco", AMT}, + {"America/Rosario", AGT}, + {"America/Santa_Isabel", PST}, + {"America/Santarem", BRT}, + {"America/Santiago", CLT}, + {"America/Santo_Domingo", AST}, + {"America/Sao_Paulo", BRT}, + {"America/Scoresbysund", EGT}, + {"America/Shiprock", MST}, + {"America/St_Barthelemy", AST}, + {"America/St_Kitts", AST}, + {"America/St_Lucia", AST}, + {"America/St_Thomas", AST}, + {"America/St_Vincent", AST}, + {"America/Swift_Current", CST}, + {"America/Tegucigalpa", CST}, + {"America/Thule", AST}, + {"America/Thunder_Bay", EST}, + {"America/Tijuana", PST}, + {"America/Toronto", EST}, + {"America/Tortola", AST}, + {"America/Vancouver", PST}, + {"America/Virgin", AST}, + {"America/Whitehorse", PST}, + {"America/Winnipeg", CST}, + {"America/Yakutat", AKST}, + {"America/Yellowknife", MST}, + {"Antarctica/Casey", WST_AUS}, + {"Antarctica/Davis", new String[] {"Fuso hor\u00e1rio de Davis", "DAVT", + "Fuso hor\u00e1rio de ver\u00e3o de Davis", "DAVST"}}, + {"Antarctica/DumontDUrville", new String[] {"Fuso hor\u00e1rio de Dumont-d'Urville", "DDUT", + "Fuso hor\u00e1rio de ver\u00e3o de Dumont-d'Urville", "DDUST"}}, + {"Antarctica/Macquarie", new String[] {"Macquarie Island Time", "MIST", + "Macquarie Island Summer Time", "MIST"}}, + {"Antarctica/Mawson", new String[] {"Fuso hor\u00e1rio de Mawson", "MAWT", + "Fuso hor\u00e1rio de ver\u00e3o de Mawson", "MAWST"}}, + {"Antarctica/McMurdo", NZST}, + {"Antarctica/Palmer", CLT}, + {"Antarctica/Rothera", new String[] {"Fuso hor\u00e1rio de Rothera", "ROTT", + "Fuso hor\u00e1rio de ver\u00e3o de Rothera", "ROTST"}}, + {"Antarctica/South_Pole", NZST}, + {"Antarctica/Syowa", new String[] {"Fuso hor\u00e1rio de Syowa", "SYOT", + "Fuso hor\u00e1rio de ver\u00e3o de Syowa", "SYOST"}}, + {"Antarctica/Vostok", new String[] {"Fuso hor\u00e1rio de Vostok", "VOST", + "Fuso hor\u00e1rio de ver\u00e3o de Vostok", "VOSST"}}, + {"Arctic/Longyearbyen", CET}, + {"Asia/Aden", ARAST}, + {"Asia/Almaty", new String[] {"Fuso hor\u00e1rio de Alma-Ata", "ALMT", + "Fuso hor\u00e1rio de ver\u00e3o de Alma-Ata", "ALMST"}}, + {"Asia/Amman", EET}, + {"Asia/Anadyr", new String[] {"Fuso hor\u00e1rio de Anadyr", "ANAT", + "Fuso hor\u00e1rio de ver\u00e3o de Anadyr", "ANAST"}}, + {"Asia/Aqtau", new String[] {"Fuso hor\u00e1rio de Aqtau", "AQTT", + "Fuso hor\u00e1rio de ver\u00e3o de Aqtau", "AQTST"}}, + {"Asia/Aqtobe", new String[] {"Fuso hor\u00e1rio de Aqtobe", "AQTT", + "Fuso hor\u00e1rio de ver\u00e3o de Aqtobe", "AQTST"}}, + {"Asia/Ashgabat", TMT}, + {"Asia/Ashkhabad", TMT}, + {"Asia/Baghdad", ARAST}, + {"Asia/Bahrain", ARAST}, + {"Asia/Baku", new String[] {"Fuso hor\u00e1rio do Azerbaij\u00e3o", "AZT", + "Fuso hor\u00e1rio de ver\u00e3o do Azerbaij\u00e3o", "AZST"}}, + {"Asia/Bangkok", ICT}, + {"Asia/Beirut", EET}, + {"Asia/Bishkek", new String[] {"Fuso hor\u00e1rio do Quirguist\u00e3o", "KGT", + "Fuso hor\u00e1rio de ver\u00e3o do Quirguist\u00e3o", "KGST"}}, + {"Asia/Brunei", new String[] {"Fuso hor\u00e1rio de Brunei", "BNT", + "Fuso hor\u00e1rio de ver\u00e3o de Brunei", "BNST"}}, + {"Asia/Calcutta", IST}, + {"Asia/Choibalsan", new String[] {"Fuso hor\u00e1rio de Choibalsan", "CHOT", + "Fuso hor\u00e1rio de ver\u00e3o de Choibalsan", "CHOST"}}, + {"Asia/Chongqing", CTT}, + {"Asia/Chungking", CTT}, + {"Asia/Colombo", IST}, + {"Asia/Dacca", BDT}, + {"Asia/Dhaka", BDT}, + {"Asia/Dili", new String[] {"Fuso hor\u00e1rio do Timor-Leste", "TLT", + "Fuso hor\u00e1rio de ver\u00e3o do Timor-Leste", "TLST"}}, + {"Asia/Damascus", EET}, + {"Asia/Dubai", GST}, + {"Asia/Dushanbe", new String[] {"Fuso hor\u00e1rio do Tadjiquist\u00e3o", "TJT", + "Fuso hor\u00e1rio de ver\u00e3o do Tadjiquist\u00e3o", "TJST"}}, + {"Asia/Gaza", EET}, + {"Asia/Harbin", CTT}, + {"Asia/Ho_Chi_Minh", ICT}, + {"Asia/Hong_Kong", HKT}, + {"Asia/Hovd", new String[] {"Fuso hor\u00e1rio de Hovd", "HOVT", + "Fuso hor\u00e1rio de ver\u00e3o de Hovd", "HOVST"}}, + {"Asia/Irkutsk", new String[] {"Fuso hor\u00e1rio de Irkutsk", "IRKT", + "Fuso hor\u00e1rio de ver\u00e3o de Irkutsk", "IRKST"}}, + {"Asia/Istanbul", EET}, + {"Asia/Jakarta", WIT}, + {"Asia/Jayapura", new String[] {"Fuso hor\u00e1rio da Indon\u00e9sia Oriental", "EIT", + "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Oriental", "EIST"}}, + {"Asia/Kabul", new String[] {"Fuso hor\u00e1rio do Afeganist\u00e3o", "AFT", + "Fuso hor\u00e1rio de ver\u00e3o do Afeganist\u00e3o", "AFST"}}, + {"Asia/Kamchatka", new String[] {"Fuso hor\u00e1rio de Petropavlovsk-Kamchatski", "PETT", + "Fuso hor\u00e1rio de ver\u00e3o de Petropavlovsk-Kamchatski", "PETST"}}, + {"Asia/Karachi", PKT}, + {"Asia/Kashgar", CTT}, + {"Asia/Kathmandu", NPT}, + {"Asia/Katmandu", NPT}, + {"Asia/Kolkata", IST}, + {"Asia/Krasnoyarsk", new String[] {"Fuso hor\u00e1rio de Krasnoyarsk", "KRAT", + "Fuso hor\u00e1rio de ver\u00e3o de Krasnoyarsk", "KRAST"}}, + {"Asia/Kuala_Lumpur", MYT}, + {"Asia/Kuching", MYT}, + {"Asia/Kuwait", ARAST}, + {"Asia/Macao", CTT}, + {"Asia/Macau", CTT}, + {"Asia/Magadan", new String[] {"Fuso hor\u00e1rio de Magadan", "MAGT", + "Fuso hor\u00e1rio de ver\u00e3o de Magadan", "MAGST"}}, + {"Asia/Makassar", CIT}, + {"Asia/Manila", new String[] {"Fuso hor\u00e1rio das Filipinas", "PHT", + "Fuso hor\u00e1rio de ver\u00e3o das Filipinas", "PHST"}}, + {"Asia/Muscat", GST}, + {"Asia/Nicosia", EET}, + {"Asia/Novokuznetsk", NOVT}, + {"Asia/Novosibirsk", NOVT}, + {"Asia/Oral", new String[] {"Fuso hor\u00e1rio de Uralsk", "ORAT", + "Fuso hor\u00e1rio de ver\u00e3o de Uralsk", "ORAST"}}, + {"Asia/Omsk", new String[] {"Fuso hor\u00e1rio de Omsk", "OMST", + "Fuso hor\u00e1rio de ver\u00e3o de Omsk", "OMSST"}}, + {"Asia/Phnom_Penh", ICT}, + {"Asia/Pontianak", WIT}, + {"Asia/Pyongyang", KST}, + {"Asia/Qatar", ARAST}, + {"Asia/Qyzylorda", new String[] {"Fuso hor\u00e1rio de Kizil-Orda", "QYZT", + "Fuso hor\u00e1rio de ver\u00e3o de Kizil-Orda", "QYZST"}}, + {"Asia/Rangoon", new String[] {"Fuso hor\u00e1rio de Mianmar", "MMT", + "Fuso hor\u00e1rio de ver\u00e3o de Mianmar", "MMST"}}, + {"Asia/Riyadh", ARAST}, + {"Asia/Saigon", ICT}, + {"Asia/Sakhalin", new String[] {"Fuso hor\u00e1rio de Sakhalina", "SAKT", + "Fuso hor\u00e1rio de ver\u00e3o de Sakhalina", "SAKST"}}, + {"Asia/Samarkand", UZT}, + {"Asia/Seoul", KST}, + {"Asia/Singapore", SGT}, + {"Asia/Taipei", CTT}, + {"Asia/Tel_Aviv", ISRAEL}, + {"Asia/Tashkent", UZT}, + {"Asia/Tbilisi", new String[] {"Fuso hor\u00e1rio da Ge\u00f3rgia", "GET", + "Fuso hor\u00e1rio de ver\u00e3o da Ge\u00f3rgia", "GEST"}}, + {"Asia/Tehran", IRT}, + {"Asia/Thimbu", BTT}, + {"Asia/Thimphu", BTT}, + {"Asia/Ujung_Pandang", CIT}, + {"Asia/Ulaanbaatar", ULAT}, + {"Asia/Ulan_Bator", ULAT}, + {"Asia/Urumqi", CTT}, + {"Asia/Vientiane", ICT}, + {"Asia/Vladivostok", new String[] {"Fuso hor\u00e1rio de Vladivostok", "VLAT", + "Fuso hor\u00e1rio de ver\u00e3o de Vladivostok", "VLAST"}}, + {"Asia/Yakutsk", new String[] {"Fuso hor\u00e1rio de Yakutsk", "YAKT", + "Fuso hor\u00e1rio de ver\u00e3o de Yakutsk", "YAKST"}}, + {"Asia/Yekaterinburg", new String[] {"Fuso hor\u00e1rio de Yekaterinburgo", "YEKT", + "Fuso hor\u00e1rio de ver\u00e3o de Yekaterinburgo", "YEKST"}}, + {"Asia/Yerevan", ARMT}, + {"Atlantic/Azores", new String[] {"Fuso hor\u00e1rio das A\u00e7ores", "AZOT", + "Fuso hor\u00e1rio de ver\u00e3o das A\u00e7ores", "AZOST"}}, + {"Atlantic/Bermuda", AST}, + {"Atlantic/Canary", WET}, + {"Atlantic/Cape_Verde", new String[] {"Fuso hor\u00e1rio de Cabo Verde", "CVT", + "Fuso hor\u00e1rio de ver\u00e3o de Cabo Verde", "CVST"}}, + {"Atlantic/Faeroe", WET}, + {"Atlantic/Faroe", WET}, + {"Atlantic/Jan_Mayen", CET}, + {"Atlantic/Madeira", WET}, + {"Atlantic/Reykjavik", GMT}, + {"Atlantic/South_Georgia", new String[] {"Fuso hor\u00e1rio padr\u00e3o da Ge\u00f3rgia do Sul", "GST", + "Hor\u00e1rio de luz natural da Ge\u00f3rgia do Sul", "GDT"}}, + {"Atlantic/St_Helena", GMT}, + {"Atlantic/Stanley", new String[] {"Fuso hor\u00e1rio das Ilhas Falkland", "FKT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Falkland", "FKST"}}, + {"Australia/ACT", EST_NSW}, + {"Australia/Adelaide", ADELAIDE}, + {"Australia/Brisbane", BRISBANE}, + {"Australia/Broken_Hill", BROKEN_HILL}, + {"Australia/Canberra", EST_NSW}, + {"Australia/Currie", EST_NSW}, + {"Australia/Darwin", DARWIN}, + {"Australia/Eucla", new String[] {"Fuso hor\u00e1rio ocidental central (Austr\u00e1lia)", "CWST", + "Fuso hor\u00e1rio de ver\u00e3o ocidental central (Austr\u00e1lia)", "CWST"}}, + {"Australia/Hobart", TASMANIA}, + {"Australia/LHI", LORD_HOWE}, + {"Australia/Lindeman", BRISBANE}, + {"Australia/Lord_Howe", LORD_HOWE}, + {"Australia/Melbourne", VICTORIA}, + {"Australia/North", DARWIN}, + {"Australia/NSW", EST_NSW}, + {"Australia/Perth", WST_AUS}, + {"Australia/Queensland", BRISBANE}, + {"Australia/South", ADELAIDE}, + {"Australia/Sydney", EST_NSW}, + {"Australia/Tasmania", TASMANIA}, + {"Australia/Victoria", VICTORIA}, + {"Australia/West", WST_AUS}, + {"Australia/Yancowinna", BROKEN_HILL}, + {"BET", BRT}, + {"BST", BDT}, + {"Brazil/Acre", AMT}, + {"Brazil/DeNoronha", NORONHA}, + {"Brazil/East", BRT}, + {"Brazil/West", AMT}, + {"Canada/Atlantic", AST}, + {"Canada/Central", CST}, + {"Canada/East-Saskatchewan", CST}, + {"Canada/Eastern", EST}, + {"Canada/Mountain", MST}, + {"Canada/Newfoundland", NST}, + {"Canada/Pacific", PST}, + {"Canada/Yukon", PST}, + {"Canada/Saskatchewan", CST}, + {"CAT", CAT}, + {"CET", CET}, + {"Chile/Continental", CLT}, + {"Chile/EasterIsland", EASTER}, + {"CST6CDT", CST}, + {"Cuba", CUBA}, + {"EAT", EAT}, + {"EET", EET}, + {"Egypt", EET}, + {"Eire", DUBLIN}, + {"EST5EDT", EST}, + {"Etc/Greenwich", GMT}, + {"Etc/UCT", UTC}, + {"Etc/Universal", UTC}, + {"Etc/UTC", UTC}, + {"Etc/Zulu", UTC}, + {"Europe/Amsterdam", CET}, + {"Europe/Andorra", CET}, + {"Europe/Athens", EET}, + {"Europe/Belfast", GMTBST}, + {"Europe/Belgrade", CET}, + {"Europe/Berlin", CET}, + {"Europe/Bratislava", CET}, + {"Europe/Brussels", CET}, + {"Europe/Budapest", CET}, + {"Europe/Chisinau", EET}, + {"Europe/Copenhagen", CET}, + {"Europe/Dublin", DUBLIN}, + {"Europe/Gibraltar", CET}, {"Europe/Guernsey", GMTBST}, - {"Europe/Helsinki", EET}, + {"Europe/Helsinki", EET}, {"Europe/Isle_of_Man", GMTBST}, - {"Europe/Istanbul", EET}, + {"Europe/Istanbul", EET}, {"Europe/Jersey", GMTBST}, - {"Europe/Kaliningrad", EET}, - {"Europe/Kiev", EET}, - {"Europe/Lisbon", WET}, - {"Europe/Ljubljana", CET}, - {"Europe/London", GMTBST}, - {"Europe/Luxembourg", CET}, - {"Europe/Madrid", CET}, - {"Europe/Malta", CET}, - {"Europe/Mariehamn", EET}, - {"Europe/Minsk", EET}, - {"Europe/Monaco", CET}, - {"Europe/Moscow", MSK}, - {"Europe/Nicosia", EET}, - {"Europe/Oslo", CET}, - {"Europe/Podgorica", CET}, - {"Europe/Prague", CET}, - {"Europe/Riga", EET}, - {"Europe/Rome", CET}, - {"Europe/Samara", new String[] {"Fuso hor\u00e1rio de Samara", "SAMT", - "Fuso hor\u00e1rio de ver\u00e3o de Samara", "SAMST"}}, - {"Europe/San_Marino", CET}, - {"Europe/Sarajevo", CET}, - {"Europe/Simferopol", EET}, - {"Europe/Skopje", CET}, - {"Europe/Sofia", EET}, - {"Europe/Stockholm", CET}, - {"Europe/Tallinn", EET}, - {"Europe/Tirane", CET}, - {"Europe/Tiraspol", EET}, - {"Europe/Uzhgorod", EET}, - {"Europe/Vaduz", CET}, - {"Europe/Vatican", CET}, - {"Europe/Vienna", CET}, - {"Europe/Vilnius", EET}, + {"Europe/Kaliningrad", EET}, + {"Europe/Kiev", EET}, + {"Europe/Lisbon", WET}, + {"Europe/Ljubljana", CET}, + {"Europe/London", GMTBST}, + {"Europe/Luxembourg", CET}, + {"Europe/Madrid", CET}, + {"Europe/Malta", CET}, + {"Europe/Mariehamn", EET}, + {"Europe/Minsk", EET}, + {"Europe/Monaco", CET}, + {"Europe/Moscow", MSK}, + {"Europe/Nicosia", EET}, + {"Europe/Oslo", CET}, + {"Europe/Podgorica", CET}, + {"Europe/Prague", CET}, + {"Europe/Riga", EET}, + {"Europe/Rome", CET}, + {"Europe/Samara", new String[] {"Fuso hor\u00e1rio de Samara", "SAMT", + "Fuso hor\u00e1rio de ver\u00e3o de Samara", "SAMST"}}, + {"Europe/San_Marino", CET}, + {"Europe/Sarajevo", CET}, + {"Europe/Simferopol", EET}, + {"Europe/Skopje", CET}, + {"Europe/Sofia", EET}, + {"Europe/Stockholm", CET}, + {"Europe/Tallinn", EET}, + {"Europe/Tirane", CET}, + {"Europe/Tiraspol", EET}, + {"Europe/Uzhgorod", EET}, + {"Europe/Vaduz", CET}, + {"Europe/Vatican", CET}, + {"Europe/Vienna", CET}, + {"Europe/Vilnius", EET}, {"Europe/Volgograd", new String[] {"Fuso hor\u00e1rio de Volgogrado", "VOLT", "Fuso hor\u00e1rio de ver\u00e3o de Volgogrado", "VOLST"}}, - {"Europe/Warsaw", CET}, - {"Europe/Zagreb", CET}, - {"Europe/Zaporozhye", EET}, - {"Europe/Zurich", CET}, - {"GB", GMTBST}, - {"GB-Eire", GMTBST}, - {"Greenwich", GMT}, - {"Hongkong", HKT}, - {"Iceland", GMT}, - {"Iran", IRT}, - {"IST", IST}, - {"Indian/Antananarivo", EAT}, - {"Indian/Chagos", new String[] {"Fuso hor\u00e1rio dos territ\u00f3rios do Oceano \u00cdndico", "IOT", - "Fuso hor\u00e1rio de ver\u00e3o dos territ\u00f3rios do Oceano \u00cdndico", "IOST"}}, - {"Indian/Christmas", new String[] {"Fuso hor\u00e1rio das Ilhas Christmas", "CXT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Christmas", "CXST"}}, - {"Indian/Cocos", new String[] {"Fuso hor\u00e1rio das Ilhas Cocos", "CCT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Cocos", "CCST"}}, - {"Indian/Comoro", EAT}, - {"Indian/Kerguelen", new String[] {"Fuso hor\u00e1rio das Terras Austrais e Ant\u00e1rticas Francesas", "TFT", - "Fuso hor\u00e1rio de ver\u00e3o das Terras Austrais e Ant\u00e1rticas Francesas", "TFST"}}, - {"Indian/Mahe", new String[] {"Fuso hor\u00e1rio das Seychelles", "SCT", - "Fuso hor\u00e1rio de ver\u00e3o das Seychelles", "SCST"}}, - {"Indian/Maldives", new String[] {"Fuso hor\u00e1rio das Maldivas", "MVT", - "Fuso hor\u00e1rio de ver\u00e3o das Maldivas", "MVST"}}, - {"Indian/Mauritius", new String[] {"Fuso hor\u00e1rio das Ilhas Maur\u00edcio", "MUT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Maur\u00edcio", "MUST"}}, - {"Indian/Mayotte", EAT}, - {"Indian/Reunion", new String[] {"Fuso hor\u00e1rio de Reuni\u00e3o", "RET", - "Fuso hor\u00e1rio de ver\u00e3o de Reuni\u00e3o", "REST"}}, - {"Israel", ISRAEL}, - {"Jamaica", EST}, - {"Japan", JST}, - {"Kwajalein", MHT}, - {"Libya", EET}, - {"MET", new String[] {"Fuso hor\u00e1rio da Europa M\u00e9dia", "MET", - "Fuso hor\u00e1rio de ver\u00e3o da Europa M\u00e9dia", "MEST"}}, - {"Mexico/BajaNorte", PST}, - {"Mexico/BajaSur", MST}, - {"Mexico/General", CST}, - {"MIT", WST_SAMOA}, - {"MST7MDT", MST}, - {"Navajo", MST}, - {"NET", ARMT}, - {"NST", NZST}, - {"NZ", NZST}, - {"NZ-CHAT", CHAST}, - {"PLT", PKT}, - {"Portugal", WET}, - {"PRT", AST}, - {"Pacific/Apia", WST_SAMOA}, - {"Pacific/Auckland", NZST}, - {"Pacific/Chatham", CHAST}, - {"Pacific/Chuuk", TRUT}, - {"Pacific/Easter", EASTER}, - {"Pacific/Efate", new String[] {"Fuso hor\u00e1rio de Vanuatu", "VUT", - "Fuso hor\u00e1rio de ver\u00e3o de Vanuatu", "VUST"}}, - {"Pacific/Enderbury", new String[] {"Fuso hor\u00e1rio das Ilhas F\u00e9nix", "PHOT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas F\u00e9nix", "PHOST"}}, - {"Pacific/Fakaofo", new String[] {"Fuso hor\u00e1rio de Tokelau", "TKT", - "Fuso hor\u00e1rio de ver\u00e3o de Tokelau", "TKST"}}, - {"Pacific/Fiji", new String[] {"Fuso hor\u00e1rio de Fiji", "FJT", - "Fuso hor\u00e1rio de ver\u00e3o de Fiji", "FJST"}}, - {"Pacific/Funafuti", new String[] {"Fuso hor\u00e1rio de Tuvalu", "TVT", - "Fuso hor\u00e1rio de ver\u00e3o de Tuvalu", "TVST"}}, - {"Pacific/Galapagos", new String[] {"Fuso hor\u00e1rio das Ilhas Gal\u00e1pagos", "GALT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Gal\u00e1pagos", "GALST"}}, - {"Pacific/Gambier", GAMBIER}, - {"Pacific/Guadalcanal", SBT}, - {"Pacific/Guam", ChST}, - {"Pacific/Johnston", HST}, - {"Pacific/Kiritimati", new String[] {"Fuso hor\u00e1rio das Esp\u00f3rades Equatoriais", "LINT", - "Fuso hor\u00e1rio de ver\u00e3o das Esp\u00f3rades Equatoriais", "LINST"}}, - {"Pacific/Kosrae", new String[] {"Fuso hor\u00e1rio de Kosrae", "KOST", - "Fuso hor\u00e1rio de ver\u00e3o de Kosrae", "KOSST"}}, - {"Pacific/Kwajalein", MHT}, - {"Pacific/Majuro", MHT}, - {"Pacific/Marquesas", new String[] {"Fuso hor\u00e1rio das Ilhas Marquesas", "MART", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Marquesas", "MARST"}}, - {"Pacific/Midway", SAMOA}, - {"Pacific/Nauru", new String[] {"Fuso hor\u00e1rio de Nauru", "NRT", - "Fuso hor\u00e1rio de ver\u00e3o de Nauru", "NRST"}}, - {"Pacific/Niue", new String[] {"Fuso hor\u00e1rio de Niue", "NUT", - "Fuso hor\u00e1rio de ver\u00e3o de Niue", "NUST"}}, - {"Pacific/Norfolk", new String[] {"Fuso hor\u00e1rio da Ilha de Norfolk", "NFT", - "Fuso hor\u00e1rio de ver\u00e3o da Ilha de Norfolk", "NFST"}}, - {"Pacific/Noumea", new String[] {"Fuso hor\u00e1rio da Nova Caled\u00f4nia", "NCT", - "Fuso hor\u00e1rio de ver\u00e3o da Nova Caled\u00f4nia", "NCST"}}, - {"Pacific/Pago_Pago", SAMOA}, - {"Pacific/Palau", new String[] {"Fuso hor\u00e1rio de Palau", "PWT", - "Fuso hor\u00e1rio de ver\u00e3o de Palau", "PWST"}}, - {"Pacific/Pitcairn", PITCAIRN}, - {"Pacific/Pohnpei", PONT}, - {"Pacific/Ponape", PONT}, - {"Pacific/Port_Moresby", new String[] {"Fuso hor\u00e1rio de Papua-Nova Guin\u00e9", "PGT", - "Fuso hor\u00e1rio de ver\u00e3o de Papua-Nova Guin\u00e9", "PGST"}}, - {"Pacific/Rarotonga", new String[] {"Fuso hor\u00e1rio das Ilhas Cook", "CKT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Cook", "CKHST"}}, - {"Pacific/Saipan", ChST}, - {"Pacific/Samoa", SAMOA}, - {"Pacific/Tahiti", new String[] {"Fuso hor\u00e1rio do Taiti", "TAHT", - "Fuso hor\u00e1rio de ver\u00e3o do Taiti", "TAHST"}}, - {"Pacific/Tarawa", new String[] {"Fuso hor\u00e1rio das Ilhas Gilbert", "GILT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Gilbert", "GILST"}}, - {"Pacific/Tongatapu", new String[] {"Fuso hor\u00e1rio de Tonga", "TOT", - "Fuso hor\u00e1rio de ver\u00e3o de Tonga", "TOST"}}, - {"Pacific/Truk", TRUT}, - {"Pacific/Wake", new String[] {"Fuso hor\u00e1rio de Wake", "WAKT", - "Fuso hor\u00e1rio de ver\u00e3o de Wake", "WAKST"}}, - {"Pacific/Wallis", new String[] {"Fuso hor\u00e1rio de Wallis e Futuna", "WFT", - "Fuso hor\u00e1rio de ver\u00e3o de Wallis e Futuna", "WFST"}}, - {"Pacific/Yap", TRUT}, - {"Poland", CET}, - {"PRC", CTT}, - {"PST8PDT", PST}, - {"ROK", KST}, - {"Singapore", SGT}, - {"SST", SBT}, - {"SystemV/AST4", AST}, - {"SystemV/AST4ADT", AST}, - {"SystemV/CST6", CST}, - {"SystemV/CST6CDT", CST}, - {"SystemV/EST5", EST}, - {"SystemV/EST5EDT", EST}, - {"SystemV/HST10", HST}, - {"SystemV/MST7", MST}, - {"SystemV/MST7MDT", MST}, - {"SystemV/PST8", PST}, - {"SystemV/PST8PDT", PST}, - {"SystemV/YST9", AKST}, - {"SystemV/YST9YDT", AKST}, - {"Turkey", EET}, - {"UCT", UTC}, - {"Universal", UTC}, - {"US/Alaska", AKST}, - {"US/Aleutian", HAST}, - {"US/Arizona", MST}, - {"US/Central", CST}, - {"US/Eastern", EST}, - {"US/Hawaii", HST}, - {"US/Indiana-Starke", CST}, - {"US/East-Indiana", EST}, - {"US/Michigan", EST}, - {"US/Mountain", MST}, - {"US/Pacific", PST}, - {"US/Pacific-New", PST}, - {"US/Samoa", SAMOA}, - {"UTC", UTC}, - {"VST", ICT}, - {"W-SU", MSK}, - {"WET", WET}, - {"Zulu", UTC}, + {"Europe/Warsaw", CET}, + {"Europe/Zagreb", CET}, + {"Europe/Zaporozhye", EET}, + {"Europe/Zurich", CET}, + {"GB", GMTBST}, + {"GB-Eire", GMTBST}, + {"Greenwich", GMT}, + {"Hongkong", HKT}, + {"Iceland", GMT}, + {"Iran", IRT}, + {"IST", IST}, + {"Indian/Antananarivo", EAT}, + {"Indian/Chagos", new String[] {"Fuso hor\u00e1rio dos territ\u00f3rios do Oceano \u00cdndico", "IOT", + "Fuso hor\u00e1rio de ver\u00e3o dos territ\u00f3rios do Oceano \u00cdndico", "IOST"}}, + {"Indian/Christmas", new String[] {"Fuso hor\u00e1rio das Ilhas Christmas", "CXT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Christmas", "CXST"}}, + {"Indian/Cocos", new String[] {"Fuso hor\u00e1rio das Ilhas Cocos", "CCT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Cocos", "CCST"}}, + {"Indian/Comoro", EAT}, + {"Indian/Kerguelen", new String[] {"Fuso hor\u00e1rio das Terras Austrais e Ant\u00e1rticas Francesas", "TFT", + "Fuso hor\u00e1rio de ver\u00e3o das Terras Austrais e Ant\u00e1rticas Francesas", "TFST"}}, + {"Indian/Mahe", new String[] {"Fuso hor\u00e1rio das Seychelles", "SCT", + "Fuso hor\u00e1rio de ver\u00e3o das Seychelles", "SCST"}}, + {"Indian/Maldives", new String[] {"Fuso hor\u00e1rio das Maldivas", "MVT", + "Fuso hor\u00e1rio de ver\u00e3o das Maldivas", "MVST"}}, + {"Indian/Mauritius", new String[] {"Fuso hor\u00e1rio das Ilhas Maur\u00edcio", "MUT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Maur\u00edcio", "MUST"}}, + {"Indian/Mayotte", EAT}, + {"Indian/Reunion", new String[] {"Fuso hor\u00e1rio de Reuni\u00e3o", "RET", + "Fuso hor\u00e1rio de ver\u00e3o de Reuni\u00e3o", "REST"}}, + {"Israel", ISRAEL}, + {"Jamaica", EST}, + {"Japan", JST}, + {"Kwajalein", MHT}, + {"Libya", EET}, + {"MET", new String[] {"Fuso hor\u00e1rio da Europa M\u00e9dia", "MET", + "Fuso hor\u00e1rio de ver\u00e3o da Europa M\u00e9dia", "MEST"}}, + {"Mexico/BajaNorte", PST}, + {"Mexico/BajaSur", MST}, + {"Mexico/General", CST}, + {"MIT", WST_SAMOA}, + {"MST7MDT", MST}, + {"Navajo", MST}, + {"NET", ARMT}, + {"NST", NZST}, + {"NZ", NZST}, + {"NZ-CHAT", CHAST}, + {"PLT", PKT}, + {"Portugal", WET}, + {"PRT", AST}, + {"Pacific/Apia", WST_SAMOA}, + {"Pacific/Auckland", NZST}, + {"Pacific/Chatham", CHAST}, + {"Pacific/Chuuk", TRUT}, + {"Pacific/Easter", EASTER}, + {"Pacific/Efate", new String[] {"Fuso hor\u00e1rio de Vanuatu", "VUT", + "Fuso hor\u00e1rio de ver\u00e3o de Vanuatu", "VUST"}}, + {"Pacific/Enderbury", new String[] {"Fuso hor\u00e1rio das Ilhas F\u00e9nix", "PHOT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas F\u00e9nix", "PHOST"}}, + {"Pacific/Fakaofo", new String[] {"Fuso hor\u00e1rio de Tokelau", "TKT", + "Fuso hor\u00e1rio de ver\u00e3o de Tokelau", "TKST"}}, + {"Pacific/Fiji", new String[] {"Fuso hor\u00e1rio de Fiji", "FJT", + "Fuso hor\u00e1rio de ver\u00e3o de Fiji", "FJST"}}, + {"Pacific/Funafuti", new String[] {"Fuso hor\u00e1rio de Tuvalu", "TVT", + "Fuso hor\u00e1rio de ver\u00e3o de Tuvalu", "TVST"}}, + {"Pacific/Galapagos", new String[] {"Fuso hor\u00e1rio das Ilhas Gal\u00e1pagos", "GALT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Gal\u00e1pagos", "GALST"}}, + {"Pacific/Gambier", GAMBIER}, + {"Pacific/Guadalcanal", SBT}, + {"Pacific/Guam", ChST}, + {"Pacific/Johnston", HST}, + {"Pacific/Kiritimati", new String[] {"Fuso hor\u00e1rio das Esp\u00f3rades Equatoriais", "LINT", + "Fuso hor\u00e1rio de ver\u00e3o das Esp\u00f3rades Equatoriais", "LINST"}}, + {"Pacific/Kosrae", new String[] {"Fuso hor\u00e1rio de Kosrae", "KOST", + "Fuso hor\u00e1rio de ver\u00e3o de Kosrae", "KOSST"}}, + {"Pacific/Kwajalein", MHT}, + {"Pacific/Majuro", MHT}, + {"Pacific/Marquesas", new String[] {"Fuso hor\u00e1rio das Ilhas Marquesas", "MART", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Marquesas", "MARST"}}, + {"Pacific/Midway", SAMOA}, + {"Pacific/Nauru", new String[] {"Fuso hor\u00e1rio de Nauru", "NRT", + "Fuso hor\u00e1rio de ver\u00e3o de Nauru", "NRST"}}, + {"Pacific/Niue", new String[] {"Fuso hor\u00e1rio de Niue", "NUT", + "Fuso hor\u00e1rio de ver\u00e3o de Niue", "NUST"}}, + {"Pacific/Norfolk", new String[] {"Fuso hor\u00e1rio da Ilha de Norfolk", "NFT", + "Fuso hor\u00e1rio de ver\u00e3o da Ilha de Norfolk", "NFST"}}, + {"Pacific/Noumea", new String[] {"Fuso hor\u00e1rio da Nova Caled\u00f4nia", "NCT", + "Fuso hor\u00e1rio de ver\u00e3o da Nova Caled\u00f4nia", "NCST"}}, + {"Pacific/Pago_Pago", SAMOA}, + {"Pacific/Palau", new String[] {"Fuso hor\u00e1rio de Palau", "PWT", + "Fuso hor\u00e1rio de ver\u00e3o de Palau", "PWST"}}, + {"Pacific/Pitcairn", PITCAIRN}, + {"Pacific/Pohnpei", PONT}, + {"Pacific/Ponape", PONT}, + {"Pacific/Port_Moresby", new String[] {"Fuso hor\u00e1rio de Papua-Nova Guin\u00e9", "PGT", + "Fuso hor\u00e1rio de ver\u00e3o de Papua-Nova Guin\u00e9", "PGST"}}, + {"Pacific/Rarotonga", new String[] {"Fuso hor\u00e1rio das Ilhas Cook", "CKT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Cook", "CKHST"}}, + {"Pacific/Saipan", ChST}, + {"Pacific/Samoa", SAMOA}, + {"Pacific/Tahiti", new String[] {"Fuso hor\u00e1rio do Taiti", "TAHT", + "Fuso hor\u00e1rio de ver\u00e3o do Taiti", "TAHST"}}, + {"Pacific/Tarawa", new String[] {"Fuso hor\u00e1rio das Ilhas Gilbert", "GILT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Gilbert", "GILST"}}, + {"Pacific/Tongatapu", new String[] {"Fuso hor\u00e1rio de Tonga", "TOT", + "Fuso hor\u00e1rio de ver\u00e3o de Tonga", "TOST"}}, + {"Pacific/Truk", TRUT}, + {"Pacific/Wake", new String[] {"Fuso hor\u00e1rio de Wake", "WAKT", + "Fuso hor\u00e1rio de ver\u00e3o de Wake", "WAKST"}}, + {"Pacific/Wallis", new String[] {"Fuso hor\u00e1rio de Wallis e Futuna", "WFT", + "Fuso hor\u00e1rio de ver\u00e3o de Wallis e Futuna", "WFST"}}, + {"Pacific/Yap", TRUT}, + {"Poland", CET}, + {"PRC", CTT}, + {"PST8PDT", PST}, + {"ROK", KST}, + {"Singapore", SGT}, + {"SST", SBT}, + {"SystemV/AST4", AST}, + {"SystemV/AST4ADT", AST}, + {"SystemV/CST6", CST}, + {"SystemV/CST6CDT", CST}, + {"SystemV/EST5", EST}, + {"SystemV/EST5EDT", EST}, + {"SystemV/HST10", HST}, + {"SystemV/MST7", MST}, + {"SystemV/MST7MDT", MST}, + {"SystemV/PST8", PST}, + {"SystemV/PST8PDT", PST}, + {"SystemV/YST9", AKST}, + {"SystemV/YST9YDT", AKST}, + {"Turkey", EET}, + {"UCT", UTC}, + {"Universal", UTC}, + {"US/Alaska", AKST}, + {"US/Aleutian", HAST}, + {"US/Arizona", MST}, + {"US/Central", CST}, + {"US/Eastern", EST}, + {"US/Hawaii", HST}, + {"US/Indiana-Starke", CST}, + {"US/East-Indiana", EST}, + {"US/Michigan", EST}, + {"US/Mountain", MST}, + {"US/Pacific", PST}, + {"US/Pacific-New", PST}, + {"US/Samoa", SAMOA}, + {"UTC", UTC}, + {"VST", ICT}, + {"W-SU", MSK}, + {"WET", WET}, + {"Zulu", UTC}, }; } } - - diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/javavm/export/jvm.h --- a/jdk/src/share/javavm/export/jvm.h Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/javavm/export/jvm.h Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1423,7 +1423,8 @@ * the new bit is also added in the main/baseline. */ unsigned int thread_park_blocker : 1; - unsigned int : 31; + unsigned int post_vm_init_hook_enabled : 1; + unsigned int : 30; unsigned int : 32; unsigned int : 32; } jdk_version_info; diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/native/common/jdk_util.c --- a/jdk/src/share/native/common/jdk_util.c Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/share/native/common/jdk_util.c Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -98,4 +98,8 @@ info->update_version = jdk_update_version; info->special_update_version = (unsigned int) jdk_special_version; info->thread_park_blocker = 1; + // Advertise presence of sun.misc.PostVMInitHook: + // future optimization: detect if this is enabled. + info->post_vm_init_hook_enabled = 1; + } diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/native/sun/font/layout/Features.h --- a/jdk/src/share/native/sun/font/layout/Features.h Thu Apr 21 15:32:48 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/* - * - * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved - * - */ - -#ifndef __FEATURES_H -#define __FEATURES_H - -/** - * \file - * \internal - */ - -#include "LETypes.h" -#include "OpenTypeTables.h" - -U_NAMESPACE_BEGIN - -struct FeatureRecord -{ - ATag featureTag; - Offset featureTableOffset; -}; - -struct FeatureTable -{ - Offset featureParamsOffset; - le_uint16 lookupCount; - le_uint16 lookupListIndexArray[ANY_NUMBER]; -}; - -struct FeatureListTable -{ - le_uint16 featureCount; - FeatureRecord featureRecordArray[ANY_NUMBER]; - - const FeatureTable *getFeatureTable(le_uint16 featureIndex, LETag *featureTag) const; - - const FeatureTable *getFeatureTable(LETag featureTag) const; -}; - -U_NAMESPACE_END -#endif diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/sample/forkjoin/mergesort/MergeDemo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/sample/forkjoin/mergesort/MergeDemo.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,287 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Oracle nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import java.util.Arrays; +import java.util.Random; + +import static java.lang.Integer.parseInt; + +/** + * MergeExample is a class that runs a demo benchmark of the {@code ForkJoin} framework + * by benchmarking a {@link MergeSort} algorithm that is implemented using + * {@link java.util.concurrent.RecursiveAction}. + * The {@code ForkJoin} framework is setup with different parallelism levels + * and the sort is executed with arrays of different sizes to see the + * trade offs by using multiple threads for different sizes of the array. + */ +public class MergeDemo { + // Use a fixed seed to always get the same random values back + private final Random random = new Random(759123751834L); + private static final int ITERATIONS = 10; + + /** + * Represents the formula {@code f(n) = start + (step * n)} for n = 0 & n < iterations + */ + private static class Range { + private final int start; + private final int step; + private final int iterations; + + private Range(int start, int step, int iterations) { + this.start = start; + this.step = step; + this.iterations = iterations; + } + + /** + * Parses start, step and iterations from args + * @param args the string array containing the arguments + * @param start which element to start the start argument from + * @return the constructed range + */ + public static Range parse(String[] args, int start) { + if (args.length < start + 3) { + throw new IllegalArgumentException("Too few elements in array"); + } + return new Range(parseInt(args[start]), parseInt(args[start + 1]), parseInt(args[start + 2])); + } + + public int get(int iteration) { + return start + (step * iteration); + } + + public int getIterations() { + return iterations; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append(start).append(" ").append(step).append(" ").append(iterations); + return builder.toString(); + } + } + + /** + * Wraps the different parameters that is used when running the MergeExample. + * {@code sizes} represents the different array sizes + * {@code parallelism} represents the different parallelism levels + */ + private static class Configuration { + private final Range sizes; + private final Range parallelism; + + private final static Configuration defaultConfig = new Configuration(new Range(20000, 20000, 10), + new Range(2, 2, 10)); + + private Configuration(Range sizes, Range parallelism) { + this.sizes = sizes; + this.parallelism = parallelism; + } + + /** + * Parses the arguments and attempts to create a configuration containing the + * parameters for creating the array sizes and parallelism sizes + * @param args the input arguments + * @return the configuration + */ + public static Configuration parse(String[] args) { + if (args.length == 0) { + return defaultConfig; + } else { + try { + if (args.length == 6) { + return new Configuration(Range.parse(args, 0), Range.parse(args, 3)); + } + } catch (NumberFormatException e) { + System.err.println("MergeExample: error: Argument was not a number."); + } + System.err.println("MergeExample " + + " "); + System.err.println("example: MergeExample 20000 10000 3 1 1 4"); + System.err.println("example: will run with arrays of sizes 20000, 30000, 40000" + + " and parallelism: 1, 2, 3, 4"); + return null; + } + } + + /** + * Creates an array for reporting the test result time in + * @return an array containing {@code sizes.iterations * parallelism.iterations} elements + */ + private long[][] createTimesArray() { + return new long[sizes.getIterations()][parallelism.getIterations()]; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(""); + if (this == defaultConfig) { + builder.append("Default configuration. "); + } + builder.append("Running with parameters: "); + builder.append(sizes); + builder.append(" "); + builder.append(parallelism); + return builder.toString(); + } + } + + /** + * Generates an array of {@code elements} random elements + * @param elements the number of elements requested in the array + * @return an array of {@code elements} random elements + */ + private int[] generateArray(int elements) { + int[] array = new int[elements]; + for (int i = 0; i < elements; ++i) { + array[i] = random.nextInt(); + } + return array; + } + + /** + * Runs the test + * @param config contains the settings for the test + */ + private void run(Configuration config) { + Range sizes = config.sizes; + Range parallelism = config.parallelism; + + // Run a couple of sorts to make the JIT compile / optimize the code + // which should produce somewhat more fair times + warmup(); + + long[][] times = config.createTimesArray(); + + for (int size = 0; size < sizes.getIterations(); size++) { + runForSize(parallelism, sizes.get(size), times, size); + } + + printResults(sizes, parallelism, times); + } + + /** + * Prints the results as a table + * @param sizes the different sizes of the arrays + * @param parallelism the different parallelism levels used + * @param times the median times for the different sizes / parallelism + */ + private void printResults(Range sizes, Range parallelism, long[][] times) { + System.out.println("Time in milliseconds. Y-axis: number of elements. X-axis parallelism used."); + long[] sums = new long[times[0].length]; + System.out.format("%8s ", ""); + for (int i = 0; i < times[0].length; i++) { + System.out.format("%4d ", parallelism.get(i)); + } + System.out.println(""); + for (int size = 0; size < sizes.getIterations(); size++) { + System.out.format("%8d: ", sizes.get(size)); + for (int i = 0; i < times[size].length; i++) { + sums[i] += times[size][i]; + System.out.format("%4d ", times[size][i]); + } + System.out.println(""); + } + System.out.format("%8s: ", "Total"); + for (long sum : sums) { + System.out.format("%4d ", sum); + } + System.out.println(""); + } + + private void runForSize(Range parallelism, int elements, long[][] times, int size) { + for (int step = 0; step < parallelism.getIterations(); step++) { + long time = runForParallelism(ITERATIONS, elements, parallelism.get(step)); + times[size][step] = time; + } + } + + /** + * Runs iterations number of test sorts of a random array of element length + * @param iterations number of iterations + * @param elements number of elements in the random array + * @param parallelism parallelism for the ForkJoin framework + * @return the median time of runs + */ + private long runForParallelism(int iterations, int elements, int parallelism) { + MergeSort mergeSort = new MergeSort(parallelism); + long[] times = new long[iterations]; + + for (int i = 0; i < iterations; i++) { + // Suggest the VM to run a garbage collection to reduce the risk of getting one + // while running the test run + System.gc(); + long start = System.currentTimeMillis(); + mergeSort.sort(generateArray(elements)); + times[i] = System.currentTimeMillis() - start; + } + + return medianValue(times); + } + + /** + * Calculates the median value of the array + * @param times array of times + * @return the median value + */ + private long medianValue(long[] times) { + if (times.length == 0) { + throw new IllegalArgumentException("Empty array"); + } + // Make a copy of times to avoid having side effects on the parameter value + Arrays.sort(times.clone()); + long median = times[times.length / 2]; + if (times.length > 1 && times.length % 2 != 0) { + median = (median + times[times.length / 2 + 1]) / 2; + } + return median; + } + + /** + * Generates 1000 arrays of 1000 elements and sorts them as a warmup + */ + private void warmup() { + MergeSort mergeSort = new MergeSort(Runtime.getRuntime().availableProcessors()); + for (int i = 0; i < 1000; i++) { + mergeSort.sort(generateArray(1000)); + } + } + + public static void main(String[] args) { + Configuration configuration = Configuration.parse(args); + if (configuration == null) { + System.exit(1); + } + System.out.println(configuration); + new MergeDemo().run(configuration); + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/sample/forkjoin/mergesort/MergeSort.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/sample/forkjoin/mergesort/MergeSort.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Oracle nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import java.util.Arrays; +import java.util.concurrent.ForkJoinPool; +import java.util.concurrent.ForkJoinTask; +import java.util.concurrent.RecursiveAction; + +/** + * A class for sorting an array of {@code ints} in parallel. + * A {@code ForkJoinPool} is used for the parallelism, using the merge sort + * algorithm the array is split into halves and a new sub task is created + * for each part. Each sub task is dispatched to the {@code ForkJoinPool} + * which will schedule the task to a {@code Thread}. + * This happens until the size of the array is at most 2 + * elements long. At this point the array is sorted using a simple compare + * and possibly a swap. The tasks then finish by using insert sort to + * merge the two just sorted arrays. + * + * The idea of this class is to demonstrate the usage of RecursiveAction not + * to implement the best possible parallel merge sort. This version creates + * a small array for each merge (creating a lot of objects), this could + * be avoided by keeping a single array. + */ +public class MergeSort { + private final ForkJoinPool pool; + + private static class MergeSortTask extends RecursiveAction { + private final int[] array; + private final int low; + private final int high; + private static final int THRESHOLD = 8; + + /** + * Creates a {@code MergeSortTask} containing the array and the bounds of the array + * + * @param array the array to sort + * @param low the lower element to start sorting at + * @param high the non-inclusive high element to sort to + */ + protected MergeSortTask(int[] array, int low, int high) { + this.array = array; + this.low = low; + this.high = high; + } + + @Override + protected void compute() { + if (high - low <= THRESHOLD) { + Arrays.sort(array, low, high); + } else { + int middle = low + ((high - low) >> 1); + // Execute the sub tasks and wait for them to finish + invokeAll(new MergeSortTask(array, low, middle), new MergeSortTask(array, middle, high)); + // Then merge the results + merge(middle); + } + } + + /** + * Merges the two sorted arrays this.low, middle - 1 and middle, this.high - 1 + * @param middle the index in the array where the second sorted list begins + */ + private void merge(int middle) { + if (array[middle - 1] < array[middle]) { + return; // the arrays are already correctly sorted, so we can skip the merge + } + int[] copy = new int[high - low]; + System.arraycopy(array, low, copy, 0, copy.length); + int copyLow = 0; + int copyHigh = high - low; + int copyMiddle = middle - low; + + for (int i = low, p = copyLow, q = copyMiddle; i < high; i++) { + if (q >= copyHigh || (p < copyMiddle && copy[p] < copy[q]) ) { + array[i] = copy[p++]; + } else { + array[i] = copy[q++]; + } + } + } + } + + /** + * Creates a {@code MergeSort} containing a ForkJoinPool with the indicated parallelism level + * @param parallelism the parallelism level used + */ + public MergeSort(int parallelism) { + pool = new ForkJoinPool(parallelism); + } + + /** + * Sorts all the elements of the given array using the ForkJoin framework + * @param array the array to sort + */ + public void sort(int[] array) { + ForkJoinTask job = pool.submit(new MergeSortTask(array, 0, array.length)); + job.join(); + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/sample/nio/chatserver/ChatServer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/sample/nio/chatserver/ChatServer.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Oracle nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.SocketAddress; +import java.net.StandardSocketOption; +import java.nio.channels.*; +import java.util.*; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +/** + * Implements a chat server, this class holds the list of {@code clients} connected to the server. + * It sets up a server socket using AsynchronousServerSocketChannel listening to a specified port. + */ +public class ChatServer implements Runnable { + private final List connections = Collections.synchronizedList(new ArrayList()); + private int port; + private final AsynchronousServerSocketChannel listener; + private final AsynchronousChannelGroup channelGroup; + + /** + * + * @param port to listen to + * @throws java.io.IOException when failing to start the server + */ + public ChatServer(int port) throws IOException { + channelGroup = AsynchronousChannelGroup.withFixedThreadPool(Runtime.getRuntime().availableProcessors(), + Executors.defaultThreadFactory()); + this.port = port; + listener = createListener(channelGroup); + } + + /** + * + * @return The socket address that the server is bound to + * @throws java.io.IOException if an I/O error occurs + */ + public SocketAddress getSocketAddress() throws IOException { + return listener.getLocalAddress(); + } + + /** + * Start accepting connections + */ + public void run() { + + // call accept to wait for connections, tell it to call our CompletionHandler when there + // is a new incoming connection + listener.accept(null, new CompletionHandler() { + @Override + public void completed(AsynchronousSocketChannel result, Void attachment) { + // request a new accept and handle the incoming connection + listener.accept(null, this); + handleNewConnection(result); + } + + @Override + public void failed(Throwable exc, Void attachment) { + } + }); + } + + /** + * Shuts down the server + * @throws InterruptedException if terminated while waiting for shutdown + * @throws IOException if failing to shutdown the channel group + */ + public void shutdown() throws InterruptedException, IOException { + channelGroup.shutdownNow(); + channelGroup.awaitTermination(1, TimeUnit.SECONDS); + } + + /* + * Creates a listener and starts accepting connections + */ + private AsynchronousServerSocketChannel createListener(AsynchronousChannelGroup channelGroup) throws IOException { + final AsynchronousServerSocketChannel listener = openChannel(channelGroup); + listener.setOption(StandardSocketOption.SO_REUSEADDR, true); + listener.bind(new InetSocketAddress(port)); + return listener; + } + + private AsynchronousServerSocketChannel openChannel(AsynchronousChannelGroup channelGroup) throws IOException { + return AsynchronousServerSocketChannel.open(channelGroup); + } + + /** + * Creates a new client and adds it to the list of connections. + * Sets the clients handler to the initial state of NameReader + * + * @param channel the newly accepted channel + */ + private void handleNewConnection(AsynchronousSocketChannel channel) { + Client client = new Client(channel, new ClientReader(this, new NameReader(this))); + try { + channel.setOption(StandardSocketOption.TCP_NODELAY, true); + } catch (IOException e) { + // ignore + } + connections.add(client); + client.run(); + } + + /** + * Sends a message to all clients except the source. + * The method is synchronized as it is desired that messages are sent to + * all clients in the same order as received. + * + * @param client the message source + * @param message the message to be sent + */ + public void writeMessageToClients(Client client, String message) { + synchronized (connections) { + for (Client clientConnection : connections) { + if (clientConnection != client) { + clientConnection.writeMessageFrom(client, message); + } + } + } + } + + public void removeClient(Client client) { + connections.remove(client); + } + + private static void usage() { + System.err.println("ChatServer [-port ]"); + System.exit(1); + } + + public static void main(String[] args) throws IOException { + int port = 5000; + if (args.length != 0 && args.length != 2) { + usage(); + } else if (args.length == 2) { + try { + if (args[0].equals("-port")) { + port = Integer.parseInt(args[1]); + } else { + usage(); + } + } catch (NumberFormatException e) { + usage(); + } + } + System.out.println("Running on port " + port); + new ChatServer(port).run(); + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/sample/nio/chatserver/Client.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/sample/nio/chatserver/Client.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Oracle nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.channels.AsynchronousSocketChannel; +import java.nio.channels.CompletionHandler; +import java.util.LinkedList; +import java.util.Queue; +import java.util.concurrent.atomic.AtomicReference; + +/** + * Client represents a remote connection to the chat server. + * It contains methods for reading and writing messages from the + * channel. + * Messages are considered to be separated by newline, so incomplete + * messages are buffered in the {@code Client}. + * + * All reads and writes are asynchronous and uses the nio2 asynchronous + * elements. + */ +class Client { + private final AsynchronousSocketChannel channel; + private AtomicReference reader; + private String userName; + private final StringBuilder messageBuffer = new StringBuilder(); + + private final Queue queue = new LinkedList(); + private boolean writing = false; + + public Client(AsynchronousSocketChannel channel, ClientReader reader) { + this.channel = channel; + this.reader = new AtomicReference(reader); + } + + /** + * Enqueues a write of the buffer to the channel. + * The call is asynchronous so the buffer is not safe to modify after + * passing the buffer here. + * + * @param buffer the buffer to send to the channel + */ + private void writeMessage(final ByteBuffer buffer) { + boolean threadShouldWrite = false; + + synchronized(queue) { + queue.add(buffer); + // Currently no thread writing, make this thread dispatch a write + if (!writing) { + writing = true; + threadShouldWrite = true; + } + } + + if (threadShouldWrite) { + writeFromQueue(); + } + } + + private void writeFromQueue() { + ByteBuffer buffer; + + synchronized (queue) { + buffer = queue.poll(); + if (buffer == null) { + writing = false; + } + } + + // No new data in buffer to write + if (writing) { + writeBuffer(buffer); + } + } + + private void writeBuffer(ByteBuffer buffer) { + channel.write(buffer, buffer, new CompletionHandler() { + @Override + public void completed(Integer result, ByteBuffer buffer) { + if (buffer.hasRemaining()) { + channel.write(buffer, buffer, this); + } else { + // Go back and check if there is new data to write + writeFromQueue(); + } + } + + @Override + public void failed(Throwable exc, ByteBuffer attachment) { + } + }); + } + + /** + * Sends a message + * @param string the message + */ + public void writeStringMessage(String string) { + writeMessage(ByteBuffer.wrap(string.getBytes())); + } + + /** + * Send a message from a specific client + * @param client the message is sent from + * @param message to send + */ + public void writeMessageFrom(Client client, String message) { + if (reader.get().acceptsMessages()) { + writeStringMessage(client.getUserName() + ": " + message); + } + } + + /** + * Enqueue a read + * @param completionHandler callback on completed read + */ + public void read(CompletionHandler completionHandler) { + ByteBuffer input = ByteBuffer.allocate(256); + if (!channel.isOpen()) { + return; + } + channel.read(input, input, completionHandler); + } + + /** + * Closes the channel + */ + public void close() { + try { + channel.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * Run the current states actions. + */ + public void run() { + reader.get().run(this); + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public void setReader(ClientReader reader) { + this.reader.set(reader); + } + + public String getUserName() { + return userName; + } + + public void appendMessage(String message) { + synchronized (messageBuffer) { + messageBuffer.append(message); + } + } + + /** + * @return the next newline separated message in the buffer. null is returned if the buffer + * doesn't contain any newline. + */ + public String nextMessage() { + synchronized(messageBuffer) { + int nextNewline = messageBuffer.indexOf("\n"); + if (nextNewline == -1) { + return null; + } + String message = messageBuffer.substring(0, nextNewline + 1); + messageBuffer.delete(0, nextNewline + 1); + return message; + } + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/sample/nio/chatserver/ClientReader.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/sample/nio/chatserver/ClientReader.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Oracle nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import java.nio.ByteBuffer; +import java.nio.channels.CompletionHandler; + +/** + * Handles a cycle of reading / writing on the {@code Client}. + */ +class ClientReader { + private final DataReader callback; + private final ChatServer chatServer; + + ClientReader(ChatServer chatServer, DataReader callback) { + this.chatServer = chatServer; + this.callback = callback; + } + + public boolean acceptsMessages() { + return callback.acceptsMessages(); + } + + /** + * Runs a cycle of doing a beforeRead action and then enqueing a new + * read on the client. Handles closed channels and errors while reading. + * If the client is still connected a new round of actions are called. + */ + public void run(final Client client) { + callback.beforeRead(client); + client.read(new CompletionHandler() { + @Override + public void completed(Integer result, ByteBuffer buffer) { + // if result is negative or zero the connection has been closed or something gone wrong + if (result < 1) { + client.close(); + System.out.println("Closing connection to " + client); + chatServer.removeClient(client); + } else { + callback.onData(client, buffer, result); + // enqueue next round of actions + client.run(); + } + } + + @Override + public void failed(Throwable exc, ByteBuffer buffer) { + client.close(); + chatServer.removeClient(client); + } + }); + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/sample/nio/chatserver/DataReader.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/sample/nio/chatserver/DataReader.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Oracle nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import java.nio.ByteBuffer; + +public interface DataReader { + void beforeRead(Client client); + void onData(Client client, ByteBuffer buffer, int bytes); + boolean acceptsMessages(); +} diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/sample/nio/chatserver/MessageReader.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/sample/nio/chatserver/MessageReader.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Oracle nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import java.nio.ByteBuffer; + +/** + * Writes all messages in our buffer to the other clients + * and appends new data read from the socket to our buffer + */ +class MessageReader implements DataReader { + private final ChatServer chatServer; + + public MessageReader(ChatServer chatServer) { + this.chatServer = chatServer; + } + + public boolean acceptsMessages() { + return true; + } + + /** + * Write all full messages in our buffer to + * the other clients + * + * @param client the client to read messages from + */ + @Override + public void beforeRead(Client client) { + // Check if we have any messages buffered and send them + String message = client.nextMessage(); + while (message != null) { + chatServer.writeMessageToClients(client, message); + message = client.nextMessage(); + } + } + + /** + * Append the read buffer to the clients message buffer + * @param client the client to append messages to + * @param buffer the buffer we received from the socket + * @param bytes the number of bytes read into the buffer + */ + @Override + public void onData(Client client, ByteBuffer buffer, int bytes) { + buffer.flip(); + // Just append the message on the buffer + client.appendMessage(new String(buffer.array(), 0, bytes)); + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/sample/nio/chatserver/NameReader.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/sample/nio/chatserver/NameReader.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Oracle nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import java.nio.ByteBuffer; + +/** + * The first state a newly connected {@code Client} is in, this + * handles writing out the welcoming message and reads the response + * up to a newline. When a newline character have been received + * it changes the handler from NameReader to MessageReader on the + * client. + */ +class NameReader implements DataReader { + private final StringBuilder buffer = new StringBuilder(); + private final ChatServer chatServer; + private boolean once = true; + private static final String NEWLINE = "\n"; + + public NameReader(ChatServer chatServer) { + this.chatServer = chatServer; + } + + /** + * Writes the welcoming message to the client the first time this method + * is called. + * + * @param client the client to receive the message + */ + @Override + public void beforeRead(Client client) { + // if it is a long name that takes more than one read we only want to display Name: once. + if (once) { + client.writeStringMessage("Name: "); + once = false; + } + } + + public boolean acceptsMessages() { + return false; + } + + /** + * Receives incoming data from the socket, searches for a newline + * and tries to set the username if one is found + */ + @Override + public void onData(Client client, ByteBuffer buffer, int bytes) { + buffer.flip(); + String name; + name = this.buffer.append(new String(buffer.array(), 0, bytes)).toString(); + if (name.contains(NEWLINE)) { + onUserNameRead(client, name); + } + } + + /** + * Splits the name on the newlines, takes the first as the username + * and appends everything else to the clients message buffer. + * Sets the clients handler to MessageReader. + * + * @param client the client to set the username for + * @param name the string containing the buffered input + */ + private void onUserNameRead(Client client, String name) { + String[] strings = name.split(NEWLINE, 2); + client.setUserName(strings[0].trim()); + sendRemainingParts(client, strings); + client.setReader(new ClientReader(chatServer, new MessageReader(chatServer))); + client.writeStringMessage("Welcome " + client.getUserName() + "\n"); + } + + /** + * Appends the remaining parts to the clients message buffer + * + * @param client the client + * @param strings the messages to append to the buffer + */ + private void sendRemainingParts(Client client, String[] strings) { + for (int i = 1; i < strings.length; ++i) { + client.appendMessage(strings[i]); + } + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/src/share/sample/nio/chatserver/README.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/sample/nio/chatserver/README.txt Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,62 @@ +A Simple Chat Server Example + +INTRODUCTION +============ +This directory contains a very simple chat server, the server takes input from a +socket ("user") and sends it to all other connected sockets ("users") along with +the provided name the user was asked for when first connecting. + +The server was written to demonstrate the asynchronous I/O API in JDK 7. +The sample assumes the reader has some familiarity with the subject matter. + +SETUP +===== + +The server must be built with version 7 (or later) of the JDK. +The server is built with: + + % mkdir build + % javac -source 7 -target 7 -d build *.java + +EXECUTION +========= + + % java -classpath build ChatServer [-port ] + + Usage: ChatServer [options] + options: + -port port port number + default: 5000 + +CLIENT EXECUTION +================ + +No client binary is included in the sample. +Connections can be made using for example the telnet command or any program +that supports a raw TCP connection to a port. + +SOURCE CODE OVERVIEW +==================== +ChatServer is the main class, it handles the startup and handles incoming +connections on the listening sockets. It keeps a list of connected client +and provides methods for sending a message to them. + +Client represents a connected user, it provides methods for reading/writing +from/to the underlying socket. It also contains a buffer of input read from +the user. + +DataReader provides the interface of the two states a user can +be in. Waiting for a name (and not receiving any messages while doing so, implemented +by NameReader) and waiting for messages from the user (implemented by MessageReader). + +ClientReader contains the "main loop" for a connected client. + +NameReader is the initial state for a new client, it sends the user a string and +waits for a response before changing the state to MessageReader. + +MessageReader is the main state for a client, it checks for new messages to send to +other clients and reads messages from the client. + +FINALLY +======= +This is a sample: it is not production quality and isn't optimized for performance. diff -r 837037533544 -r 3ea0814d3885 jdk/src/solaris/bin/java_md.c --- a/jdk/src/solaris/bin/java_md.c Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/solaris/bin/java_md.c Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,6 +46,10 @@ #define JVM_DLL "libjvm.so" #define JAVA_DLL "libjava.so" +/* help jettison the LD_LIBRARY_PATH settings in the future */ +#ifndef SETENV_REQUIRED +#define SETENV_REQUIRED +#endif /* * If a processor / os combination has the ability to run binaries of * two data models and cohabitation of jre/jdk bits with both data @@ -106,10 +110,22 @@ * Previously the launcher modified the LD_LIBRARY_PATH appropriately for the * desired data model path, regardless if data models matched or not. The * launcher subsequently exec'ed the desired executable, in order to make the - * LD_LIBRARY_PATH path available for the runtime linker. This is no longer the - * case, the launcher dlopens the target libjvm.so. All other required - * libraries are loaded by the runtime linker, by virtue of the $ORIGIN paths - * baked into the shared libraries, by the build infrastructure at compile time. + * LD_LIBRARY_PATH path available, for the runtime linker. + * + * Now, in most cases,the launcher will dlopen the target libjvm.so. All + * required libraries are loaded by the runtime linker, using the + * $RPATH/$ORIGIN baked into the shared libraries at compile time. Therefore, + * in most cases, the launcher will only exec, if the data models are + * mismatched, and will not set any environment variables, regardless of the + * data models. + * + * However, if the environment contains a LD_LIBRARY_PATH, this will cause the + * launcher to inspect the LD_LIBRARY_PATH. The launcher will check + * a. if the LD_LIBRARY_PATH's first component is the the path to the desired + * libjvm.so + * b. if any other libjvm.so is found in any of the paths. + * If case b is true, then the launcher will set the LD_LIBRARY_PATH to the + * desired JRE and reexec, in order to propagate the environment. * * Main * (incoming argv) @@ -137,11 +153,11 @@ * | | * | | * \|/ \|/ - * YES (find the desired executable and exec child) + * YES Find the desired executable/library * | | * | | * \|/ \|/ - * CheckJvmType Main + * CheckJvmType RequiresSetenv * (removes -client, -server, etc.) * | * | @@ -156,7 +172,42 @@ * processes version options, * creates argument list for vm, * etc.) - * + * | + * | + * \|/ + * RequiresSetenv + * Is LD_LIBRARY_PATH + * and friends set ? --> NO --> Have Desired Model ? NO --> Re-exec --> Main + * YES YES --> Continue + * | + * | + * \|/ + * Path is desired JRE ? YES --> Have Desired Model ? NO --> Re-exec --> Main + * NO YES --> Continue + * | + * | + * \|/ + * Paths have well known + * jvm paths ? --> NO --> Have Desired Model ? NO --> Re-exec --> Main + * YES YES --> Continue + * | + * | + * \|/ + * Does libjvm.so exit + * in any of them ? --> NO --> Have Desired Model ? NO --> Re-exec --> Main + * YES YES --> Continue + * | + * | + * \|/ + * Set the LD_LIBRARY_PATH + * | + * | + * \|/ + * Re-exec + * | + * | + * \|/ + * Main */ static const char * SetExecname(char **argv); @@ -182,6 +233,130 @@ } } +#ifdef SETENV_REQUIRED +static jboolean +JvmExists(const char *path) { + char tmp[PATH_MAX + 1]; + struct stat statbuf; + JLI_Snprintf(tmp, PATH_MAX, "%s/%s", path, JVM_DLL); + if (stat(tmp, &statbuf) == 0) { + return JNI_TRUE; + } + return JNI_FALSE; +} +/* + * contains a lib/$LIBARCH/{server,client}/libjvm.so ? + */ +static jboolean +ContainsLibJVM(int wanted, const char *env) { + char clientPattern[PATH_MAX + 1]; + char serverPattern[PATH_MAX + 1]; + char *envpath; + char *path; + jboolean clientPatternFound; + jboolean serverPatternFound; + + /* fastest path */ + if (env == NULL) { + return JNI_FALSE; + } + + /* the usual suspects */ + JLI_Snprintf(clientPattern, PATH_MAX, "lib/%s/client", GetArchPath(wanted)); + JLI_Snprintf(serverPattern, PATH_MAX, "lib/%s/server", GetArchPath(wanted)); + + /* to optimize for time, test if any of our usual suspects are present. */ + clientPatternFound = JLI_StrStr(env, clientPattern) != NULL; + serverPatternFound = JLI_StrStr(env, serverPattern) != NULL; + if (clientPatternFound == JNI_FALSE && serverPatternFound == JNI_FALSE) { + return JNI_FALSE; + } + + /* + * we have a suspicious path component, check if it contains a libjvm.so + */ + envpath = JLI_StringDup(env); + for (path = JLI_StrTok(envpath, ":"); path != NULL; path = JLI_StrTok(NULL, ":")) { + if (clientPatternFound && JLI_StrStr(path, clientPattern) != NULL) { + if (JvmExists(path)) { + JLI_MemFree(envpath); + return JNI_TRUE; + } + } + if (serverPatternFound && JLI_StrStr(path, serverPattern) != NULL) { + if (JvmExists(path)) { + JLI_MemFree(envpath); + return JNI_TRUE; + } + } + } + JLI_MemFree(envpath); + return JNI_FALSE; +} + +/* + * Test whether the environment variable needs to be set, see flowchart. + */ +static jboolean +RequiresSetenv(int wanted, const char *jvmpath) { + char jpath[PATH_MAX + 1]; + char *llp; + char *dmllp = NULL; + char *p; /* a utility pointer */ + + llp = getenv("LD_LIBRARY_PATH"); +#ifdef __solaris__ + dmllp = (CURRENT_DATA_MODEL == 32) + ? getenv("LD_LIBRARY_PATH_32") + : getenv("LD_LIBRARY_PATH_64"); +#endif /* __solaris__ */ + /* no environment variable is a good environment variable */ + if (llp == NULL && dmllp == NULL) { + return JNI_FALSE; + } +#ifdef __linux + /* + * On linux, if a binary is running as sgid or suid, glibc sets + * LD_LIBRARY_PATH to the empty string for security purposes. (In contrast, + * on Solaris the LD_LIBRARY_PATH variable for a privileged binary does not + * lose its settings; but the dynamic linker does apply more scrutiny to the + * path.) The launcher uses the value of LD_LIBRARY_PATH to prevent an exec + * loop, here and further downstream. Therefore, if we are running sgid or + * suid, this function's setting of LD_LIBRARY_PATH will be ineffective and + * we should case a return from the calling function. Getting the right + * libraries will be handled by the RPATH. In reality, this check is + * redundant, as the previous check for a non-null LD_LIBRARY_PATH will + * return back to the calling function forthwith, it is left here to safe + * guard against any changes, in the glibc's existing security policy. + */ + if ((getgid() != getegid()) || (getuid() != geteuid())) { + return JNI_FALSE; + } +#endif /* __linux */ + + /* + * Prevent recursions. Since LD_LIBRARY_PATH is the one which will be set by + * previous versions of the JRE, thus it is the only path that matters here. + * So we check to see if the desired JRE is set. + */ + JLI_StrNCpy(jpath, jvmpath, PATH_MAX); + p = JLI_StrRChr(jpath, '/'); + *p = '\0'; + if (llp != NULL && JLI_StrNCmp(llp, jpath, JLI_StrLen(jpath)) == 0) { + return JNI_FALSE; + } + + /* scrutinize all the paths further */ + if (llp != NULL && ContainsLibJVM(wanted, llp)) { + return JNI_TRUE; + } + if (dmllp != NULL && ContainsLibJVM(wanted, dmllp)) { + return JNI_TRUE; + } + return JNI_FALSE; +} +#endif /* SETENV_REQUIRED */ + void CreateExecutionEnvironment(int *pargc, char ***pargv, char jrepath[], jint so_jrepath, @@ -195,7 +370,6 @@ * informative to issue an error message based on whether or not the * os/processor combination has dual mode capabilities. */ - jboolean jvmpathExists; /* Compute/set the name of the executable */ @@ -207,13 +381,24 @@ char * jvmtype = NULL; int argc = *pargc; char **argv = *pargv; - int running = CURRENT_DATA_MODEL; int wanted = running; /* What data mode is being asked for? Current model is fine unless another model is asked for */ +#ifdef SETENV_REQUIRED + jboolean mustsetenv = JNI_FALSE; + char *runpath = NULL; /* existing effective LD_LIBRARY_PATH setting */ + char* new_runpath = NULL; /* desired new LD_LIBRARY_PATH string */ + char* newpath = NULL; /* path on new LD_LIBRARY_PATH */ + char* lastslash = NULL; + char** newenvp = NULL; /* current environment */ +#ifdef __solaris__ + char* dmpath = NULL; /* data model specific LD_LIBRARY_PATH, + Solaris only */ +#endif /* __solaris__ */ +#endif /* SETENV_REQUIRED */ char** newargv = NULL; int newargc = 0; @@ -300,9 +485,18 @@ } /* * we seem to have everything we need, so without further ado - * we return back. + * we return back, otherwise proceed to set the environment. */ +#ifdef SETENV_REQUIRED + mustsetenv = RequiresSetenv(wanted, jvmpath); + JLI_TraceLauncher("mustsetenv: %s\n", mustsetenv ? "TRUE" : "FALSE"); + + if (mustsetenv == JNI_FALSE) { + return; + } +#else return; +#endif /* SETENV_REQUIRED */ } else { /* do the same speculatively or exit */ #ifdef DUAL_MODE if (running != wanted) { @@ -331,67 +525,240 @@ /* exec child can do error checking on the existence of the path */ jvmpathExists = GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath, GetArchPath(wanted)); - +#ifdef SETENV_REQUIRED + mustsetenv = RequiresSetenv(wanted, jvmpath); +#endif /* SETENV_REQUIRED */ } #else JLI_ReportErrorMessage(JRE_ERROR2, wanted); exit(1); #endif - } + } +#ifdef SETENV_REQUIRED + if (mustsetenv) { + /* + * We will set the LD_LIBRARY_PATH as follows: + * + * o $JVMPATH (directory portion only) + * o $JRE/lib/$LIBARCHNAME + * o $JRE/../lib/$LIBARCHNAME + * + * followed by the user's previous effective LD_LIBRARY_PATH, if + * any. + */ + +#ifdef __solaris__ + /* + * Starting in Solaris 7, ld.so.1 supports three LD_LIBRARY_PATH + * variables: + * + * 1. LD_LIBRARY_PATH -- used for 32 and 64 bit searches if + * data-model specific variables are not set. + * + * 2. LD_LIBRARY_PATH_64 -- overrides and replaces LD_LIBRARY_PATH + * for 64-bit binaries. + * + * 3. LD_LIBRARY_PATH_32 -- overrides and replaces LD_LIBRARY_PATH + * for 32-bit binaries. + * + * The vm uses LD_LIBRARY_PATH to set the java.library.path system + * property. To shield the vm from the complication of multiple + * LD_LIBRARY_PATH variables, if the appropriate data model + * specific variable is set, we will act as if LD_LIBRARY_PATH had + * the value of the data model specific variant and the data model + * specific variant will be unset. Note that the variable for the + * *wanted* data model must be used (if it is set), not simply the + * current running data model. + */ + + switch (wanted) { + case 0: + if (running == 32) { + dmpath = getenv("LD_LIBRARY_PATH_32"); + wanted = 32; + } else { + dmpath = getenv("LD_LIBRARY_PATH_64"); + wanted = 64; + } + break; - { - char *newexec = execname; + case 32: + dmpath = getenv("LD_LIBRARY_PATH_32"); + break; + + case 64: + dmpath = getenv("LD_LIBRARY_PATH_64"); + break; + + default: + JLI_ReportErrorMessage(JRE_ERROR3, __LINE__); + exit(1); /* unknown value in wanted */ + break; + } + + /* + * If dmpath is NULL, the relevant data model specific variable is + * not set and normal LD_LIBRARY_PATH should be used. + */ + if (dmpath == NULL) { + runpath = getenv("LD_LIBRARY_PATH"); + } else { + runpath = dmpath; + } +#else + /* + * If not on Solaris, assume only a single LD_LIBRARY_PATH + * variable. + */ + runpath = getenv("LD_LIBRARY_PATH"); +#endif /* __solaris__ */ + + /* runpath contains current effective LD_LIBRARY_PATH setting */ + + jvmpath = JLI_StringDup(jvmpath); + new_runpath = JLI_MemAlloc(((runpath != NULL) ? JLI_StrLen(runpath) : 0) + + 2 * JLI_StrLen(jrepath) + 2 * JLI_StrLen(arch) + + JLI_StrLen(jvmpath) + 52); + newpath = new_runpath + JLI_StrLen("LD_LIBRARY_PATH="); + + + /* + * Create desired LD_LIBRARY_PATH value for target data model. + */ + { + /* remove the name of the .so from the JVM path */ + lastslash = JLI_StrRChr(jvmpath, '/'); + if (lastslash) + *lastslash = '\0'; + + sprintf(new_runpath, "LD_LIBRARY_PATH=" + "%s:" + "%s/lib/%s:" + "%s/../lib/%s", + jvmpath, #ifdef DUAL_MODE - /* - * If the data model is being changed, the path to the - * executable must be updated accordingly; the executable name - * and directory the executable resides in are separate. In the - * case of 32 => 64, the new bits are assumed to reside in, e.g. - * "olddir/LIBARCH64NAME/execname"; in the case of 64 => 32, - * the bits are assumed to be in "olddir/../execname". For example, - * - * olddir/sparcv9/execname - * olddir/amd64/execname - * - * for Solaris SPARC and Linux amd64, respectively. - */ - - if (running != wanted) { - char *oldexec = JLI_StrCpy(JLI_MemAlloc(JLI_StrLen(execname) + 1), execname); - char *olddir = oldexec; - char *oldbase = JLI_StrRChr(oldexec, '/'); + jrepath, GetArchPath(wanted), + jrepath, GetArchPath(wanted) +#else + jrepath, arch, + jrepath, arch +#endif + ); - newexec = JLI_MemAlloc(JLI_StrLen(execname) + 20); - *oldbase++ = 0; - sprintf(newexec, "%s/%s/%s", olddir, - ((wanted==64) ? LIBARCH64NAME : ".."), oldbase); - argv[0] = newexec; + /* + * Check to make sure that the prefix of the current path is the + * desired environment variable setting, though the RequiresSetenv + * checks if the desired runpath exists, this logic does a more + * comprehensive check. + */ + if (runpath != NULL && + JLI_StrNCmp(newpath, runpath, JLI_StrLen(newpath)) == 0 && + (runpath[JLI_StrLen(newpath)] == 0 || runpath[JLI_StrLen(newpath)] == ':') && + (running == wanted) /* data model does not have to be changed */ +#ifdef __solaris__ + && (dmpath == NULL) /* data model specific variables not set */ +#endif + ) { + + return; + + } + } + + /* + * Place the desired environment setting onto the prefix of + * LD_LIBRARY_PATH. Note that this prevents any possible infinite + * loop of execv() because we test for the prefix, above. + */ + if (runpath != 0) { + JLI_StrCat(new_runpath, ":"); + JLI_StrCat(new_runpath, runpath); + } + + if (putenv(new_runpath) != 0) { + exit(1); /* problem allocating memory; LD_LIBRARY_PATH not set + properly */ + } + + /* + * Unix systems document that they look at LD_LIBRARY_PATH only + * once at startup, so we have to re-exec the current executable + * to get the changed environment variable to have an effect. + */ + +#ifdef __solaris__ + /* + * If dmpath is not NULL, remove the data model specific string + * in the environment for the exec'ed child. + */ + if (dmpath != NULL) + (void)UnsetEnv((wanted == 32) ? "LD_LIBRARY_PATH_32" : "LD_LIBRARY_PATH_64"); +#endif + + newenvp = environ; } -#endif - JLI_TraceLauncher("TRACER_MARKER:About to EXEC\n"); - (void)fflush(stdout); - (void)fflush(stderr); - execv(newexec, argv); - JLI_ReportErrorMessageSys(JRE_ERROR4, newexec); +#endif /* SETENV_REQUIRED */ + { + char *newexec = execname; +#ifdef DUAL_MODE + /* + * If the data model is being changed, the path to the + * executable must be updated accordingly; the executable name + * and directory the executable resides in are separate. In the + * case of 32 => 64, the new bits are assumed to reside in, e.g. + * "olddir/LIBARCH64NAME/execname"; in the case of 64 => 32, + * the bits are assumed to be in "olddir/../execname". For example, + * + * olddir/sparcv9/execname + * olddir/amd64/execname + * + * for Solaris SPARC and Linux amd64, respectively. + */ + + if (running != wanted) { + char *oldexec = JLI_StrCpy(JLI_MemAlloc(JLI_StrLen(execname) + 1), execname); + char *olddir = oldexec; + char *oldbase = JLI_StrRChr(oldexec, '/'); + + + newexec = JLI_MemAlloc(JLI_StrLen(execname) + 20); + *oldbase++ = 0; + sprintf(newexec, "%s/%s/%s", olddir, + ((wanted == 64) ? LIBARCH64NAME : ".."), oldbase); + argv[0] = newexec; + } +#endif /* DUAL_MODE */ + JLI_TraceLauncher("TRACER_MARKER:About to EXEC\n"); + (void) fflush(stdout); + (void) fflush(stderr); +#ifdef SETENV_REQUIRED + if (mustsetenv) { + execve(newexec, argv, newenvp); + } else { + execv(newexec, argv); + } +#else + execv(newexec, argv); +#endif /* SETENV_REQUIRED */ + JLI_ReportErrorMessageSys(JRE_ERROR4, newexec); #ifdef DUAL_MODE - if (running != wanted) { - JLI_ReportErrorMessage(JRE_ERROR5, wanted, running); -# ifdef __solaris__ -# ifdef __sparc - JLI_ReportErrorMessage(JRE_ERROR6); -# else - JLI_ReportErrorMessage(JRE_ERROR7); -# endif + if (running != wanted) { + JLI_ReportErrorMessage(JRE_ERROR5, wanted, running); +#ifdef __solaris__ +#ifdef __sparc + JLI_ReportErrorMessage(JRE_ERROR6); +#else + JLI_ReportErrorMessage(JRE_ERROR7); +#endif /* __sparc */ + } +#endif /* __solaris__ */ +#endif /* DUAL_MODE */ + } -# endif -#endif - - } - exit(1); + exit(1); } - } /* diff -r 837037533544 -r 3ea0814d3885 jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c --- a/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c Wed Jul 05 17:42:05 2017 +0200 @@ -128,12 +128,12 @@ } } - /* Calculate toolkit name, kind of toolkit (XAWT, Motif) and library to load */ + /* Calculate library name to load */ if (AWTIsHeadless()) { - strcpy(p, "/headless/libmawt"); + strncpy(p, "/headless/libmawt.so", MAXPATHLEN-len-1); } else { /* Default AWT Toolkit on Linux and Solaris is XAWT. */ - strcpy(p, "/xawt/libmawt"); + strncpy(p, "/xawt/libmawt.so", MAXPATHLEN-len-1); } if (toolkit) { @@ -143,23 +143,12 @@ (*env)->DeleteLocalRef(env, propname); } - strcat(p, ".so"); - JNU_CallStaticMethodByName(env, NULL, "java/lang/System", "load", "(Ljava/lang/String;)V", JNU_NewStringPlatform(env, buf)); awtHandle = dlopen(buf, RTLD_LAZY | RTLD_GLOBAL); -/* - if (dlsym(awtHandle, "AWTCharRBearing") == NULL) { - printf("========= AWTCharRBearing not found\n"); fflush(stdout); - } - else { - printf("========= AWTCharRBearing was found\n"); fflush(stdout); - } -*/ - return JNI_VERSION_1_2; } diff -r 837037533544 -r 3ea0814d3885 jdk/src/solaris/native/sun/awt/awt_mgrsel.c --- a/jdk/src/solaris/native/sun/awt/awt_mgrsel.c Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/solaris/native/sun/awt/awt_mgrsel.c Wed Jul 05 17:42:05 2017 +0200 @@ -136,7 +136,7 @@ || per_scr_owners == NULL || mgrsel == NULL) { DTRACE_PRINTLN("MG: select: unable to allocate memory"); - if (namesbuf != NULL) free(per_scr_atoms); + if (namesbuf != NULL) free(namesbuf); if (names != NULL) free(names); if (per_scr_atoms != NULL) free(per_scr_atoms); if (per_scr_owners != NULL) free(per_scr_owners); diff -r 837037533544 -r 3ea0814d3885 jdk/src/solaris/native/sun/awt/gtk2_interface.c --- a/jdk/src/solaris/native/sun/awt/gtk2_interface.c Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/solaris/native/sun/awt/gtk2_interface.c Wed Jul 05 17:42:05 2017 +0200 @@ -443,6 +443,8 @@ "gtk_file_chooser_set_current_folder"); fp_gtk_file_chooser_set_filename = dl_symbol( "gtk_file_chooser_set_filename"); + fp_gtk_file_chooser_set_current_name = dl_symbol( + "gtk_file_chooser_set_current_name"); fp_gtk_file_filter_add_custom = dl_symbol("gtk_file_filter_add_custom"); fp_gtk_file_chooser_set_filter = dl_symbol("gtk_file_chooser_set_filter"); fp_gtk_file_chooser_get_type = dl_symbol("gtk_file_chooser_get_type"); diff -r 837037533544 -r 3ea0814d3885 jdk/src/solaris/native/sun/awt/gtk2_interface.h --- a/jdk/src/solaris/native/sun/awt/gtk2_interface.h Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/solaris/native/sun/awt/gtk2_interface.h Wed Jul 05 17:42:05 2017 +0200 @@ -766,6 +766,8 @@ const gchar *filename); gboolean (*fp_gtk_file_chooser_set_filename)(GtkFileChooser *chooser, const char *filename); +void (*fp_gtk_file_chooser_set_current_name)(GtkFileChooser *chooser, + const gchar *name); void (*fp_gtk_file_filter_add_custom)(GtkFileFilter *filter, GtkFileFilterFlags needed, GtkFileFilterFunc func, gpointer data, GDestroyNotify notify); diff -r 837037533544 -r 3ea0814d3885 jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c --- a/jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c Wed Jul 05 17:42:05 2017 +0200 @@ -4,6 +4,7 @@ #include #include "gtk2_interface.h" #include "sun_awt_X11_GtkFileDialogPeer.h" +#include "java_awt_FileDialog.h" #include "debug_assert.h" static JavaVM *jvm; @@ -220,7 +221,7 @@ const char *title = jtitle == NULL? "": (*env)->GetStringUTFChars(env, jtitle, 0); - if (mode == 1) { + if (mode == java_awt_FileDialog_SAVE) { /* Save action */ dialog = fp_gtk_file_chooser_dialog_new(title, NULL, GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, @@ -253,7 +254,11 @@ /* Set the filename */ if (jfile != NULL) { const char *filename = (*env)->GetStringUTFChars(env, jfile, 0); - fp_gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), filename); + if (mode == java_awt_FileDialog_SAVE) { + fp_gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), filename); + } else { + fp_gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), filename); + } (*env)->ReleaseStringUTFChars(env, jfile, filename); } diff -r 837037533544 -r 3ea0814d3885 jdk/src/windows/classes/sun/awt/Win32FontManager.java --- a/jdk/src/windows/classes/sun/awt/Win32FontManager.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/windows/classes/sun/awt/Win32FontManager.java Wed Jul 05 17:42:05 2017 +0200 @@ -62,8 +62,11 @@ String eudcFile = getEUDCFontFile(); if (eudcFile != null) { try { + /* Must use Java rasteriser since GDI doesn't + * enumerate (allow direct use) of EUDC fonts. + */ eudcFont = new TrueTypeFont(eudcFile, null, 0, - false); + true); } catch (FontFormatException e) { } } @@ -100,6 +103,14 @@ }); } + /** + * Whether registerFontFile expects absolute or relative + * font file names. + */ + protected boolean useAbsoluteFontFileNames() { + return false; + } + /* Unlike the shared code version, this expects a base file name - * not a full path name. * The font configuration file has base file names and the FontConfiguration diff -r 837037533544 -r 3ea0814d3885 jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java --- a/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java Wed Jul 05 17:42:05 2017 +0200 @@ -72,12 +72,6 @@ } /** - * Noop function that just acts as an entry point for someone to force - * a static initialization of this class. - */ - public static void init() {} - - /** * Initializes native components of the graphics environment. This * includes everything from the native GraphicsDevice elements to * the DirectX rendering layer. @@ -208,14 +202,6 @@ * ----END DISPLAY CHANGE SUPPORT---- */ - /** - * Whether registerFontFile expects absolute or relative - * font file names. - */ - protected boolean useAbsoluteFontFileNames() { - return false; - } - protected GraphicsDevice makeScreenDevice(int screennum) { GraphicsDevice device = null; if (WindowsFlags.isD3DEnabled()) { diff -r 837037533544 -r 3ea0814d3885 jdk/src/windows/classes/sun/awt/windows/WToolkit.java --- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java Wed Jul 05 17:42:05 2017 +0200 @@ -103,9 +103,6 @@ static { loadLibraries(); - // Force Win32GE to load if it is not already loaded; this loads - // various other classes that are required for basic awt functionality - Win32GraphicsEnvironment.init(); initIDs(); // Print out which version of Windows is running diff -r 837037533544 -r 3ea0814d3885 jdk/src/windows/classes/sun/nio/fs/WindowsFileSystem.java --- a/jdk/src/windows/classes/sun/nio/fs/WindowsFileSystem.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/windows/classes/sun/nio/fs/WindowsFileSystem.java Wed Jul 05 17:42:05 2017 +0200 @@ -56,8 +56,9 @@ // parse default directory and check it is absolute WindowsPathParser.Result result = WindowsPathParser.parse(dir); - if (result.type() != WindowsPathType.ABSOLUTE) - throw new AssertionError("Default directory must be absolute/non-UNC"); + if ((result.type() != WindowsPathType.ABSOLUTE) && + (result.type() != WindowsPathType.UNC)) + throw new AssertionError("Default directory is not an absolute path"); this.defaultDirectory = result.path(); this.defaultRoot = result.root(); diff -r 837037533544 -r 3ea0814d3885 jdk/src/windows/native/sun/windows/awt_Button.cpp --- a/jdk/src/windows/native/sun/windows/awt_Button.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/windows/native/sun/windows/awt_Button.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -317,7 +317,9 @@ badAlloc = 1; } else { c->SetText(labelStr); - JNU_ReleaseStringPlatformChars(env, label, labelStr); + if (label != NULL) { + JNU_ReleaseStringPlatformChars(env, label, labelStr); + } } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/windows/native/sun/windows/awt_Checkbox.cpp --- a/jdk/src/windows/native/sun/windows/awt_Checkbox.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/windows/native/sun/windows/awt_Checkbox.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -384,7 +384,9 @@ { c->SetText(labelStr); c->VerifyState(); - JNU_ReleaseStringPlatformChars(env, label, labelStr); + if (label != NULL) { + JNU_ReleaseStringPlatformChars(env, label, labelStr); + } } } diff -r 837037533544 -r 3ea0814d3885 jdk/src/windows/native/sun/windows/awt_FileDialog.cpp --- a/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp Wed Jul 05 17:42:05 2017 +0200 @@ -225,7 +225,6 @@ { JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); jobject peer; - WCHAR unicodeChar = L' '; LPTSTR fileBuffer = NULL; LPTSTR currentDirectory = NULL; jint mode = 0; @@ -263,7 +262,7 @@ HWND hwndOwner = awtParent ? awtParent->GetHWnd() : NULL; if (title == NULL || env->GetStringLength(title)==0) { - title = JNU_NewStringPlatform(env, &unicodeChar); + title = JNU_NewStringPlatform(env, L" "); } JavaStringBuffer titleBuffer(env, title); diff -r 837037533544 -r 3ea0814d3885 jdk/test/ProblemList.txt --- a/jdk/test/ProblemList.txt Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/ProblemList.txt Wed Jul 05 17:42:05 2017 +0200 @@ -288,12 +288,6 @@ # jdk_math -# Problems with rounding add failures on solaris-sparcv9 and -server -java/math/BigDecimal/AddTests.java solaris-sparcv9 - -# Should be samevm? But seems problematic with samevm on windows -java/math/BigInteger/ModPow65537.java generic-all - ############################################################################ # jdk_misc diff -r 837037533544 -r 3ea0814d3885 jdk/test/com/sun/tools/attach/ApplicationSetup.sh --- a/jdk/test/com/sun/tools/attach/ApplicationSetup.sh Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/com/sun/tools/attach/ApplicationSetup.sh Wed Jul 05 17:42:05 2017 +0200 @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,8 @@ startApplication() { - ${JAVA} $1 $2 $3 -jar "${TESTCLASSES}"/Application.jar > ${OUTPUTFILE} & + # put all output from the app into ${OUTPUTFILE} + ${JAVA} $1 $2 $3 -jar "${TESTCLASSES}"/Application.jar > ${OUTPUTFILE} 2>&1 & pid="$!" # MKS creates an intermediate shell to launch ${JAVA} so diff -r 837037533544 -r 3ea0814d3885 jdk/test/com/sun/tools/attach/BasicTests.java --- a/jdk/test/com/sun/tools/attach/BasicTests.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/com/sun/tools/attach/BasicTests.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -75,14 +75,23 @@ // Test 3 - load an "bad" agent (agentmain throws an exception) System.out.println(" - Test: Load a bad agent"); + System.out.println("INFO: This test will cause error messages " + + "to appear in the application log about SilverBullet.jar " + + "not being found and an agent failing to start."); try { vm.loadAgent(badagent); + throw new RuntimeException( + "AgentInitializationException not thrown as expected!"); } catch (AgentInitializationException x) { - System.out.println(" - AgentInitializationException throws as expected!"); + System.out.println( + " - AgentInitializationException thrown as expected!"); } // Test 4 - detach from the VM and attempt a load (should throw IOE) System.out.println(" - Test: Detach from VM"); + System.out.println("INFO: This test will cause error messages " + + "to appear in the application log about a BadAgent including " + + "a RuntimeException and an InvocationTargetException."); vm.detach(); try { vm.loadAgent(agent); diff -r 837037533544 -r 3ea0814d3885 jdk/test/com/sun/tools/attach/BasicTests.sh --- a/jdk/test/com/sun/tools/attach/BasicTests.sh Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/com/sun/tools/attach/BasicTests.sh Wed Jul 05 17:42:05 2017 +0200 @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -39,11 +39,9 @@ # Windows 2000 is a problem here, so we skip it, see 6962615 osrev=`uname -a` -if [ "`echo ${osrev} | grep 'CYGWIN'`" != "" ] ; then - if [ "`echo ${osrev} | grep '5.0'`" != "" ] ; then - echo "Treating as a pass, not testing Windows 2000" - exit 0 - fi +if [ "`echo ${osrev} | grep 'CYGWIN[^ ]*-5\.0'`" != "" ] ; then + echo "Treating as a pass, not testing Windows 2000" + exit 0 fi if [ "`echo ${osrev} | grep 'Windows'`" != "" ] ; then if [ "`echo ${osrev} | grep '5 00'`" != "" ] ; then @@ -58,7 +56,7 @@ startApplication -Dattach.test=true # pid = process-id, port = shutdown port - + failures=0 echo "Running tests ..." @@ -69,6 +67,18 @@ stopApplication $port +# Add these info messages to $OUTPUTFILE just in case someone +# looks at it and wonders about the failures. We have to do +# this after the application is stopped because it is writing +# to $OUTPUTFILE. +( +echo "" +echo "INFO: Test 2 will cause error messages about SilverBullet.jar" \ + "and an agent failing to start." +echo "INFO: Test 3 will cause error messages about BadAgent" \ + "including a RuntimeException and an InvocationTargetException." +) >> ${OUTPUTFILE} + if [ $failures = 0 ]; then echo "All tests passed."; else echo "$failures test(s) failed:"; cat ${OUTPUTFILE}; diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/awt/Dialog/ValidateOnShow/ValidateOnShow.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/Dialog/ValidateOnShow/ValidateOnShow.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 7027013 + @summary Dialog.show() should validate the window unconditionally + @author anthony.petrov@oracle.com: area=awt.toplevel + @run main ValidateOnShow +*/ + +import java.awt.*; + +public class ValidateOnShow { + private static Dialog dialog = new Dialog((Frame)null); + private static Panel panel = new Panel() { + @Override + public boolean isValidateRoot() { + return true; + } + }; + private static Button button = new Button("Test"); + + private static void sleep() { + try { Thread.sleep(500); } catch (Exception e) {} + } + + private static void test() { + System.out.println("Before showing: panel.isValid=" + panel.isValid() + " dialog.isValid=" + dialog.isValid()); + dialog.setVisible(true); + sleep(); + System.out.println("After showing: panel.isValid=" + panel.isValid() + " dialog.isValid=" + dialog.isValid()); + + if (!panel.isValid()) { + dialog.dispose(); + throw new RuntimeException("The panel hasn't been validated upon showing the dialog"); + } + + dialog.setVisible(false); + sleep(); + } + + public static void main(String[] args) { + // setup + dialog.add(panel); + panel.add(button); + + dialog.setBounds(200, 200, 300, 200); + + // The first test should always succeed since the dialog is invalid initially + test(); + + // now invalidate the button and the panel + button.setBounds(1, 1, 30, 30); + sleep(); + // since the panel is a validate root, the dialog is still valid + + // w/o a fix this would fail + test(); + + // cleanup + dialog.dispose(); + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/awt/FileDialog/FileNameOverrideTest/FileNameOverrideTest.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/FileDialog/FileNameOverrideTest/FileNameOverrideTest.html Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,22 @@ + + + + FileNameOverrideTest + + + +

              FileNameOverrideTest
              Bug ID: 6260659

              + +

              See the dialog box (usually in upper left corner) for instructions

              + + + + diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/awt/FileDialog/FileNameOverrideTest/FileNameOverrideTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/FileDialog/FileNameOverrideTest/FileNameOverrideTest.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,73 @@ +/* + test + @bug 6260659 + @summary File Name set programmatically in FileDialog is overridden during navigation, XToolkit + @author Dmitry.Cherepanov@SUN.COM area=awt.filedialog + @library ../../regtesthelpers + @build Sysout + @run applet/manual=yesno FileNameOverrideTest.html +*/ + +import test.java.awt.regtesthelpers.Sysout; + +import java.applet.Applet; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.io.IOException; + +public class FileNameOverrideTest extends Applet implements ActionListener { + private final static String fileName = "input"; + private final static String clickDirName = "Directory for double click"; + private final static String dirPath = "."; + private Button showBtn; + private FileDialog fd; + + public void init() { + this.setLayout(new GridLayout(1, 1)); + + fd = new FileDialog(new Frame(), "Open"); + + showBtn = new Button("Show File Dialog"); + showBtn.addActionListener(this); + add(showBtn); + + try { + File tmpFileUp = new File(dirPath + File.separator + fileName); + File tmpDir = new File(dirPath + File.separator + clickDirName); + File tmpFileIn = new File(tmpDir.getAbsolutePath() + File.separator + fileName); + tmpDir.mkdir(); + tmpFileUp.createNewFile(); + tmpFileIn.createNewFile(); + } catch (IOException ex) { + throw new RuntimeException("Cannot create test folder", ex); + } + + String[] instructions = { + "1) Click on 'Show File Dialog' button. A file dialog will come up.", + "2) Double-click on '" + clickDirName + "' and click OK.", + "3) See result of the test below" + }; + Sysout.createDialogWithInstructions(instructions); + }//End init() + + public void start() { + setSize(200, 200); + show(); + }// start() + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == showBtn) { + fd.setFile(fileName); + fd.setDirectory(dirPath); + fd.setVisible(true); + String output = fd.getFile(); + if (fileName.equals(output)) { + Sysout.println("TEST PASSED"); + } else { + Sysout.println("TEST FAILED (output file - " + output + ")"); + } + } + } +}// class ManualYesNoTest diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/awt/FileDialog/SaveFileNameOverrideTest/SaveFileNameOverrideTest.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/FileDialog/SaveFileNameOverrideTest/SaveFileNameOverrideTest.html Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,22 @@ + + + + SaveFileNameOverrideTest + + + +

              SaveFileNameOverrideTest
              Bug ID: 6260659

              + +

              See the dialog box (usually in upper left corner) for instructions

              + + + + diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/awt/FileDialog/SaveFileNameOverrideTest/SaveFileNameOverrideTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/FileDialog/SaveFileNameOverrideTest/SaveFileNameOverrideTest.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,65 @@ +/* + test + @bug 6998877 + @summary After double-click on the folder names, FileNameOverrideTest FAILED + @author Sergey.Bylokhov@oracle.com area=awt.filedialog + @library ../../regtesthelpers + @build Sysout + @run applet/manual=yesno SaveFileNameOverrideTest.html +*/ + +import test.java.awt.regtesthelpers.Sysout; + +import java.applet.Applet; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; + +public class SaveFileNameOverrideTest extends Applet implements ActionListener { + private final static String clickDirName = "Directory for double click"; + private final static String dirPath = "."; + private Button showBtn; + private FileDialog fd; + + public void init() { + this.setLayout(new GridLayout(1, 1)); + + fd = new FileDialog(new Frame(), "Save", FileDialog.SAVE); + + showBtn = new Button("Show File Dialog"); + showBtn.addActionListener(this); + add(showBtn); + + File tmpDir = new File(dirPath + File.separator + clickDirName); + tmpDir.mkdir(); + + String[] instructions = { + "1) Click on 'Show File Dialog' button. A file dialog will come up.", + "2) Double-click on '" + clickDirName + "' and click OK.", + "3) See result of the test below" + }; + + Sysout.createDialogWithInstructions(instructions); + + }//End init() + + public void start() { + setSize(200, 200); + show(); + }// start() + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == showBtn) { + fd.setFile("input"); + fd.setDirectory(dirPath); + fd.setVisible(true); + String output = fd.getFile(); + if ("input".equals(output)) { + Sysout.println("TEST PASSED"); + } else { + Sysout.println("TEST FAILED (output file - " + output + ")"); + } + } + } +}// class ManualYesNoTest diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/awt/GraphicsEnvironment/LoadLock/GE_init1.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/GraphicsEnvironment/LoadLock/GE_init1.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7002839 + * @summary Static init deadlock Win32GraphicsEnvironment and WToolkit + * @run main GE_init1 + */ + +import java.awt.Toolkit; + +public class GE_init1 { + public static void main(String[] args) { + Toolkit.getDefaultToolkit(); + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/awt/GraphicsEnvironment/LoadLock/GE_init2.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/GraphicsEnvironment/LoadLock/GE_init2.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7002839 + * @summary Static init deadlock Win32GraphicsEnvironment and WToolkit + * @run main GE_init2 + */ + + +import java.awt.GraphicsEnvironment; + +public class GE_init2 { + public static void main(String[] args) { + GraphicsEnvironment.getLocalGraphicsEnvironment(); + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/awt/GraphicsEnvironment/LoadLock/GE_init3.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/GraphicsEnvironment/LoadLock/GE_init3.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7002839 + * @summary Static init deadlock Win32GraphicsEnvironment and WToolkit + * @run main GE_init3 + */ + + +import java.awt.Frame; + +public class GE_init3 { + public static void main(String[] args) { + new Frame("Test3").setVisible(true); + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/awt/GraphicsEnvironment/LoadLock/GE_init4.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/GraphicsEnvironment/LoadLock/GE_init4.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7002839 + * @summary Static init deadlock Win32GraphicsEnvironment and WToolkit + * @run main/othervm -Djava.awt.headless=true GE_init4 + */ + +import java.awt.Toolkit; + +public class GE_init4 { + public static void main(String[] args) { + Toolkit.getDefaultToolkit(); + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/awt/GraphicsEnvironment/LoadLock/GE_init5.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/GraphicsEnvironment/LoadLock/GE_init5.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7002839 + * @summary Static init deadlock Win32GraphicsEnvironment and WToolkit + * @run main/othervm -Djava.awt.headless=true GE_init4 + */ + +import java.awt.Toolkit; + +public class GE_init5 { + public static void main(String[] args) { + GraphicsEnvironment.getLocalGraphicsEnvironment(); + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/awt/GraphicsEnvironment/LoadLock/GE_init6.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/GraphicsEnvironment/LoadLock/GE_init6.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7002839 + * @summary Static init deadlock Win32GraphicsEnvironment and WToolkit + * @run main/othervm -Djava.awt.headless=true GE_init6 + */ + +import java.awt.*; + +public class GE_init6 { + private static boolean passed = false; + public static void main(String[] args) { + try { + new Frame("Test3").setVisible(true); + } catch (HeadlessException e){ + passed = true; + } + if (!passed){ + throw new RuntimeException("Should have thrown HE but it either didn't throw any or just passed through."); + } + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/awt/Window/TranslucentJAppletTest/TranslucentJAppletTest.java --- a/jdk/test/java/awt/Window/TranslucentJAppletTest/TranslucentJAppletTest.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/awt/Window/TranslucentJAppletTest/TranslucentJAppletTest.java Wed Jul 05 17:42:05 2017 +0200 @@ -43,6 +43,7 @@ private static void initAndShowGUI() { frame = new JFrame(); JApplet applet = new JApplet(); + applet.setBackground(new Color(0, 0, 0, 0)); JPanel panel = new JPanel() { protected void paintComponent(Graphics g) { paintComponentCalled = true; diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/lang/Character/CheckScript.java --- a/jdk/test/java/lang/Character/CheckScript.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/lang/Character/CheckScript.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,34 +1,58 @@ + +/* + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + /** * @test - * @bug 6945564 6959267 + * @bug 6945564 6959267 7033561 * @summary Check that the j.l.Character.UnicodeScript */ import java.io.*; -import java.lang.reflect.*; import java.util.*; import java.util.regex.*; import java.lang.Character.UnicodeScript; public class CheckScript { - static BufferedReader open(String[] args) throws FileNotFoundException { + public static void main(String[] args) throws Exception { + File fScripts; + File fAliases; if (args.length == 0) { - return new BufferedReader(new FileReader(new File(System.getProperty("test.src", "."), "Scripts.txt"))); - } else if (args.length == 1) { - return new BufferedReader(new FileReader(args[0])); + fScripts = new File(System.getProperty("test.src", "."), "Scripts.txt"); + fAliases = new File(System.getProperty("test.src", "."), "PropertyValueAliases.txt"); + } else if (args.length == 2) { + fScripts = new File(args[0]); + fAliases = new File(args[1]); } else { - System.out.println("java CharacterScript Scripts.txt"); + System.out.println("java CharacterScript Scripts.txt PropertyValueAliases.txt"); throw new RuntimeException("Datafile name should be specified."); } - } - - public static void main(String[] args) throws Exception { Matcher m = Pattern.compile("(\\p{XDigit}+)(?:\\.{2}(\\p{XDigit}+))?\\s+;\\s+(\\w+)\\s+#.*").matcher(""); String line = null; HashMap> scripts = new HashMap<>(); - try (BufferedReader sbfr = open(args)) { + try (BufferedReader sbfr = new BufferedReader(new FileReader(fScripts))) { while ((line = sbfr.readLine()) != null) { if (line.length() <= 1 || line.charAt(0) == '#') { continue; @@ -107,5 +131,29 @@ } } } + // check all aliases + m = Pattern.compile("sc\\s*;\\s*(\\p{Alpha}{4})\\s*;\\s*([\\p{Alpha}|_]+)\\s*.*").matcher(""); + line = null; + try (BufferedReader sbfr = new BufferedReader(new FileReader(fAliases))) { + while ((line = sbfr.readLine()) != null) { + if (line.length() <= 1 || line.charAt(0) == '#') { + continue; + } + m.reset(line); + if (m.matches()) { + String alias = m.group(1); + String name = m.group(2); + // HRKT -> Katakana_Or_Hiragana not supported + if ("HRKT".equals(alias.toUpperCase(Locale.ENGLISH))) + continue; + if (Character.UnicodeScript.forName(alias) != + Character.UnicodeScript.forName(name)) { + throw new RuntimeException( + "UnicodeScript failed: alias<" + alias + + "> does not map to <" + name + ">"); + } + } + } + } } } diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/lang/Character/PropertyValueAliases.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/lang/Character/PropertyValueAliases.txt Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,1178 @@ +# PropertyValueAliases-6.0.0.txt +# Date: 2010-07-17, 22:44:06 GMT [MD] +# +# Unicode Character Database +# Copyright (c) 1991-2010 Unicode, Inc. +# For terms of use, see http://www.unicode.org/terms_of_use.html +# For documentation, see http://www.unicode.org/reports/tr44/ +# +# This file contains aliases for property values used in the UCD. +# These names can be used for XML formats of UCD data, for regular-expression +# property tests, and other programmatic textual descriptions of Unicode data. +# For information on which properties are normative, see UCD.html. +# +# The names may be translated in appropriate environments, and additional +# aliases may be useful. +# +# FORMAT +# +# Each line describes a property value name. +# This consists of three or more fields, separated by semicolons. +# +# First Field: The first field describes the property for which that +# property value name is used. +# +# Second Field: The second field is an abbreviated name. +# If there is no abbreviated name available, the field is marked with "n/a". +# +# Third Field: The third field is a long name. +# +# In the case of ccc, there are 4 fields. The second field is numeric, third +# is abbreviated, and fourth is long. +# +# The above are the preferred aliases. Other aliases may be listed in additional fields. +# +# Loose matching should be applied to all property names and property values, with +# the exception of String Property values. With loose matching of property names and +# values, the case distinctions, whitespace, and '_' are ignored. For Numeric Property +# values, numeric equivalencies are applied: thus "01.00" is equivalent to "1". +# +# NOTE: Property value names are NOT unique across properties. For example: +# +# AL means Arabic Letter for the Bidi_Class property, and +# AL means Above_Left for the Combining_Class property, and +# AL means Alphabetic for the Line_Break property. +# +# In addition, some property names may be the same as some property value names. +# For example: +# +# sc means the Script property, and +# Sc means the General_Category property value Currency_Symbol (Sc) +# +# The combination of property value and property name is, however, unique. +# +# For more information, see UTS #18: Unicode Regular Expressions +# ================================================ + + +# ASCII_Hex_Digit (AHex) + +AHex; N ; No ; F ; False +AHex; Y ; Yes ; T ; True + +# Age (age) + +age; n/a ; 1.1 +age; n/a ; 2.0 +age; n/a ; 2.1 +age; n/a ; 3.0 +age; n/a ; 3.1 +age; n/a ; 3.2 +age; n/a ; 4.0 +age; n/a ; 4.1 +age; n/a ; 5.0 +age; n/a ; 5.1 +age; n/a ; 5.2 +age; n/a ; 6.0 +age; n/a ; unassigned + +# Alphabetic (Alpha) + +Alpha; N ; No ; F ; False +Alpha; Y ; Yes ; T ; True + +# Bidi_Class (bc) + +bc ; AL ; Arabic_Letter +bc ; AN ; Arabic_Number +bc ; B ; Paragraph_Separator +bc ; BN ; Boundary_Neutral +bc ; CS ; Common_Separator +bc ; EN ; European_Number +bc ; ES ; European_Separator +bc ; ET ; European_Terminator +bc ; L ; Left_To_Right +bc ; LRE ; Left_To_Right_Embedding +bc ; LRO ; Left_To_Right_Override +bc ; NSM ; Nonspacing_Mark +bc ; ON ; Other_Neutral +bc ; PDF ; Pop_Directional_Format +bc ; R ; Right_To_Left +bc ; RLE ; Right_To_Left_Embedding +bc ; RLO ; Right_To_Left_Override +bc ; S ; Segment_Separator +bc ; WS ; White_Space + +# Bidi_Control (Bidi_C) + +Bidi_C; N ; No ; F ; False +Bidi_C; Y ; Yes ; T ; True + +# Bidi_Mirrored (Bidi_M) + +Bidi_M; N ; No ; F ; False +Bidi_M; Y ; Yes ; T ; True + +# Bidi_Mirroring_Glyph (bmg) + +# @missing: 0000..10FFFF; Bidi_Mirroring_Glyph; + +# Block (blk) + +blk; n/a ; Aegean_Numbers +blk; n/a ; Alchemical_Symbols +blk; n/a ; Alphabetic_Presentation_Forms +blk; n/a ; Ancient_Greek_Musical_Notation +blk; n/a ; Ancient_Greek_Numbers +blk; n/a ; Ancient_Symbols +blk; n/a ; Arabic +blk; n/a ; Arabic_Presentation_Forms_A ; Arabic_Presentation_Forms-A +blk; n/a ; Arabic_Presentation_Forms_B +blk; n/a ; Arabic_Supplement +blk; n/a ; Armenian +blk; n/a ; Arrows +blk; n/a ; Avestan +blk; n/a ; Balinese +blk; n/a ; Bamum +blk; n/a ; Bamum_Supplement +blk; n/a ; Basic_Latin ; ASCII +blk; n/a ; Batak +blk; n/a ; Bengali +blk; n/a ; Block_Elements +blk; n/a ; Bopomofo +blk; n/a ; Bopomofo_Extended +blk; n/a ; Box_Drawing +blk; n/a ; Brahmi +blk; n/a ; Braille_Patterns +blk; n/a ; Buginese +blk; n/a ; Buhid +blk; n/a ; Byzantine_Musical_Symbols +blk; n/a ; Carian +blk; n/a ; Cham +blk; n/a ; Cherokee +blk; n/a ; CJK_Compatibility +blk; n/a ; CJK_Compatibility_Forms +blk; n/a ; CJK_Compatibility_Ideographs +blk; n/a ; CJK_Compatibility_Ideographs_Supplement +blk; n/a ; CJK_Radicals_Supplement +blk; n/a ; CJK_Strokes +blk; n/a ; CJK_Symbols_And_Punctuation +blk; n/a ; CJK_Unified_Ideographs +blk; n/a ; CJK_Unified_Ideographs_Extension_A +blk; n/a ; CJK_Unified_Ideographs_Extension_B +blk; n/a ; CJK_Unified_Ideographs_Extension_C +blk; n/a ; CJK_Unified_Ideographs_Extension_D +blk; n/a ; Combining_Diacritical_Marks +blk; n/a ; Combining_Diacritical_Marks_For_Symbols; Combining_Marks_For_Symbols +blk; n/a ; Combining_Diacritical_Marks_Supplement +blk; n/a ; Combining_Half_Marks +blk; n/a ; Common_Indic_Number_Forms +blk; n/a ; Control_Pictures +blk; n/a ; Coptic +blk; n/a ; Counting_Rod_Numerals +blk; n/a ; Cuneiform +blk; n/a ; Cuneiform_Numbers_And_Punctuation +blk; n/a ; Currency_Symbols +blk; n/a ; Cypriot_Syllabary +blk; n/a ; Cyrillic +blk; n/a ; Cyrillic_Extended_A +blk; n/a ; Cyrillic_Extended_B +blk; n/a ; Cyrillic_Supplement ; Cyrillic_Supplementary +blk; n/a ; Deseret +blk; n/a ; Devanagari +blk; n/a ; Devanagari_Extended +blk; n/a ; Dingbats +blk; n/a ; Domino_Tiles +blk; n/a ; Egyptian_Hieroglyphs +blk; n/a ; Emoticons +blk; n/a ; Enclosed_Alphanumeric_Supplement +blk; n/a ; Enclosed_Alphanumerics +blk; n/a ; Enclosed_CJK_Letters_And_Months +blk; n/a ; Enclosed_Ideographic_Supplement +blk; n/a ; Ethiopic +blk; n/a ; Ethiopic_Extended +blk; n/a ; Ethiopic_Extended_A +blk; n/a ; Ethiopic_Supplement +blk; n/a ; General_Punctuation +blk; n/a ; Geometric_Shapes +blk; n/a ; Georgian +blk; n/a ; Georgian_Supplement +blk; n/a ; Glagolitic +blk; n/a ; Gothic +blk; n/a ; Greek_And_Coptic ; Greek +blk; n/a ; Greek_Extended +blk; n/a ; Gujarati +blk; n/a ; Gurmukhi +blk; n/a ; Halfwidth_And_Fullwidth_Forms +blk; n/a ; Hangul_Compatibility_Jamo +blk; n/a ; Hangul_Jamo +blk; n/a ; Hangul_Jamo_Extended_A +blk; n/a ; Hangul_Jamo_Extended_B +blk; n/a ; Hangul_Syllables +blk; n/a ; Hanunoo +blk; n/a ; Hebrew +blk; n/a ; High_Private_Use_Surrogates +blk; n/a ; High_Surrogates +blk; n/a ; Hiragana +blk; n/a ; Ideographic_Description_Characters +blk; n/a ; Imperial_Aramaic +blk; n/a ; Inscriptional_Pahlavi +blk; n/a ; Inscriptional_Parthian +blk; n/a ; IPA_Extensions +blk; n/a ; Javanese +blk; n/a ; Kaithi +blk; n/a ; Kana_Supplement +blk; n/a ; Kanbun +blk; n/a ; Kangxi_Radicals +blk; n/a ; Kannada +blk; n/a ; Katakana +blk; n/a ; Katakana_Phonetic_Extensions +blk; n/a ; Kayah_Li +blk; n/a ; Kharoshthi +blk; n/a ; Khmer +blk; n/a ; Khmer_Symbols +blk; n/a ; Lao +blk; n/a ; Latin_1_Supplement ; Latin_1 +blk; n/a ; Latin_Extended_A +blk; n/a ; Latin_Extended_Additional +blk; n/a ; Latin_Extended_B +blk; n/a ; Latin_Extended_C +blk; n/a ; Latin_Extended_D +blk; n/a ; Lepcha +blk; n/a ; Letterlike_Symbols +blk; n/a ; Limbu +blk; n/a ; Linear_B_Ideograms +blk; n/a ; Linear_B_Syllabary +blk; n/a ; Lisu +blk; n/a ; Low_Surrogates +blk; n/a ; Lycian +blk; n/a ; Lydian +blk; n/a ; Mahjong_Tiles +blk; n/a ; Malayalam +blk; n/a ; Mandaic +blk; n/a ; Mathematical_Alphanumeric_Symbols +blk; n/a ; Mathematical_Operators +blk; n/a ; Meetei_Mayek +blk; n/a ; Miscellaneous_Mathematical_Symbols_A +blk; n/a ; Miscellaneous_Mathematical_Symbols_B +blk; n/a ; Miscellaneous_Symbols +blk; n/a ; Miscellaneous_Symbols_And_Arrows +blk; n/a ; Miscellaneous_Symbols_And_Pictographs +blk; n/a ; Miscellaneous_Technical +blk; n/a ; Modifier_Tone_Letters +blk; n/a ; Mongolian +blk; n/a ; Musical_Symbols +blk; n/a ; Myanmar +blk; n/a ; Myanmar_Extended_A +blk; n/a ; New_Tai_Lue +blk; n/a ; NKo +blk; n/a ; No_Block +blk; n/a ; Number_Forms +blk; n/a ; Ogham +blk; n/a ; Ol_Chiki +blk; n/a ; Old_Italic +blk; n/a ; Old_Persian +blk; n/a ; Old_South_Arabian +blk; n/a ; Old_Turkic +blk; n/a ; Optical_Character_Recognition +blk; n/a ; Oriya +blk; n/a ; Osmanya +blk; n/a ; Phags_Pa +blk; n/a ; Phaistos_Disc +blk; n/a ; Phoenician +blk; n/a ; Phonetic_Extensions +blk; n/a ; Phonetic_Extensions_Supplement +blk; n/a ; Playing_Cards +blk; n/a ; Private_Use_Area ; Private_Use +blk; n/a ; Rejang +blk; n/a ; Rumi_Numeral_Symbols +blk; n/a ; Runic +blk; n/a ; Samaritan +blk; n/a ; Saurashtra +blk; n/a ; Shavian +blk; n/a ; Sinhala +blk; n/a ; Small_Form_Variants +blk; n/a ; Spacing_Modifier_Letters +blk; n/a ; Specials +blk; n/a ; Sundanese +blk; n/a ; Superscripts_And_Subscripts +blk; n/a ; Supplemental_Arrows_A +blk; n/a ; Supplemental_Arrows_B +blk; n/a ; Supplemental_Mathematical_Operators +blk; n/a ; Supplemental_Punctuation +blk; n/a ; Supplementary_Private_Use_Area_A +blk; n/a ; Supplementary_Private_Use_Area_B +blk; n/a ; Syloti_Nagri +blk; n/a ; Syriac +blk; n/a ; Tagalog +blk; n/a ; Tagbanwa +blk; n/a ; Tags +blk; n/a ; Tai_Le +blk; n/a ; Tai_Tham +blk; n/a ; Tai_Viet +blk; n/a ; Tai_Xuan_Jing_Symbols +blk; n/a ; Tamil +blk; n/a ; Telugu +blk; n/a ; Thaana +blk; n/a ; Thai +blk; n/a ; Tibetan +blk; n/a ; Tifinagh +blk; n/a ; Transport_And_Map_Symbols +blk; n/a ; Ugaritic +blk; n/a ; Unified_Canadian_Aboriginal_Syllabics; Canadian_Syllabics +blk; n/a ; Unified_Canadian_Aboriginal_Syllabics_Extended +blk; n/a ; Vai +blk; n/a ; Variation_Selectors +blk; n/a ; Variation_Selectors_Supplement +blk; n/a ; Vedic_Extensions +blk; n/a ; Vertical_Forms +blk; n/a ; Yi_Radicals +blk; n/a ; Yi_Syllables +blk; n/a ; Yijing_Hexagram_Symbols + +# Canonical_Combining_Class (ccc) + +ccc; 0; NR ; Not_Reordered +ccc; 1; OV ; Overlay +ccc; 7; NK ; Nukta +ccc; 8; KV ; Kana_Voicing +ccc; 9; VR ; Virama +ccc; 200; ATBL ; Attached_Below_Left +ccc; 202; ATB ; Attached_Below +ccc; 214; ATA ; Attached_Above +ccc; 216; ATAR ; Attached_Above_Right +ccc; 218; BL ; Below_Left +ccc; 220; B ; Below +ccc; 222; BR ; Below_Right +ccc; 224; L ; Left +ccc; 226; R ; Right +ccc; 228; AL ; Above_Left +ccc; 230; A ; Above +ccc; 232; AR ; Above_Right +ccc; 233; DB ; Double_Below +ccc; 234; DA ; Double_Above +ccc; 240; IS ; Iota_Subscript + +# Case_Folding (cf) + +# @missing: 0000..10FFFF; Case_Folding; + +# Case_Ignorable (CI) + +CI ; N ; No ; F ; False +CI ; Y ; Yes ; T ; True + +# Cased (Cased) + +Cased; N ; No ; F ; False +Cased; Y ; Yes ; T ; True + +# Changes_When_Casefolded (CWCF) + +CWCF; N ; No ; F ; False +CWCF; Y ; Yes ; T ; True + +# Changes_When_Casemapped (CWCM) + +CWCM; N ; No ; F ; False +CWCM; Y ; Yes ; T ; True + +# Changes_When_Lowercased (CWL) + +CWL; N ; No ; F ; False +CWL; Y ; Yes ; T ; True + +# Changes_When_NFKC_Casefolded (CWKCF) + +CWKCF; N ; No ; F ; False +CWKCF; Y ; Yes ; T ; True + +# Changes_When_Titlecased (CWT) + +CWT; N ; No ; F ; False +CWT; Y ; Yes ; T ; True + +# Changes_When_Uppercased (CWU) + +CWU; N ; No ; F ; False +CWU; Y ; Yes ; T ; True + +# Composition_Exclusion (CE) + +CE ; N ; No ; F ; False +CE ; Y ; Yes ; T ; True + +# Dash (Dash) + +Dash; N ; No ; F ; False +Dash; Y ; Yes ; T ; True + +# Decomposition_Mapping (dm) + +# @missing: 0000..10FFFF; Decomposition_Mapping; + +# Decomposition_Type (dt) + +dt ; Can ; Canonical ; can +dt ; Com ; Compat ; com +dt ; Enc ; Circle ; enc +dt ; Fin ; Final ; fin +dt ; Font ; font +dt ; Fra ; Fraction ; fra +dt ; Init ; Initial ; init +dt ; Iso ; Isolated ; iso +dt ; Med ; Medial ; med +dt ; Nar ; Narrow ; nar +dt ; Nb ; Nobreak ; nb +dt ; None ; none +dt ; Sml ; Small ; sml +dt ; Sqr ; Square ; sqr +dt ; Sub ; sub +dt ; Sup ; Super ; sup +dt ; Vert ; Vertical ; vert +dt ; Wide ; wide + +# Default_Ignorable_Code_Point (DI) + +DI ; N ; No ; F ; False +DI ; Y ; Yes ; T ; True + +# Deprecated (Dep) + +Dep; N ; No ; F ; False +Dep; Y ; Yes ; T ; True + +# Diacritic (Dia) + +Dia; N ; No ; F ; False +Dia; Y ; Yes ; T ; True + +# East_Asian_Width (ea) + +ea ; A ; Ambiguous +ea ; F ; Fullwidth +ea ; H ; Halfwidth +ea ; N ; Neutral +ea ; Na ; Narrow +ea ; W ; Wide + +# Expands_On_NFC (XO_NFC) + +XO_NFC; N ; No ; F ; False +XO_NFC; Y ; Yes ; T ; True + +# Expands_On_NFD (XO_NFD) + +XO_NFD; N ; No ; F ; False +XO_NFD; Y ; Yes ; T ; True + +# Expands_On_NFKC (XO_NFKC) + +XO_NFKC; N ; No ; F ; False +XO_NFKC; Y ; Yes ; T ; True + +# Expands_On_NFKD (XO_NFKD) + +XO_NFKD; N ; No ; F ; False +XO_NFKD; Y ; Yes ; T ; True + +# Extender (Ext) + +Ext; N ; No ; F ; False +Ext; Y ; Yes ; T ; True + +# FC_NFKC_Closure (FC_NFKC) + +# @missing: 0000..10FFFF; FC_NFKC_Closure; + +# Full_Composition_Exclusion (Comp_Ex) + +Comp_Ex; N ; No ; F ; False +Comp_Ex; Y ; Yes ; T ; True + +# General_Category (gc) + +gc ; C ; Other # Cc | Cf | Cn | Co | Cs +gc ; Cc ; Control ; cntrl +gc ; Cf ; Format +gc ; Cn ; Unassigned +gc ; Co ; Private_Use +gc ; Cs ; Surrogate +gc ; L ; Letter # Ll | Lm | Lo | Lt | Lu +gc ; LC ; Cased_Letter # Ll | Lt | Lu +gc ; Ll ; Lowercase_Letter +gc ; Lm ; Modifier_Letter +gc ; Lo ; Other_Letter +gc ; Lt ; Titlecase_Letter +gc ; Lu ; Uppercase_Letter +gc ; M ; Mark # Mc | Me | Mn +gc ; Mc ; Spacing_Mark +gc ; Me ; Enclosing_Mark +gc ; Mn ; Nonspacing_Mark +gc ; N ; Number # Nd | Nl | No +gc ; Nd ; Decimal_Number ; digit +gc ; Nl ; Letter_Number +gc ; No ; Other_Number +gc ; P ; Punctuation ; punct # Pc | Pd | Pe | Pf | Pi | Po | Ps +gc ; Pc ; Connector_Punctuation +gc ; Pd ; Dash_Punctuation +gc ; Pe ; Close_Punctuation +gc ; Pf ; Final_Punctuation +gc ; Pi ; Initial_Punctuation +gc ; Po ; Other_Punctuation +gc ; Ps ; Open_Punctuation +gc ; S ; Symbol # Sc | Sk | Sm | So +gc ; Sc ; Currency_Symbol +gc ; Sk ; Modifier_Symbol +gc ; Sm ; Math_Symbol +gc ; So ; Other_Symbol +gc ; Z ; Separator # Zl | Zp | Zs +gc ; Zl ; Line_Separator +gc ; Zp ; Paragraph_Separator +gc ; Zs ; Space_Separator + +# Grapheme_Base (Gr_Base) + +Gr_Base; N ; No ; F ; False +Gr_Base; Y ; Yes ; T ; True + +# Grapheme_Cluster_Break (GCB) + +GCB; CN ; Control +GCB; CR ; CR +GCB; EX ; Extend +GCB; L ; L +GCB; LF ; LF +GCB; LV ; LV +GCB; LVT ; LVT +GCB; PP ; Prepend +GCB; SM ; SpacingMark +GCB; T ; T +GCB; V ; V +GCB; XX ; Other + +# Grapheme_Extend (Gr_Ext) + +Gr_Ext; N ; No ; F ; False +Gr_Ext; Y ; Yes ; T ; True + +# Grapheme_Link (Gr_Link) + +Gr_Link; N ; No ; F ; False +Gr_Link; Y ; Yes ; T ; True + +# Hangul_Syllable_Type (hst) + +hst; L ; Leading_Jamo +hst; LV ; LV_Syllable +hst; LVT ; LVT_Syllable +hst; NA ; Not_Applicable +hst; T ; Trailing_Jamo +hst; V ; Vowel_Jamo + +# Hex_Digit (Hex) + +Hex; N ; No ; F ; False +Hex; Y ; Yes ; T ; True + +# Hyphen (Hyphen) + +Hyphen; N ; No ; F ; False +Hyphen; Y ; Yes ; T ; True + +# IDS_Binary_Operator (IDSB) + +IDSB; N ; No ; F ; False +IDSB; Y ; Yes ; T ; True + +# IDS_Trinary_Operator (IDST) + +IDST; N ; No ; F ; False +IDST; Y ; Yes ; T ; True + +# ID_Continue (IDC) + +IDC; N ; No ; F ; False +IDC; Y ; Yes ; T ; True + +# ID_Start (IDS) + +IDS; N ; No ; F ; False +IDS; Y ; Yes ; T ; True + +# ISO_Comment (isc) + +# @missing: 0000..10FFFF; ISO_Comment; + +# Ideographic (Ideo) + +Ideo; N ; No ; F ; False +Ideo; Y ; Yes ; T ; True + +# Jamo_Short_Name (JSN) + +# @missing: 0000..10FFFF; Jamo_Short_Name; +JSN; A ; A +JSN; AE ; AE +JSN; B ; B +JSN; BB ; BB +JSN; BS ; BS +JSN; C ; C +JSN; D ; D +JSN; DD ; DD +JSN; E ; E +JSN; EO ; EO +JSN; EU ; EU +JSN; G ; G +JSN; GG ; GG +JSN; GS ; GS +JSN; H ; H +JSN; I ; I +JSN; J ; J +JSN; JJ ; JJ +JSN; K ; K +JSN; L ; L +JSN; LB ; LB +JSN; LG ; LG +JSN; LH ; LH +JSN; LM ; LM +JSN; LP ; LP +JSN; LS ; LS +JSN; LT ; LT +JSN; M ; M +JSN; N ; N +JSN; NG ; NG +JSN; NH ; NH +JSN; NJ ; NJ +JSN; O ; O +JSN; OE ; OE +JSN; P ; P +JSN; R ; R +JSN; S ; S +JSN; SS ; SS +JSN; T ; T +JSN; U ; U +JSN; WA ; WA +JSN; WAE ; WAE +JSN; WE ; WE +JSN; WEO ; WEO +JSN; WI ; WI +JSN; YA ; YA +JSN; YAE ; YAE +JSN; YE ; YE +JSN; YEO ; YEO +JSN; YI ; YI +JSN; YO ; YO +JSN; YU ; YU + +# Join_Control (Join_C) + +Join_C; N ; No ; F ; False +Join_C; Y ; Yes ; T ; True + +# Joining_Group (jg) + +jg ; n/a ; Ain +jg ; n/a ; Alaph +jg ; n/a ; Alef +jg ; n/a ; Beh +jg ; n/a ; Beth +jg ; n/a ; Burushaski_Yeh_Barree +jg ; n/a ; Dal +jg ; n/a ; Dalath_Rish +jg ; n/a ; E +jg ; n/a ; Farsi_Yeh +jg ; n/a ; Fe +jg ; n/a ; Feh +jg ; n/a ; Final_Semkath +jg ; n/a ; Gaf +jg ; n/a ; Gamal +jg ; n/a ; Hah +jg ; n/a ; He +jg ; n/a ; Heh +jg ; n/a ; Heh_Goal +jg ; n/a ; Heth +jg ; n/a ; Kaf +jg ; n/a ; Kaph +jg ; n/a ; Khaph +jg ; n/a ; Knotted_Heh +jg ; n/a ; Lam +jg ; n/a ; Lamadh +jg ; n/a ; Meem +jg ; n/a ; Mim +jg ; n/a ; No_Joining_Group +jg ; n/a ; Noon +jg ; n/a ; Nun +jg ; n/a ; Nya +jg ; n/a ; Pe +jg ; n/a ; Qaf +jg ; n/a ; Qaph +jg ; n/a ; Reh +jg ; n/a ; Reversed_Pe +jg ; n/a ; Sad +jg ; n/a ; Sadhe +jg ; n/a ; Seen +jg ; n/a ; Semkath +jg ; n/a ; Shin +jg ; n/a ; Swash_Kaf +jg ; n/a ; Syriac_Waw +jg ; n/a ; Tah +jg ; n/a ; Taw +jg ; n/a ; Teh_Marbuta +jg ; n/a ; Teh_Marbuta_Goal ; Hamza_On_Heh_Goal +jg ; n/a ; Teth +jg ; n/a ; Waw +jg ; n/a ; Yeh +jg ; n/a ; Yeh_Barree +jg ; n/a ; Yeh_With_Tail +jg ; n/a ; Yudh +jg ; n/a ; Yudh_He +jg ; n/a ; Zain +jg ; n/a ; Zhain + +# Joining_Type (jt) + +jt ; C ; Join_Causing +jt ; D ; Dual_Joining +jt ; L ; Left_Joining +jt ; R ; Right_Joining +jt ; T ; Transparent +jt ; U ; Non_Joining + +# Line_Break (lb) + +lb ; AI ; Ambiguous +lb ; AL ; Alphabetic +lb ; B2 ; Break_Both +lb ; BA ; Break_After +lb ; BB ; Break_Before +lb ; BK ; Mandatory_Break +lb ; CB ; Contingent_Break +lb ; CL ; Close_Punctuation +lb ; CM ; Combining_Mark +lb ; CP ; Close_Parenthesis +lb ; CR ; Carriage_Return +lb ; EX ; Exclamation +lb ; GL ; Glue +lb ; H2 ; H2 +lb ; H3 ; H3 +lb ; HY ; Hyphen +lb ; ID ; Ideographic +lb ; IN ; Inseparable ; Inseperable +lb ; IS ; Infix_Numeric +lb ; JL ; JL +lb ; JT ; JT +lb ; JV ; JV +lb ; LF ; Line_Feed +lb ; NL ; Next_Line +lb ; NS ; Nonstarter +lb ; NU ; Numeric +lb ; OP ; Open_Punctuation +lb ; PO ; Postfix_Numeric +lb ; PR ; Prefix_Numeric +lb ; QU ; Quotation +lb ; SA ; Complex_Context +lb ; SG ; Surrogate +lb ; SP ; Space +lb ; SY ; Break_Symbols +lb ; WJ ; Word_Joiner +lb ; XX ; Unknown +lb ; ZW ; ZWSpace + +# Logical_Order_Exception (LOE) + +LOE; N ; No ; F ; False +LOE; Y ; Yes ; T ; True + +# Lowercase (Lower) + +Lower; N ; No ; F ; False +Lower; Y ; Yes ; T ; True + +# Lowercase_Mapping (lc) + +# @missing: 0000..10FFFF; Lowercase_Mapping; + +# Math (Math) + +Math; N ; No ; F ; False +Math; Y ; Yes ; T ; True + +# NFC_Quick_Check (NFC_QC) + +NFC_QC; M ; Maybe +NFC_QC; N ; No +NFC_QC; Y ; Yes + +# NFD_Quick_Check (NFD_QC) + +NFD_QC; N ; No +NFD_QC; Y ; Yes + +# NFKC_Casefold (NFKC_CF) + +# @missing: 0000..10FFFF; NFKC_Casefold; + +# NFKC_Quick_Check (NFKC_QC) + +NFKC_QC; M ; Maybe +NFKC_QC; N ; No +NFKC_QC; Y ; Yes + +# NFKD_Quick_Check (NFKD_QC) + +NFKD_QC; N ; No +NFKD_QC; Y ; Yes + +# Name (na) + +# @missing: 0000..10FFFF; Name; + +# Name_Alias (Name_Alias) + +# @missing: 0000..10FFFF; Name_Alias; + +# Noncharacter_Code_Point (NChar) + +NChar; N ; No ; F ; False +NChar; Y ; Yes ; T ; True + +# Numeric_Type (nt) + +nt ; De ; Decimal +nt ; Di ; Digit +nt ; None ; None +nt ; Nu ; Numeric + +# Numeric_Value (nv) + +# @missing: 0000..10FFFF; Numeric_Value; NaN + +# Other_Alphabetic (OAlpha) + +OAlpha; N ; No ; F ; False +OAlpha; Y ; Yes ; T ; True + +# Other_Default_Ignorable_Code_Point (ODI) + +ODI; N ; No ; F ; False +ODI; Y ; Yes ; T ; True + +# Other_Grapheme_Extend (OGr_Ext) + +OGr_Ext; N ; No ; F ; False +OGr_Ext; Y ; Yes ; T ; True + +# Other_ID_Continue (OIDC) + +OIDC; N ; No ; F ; False +OIDC; Y ; Yes ; T ; True + +# Other_ID_Start (OIDS) + +OIDS; N ; No ; F ; False +OIDS; Y ; Yes ; T ; True + +# Other_Lowercase (OLower) + +OLower; N ; No ; F ; False +OLower; Y ; Yes ; T ; True + +# Other_Math (OMath) + +OMath; N ; No ; F ; False +OMath; Y ; Yes ; T ; True + +# Other_Uppercase (OUpper) + +OUpper; N ; No ; F ; False +OUpper; Y ; Yes ; T ; True + +# Pattern_Syntax (Pat_Syn) + +Pat_Syn; N ; No ; F ; False +Pat_Syn; Y ; Yes ; T ; True + +# Pattern_White_Space (Pat_WS) + +Pat_WS; N ; No ; F ; False +Pat_WS; Y ; Yes ; T ; True + +# Quotation_Mark (QMark) + +QMark; N ; No ; F ; False +QMark; Y ; Yes ; T ; True + +# Radical (Radical) + +Radical; N ; No ; F ; False +Radical; Y ; Yes ; T ; True + +# STerm (STerm) + +STerm; N ; No ; F ; False +STerm; Y ; Yes ; T ; True + +# Script (sc) + +sc ; Arab ; Arabic +sc ; Armi ; Imperial_Aramaic +sc ; Armn ; Armenian +sc ; Avst ; Avestan +sc ; Bali ; Balinese +sc ; Bamu ; Bamum +sc ; Batk ; Batak +sc ; Beng ; Bengali +sc ; Bopo ; Bopomofo +sc ; Brah ; Brahmi +sc ; Brai ; Braille +sc ; Bugi ; Buginese +sc ; Buhd ; Buhid +sc ; Cans ; Canadian_Aboriginal +sc ; Cari ; Carian +sc ; Cham ; Cham +sc ; Cher ; Cherokee +sc ; Copt ; Coptic ; Qaac +sc ; Cprt ; Cypriot +sc ; Cyrl ; Cyrillic +sc ; Deva ; Devanagari +sc ; Dsrt ; Deseret +sc ; Egyp ; Egyptian_Hieroglyphs +sc ; Ethi ; Ethiopic +sc ; Geor ; Georgian +sc ; Glag ; Glagolitic +sc ; Goth ; Gothic +sc ; Grek ; Greek +sc ; Gujr ; Gujarati +sc ; Guru ; Gurmukhi +sc ; Hang ; Hangul +sc ; Hani ; Han +sc ; Hano ; Hanunoo +sc ; Hebr ; Hebrew +sc ; Hira ; Hiragana +sc ; Hrkt ; Katakana_Or_Hiragana +sc ; Ital ; Old_Italic +sc ; Java ; Javanese +sc ; Kali ; Kayah_Li +sc ; Kana ; Katakana +sc ; Khar ; Kharoshthi +sc ; Khmr ; Khmer +sc ; Knda ; Kannada +sc ; Kthi ; Kaithi +sc ; Lana ; Tai_Tham +sc ; Laoo ; Lao +sc ; Latn ; Latin +sc ; Lepc ; Lepcha +sc ; Limb ; Limbu +sc ; Linb ; Linear_B +sc ; Lisu ; Lisu +sc ; Lyci ; Lycian +sc ; Lydi ; Lydian +sc ; Mand ; Mandaic +sc ; Mlym ; Malayalam +sc ; Mong ; Mongolian +sc ; Mtei ; Meetei_Mayek +sc ; Mymr ; Myanmar +sc ; Nkoo ; Nko +sc ; Ogam ; Ogham +sc ; Olck ; Ol_Chiki +sc ; Orkh ; Old_Turkic +sc ; Orya ; Oriya +sc ; Osma ; Osmanya +sc ; Phag ; Phags_Pa +sc ; Phli ; Inscriptional_Pahlavi +sc ; Phnx ; Phoenician +sc ; Prti ; Inscriptional_Parthian +sc ; Rjng ; Rejang +sc ; Runr ; Runic +sc ; Samr ; Samaritan +sc ; Sarb ; Old_South_Arabian +sc ; Saur ; Saurashtra +sc ; Shaw ; Shavian +sc ; Sinh ; Sinhala +sc ; Sund ; Sundanese +sc ; Sylo ; Syloti_Nagri +sc ; Syrc ; Syriac +sc ; Tagb ; Tagbanwa +sc ; Tale ; Tai_Le +sc ; Talu ; New_Tai_Lue +sc ; Taml ; Tamil +sc ; Tavt ; Tai_Viet +sc ; Telu ; Telugu +sc ; Tfng ; Tifinagh +sc ; Tglg ; Tagalog +sc ; Thaa ; Thaana +sc ; Thai ; Thai +sc ; Tibt ; Tibetan +sc ; Ugar ; Ugaritic +sc ; Vaii ; Vai +sc ; Xpeo ; Old_Persian +sc ; Xsux ; Cuneiform +sc ; Yiii ; Yi +sc ; Zinh ; Inherited ; Qaai +sc ; Zyyy ; Common +sc ; Zzzz ; Unknown + +# Sentence_Break (SB) + +SB ; AT ; ATerm +SB ; CL ; Close +SB ; CR ; CR +SB ; EX ; Extend +SB ; FO ; Format +SB ; LE ; OLetter +SB ; LF ; LF +SB ; LO ; Lower +SB ; NU ; Numeric +SB ; SC ; SContinue +SB ; SE ; Sep +SB ; SP ; Sp +SB ; ST ; STerm +SB ; UP ; Upper +SB ; XX ; Other + +# Simple_Case_Folding (scf) + +# @missing: 0000..10FFFF; Simple_Case_Folding; + +# Simple_Lowercase_Mapping (slc) + +# @missing: 0000..10FFFF; Simple_Lowercase_Mapping; + +# Simple_Titlecase_Mapping (stc) + +# @missing: 0000..10FFFF; Simple_Titlecase_Mapping; + +# Simple_Uppercase_Mapping (suc) + +# @missing: 0000..10FFFF; Simple_Uppercase_Mapping; + +# Soft_Dotted (SD) + +SD ; N ; No ; F ; False +SD ; Y ; Yes ; T ; True + +# Terminal_Punctuation (Term) + +Term; N ; No ; F ; False +Term; Y ; Yes ; T ; True + +# Titlecase_Mapping (tc) + +# @missing: 0000..10FFFF; Titlecase_Mapping; + +# Unicode_1_Name (na1) + +# @missing: 0000..10FFFF; Unicode_1_Name; + +# Unified_Ideograph (UIdeo) + +UIdeo; N ; No ; F ; False +UIdeo; Y ; Yes ; T ; True + +# Uppercase (Upper) + +Upper; N ; No ; F ; False +Upper; Y ; Yes ; T ; True + +# Uppercase_Mapping (uc) + +# @missing: 0000..10FFFF; Uppercase_Mapping; + +# Variation_Selector (VS) + +VS ; N ; No ; F ; False +VS ; Y ; Yes ; T ; True + +# White_Space (WSpace) + +WSpace; N ; No ; F ; False +WSpace; Y ; Yes ; T ; True + +# Word_Break (WB) + +WB ; CR ; CR +WB ; EX ; ExtendNumLet +WB ; Extend ; Extend +WB ; FO ; Format +WB ; KA ; Katakana +WB ; LE ; ALetter +WB ; LF ; LF +WB ; MB ; MidNumLet +WB ; ML ; MidLetter +WB ; MN ; MidNum +WB ; NL ; Newline +WB ; NU ; Numeric +WB ; XX ; Other + +# XID_Continue (XIDC) + +XIDC; N ; No ; F ; False +XIDC; Y ; Yes ; T ; True + +# XID_Start (XIDS) + +XIDS; N ; No ; F ; False +XIDS; Y ; Yes ; T ; True + +# cjkAccountingNumeric (cjkAccountingNumeric) + +# @missing: 0000..10FFFF; cjkAccountingNumeric; NaN + +# cjkCompatibilityVariant (cjkCompatibilityVariant) + +# @missing: 0000..10FFFF; cjkCompatibilityVariant; + +# cjkIICore (cjkIICore) + +# @missing: 0000..10FFFF; cjkIICore; + +# cjkIRG_GSource (cjkIRG_GSource) + +# @missing: 0000..10FFFF; cjkIRG_GSource; + +# cjkIRG_HSource (cjkIRG_HSource) + +# @missing: 0000..10FFFF; cjkIRG_HSource; + +# cjkIRG_JSource (cjkIRG_JSource) + +# @missing: 0000..10FFFF; cjkIRG_JSource; + +# cjkIRG_KPSource (cjkIRG_KPSource) + +# @missing: 0000..10FFFF; cjkIRG_KPSource; + +# cjkIRG_KSource (cjkIRG_KSource) + +# @missing: 0000..10FFFF; cjkIRG_KSource; + +# cjkIRG_MSource (cjkIRG_MSource) + +# @missing: 0000..10FFFF; cjkIRG_MSource; + +# cjkIRG_TSource (cjkIRG_TSource) + +# @missing: 0000..10FFFF; cjkIRG_TSource; + +# cjkIRG_USource (cjkIRG_USource) + +# @missing: 0000..10FFFF; cjkIRG_USource; + +# cjkIRG_VSource (cjkIRG_VSource) + +# @missing: 0000..10FFFF; cjkIRG_VSource; + +# cjkOtherNumeric (cjkOtherNumeric) + +# @missing: 0000..10FFFF; cjkOtherNumeric; NaN + +# cjkPrimaryNumeric (cjkPrimaryNumeric) + +# @missing: 0000..10FFFF; cjkPrimaryNumeric; NaN + +# cjkRSUnicode (cjkRSUnicode) + +# @missing: 0000..10FFFF; cjkRSUnicode; + +# EOF diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/lang/Double/ParseDouble.java --- a/jdk/test/java/lang/Double/ParseDouble.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/lang/Double/ParseDouble.java Wed Jul 05 17:42:05 2017 +0200 @@ -23,7 +23,7 @@ /* * @test - * @bug 4160406 4705734 4707389 4826774 4895911 4421494 + * @bug 4160406 4705734 4707389 4826774 4895911 4421494 7021568 * @summary Test for Double.parseDouble method and acceptance regex */ @@ -581,6 +581,31 @@ } } + + private static void testStrictness() { + final double expected = 0x0.0000008000001p-1022; + boolean failed = false; + double conversion = 0.0; + double sum = 0.0; // Prevent conversion from being optimized away + + //2^-1047 + 2^-1075 + String decimal = "6.631236871469758276785396630275967243399099947355303144249971758736286630139265439618068200788048744105960420552601852889715006376325666595539603330361800519107591783233358492337208057849499360899425128640718856616503093444922854759159988160304439909868291973931426625698663157749836252274523485312442358651207051292453083278116143932569727918709786004497872322193856150225415211997283078496319412124640111777216148110752815101775295719811974338451936095907419622417538473679495148632480391435931767981122396703443803335529756003353209830071832230689201383015598792184172909927924176339315507402234836120730914783168400715462440053817592702766213559042115986763819482654128770595766806872783349146967171293949598850675682115696218943412532098591327667236328125E-316"; + + for(int i = 0; i <= 12_000; i++) { + conversion = Double.parseDouble(decimal); + sum += conversion; + if (conversion != expected) { + failed = true; + System.out.printf("Iteration %d converts as %a%n", + i, conversion); + } + } + + System.out.println("Sum = " + sum); + if (failed) + throw new RuntimeException("Inconsistent conversion"); + } + public static void main(String[] args) throws Exception { rudimentaryTest(); @@ -595,5 +620,6 @@ testRegex(paddedBadStrings, true); testSubnormalPowers(); + testStrictness(); } } diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/lang/Math/RoundTests.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/lang/Math/RoundTests.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 6430675 + * @summary Check for correct implementation of {Math, StrictMath}.round + */ +public class RoundTests { + public static void main(String... args) { + int failures = 0; + + failures += testNearFloatHalfCases(); + failures += testNearDoubleHalfCases(); + + if (failures > 0) { + System.err.println("Testing {Math, StrictMath}.round incurred " + + failures + " failures."); + throw new RuntimeException(); + } + } + + private static int testNearDoubleHalfCases() { + int failures = 0; + double [][] testCases = { + {+0x1.fffffffffffffp-2, 0.0}, + {+0x1.0p-1, 1.0}, // +0.5 + {+0x1.0000000000001p-1, 1.0}, + + {-0x1.fffffffffffffp-2, 0.0}, + {-0x1.0p-1, 0.0}, // -0.5 + {-0x1.0000000000001p-1, -1.0}, + }; + + for(double[] testCase : testCases) { + failures += testNearHalfCases(testCase[0], (long)testCase[1]); + } + + return failures; + } + + private static int testNearHalfCases(double input, double expected) { + int failures = 0; + + failures += Tests.test("Math.round", input, Math.round(input), expected); + failures += Tests.test("StrictMath.round", input, StrictMath.round(input), expected); + + return failures; + } + + private static int testNearFloatHalfCases() { + int failures = 0; + float [][] testCases = { + {+0x1.fffffep-2f, 0.0f}, + {+0x1.0p-1f, 1.0f}, // +0.5 + {+0x1.000002p-1f, 1.0f}, + + {-0x1.fffffep-2f, 0.0f}, + {-0x1.0p-1f, 0.0f}, // -0.5 + {-0x1.000002p-1f, -1.0f}, + }; + + for(float[] testCase : testCases) { + failures += testNearHalfCases(testCase[0], (int)testCase[1]); + } + + return failures; + } + + private static int testNearHalfCases(float input, float expected) { + int failures = 0; + + failures += Tests.test("Math.round", input, Math.round(input), expected); + failures += Tests.test("StrictMath.round", input, StrictMath.round(input), expected); + + return failures; + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/lang/reflect/Generics/Probe.java --- a/jdk/test/java/lang/reflect/Generics/Probe.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/lang/reflect/Generics/Probe.java Wed Jul 05 17:42:05 2017 +0200 @@ -38,12 +38,12 @@ "java.util.concurrent.ConcurrentHashMap$KeyIterator", "java.util.concurrent.ConcurrentHashMap$ValueIterator", "java.util.AbstractList$ListItr", - "java.util.EnumMap$EntryIterator", - "java.util.EnumMap$KeyIterator", - "java.util.EnumMap$ValueIterator", - "java.util.IdentityHashMap$EntryIterator", - "java.util.IdentityHashMap$KeyIterator", - "java.util.IdentityHashMap$ValueIterator", +// "java.util.EnumMap$EntryIterator", +// "java.util.EnumMap$KeyIterator", +// "java.util.EnumMap$ValueIterator", +// "java.util.IdentityHashMap$EntryIterator", +// "java.util.IdentityHashMap$KeyIterator", +// "java.util.IdentityHashMap$ValueIterator", "java.util.WeakHashMap$EntryIterator", "java.util.WeakHashMap$KeyIterator", "java.util.WeakHashMap$ValueIterator", diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/math/BigDecimal/DivideMcTests.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/math/BigDecimal/DivideMcTests.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,5797 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7036582 + * @summary Some tests for the divide(..,MathContext) method. + * @run main DivideMcTests + * @run main/othervm -XX:+AggressiveOpts DivideMcTests + * @author Sergey V. Kuksenko + */ + +import java.math.BigDecimal; +import java.math.MathContext; +import java.math.RoundingMode; + + +public class DivideMcTests { + + static String[] value = new String[75]; + static String[][] results = new String[75][75]; + static { + value[0]="11061"; + value[1]="5030285645"; + value[2]="224198292018431"; + value[3]="19226185404220649458"; + value[4]="2754593222460641763294400"; + value[5]="88290e4"; + value[6]="14207e-4"; + value[7]="9206524943e4"; + value[8]="9637167289e-4"; + value[9]="987673128759528e4"; + value[10]="270627774630281e-4"; + value[11]="81503625886547904651e4"; + value[12]="60700032235397315737e-4"; + value[13]="6477954854329556663533122e4"; + value[14]="8056417378028557868905113e-4"; + value[15]="74996e8"; + value[16]="65282e-8"; + value[17]="6336626690e8"; + value[18]="8318166778e-8"; + value[19]="983114227763768e8"; + value[20]="245802997834566e-8"; + value[21]="52727924122290902686e8"; + value[22]="42785567085625398961e-8"; + value[23]="4810906998143118279742863e8"; + value[24]="8077506080975981172874361e-8"; + value[25]="80689e12"; + value[26]="30125e-12"; + value[27]="6921467144e12"; + value[28]="1953347181e-12"; + value[29]="405471649883944e12"; + value[30]="866720590936024e-12"; + value[31]="33231666378140173438e12"; + value[32]="42631490906110209257e-12"; + value[33]="7723154992826793726050991e12"; + value[34]="1611437259018380210686834e-12"; + value[35]="65645e16"; + value[36]="31153e-16"; + value[37]="7758733150e16"; + value[38]="6365465077e-16"; + value[39]="727973863299662e16"; + value[40]="351084160935215e-16"; + value[41]="45470432070181568402e16"; + value[42]="97216256670931719037e-16"; + value[43]="2520581904836081418366563e16"; + value[44]="3700768934485477578987416e-16"; + value[45]="28736e20"; + value[46]="52779e-20"; + value[47]="7904805864e20"; + value[48]="6373815349e-20"; + value[49]="186651310031326e20"; + value[50]="189125880591366e-20"; + value[51]="74987916068454915171e20"; + value[52]="10554589082317914511e-20"; + value[53]="3599986721169840668392202e20"; + value[54]="2588106172836128849130551e-20"; + value[55]="71080e24"; + value[56]="61576e-24"; + value[57]="7086656363e24"; + value[58]="7703864845e-24"; + value[59]="361167296280301e24"; + value[60]="149150690375117e-24"; + value[61]="78129219923655854302e24"; + value[62]="20861932490694515212e-24"; + value[63]="9185868654811652011998047e24"; + value[64]="1996563690880014012200226e-24"; + value[65]="84665e28"; + value[66]="94968e-28"; + value[67]="2622821029e28"; + value[68]="4451579486e-28"; + value[69]="590522407411869e28"; + value[70]="606293232614518e-28"; + value[71]="96628087822208148505e28"; + value[72]="24875240094942654314e-28"; + value[73]="5099400093819597146233149e28"; + value[74]="8906650752845770170008864e-28"; + //-------------------------------------------- + initResults1(); + initResults2(); + } + + private static void initResults1() { + results[0][0]="1"; + results[0][1]="0.000002198881093560642"; + results[0][2]="4.933579065397471E-11"; + results[0][3]="5.753091300977375E-16"; + results[0][4]="4.015474920147867E-21"; + results[0][5]="0.00001252803261977574"; + results[0][6]="7785.598648553530"; + results[0][7]="1.201430514605841E-10"; + results[0][8]="0.01147743903192921"; + results[0][9]="1.119904923797219E-15"; + results[0][10]="4.087163638363069E-7"; + results[0][11]="1.357117536758031E-20"; + results[0][12]="1.822239559462666E-12"; + results[0][13]="1.707483341383177E-25"; + results[0][14]="1.372942771084022E-17"; + results[0][15]="1.474878660195210E-9"; + results[0][16]="16943414.72381361"; + results[0][17]="1.745565983468090E-14"; + results[0][18]="132.9740109233477"; + results[0][19]="1.125098151123273E-19"; + results[0][20]="0.004499945117611804"; + results[0][21]="2.097749946374985E-24"; + results[0][22]="2.585217575324869E-8"; + results[0][23]="2.299150660004288E-29"; + results[0][24]="1.369358300583728E-13"; + results[0][25]="1.370818822887878E-13"; + results[0][26]="367170124481.3278"; + results[0][27]="1.598071589430057E-18"; + results[0][28]="5662587.842852089"; + results[0][29]="2.727934247231818E-23"; + results[0][30]="12.76189825841631"; + results[0][31]="3.328451806821200E-28"; + results[0][32]="0.0002594560913752765"; + results[0][33]="1.432186717769276E-33"; + results[0][34]="6.864058738928437E-9"; + results[0][35]="1.684972198948892E-17"; + results[0][36]="3550540878888069"; + results[0][37]="1.425619335806130E-22"; + results[0][38]="17376577934.52694"; + results[0][39]="1.519422682273810E-27"; + results[0][40]="315052.6634564146"; + results[0][41]="2.432569803367569E-32"; + results[0][42]="1.137772670824026"; + results[0][43]="4.388272398043467E-37"; + results[0][44]="0.00002988838318687904"; + results[0][45]="3.849178730512249E-21"; + results[0][46]="2.095719888592054E+19"; + results[0][47]="1.399275351008165E-26"; + results[0][48]="173538130528606.9"; + results[0][49]="5.926023234524105E-31"; + results[0][50]="5848485656.967753"; + results[0][51]="1.475037656720937E-36"; + results[0][52]="104798.0164242535"; + results[0][53]="3.072511333154488E-41"; + results[0][54]="0.4273781391232109"; + results[0][55]="1.556133933595948E-25"; + results[0][56]="1.796316746784461E+23"; + results[0][57]="1.560820707738894E-30"; + results[0][58]="1.435772852009322E+18"; + results[0][59]="3.062569649555309E-35"; + results[0][60]="74159898101586.80"; + results[0][61]="1.415731529229177E-40"; + results[0][62]="530200162.6615257"; + results[0][63]="1.204132174718842E-45"; + results[0][64]="5540.018608234184"; + results[0][65]="1.306443040217327E-29"; + results[0][66]="1.164708112206217E+27"; + results[0][67]="4.217214929154817E-34"; + results[0][68]="2.484736043641657E+22"; + results[0][69]="1.873087263272185E-39"; + results[0][70]="1.824364747121068E+17"; + results[0][71]="1.144698218633054E-44"; + results[0][72]="4446590247082.196"; + results[0][73]="2.169078675235893E-49"; + results[0][74]="12418809.61422664"; + results[1][0]="454776.7511979025"; + results[1][1]="1"; + results[1][2]="0.00002243677059139446"; + results[1][3]="2.616372171203405E-10"; + results[1][4]="1.826144638701504E-15"; + results[1][5]="5.697457973722958"; + results[1][6]="3540709259.519955"; + results[1][7]="0.00005463826662224685"; + results[1][8]="5219.672435012765"; + results[1][9]="5.093067228950338E-10"; + results[1][10]="0.1858747001068956"; + results[1][11]="6.171855043605175E-15"; + results[1][12]="8.287121867567282E-7"; + results[1][13]="7.765237267187802E-20"; + results[1][14]="6.243824530142372E-12"; + results[1][15]="0.0006707405254946931"; + results[1][16]="7705471102294.660"; + results[1][17]="7.938428269631898E-9"; + results[1][18]="60473488.68147447"; + results[1][19]="5.116684819466090E-14"; + results[1][20]="2046.470421156359"; + results[1][21]="9.540079054379898E-19"; + results[1][22]="0.01175696850045963"; + results[1][23]="1.045600267671264E-23"; + results[1][24]="6.227523191653488E-8"; + results[1][25]="6.234165307538822E-8"; + results[1][26]="1.669804363485477E+17"; + results[1][27]="7.267658056226699E-13"; + results[1][28]="2575213302545.012"; + results[1][29]="1.240601074437582E-17"; + results[1][30]="5803814.629080740"; + results[1][31]="1.513702499224934E-22"; + results[1][32]="117.9945983141544"; + results[1][33]="6.513252226158986E-28"; + results[1][34]="0.003121614333321446"; + results[1][35]="7.662861824967629E-12"; + results[1][36]="1.614703445896061E+21"; + results[1][37]="6.483385299828233E-17"; + results[1][38]="7902463660001319"; + results[1][39]="6.909981111408860E-22"; + results[1][40]="143278626742.9544"; + results[1][41]="1.106276192237624E-26"; + results[1][42]="517432.5588391111"; + results[1][43]="1.995684264553637E-31"; + results[1][44]="13.59254180428686"; + results[1][45]="1.750516997842428E-15"; + results[1][46]="9.530846823547244E+24"; + results[1][47]="6.363578981627979E-21"; + results[1][48]="7.892110721075739E+19"; + results[1][49]="2.695017594120158E-25"; + results[1][50]="2659755306503325"; + results[1][51]="6.708128334181145E-31"; + results[1][52]="47659701441.40646"; + results[1][53]="1.397306722110734E-35"; + results[1][54]="194361.6416434591"; + results[1][55]="7.076935347495779E-20"; + results[1][56]="8.169230942250227E+28"; + results[1][57]="7.098249706679054E-25"; + results[1][58]="6.529561130949462E+23"; + results[1][59]="1.392785475542062E-29"; + results[1][60]="3.372619752780715E+19"; + results[1][61]="6.438417854312836E-35"; + results[1][62]="241122707459808.1"; + results[1][63]="5.476113184315002E-40"; + results[1][64]="2519471664.228668"; + results[1][65]="5.941399214551468E-24"; + results[1][66]="5.296821713629854E+32"; + results[1][67]="1.917891304584321E-28"; + results[1][68]="1.130000185511682E+28"; + results[1][69]="8.518365403010947E-34"; + results[1][70]="8.296786726957023E+22"; + results[1][71]="5.205821369719668E-39"; + results[1][72]="2.022205866476320E+18"; + results[1][73]="9.864465530164297E-44"; + results[1][74]="5647785890103.269"; + results[2][0]="20269260647.17756"; + results[2][1]="44569.69401753148"; + results[2][2]="1"; + results[2][3]="0.00001166109071065203"; + results[2][4]="8.139070777868161E-11"; + results[2][5]="253933.9585665772"; + results[2][6]="157808328301844.9"; + results[2][7]="2.435210825001846"; + results[2][8]="232639203.3002624"; + results[2][9]="0.00002269964480050335"; + results[2][10]="8284.378509364762"; + results[2][11]="2.750776908140411E-10"; + results[2][12]="0.03693544859234678"; + results[2][13]="3.460942489720927E-15"; + results[2][14]="2.782853488076028E-7"; + results[2][15]="29.89469998645674"; + results[2][16]="3.434304892902040E+17"; + results[2][17]="0.0003538133189576156"; + results[2][18]="2695284886705.971"; + results[2][19]="2.280490767877520E-9"; + results[2][20]="91210560.48686773"; + results[2][21]="4.251984043567731E-14"; + results[2][22]="524.0044886392415"; + results[2][23]="4.660208399475724E-19"; + results[2][24]="0.002775588031390770"; + results[2][25]="0.002778548402117154"; + results[2][26]="7.442266954968664E+21"; + results[2][27]="3.239172957900716E-8"; + results[2][28]="1.147764689243079E+17"; + results[2][29]="5.529321028550383E-13"; + results[2][30]="258674242152.6016"; + results[2][31]="6.746525722402801E-18"; + results[2][32]="5258983.142583397"; + results[2][33]="2.902936587789118E-23"; + results[2][34]="139.1293956768774"; + results[2][35]="3.415314068374301E-7"; + results[2][36]="7.196683851264116E+25"; + results[2][37]="2.889624990111060E-12"; + results[2][38]="3.522103873109208E+20"; + results[2][39]="3.079757438024150E-17"; + results[2][40]="6385884553185581"; + results[2][41]="4.930639138691073E-22"; + results[2][42]="23061810822.16754"; + results[2][43]="8.894703702675794E-27"; + results[2][44]="605815.4291375707"; + results[2][45]="7.802000696632482E-11"; + results[2][46]="4.247869266534626E+29"; + results[2][47]="2.836227680675536E-16"; + results[2][48]="3.517489599908254E+24"; + results[2][49]="1.201161095417993E-20"; + results[2][50]="1.185444801723589E+20"; + results[2][51]="2.989792272847868E-26"; + results[2][52]="2124178310210390"; + results[2][53]="6.227753305311532E-31"; + results[2][54]="8662638896.794075"; + results[2][55]="3.154168430197397E-15"; + results[2][56]="3.641001234546430E+33"; + results[2][57]="3.163668174867180E-20"; + results[2][58]="2.910205416751843E+28"; + results[2][59]="6.207602247697180E-25"; + results[2][60]="1.503166304189191E+24"; + results[2][61]="2.869583137237347E-30"; + results[2][62]="1.074676529216240E+19"; + results[2][63]="2.440686890302896E-35"; + results[2][64]="112292081160512.5"; + results[2][65]="2.648063450285608E-19"; + results[2][66]="2.360777230418994E+37"; + results[2][67]="8.547982860420744E-24"; + results[2][68]="5.036376250800950E+32"; + results[2][69]="3.796609395417242E-29"; + results[2][70]="3.697852457491911E+27"; + results[2][71]="2.320218655583322E-34"; + results[2][72]="9.012909670930670E+22"; + results[2][73]="4.396562103259092E-39"; + results[2][74]="2.517200889984344E+17"; + results[3][0]="1738195950114877"; + results[3][1]="3822086211.611279"; + results[3][2]="85755.27151045421"; + results[3][3]="1"; + results[3][4]="0.000006979682243988879"; + results[3][5]="21776175562.60126"; + results[3][6]="1.353289604013560E+19"; + results[3][7]="208832.1654832305"; + results[3][8]="19950038042989.76"; + results[3][9]="1.946614203058035"; + results[3][10]="710429128.3659471"; + results[3][11]="0.00002358936206222687"; + results[3][12]="3167.409422397122"; + results[3][13]="2.967940628880855E-10"; + results[3][14]="0.02386443564437743"; + results[3][15]="2563628.114062170"; + results[3][16]="2.945097485404958E+22"; + results[3][17]="30.34135723122526"; + results[3][18]="2.311348872574943E+17"; + results[3][19]="0.0001955641049764209"; + results[3][20]="7821786379172.049"; + results[3][21]="3.646300461142698E-9"; + results[3][22]="44936147.19595487"; + results[3][23]="3.996374365923399E-14"; + results[3][24]="238.0213052330826"; + results[3][25]="238.2751726284952"; + results[3][26]="6.382136233766191E+26"; + results[3][27]="0.002777761564740970"; + results[3][28]="9.842687255615237E+21"; + results[3][29]="4.741684260718020E-8"; + results[3][30]="2.218267986855733E+16"; + results[3][31]="5.785501450769154E-13"; + results[3][32]="450985527261.1410"; + results[3][33]="2.489421152634873E-18"; + results[3][34]="11931079.10135604"; + results[3][35]="0.02928811852269122"; + results[3][36]="6.171535776400555E+30"; + results[3][37]="2.478005755903675E-7"; + results[3][38]="3.020389739265025E+25"; + results[3][39]="2.641054352841019E-12"; + results[3][40]="5.476232636928451E+20"; + results[3][41]="4.228282980585251E-17"; + results[3][42]="1977671848577708"; + results[3][43]="7.627677310280051E-22"; + results[3][44]="51951866610.91471"; + results[3][45]="0.000006690626880644714"; + results[3][46]="3.642771822925908E+34"; + results[3][47]="2.432214748217965E-11"; + results[3][48]="3.016432756753313E+29"; + results[3][49]="1.030058958653646E-15"; + results[3][50]="1.016581408324629E+25"; + results[3][51]="2.563904481179269E-21"; + results[3][52]="1.821594877287098E+20"; + results[3][53]="5.340626755971191E-26"; + results[3][54]="742866950591597.5"; + results[3][55]="2.704865701212809E-10"; + results[3][56]="3.122350494384281E+38"; + results[3][57]="2.713012233047182E-15"; + results[3][58]="2.495654556647489E+33"; + results[3][59]="5.323346161801775E-20"; + results[3][60]="1.289044345411101E+29"; + results[3][61]="2.460818810556097E-25"; + results[3][62]="9.215917754885128E+23"; + results[3][63]="2.093017669499310E-30"; + results[3][64]="9.629637908393713E+18"; + results[3][65]="2.270854001561525E-14"; + results[3][66]="2.024490923702789E+42"; + results[3][67]="7.330345910620899E-19"; + results[3][68]="4.318958128162389E+37"; + results[3][69]="3.255792695231470E-24"; + results[3][70]="3.171103414978191E+32"; + results[3][71]="1.989709807731689E-29"; + results[3][72]="7.729045159298581E+27"; + results[3][73]="3.770283768775571E-34"; + results[3][74]="2.158632457669644E+22"; + results[4][0]="2.490365448386802E+20"; + results[4][1]="547601750051441.0"; + results[4][2]="12286414841.35031"; + results[4][3]="143272.9979736873"; + results[4][4]="1"; + results[4][5]="3119937957255229"; + results[4][6]="1.938898586936469E+24"; + results[4][7]="29920010422.11961"; + results[4][8]="2.858301760108257E+18"; + results[4][9]="278897.2527702849"; + results[4][10]="101785311068822.8"; + results[4][11]="3.379718622942007"; + results[4][12]="453804243.7569410"; + results[4][13]="0.00004252257517076709"; + results[4][14]="3419.129239720079"; + results[4][15]="367298685591.3171"; + results[4][16]="4.219529460587362E+27"; + results[4][17]="4347097.213108260"; + results[4][18]="3.311538823369143E+22"; + results[4][19]="28.01905561601273"; + results[4][20]="1.120650784053732E+18"; + results[4][21]="0.0005224163985807529"; + results[4][22]="6438136526151.358"; + results[4][23]="5.725725364310391E-9"; + results[4][24]="34102025.98235386"; + results[4][25]="34138398.32518239"; + results[4][26]="9.143877916881798E+31"; + results[4][27]="397.9782270365194"; + results[4][28]="1.410191311229400E+27"; + results[4][29]="0.006793553194777180"; + results[4][30]="3.178179047858768E+21"; + results[4][31]="8.289061376328140E-8"; + results[4][32]="6.461404853344776E+16"; + results[4][33]="3.566668317571105E-13"; + results[4][34]="1709401471912.486"; + results[4][35]="4196.196545754653"; + results[4][36]="8.842144327867755E+35"; + results[4][37]="0.03550313136443727"; + results[4][38]="4.327402929934638E+30"; + results[4][39]="3.783917749429893E-7"; + results[4][40]="7.845962674940902E+25"; + results[4][41]="6.057987789095672E-12"; + results[4][42]="2.833469747538924E+20"; + results[4][43]="1.092840195819694E-16"; + results[4][44]="7443299679674857"; + results[4][45]="0.9585861715133080"; + results[4][46]="5.219108400046689E+39"; + results[4][47]="0.000003484706986930048"; + results[4][48]="4.321733642460815E+34"; + results[4][49]="1.475796350959623E-10"; + results[4][50]="1.456486660549828E+30"; + results[4][51]="3.673382815367253E-16"; + results[4][52]="2.609853591624336E+25"; + results[4][53]="7.651676063864807E-21"; + results[4][54]="1.064327751068292E+20"; + results[4][55]="0.00003875342181289592"; + results[4][56]="4.473485160550607E+43"; + results[4][57]="3.887013961679578E-10"; + results[4][58]="3.575599102375792E+38"; + results[4][59]="7.626917638530619E-15"; + results[4][60]="1.846852478880778E+34"; + results[4][61]="3.525688884584153E-20"; + results[4][62]="1.320392165821326E+29"; + results[4][63]="2.998729163210665E-25"; + results[4][64]="1.379667092536635E+24"; + results[4][65]="3.253520607642641E-9"; + results[4][66]="2.900548840094181E+47"; + results[4][67]="1.050240634798815E-13"; + results[4][68]="6.187900791446503E+42"; + results[4][69]="4.664671802266443E-19"; + results[4][70]="4.543334931485233E+37"; + results[4][71]="2.850716892513680E-24"; + results[4][72]="1.107363471446723E+33"; + results[4][73]="5.401798587640085E-29"; + results[4][74]="3.092737437336386E+27"; + results[5][0]="79820.99267697315"; + results[5][1]="0.1755168716666387"; + results[5][2]="0.000003938031784503595"; + results[5][3]="4.592174586052730E-11"; + results[5][4]="3.205191941956922E-16"; + results[5][5]="1"; + results[5][6]="621454212.7120434"; + results[5][7]="0.000009589937630824491"; + results[5][8]="916.1405769180272"; + results[5][9]="8.939192272132398E-11"; + results[5][10]="0.03262414588473695"; + results[5][11]="1.083264689633546E-15"; + results[5][12]="1.454529705315602E-7"; + results[5][13]="1.362930152886002E-20"; + results[5][14]="1.095896548766010E-12"; + results[5][15]="0.0001177262787348659"; + results[5][16]="1352440182592.445"; + results[5][17]="1.393328095835799E-9"; + results[5][18]="10614117.55214028"; + results[5][19]="8.980645128168683E-15"; + results[5][20]="359.1900862796728"; + results[5][21]="1.674444831077185E-19"; + results[5][22]="0.002063546331483886"; + results[5][23]="1.835204879954603E-24"; + results[5][24]="1.093035388830462E-8"; + results[5][25]="1.094201192231903E-8"; + results[5][26]="2.930788381742739E+16"; + results[5][27]="1.275596606371755E-13"; + results[5][28]="451993382737.0138"; + results[5][29]="2.177464195715552E-18"; + results[5][30]="1018667.387429325"; + results[5][31]="2.656803272979331E-23"; + results[5][32]="20.71004276966202"; + results[5][33]="1.143185655111196E-28"; + results[5][34]="0.0005478959823343203"; + results[5][35]="1.344961535532028E-12"; + results[5][36]="2.834076974930183E+20"; + results[5][37]="1.137943505635324E-17"; + results[5][38]="1387015700062728"; + results[5][39]="1.212818267950047E-22"; + results[5][40]="25147816342.61536"; + results[5][41]="1.941701364608288E-27"; + results[5][42]="90818.14402590475"; + results[5][43]="3.502762589487909E-32"; + results[5][44]="2.385720415486439"; + results[5][45]="3.072452672605791E-16"; + results[5][46]="1.672824418802933E+24"; + results[5][47]="1.116915475458918E-21"; + results[5][48]="1.385198584609954E+19"; + results[5][49]="4.730210572065213E-26"; + results[5][50]="466831930796205.5"; + results[5][51]="1.177389699953815E-31"; + results[5][52]="8365081701.561654"; + results[5][53]="2.452509046236414E-36"; + results[5][54]="34113.74731325223"; + results[5][55]="1.242121553179516E-20"; + results[5][56]="1.433837858906067E+28"; + results[5][57]="1.245862582824943E-25"; + results[5][58]="1.146048143060329E+23"; + results[5][59]="2.444573495698746E-30"; + results[5][60]="5.919516683291835E+18"; + results[5][61]="1.130050960271621E-35"; + results[5][62]="42321103301135.62"; + results[5][63]="9.611502550034045E-41"; + results[5][64]="442209784.7581557"; + results[5][65]="1.042815803460698E-24"; + results[5][66]="9.296815769522365E+31"; + results[5][67]="3.366222819772885E-29"; + results[5][68]="1.983340975437319E+27"; + results[5][69]="1.495116847249808E-34"; + results[5][70]="1.456226051200787E+22"; + results[5][71]="9.137094812685324E-40"; + results[5][72]="3.549312475498482E+17"; + results[5][73]="1.731380130517828E-44"; + results[5][74]="991281711273.9084"; + results[6][0]="0.0001284422746587108"; + results[6][1]="2.824292893609623E-10"; + results[6][2]="6.336801173682476E-15"; + results[6][3]="7.389401330167758E-20"; + results[6][4]="5.157567325787970E-25"; + results[6][5]="1.609129006682524E-9"; + results[6][6]="1"; + results[6][7]="1.543144681403597E-14"; + results[6][8]="0.000001474188376517659"; + results[6][9]="1.438431358140050E-19"; + results[6][10]="5.249645946137250E-11"; + results[6][11]="1.743112634004281E-24"; + results[6][12]="2.340525939904718E-16"; + results[6][13]="2.193130443091112E-29"; + results[6][14]="1.763438924942655E-21"; + results[6][15]="1.894367699610646E-13"; + results[6][16]="2176.250727612512"; + results[6][17]="2.242044654835111E-18"; + results[6][18]="0.01707948443348703"; + results[6][19]="1.445101657445832E-23"; + results[6][20]="5.779831867454199E-7"; + results[6][21]="2.694397747775916E-28"; + results[6][22]="3.320512258624031E-12"; + results[6][23]="2.953081405540270E-33"; + results[6][24]="1.758834949497607E-17"; + results[6][25]="1.760710877566955E-17"; + results[6][26]="47160165.97510373"; + results[6][27]="2.052599500138579E-22"; + results[6][28]="727.3156629906847"; + results[6][29]="3.503820798338526E-27"; + results[6][30]="0.001639167241274031"; + results[6][31]="4.275139211600108E-32"; + results[6][32]="3.332513055029883E-8"; + results[6][33]="1.839533197662788E-37"; + results[6][34]="8.816353178189703E-13"; + results[6][35]="2.164216619696854E-21"; + results[6][36]="456039546753.1217"; + results[6][37]="1.831097902883797E-26"; + results[6][38]="2231887.195695002"; + results[6][39]="1.951581054792877E-31"; + results[6][40]="40.46608073162718"; + results[6][41]="3.124447988106234E-36"; + results[6][42]="0.0001461381098851545"; + results[6][43]="5.636396886267384E-41"; + results[6][44]="3.838931922393911E-9"; + results[6][45]="4.943972717149220E-25"; + results[6][46]="2691790295382633"; + results[6][47]="1.797261089573547E-30"; + results[6][48]="22289632225.11453"; + results[6][49]="7.611519039226468E-35"; + results[6][50]="751192.8010897827"; + results[6][51]="1.894571918364917E-40"; + results[6][52]="13.46049560925206"; + results[6][53]="3.946403445450303E-45"; + results[6][54]="0.00005489342032839216"; + results[6][55]="1.998733821046708E-29"; + results[6][56]="2.307230089645316E+19"; + results[6][57]="2.004753620364024E-34"; + results[6][58]="184413931005301.8"; + results[6][59]="3.933634120896147E-39"; + results[6][60]="9525266000.626017"; + results[6][61]="1.818397779202506E-44"; + results[6][62]="68100.11491666482"; + results[6][63]="1.546614755106283E-49"; + results[6][64]="0.7115725916931837"; + results[6][65]="1.678025157975551E-33"; + results[6][66]="1.495977592452194E+23"; + results[6][67]="5.416686782253186E-38"; + results[6][68]="3.191451493718201E+18"; + results[6][69]="2.405835887289389E-43"; + results[6][70]="23432555792739.37"; + results[6][71]="1.470276429990037E-48"; + results[6][72]="571130165.8104760"; + results[6][73]="2.786013989610011E-53"; + results[6][74]="1595.100155404736"; + results[7][0]="8323411032.456378"; + results[7][1]="18302.19115320239"; + results[7][2]="0.4106420642242513"; + results[7][3]="0.000004788534360528390"; + results[7][4]="3.342244825091065E-11"; + results[7][5]="104275.9649224148"; + results[7][6]="64802737685647.92"; + results[7][7]="1"; + results[7][8]="95531442.66270503"; + results[7][9]="0.000009321428998035992"; + results[7][10]="3401.914291900572"; + results[7][11]="1.129584707779182E-10"; + results[7][12]="0.01516724885301000"; + results[7][13]="1.421208568140421E-15"; + results[7][14]="1.142756700777198E-7"; + results[7][15]="12.27602131180330"; + results[7][16]="1.410270050396740E+17"; + results[7][17]="0.0001452906316467887"; + results[7][18]="1106797349549.367"; + results[7][19]="9.364654363655727E-10"; + results[7][20]="37454892.83737830"; + results[7][21]="1.746043504699232E-14"; + results[7][22]="215.1782848775914"; + results[7][23]="1.913677596875906E-19"; + results[7][24]="0.001139773198646432"; + results[7][25]="0.001140988851392383"; + results[7][26]="3.056107864896266E+21"; + results[7][27]="1.330140669811724E-8"; + results[7][28]="4.713204612344845E+16"; + results[7][29]="2.270571800922490E-13"; + results[7][30]="106222524759.1882"; + results[7][31]="2.770407248989495E-18"; + results[7][32]="2159559.693390987"; + results[7][33]="1.192067872721828E-23"; + results[7][34]="57.13238223502557"; + results[7][35]="1.402471619011349E-7"; + results[7][36]="2.955261112252432E+25"; + results[7][37]="1.186601570773187E-12"; + results[7][38]="1.446324004865796E+20"; + results[7][39]="1.264677951660229E-17"; + results[7][40]="2622312814817888"; + results[7][41]="2.024727833856987E-22"; + results[7][42]="9470149600.764056"; + results[7][43]="3.652539489129880E-27"; + results[7][44]="248773.2983599527"; + results[7][45]="3.203829671144209E-11"; + results[7][46]="1.744353804164535E+29"; + results[7][47]="1.164674389402563E-16"; + results[7][48]="1.444429190193662E+24"; + results[7][49]="4.932472716883077E-21"; + results[7][50]="4.867935004036829E+19"; + results[7][51]="1.227734470523965E-26"; + results[7][52]="872276966085176.7"; + results[7][53]="2.557377472772532E-31"; + results[7][54]="3557243918.208811"; + results[7][55]="1.295234235087226E-15"; + results[7][56]="1.495148262797194E+33"; + results[7][57]="1.299135229848029E-20"; + results[7][58]="1.195052759651575E+28"; + results[7][59]="2.549102600877473E-25"; + results[7][60]="6.172633140245884E+23"; + results[7][61]="1.178371542938247E-30"; + results[7][62]="4.413073883307109E+18"; + results[7][63]="1.002248702759050E-35"; + results[7][64]="46111852003790.03"; + results[7][65]="1.087406241422075E-19"; + results[7][66]="9.694344350728666E+36"; + results[7][67]="3.510161326756695E-24"; + results[7][68]="2.068147939838898E+32"; + results[7][69]="1.559047519187323E-29"; + results[7][70]="1.518493766341199E+27"; + results[7][71]="9.527793781803528E-35"; + results[7][72]="3.701079831937688E+22"; + results[7][73]="1.805413337572430E-39"; + results[7][74]="1.033668569530294E+17"; + results[8][0]="87.12745040231444"; + results[8][1]="0.0001915829034197918"; + results[8][2]="4.298501653263149E-9"; + results[8][3]="5.012521769858929E-14"; + results[8][4]="3.498580919469208E-19"; + results[8][5]="0.001091535540718088"; + results[8][6]="678339.3601041740"; + results[8][7]="1.046775775731475E-8"; + results[8][8]="1"; + results[8][9]="9.757446070344992E-14"; + results[8][10]="0.00003561041471876213"; + results[8][11]="1.182421908739965E-18"; + results[8][12]="1.587670868382187E-10"; + results[8][13]="1.487686701391408E-23"; + results[8][14]="1.196210031928393E-15"; + results[8][15]="1.285024173155902E-7"; + results[8][16]="1476236525.994914"; + results[8][17]="1.520867136485833E-12"; + results[8][18]="11585.68654152080"; + results[8][19]="9.802693335972867E-18"; + results[8][20]="0.3920687450478594"; + results[8][21]="1.827716044092442E-22"; + results[8][22]="0.000002252434160733091"; + results[8][23]="2.003191350969721E-27"; + results[8][24]="1.193086974171064E-11"; + results[8][25]="1.194359490017227E-11"; + results[8][26]="31990596809958.51"; + results[8][27]="1.392359031474151E-16"; + results[8][28]="493366841.4268441"; + results[8][29]="2.376779558264652E-21"; + results[8][30]="1111.911657549550"; + results[8][31]="2.899995197153080E-26"; + results[8][32]="0.02260574773287777"; + results[8][33]="1.247827772192961E-31"; + results[8][34]="5.980479373345604E-7"; + results[8][35]="1.468073316931983E-15"; + results[8][36]="3.093495743267101E+17"; + results[8][37]="1.242105779730290E-20"; + results[8][38]="1513976932152.447"; + results[8][39]="1.323834243899629E-25"; + results[8][40]="27449735.30941583"; + results[8][41]="2.119436048930757E-30"; + results[8][42]="99.13123194632914"; + results[8][43]="3.823389857123776E-35"; + results[8][44]="0.002604098623720172"; + results[8][45]="3.353691289323497E-19"; + results[8][46]="1.825947306504481E+21"; + results[8][47]="1.219152937441450E-24"; + results[8][48]="1.511993486054156E+16"; + results[8][49]="5.163192954489619E-29"; + results[8][50]="509563644006.1053"; + results[8][51]="1.285162702774995E-34"; + results[8][52]="9130783.978265085"; + results[8][53]="2.677000787899666E-39"; + results[8][54]="37.23636761949100"; + results[8][55]="1.355819821187394E-23"; + results[8][56]="1.565084982623100E+25"; + results[8][57]="1.359903288004258E-28"; + results[8][58]="1.250952279524317E+20"; + results[8][59]="2.668338852452637E-33"; + results[8][60]="6461362843686697"; + results[8][61]="1.233490785959079E-38"; + results[8][62]="46194988375.59113"; + results[8][63]="1.049129663306469E-43"; + results[8][64]="482687.6965168229"; + results[8][65]="1.138270511899841E-27"; + results[8][66]="1.014780482794204E+29"; + results[8][67]="3.674351845758363E-32"; + results[8][68]="2.164887164052315E+24"; + results[8][69]="1.631973176299542E-37"; + results[8][70]="1.589522490205218E+19"; + results[8][71]="9.973463726956913E-43"; + results[8][72]="387420071212069.1"; + results[8][73]="1.889862946953332E-47"; + results[8][74]="1082019218.719317"; + results[9][0]="892932943458573.4"; + results[9][1]="1963453367.188511"; + results[9][2]="44053.55276650961"; + results[9][3]="0.5137124749367641"; + results[9][4]="0.000003585549839831714"; + results[9][5]="11186693042.92137"; + results[9][6]="6.952017517839994E+18"; + results[9][7]="107279.6885767942"; + results[9][8]="10248583418146.87"; + results[9][9]="1"; + results[9][10]="364956305.8000387"; + results[9][11]="0.00001211814956716597"; + results[9][12]="1627.137733517652"; + results[9][13]="1.524668125927760E-10"; + results[9][14]="0.01225945829784226"; + results[9][15]="1316967.743292346"; + results[9][16]="1.512933318157422E+22"; + results[9][17]="15.58673371619321"; + results[9][18]="1.187368749772774E+17"; + results[9][19]="0.0001004637203762303"; + results[9][20]="4018149239271.144"; + results[9][21]="1.873150034256679E-9"; + results[9][22]="23084259.39015671"; + results[9][23]="2.052987366292351E-14"; + results[9][24]="122.2745137989658"; + results[9][25]="122.4049286469690"; + results[9][26]="3.278583000031628E+26"; + results[9][27]="0.001426970768207302"; + results[9][28]="5.056311230110650E+21"; + results[9][29]="2.435862356942155E-8"; + results[9][30]="1.139551937600652E+16"; + results[9][31]="2.972084269024861E-13"; + results[9][32]="231676891369.9822"; + results[9][33]="1.278846701479992E-18"; + results[9][34]="6129144.173823912"; + results[9][35]="0.01504567185253299"; + results[9][36]="3.170394917855513E+30"; + results[9][37]="1.272982469772824E-7"; + results[9][38]="1.551611888231443E+25"; + results[9][39]="1.356742568040473E-12"; + results[9][40]="2.813209021245996E+20"; + results[9][41]="2.172121714689447E-17"; + results[9][42]="1015954699945620"; + results[9][43]="3.918432989082965E-22"; + results[9][44]="26688321974.27763"; + results[9][45]="0.000003437058493734438"; + results[9][46]="1.871337328785176E+34"; + results[9][47]="1.249459057884749E-11"; + results[9][48]="1.549579136952070E+29"; + results[9][49]="5.291541369807505E-16"; + results[9][50]="5.222305512451464E+24"; + results[9][51]="1.317109716528063E-21"; + results[9][52]="9.357760127432864E+19"; + results[9][53]="2.743546588523462E-26"; + results[9][54]="381620019737136.4"; + results[9][55]="1.389523253741598E-10"; + results[9][56]="1.603990400090178E+38"; + results[9][57]="1.393708228772385E-15"; + results[9][58]="1.282048878882594E+33"; + results[9][59]="2.734669331724314E-20"; + results[9][60]="6.621981609843777E+28"; + results[9][61]="1.264153321541716E-25"; + results[9][62]="4.734331918675705E+23"; + results[9][63]="1.075209287084869E-30"; + results[9][64]="4.946865122665819E+18"; + results[9][65]="1.166566029362225E-14"; + results[9][66]="1.040006242902376E+42"; + results[9][67]="3.765690139887650E-19"; + results[9][68]="2.218702669166555E+37"; + results[9][69]="1.672541323348396E-24"; + results[9][70]="1.629035383588871E+32"; + results[9][71]="1.022138749735799E-29"; + results[9][72]="3.970506917681290E+27"; + results[9][73]="1.936841806071609E-34"; + results[9][74]="1.108916422308302E+22"; + results[10][0]="2446684.518852554"; + results[10][1]="5.379968330412397"; + results[10][2]="0.0001207091152184304"; + results[10][3]="1.407599942164664E-9"; + results[10][4]="9.824600322966481E-15"; + results[10][5]="30.65214346248511"; + results[10][6]="19048903683.41529"; + results[10][7]="0.0002939521440563168"; + results[10][8]="28081.67239549524"; + results[10][9]="2.740054039641405E-9"; + results[10][10]="1"; + results[10][11]="3.320438467449187E-14"; + results[10][12]="0.000004458445319778002"; + results[10][13]="4.177673057560849E-19"; + results[10][14]="3.359157823281803E-11"; + results[10][15]="0.003608562785085618"; + results[10][16]="41455190501253.18"; + results[10][17]="4.270849268387010E-8"; + results[10][18]="325345453.9358852"; + results[10][19]="2.752760228542944E-13"; + results[10][20]="11009.94605494694"; + results[10][21]="5.132532318219450E-18"; + results[10][22]="0.06325211819412893"; + results[10][23]="5.625296326342124E-23"; + results[10][24]="3.350387754800450E-7"; + results[10][25]="3.353961192111453E-7"; + results[10][26]="8.983494593536299E+17"; + results[10][27]="3.909977017876616E-12"; + results[10][28]="13854566011748.89"; + results[10][29]="6.674394491149785E-17"; + results[10][30]="31224338.90003856"; + results[10][31]="8.143671507496243E-22"; + results[10][32]="634.8072020898827"; + results[10][33]="3.504109070472339E-27"; + results[10][34]="0.01679418625303079"; + results[10][35]="4.122595393865199E-11"; + results[10][36]="8.687053401928578E+21"; + results[10][37]="3.488040758693718E-16"; + results[10][38]="4.251500422304194E+16"; + results[10][39]="3.717547954312753E-21"; + results[10][40]="770834474302.0734"; + results[10][41]="5.951730878927634E-26"; + results[10][42]="2783770.779678667"; + results[10][43]="1.073671814080092E-30"; + results[10][44]="73.12744443686990"; + results[10][45]="9.417726010240848E-15"; + results[10][46]="5.127565407269577E+25"; + results[10][47]="3.423585338923651E-20"; + results[10][48]="4.245930573949562E+20"; + results[10][49]="1.449910930627067E-24"; + results[10][50]="1.430939931563421E+16"; + results[10][51]="3.608951799423663E-30"; + results[10][52]="256407684391.6768"; + results[10][53]="7.517465912828107E-35"; + results[10][54]="1045659.476688773"; + results[10][55]="3.807368804590335E-19"; + results[10][56]="4.395020375313125E+29"; + results[10][57]="3.818835862329240E-24"; + results[10][58]="3.512883209599986E+24"; + results[10][59]="7.493141749474667E-29"; + results[10][60]="1.814458746048353E+20"; + results[10][61]="3.463848415416480E-34"; + results[10][62]="1297232529877061"; + results[10][63]="2.946131550536850E-39"; + results[10][64]="13554677762.92165"; + results[10][65]="3.196453961262399E-23"; + results[10][66]="2.849673307116934E+33"; + results[10][67]="1.031819447983696E-27"; + results[10][68]="6.079365211412986E+28"; + results[10][69]="4.582853609507953E-33"; + results[10][70]="4.463644983521472E+23"; + results[10][71]="2.800715410287590E-38"; + results[10][72]="1.087940351921676E+19"; + results[10][73]="5.307051214872866E-43"; + results[10][74]="30384909225705.58"; + results[11][0]="7.368558528753992E+19"; + results[11][1]="162025840356721.7"; + results[11][2]="3635336609.961668"; + results[11][3]="42391.98997251724"; + results[11][4]="0.2958826196985332"; + results[11][5]="923135416089567.4"; + results[11][6]="5.736863932325467E+23"; + results[11][7]="8852811065.104166"; + results[11][8]="8.457218126697593E+17"; + results[11][9]="82520.84977639587"; + results[11][10]="30116504485873.39"; + results[11][11]="1"; + results[11][12]="134272788.4731154"; + results[11][13]="0.00001258169093785437"; + results[11][14]="1011.660916536231"; + results[11][15]="108677297304.5868"; + results[11][16]="1.248485430693727E+27"; + results[11][17]="1286230.511498665"; + results[11][18]="9.798267822918602E+21"; + results[11][19]="8.290351577144743"; + results[11][20]="3.315810897530334E+17"; + results[11][21]="0.0001545739325855462"; + results[11][22]="1904932701334.478"; + results[11][23]="1.694142620466497E-9"; + results[11][24]="10090196.78468630"; + results[11][25]="10100958.72876698"; + results[11][26]="2.705514552250553E+31"; + results[11][27]="117.7548403985430"; + results[11][28]="4.172510994426643E+26"; + results[11][29]="0.002010094316332011"; + results[11][30]="9.403679425514422E+20"; + results[11][31]="2.452589194869899E-8"; + results[11][32]="1.911817394940469E+16"; + results[11][33]="1.055315165398698E-13"; + results[11][34]="505782185625.9951"; + results[11][35]="1241.581626727822"; + results[11][36]="2.616236827482037E+35"; + results[11][37]="0.01050475951561086"; + results[11][38]="1.280403315400169E+30"; + results[11][39]="1.119595496425095E-7"; + results[11][40]="2.321483990318425E+25"; + results[11][41]="1.792453297139352E-12"; + results[11][42]="8.383744517383584E+19"; + results[11][43]="3.233524200509892E-17"; + results[11][44]="2202343008423450"; + results[11][45]="0.2836289876341450"; + results[11][46]="1.544243465896434E+39"; + results[11][47]="0.000001031064232174645"; + results[11][48]="1.278725871770590E+34"; + results[11][49]="4.366624904634691E-11"; + results[11][50]="4.309490886794513E+29"; + results[11][51]="1.086890130566436E-16"; + results[11][52]="7.722103177194344E+24"; + results[11][53]="2.263997958860880E-21"; + results[11][54]="3.149160832039346E+19"; + results[11][55]="0.00001146646396828192"; + results[11][56]="1.323626508486227E+43"; + results[11][57]="1.150099873786527E-10"; + results[11][58]="1.057957629402673E+38"; + results[11][59]="2.256672371113390E-15"; + results[11][60]="5.464515496479744E+33"; + results[11][61]="1.043190063412758E-20"; + results[11][62]="3.906810930526339E+28"; + results[11][63]="8.872718405771617E-26"; + results[11][64]="4.082195136515981E+23"; + results[11][65]="9.626602006324680E-10"; + results[11][66]="8.582219893706080E+46"; + results[11][67]="3.107479503381239E-14"; + results[11][68]="1.830892296607818E+42"; + results[11][69]="1.380195312888473E-19"; + results[11][70]="1.344293841695707E+37"; + results[11][71]="8.434775821758094E-25"; + results[11][72]="3.276496048901183E+32"; + results[11][73]="1.598298317194785E-29"; + results[11][74]="9.150872549988179E+26"; + results[12][0]="548775266570.8102"; + results[12][1]="1206691.558276256"; + results[12][2]="27.07426166761666"; + results[12][3]="0.0003157154212300068"; + results[12][4]="2.203593319712548E-9"; + results[12][5]="6875074.440525237"; + results[12][6]="4272543973773303"; + results[12][7]="65.93153509191260"; + results[12][8]="6298534664.297173"; + results[12][9]="0.0006145761230907817"; + results[12][10]="224293.4315161216"; + results[12][11]="7.447525380023099E-9"; + results[12][12]="1"; + results[12][13]="9.370246258327704E-14"; + results[12][14]="0.000007534370351881011"; + results[12][15]="809.3769299082260"; + results[12][16]="9.298126931680603E+18"; + results[12][17]="0.009579234378946397"; + results[12][18]="72972848291449.96"; + results[12][19]="6.174260378010000E-8"; + results[12][20]="2469458581.471433"; + results[12][21]="1.151193286020835E-12"; + results[12][22]="14187.03464042448"; + results[12][23]="1.261717016330308E-17"; + results[12][24]="0.07514699664337871"; + results[12][25]="0.07522714649505796"; + results[12][26]="2.014938829390782E+23"; + results[12][27]="8.769821624887181E-7"; + results[12][28]="3.107488152941784E+18"; + results[12][29]="1.497022843712283E-11"; + results[12][30]="7003414118711.969"; + results[12][31]="1.826572027556399E-16"; + results[12][32]="142383085.7078879"; + results[12][33]="7.859486478230080E-22"; + results[12][34]="3766.825664213152"; + results[12][35]="0.000009246710676425823"; + results[12][36]="1.948449017282359E+27"; + results[12][37]="7.823446310355102E-11"; + results[12][38]="9.535836188108477E+21"; + results[12][39]="8.338215874985453E-16"; + results[12][40]="1.728931093721377E+17"; + results[12][41]="1.334934142295141E-20"; + results[12][42]="624381500728.4375"; + results[12][43]="2.408175355021632E-25"; + results[12][44]="16402005.45075007"; + results[12][45]="2.112334083915552E-9"; + results[12][46]="1.150079240519853E+31"; + results[12][47]="7.678877037554697E-15"; + results[12][48]="9.523343384103629E+25"; + results[12][49]="3.252054980230781E-19"; + results[12][50]="3.209504275438039E+21"; + results[12][51]="8.094641832690152E-25"; + results[12][52]="5.751055939931189E+16"; + results[12][53]="1.686118225893689E-29"; + results[12][54]="234534552223.8769"; + results[12][55]="8.539678142289999E-14"; + results[12][56]="9.857742015622534E+34"; + results[12][57]="8.565397999586525E-19"; + results[12][58]="7.879166295965479E+29"; + results[12][59]="1.680662475826388E-23"; + results[12][60]="4.069711784956242E+25"; + results[12][61]="7.769184473454425E-29"; + results[12][62]="2.909607356004657E+20"; + results[12][63]="6.607979551678220E-34"; + results[12][64]="3040225188540963"; + results[12][65]="7.169436276548434E-18"; + results[12][66]="6.391630047531518E+38"; + results[12][67]="2.314303246933335E-22"; + results[12][68]="1.363561684707550E+34"; + results[12][69]="1.027903962212583E-27"; + results[12][70]="1.001166250423753E+29"; + results[12][71]="6.281820700734860E-33"; + results[12][72]="2.440178748173697E+24"; + results[12][73]="1.190336728215637E-37"; + results[12][74]="6.815135556539365E+18"; + results[13][0]="5.856572510920854E+24"; + results[13][1]="1.287790656733084E+19"; + results[13][2]="288938635348614.2"; + results[13][3]="3369339636.612199"; + results[13][4]="23516.92003563011"; + results[13][5]="7.337133145689837E+19"; + results[13][6]="4.559692302618115E+28"; + results[13][7]="703626492562206.3"; + results[13][8]="6.721845393016666E+22"; + results[13][9]="6558804391.555706"; + results[13][10]="2.393677021207241E+18"; + results[13][11]="79480.57259865707"; + results[13][12]="10672078112261.57"; + results[13][13]="1"; + results[13][14]="80407388.92198187"; + results[13][15]="8637733818243049"; + results[13][16]="9.923033691261843E+31"; + results[13][17]="102230337547.7774"; + results[13][18]="7.787719370405676E+26"; + results[13][19]="658921.8903956439"; + results[13][20]="2.635425487645780E+22"; + results[13][21]="12.28562467072543"; + results[13][22]="1.514051418639709E+17"; + results[13][23]="0.0001346514255384665"; + results[13][24]="801974618079.9959"; + results[13][25]="802829983557.8030"; + results[13][26]="2.150358457868733E+36"; + results[13][27]="9359222.141139671"; + results[13][28]="3.316335630112216E+31"; + results[13][29]="159.7634472393744"; + results[13][30]="7.474098252740968E+25"; + results[13][31]="0.001949331935575389"; + results[13][32]="1.519523412539414E+21"; + results[13][33]="8.387705361793504E-9"; + results[13][34]="4.019985772375435E+16"; + results[13][35]="98681618.62029944"; + results[13][36]="2.079400011019663E+40"; + results[13][37]="834.9243013119425"; + results[13][38]="1.017671886652243E+35"; + results[13][39]="0.008898609113474424"; + results[13][40]="1.845128768291237E+30"; + results[13][41]="1.424652144129865E-7"; + results[13][42]="6.663448147624991E+24"; + results[13][43]="2.570023549681410E-12"; + results[13][44]="1.750434833681448E+20"; + results[13][45]="22542.99434273927"; + results[13][46]="1.227373549011834E+44"; + results[13][47]="0.08194957555923548"; + results[13][48]="1.016338644850434E+39"; + results[13][49]="0.000003470618477439216"; + results[13][50]="3.425208032911223E+34"; + results[13][51]="8.638664992924948E-12"; + results[13][52]="6.137571821893155E+29"; + results[13][53]="1.799438541324536E-16"; + results[13][54]="2.502971061357505E+24"; + results[13][55]="0.9113611218809168"; + results[13][56]="1.052025928012465E+48"; + results[13][57]="0.000009141059651419642"; + results[13][58]="8.408707817004228E+42"; + results[13][59]="1.793616122236614E-10"; + results[13][60]="4.343228206344449E+38"; + results[13][61]="8.291334356927543E-16"; + results[13][62]="3.105155697929257E+33"; + results[13][63]="7.052087393973718E-21"; + results[13][64]="3.244552069097433E+28"; + results[13][65]="0.00007651278396420666"; + results[13][66]="6.821197513193451E+51"; + results[13][67]="2.469842502673314E-9"; + results[13][68]="1.455203681008597E+47"; + results[13][69]="1.096987137663585E-14"; + results[13][70]="1.068452442788232E+42"; + results[13][71]="6.704008120546416E-20"; + results[13][72]="2.604177820839036E+37"; + results[13][73]="1.270336654341115E-24"; + results[13][74]="7.273165900503936E+31"; + results[14][0]="7.283624788019671E+16"; + results[14][1]="160158248389.6609"; + results[14][2]="3593433.877438394"; + results[14][3]="41.90335840753915"; + results[14][4]="0.0002924721266406031"; + results[14][5]="912494889345.1759"; + results[14][6]="5.670737930617694E+20"; + results[14][7]="8750769.077266332"; + results[14][8]="835973594359440.8"; + results[14][9]="81.56967263194704"; + results[14][10]="29769366389.07392"; + results[14][11]="0.0009884734930986993"; + results[14][12]="132725.0922501232"; + results[14][13]="1.243666799042916E-8"; + results[14][14]="1"; + results[14][15]="107424627.6871908"; + results[14][16]="1.234094754760663E+24"; + results[14][17]="1271.404766631212"; + results[14][18]="9.685328021236938E+18"; + results[14][19]="0.008194792782476575"; + results[14][20]="327759118033654.3"; + results[14][21]="1.527922350848377E-7"; + results[14][22]="1882975481.406032"; + results[14][23]="1.674615073859902E-12"; + results[14][24]="9973.892061812134"; + results[14][25]="9984.529958270096"; + results[14][26]="2.674329420092467E+28"; + results[14][27]="0.1163975384180276"; + results[14][28]="4.124416517653632E+23"; + results[14][29]="0.000001986924950322545"; + results[14][30]="9.295287849718610E+17"; + results[14][31]="2.424319408589176E-11"; + results[14][32]="18897808185436.61"; + results[14][33]="1.043151067861683E-16"; + results[14][34]="499952283.7728221"; + results[14][35]="1.227270527538816"; + results[14][36]="2.586080755634628E+32"; + results[14][37]="0.00001038367633255766"; + results[14][38]="1.265644737748760E+27"; + results[14][39]="1.106690471208886E-10"; + results[14][40]="2.294725389082761E+22"; + results[14][41]="1.771792571839617E-15"; + results[14][42]="8.287109228345220E+16"; + results[14][43]="3.196252961497192E-20"; + results[14][44]="2176957686537.825"; + results[14][45]="0.0002803597361507711"; + results[14][46]="1.526443732929490E+36"; + results[14][47]="1.019179663186800E-9"; + results[14][48]="1.263986629184754E+31"; + results[14][49]="4.316292972536028E-14"; + results[14][50]="4.259817510346784E+26"; + results[14][51]="1.074362083975506E-19"; + results[14][52]="7.633094301629857E+21"; + results[14][53]="2.237901970763539E-24"; + results[14][54]="3.112862007975538E+16"; + results[14][55]="1.133429569221800E-8"; + results[14][56]="1.308369718401416E+40"; + results[14][57]="1.136843239654142E-13"; + results[14][58]="1.045763073486079E+35"; + results[14][59]="2.230660821453777E-18"; + results[14][60]="5.401528720897306E+30"; + results[14][61]="1.031165725947463E-23"; + results[14][62]="3.861779047373550E+25"; + results[14][63]="8.770446955834192E-29"; + results[14][64]="4.035141686102474E+20"; + results[14][65]="9.515640911862703E-13"; + results[14][66]="8.483296876872797E+43"; + results[14][67]="3.071661119439865E-17"; + results[14][68]="1.809788503915430E+39"; + results[14][69]="1.364286482089321E-22"; + results[14][70]="1.328798829452025E+34"; + results[14][71]="8.337552320037675E-28"; + results[14][72]="3.238729494581439E+29"; + results[14][73]="1.579875520611302E-32"; + results[14][74]="9.045394954387817E+23"; + results[15][0]="678021878.6728144"; + results[15][1]="1490.889490034119"; + results[15][2]="0.03345074546501661"; + results[15][3]="3.900721772064906E-7"; + results[15][4]="2.722579849122226E-12"; + results[15][5]="8494.280212934647"; + results[15][6]="5278806222284.789"; + results[15][7]="0.08145961746078984"; + results[15][8]="7781954.774781330"; + results[15][9]="7.593200403679254E-7"; + results[15][10]="277.1186368526144"; + results[15][11]="9.201553818525026E-12"; + results[15][12]="0.001235518289498798"; + results[15][13]="1.157711062927156E-16"; + results[15][14]="9.308852369606484E-9"; + results[15][15]="1"; + results[15][16]="1.148800588217273E+16"; + results[15][17]="0.00001183531927458393"; + results[15][18]="90159288700.90755"; + results[15][19]="7.628411621159118E-11"; + results[15][20]="3051061.242567714"; + results[15][21]="1.422320359626963E-15"; + results[15][22]="17.52834077199745"; + results[15][23]="1.558874449847949E-20"; + results[15][24]="0.00009284548875379919"; + results[15][25]="0.00009294451536144952"; + results[15][26]="2.489493775933610E+20"; + results[15][27]="1.083527501319018E-9"; + results[15][28]="3839358447360413"; + results[15][29]="1.849599103204027E-14"; + results[15][30]="8652846232.602745"; + results[15][31]="2.256763147132834E-19"; + results[15][32]="175916.9065073704"; + results[15][33]="9.710539289921761E-25"; + results[15][34]="4.653982001488808"; + results[15][35]="1.142448015842791E-8"; + results[15][36]="2.407344397008314E+24"; + results[15][37]="9.666011003355619E-14"; + results[15][38]="1.178170001607253E+19"; + results[15][39]="1.030201821533375E-18"; + results[15][40]="213612598757592.2"; + results[15][41]="1.649335548082038E-23"; + results[15][42]="771434763.7746916"; + results[15][43]="2.975344695449488E-28"; + results[15][44]="20264.97771886068"; + results[15][45]="2.609827394209354E-12"; + results[15][46]="1.420943936035166E+28"; + results[15][47]="9.487393022711177E-18"; + results[15][48]="1.176626492823741E+23"; + results[15][49]="4.017973406530782E-22"; + results[15][50]="3.965401232528285E+18"; + results[15][51]="1.000107803123075E-27"; + results[15][52]="71055347977156.85"; + results[15][53]="2.083229906348919E-32"; + results[15][54]="289771728.7920109"; + results[15][55]="1.055092853123241E-16"; + results[15][56]="1.217942055346239E+32"; + results[15][57]="1.058270588532557E-21"; + results[15][58]="9.734854064667849E+26"; + results[15][59]="2.076489227357834E-26"; + results[15][60]="5.028203343302236E+22"; + results[15][61]="9.598969511443032E-32"; + results[15][62]="3.594873103603994E+17"; + results[15][63]="8.164279592732510E-37"; + results[15][64]="3756253824637.292"; + results[15][65]="8.857969645071753E-21"; + results[15][66]="7.896975823435262E+35"; + results[15][67]="2.859363989032589E-25"; + results[15][68]="1.684705400315972E+31"; + results[15][69]="1.269994145161927E-30"; + results[15][70]="1.236959213227480E+26"; + results[15][71]="7.761304367110075E-36"; + results[15][72]="3.014885473014884E+21"; + results[15][73]="1.470682798372580E-40"; + results[15][74]="8420224625517956"; + results[16][0]="5.901998011029744E-8"; + results[16][1]="1.297779184068582E-13"; + results[16][2]="2.911797383123386E-18"; + results[16][3]="3.395473341564099E-23"; + results[16][4]="2.369932499205253E-28"; + results[16][5]="7.394042360403217E-13"; + results[16][6]="0.0004595058773843880"; + results[16][7]="7.090840507594115E-18"; + results[16][8]="6.773982233816134E-10"; + results[16][9]="6.609676632793603E-23"; + results[16][10]="2.412243166437193E-14"; + results[16][11]="8.009705002679486E-28"; + results[16][12]="1.075485425556837E-19"; + results[16][13]="1.007756328470993E-32"; + results[16][14]="8.103105504195564E-25"; + results[16][15]="8.704730918982346E-17"; + results[16][16]="1"; + results[16][17]="1.030232696254985E-21"; + results[16][18]="0.000007848123479882456"; + results[16][19]="6.640327050142802E-27"; + results[16][20]="2.655866713388787E-10"; + results[16][21]="1.238091601114291E-31"; + results[16][22]="1.525794898764651E-15"; + results[16][23]="1.356958262240303E-36"; + results[16][24]="8.081949966432234E-21"; + results[16][25]="8.090569966166392E-21"; + results[16][26]="21670.37344398340"; + results[16][27]="9.431815342299341E-26"; + results[16][28]="0.3342058218579424"; + results[16][29]="1.610026250138211E-30"; + results[16][30]="7.532069813813702E-7"; + results[16][31]="1.964451594366708E-35"; + results[16][32]="1.531309335246434E-11"; + results[16][33]="8.452763159697483E-41"; + results[16][34]="4.051166102474697E-16"; + results[16][35]="9.944702566836774E-25"; + results[16][36]="209552852.0527718"; + results[16][37]="8.414002484413322E-30"; + results[16][38]="1025.565284080813"; + results[16][39]="8.967629648693503E-35"; + results[16][40]="0.01859440193089382"; + results[16][41]="1.435702214116641E-39"; + results[16][42]="6.715132040207400E-8"; + results[16][43]="2.589957496510927E-44"; + results[16][44]="1.764011781218549E-12"; + results[16][45]="2.271784521158129E-28"; + results[16][46]="1236893461414.578"; + results[16][47]="8.258520338533136E-34"; + results[16][48]="10242217.01217658"; + results[16][49]="3.497537734347732E-38"; + results[16][50]="345.1775071495967"; + results[16][51]="8.705669316160942E-44"; + results[16][52]="0.006185176844958069"; + results[16][53]="1.813395577714413E-48"; + results[16][54]="2.522384927062784E-8"; + results[16][55]="9.184299380979178E-33"; + results[16][56]="1.060185786670131E+16"; + results[16][57]="9.211960712648993E-38"; + results[16][58]="84739285168.49519"; + results[16][59]="1.807527998031550E-42"; + results[16][60]="4376915.710937338"; + results[16][61]="8.355644669662702E-48"; + results[16][62]="31.29240305475972"; + results[16][63]="7.106785700207527E-53"; + results[16][64]="0.0003269717880686592"; + results[16][65]="7.710624224886317E-37"; + results[16][66]="6.874104961671300E+19"; + results[16][67]="2.488999412395668E-41"; + results[16][68]="1466490718750697"; + results[16][69]="1.105495730231758E-46"; + results[16][70]="10767397108.90133"; + results[16][71]="6.756006609601578E-52"; + results[16][72]="262437.6679414338"; + results[16][73]="1.280189802700927E-56"; + results[16][74]="0.7329578964252270"; + results[17][0]="57288009131181.63"; + results[17][1]="125969520.1662847"; + results[17][2]="2826.349225478968"; + results[17][3]="0.03295831469829135"; + results[17][4]="2.300385638914618E-7"; + results[17][5]="717706047.1174538"; + results[17][6]="4.460214464700500E+17"; + results[17][7]="6882.756229121966"; + results[17][8]="657519632063.7410"; + results[17][9]="0.06415712350055034"; + results[17][10]="23414546.78351770"; + results[17][11]="7.774656183788081E-7"; + results[17][12]="104.3924765216976"; + results[17][13]="9.781832125249994E-12"; + results[17][14]="0.0007865315800645127"; + results[17][15]="84492.86215264814"; + results[17][16]="9.706544974112313E+20"; + results[17][17]="1"; + results[17][18]="7617816351986589"; + results[17][19]="0.000006445463315502565"; + results[17][20]="257792896987.5612"; + results[17][21]="1.201759180828659E-10"; + results[17][22]="1481019.680613023"; + results[17][23]="1.317137640042879E-15"; + results[17][24]="7.844781082769998"; + results[17][25]="7.853148124279642"; + results[17][26]="2.103444544398340E+25"; + results[17][27]="0.00009155033980755107"; + results[17][28]="3.243983840474286E+20"; + results[17][29]="1.562779220646795E-9"; + results[17][30]="731103743959364.5"; + results[17][31]="1.906803775018709E-14"; + results[17][32]="14863722931.84754"; + results[17][33]="8.204712576512332E-20"; + results[17][34]="393228.2597126994"; + results[17][35]="0.0009652870271917130"; + results[17][36]="2.034034182903733E+29"; + results[17][37]="8.167089352725064E-9"; + results[17][38]="9.954695553818683E+23"; + results[17][39]="8.704470049622648E-14"; + results[17][40]="1.804873986089417E+19"; + results[17][41]="1.393570811075580E-18"; + results[17][42]="65180731155375.70"; + results[17][43]="2.513953892092264E-23"; + results[17][44]="1712245968.926182"; + results[17][45]="2.205117862611359E-7"; + results[17][46]="1.200596201140605E+33"; + results[17][47]="8.016169908559313E-13"; + results[17][48]="9.941654006331020E+27"; + results[17][49]="3.394900731710114E-17"; + results[17][50]="3.350480997199534E+23"; + results[17][51]="8.450197074706576E-23"; + results[17][52]="6.003669721842360E+18"; + results[17][53]="1.760180573094133E-27"; + results[17][54]="24483642736557.92"; + results[17][55]="8.914781499718627E-12"; + results[17][56]="1.029074101922827E+37"; + results[17][57]="8.941631095708316E-17"; + results[17][58]="8.225256825621270E+31"; + results[17][59]="1.754485180486043E-21"; + results[17][60]="4.248472919611204E+27"; + results[17][61]="8.110444077378283E-27"; + results[17][62]="3.037411175990747E+22"; + results[17][63]="6.898233502044262E-32"; + results[17][64]="3.173766366154361E+17"; + results[17][65]="7.484352081733892E-16"; + results[17][66]="6.672380896723107E+40"; + results[17][67]="2.415958473695767E-20"; + results[17][68]="1.423455811567193E+36"; + results[17][69]="1.073054402418369E-25"; + results[17][70]="1.045142242916776E+31"; + results[17][71]="6.557748200149776E-31"; + results[17][72]="2.547363026774680E+26"; + results[17][73]="1.242621989531652E-35"; + results[17][74]="7.114488785782220E+20"; + results[18][0]="0.007520266502124582"; + results[18][1]="1.653617183005917E-8"; + results[18][2]="3.710182938109170E-13"; + results[18][3]="4.326477979440449E-18"; + results[18][4]="3.019744153210938E-23"; + results[18][5]="9.421414404802356E-8"; + results[18][6]="58.54977671570353"; + results[18][7]="9.035077653620603E-13"; + results[18][8]="0.00008631340028199442"; + results[18][9]="8.421983483996608E-18"; + results[18][10]="3.073655979828342E-9"; + results[18][11]="1.020588555112725E-22"; + results[18][12]="1.370372711787334E-14"; + results[18][13]="1.284072977513965E-27"; + results[18][14]="1.032489553071727E-19"; + results[18][15]="1.109148058296442E-11"; + results[18][16]="127418.9941790999"; + results[18][17]="1.312712139272323E-16"; + results[18][18]="1"; + results[18][19]="8.461037937494653E-22"; + results[18][20]="0.00003384078652937511"; + results[18][21]="1.577563865155743E-26"; + results[18][22]="1.944152513241934E-10"; + results[18][23]="1.729022569176787E-31"; + results[18][24]="1.029793935728606E-15"; + results[18][25]="1.030892287424556E-15"; + results[18][26]="2761217187.717842"; + results[18][27]="1.201792424198785E-20"; + results[18][28]="42584.16966993846"; + results[18][29]="2.051479253945588E-25"; + results[18][30]="0.09597287597629022"; + results[18][31]="2.503084462677351E-30"; + results[18][32]="0.000001951178952741667"; + results[18][33]="1.077042579842804E-35"; + results[18][34]="5.161955100297903E-11"; + results[18][35]="1.267143998476655E-19"; + results[18][36]="26701013635925.91"; + results[18][37]="1.072103733584393E-24"; + results[18][38]="130676496.9625801"; + results[18][39]="1.142646350007201E-29"; + results[18][40]="2369.279991396404"; + results[18][41]="1.829357320634491E-34"; + results[18][42]="0.008556353703430740"; + results[18][43]="3.300097791720419E-39"; + results[18][44]="2.247686068829500E-7"; + results[18][45]="2.894684986776169E-23"; + results[18][46]="1.576037207601508E+17"; + results[18][47]="1.052292354943532E-28"; + results[18][48]="1305052989855.606"; + results[18][49]="4.456527402140359E-33"; + results[18][50]="43982170.77425067"; + results[18][51]="1.109267627921080E-38"; + results[18][52]="788.1090124044157"; + results[18][53]="2.310610405611983E-43"; + results[18][54]="0.003213997503388622"; + results[18][55]="1.170254189364097E-27"; + results[18][56]="1.350878065804859E+21"; + results[18][57]="1.173778768423119E-32"; + results[18][58]="1.079739448362558E+16"; + results[18][59]="2.303133994597421E-37"; + results[18][60]="557702197494.3356"; + results[18][61]="1.064667839526379E-42"; + results[18][62]="3987246.522684476"; + results[18][63]="9.055394857668533E-48"; + results[18][64]="41.66241636065038"; + results[18][65]="9.824799832280163E-32"; + results[18][66]="8.758915400977171E+24"; + results[18][67]="3.171458016398266E-36"; + results[18][68]="1.868587723561991E+20"; + results[18][69]="1.408611540154202E-41"; + results[18][70]="1371970909543155"; + results[18][71]="8.608435668627840E-47"; + results[18][72]="33439543683.80610"; + results[18][73]="1.631204970184925E-51"; + results[18][74]="93392.75793813131"; + results[19][0]="8.888113441495055E+18"; + results[19][1]="19543904603925.69"; + results[19][2]="438502104.0583787"; + results[19][3]="5113.412812236528"; + results[19][4]="0.03568999661175253"; + results[19][5]="111350575123317.2"; + results[19][6]="6.919928399829436E+22"; + results[19][7]="1067845070.589050"; + results[19][8]="1.020127801336300E+17"; + results[19][9]="9953.842006398556"; + results[19][10]="3632717407172.463"; + results[19][11]="0.1206221462014772"; + results[19][12]="16196271.92208414"; + results[19][13]="0.000001517630563767670"; + results[19][14]="122.0287109807536"; + results[19][15]="13108888844.25527"; + results[19][16]="1.505949921515530E+26"; + results[19][17]="155147.8848067927"; + results[19][18]="1.181888093857317E+21"; + results[19][19]="1"; + results[19][20]="3.999602268583552E+16"; + results[19][21]="0.00001864503949527103"; + results[19][22]="229777070804.3422"; + results[19][23]="2.043511188520634E-10"; + results[19][24]="1217101.191764106"; + results[19][25]="1218399.320556418"; + results[19][26]="3.263449718717902E+30"; + results[19][27]="14.20384157448466"; + results[19][28]="5.032972311970014E+25"; + results[19][29]="0.0002424618905033581"; + results[19][30]="1.134291994496223E+20"; + results[19][31]="2.958365724357601E-9"; + results[19][32]="2306075173230364"; + results[19][33]="1.272943801693578E-14"; + results[19][34]="61008532740.68144"; + results[19][35]="149.7622405002312"; + results[19][36]="3.155761011022271E+34"; + results[19][37]="0.001267106638103371"; + results[19][38]="1.544449959070552E+29"; + results[19][39]="1.350480116563032E-8"; + results[19][40]="2.800223812845777E+24"; + results[19][41]="2.162095636668628E-13"; + results[19][42]="1.011265256891675E+19"; + results[19][43]="3.900346288599187E-18"; + results[19][44]="265651340347854.4"; + results[19][45]="0.03421193721338280"; + results[19][46]="1.862699611140355E+38"; + results[19][47]="1.243691805564838E-7"; + results[19][48]="1.542426590563234E+33"; + results[19][49]="5.267116676538570E-12"; + results[19][50]="5.198200398008612E+28"; + results[19][51]="1.311030202341272E-17"; + results[19][52]="9.314566584224275E+23"; + results[19][53]="2.730882927935629E-22"; + results[19][54]="3.798585382942154E+18"; + results[19][55]="0.000001383109493196072"; + results[19][56]="1.596586702227764E+42"; + results[19][57]="1.387275151221789E-11"; + results[19][58]="1.276131198487774E+37"; + results[19][59]="2.722046646772734E-16"; + results[19][60]="6.591415871366172E+32"; + results[19][61]="1.258318243449020E-21"; + results[19][62]="4.712479192434771E+27"; + results[19][63]="1.070246336745521E-26"; + results[19][64]="4.924031385797897E+22"; + results[19][65]="1.161181394630329E-10"; + results[19][66]="1.035205782751841E+46"; + results[19][67]="3.748308469749455E-15"; + results[19][68]="2.208461582805865E+41"; + results[19][69]="1.664821208178269E-20"; + results[19][70]="1.621516083107649E+36"; + results[19][71]="1.017420762348790E-25"; + results[19][72]="3.952179854391208E+31"; + results[19][73]="1.927901732902443E-30"; + results[19][74]="1.103797886595758E+26"; + results[20][0]="222.2249324966694"; + results[20][1]="0.0004886462025847162"; + results[20][2]="1.096364274774934E-8"; + results[20][3]="1.278480326006873E-13"; + results[20][4]="8.923386430719285E-19"; + results[20][5]="0.002784041203245736"; + results[20][6]="1730154.134120969"; + results[20][7]="2.669878150077217E-8"; + results[20][8]="2.550573114105107"; + results[20][9]="2.488707960935246E-13"; + results[20][10]="0.00009082696636380747"; + results[20][11]="3.015853529960997E-18"; + results[20][12]="4.049470630943514E-10"; + results[20][13]="3.794453702780639E-23"; + results[20][14]="3.051021146259370E-15"; + results[20][15]="3.277548107026588E-7"; + results[20][16]="3765249193.262553"; + results[20][17]="3.879082828446787E-12"; + results[20][18]="29550.14060125232"; + results[20][19]="2.500248606854969E-17"; + results[20][20]="1"; + results[20][21]="4.661723402280728E-22"; + results[20][22]="0.000005744998011657722"; + results[20][23]="5.109286002191258E-27"; + results[20][24]="3.043055559109729E-11"; + results[20][25]="3.046301203814225E-11"; + results[20][26]="81594356127656.76"; + results[20][27]="3.551313510859396E-16"; + results[20][28]="1258368201.134266"; + results[20][29]="6.062150039464433E-21"; + results[20][30]="2836.011979005927"; + results[20][31]="7.396649780892585E-26"; + results[20][32]="0.05765761239172050"; + results[20][33]="3.182675966789038E-31"; + results[20][34]="0.000001525364989911545"; + results[20][35]="3.744428331701820E-15"; + results[20][36]="7.890187071375662E+17"; + results[20][37]="3.168081606654638E-20"; + results[20][38]="3861508858523.363"; + results[20][39]="3.376536030022057E-25"; + results[20][40]="70012556.86949763"; + results[20][41]="5.405776603467944E-30"; + results[20][42]="252.8414549704244"; + results[20][43]="9.751835374322068E-35"; + results[20][44]="0.006641943936138782"; + results[20][45]="8.553834835557002E-19"; + results[20][46]="4.657212107742966E+21"; + results[20][47]="3.109538704220428E-24"; + results[20][48]="3.856449934231786E+16"; + results[20][49]="1.316910113265814E-28"; + results[20][50]="1299679330327.398"; + results[20][51]="3.277901436948555E-34"; + results[20][52]="23288732.12566459"; + results[20][53]="6.827886236055077E-39"; + results[20][54]="94.97407811720772"; + results[20][55]="3.458117583491362E-23"; + results[20][56]="3.991863677968137E+25"; + results[20][57]="3.468532764166796E-28"; + results[20][58]="3.190645251183220E+20"; + results[20][59]="6.805793336387770E-33"; + results[20][60]="1.648017834958501E+16"; + results[20][61]="3.146108435163604E-38"; + results[20][62]="117823695357.1807"; + results[20][63]="2.675881912439624E-43"; + results[20][64]="1231130.261245134"; + results[20][65]="2.903242164230390E-27"; + results[20][66]="2.588271816133498E+29"; + results[20][67]="9.371703029553756E-32"; + results[20][68]="5.521702995703085E+24"; + results[20][69]="4.162466906410325E-37"; + results[20][70]="4.054193327782826E+19"; + results[20][71]="2.543804843647882E-42"; + results[20][72]="988143217498189.4"; + results[20][73]="4.820233621842614E-47"; + results[20][74]="2759769128.210504"; + results[21][0]="4.767012396916274E+23"; + results[21][1]="1.048209343234839E+18"; + results[21][2]="23518432565916.35"; + results[21][3]="274250575.5235032"; + results[21][4]="1914.181872385126"; + results[21][5]="5.972128680744241E+18"; + results[21][6]="3.711404527506926E+27"; + results[21][7]="57272341571595.42"; + results[21][8]="5.471309415005725E+21"; + results[21][9]="533860065.5108917"; + results[21][10]="1.948355973230217E+17"; + results[21][11]="6469.396121798011"; + results[21][12]="868663857010.9776"; + results[21][13]="0.08139594255901624"; + results[21][14]="6544835.210014115"; + results[21][15]="703076485709783.2"; + results[21][16]="8.076946803451319E+30"; + results[21][17]="8321134682.827734"; + results[21][18]="6.338887585392785E+25"; + results[21][19]="53633.56834152223"; + results[21][20]="2.145129416109833E+21"; + results[21][21]="1"; + results[21][22]="1.232376423029948E+16"; + results[21][23]="0.00001096007969861868"; + results[21][24]="65277479947.02833"; + results[21][25]="65347103226.32689"; + results[21][26]="1.750304535179781E+35"; + results[21][27]="761802.7077972777"; + results[21][28]="2.699362644550329E+30"; + results[21][29]="13.00409637452654"; + results[21][30]="6.083612720605475E+24"; + results[21][31]="0.0001586677102565503"; + results[21][32]="1.236830404041385E+20"; + results[21][33]="6.827251838304966E-10"; + results[21][34]="3272105310163334"; + results[21][35]="8032283.360848641"; + results[21][36]="1.692547238541742E+39"; + results[21][37]="67.95945047071364"; + results[21][38]="8.283436242987168E+33"; + results[21][39]="0.0007243106762555027"; + results[21][40]="1.501859952378219E+29"; + results[21][41]="1.159609040901739E-8"; + results[21][42]="5.423776426690670E+23"; + results[21][43]="2.091894892251871E-13"; + results[21][44]="1.424782931756363E+19"; + results[21][45]="1834.908272629834"; + results[21][46]="9.990322689382312E+42"; + results[21][47]="0.006670362944955292"; + results[21][48]="8.272584195675434E+37"; + results[21][49]="2.824942622339028E-7"; + results[21][50]="2.787980362995230E+33"; + results[21][51]="7.031522795507035E-13"; + results[21][52]="4.995734434666519E+28"; + results[21][53]="1.464669961481319E-17"; + results[21][54]="2.037316887371354E+23"; + results[21][55]="0.07418109752713971"; + results[21][56]="8.563064200709839E+46"; + results[21][57]="7.440451663154942E-7"; + results[21][58]="6.844346984684270E+41"; + results[21][59]="1.459930748584969E-11"; + results[21][60]="3.535211536043119E+37"; + results[21][61]="6.748809750540721E-17"; + results[21][62]="2.527470748254518E+32"; + results[21][63]="5.740113004410473E-22"; + results[21][64]="2.640933738459919E+27"; + results[21][65]="0.000006227830168580984"; + results[21][66]="5.552178009675986E+50"; + results[21][67]="2.010351584774140E-10"; + results[21][68]="1.184476752310447E+46"; + results[21][69]="8.929030204524482E-16"; + results[21][70]="8.696769366023154E+40"; + results[21][71]="5.456790598951745E-21"; + results[21][72]="2.119695083184782E+36"; + results[21][73]="1.034002493473623E-25"; + results[21][74]="5.920061938596140E+30"; + results[22][0]="38681463.77870482"; + results[22][1]="85.05593937424482"; + results[22][2]="0.001908380599175486"; + results[22][3]="2.225379927743381E-8"; + results[22][4]="1.553244476779973E-13"; + results[22][5]="484.6026400002877"; + results[22][6]="301158352119.5565"; + results[22][7]="0.004647309093335652"; + results[22][8]="443964.1421858626"; + results[22][9]="4.331956174545530E-8"; + results[22][10]="15.80974722349805"; + results[22][11]="5.249529284155089E-13"; + results[22][12]="0.00007048689351547812"; + results[22][13]="6.604795502245522E-18"; + results[22][14]="5.310743606992122E-10"; + results[22][15]="0.05705046547232572"; + results[22][16]="655396082926770.0"; + results[22][17]="6.752104736286019E-7"; + results[22][18]="5143629387.040573"; + results[22][19]="4.352044338016266E-12"; + results[22][20]="174064.4640730606"; + results[22][21]="8.114403856748394E-17"; + results[22][22]="1"; + results[22][23]="8.893451297674116E-22"; + results[22][24]="0.000005296878350409827"; + results[22][25]="0.000005302527864470423"; + results[22][26]="1.420267787074702E+19"; + results[22][27]="6.181574830231600E-11"; + results[22][28]="219037186537017.3"; + results[22][29]="1.055204897749860E-15"; + results[22][30]="493648905.2304466"; + results[22][31]="1.287493880047189E-20"; + results[22][32]="10036.14140069709"; + results[22][33]="5.539907864773438E-26"; + results[22][34]="0.2655118394847626"; + results[22][35]="6.517719108176616E-10"; + results[22][36]="1.373401184015196E+23"; + results[22][37]="5.514504270020602E-15"; + results[22][38]="6.721514699722450E+17"; + results[22][39]="5.877349344891688E-20"; + results[22][40]="12186698189873.78"; + results[22][41]="9.409536073813374E-25"; + results[22][42]="44010712.35487979"; + results[22][43]="1.697447998160085E-29"; + results[22][44]="1156.126411647312"; + results[22][45]="1.488918676420706E-13"; + results[22][46]="8.106551296088482E+26"; + results[22][47]="5.412601880645680E-19"; + results[22][48]="6.712708910266456E+21"; + results[22][49]="2.292272530980073E-23"; + results[22][50]="2.262279861002728E+17"; + results[22][51]="5.705661569067654E-29"; + results[22][52]="4053740676394.876"; + results[22][53]="1.188492358430754E-33"; + results[22][54]="16531612.00830475"; + results[22][55]="6.019353838720512E-18"; + results[22][56]="6.948416117582402E+30"; + results[22][57]="6.037482967145447E-23"; + results[22][58]="5.553779556944628E+25"; + results[22][59]="1.184646769690344E-27"; + results[22][60]="2.868613412248970E+21"; + results[22][61]="5.476256786824880E-33"; + results[22][62]="2.050891838745521E+16"; + results[22][63]="4.657759510115996E-38"; + results[22][64]="214296029127.7612"; + results[22][65]="5.053512913910754E-22"; + results[22][66]="4.505261465506844E+34"; + results[22][67]="1.631280465291153E-26"; + results[22][68]="9.611322727176706E+29"; + results[22][69]="7.245375712861636E-32"; + results[22][70]="7.056909888490957E+24"; + results[22][71]="4.427860268160242E-37"; + results[22][72]="1.720006195812521E+20"; + results[22][73]="8.390313820929822E-42"; + results[22][74]="480377734267339.0"; + results[23][0]="4.349432237720928E+28"; + results[23][1]="9.563884315247705E+22"; + results[23][2]="2.145826783438484E+18"; + results[23][3]="25022680771022.83"; + results[23][4]="174650360.6745100"; + results[23][5]="5.448982895167197E+23"; + results[23][6]="3.386293375197521E+32"; + results[23][7]="5.225540611608288E+18"; + results[23][8]="4.992034333194938E+26"; + results[23][9]="48709505787460.23"; + results[23][10]="1.777684128953709E+22"; + results[23][11]="590269076.4751797"; + results[23][12]="7.925707484777299E+16"; + results[23][13]="7426.583090383436"; + results[23][14]="597152154909.8750"; + results[23][15]="6.414884791379698E+19"; + results[23][16]="7.369423421683034E+35"; + results[23][17]="759222096156514.8"; + results[23][18]="5.783614498890633E+30"; + results[23][19]="4893538169.095777"; + results[23][20]="1.957220636251567E+26"; + results[23][21]="91240.21243440706"; + results[23][22]="1.124422866364071E+21"; + results[23][23]="1"; + results[23][24]="5955931137549612"; + results[23][25]="5962283580343192"; + results[23][26]="1.596981576147093E+40"; + results[23][27]="69507040892.53014"; + results[23][28]="2.462904211262749E+35"; + results[23][29]="1186496.515729304"; + results[23][30]="5.550701169967046E+29"; + results[23][31]="14.47687559028860"; + results[23][32]="1.128486688100694E+25"; + results[23][33]="0.00006229199080701412"; + results[23][34]="2.985475836070540E+20"; + results[23][35]="732867240177.1831"; + results[23][36]="1.544283695998176E+44"; + results[23][37]="6200634.697873477"; + results[23][38]="7.557824824970159E+38"; + results[23][39]="66.08625997006110"; + results[23][40]="1.370300211017172E+34"; + results[23][41]="0.001058029752327336"; + results[23][42]="4.948665133679859E+28"; + results[23][43]="1.908649343595118E-8"; + results[23][44]="1.299974973663679E+24"; + results[23][45]="167417420.5923969"; + results[23][46]="9.115191644675190E+47"; + results[23][47]="608.6053321123179"; + results[23][48]="7.547923393949451E+42"; + results[23][49]="0.02577483649772239"; + results[23][50]="2.543759205826400E+38"; + results[23][51]="6.415576335994377E-8"; + results[23][52]="4.558118710848557E+33"; + results[23][53]="1.336367984318503E-12"; + results[23][54]="1.858852255999673E+28"; + results[23][55]="6768.299096993695"; + results[23][56]="7.812957967622318E+51"; + results[23][57]="0.06788683903541942"; + results[23][58]="6.244796728573862E+46"; + results[23][59]="0.000001332043916404155"; + results[23][60]="3.225534515491407E+42"; + results[23][61]="6.157628353187331E-12"; + results[23][62]="2.306069679924920E+37"; + results[23][63]="5.237291299199141E-17"; + results[23][64]="2.409593553222759E+32"; + results[23][65]="0.5682285475867381"; + results[23][66]="5.065819010764803E+55"; + results[23][67]="0.00001834249056626394"; + results[23][68]="1.080719105044218E+51"; + results[23][69]="8.146866126940509E-11"; + results[23][70]="7.934950844489962E+45"; + results[23][71]="4.978787334584325E-16"; + results[23][72]="1.934014296859477E+41"; + results[23][73]="9.434260716223996E-21"; + results[23][74]="5.401477089023595E+35"; + results[24][0]="7302690607518.291"; + results[24][1]="16057748.30899485"; + results[24][2]="360.2840150232697"; + results[24][3]="0.004201304580784266"; + results[24][4]="2.932377098408908E-8"; + results[24][5]="91488346.14311905"; + results[24][6]="5.685581812469896E+16"; + results[24][7]="877.3675334597941"; + results[24][8]="83816186216.83326"; + results[24][9]="0.008178319168327438"; + results[24][10]="2984729.151326427"; + results[24][11]="9.910609488981233E-8"; + results[24][12]="13.30725171553627"; + results[24][13]="1.246922255961287E-12"; + results[24][14]="0.0001002617627905542"; + results[24][15]="10770.58253903672"; + results[24][16]="1.237325155628808E+20"; + results[24][17]="0.1274732831227585"; + results[24][18]="971068060613965.9"; + results[24][19]="8.216243700744122E-7"; + results[24][20]="32861706944.73151"; + results[24][21]="1.531921883031460E-11"; + results[24][22]="188790.4410571613"; + results[24][23]="1.678998593008280E-16"; + results[24][24]="1"; + results[24][25]="1.001066574251259"; + results[24][26]="2.681329819411114E+24"; + results[24][27]="0.00001167022238627271"; + results[24][28]="4.135212705424321E+19"; + results[24][29]="1.992125980518727E-10"; + results[24][30]="93196194545840.82"; + results[24][31]="2.430665374725046E-15"; + results[24][32]="1894727561.549639"; + results[24][33]="1.045881649206614E-20"; + results[24][34]="50126.09728222654"; + results[24][35]="0.0001230483065119351"; + results[24][36]="2.592850152786563E+28"; + results[24][37]="1.041085693348789E-9"; + results[24][38]="1.268957724732794E+23"; + results[24][39]="1.109587375069120E-14"; + results[24][40]="2.300732126296780E+18"; + results[24][41]="1.776430465518496E-19"; + results[24][42]="8308801796717.613"; + results[24][43]="3.204619562442379E-24"; + results[24][44]="218265615.1727291"; + results[24][45]="2.810936136197098E-8"; + results[24][46]="1.530439394641047E+32"; + results[24][47]="1.021847496313918E-13"; + results[24][48]="1.267295275857541E+27"; + results[24][49]="4.327591421469434E-18"; + results[24][50]="4.270968127534385E+22"; + results[24][51]="1.077174364147177E-23"; + results[24][52]="7.653074902279439E+17"; + results[24][53]="2.243759965412078E-28"; + results[24][54]="3121010322433.718"; + results[24][55]="1.136396466091162E-12"; + results[24][56]="1.311794543487070E+36"; + results[24][57]="1.139819072242488E-17"; + results[24][58]="1.048500492089822E+31"; + results[24][59]="2.236499861467814E-22"; + results[24][60]="5.415667913209714E+26"; + results[24][61]="1.033864934126942E-27"; + results[24][62]="3.871887747972994E+21"; + results[24][63]="8.793404722529862E-33"; + results[24][64]="4.045704185582832E+16"; + results[24][65]="9.540549319052715E-17"; + results[24][66]="8.505502991508699E+39"; + results[24][67]="3.079701585302480E-21"; + results[24][68]="1.814525856806408E+35"; + results[24][69]="1.367857676455993E-26"; + results[24][70]="1.332277130348850E+30"; + results[24][71]="8.359376929654525E-32"; + results[24][72]="3.247207283284959E+25"; + results[24][73]="1.584011046861337E-36"; + results[24][74]="9.069072432637074E+19"; + results[25][0]="7294910044299.792"; + results[25][1]="16040639.77563644"; + results[25][2]="359.9001547851519"; + results[25][3]="0.004196828351727361"; + results[25][4]="2.929252832762058E-8"; + results[25][5]="91390870.99331748"; + results[25][6]="5.679524178222003E+16"; + results[25][7]="876.4327528526417"; + results[25][8]="83726885276.85887"; + results[25][9]="0.008169605677269126"; + results[25][10]="2981549.107819164"; + results[25][11]="9.900050350191554E-8"; + results[25][12]="13.29307366544463"; + results[25][13]="1.245593737753071E-12"; + results[25][14]="0.0001001549401102962"; + results[25][15]="10759.10715238146"; + results[25][16]="1.236006862534849E+20"; + results[25][17]="0.1273374682578942"; + results[25][18]="970033447915559.5"; + results[25][19]="8.207489803452292E-7"; + results[25][20]="32826694837.26416"; + results[25][21]="1.530289715424023E-11"; + results[25][22]="188589.2965693774"; + results[25][23]="1.677209724302378E-16"; + results[25][24]="0.9989345621173533"; + results[25][25]="1"; + results[25][26]="2.678473029045643E+24"; + results[25][27]="0.00001165778848924346"; + results[25][28]="4.130806893155160E+19"; + results[25][29]="1.990003494032078E-10"; + results[25][30]="93096899789653.17"; + results[25][31]="2.428075651754777E-15"; + results[25][32]="1892708847.028269"; + results[25][33]="1.044767327276784E-20"; + results[25][34]="50072.69103927282"; + results[25][35]="0.0001229172061847818"; + results[25][36]="2.590087632009758E+28"; + results[25][37]="1.039976481212013E-9"; + results[25][38]="1.267605729101387E+23"; + results[25][39]="1.108405178645614E-14"; + results[25][40]="2.298280839131601E+18"; + results[25][41]="1.774537789204645E-19"; + results[25][42]="8299949284523.987"; + results[25][43]="3.201205239361082E-24"; + results[25][44]="218033066.7178449"; + results[25][45]="2.807941258351893E-8"; + results[25][46]="1.528808806532901E+32"; + results[25][47]="1.020758781281058E-13"; + results[25][48]="1.265945051462143E+27"; + results[25][49]="4.322980641628383E-18"; + results[25][50]="4.266417676295733E+22"; + results[25][51]="1.076026701773399E-23"; + results[25][52]="7.644921026359818E+17"; + results[25][53]="2.241369378545362E-28"; + results[25][54]="3117685079804.065"; + results[25][55]="1.135185706246483E-12"; + results[25][56]="1.310396907886189E+36"; + results[25][57]="1.138604665823557E-17"; + results[25][58]="1.047383379945576E+31"; + results[25][59]="2.234117009790872E-22"; + results[25][60]="5.409897855455146E+26"; + results[25][61]="1.032763415260583E-27"; + results[25][62]="3.867762492088947E+21"; + results[25][63]="8.784035896021034E-33"; + results[25][64]="4.041393739081530E+16"; + results[25][65]="9.530384456386937E-17"; + results[25][66]="8.496440906410580E+39"; + results[25][67]="3.076420354566251E-21"; + results[25][68]="1.812592592219525E+35"; + results[25][69]="1.366400309069427E-26"; + results[25][70]="1.330857671823993E+30"; + results[25][71]="8.350470532798348E-32"; + results[25][72]="3.243747585632540E+25"; + results[25][73]="1.582323381485480E-36"; + results[25][74]="9.059409899306875E+19"; + results[26][0]="2.723533134436308E-12"; + results[26][1]="5.988725516997952E-18"; + results[26][2]="1.343676605597132E-22"; + results[26][3]="1.566873478364917E-27"; + results[26][4]="1.093627899552070E-32"; + results[26][5]="3.412051194925813E-17"; + results[26][6]="2.120433589075808E-8"; + results[26][7]="3.272135815251872E-22"; + results[26][8]="3.125918550193178E-14"; + results[26][9]="3.050098167380094E-27"; + results[26][10]="1.113152559494507E-18"; + results[26][11]="3.696154578685082E-32"; + results[26][12]="4.962929819077190E-24"; + results[26][13]="4.650387456755103E-37"; + results[26][14]="3.739255128732137E-29"; + results[26][15]="4.016880900314683E-21"; + results[26][16]="0.00004614595141080237"; + results[26][17]="4.754106794320244E-26"; + results[26][18]="3.621591247686330E-10"; + results[26][19]="3.064242094077263E-31"; + results[26][20]="1.225574963096063E-14"; + results[26][21]="5.713291486714258E-36"; + results[26][22]="7.040925726124371E-20"; + results[26][23]="6.261813003582785E-41"; + results[26][24]="3.729492704555177E-25"; + results[26][25]="3.733470485444113E-25"; + results[26][26]="1"; + results[26][27]="4.352400925014057E-30"; + results[26][28]="0.00001542224561666388"; + results[26][29]="7.429619310899423E-35"; + results[26][30]="3.475745276510183E-11"; + results[26][31]="9.065148782251936E-40"; + results[26][32]="7.066372617918999E-16"; + results[26][33]="3.900607980544203E-45"; + results[26][34]="1.869449141218870E-20"; + results[26][35]="4.589077614441313E-29"; + results[26][36]="9670.015728822264"; + results[26][37]="3.882721498161075E-34"; + results[26][38]="0.04732568576779893"; + results[26][39]="4.138198020386811E-39"; + results[26][40]="8.580563680159561E-7"; + results[26][41]="6.625184461300789E-44"; + results[26][42]="3.098761568445328E-12"; + results[26][43]="1.195160527900366E-48"; + results[26][44]="8.140200194419411E-17"; + results[26][45]="1.048336581291759E-32"; + results[26][46]="57077625.57077626"; + results[26][47]="3.810972782670732E-38"; + results[26][48]="472.6368485827938"; + results[26][49]="1.613972063466582E-42"; + results[26][50]="0.01592854447302717"; + results[26][51]="4.017313932620759E-48"; + results[26][52]="2.854208701546549E-7"; + results[26][53]="8.368086421777320E-53"; + results[26][54]="1.163978522835795E-12"; + results[26][55]="4.238182329769274E-37"; + results[26][56]="489232817981.0316"; + results[26][57]="4.250946914441208E-42"; + results[26][58]="3910374.935971505"; + results[26][59]="8.341009917082876E-47"; + results[26][60]="201.9769397260919"; + results[26][61]="3.855791729321848E-52"; + results[26][62]="0.001444017710892185"; + results[26][63]="3.279493876087616E-57"; + results[26][64]="1.508842424491952E-8"; + results[26][65]="3.558140908285596E-41"; + results[26][66]="3172121135540393"; + results[26][67]="1.148572459459261E-45"; + results[26][68]="67672609451.86232"; + results[26][69]="5.101415225212420E-51"; + results[26][70]="496871.7838081744"; + results[26][71]="3.117623527377340E-56"; + results[26][72]="12.11043587318969"; + results[26][73]="5.907557643204166E-61"; + results[26][74]="0.00003382303947460244"; + results[27][0]="6.257541943766386E+17"; + results[27][1]="1375959067231.062"; + results[27][2]="30872077.93461244"; + results[27][3]="360.0021012218345"; + results[27][4]="0.002512700273696726"; + results[27][5]="7839468959112.017"; + results[27][6]="4.871871010065461E+21"; + results[27][7]="75180018.37666884"; + results[27][8]="7182055614931850"; + results[27][9]="700.7852033691596"; + results[27][10]="255755978980.9374"; + results[27][11]="0.008492219908884301"; + results[27][12]="1140274.047492801"; + results[27][13]="1.068464862698761E-7"; + results[27][14]="8.591246976449121"; + results[27][15]="922911507.8137501"; + results[27][16]="1.060241283048926E+25"; + results[27][17]="10922.95235716340"; + results[27][18]="8.320904507836979E+19"; + results[27][19]="0.07040348871507895"; + results[27][20]="2815859531810263"; + results[27][21]="0.000001312675827697515"; + results[27][22]="16177107411.35740"; + results[27][23]="1.438703169001500E-11"; + results[27][24]="85688.17001947338"; + results[27][25]="85779.56281525363"; + results[27][26]="2.297582454439834E+29"; + results[27][27]="1"; + results[27][28]="3.543388093690857E+24"; + results[27][29]="0.00001707016297188988"; + results[27][30]="7.985811363411926E+18"; + results[27][31]="2.082792678898868E-10"; + results[27][32]="162355737434647.7"; + results[27][33]="8.961968457746355E-16"; + results[27][34]="4295213546.332090"; + results[27][35]="10.54378420900297"; + results[27][36]="2.221765847269926E+33"; + results[27][37]="0.00008920872789651233"; + results[27][38]="1.087346652644278E+28"; + results[27][39]="9.507851164638391E-10"; + results[27][40]="1.971455256073830E+23"; + results[27][41]="1.522190757571212E-14"; + results[27][42]="7.119660210152448E+17"; + results[27][43]="2.745979859142930E-19"; + results[27][44]="18702781142325.76"; + results[27][45]="0.002408639735523385"; + results[27][46]="1.311405510525019E+37"; + results[27][47]="8.756024199812025E-9"; + results[27][48]="1.085922130625564E+32"; + results[27][49]="3.708233894976874E-13"; + results[27][50]="3.659714430599182E+27"; + results[27][51]="9.230110005566145E-19"; + results[27][52]="6.557779833982852E+22"; + results[27][53]="1.922636853991178E-23"; + results[27][54]="2.674336631412318E+17"; + results[27][55]="9.737573359594823E-8"; + results[27][56]="1.124052738729375E+41"; + results[27][57]="9.766901045375269E-13"; + results[27][58]="8.984408843169418E+35"; + results[27][59]="1.916415803779827E-17"; + results[27][60]="4.640586729161206E+31"; + results[27][61]="8.858999425264104E-23"; + results[27][62]="3.317749756446258E+26"; + results[27][63]="7.534907589141790E-28"; + results[27][64]="3.466689881027168E+21"; + results[27][65]="8.175122121301600E-12"; + results[27][66]="7.288209864375369E+44"; + results[27][67]="2.638939930506406E-16"; + results[27][68]="1.554834001227581E+40"; + results[27][69]="1.172092211426029E-21"; + results[27][70]="1.141603892583884E+35"; + results[27][71]="7.162997116051003E-27"; + results[27][72]="2.782472497785938E+30"; + results[27][73]="1.357310078961783E-31"; + results[27][74]="7.771122205267246E+24"; + results[28][0]="1.765977019256848E-7"; + results[28][1]="3.883173479306462E-13"; + results[28][2]="8.712587252178613E-18"; + results[28][3]="1.015982702721253E-22"; + results[28][4]="7.091236430383361E-28"; + results[28][5]="2.212421770302413E-12"; + results[28][6]="0.001374918829450271"; + results[28][7]="2.121698679027844E-17"; + results[28][8]="2.026889357030855E-9"; + results[28][9]="1.977726359178481E-22"; + results[28][10]="7.217837059291388E-14"; + results[28][11]="2.396638382345144E-27"; + results[28][12]="3.218033185591791E-19"; + results[28][13]="3.015376341646586E-32"; + results[28][14]="2.424585382489199E-24"; + results[28][15]="2.604601820097072E-16"; + results[28][16]="2.992168102999295"; + results[28][17]="3.082629412401127E-21"; + results[28][18]="0.00002348290474490412"; + results[28][19]="1.986897479292069E-26"; + results[28][20]="7.946799665619501E-10"; + results[28][21]="3.704578197445509E-31"; + results[28][22]="4.565434827802628E-15"; + results[28][23]="4.060247229376789E-36"; + results[28][24]="2.418255289959476E-20"; + results[28][25]="2.420834538784717E-20"; + results[28][26]="64841.40019917012"; + results[28][27]="2.822157702060747E-25"; + results[28][28]="1"; + results[28][29]="4.817469190655120E-30"; + results[28][30]="0.000002253721904645720"; + results[28][31]="5.877969400550175E-35"; + results[28][32]="4.581934948749433E-11"; + results[28][33]="2.529208830865435E-40"; + results[28][34]="1.212176999177676E-15"; + results[28][35]="2.975622181430421E-24"; + results[28][36]="627017359.8048342"; + results[28][37]="2.517610985241837E-29"; + results[28][38]="3068.663730570020"; + results[28][39]="2.683265539433148E-34"; + results[28][40]="0.05563757635196901"; + results[28][41]="4.295862370485278E-39"; + results[28][42]="2.009280389813716E-7"; + results[28][43]="7.749588209183903E-44"; + results[28][44]="5.278219785077115E-12"; + results[28][45]="6.797561181096882E-28"; + results[28][46]="3700993162053.089"; + results[28][47]="2.471088113492979E-33"; + results[28][48]="30646435.04783151"; + results[28][49]="1.046522084775171E-37"; + results[28][50]="1032.829126765834"; + results[28][51]="2.604882604307646E-43"; + results[28][52]="0.01850708886689335"; + results[28][53]="5.425984405757048E-48"; + results[28][54]="7.547399722243467E-8"; + results[28][55]="2.748096765616207E-32"; + results[28][56]="3.172254094127582E+16"; + results[28][57]="2.756373501047097E-37"; + results[28][58]="253554186152.1326"; + results[28][59]="5.408427620988176E-42"; + results[28][60]="13096467.57978319"; + results[28][61]="2.500149346056082E-47"; + results[28][62]="93.63213028664973"; + results[28][63]="2.126469748701247E-52"; + results[28][64]="0.0009783545548396877"; + results[28][65]="2.307148385991850E-36"; + results[28][66]="2.056847760298206E+20"; + results[28][67]="7.447504650154305E-41"; + results[28][68]="4387986751990347"; + results[28][69]="3.307829062001381E-46"; + results[28][70]="32217862181.58138"; + results[28][71]="2.021510748090225E-51"; + results[28][72]="785257.6190398789"; + results[28][73]="3.830543093426676E-56"; + results[28][74]="2.193133238525025"; + results[29][0]="3.665777505505325E+22"; + results[29][1]="8.060608850055552E+16"; + results[29][2]="1808540315956.603"; + results[29][3]="21089552.67824123"; + results[29][4]="147.1983763619884"; + results[29][5]="4.592498016581085E+17"; + results[29][6]="2.854027239276019E+26"; + results[29][7]="4404176954869.778"; + results[29][8]="4.207373782405491E+20"; + results[29][9]="41053222.77960500"; + results[29][10]="1.498263252683064E+16"; + results[29][11]="497.4890938574387"; + results[29][12]="66799247867.20172"; + results[29][13]="0.006259254023867518"; + results[29][14]="503290.2726585955"; + results[29][15]="54065770158934.34"; + results[29][16]="6.211078856100365E+29"; + results[29][17]="639885651.6572606"; + results[29][18]="4.874531380596274E+24"; + results[29][19]="4124.359493873326"; + results[29][20]="1.649579758814986E+20"; + results[29][21]="0.07689884565596421"; + results[29][22]="947683243446292.2"; + results[29][23]="8.428174771211442E-7"; + results[29][24]="5019762855.256830"; + results[29][25]="5025116805.065672"; + results[29][26]="1.345963983017241E+34"; + results[29][27]="58581.74884719846"; + results[29][28]="2.075778713727511E+29"; + results[29][29]="1"; + results[29][30]="4.678227956325009E+23"; + results[29][31]="0.00001220136376160371"; + results[29][32]="9.511083034298228E+18"; + results[29][33]="5.250077853682115E-11"; + results[29][34]="251621121216311.1"; + results[29][35]="617673.3184308691"; + results[29][36]="1.301549288620499E+38"; + results[29][37]="5.226003292611552"; + results[29][38]="6.369866851504902E+32"; + results[29][39]="0.00005569865490033896"; + results[29][40]="1.154912966748064E+28"; + results[29][41]="8.917259665756348E-10"; + results[29][42]="4.170821463085429E+22"; + results[29][43]="1.608643024477765E-14"; + results[29][44]="1.095641627623847E+18"; + results[29][45]="141.1023280498135"; + results[29][46]="7.682442825440876E+41"; + results[29][47]="0.0005129432105733799"; + results[29][48]="6.361521752392140E+36"; + results[29][49]="2.172348267022037E-8"; + results[29][50]="2.143924716258292E+32"; + results[29][51]="5.407159861780895E-14"; + results[29][52]="3.841662112296063E+27"; + results[29][53]="1.126314293048790E-18"; + results[29][54]="1.566673168742592E+22"; + results[29][55]="0.005704440769329544"; + results[29][56]="6.584897523124984E+45"; + results[29][57]="5.721621440556141E-8"; + results[29][58]="5.263223823910997E+40"; + results[29][59]="1.122669893038318E-12"; + results[29][60]="2.718536862713640E+36"; + results[29][61]="5.189756793682972E-18"; + results[29][62]="1.943595829699885E+31"; + results[29][63]="4.414080639739539E-23"; + results[29][64]="2.030847559414579E+26"; + results[29][65]="4.789129509052666E-7"; + results[29][66]="4.269560798205122E+49"; + results[29][67]="1.545937162317696E-11"; + results[29][68]="9.108489495899883E+44"; + results[29][69]="6.866321155551707E-17"; + results[29][70]="6.687715251833322E+39"; + results[29][71]="4.196208980457067E-22"; + results[29][72]="1.630021050395328E+35"; + results[29][73]="7.951359815351027E-27"; + results[29][74]="4.552459292898528E+29"; + results[30][0]="0.07835824888672127"; + results[30][1]="1.723004720015306E-7"; + results[30][2]="3.865866163087327E-12"; + results[30][3]="4.508021600300163E-17"; + results[30][4]="3.146455831913338E-22"; + results[30][5]="9.816746980813501E-7"; + results[30][6]="610.0658766354783"; + results[30][7]="9.414199128358610E-12"; + results[30][8]="0.0008993520242460782"; + results[30][9]="8.775378874836710E-17"; + results[30][10]="3.202629856156106E-8"; + results[30][11]="1.063413537138199E-21"; + results[30][12]="1.427875009316049E-13"; + results[30][13]="1.337954046340334E-26"; + results[30][14]="1.075813913638266E-18"; + results[30][15]="1.155689091332903E-10"; + results[30][16]="1327656.307919525"; + results[30][17]="1.367794937807870E-15"; + results[30][18]="10.41961064339727"; + results[30][19]="8.816072094770739E-21"; + results[30][20]="0.0003526078195024119"; + results[30][21]="1.643760124001572E-25"; + results[30][22]="2.025731221936322E-9"; + results[30][23]="1.801574196446855E-30"; + results[30][24]="1.073005185322375E-14"; + results[30][25]="1.074149625024506E-14"; + results[30][26]="28770807997.87632"; + results[30][27]="1.252220913433587E-19"; + results[30][28]="443710.4675331262"; + results[30][29]="2.137561506912014E-24"; + results[30][30]="1"; + results[30][31]="2.608116550863527E-29"; + results[30][32]="0.00002033052498315981"; + results[30][33]="1.122236432832213E-34"; + results[30][34]="5.378556230380286E-10"; + results[30][35]="1.320314709324433E-18"; + results[30][36]="278214165870389.4"; + results[30][37]="1.117090347328190E-23"; + results[30][38]="1361598218.593171"; + results[30][39]="1.190593007017408E-28"; + results[30][40]="24686.97501554217"; + results[30][41]="1.906119100865986E-33"; + results[30][42]="0.08915387411693861"; + results[30][43]="3.438573407486192E-38"; + results[30][44]="0.000002342001368579163"; + results[30][45]="3.016149049749527E-22"; + results[30][46]="1.642169406271479E+18"; + results[30][47]="1.096447662153521E-27"; + results[30][48]="13598144023296.90"; + results[30][49]="4.643528035193328E-32"; + results[30][50]="458277094.7190988"; + results[30][51]="1.155813678226253E-37"; + results[30][52]="8211.789053806363"; + results[30][53]="2.407566077505911E-42"; + results[30][54]="0.03348860259416035"; + results[30][55]="1.219359300697839E-26"; + results[30][56]="1.407562347239223E+22"; + results[30][57]="1.223031774845527E-31"; + results[30][58]="1.125046464825440E+17"; + results[30][59]="2.399775948327737E-36"; + results[30][60]="5811039752858.027"; + results[30][61]="1.109342435241184E-41"; + results[30][62]="41545556.30561193"; + results[30][63]="9.435368863912798E-47"; + results[30][64]="434.1061569410814"; + results[30][65]="1.023705889016741E-30"; + results[30][66]="9.126448813663803E+25"; + results[30][67]="3.304535770275098E-35"; + results[30][68]="1.946995653254801E+21"; + results[30][69]="1.467718379620295E-40"; + results[30][70]="1.429540269150730E+16"; + results[30][71]="8.969654791583536E-46"; + results[30][72]="348427025278.1341"; + results[30][73]="1.699652066890138E-50"; + results[30][74]="973116.1746283781"; + results[31][0]="3.004399817208225E+27"; + results[31][1]="6.606317955556214E+21"; + results[31][2]="1.482244404226248E+17"; + results[31][3]="1728458645303.865"; + results[31][4]="12064092.11609646"; + results[31][5]="3.763921891283291E+22"; + results[31][6]="2.339105115657083E+31"; + results[31][7]="3.609577618470172E+17"; + results[31][8]="3.448281572954666E+25"; + results[31][9]="3364642148346.955"; + results[31][10]="1.227947368799811E+21"; + results[31][11]="40773236.79365905"; + results[31][12]="5474736199359228"; + results[31][13]="512.9962638737704"; + results[31][14]="41248690104.82190"; + results[31][15]="4.431125177094802E+18"; + results[31][16]="5.090479209910875E+34"; + results[31][17]="52443781216564.26"; + results[31][18]="3.995070941115503E+29"; + results[31][19]="338024467.9576074"; + results[31][20]="1.351963428879995E+25"; + results[31][21]="6302.479555437567"; + results[31][22]="7.767027210749525E+19"; + results[31][23]="0.06907567822651053"; + results[31][24]="411409982796631.8"; + results[31][25]="411848782090993.5"; + results[31][26]="1.103125854876022E+39"; + results[31][27]="4801245991.169322"; + results[31][28]="1.701267787999033E+34"; + results[31][29]="81958.05153739330"; + results[31][30]="3.834184479481592E+28"; + results[31][31]="1"; + results[31][32]="7.795098335014412E+23"; + results[31][33]="0.000004302861513074059"; + results[31][34]="2.062237682054311E+19"; + results[31][35]="50623301665.22991"; + results[31][36]="1.066724436752164E+43"; + results[31][37]="428313.0471904447"; + results[31][38]="5.220618757019720E+37"; + results[31][39]="4.564953228885464"; + results[31][40]="9.465441644994164E+32"; + results[31][41]="0.00007308412272583773"; + results[31][42]="3.418324004248217E+27"; + results[31][43]="1.318412479054169E-9"; + results[31][44]="8.979665298330876E+22"; + results[31][45]="11564471.87435279"; + results[31][46]="6.296380450205607E+46"; + results[31][47]="42.03982608792905"; + results[31][48]="5.213779276388035E+41"; + results[31][49]="0.001780414312257591"; + results[31][50]="1.757118923873884E+37"; + results[31][51]="4.431602866227630E-9"; + results[31][52]="3.148551413888119E+32"; + results[31][53]="9.231052487699542E-14"; + results[31][54]="1.284014803060566E+27"; + results[31][55]="467.5248505647183"; + results[31][56]="5.396853705687309E+50"; + results[31][57]="0.004689329449025547"; + results[31][58]="4.313635694129337E+45"; + results[31][59]="9.201183695311428E-8"; + results[31][60]="2.228059843005880E+41"; + results[31][61]="4.253423547632060E-13"; + results[31][62]="1.592933271784059E+36"; + results[31][63]="3.617694485619832E-18"; + results[31][64]="1.664443089390894E+31"; + results[31][65]="0.03925077231221895"; + results[31][66]="3.499248839413294E+54"; + results[31][67]="0.000001267019976228053"; + results[31][68]="7.465140515327681E+49"; + results[31][69]="5.627503031390007E-12"; + results[31][70]="5.481121112771666E+44"; + results[31][71]="3.439131118819729E-17"; + results[31][72]="1.335933492553362E+40"; + results[31][73]="6.516779575388975E-22"; + results[31][74]="3.731106933492626E+34"; + results[32][0]="3854.216698861785"; + results[32][1]="0.008474964229612891"; + results[32][2]="1.901508281900985E-7"; + results[32][3]="2.217366056230347E-12"; + results[32][4]="1.547651049109460E-17"; + results[32][5]="0.04828575252702482"; + results[32][6]="30007384.32189076"; + results[32][7]="4.630573551915940E-7"; + results[32][8]="44.23653717702960"; + results[32][9]="4.316356258436777E-12"; + results[32][10]="0.001575281434595963"; + results[32][11]="5.230625072490977E-17"; + results[32][12]="7.023306139407549E-9"; + results[32][13]="6.581010807387358E-22"; + results[32][14]="5.291618954893612E-14"; + results[32][15]="0.000005684501960919277"; + results[32][16]="65303591964.26306"; + results[32][17]="6.727789562447809E-11"; + results[32][18]="512510.6534153962"; + results[32][19]="4.336372081917841E-16"; + results[32][20]="17.34376361626097"; + results[32][21]="8.085182873354881E-21"; + results[32][22]="0.00009963988749008084"; + results[32][23]="8.861424866987624E-26"; + results[32][24]="5.277803628834801E-10"; + results[32][25]="5.283432798288516E-10"; + results[32][26]="1415153225099094"; + results[32][27]="6.159314205957922E-15"; + results[32][28]="21824840622.69226"; + results[32][29]="1.051404972907783E-19"; + results[32][30]="49187.12137676328"; + results[32][31]="1.282857453520695E-24"; + results[32][32]="1"; + results[32][33]="5.519957963514394E-30"; + results[32][34]="0.00002645556981354615"; + results[32][35]="6.494247986306681E-14"; + results[32][36]="1.368455394540179E+19"; + results[32][37]="5.494645850284232E-19"; + results[32][38]="66973096844326.95"; + results[32][39]="5.856184274649082E-24"; + results[32][40]="1214281236.514595"; + results[32][41]="9.375651157286216E-29"; + results[32][42]="4385.222427398534"; + results[32][43]="1.691335275569338E-33"; + results[32][44]="0.1151963055808490"; + results[32][45]="1.483556894004392E-17"; + results[32][46]="8.077358590748254E+22"; + results[32][47]="5.393110424161355E-23"; + results[32][48]="6.688535605726128E+17"; + results[32][49]="2.284017770834574E-27"; + results[32][50]="22541331082138.75"; + results[32][51]="5.685114767983791E-33"; + results[32][52]="403914264.9099497"; + results[32][53]="1.184212448768611E-37"; + results[32][54]="1647.207960537155"; + results[32][55]="5.997677392530980E-22"; + results[32][56]="6.923394001901749E+26"; + results[32][57]="6.015741235696518E-27"; + results[32][58]="5.533779701986738E+21"; + results[32][59]="1.180380708474336E-31"; + results[32][60]="2.858283176490243E+17"; + results[32][61]="5.456536101060227E-37"; + results[32][62]="2043506320669.287"; + results[32][63]="4.640986335438119E-42"; + results[32][64]="21352432.23186122"; + results[32][65]="5.035314581717381E-26"; + results[32][66]="4.489037455364987E+30"; + results[32][67]="1.625406020263772E-30"; + results[32][68]="9.576711151667440E+25"; + results[32][69]="7.219284208528977E-36"; + results[32][70]="7.031497073168779E+20"; + results[32][71]="4.411914989412857E-41"; + results[32][72]="1.713812238330015E+16"; + results[32][73]="8.360099251239178E-46"; + results[32][74]="47864783395.13761"; + results[33][0]="6.982329800946383E+32"; + results[33][1]="1.535331298830604E+27"; + results[33][2]="3.444787613364996E+22"; + results[33][3]="4.016998083837972E+17"; + results[33][4]="2803737019990.124"; + results[33][5]="8.747485550828852E+27"; + results[33][6]="5.436161746200319E+36"; + results[33][7]="8.388784085898711E+22"; + results[33][8]="8.013926459118452E+30"; + results[33][9]="7.819545523655909E+17"; + results[33][10]="2.853792447348690E+26"; + results[33][11]="9475842220292.549"; + results[33][12]="1.272347758049958E+21"; + results[33][13]="119222118.1915926"; + results[33][14]="9586339225533875"; + results[33][15]="1.029808922186089E+24"; + results[33][16]="1.183045095558775E+40"; + results[33][17]="1.218811738588753E+19"; + results[33][18]="9.284683992214605E+34"; + results[33][19]="78558063495777.08"; + results[33][20]="3.142010089732407E+30"; + results[33][21]="1464718196.550773"; + results[33][22]="1.805084171812118E+25"; + results[33][23]="16053.42817021349"; + results[33][24]="9.561311270339060E+19"; + results[33][25]="9.571509118748273E+19"; + results[33][26]="2.563702902183168E+44"; + results[33][27]="1115826288292324"; + results[33][28]="3.953805584562284E+39"; + results[33][29]="19047336589.46896"; + results[33][30]="8.910778252638594E+33"; + results[33][31]="232403.4824178150"; + results[33][32]="1.811607998846661E+29"; + results[33][33]="1"; + results[33][34]="4.792712188826647E+24"; + results[33][35]="1.176503159848700E+16"; + results[33][36]="2.479104738813852E+48"; + results[33][37]="99541443732.04527"; + results[33][38]="1.213289979507148E+43"; + results[33][39]="1060911.027467431"; + results[33][40]="2.199801600919255E+38"; + results[33][41]="16.98500463093566"; + results[33][42]="7.944304026196954E+32"; + results[33][43]="0.0003064036513952934"; + results[33][44]="2.086905486278503E+28"; + results[33][45]="2687623535922.464"; + results[33][46]="1.463300743255233E+52"; + results[33][47]="9770201.983074019"; + results[33][48]="1.211700460390415E+47"; + results[33][49]="413.7744863151833"; + results[33][50]="4.083605569305342E+42"; + results[33][51]="0.001029919938804072"; + results[33][52]="7.317343131591340E+37"; + results[33][53]="2.145328744523008E-8"; + results[33][54]="2.984095117073005E+32"; + results[33][55]="108654403.3881091"; + results[33][56]="1.254247595301220E+56"; + results[33][57]="1089.816494157951"; + results[33][58]="1.002503957197447E+51"; + results[33][59]="0.02138387133156396"; + results[33][60]="5.178088665498566E+46"; + results[33][61]="9.885104446676278E-8"; + results[33][62]="3.702032396218190E+41"; + results[33][63]="8.407647967817748E-13"; + results[33][64]="3.868223702607104E+36"; + results[33][65]="9122.016172948436"; + results[33][66]="8.132376161261471E+59"; + results[33][67]="0.2944598547683367"; + results[33][68]="1.734924652500475E+55"; + results[33][69]="0.000001307851301811848"; + results[33][70]="1.273831634161944E+50"; + results[33][71]="7.992660485051813E-12"; + results[33][72]="3.104755959479955E+45"; + results[33][73]="1.514522267469688E-16"; + results[33][74]="8.671222446169412E+39"; + results[34][0]="145686398.9710135"; + results[34][1]="320.3470682862941"; + results[34][2]="0.007187553680765358"; + results[34][3]="8.381471545908569E-8"; + results[34][4]="5.850000812747606E-13"; + results[34][5]="1825.163958566520"; + results[34][6]="1134255830941.353"; + results[34][7]="0.01750320852868166"; + results[34][8]="1672106.761971122"; + results[34][9]="1.631549155379241E-7"; + results[34][10]="59.54441524783812"; + results[34][11]="1.977135669106896E-12"; + results[34][12]="0.0002654755194806417"; + results[34][13]="2.487570993091087E-17"; + results[34][14]="2.000190883125157E-9"; + results[34][15]="0.2148697609230333"; + results[34][16]="2468425077384854"; + results[34][17]="0.000002543052222977617"; + results[34][18]="19372504808.15474"; + results[34][19]="1.639114981260948E-11"; + results[34][20]="655580.7997520574"; + results[34][21]="3.056136356290082E-16"; + results[34][22]="3.766310391056549"; + results[34][23]="3.349549803478537E-21"; + results[34][24]="0.00001994968797131100"; + results[34][25]="0.00001997096579482185"; + results[34][26]="5.349169324542341E+19"; + results[34][27]="2.328172951619490E-10"; + results[34][28]="824962031682160.1"; + results[34][29]="3.974229171089060E-15"; + results[34][30]="1859235001.303121"; + results[34][31]="4.849101578843441E-20"; + results[34][32]="37799.22364355827"; + results[34][33]="2.086501255659210E-25"; + results[34][34]="1"; + results[34][35]="2.454775320311342E-9"; + results[34][36]="5.172655150445800E+23"; + results[34][37]="2.076933473370431E-14"; + results[34][38]="2.531531065720401E+18"; + results[34][39]="2.213592190953497E-19"; + results[34][40]="45898888025191.66"; + results[34][41]="3.543923348982476E-24"; + results[34][42]="165758003.2599846"; + results[34][43]="6.393116033748466E-29"; + results[34][44]="4354.330917562191"; + results[34][45]="5.607729882441468E-13"; + results[34][46]="3.053178838209099E+27"; + results[34][47]="2.038553870572805E-18"; + results[34][48]="2.528214532087444E+22"; + results[34][49]="8.633409852563746E-23"; + results[34][50]="8.520448147972540E+17"; + results[34][51]="2.148929245543152E-28"; + results[34][52]="15267645632154.63"; + results[34][53]="4.476231119249052E-33"; + results[34][54]="62263182.08779341"; + results[34][55]="2.267075491021919E-17"; + results[34][56]="2.616989182503541E+31"; + results[34][57]="2.273903483498682E-22"; + results[34][58]="2.091725765495799E+26"; + results[34][59]="4.461747438416318E-27"; + results[34][60]="1.080408850247748E+22"; + results[34][61]="2.062528284031250E-32"; + results[34][62]="7.724295243200328E+16"; + results[34][63]="1.754256804199234E-37"; + results[34][64]="807105361266.0442"; + results[34][65]="1.903309819900053E-21"; + results[34][66]="1.696821307196509E+35"; + results[34][67]="6.143908567153631E-26"; + results[34][68]="3.619922465916360E+30"; + results[34][69]="2.728833383445953E-31"; + results[34][70]="2.657851304177320E+25"; + results[34][71]="1.667669613811836E-36"; + results[34][72]="6.478077207970342E+20"; + results[34][73]="3.160052612799337E-41"; + results[34][74]="1809251652203281"; + results[35][0]="5.934816020251334E+16"; + results[35][1]="130499547406.9147"; + results[35][2]="2927988.407449751"; + results[35][3]="34.14353841900911"; + results[35][4]="0.0002383110488501100"; + results[35][5]="743515686940.7634"; + results[35][6]="4.620609558668262E+20"; + results[35][7]="7130269.065301548"; + results[35][8]="681164890381514.3"; + results[35][9]="66.46429682910084"; + results[35][10]="24256564238.34587"; + results[35][11]="0.0008054242898515592"; + results[35][12]="108146.5653023476"; + results[35][13]="1.013359948875315E-8"; + results[35][14]="0.8148162752717714"; + results[35][15]="87531335.00453358"; + results[35][16]="1.005560491406513E+24"; + results[35][17]="1035.961296309220"; + results[35][18]="7.891762903049598E+18"; + results[35][19]="0.006677250531641558"; + results[35][20]="267063463742543.0"; + results[35][21]="1.244975998822763E-7"; + results[35][22]="1534279068.187334"; + results[35][23]="1.364503616996488E-12"; + results[35][24]="8126.889579768451"; + results[35][25]="8135.557510937055"; + results[35][26]="2.179087136929461E+28"; + results[35][27]="0.09484260870458016"; + results[35][28]="3.360641704583902E+23"; + results[35][29]="0.000001618978787266365"; + results[35][30]="7.573951823286671E+17"; + results[35][31]="1.975374910575696E-11"; + results[35][32]="15398241676457.85"; + results[35][33]="8.499764676608273E-17"; + results[35][34]="407369257.6773865"; + results[35][35]="1"; + results[35][36]="2.107180688858216E+32"; + results[35][37]="0.000008460788472922284"; + results[35][38]="1.031267931029763E+27"; + results[35][39]="9.017494076291857E-11"; + results[35][40]="1.869779594303981E+22"; + results[35][41]="1.443685423940549E-15"; + results[35][42]="6.752471474210576E+16"; + results[35][43]="2.604358932913510E-20"; + results[35][44]="1773820553569.003"; + results[35][45]="0.0002284416759465479"; + results[35][46]="1.243771196877546E+36"; + results[35][47]="8.304441769906065E-10"; + results[35][48]="1.029916877185643E+31"; + results[35][49]="3.516985762863528E-14"; + results[35][50]="3.470968637118237E+26"; + results[35][51]="8.754077115581401E-20"; + results[35][52]="6.219569467652223E+21"; + results[35][53]="1.823478948240904E-24"; + results[35][54]="2.536410626773635E+16"; + results[35][55]="9.235368598761958E-9"; + results[35][56]="1.066080940626218E+40"; + results[35][57]="9.263183741028816E-14"; + results[35][58]="8.521047723546869E+34"; + results[35][59]="1.817578741931636E-18"; + results[35][60]="4.401253513135038E+30"; + results[35][61]="8.402106160044240E-24"; + results[35][62]="3.146640419303486E+25"; + results[35][63]="7.146302921021462E-29"; + results[35][64]="3.287899118863873E+20"; + results[35][65]="7.753499084627650E-13"; + results[35][66]="6.912328363238143E+43"; + results[35][67]="2.502839472239110E-17"; + results[35][68]="1.474645127790042E+39"; + results[35][69]="1.111642829739649E-22"; + results[35][70]="1.082726912799589E+34"; + results[35][71]="6.793573326296614E-28"; + results[35][72]="2.638969503387675E+29"; + results[35][73]="1.287308287097552E-32"; + results[35][74]="7.370335025096355E+23"; + results[36][0]="2.816472290028026E-16"; + results[36][1]="6.193087669080073E-22"; + results[36][2]="1.389528872835434E-26"; + results[36][3]="1.620342223120407E-31"; + results[36][4]="1.130947384389897E-36"; + results[36][5]="3.528485672216559E-21"; + results[36][6]="2.192792285493067E-12"; + results[36][7]="3.383795752781463E-26"; + results[36][8]="3.232588899391471E-18"; + results[36][9]="3.154181185340816E-31"; + results[36][10]="1.151138313225971E-22"; + results[36][11]="3.822283936590086E-36"; + results[36][12]="5.132287225019476E-28"; + results[36][13]="4.809079516690182E-41"; + results[36][14]="3.866855270552440E-33"; + results[36][15]="4.153954877593472E-25"; + results[36][16]="4.772065806807389E-9"; + results[36][17]="4.916338222853396E-30"; + results[36][18]="3.745176170594929E-14"; + results[36][19]="3.168807766200464E-35"; + results[36][20]="1.267397073040055E-18"; + results[36][21]="5.908254595372923E-40"; + results[36][22]="7.281193664595935E-24"; + results[36][23]="6.475494124501726E-45"; + results[36][24]="3.856759708713939E-29"; + results[36][25]="3.860873229312546E-29"; + results[36][26]="0.0001034124481327801"; + results[36][27]="4.500924349110802E-34"; + results[36][28]="1.594852174924249E-9"; + results[36][29]="7.683151216346878E-39"; + results[36][30]="3.594353281298647E-15"; + results[36][31]="9.374492282605629E-44"; + results[36][32]="7.307508918374459E-20"; + results[36][33]="4.033714204743355E-49"; + results[36][34]="1.933243123531666E-24"; + results[36][35]="4.745677507807144E-33"; + results[36][36]="1"; + results[36][37]="4.015217355426124E-38"; + results[36][38]="0.000004894065024810755"; + results[36][39]="4.279411881464243E-43"; + results[36][40]="8.873370965245172E-11"; + results[36][41]="6.851265444743684E-48"; + results[36][42]="3.204505199727048E-16"; + results[36][43]="1.235944761018426E-52"; + results[36][44]="8.417980303958437E-21"; + results[36][45]="1.084110523385301E-36"; + results[36][46]="5902.536993880142"; + results[36][47]="3.941020252233737E-42"; + results[36][48]="0.04887653358970880"; + results[36][49]="1.669048023009940E-46"; + results[36][50]="0.000001647209779147603"; + results[36][51]="4.154402686902390E-52"; + results[36][52]="2.951607093088121E-11"; + results[36][53]="8.653643030626684E-57"; + results[36][54]="1.203698686204266E-16"; + results[36][55]="4.382808103545301E-41"; + results[36][56]="50592763.41431727"; + results[36][57]="4.396008273048529E-46"; + results[36][58]="404.3814452458765"; + results[36][59]="8.625642554253372E-51"; + results[36][60]="0.02088692980344213"; + results[36][61]="3.987368622192980E-56"; + results[36][62]="1.493294066304539E-7"; + results[36][63]="3.391404903626805E-61"; + results[36][64]="1.560330889633121E-12"; + results[36][65]="3.679560621272072E-45"; + results[36][66]="328036812399.9663"; + results[36][67]="1.187766898905705E-49"; + results[36][68]="6998190.214950595"; + results[36][69]="5.275498373810540E-55"; + results[36][70]="51.38272757170476"; + results[36][71]="3.224010813224441E-60"; + results[36][72]="0.001252369821601588"; + results[36][73]="6.109149983692593E-65"; + results[36][74]="3.497723315360298E-9"; + results[37][0]="7.014495208389838E+21"; + results[37][1]="1.542404089460013E+16"; + results[37][2]="346065667144.4297"; + results[37][3]="4035503.136413506"; + results[37][4]="28.16652958678678"; + results[37][5]="8.787782478196851E+16"; + results[37][6]="5.461204441472514E+25"; + results[37][7]="842742858791.6008"; + results[37][8]="8.050844109405394E+19"; + results[37][9]="7855567.721827779"; + results[37][10]="2866938975720293"; + results[37][11]="95.19494458811030"; + results[37][12]="12782090658.38928"; + results[37][13]="0.001197713371653776"; + results[37][14]="96305.00489162340"; + results[37][15]="10345529294895.73"; + results[37][16]="1.188495013939524E+29"; + results[37][17]="122442642.2696522"; + results[37][18]="9.327455624622005E+23"; + results[37][19]="789.1995590022467"; + results[37][20]="3.156484346550524E+19"; + results[37][21]="0.01471465694724737"; + results[37][22]="181339962947614.9"; + results[37][23]="1.612738128796641E-7"; + results[37][24]="960535723.8013413"; + results[37][25]="961560206.4717620"; + results[37][26]="2.575513078838174E+33"; + results[37][27]="11209.66550672107"; + results[37][28]="3.972019529077253E+28"; + results[37][29]="0.1913508170601013"; + results[37][30]="8.951827418361983E+22"; + results[37][31]="0.000002334740925030381"; + results[37][32]="1.819953509739433E+18"; + results[37][33]="1.004606686931215E-11"; + results[37][34]="48147907134319.92"; + results[37][35]="118192.2941579709"; + results[37][36]="2.490525198215260E+37"; + results[37][37]="1"; + results[37][38]="1.218879226599518E+32"; + results[37][39]="0.00001065798312432847"; + results[37][40]="2.209935398205477E+27"; + results[37][41]="1.706324922979563E-10"; + results[37][42]="7.980900947732038E+21"; + results[37][43]="3.078151570918528E-15"; + results[37][44]="2.096519206508824E+17"; + results[37][45]="27.00004576141425"; + results[37][46]="1.470041711665625E+41"; + results[37][47]="0.00009815210244864781"; + results[37][48]="1.217282385065843E+36"; + results[37][49]="4.156806158337618E-9"; + results[37][50]="4.102417461713700E+31"; + results[37][51]="1.034664457526358E-14"; + results[37][52]="7.351051840566861E+26"; + results[37][53]="2.155211602413563E-19"; + results[37][54]="2.997841909050329E+21"; + results[37][55]="0.001091549402082161"; + results[37][56]="1.260025521307003E+45"; + results[37][57]="1.094836937559011E-8"; + results[37][58]="1.007122179075560E+40"; + results[37][59]="2.148238013216586E-13"; + results[37][60]="5.201942498882593E+35"; + results[37][61]="9.930642028144481E-19"; + results[37][62]="3.719086500476785E+30"; + results[37][63]="8.446379369833354E-24"; + results[37][64]="3.886043398184922E+25"; + results[37][65]="9.164038445638694E-8"; + results[37][66]="8.169839472243282E+48"; + results[37][67]="2.958163391330656E-12"; + results[37][68]="1.742916907223793E+44"; + results[37][69]="1.313876163311878E-17"; + results[37][70]="1.279699777703607E+39"; + results[37][71]="8.029480169653943E-23"; + results[37][72]="3.119058598183105E+34"; + results[37][73]="1.521499197406275E-27"; + results[37][74]="8.711168053289843E+28"; + } + + private static void initResults2() { + results[38][0]="5.754873046740801E-11"; + results[38][1]="1.265428153832008E-16"; + results[38][2]="2.839212118742058E-21"; + results[38][3]="3.310831006343367E-26"; + results[38][4]="2.310854838782263E-31"; + results[38][5]="7.209723725223695E-16"; + results[38][6]="4.480513181530232E-7"; + results[38][7]="6.914080086037084E-21"; + results[38][8]="6.605120453046024E-13"; + results[38][9]="6.444910660872926E-26"; + results[38][10]="2.352110786003469E-17"; + results[38][11]="7.810039133548062E-31"; + results[38][12]="1.048675732545652E-22"; + results[38][13]="9.826349859084964E-36"; + results[38][14]="7.901111348029064E-28"; + results[38][15]="8.487739448770601E-20"; + results[38][16]="0.0009750720071382617"; + results[38][17]="1.004551062956811E-24"; + results[38][18]="7.652485513797906E-9"; + results[38][19]="6.474797024837234E-30"; + results[38][20]="2.589661286915703E-13"; + results[38][21]="1.207228462519536E-34"; + results[38][22]="1.487759894419769E-18"; + results[38][23]="1.323132016365500E-39"; + results[38][24]="7.880483175360085E-24"; + results[38][25]="7.888888295802402E-24"; + results[38][26]="21.13017452946058"; + results[38][27]="9.196699116773269E-29"; + results[38][28]="0.0003258747415163162"; + results[38][29]="1.569891527267555E-33"; + results[38][30]="7.344310431260839E-10"; + results[38][31]="1.915481759045105E-38"; + results[38][32]="1.493136867068297E-14"; + results[38][33]="8.242052739990580E-44"; + results[38][34]="3.950178662790491E-19"; + results[38][35]="9.696801092238556E-28"; + results[38][36]="204329.1200526434"; + results[38][37]="8.204258290543218E-33"; + results[38][38]="1"; + results[38][39]="8.744084640824158E-38"; + results[38][40]="0.00001813088081229221"; + results[38][41]="1.399913039571560E-42"; + results[38][42]="6.547737276643480E-11"; + results[38][43]="2.525395054525697E-47"; + results[38][44]="1.720038508128311E-15"; + results[38][45]="2.215153492831292E-31"; + results[38][46]="1206060190.037704"; + results[38][47]="8.052652002485662E-37"; + results[38][48]="9986.899099608667"; + results[38][49]="3.410351138672251E-41"; + results[38][50]="0.3365729247153389"; + results[38][51]="8.488654453591028E-47"; + results[38][52]="0.000006030992800718365"; + results[38][53]="1.768191265697641E-51"; + results[38][54]="2.459506933606407E-11"; + results[38][55]="8.955353231570062E-36"; + results[38][56]="10337574829479.02"; + results[38][57]="8.982325021761465E-41"; + results[38][58]="82626904.87270614"; + results[38][59]="1.762469952999227E-45"; + results[38][60]="4267.807987338662"; + results[38][61]="8.147355218982128E-51"; + results[38][62]="0.03051234625478403"; + results[38][63]="6.929627797002850E-56"; + results[38][64]="3.188210376696939E-7"; + results[38][65]="7.518413839248804E-40"; + results[38][66]="6.702747322255918E+16"; + results[38][67]="2.426953652810597E-44"; + results[38][68]="1429934048581.875"; + results[38][69]="1.077937940559859E-49"; + results[38][70]="10498987.51063113"; + results[38][71]="6.587592925063573E-55"; + results[38][72]="255.8956236283385"; + results[38][73]="1.248277240437528E-59"; + results[38][74]="0.0007146867272151842"; + results[39][0]="6.581447096100371E+26"; + results[39][1]="1.447181958788470E+21"; + results[39][2]="3.247008961334176E+16"; + results[39][3]="378636660364.1785"; + results[39][4]="2642763.575267104"; + results[39][5]="8.245258390527376E+21"; + results[39][6]="5.124050561692560E+30"; + results[39][7]="7.907151371518986E+16"; + results[39][8]="7.553815778735954E+24"; + results[39][9]="737059500863.3713"; + results[39][10]="2.689945125899165E+20"; + results[39][11]="8931797.271363033"; + results[39][12]="1199297325702478"; + results[39][13]="112.3771127878607"; + results[39][14]="9035950213.862933"; + results[39][15]="9.706835875242173E+17"; + results[39][16]="1.115121876320673E+34"; + results[39][17]="11488350172947.65"; + results[39][18]="8.751614180482857E+28"; + results[39][19]="74047739.59538163"; + results[39][20]="2.961615072691725E+24"; + results[39][21]="1380.623029291435"; + results[39][22]="1.701447270390950E+19"; + results[39][23]="0.01513173843478247"; + results[39][24]="90123592108977.16"; + results[39][25]="90219715611751.54"; + results[39][26]="2.416510749542446E+38"; + results[39][27]="1051762362.161496"; + results[39][28]="3.726802231475215E+33"; + results[39][29]="17953.75492979660"; + results[39][30]="8.399175823358240E+27"; + results[39][31]="0.2190602947851342"; + results[39][32]="1.707596539147366E+23"; + results[39][33]="9.425861114736121E-7"; + results[39][34]="4.517543945478293E+18"; + results[39][35]="11089555385.78204"; + results[39][36]="2.336769695694354E+42"; + results[39][37]="93826.38237785791"; + results[39][38]="1.143630283873541E+37"; + results[39][39]="1"; + results[39][40]="2.073502437023907E+32"; + results[39][41]="0.00001600982946843494"; + results[39][42]="7.488190640417148E+26"; + results[39][43]="2.888118263100058E-10"; + results[39][44]="1.967088127324202E+22"; + results[39][45]="2533316.617830116"; + results[39][46]="1.379286957501396E+46"; + results[39][47]="9.209256695537514"; + results[39][48]="1.142132025230187E+41"; + results[39][49]="0.0003900180840828200"; + results[39][50]="3.849149894363509E+36"; + results[39][51]="9.707882302464703E-10"; + results[39][52]="6.897226008724825E+31"; + results[39][53]="2.022157079132508E-14"; + results[39][54]="2.812766612669237E+26"; + results[39][55]="102.4161315840830"; + results[39][56]="1.182236363680106E+50"; + results[39][57]="0.001027245891448147"; + results[39][58]="9.449463067516497E+44"; + results[39][59]="2.015614012667092E-8"; + results[39][60]="4.880794460077878E+40"; + results[39][61]="9.317562161903105E-14"; + results[39][62]="3.489484320900643E+35"; + results[39][63]="7.924932204624348E-19"; + results[39][64]="3.646133938150488E+30"; + results[39][65]="0.008598285753258867"; + results[39][66]="7.665464822884150E+53"; + results[39][67]="2.775537694911710E-7"; + results[39][68]="1.635315881900131E+49"; + results[39][69]="1.232762472960531E-12"; + results[39][70]="1.200696006716784E+44"; + results[39][71]="7.533770766933783E-18"; + results[39][72]="2.926499846920735E+39"; + results[39][73]="1.427567654834451E-22"; + results[39][74]="8.173373847257529E+33"; + results[40][0]="0.000003174072515461667"; + results[40][1]="6.979408043839129E-12"; + results[40][2]="1.565953771433517E-16"; + results[40][3]="1.826072897737389E-21"; + results[40][4]="1.274540858056698E-26"; + results[40][5]="3.976488401123740E-11"; + results[40][6]="0.02471205468678926"; + results[40][7]="3.813427575647367E-16"; + results[40][8]="3.643022377913347E-8"; + results[40][9]="3.554659438554945E-21"; + results[40][10]="1.297295377072253E-12"; + results[40][11]="4.307589473674706E-26"; + results[40][12]="5.783920502277423E-18"; + results[40][13]="5.419675944492992E-31"; + results[40][14]="4.357819914999574E-23"; + results[40][15]="4.681371818966545E-15"; + results[40][16]="53.77962699292531"; + results[40][17]="5.540553012050880E-20"; + results[40][18]="0.0004220691533424975"; + results[40][19]="3.571143118677119E-25"; + results[40][20]="1.428315211889754E-8"; + results[40][21]="6.658410449100025E-30"; + results[40][22]="8.205668052327118E-14"; + results[40][23]="7.297670918825164E-35"; + results[40][24]="4.346442545702108E-19"; + results[40][25]="4.351078349405929E-19"; + results[40][26]="1165424.600614822"; + results[40][27]="5.072395109750087E-24"; + results[40][28]="17.97346443838419"; + results[40][29]="8.658661118125126E-29"; + results[40][30]="0.00004050719050715733"; + results[40][31]="1.056474739906990E-33"; + results[40][32]="8.235324486033761E-10"; + results[40][33]="4.545864497880714E-39"; + results[40][34]="2.178702018774722E-14"; + results[40][35]="5.348223946000686E-23"; + results[40][36]="11269674218.70173"; + results[40][37]="4.525019151292953E-28"; + results[40][38]="55154.51843475961"; + results[40][39]="4.822757775174344E-33"; + results[40][40]="1"; + results[40][41]="7.721152954810994E-38"; + results[40][42]="0.000003611372963305955"; + results[40][43]="1.392869480898883E-42"; + results[40][44]="9.486789560505935E-11"; + results[40][45]="1.221757241561856E-26"; + results[40][46]="66519668984864.25"; + results[40][47]="4.441401433197993E-32"; + results[40][48]="550822610.4954504"; + results[40][49]="1.880962747469021E-36"; + results[40][50]="18563.51758085312"; + results[40][51]="4.681876485468906E-42"; + results[40][52]="0.3326365036071236"; + results[40][53]="9.752373776010145E-47"; + results[40][54]="0.000001356529205100136"; + results[40][55]="4.939281949004150E-31"; + results[40][56]="5.701639615032074E+17"; + results[40][57]="4.954158109997452E-36"; + results[40][58]="4557247148008.799"; + results[40][59]="9.720818151340577E-41"; + results[40][60]="235388894.3136845"; + results[40][61]="4.493634536198847E-46"; + results[40][62]="1682.893763997254"; + results[40][63]="3.822002840758163E-51"; + results[40][64]="0.01758442079954232"; + results[40][65]="4.146744946969999E-35"; + results[40][66]="3.696868007488996E+21"; + results[40][67]="1.338574599842493E-39"; + results[40][68]="7.886732384299944E+16"; + results[40][69]="5.945314801413554E-45"; + results[40][70]="579066600201.4157"; + results[40][71]="3.633355154261108E-50"; + results[40][72]="14113799.89078350"; + results[40][73]="6.884813006940251E-55"; + results[40][74]="39.41820227126789"; + results[41][0]="4.110878950382567E+31"; + results[41][1]="9.039334001912643E+25"; + results[41][2]="2.028134632999056E+21"; + results[41][3]="2.365026192881695E+16"; + results[41][4]="165071313250.2498"; + results[41][5]="5.150122558634225E+26"; + results[41][6]="3.200565360046566E+35"; + results[41][7]="4.938935412840446E+21"; + results[41][8]="4.718236252065705E+29"; + results[41][9]="4.603793577667779E+16"; + results[41][10]="1.680183496771577E+25"; + results[41][11]="557894591505.3629"; + results[41][12]="7.491006247549473E+19"; + results[41][13]="7019257.326220990"; + results[41][14]="564400153772921.7"; + results[41][15]="6.063047638564933E+22"; + results[41][16]="6.965232693572741E+38"; + results[41][17]="7.175810457942816E+17"; + results[41][18]="5.466400624527316E+33"; + results[41][19]="4625142306567.008"; + results[41][20]="1.849872966186717E+29"; + results[41][21]="86235960.97719082"; + results[41][22]="1.062751651256206E+24"; + results[41][23]="945.1530051969814"; + results[41][24]="5.629266213401292E+18"; + results[41][25]="5.635270243797986E+18"; + results[41][26]="1.509391935939637E+43"; + results[41][27]="65694788581924.34"; + results[41][28]="2.327821316787288E+38"; + results[41][29]="1121420747.497299"; + results[41][30]="5.246261891744755E+32"; + results[41][31]="13682.86247002409"; + results[41][32]="1.066592584583160E+28"; + results[41][33]="0.05887546231095213"; + results[41][34]="2.821731458405042E+23"; + results[41][35]="692671674463882.5"; + results[41][36]="1.459584376149378E+47"; + results[41][37]="5860548518.823794"; + results[41][38]="7.143300846072895E+41"; + results[41][39]="62461.62721293222"; + results[41][40]="1.295143362464938E+37"; + results[41][41]="1"; + results[41][42]="4.677245722811041E+31"; + results[41][43]="0.00001803965662966171"; + results[41][44]="1.228675253039092E+27"; + results[41][45]="158235078195.2310"; + results[41][46]="8.615250775911171E+50"; + results[41][47]="575225.1586248642"; + results[41][48]="7.133942478787923E+45"; + results[41][49]="24.36116417428315"; + results[41][50]="2.404241657884309E+41"; + results[41][51]="0.00006063701254035724"; + results[41][52]="4.308119597603104E+36"; + results[41][53]="1.263072216427666E-9"; + results[41][54]="1.756899795975280E+31"; + results[41][55]="6397078.231595606"; + results[41][56]="7.384440702575934E+54"; + results[41][57]="64.16344992765041"; + results[41][58]="5.902288394855864E+49"; + results[41][59]="0.001258985310643743"; + results[41][60]="3.048623640683292E+45"; + results[41][61]="5.819900942901146E-9"; + results[41][62]="2.179588688174679E+40"; + results[41][63]="4.950041610530071E-14"; + results[41][64]="2.277434588131763E+35"; + results[41][65]="537.0629193903215"; + results[41][66]="4.787974061808353E+58"; + results[41][67]="0.01733646008150164"; + results[41][68]="1.021444909906334E+54"; + results[41][69]="7.700035002815314E-8"; + results[41][70]="7.499742636760013E+48"; + results[41][71]="4.705715811519044E-13"; + results[41][72]="1.827939424770661E+44"; + results[41][73]="8.916819867750936E-18"; + results[41][74]="5.105222303193294E+38"; + results[42][0]="0.8789101950179163"; + results[42][1]="0.000001932619010762593"; + results[42][2]="4.336172938504800E-11"; + results[42][3]="5.056450597297903E-16"; + results[42][4]="3.529241845156713E-21"; + results[42][5]="0.00001101101559303791"; + results[42][6]="6842.842026531408"; + results[42][7]="1.055949527892695E-10"; + results[42][8]="0.01008763817785915"; + results[42][9]="9.842958549761383E-16"; + results[42][10]="3.592249790463821E-7"; + results[42][11]="1.192784438894235E-20"; + results[42][12]="1.601584926576693E-12"; + results[42][13]="1.500724516564931E-25"; + results[42][14]="1.206693398681896E-17"; + results[42][15]="1.296285890859935E-9"; + results[42][16]="14891739.93917645"; + results[42][17]="1.534195738946580E-14"; + results[42][18]="116.8722138729541"; + results[42][19]="9.888602354180532E-20"; + results[42][20]="0.003955047640890110"; + results[42][21]="1.843733814467261E-24"; + results[42][22]="2.272174083292525E-8"; + results[42][23]="2.020746954959940E-29"; + results[42][24]="1.203542971015447E-13"; + results[42][25]="1.204826638958615E-13"; + results[42][26]="322709565712.6364"; + results[42][27]="1.404561412318563E-18"; + results[42][28]="4976906.185267212"; + results[42][29]="2.397609221230570E-23"; + results[42][30]="11.21656248710349"; + results[42][31]="2.925410226640957E-28"; + results[42][32]="0.0002280386038692306"; + results[42][33]="1.258763507416664E-33"; + results[42][34]="6.032891204846025E-9"; + results[42][35]="1.480939243977938E-17"; + results[42][36]="3120606576282596"; + results[42][37]="1.252991368454678E-22"; + results[42][38]="15272451501.17909"; + results[42][39]="1.335436085991919E-27"; + results[42][40]="276902.9978793913"; + results[42][41]="2.138010400272485E-32"; + results[42][42]="1"; + results[42][43]="3.856897349156122E-37"; + results[42][44]="0.00002626920469555007"; + results[42][45]="3.383082428693337E-21"; + results[42][46]="1.841949575985368E+19"; + results[42][47]="1.229837371638349E-26"; + results[42][48]="152524432145942.5"; + results[42][49]="5.208442236736284E-31"; + results[42][50]="5140293669.325014"; + results[42][51]="1.296425634527369E-36"; + results[42][52]="92108.04505293148"; + results[42][53]="2.700461535017569E-41"; + results[42][54]="0.3756270036031754"; + results[42][55]="1.367701979050812E-25"; + results[42][56]="1.578801102230280E+23"; + results[42][57]="1.371821232626794E-30"; + results[42][58]="1.261915397360943E+18"; + results[42][59]="2.691723687946608E-35"; + results[42][60]="65179890502974.45"; + results[42][61]="1.244300874447829E-40"; + results[42][62]="465998328.3633725"; + results[42][63]="1.058324044509485E-45"; + results[42][64]="4869.178835365991"; + results[42][65]="1.148246107257210E-29"; + results[42][66]="1.023673834038115E+27"; + results[42][67]="3.706553195815928E-34"; + results[42][68]="2.183859840685134E+22"; + results[42][69]="1.646275491848131E-39"; + results[42][70]="1.603452775675989E+17"; + results[42][71]="1.006086934575439E-44"; + results[42][72]="3908153501227.777"; + results[42][73]="1.906425361460782E-49"; + results[42][74]="10915018.37993031"; + results[43][0]="2.278801107346606E+36"; + results[43][1]="5.010812670929508E+30"; + results[43][2]="1.124264543740979E+26"; + results[43][3]="1.311015082733337E+21"; + results[43][4]="9150468694555485"; + results[43][5]="2.854889460681936E+31"; + results[43][6]="1.774183082168003E+40"; + results[43][7]="2.737821187083793E+26"; + results[43][8]="2.615480077546344E+34"; + results[43][9]="2.552040580472019E+21"; + results[43][10]="9.313833025008547E+29"; + results[43][11]="3.092600945563700E+16"; + results[43][12]="4.152521525954315E+24"; + results[43][13]="389101492911.9866"; + results[43][14]="3.128663507069788E+19"; + results[43][15]="3.360955124054725E+27"; + results[43][16]="3.861067223485925E+43"; + results[43][17]="3.977797696073652E+22"; + results[43][18]="3.030213233404445E+38"; + results[43][19]="2.563874912653335E+17"; + results[43][20]="1.025447991701273E+34"; + results[43][21]="4780354900735.599"; + results[43][22]="5.891196673382220E+28"; + results[43][23]="52393070.69974453"; + results[43][24]="3.120495211724467E+23"; + results[43][25]="3.123823451568468E+23"; + results[43][26]="8.367076862526411E+47"; + results[43][27]="3.641687307612366E+18"; + results[43][28]="1.290391144673877E+43"; + results[43][29]="62164195833605.98"; + results[43][30]="2.908182788312382E+37"; + results[43][31]="758487966.3133965"; + results[43][32]="5.912488283338024E+32"; + results[43][33]="3263.668678379727"; + results[43][34]="1.564182465516227E+28"; + results[43][35]="3.839716512812981E+19"; + results[43][36]="8.090976486489524E+51"; + results[43][37]="324870292108974.2"; + results[43][38]="3.959776503909459E+46"; + results[43][39]="3462462090.893108"; + results[43][40]="7.179423583569754E+41"; + results[43][41]="55433.42761611934"; + results[43][42]="2.592757622182496E+36"; + results[43][43]="1"; + results[43][44]="6.810968070305965E+31"; + results[43][45]="8771512753466319"; + results[43][46]="4.775728802811879E+55"; + results[43][47]="31886702193.60218"; + results[43][48]="3.954588840154493E+50"; + results[43][49]="1350422.830899525"; + results[43][50]="1.332753559139886E+46"; + results[43][51]="3.361317445513614"; + results[43][52]="2.388138358753168E+41"; + results[43][53]="0.00007001642228327445"; + results[43][54]="9.739097766897050E+35"; + results[43][55]="354611973105.8077"; + results[43][56]="4.093448591717685E+59"; + results[43][57]="3556799.957164907"; + results[43][58]="3.271840765057037E+54"; + results[43][59]="69.78987108732747"; + results[43][60]="1.689956579146075E+50"; + results[43][61]="0.0003226170576512954"; + results[43][62]="1.208220717788436E+45"; + results[43][63]="2.743977733140975E-9"; + results[43][64]="1.262460053916486E+40"; + results[43][65]="29771238.46732512"; + results[43][66]="2.654138135831102E+63"; + results[43][67]="961.0194050476638"; + results[43][68]="5.662219247714633E+58"; + results[43][69]="0.004268393329701480"; + results[43][70]="4.157364405943601E+53"; + results[43][71]="2.608539568198692E-8"; + results[43][72]="1.013289477896753E+49"; + results[43][73]="4.942898887049463E-13"; + results[43][74]="2.829999710082635E+43"; + results[44][0]="33457.81515672613"; + results[44][1]="0.07356975717997179"; + results[44][2]="0.000001650667764311622"; + results[44][3]="1.924858653278701E-11"; + results[44][4]="1.343490176447769E-16"; + results[44][5]="0.4191605996698921"; + results[44][6]="260489120.4677608"; + results[44][7]="0.000004019724008133258"; + results[44][8]="384.0100336028812"; + results[44][9]="3.746957193351482E-11"; + results[44][10]="0.01367475655276438"; + results[44][11]="4.540618769080169E-16"; + results[44][12]="6.096815435177592E-8"; + results[44][13]="5.712866201918743E-21"; + results[44][14]="4.593566545569257E-13"; + results[44][15]="0.00004934621759141124"; + results[44][16]="566889637953.1077"; + results[44][17]="5.840282401874423E-10"; + results[44][18]="4449019.878121849"; + results[44][19]="3.764332597345680E-15"; + results[44][20]="150.5583319604680"; + results[44][21]="7.018612995084639E-20"; + results[44][22]="0.0008649573177513917"; + results[44][23]="7.692455779988837E-25"; + results[44][24]="4.581573690425900E-9"; + results[44][25]="4.586460278954353E-9"; + results[44][26]="1.228471015596839E+16"; + results[44][27]="5.346798384636640E-14"; + results[44][28]="189457817354.8698"; + results[44][29]="9.127071980358501E-19"; + results[44][30]="426985.2329790381"; + results[44][31]="1.113627253106948E-23"; + results[44][32]="8.680833946520647"; + results[44][33]="4.791783847304273E-29"; + results[44][34]="0.0002296564085119783"; + results[44][35]="5.637548837665439E-13"; + results[44][36]="1.187933404322369E+20"; + results[44][37]="4.769810822125617E-18"; + results[44][38]="581382332589848.2"; + results[44][39]="5.083656324845414E-23"; + results[44][40]="10540973778.55897"; + results[44][41]="8.138847083690577E-28"; + results[44][42]="38067.38771080486"; + results[44][43]="1.468220067511016E-32"; + results[44][44]="1"; + results[44][45]="1.287851104706806E-16"; + results[44][46]="7.011820865278762E+23"; + results[44][47]="4.681669604739426E-22"; + results[44][48]="5.806206693869941E+18"; + results[44][49]="1.982717899951718E-26"; + results[44][50]="195677552057591.1"; + results[44][51]="4.935153726777955E-32"; + results[44][52]="3506312662.314225"; + results[44][53]="1.027995162516290E-36"; + results[44][54]="14299.13878080998"; + results[44][55]="5.206484150936237E-21"; + results[44][56]="6.010083367684613E+27"; + results[44][57]="5.222165073231839E-26"; + results[44][58]="4.803782268957339E+22"; + results[44][59]="1.024668892394211E-30"; + results[44][60]="2.481228162724536E+18"; + results[44][61]="4.736728381649903E-36"; + results[44][62]="17739339038395.46"; + results[44][63]="4.028763172600968E-41"; + results[44][64]="185356918.5591225"; + results[44][65]="4.371072975238266E-25"; + results[44][66]="3.896858872973504E+31"; + results[44][67]="1.410987975758478E-29"; + results[44][68]="8.313383926141755E+26"; + results[44][69]="6.266940742697879E-35"; + results[44][70]="6.103925848762411E+21"; + results[44][71]="3.829910140925841E-40"; + results[44][72]="1.487731945645773E+17"; + results[44][73]="7.257263337643890E-45"; + results[44][74]="415506236539.3683"; + results[45][0]="2.597956785100805E+20"; + results[45][1]="571259805664574.7"; + results[45][2]="12817225207.78065"; + results[45][3]="149462.8258067859"; + results[45][4]="1.043203031420026"; + results[45][5]="3254728734851059"; + results[45][6]="2.022664883508130E+24"; + results[45][7]="31212645572.47396"; + results[45][8]="2.981789060858130E+18"; + results[45][9]="290946.4595446784"; + results[45][10]="106182745061026.3"; + results[45][11]="3.525732712799818"; + results[45][12]="473409962.7585133"; + results[45][13]="0.00004435967932193017"; + results[45][14]="3566.845987692836"; + results[45][15]="383167102245.4531"; + results[45][16]="4.401825924450844E+27"; + results[45][17]="4534904.990592084"; + results[45][18]="3.454607339203797E+22"; + results[45][19]="29.22956375615078"; + results[45][20]="1.169066295088082E+18"; + results[45][21]="0.0005449863706629740"; + results[45][22]="6716283540777.093"; + results[45][23]="5.973094057127134E-9"; + results[45][24]="35575336.88235604"; + results[45][25]="35613280.62065461"; + results[45][26]="9.538921161825726E+31"; + results[45][27]="415.1720928836645"; + results[45][28]="1.471115850756691E+27"; + results[45][29]="0.007087055286904757"; + results[45][30]="3.315486017121880E+21"; + results[45][31]="8.647173955412170E-8"; + results[45][32]="6.740557130241340E+16"; + results[45][33]="3.720759200959941E-13"; + results[45][34]="1783252797412.961"; + results[45][35]="4377.484956965496"; + results[45][36]="9.224151767085032E+35"; + results[45][37]="0.03703697426428437"; + results[45][38]="4.514359854683718E+30"; + results[45][39]="3.947394466849308E-7"; + results[45][40]="8.184932046906727E+25"; + results[45][41]="6.319711225890107E-12"; + results[45][42]="2.955884230069542E+20"; + results[45][43]="1.140054205136760E-16"; + results[45][44]="7764872789604521"; + results[45][45]="1"; + results[45][46]="5.444589704238428E+39"; + results[45][47]="0.000003635256892375972"; + results[45][48]="4.508445636805033E+34"; + results[45][49]="1.539555227079692E-10"; + results[45][50]="1.519411299508411E+30"; + results[45][51]="3.832084088557348E-16"; + results[45][52]="2.722607178344951E+25"; + results[45][53]="7.982251665267820E-21"; + results[45][54]="1.110309936338901E+20"; + results[45][55]="0.00004042768711311199"; + results[45][56]="4.666753280498896E+43"; + results[45][57]="4.054944747996101E-10"; + results[45][58]="3.730075822741150E+38"; + results[45][59]="7.956423600906009E-15"; + results[45][60]="1.926642104554017E+34"; + results[45][61]="3.678009332242079E-20"; + results[45][62]="1.377437110048061E+29"; + results[45][63]="3.128283353469004E-25"; + results[45][64]="1.439272893284671E+24"; + results[45][65]="3.394082560680328E-9"; + results[45][66]="3.025861342768090E+47"; + results[45][67]="1.095614213942617E-13"; + results[45][68]="6.455236863763371E+42"; + results[45][69]="4.866199764703870E-19"; + results[45][70]="4.739620773281892E+37"; + results[45][71]="2.973876503990548E-24"; + results[45][72]="1.155204930297025E+33"; + results[45][73]="5.635172661746553E-29"; + results[45][74]="3.226353070015521E+27"; + results[46][0]="4.771630051532411E-20"; + results[46][1]="1.049224710578041E-25"; + results[46][2]="2.354121413006176E-30"; + results[46][3]="2.745162334095334E-35"; + results[46][4]="1.916036080015227E-40"; + results[46][5]="5.977913693510024E-25"; + results[46][6]="3.714999648060815E-16"; + results[46][7]="5.732781948321280E-30"; + results[46][8]="5.476609299938448E-22"; + results[46][9]="5.343771989249925E-35"; + results[46][10]="1.950243284234377E-26"; + results[46][11]="6.475662821856263E-40"; + results[46][12]="8.695053043023237E-32"; + results[46][13]="8.147478824234940E-45"; + results[46][14]="6.551174985538704E-37"; + results[46][15]="7.037575337351325E-29"; + results[46][16]="8.084770687172574E-13"; + results[46][17]="8.329195103649068E-34"; + results[46][18]="6.345027865946450E-18"; + results[46][19]="5.368552148823365E-39"; + results[46][20]="2.147207335344303E-22"; + results[46][21]="1.000968668472338E-43"; + results[46][22]="1.233570187216990E-27"; + results[46][23]="1.097069638227704E-48"; + results[46][24]="6.534071218380670E-33"; + results[46][25]="6.541040290498085E-33"; + results[46][26]="1.752E-8"; + results[46][27]="7.625406420624627E-38"; + results[46][28]="2.701977432039512E-13"; + results[46][29]="1.301669303269579E-42"; + results[46][30]="6.089505724445841E-19"; + results[46][31]="1.588214066650539E-47"; + results[46][32]="1.238028482659409E-23"; + results[46][33]="6.833865181913444E-53"; + results[46][34]="3.275274895415460E-28"; + results[46][35]="8.040063980501181E-37"; + results[46][36]="0.0001694186755689661"; + results[46][37]="6.802528064778204E-42"; + results[46][38]="8.291460146518372E-10"; + results[46][39]="7.250122931717692E-47"; + results[46][40]="1.503314756763955E-14"; + results[46][41]="1.160732317619898E-51"; + results[46][42]="5.429030267916215E-20"; + results[46][43]="2.093921244881440E-56"; + results[46][44]="1.426163074062281E-24"; + results[46][45]="1.836685690423163E-40"; + results[46][46]="1"; + results[46][47]="6.676824315239122E-46"; + results[46][48]="0.000008280597587170547"; + results[46][49]="2.827679055193452E-50"; + results[46][50]="2.790680991674361E-10"; + results[46][51]="7.038334009951569E-56"; + results[46][52]="5.000573645109554E-15"; + results[46][53]="1.466088741095387E-60"; + results[46][54]="2.039290372008313E-20"; + results[46][55]="7.425295441755768E-45"; + results[46][56]="8571.358971027673"; + results[46][57]="7.447658994100996E-50"; + results[46][58]="0.06850976887822076"; + results[46][59]="1.461344937472920E-54"; + results[46][60]="0.000003538635984001130"; + results[46][61]="6.755347109771878E-60"; + results[46][62]="2.529919029483109E-11"; + results[46][63]="5.745673270905503E-65"; + results[46][64]="2.643491927709899E-16"; + results[46][65]="6.233862871316364E-49"; + results[46][66]="55575562.29466768"; + results[46][67]="2.012298948972625E-53"; + results[46][68]="1185.624117596628"; + results[46][69]="8.937679474572159E-59"; + results[46][70]="0.008705193652319216"; + results[46][71]="5.462076419965100E-64"; + results[46][72]="2.121748364982833E-7"; + results[46][73]="1.035004099089370E-68"; + results[46][74]="5.925796515950347E-13"; + results[47][0]="7.146556246270681E+25"; + results[47][1]="1.571442741399231E+20"; + results[47][2]="3525810028628656"; + results[47][3]="41114790572.36538"; + results[47][4]="286968.1737232600"; + results[47][5]="8.953228977234115E+20"; + results[47][6]="5.564021865277680E+29"; + results[47][7]="8586090748616571"; + results[47][8]="8.202416360482460E+23"; + results[47][9]="80034635283.92306"; + results[47][10]="2.920914482927399E+19"; + results[47][11]="969871.6809241588"; + results[47][12]="130227375058794.5"; + results[47][13]="12.20262573876507"; + results[47][14]="981181273.6462696"; + results[47][15]="1.054030330150941E+17"; + results[47][16]="1.210870663276248E+33"; + results[47][17]="1247478548243.150"; + results[47][18]="9.503062483559163E+27"; + results[47][19]="8040577.219577623"; + results[47][20]="3.215911088814389E+23"; + results[47][21]="149.9168798238013"; + results[47][22]="1.847540281090668E+18"; + results[47][23]="0.001643100951037101"; + results[47][24]="9786196116419.247"; + results[47][25]="9796633821214.788"; + results[47][26]="2.624001946556017E+37"; + results[47][27]="114207084.9942909"; + results[47][28]="4.046800251839102E+32"; + results[47][29]="1949.533553397026"; + results[47][30]="9.120362371295601E+26"; + results[47][31]="0.02378696805044898"; + results[47][32]="1.854217550450959E+22"; + results[47][33]="1.023520293369992E-7"; + results[47][34]="4.905438185545787E+17"; + results[47][35]="1204174859.319065"; + results[47][36]="2.537414009565692E+41"; + results[47][37]="10188.26876910955"; + results[47][38]="1.241826915768028E+36"; + results[47][39]="0.1085863966072925"; + results[47][40]="2.251541579928655E+31"; + results[47][41]="0.000001738449692274594"; + results[47][42]="8.131156387513517E+25"; + results[47][43]="3.136103551657476E-11"; + results[47][44]="2.135990115551220E+21"; + results[47][45]="275083.7229955457"; + results[47][46]="1.497718006025124E+45"; + results[47][47]="1"; + results[47][48]="1.240200010695352E+40"; + results[47][49]="0.00004235065836223342"; + results[47][50]="4.179653170302738E+35"; + results[47][51]="1.054143957912348E-10"; + results[47][52]="7.489449188735266E+30"; + results[47][53]="2.195787505969266E-15"; + results[47][54]="3.054281909670523E+25"; + results[47][55]="11.12099868317389"; + results[47][56]="1.283747866701312E+49"; + results[47][57]="0.0001115449297820002"; + results[47][58]="1.026083144375309E+44"; + results[47][59]="2.188682625866851E-9"; + results[47][60]="5.299878830006924E+39"; + results[47][61]="1.011760500325512E-14"; + results[47][62]="3.789105284242457E+34"; + results[47][63]="8.605398314572440E-20"; + results[47][64]="3.959205458913181E+29"; + results[47][65]="0.0009336568669461997"; + results[47][66]="8.323652034369472E+52"; + results[47][67]="3.013856369381733E-8"; + results[47][68]="1.775730589302118E+48"; + results[47][69]="1.338612348114789E-13"; + results[47][70]="1.303792527901410E+43"; + results[47][71]="8.180650204466976E-19"; + results[47][72]="3.177780730489156E+38"; + results[47][73]="1.550144275515960E-23"; + results[47][74]="8.875172141979778E+32"; + results[48][0]="5.762422338848205E-15"; + results[48][1]="1.267088153400481E-20"; + results[48][2]="2.842936621692024E-25"; + results[48][3]="3.315174183018531E-30"; + results[48][4]="2.313886238094478E-35"; + results[48][5]="7.219181503001472E-20"; + results[48][6]="4.486390757373126E-11"; + results[48][7]="6.923150035938593E-25"; + results[48][8]="6.613785107035720E-17"; + results[48][9]="6.453365150275192E-30"; + results[48][10]="2.355196305223146E-21"; + results[48][11]="7.820284410257130E-35"; + results[48][12]="1.050051394418058E-26"; + results[48][13]="9.839240149597593E-40"; + results[48][14]="7.911476094054727E-32"; + results[48][15]="8.498873738599392E-24"; + results[48][16]="9.763511150087314E-8"; + results[48][17]="1.005868841707006E-28"; + results[48][18]="7.662524110309441E-13"; + results[48][19]="6.483290719429564E-34"; + results[48][20]="2.593058426931717E-17"; + results[48][21]="1.208812115230884E-38"; + results[48][22]="1.489711550683502E-22"; + results[48][23]="1.324867712358631E-43"; + results[48][24]="7.890820861170891E-28"; + results[48][25]="7.899237007522711E-28"; + results[48][26]="0.002115789327468880"; + results[48][27]="9.208763426010420E-33"; + results[48][28]="3.263022268134115E-8"; + results[48][29]="1.571950924515769E-37"; + results[48][30]="7.353944761040615E-14"; + results[48][31]="1.917994504540616E-42"; + results[48][32]="1.495095576891135E-18"; + results[48][33]="8.252864735875365E-48"; + results[48][34]="3.955360541236747E-23"; + results[48][35]="9.709521439561277E-32"; + results[48][36]="20.45971607549835"; + results[48][37]="8.215020707343183E-37"; + results[48][38]="0.0001001311808626548"; + results[48][39]="8.755555206487259E-42"; + results[48][40]="1.815466505814869E-9"; + results[48][41]="1.401749457573287E-46"; + results[48][42]="6.556326654887352E-15"; + results[48][43]="2.528707889543666E-51"; + results[48][44]="1.722294869481269E-19"; + results[48][45]="2.218059350292316E-35"; + results[48][46]="120764.2310199132"; + results[48][47]="8.063215540849113E-41"; + results[48][48]="1"; + results[48][49]="3.414824866715520E-45"; + results[48][50]="0.00003370144439814430"; + results[48][51]="8.499789943731035E-51"; + results[48][52]="6.038904309100998E-10"; + results[48][53]="1.770510794253370E-55"; + results[48][54]="2.462733336018967E-15"; + results[48][55]="8.967100941193022E-40"; + results[48][56]="1035113574.931792"; + results[48][57]="8.994108113211472E-45"; + results[48][58]="8273.529555930313"; + results[48][59]="1.764781976287603E-49"; + results[48][60]="0.4273406534672904"; + results[48][61]="8.158042989841942E-55"; + results[48][62]="0.000003055237261381728"; + results[48][63]="6.938718142525727E-60"; + results[48][64]="3.192392698572340E-11"; + results[48][65]="7.528276559381090E-44"; + results[48][66]="6711540044014.826"; + results[48][67]="2.430137351548587E-48"; + results[48][68]="143180984.8402199"; + results[48][69]="1.079351988849169E-53"; + results[48][70]="1051.276017301760"; + results[48][71]="6.596234586290859E-59"; + results[48][72]="0.02562313097149101"; + results[48][73]="1.249914741289858E-63"; + results[48][74]="7.156242594292246E-8"; + results[49][0]="1.687472290311238E+30"; + results[49][1]="3.710550915072856E+24"; + results[49][2]="8.325277964917845E+19"; + results[49][3]="970818215402995.0"; + results[49][4]="6776002660.189255"; + results[49][5]="2.114070789798686E+25"; + results[49][6]="1.313798198291870E+34"; + results[49][7]="2.027380702131727E+20"; + results[49][8]="1.936786033011718E+28"; + results[49][9]="1889808526690925"; + results[49][10]="6.896975385705340E+23"; + results[49][11]="22900982379.74620"; + results[49][12]="3.074978762902205E+18"; + results[49][13]="288133.0824752154"; + results[49][14]="23168028823874.12"; + results[49][15]="2.488816870650781E+21"; + results[49][16]="2.859154284968690E+37"; + results[49][17]="2.945594228012286E+16"; + results[49][18]="2.243899587646931E+32"; + results[49][19]="189857195390.0929"; + results[49][20]="7.593532693891262E+27"; + results[49][21]="3539894.906509671"; + results[49][22]="4.362483022786321E+22"; + results[49][23]="38.79753030008030"; + results[49][24]="2.310754187742728E+17"; + results[49][25]="2.313218778660363E+17"; + results[49][26]="6.195894108923685E+41"; + results[49][27]="2696701525096.859"; + results[49][28]="9.555460076266186E+36"; + results[49][29]="46033134.51994738"; + results[49][30]="2.153534968284877E+31"; + results[49][31]="561.6670193647148"; + results[49][32]="4.378249647482396E+26"; + results[49][33]="0.002416775400787454"; + results[49][34]="1.158290892101044E+22"; + results[49][35]="28433438956710.49"; + results[49][36]="5.991439348740924E+45"; + results[49][37]="240569312.5704755"; + results[49][38]="2.932249376494788E+40"; + results[49][39]="2563.983673607429"; + results[49][40]="5.316426395714516E+35"; + results[49][41]="0.04104894137430629"; + results[49][42]="1.919959854688953E+30"; + results[49][43]="7.405088074035996E-7"; + results[49][44]="5.043581843006266E+25"; + results[49][45]="6495382448.194808"; + results[49][46]="3.536469240253245E+49"; + results[49][47]="23612.38381341809"; + results[49][48]="2.928407865794388E+44"; + results[49][49]="1"; + results[49][50]="9.869157486415798E+39"; + results[49][51]="0.000002489085172882200"; + results[49][52]="1.768437487955098E+35"; + results[49][53]="5.184777736365438E-11"; + results[49][54]="7.211887672551995E+29"; + results[49][55]="262593.2892956190"; + results[49][56]="3.031234734820807E+53"; + results[49][57]="2.633841694453359"; + results[49][58]="2.422826902946868E+48"; + results[49][59]="0.00005168001420772782"; + results[49][60]="1.251427730987327E+44"; + results[49][61]="2.389007726094191E-10"; + results[49][62]="8.946980828098355E+38"; + results[49][63]="2.031939678710256E-15"; + results[49][64]="9.348627889203813E+33"; + results[49][65]="22.04586429236709"; + results[49][66]="1.965412665648703E+57"; + results[49][67]="0.0007116433335235624"; + results[49][68]="4.192923222382870E+52"; + results[49][69]="3.160782854106722E-9"; + results[49][70]="3.078564958187471E+47"; + results[49][71]="1.931646524711914E-14"; + results[49][72]="7.503497828319405E+42"; + results[49][73]="3.660260159965578E-19"; + results[49][74]="2.095639710265825E+37"; + results[50][0]="1.709844323220016E-10"; + results[50][1]="3.759744355260485E-16"; + results[50][2]="8.435652158126978E-21"; + results[50][3]="9.836890501942623E-26"; + results[50][4]="6.865836997247178E-31"; + results[50][5]="2.142098545603874E-15"; + results[50][6]="0.000001331216165209868"; + results[50][7]="2.054259145142100E-20"; + results[50][8]="1.962463397384800E-12"; + results[50][9]="1.914863076500820E-25"; + results[50][10]="6.988413545126361E-17"; + results[50][11]="2.320459716168051E-30"; + results[50][12]="3.115745966294182E-22"; + results[50][13]="2.919530698256769E-35"; + results[50][14]="2.347518403243974E-27"; + results[50][15]="2.521812904573124E-19"; + results[50][16]="0.002897060148147514"; + results[50][17]="2.984646087638879E-24"; + results[50][18]="2.273648577130825E-8"; + results[50][19]="1.923742686763465E-29"; + results[50][20]="7.694205614150171E-13"; + results[50][21]="3.586825837344361E-34"; + results[50][22]="4.420319595457841E-18"; + results[50][23]="3.931189704235886E-39"; + results[50][24]="2.341389516707296E-23"; + results[50][25]="2.343886782477983E-23"; + results[50][26]="62.78037530003851"; + results[50][27]="2.732453635286172E-28"; + results[50][28]="0.0009682143677835323"; + results[50][29]="4.664342886746792E-33"; + results[50][30]="2.182085929066454E-9"; + results[50][31]="5.691134427004636E-38"; + results[50][32]="4.436295249628704E-14"; + results[50][33]="2.448816329168904E-43"; + results[50][34]="1.173647186900553E-18"; + results[50][35]="2.881040149156310E-27"; + results[50][36]="607087.2166127371"; + results[50][37]="2.437587128400801E-32"; + results[50][38]="2.971124313834108"; + results[50][39]="2.597976247857604E-37"; + results[50][40]="0.00005386910081262968"; + results[50][41]="4.159315669124470E-42"; + results[50][42]="1.945414142323337E-10"; + results[50][43]="7.503262648537709E-47"; + results[50][44]="5.110448232230970E-15"; + results[50][45]="6.581496401425599E-31"; + results[50][46]="3583354754.568408"; + results[50][47]="2.392543015543006E-36"; + results[50][48]="29672.31873465527"; + results[50][49]="1.013257718682096E-40"; + results[50][50]="1"; + results[50][51]="2.522084763880048E-46"; + results[50][52]="0.00001791882934677280"; + results[50][53]="5.253516061023365E-51"; + results[50][54]="7.307500850481565E-11"; + results[50][55]="2.660746772529066E-35"; + results[50][56]="30714219921944.59"; + results[50][57]="2.668760426691597E-40"; + results[50][58]="245494806.0441551"; + results[50][59]="5.236517329758060E-45"; + results[50][60]="12680.18807795731"; + results[50][61]="2.420680518456101E-50"; + results[50][62]="0.09065597382971390"; + results[50][63]="2.058878563349585E-55"; + results[50][64]="9.472569367822474E-7"; + results[50][65]="2.233814215925896E-39"; + results[50][66]="1.991469553864102E+17"; + results[50][67]="7.210781006414067E-44"; + results[50][68]="4248511818920.849"; + results[50][69]="3.202687624001662E-49"; + results[50][70]="31193797.06347679"; + results[50][71]="1.957255750929793E-54"; + results[50][72]="760.2977091658982"; + results[50][73]="3.708786859469685E-59"; + results[50][74]="0.002123423112003558"; + results[51][0]="6.779487936755711E+35"; + results[51][1]="1.490728784815458E+30"; + results[51][2]="3.344713975889266E+25"; + results[51][3]="3.900301307403033E+20"; + results[51][4]="2722286378148756"; + results[51][5]="8.493364601705167E+30"; + results[51][6]="5.278237211829022E+39"; + results[51][7]="8.145083680620504E+25"; + results[51][8]="7.781115946181321E+33"; + results[51][9]="7.592381921196569E+20"; + results[51][10]="2.770887658182901E+29"; + results[51][11]="9200561969210697"; + results[51][12]="1.235385111125618E+24"; + results[51][13]="115758627151.1858"; + results[51][14]="9.307848954420085E+18"; + results[51][15]="9.998922084971854E+26"; + results[51][16]="1.148676757275435E+43"; + results[51][17]="1.183404352773304E+22"; + results[51][18]="9.014957029568579E+37"; + results[51][19]="7.627589343206385E+16"; + results[51][20]="3.050732364091198E+33"; + results[51][21]="1422167045577.915"; + results[51][22]="1.752645136580379E+28"; + results[51][23]="15587064.16428300"; + results[51][24]="9.283548079903686E+22"; + results[51][25]="9.293449673246033E+22"; + results[51][26]="2.489225429658254E+47"; + results[51][27]="1.083410706261310E+18"; + results[51][28]="3.838944597143528E+42"; + results[51][29]="18493997321370.88"; + results[51][30]="8.651913529303709E+36"; + results[51][31]="225651988.7241708"; + results[51][32]="1.758979441596474E+32"; + results[51][33]="970.9492576298560"; + results[51][34]="4.653480341774795E+27"; + results[51][35]="1.142324869654275E+19"; + results[51][36]="2.407084905737968E+51"; + results[51][37]="96649690895033.44"; + results[51][38]="1.178043004892208E+46"; + results[51][39]="1030090774.530830"; + results[51][40]="2.135895731345520E+41"; + results[51][41]="16491.57763724665"; + results[51][42]="7.713516096621809E+35"; + results[51][43]="0.2975023978573374"; + results[51][44]="2.026279332645786E+31"; + results[51][45]="2609546076992446"; + results[51][46]="1.420790770352885E+55"; + results[51][47]="9486370362.359466"; + results[51][48]="1.176499662485828E+50"; + results[51][49]="401754.0303139023"; + results[51][50]="3.964973795970168E+45"; + results[51][51]="1"; + results[51][52]="7.104768881441538E+40"; + results[51][53]="0.00002083005351866606"; + results[51][54]="2.897404938618912E+35"; + results[51][55]="105497912307.8994"; + results[51][56]="1.217810771541752E+59"; + results[51][57]="1058156.515955435"; + results[51][58]="9.733804730118538E+53"; + results[51][59]="20.76265399463438"; + results[51][60]="5.027661345707404E+49"; + results[51][61]="0.00009597934824093921"; + results[51][62]="3.594485606829729E+44"; + results[51][63]="8.163399552765810E-10"; + results[51][64]="3.755848932392581E+39"; + results[51][65]="8857014.831211825"; + results[51][66]="7.896124596543564E+62"; + results[51][67]="285.9055773891117"; + results[51][68]="1.684523803389072E+58"; + results[51][69]="0.001269857250584455"; + results[51][70]="1.236825879534966E+53"; + results[51][71]="7.760467764448543E-9"; + results[51][72]="3.014560493978934E+48"; + results[51][73]="1.470524271263579E-13"; + results[51][74]="8.419316996851535E+42"; + results[52][0]="0.000009542165339768479"; + results[52][1]="2.098208695724657E-11"; + results[52][2]="4.707702715884311E-16"; + results[52][3]="5.489694840870986E-21"; + results[52][4]="3.831632560574457E-26"; + results[52][5]="1.195445586399130E-10"; + results[52][6]="0.07429146957357580"; + results[52][7]="1.146424861461206E-15"; + results[52][8]="1.095196209197808E-7"; + results[52][9]="1.068631794769388E-20"; + results[52][10]="3.900039120795011E-12"; + results[52][11]="1.294983992124446E-25"; + results[52][12]="1.738811116505963E-17"; + results[52][13]="1.629308835837862E-30"; + results[52][14]="1.310084692372364E-22"; + results[52][15]="1.407353603167891E-14"; + results[52][16]="161.6768647148971"; + results[52][17]="1.665647922572809E-19"; + results[52][18]="0.001268859998122764"; + results[52][19]="1.073587258148610E-24"; + results[52][20]="4.293922033213574E-8"; + results[52][21]="2.001707682980056E-29"; + results[52][22]="2.466857354302527E-13"; + results[52][23]="2.193887573879874E-34"; + results[52][24]="1.306664331355432E-18"; + results[52][25]="1.308057985886294E-18"; + results[52][26]="3503598.035624204"; + results[52][27]="1.524906333112822E-23"; + results[52][28]="54.03334944745757"; + results[52][29]="2.603039962310287E-28"; + results[52][30]="0.0001217761432311118"; + results[52][31]="3.176063746613903E-33"; + results[52][32]="2.475772922312967E-9"; + results[52][33]="1.366616245837476E-38"; + results[52][34]="6.549798338873787E-14"; + results[52][35]="1.607828331528359E-22"; + results[52][36]="33879848111.95684"; + results[52][37]="1.360349541383301E-27"; + results[52][38]="165810.1796906287"; + results[52][39]="1.449858245525120E-32"; + results[52][40]="3.006284605435543"; + results[52][41]="2.321198326426144E-37"; + results[52][42]="0.00001085681494407283"; + results[52][43]="4.187362077807307E-42"; + results[52][44]="2.851998941075561E-10"; + results[52][45]="3.672949986886802E-26"; + results[52][46]="199977056827865.5"; + results[52][47]="1.335211675518248E-31"; + results[52][48]="1655929534.258291"; + results[52][49]="5.654709351113861E-36"; + results[52][50]="55807.21712605078"; + results[52][51]="1.407505320281584E-41"; + results[52][52]="1"; + results[52][53]="2.931841114927259E-46"; + results[52][54]="0.000004078112866116254"; + results[52][55]="1.484888728519684E-30"; + results[52][56]="1.714075140041236E+18"; + results[52][57]="1.489360925897899E-35"; + results[52][58]="13700381944223.89"; + results[52][59]="2.922354596061357E-40"; + results[52][60]="707646009.2657238"; + results[52][61]="1.350914432862808E-45"; + results[52][62]="5059.257615288420"; + results[52][63]="1.149002830210218E-50"; + results[52][64]="0.05286377354516463"; + results[52][65]="1.246629549674354E-34"; + results[52][66]="1.111383737924134E+22"; + results[52][67]="4.024136212733528E-39"; + results[52][68]="2.370976215411088E+17"; + results[52][69]="1.787330836195764E-44"; + results[52][70]="1740839005707.414"; + results[52][71]="1.092289966633505E-49"; + results[52][72]="42430099.33586029"; + results[52][73]="2.069770735406687E-54"; + results[52][74]="118.5023346620570"; + results[53][0]="3.254666595398102E+40"; + results[53][1]="7.156624842464271E+34"; + results[53][2]="1.605715497990454E+30"; + results[53][3]="1.872439407756647E+25"; + results[53][4]="1.306903208726412E+20"; + results[53][5]="4.077456927364187E+35"; + results[53][6]="2.533952784662378E+44"; + results[53][7]="3.910255762579582E+30"; + results[53][8]="3.735523741793833E+38"; + results[53][9]="3.644917145504665E+25"; + results[53][10]="1.330235496370605E+34"; + results[53][11]="4.416965112915320E+20"; + results[53][12]="5.930782222996091E+28"; + results[53][13]="5557288993398558"; + results[53][14]="4.468470974440470E+23"; + results[53][15]="4.800238307602860E+31"; + results[53][16]="5.514516591357251E+47"; + results[53][17]="5.681235296456829E+26"; + results[53][18]="4.327860714083221E+42"; + results[53][19]="3.661819369005083E+21"; + results[53][20]="1.464582105541592E+38"; + results[53][21]="6.827476675964822E+16"; + results[53][22]="8.414021284245927E+32"; + results[53][23]="748296885090.3456"; + results[53][24]="4.456804718040974E+27"; + results[53][25]="4.461558231196124E+27"; + results[53][26]="1.195016338977540E+52"; + results[53][27]="5.201190219172758E+22"; + results[53][28]="1.842983549563809E+47"; + results[53][29]="8.878516468907865E+17"; + results[53][30]="4.153572395553678E+41"; + results[53][31]="10833000910053.42"; + results[53][32]="8.444430735716701E+36"; + results[53][33]="46612902.68696511"; + results[53][34]="2.234022268644081E+32"; + results[53][35]="5.484022730093443E+23"; + results[53][36]="1.155582679411242E+56"; + results[53][37]="4.639915630001839E+18"; + results[53][38]="5.655496774583657E+50"; + results[53][39]="49452142482867.52"; + results[53][40]="1.025391379542793E+46"; + results[53][41]="791720367.9994558"; + results[53][42]="3.703070704887838E+40"; + results[53][43]="14282.36358541959"; + results[53][44]="9.727672234879347E+35"; + results[53][45]="1.252779343391509E+20"; + results[53][46]="6.820869514711989E+59"; + results[53][47]="455417474269022.8"; + results[53][48]="5.648087564592924E+54"; + results[53][49]="19287229864.95862"; + results[53][50]="1.903487090139787E+50"; + results[53][51]="48007.55788283925"; + results[53][52]="3.410826033199997E+45"; + results[53][53]="1"; + results[53][54]="1.390973353007717E+40"; + results[53][55]="5064697131640181"; + results[53][56]="5.846412110513578E+63"; + results[53][57]="50799510188.83404"; + results[53][58]="4.672961940014202E+58"; + results[53][59]="996764.3134487737"; + results[53][60]="2.413657430693617E+54"; + results[53][61]="4.607734116234075"; + results[53][62]="1.725624758289108E+49"; + results[53][63]="0.00003919048765501487"; + results[53][64]="1.803091350210368E+44"; + results[53][65]="425203652178.5674"; + results[53][66]="3.790736586186758E+67"; + results[53][67]="13725628.55553436"; + results[53][68]="8.086987399622141E+62"; + results[53][69]="60.96274546037631"; + results[53][70]="5.937699000276846E+57"; + results[53][71]="0.0003725611053996715"; + results[53][72]="1.447216874060142E+53"; + results[53][73]="7.059627907080629E-9"; + results[53][74]="4.041908480603224E+47"; + results[54][0]="2.339848271255880"; + results[54][1]="0.000005145048125465107"; + results[54][2]="1.154382644727447E-10"; + results[54][3]="1.346136073496915E-15"; + results[54][4]="9.395602050179328E-21"; + results[54][5]="0.00002931369546761954"; + results[54][6]="18217.11953851009"; + results[54][7]="2.811165112634539E-10"; + results[54][8]="0.02685546587730432"; + results[54][9]="2.620407599917871E-15"; + results[54][10]="9.563342773563720E-7"; + results[54][11]="3.175449122274317E-20"; + results[54][12]="4.263764083022794E-12"; + results[54][13]="3.995251944533639E-25"; + results[54][14]="3.212477769454207E-17"; + results[54][15]="3.450992283369952E-9"; + results[54][16]="39645019.65068670"; + results[54][17]="4.084359548780881E-14"; + results[54][18]="311.1390095809556"; + results[54][19]="2.632558963898978E-19"; + results[54][20]="0.01052918880419032"; + results[54][21]="4.908416585552623E-24"; + results[54][22]="6.049016874444212E-8"; + results[54][23]="5.379663697167850E-29"; + results[54][24]="3.204090652350726E-13"; + results[54][25]="3.207508052939222E-13"; + results[54][26]="859122381024.4411"; + results[54][27]="3.739245045871056E-18"; + results[54][28]="13249596.37493202"; + results[54][29]="6.382952232485079E-23"; + results[54][30]="29.86090557789883"; + results[54][31]="7.788072206149096E-28"; + results[54][32]="0.0006070878868712484"; + results[54][33]="3.351099615688073E-33"; + results[54][34]="1.606085597408052E-8"; + results[54][35]="3.942579286824783E-17"; + results[54][36]="8307726937489580"; + results[54][37]="3.335732938354928E-22"; + results[54][38]="40658555840.44592"; + results[54][39]="3.555218536425345E-27"; + results[54][40]="737175.4299430523"; + results[54][41]="5.691844249118863E-32"; + results[54][42]="2.662215416909782"; + results[54][43]="1.026789158436190E-36"; + results[54][44]="0.00006993428173045223"; + results[54][45]="9.006494198343990E-21"; + results[54][46]="4.903666558358682E+19"; + results[54][47]="3.274092011067419E-26"; + results[54][48]="406052894714338.1"; + results[54][49]="1.386599522072340E-30"; + results[54][50]="13684569053.92081"; + results[54][51]="3.451364311115807E-36"; + results[54][52]="245211.4575613350"; + results[54][53]="7.189210331295627E-41"; + results[54][54]="1"; + results[54][55]="3.641117294367092E-25"; + results[54][56]="4.203108634591608E+23"; + results[54][57]="3.652083634743231E-30"; + results[54][58]="3.359490625690135E+18"; + results[54][59]="7.165948300112717E-35"; + results[54][60]="173522909369510.1"; + results[54][61]="3.312596971229334E-40"; + results[54][62]="1240587934.023157"; + results[54][63]="2.817486587379466E-45"; + results[54][64]="12962.80296320216"; + results[54][65]="3.056878489146789E-29"; + results[54][66]="2.725240262863416E+27"; + results[54][67]="9.867643061497388E-34"; + results[54][68]="5.813905336242105E+22"; + results[54][69]="4.382739994878830E-39"; + results[54][70]="4.268736699691402E+17"; + results[54][71]="2.678420147978238E-44"; + results[54][72]="10404346502618.53"; + results[54][73]="5.075314988468698E-49"; + results[54][74]="29058130.20690411"; + results[55][0]="6.426182081186150E+24"; + results[55][1]="1.413041028209840E+19"; + results[55][2]="317040773861723.4"; + results[55][3]="3697041222.976872"; + results[55][4]="25804.17297930660"; + results[55][5]="8.050741873371843E+19"; + results[55][6]="5.003167452664180E+28"; + results[55][7]="772061124475030.9"; + results[55][8]="7.375611304488999E+22"; + results[55][9]="7196712953.937829"; + results[55][10]="2.626485773572434E+18"; + results[55][11]="87210.84396777946"; + results[55][12]="11710043204647.52"; + results[55][13]="1.097259885232042"; + results[55][14]="88227802.34034201"; + results[55][15]="9477838818070297"; + results[55][16]="1.088814680922766E+32"; + results[55][17]="112173248444.9072"; + results[55][18]="8.545152062590683E+26"; + results[55][19]="723008.5578324046"; + results[55][20]="2.891746668111807E+22"; + results[55][21]="13.48052311620413"; + results[55][22]="1.661307885852018E+17"; + results[55][23]="0.0001477476077326687"; + results[55][24]="879974577393.4671"; + results[55][25]="880913135619.4773"; + results[55][26]="2.359502074688797E+36"; + results[55][27]="10269499.01244810"; + results[55][28]="3.638882052887863E+31"; + results[55][29]="175.3020217821514"; + results[55][30]="8.201028191015562E+25"; + results[55][31]="0.002138923735908606"; + results[55][32]="1.667312085250398E+21"; + results[55][33]="9.203492622641725E-9"; + results[55][34]="4.410969127231112E+16"; + results[55][35]="108279381.5218219"; + results[55][36]="2.281642217442943E+40"; + results[55][37]="916.1289430349850"; + results[55][38]="1.116650537551916E+35"; + results[55][39]="0.009764086814575751"; + results[55][40]="2.024585780533582E+30"; + results[55][41]="1.563213648163519E-7"; + results[55][42]="7.311534349712662E+24"; + results[55][43]="2.819983745167070E-12"; + results[55][44]="1.920681924711475E+20"; + results[55][45]="24735.52338530067"; + results[55][46]="1.346747759525569E+44"; + results[55][47]="0.08991998187294129"; + results[55][48]="1.115187624805477E+39"; + results[55][49]="0.000003808170432239159"; + results[55][50]="3.758343373088038E+34"; + results[55][51]="9.478860558694889E-12"; + results[55][52]="6.734511352893900E+29"; + results[55][53]="1.974451727335874E-16"; + results[55][54]="2.746409739524259E+24"; + results[55][55]="1"; + results[55][56]="1.154345849032090E+48"; + results[55][57]="0.00001003011806401597"; + results[55][58]="9.226537774235836E+42"; + results[55][59]="1.968063020435687E-10"; + results[55][60]="4.765650083230079E+38"; + results[55][61]="9.097748584902804E-16"; + results[55][62]="3.407162784737478E+33"; + results[55][63]="7.737972604557934E-21"; + results[55][64]="3.560116830967234E+28"; + results[55][65]="0.00008395440855134944"; + results[55][66]="7.484626400471738E+51"; + results[55][67]="2.710059101024540E-9"; + results[55][68]="1.596736624012738E+47"; + results[55][69]="1.203679980773772E-14"; + results[55][70]="1.172370004749711E+42"; + results[55][71]="7.356039180945439E-20"; + results[55][72]="2.857459856817670E+37"; + results[55][73]="1.393889451548389E-24"; + results[55][74]="7.980553181260552E+31"; + results[56][0]="5.566946930657264E-24"; + results[56][1]="1.224105435467771E-29"; + results[56][2]="2.746497283526938E-34"; + results[56][3]="3.202715395976701E-39"; + results[56][4]="2.235393578184839E-44"; + results[56][5]="6.974289273983464E-29"; + results[56][6]="4.334201449989442E-20"; + results[56][7]="6.688299915682963E-34"; + results[56][8]="6.389429399060419E-26"; + results[56][9]="6.234451278160885E-39"; + results[56][10]="2.275302307167926E-30"; + results[56][11]="7.555001305796269E-44"; + results[56][12]="1.014431092247293E-35"; + results[56][13]="9.505469146461484E-49"; + results[56][14]="7.643099545454276E-41"; + results[56][15]="8.210571230465625E-33"; + results[56][16]="9.432309059158727E-17"; + results[56][17]="9.717473193927414E-38"; + results[56][18]="7.402592619669160E-22"; + results[56][19]="6.263361699083869E-43"; + results[56][20]="2.505095566061517E-26"; + results[56][21]="1.167806262525866E-47"; + results[56][22]="1.439176904603599E-31"; + results[56][23]="1.279924970982950E-52"; + results[56][24]="7.623144988404633E-37"; + results[56][25]="7.631275638562877E-37"; + results[56][26]="2.044016597510373E-12"; + results[56][27]="8.896379729748234E-42"; + results[56][28]="3.152332601134258E-17"; + results[56][29]="1.518626518466200E-46"; + results[56][30]="7.104481033905097E-23"; + results[56][31]="1.852931456982391E-51"; + results[56][32]="1.444378291521926E-27"; + results[56][33]="7.972907452613771E-57"; + results[56][34]="3.821185072852883E-32"; + results[56][35]="9.380150811181354E-41"; + results[56][36]="1.976567264789908E-8"; + results[56][37]="7.936347185751581E-46"; + results[56][38]="9.673448719794147E-14"; + results[56][39]="8.458545437455212E-51"; + results[56][40]="1.753881457824083E-18"; + results[56][41]="1.354198700046664E-55"; + results[56][42]="6.333920077629528E-24"; + results[56][43]="2.442927955717607E-60"; + results[56][44]="1.663870430445044E-28"; + results[56][45]="2.142817371937639E-44"; + results[56][46]="0.0001166676140131492"; + results[56][47]="7.789691620439270E-50"; + results[56][48]="9.660775630982277E-10"; + results[56][49]="3.298985685643760E-54"; + results[56][50]="3.255820927704967E-14"; + results[56][51]="8.211456355686501E-60"; + results[56][52]="5.834049958719679E-19"; + results[56][53]="1.710450753551403E-64"; + results[56][54]="2.379191419821972E-24"; + results[56][55]="8.662915025323579E-49"; + results[56][56]="1"; + results[56][57]="8.689006048253338E-54"; + results[56][58]="0.000007992871271614319"; + results[56][59]="1.704916271051602E-58"; + results[56][60]="4.128442171144841E-10"; + results[56][61]="7.881302291277083E-64"; + results[56][62]="2.951596168162563E-15"; + results[56][63]="6.703339914156715E-69"; + results[56][64]="3.084098958689342E-20"; + results[56][65]="7.272899072816394E-53"; + results[56][66]="6483.868250358015"; + results[56][67]="2.347701170578040E-57"; + results[56][68]="0.1383239369164440"; + results[56][69]="1.042737739112631E-62"; + results[56][70]="0.000001015614172938495"; + results[56][71]="6.372474234748120E-68"; + results[56][72]="2.475393192788476E-11"; + results[56][73]="1.207514587345858E-72"; + results[56][74]="6.913485406433592E-17"; + results[57][0]="6.406885781574903E+29"; + results[57][1]="1.408798001370755E+24"; + results[57][2]="3.160887756637065E+19"; + results[57][3]="368593988563342.1"; + results[57][4]="2572668917.216598"; + results[57][5]="8.026567406274776E+24"; + results[57][6]="4.988144128246639E+33"; + results[57][7]="7.697428081578381E+19"; + results[57][8]="7.353464094256007E+27"; + results[57][9]="717510293299212.7"; + results[57][10]="2.618599060159830E+23"; + results[57][11]="8694897050.180986"; + results[57][12]="1.167488072414467E+18"; + results[57][13]="109396.5074218388"; + results[57][14]="8796287518974.268"; + results[57][15]="9.449379117552936E+20"; + results[57][16]="1.085545228853283E+37"; + results[57][17]="1.118364188028252E+16"; + results[57][18]="8.519492999037822E+31"; + results[57][19]="72083753473.07911"; + results[57][20]="2.883063439189447E+27"; + results[57][21]="1344004.430472940"; + results[57][22]="1.656319372562645E+22"; + results[57][23]="14.73039567328003"; + results[57][24]="8.773322225891460E+16"; + results[57][25]="8.782679625475591E+16"; + results[57][26]="2.352417049958506E+41"; + results[57][27]="1023866214425.824"; + results[57][28]="3.627955353728795E+36"; + results[57][29]="17477563.14166077"; + results[57][30]="8.176402449775297E+30"; + results[57][31]="213.2501055578004"; + results[57][32]="1.662305542775258E+26"; + results[57][33]="0.0009175856718636401"; + results[57][34]="4.397724033833556E+21"; + results[57][35]="10795424423794.65"; + results[57][36]="2.274790987384843E+45"; + results[57][37]="91337802.52514549"; + results[57][38]="1.113297501011488E+40"; + results[57][39]="973.4767579262472"; + results[57][40]="2.018506429946206E+35"; + results[57][41]="0.01558519688588414"; + results[57][42]="7.289579547366953E+29"; + results[57][43]="2.811516003270229E-7"; + results[57][44]="1.914914572742777E+25"; + results[57][45]="2466124847.925947"; + results[57][46]="1.342703795638417E+49"; + results[57][47]="8964.997350882443"; + results[57][48]="1.111838981044821E+44"; + results[57][49]="0.3796735400255500"; + results[57][50]="3.747057959937145E+39"; + results[57][51]="9.450397790132930E-7"; + results[57][52]="6.714289213658032E+34"; + results[57][53]="1.968522917411524E-11"; + results[57][54]="2.738162922904441E+29"; + results[57][55]="99699.72373382105"; + results[57][56]="1.150879622417825E+53"; + results[57][57]="1"; + results[57][58]="9.198832671109769E+47"; + results[57][59]="0.00001962153394281874"; + results[57][60]="4.751339967101001E+43"; + results[57][61]="9.070430205145709E-11"; + results[57][62]="3.396931883544830E+38"; + results[57][63]="7.714737309343017E-16"; + results[57][64]="3.549426645075597E+33"; + results[57][65]="8.370231338805882"; + results[57][66]="7.462151843778957E+56"; + results[57][67]="0.0002701921436744741"; + results[57][68]="1.591942002897441E+52"; + results[57][69]="1.200065615470761E-9"; + results[57][70]="1.168849655873646E+47"; + results[57][71]="7.333950741154235E-15"; + results[57][72]="2.848879583052055E+42"; + results[57][73]="1.389703932348617E-19"; + results[57][74]="7.956589474147437E+36"; + results[58][0]="6.964890014465238E-19"; + results[58][1]="1.531496497153692E-24"; + results[58][2]="3.436183556816159E-29"; + results[58][3]="4.006964815448415E-34"; + results[58][4]="2.796734117467348E-39"; + results[58][5]="8.725636929437082E-24"; + results[58][6]="5.422583828394453E-15"; + results[58][7]="8.367831394252054E-29"; + results[58][8]="7.993910050511732E-21"; + results[58][9]="7.800014620905704E-34"; + results[58][10]="2.846664521232035E-25"; + results[58][11]="9.452174380221672E-39"; + results[58][12]="1.269169811166505E-30"; + results[58][13]="1.189243367426543E-43"; + results[58][14]="9.562395396755339E-36"; + results[58][15]="1.027236765294149E-27"; + results[58][16]="1.180090200208327E-11"; + results[58][17]="1.215767508784710E-32"; + results[58][18]="9.261493608634160E-17"; + results[58][19]="7.836184878051788E-38"; + results[58][20]="3.134162281529605E-21"; + results[58][21]="1.461059765435212E-42"; + results[58][22]="1.800575607560021E-26"; + results[58][23]="1.601333147361503E-47"; + results[58][24]="9.537429953960697E-32"; + results[58][25]="9.547602331172774E-32"; + results[58][26]="2.557299533609959E-7"; + results[58][27]="1.113039285562200E-36"; + results[58][28]="3.943930152271277E-12"; + results[58][29]="1.899976199866263E-41"; + results[58][30]="8.888521774566507E-18"; + results[58][31]="2.318230075295776E-46"; + results[58][32]="1.807083140011844E-22"; + results[58][33]="9.975022969440973E-52"; + results[58][34]="4.780741416946553E-27"; + results[58][35]="1.173564604311067E-35"; + results[58][36]="0.002472912671331814"; + results[58][37]="9.929281876384678E-41"; + results[58][38]="1.210259541417636E-8"; + results[58][39]="1.058261186752084E-45"; + results[58][40]="2.194307149738259E-13"; + results[58][41]="1.694258113296445E-50"; + results[58][42]="7.924461513753702E-19"; + results[58][43]="3.056383460588637E-55"; + results[58][44]="2.081693016068045E-23"; + results[58][45]="2.680910650403675E-39"; + results[58][46]="14.59645852517100"; + results[58][47]="9.745798919724109E-45"; + results[58][48]="0.0001208673992447659"; + results[58][49]="4.127410005162593E-49"; + results[58][50]="4.073405935195787E-9"; + results[58][51]="1.027347504625585E-54"; + results[58][52]="7.299066581290476E-14"; + results[58][53]="2.139970350361897E-59"; + results[58][54]="2.976641733579987E-19"; + results[58][55]="1.083830169527293E-43"; + results[58][56]="125111.4857249578"; + results[58][57]="1.087094456170119E-48"; + results[58][58]="1"; + results[58][59]="2.133046077079208E-53"; + results[58][60]="0.00005165155337615015"; + results[58][61]="9.860414391091898E-59"; + results[58][62]="3.692785818589105E-10"; + results[58][63]="8.386648159795576E-64"; + results[58][64]="3.858562028444187E-15"; + results[58][65]="9.099232085277269E-48"; + results[58][66]="811206390.0471738"; + results[58][67]="2.937243814892411E-52"; + results[58][68]="17305.91325894164"; + results[58][69]="1.304584677618646E-57"; + results[58][70]="0.1270649980996593"; + results[58][71]="7.972697192533506E-63"; + results[58][72]="0.000003097001201032130"; + results[58][73]="1.510739440573996E-67"; + results[58][74]="8.649564307367203E-12"; + results[59][0]="3.265231862221327E+34"; + results[59][1]="7.179856607930284E+28"; + results[59][2]="1.610927955912394E+24"; + results[59][3]="1.878517702221967E+19"; + results[59][4]="131114566512174.5"; + results[59][5]="4.090693128103987E+29"; + results[59][6]="2.542178477372429E+38"; + results[59][7]="3.922949196535957E+24"; + results[59][8]="3.747649962375796E+32"; + results[59][9]="3.656749239841227E+19"; + results[59][10]="1.334553693809554E+28"; + results[59][11]="443130342180164.7"; + results[59][12]="5.950034670157650E+22"; + results[59][13]="5575329010.496484"; + results[59][14]="4.482976481149991E+17"; + results[59][15]="4.815820794179703E+25"; + results[59][16]="5.532417761102616E+41"; + results[59][17]="5.699677666829715E+20"; + results[59][18]="4.341909773142817E+36"; + results[59][19]="3673706331174018"; + results[59][20]="1.469336417627336E+32"; + results[59][21]="68496399638.76680"; + results[59][22]="8.441334797725325E+26"; + results[59][23]="750725.9991093196"; + results[59][24]="4.471272353863239E+21"; + results[59][25]="4.476041297826234E+21"; + results[59][26]="1.198895589312202E+46"; + results[59][27]="5.218074271917703E+16"; + results[59][28]="1.848966224710778E+41"; + results[59][29]="890733782210.6083"; + results[59][30]="4.167055681580780E+35"; + results[59][31]="10868166.89150073"; + results[59][32]="8.471842964059609E+30"; + results[59][33]="46.76421703510423"; + results[59][34]="2.241274329850788E+26"; + results[59][35]="5.501824910965054E+17"; + results[59][36]="1.159333920586464E+50"; + results[59][37]="4654977678672.980"; + results[59][38]="5.673855592818941E+44"; + results[59][39]="49612673.54342235"; + results[59][40]="1.028719994995578E+40"; + results[59][41]="794.2904429033256"; + results[59][42]="3.715091576739267E+34"; + results[59][43]="0.01432872685419792"; + results[59][44]="9.759250109207765E+29"; + results[59][45]="125684610342532.4"; + results[59][46]="6.843011354521704E+53"; + results[59][47]="456895846.0132791"; + results[59][48]="5.666422331123308E+48"; + results[59][49]="19349.83988163200"; + results[59][50]="1.909666171287554E+44"; + results[59][51]="0.04816339954701486"; + results[59][52]="3.421898223260666E+39"; + results[59][53]="0.000001003246190205216"; + results[59][54]="1.395488717081967E+34"; + results[59][55]="5081138101.861297"; + results[59][56]="5.865390676242383E+57"; + results[59][57]="50964.41506123880"; + results[59][58]="4.688131263293223E+52"; + results[59][59]="1"; + results[59][60]="2.421492621803881E+48"; + results[59][61]="0.000004622691697590433"; + results[59][62]="1.731226464477344E+43"; + results[59][63]="3.931770743217822E-11"; + results[59][64]="1.808944527690531E+38"; + results[59][65]="426583.9441094915"; + results[59][66]="3.803042038163392E+61"; + results[59][67]="13.77018455651177"; + results[59][68]="8.113239298908500E+56"; + results[59][69]="0.00006116064212757286"; + results[59][70]="5.956973900613066E+51"; + results[59][71]="3.737705096108644E-10"; + results[59][72]="1.451914815301539E+47"; + results[59][73]="7.082544802045064E-15"; + results[59][74]="4.055029284323338E+41"; + results[60][0]="1.348437667255375E-14"; + results[60][1]="2.965054092372860E-20"; + results[60][2]="6.652623846164517E-25"; + results[60][3]="7.757685013397121E-30"; + results[60][4]="5.414617634246651E-35"; + results[60][5]="1.689327108110964E-19"; + results[60][6]="1.049839447984212E-10"; + results[60][7]="1.620054160484525E-24"; + results[60][8]="1.547661111428041E-16"; + results[60][9]="1.510121982992930E-29"; + results[60][10]="5.511285402205287E-21"; + results[60][11]="1.829988405457360E-34"; + results[60][12]="2.457176460742298E-26"; + results[60][13]="2.302434853732143E-39"; + results[60][14]="1.851327747515669E-31"; + results[60][15]="1.988781940038362E-23"; + results[60][16]="2.284713862551959E-7"; + results[60][17]="2.353786922788046E-28"; + results[60][18]="1.793071650950697E-12"; + results[60][19]="1.517124726334002E-33"; + results[60][20]="6.067895497169673E-17"; + results[60][21]="2.828685044174972E-38"; + results[60][22]="3.486004756618662E-22"; + results[60][23]="3.100261352644838E-43"; + results[60][24]="1.846494312475907E-27"; + results[60][25]="1.848463735764689E-27"; + results[60][26]="0.004951060261414672"; + results[60][27]="2.154899926158156E-32"; + results[60][28]="7.635646741444116E-8"; + results[60][29]="3.678449292763319E-37"; + results[60][30]="1.720862431732932E-13"; + results[60][31]="4.488209789961917E-42"; + results[60][32]="3.498603666092752E-18"; + results[60][33]="1.931214516782934E-47"; + results[60][34]="9.255755353824531E-23"; + results[60][35]="2.272079981340803E-31"; + results[60][36]="47.87683060222675"; + results[60][37]="1.922358811568574E-36"; + results[60][38]="0.0002343123221491472"; + results[60][39]="2.048846777260200E-41"; + results[60][40]="4.248288785737604E-9"; + results[60][41]="3.280168751088831E-46"; + results[60][42]="1.534215526112867E-14"; + results[60][43]="5.917311795698881E-51"; + results[60][44]="4.030262170254993E-19"; + results[60][45]="5.190377588220942E-35"; + results[60][46]="282594.7637793763"; + results[60][47]="1.886835590161396E-40"; + results[60][48]="2.340053519098534"; + results[60][49]="7.990872946462834E-45"; + results[60][50]="0.00007886318356258115"; + results[60][51]="1.988996336942614E-50"; + results[60][52]="1.413135928001109E-9"; + results[60][53]="4.143090014694539E-55"; + results[60][54]="5.762927809552455E-15"; + results[60][55]="2.098349611355051E-39"; + results[60][56]="2422221163.685803"; + results[60][57]="2.104669434147318E-44"; + results[60][58]="19360.50195272046"; + results[60][59]="4.129684274053472E-49"; + results[60][60]="1"; + results[60][61]="1.909025720733676E-54"; + results[60][62]="0.000007149418705177280"; + results[60][63]="1.623697180745017E-59"; + results[60][64]="7.470369768638670E-11"; + results[60][65]="1.761657005552672E-43"; + results[60][66]="15705362898567.62"; + results[60][67]="5.686651461384062E-48"; + results[60][68]="335051167.4433505"; + results[60][69]="2.525741419852499E-53"; + results[60][70]="2460.042143830875"; + results[60][71]="1.543554195644939E-58"; + results[60][72]="0.05995949780016016"; + results[60][73]="2.924867388928466E-63"; + results[60][74]="1.674599066629639E-7"; + results[61][0]="7.063486115509977E+39"; + results[61][1]="1.553176607402299E+34"; + results[61][2]="3.484826722820572E+29"; + results[61][3]="4.063688052571492E+24"; + results[61][4]="2.836325134564299E+19"; + results[61][5]="8.849158446444201E+34"; + results[61][6]="5.499346795499110E+43"; + results[61][7]="8.486287758668364E+29"; + results[61][8]="8.107073124364424E+37"; + results[61][9]="7.910432879932915E+24"; + results[61][10]="2.886962361139478E+33"; + results[61][11]="9.585980878005454E+19"; + results[61][12]="1.287136382739755E+28"; + results[61][13]="1206078487432465"; + results[61][14]="9.697762200941783E+22"; + results[61][15]="1.041778493835083E+31"; + results[61][16]="1.196795746509847E+47"; + results[61][17]="1.232978108793337E+26"; + results[61][18]="9.392600798807385E+41"; + results[61][19]="7.947115169045187E+20"; + results[61][20]="3.178529985880788E+37"; + results[61][21]="1.481742762003150E+16"; + results[61][22]="1.826064844887958E+32"; + results[61][23]="162400187644.0589"; + results[61][24]="9.672443343331502E+26"; + results[61][25]="9.682759722348257E+26"; + results[61][26]="2.593501076303929E+51"; + results[61][27]="1.128795648353017E+22"; + results[61][28]="3.999761060584132E+46"; + results[61][29]="1.926872567934611E+17"; + results[61][30]="9.014349115587456E+40"; + results[61][31]="2351047312362.565"; + results[61][32]="1.832664499013753E+36"; + results[61][33]="10116230.99578109"; + results[61][34]="4.848418359846594E+31"; + results[61][35]="1.190177773229581E+23"; + results[61][36]="2.507919620057646E+55"; + results[61][37]="1.006984238446915E+18"; + results[61][38]="1.227392169756080E+50"; + results[61][39]="10732421019831.98"; + results[61][40]="2.225370113978822E+45"; + results[61][41]="171824230.3109566"; + results[61][42]="8.036641462972210E+39"; + results[61][43]="3099.650115465570"; + results[61][44]="2.111161796555619E+35"; + results[61][45]="2.718862051908959E+19"; + results[61][46]="1.480308833506809E+59"; + results[61][47]="98837620136215.22"; + results[61][48]="1.225784175500373E+54"; + results[61][49]="4185838283.725054"; + results[61][50]="4.131069723475097E+49"; + results[61][51]="10418.90800810271"; + results[61][52]="7.402393339457015E+44"; + results[61][53]="0.2170264114148377"; + results[61][54]="3.018779551769291E+39"; + results[61][55]="1099173043382890"; + results[61][56]="1.268825839997009E+63"; + results[61][57]="11024835397.91414"; + results[61][58]="1.014156160519400E+58"; + results[61][59]="216324.1819741618"; + results[61][60]="5.238274105681931E+53"; + results[61][61]="1"; + results[61][62]="3.745061487400818E+48"; + results[61][63]="0.000008505370897365375"; + results[61][64]="3.913184451892906E+43"; + results[61][65]="92280422752.79732"; + results[61][66]="8.226899579190449E+66"; + results[61][67]="2978823.909820644"; + results[61][68]="1.755089854497003E+62"; + results[61][69]="13.23052587726166"; + results[61][70]="1.288637506091553E+57"; + results[61][71]="0.00008085559973763583"; + results[61][72]="3.140842847162717E+52"; + results[61][73]="1.532125710597750E-9"; + results[61][74]="8.772008928125169E+46"; + results[62][0]="1.886080145619249E-9"; + results[62][1]="4.147265973142270E-15"; + results[62][2]="9.305125522088941E-20"; + results[62][3]="1.085079127870824E-24"; + results[62][4]="7.573507522122931E-30"; + results[62][5]="2.362887358782933E-14"; + results[62][6]="0.00001468426303279687"; + results[62][7]="2.265994239939194E-19"; + results[62][8]="2.164736988067710E-11"; + results[62][9]="2.112230441755173E-24"; + results[62][10]="7.708718190213518E-16"; + results[62][11]="2.559632441351024E-29"; + results[62][12]="3.436889853664501E-21"; + results[62][13]="3.220450429158424E-34"; + results[62][14]="2.589480101613048E-26"; + results[62][15]="2.781739358191706E-18"; + results[62][16]="0.03195663810957770"; + results[62][17]="3.292277344287504E-23"; + results[62][18]="2.507996418858833E-7"; + results[62][19]="2.122025284706531E-28"; + results[62][20]="8.487257142703900E-12"; + results[62][21]="3.956524524331703E-33"; + results[62][22]="4.875927540926171E-17"; + results[62][23]="4.336382411621481E-38"; + results[62][24]="2.582719502969886E-22"; + results[62][25]="2.585474165089977E-22"; + results[62][26]="692.5122818487806"; + results[62][27]="3.014091096102228E-27"; + results[62][28]="0.01068009450322826"; + results[62][29]="5.145102622258724E-32"; + results[62][30]="2.406996292561188E-8"; + results[62][31]="6.277726868495983E-37"; + results[62][32]="4.893549826028827E-13"; + results[62][33]="2.701218933204230E-42"; + results[62][34]="1.294616490585723E-17"; + results[62][35]="3.177992610357912E-26"; + results[62][36]="6696604.657880305"; + results[62][37]="2.688832324474842E-31"; + results[62][38]="32.77361864111679"; + results[62][39]="2.865752953840177E-36"; + results[62][40]="0.0005942145733696068"; + results[62][41]="4.588021608964494E-41"; + results[62][42]="2.145930444669381E-9"; + results[62][43]="8.276633443518753E-46"; + results[62][44]="5.637188611343273E-14"; + results[62][45]="7.259859580559060E-30"; + results[62][46]="39526956726.52857"; + results[62][47]="2.639145457790906E-35"; + results[62][48]="327306.8224978871"; + results[62][49]="1.117695476511428E-39"; + results[62][50]="11.03071267954583"; + results[62][51]="2.782039238382100E-45"; + results[62][52]="0.0001976574580780646"; + results[62][53]="5.795002622652810E-50"; + results[62][54]="8.060694228719894E-10"; + results[62][55]="2.934993316079701E-34"; + results[62][56]="338799735135353.3"; + results[62][57]="2.943832947737714E-39"; + results[62][58]="2707982669.793906"; + results[62][59]="5.776251810602371E-44"; + results[62][60]="139871.5114105495"; + results[62][61]="2.670183128806329E-49"; + results[62][62]="1"; + results[62][63]="2.271089787438537E-54"; + results[62][64]="0.00001044891910335168"; + results[62][65]="2.464056279536351E-38"; + results[62][66]="2.196732845873822E+18"; + results[62][67]="7.954005347687989E-43"; + results[62][68]="46864113190170.53"; + results[62][69]="3.532792698269964E-48"; + results[62][70]="344089812.7912729"; + results[62][71]="2.158992582889526E-53"; + results[62][72]="8386.625580725921"; + results[62][73]="4.091056223648521E-58"; + results[62][74]="0.02342287024561831"; + results[63][0]="8.304736149364119E+44"; + results[63][1]="1.826112730584637E+39"; + results[63][2]="4.097207241015242E+34"; + results[63][3]="4.777790529781906E+29"; + results[63][4]="3.334745972621699E+24"; + results[63][5]="1.040420053778644E+40"; + results[63][6]="6.465734254108293E+48"; + results[63][7]="9.977563425596263E+34"; + results[63][8]="9.531710283058522E+42"; + results[63][9]="9.300514904509633E+29"; + results[63][10]="3.394281561588036E+38"; + results[63][11]="1.127050306645041E+25"; + results[63][12]="1.513321874227095E+33"; + results[63][13]="1.418019862962190E+20"; + results[63][14]="1.140192746202962E+28"; + results[63][15]="1.224847812524888E+36"; + results[63][16]="1.407105887505231E+52"; + results[63][17]="1.449646492400778E+31"; + results[63][18]="1.104314075441065E+47"; + results[63][19]="9.343643287216183E+25"; + results[63][20]="3.737085688838532E+42"; + results[63][21]="1.742125981198698E+21"; + results[63][22]="2.146954985177189E+37"; + results[63][23]="1.909383959897199E+16"; + results[63][24]="1.137215938028950E+32"; + results[63][25]="1.138428863266573E+32"; + results[63][26]="3.049251005746606E+56"; + results[63][27]="1.327156289801157E+27"; + results[63][28]="4.702629795748353E+51"; + results[63][29]="2.265477415607447E+22"; + results[63][30]="1.059841978011769E+46"; + results[63][31]="2.764191404152434E+17"; + results[63][32]="2.154714381216979E+41"; + results[63][33]="1189393280769.765"; + results[63][34]="5.700419674053768E+36"; + results[63][35]="1.399324953128441E+28"; + results[63][36]="2.948630518669679E+60"; + results[63][37]="1.183939243330163E+23"; + results[63][38]="1.443078949251087E+55"; + results[63][39]="1.261840447564310E+18"; + results[63][40]="2.616429243159934E+50"; + results[63][41]="20201850381878.22"; + results[63][42]="9.448901829150850E+44"; + results[63][43]="364434444.1728835"; + results[63][44]="2.482151362981211E+40"; + results[63][45]="3.196641374864857E+24"; + results[63][46]="1.740440071773177E+64"; + results[63][47]="1.162061259043167E+19"; + results[63][48]="1.441188385893991E+59"; + results[63][49]="492140593777240.2"; + results[63][50]="4.857013025445766E+54"; + results[63][51]="1224979854.944370"; + results[63][52]="8.703198753801531E+49"; + results[63][53]="25516.39593777902"; + results[63][54]="3.549262681424497E+44"; + results[63][55]="1.292328173158645E+20"; + results[63][56]="1.491793662272907E+68"; + results[63][57]="1296220415423529"; + results[63][58]="1.192371470635743E+63"; + results[63][59]="25433832878.60738"; + results[63][60]="6.158783865974074E+58"; + results[63][61]="117572.7680858409"; + results[63][62]="4.403172457253908E+53"; + results[63][63]="1"; + results[63][64]="4.600839280395232E+48"; + results[63][65]="1.084966474317800E+16"; + results[63][66]="9.672593562896609E+71"; + results[63][67]="350228572717.9005"; + results[63][68]="2.063507724325885E+67"; + results[63][69]="1555549.550621002"; + results[63][70]="1.515086786504186E+62"; + results[63][71]="9.506416676394638"; + results[63][72]="3.692775876635344E+57"; + results[63][73]="0.0001801362608504635"; + results[63][74]="1.031349371353387E+52"; + results[64][0]="0.0001805048088671923"; + results[64][1]="3.969086115148465E-10"; + results[64][2]="8.905347462307516E-15"; + results[64][3]="1.038460645678428E-19"; + results[64][4]="7.248125329722949E-25"; + results[64][5]="2.261370133514570E-9"; + results[64][6]="1.405337995973826"; + results[64][7]="2.168639854061398E-14"; + results[64][8]="0.000002071732938743234"; + results[64][9]="2.021482242194446E-19"; + results[64][10]="7.377526913516641E-11"; + results[64][11]="2.449662415828232E-24"; + results[64][12]="3.289230033910451E-16"; + results[64][13]="3.082089541802851E-29"; + results[64][14]="2.478227724801148E-21"; + results[64][15]="2.662226906608371E-13"; + results[64][16]="3058.367836279547"; + results[64][17]="3.150830542109802E-18"; + results[64][18]="0.02400244842602282"; + results[64][19]="2.030856267253379E-23"; + results[64][20]="8.122617333673738E-7"; + results[64][21]="3.786539531215795E-28"; + results[64][22]="4.666442043141217E-12"; + results[64][23]="4.150077504409531E-33"; + results[64][24]="2.471757583175691E-17"; + results[64][25]="2.474393896169260E-17"; + results[64][26]="66275973.14124528"; + results[64][27]="2.884596068061627E-22"; + results[64][28]="1022.124336267703"; + results[64][29]="4.924052498988474E-27"; + results[64][30]="0.002303584005917990"; + results[64][31]="6.008015572139217E-32"; + results[64][32]="4.683307218312307E-8"; + results[64][33]="2.585165897530746E-37"; + results[64][34]="1.238995610723459E-12"; + results[64][35]="3.041455847178024E-21"; + results[64][36]="640889702718.8438"; + results[64][37]="2.573311457270591E-26"; + results[64][38]="3136555.878837656"; + results[64][39]="2.742631008523106E-31"; + results[64][40]="56.86852080029998"; + results[64][41]="4.390905474129667E-36"; + results[64][42]="0.0002053734384814057"; + results[64][43]="7.921042704660115E-41"; + results[64][44]="5.394996894497005E-9"; + results[64][45]="6.947952710467755E-25"; + results[64][46]="3782875179294822"; + results[64][47]="2.525759297863022E-30"; + results[64][48]="31324467082.23605"; + results[64][49]="1.069675691290314E-34"; + results[64][50]="1055679.785673480"; + results[64][51]="2.662513902983238E-40"; + results[64][52]="18.91654592432077"; + results[64][53]="5.546030709333330E-45"; + results[64][54]="0.00007714380931645150"; + results[64][55]="2.808896582554887E-29"; + results[64][56]="3.242438110432659E+19"; + results[64][57]="2.817356435263650E-34"; + results[64][58]="259163904228646.2"; + results[64][59]="5.528085492354452E-39"; + results[64][60]="13386218232.43738"; + results[64][61]="2.555463490907705E-44"; + results[64][62]="95703.67902257296"; + results[64][63]="2.173516480484612E-49"; + results[64][64]="1"; + results[64][65]="2.358192512703023E-33"; + results[64][66]="2.102354151798515E+23"; + results[64][67]="7.612275747389602E-38"; + results[64][68]="4.485068046429608E+18"; + results[64][69]="3.381012584485181E-43"; + results[64][70]="32930660998313.20"; + results[64][71]="2.066235331649750E-48"; + results[64][72]="802630922.6602931"; + results[64][73]="3.915291316913575E-53"; + results[64][74]="2241.654855774030"; + results[65][0]="7.654371214175933E+28"; + results[65][1]="1.683105214594628E+23"; + results[65][2]="3.776344558103940E+18"; + results[65][3]="44036296446727.19"; + results[65][4]="307359356.4002524"; + results[65][5]="9.589421225506852E+23"; + results[65][6]="5.959386218061519E+32"; + results[65][7]="9.196195146831527E+18"; + results[65][8]="8.785257893845823E+26"; + results[65][9]="85721680113273.25"; + results[65][10]="3.128466770111285E+22"; + results[65][11]="1038788140.761402"; + results[65][12]="1.394809802928366E+17"; + results[65][13]="13069.71133696832"; + results[65][14]="1050901362569.648"; + results[65][15]="1.128926876100059E+20"; + results[65][16]="1.296911859318036E+36"; + results[65][17]="1336121001630285"; + results[65][18]="1.017832441445189E+31"; + results[65][19]="8611918901.080548"; + results[65][20]="3.444425037361932E+26"; + results[65][21]="160569.5680407179"; + results[65][22]="1.978821499094838E+21"; + results[65][23]="1.759855262899042"; + results[65][24]="1.048157675788096E+16"; + results[65][25]="1.049275613776351E+16"; + results[65][26]="2.810456431535270E+40"; + results[65][27]="122322331723.2581"; + results[65][28]="4.334354938206963E+35"; + results[65][29]="2088062.137617592"; + results[65][30]="9.768430666746378E+29"; + results[65][31]="25.47720569790407"; + results[65][32]="1.985973237165517E+25"; + results[65][33]="0.0001096248878581826"; + results[65][34]="5.254005362366659E+20"; + results[65][35]="1289740269632.112"; + results[65][36]="2.717715789811575E+44"; + results[65][37]="10912219.60636705"; + results[65][38]="1.330067779429277E+39"; + results[65][39]="116.3022524136263"; + results[65][40]="2.411530038110238E+34"; + results[65][41]="0.001861979227937033"; + results[65][42]="8.708934379831493E+28"; + results[65][43]="3.358946592354670E-8"; + results[65][44]="2.287767799039069E+24"; + results[65][45]="294630428.7305122"; + results[65][46]="1.604141798821501E+48"; + results[65][47]="1071.057296746282"; + results[65][48]="1.328325270880074E+43"; + results[65][49]="0.04535998166087906"; + results[65][50]="4.476648025921479E+38"; + results[65][51]="1.129048577943026E-7"; + results[65][52]="8.021629202205431E+33"; + results[65][53]="2.351814230372703E-12"; + results[65][54]="3.271310925672783E+28"; + results[65][55]="11911.22678671919"; + results[65][56]="1.374967519812914E+52"; + results[65][57]="0.1194710109580630"; + results[65][58]="1.098993838851543E+47"; + results[65][59]="0.000002344204496696504"; + results[65][60]="5.676473892750065E+42"; + results[65][61]="1.083653466433309E-11"; + results[65][62]="4.058348862827780E+37"; + results[65][63]="9.216874656230971E-17"; + results[65][64]="4.240535896086675E+32"; + results[65][65]="1"; + results[65][66]="8.915108246988459E+55"; + results[65][67]="0.00003228012855771563"; + results[65][68]="1.901909204727609E+51"; + results[65][69]="1.433730522963019E-10"; + results[65][70]="1.396436500452086E+46"; + results[65][71]="8.761945093623320E-16"; + results[65][72]="3.403585238850141E+41"; + results[65][73]="1.660293337300849E-20"; + results[65][74]="9.505817882546773E+35"; + results[66][0]="8.585842148087876E-28"; + results[66][1]="1.887924597172652E-33"; + results[66][2]="4.235893108061360E-38"; + results[66][3]="4.939513377372926E-43"; + results[66][4]="3.447623381399535E-48"; + results[66][5]="1.075637104994903E-32"; + results[66][6]="6.684592102484691E-24"; + results[66][7]="1.031529275030174E-37"; + results[66][8]="9.854347979244672E-30"; + results[66][9]="9.615326896589304E-43"; + results[66][10]="3.509174183238983E-34"; + results[66][11]="1.165199694700630E-47"; + results[66][12]="1.564546121354764E-39"; + results[66][13]="1.466018243960560E-52"; + results[66][14]="1.178786991088576E-44"; + results[66][15]="1.266307536401941E-36"; + results[66][16]="1.454734842682516E-20"; + results[66][17]="1.498715399312880E-41"; + results[66][18]="1.141693867585976E-25"; + results[66][19]="9.659915126649943E-47"; + results[66][20]="3.863581845487368E-30"; + results[66][21]="1.801094990573543E-51"; + results[66][22]="2.219627002020180E-35"; + results[66][23]="1.974014464146888E-56"; + results[66][24]="1.175709421298576E-40"; + results[66][25]="1.176963402694295E-40"; + results[66][26]="3.152464730290456E-16"; + results[66][27]="1.372079040819037E-45"; + results[66][28]="4.861808536840948E-21"; + results[66][29]="2.342161283709532E-50"; + results[66][30]="1.095716439567200E-26"; + results[66][31]="2.857756181088471E-55"; + results[66][32]="2.227649044907988E-31"; + results[66][33]="1.229652908535508E-60"; + results[66][34]="5.893372482764269E-36"; + results[66][35]="1.446690532409171E-44"; + results[66][36]="3.048438352646615E-12"; + results[66][37]="1.224014258049331E-49"; + results[66][38]="1.491925552197951E-17"; + results[66][39]="1.304552330622721E-54"; + results[66][40]="2.704992436771430E-22"; + results[66][41]="2.088566034591912E-59"; + results[66][42]="9.768736552103434E-28"; + results[66][43]="3.767701411241225E-64"; + results[66][44]="2.566169401041071E-32"; + results[66][45]="3.304844097995546E-48"; + results[66][46]="1.799352015005968E-8"; + results[66][47]="1.201395728546636E-53"; + results[66][48]="1.489970995392888E-13"; + results[66][49]="5.087990005752511E-58"; + results[66][50]="5.021417465608115E-18"; + results[66][51]="1.266444048309139E-63"; + results[66][52]="8.997792264513616E-23"; + results[66][53]="2.638009730467547E-68"; + results[66][54]="3.669401240055428E-28"; + results[66][55]="1.336072031513787E-52"; + results[66][56]="0.0001542289203585813"; + results[66][57]="1.340096021811295E-57"; + results[66][58]="1.232731906786197E-9"; + results[66][59]="2.629473957860669E-62"; + results[66][60]="6.367251788185060E-14"; + results[66][61]="1.215524743403277E-67"; + results[66][62]="4.552214903502375E-19"; + results[66][63]="1.033848877756975E-72"; + results[66][64]="4.756572526776819E-24"; + results[66][65]="1.121691371877399E-56"; + results[66][66]="1"; + results[66][67]="3.620834168628286E-61"; + results[66][68]="0.00002133355145037165"; + results[66][69]="1.608203157204890E-66"; + results[66][70]="1.566370773931775E-10"; + results[66][71]="9.828198212380789E-72"; + results[66][72]="3.817772195867480E-15"; + results[66][73]="1.862336711235894E-76"; + results[66][74]="1.066259390149060E-20"; + results[67][0]="2.371233187776874E+33"; + results[67][1]="5.214059825026099E+27"; + results[67][2]="1.169866641439169E+23"; + results[67][3]="1.364192102518798E+18"; + results[67][4]="9521627395340.313"; + results[67][5]="2.970688672556348E+28"; + results[67][6]="1.846146990216091E+37"; + results[67][7]="2.848871909041218E+23"; + results[67][8]="2.721568434319621E+31"; + results[67][9]="2.655555722462696E+18"; + results[67][10]="9.691618063161386E+26"; + results[67][11]="32180421428746.45"; + results[67][12]="4.320954919477782E+21"; + results[67][13]="404884116.6663938"; + results[67][14]="3.255567463712780E+16"; + results[67][15]="3.497281226998773E+24"; + results[67][16]="4.017678730737416E+40"; + results[67][17]="4.139143991453913E+19"; + results[67][18]="3.153123878132466E+35"; + results[67][19]="266787007544990.6"; + results[67][20]="1.067041920605562E+31"; + results[67][21]="4974254292.501521"; + results[67][22]="6.130153712234388E+25"; + results[67][23]="54518.22348701272"; + results[67][24]="3.247067848301876E+20"; + results[67][25]="3.250531087260965E+20"; + results[67][26]="8.706459847302905E+44"; + results[67][27]="3789400389299890"; + results[67][28]="1.342731622167273E+40"; + results[67][29]="64685682211.09210"; + results[67][30]="3.026143668938864E+34"; + results[67][31]="789253.5388250330"; + results[67][32]="6.152308946399247E+29"; + results[67][33]="3.396048676267737"; + results[67][34]="1.627628388459699E+25"; + results[67][35]="3.995461998628989E+16"; + results[67][36]="8.419160366577858E+48"; + results[67][37]="338047588219.9918"; + results[67][38]="4.120391828834159E+43"; + results[67][39]="3602905.490468613"; + results[67][40]="7.470633314853486E+38"; + results[67][41]="57.68190249329044"; + results[67][42]="2.697924317203462E+33"; + results[67][43]="0.001040561714724588"; + results[67][44]="7.087232614171990E+28"; + results[67][45]="9127300351475.501"; + results[67][46]="4.969440552113530E+52"; + results[67][47]="33180081.51148695"; + results[67][48]="4.114993744541877E+47"; + results[67][49]="1405.198296524041"; + results[67][50]="1.386812328803897E+43"; + results[67][51]="0.003497658244837316"; + results[67][52]="2.485005345583759E+38"; + results[67][53]="7.285640842996488E-8"; + results[67][54]="1.013413227219280E+33"; + results[67][55]="368995642.7968486"; + results[67][56]="4.259485885734702E+56"; + results[67][57]="3701.069862359855"; + results[67][58]="3.404552236793557E+51"; + results[67][59]="0.07262066792903739"; + results[67][60]="1.758504115806338E+47"; + results[67][61]="3.357029587090330E-7"; + results[67][62]="1.257228221867707E+42"; + results[67][63]="2.855278175163260E-12"; + results[67][64]="1.313667598474634E+37"; + results[67][65]="30978.81094903443"; + results[67][66]="2.761794529736332E+60"; + results[67][67]="1"; + results[67][68]="5.891888569548503E+55"; + results[67][69]="0.000004441526682273164"; + results[67][70]="4.325994234983640E+50"; + results[67][71]="2.714346406011766E-11"; + results[67][72]="1.054390236632627E+46"; + results[67][73]="5.143391341618445E-16"; + results[67][74]="2.944789350993672E+40"; + results[68][0]="4.024572358737908E-23"; + results[68][1]="8.849556069295544E-29"; + results[68][2]="1.985554593624666E-33"; + results[68][3]="2.315373222720905E-38"; + results[68][4]="1.616056937083241E-43"; + results[68][5]="5.041997379091630E-28"; + results[68][6]="3.133370511719575E-19"; + results[68][7]="4.835244040026928E-33"; + results[68][8]="4.619178387700187E-25"; + results[68][9]="4.507138400728770E-38"; + results[68][10]="1.644908580459467E-29"; + results[68][11]="5.461817725994849E-43"; + results[68][12]="7.333734962012186E-35"; + results[68][13]="6.871890258736175E-48"; + results[68][14]="5.525507526633783E-40"; + results[68][15]="5.935755888314043E-32"; + results[68][16]="6.818999856009313E-16"; + results[68][17]="7.025156607418828E-37"; + results[68][18]="5.351635287926178E-21"; + results[68][19]="4.528038919877851E-42"; + results[68][20]="1.811035473617807E-25"; + results[68][21]="8.442546449724692E-47"; + results[68][22]="1.040439519497590E-30"; + results[68][23]="9.253098194827277E-52"; + results[68][24]="5.511081565737588E-36"; + results[68][25]="5.516959543432190E-36"; + results[68][26]="1.477702733941909E-11"; + results[68][27]="6.431554746104564E-41"; + results[68][28]="2.278949451126784E-16"; + results[68][29]="1.097876876786368E-45"; + results[68][30]="5.136118297584773E-22"; + results[68][31]="1.339559513912385E-50"; + results[68][32]="1.044199813655115E-26"; + results[68][33]="5.763939076885797E-56"; + results[68][34]="2.762490106944477E-31"; + results[68][35]="6.781292537131541E-40"; + results[68][36]="1.428940867974192E-7"; + results[68][37]="5.737508172967645E-45"; + results[68][38]="6.993329524475215E-13"; + results[68][39]="6.115026528318585E-50"; + results[68][40]="1.267952240893443E-17"; + results[68][41]="9.790053191333628E-55"; + results[68][42]="4.579048441525779E-23"; + results[68][43]="1.766091979577825E-59"; + results[68][44]="1.202879608212802E-27"; + results[68][45]="1.549129832266147E-43"; + results[68][46]="0.0008434376335284867"; + results[68][47]="5.631484899930744E-49"; + results[68][48]="6.984167633124823E-9"; + results[68][49]="2.384970930690432E-53"; + results[68][50]="2.353765371550753E-13"; + results[68][51]="5.936395781336616E-59"; + results[68][52]="4.217672001516121E-18"; + results[68][53]="1.236554418332251E-63"; + results[68][54]="1.720014245444119E-23"; + results[68][55]="6.262773615644344E-48"; + results[68][56]="7.229406726646745"; + results[68][57]="6.281635877311693E-53"; + results[68][58]="0.00005778371733623009"; + results[68][59]="1.232553315830994E-57"; + results[68][60]="2.984618760264661E-9"; + results[68][61]="5.697713979929495E-63"; + results[68][62]="2.133828919245919E-14"; + results[68][63]="4.846117066640417E-68"; + results[68][64]="2.229620575759295E-19"; + results[68][65]="5.257874547924172E-52"; + results[68][66]="46874.52074382950"; + results[68][67]="1.697248663473332E-56"; + results[68][68]="1"; + results[68][69]="7.538375225269271E-62"; + results[68][70]="0.000007342287933519324"; + results[68][71]="4.606920809807113E-67"; + results[68][72]="1.789562419904057E-10"; + results[68][73]="8.729614080282214E-72"; + results[68][74]="4.998039790184512E-16"; + results[69][0]="5.338779562533849E+38"; + results[69][1]="1.173934144274364E+33"; + results[69][2]="2.633929108448886E+28"; + results[69][3]="3.071448625904928E+23"; + results[69][4]="2.143773543755267E+18"; + results[69][5]="6.688440450921611E+33"; + results[69][6]="4.156559494698874E+42"; + results[69][7]="6.414172677182188E+28"; + results[69][8]="6.127551693389194E+36"; + results[69][9]="5.978925519149620E+23"; + results[69][10]="2.182046570122424E+32"; + results[69][11]="7.245351369200056E+18"; + results[69][12]="9.728535318099962E+26"; + results[69][13]="91158771663435.09"; + results[69][14]="7.329838806791966E+21"; + results[69][15]="7.874052048267494E+29"; + results[69][16]="9.045715624703119E+45"; + results[69][17]="9.319191997593739E+24"; + results[69][18]="7.099189318657215E+40"; + results[69][19]="6.006651015061551E+19"; + results[69][20]="2.402421502642987E+36"; + results[69][21]="1119942454101324"; + results[69][22]="1.380190675584772E+31"; + results[69][23]="12274658554.81710"; + results[69][24]="7.310702108942491E+25"; + results[69][25]="7.318499515570511E+25"; + results[69][26]="1.960240356553922E+50"; + results[69][27]="8.531751941115174E+20"; + results[69][28]="3.023130824647137E+45"; + results[69][29]="1.456383960705739E+16"; + results[69][30]="6.813296160116931E+39"; + results[69][31]="177698704811.3589"; + results[69][32]="1.385178878009241E+35"; + results[69][33]="764612.9178559042"; + results[69][34]="3.664569651142300E+30"; + results[69][35]="8.995695139186061E+21"; + results[69][36]="1.895555508014859E+54"; + results[69][37]="7.611067373954845E+16"; + results[69][38]="9.276971914362904E+48"; + results[69][39]="811186276297.3776"; + results[69][40]="1.681996720782961E+44"; + results[69][41]="12986953.95065576"; + results[69][42]="6.074317481804861E+38"; + results[69][43]="234.2801899350586"; + results[69][44]="1.595674893152901E+34"; + results[69][45]="2.054991673899878E+18"; + results[69][46]="1.118858651001097E+58"; + results[69][47]="7470422646319.768"; + results[69][48]="9.264818245864578E+52"; + results[69][49]="316377317.3157802"; + results[69][50]="3.122377569719179E+48"; + results[69][51]="787.4900895669555"; + results[69][52]="5.594935082798914E+43"; + results[69][53]="0.01640346071109881"; + results[69][54]="2.281677674624746E+38"; + results[69][55]="83078560412474.54"; + results[69][56]="9.590139135570173E+61"; + results[69][57]="833287769.5256027"; + results[69][58]="7.665274758748302E+56"; + results[69][59]="16350.38425388234"; + results[69][60]="3.959233483443444E+52"; + results[69][61]="0.07558278554283523"; + results[69][62]="2.830621792469476E+47"; + results[69][63]="6.428596244978392E-7"; + results[69][64]="2.957693812169788E+42"; + results[69][65]="6974811402.726853"; + results[69][66]="6.218119865763931E+65"; + results[69][67]="225147.8087458437"; + results[69][68]="1.326545800808529E+61"; + results[69][69]="1"; + results[69][70]="9.739881226537191E+55"; + results[69][71]="0.000006111291454907054"; + results[69][72]="2.373936513408476E+51"; + results[69][73]="1.158023290087738E-10"; + results[69][74]="6.630128695943206E+45"; + results[70][0]="5.481360027253576E-18"; + results[70][1]="1.205285893092693E-23"; + results[70][2]="2.704272308036475E-28"; + results[70][3]="3.153476469031765E-33"; + results[70][4]="2.201026371773776E-38"; + results[70][5]="6.867065722216763E-23"; + results[70][6]="4.267566922042078E-14"; + results[70][7]="6.585473198283149E-28"; + results[70][8]="6.291197552485674E-20"; + results[70][9]="6.138602083626537E-33"; + results[70][10]="2.240321539216762E-24"; + results[70][11]="7.438849818270307E-38"; + results[70][12]="9.988351081318820E-30"; + results[70][13]="9.359330934659115E-43"; + results[70][14]="7.525593625126715E-35"; + results[70][15]="8.084340933043336E-27"; + results[70][16]="9.287295619229160E-11"; + results[70][17]="9.568075606715566E-32"; + results[70][18]="7.288784281388184E-16"; + results[70][19]="6.167068032304013E-37"; + results[70][20]="2.466581929251223E-20"; + results[70][21]="1.149852270323317E-41"; + results[70][22]="1.417050827913914E-25"; + results[70][23]="1.260247252438118E-46"; + results[70][24]="7.505945851807534E-31"; + results[70][25]="7.513951500384414E-31"; + results[70][26]="0.000002012591643533670"; + results[70][27]="8.759605730991504E-36"; + results[70][28]="3.103868265262150E-11"; + results[70][29]="1.495278973975256E-40"; + results[70][30]="6.995255898556019E-17"; + results[70][31]="1.824444268654967E-45"; + results[70][32]="1.422172248091892E-21"; + results[70][33]="7.850331026344006E-51"; + results[70][34]="3.762437719628292E-26"; + results[70][35]="9.235939258352015E-35"; + results[70][36]="0.01946179284866684"; + results[70][37]="7.814332841367511E-40"; + results[70][38]="9.524727970077244E-8"; + results[70][39]="8.328502755118070E-45"; + results[70][40]="1.726917075949764E-12"; + results[70][41]="1.333379088368309E-49"; + results[70][42]="6.236541637956356E-18"; + results[70][43]="2.405370091133565E-54"; + results[70][44]="1.638289888797966E-22"; + results[70][45]="2.109873443118451E-38"; + results[70][46]="114.8739522564880"; + results[70][47]="7.669931976137371E-44"; + results[70][48]="0.0009512249718838192"; + results[70][49]="3.248266687829637E-48"; + results[70][50]="3.205765550006891E-8"; + results[70][51]="8.085212450243923E-54"; + results[70][52]="5.744356581633671E-13"; + results[70][53]="1.684154080483660E-58"; + results[70][54]="2.342613448311986E-18"; + results[70][55]="8.529730340665701E-43"; + results[70][56]="984625.8812110530"; + results[70][57]="8.555420237109612E-48"; + results[70][58]="7.869987919219759"; + results[70][59]="1.678704685775246E-52"; + results[70][60]="0.0004064971010792362"; + results[70][61]="7.760134213639389E-58"; + results[70][62]="2.906217978056231E-9"; + results[70][63]="6.600281970033780E-63"; + results[70][64]="3.036683654941584E-14"; + results[70][65]="7.161084658530892E-47"; + results[70][66]="6384184489.665129"; + results[70][67]="2.311607333900624E-51"; + results[70][68]="136197.3282789357"; + results[70][69]="1.026706565245795E-56"; + results[70][70]="1"; + results[70][71]="6.274503058883598E-62"; + results[70][72]="0.00002437336203793195"; + results[70][73]="1.188950114640616E-66"; + results[70][74]="6.807196660549431E-11"; + results[71][0]="8.735926934473208E+43"; + results[71][1]="1.920926457094031E+38"; + results[71][2]="4.309938624075892E+33"; + results[71][3]="5.025858525269176E+28"; + results[71][4]="3.507889550962140E+23"; + results[71][5]="1.094439775990578E+39"; + results[71][6]="6.801442093489699E+47"; + results[71][7]="1.049560919244317E+34"; + results[71][8]="1.002660687778045E+42"; + results[71][9]="9.783407587849290E+28"; + results[71][10]="3.570516291397545E+37"; + results[71][11]="1.185567964261042E+24"; + results[71][12]="1.591895164857249E+32"; + results[71][13]="1.491644971215360E+19"; + results[71][14]="1.199392773340319E+27"; + results[71][15]="1.288443221267910E+35"; + results[71][16]="1.480164330477132E+51"; + results[71][17]="1.524913689087910E+30"; + results[71][18]="1.161651243610208E+46"; + results[71][19]="9.828775242323811E+24"; + results[71][20]="3.931119175659616E+41"; + results[71][21]="1.832579025832696E+20"; + results[71][22]="2.258427184775404E+36"; + results[71][23]="2008521217714331"; + results[71][24]="1.196261406101385E+31"; + results[71][25]="1.197537307714907E+31"; + results[71][26]="3.207571379990312E+55"; + results[71][27]="1.396063664131845E+26"; + results[71][28]="4.946795365519211E+50"; + results[71][29]="2.383103426586433E+21"; + results[71][30]="1.114870107307058E+45"; + results[71][31]="2.907711178930534E+16"; + results[71][32]="2.266589456958420E+40"; + results[71][33]="125114785229.5539"; + results[71][34]="5.996391561721113E+35"; + results[71][35]="1.471979401663617E+27"; + results[71][36]="3.101726569582645E+59"; + results[71][37]="1.245410635397457E+22"; + results[71][38]="1.518005152072067E+54"; + results[71][39]="1.327356553492530E+17"; + results[71][40]="2.752277048466415E+49"; + results[71][41]="2125075206522.494"; + results[71][42]="9.939498920359126E+43"; + results[71][43]="38335627.03787325"; + results[71][44]="2.611027317101128E+39"; + results[71][45]="3.362614414748335E+23"; + results[71][46]="1.830805582186251E+63"; + results[71][47]="1.222396722761668E+18"; + results[71][48]="1.516016428642984E+58"; + results[71][49]="51769305988793.17"; + results[71][50]="5.109194337658483E+53"; + results[71][51]="128858211.9471067"; + results[71][52]="9.155078143600022E+48"; + results[71][53]="2684.123451177847"; + results[71][54]="3.733544196771496E+43"; + results[71][55]="1.359427234414859E+19"; + results[71][56]="1.569249185107967E+67"; + results[71][57]="136352156606197.4"; + results[71][58]="1.254280672965365E+62"; + results[71][59]="2675438469.025040"; + results[71][60]="6.478554512834406E+57"; + results[71][61]="12367.72719817611"; + results[71][62]="4.631789881656898E+52"; + results[71][63]="0.1051921069779213"; + results[71][64]="4.839719777715578E+47"; + results[71][65]="1141299094338961"; + results[71][66]="1.017480496822173E+71"; + results[71][67]="36841281488.06609"; + results[71][68]="2.170647252870554E+66"; + results[71][69]="163631.5347383819"; + results[71][70]="1.593751713267834E+61"; + results[71][71]="1"; + results[71][72]="3.884508750605123E+56"; + results[71][73]="0.00001894891282198470"; + results[71][74]="1.084898134030173E+51"; + results[72][0]="2.248914211639332E-13"; + results[72][1]="4.945094941013564E-19"; + results[72][2]="1.109519607441867E-23"; + results[72][3]="1.293820878762663E-28"; + results[72][4]="9.030458614401850E-34"; + results[72][5]="2.817447060249479E-18"; + results[72][6]="1.750914344685201E-9"; + results[72][7]="2.701914158594232E-23"; + results[72][8]="2.581177575212958E-15"; + results[72][9]="2.518570098812429E-28"; + results[72][10]="9.191680391610227E-20"; + results[72][11]="3.052040915280100E-33"; + results[72][12]="4.098060442286985E-25"; + results[72][13]="3.839983552574039E-38"; + results[72][14]="3.087630509658344E-30"; + results[72][15]="3.316875579356586E-22"; + results[72][16]="0.000003810428616608354"; + results[72][17]="3.925628147575576E-27"; + results[72][18]="2.990471429442005E-11"; + results[72][19]="2.530249221550267E-32"; + results[72][20]="1.011999052659421E-15"; + results[72][21]="4.717659666868350E-37"; + results[72][22]="5.813932545327873E-21"; + results[72][23]="5.170592593983595E-42"; + results[72][24]="3.079569343009031E-26"; + results[72][25]="3.082853932375250E-26"; + results[72][26]="0.08257341110354408"; + results[72][27]="3.593925908686312E-31"; + results[72][28]="0.000001273467427444617"; + results[72][29]="6.134890097017279E-36"; + results[72][30]="2.870041436084768E-12"; + results[72][31]="7.485402571116811E-41"; + results[72][32]="5.834944911902525E-17"; + results[72][33]="3.220865063312414E-46"; + results[72][34]="1.543667924750332E-21"; + results[72][35]="3.789357924433339E-30"; + results[72][36]="798.4861841537783"; + results[72][37]="3.206095584682231E-35"; + results[72][38]="0.003907843306661606"; + results[72][39]="3.417051263652724E-40"; + results[72][40]="7.085264122619546E-8"; + results[72][41]="5.470640801598023E-45"; + results[72][42]="2.558753129030992E-13"; + results[72][43]="9.868848160504565E-50"; + results[72][44]="6.721640971189435E-18"; + results[72][45]="8.656472750188841E-34"; + results[72][46]="4713094.241069868"; + results[72][47]="3.146850222878877E-39"; + results[72][48]="39.02723680071055"; + results[72][49]="1.332711787062614E-43"; + results[72][50]="0.001315274251052358"; + results[72][51]="3.317233148902893E-49"; + results[72][52]="2.356817484881160E-8"; + results[72][53]="6.909814402554038E-54"; + results[72][54]="9.611367708181607E-14"; + results[72][55]="3.499611718478145E-38"; + results[72][56]="40397622604.49307"; + results[72][57]="3.510151871454961E-43"; + results[72][58]="322892.9971569699"; + results[72][59]="6.887456409020225E-48"; + results[72][60]="16.67792487743833"; + results[72][61]="3.183858755949381E-53"; + results[72][62]="0.0001192374680822991"; + results[72][63]="2.707989960417380E-58"; + results[72][64]="1.245902658080421E-9"; + results[72][65]="2.938078319842043E-42"; + results[72][66]="261932862595217.9"; + results[72][67]="9.484154587713828E-47"; + results[72][68]="5587958200.718210"; + results[72][69]="4.212412566013441E-52"; + results[72][70]="41028.39807014366"; + results[72][71]="2.574328091922103E-57"; + results[72][72]="1"; + results[72][73]="4.878071858901815E-62"; + results[72][74]="0.000002792883743307747"; + results[73][0]="4.610252322411714E+48"; + results[73][1]="1.013739666829516E+43"; + results[73][2]="2.274504434405050E+38"; + results[73][3]="2.652320253137757E+33"; + results[73][4]="1.851235257619769E+28"; + results[73][5]="5.775739148057081E+43"; + results[73][6]="3.589357425085942E+52"; + results[73][7]="5.538897820177879E+38"; + results[73][8]="5.291388995229049E+46"; + results[73][9]="5.163044275816442E+33"; + results[73][10]="1.884285565584005E+42"; + results[73][11]="6.256654275624378E+28"; + results[73][12]="8.400984161003253E+36"; + results[73][13]="7.871929040091104E+23"; + results[73][14]="6.329612598928488E+31"; + results[73][15]="6.799562768440446E+39"; + results[73][16]="7.811341708004652E+55"; + results[73][17]="8.047499629206652E+34"; + results[73][18]="6.130437426797644E+50"; + results[73][19]="5.186986364157197E+29"; + results[73][20]="2.074588242919507E+46"; + results[73][21]="9.671156562114322E+24"; + results[73][22]="1.191850533058106E+41"; + results[73][23]="1.059966466985920E+20"; + results[73][24]="6.313087285479891E+35"; + results[73][25]="6.319820661824533E+35"; + results[73][26]="1.692746919110240E+60"; + results[73][27]="7.367513256550102E+30"; + results[73][28]="2.610595875336918E+55"; + results[73][29]="1.257646519868694E+26"; + results[73][30]="5.883557108424581E+49"; + results[73][31]="1.534500267243291E+21"; + results[73][32]="1.196158047826734E+45"; + results[73][33]="6602742141723014"; + results[73][34]="3.164504274231525E+40"; + results[73][35]="7.768146993403301E+31"; + results[73][36]="1.636888933271145E+64"; + results[73][37]="6.572464853775255E+26"; + results[73][38]="8.011040877822095E+58"; + results[73][39]="7.004921949677867E+21"; + results[73][40]="1.452472273381932E+54"; + results[73][41]="1.121476058540394E+17"; + results[73][42]="5.245419098043044E+48"; + results[73][43]="2023104301445.511"; + results[73][44]="1.377929880004403E+44"; + results[73][45]="1.774568518172187E+28"; + results[73][46]="9.661797483505934E+67"; + results[73][47]="6.451012436678859E+22"; + results[73][48]="8.000545692964971E+62"; + results[73][49]="2.732046237963053E+18"; + results[73][50]="2.696299458262718E+58"; + results[73][51]="6800295782542.430"; + results[73][52]="4.831452986040559E+53"; + results[73][53]="141650525.0931179"; + results[73][54]="1.970321058440780E+48"; + results[73][55]="7.174170081344397E+23"; + results[73][56]="8.281473453650119E+71"; + results[73][57]="7.195777292721534E+18"; + results[73][58]="6.619275125431665E+66"; + results[73][59]="141192188394099.9"; + results[73][60]="3.418958424526566E+62"; + results[73][61]="652687957.0540302"; + results[73][62]="2.444356531253368E+57"; + results[73][63]="5551.353154988210"; + results[73][64]="2.554088365481576E+52"; + results[73][65]="6.023032060260553E+19"; + results[73][66]="5.369598279230475E+75"; + results[73][67]="1944242492124535"; + results[73][68]="1.145526011577904E+71"; + results[73][69]="8635404905.580393"; + results[73][70]="8.410781812340964E+65"; + results[73][71]="52773.47620913591"; + results[73][72]="2.049990301342397E+61"; + results[73][73]="1"; + results[73][74]="5.725384586557730E+55"; + results[74][0]="8.052301557585906E-8"; + results[74][1]="1.770605365462456E-13"; + results[74][2]="3.972666639277327E-18"; + results[74][3]="4.632562604379404E-23"; + results[74][4]="3.233381495395381E-28"; + results[74][5]="1.008794965777072E-12"; + results[74][6]="0.0006269198812448631"; + results[74][7]="9.674280804091849E-18"; + results[74][8]="9.241980019390084E-10"; + results[74][9]="9.017812162240471E-23"; + results[74][10]="3.291107413129942E-14"; + results[74][11]="1.092791965506384E-27"; + results[74][12]="1.467322244295588E-19"; + results[74][13]="1.374917076937174E-32"; + results[74][14]="1.105534921407618E-24"; + results[74][15]="1.187616773274011E-16"; + results[74][16]="1.364334847713883"; + results[74][17]="1.405582368754908E-21"; + results[74][18]="0.00001070746835276518"; + results[74][19]="9.059629594726956E-27"; + results[74][20]="3.623491507959662E-10"; + results[74][21]="1.689171516062104E-31"; + results[74][22]="2.081695150848690E-15"; + results[74][23]="1.851345444067719E-36"; + results[74][24]="1.102648597668354E-20"; + results[74][25]="1.103824654270814E-20"; + results[74][26]="29565.64565260007"; + results[74][27]="1.286815434870144E-25"; + results[74][28]="0.4559686490696489"; + results[74][29]="2.196614918797670E-30"; + results[74][30]="0.000001027626532239985"; + results[74][31]="2.680169766841597E-35"; + results[74][32]="2.089218688706290E-11"; + results[74][33]="1.153239933824738E-40"; + results[74][34]="5.527147087483460E-16"; + results[74][35]="1.356790426208511E-24"; + results[74][36]="285900258.4934282"; + results[74][37]="1.147951679823628E-29"; + results[74][38]="1399.214455677041"; + results[74][39]="1.223484963110475E-34"; + results[74][40]="0.02536899052671676"; + results[74][41]="1.958778561659312E-39"; + results[74][42]="9.161688649454979E-8"; + results[74][43]="3.533569266587664E-44"; + results[74][44]="2.406702744894305E-12"; + results[74][45]="3.099474788713032E-28"; + results[74][46]="1687536852317.355"; + results[74][47]="1.126738708841461E-33"; + results[74][48]="13973813.58756047"; + results[74][49]="4.771812612164872E-38"; + results[74][50]="470.9377016512027"; + results[74][51]="1.187744802071186E-43"; + results[74][52]="0.008438652308849302"; + results[74][53]="2.474078779366023E-48"; + results[74][54]="3.441377655339997E-8"; + results[74][55]="1.253045969730694E-32"; + results[74][56]="1.446448413805017E+16"; + results[74][57]="1.256819901603824E-37"; + results[74][58]="115612759725.7422"; + results[74][59]="2.466073435932954E-42"; + results[74][60]="5971578.629938194"; + results[74][61]="1.139989719793558E-47"; + results[74][62]="42.69331595631704"; + results[74][63]="9.696035386027837E-53"; + results[74][64]="0.0004460990046813902"; + results[74][65]="1.051987332763925E-36"; + results[74][66]="9.378580946051059E+19"; + results[74][67]="3.395828634270787E-41"; + results[74][68]="2000784391440555"; + results[74][69]="1.508266348754094E-46"; + results[74][70]="14690335094.84779"; + results[74][71]="9.217455248864755E-52"; + results[74][72]="358052.8557252626"; + results[74][73]="1.746607559512835E-56"; + results[74][74]="1"; + } + + public static int mcDivideTests() { + int failures = 0; + for(int i=0; i 0) { + throw new RuntimeException("Incurred " + failures + + " failures while testing DECIMAL64 divide."); + } + } + +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/math/BigDecimal/FloatDoubleValueTests.java --- a/jdk/test/java/math/BigDecimal/FloatDoubleValueTests.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/math/BigDecimal/FloatDoubleValueTests.java Wed Jul 05 17:42:05 2017 +0200 @@ -25,6 +25,8 @@ * @test * @bug 6274390 * @summary Verify {float, double}Value methods work with condensed representation + * @run main FloatDoubleValueTests + * @run main/othervm -XX:+AggressiveOpts FloatDoubleValueTests */ import java.math.*; @@ -64,6 +66,7 @@ static void checkDouble(BigDecimal bd, double d) { double dbd = bd.doubleValue(); + if (d != dbd ) { String message = String.format("Bad conversion:"+ "got %g (%a)\texpected %g (%a)", @@ -156,9 +159,29 @@ } } + static void testFloatValue1() { + checkFloat(new BigDecimal("85070591730234615847396907784232501249"), 8.507059e+37f); + checkFloat(new BigDecimal("7784232501249e12"), 7.7842326e24f); + checkFloat(new BigDecimal("907784232501249e-12"),907.78424f); + checkFloat(new BigDecimal("7784e8"),7.7839997e11f); + checkFloat(new BigDecimal("9077e-8"),9.077e-5f); + + } + + static void testDoubleValue1() { + checkDouble(new BigDecimal("85070591730234615847396907784232501249"), 8.507059173023462e37); + checkDouble(new BigDecimal("7784232501249e12"), 7.784232501249e24); + checkDouble(new BigDecimal("907784232501249e-12"), 907.784232501249); + checkDouble(new BigDecimal("7784e8"), 7.784e11); + checkDouble(new BigDecimal("9077e-8"), 9.077e-5); + + } + public static void main(String[] args) throws Exception { testFloatDoubleValue(); testDoubleValue(); testFloatValue(); + testFloatValue1(); + testDoubleValue1(); } } diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/math/BigDecimal/RangeTests.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/math/BigDecimal/RangeTests.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7036582 + * @summary Some new tests for the add method and constructor with MathContext. + * @run main RangeTests + * @run main/othervm -XX:+AggressiveOpts RangeTests + * @author Sergey V. Kuksenko + */ + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.math.MathContext; + +public class RangeTests { + + + private static int addTest(BigDecimal arg1, BigDecimal arg2, BigDecimal expectedResult) { + int failures = 0; + BigDecimal result = arg1.add(arg2); + if (!result.equals(expectedResult)) { + System.out.println("Sum:" + + arg1 + " + " + + arg2 + " == " + + result + "; expected " + + expectedResult + ); + failures++; + } + result = arg2.add(arg1); + if (!result.equals(expectedResult)) { + System.out.println("Sum:" + + arg2 + " + " + + arg1 + " == " + + result + "; expected " + + expectedResult + ); + failures++; + } + return failures; + } + + /* + * Test BigDecimal.add(BigDecimal) when values are withing different ranges: + * 1. within 32 bits + * 2. within 64 bits + * 3. outside 64 bits. + */ + private static int addBoundaryTest() { + int failures = 0; + failures += addTest( + new BigDecimal("85070591730234615847396907784232501249"), + BigDecimal.valueOf(0), + new BigDecimal("85070591730234615847396907784232501249") ); + failures += addTest( + new BigDecimal("-85070591730234615847396907784232501249"), + BigDecimal.valueOf(0), + new BigDecimal("-85070591730234615847396907784232501249") ); + failures += addTest( + new BigDecimal("85070591730234615847396907784232501249"), + BigDecimal.valueOf(1), + new BigDecimal("85070591730234615847396907784232501250") ); + failures += addTest( + new BigDecimal("85070591730234615847396907784232501249"), + BigDecimal.valueOf(-1), + new BigDecimal("85070591730234615847396907784232501248") ); + failures += addTest( + new BigDecimal("-85070591730234615847396907784232501250"), + BigDecimal.valueOf(-1), + new BigDecimal("-85070591730234615847396907784232501251") ); + failures += addTest( + new BigDecimal("-85070591730234615847396907784232501249"), + BigDecimal.valueOf(1), + new BigDecimal("-85070591730234615847396907784232501248") ); + failures += addTest( + new BigDecimal("147573952589676412927"), + BigDecimal.valueOf(Integer.MAX_VALUE), + new BigDecimal("147573952591823896574") ); + failures += addTest( + new BigDecimal("-147573952589676412927"), + BigDecimal.valueOf(Integer.MAX_VALUE), + new BigDecimal("-147573952587528929280") ); + failures += addTest( + new BigDecimal("79228162514264337593543950335"), + BigDecimal.valueOf(999), + new BigDecimal("79228162514264337593543951334") ); + failures += addTest( + new BigDecimal("79228162514264337593543950335"), + BigDecimal.valueOf(Integer.MAX_VALUE/2), + new BigDecimal("79228162514264337594617692158") ); + failures += addTest( + new BigDecimal("79228162514264337593543950335"), + BigDecimal.valueOf(Integer.MIN_VALUE/2), + new BigDecimal("79228162514264337592470208511") ); + failures += addTest( + new BigDecimal("-79228162514264337593543950335"), + BigDecimal.valueOf(Integer.MAX_VALUE/2), + new BigDecimal("-79228162514264337592470208512") ); + failures += addTest( + new BigDecimal("79228162514264337593543950335"), + BigDecimal.valueOf(-(Integer.MIN_VALUE/2)), + new BigDecimal("79228162514264337594617692159") ); + failures += addTest( + new BigDecimal("79228162514264337593543950335"), + BigDecimal.valueOf(Long.MAX_VALUE/2), + new BigDecimal("79228162518876023611971338238") ); + failures += addTest( + new BigDecimal("79228162514264337593543950335"), + BigDecimal.valueOf(Long.MIN_VALUE/2), + new BigDecimal("79228162509652651575116562431") ); + failures += addTest( + new BigDecimal("-79228162514264337593543950335"), + BigDecimal.valueOf(Long.MAX_VALUE/2), + new BigDecimal("-79228162509652651575116562432") ); + failures += addTest( + new BigDecimal("79228162514264337593543950335"), + BigDecimal.valueOf(-(Long.MIN_VALUE/2)), + new BigDecimal("79228162518876023611971338239") ); + failures += addTest( + new BigDecimal("-9223372036854775808"), + BigDecimal.valueOf(1), + new BigDecimal("-9223372036854775807") ); + failures += addTest( + new BigDecimal("-9223372036854775808"), + BigDecimal.valueOf(Long.MAX_VALUE/2), + new BigDecimal("-4611686018427387905") ); + failures += addTest( + new BigDecimal("9223372036854775808"), + BigDecimal.valueOf(-1), + new BigDecimal("9223372036854775807") ); + failures += addTest( + new BigDecimal("9223372036854775808"), + BigDecimal.valueOf(-Long.MAX_VALUE/2), + new BigDecimal("4611686018427387905") ); + + return failures; + } + + private static int testRoundingFromBigInteger(BigInteger bi, int scale, MathContext mc) { + int failures = 0; + BigDecimal bd1 = new BigDecimal(bi,scale, mc); + BigDecimal bd2 = (new BigDecimal(bi,scale)).round(mc); + if (!bd1.equals(bd2)) { + System.out.println("new BigDecimal(BigInteger,int,MathContext):" + + "BigInteger == " + + bi + "; scale == " + scale + "; result == " + + bd1 + "; expected == " + + bd2 + ); + failures++; + } + return failures; + } + + private static int roundingConstructorTest() { + int failures = 0; + failures += testRoundingFromBigInteger( + new BigInteger("85070591730234615847396907784232501249"), + 7, MathContext.DECIMAL64); + failures += testRoundingFromBigInteger( + new BigInteger("85070591730234615847396907784232501249"), + 0, MathContext.DECIMAL64); + failures += testRoundingFromBigInteger( + new BigInteger("85070591730234615847396907784232501249"), + -7, MathContext.DECIMAL64); + failures += testRoundingFromBigInteger( + new BigInteger("85070591730234615847396907784232501249"), + 7, MathContext.DECIMAL128); + failures += testRoundingFromBigInteger( + new BigInteger("85070591730234615847396907784232501249"), + 177, MathContext.DECIMAL128); + failures += testRoundingFromBigInteger( + new BigInteger("85070591730234615847396907784232501249"), + 177, MathContext.DECIMAL32); + failures += testRoundingFromBigInteger( + new BigInteger("85070591730234615847396907784232501249"), + 177, MathContext.UNLIMITED); + failures += testRoundingFromBigInteger( + new BigInteger("85070591730234615847396907784232501249"), + 0, MathContext.UNLIMITED); + return failures; + } + + private static int minLongConstructorTest(MathContext mc) { + int failures = 0; + BigDecimal bd1 = new BigDecimal(Long.MIN_VALUE,mc); + BigDecimal bd2 = new BigDecimal(Long.MIN_VALUE).round(mc); + if (!bd1.equals(bd2)) { + System.out.println("new BigDecimal(long,MathContext):" + + "long == " + + Long.MIN_VALUE + "; result == " + + bd1 + "; expected == " + + bd2 + ); + failures++; + } + return failures; + } + + private static int minLongConstructorTest() { + int failures = 0; + failures+=minLongConstructorTest(MathContext.UNLIMITED); + failures+=minLongConstructorTest(MathContext.DECIMAL32); + failures+=minLongConstructorTest(MathContext.DECIMAL64); + failures+=minLongConstructorTest(MathContext.DECIMAL128); + return failures; + } + + public static void main(String argv[]) { + int failures = 0; + + failures += addBoundaryTest(); + failures += roundingConstructorTest(); + failures += minLongConstructorTest(); + if (failures > 0) { + throw new RuntimeException("Incurred " + failures + + " failures while testing."); + } + } + + + +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/math/BigDecimal/StrippingZerosTest.java --- a/jdk/test/java/math/BigDecimal/StrippingZerosTest.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/math/BigDecimal/StrippingZerosTest.java Wed Jul 05 17:42:05 2017 +0200 @@ -25,6 +25,8 @@ * @test * @bug 4108852 * @summary A few tests of stripTrailingZeros + * @run main StrippingZerosTest + * @run main/othervm -XX:+AggressiveOpts StrippingZerosTest * @author Joseph D. Darcy */ @@ -53,6 +55,11 @@ {new BigDecimal("10000000e2"), new BigDecimal("1e9")}, {new BigDecimal("1000000e3"), new BigDecimal("1e9")}, {new BigDecimal("100000e4"), new BigDecimal("1e9")}, + // BD value which larger than Long.MaxValue + {new BigDecimal("1.0000000000000000000000000000"), new BigDecimal("1")}, + {new BigDecimal("-1.0000000000000000000000000000"), new BigDecimal("-1")}, + {new BigDecimal("1.00000000000000000000000000001"), new BigDecimal("1.00000000000000000000000000001")}, + {new BigDecimal("1000000000000000000000000000000e4"), new BigDecimal("1e34")}, }; for(int i = 0; i < testCases.length; i++) { diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/math/BigDecimal/ToPlainStringTests.java --- a/jdk/test/java/math/BigDecimal/ToPlainStringTests.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/math/BigDecimal/ToPlainStringTests.java Wed Jul 05 17:42:05 2017 +0200 @@ -25,6 +25,8 @@ * @test * @bug 4984872 * @summary Basic tests of toPlainString method + * @run main ToPlainStringTests + * @run main/othervm -XX:+AggressiveOpts ToPlainStringTests * @author Joseph D. Darcy */ @@ -60,6 +62,11 @@ {"8e-8", "0.00000008"}, {"9e-9", "0.000000009"}, {"9000e-12", "0.000000009000"}, + + {"9000e-22", "0.0000000000000000009000"}, + {"12345678901234567890", "12345678901234567890"}, + {"12345678901234567890e22", "123456789012345678900000000000000000000000"}, + {"12345678901234567890e-22", "0.0012345678901234567890"}, }; int errors = 0; @@ -73,8 +80,8 @@ s + "'' from BigDecimal " + bd); } - - if (!(s=("-"+bd.toPlainString())).equals("-"+testCase[1])) { + bd = new BigDecimal("-"+testCase[0]); + if (bd.signum()!=0 && !(s=(bd.toPlainString())).equals("-"+testCase[1])) { errors++; System.err.println("Unexpected plain result ``" + s + "'' from BigDecimal " + diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/net/URL/Equals.java --- a/jdk/test/java/net/URL/Equals.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/net/URL/Equals.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,16 +23,19 @@ /* * @test - * @bug 4052976 - * @summary Test URL.equals involving anchors - * + * @bug 4052976 7030649 + * @summary Test URL.equals with anchors, and jar URLs */ import java.net.*; public class Equals { + public static void main(String[] args) throws Exception { + anchors(); + jarURLs(); + } - public static void main(String[] args) throws Exception { + static void anchors() throws Exception { URL url1, url2; url1 = new URL(null, "http://JavaSoft/Test#bar"); @@ -45,4 +48,74 @@ if (url1.equals(null)) throw new RuntimeException("URL.equals fails given null"); } + + static final String HTTP_URL1A = "http://localhost/xyz"; + static final String HTTP_URL1B = "http://LOCALHOST/xyz"; + static final String FILE_URL1A = "file:///c:/foo/xyz"; + static final String FILE_URL1B = "file:/c:/foo/xyz"; + + static void jarURLs() throws Exception { + int failed = 0; + failed = compareJarURLS(HTTP_URL1A, HTTP_URL1A, "!/abc", "!/abc", true); + failed = compareJarURLS(HTTP_URL1A, HTTP_URL1B, "!/abc", "!/abc", true); + failed = compareJarURLS(HTTP_URL1B, HTTP_URL1A, "!/", "!/", true); + failed = compareJarURLS(HTTP_URL1A, HTTP_URL1B, "!/abc", "!/", false); + failed = compareJarURLS(HTTP_URL1A, HTTP_URL1B, "!/abc", "!/xy", false); + failed = compareJarURLS(FILE_URL1A, FILE_URL1A, "!/abc", "!/abc", true); + failed = compareJarURLS(FILE_URL1A, FILE_URL1B, "!/abc", "!/abc", true); + failed = compareJarURLS(FILE_URL1A, FILE_URL1B, "!/", "!/", true); + failed = compareJarURLS(FILE_URL1A, FILE_URL1B, "!/abc", "!/", false); + failed = compareJarURLS(FILE_URL1A, FILE_URL1B, "!/abc", "!/xy", false); + + failed = (new URL("jar:file://xzy!/abc")).equals( + new URL("file://xzy!/abc")) ? 1 : 0; + + if (failed > 0) + throw new RuntimeException("Some jar URL tests failed. Check output"); + } + + static int compareJarURLS(String urlStr1, String urlStr2, + String entry1, String entry2, + boolean expectEqual) throws Exception { + int failed = 0; + + URL url1 = new URL(urlStr1); + URL url2 = new URL(urlStr2); + + if (!url1.equals(url2)) { + System.out.println("Urls are not equal, so the test cannot run."); + System.out.println("url1: " + url1 + ", url2:" + url2); + return 1; + } + + URL jarUrl1 = new URL("jar:" + urlStr1 + entry1); + URL jarUrl2 = new URL("jar:" + urlStr2 + entry2); + jarUrl2.openConnection(); + + boolean equal = jarUrl1.equals(jarUrl2); + if (expectEqual && !equal) { + System.out.println("URLs should be equal, but are not. " + + jarUrl1 + ", " + jarUrl2); + failed++; + } else if (!expectEqual && equal) { + System.out.println("URLs should NOT be equal, but are. " + + jarUrl1 + ", " + jarUrl2); + failed++; + } + + if (expectEqual) { + // hashCode MUST produce the same integer result for equal urls + int hash1 = jarUrl1.hashCode(); + int hash2 = jarUrl2.hashCode(); + if (hash1 != hash2) { + System.out.println("jarUrl1.hashCode = " + hash1); + System.out.println("jarUrl2.hashCode = " + hash2); + System.out.println("Equal urls should have same hashCode. " + + jarUrl1 + ", " + jarUrl2); + failed++; + } + } + + return failed; + } } diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/rmi/server/UnicastRemoteObject/exportObject/GcDuringExport.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/rmi/server/UnicastRemoteObject/exportObject/GcDuringExport.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Portions Copyright (c) 2011 IBM Corporation + */ + +/* + * @test + * @bug 6597112 + * @summary GC'ing objects whilst being exported to RMI should not cause exceptions + * @author Neil Richards , + */ + +import java.rmi.Remote; +import java.rmi.server.UnicastRemoteObject; + +public class GcDuringExport { + private static final long MAX_EXPORT_ITERATIONS = 50000; + + public static void main(String[] args) throws Exception { + Thread gcInducingThread = new Thread() { + public void run() { + while (true) { + System.gc(); + try { Thread.sleep(1); } catch (InterruptedException e) { } + } + } + }; + gcInducingThread.setDaemon(true); + gcInducingThread.start(); + + long i = 0; + try { + while (i < MAX_EXPORT_ITERATIONS) { + i++; + UnicastRemoteObject.exportObject(new Remote() { }, 0); + } + } catch (Throwable e) { + throw new RuntimeException("Test FAILED on iteration " + i + ".", e); + } + + System.out.println("Test successfully exported " + i + " objects."); + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/text/Bidi/Bug6665028.java --- a/jdk/test/java/text/Bidi/Bug6665028.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/text/Bidi/Bug6665028.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ * that this test case fails without the fix in some different ways, * including timeout, due to the memory corruption. * @build Bug6665028 - * @run main/othervm/timeout=60 -Xmx16m Bug6665028 + * @run main/othervm -Xmx16m Bug6665028 10 */ import java.awt.font.TextAttribute; @@ -36,6 +36,7 @@ import java.text.Bidi; // test1() and test2() were derived from BidiEmbeddingTest. +// Usage: java Bug6665028 [duration] public class Bug6665028 { private static boolean runrun = true; @@ -50,6 +51,11 @@ } public static void main(String[] args) { + int duration = 45; + if (args.length == 1) { + duration = Math.max(1, Math.min(Integer.parseInt(args[0]), 45)); + } + Test[] tests = new Test[4]; for (int i = 0; i < tests.length; i++) { Test t = new Test(); @@ -58,7 +64,7 @@ } try { - Thread.sleep(45000); + Thread.sleep(duration * 1000); } catch (InterruptedException e) { } diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/EnumMap/DistinctEntrySetElements.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/util/EnumMap/DistinctEntrySetElements.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Portions Copyright (c) 2011 IBM Corporation + */ + +/* + * @test + * @bug 6312706 + * @summary Sets from Map.entrySet() return distinct objects for each Entry + * @author Neil Richards , + */ + +import java.util.EnumMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +public class DistinctEntrySetElements { + static enum TestEnum { e00, e01, e02 } + + public static void main(String[] args) throws Exception { + final EnumMap enumMap = new EnumMap<>(TestEnum.class); + + for (TestEnum e : TestEnum.values()) { + enumMap.put(e, e.name()); + } + + Set> entrySet = enumMap.entrySet(); + HashSet> hashSet = new HashSet<>(entrySet); + + if (false == hashSet.equals(entrySet)) { + throw new RuntimeException("Test FAILED: Sets are not equal."); + } + if (hashSet.hashCode() != entrySet.hashCode()) { + throw new RuntimeException("Test FAILED: Set's hashcodes are not equal."); + } + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/EnumMap/EntrySetIteratorRemoveInvalidatesEntry.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/util/EnumMap/EntrySetIteratorRemoveInvalidatesEntry.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Portions Copyright (c) 2011 IBM Corporation + */ + +/* + * @test + * @bug 6312706 + * @summary Iterator.remove() from Map.entrySet().iterator() invalidates returned Entry. + * @author Neil Richards , + */ + +import java.util.EnumMap; +import java.util.Iterator; +import java.util.Map; + +public class EntrySetIteratorRemoveInvalidatesEntry { + static enum TestEnum { e00, e01, e02 } + + public static void main(String[] args) throws Exception { + final EnumMap enumMap = new EnumMap<>(TestEnum.class); + + for (TestEnum e : TestEnum.values()) { + enumMap.put(e, e.name()); + } + + Iterator> entrySetIterator = + enumMap.entrySet().iterator(); + Map.Entry entry = entrySetIterator.next(); + + entrySetIterator.remove(); + + try { + entry.getKey(); + throw new RuntimeException("Test FAILED: Entry not invalidated by removal."); + } catch (Exception e) { } + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/EnumMap/SimpleSerialization.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/util/EnumMap/SimpleSerialization.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Portions Copyright (c) 2011 IBM Corporation + */ + +/* + * @test + * @bug 6312706 + * @summary A serialized EnumMap can be successfully de-serialized. + * @author Neil Richards , + */ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.EnumMap; + +public class SimpleSerialization { + private enum TestEnum { e00, e01, e02, e03, e04, e05, e06, e07 } + public static void main(final String[] args) throws Exception { + final EnumMap enumMap = new EnumMap<>(TestEnum.class); + + enumMap.put(TestEnum.e01, TestEnum.e01.name()); + enumMap.put(TestEnum.e04, TestEnum.e04.name()); + enumMap.put(TestEnum.e05, TestEnum.e05.name()); + + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final ObjectOutputStream oos = new ObjectOutputStream(baos); + + oos.writeObject(enumMap); + oos.close(); + + final byte[] data = baos.toByteArray(); + final ByteArrayInputStream bais = new ByteArrayInputStream(data); + final ObjectInputStream ois = new ObjectInputStream(bais); + + final Object deserializedObject = ois.readObject(); + ois.close(); + + if (false == enumMap.equals(deserializedObject)) { + throw new RuntimeException(getFailureText(enumMap, deserializedObject)); + } + } + + private static String getFailureText(final Object orig, final Object copy) { + final StringWriter sw = new StringWriter(); + final PrintWriter pw = new PrintWriter(sw); + + pw.println("Test FAILED: Deserialized object is not equal to the original object"); + pw.print("\tOriginal: "); + printObject(pw, orig).println(); + pw.print("\tCopy: "); + printObject(pw, copy).println(); + + pw.close(); + return sw.toString(); + } + + private static PrintWriter printObject(final PrintWriter pw, final Object o) { + pw.printf("%s@%08x", o.getClass().getName(), System.identityHashCode(o)); + return pw; + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/IdentityHashMap/DistinctEntrySetElements.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/util/IdentityHashMap/DistinctEntrySetElements.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Portions Copyright (c) 2011 IBM Corporation + */ + +/* + * @test + * @bug 6312706 + * @summary Sets from Map.entrySet() return distinct objects for each Entry + * @author Neil Richards , + */ + +import java.util.IdentityHashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +public class DistinctEntrySetElements { + public static void main(String[] args) throws Exception { + final IdentityHashMap identityHashMap = + new IdentityHashMap<>(); + + identityHashMap.put("One", "Un"); + identityHashMap.put("Two", "Deux"); + identityHashMap.put("Three", "Trois"); + + Set> entrySet = identityHashMap.entrySet(); + HashSet> hashSet = new HashSet<>(entrySet); + + // NB: These comparisons are valid in this case because none of the + // keys put into 'identityHashMap' above are equal to any other. + if (false == hashSet.equals(entrySet)) { + throw new RuntimeException("Test FAILED: Sets are not equal."); + } + if (hashSet.hashCode() != entrySet.hashCode()) { + throw new RuntimeException("Test FAILED: Set's hashcodes are not equal."); + } + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/IdentityHashMap/EntrySetIteratorRemoveInvalidatesEntry.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/util/IdentityHashMap/EntrySetIteratorRemoveInvalidatesEntry.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Portions Copyright (c) 2011 IBM Corporation + */ + +/* + * @test + * @bug 6312706 + * @summary Iterator.remove() from Map.entrySet().iterator() invalidates returned Entry. + * @author Neil Richards , + */ + +import java.util.IdentityHashMap; +import java.util.Iterator; +import java.util.Map; + +public class EntrySetIteratorRemoveInvalidatesEntry { + public static void main(String[] args) throws Exception { + final IdentityHashMap identityHashMap = + new IdentityHashMap<>(); + + identityHashMap.put("One", "Un"); + identityHashMap.put("Two", "Deux"); + identityHashMap.put("Three", "Trois"); + + Iterator> entrySetIterator = + identityHashMap.entrySet().iterator(); + Map.Entry entry = entrySetIterator.next(); + + entrySetIterator.remove(); + + try { + entry.getKey(); + throw new RuntimeException("Test FAILED: Entry not invalidated by removal."); + } catch (Exception e) { } + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/Locale/Bug4518797.java --- a/jdk/test/java/util/Locale/Bug4518797.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/Locale/Bug4518797.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,17 +24,22 @@ * @test * @bug 4518797 * @summary Make sure that hashCode() and read/writeObject() are thread-safe. - * @run main/timeout=200 Bug4518797 + * @run main Bug4518797 10 */ import java.util.*; import java.io.*; +// Usage: java Bug4518797 [duration] public class Bug4518797 { static volatile boolean runrun = true; static volatile String message = null; public static void main(String[] args) { + int duration = 180; + if (args.length == 1) { + duration = Math.max(5, Integer.parseInt(args[0])); + } final Locale loc = new Locale("ja", "US"); final int hashcode = loc.hashCode(); @@ -84,7 +89,7 @@ t1.start(); t2.start(); try { - for (int i = 0; runrun && i < 180; i++) { + for (int i = 0; runrun && i < duration; i++) { Thread.sleep(1000); } runrun = false; diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/Locale/LocaleEnhanceTest.java --- a/jdk/test/java/util/Locale/LocaleEnhanceTest.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/Locale/LocaleEnhanceTest.java Wed Jul 05 17:42:05 2017 +0200 @@ -33,8 +33,10 @@ import java.io.ObjectOutputStream; import java.net.URISyntaxException; import java.net.URL; +import java.text.DecimalFormatSymbols; import java.util.ArrayList; import java.util.Arrays; +import java.util.Calendar; import java.util.IllformedLocaleException; import java.util.List; import java.util.Locale; @@ -43,8 +45,10 @@ /** * @test - * @bug 6875847 6992272 7002320 7015500 7023613 + * @bug 6875847 6992272 7002320 7015500 7023613 7032820 7033504 * @summary test API changes to Locale + * @compile LocaleEnhanceTest.java + * @run main/othervm -esa LocaleEnhanceTest */ public class LocaleEnhanceTest extends LocaleTestFmwk { @@ -593,6 +597,9 @@ assertEquals("extension", "aa-00-bb-01", locale.getExtension('d')); assertEquals("extension c", "1234", locale.getExtension('c')); + locale = Locale.forLanguageTag("und-U-ca-gregory-u-ca-japanese"); + assertEquals("Unicode extension", "ca-gregory", locale.getExtension(Locale.UNICODE_LOCALE_EXTENSION)); + // redundant Unicode locale keys in an extension are ignored locale = Locale.forLanguageTag("und-u-aa-000-bb-001-bB-002-cc-003-c-1234"); assertEquals("Unicode keywords", "aa-000-bb-001-cc-003", locale.getExtension(Locale.UNICODE_LOCALE_EXTENSION)); @@ -1275,6 +1282,35 @@ } } + /* + * 7033504: (lc) incompatible behavior change for ja_JP_JP and th_TH_TH locales + */ + public void testBug7033504() { + checkCalendar(new Locale("ja", "JP", "jp"), "java.util.GregorianCalendar"); + checkCalendar(new Locale("ja", "jp", "jp"), "java.util.GregorianCalendar"); + checkCalendar(new Locale("ja", "JP", "JP"), "java.util.JapaneseImperialCalendar"); + checkCalendar(new Locale("ja", "jp", "JP"), "java.util.JapaneseImperialCalendar"); + checkCalendar(Locale.forLanguageTag("en-u-ca-japanese"), + "java.util.JapaneseImperialCalendar"); + + checkDigit(new Locale("th", "TH", "th"), '0'); + checkDigit(new Locale("th", "th", "th"), '0'); + checkDigit(new Locale("th", "TH", "TH"), '\u0e50'); + checkDigit(new Locale("th", "TH", "TH"), '\u0e50'); + checkDigit(Locale.forLanguageTag("en-u-nu-thai"), '\u0e50'); + } + + private void checkCalendar(Locale loc, String expected) { + Calendar cal = Calendar.getInstance(loc); + assertEquals("Wrong calendar", expected, cal.getClass().getName()); + } + + private void checkDigit(Locale loc, Character expected) { + DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(loc); + Character zero = dfs.getZeroDigit(); + assertEquals("Wrong digit zero char", expected, zero); + } + /// /// utility asserts /// diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/PriorityQueue/NoNulls.java --- a/jdk/test/java/util/PriorityQueue/NoNulls.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/PriorityQueue/NoNulls.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Martin Buchholz with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/PriorityQueue/PriorityQueueSort.java --- a/jdk/test/java/util/PriorityQueue/PriorityQueueSort.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/PriorityQueue/PriorityQueueSort.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/Random/DistinctSeeds.java --- a/jdk/test/java/util/Random/DistinctSeeds.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/Random/DistinctSeeds.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/ResourceBundle/Bug4168625Test.java --- a/jdk/test/java/util/ResourceBundle/Bug4168625Test.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/ResourceBundle/Bug4168625Test.java Wed Jul 05 17:42:05 2017 +0200 @@ -282,7 +282,7 @@ thread1.start(); //start thread 1 loader.waitForNotify(1); //wait for thread1 to do getBundle & block in loader thread2.start(); //start second thread - thread2.join(1000); //wait until thread2 blocks somewhere in getBundle + thread2.join(); //wait until thread2 terminates. //Thread1 should be blocked inside getBundle at the class loader //Thread2 should have completed its getBundle call and terminated @@ -292,7 +292,6 @@ thread1.ping(); //continue thread1 thread1.join(); - thread2.join(); } /** @@ -318,8 +317,7 @@ loader.waitForNotify(3); //wait for thread1 to do getBundle(en) & block in loader causeResourceBundleCacheFlush(); //cause a cache flush thread1.ping(); //kick thread 1 - thread1.ping(); //kick thread 1 - thread1.join(1000); //wait until thread2 blocks somewhere in getBundle + thread1.join(); //wait until thread1 terminates ResourceBundle bundle = (ResourceBundle)thread1.bundle; String s1 = bundle.getString("Bug4168625Resource3_en_US"); diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/ResourceBundle/Control/StressTest.java --- a/jdk/test/java/util/ResourceBundle/Control/StressTest.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/ResourceBundle/Control/StressTest.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,12 +24,13 @@ * @test * @bug 5102289 * @summary Stress test for ResourceBundle.getBundle with ResourceBundle.Control. - * @run main/timeout=300/othervm -esa StressTest + * @run main/othervm -esa StressTest 2 15 */ import java.util.*; import java.util.concurrent.atomic.*; +// Usage: java StressTest [threadsFactor [duration]] public class StressTest { static final Locale ROOT_LOCALE = new Locale(""); static final Random rand = new Random(); @@ -60,16 +61,16 @@ static volatile boolean runrun = true; public static void main(String[] args) { - int nThreads = 2; + int threadsFactor = 2; if (args.length > 0) { - nThreads = Math.max(Integer.parseInt(args[0]), 2); + threadsFactor = Math.max(2, Integer.parseInt(args[0])); } - int nSeconds = 180; + int duration = 180; if (args.length > 1) { - nSeconds = Integer.parseInt(args[1]); + duration = Math.max(5, Integer.parseInt(args[1])); } Locale.setDefault(Locale.US); - Thread[] tasks = new Thread[locales.length * nThreads]; + Thread[] tasks = new Thread[locales.length * threadsFactor]; counters = new AtomicIntegerArray(tasks.length); for (int i = 0; i < tasks.length; i++) { @@ -84,8 +85,8 @@ System.out.printf("%d processors, intervalForCounterCheck = %d [sec]%n", nProcessors, intervalForCounterCheck); try { - for (int i = 0; runrun && i < nSeconds; i++) { - Thread.sleep(1000); // 1 seconds + for (int i = 0; runrun && i < duration; i++) { + Thread.sleep(1000); // 1 second if ((i % intervalForCounterCheck) == 0) { checkCounters(); } diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java --- a/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/BlockingQueue/LoopHelpers.java --- a/jdk/test/java/util/concurrent/BlockingQueue/LoopHelpers.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/BlockingQueue/LoopHelpers.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /** diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java --- a/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/BlockingQueue/OfferDrainToLoops.java --- a/jdk/test/java/util/concurrent/BlockingQueue/OfferDrainToLoops.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/BlockingQueue/OfferDrainToLoops.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/BlockingQueue/PollMemoryLeak.java --- a/jdk/test/java/util/concurrent/BlockingQueue/PollMemoryLeak.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/BlockingQueue/PollMemoryLeak.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java --- a/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java --- a/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/ConcurrentHashMap/DistinctEntrySetElements.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/DistinctEntrySetElements.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Portions Copyright (c) 2011 IBM Corporation + */ + +/* + * @test + * @bug 6312706 + * @summary Sets from Map.entrySet() return distinct objects for each Entry + * @author Neil Richards , + */ + +import java.util.concurrent.ConcurrentHashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +public class DistinctEntrySetElements { + public static void main(String[] args) throws Exception { + final ConcurrentHashMap concurrentHashMap = + new ConcurrentHashMap<>(); + + concurrentHashMap.put("One", "Un"); + concurrentHashMap.put("Two", "Deux"); + concurrentHashMap.put("Three", "Trois"); + + Set> entrySet = concurrentHashMap.entrySet(); + HashSet> hashSet = new HashSet<>(entrySet); + + if (false == hashSet.equals(entrySet)) { + throw new RuntimeException("Test FAILED: Sets are not equal."); + } + if (hashSet.hashCode() != entrySet.hashCode()) { + throw new RuntimeException("Test FAILED: Set's hashcodes are not equal."); + } + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/ConcurrentHashMap/LoopHelpers.java --- a/jdk/test/java/util/concurrent/ConcurrentHashMap/LoopHelpers.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/LoopHelpers.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /** diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/ConcurrentHashMap/MapCheck.java --- a/jdk/test/java/util/concurrent/ConcurrentHashMap/MapCheck.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/MapCheck.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java --- a/jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java --- a/jdk/test/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/ConcurrentQueues/GCRetention.java --- a/jdk/test/java/util/concurrent/ConcurrentQueues/GCRetention.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/ConcurrentQueues/GCRetention.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/ConcurrentQueues/IteratorWeakConsistency.java --- a/jdk/test/java/util/concurrent/ConcurrentQueues/IteratorWeakConsistency.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/ConcurrentQueues/IteratorWeakConsistency.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/ConcurrentQueues/LoopHelpers.java --- a/jdk/test/java/util/concurrent/ConcurrentQueues/LoopHelpers.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/ConcurrentQueues/LoopHelpers.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /** diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/ConcurrentQueues/RemovePollRace.java --- a/jdk/test/java/util/concurrent/ConcurrentQueues/RemovePollRace.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/ConcurrentQueues/RemovePollRace.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java --- a/jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/Exchanger/LoopHelpers.java --- a/jdk/test/java/util/concurrent/Exchanger/LoopHelpers.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/Exchanger/LoopHelpers.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Misc utilities in JSR166 performance tests diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java --- a/jdk/test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/ExecutorCompletionService/LoopHelpers.java --- a/jdk/test/java/util/concurrent/ExecutorCompletionService/LoopHelpers.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/ExecutorCompletionService/LoopHelpers.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Misc utilities in JSR166 performance tests diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/FutureTask/CancelledFutureLoops.java --- a/jdk/test/java/util/concurrent/FutureTask/CancelledFutureLoops.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/FutureTask/CancelledFutureLoops.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/FutureTask/LoopHelpers.java --- a/jdk/test/java/util/concurrent/FutureTask/LoopHelpers.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/FutureTask/LoopHelpers.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Misc utilities in JSR166 performance tests diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/Phaser/Arrive.java --- a/jdk/test/java/util/concurrent/Phaser/Arrive.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/Phaser/Arrive.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/Phaser/Basic.java --- a/jdk/test/java/util/concurrent/Phaser/Basic.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/Phaser/Basic.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/Phaser/FickleRegister.java --- a/jdk/test/java/util/concurrent/Phaser/FickleRegister.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/Phaser/FickleRegister.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/Phaser/PhaseOverflow.java --- a/jdk/test/java/util/concurrent/Phaser/PhaseOverflow.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/Phaser/PhaseOverflow.java Wed Jul 05 17:42:05 2017 +0200 @@ -29,7 +29,7 @@ * Written by Martin Buchholz and Doug Lea with assistance from * members of JCP JSR-166 Expert Group and released to the public * domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/Phaser/TieredArriveLoops.java --- a/jdk/test/java/util/concurrent/Phaser/TieredArriveLoops.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/Phaser/TieredArriveLoops.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/ScheduledThreadPoolExecutor/DelayOverflow.java --- a/jdk/test/java/util/concurrent/ScheduledThreadPoolExecutor/DelayOverflow.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/ScheduledThreadPoolExecutor/DelayOverflow.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/Semaphore/PermitOverflow.java --- a/jdk/test/java/util/concurrent/Semaphore/PermitOverflow.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/Semaphore/PermitOverflow.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/Semaphore/RacingReleases.java --- a/jdk/test/java/util/concurrent/Semaphore/RacingReleases.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/Semaphore/RacingReleases.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/forkjoin/Integrate.java --- a/jdk/test/java/util/concurrent/forkjoin/Integrate.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/forkjoin/Integrate.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/forkjoin/NQueensCS.java --- a/jdk/test/java/util/concurrent/forkjoin/NQueensCS.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/forkjoin/NQueensCS.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java --- a/jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java --- a/jdk/test/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/locks/ReentrantLock/LoopHelpers.java --- a/jdk/test/java/util/concurrent/locks/ReentrantLock/LoopHelpers.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/LoopHelpers.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Misc utilities in JSR166 performance tests diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java --- a/jdk/test/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java --- a/jdk/test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/LoopHelpers.java --- a/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/LoopHelpers.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/LoopHelpers.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Misc utilities in JSR166 performance tests diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java --- a/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ /* diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/RWMap.java --- a/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/RWMap.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/RWMap.java Wed Jul 05 17:42:05 2017 +0200 @@ -28,7 +28,7 @@ * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; diff -r 837037533544 -r 3ea0814d3885 jdk/test/java/util/zip/ZipFile/ClearStaleZipFileInputStreams.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/util/zip/ZipFile/ClearStaleZipFileInputStreams.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Portions Copyright (c) 2011 IBM Corporation + */ + +/* + * @test + * @bug 7031076 + * @summary Allow stale InputStreams from ZipFiles to be GC'd + * @author Neil Richards , + */ +import java.lang.ref.ReferenceQueue; +import java.lang.ref.WeakReference; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.Random; +import java.util.Set; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipOutputStream; + +public class ClearStaleZipFileInputStreams { + private static final int ZIP_ENTRY_NUM = 5; + + private static final byte[][] data; + + static { + data = new byte[ZIP_ENTRY_NUM][]; + Random r = new Random(); + for (int i = 0; i < ZIP_ENTRY_NUM; i++) { + data[i] = new byte[1000]; + r.nextBytes(data[i]); + } + } + + private static File createTestFile(int compression) throws Exception { + File tempZipFile = + File.createTempFile("test-data" + compression, ".zip"); + tempZipFile.deleteOnExit(); + + ZipOutputStream zos = + new ZipOutputStream(new FileOutputStream(tempZipFile)); + zos.setLevel(compression); + + try { + for (int i = 0; i < ZIP_ENTRY_NUM; i++) { + String text = "Entry" + i; + ZipEntry entry = new ZipEntry(text); + zos.putNextEntry(entry); + try { + zos.write(data[i], 0, data[i].length); + } finally { + zos.closeEntry(); + } + } + } finally { + zos.close(); + } + + return tempZipFile; + } + + private static void startGcInducingThread(final int sleepMillis) { + final Thread gcInducingThread = new Thread() { + public void run() { + while (true) { + System.gc(); + try { + Thread.sleep(sleepMillis); + } catch (InterruptedException e) { } + } + } + }; + + gcInducingThread.setDaemon(true); + gcInducingThread.start(); + } + + public static void main(String[] args) throws Exception { + startGcInducingThread(500); + runTest(ZipOutputStream.DEFLATED); + runTest(ZipOutputStream.STORED); + } + + private static void runTest(int compression) throws Exception { + ReferenceQueue rq = new ReferenceQueue<>(); + + System.out.println("Testing with a zip file with compression level = " + + compression); + File f = createTestFile(compression); + try { + ZipFile zf = new ZipFile(f); + try { + Set refSet = createTransientInputStreams(zf, rq); + + System.out.println("Waiting for 'stale' input streams from ZipFile to be GC'd ..."); + System.out.println("(The test will hang on failure)"); + while (false == refSet.isEmpty()) { + refSet.remove(rq.remove()); + } + System.out.println("Test PASSED."); + System.out.println(); + } finally { + zf.close(); + } + } finally { + f.delete(); + } + } + + private static Set createTransientInputStreams(ZipFile zf, + ReferenceQueue rq) throws Exception { + Enumeration zfe = zf.entries(); + Set refSet = new HashSet<>(); + + while (zfe.hasMoreElements()) { + InputStream is = zf.getInputStream(zfe.nextElement()); + refSet.add(new WeakReference(is, rq)); + } + + return refSet; + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/javax/crypto/Cipher/GCMAPI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/crypto/Cipher/GCMAPI.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 7031343 + * @summary Provide API changes to support GCM AEAD ciphers + * @author Brad Wetmore + */ + +import javax.crypto.*; +import javax.crypto.spec.*; +import java.nio.ByteBuffer; + +/* + * At this point in time, we can't really do any testing since only the API + * is available, the underlying implementation doesn't exist yet. Test + * what we can... + */ +public class GCMAPI { + + // 16 elements + private static byte[] bytes = new byte[] { + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }; + + private static int failed = 0; + private static Cipher c; + + public static void main(String[] args) throws Exception { + c = Cipher.getInstance("AES"); + c.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(new byte[16], "AES")); + + updateAADFail((byte[]) null); + updateAADPass(bytes); + + updateAADFail(null, 2, 4); + updateAADFail(bytes, -2, 4); + updateAADFail(bytes, 2, -4); + updateAADFail(bytes, 2, 15); // one too many + + updateAADPass(bytes, 2, 14); // ok. + updateAADPass(bytes, 4, 4); + updateAADPass(bytes, 0, 0); + + ByteBuffer bb = ByteBuffer.wrap(bytes); + + updateAADFail((ByteBuffer) null); + updateAADPass(bb); + + if (failed != 0) { + throw new Exception("Test(s) failed"); + } + } + + private static void updateAADPass(byte[] src) { + try { + c.updateAAD(src); + } catch (UnsupportedOperationException e) { + // swallow + }catch (Exception e) { + e.printStackTrace(); + failed++; + } + } + + private static void updateAADFail(byte[] src) { + try { + c.updateAAD(src); + new Exception("Didn't Fail as Expected").printStackTrace(); + failed++; + } catch (IllegalArgumentException e) { + // swallow + } + } + + private static void updateAADPass(byte[] src, int offset, int len) { + try { + c.updateAAD(src, offset, len); + } catch (UnsupportedOperationException e) { + // swallow + } catch (Exception e) { + e.printStackTrace(); + failed++; + } + } + + private static void updateAADFail(byte[] src, int offset, int len) { + try { + c.updateAAD(src, offset, len); + new Exception("Didn't Fail as Expected").printStackTrace(); + failed++; + } catch (IllegalArgumentException e) { + // swallow + } + } + + private static void updateAADPass(ByteBuffer src) { + try { + c.updateAAD(src); + } catch (UnsupportedOperationException e) { + // swallow + }catch (Exception e) { + e.printStackTrace(); + failed++; + } + } + + private static void updateAADFail(ByteBuffer src) { + try { + c.updateAAD(src); + new Exception("Didn't Fail as Expected").printStackTrace(); + failed++; + } catch (IllegalArgumentException e) { + // swallow + } + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/javax/crypto/spec/GCMParameterSpec/GCMParameterSpecTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/crypto/spec/GCMParameterSpec/GCMParameterSpecTest.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 7031343 + * @summary Provide API changes to support GCM AEAD ciphers + * @author Brad Wetmore + */ + +import javax.crypto.AEADBadTagException; +import javax.crypto.spec.GCMParameterSpec; +import java.util.Arrays; + +public class GCMParameterSpecTest { + + // 16 elements + private static byte[] bytes = new byte[] { + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }; + + private static int failed = 0; + + public static void main(String[] args) throws Exception { + newGCMParameterSpecFail(-1, bytes); + newGCMParameterSpecFail(128, null); + newGCMParameterSpecPass(128, bytes); + + newGCMParameterSpecFail(-1, bytes, 2, 4); + newGCMParameterSpecFail(128, null, 2, 4); + newGCMParameterSpecFail(128, bytes, -2, 4); + newGCMParameterSpecFail(128, bytes, 2, -4); + newGCMParameterSpecFail(128, bytes, 2, 15); // one too many + + newGCMParameterSpecPass(128, bytes, 2, 14); // ok. + newGCMParameterSpecPass(96, bytes, 4, 4); + newGCMParameterSpecPass(96, bytes, 0, 0); + + // Might as well check the Exception constructors. + try { + new AEADBadTagException(); + new AEADBadTagException("Bad Tag Seen"); + } catch (Exception e) { + e.printStackTrace(); + failed++; + } + + if (failed != 0) { + throw new Exception("Test(s) failed"); + } + } + + private static void newGCMParameterSpecPass( + int tLen, byte[] src) { + try { + GCMParameterSpec gcmps = new GCMParameterSpec(tLen, src); + if (gcmps.getTLen() != tLen) { + throw new Exception("tLen's not equal"); + } + if (!Arrays.equals(gcmps.getIV(), src)) { + throw new Exception("IV's not equal"); + } + } catch (Exception e) { + e.printStackTrace(); + failed++; + } + } + + private static void newGCMParameterSpecFail( + int tLen, byte[] src) { + try { + new GCMParameterSpec(tLen, src); + new Exception("Didn't Fail as Expected").printStackTrace(); + failed++; + } catch (IllegalArgumentException e) { + // swallow + } + } + + private static void newGCMParameterSpecPass( + int tLen, byte[] src, int offset, int len) { + try { + GCMParameterSpec gcmps = + new GCMParameterSpec(tLen, src, offset, len); + if (gcmps.getTLen() != tLen) { + throw new Exception("tLen's not equal"); + } + if (!Arrays.equals(gcmps.getIV(), + Arrays.copyOfRange(src, offset, offset + len))) { + System.out.println(offset + " " + len); + System.out.println(Arrays.copyOfRange(src, offset, len)[0]); + throw new Exception("IV's not equal"); + } + } catch (Exception e) { + e.printStackTrace(); + failed++; + } + } + + private static void newGCMParameterSpecFail( + int tLen, byte[] src, int offset, int len) { + try { + new GCMParameterSpec(tLen, src, offset, len); + new Exception("Didn't Fail as Expected").printStackTrace(); + failed++; + } catch (IllegalArgumentException e) { + // swallow + } + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/javax/imageio/metadata/DOML3Node.java --- a/jdk/test/javax/imageio/metadata/DOML3Node.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/javax/imageio/metadata/DOML3Node.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ /* * @test - * @bug 6559064 + * @bug 6559064 6942504 * * @summary Verify DOM L3 Node APIs behave as per Image I/O spec. * @@ -34,6 +34,7 @@ import javax.imageio.metadata.IIOMetadataNode; import org.w3c.dom.Attr; +import org.w3c.dom.Node; import org.w3c.dom.DOMException; import org.w3c.dom.UserDataHandler; @@ -74,7 +75,7 @@ } try { - node.setUserData("key"); + node.getUserData("key"); throw new RuntimeException("No expected DOM exception"); } catch (DOMException e) { } @@ -116,12 +117,6 @@ } try { - node.lookupPrefix("namespaceURI"); - throw new RuntimeException("No expected DOM exception"); - } catch (DOMException e) { - } - - try { node.getTextContent(); throw new RuntimeException("No expected DOM exception"); } catch (DOMException e) { diff -r 837037533544 -r 3ea0814d3885 jdk/test/javax/swing/JComponent/6989617/bug6989617.java --- a/jdk/test/javax/swing/JComponent/6989617/bug6989617.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/javax/swing/JComponent/6989617/bug6989617.java Wed Jul 05 17:42:05 2017 +0200 @@ -59,9 +59,7 @@ toolkit.realSync(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { - if (panel.getPaintRectangle() != null) { - throw new RuntimeException("paint rectangle is not null"); - } + panel.resetPaintRectangle(); button.repaint(); } }); diff -r 837037533544 -r 3ea0814d3885 jdk/test/javax/swing/JLabel/6596966/bug6596966.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/swing/JLabel/6596966/bug6596966.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + @bug 6596966 + @summary Some JFileChooser mnemonics do not work with sticky keys + * @library ../../regtesthelpers + * @build Util + @run main bug6596966 + @author Pavel Porvatov +*/ + + +import javax.swing.*; +import java.awt.*; +import java.awt.event.KeyEvent; + +public class bug6596966 { + private static JFrame frame; + + private static JLabel label; + private static JButton button; + private static JComboBox comboBox; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + button = new JButton("Button"); + comboBox = new JComboBox(); + + label = new JLabel("Label"); + label.setDisplayedMnemonic('L'); + label.setLabelFor(comboBox); + + JPanel pnContent = new JPanel(); + + pnContent.add(button); + pnContent.add(label); + pnContent.add(comboBox); + + frame = new JFrame(); + + frame.add(pnContent); + frame.pack(); + frame.setVisible(true); + } + }); + + Util.blockTillDisplayed(frame); + + robot.keyPress(KeyEvent.VK_ALT); + robot.keyPress(KeyEvent.VK_L); + + robot.waitForIdle(); + + Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new KeyEvent(label, KeyEvent.KEY_RELEASED, + EventQueue.getMostRecentEventTime(), 0, KeyEvent.VK_L, 'L')); + + robot.waitForIdle(); + + try { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + if (!comboBox.isFocusOwner()) { + throw new RuntimeException("comboBox isn't focus owner"); + } + } + }); + } finally { + robot.keyRelease(KeyEvent.VK_ALT); + } + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/javax/swing/JLabel/7004134/bug7004134.java --- a/jdk/test/javax/swing/JLabel/7004134/bug7004134.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/javax/swing/JLabel/7004134/bug7004134.java Wed Jul 05 17:42:05 2017 +0200 @@ -52,7 +52,13 @@ frame.add(label); frame.pack(); frame.setVisible(true); + } + }); + ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync(); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { ToolTipManager toolTipManager = ToolTipManager.sharedInstance(); toolTipManager.setInitialDelay(0); @@ -83,7 +89,13 @@ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); + } + }); + ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync(); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { ToolTipManager toolTipManager = ToolTipManager.sharedInstance(); toolTipManager.setInitialDelay(0); diff -r 837037533544 -r 3ea0814d3885 jdk/test/javax/swing/JMenuItem/7036148/bug7036148.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/swing/JMenuItem/7036148/bug7036148.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + /* + * @test + * @bug 7036148 + * @summary NullPointerException with null JMenu name + * @author Alexander Potochkin + * @run main bug7036148 + */ + + +import javax.swing.*; +import java.awt.event.ActionEvent; + +public class bug7036148 extends JFrame { + public bug7036148() { + JMenuBar bar = new JMenuBar(); + Action menuAction = new AbstractAction(null, null){ + public void actionPerformed(ActionEvent e) { + } + }; + JMenu menu = new JMenu(menuAction); + menu.add(new JMenuItem("test")); + bar.add(menu); + setJMenuBar(bar); + pack(); + } + + public static void main(String[] args) { + new bug7036148(); + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/javax/swing/border/Test7034614.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/swing/border/Test7034614.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7034614 + * @summary Tests that TitledBorder does not modify Insets + * @author Sergey Malenkov + */ + +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.image.BufferedImage; +import javax.swing.border.Border; +import javax.swing.border.TitledBorder; + +public class Test7034614 { + + public static void main(String[] args) { + Graphics g = new BufferedImage(9, 9, 9).getGraphics(); + + BrokenBorder broken = new BrokenBorder(); + TitledBorder titled = new TitledBorder(broken, broken.getClass().getName()); + + Insets insets = (Insets) broken.getBorderInsets(broken).clone(); + titled.getBorderInsets(broken); + broken.validate(insets); + for (int i = 0; i < 10; i++) { + titled.paintBorder(broken, g, 0, 0, i, i); + broken.validate(insets); + titled.getBaseline(broken, i, i); + broken.validate(insets); + } + } + + private static class BrokenBorder extends Component implements Border { + private Insets insets = new Insets(1, 2, 3, 4); + + private void validate(Insets insets) { + if (!this.insets.equals(insets)) { + throw new Error("unexpected change"); + } + } + + public Insets getBorderInsets(Component c) { + return this.insets; + } + + public boolean isBorderOpaque() { + return false; + } + + public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { + } + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/javax/swing/plaf/synth/7032791/bug7032791.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/swing/plaf/synth/7032791/bug7032791.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 7032791 + * @author Alexander Potochkin + * @summary TableCellRenderer.getTableCellRendererComponent() doesn't accept null JTable with GTK+ L&F + */ + +import javax.swing.*; +import javax.swing.plaf.synth.SynthLookAndFeel; +import javax.swing.table.TableCellRenderer; + +public class bug7032791 { + + public static void main(String[] args) throws Exception { + + UIManager.setLookAndFeel(new SynthLookAndFeel()); + + Object value = "Test value"; + JTable table = new JTable(1, 1); + TableCellRenderer renderer = table.getDefaultRenderer(Object.class); + renderer.getTableCellRendererComponent(null, value, true, true, 0, 0); + System.out.println("OK"); + } +} + diff -r 837037533544 -r 3ea0814d3885 jdk/test/javax/swing/text/CSSBorder/6796710/bug6796710.java --- a/jdk/test/javax/swing/text/CSSBorder/6796710/bug6796710.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/javax/swing/text/CSSBorder/6796710/bug6796710.java Wed Jul 05 17:42:05 2017 +0200 @@ -31,6 +31,8 @@ @run main bug6796710 */ +import sun.awt.SunToolkit; + import javax.swing.*; import java.awt.*; import java.awt.image.BufferedImage; @@ -91,7 +93,7 @@ } }); - robot.waitForIdle(); + ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync(); BufferedImage bufferedImage = getPnBottomImage(); @@ -101,7 +103,10 @@ } }); - robot.waitForIdle(); + ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync(); + + // On Linux platforms realSync doesn't guaranties setSize completion + Thread.sleep(1000); if (!Util.compareBufferedImages(bufferedImage, getPnBottomImage())) { throw new RuntimeException("The test failed"); diff -r 837037533544 -r 3ea0814d3885 jdk/test/javax/swing/text/GlyphView/6539700/bug6539700.java --- a/jdk/test/javax/swing/text/GlyphView/6539700/bug6539700.java Thu Apr 21 15:32:48 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 6539700 - * @summary test that the long space-less lines are correctly soft-wrapped - * @author Sergey Groznyh - * @run main bug6539700 - */ - -import javax.swing.JEditorPane; -import javax.swing.JFrame; -import javax.swing.SwingUtilities; -import javax.swing.text.ParagraphView; -import javax.swing.text.View; - -public class bug6539700 { - static JFrame f; - static JEditorPane ep; - static String text = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + - "AAAAAAAAAAAAAA"; - static int size = 100; - static Class rowClass = null; - - static void createContentPane() { - ep = new JEditorPane(); - ep.setContentType("text/html"); - ep.setEditable(false); - ep.setText(text); - f = new JFrame(); - f.setSize(size, 2 * size); - f.add(ep); - f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - f.setVisible(true); - } - - static void checkRows(View v, boolean last) { - int width = (int) v.getPreferredSpan(View.X_AXIS); - - if (v.getClass() == rowClass) { - // Row width shouldn't exceed the container width - if (width > size) { - throw new RuntimeException("too long row: " + width); - } - - // Row shouldn't be too short (except for the last one) - if (!last) { - if (width < size * 2 / 3) { - throw new RuntimeException("too short row: " + width); - } - } - } - - int n = v.getViewCount(); - if (n > 0) { - for (int i = 0; i < n; i++) { - View c = v.getView(i); - checkRows(c, i == n - 1); - } - } - } - - public static void main(String[] argv) { - try { - SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - createContentPane(); - } - }); - } catch (Exception ex) { - throw new RuntimeException(ex); - } - - Class[] pvchildren = ParagraphView.class.getDeclaredClasses(); - for (Class c : pvchildren) { - if (c.getName().equals("javax.swing.text.ParagraphView$Row")) { - rowClass = c; - break; - } - } - if (rowClass == null) { - throw new RuntimeException("can't find ParagraphView.Row class"); - } - - SwingUtilities.invokeLater(new Runnable() { - public void run() { - checkRows(ep.getUI().getRootView(ep), true); - } - }); - - System.out.println("OK"); - } -} diff -r 837037533544 -r 3ea0814d3885 jdk/test/javax/swing/text/html/parser/Parser/7003777/bug7003777.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/swing/text/html/parser/Parser/7003777/bug7003777.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + @bug 7003777 + @summary Nonexistent html entities not parsed properly. + @author Pavel Porvatov +*/ + +import javax.swing.*; +import javax.swing.text.BadLocationException; + +public class bug7003777 { + private static final String[] TEST_STRINGS = { + "&a", + "&aa", + "&a;", + "&aa;", + }; + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + JTextPane pane = new JTextPane(); + + pane.setContentType("text/html"); + + for (String testString : TEST_STRINGS) { + pane.setText(testString); + + String parsedText; + + try { + parsedText = pane.getDocument().getText(0, pane.getDocument().getLength()); + } catch (BadLocationException e) { + throw new RuntimeException("The test failed.", e); + } + + if (parsedText.charAt(0) != '\n') { + throw new RuntimeException("The first char should be \\n"); + } + + parsedText = parsedText.substring(1); + + if (!testString.equals(parsedText)) { + throw new RuntimeException("The '" + testString + + "' string wasn't parsed correctly. Parsed value is '" + parsedText + "'"); + } + } + } + }); + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/sample/chatserver/ChatTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/sample/chatserver/ChatTest.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,399 @@ +/* + * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* @test + * @summary Test chat server chatserver test + * + * @library ../../../src/share/sample/nio/chatserver + * @build ChatTest ChatServer Client ClientReader DataReader MessageReader NameReader + * @run main ChatTest + */ + +import java.io.*; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.CyclicBarrier; + +public class ChatTest { + public static int listeningPort = 0; + + public static void main(String[] args) throws Throwable { + testStartStop(); + testPortOpen(); + testAsksForName(); + testUseName(); + testConnectDisconnectConnect(); + testUsernameAndMessage(); + testDontReceiveMessageInNameState(); + } + + private static ChatServer startServer() throws IOException { + ChatServer server = new ChatServer(0); + InetSocketAddress address = (InetSocketAddress) server.getSocketAddress(); + listeningPort = address.getPort(); + server.run(); + return server; + } + + public static void testStartStop() throws Exception { + ChatServer server = startServer(); + server.shutdown(); + } + + public static void testPortOpen() throws Exception { + ChatServer server = startServer(); + try { + Socket socket = new Socket("localhost", listeningPort); + if (!socket.isConnected()) { + throw new RuntimeException("Failed to connect to server: port not open"); + } + } finally { + server.shutdown(); + } + } + + public static void testAsksForName() throws Exception { + ChatServer server = startServer(); + try { + Socket socket = new Socket("localhost", listeningPort); + + Reader reader = new BufferedReader(new InputStreamReader(socket.getInputStream())); + String string = readAvailableString(reader); + if (!string.equals("Name: ")) { + throw new RuntimeException("Server doesn't send Name: "); + } + } finally { + server.shutdown(); + } + } + + public static void testUseName() throws Throwable { + ChatServer server = startServer(); + try { + performTestUseName(); + } finally { + server.shutdown(); + } + } + + public static void testConnectDisconnectConnect() throws Exception { + ChatServer server = startServer(); + try { + performTestConnectDisconnectConnect(); + } finally { + server.shutdown(); + } + } + + public static void testUsernameAndMessage() throws Exception { + ChatServer server = startServer(); + try { + performTestUsernameAndMessage(); + } finally { + server.shutdown(); + } + } + + public static void testDontReceiveMessageInNameState() throws Exception { + ChatServer server = startServer(); + try { + performDontReceiveMessageInNameState(); + } finally { + server.shutdown(); + } + } + + private static void assertEqual(List exception, Object value, Object expected) { + if (expected == value) { + return; + } + if (expected == null) { + exception.add(new RuntimeException("Expected null, but was: " + value)); + return; + } + if (!expected.equals(value)) { + exception.add(new RuntimeException("Expected: " + expected + " but was: " + value)); + return; + } + } + + private static void performDontReceiveMessageInNameState() throws Exception { + final CyclicBarrier barrier1 = new CyclicBarrier(2); + final CyclicBarrier barrier2 = new CyclicBarrier(2); + final CyclicBarrier barrier3 = new CyclicBarrier(2); + final List exceptions = Collections.synchronizedList(new ArrayList()); + + ChatConnection chatConnection = new ChatConnection() { + @Override + public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception { + String string = readAvailableString(reader); + assertEqual(exceptions, string, "Name: "); + writer.write("testClient1\n"); + waitForJoin(reader, "testClient1"); + barrier1.await(); + writer.write("Ignore this!\n"); + barrier2.await(); + barrier3.await(); + } + }; + + Thread client2 = new Thread(new ChatConnection() { + @Override + public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception { + barrier1.await(); + barrier2.await(); + String string = readAvailableString(reader); + assertEqual(exceptions, string, "Name: "); + string = readAvailableString(reader, true); + assertEqual(exceptions, string, null); + writer.write("testClient2\n"); + barrier3.await(); + } + }); + + client2.start(); + chatConnection.run(); + if (!exceptions.isEmpty()) { + throw exceptions.get(0); + } + + } + + private static void waitForJoin(BufferedReader reader, String s) throws IOException { + String joined; + do { + joined = readAvailableString(reader); + } while (!(joined != null && joined.contains("Welcome " + s))); + } + + private static void performTestUsernameAndMessage() throws Exception { + final CyclicBarrier barrier1 = new CyclicBarrier(2); + final CyclicBarrier barrier2 = new CyclicBarrier(2); + final CyclicBarrier barrier3 = new CyclicBarrier(2); + final List exceptions = Collections.synchronizedList(new ArrayList()); + + ChatConnection chatConnection = new ChatConnection() { + @Override + public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception { + String string = readAvailableString(reader); + assertEqual(exceptions, string, "Name: "); + writer.write("testClient1\n"); + waitForJoin(reader, "testClient1"); + barrier1.await(); + barrier2.await(); + string = readAvailableString(reader); + assertEqual(exceptions, string, "testClient2: Hello world!\n"); + barrier3.await(); + } + }; + + Thread client2 = new Thread(new ChatConnection() { + @Override + public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception { + String string = readAvailableString(reader); + assertEqual(exceptions, string, "Name: "); + barrier1.await(); + writer.write("testClient2\nHello world!\n"); + barrier2.await(); + barrier3.await(); + } + }); + + client2.start(); + chatConnection.run(); + if (!exceptions.isEmpty()) { + throw exceptions.get(0); + } + } + + private static void performTestConnectDisconnectConnect() throws Exception { + final CyclicBarrier barrier1 = new CyclicBarrier(2); + final CyclicBarrier barrier2 = new CyclicBarrier(2); + final CyclicBarrier barrier3 = new CyclicBarrier(2); + final List exceptions = new ArrayList(); + + ChatConnection chatConnection = new ChatConnection() { + @Override + public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception { + String string = readAvailableString(reader); + assertEqual(exceptions, string, "Name: "); + writer.write("testClient1\n"); + } + }; + + ChatConnection chatConnection2 = new ChatConnection() { + @Override + public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception { + readAvailableString(reader); + writer.write("testClient1\n"); + waitForJoin(reader, "testClient1"); + barrier1.await(); + writer.write("Good morning!\n"); + barrier2.await(); + String string = readAvailableString(reader); + assertEqual(exceptions, string, "testClient2: Hello world!\n"); + barrier3.await(); + } + }; + + Thread client2 = new Thread(new ChatConnection() { + @Override + public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception { + readAvailableString(reader); + writer.write("testClient2\n"); + waitForJoin(reader, "testClient2"); + barrier1.await(); + writer.write("Hello world!\n"); + barrier2.await(); + String string = readAvailableString(reader); + assertEqual(exceptions, string, "testClient1: Good morning!\n"); + barrier3.await(); + } + }); + + client2.start(); + chatConnection.run(); + chatConnection2.run(); + if (!exceptions.isEmpty()) { + throw exceptions.get(0); + } + } + + private static void performTestUseName() throws Exception { + final CyclicBarrier barrier1 = new CyclicBarrier(2); + final CyclicBarrier barrier2 = new CyclicBarrier(2); + final CyclicBarrier barrier3 = new CyclicBarrier(2); + final List exceptions = new ArrayList(); + + ChatConnection chatConnection = new ChatConnection() { + @Override + public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception { + String string = readAvailableString(reader); + if (!"Name: ".equals(string)) { + exceptions.add(new RuntimeException("Expected Name: ")); + } + writer.write("testClient1\n"); + waitForJoin(reader, "testClient1"); + barrier1.await(); + barrier2.await(); + string = readAvailableString(reader); + if (!"testClient2: Hello world!\n".equals(string)) { + exceptions.add(new RuntimeException("testClient2: Hello world!\n")); + } + barrier3.await(); + } + }; + + Thread client2 = new Thread(new ChatConnection() { + @Override + public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception { + String string = readAvailableString(reader); + if (!"Name: ".equals(string)) { + exceptions.add(new RuntimeException("Expected Name: ")); + } + writer.write("testClient2\n"); + waitForJoin(reader, "testClient2"); + barrier1.await(); + writer.write("Hello world!\n"); + barrier2.await(); + barrier3.await(); + } + }); + + client2.start(); + chatConnection.run(); + if (!exceptions.isEmpty()) { + throw exceptions.get(0); + } + } + + private static String readAvailableString(Reader reader) throws IOException { + return readAvailableString(reader, false); + } + + private static String readAvailableString(Reader reader, boolean now) throws IOException { + StringBuilder builder = new StringBuilder(); + int bytes; + if (now && !reader.ready()) { + return null; + } + do { + char[] buf = new char[256]; + bytes = reader.read(buf); + builder.append(buf, 0, bytes); + } while (bytes == 256); + return builder.toString(); + } + + private abstract static class ChatConnection implements Runnable { + public Exception exception; + + @Override + public void run() { + try (Socket socket = new Socket("localhost", listeningPort); + BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream())); + Writer writer = new FlushingWriter(new OutputStreamWriter(socket.getOutputStream()))) { + socket.setTcpNoDelay(true); + + run(socket, reader, writer); + } catch (Exception e) { + exception = e; + } + } + + public abstract void run(Socket socket, BufferedReader reader, Writer writer) throws Exception; + } + + private static class FlushingWriter extends Writer { + public final Writer delegate; + + private FlushingWriter(Writer delegate) { + this.delegate = delegate; + } + + @Override + public void write(char[] cbuf, int off, int len) throws IOException { + delegate.write(cbuf, off, len); + } + + @Override + public void flush() throws IOException { + delegate.flush(); + } + + @Override + public void close() throws IOException { + delegate.close(); + } + + @Override + public void write(String str) throws IOException { + super.write(str); + flush(); + } + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/sample/mergesort/MergeSortTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/sample/mergesort/MergeSortTest.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* @test + * @summary Test MergeSort + * + * @library ../../../src/share/sample/forkjoin/mergesort + * @build MergeSortTest MergeDemo MergeSort + * @run main MergeSortTest + */ + +import java.util.Arrays; +import java.util.Random; + +public class MergeSortTest { + private Random random; + private MergeSort target; + + public MergeSortTest(Random random, MergeSort target) { + this.random = random; + this.target = target; + } + + public static void main(String[] args) { + MergeSortTest test = new MergeSortTest(new Random(), new MergeSort(Runtime.getRuntime().availableProcessors() * 4)); + test.run(); + } + + private int[] generateArray(int elements) { + int[] array = new int[elements]; + for (int i = 0; i < array.length; ++i) { + array[i] = random.nextInt(10); + } + return array; + } + + private void run() { + testSort(); + testSortSingle(); + testSortEmpty(); + testLong(); + } + + public void testLong() { + for (int i = 0; i < 1000; ++i) { + int elements = 1 + i * 100; + + int[] array = generateArray(elements); + int[] copy = Arrays.copyOf(array, array.length); + Arrays.sort(copy); + target.sort(array); + assertEqual(copy, array); + } + } + + private void testSortEmpty() { + int[] array = { }; + target.sort(array); + assertEqual(new int[] { }, array); + } + + private void testSortSingle() { + int[] array = { 1 }; + target.sort(array); + assertEqual(new int[] { 1 }, array); + } + + private void testSort() { + int[] array = { 7, 3, 9, 0, -6, 12, 54, 3, -6, 88, 1412}; + target.sort(array); + assertEqual(new int[] { -6, -6, 0, 3, 3, 7, 9, 12, 54, 88, 1412 }, array); + } + + private void assertEqual(int[] expected, int[] array) { + if (!Arrays.equals(expected, array)) { + throw new RuntimeException("Invalid sorted array!"); + } + } + + +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java --- a/jdk/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java Wed Jul 05 17:42:05 2017 +0200 @@ -23,7 +23,7 @@ /** * @test - * @bug 6476665 + * @bug 6476665 7033534 * @summary Verifies color conversion of Component Color Model based images * @run main ColConvCCMTest */ diff -r 837037533544 -r 3ea0814d3885 jdk/test/sun/java2d/cmm/ColorConvertOp/MTColConvTest.java --- a/jdk/test/sun/java2d/cmm/ColorConvertOp/MTColConvTest.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/sun/java2d/cmm/ColorConvertOp/MTColConvTest.java Wed Jul 05 17:42:05 2017 +0200 @@ -23,7 +23,7 @@ /** * @test - * @bug 6476665 + * @bug 6476665 7033534 * @summary Verifies MT safety of color conversion of Component and Direct Color Model based images * @run main MTColConvTest */ diff -r 837037533544 -r 3ea0814d3885 jdk/test/sun/net/InetAddress/nameservice/dns/cname.sh --- a/jdk/test/sun/net/InetAddress/nameservice/dns/cname.sh Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/sun/net/InetAddress/nameservice/dns/cname.sh Wed Jul 05 17:42:05 2017 +0200 @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -26,16 +26,16 @@ # @test # @bug 4763315 -# @build CanonicalName Lookup +# @build CanonicalName Lookup # @run shell/timeout=120 cname.sh # @summary Test DNS provider's handling of CNAME records # The host that we try to resolve -HOST=webcache.sfbay.sun.com +HOST=www-proxy.us.oracle.com -# fail gracefully if DNS is not configured or there +# fail gracefully if DNS is not configured or there # isn't a CNAME record. CLASSPATH=${TESTCLASSES} @@ -43,7 +43,7 @@ JAVA="${TESTJAVA}/bin/java" sh -xc "$JAVA CanonicalName $HOST" 2>&1 -if [ $? != 0 ]; then +if [ $? != 0 ]; then echo "DNS not configured or host doesn't resolve to CNAME record" exit 0 fi @@ -70,7 +70,7 @@ go "$np $sm" "$HOST" -# +# # Results # echo '' diff -r 837037533544 -r 3ea0814d3885 jdk/test/sun/security/krb5/KrbCredSubKey.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/sun/security/krb5/KrbCredSubKey.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,352 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 7030180 + * @run main/othervm KrbCredSubKey + * @summary AES 128/256 decrypt exception + */ + +import java.io.FileOutputStream; +import java.security.PrivilegedExceptionAction; +import javax.security.auth.Subject; +import javax.security.auth.kerberos.KerberosKey; +import javax.security.auth.kerberos.KerberosPrincipal; +import org.ietf.jgss.GSSContext; +import org.ietf.jgss.GSSCredential; +import org.ietf.jgss.GSSManager; +import sun.security.jgss.GSSUtil; +import sun.security.krb5.Config; +import sun.security.krb5.EncryptedData; + +public class KrbCredSubKey { + + public static void main(String[] args) throws Exception { + + // We don't care about clock difference + new FileOutputStream("krb5.conf").write( + "[libdefaults]\nclockskew=999999999".getBytes()); + System.setProperty("java.security.krb5.conf", "krb5.conf"); + Config.refresh(); + + Subject subj = new Subject(); + KerberosPrincipal kp = new KerberosPrincipal(princ); + KerberosKey kk = new KerberosKey( + kp, key, EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96, 0); + subj.getPrincipals().add(kp); + subj.getPrivateCredentials().add(kk); + + Subject.doAs(subj, new PrivilegedExceptionAction() { + public Object run() throws Exception { + GSSManager man = GSSManager.getInstance(); + GSSContext ctxt = man.createContext(man.createCredential( + null, GSSCredential.INDEFINITE_LIFETIME, + GSSUtil.GSS_KRB5_MECH_OID, GSSCredential.ACCEPT_ONLY)); + return ctxt.acceptSecContext(token, 0, token.length); + } + }); + } + + // All following data generated by myself on a test machine + + private static String princ = "server/host.rabbit.hole@RABBIT.HOLE"; + + // A aes-128 key for princ + private static byte[] key = { + (byte)0x83, (byte)0xA1, (byte)0xD6, (byte)0xE2, + (byte)0xC7, (byte)0x76, (byte)0xD5, (byte)0x24, + (byte)0x63, (byte)0x9F, (byte)0xF9, (byte)0xFF, + (byte)0x76, (byte)0x6D, (byte)0x26, (byte)0x30, + }; + + // A JGSS token generated by the first call of an initiator's + // initSecContext, targetting princ, using the authenticator + // subkey to encrypt the KRB_CRED inside AP_REQ + private static byte[] token = { + (byte)0x60, (byte)0x82, (byte)0x04, (byte)0x1C, + (byte)0x06, (byte)0x09, (byte)0x2A, (byte)0x86, + (byte)0x48, (byte)0x86, (byte)0xF7, (byte)0x12, + (byte)0x01, (byte)0x02, (byte)0x02, (byte)0x01, + (byte)0x00, (byte)0x6E, (byte)0x82, (byte)0x04, + (byte)0x0B, (byte)0x30, (byte)0x82, (byte)0x04, + (byte)0x07, (byte)0xA0, (byte)0x03, (byte)0x02, + (byte)0x01, (byte)0x05, (byte)0xA1, (byte)0x03, + (byte)0x02, (byte)0x01, (byte)0x0E, (byte)0xA2, + (byte)0x07, (byte)0x03, (byte)0x05, (byte)0x00, + (byte)0x20, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0xA3, (byte)0x82, (byte)0x01, (byte)0x04, + (byte)0x61, (byte)0x82, (byte)0x01, (byte)0x00, + (byte)0x30, (byte)0x81, (byte)0xFD, (byte)0xA0, + (byte)0x03, (byte)0x02, (byte)0x01, (byte)0x05, + (byte)0xA1, (byte)0x0D, (byte)0x1B, (byte)0x0B, + (byte)0x52, (byte)0x41, (byte)0x42, (byte)0x42, + (byte)0x49, (byte)0x54, (byte)0x2E, (byte)0x48, + (byte)0x4F, (byte)0x4C, (byte)0x45, (byte)0xA2, + (byte)0x25, (byte)0x30, (byte)0x23, (byte)0xA0, + (byte)0x03, (byte)0x02, (byte)0x01, (byte)0x00, + (byte)0xA1, (byte)0x1C, (byte)0x30, (byte)0x1A, + (byte)0x1B, (byte)0x06, (byte)0x73, (byte)0x65, + (byte)0x72, (byte)0x76, (byte)0x65, (byte)0x72, + (byte)0x1B, (byte)0x10, (byte)0x68, (byte)0x6F, + (byte)0x73, (byte)0x74, (byte)0x2E, (byte)0x72, + (byte)0x61, (byte)0x62, (byte)0x62, (byte)0x69, + (byte)0x74, (byte)0x2E, (byte)0x68, (byte)0x6F, + (byte)0x6C, (byte)0x65, (byte)0xA3, (byte)0x81, + (byte)0xBF, (byte)0x30, (byte)0x81, (byte)0xBC, + (byte)0xA0, (byte)0x03, (byte)0x02, (byte)0x01, + (byte)0x11, (byte)0xA2, (byte)0x81, (byte)0xB4, + (byte)0x04, (byte)0x81, (byte)0xB1, (byte)0xA7, + (byte)0xE8, (byte)0x58, (byte)0xBA, (byte)0x98, + (byte)0x69, (byte)0x45, (byte)0xB3, (byte)0x68, + (byte)0xBF, (byte)0xFD, (byte)0x25, (byte)0x74, + (byte)0xC4, (byte)0x2E, (byte)0x09, (byte)0x7B, + (byte)0x3C, (byte)0x7F, (byte)0xA5, (byte)0x6C, + (byte)0xC3, (byte)0x86, (byte)0xC9, (byte)0xEE, + (byte)0x58, (byte)0xD3, (byte)0x7C, (byte)0xD6, + (byte)0x19, (byte)0xA1, (byte)0x3B, (byte)0xF7, + (byte)0x17, (byte)0xD6, (byte)0x18, (byte)0xA9, + (byte)0x58, (byte)0x43, (byte)0x55, (byte)0xD6, + (byte)0xBA, (byte)0x85, (byte)0xF7, (byte)0x6B, + (byte)0x20, (byte)0x01, (byte)0xEF, (byte)0xB4, + (byte)0x74, (byte)0x0B, (byte)0x31, (byte)0x07, + (byte)0x55, (byte)0xD8, (byte)0x8C, (byte)0x85, + (byte)0x25, (byte)0x12, (byte)0x66, (byte)0x85, + (byte)0xA8, (byte)0x5A, (byte)0x84, (byte)0xB2, + (byte)0x6C, (byte)0xDE, (byte)0xEE, (byte)0xF9, + (byte)0x15, (byte)0xF2, (byte)0xBC, (byte)0xB0, + (byte)0x43, (byte)0xA5, (byte)0x21, (byte)0x31, + (byte)0xFA, (byte)0x2F, (byte)0x2C, (byte)0x37, + (byte)0x39, (byte)0xD8, (byte)0xAA, (byte)0xE0, + (byte)0x78, (byte)0x08, (byte)0x18, (byte)0xFB, + (byte)0x03, (byte)0x43, (byte)0x22, (byte)0xE6, + (byte)0x2C, (byte)0xF2, (byte)0x98, (byte)0xDC, + (byte)0x2A, (byte)0xDE, (byte)0x8C, (byte)0x95, + (byte)0x0B, (byte)0xB6, (byte)0xE6, (byte)0x0F, + (byte)0xB5, (byte)0x4E, (byte)0xAD, (byte)0xAC, + (byte)0xD1, (byte)0x4C, (byte)0xE8, (byte)0x22, + (byte)0x93, (byte)0x38, (byte)0xA2, (byte)0x44, + (byte)0x0E, (byte)0x83, (byte)0x9E, (byte)0x4D, + (byte)0xC0, (byte)0x1A, (byte)0x02, (byte)0xB2, + (byte)0xB8, (byte)0xCE, (byte)0xDF, (byte)0xB5, + (byte)0xFB, (byte)0xF2, (byte)0x75, (byte)0x5E, + (byte)0x74, (byte)0xC1, (byte)0x90, (byte)0x82, + (byte)0x60, (byte)0x00, (byte)0xA5, (byte)0xC3, + (byte)0xBF, (byte)0x66, (byte)0x97, (byte)0x0E, + (byte)0xF3, (byte)0x9F, (byte)0xB3, (byte)0xD9, + (byte)0x51, (byte)0x51, (byte)0x38, (byte)0xBC, + (byte)0xD9, (byte)0xC1, (byte)0xD0, (byte)0x1E, + (byte)0x90, (byte)0x9B, (byte)0x43, (byte)0xEE, + (byte)0xD9, (byte)0xD6, (byte)0x3E, (byte)0x31, + (byte)0xEA, (byte)0x8E, (byte)0xB1, (byte)0xDC, + (byte)0xDE, (byte)0xFD, (byte)0xA4, (byte)0x77, + (byte)0x6C, (byte)0x4A, (byte)0x81, (byte)0x1F, + (byte)0xA4, (byte)0x82, (byte)0x02, (byte)0xE8, + (byte)0x30, (byte)0x82, (byte)0x02, (byte)0xE4, + (byte)0xA0, (byte)0x03, (byte)0x02, (byte)0x01, + (byte)0x11, (byte)0xA2, (byte)0x82, (byte)0x02, + (byte)0xDB, (byte)0x04, (byte)0x82, (byte)0x02, + (byte)0xD7, (byte)0x81, (byte)0x78, (byte)0x25, + (byte)0x75, (byte)0x92, (byte)0x7A, (byte)0xEC, + (byte)0xBE, (byte)0x31, (byte)0xF1, (byte)0x50, + (byte)0xE7, (byte)0xC1, (byte)0x32, (byte)0xA5, + (byte)0xCB, (byte)0x34, (byte)0x46, (byte)0x95, + (byte)0x2B, (byte)0x84, (byte)0xB7, (byte)0x06, + (byte)0x0E, (byte)0x15, (byte)0x02, (byte)0x74, + (byte)0xCA, (byte)0x18, (byte)0x5D, (byte)0xE8, + (byte)0x0E, (byte)0x1B, (byte)0xB7, (byte)0x77, + (byte)0x5A, (byte)0x6C, (byte)0xFB, (byte)0x94, + (byte)0x82, (byte)0x2B, (byte)0xE6, (byte)0x14, + (byte)0x0C, (byte)0xDA, (byte)0x22, (byte)0xA2, + (byte)0x42, (byte)0xD7, (byte)0xB0, (byte)0xFC, + (byte)0xCA, (byte)0x4A, (byte)0xEA, (byte)0xB8, + (byte)0x92, (byte)0xB5, (byte)0x8C, (byte)0x71, + (byte)0xED, (byte)0x2B, (byte)0x46, (byte)0xC5, + (byte)0xE5, (byte)0x47, (byte)0x76, (byte)0x29, + (byte)0x27, (byte)0x0F, (byte)0xFF, (byte)0x03, + (byte)0x72, (byte)0x13, (byte)0xAA, (byte)0xDB, + (byte)0x4E, (byte)0xFF, (byte)0x48, (byte)0x36, + (byte)0xAB, (byte)0x73, (byte)0xD7, (byte)0xDA, + (byte)0xF1, (byte)0x80, (byte)0x1B, (byte)0x5B, + (byte)0x9A, (byte)0x88, (byte)0x07, (byte)0x47, + (byte)0x43, (byte)0x27, (byte)0xD5, (byte)0x00, + (byte)0x04, (byte)0xEE, (byte)0xAF, (byte)0x53, + (byte)0x5C, (byte)0xCC, (byte)0x2C, (byte)0xC7, + (byte)0x2F, (byte)0x94, (byte)0x12, (byte)0x86, + (byte)0xEF, (byte)0xAC, (byte)0xB1, (byte)0x6C, + (byte)0xB0, (byte)0xB5, (byte)0x3D, (byte)0x92, + (byte)0xBD, (byte)0xBE, (byte)0x7B, (byte)0x1A, + (byte)0x39, (byte)0x4A, (byte)0x1E, (byte)0x91, + (byte)0xA4, (byte)0xDF, (byte)0x82, (byte)0x12, + (byte)0x2E, (byte)0x67, (byte)0x17, (byte)0x92, + (byte)0xB3, (byte)0x93, (byte)0x38, (byte)0x32, + (byte)0x94, (byte)0xF5, (byte)0xF7, (byte)0x09, + (byte)0x07, (byte)0x5E, (byte)0x21, (byte)0x12, + (byte)0x70, (byte)0x37, (byte)0xAF, (byte)0x5A, + (byte)0x2D, (byte)0xAC, (byte)0xFF, (byte)0x22, + (byte)0x46, (byte)0xA0, (byte)0x12, (byte)0x74, + (byte)0x1C, (byte)0xA1, (byte)0x68, (byte)0xC3, + (byte)0x64, (byte)0xDB, (byte)0xC3, (byte)0x9F, + (byte)0xAB, (byte)0x0E, (byte)0x19, (byte)0xFE, + (byte)0xD9, (byte)0xA4, (byte)0xAA, (byte)0x7B, + (byte)0x73, (byte)0xAD, (byte)0xC8, (byte)0xA8, + (byte)0xD5, (byte)0x29, (byte)0xAD, (byte)0x1F, + (byte)0xEF, (byte)0x54, (byte)0xAE, (byte)0x72, + (byte)0x02, (byte)0xD9, (byte)0x06, (byte)0x0D, + (byte)0x1A, (byte)0x94, (byte)0x7B, (byte)0xBC, + (byte)0x32, (byte)0x9A, (byte)0xBC, (byte)0x4B, + (byte)0x33, (byte)0xC2, (byte)0x02, (byte)0xA3, + (byte)0xF4, (byte)0xB1, (byte)0xED, (byte)0x76, + (byte)0x0D, (byte)0x59, (byte)0xCD, (byte)0x56, + (byte)0xCB, (byte)0xDC, (byte)0xCE, (byte)0xED, + (byte)0xFF, (byte)0x25, (byte)0x84, (byte)0x5E, + (byte)0x41, (byte)0xF9, (byte)0x42, (byte)0xBE, + (byte)0x73, (byte)0xAC, (byte)0xA2, (byte)0x20, + (byte)0x97, (byte)0xB7, (byte)0x88, (byte)0x77, + (byte)0x65, (byte)0x43, (byte)0x9F, (byte)0xEE, + (byte)0xF4, (byte)0x3A, (byte)0x7E, (byte)0x9B, + (byte)0x5B, (byte)0x54, (byte)0xD3, (byte)0x0D, + (byte)0x50, (byte)0x6D, (byte)0xF6, (byte)0x14, + (byte)0xB7, (byte)0x5A, (byte)0x34, (byte)0x0F, + (byte)0x1F, (byte)0xC7, (byte)0x39, (byte)0x99, + (byte)0x9B, (byte)0x96, (byte)0xE3, (byte)0xAD, + (byte)0x86, (byte)0xE3, (byte)0x6A, (byte)0x71, + (byte)0x63, (byte)0x04, (byte)0xAD, (byte)0x9C, + (byte)0x17, (byte)0x68, (byte)0x44, (byte)0xFE, + (byte)0x21, (byte)0x62, (byte)0xD5, (byte)0x99, + (byte)0x4A, (byte)0xDF, (byte)0x48, (byte)0xDE, + (byte)0x9A, (byte)0xD4, (byte)0xBB, (byte)0xA1, + (byte)0x9B, (byte)0xE7, (byte)0x2A, (byte)0x08, + (byte)0x80, (byte)0x3A, (byte)0x08, (byte)0xA4, + (byte)0xBA, (byte)0xBE, (byte)0x1E, (byte)0x81, + (byte)0x63, (byte)0x20, (byte)0xAC, (byte)0x9C, + (byte)0x42, (byte)0x2F, (byte)0xCA, (byte)0x06, + (byte)0x95, (byte)0x92, (byte)0x97, (byte)0x09, + (byte)0x3C, (byte)0x0C, (byte)0x5A, (byte)0x99, + (byte)0xFB, (byte)0xAB, (byte)0xEB, (byte)0xDE, + (byte)0xC4, (byte)0x09, (byte)0xD3, (byte)0xA3, + (byte)0xF0, (byte)0x65, (byte)0xDC, (byte)0x5F, + (byte)0xAA, (byte)0xBB, (byte)0x28, (byte)0xC0, + (byte)0x3E, (byte)0xBF, (byte)0x77, (byte)0xAE, + (byte)0xCC, (byte)0x3A, (byte)0xD3, (byte)0x31, + (byte)0x0D, (byte)0x9B, (byte)0x96, (byte)0xEF, + (byte)0x2C, (byte)0xED, (byte)0x60, (byte)0x63, + (byte)0xC5, (byte)0x8F, (byte)0xCA, (byte)0xB0, + (byte)0xA2, (byte)0x0B, (byte)0x49, (byte)0x5A, + (byte)0xB2, (byte)0x8F, (byte)0xEF, (byte)0xE4, + (byte)0x19, (byte)0xC0, (byte)0xC6, (byte)0x2D, + (byte)0xD3, (byte)0x4F, (byte)0xB2, (byte)0xED, + (byte)0xA3, (byte)0xA4, (byte)0x6F, (byte)0xAE, + (byte)0xD4, (byte)0xE9, (byte)0xA2, (byte)0x5A, + (byte)0xFB, (byte)0xB0, (byte)0x14, (byte)0xBD, + (byte)0x06, (byte)0x12, (byte)0xD7, (byte)0x91, + (byte)0x15, (byte)0x46, (byte)0x78, (byte)0xE4, + (byte)0xD1, (byte)0x73, (byte)0xCA, (byte)0xA5, + (byte)0xA5, (byte)0x64, (byte)0xC8, (byte)0x6F, + (byte)0xD1, (byte)0xBD, (byte)0xEA, (byte)0x74, + (byte)0xE4, (byte)0xCA, (byte)0x40, (byte)0x16, + (byte)0x9E, (byte)0x46, (byte)0x7C, (byte)0x25, + (byte)0x6C, (byte)0x32, (byte)0xB4, (byte)0x14, + (byte)0xF9, (byte)0x26, (byte)0x8A, (byte)0x3A, + (byte)0xDD, (byte)0x51, (byte)0x26, (byte)0x79, + (byte)0x43, (byte)0x27, (byte)0x2E, (byte)0xED, + (byte)0xC7, (byte)0x82, (byte)0x7C, (byte)0xCE, + (byte)0x43, (byte)0x03, (byte)0x60, (byte)0x2A, + (byte)0x9C, (byte)0xB2, (byte)0x71, (byte)0x41, + (byte)0xAB, (byte)0x3D, (byte)0xA6, (byte)0xB5, + (byte)0x51, (byte)0xBC, (byte)0x80, (byte)0x1F, + (byte)0x96, (byte)0x73, (byte)0x23, (byte)0x11, + (byte)0xED, (byte)0xC0, (byte)0x1D, (byte)0x0B, + (byte)0xA0, (byte)0x13, (byte)0xB3, (byte)0x2F, + (byte)0x16, (byte)0x59, (byte)0x64, (byte)0x45, + (byte)0xE8, (byte)0x68, (byte)0xFB, (byte)0xF9, + (byte)0x6F, (byte)0xB0, (byte)0x2B, (byte)0xFB, + (byte)0x39, (byte)0xBB, (byte)0x53, (byte)0x8F, + (byte)0xD2, (byte)0xAF, (byte)0x38, (byte)0x5E, + (byte)0xEF, (byte)0x5B, (byte)0xE2, (byte)0x98, + (byte)0xE8, (byte)0x46, (byte)0x3C, (byte)0x03, + (byte)0x71, (byte)0x46, (byte)0x8D, (byte)0x41, + (byte)0x92, (byte)0x32, (byte)0x85, (byte)0x8D, + (byte)0xBA, (byte)0x33, (byte)0x05, (byte)0xB1, + (byte)0xE4, (byte)0x56, (byte)0x3E, (byte)0xF5, + (byte)0x20, (byte)0x35, (byte)0xA6, (byte)0x74, + (byte)0xA2, (byte)0xBE, (byte)0x54, (byte)0x08, + (byte)0xB4, (byte)0xFC, (byte)0x1D, (byte)0x13, + (byte)0x84, (byte)0xBE, (byte)0x1C, (byte)0xC5, + (byte)0x3E, (byte)0x43, (byte)0x14, (byte)0x6F, + (byte)0xC0, (byte)0x3D, (byte)0xF4, (byte)0xDC, + (byte)0x66, (byte)0x4E, (byte)0xF0, (byte)0x3E, + (byte)0xD4, (byte)0xC6, (byte)0xE9, (byte)0x8D, + (byte)0x7D, (byte)0xB9, (byte)0xDC, (byte)0x9F, + (byte)0xBE, (byte)0x54, (byte)0x63, (byte)0x93, + (byte)0x49, (byte)0x2F, (byte)0x6A, (byte)0xC3, + (byte)0x34, (byte)0xC5, (byte)0xF7, (byte)0x76, + (byte)0xE8, (byte)0xD5, (byte)0x5B, (byte)0xD9, + (byte)0x41, (byte)0xCA, (byte)0x74, (byte)0x25, + (byte)0x25, (byte)0x09, (byte)0xF4, (byte)0xD3, + (byte)0x00, (byte)0x9F, (byte)0x7D, (byte)0xFB, + (byte)0x3D, (byte)0xAB, (byte)0x87, (byte)0xF7, + (byte)0xCE, (byte)0x42, (byte)0x0F, (byte)0x60, + (byte)0xEB, (byte)0x03, (byte)0x47, (byte)0x98, + (byte)0x0F, (byte)0xEB, (byte)0xA4, (byte)0x05, + (byte)0xE2, (byte)0x58, (byte)0x8F, (byte)0x44, + (byte)0x09, (byte)0xD3, (byte)0x66, (byte)0x1E, + (byte)0x69, (byte)0x89, (byte)0xB7, (byte)0xEE, + (byte)0x8B, (byte)0xA4, (byte)0x8E, (byte)0x05, + (byte)0x2D, (byte)0x2E, (byte)0xB3, (byte)0x5A, + (byte)0xAE, (byte)0xAB, (byte)0x80, (byte)0xD6, + (byte)0x5C, (byte)0x93, (byte)0x40, (byte)0x91, + (byte)0x53, (byte)0xE6, (byte)0x13, (byte)0xD5, + (byte)0x2F, (byte)0x64, (byte)0xF0, (byte)0x68, + (byte)0xD2, (byte)0x85, (byte)0x94, (byte)0xE5, + (byte)0x2D, (byte)0x73, (byte)0x10, (byte)0x59, + (byte)0x18, (byte)0xCD, (byte)0xED, (byte)0xBC, + (byte)0x05, (byte)0x97, (byte)0xFD, (byte)0xE7, + (byte)0x6F, (byte)0x5D, (byte)0x7C, (byte)0x46, + (byte)0x28, (byte)0x5F, (byte)0xC2, (byte)0xB4, + (byte)0x31, (byte)0xA5, (byte)0x2B, (byte)0x82, + (byte)0xAB, (byte)0x32, (byte)0x49, (byte)0xA5, + (byte)0xCD, (byte)0x91, (byte)0x37, (byte)0x97, + (byte)0xA1, (byte)0x85, (byte)0x8F, (byte)0xBB, + (byte)0x6E, (byte)0x1E, (byte)0x9F, (byte)0xFC, + (byte)0x10, (byte)0x3B, (byte)0x8A, (byte)0xF6, + (byte)0x9A, (byte)0x66, (byte)0xBD, (byte)0x75, + (byte)0x4F, (byte)0x1D, (byte)0xBA, (byte)0x64, + (byte)0x15, (byte)0xDD, (byte)0x9F, (byte)0x00, + (byte)0x6C, (byte)0x2F, (byte)0x87, (byte)0x20, + (byte)0x25, (byte)0xA2, (byte)0x09, (byte)0x9F, + (byte)0x5D, (byte)0x64, (byte)0xC9, (byte)0xA8, + (byte)0x32, (byte)0x59, (byte)0x90, (byte)0x1D, + (byte)0x78, (byte)0xFE, (byte)0x5A, (byte)0xA2, + (byte)0x1F, (byte)0x9B, (byte)0x22, (byte)0xBE, + (byte)0x8F, (byte)0xEA, (byte)0x59, (byte)0x5B, + (byte)0x96, (byte)0xE3, (byte)0x4A, (byte)0xB2, + (byte)0x71, (byte)0x65, (byte)0xB7, (byte)0x3C, + (byte)0xC6, (byte)0x1B, (byte)0xD6, (byte)0x80, + (byte)0x90, (byte)0xD2, (byte)0xF2, (byte)0x6F, + (byte)0xA2, (byte)0x68, (byte)0x53, (byte)0xC0, + (byte)0x44, (byte)0xAF, (byte)0xD4, (byte)0x68, + (byte)0x12, (byte)0xFF, (byte)0xB4, (byte)0x36, + (byte)0x34, (byte)0x43, (byte)0xAC, (byte)0x1C, + }; +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/sun/security/krb5/auto/KDC.java --- a/jdk/test/sun/security/krb5/auto/KDC.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/sun/security/krb5/auto/KDC.java Wed Jul 05 17:42:05 2017 +0200 @@ -691,7 +691,10 @@ new KerberosTime(new Date()), body.from, till, body.rtime, - body.addresses, + body.addresses != null // always set caddr + ? body.addresses + : new HostAddresses( + new InetAddress[]{InetAddress.getLocalHost()}), null); EncryptionKey skey = keyForUser(body.sname, e3, true); if (skey == null) { @@ -716,7 +719,10 @@ till, body.rtime, body.crealm, body.sname, - body.addresses + body.addresses != null // always set caddr + ? body.addresses + : new HostAddresses( + new InetAddress[]{InetAddress.getLocalHost()}) ); EncryptedData edata = new EncryptedData(ckey, enc_part.asn1Encode(), KeyUsage.KU_ENC_TGS_REP_PART_SESSKEY); TGSRep tgsRep = new TGSRep(null, diff -r 837037533544 -r 3ea0814d3885 jdk/test/sun/security/krb5/auto/NoAddresses.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/sun/security/krb5/auto/NoAddresses.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7032354 + * @run main/othervm NoAddresses 1 + * @run main/othervm NoAddresses 2 + * @run main/othervm/fail NoAddresses 3 + * @summary no-addresses should not be used on acceptor side + */ + +import java.net.InetAddress; +import org.ietf.jgss.ChannelBinding; +import sun.security.jgss.GSSUtil; +import sun.security.krb5.Config; + +public class NoAddresses { + + public static void main(String[] args) + throws Exception { + + OneKDC kdc = new OneKDC(null); + kdc.writeJAASConf(); + KDC.saveConfig(OneKDC.KRB5_CONF, kdc, + "noaddresses = false", + "default_keytab_name = " + OneKDC.KTAB); + Config.refresh(); + + Context c = Context.fromJAAS("client"); + Context s = Context.fromJAAS("server"); + + c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); + s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); + + InetAddress initiator = InetAddress.getLocalHost(); + InetAddress acceptor = InetAddress.getLocalHost(); + switch (args[0]) { + case "1": + // no initiator host address available, should be OK + break; + case "2": + // correct initiator host address, still fine + c.x().setChannelBinding( + new ChannelBinding(initiator, acceptor, null)); + s.x().setChannelBinding( + new ChannelBinding(initiator, acceptor, null)); + break; + case "3": + // incorrect initiator host address, fail + initiator = InetAddress.getByAddress(new byte[]{1,1,1,1}); + c.x().setChannelBinding( + new ChannelBinding(initiator, acceptor, null)); + s.x().setChannelBinding( + new ChannelBinding(initiator, acceptor, null)); + break; + } + + Context.handshake(c, s); + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/sun/security/pkcs11/Provider/ConfigShortPath.java --- a/jdk/test/sun/security/pkcs11/Provider/ConfigShortPath.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/sun/security/pkcs11/Provider/ConfigShortPath.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,27 +22,44 @@ */ /** * @test - * @bug 6581254 - * @summary Allow "~" in config to support windows short path + * @bug 6581254 6986789 + * @summary Allow '~' and '+' in config file * @author Valerie Peng */ import java.security.*; import java.io.*; +import java.lang.reflect.*; public class ConfigShortPath { - public static void main(String[] args) { - String testSrc = System.getProperty("test.src", "."); - String configFile = testSrc + File.separator + "csp.cfg"; - System.out.println("Testing against " + configFile); + private static final String[] configNames = { "csp.cfg", "cspPlus.cfg" }; + + public static void main(String[] args) throws Exception { + Constructor cons = null; try { - Provider p = new sun.security.pkcs11.SunPKCS11(configFile); - } catch (ProviderException pe) { - String cause = pe.getCause().getMessage(); - if (cause.indexOf("Unexpected token") != -1) { - // re-throw to indicate test failure - throw pe; + Class clazz = Class.forName("sun.security.pkcs11.SunPKCS11"); + cons = clazz.getConstructor(String.class); + } catch (Exception ex) { + System.out.println("Skipping test - no PKCS11 provider available"); + return; + } + String testSrc = System.getProperty("test.src", "."); + for (int i = 0; i < configNames.length; i++) { + String configFile = testSrc + File.separator + configNames[i]; + + System.out.println("Testing against " + configFile); + try { + Object obj = cons.newInstance(configFile); + } catch (InvocationTargetException ite) { + Throwable cause = ite.getCause(); + if (cause instanceof ProviderException) { + String causeMsg = cause.getCause().getMessage(); + // Indicate failure if due to parsing config + if (causeMsg.indexOf("Unexpected token") != -1) { + throw (ProviderException) cause; + } + } } } } diff -r 837037533544 -r 3ea0814d3885 jdk/test/sun/security/pkcs11/Provider/cspPlus.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/sun/security/pkcs11/Provider/cspPlus.cfg Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,4 @@ +showInfo = false +name = NSS +nssSecmodDirectory = /export/local/38289.JDK7.PIT.JSN-TL+7-b112_pit_security_oel5.5-x64-32/results/ResultDir/KeytoolNSS/db +nssLibraryDirectory = /export/local/common/testbase/7/security/tools/lib/nss/Linux2.6 diff -r 837037533544 -r 3ea0814d3885 jdk/test/sun/security/ssl/javax/net/ssl/SSLContextVersion.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/sun/security/ssl/javax/net/ssl/SSLContextVersion.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 6976117 + * @summary SSLContext.getInstance("TLSv1.1") returns SSLEngines/SSLSockets + * without TLSv1.1 enabled + */ + +import javax.net.ssl.*; + +public class SSLContextVersion { + static enum ContextVersion { + TLS_CV_01("SSL", "TLSv1", "TLSv1.2"), + TLS_CV_02("TLS", "TLSv1", "TLSv1.2"), + TLS_CV_03("SSLv3", "TLSv1", "TLSv1.2"), + TLS_CV_04("TLSv1", "TLSv1", "TLSv1.2"), + TLS_CV_05("TLSv1.1", "TLSv1.1", "TLSv1.2"), + TLS_CV_06("TLSv1.2", "TLSv1.2", "TLSv1.2"), + TLS_CV_07("Default", "TLSv1", "TLSv1.2"); + + final String contextVersion; + final String defaultProtocolVersion; + final String supportedProtocolVersion; + + ContextVersion(String contextVersion, String defaultProtocolVersion, + String supportedProtocolVersion) { + this.contextVersion = contextVersion; + this.defaultProtocolVersion = defaultProtocolVersion; + this.supportedProtocolVersion = supportedProtocolVersion; + } + } + + public static void main(String[] args) throws Exception { + for (ContextVersion cv : ContextVersion.values()) { + System.out.println("Checking SSLContext of " + cv.contextVersion); + SSLContext context = SSLContext.getInstance(cv.contextVersion); + + // Default SSLContext is initialized automatically. + if (!cv.contextVersion.equals("Default")) { + // Use default TK, KM and random. + context.init((KeyManager[])null, (TrustManager[])null, null); + } + + SSLParameters parameters = context.getDefaultSSLParameters(); + + String[] protocols = parameters.getProtocols(); + String[] ciphers = parameters.getCipherSuites(); + + if (protocols.length == 0 || ciphers.length == 0) { + throw new Exception("No default protocols or cipher suites"); + } + + boolean isMatch = false; + for (String protocol : protocols) { + System.out.println("\tdefault protocol version " + protocol); + if (protocol.equals(cv.defaultProtocolVersion)) { + isMatch = true; + break; + } + } + + if (!isMatch) { + throw new Exception("No matched default protocol"); + } + + parameters = context.getSupportedSSLParameters(); + + protocols = parameters.getProtocols(); + ciphers = parameters.getCipherSuites(); + + if (protocols.length == 0 || ciphers.length == 0) { + throw new Exception("No default protocols or cipher suites"); + } + + isMatch = false; + for (String protocol : protocols) { + System.out.println("\tsupported protocol version " + protocol); + if (protocol.equals(cv.supportedProtocolVersion)) { + isMatch = true; + break; + } + } + + if (!isMatch) { + throw new Exception("No matched default protocol"); + } + System.out.println("\t... Success"); + } + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/tools/launcher/ExecutionEnvironment.java --- a/jdk/test/tools/launcher/ExecutionEnvironment.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/tools/launcher/ExecutionEnvironment.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ */ /* - * This test tests for various things as follows: + * This tests for various things as follows: * Ensures that: * 1. uneccessary execs do not occur * 2. the environment is pristine, users environment variable wrt. @@ -84,7 +84,9 @@ static int errors = 0; static int passes = 0; - private static void createTestJar() { + static final String LIBJVM = TestHelper.isWindows ? "jvm.dll" : "libjvm.so"; + + static void createTestJar() { try { List codeList = new ArrayList(); codeList.add("static void printValue(String name, boolean property) {\n"); @@ -127,6 +129,7 @@ testJarFile.getAbsolutePath()); if (!tr.isNotZeroOutput()) { + System.out.println(tr); throw new RuntimeException("Error: No output at all. Did the test execute ?"); } @@ -177,7 +180,6 @@ Map env = new HashMap(); - if (TestHelper.isLinux) { for (String x : LD_PATH_STRINGS) { String pairs[] = x.split("="); @@ -209,7 +211,7 @@ verifyJavaLibraryPathOverride(tr, true); // try changing the model from 32 to 64 bit - if (TestHelper.java64Cmd != null && TestHelper.is32Bit) { + if (TestHelper.dualModePresent() && TestHelper.is32Bit) { // verify the override occurs env.clear(); for (String x : LD_PATH_STRINGS) { @@ -326,7 +328,7 @@ File symLink = null; String libPathPrefix = TestHelper.isSDK ? "jre/lib" : "/lib"; symLink = new File(TestHelper.JAVAHOME, libPathPrefix + - TestHelper.getJreArch() + "/libjvm.so"); + TestHelper.getJreArch() + "/" + LIBJVM); if (symLink.exists()) { System.out.println("FAIL: The symlink exists " + symLink.getAbsolutePath()); diff -r 837037533544 -r 3ea0814d3885 jdk/test/tools/launcher/Test7029048.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/tools/launcher/Test7029048.java Wed Jul 05 17:42:05 2017 +0200 @@ -0,0 +1,313 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7029048 + * @summary Checks for LD_LIBRARY_PATH on *nixes + * @compile -XDignore.symbol.file ExecutionEnvironment.java TestHelper.java Test7029048.java + * @run main Test7029048 + */ + +/* + * 7029048: test for LD_LIBRARY_PATH set to different paths pointing which may + * contain a libjvm.so and may not, but we test to ensure that the launcher + * behaves correctly in all cases. + */ +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class Test7029048 { + + static int passes = 0; + static int errors = 0; + + private static final String LIBJVM = ExecutionEnvironment.LIBJVM; + private static final String LD_LIBRARY_PATH = + ExecutionEnvironment.LD_LIBRARY_PATH; + private static final String LD_LIBRARY_PATH_32 = + ExecutionEnvironment.LD_LIBRARY_PATH_32; + private static final String LD_LIBRARY_PATH_64 = + ExecutionEnvironment.LD_LIBRARY_PATH_64; + + private static final File libDir = + new File(System.getProperty("sun.boot.library.path")); + private static final File srcServerDir = new File(libDir, "server"); + private static final File srcLibjvmSo = new File(srcServerDir, LIBJVM); + + private static final File dstLibDir = new File("lib"); + private static final File dstLibArchDir = + new File(dstLibDir, TestHelper.getJreArch()); + + private static final File dstServerDir = new File(dstLibArchDir, "server"); + private static final File dstServerLibjvm = new File(dstServerDir, LIBJVM); + + private static final File dstClientDir = new File(dstLibArchDir, "client"); + private static final File dstClientLibjvm = new File(dstClientDir, LIBJVM); + + // used primarily to test the solaris variants in dual mode + private static final File dstOtherArchDir; + private static final File dstOtherServerDir; + private static final File dstOtherServerLibjvm; + + private static final Map env = new HashMap<>(); + + static { + if (TestHelper.isDualMode) { + dstOtherArchDir = new File(dstLibDir, TestHelper.getComplementaryJreArch()); + dstOtherServerDir = new File(dstOtherArchDir, "server"); + dstOtherServerLibjvm = new File(dstOtherServerDir, LIBJVM); + } else { + dstOtherArchDir = null; + dstOtherServerDir = null; + dstOtherServerLibjvm = null; + } + } + + static String getValue(String name, List in) { + for (String x : in) { + String[] s = x.split("="); + if (name.equals(s[0].trim())) { + return s[1].trim(); + } + } + return null; + } + + static void run(boolean want32, String dflag, Map env, + int nLLPComponents, String caseID) { + final boolean want64 = want32 == false; + env.put(ExecutionEnvironment.JLDEBUG_KEY, "true"); + List cmdsList = new ArrayList<>(); + + // only for a dual-mode system + if (want64 && TestHelper.isDualMode) { + cmdsList.add(TestHelper.java64Cmd); + } else { + cmdsList.add(TestHelper.javaCmd); // a 32-bit java command for all + } + + /* + * empty or null strings can confuse the ProcessBuilder. A null flag + * indicates that the appropriate data model is enforced on the chosen + * launcher variant. + */ + + if (dflag != null) { + cmdsList.add(dflag); + } else { + cmdsList.add(want32 ? "-d32" : "-d64"); + } + cmdsList.add("-server"); + cmdsList.add("-jar"); + cmdsList.add(ExecutionEnvironment.testJarFile.getAbsolutePath()); + String[] cmds = new String[cmdsList.size()]; + TestHelper.TestResult tr = TestHelper.doExec(env, cmdsList.toArray(cmds)); + analyze(tr, nLLPComponents, caseID); + } + + // no cross launch, ie. no change to the data model. + static void run(Map env, int nLLPComponents, String caseID) + throws IOException { + boolean want32 = TestHelper.is32Bit; + run(want32, null, env, nLLPComponents, caseID); + } + + static void analyze(TestHelper.TestResult tr, int nLLPComponents, String caseID) { + String envValue = getValue(LD_LIBRARY_PATH, tr.testOutput); + /* + * the envValue can never be null, since the test code should always + * print a "null" string. + */ + if (envValue == null) { + System.out.println(tr); + throw new RuntimeException("NPE, likely a program crash ??"); + } + String values[] = envValue.split(File.pathSeparator); + if (values.length == nLLPComponents) { + System.out.println(caseID + " :OK"); + passes++; + } else { + System.out.println("FAIL: test7029048, " + caseID); + System.out.println(" expected " + nLLPComponents + + " but got " + values.length); + System.out.println(envValue); + System.out.println(tr); + errors++; + } + } + + /* + * A crucial piece, specifies what we should expect, given the conditions. + * That is for a given enum type, the value indicates how many absolute + * environment variables that can be expected. This value is used to base + * the actual expected values by adding the set environment variable usually + * it is 1, but it could be more if the test wishes to set more paths in + * the future. + */ + private static enum LLP_VAR { + LLP_SET_NON_EXISTENT_PATH(0), // env set, but the path does not exist + LLP_SET_EMPTY_PATH(0), // env set, with a path but no libjvm.so + LLP_SET_WITH_JVM(3); // env set, with a libjvm.so + private final int value; + LLP_VAR(int i) { + this.value = i; + } + } + + /* + * test for 7029048 + */ + static void test7029048() throws IOException { + String desc = null; + for (LLP_VAR v : LLP_VAR.values()) { + switch (v) { + case LLP_SET_WITH_JVM: + // copy the files into the directory structures + TestHelper.copyFile(srcLibjvmSo, dstServerLibjvm); + // does not matter if it is client or a server + TestHelper.copyFile(srcLibjvmSo, dstClientLibjvm); + // does not matter if the arch do not match either + if (TestHelper.isDualMode) { + TestHelper.copyFile(srcLibjvmSo, dstOtherServerLibjvm); + } + desc = "LD_LIBRARY_PATH should be set"; + break; + case LLP_SET_EMPTY_PATH: + if (!dstClientDir.exists()) { + Files.createDirectories(dstClientDir.toPath()); + } else { + Files.deleteIfExists(dstClientLibjvm.toPath()); + } + + if (!dstServerDir.exists()) { + Files.createDirectories(dstServerDir.toPath()); + } else { + Files.deleteIfExists(dstServerLibjvm.toPath()); + } + + if (TestHelper.isDualMode) { + if (!dstOtherServerDir.exists()) { + Files.createDirectories(dstOtherServerDir.toPath()); + } else { + Files.deleteIfExists(dstOtherServerLibjvm.toPath()); + } + } + + desc = "LD_LIBRARY_PATH should not be set"; + break; + case LLP_SET_NON_EXISTENT_PATH: + if (dstLibDir.exists()) { + TestHelper.recursiveDelete(dstLibDir); + } + desc = "LD_LIBRARY_PATH should not be set"; + break; + default: + throw new RuntimeException("unknown case"); + } + + /* + * Case 1: set the server path + */ + env.clear(); + env.put(LD_LIBRARY_PATH, dstServerDir.getAbsolutePath()); + run(env, v.value + 1, "Case 1: " + desc); + + /* + * Case 2: repeat with client path + */ + env.clear(); + env.put(LD_LIBRARY_PATH, dstClientDir.getAbsolutePath()); + run(env, v.value + 1, "Case 2: " + desc); + + if (!TestHelper.isDualMode) { + continue; // nothing more to do for Linux + } + + // Tests applicable only to solaris. + + // initialize test variables for dual mode operations + final File dst32ServerDir = TestHelper.is32Bit + ? dstServerDir + : dstOtherServerDir; + + final File dst64ServerDir = TestHelper.is64Bit + ? dstServerDir + : dstOtherServerDir; + + /* + * Case 3: set the appropriate LLP_XX flag, + * java32 -d32, LLP_32 is relevant, LLP_64 is ignored + * java64 -d64, LLP_64 is relevant, LLP_32 is ignored + */ + env.clear(); + env.put(LD_LIBRARY_PATH_32, dst32ServerDir.getAbsolutePath()); + env.put(LD_LIBRARY_PATH_64, dst64ServerDir.getAbsolutePath()); + run(TestHelper.is32Bit, null, env, v.value + 1, "Case 3: " + desc); + + /* + * Case 4: we are in dual mode environment, running 64-bit then + * we have the following scenarios: + * java32 -d64, LLP_64 is relevant, LLP_32 is ignored + * java64 -d32, LLP_32 is relevant, LLP_64 is ignored + */ + if (TestHelper.dualModePresent()) { + run(true, "-d64", env, v.value + 1, "Case 4A: " + desc); + run(false,"-d32", env, v.value + 1, "Case 4B: " + desc); + } + } + return; + } + + public static void main(String... args) throws Exception { + if (TestHelper.isWindows) { + System.out.println("Warning: noop on windows"); + return; + } + // create our test jar first + ExecutionEnvironment.createTestJar(); + + // run the tests + test7029048(); + if (errors > 0) { + throw new Exception("Test7029048: FAIL: with " + + errors + " errors and passes " + passes); + } else if (TestHelper.dualModePresent() && passes < 15) { + throw new Exception("Test7029048: FAIL: " + + "all tests did not run, expected " + 15 + " got " + passes); + } else if (TestHelper.isSolaris && passes < 9) { + throw new Exception("Test7029048: FAIL: " + + "all tests did not run, expected " + 9 + " got " + passes); + } else if (TestHelper.isLinux && passes < 6) { + throw new Exception("Test7029048: FAIL: " + + "all tests did not run, expected " + 6 + " got " + passes); + } else { + System.out.println("Test7029048: PASS " + passes); + } + } +} diff -r 837037533544 -r 3ea0814d3885 jdk/test/tools/launcher/TestHelper.java --- a/jdk/test/tools/launcher/TestHelper.java Thu Apr 21 15:32:48 2011 -0700 +++ b/jdk/test/tools/launcher/TestHelper.java Wed Jul 05 17:42:05 2017 +0200 @@ -1,6 +1,5 @@ - /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2011 Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,20 +21,28 @@ * questions. */ +import java.nio.file.attribute.BasicFileAttributes; +import java.nio.file.FileVisitResult; +import java.nio.file.SimpleFileVisitor; import javax.tools.ToolProvider; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; +import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.tools.JavaCompiler; +import static java.nio.file.StandardCopyOption.*; + /** - * This class provides some common utilites for the launcher tests. + * This class provides some common utilities for the launcher tests. */ public enum TestHelper { INSTANCE; @@ -101,6 +108,13 @@ } /* + * is a dual mode available in the test jdk + */ + static boolean dualModePresent() { + return isDualMode && java64Cmd != null; + } + + /* * usually the jre/lib/arch-name is the same as os.arch, except for x86. */ static String getJreArch() { @@ -109,6 +123,27 @@ } /* + * get the complementary jre arch ie. if sparc then return sparcv9 and + * vice-versa. + */ + static String getComplementaryJreArch() { + String arch = System.getProperty("os.arch"); + if (arch != null) { + switch (arch) { + case "sparc": + return "sparcv9"; + case "sparcv9": + return "sparc"; + case "x86": + return "amd64"; + case "amd64": + return "i386"; + } + } + return null; + } + + /* * A convenience method to create a jar with jar file name and defs */ static void createJar(File jarName, String... mainDefs) @@ -168,6 +203,44 @@ } } + static void copyFile(File src, File dst) throws IOException { + Path parent = dst.toPath().getParent(); + if (parent != null) { + Files.createDirectories(parent); + } + Files.copy(src.toPath(), dst.toPath(), COPY_ATTRIBUTES, REPLACE_EXISTING); + } + + static void recursiveDelete(File target) throws IOException { + if (!target.exists()) { + return; + } + Files.walkFileTree(target.toPath(), new SimpleFileVisitor() { + @Override + public FileVisitResult postVisitDirectory(Path dir, IOException exc) { + try { + Files.deleteIfExists(dir); + } catch (IOException ex) { + System.out.println("Error: could not delete: " + dir.toString()); + System.out.println(ex.getMessage()); + return FileVisitResult.TERMINATE; + } + return FileVisitResult.CONTINUE; + } + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { + try { + Files.deleteIfExists(file); + } catch (IOException ex) { + System.out.println("Error: could not delete: " + file.toString()); + System.out.println(ex.getMessage()); + return FileVisitResult.TERMINATE; + } + return FileVisitResult.CONTINUE; + } + }); + } + static TestResult doExec(String...cmds) { return doExec(null, cmds); } @@ -187,7 +260,7 @@ } BufferedReader rdr = null; try { - List outputList = new ArrayList(); + List outputList = new ArrayList<>(); pb.redirectErrorStream(true); Process p = pb.start(); rdr = new BufferedReader(new InputStreamReader(p.getInputStream())); @@ -198,7 +271,9 @@ } p.waitFor(); p.destroy(); - return new TestHelper.TestResult(cmdStr, p.exitValue(), outputList); + + return new TestHelper.TestResult(cmdStr, p.exitValue(), outputList, + env, new Throwable("current stack of the test")); } catch (Exception ex) { ex.printStackTrace(); throw new RuntimeException(ex.getMessage()); @@ -213,11 +288,16 @@ StringBuilder status; int exitValue; List testOutput; + Map env; + Throwable t; - public TestResult(String str, int rv, List oList) { + public TestResult(String str, int rv, List oList, + Map env, Throwable t) { status = new StringBuilder("Executed command: " + str + "\n"); exitValue = rv; testOutput = oList; + this.env = env; + this.t = t; } void appendStatus(String x) { @@ -262,11 +342,21 @@ @Override public String toString() { - status = status.append("++++Test Output Begin++++\n"); + status.append("++++Begin Test Info++++\n"); + status.append("++++Test Environment++++\n"); + for (String x : env.keySet()) { + status.append(x).append("=").append(env.get(x)).append("\n"); + } + status.append("++++Test Output++++\n"); for (String x : testOutput) { appendStatus(x); } - status = status.append("++++Test Output End++++\n"); + status.append("++++Test Stack Trace++++\n"); + status.append(t.toString()); + for (StackTraceElement e : t.getStackTrace()) { + status.append(e.toString()); + } + status.append("++++End of Test Info++++\n"); return status.toString(); }