Merge
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index 6e41d0d..bc8b95c 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -992,3 +992,4 @@
 5f55e79422a0246076db7d3f2a2c44cb36e0e271 jdk8u252-b01
 a013ce3462fc144cc83347be67109c4e4e4b26ff jdk8u252-b02
 9fb3e77d22d6a616c33ae6feac9a847764968bc3 jdk8u252-b03
+6383ac7b39e4d10c1fa6bf174855bc259dd9cb22 jdk8u252-b04
diff --git a/corba/.hgtags b/corba/.hgtags
index 40a0571..716e5f2 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -1065,3 +1065,4 @@
 f718ce62e7c8bf41eb3cbab2a5c0d0af94b7e03b jdk8u252-b01
 c43e6827a131c6b23a367f09146f911cf64251f1 jdk8u252-b02
 e612032f8f28daa0a41df1fd69ca4c94f64280ff jdk8u252-b03
+4eb5558f0f4fc6602ed0d01df95aeae1e77364c6 jdk8u252-b04
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index d9edc7c..54783c7 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -1298,3 +1298,4 @@
 a67e9c6edcdd73cb860a16990f0905e102c282d7 jdk8u252-b01
 5bd3b8c0555292a967ea3b4c39a220d0c2cf40ad jdk8u252-b02
 2e972804450764c9ec3b7e548b07be869948ecca jdk8u252-b03
+ff1c3c1867b502c289c7c08ebc712663ec657f06 jdk8u252-b04
diff --git a/hotspot/make/bsd/makefiles/gcc.make b/hotspot/make/bsd/makefiles/gcc.make
index 9571ad7..5288519 100644
--- a/hotspot/make/bsd/makefiles/gcc.make
+++ b/hotspot/make/bsd/makefiles/gcc.make
@@ -260,14 +260,13 @@
   WARNINGS_ARE_ERRORS += -Wno-empty-body
 endif
 
-WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef
+WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value
 
-ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
+ifeq ($(USE_CLANG),)
   # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
   # conversions which might affect the values. Only enable it in earlier versions.
-  WARNING_FLAGS = -Wunused-function
-  ifeq ($(USE_CLANG),)
-    WARNING_FLAGS += -Wconversion
+  ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
+    WARNINGS_FLAGS += -Wconversion
   endif
 endif
 
diff --git a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp
index b519b34..0bd581a 100644
--- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp
@@ -509,8 +509,13 @@
   if (o == NULL) {
     __ set(NULL_WORD, reg);
   } else {
+#ifdef ASSERT
+    {
+      ThreadInVMfromNative tiv(JavaThread::current());
+      assert(Universe::heap()->is_in_reserved(JNIHandles::resolve(o)), "should be real oop");
+    }
+#endif
     int oop_index = __ oop_recorder()->find_index(o);
-    assert(Universe::heap()->is_in_reserved(JNIHandles::resolve(o)), "should be real oop");
     RelocationHolder rspec = oop_Relocation::spec(oop_index);
     __ set(NULL_WORD, reg, rspec); // Will be set when the nmethod is created
   }
diff --git a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp
index 7f6b1d6..5eacb6b 100644
--- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp
@@ -233,8 +233,8 @@
 }
 
 
-bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, int c, LIR_Opr result, LIR_Opr tmp) {
-  if (tmp->is_valid()) {
+bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, jint c, LIR_Opr result, LIR_Opr tmp) {
+  if (tmp->is_valid() && c > 0 && c < max_jint) {
     if (is_power_of_2(c + 1)) {
       __ move(left, tmp);
       __ shift_left(left, log2_jint(c + 1), left);
@@ -602,8 +602,8 @@
       bool use_constant = false;
       bool use_tmp = false;
       if (right_arg->is_constant()) {
-        int iconst = right_arg->get_jint_constant();
-        if (iconst > 0) {
+        jint iconst = right_arg->get_jint_constant();
+        if (iconst > 0 && iconst < max_jint) {
           if (is_power_of_2(iconst)) {
             use_constant = true;
           } else if (is_power_of_2(iconst - 1) || is_power_of_2(iconst + 1)) {
diff --git a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp
index c2f69f7..2ba2c15 100644
--- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp
@@ -2098,7 +2098,7 @@
   // critical natives they are offset down.
   GrowableArray<int> arg_order(2 * total_in_args);
   VMRegPair tmp_vmreg;
-  tmp_vmreg.set1(rbx->as_VMReg());
+  tmp_vmreg.set2(rbx->as_VMReg());
 
   if (!is_critical_native) {
     for (int i = total_in_args - 1, c_arg = total_c_args - 1; i >= 0; i--, c_arg--) {
diff --git a/hotspot/src/share/vm/adlc/archDesc.cpp b/hotspot/src/share/vm/adlc/archDesc.cpp
index 303106b..f3f5970 100644
--- a/hotspot/src/share/vm/adlc/archDesc.cpp
+++ b/hotspot/src/share/vm/adlc/archDesc.cpp
@@ -43,32 +43,6 @@
   return result;
 }
 
-// Utilities to characterize effect statements
-static bool is_def(int usedef) {
-  switch(usedef) {
-  case Component::DEF:
-  case Component::USE_DEF: return true; break;
-  }
-  return false;
-}
-
-static bool is_use(int usedef) {
-  switch(usedef) {
-  case Component::USE:
-  case Component::USE_DEF:
-  case Component::USE_KILL: return true; break;
-  }
-  return false;
-}
-
-static bool is_kill(int usedef) {
-  switch(usedef) {
-  case Component::KILL:
-  case Component::USE_KILL: return true; break;
-  }
-  return false;
-}
-
 //---------------------------ChainList Methods-------------------------------
 ChainList::ChainList() {
 }
diff --git a/hotspot/src/share/vm/adlc/main.cpp b/hotspot/src/share/vm/adlc/main.cpp
index 9c558a5..0e0ea74 100644
--- a/hotspot/src/share/vm/adlc/main.cpp
+++ b/hotspot/src/share/vm/adlc/main.cpp
@@ -29,7 +29,6 @@
 static void  usage(ArchDesc& AD);          // Print usage message and exit
 static char *strip_ext(char *fname);       // Strip off name extension
 static char *base_plus_suffix(const char* base, const char *suffix);// New concatenated string
-static char *prefix_plus_base_plus_suffix(const char* prefix, const char* base, const char *suffix);// New concatenated string
 static int get_legal_text(FileBuff &fbuf, char **legal_text); // Get pointer to legal text
 
 ArchDesc* globalAD = NULL;      // global reference to Architecture Description object
diff --git a/hotspot/src/share/vm/adlc/output_c.cpp b/hotspot/src/share/vm/adlc/output_c.cpp
index b376663..1991690 100644
--- a/hotspot/src/share/vm/adlc/output_c.cpp
+++ b/hotspot/src/share/vm/adlc/output_c.cpp
@@ -35,23 +35,6 @@
   return false;
 }
 
-static bool is_use(int usedef) {
-  switch(usedef) {
-  case Component::USE:
-  case Component::USE_DEF:
-  case Component::USE_KILL: return true; break;
-  }
-  return false;
-}
-
-static bool is_kill(int usedef) {
-  switch(usedef) {
-  case Component::KILL:
-  case Component::USE_KILL: return true; break;
-  }
-  return false;
-}
-
 // Define  an array containing the machine register names, strings.
 static void defineRegNames(FILE *fp, RegisterForm *registers) {
   if (registers) {
diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
index 21cd08d..fe08157 100644
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
@@ -539,11 +539,11 @@
 
     case Bytecodes::_imul:
       {
-        bool    did_strength_reduce = false;
+        bool did_strength_reduce = false;
 
         if (right->is_constant()) {
-          int c = right->as_jint();
-          if (is_power_of_2(c)) {
+          jint c = right->as_jint();
+          if (c > 0 && is_power_of_2(c)) {
             // do not need tmp here
             __ shift_left(left_op, exact_log2(c), result_op);
             did_strength_reduce = true;
@@ -2334,7 +2334,7 @@
         __ cmp(lir_cond_equal, src_reg, LIR_OprFact::oopConst(NULL));
         __ branch(lir_cond_equal, T_OBJECT, Lcont->label());
       }
-      LIR_Opr src_klass = new_register(T_OBJECT);
+      LIR_Opr src_klass = new_register(T_METADATA);
       if (gen_type_check) {
         // We have determined that offset == referent_offset && src != null.
         // if (src->_klass->_reference_type == REF_NONE) -> continue
@@ -3299,7 +3299,7 @@
 void LIRGenerator::do_ProfileCall(ProfileCall* x) {
   // Need recv in a temporary register so it interferes with the other temporaries
   LIR_Opr recv = LIR_OprFact::illegalOpr;
-  LIR_Opr mdo = new_register(T_OBJECT);
+  LIR_Opr mdo = new_register(T_METADATA);
   // tmp is used to hold the counters on SPARC
   LIR_Opr tmp = new_pointer_register();
 
diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp
index 8312a4b..1a749ea 100644
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp
@@ -308,7 +308,7 @@
   // is_strictfp is only needed for mul and div (and only generates different code on i486)
   void arithmetic_op(Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, bool is_strictfp, LIR_Opr tmp, CodeEmitInfo* info = NULL);
   // machine dependent.  returns true if it emitted code for the multiply
-  bool strength_reduce_multiply(LIR_Opr left, int constant, LIR_Opr result, LIR_Opr tmp);
+  bool strength_reduce_multiply(LIR_Opr left, jint constant, LIR_Opr result, LIR_Opr tmp);
 
   void store_stack_parameter (LIR_Opr opr, ByteSize offset_from_sp_in_bytes);
 
diff --git a/hotspot/src/share/vm/code/debugInfo.cpp b/hotspot/src/share/vm/code/debugInfo.cpp
index 3b01884..f04d93f 100644
--- a/hotspot/src/share/vm/code/debugInfo.cpp
+++ b/hotspot/src/share/vm/code/debugInfo.cpp
@@ -27,6 +27,8 @@
 #include "code/debugInfoRec.hpp"
 #include "code/nmethod.hpp"
 #include "runtime/handles.inline.hpp"
+#include "runtime/interfaceSupport.hpp"
+#include "runtime/thread.hpp"
 
 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
@@ -204,14 +206,24 @@
 // ConstantOopWriteValue
 
 void ConstantOopWriteValue::write_on(DebugInfoWriteStream* stream) {
-  assert(JNIHandles::resolve(value()) == NULL ||
-         Universe::heap()->is_in_reserved(JNIHandles::resolve(value())),
-         "Should be in heap");
+#ifdef ASSERT
+  {
+    // cannot use ThreadInVMfromNative here since in case of JVMCI compiler,
+    // thread is already in VM state.
+    ThreadInVMfromUnknown tiv;
+    assert(JNIHandles::resolve(value()) == NULL ||
+           Universe::heap()->is_in_reserved(JNIHandles::resolve(value())),
+           "Should be in heap");
+ }
+#endif
   stream->write_int(CONSTANT_OOP_CODE);
   stream->write_handle(value());
 }
 
 void ConstantOopWriteValue::print_on(outputStream* st) const {
+  // using ThreadInVMfromUnknown here since in case of JVMCI compiler,
+  // thread is already in VM state.
+  ThreadInVMfromUnknown tiv;
   JNIHandles::resolve(value())->print_value_on(st);
 }
 
diff --git a/hotspot/src/share/vm/opto/type.cpp b/hotspot/src/share/vm/opto/type.cpp
index 1a231df..a57e3a2 100644
--- a/hotspot/src/share/vm/opto/type.cpp
+++ b/hotspot/src/share/vm/opto/type.cpp
@@ -3753,29 +3753,22 @@
   return make(_ptr, const_oop(), _ary, klass(), _klass_is_exact, _offset, instance_id, _speculative, _inline_depth);
 }
 
-//-----------------------------narrow_size_type-------------------------------
-// Local cache for arrayOopDesc::max_array_length(etype),
-// which is kind of slow (and cached elsewhere by other users).
-static jint max_array_length_cache[T_CONFLICT+1];
-static jint max_array_length(BasicType etype) {
-  jint& cache = max_array_length_cache[etype];
-  jint res = cache;
-  if (res == 0) {
-    switch (etype) {
-    case T_NARROWOOP:
+//-----------------------------max_array_length-------------------------------
+// A wrapper around arrayOopDesc::max_array_length(etype) with some input normalization.
+jint TypeAryPtr::max_array_length(BasicType etype) {
+  if (!is_java_primitive(etype) && !is_reference_type(etype)) {
+    if (etype == T_NARROWOOP) {
       etype = T_OBJECT;
-      break;
-    case T_NARROWKLASS:
-    case T_CONFLICT:
-    case T_ILLEGAL:
-    case T_VOID:
-      etype = T_BYTE;           // will produce conservatively high value
+    } else if (etype == T_ILLEGAL) { // bottom[]
+      etype = T_BYTE; // will produce conservatively high value
+    } else {
+      fatal(err_msg("not an element type: %s", type2name(etype)));
     }
-    cache = res = arrayOopDesc::max_array_length(etype);
   }
-  return res;
+  return arrayOopDesc::max_array_length(etype);
 }
 
+//-----------------------------narrow_size_type-------------------------------
 // Narrow the given size type to the index range for the given array base type.
 // Return NULL if the resulting int type becomes empty.
 const TypeInt* TypeAryPtr::narrow_size_type(const TypeInt* size) const {
diff --git a/hotspot/src/share/vm/opto/type.hpp b/hotspot/src/share/vm/opto/type.hpp
index 88e31fa..a935234 100644
--- a/hotspot/src/share/vm/opto/type.hpp
+++ b/hotspot/src/share/vm/opto/type.hpp
@@ -433,7 +433,6 @@
 
 private:
   // support arrays
-  static const BasicType _basic_type[];
   static const Type*        _zero_type[T_CONFLICT+1];
   static const Type* _const_basic_type[T_CONFLICT+1];
 };
@@ -1154,6 +1153,8 @@
   const TypeAryPtr* cast_to_stable(bool stable, int stable_dimension = 1) const;
   int stable_dimension() const;
 
+  static jint max_array_length(BasicType etype) ;
+
   // Convenience common pre-built types.
   static const TypeAryPtr *RANGE;
   static const TypeAryPtr *OOPS;
diff --git a/hotspot/src/share/vm/prims/forte.cpp b/hotspot/src/share/vm/prims/forte.cpp
index 586ae6f..7b0ce63 100644
--- a/hotspot/src/share/vm/prims/forte.cpp
+++ b/hotspot/src/share/vm/prims/forte.cpp
@@ -625,7 +625,7 @@
 #ifdef __APPLE__
 // XXXDARWIN: Link errors occur even when __attribute__((weak_import))
 // is added
-#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) (0)
+#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) ((void) 0)
 #else
 void    collector_func_load(char* name,
                             void* null_argument_1,
diff --git a/hotspot/src/share/vm/prims/jni.cpp b/hotspot/src/share/vm/prims/jni.cpp
index 0a90827..1d1e6cc 100644
--- a/hotspot/src/share/vm/prims/jni.cpp
+++ b/hotspot/src/share/vm/prims/jni.cpp
@@ -5101,6 +5101,7 @@
 void TestNewSize_test();
 void TestKlass_test();
 void Test_linked_list();
+void TestResourcehash_test();
 void TestChunkedList_test();
 #if INCLUDE_ALL_GCS
 void TestOldFreeSpaceCalculation_test();
@@ -5133,6 +5134,7 @@
     run_unit_test(test_snprintf());
     run_unit_test(TestNewSize_test());
     run_unit_test(TestKlass_test());
+    run_unit_test(TestResourcehash_test());
     run_unit_test(Test_linked_list());
     run_unit_test(TestChunkedList_test());
     run_unit_test(ObjectMonitor::sanity_checks());
diff --git a/hotspot/src/share/vm/runtime/java.cpp b/hotspot/src/share/vm/runtime/java.cpp
index 721f743..9b49d51 100644
--- a/hotspot/src/share/vm/runtime/java.cpp
+++ b/hotspot/src/share/vm/runtime/java.cpp
@@ -335,7 +335,7 @@
     klassVtable::print_statistics();
     klassItable::print_statistics();
   }
-  if (VerifyOops) {
+  if (VerifyOops && Verbose) {
     tty->print_cr("+VerifyOops count: %d", StubRoutines::verify_oop_count());
   }
 
diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp
index 2659418..792888a 100644
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp
@@ -644,6 +644,10 @@
   return (t == T_BYTE || t == T_SHORT);
 }
 
+inline bool is_reference_type(BasicType t) {
+  return (t == T_OBJECT || t == T_ARRAY);
+}
+
 // Convert a char from a classfile signature to a BasicType
 inline BasicType char2type(char c) {
   switch( c ) {
diff --git a/hotspot/src/share/vm/utilities/resourceHash.cpp b/hotspot/src/share/vm/utilities/resourceHash.cpp
new file mode 100644
index 0000000..36088ac
--- /dev/null
+++ b/hotspot/src/share/vm/utilities/resourceHash.cpp
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "memory/allocation.hpp"
+#include "memory/resourceArea.hpp"
+#include "utilities/debug.hpp"
+#include "utilities/resourceHash.hpp"
+
+#ifndef PRODUCT
+
+/////////////// Unit tests ///////////////
+
+class TestResourceHashtable : public AllStatic {
+  typedef void* K;
+  typedef int V;
+
+  static unsigned identity_hash(const K& k) {
+    return (unsigned)(uintptr_t)k;
+  }
+
+  static unsigned bad_hash(const K& k) {
+    return 1;
+  }
+
+  class EqualityTestIter {
+   public:
+    bool do_entry(K const& k, V const& v) {
+      assert((uintptr_t)k == (uintptr_t)v, "");
+      return true; // continue iteration
+    }
+  };
+
+  template<
+  unsigned (*HASH)  (K const&)           = primitive_hash<K>,
+  bool     (*EQUALS)(K const&, K const&) = primitive_equals<K>,
+  unsigned SIZE = 256,
+  ResourceObj::allocation_type ALLOC_TYPE = ResourceObj::RESOURCE_AREA,
+  MEMFLAGS MEM_TYPE = mtInternal
+  >
+  class Runner : public AllStatic {
+    static void* as_K(uintptr_t val) { return (void*)val; }
+
+   public:
+    static void test_small() {
+      EqualityTestIter et;
+      ResourceHashtable<K, V, HASH, EQUALS, SIZE, ALLOC_TYPE, MEM_TYPE> rh;
+
+      assert(!rh.contains(as_K(0x1)), "");
+
+      assert(rh.put(as_K(0x1), 0x1), "");
+      assert(rh.contains(as_K(0x1)), "");
+
+      assert(!rh.put(as_K(0x1), 0x1), "");
+
+      assert(rh.put(as_K(0x2), 0x2), "");
+      assert(rh.put(as_K(0x3), 0x3), "");
+      assert(rh.put(as_K(0x4), 0x4), "");
+      assert(rh.put(as_K(0x5), 0x5), "");
+
+      assert(!rh.remove(as_K(0x0)), "");
+      rh.iterate(&et);
+
+      assert(rh.remove(as_K(0x1)), "");
+      rh.iterate(&et);
+
+    }
+
+    // We use keys with the low bits cleared since the default hash will do some shifting
+    static void test_small_shifted() {
+      EqualityTestIter et;
+      ResourceHashtable<K, V, HASH, EQUALS, SIZE, ALLOC_TYPE, MEM_TYPE> rh;
+
+      assert(!rh.contains(as_K(0x10)), "");
+
+      assert(rh.put(as_K(0x10), 0x10), "");
+      assert(rh.contains(as_K(0x10)), "");
+
+      assert(!rh.put(as_K(0x10), 0x10), "");
+
+      assert(rh.put(as_K(0x20), 0x20), "");
+      assert(rh.put(as_K(0x30), 0x30), "");
+      assert(rh.put(as_K(0x40), 0x40), "");
+      assert(rh.put(as_K(0x50), 0x50), "");
+
+      assert(!rh.remove(as_K(0x00)), "");
+
+      assert(rh.remove(as_K(0x10)), "");
+
+      rh.iterate(&et);
+    }
+
+    static void test(unsigned num_elements = SIZE) {
+      EqualityTestIter et;
+      ResourceHashtable<K, V, HASH, EQUALS, SIZE, ALLOC_TYPE, MEM_TYPE> rh;
+
+      for (uintptr_t i = 0; i < num_elements; ++i) {
+        assert(rh.put(as_K(i), i), "");
+      }
+
+      rh.iterate(&et);
+
+      for (uintptr_t i = num_elements; i > 0; --i) {
+        uintptr_t index = i - 1;
+        assert(rh.remove(as_K(index)), "");
+      }
+      rh.iterate(&et);
+      for (uintptr_t i = num_elements; i > 0; --i) {
+        uintptr_t index = i - 1;
+        assert(!rh.remove(as_K(index)), "");
+      }
+      rh.iterate(&et);
+    }
+  };
+
+ public:
+  static void run_tests() {
+    {
+      ResourceMark rm;
+      Runner<>::test_small();
+      Runner<>::test_small_shifted();
+      Runner<>::test();
+    }
+
+    {
+      ResourceMark rm;
+      Runner<identity_hash>::test_small();
+      Runner<identity_hash>::test_small_shifted();
+      Runner<identity_hash>::test();
+    }
+
+    {
+      ResourceMark rm;
+      Runner<bad_hash>::test_small();
+      Runner<bad_hash>::test_small_shifted();
+      Runner<bad_hash>::test();
+    }
+
+
+    assert(Thread::current()->resource_area()->nesting() == 0, "this code depends on not having an active ResourceMark");
+    // The following test calls will cause an assert if resource allocations occur since we don't have an active mark
+    Runner<primitive_hash<K>, primitive_equals<K>, 512, ResourceObj::C_HEAP>::test_small();
+    Runner<primitive_hash<K>, primitive_equals<K>, 512, ResourceObj::C_HEAP>::test_small_shifted();
+    Runner<primitive_hash<K>, primitive_equals<K>, 512, ResourceObj::C_HEAP>::test();
+
+    Runner<bad_hash, primitive_equals<K>, 512, ResourceObj::C_HEAP>::test_small();
+    Runner<bad_hash, primitive_equals<K>, 512, ResourceObj::C_HEAP>::test_small_shifted();
+    Runner<bad_hash, primitive_equals<K>, 512, ResourceObj::C_HEAP>::test();
+
+    Runner<identity_hash, primitive_equals<K>, 1, ResourceObj::C_HEAP>::test_small();
+    Runner<identity_hash, primitive_equals<K>, 1, ResourceObj::C_HEAP>::test_small_shifted();
+    Runner<identity_hash, primitive_equals<K>, 1, ResourceObj::C_HEAP>::test(512);
+  }
+};
+
+void TestResourcehash_test() {
+  TestResourceHashtable::run_tests();
+}
+
+#endif // not PRODUCT
+
diff --git a/hotspot/src/share/vm/utilities/resourceHash.hpp b/hotspot/src/share/vm/utilities/resourceHash.hpp
index 2fe5dec..82c1219 100644
--- a/hotspot/src/share/vm/utilities/resourceHash.hpp
+++ b/hotspot/src/share/vm/utilities/resourceHash.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015 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 @@
 
 template<typename K> unsigned primitive_hash(const K& k) {
   unsigned hash = (unsigned)((uintptr_t)k);
-  return hash ^ (hash > 3); // just in case we're dealing with aligned ptrs
+  return hash ^ (hash >> 3); // just in case we're dealing with aligned ptrs
 }
 
 template<typename K> bool primitive_equals(const K& k0, const K& k1) {
@@ -50,7 +50,9 @@
     //typename ResourceHashtableFns<K>::equals_fn EQUALS = primitive_equals<K>,
     unsigned (*HASH)  (K const&)           = primitive_hash<K>,
     bool     (*EQUALS)(K const&, K const&) = primitive_equals<K>,
-    unsigned SIZE = 256
+    unsigned SIZE = 256,
+    ResourceObj::allocation_type ALLOC_TYPE = ResourceObj::RESOURCE_AREA,
+    MEMFLAGS MEM_TYPE = mtInternal
     >
 class ResourceHashtable : public ResourceObj {
  private:
@@ -91,6 +93,21 @@
  public:
   ResourceHashtable() { memset(_table, 0, SIZE * sizeof(Node*)); }
 
+  ~ResourceHashtable() {
+    if (ALLOC_TYPE == C_HEAP) {
+      Node* const* bucket = _table;
+      while (bucket < &_table[SIZE]) {
+        Node* node = *bucket;
+        while (node != NULL) {
+          Node* cur = node;
+          node = node->_next;
+          delete cur;
+        }
+        ++bucket;
+      }
+    }
+  }
+
   bool contains(K const& key) const {
     return get(key) != NULL;
   }
@@ -105,17 +122,38 @@
     }
   }
 
-  // Inserts or replaces a value in the table
-  void put(K const& key, V const& value) {
+ /**
+  * Inserts or replaces a value in the table.
+  * @return: true:  if a new item is added
+  *          false: if the item already existed and the value is updated
+  */
+  bool put(K const& key, V const& value) {
     unsigned hv = HASH(key);
     Node** ptr = lookup_node(hv, key);
     if (*ptr != NULL) {
       (*ptr)->_value = value;
+      return false;
     } else {
-      *ptr = new Node(hv, key, value);
+      *ptr = new (ALLOC_TYPE, MEM_TYPE) Node(hv, key, value);
+      return true;
     }
   }
 
+  bool remove(K const& key) {
+    unsigned hv = HASH(key);
+    Node** ptr = lookup_node(hv, key);
+
+    Node* node = *ptr;
+    if (node != NULL) {
+      *ptr = node->_next;
+      if (ALLOC_TYPE == C_HEAP) {
+        delete node;
+      }
+      return true;
+    }
+    return false;
+  }
+
   // ITER contains bool do_entry(K const&, V const&), which will be
   // called for each entry in the table.  If do_entry() returns false,
   // the iteration is cancelled.
@@ -132,6 +170,10 @@
       ++bucket;
     }
   }
+
+  static size_t node_size() {
+    return sizeof(Node);
+  }
 };
 
 
diff --git a/hotspot/test/compiler/c1/MultiplyByMaxInt.java b/hotspot/test/compiler/c1/MultiplyByMaxInt.java
new file mode 100644
index 0000000..f03c2dc
--- /dev/null
+++ b/hotspot/test/compiler/c1/MultiplyByMaxInt.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, 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 8181872
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions
+ *                   -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,compiler.c1.MultiplyByMaxInt::test
+ *                   compiler.c1.MultiplyByMaxInt
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-BackgroundCompilation
+ *                   -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=3
+ *                   -XX:CompileCommand=dontinline,compiler.c1.MultiplyByMaxInt::test
+ *                   compiler.c1.MultiplyByMaxInt
+ */
+package compiler.c1;
+
+public class MultiplyByMaxInt {
+    static int test(int x) {
+        int loops = (x >>> 4) & 7;
+        while (loops-- > 0) {
+            x = (x * 2147483647) % 16807;
+        }
+        return x;
+    }
+
+    public static void main(String[] args) {
+        for (int i = 0; i < 20000; i++) {
+            test(i);
+        }
+    }
+}
diff --git a/hotspot/test/compiler/criticalnatives/argumentcorruption/CheckLongArgs.java b/hotspot/test/compiler/criticalnatives/argumentcorruption/CheckLongArgs.java
new file mode 100644
index 0000000..23ba96e
--- /dev/null
+++ b/hotspot/test/compiler/criticalnatives/argumentcorruption/CheckLongArgs.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017, 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.
+ */
+
+public class CheckLongArgs {
+    static {
+        System.loadLibrary("CNCheckLongArgs");
+    }
+    static native void m1(long a1, long a2, long a3, long a4,  long a5, long a6, long a7, long a8, byte[] result);
+    static native void m2(long a1, int[] a2, long a3, int[] a4, long a5, int[] a6, long a7, int[] a8, long a9, byte[] result);
+    public static void main(String args[]) throws Exception {
+        test();
+    }
+    private static void test() throws Exception {
+        int[] l1 = { 1111, 2222, 3333 };
+        int[] l2 = { 4444, 5555, 6666 };
+        int[] l3 = { 7777, 8888, 9999 };
+        int[] l4 = { 1010, 2020, 3030 };
+        byte[] result = { -1 };
+        m1(1111111122222222L, 3333333344444444L, 5555555566666666L, 7777777788888888L, 9999999900000000L, 1212121234343434L,
+           5656565678787878L, 9090909012121212L, result);
+        check(result[0]);
+        result[0] = -1;
+        m2(1111111122222222L, l1, 3333333344444444L, l2, 5555555566666666L, l3, 7777777788888888L, l4, 9999999900000000L, result);
+        check(result[0]);
+    }
+    private static void check(byte result) throws Exception {
+        if (result != 2) {
+            if (result == 1) {
+              throw new Exception("critical native arguments mismatch");
+            }
+            throw new Exception("critical native lookup failed");
+        }
+    }
+}
diff --git a/hotspot/test/compiler/criticalnatives/argumentcorruption/Test8167409.sh b/hotspot/test/compiler/criticalnatives/argumentcorruption/Test8167409.sh
new file mode 100644
index 0000000..81695e7
--- /dev/null
+++ b/hotspot/test/compiler/criticalnatives/argumentcorruption/Test8167409.sh
@@ -0,0 +1,83 @@
+#!/bin/sh
+
+#
+#  Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
+#  Copyright (c) 2019 Huawei Technologies Co. LTD.  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 Test8167409.sh
+## @bug 8167409
+## @summary Invalid value passed to critical JNI function
+## @run shell Test8167409.sh
+
+if [ "${TESTSRC}" = "" ]
+then
+  TESTSRC=${PWD}
+  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
+fi
+echo "TESTSRC=${TESTSRC}"
+## Adding common setup Variables for running shell tests.
+. ${TESTSRC}/../../../test_env.sh
+
+# set platform-dependent variables
+OS=`uname -s`
+echo "Testing on " $OS
+case "$OS" in
+  Linux)
+    cc_cmd=`which gcc`
+    if [ "x$cc_cmd" == "x" ]; then
+        echo "WARNING: gcc not found. Cannot execute test." 2>&1
+        exit 0;
+    fi
+    ;;
+  Solaris)
+    cc_cmd=`which cc`
+    if [ "x$cc_cmd" == "x" ]; then
+        echo "WARNING: cc not found. Cannot execute test." 2>&1
+        exit 0;
+    fi
+    ;;
+  *)
+    echo "Test passed; only valid for Linux and Solaris"
+    exit 0;
+    ;;
+esac
+
+THIS_DIR=.
+
+cp ${TESTSRC}${FS}*.java ${THIS_DIR}
+${TESTJAVA}${FS}bin${FS}javac *.java
+
+$cc_cmd -fPIC -shared -o libCNCheckLongArgs.so \
+    -I${TESTJAVA}${FS}include -I${TESTJAVA}${FS}include${FS}linux \
+    ${TESTSRC}${FS}libCNCheckLongArgs.c
+
+LD_LIBRARY_PATH=${THIS_DIR}
+echo   LD_LIBRARY_PATH = ${LD_LIBRARY_PATH}
+export LD_LIBRARY_PATH
+
+echo
+echo ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} -Xcomp -XX:+CriticalJNINatives CheckLongArgs
+${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} -Xcomp -XX:+CriticalJNINatives CheckLongArgs
+JAVA_RETVAL=$?
+
+exit $JAVA_RETVAL
diff --git a/hotspot/test/compiler/criticalnatives/argumentcorruption/libCNCheckLongArgs.c b/hotspot/test/compiler/criticalnatives/argumentcorruption/libCNCheckLongArgs.c
new file mode 100644
index 0000000..33ec5b4
--- /dev/null
+++ b/hotspot/test/compiler/criticalnatives/argumentcorruption/libCNCheckLongArgs.c
@@ -0,0 +1,30 @@
+#include "jni.h"
+JNIEXPORT void JNICALL JavaCritical_CheckLongArgs_m1
+  (jlong a1, jlong a2, jlong a3, jlong a4, jlong a5, jlong a6, jlong a7, jlong a8,jint result_length,jbyte* result) {
+
+  if (a1 != 1111111122222222LL || a2 != 3333333344444444LL || a3 != 5555555566666666LL || a4 != 7777777788888888LL ||
+      a5 != 9999999900000000LL || a6 != 1212121234343434LL || a7 != 5656565678787878LL || a8 != 9090909012121212LL ||
+      result_length != 1 || result[0] != -1) {
+    result[0] = 1;
+  } else {
+    result[0] = 2;
+  }
+}
+
+JNIEXPORT void JNICALL JavaCritical_CheckLongArgs_m2
+  (jlong a1, jint a2_length, jint* a2, jlong a3, jint a4_length, jint* a4, jlong a5, jint a6_length, jint* a6, jlong a7,
+   jint a8_length, jint* a8, jlong a9, jint result_length, jbyte* result) {
+  if (a1 != 1111111122222222LL || a2_length != 3 || a2[0] != 1111 || a3 != 3333333344444444LL || a4_length != 3 || a4[0] != 4444 ||
+      a5 != 5555555566666666LL || a6_length != 3 || a6[0] != 7777 || a7 != 7777777788888888LL || a8_length != 3 || a8[0] != 1010 || a9 != 9999999900000000LL ||
+      result_length != 1 || result[0] != -1) {
+    result[0] = 1;
+  } else {
+    result[0] = 2;
+  }
+}
+
+JNIEXPORT void JNICALL Java_CheckLongArgs_m1
+  (JNIEnv * env, jclass jclazz, jlong a3, jlong a4, jlong a5, jlong a6, jlong a7, jlong a8, jlong a9, jlong a10, jbyteArray result) {}
+
+JNIEXPORT void JNICALL Java_CheckLongArgs_m2
+  (JNIEnv * env, jclass jclazz, jlong a3, jintArray a4, jlong a5, jintArray a6, jlong a7, jintArray a8, jlong a9, jintArray a10, jlong a11, jbyteArray result) {}
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index 78e6385..e7dacba 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -1029,3 +1029,4 @@
 c74e6ad60110a7d95568c96e1d375007531a2d3e jdk8u252-b01
 a8a94522990d0ccd5525ffbf12e9ca0074a9ae95 jdk8u252-b02
 3caad4f1dcbc4aa5265a8ac7d494fc685d1d86c6 jdk8u252-b03
+d71d04eabe6424cb001f59c7448535ce9a8a5d86 jdk8u252-b04
diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index 69d0876..cc438a3 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -1023,3 +1023,4 @@
 2c358ca051cb42b7b3326ad8e1375bb944208d1b jdk8u252-b01
 21725ddbd615ab02accd2d968ea556b239af8fd0 jdk8u252-b02
 08cb9430f84f4fea71345a3be9408542d410f0da jdk8u252-b03
+966e128812aff4c0a4aa4aed7e0ec61dbb8c7953 jdk8u252-b04
diff --git a/jdk/.hgtags b/jdk/.hgtags
index 7eccea3..c582ea9 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -1024,3 +1024,4 @@
 4dd113d7811ea6651c1c96f9c641b8bec8e31669 jdk8u252-b01
 8d39522b0f7573e69260eb3f7af360b72b27dfc3 jdk8u252-b02
 9099e882f08e33e091ff14239461047fc8ab787f jdk8u252-b03
+b67f77679d02d6634666578983103ce5d16a3a9b jdk8u252-b04
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/BlowfishCipher.java b/jdk/src/share/classes/com/sun/crypto/provider/BlowfishCipher.java
index d0341b0..e991108 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/BlowfishCipher.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/BlowfishCipher.java
@@ -82,7 +82,7 @@
     /**
      * Sets the padding mechanism of this cipher.
      *
-     * @param padding the padding mechanism
+     * @param paddingScheme the padding mechanism
      *
      * @exception NoSuchPaddingException if the requested padding mechanism
      * does not exist
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/DESCipher.java b/jdk/src/share/classes/com/sun/crypto/provider/DESCipher.java
index 2fff5b7..742ee95 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/DESCipher.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/DESCipher.java
@@ -77,7 +77,7 @@
     /**
      * Sets the padding mechanism of this cipher.
      *
-     * @param padding the padding mechanism
+     * @param paddingScheme the padding mechanism
      *
      * @exception NoSuchPaddingException if the requested padding mechanism
      * does not exist
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/DESedeCipher.java b/jdk/src/share/classes/com/sun/crypto/provider/DESedeCipher.java
index 135ed24..1ab81c4 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/DESedeCipher.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/DESedeCipher.java
@@ -74,7 +74,7 @@
     /**
      * Sets the padding mechanism of this cipher.
      *
-     * @param padding the padding mechanism
+     * @param paddingScheme the padding mechanism
      *
      * @exception NoSuchPaddingException if the requested padding mechanism
      * does not exist
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/DESedeWrapCipher.java b/jdk/src/share/classes/com/sun/crypto/provider/DESedeWrapCipher.java
index 9468565..8c1a5a3 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/DESedeWrapCipher.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/DESedeWrapCipher.java
@@ -32,7 +32,7 @@
 
 /**
  * This class implements the CMS DESede KeyWrap algorithm as defined
- * in <a href=http://www.w3.org/TR/xmlenc-core/#sec-Alg-SymmetricKeyWrap>
+ * in <a href=http://www.w3.org/TR/xmlenc-core/#sec-Alg-SymmetricKeyWrap></a>
  * "XML Encryption Syntax and Processing" section 5.6.2
  * "CMS Triple DES Key Wrap".
  * Note: only <code>CBC</code> mode and <code>NoPadding</code> padding
@@ -159,9 +159,8 @@
     /**
      * Initializes this cipher with a key and a source of randomness.
      *
-     * <p>The cipher only supports the following two operation modes:<b>
-     * Cipher.WRAP_MODE, and <b>
-     * Cipher.UNWRAP_MODE.
+     * <p>The cipher only supports the following two operation modes:
+     * {@code Cipher.WRAP_MODE}, and {@code Cipher.UNWRAP_MODE}.
      * <p>For modes other than the above two, UnsupportedOperationException
      * will be thrown.
      * <p>If this cipher requires an initialization vector (IV), it will get
@@ -192,9 +191,8 @@
      * Initializes this cipher with a key, a set of algorithm parameters,
      * and a source of randomness.
      *
-     * <p>The cipher only supports the following two operation modes:<b>
-     * Cipher.WRAP_MODE, and <b>
-     * Cipher.UNWRAP_MODE.
+     * <p>The cipher only supports the following two operation modes:
+     * {@code Cipher.WRAP_MODE}, and {@code Cipher.UNWRAP_MODE}.
      * <p>For modes other than the above two, UnsupportedOperationException
      * will be thrown.
      * <p>If this cipher requires an initialization vector (IV), it will get
@@ -252,9 +250,8 @@
      * Initializes this cipher with a key, a set of algorithm parameters,
      * and a source of randomness.
      *
-     * <p>The cipher only supports the following two operation modes:<b>
-     * Cipher.WRAP_MODE, and <b>
-     * Cipher.UNWRAP_MODE.
+     * <p>The cipher only supports the following two operation modes:
+     * {@code Cipher.WRAP_MODE}, and {@code Cipher.UNWRAP_MODE}.
      * <p>For modes other than the above two, UnsupportedOperationException
      * will be thrown.
      * <p>If this cipher requires an initialization vector (IV), it will get
@@ -360,15 +357,15 @@
      * current Cipher.engineInit(...) implementation,
      * IllegalStateException will always be thrown upon invocation.
      *
-     * @param in the input buffer.
-     * @param inOffset the offset in <code>in</code> where the input
+     * @param input the input buffer.
+     * @param inputOffset the offset in {@code input} where the input
      * starts.
-     * @param inLen the input length.
-     * @param out the buffer for the result.
-     * @param outOffset the ofset in <code>out</code> where the result
+     * @param inputLen the input length.
+     * @param output the buffer for the result.
+     * @param outputOffset the ofset in {@code output} where the result
      * is stored.
      *
-     * @return the number of bytes stored in <code>out</code>.
+     * @return the number of bytes stored in {@code out}.
      *
      * @exception IllegalStateException upon invocation of this method.
      */
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java b/jdk/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java
index 09b132e..f9290b3 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java
@@ -118,7 +118,7 @@
      * generator, and optionally the requested size in bits of the random
      * exponent (private value).
      *
-     * @param params the parameter set used to generate the key pair
+     * @param algParams the parameter set used to generate the key pair
      * @param random the source of randomness
      *
      * @exception InvalidAlgorithmParameterException if the given parameters
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java b/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java
index edfa89e..d921b6d 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java
@@ -92,7 +92,7 @@
      * generation values, which specify the size of the prime modulus and
      * the size of the random exponent, both in bits.
      *
-     * @param params the set of parameter generation values
+     * @param genParamSpec the set of parameter generation values
      * @param random the source of randomness
      *
      * @exception InvalidAlgorithmParameterException if the given parameter
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java b/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java
index b19f7b3..e5756d4 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java
@@ -80,7 +80,7 @@
      * Sets the padding mechanism of this cipher. This algorithm only uses
      * PKCS #5 padding.
      *
-     * @param padding the padding mechanism
+     * @param paddingScheme the padding mechanism
      *
      * @exception NoSuchPaddingException if the requested padding mechanism
      * is invalid
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java b/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java
index 7119233..f2712b6 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java
@@ -92,7 +92,7 @@
      * Sets the padding mechanism of this cipher. This algorithm only uses
      * PKCS #5 padding.
      *
-     * @param padding the padding mechanism
+     * @param paddingScheme the padding mechanism
      *
      * @exception NoSuchPaddingException if the requested padding mechanism
      * is invalid
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/PBKDF2HmacSHA1Factory.java b/jdk/src/share/classes/com/sun/crypto/provider/PBKDF2HmacSHA1Factory.java
index ae49c79..e786d53 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/PBKDF2HmacSHA1Factory.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/PBKDF2HmacSHA1Factory.java
@@ -75,7 +75,7 @@
      *
      * @param key the key
      *
-     * @param keySpec the requested format in which the key material shall be
+     * @param keySpecCl the requested format in which the key material shall be
      * returned
      *
      * @return the underlying key specification (key material) in the
diff --git a/jdk/src/share/classes/com/sun/security/sasl/digest/FactoryImpl.java b/jdk/src/share/classes/com/sun/security/sasl/digest/FactoryImpl.java
index 39ec03d..5e6a76e 100644
--- a/jdk/src/share/classes/com/sun/security/sasl/digest/FactoryImpl.java
+++ b/jdk/src/share/classes/com/sun/security/sasl/digest/FactoryImpl.java
@@ -60,7 +60,7 @@
      *
      * @throws SaslException If there is an error creating the DigestMD5
      * SASL client.
-     * @returns a new SaslClient ; otherwise null if unsuccessful.
+     * @return a new SaslClient; otherwise null if unsuccessful.
      */
     public SaslClient createSaslClient(String[] mechs,
          String authorizationId, String protocol, String serverName,
@@ -90,7 +90,7 @@
      *
      * @throws SaslException If there is an error creating the DigestMD5
      * SASL server.
-     * @returns a new SaslServer ; otherwise null if unsuccessful.
+     * @return a new SaslServer; otherwise null if unsuccessful.
      */
     public SaslServer createSaslServer(String mech,
          String protocol, String serverName, Map<String,?> props, CallbackHandler cbh)
@@ -114,7 +114,7 @@
     /**
       * Returns the authentication mechanisms that this factory can produce.
       *
-      * @returns String[] {"DigestMD5"} if policies in env match those of this
+      * @return String[] {"DigestMD5"} if policies in env match those of this
       * factory.
       */
     public String[] getMechanismNames(Map<String,?> env) {
diff --git a/jdk/src/share/classes/com/sun/security/sasl/ntlm/FactoryImpl.java b/jdk/src/share/classes/com/sun/security/sasl/ntlm/FactoryImpl.java
index e7a3097..fff919a 100644
--- a/jdk/src/share/classes/com/sun/security/sasl/ntlm/FactoryImpl.java
+++ b/jdk/src/share/classes/com/sun/security/sasl/ntlm/FactoryImpl.java
@@ -57,7 +57,7 @@
     /**
      * Returns a new instance of the NTLM SASL client mechanism.
      * Argument checks are performed in SaslClient's constructor.
-     * @returns a new SaslClient ; otherwise null if unsuccessful.
+     * @return a new SaslClient; otherwise null if unsuccessful.
      * @throws SaslException If there is an error creating the NTLM
      * SASL client.
      */
@@ -86,7 +86,7 @@
     /**
      * Returns a new instance of the NTLM SASL server mechanism.
      * Argument checks are performed in SaslServer's constructor.
-     * @returns a new SaslServer ; otherwise null if unsuccessful.
+     * @return a new SaslServer; otherwise null if unsuccessful.
      * @throws SaslException If there is an error creating the NTLM
      * SASL server.
      */
@@ -116,7 +116,7 @@
     /**
       * Returns the authentication mechanisms that this factory can produce.
       *
-      * @returns String[] {"NTLM"} if policies in env match those of this
+      * @return String[] {"NTLM"} if policies in env match those of this
       * factory.
       */
     public String[] getMechanismNames(Map<String,?> env) {
diff --git a/jdk/src/share/classes/java/io/BufferedReader.java b/jdk/src/share/classes/java/io/BufferedReader.java
index ee9f66a..16b82e0 100644
--- a/jdk/src/share/classes/java/io/BufferedReader.java
+++ b/jdk/src/share/classes/java/io/BufferedReader.java
@@ -310,7 +310,7 @@
      * @exception  IOException  If an I/O error occurs
      */
     String readLine(boolean ignoreLF) throws IOException {
-        StringBuffer s = null;
+        StringBuilder s = null;
         int startChar;
 
         synchronized (lock) {
@@ -366,7 +366,7 @@
                 }
 
                 if (s == null)
-                    s = new StringBuffer(defaultExpectedLineLength);
+                    s = new StringBuilder(defaultExpectedLineLength);
                 s.append(cb, startChar, i - startChar);
             }
         }
diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCryptoBinary.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCryptoBinary.java
index b3b7c31..c540648 100644
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCryptoBinary.java
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCryptoBinary.java
@@ -41,12 +41,12 @@
  * as defined in the W3C specification for XML-Signature Syntax and Processing.
  * The XML Schema Definition is defined as:
  *
- * <xmp>
+ * <pre>{@code
  * <simpleType name="CryptoBinary">
  *   <restriction base = "base64Binary">
  *   </restriction>
  * </simpleType>
- * </xmp>
+ * }</pre>
  *
  * @author Sean Mullan
  */
diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java
index 08aee02..63d514e 100644
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java
@@ -326,32 +326,54 @@
         private KeyFactory eckf;
         private ECParameterSpec ecParams;
 
-        // The supported curve, secp256r1
-        private static final Curve SECP256R1;
-        static {
-            final String name, oid, sfield, a, b, x, y, n;
-            name = "secp256r1 [NIST P-256, X9.62 prime256v1]";
-            oid  = "1.2.840.10045.3.1.7";
-            sfield =
-             "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF";
-            a =
-             "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC";
-            b =
-             "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B";
-            x =
-             "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296";
-            y =
-             "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5";
-            n =
-             "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551";
-            final int h = 1;
+        /* Supported curve, secp256r1 */
+        private static final Curve SECP256R1 = initializeCurve(
+            "secp256r1 [NIST P-256, X9.62 prime256v1]",
+            "1.2.840.10045.3.1.7",
+            "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF",
+            "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC",
+            "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B",
+            "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296",
+            "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",
+            "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551",
+            1
+        );
 
+        /* Supported curve secp384r1 */
+        private static final Curve SECP384R1 = initializeCurve(
+            "secp384r1 [NIST P-384]",
+            "1.3.132.0.34",
+            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF",
+            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC",
+            "B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF",
+            "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7",
+            "3617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A147CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F",
+            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973",
+            1
+        );
+
+        /* Supported curve secp521r1 */
+        private static final Curve SECP521R1 = initializeCurve(
+            "secp521r1 [NIST P-521]",
+            "1.3.132.0.35",
+            "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
+            "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC",
+            "0051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00",
+            "00C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66",
+            "011839296A789A3BC0045C8A5FB42C7D1BD998F54449579B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C7086A272C24088BE94769FD16650",
+            "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409",
+            1
+        );
+
+        private static Curve initializeCurve(String name, String oid,
+                String sfield, String a, String b,
+                String x, String y, String n, int h) {
             BigInteger p = bigInt(sfield);
             ECField field = new ECFieldFp(p);
             EllipticCurve curve = new EllipticCurve(field, bigInt(a),
                                                     bigInt(b));
             ECPoint g = new ECPoint(bigInt(x), bigInt(y));
-            SECP256R1 = new Curve(name, oid, curve, g, bigInt(n), h);
+            return new Curve(name, oid, curve, g, bigInt(n), h);
         }
 
         EC(PublicKey key) throws KeyException {
@@ -413,24 +435,45 @@
         }
 
         private static String getCurveOid(ECParameterSpec params) {
-            // Check that the params represent the secp256r1 curve
-            // If so, return the object identifier of the curve
-            int fieldSize = params.getCurve().getField().getFieldSize();
-            if (SECP256R1.getCurve().getField().getFieldSize() == fieldSize
-                && SECP256R1.getCurve().equals(params.getCurve())
-                && SECP256R1.getGenerator().equals(params.getGenerator())
-                && SECP256R1.getOrder().equals(params.getOrder())
-                && SECP256R1.getCofactor() == params.getCofactor()) {
-                return SECP256R1.getObjectId();
+            // Check that the params represent one of the supported
+            // curves. If there is a match, return the object identifier
+            // of the curve.
+            Curve match;
+            if (matchCurve(params, SECP256R1)) {
+                match = SECP256R1;
+            } else if (matchCurve(params, SECP384R1)) {
+                match = SECP384R1;
+            } else if (matchCurve(params, SECP521R1)) {
+                match = SECP521R1;
+            } else {
+                return null;
             }
-            return null;
+            return match.getObjectId();
+        }
+
+        private static boolean matchCurve(ECParameterSpec params, Curve curve) {
+            int fieldSize = params.getCurve().getField().getFieldSize();
+            if (curve.getCurve().getField().getFieldSize() == fieldSize
+                && curve.getCurve().equals(params.getCurve())
+                && curve.getGenerator().equals(params.getGenerator())
+                && curve.getOrder().equals(params.getOrder())
+                && curve.getCofactor() == params.getCofactor()) {
+                return true;
+            } else {
+                return false;
+            }
         }
 
         private static ECParameterSpec getECParameterSpec(String oid) {
             if (oid.equals(SECP256R1.getObjectId())) {
                 return SECP256R1;
+            } else if (oid.equals(SECP384R1.getObjectId())) {
+                return SECP384R1;
+            } else if (oid.equals(SECP521R1.getObjectId())) {
+                return SECP521R1;
+            } else {
+                return null;
             }
-            return null;
         }
 
         void marshalPublicKey(Node parent, Document doc, String dsPrefix,
diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java
index 43a1e71..07ee11b 100644
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java
@@ -57,7 +57,7 @@
      * and optional list of external elements.
      *
      * @param keyPacket a PGP Key Material Packet as defined in section 5.5 of
-     *    <a href="http://www.ietf.org/rfc/rfc2440.txt"/>RFC 2440</a>. The
+     *    <a href="http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>. The
      *    array is cloned to prevent subsequent modification.
      * @param other a list of {@link XMLStructure}s representing elements from
      *    an external namespace. The list is defensively copied to prevent
@@ -95,10 +95,10 @@
      * optional key packet and list of external elements.
      *
      * @param keyId a PGP public key id as defined in section 11.2 of
-     *    <a href="http://www.ietf.org/rfc/rfc2440.txt"/>RFC 2440</a>. The
+     *    <a href="http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>. The
      *    array is cloned to prevent subsequent modification.
      * @param keyPacket a PGP Key Material Packet as defined in section 5.5 of
-     *    <a href="http://www.ietf.org/rfc/rfc2440.txt"/>RFC 2440</a> (may
+     *    <a href="http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a> (may
      *    be <code>null</code>). The array is cloned to prevent subsequent
      *    modification.
      * @param other a list of {@link XMLStructure}s representing elements from
diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java
index f112f9e..81f0483 100644
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java
@@ -112,7 +112,6 @@
      *    is defensively copied to protect against subsequent modification.
      *    May be <code>null</code> or empty.
      * @param id the reference ID (may be <code>null</code>)
-     * @return a <code>Reference</code>
      * @throws NullPointerException if <code>dm</code> is <code>null</code>
      * @throws ClassCastException if any of the <code>transforms</code> are
      *    not of type <code>Transform</code>
diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java
index 26389e9..9eb40e0 100644
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java
@@ -58,7 +58,6 @@
      * @param properties a list of one or more {@link SignatureProperty}s. The
      *    list is defensively copied to protect against subsequent modification.
      * @param id the Id (may be <code>null</code>)
-     * @return a <code>DOMSignatureProperties</code>
      * @throws ClassCastException if <code>properties</code> contains any
      *    entries that are not of type {@link SignatureProperty}
      * @throws IllegalArgumentException if <code>properties</code> is empty
diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java
index 11d2e67..4fc688e 100644
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java
@@ -59,7 +59,6 @@
      *    is defensively copied to protect against subsequent modification.
      * @param target the target URI
      * @param id the Id (may be <code>null</code>)
-     * @return a <code>SignatureProperty</code>
      * @throws ClassCastException if <code>content</code> contains any
      *    entries that are not of type {@link XMLStructure}
      * @throws IllegalArgumentException if <code>content</code> is empty
diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java
index 74131a6..77f2298 100644
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java
@@ -53,7 +53,7 @@
     protected TransformService spi;
 
     /**
-     * Creates a <code>DOMTransform</code>.
+     * Creates a {@code DOMTransform}.
      *
      * @param spi the TransformService
      */
@@ -62,7 +62,7 @@
     }
 
     /**
-     * Creates a <code>DOMTransform</code> from an element. This constructor
+     * Creates a {@code DOMTransform} from an element. This constructor
      * invokes the abstract {@link #unmarshalParams unmarshalParams} method to
      * unmarshal any algorithm-specific input parameters.
      *
@@ -138,12 +138,12 @@
      * Transforms the specified data using the underlying transform algorithm.
      *
      * @param data the data to be transformed
-     * @param sc the <code>XMLCryptoContext</code> containing
-     *    additional context (may be <code>null</code> if not applicable)
+     * @param xc the {@code XMLCryptoContext} containing
+     *     additional context (may be {@code null} if not applicable)
      * @return the transformed data
-     * @throws NullPointerException if <code>data</code> is <code>null</code>
+     * @throws NullPointerException if {@code data} is {@code null}
      * @throws XMLSignatureException if an unexpected error occurs while
-     *    executing the transform
+     *     executing the transform
      */
     public Data transform(Data data, XMLCryptoContext xc)
         throws TransformException
@@ -155,14 +155,14 @@
      * Transforms the specified data using the underlying transform algorithm.
      *
      * @param data the data to be transformed
-     * @param sc the <code>XMLCryptoContext</code> containing
-     *    additional context (may be <code>null</code> if not applicable)
-     * @param os the <code>OutputStream</code> that should be used to write
-     *    the transformed data to
+     * @param xc the {@code XMLCryptoContext} containing
+     *     additional context (may be {@code null} if not applicable)
+     * @param os the {@code OutputStream} that should be used to write
+     *     the transformed data to
      * @return the transformed data
-     * @throws NullPointerException if <code>data</code> is <code>null</code>
+     * @throws NullPointerException if {@code data} is {@code null}
      * @throws XMLSignatureException if an unexpected error occurs while
-     *    executing the transform
+     *     executing the transform
      */
     public Data transform(Data data, XMLCryptoContext xc, OutputStream os)
         throws TransformException
@@ -201,16 +201,16 @@
     /**
      * Transforms the specified data using the underlying transform algorithm.
      * This method invokes the {@link #marshal marshal} method and passes it
-     * the specified <code>DOMSignContext</code> before transforming the data.
+     * the specified {@code DOMSignContext} before transforming the data.
      *
      * @param data the data to be transformed
-     * @param sc the <code>XMLCryptoContext</code> containing
-     *    additional context (may be <code>null</code> if not applicable)
+     * @param sc the {@code XMLCryptoContext} containing
+     *    additional context (may be {@code null} if not applicable)
      * @param context the marshalling context
      * @return the transformed data
      * @throws MarshalException if an exception occurs while marshalling
-     * @throws NullPointerException if <code>data</code> or <code>context</code>
-     *    is <code>null</code>
+     * @throws NullPointerException if {@code data} or {@code context}
+     *    is {@code null}
      * @throws XMLSignatureException if an unexpected error occurs while
      *    executing the transform
      */
diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java
index 72740c7..53555aa 100644
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java
@@ -65,7 +65,6 @@
      *    or {@link javax.xml.dsig.XMLStructure} ({@link X509IssuerSerial}
      *    objects or elements from an external namespace). The list is
      *    defensively copied to protect against subsequent modification.
-     * @return a <code>X509Data</code>
      * @throws NullPointerException if <code>content</code> is <code>null</code>
      * @throws IllegalArgumentException if <code>content</code> is empty
      * @throws ClassCastException if <code>content</code> contains any entries
diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java
index 7abd1e6..6d1ea83 100644
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java
@@ -63,7 +63,6 @@
      * @param id the Id (may be <code>null</code>)
      * @param mimeType the mime type (may be <code>null</code>)
      * @param encoding the encoding (may be <code>null</code>)
-     * @return an <code>XMLObject</code>
      * @throws ClassCastException if <code>content</code> contains any
      *    entries that are not of type {@link XMLStructure}
      */
diff --git a/jdk/src/share/classes/sun/java2d/marlin/ByteArrayCache.java b/jdk/src/share/classes/sun/java2d/marlin/ByteArrayCache.java
index cd6ebee..226a3d2 100644
--- a/jdk/src/share/classes/sun/java2d/marlin/ByteArrayCache.java
+++ b/jdk/src/share/classes/sun/java2d/marlin/ByteArrayCache.java
@@ -74,7 +74,7 @@
     void putDirtyArray(final byte[] array, final int length) {
         if (length != arraySize) {
             if (doChecks) {
-                System.out.println("ArrayCache: bad length = " + length);
+                MarlinUtils.logInfo("ArrayCache: bad length = " + length);
             }
             return;
         }
@@ -98,7 +98,7 @@
     {
         if (length != arraySize) {
             if (doChecks) {
-                System.out.println("ArrayCache: bad length = " + length);
+                MarlinUtils.logInfo("ArrayCache: bad length = " + length);
             }
             return;
         }
diff --git a/jdk/src/share/classes/sun/java2d/marlin/FloatArrayCache.java b/jdk/src/share/classes/sun/java2d/marlin/FloatArrayCache.java
index a068ad8..06d7f35 100644
--- a/jdk/src/share/classes/sun/java2d/marlin/FloatArrayCache.java
+++ b/jdk/src/share/classes/sun/java2d/marlin/FloatArrayCache.java
@@ -75,7 +75,7 @@
     void putDirtyArray(final float[] array, final int length) {
         if (length != arraySize) {
             if (doChecks) {
-                System.out.println("ArrayCache: bad length = " + length);
+                MarlinUtils.logInfo("ArrayCache: bad length = " + length);
             }
             return;
         }
@@ -99,7 +99,7 @@
     {
         if (length != arraySize) {
             if (doChecks) {
-                System.out.println("ArrayCache: bad length = " + length);
+                MarlinUtils.logInfo("ArrayCache: bad length = " + length);
             }
             return;
         }
diff --git a/jdk/src/share/classes/sun/java2d/marlin/IntArrayCache.java b/jdk/src/share/classes/sun/java2d/marlin/IntArrayCache.java
index ccd239c..11c5aae 100644
--- a/jdk/src/share/classes/sun/java2d/marlin/IntArrayCache.java
+++ b/jdk/src/share/classes/sun/java2d/marlin/IntArrayCache.java
@@ -74,7 +74,7 @@
     void putDirtyArray(final int[] array, final int length) {
         if (length != arraySize) {
             if (doChecks) {
-                System.out.println("ArrayCache: bad length = " + length);
+                MarlinUtils.logInfo("ArrayCache: bad length = " + length);
             }
             return;
         }
@@ -98,7 +98,7 @@
     {
         if (length != arraySize) {
             if (doChecks) {
-                System.out.println("ArrayCache: bad length = " + length);
+                MarlinUtils.logInfo("ArrayCache: bad length = " + length);
             }
             return;
         }
diff --git a/jdk/src/share/classes/sun/java2d/marlin/MarlinConst.java b/jdk/src/share/classes/sun/java2d/marlin/MarlinConst.java
index e799504..72993eb 100644
--- a/jdk/src/share/classes/sun/java2d/marlin/MarlinConst.java
+++ b/jdk/src/share/classes/sun/java2d/marlin/MarlinConst.java
@@ -30,8 +30,8 @@
  */
 interface MarlinConst {
     // enable Logs (logger or stdout)
-    static final boolean enableLogs = false;
-    // enable Logger
+    static final boolean enableLogs = MarlinProperties.isLoggingEnabled();
+    // use Logger instead of stdout
     static final boolean useLogger = enableLogs && MarlinProperties.isUseLogger();
 
     // log new RendererContext
@@ -47,9 +47,10 @@
     static final boolean doStats = enableLogs && MarlinProperties.isDoStats();
     // do monitors
     // disabled to reduce byte-code size a bit...
-    static final boolean doMonitors = enableLogs && false; // MarlinProperties.isDoMonitors();
+    static final boolean doMonitors = false;
+//    static final boolean doMonitors = enableLogs && MarlinProperties.isDoMonitors();
     // do checks
-    static final boolean doChecks = false; // MarlinProperties.isDoChecks();
+    static final boolean doChecks = enableLogs && MarlinProperties.isDoChecks();
 
     // do AA range checks: disable when algorithm / code is stable
     static final boolean DO_AA_RANGE_CHECK = false;
diff --git a/jdk/src/share/classes/sun/java2d/marlin/MarlinProperties.java b/jdk/src/share/classes/sun/java2d/marlin/MarlinProperties.java
index 002f16d..bbee15a 100644
--- a/jdk/src/share/classes/sun/java2d/marlin/MarlinProperties.java
+++ b/jdk/src/share/classes/sun/java2d/marlin/MarlinProperties.java
@@ -136,6 +136,10 @@
 
     // logging parameters
 
+    public static boolean isLoggingEnabled() {
+        return getBoolean("sun.java2d.renderer.log", "false");
+    }
+
     public static boolean isUseLogger() {
         return getBoolean("sun.java2d.renderer.useLogger", "false");
     }
diff --git a/jdk/src/share/classes/sun/java2d/marlin/MarlinUtils.java b/jdk/src/share/classes/sun/java2d/marlin/MarlinUtils.java
index 95cd30a..aeeacca 100644
--- a/jdk/src/share/classes/sun/java2d/marlin/MarlinUtils.java
+++ b/jdk/src/share/classes/sun/java2d/marlin/MarlinUtils.java
@@ -25,16 +25,14 @@
 
 package sun.java2d.marlin;
 
-import sun.misc.JavaLangAccess;
-import sun.misc.SharedSecrets;
 
 public final class MarlinUtils {
-    // TODO: use sun.util.logging.PlatformLogger once in JDK9
-    private static final java.util.logging.Logger log;
+    // Marlin logger
+    private static final sun.util.logging.PlatformLogger log;
 
     static {
         if (MarlinConst.useLogger) {
-            log = java.util.logging.Logger.getLogger("sun.java2d.marlin");
+            log = sun.util.logging.PlatformLogger.getLogger("sun.java2d.marlin");
         } else {
             log = null;
         }
@@ -55,50 +53,11 @@
 
     public static void logException(final String msg, final Throwable th) {
         if (MarlinConst.useLogger) {
-//            log.warning(msg, th);
-            log.log(java.util.logging.Level.WARNING, msg, th);
+            log.warning(msg, th);
         } else if (MarlinConst.enableLogs) {
             System.out.print("WARNING: ");
             System.out.println(msg);
             th.printStackTrace(System.err);
         }
     }
-
-    // Returns the caller's class and method's name; best effort
-    // if cannot infer, return the logger's name.
-    static String getCallerInfo(String className) {
-        String sourceClassName = null;
-        String sourceMethodName = null;
-
-        JavaLangAccess access = SharedSecrets.getJavaLangAccess();
-        Throwable throwable = new Throwable();
-        int depth = access.getStackTraceDepth(throwable);
-
-        boolean lookingForClassName = true;
-        for (int ix = 0; ix < depth; ix++) {
-            // Calling getStackTraceElement directly prevents the VM
-            // from paying the cost of building the entire stack frame.
-            StackTraceElement frame = access.getStackTraceElement(throwable, ix);
-            String cname = frame.getClassName();
-            if (lookingForClassName) {
-                // Skip all frames until we have found the first frame having the class name.
-                if (cname.equals(className)) {
-                    lookingForClassName = false;
-                }
-            } else {
-                if (!cname.equals(className)) {
-                    // We've found the relevant frame.
-                    sourceClassName = cname;
-                    sourceMethodName = frame.getMethodName();
-                    break;
-                }
-            }
-        }
-
-        if (sourceClassName != null) {
-            return sourceClassName + " " + sourceMethodName;
-        } else {
-            return "unknown";
-        }
-    }
 }
diff --git a/jdk/src/share/classes/sun/java2d/marlin/RendererContext.java b/jdk/src/share/classes/sun/java2d/marlin/RendererContext.java
index 7af675b..a767651 100644
--- a/jdk/src/share/classes/sun/java2d/marlin/RendererContext.java
+++ b/jdk/src/share/classes/sun/java2d/marlin/RendererContext.java
@@ -31,7 +31,6 @@
 import java.util.concurrent.atomic.AtomicInteger;
 import static sun.java2d.marlin.ArrayCache.*;
 import sun.java2d.marlin.MarlinRenderingEngine.NormalizingPathIterator;
-import static sun.java2d.marlin.MarlinUtils.getCallerInfo;
 import static sun.java2d.marlin.MarlinUtils.logInfo;
 
 /**
@@ -39,7 +38,6 @@
  */
 final class RendererContext implements MarlinConst {
 
-    private static final String className = RendererContext.class.getName();
     // RendererContext creation counter
     private static final AtomicInteger contextCount = new AtomicInteger(1);
     // RendererContext statistics
@@ -214,8 +212,7 @@
         }
 
         if (doLogOverSize) {
-            logInfo("getDirtyByteArray[oversize]: length=\t" + length
-                    + "\tfrom=\t" + getCallerInfo(className));
+            logInfo("getDirtyByteArray[oversize]: length=\t" + length);
         }
 
         return new byte[length];
@@ -254,7 +251,7 @@
         if (doLogWidenArray) {
             logInfo("widenDirtyByteArray[" + res.length + "]: usedSize=\t"
                     + usedSize + "\tlength=\t" + length + "\tneeded length=\t"
-                    + needSize + "\tfrom=\t" + getCallerInfo(className));
+                    + needSize);
         }
         return res;
     }
@@ -275,8 +272,7 @@
         }
 
         if (doLogOverSize) {
-            logInfo("getIntArray[oversize]: length=\t" + length + "\tfrom=\t"
-                    + getCallerInfo(className));
+            logInfo("getIntArray[oversize]: length=\t" + length);
         }
 
         return new int[length];
@@ -306,7 +302,7 @@
         if (doLogWidenArray) {
             logInfo("widenIntArray[" + res.length + "]: usedSize=\t"
                     + usedSize + "\tlength=\t" + length + "\tneeded length=\t"
-                    + needSize + "\tfrom=\t" + getCallerInfo(className));
+                    + needSize);
         }
         return res;
     }
@@ -338,8 +334,7 @@
         }
 
         if (doLogOverSize) {
-            logInfo("getDirtyIntArray[oversize]: length=\t" + length
-                    + "\tfrom=\t" + getCallerInfo(className));
+            logInfo("getDirtyIntArray[oversize]: length=\t" + length);
         }
 
         return new int[length];
@@ -369,7 +364,7 @@
         if (doLogWidenArray) {
             logInfo("widenDirtyIntArray[" + res.length + "]: usedSize=\t"
                     + usedSize + "\tlength=\t" + length + "\tneeded length=\t"
-                    + needSize + "\tfrom=\t" + getCallerInfo(className));
+                    + needSize);
         }
         return res;
     }
@@ -399,8 +394,7 @@
         }
 
         if (doLogOverSize) {
-            logInfo("getDirtyFloatArray[oversize]: length=\t" + length
-                    + "\tfrom=\t" + getCallerInfo(className));
+            logInfo("getDirtyFloatArray[oversize]: length=\t" + length);
         }
 
         return new float[length];
@@ -430,7 +424,7 @@
         if (doLogWidenArray) {
             logInfo("widenDirtyFloatArray[" + res.length + "]: usedSize=\t"
                     + usedSize + "\tlength=\t" + length + "\tneeded length=\t"
-                    + needSize + "\tfrom=\t" + getCallerInfo(className));
+                    + needSize);
         }
         return res;
     }
diff --git a/jdk/src/share/classes/sun/java2d/marlin/Stroker.java b/jdk/src/share/classes/sun/java2d/marlin/Stroker.java
index 1aa4841..2946eda 100644
--- a/jdk/src/share/classes/sun/java2d/marlin/Stroker.java
+++ b/jdk/src/share/classes/sun/java2d/marlin/Stroker.java
@@ -87,6 +87,7 @@
     private int joinStyle;
 
     private float lineWidth2;
+    private float invHalfLineWidth2Sq;
 
     private final float[] offset0 = new float[2];
     private final float[] offset1 = new float[2];
@@ -158,6 +159,7 @@
         this.out = pc2d;
 
         this.lineWidth2 = lineWidth / 2f;
+        this.invHalfLineWidth2Sq = 1f / (2f * lineWidth2 * lineWidth2);
         this.capStyle = capStyle;
         this.joinStyle = joinStyle;
 
@@ -252,11 +254,11 @@
         // The sign of the dot product of mx,my and omx,omy is equal to the
         // the sign of the cosine of ext
         // (ext is the angle between omx,omy and mx,my).
-        double cosext = omx * mx + omy * my;
+        final float cosext = omx * mx + omy * my;
         // If it is >=0, we know that abs(ext) is <= 90 degrees, so we only
         // need 1 curve to approximate the circle section that joins omx,omy
         // and mx,my.
-        final int numCurves = cosext >= 0 ? 1 : 2;
+        final int numCurves = (cosext >= 0f) ? 1 : 2;
 
         switch (numCurves) {
         case 1:
@@ -302,14 +304,22 @@
                                      final float mx, final float my,
                                      boolean rev)
     {
-        float cosext2 = (omx * mx + omy * my) / (2f * lineWidth2 * lineWidth2);
+        final float cosext2 = (omx * mx + omy * my) * invHalfLineWidth2Sq;
+
+        // check round off errors producing cos(ext) > 1 and a NaN below
+        // cos(ext) == 1 implies colinear segments and an empty join anyway
+        if (cosext2 >= 0.5f) {
+            // just return to avoid generating a flat curve:
+            return;
+        }
+
         // cv is the length of P1-P0 and P2-P3 divided by the radius of the arc
         // (so, cv assumes the arc has radius 1). P0, P1, P2, P3 are the points that
         // define the bezier curve we're computing.
         // It is computed using the constraints that P1-P0 and P3-P2 are parallel
         // to the arc tangents at the endpoints, and that |P1-P0|=|P3-P2|.
-        float cv = (float) ((4.0 / 3.0) * sqrt(0.5-cosext2) /
-                            (1.0 + sqrt(cosext2+0.5)));
+        float cv = (float) ((4.0 / 3.0) * sqrt(0.5 - cosext2) /
+                            (1.0 + sqrt(cosext2 + 0.5)));
         // if clockwise, we need to negate cv.
         if (rev) { // rev is equivalent to isCW(omx, omy, mx, my)
             cv = -cv;
diff --git a/jdk/src/share/classes/sun/java2d/pisces/Stroker.java b/jdk/src/share/classes/sun/java2d/pisces/Stroker.java
index 6d4a4c7..f388da4 100644
--- a/jdk/src/share/classes/sun/java2d/pisces/Stroker.java
+++ b/jdk/src/share/classes/sun/java2d/pisces/Stroker.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015, 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
@@ -193,11 +193,11 @@
         // The sign of the dot product of mx,my and omx,omy is equal to the
         // the sign of the cosine of ext
         // (ext is the angle between omx,omy and mx,my).
-        double cosext = omx * mx + omy * my;
+        final float cosext = omx * mx + omy * my;
         // If it is >=0, we know that abs(ext) is <= 90 degrees, so we only
         // need 1 curve to approximate the circle section that joins omx,omy
         // and mx,my.
-        final int numCurves = cosext >= 0 ? 1 : 2;
+        final int numCurves = (cosext >= 0f) ? 1 : 2;
 
         switch (numCurves) {
         case 1:
@@ -242,14 +242,22 @@
                                      final float mx, final float my,
                                      boolean rev)
     {
-        float cosext2 = (omx * mx + omy * my) / (2 * lineWidth2 * lineWidth2);
+        final float cosext2 = (omx * mx + omy * my) / (2f * lineWidth2 * lineWidth2);
+
+        // check round off errors producing cos(ext) > 1 and a NaN below
+        // cos(ext) == 1 implies colinear segments and an empty join anyway
+        if (cosext2 >= 0.5f) {
+            // just return to avoid generating a flat curve:
+            return;
+        }
+
         // cv is the length of P1-P0 and P2-P3 divided by the radius of the arc
         // (so, cv assumes the arc has radius 1). P0, P1, P2, P3 are the points that
         // define the bezier curve we're computing.
         // It is computed using the constraints that P1-P0 and P3-P2 are parallel
         // to the arc tangents at the endpoints, and that |P1-P0|=|P3-P2|.
-        float cv = (float) ((4.0 / 3.0) * sqrt(0.5-cosext2) /
-                            (1.0 + sqrt(cosext2+0.5)));
+        float cv = (float) ((4.0 / 3.0) * sqrt(0.5 - cosext2) /
+                            (1.0 + sqrt(cosext2 + 0.5)));
         // if clockwise, we need to negate cv.
         if (rev) { // rev is equivalent to isCW(omx, omy, mx, my)
             cv = -cv;
diff --git a/jdk/src/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java b/jdk/src/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java
index 0b42768..404247c 100644
--- a/jdk/src/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java
+++ b/jdk/src/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java
@@ -31,7 +31,6 @@
 import java.util.Base64;
 import java.util.HashMap;
 import sun.net.www.HeaderParser;
-import sun.util.logging.PlatformLogger;
 import static sun.net.www.protocol.http.AuthScheme.NEGOTIATE;
 import static sun.net.www.protocol.http.AuthScheme.KERBEROS;
 import sun.security.action.GetPropertyAction;
@@ -46,7 +45,6 @@
 class NegotiateAuthentication extends AuthenticationInfo {
 
     private static final long serialVersionUID = 100L;
-    private static final PlatformLogger logger = HttpURLConnection.getHttpLogger();
 
     final private HttpCallerInfo hci;
 
@@ -90,31 +88,6 @@
     }
 
     /**
-     * Find out if the HttpCallerInfo supports Negotiate protocol.
-     * @return true if supported
-     */
-    public static boolean isSupported(HttpCallerInfo hci) {
-        ClassLoader loader = null;
-        try {
-            loader = Thread.currentThread().getContextClassLoader();
-        } catch (SecurityException se) {
-            if (logger.isLoggable(PlatformLogger.Level.FINER)) {
-                logger.finer("NegotiateAuthentication: " +
-                    "Attempt to get the context class loader failed - " + se);
-            }
-        }
-
-        if (loader != null) {
-            // Lock on the class loader instance to avoid the deadlock engaging
-            // the lock in "ClassLoader.loadClass(String, boolean)" method.
-            synchronized (loader) {
-                return isSupportedImpl(hci);
-            }
-        }
-        return isSupportedImpl(hci);
-    }
-
-    /**
      * Find out if the HttpCallerInfo supports Negotiate protocol. In order to
      * find out yes or no, an initialization of a Negotiator object against it
      * is tried. The generated object will be cached under the name of ths
@@ -125,7 +98,7 @@
      *
      * @return true if supported
      */
-    private static synchronized boolean isSupportedImpl(HttpCallerInfo hci) {
+    synchronized public static boolean isSupported(HttpCallerInfo hci) {
         if (supported == null) {
             supported = new HashMap<>();
         }
diff --git a/jdk/src/share/classes/sun/security/jgss/GSSCredentialImpl.java b/jdk/src/share/classes/sun/security/jgss/GSSCredentialImpl.java
index 65f6847..2b8b11b 100644
--- a/jdk/src/share/classes/sun/security/jgss/GSSCredentialImpl.java
+++ b/jdk/src/share/classes/sun/security/jgss/GSSCredentialImpl.java
@@ -535,8 +535,8 @@
     /**
      * Returns the specified mechanism's credential-element.
      *
-     * @param mechOid - the oid for mechanism to retrieve
-     * @param throwExcep - boolean indicating if the function is
+     * @param mechOid the oid for mechanism to retrieve
+     * @param initiate boolean indicating if the function is
      *    to throw exception or return null when element is not
      *    found.
      * @return mechanism credential object
diff --git a/jdk/src/share/classes/sun/security/jgss/GSSToken.java b/jdk/src/share/classes/sun/security/jgss/GSSToken.java
index 7fa3047..5c887b0 100644
--- a/jdk/src/share/classes/sun/security/jgss/GSSToken.java
+++ b/jdk/src/share/classes/sun/security/jgss/GSSToken.java
@@ -84,7 +84,7 @@
      *
      * @param data the array containing the bytes of the integer value
      * @param pos the offset in the array
-     * @size the number of bytes to read from the array.
+     * @param size the number of bytes to read from the array.
      * @return the integer value
      */
     public static final int readLittleEndian(byte[] data, int pos, int size) {
@@ -141,7 +141,7 @@
      * Reads a two byte integer value from an InputStream.
      *
      * @param is the InputStream to read from
-     * @returns the integer value
+     * @return the integer value
      * @throws IOException if some errors occurs while reading the integer
      * bytes.
      */
@@ -155,7 +155,7 @@
      *
      * @param src the byte arra to read from
      * @param pos the offset to start reading from
-     * @returns the integer value
+     * @return the integer value
      */
     public static final int readInt(byte[] src, int pos) {
         return ((0xFF & src[pos])<<8 | (0xFF & src[pos+1]));
@@ -167,8 +167,8 @@
      *
      * @param is the InputStream to read from
      * @param buffer the buffer to store the bytes into
-     * @param throws EOFException if EOF is reached before all bytes are
-     * read.
+     * @throws EOFException if EOF is reached before all bytes are
+     *         read.
      * @throws IOException is an error occurs while reading
      */
     public static final void readFully(InputStream is, byte[] buffer)
@@ -184,8 +184,8 @@
      * @param buffer the buffer to store the bytes into
      * @param offset the offset to start storing at
      * @param len the number of bytes to read
-     * @param throws EOFException if EOF is reached before all bytes are
-     * read.
+     * @throws EOFException if EOF is reached before all bytes are
+     *         read.
      * @throws IOException is an error occurs while reading
      */
     public static final void readFully(InputStream is,
diff --git a/jdk/src/share/classes/sun/security/jgss/LoginConfigImpl.java b/jdk/src/share/classes/sun/security/jgss/LoginConfigImpl.java
index 9ae3d5a..eab531d 100644
--- a/jdk/src/share/classes/sun/security/jgss/LoginConfigImpl.java
+++ b/jdk/src/share/classes/sun/security/jgss/LoginConfigImpl.java
@@ -59,7 +59,7 @@
      * A new instance of LoginConfigImpl must be created for each login request
      * since it's only used by a single (caller, mech) pair
      * @param caller defined in GSSUtil as CALLER_XXX final fields
-     * @param oid defined in GSSUtil as XXX_MECH_OID final fields
+     * @param mech defined in GSSUtil as XXX_MECH_OID final fields
      */
     public LoginConfigImpl(GSSCaller caller, Oid mech) {
 
diff --git a/jdk/src/share/classes/sun/security/jgss/ProviderList.java b/jdk/src/share/classes/sun/security/jgss/ProviderList.java
index bfc48ac..d7dfffe 100644
--- a/jdk/src/share/classes/sun/security/jgss/ProviderList.java
+++ b/jdk/src/share/classes/sun/security/jgss/ProviderList.java
@@ -46,7 +46,7 @@
  * queries this class whenever it needs a mechanism's factory.<p>
  *
  * This class stores an ordered list of pairs of the form
- * <provider, oid>. When it attempts to instantiate a mechanism
+ * {@code <provider, oid>}. When it attempts to instantiate a mechanism
  * defined by oid o, it steps through the list looking for an entry
  * with oid=o, or with oid=null. (An entry with oid=null matches all
  * mechanisms.) When it finds such an entry, the corresponding
@@ -74,12 +74,12 @@
  * the system ones don't suffice.<p>
  *
  * If a mechanism's factory is being obtained from a provider as a
- * result of encountering a entryof the form <provider, oid> where
+ * result of encountering a entryof the form {@code <provider, oid>} where
  * oid is non-null, then the assumption is that the application added
  * this entry and it wants this mechanism to be obtained from this
  * provider. Thus is the provider does not actually contain the
  * requested mechanism, an exception will be thrown. However, if the
- * entry were of the form <provider, null>, then it is viewed more
+ * entry were of the form {@code <provider, null>}, then it is viewed more
  * liberally and is simply skipped over if the provider does not claim to
  * support the requested mechanism.
  */
diff --git a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5NameElement.java b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5NameElement.java
index 37d0b77..461e248 100644
--- a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5NameElement.java
+++ b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5NameElement.java
@@ -214,7 +214,7 @@
      * return false.
      *
      * @param other to be compared with
-     * @returns true if they both refer to the same entity, else false
+     * @return true if they both refer to the same entity, else false
      * @exception GSSException with major codes of BAD_NAMETYPE,
      *  BAD_NAME, FAILURE
      */
@@ -239,7 +239,7 @@
      * situation where an error occurs.
      *
      * @param another the object to be compared to
-     * @returns true if they both refer to the same entity, else false
+     * @return true if they both refer to the same entity, else false
      * @see #equals(GSSNameSpi)
      */
     public boolean equals(Object another) {
diff --git a/jdk/src/share/classes/sun/security/jgss/spi/GSSContextSpi.java b/jdk/src/share/classes/sun/security/jgss/spi/GSSContextSpi.java
index 1a68a44..07b1c7d 100644
--- a/jdk/src/share/classes/sun/security/jgss/spi/GSSContextSpi.java
+++ b/jdk/src/share/classes/sun/security/jgss/spi/GSSContextSpi.java
@@ -52,14 +52,14 @@
  * and the context flags before the context is fully established. The
  * isProtReady method is used to indicate that these services are
  * available.
- *<p>
+ * <p>
  * <strong>
  * Context establishment tokens are defined in a mechanism independent
  * format in section 3.1 of RFC 2743. The GSS-Framework will add
  * and remove the mechanism independent header portion of this token format
  * depending on whether a token is received or is being sent. The mechanism
- * should only generate or expect to read the inner-context token portion..
- * <p>
+ * should only generate or expect to read the inner-context token portion.
+ * <br>
  * On the other hands, tokens used for per-message calls are generated
  * entirely by the mechanism. It is possible that the mechanism chooses to
  * encase inner-level per-message tokens in a header similar to that used
@@ -240,7 +240,7 @@
      *    asked to provide.
      * @param confReq a flag indicating whether confidentiality will be
      *    requested or not
-     * @param outputSize the maximum size of the output token
+     * @param maxTokSize the maximum size of the output token
      * @return the maximum size for the input message that can be
      *    provided to the wrap() method in order to guarantee that these
      *    requirements are met.
@@ -255,7 +255,7 @@
      * @param is the user-provided message to be protected
      * @param os the token to be sent to the peer. It includes
      *    the message from <i>is</i> with the requested protection.
-     * @param msgPro on input it contains the requested qop and
+     * @param msgProp on input it contains the requested qop and
      *    confidentiality state, on output, the applied values
      * @exception GSSException may be thrown
      * @see unwrap
@@ -366,7 +366,7 @@
      *
      * @param is token generated by getMIC
      * @param msgStr the message to check integrity for
-     * @param msgProp will contain the applied QOP and confidentiality
+     * @param mProp will contain the applied QOP and confidentiality
      *    states of the token as well as any informatory status codes
      * @exception GSSException may be thrown
      */
diff --git a/jdk/src/share/classes/sun/security/jgss/spi/GSSNameSpi.java b/jdk/src/share/classes/sun/security/jgss/spi/GSSNameSpi.java
index 61fc207..24362d0 100644
--- a/jdk/src/share/classes/sun/security/jgss/spi/GSSNameSpi.java
+++ b/jdk/src/share/classes/sun/security/jgss/spi/GSSNameSpi.java
@@ -46,7 +46,7 @@
      * return false.
      *
      * @param name to be compared with
-     * @returns true if they both refer to the same entity, else false
+     * @return true if they both refer to the same entity, else false
      * @exception GSSException with major codes of BAD_NAMETYPE,
      *    BAD_NAME, FAILURE
      */
@@ -60,7 +60,7 @@
      * situation where an error occurs.
      *
      * @param another the object to be compared to
-     * @returns true if they both refer to the same entity, else false
+     * @return true if they both refer to the same entity, else false
      * @see #equals(GSSNameSpi)
      */
     public boolean equals(Object another);
diff --git a/jdk/src/share/classes/sun/security/jgss/spi/MechanismFactory.java b/jdk/src/share/classes/sun/security/jgss/spi/MechanismFactory.java
index 5d40fff..e5bba5f 100644
--- a/jdk/src/share/classes/sun/security/jgss/spi/MechanismFactory.java
+++ b/jdk/src/share/classes/sun/security/jgss/spi/MechanismFactory.java
@@ -147,7 +147,7 @@
      * <p>
      * An exported name will generally be passed in using this method.
      *
-     * @param nameBytes the bytes describing this entity to the mechanism
+     * @param name the bytes describing this entity to the mechanism
      * @param nameType an Oid serving as a clue as to how the mechanism should
      * interpret the nameStr
      * @throws GSSException if any of the errors described in RFC 2743 for
diff --git a/jdk/src/share/classes/sun/security/krb5/Checksum.java b/jdk/src/share/classes/sun/security/krb5/Checksum.java
index 92a5de8..3f89f97 100644
--- a/jdk/src/share/classes/sun/security/krb5/Checksum.java
+++ b/jdk/src/share/classes/sun/security/krb5/Checksum.java
@@ -133,8 +133,8 @@
      * own calculating and verification rules. It does has the same
      * ASN.1 encoding though.
      *
-     * @data the byte array of checksum.
-     * @new_cksumType the type of checksum.
+     * @param data the byte array of checksum.
+     * @param new_cksumType the type of checksum.
      */
     public Checksum(byte[] data, int new_cksumType) {
         cksumType = new_cksumType;
@@ -235,12 +235,12 @@
 
     /**
      * Encodes a Checksum object.
-     * <xmp>
+     * <pre>{@code
      * Checksum    ::= SEQUENCE {
      *         cksumtype   [0] Int32,
      *         checksum    [1] OCTET STRING
      * }
-     * </xmp>
+     * }</pre>
      *
      * <p>
      * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/Config.java b/jdk/src/share/classes/sun/security/krb5/Config.java
index fe6565c..e981c31 100644
--- a/jdk/src/share/classes/sun/security/krb5/Config.java
+++ b/jdk/src/share/classes/sun/security/krb5/Config.java
@@ -361,7 +361,7 @@
      *
      * @param s the string duration
      * @return time in seconds
-     * @throw KrbException if format is illegal
+     * @throws KrbException if format is illegal
      */
     public static int duration(String s) throws KrbException {
 
@@ -423,7 +423,7 @@
      * @param keys the keys
      * @return the int value, Integer.MIN_VALUE is returned if it cannot be
      * found or the value is not a legal integer.
-     * @throw IllegalArgumentException if any of the keys is illegal
+     * @throws IllegalArgumentException if any of the keys is illegal
      * @see #get(java.lang.String[])
      */
     public int getIntValue(String... keys) {
diff --git a/jdk/src/share/classes/sun/security/krb5/Credentials.java b/jdk/src/share/classes/sun/security/krb5/Credentials.java
index b364a62..0fed291 100644
--- a/jdk/src/share/classes/sun/security/krb5/Credentials.java
+++ b/jdk/src/share/classes/sun/security/krb5/Credentials.java
@@ -313,7 +313,7 @@
      * @param ticketCache the path to the tickets file. A value
      * of null will be accepted to indicate that the default
      * path should be searched
-     * @returns the TGT credentials or null if none were found. If the tgt
+     * @return the TGT credentials or null if none were found. If the tgt
      * expired, it is the responsibility of the caller to determine this.
      */
     public static Credentials acquireTGTFromCache(PrincipalName princ,
diff --git a/jdk/src/share/classes/sun/security/krb5/EncryptedData.java b/jdk/src/share/classes/sun/security/krb5/EncryptedData.java
index 4c5cab7..7f93db2 100644
--- a/jdk/src/share/classes/sun/security/krb5/EncryptedData.java
+++ b/jdk/src/share/classes/sun/security/krb5/EncryptedData.java
@@ -259,20 +259,20 @@
     /**
      * Returns an ASN.1 encoded EncryptedData type.
      *
-     * <xmp>
+     * <pre>{@code
      * EncryptedData   ::= SEQUENCE {
      *     etype   [0] Int32 -- EncryptionType --,
      *     kvno    [1] UInt32 OPTIONAL,
      *     cipher  [2] OCTET STRING -- ciphertext
      * }
-     * </xmp>
+     * }</pre>
      *
      * <p>
      * This definition reflects the Network Working Group RFC 4120
      * specification available at
      * <a href="http://www.ietf.org/rfc/rfc4120.txt">
      * http://www.ietf.org/rfc/rfc4120.txt</a>.
-     * <p>
+     *
      * @return byte array of encoded EncryptedData object.
      * @exception Asn1Exception if an error occurs while decoding an
      * ASN1 encoded data.
diff --git a/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java b/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java
index b83fe8c..4823b25 100644
--- a/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java
+++ b/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java
@@ -101,11 +101,11 @@
      * Obtains all versions of the secret key of the principal from a
      * keytab.
      *
-     * @Param princ the principal whose secret key is desired
+     * @param princ the principal whose secret key is desired
      * @param keytab the path to the keytab file. A value of null
      * will be accepted to indicate that the default path should be
      * searched.
-     * @returns an array of secret keys or null if none were found.
+     * @return an array of secret keys or null if none were found.
      */
     public static EncryptionKey[] acquireSecretKeys(PrincipalName princ,
                                                     String keytab) {
@@ -127,7 +127,7 @@
      * @param password NOT null
      * @param etype
      * @param snp can be NULL
-     * @returns never null
+     * @return never null
      */
     public static EncryptionKey acquireSecretKey(PrincipalName cname,
             char[] password, int etype, PAData.SaltAndParams snp)
@@ -150,7 +150,7 @@
      * @param salt NOT null
      * @param etype
      * @param s2kparams can be NULL
-     * @returns never null
+     * @return never null
      */
     public static EncryptionKey acquireSecretKey(char[] password,
             String salt, int etype, byte[] s2kparams)
@@ -381,11 +381,11 @@
     /**
      * Returns the ASN.1 encoding of this EncryptionKey.
      *
-     * <xmp>
+     * <pre>{@code
      * EncryptionKey ::=   SEQUENCE {
      *                             keytype[0]    INTEGER,
      *                             keyvalue[1]   OCTET STRING }
-     * </xmp>
+     * }</pre>
      *
      * <p>
      * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/KrbAsReqBuilder.java b/jdk/src/share/classes/sun/security/krb5/KrbAsReqBuilder.java
index 445fa19..c626cfd 100644
--- a/jdk/src/share/classes/sun/security/krb5/KrbAsReqBuilder.java
+++ b/jdk/src/share/classes/sun/security/krb5/KrbAsReqBuilder.java
@@ -112,7 +112,7 @@
      * realm, where default realm will be used. This realm will be the target
      * realm for AS-REQ. I believe a client should only get initial TGT from
      * its own realm.
-     * @param keys must not be null. if empty, might be quite useless.
+     * @param ktab must not be null. If empty, might be quite useless.
      * This argument will neither be modified nor stored by the method.
      * @throws KrbException
      */
diff --git a/jdk/src/share/classes/sun/security/krb5/PrincipalName.java b/jdk/src/share/classes/sun/security/krb5/PrincipalName.java
index 4a16eb3..e2dadb3 100644
--- a/jdk/src/share/classes/sun/security/krb5/PrincipalName.java
+++ b/jdk/src/share/classes/sun/security/krb5/PrincipalName.java
@@ -45,14 +45,14 @@
 
 /**
  * Implements the ASN.1 PrincipalName type and its realm in a single class.
- * <xmp>
+ * <pre>{@code
  *    Realm           ::= KerberosString
  *
  *    PrincipalName   ::= SEQUENCE {
  *            name-type       [0] Int32,
  *            name-string     [1] SEQUENCE OF KerberosString
  *    }
- * </xmp>
+ * }</pre>
  * This class is immutable.
  * @see Realm
  */
@@ -219,14 +219,14 @@
 
     /**
      * Returns the ASN.1 encoding of the
-     * <xmp>
+     * <pre>{@code
      * PrincipalName    ::= SEQUENCE {
      *          name-type       [0] Int32,
      *          name-string     [1] SEQUENCE OF KerberosString
      * }
      *
      * KerberosString   ::= GeneralString (IA5String)
-     * </xmp>
+     * }</pre>
      *
      * <p>
      * This definition reflects the Network Working Group RFC 4120
@@ -657,7 +657,8 @@
      * name, the second component is returned.
      * Null is returned if there are not two or more
      * components in the name.
-     * @returns instance component of a multi-component name.
+     *
+     * @return instance component of a multi-component name.
      */
     public String getInstanceComponent()
     {
diff --git a/jdk/src/share/classes/sun/security/krb5/Realm.java b/jdk/src/share/classes/sun/security/krb5/Realm.java
index 2cf7bbf..ffd6465 100644
--- a/jdk/src/share/classes/sun/security/krb5/Realm.java
+++ b/jdk/src/share/classes/sun/security/krb5/Realm.java
@@ -41,9 +41,8 @@
 /**
  * Implements the ASN.1 Realm type.
  *
- * <xmp>
- * Realm ::= GeneralString
- * </xmp>
+ * {@code Realm ::= GeneralString}
+ *
  * This class is immutable.
  */
 public class Realm implements Cloneable {
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/APOptions.java b/jdk/src/share/classes/sun/security/krb5/internal/APOptions.java
index c9644af..88ef620 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/APOptions.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/APOptions.java
@@ -38,17 +38,17 @@
 /**
  * Implements the ASN.1 APOptions type.
  *
- * <xmp>
+ * <pre>{@code
  * APOptions    ::= KerberosFlags
  *      -- reserved(0),
  *      -- use-session-key(1),
  *      -- mutual-required(2)
- * </xmp>
  *
  * KerberosFlags   ::= BIT STRING (SIZE (32..MAX))
  *              -- minimum number of bits shall be sent,
  *              -- but no fewer than 32
  *
+ * }</pre>
  * <p>
  * This definition reflects the Network Working Group RFC4120
  * specification available at
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/APRep.java b/jdk/src/share/classes/sun/security/krb5/internal/APRep.java
index 4a8bea8..017159d 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/APRep.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/APRep.java
@@ -39,13 +39,13 @@
 /**
  * Implements the ASN.1 AP-REP type.
  *
- * <xmp>
+ * <pre>{@code
  * AP-REP          ::= [APPLICATION 15] SEQUENCE {
  *         pvno            [0] INTEGER (5),
  *         msg-type        [1] INTEGER (15),
  *         enc-part        [2] EncryptedData -- EncAPRepPart
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/APReq.java b/jdk/src/share/classes/sun/security/krb5/internal/APReq.java
index c70fe20..30a6aa6 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/APReq.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/APReq.java
@@ -38,7 +38,7 @@
 /**
  * Implements the ASN.1 AP-REQ type.
  *
- * <xmp>
+ * <pre>{@code
  * AP-REQ               ::= [APPLICATION 14] SEQUENCE {
  *      pvno            [0] INTEGER (5),
  *      msg-type        [1] INTEGER (14),
@@ -46,7 +46,7 @@
  *      ticket          [3] Ticket,
  *      authenticator   [4] EncryptedData -- Authenticator
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/Authenticator.java b/jdk/src/share/classes/sun/security/krb5/internal/Authenticator.java
index 6220135..16e04a2 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/Authenticator.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/Authenticator.java
@@ -38,7 +38,7 @@
 /**
  * Implements the ASN.1 Authenticator type.
  *
- * <xmp>
+ * <pre>{@code
  * Authenticator   ::= [APPLICATION 2] SEQUENCE  {
  *         authenticator-vno       [0] INTEGER (5),
  *         crealm                  [1] Realm,
@@ -50,7 +50,7 @@
  *         seq-number              [7] UInt32 OPTIONAL,
  *         authorization-data      [8] AuthorizationData OPTIONAL
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/EncAPRepPart.java b/jdk/src/share/classes/sun/security/krb5/internal/EncAPRepPart.java
index fdebf1d..5f323ac 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/EncAPRepPart.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/EncAPRepPart.java
@@ -39,14 +39,14 @@
 /**
  * Implements the ASN.1 EncAPRepPart type.
  *
- * <xmp>
+ * <pre>{@code
  * EncAPRepPart ::= [APPLICATION 27] SEQUENCE {
  *      ctime           [0] KerberosTime,
  *      cusec           [1] Microseconds,
  *      subkey          [2] EncryptionKey OPTIONAL,
  *      seq-number      [3] UInt32 OPTIONAL
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/EncKDCRepPart.java b/jdk/src/share/classes/sun/security/krb5/internal/EncKDCRepPart.java
index 5c60364..9db87e2 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/EncKDCRepPart.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/EncKDCRepPart.java
@@ -39,7 +39,7 @@
 /**
  * Implements the ASN.1 EncKDCRepPart type.
  *
- * <xmp>
+ * <pre>{@code
  * EncKDCRepPart          ::= SEQUENCE {
  *      key               [0] EncryptionKey,
  *      last-req          [1] LastReq,
@@ -55,7 +55,7 @@
  *      caddr             [11] HostAddresses OPTIONAL,
  *      encrypted-pa-data [12] SEQUENCE OF PA-DATA OPTIONAL
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/EncKrbCredPart.java b/jdk/src/share/classes/sun/security/krb5/internal/EncKrbCredPart.java
index 5fc5c9f..7015577 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/EncKrbCredPart.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/EncKrbCredPart.java
@@ -40,7 +40,7 @@
 /**
  * Implements the ASN.1 EncKrbCredPart type.
  *
- * <xmp>
+ * <pre>{@code
  * EncKrbCredPart  ::= [APPLICATION 29] SEQUENCE {
  *         ticket-info     [0] SEQUENCE OF KrbCredInfo,
  *         nonce           [1] UInt32 OPTIONAL,
@@ -49,7 +49,7 @@
  *         s-address       [4] HostAddress OPTIONAL,
  *         r-address       [5] HostAddress OPTIONAL
  *   }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/EncKrbPrivPart.java b/jdk/src/share/classes/sun/security/krb5/internal/EncKrbPrivPart.java
index a3cb42c..3c0eecf 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/EncKrbPrivPart.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/EncKrbPrivPart.java
@@ -38,7 +38,7 @@
 /**
  * Implements the ASN.1 EncKrbPrivPart type.
  *
- * <xmp>
+ * <pre>{@code
  * EncKrbPrivPart  ::= [APPLICATION 28] SEQUENCE {
  *         user-data       [0] OCTET STRING,
  *         timestamp       [1] KerberosTime OPTIONAL,
@@ -47,7 +47,7 @@
  *         s-address       [4] HostAddress -- sender's addr --,
  *         r-address       [5] HostAddress OPTIONAL -- recip's addr
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/EncTicketPart.java b/jdk/src/share/classes/sun/security/krb5/internal/EncTicketPart.java
index 3b43f60..eba8721 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/EncTicketPart.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/EncTicketPart.java
@@ -39,7 +39,7 @@
 /**
  * Implements the ASN.1 EncTicketPart type.
  *
- * <xmp>
+ * <pre>{@code
  * EncTicketPart   ::= [APPLICATION 3] SEQUENCE {
  *         flags                   [0] TicketFlags,
  *         key                     [1] EncryptionKey,
@@ -53,7 +53,7 @@
  *         caddr                   [9] HostAddresses OPTIONAL,
  *         authorization-data      [10] AuthorizationData OPTIONAL
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/HostAddress.java b/jdk/src/share/classes/sun/security/krb5/internal/HostAddress.java
index 77e00a0..e63d719 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/HostAddress.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/HostAddress.java
@@ -44,12 +44,12 @@
 /**
  * Implements the ASN.1 HostAddress type.
  *
- * <xmp>
+ * <pre>{@code
  * HostAddress     ::= SEQUENCE  {
  *         addr-type       [0] Int32,
  *         address         [1] OCTET STRING
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
@@ -132,7 +132,7 @@
     /**
      * Gets the InetAddress of this HostAddress.
      * @return the IP address for this specified host.
-     * @exception if no IP address for the host could be found.
+     * @exception UnknownHostException if no IP address for the host could be found.
      *
      */
     public InetAddress getInetAddress() throws UnknownHostException {
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/HostAddresses.java b/jdk/src/share/classes/sun/security/krb5/internal/HostAddresses.java
index 38bb6a3..56dacda 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/HostAddresses.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/HostAddresses.java
@@ -45,7 +45,7 @@
 /**
  * Implements the ASN.1 HostAddresses type.
  *
- * <xmp>
+ * <pre>{@code
  * HostAddresses   -- NOTE: subtly different from rfc1510,
  *                 -- but has a value mapping and encodes the same
  *         ::= SEQUENCE OF HostAddress
@@ -54,7 +54,7 @@
  *         addr-type       [0] Int32,
  *         address         [1] OCTET STRING
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/KDCOptions.java b/jdk/src/share/classes/sun/security/krb5/internal/KDCOptions.java
index eb1b6f5..d9fdf43 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/KDCOptions.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KDCOptions.java
@@ -40,7 +40,7 @@
 /**
  * Implements the ASN.1 KDCOptions type.
  *
- * <xmp>
+ * <pre>{@code
  * KDCOptions   ::= KerberosFlags
  *      -- reserved(0),
  *      -- forwardable(1),
@@ -69,7 +69,7 @@
  *                      -- minimum number of bits shall be sent,
  *                      -- but no fewer than 32
  *
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
@@ -115,7 +115,7 @@
  * in the addresses field of the request.
  * <li>FORWARDED, PROXY, ENC_TKT_IN_SKEY, RENEW, VALIDATE are used only in
  * subsequent requests.
- * </ol><p>
+ * </ol>
  */
 
 public class KDCOptions extends KerberosFlags {
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/KDCRep.java b/jdk/src/share/classes/sun/security/krb5/internal/KDCRep.java
index 5c4ca1e..0548a1a 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/KDCRep.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KDCRep.java
@@ -38,7 +38,7 @@
 /**
  * Implements the ASN.1 KDC-REP type.
  *
- * <xmp>
+ * <pre>{@code
  * KDC-REP         ::= SEQUENCE {
  *         pvno            [0] INTEGER (5),
  *         msg-type        [1] INTEGER (11 -- AS -- | 13 -- TGS --),
@@ -51,7 +51,7 @@
  *                                   -- EncASRepPart or EncTGSRepPart,
  *                                   -- as appropriate
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/KDCReq.java b/jdk/src/share/classes/sun/security/krb5/internal/KDCReq.java
index 12d4107..39e226a 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/KDCReq.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KDCReq.java
@@ -39,7 +39,7 @@
 /**
  * Implements the ASN.1 KRB_KDC_REQ type.
  *
- * <xmp>
+ * <pre>{@code
  * KDC-REQ              ::= SEQUENCE {
  *      -- NOTE: first tag is [1], not [0]
  *      pvno            [1] INTEGER (5) ,
@@ -48,7 +48,7 @@
  *                            -- NOTE: not empty --,
  *      req-body        [4] KDC-REQ-BODY
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
@@ -95,7 +95,7 @@
      * @param req_type a encoded asn1 type value.
      * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
      * @exception IOException if an I/O error occurs while reading encoded data.
-     * @exceptoin KrbErrException
+     * @exception KrbErrException
      */
     public KDCReq(DerValue der, int req_type) throws Asn1Exception,
             IOException, KrbException {
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/KDCReqBody.java b/jdk/src/share/classes/sun/security/krb5/internal/KDCReqBody.java
index 83178b6..43444b5 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/KDCReqBody.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KDCReqBody.java
@@ -39,7 +39,7 @@
 /**
  * Implements the ASN.1 KDC-REQ-BODY type.
  *
- * <xmp>
+ * <pre>{@code
  * KDC-REQ-BODY ::= SEQUENCE {
  *      kdc-options             [0] KDCOptions,
  *      cname                   [1] PrincipalName OPTIONAL
@@ -60,7 +60,7 @@
  *      additional-tickets      [11] SEQUENCE OF Ticket OPTIONAL
  *                                       -- NOTE: not empty
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/KRBCred.java b/jdk/src/share/classes/sun/security/krb5/internal/KRBCred.java
index ff719f4..5ebe985 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/KRBCred.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KRBCred.java
@@ -41,14 +41,14 @@
 /**
  * Implements the ASN.1 Authenticator type.
  *
- * <xmp>
+ * <pre>{@code
  * KRB-CRED     ::= [APPLICATION 22] SEQUENCE {
  *      pvno            [0] INTEGER (5),
  *      msg-type        [1] INTEGER (22),
  *      tickets         [2] SEQUENCE OF Ticket,
  *      enc-part        [3] EncryptedData -- EncKrbCredPart
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java b/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java
index 5b51706..7c8a2a1 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java
@@ -48,7 +48,7 @@
 /**
  * Implements the ASN.1 KRBError type.
  *
- * <xmp>
+ * <pre>{@code
  * KRB-ERROR       ::= [APPLICATION 30] SEQUENCE {
  *         pvno            [0] INTEGER (5),
  *         msg-type        [1] INTEGER (30),
@@ -71,7 +71,7 @@
  *         data-type       [0] Int32,
  *         data-value      [1] OCTET STRING OPTIONAL
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/KRBPriv.java b/jdk/src/share/classes/sun/security/krb5/internal/KRBPriv.java
index f0867ef..09adfe3 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/KRBPriv.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KRBPriv.java
@@ -39,14 +39,14 @@
 /**
  * Implements the ASN.1 KRB-PRIV type.
  *
- * <xmp>
+ * <pre>{@code
  * KRB-PRIV        ::= [APPLICATION 21] SEQUENCE {
  *         pvno            [0] INTEGER (5),
  *         msg-type        [1] INTEGER (21),
  *                           -- NOTE: there is no [2] tag
  *         enc-part        [3] EncryptedData -- EncKrbPrivPart
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/KRBSafe.java b/jdk/src/share/classes/sun/security/krb5/internal/KRBSafe.java
index 52da89a..c9e8553 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/KRBSafe.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KRBSafe.java
@@ -40,14 +40,14 @@
 /**
  * Implements the ASN.1 KRBSafe type.
  *
- * <xmp>
+ * <pre>{@code
  * KRB-SAFE        ::= [APPLICATION 20] SEQUENCE {
  *         pvno            [0] INTEGER (5),
  *         msg-type        [1] INTEGER (20),
  *         safe-body       [2] KRB-SAFE-BODY,
  *         cksum           [3] Checksum
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/KRBSafeBody.java b/jdk/src/share/classes/sun/security/krb5/internal/KRBSafeBody.java
index 1418765..d8b331c 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/KRBSafeBody.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KRBSafeBody.java
@@ -39,7 +39,7 @@
 /**
  * Implements the ASN.1 KRBSafeBody type.
  *
- * <xmp>
+ * <pre>{@code
  * KRB-SAFE-BODY   ::= SEQUENCE {
  *         user-data       [0] OCTET STRING,
  *         timestamp       [1] KerberosTime OPTIONAL,
@@ -48,7 +48,7 @@
  *         s-address       [4] HostAddress,
  *         r-address       [5] HostAddress OPTIONAL
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/KerberosTime.java b/jdk/src/share/classes/sun/security/krb5/internal/KerberosTime.java
index 64225c8..ec40930 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/KerberosTime.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KerberosTime.java
@@ -46,9 +46,7 @@
 /**
  * Implements the ASN.1 KerberosTime type. This is an immutable class.
  *
- * <xmp>
- * KerberosTime    ::= GeneralizedTime -- with no fractional seconds
- * </xmp>
+ * {@code KerberosTime ::= GeneralizedTime} -- with no fractional seconds
  *
  * The timestamps used in Kerberos are encoded as GeneralizedTimes. A
  * KerberosTime value shall not include any fractional portions of the
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/KrbCredInfo.java b/jdk/src/share/classes/sun/security/krb5/internal/KrbCredInfo.java
index 18fa741..2b532b8 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/KrbCredInfo.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KrbCredInfo.java
@@ -38,7 +38,7 @@
 /**
  * Implements the ASN.1 KrbCredInfo type.
  *
- * <xmp>
+ * <pre>{@code
  * KrbCredInfo  ::= SEQUENCE {
  *      key             [0] EncryptionKey,
  *      prealm          [1] Realm OPTIONAL,
@@ -52,7 +52,7 @@
  *      sname           [9] PrincipalName OPTIONAL,
  *      caddr           [10] HostAddresses OPTIONAL
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/LastReq.java b/jdk/src/share/classes/sun/security/krb5/internal/LastReq.java
index 45ff8a8..9e160b0 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/LastReq.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/LastReq.java
@@ -38,12 +38,12 @@
 /**
  * Implements the ASN.1 LastReq type.
  *
- * <xmp>
+ * <pre>{@code
  * LastReq         ::=     SEQUENCE OF SEQUENCE {
  *         lr-type         [0] Int32,
  *         lr-value        [1] KerberosTime
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/LoginOptions.java b/jdk/src/share/classes/sun/security/krb5/internal/LoginOptions.java
index 1283397..76bc174 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/LoginOptions.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/LoginOptions.java
@@ -36,7 +36,7 @@
 /**
  * Implements the ASN.1 KDCOptions type.
  *
- * <xmp>
+ * <pre>{@code
  * KDCOptions   ::= KerberosFlags
  *      -- reserved(0),
  *      -- forwardable(1),
@@ -64,7 +64,7 @@
  * KerberosFlags ::= BIT STRING (SIZE (32..MAX))
  *                   -- minimum number of bits shall be sent,
  *                   -- but no fewer than 32
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/MethodData.java b/jdk/src/share/classes/sun/security/krb5/internal/MethodData.java
index ef29461..d700410 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/MethodData.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/MethodData.java
@@ -38,12 +38,12 @@
 /**
  * Implements the ASN.1 EncKrbPrivPart type.
  *
- * <xmp>
+ * <pre>{@code
  *     METHOD-DATA ::=    SEQUENCE {
  *                        method-type[0]   INTEGER,
  *                        method-data[1]   OCTET STRING OPTIONAL
  *  }
- * </xmp>
+ * }</pre>
  */
 public class MethodData {
     private int methodType;
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/PAData.java b/jdk/src/share/classes/sun/security/krb5/internal/PAData.java
index fd1429a..001a483 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/PAData.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/PAData.java
@@ -43,13 +43,13 @@
 /**
  * Implements the ASN.1 PA-DATA type.
  *
- * <xmp>
+ * <pre>{@code
  * PA-DATA         ::= SEQUENCE {
  *         -- NOTE: first tag is [1], not [0]
  *         padata-type     [1] Int32,
  *         padata-value    [2] OCTET STRING -- might be encoded AP-REQ
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
@@ -179,11 +179,14 @@
 
     /**
      * Gets the preferred etype from the PAData array.
-     * 1. ETYPE-INFO2-ENTRY with unknown s2kparams ignored
-     * 2. ETYPE-INFO2 preferred to ETYPE-INFO
-     * 3. multiple entries for same etype in one PA-DATA, use the first one.
-     * 4. Multiple PA-DATA with same type, choose the last one
+     * <ol>
+     * <li>ETYPE-INFO2-ENTRY with unknown s2kparams ignored</li>
+     * <li>ETYPE-INFO2 preferred to ETYPE-INFO</li>
+     * <li>Multiple entries for same etype in one PA-DATA, use the first one.</li>
+     * <li>Multiple PA-DATA with same type, choose the last one.</li>
+     * </ol>
      * (This is useful when PA-DATAs from KRB-ERROR and AS-REP are combined).
+     *
      * @return the etype, or defaultEType if not enough info
      * @throws Asn1Exception|IOException if there is an encoding error
      */
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/PAEncTSEnc.java b/jdk/src/share/classes/sun/security/krb5/internal/PAEncTSEnc.java
index 8337564..1955434 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/PAEncTSEnc.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/PAEncTSEnc.java
@@ -38,12 +38,12 @@
 /**
  * Implements the ASN.1 PAEncTSEnc type.
  *
- * <xmp>
+ * <pre>{@code
  * PA-ENC-TS-ENC                ::= SEQUENCE {
  *      patimestamp     [0] KerberosTime -- client's time --,
  *      pausec          [1] Microseconds OPTIONAL
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/PAForUserEnc.java b/jdk/src/share/classes/sun/security/krb5/internal/PAForUserEnc.java
index 91e26a0..ac8db4f 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/PAForUserEnc.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/PAForUserEnc.java
@@ -36,7 +36,7 @@
 /**
  * Implements the ASN.1 PA-FOR-USER type.
  *
- * <xmp>
+ * <pre>{@code
  * padata-type  ::= PA-FOR-USER
  *                  -- value 129
  * padata-value ::= EncryptedData
@@ -47,7 +47,7 @@
  *     cksum[2] Checksum,
  *     auth-package[3] KerberosString
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects MS-SFU.
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/Ticket.java b/jdk/src/share/classes/sun/security/krb5/internal/Ticket.java
index 0f1c3d9..d279d14 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/Ticket.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/Ticket.java
@@ -42,14 +42,14 @@
 /**
  * Implements the ASN.1 Ticket type.
  *
- * <xmp>
+ * <pre>{@code
  * Ticket               ::= [APPLICATION 1] SEQUENCE {
  *      tkt-vno         [0] INTEGER (5),
  *      realm           [1] Realm,
  *      sname           [2] PrincipalName,
  *      enc-part        [3] EncryptedData -- EncTicketPart
  * }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/TransitedEncoding.java b/jdk/src/share/classes/sun/security/krb5/internal/TransitedEncoding.java
index fc33f9f..301d7c7 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/TransitedEncoding.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/TransitedEncoding.java
@@ -38,12 +38,12 @@
 /**
  * Implements the ASN.1 TransitedEncoding type.
  *
- * <xmp>
+ * <pre>{@code
  *  TransitedEncoding      ::= SEQUENCE {
  *         tr-type         [0] Int32 -- must be registered --,
  *         contents        [1] OCTET STRING
  *  }
- * </xmp>
+ * }</pre>
  *
  * <p>
  * This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/crypto/Des.java b/jdk/src/share/classes/sun/security/krb5/internal/crypto/Des.java
index 73dbc55..2eb0f78 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/crypto/Des.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/crypto/Des.java
@@ -226,7 +226,7 @@
 
     /**
      * Generates DES key from the password.
-     * @param password a char[] used to create the key.
+     * @param passwdChars a char[] used to create the key.
      * @return DES key.
      *
      * @modified by Yanni Zhang, Dec 6, 99
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/crypto/DesMacCksumType.java b/jdk/src/share/classes/sun/security/krb5/internal/crypto/DesMacCksumType.java
index 2e11a20..0d9310f 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/crypto/DesMacCksumType.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/crypto/DesMacCksumType.java
@@ -121,7 +121,7 @@
      * @param data the data.
      * @param size the length of data.
      * @param key the key used to encrypt the checksum.
-     * @param checksum
+     * @param checksum the checksum.
      * @return true if verification is successful.
      *
      * @modified by Yanni Zhang, 12/08/99.
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/crypto/HmacMd5ArcFourCksumType.java b/jdk/src/share/classes/sun/security/krb5/internal/crypto/HmacMd5ArcFourCksumType.java
index 41388ec8..5ce9fa1 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/crypto/HmacMd5ArcFourCksumType.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/crypto/HmacMd5ArcFourCksumType.java
@@ -89,7 +89,7 @@
      * @param data the data.
      * @param size the length of data.
      * @param key the key used to encrypt the checksum.
-     * @param checksum
+     * @param checksum the checksum.
      * @return true if verification is successful.
      */
     public boolean verifyChecksum(byte[] data, int size,
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes128CksumType.java b/jdk/src/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes128CksumType.java
index a16941c..bb06f97 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes128CksumType.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes128CksumType.java
@@ -89,7 +89,7 @@
      * @param data the data.
      * @param size the length of data.
      * @param key the key used to encrypt the checksum.
-     * @param checksum
+     * @param checksum the checksum.
      * @return true if verification is successful.
      */
     public boolean verifyChecksum(byte[] data, int size,
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes256CksumType.java b/jdk/src/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes256CksumType.java
index 9ce9347..f84bedd 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes256CksumType.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes256CksumType.java
@@ -89,7 +89,7 @@
      * @param data the data.
      * @param size the length of data.
      * @param key the key used to encrypt the checksum.
-     * @param checksum
+     * @param checksum the checksum.
      * @return true if verification is successful.
      */
     public boolean verifyChecksum(byte[] data, int size,
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/crypto/HmacSha1Des3KdCksumType.java b/jdk/src/share/classes/sun/security/krb5/internal/crypto/HmacSha1Des3KdCksumType.java
index 81e4420..56cce80 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/crypto/HmacSha1Des3KdCksumType.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/crypto/HmacSha1Des3KdCksumType.java
@@ -83,7 +83,7 @@
      * @param data the data.
      * @param size the length of data.
      * @param key the key used to encrypt the checksum.
-     * @param checksum
+     * @param checksum the checksum.
      * @return true if verification is successful.
      */
     public boolean verifyChecksum(byte[] data, int size,
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/crypto/RsaMd5DesCksumType.java b/jdk/src/share/classes/sun/security/krb5/internal/crypto/RsaMd5DesCksumType.java
index 0d55aed..29d3339 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/crypto/RsaMd5DesCksumType.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/crypto/RsaMd5DesCksumType.java
@@ -116,7 +116,7 @@
      * @param data the data.
      * @param size the length of data.
      * @param key the key used to encrypt the checksum.
-     * @param checksum
+     * @param checksum the checksum.
      * @return true if verification is successful.
      *
      * @modified by Yanni Zhang, 12/08/99.
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java b/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java
index 5da7bc6..53dd8cc 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java
@@ -513,7 +513,7 @@
     /**
      * Creates key table file version.
      * @param file the key table file.
-     * @exception IOException.
+     * @exception IOException
      */
     public synchronized void createVersion(File file) throws IOException {
         try (KeyTabOutputStream kos =
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/rcache/AuthList.java b/jdk/src/share/classes/sun/security/krb5/internal/rcache/AuthList.java
index c978417..24a0db2 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/rcache/AuthList.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/rcache/AuthList.java
@@ -45,7 +45,7 @@
  * self-cleanup of expired items in the cache.
  *
  * AuthTimeWithHash objects inside a cache are always sorted from big (new) to
- * small (old) as determined by {@see AuthTimeWithHash#compareTo}. In the most
+ * small (old) as determined by {@link AuthTimeWithHash#compareTo}. In the most
  * common case a newcomer should be newer than the first element.
  *
  * @author Yanni Zhang
diff --git a/jdk/src/share/classes/sun/security/pkcs11/wrapper/CK_CREATEMUTEX.java b/jdk/src/share/classes/sun/security/pkcs11/wrapper/CK_CREATEMUTEX.java
index 29dd095..2721fb1 100644
--- a/jdk/src/share/classes/sun/security/pkcs11/wrapper/CK_CREATEMUTEX.java
+++ b/jdk/src/share/classes/sun/security/pkcs11/wrapper/CK_CREATEMUTEX.java
@@ -50,17 +50,16 @@
 
 
 /**
- * interface CK_CREATEMUTEX.<p>
+ * interface CK_CREATEMUTEX.
  *
- * @author Karl Scheibelhofer <Karl.Scheibelhofer@iaik.at>
- * @author Martin Schlaeffer <schlaeff@sbox.tugraz.at>
+ * @author Karl Scheibelhofer &lt;Karl.Scheibelhofer@iaik.at&gt;
+ * @author Martin Schlaeffer &lt;schlaeff@sbox.tugraz.at&gt;
  */
 public interface CK_CREATEMUTEX {
 
     /**
      * Method CK_CREATEMUTEX
      *
-     * @param ppMutex
      * @return The mutex (lock) object.
      * @exception PKCS11Exception
      */
diff --git a/jdk/src/solaris/classes/sun/java2d/xr/XRDrawLine.java b/jdk/src/solaris/classes/sun/java2d/xr/XRDrawLine.java
index 66b595e..d4170c4 100644
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRDrawLine.java
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRDrawLine.java
@@ -224,7 +224,7 @@
         outcode2 = outcode(x2, y2, cxmin, cymin, cxmax, cymax);
 
         while ((outcode1 | outcode2) != 0) {
-            int xsteps = 0, ysteps = 0;
+            long xsteps = 0, ysteps = 0;
 
             if ((outcode1 & outcode2) != 0) {
                 return false;
diff --git a/jdk/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java b/jdk/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java
index eec35ea..53f2902 100644
--- a/jdk/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java
+++ b/jdk/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java
@@ -40,6 +40,7 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
+import sun.misc.Unsafe;
 
 /**
  * A multi-threaded implementation of Selector for Windows.
@@ -49,12 +50,26 @@
  */
 
 final class WindowsSelectorImpl extends SelectorImpl {
+    private static final Unsafe unsafe = Unsafe.getUnsafe();
+    private static int addressSize = unsafe.addressSize();
+
+    private static int dependsArch(int value32, int value64) {
+        return (addressSize == 4) ? value32 : value64;
+    }
+
     // Initial capacity of the poll array
     private final int INIT_CAP = 8;
     // Maximum number of sockets for select().
     // Should be INIT_CAP times a power of 2
     private final static int MAX_SELECTABLE_FDS = 1024;
 
+    // Size of FD_SET struct to allocate a buffer for it in SubSelector,
+    // aligned to 8 bytes on 64-bit:
+    // struct { unsigned int fd_count; SOCKET fd_array[MAX_SELECTABLE_FDS]; }.
+    private static final long SIZEOF_FD_SET = dependsArch(
+            4 + MAX_SELECTABLE_FDS * 4,      // SOCKET = unsigned int
+            4 + MAX_SELECTABLE_FDS * 8 + 4); // SOCKET = unsigned __int64
+
     // The list of SelectableChannels serviced by this Selector. Every mod
     // MAX_SELECTABLE_FDS entry is bogus, to align this array with the poll
     // array,  where the corresponding entry is occupied by the wakeupSocket
@@ -283,6 +298,9 @@
         private final int[] readFds = new int [MAX_SELECTABLE_FDS + 1];
         private final int[] writeFds = new int [MAX_SELECTABLE_FDS + 1];
         private final int[] exceptFds = new int [MAX_SELECTABLE_FDS + 1];
+        // Buffer for readfds, writefds and exceptfds structs that are passed
+        // to native select().
+        private final long fdsBuffer = unsafe.allocateMemory(SIZEOF_FD_SET * 6);
 
         private SubSelector() {
             this.pollArrayIndex = 0; // main thread
@@ -295,7 +313,7 @@
         private int poll() throws IOException{ // poll for the main thread
             return poll0(pollWrapper.pollArrayAddress,
                          Math.min(totalChannels, MAX_SELECTABLE_FDS),
-                         readFds, writeFds, exceptFds, timeout);
+                         readFds, writeFds, exceptFds, timeout, fdsBuffer);
         }
 
         private int poll(int index) throws IOException {
@@ -304,11 +322,11 @@
                      (pollArrayIndex * PollArrayWrapper.SIZE_POLLFD),
                      Math.min(MAX_SELECTABLE_FDS,
                              totalChannels - (index + 1) * MAX_SELECTABLE_FDS),
-                     readFds, writeFds, exceptFds, timeout);
+                     readFds, writeFds, exceptFds, timeout, fdsBuffer);
         }
 
         private native int poll0(long pollAddress, int numfds,
-             int[] readFds, int[] writeFds, int[] exceptFds, long timeout);
+             int[] readFds, int[] writeFds, int[] exceptFds, long timeout, long fdsBuffer);
 
         private int processSelectedKeys(long updateCount) {
             int numKeysUpdated = 0;
@@ -400,6 +418,10 @@
             }
             return numKeysUpdated;
         }
+
+        private void freeFDSetBuffer() {
+            unsafe.freeMemory(fdsBuffer);
+        }
     }
 
     // Represents a helper thread used for select.
@@ -425,8 +447,10 @@
             while (true) { // poll loop
                 // wait for the start of poll. If this thread has become
                 // redundant, then exit.
-                if (startLock.waitForStart(this))
+                if (startLock.waitForStart(this)) {
+                    subSelector.freeFDSetBuffer();
                     return;
+                }
                 // call poll()
                 try {
                     subSelector.poll(index);
@@ -525,6 +549,7 @@
                     for (SelectThread t: threads)
                          t.makeZombie();
                     startLock.startThreads();
+                    subSelector.freeFDSetBuffer();
                 }
             }
         }
diff --git a/jdk/src/windows/classes/sun/security/krb5/internal/tools/Kinit.java b/jdk/src/windows/classes/sun/security/krb5/internal/tools/Kinit.java
index 5839a5e..0667286 100644
--- a/jdk/src/windows/classes/sun/security/krb5/internal/tools/Kinit.java
+++ b/jdk/src/windows/classes/sun/security/krb5/internal/tools/Kinit.java
@@ -59,26 +59,25 @@
      * We currently support only file-based credentials cache to
      * store the tickets obtained from the KDC.
      * By default, for all Unix platforms a cache file named
-     * /tmp/krb5cc_&lt;uid&gt will be generated. The &lt;uid&gt is the
+     * {@code /tmp/krb5cc_<uid>} will be generated. The {@code <uid>} is the
      * numeric user identifier.
      * For all other platforms, a cache file named
-     * &lt;USER_HOME&gt/krb5cc_&lt;USER_NAME&gt would be generated.
+     * {@code <USER_HOME>/krb5cc_<USER_NAME>} would be generated.
      * <p>
-     * &lt;USER_HOME&gt is obtained from <code>java.lang.System</code>
+     * {@code <USER_HOME>} is obtained from {@code java.lang.System}
      * property <i>user.home</i>.
-     * &lt;USER_NAME&gt is obtained from <code>java.lang.System</code>
+     * {@code <USER_NAME>} is obtained from {@code java.lang.System}
      * property <i>user.name</i>.
-     * If &lt;USER_HOME&gt is null the cache file would be stored in
+     * If {@code <USER_HOME>} is null the cache file would be stored in
      * the current directory that the program is running from.
-     * &lt;USER_NAME&gt is operating system's login username.
+     * {@code <USER_NAME>} is operating system's login username.
      * It could be different from user's principal name.
-     *</p>
-     *<p>
+     * <p>
      * For instance, on Windows NT, it could be
-     * c:\winnt\profiles\duke\krb5cc_duke, in
-     * which duke is the &lt;USER_NAME&gt, and c:\winnt\profile\duke is the
-     * &lt;USER_HOME&gt.
-     *<p>
+     * {@code c:\winnt\profiles\duke\krb5cc_duke}, in
+     * which duke is the {@code <USER_NAME>} and {@code c:\winnt\profile\duke} is the
+     * {@code <USER_HOME>}.
+     * <p>
      * A single user could have multiple principal names,
      * but the primary principal of the credentials cache could only be one,
      * which means one cache file could only store tickets for one
@@ -88,10 +87,8 @@
      * To avoid overwriting, you need to specify
      * a different cache file name when you request a
      * new ticket.
-     *</p>
-     *<p>
+     * <p>
      * You can specify the location of the cache file by using the -c option
-     *
      */
 
     public static void main(String[] args) {
diff --git a/jdk/src/windows/classes/sun/security/krb5/internal/tools/Klist.java b/jdk/src/windows/classes/sun/security/krb5/internal/tools/Klist.java
index 37f59ad..c8b70ff 100644
--- a/jdk/src/windows/classes/sun/security/krb5/internal/tools/Klist.java
+++ b/jdk/src/windows/classes/sun/security/krb5/internal/tools/Klist.java
@@ -71,8 +71,10 @@
      * <li><b>-n</b>  do not reverse-resolve addresses
      * </ul>
      * available options for keytabs:
+     * <ul>
      * <li><b>-t</b> shows keytab entry timestamps
      * <li><b>-K</b> shows keytab entry DES keys
+     * </ul>
      */
     public static void main(String[] args) {
         Klist klist = new Klist();
diff --git a/jdk/src/windows/native/sun/nio/ch/WindowsSelectorImpl.c b/jdk/src/windows/native/sun/nio/ch/WindowsSelectorImpl.c
index c43496a..6335849 100644
--- a/jdk/src/windows/native/sun/nio/ch/WindowsSelectorImpl.c
+++ b/jdk/src/windows/native/sun/nio/ch/WindowsSelectorImpl.c
@@ -38,6 +38,7 @@
 #include "jvm.h"
 #include "jni.h"
 #include "jni_util.h"
+#include "nio.h"
 #include "sun_nio_ch_WindowsSelectorImpl.h"
 #include "sun_nio_ch_PollArrayWrapper.h"
 
@@ -55,12 +56,14 @@
 Java_sun_nio_ch_WindowsSelectorImpl_00024SubSelector_poll0(JNIEnv *env, jobject this,
                                    jlong pollAddress, jint numfds,
                                    jintArray returnReadFds, jintArray returnWriteFds,
-                                   jintArray returnExceptFds, jlong timeout)
+                                   jintArray returnExceptFds, jlong timeout, jlong fdsBuffer)
 {
     DWORD result = 0;
     pollfd *fds = (pollfd *) pollAddress;
     int i;
-    FD_SET readfds, writefds, exceptfds;
+    FD_SET *readfds = (FD_SET *) jlong_to_ptr(fdsBuffer);
+    FD_SET *writefds = (FD_SET *) jlong_to_ptr(fdsBuffer + sizeof(FD_SET));
+    FD_SET *exceptfds = (FD_SET *) jlong_to_ptr(fdsBuffer + sizeof(FD_SET) * 2);
     struct timeval timevalue, *tv;
     static struct timeval zerotime = {0, 0};
     int read_count = 0, write_count = 0, except_count = 0;
@@ -82,66 +85,68 @@
     /* Set FD_SET structures required for select */
     for (i = 0; i < numfds; i++) {
         if (fds[i].events & POLLIN) {
-           readfds.fd_array[read_count] = fds[i].fd;
+           readfds->fd_array[read_count] = fds[i].fd;
            read_count++;
         }
         if (fds[i].events & (POLLOUT | POLLCONN))
         {
-           writefds.fd_array[write_count] = fds[i].fd;
+           writefds->fd_array[write_count] = fds[i].fd;
            write_count++;
         }
-        exceptfds.fd_array[except_count] = fds[i].fd;
+        exceptfds->fd_array[except_count] = fds[i].fd;
         except_count++;
     }
 
-    readfds.fd_count = read_count;
-    writefds.fd_count = write_count;
-    exceptfds.fd_count = except_count;
+    readfds->fd_count = read_count;
+    writefds->fd_count = write_count;
+    exceptfds->fd_count = except_count;
 
     /* Call select */
-    if ((result = select(0 , &readfds, &writefds, &exceptfds, tv))
+    if ((result = select(0 , readfds, writefds, exceptfds, tv))
                                                              == SOCKET_ERROR) {
         /* Bad error - this should not happen frequently */
         /* Iterate over sockets and call select() on each separately */
-        FD_SET errreadfds, errwritefds, errexceptfds;
-        readfds.fd_count = 0;
-        writefds.fd_count = 0;
-        exceptfds.fd_count = 0;
+        FD_SET *errreadfds = (FD_SET *) jlong_to_ptr(fdsBuffer + sizeof(FD_SET) * 3);
+        FD_SET *errwritefds = (FD_SET *) jlong_to_ptr(fdsBuffer + sizeof(FD_SET) * 4);
+        FD_SET *errexceptfds = (FD_SET *) jlong_to_ptr(fdsBuffer + sizeof(FD_SET) * 5);
+        readfds->fd_count = 0;
+        writefds->fd_count = 0;
+        exceptfds->fd_count = 0;
         for (i = 0; i < numfds; i++) {
             /* prepare select structures for the i-th socket */
-            errreadfds.fd_count = 0;
-            errwritefds.fd_count = 0;
+            errreadfds->fd_count = 0;
+            errwritefds->fd_count = 0;
             if (fds[i].events & POLLIN) {
-               errreadfds.fd_array[0] = fds[i].fd;
-               errreadfds.fd_count = 1;
+               errreadfds->fd_array[0] = fds[i].fd;
+               errreadfds->fd_count = 1;
             }
             if (fds[i].events & (POLLOUT | POLLCONN))
             {
-                errwritefds.fd_array[0] = fds[i].fd;
-                errwritefds.fd_count = 1;
+                errwritefds->fd_array[0] = fds[i].fd;
+                errwritefds->fd_count = 1;
             }
-            errexceptfds.fd_array[0] = fds[i].fd;
-            errexceptfds.fd_count = 1;
+            errexceptfds->fd_array[0] = fds[i].fd;
+            errexceptfds->fd_count = 1;
 
             /* call select on the i-th socket */
-            if (select(0, &errreadfds, &errwritefds, &errexceptfds, &zerotime)
+            if (select(0, errreadfds, errwritefds, errexceptfds, &zerotime)
                                                              == SOCKET_ERROR) {
                 /* This socket causes an error. Add it to exceptfds set */
-                exceptfds.fd_array[exceptfds.fd_count] = fds[i].fd;
-                exceptfds.fd_count++;
+                exceptfds->fd_array[exceptfds->fd_count] = fds[i].fd;
+                exceptfds->fd_count++;
             } else {
                 /* This socket does not cause an error. Process result */
-                if (errreadfds.fd_count == 1) {
-                    readfds.fd_array[readfds.fd_count] = fds[i].fd;
-                    readfds.fd_count++;
+                if (errreadfds->fd_count == 1) {
+                    readfds->fd_array[readfds->fd_count] = fds[i].fd;
+                    readfds->fd_count++;
                 }
-                if (errwritefds.fd_count == 1) {
-                    writefds.fd_array[writefds.fd_count] = fds[i].fd;
-                    writefds.fd_count++;
+                if (errwritefds->fd_count == 1) {
+                    writefds->fd_array[writefds->fd_count] = fds[i].fd;
+                    writefds->fd_count++;
                 }
-                if (errexceptfds.fd_count == 1) {
-                    exceptfds.fd_array[exceptfds.fd_count] = fds[i].fd;
-                    exceptfds.fd_count++;
+                if (errexceptfds->fd_count == 1) {
+                    exceptfds->fd_array[exceptfds->fd_count] = fds[i].fd;
+                    exceptfds->fd_count++;
                 }
             }
         }
@@ -151,34 +156,34 @@
     /* Each Java array consists of sockets count followed by sockets list */
 
 #ifdef _WIN64
-    resultbuf[0] = readfds.fd_count;
-    for (i = 0; i < (int)readfds.fd_count; i++) {
-        resultbuf[i + 1] = (int)readfds.fd_array[i];
+    resultbuf[0] = readfds->fd_count;
+    for (i = 0; i < (int)readfds->fd_count; i++) {
+        resultbuf[i + 1] = (int)readfds->fd_array[i];
     }
     (*env)->SetIntArrayRegion(env, returnReadFds, 0,
-                              readfds.fd_count + 1, resultbuf);
+                              readfds->fd_count + 1, resultbuf);
 
-    resultbuf[0] = writefds.fd_count;
-    for (i = 0; i < (int)writefds.fd_count; i++) {
-        resultbuf[i + 1] = (int)writefds.fd_array[i];
+    resultbuf[0] = writefds->fd_count;
+    for (i = 0; i < (int)writefds->fd_count; i++) {
+        resultbuf[i + 1] = (int)writefds->fd_array[i];
     }
     (*env)->SetIntArrayRegion(env, returnWriteFds, 0,
-                              writefds.fd_count + 1, resultbuf);
+                              writefds->fd_count + 1, resultbuf);
 
-    resultbuf[0] = exceptfds.fd_count;
-    for (i = 0; i < (int)exceptfds.fd_count; i++) {
-        resultbuf[i + 1] = (int)exceptfds.fd_array[i];
+    resultbuf[0] = exceptfds->fd_count;
+    for (i = 0; i < (int)exceptfds->fd_count; i++) {
+        resultbuf[i + 1] = (int)exceptfds->fd_array[i];
     }
     (*env)->SetIntArrayRegion(env, returnExceptFds, 0,
-                              exceptfds.fd_count + 1, resultbuf);
+                              exceptfds->fd_count + 1, resultbuf);
 #else
     (*env)->SetIntArrayRegion(env, returnReadFds, 0,
-                              readfds.fd_count + 1, (jint *)&readfds);
+                              readfds->fd_count + 1, (jint *)readfds);
 
     (*env)->SetIntArrayRegion(env, returnWriteFds, 0,
-                              writefds.fd_count + 1, (jint *)&writefds);
+                              writefds->fd_count + 1, (jint *)writefds);
     (*env)->SetIntArrayRegion(env, returnExceptFds, 0,
-                              exceptfds.fd_count + 1, (jint *)&exceptfds);
+                              exceptfds->fd_count + 1, (jint *)exceptfds);
 #endif
     return 0;
 }
diff --git a/jdk/test/com/sun/crypto/provider/Cipher/PBE/TestCipherPBECons.java b/jdk/test/com/sun/crypto/provider/Cipher/PBE/TestCipherPBECons.java
index c429523..e316706 100644
--- a/jdk/test/com/sun/crypto/provider/Cipher/PBE/TestCipherPBECons.java
+++ b/jdk/test/com/sun/crypto/provider/Cipher/PBE/TestCipherPBECons.java
@@ -36,7 +36,6 @@
  * @author Yun Ke
  * @author Bill Situ
  * @author Yu-Ching (Valerie) PENG
- * @run main TestCipherKeyWrapperPBEKey
  */
 public class TestCipherPBECons {
 
diff --git a/jdk/test/java/awt/Graphics/DrawLineTest.java b/jdk/test/java/awt/Graphics/DrawLineTest.java
new file mode 100644
index 0000000..4f1da52
--- /dev/null
+++ b/jdk/test/java/awt/Graphics/DrawLineTest.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2020, 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
+  @key headful
+  @bug 8235904
+  @run main/othervm/timeout=60 DrawLineTest
+*/
+
+import java.awt.EventQueue;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Image;
+
+public class DrawLineTest extends Frame {
+
+    volatile static boolean done = false;
+
+    public static void main(String[] args) throws Exception {
+
+        EventQueue.invokeLater(() -> {
+           DrawLineTest frame = new DrawLineTest();
+           frame.setVisible(true);
+           Image img = frame.createVolatileImage(1000, 1000);
+           img.getGraphics().drawLine(0, 0, 34005, 34005);
+           done = true;
+           frame.setVisible(false);
+           frame.dispose();
+           return;
+        });
+
+        int cnt=0;
+        while (!done && (cnt++ < 60)) {
+            try {
+               Thread.sleep(1000);
+            } catch (InterruptedException e) {
+            }
+        }
+
+        if (!done) {
+           // jtreg will shutdown the test properly
+           if ((System.getProperty("test.src") != null)) {
+               throw new RuntimeException("Test Failed");
+           } else {
+               // Not to be used in jtreg
+               System.out.println("Test failed.");
+               Runtime.getRuntime().halt(-1);
+           }
+        }
+        return;
+    }
+}
diff --git a/jdk/test/java/nio/channels/Selector/StackOverflowTest.java b/jdk/test/java/nio/channels/Selector/StackOverflowTest.java
new file mode 100644
index 0000000..9ca0a67
--- /dev/null
+++ b/jdk/test/java/nio/channels/Selector/StackOverflowTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2019, Red Hat, Inc. and/or its affiliates.
+ * 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 8216472
+ * @summary native call in WindowsSelectorImpl.SubSelector.poll can use
+ *     more stack space than available in a shadow zone, this can cause
+ *     a crash if selector is called from a deep recursive java call
+ * @requires (os.family == "windows")
+ */
+
+import java.nio.channels.Selector;
+
+public class StackOverflowTest {
+
+    public static void main(String[] args) throws Exception {
+        try (Selector sel = Selector.open()) {
+            recursiveSelect(sel);
+        } catch (StackOverflowError e) {
+            // ignore SOE from java calls
+        }
+    }
+
+    static void recursiveSelect(Selector sel) throws Exception {
+        sel.selectNow();
+        recursiveSelect(sel);
+    }
+}
diff --git a/jdk/test/javax/xml/crypto/dsig/GenerationTests.java b/jdk/test/javax/xml/crypto/dsig/GenerationTests.java
index b6f284b..1a2184a 100644
--- a/jdk/test/javax/xml/crypto/dsig/GenerationTests.java
+++ b/jdk/test/javax/xml/crypto/dsig/GenerationTests.java
@@ -24,7 +24,7 @@
 /**
  * @test
  * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184
- * 8038349 8046724 8074784 8210736
+ * 8038349 8046724 8074784 8079693 8210736
  * @summary Basic unit tests for generating XML Signatures with JSR 105
  * @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java
  *     X509KeySelector.java GenerationTests.java
@@ -101,7 +101,8 @@
                                    rsaSha256, rsaSha384, rsaSha512,
                                    ecdsaSha1;
     private static DigestMethod sha1, sha256, sha384, sha512;
-    private static KeyInfo dsa1024, dsa2048, rsa, rsa1024, p256ki;
+    private static KeyInfo dsa1024, dsa2048, rsa, rsa1024,
+                           p256ki, p384ki, p521ki;
     private static KeySelector kvks = new KeySelectors.KeyValueKeySelector();
     private static KeySelector sks;
     private static Key signingKey;
@@ -210,6 +211,8 @@
         test_create_signature_enveloping_hmac_sha512();
         test_create_signature_enveloping_rsa();
         test_create_signature_enveloping_p256_sha1();
+        test_create_signature_enveloping_p384_sha1();
+        test_create_signature_enveloping_p521_sha1();
         test_create_signature_external_b64_dsa();
         test_create_signature_external_dsa();
         test_create_signature_keyname();
@@ -356,7 +359,11 @@
         rsa1024 = kifac.newKeyInfo(Collections.singletonList
             (kifac.newKeyValue(getPublicKey("RSA", 1024))));
         p256ki = kifac.newKeyInfo(Collections.singletonList
-            (kifac.newKeyValue(getECPublicKey())));
+            (kifac.newKeyValue(getECPublicKey("P256"))));
+        p384ki = kifac.newKeyInfo(Collections.singletonList
+            (kifac.newKeyValue(getECPublicKey("P384"))));
+        p521ki = kifac.newKeyInfo(Collections.singletonList
+            (kifac.newKeyValue(getECPublicKey("P521"))));
         rsaSha1 = fac.newSignatureMethod(SignatureMethod.RSA_SHA1, null);
         rsaSha256 = fac.newSignatureMethod
             ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", null);
@@ -529,7 +536,21 @@
     static void test_create_signature_enveloping_p256_sha1() throws Exception {
         System.out.println("* Generating signature-enveloping-p256-sha1.xml");
         test_create_signature_enveloping(sha1, ecdsaSha1, p256ki,
-            getECPrivateKey(), kvks, false);
+            getECPrivateKey("P256"), kvks, false);
+        System.out.println();
+    }
+
+    static void test_create_signature_enveloping_p384_sha1() throws Exception {
+        System.out.println("* Generating signature-enveloping-p384-sha1.xml");
+        test_create_signature_enveloping(sha1, ecdsaSha1, p384ki,
+            getECPrivateKey("P384"), kvks, false);
+        System.out.println();
+    }
+
+    static void test_create_signature_enveloping_p521_sha1() throws Exception {
+        System.out.println("* Generating signature-enveloping-p521-sha1.xml");
+        test_create_signature_enveloping(sha1, ecdsaSha1, p521ki,
+            getECPrivateKey("P521"), kvks, false);
         System.out.println();
     }
 
@@ -1546,37 +1567,63 @@
         "237008997971129772408397621801631622129297063463868593083106979716" +
         "204903524890556839550490384015324575598723478554854070823335021842" +
         "210112348400928769";
-    private static final String EC_X =
+    private static final String EC_P256_X =
         "335863644451761614592446380116804721648611739647823420286081723541" +
         "6166183710";
-    private static final String EC_Y =
+    private static final String EC_P256_Y =
         "951559601159729477487064127150143688502130342917782252098602422796" +
         "95457910701";
-    private static final String EC_S =
+    private static final String EC_P256_S =
         "425976209773168452211813225517384419928639977904006759709292218082" +
         "7440083936";
-    private static final ECParameterSpec EC_PARAMS;
+    private static final ECParameterSpec EC_P256_PARAMS = initECParams(
+        "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF",
+        "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC",
+        "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B",
+        "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296",
+        "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",
+        "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551",
+        1
+    );
+    private static final String EC_P384_X =
+        "12144058647679082341340699736608428955270957565259459672517275506071643671835484144490620216582303669654008841724053";
+    private static final String EC_P384_Y =
+        "18287745972107701566600963632634101287058332546756092926848497481238534346489545826483592906634896557151987868614320";
+    private static final String EC_P384_S =
+        "10307785759830534742680442271492590599236624208247590184679565032330507874096079979152605984203102224450595283943382";
+    private static final ECParameterSpec EC_P384_PARAMS = initECParams(
+        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF",
+        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC",
+        "B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF",
+        "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7",
+        "3617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A147CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F",
+        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973",
+        1
+    );
+    private static final String EC_P521_X =
+        "4157918188927862838251799402582135611021257663417126086145819679867926857146776190737187582274664373117054717389603317411991660346043842712448912355335343997";
+    private static final String EC_P521_Y =
+        "4102838062751704796157456866854813794620023146924181568434486703918224542844053923233919899911519054998554969832861957437850996213216829205401947264294066288";
+    private static final String EC_P521_S =
+        "4857798533181496041050215963883119936300918353498701880968530610687256097257307590162398707429640390843595868713096292822034014722985178583665959048714417342";
+    private static final ECParameterSpec EC_P521_PARAMS = initECParams(
+        "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
+        "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC",
+        "0051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00",
+        "00C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66",
+        "011839296A789A3BC0045C8A5FB42C7D1BD998F54449579B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C7086A272C24088BE94769FD16650",
+        "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409",
+        1
+    );
 
-    static {
-        final String ec_sfield, ec_a, ec_b, ec_gx, ec_gy, ec_n;
-        ec_sfield =
-            "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF";
-        ec_a =
-            "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC";
-        ec_b =
-            "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B";
-        ec_gx =
-            "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296";
-        ec_gy =
-            "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5";
-        ec_n =
-            "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551";
-        final int ec_h = 1;
-        final ECField ec_field = new ECFieldFp(bigInt(ec_sfield));
-        final EllipticCurve ec_curve = new EllipticCurve(ec_field,
-                                                bigInt(ec_a), bigInt(ec_b));
-        final ECPoint ec_g = new ECPoint(bigInt(ec_gx), bigInt(ec_gy));
-        EC_PARAMS = new ECParameterSpec(ec_curve, ec_g, bigInt(ec_n), ec_h);
+    private static ECParameterSpec initECParams(
+            String sfield, String a, String b, String gx, String gy,
+            String n, int h) {
+        ECField field = new ECFieldFp(bigInt(sfield));
+        EllipticCurve curve = new EllipticCurve(field,
+                                                bigInt(a), bigInt(b));
+        ECPoint g = new ECPoint(bigInt(gx), bigInt(gy));
+        return new ECParameterSpec(curve, g, bigInt(n), h);
     }
 
     private static BigInteger bigInt(String s) {
@@ -1610,11 +1657,32 @@
         return kf.generatePublic(kspec);
     }
 
-    private static PublicKey getECPublicKey() throws Exception {
+    private static PublicKey getECPublicKey(String curve) throws Exception {
         KeyFactory kf = KeyFactory.getInstance("EC");
-        KeySpec kspec = new ECPublicKeySpec(new ECPoint(new BigInteger(EC_X),
-                                                        new BigInteger(EC_Y)),
-                                            EC_PARAMS);
+        String x, y;
+        ECParameterSpec params;
+        switch (curve) {
+            case "P256":
+                x = EC_P256_X;
+                y = EC_P256_Y;
+                params = EC_P256_PARAMS;
+                break;
+            case "P384":
+                x = EC_P384_X;
+                y = EC_P384_Y;
+                params = EC_P384_PARAMS;
+                break;
+            case "P521":
+                x = EC_P521_X;
+                y = EC_P521_Y;
+                params = EC_P521_PARAMS;
+                break;
+            default:
+                throw new Exception("Unsupported curve: " + curve);
+        }
+        KeySpec kspec = new ECPublicKeySpec(new ECPoint(new BigInteger(x),
+                                                        new BigInteger(y)),
+                                            params);
         return kf.generatePublic(kspec);
     }
 
@@ -1644,9 +1712,27 @@
         return kf.generatePrivate(kspec);
     }
 
-    private static PrivateKey getECPrivateKey() throws Exception {
+    private static PrivateKey getECPrivateKey(String curve) throws Exception {
+        String s;
+        ECParameterSpec params;
+        switch (curve) {
+            case "P256":
+                s = EC_P256_S;
+                params = EC_P256_PARAMS;
+                break;
+            case "P384":
+                s = EC_P384_S;
+                params = EC_P384_PARAMS;
+                break;
+            case "P521":
+                s = EC_P521_S;
+                params = EC_P521_PARAMS;
+                break;
+            default:
+                throw new Exception("Unsupported curve: " + curve);
+        }
         KeyFactory kf = KeyFactory.getInstance("EC");
-        KeySpec kspec = new ECPrivateKeySpec(new BigInteger(EC_S), EC_PARAMS);
+        KeySpec kspec = new ECPrivateKeySpec(new BigInteger(s), params);
         return kf.generatePrivate(kspec);
     }
 
diff --git a/jdk/test/javax/xml/crypto/dsig/ValidationTests.java b/jdk/test/javax/xml/crypto/dsig/ValidationTests.java
index d738481..5413d28 100644
--- a/jdk/test/javax/xml/crypto/dsig/ValidationTests.java
+++ b/jdk/test/javax/xml/crypto/dsig/ValidationTests.java
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 4635230 6365103 6366054 6824440 7131084 8046724
+ * @bug 4635230 6365103 6366054 6824440 7131084 8046724 8079693
  * @summary Basic unit tests for validating XML Signatures with JSR 105
  * @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java
  *     X509KeySelector.java ValidationTests.java
@@ -100,6 +100,8 @@
         new Test("signature-enveloping-dsa.xml", KVKS),
         new Test("signature-enveloping-rsa.xml", KVKS),
         new Test("signature-enveloping-p256-sha1.xml", KVKS),
+        new Test("signature-enveloping-p384-sha1.xml", KVKS),
+        new Test("signature-enveloping-p521-sha1.xml", KVKS),
         new Test("signature-enveloping-hmac-sha1.xml", SKKS),
         new Test("signature-external-dsa.xml", KVKS),
         new Test("signature-external-b64-dsa.xml", KVKS),
diff --git a/jdk/test/javax/xml/crypto/dsig/data/signature-enveloping-p384-sha1.xml b/jdk/test/javax/xml/crypto/dsig/data/signature-enveloping-p384-sha1.xml
new file mode 100644
index 0000000..115a5ae
--- /dev/null
+++ b/jdk/test/javax/xml/crypto/dsig/data/signature-enveloping-p384-sha1.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/><SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1"/><Reference URI="#object"><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><DigestValue>7/XTsHaBSOnJ/jXD5v0zL6VKYsk=</DigestValue></Reference></SignedInfo><SignatureValue>s15F4ng4a+TfNHlK+y18igexSe3wRspeyQi8hwhyMUh6I6kyzxO1wcqRulFyBNwh/Dplht+WS9dO
+GwL4xfDfozKss36ZsHACI3EYe0QI6pN7hcKp511muPI+cmoZzIN/</SignatureValue><KeyInfo><KeyValue><ECKeyValue xmlns="http://www.w3.org/2009/xmldsig11#"><NamedCurve URI="urn:oid:1.3.132.0.34"/><PublicKey>BE7my2bSrGpZ3jNFQ1I6baGP9CE4AIMIyN/ugWhbsCQz8ntwXf15NStBt9MBXolglXbRYMqV8vYB
+f7UJ1ixum8hzcEvgShn0L9l1VkWaU4bYr/Ss9ApimDvbF2g6Mw++sA==</PublicKey></ECKeyValue></KeyValue></KeyInfo><Object Id="object">some text</Object></Signature>
\ No newline at end of file
diff --git a/jdk/test/javax/xml/crypto/dsig/data/signature-enveloping-p521-sha1.xml b/jdk/test/javax/xml/crypto/dsig/data/signature-enveloping-p521-sha1.xml
new file mode 100644
index 0000000..a4b6028
--- /dev/null
+++ b/jdk/test/javax/xml/crypto/dsig/data/signature-enveloping-p521-sha1.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/><SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1"/><Reference URI="#object"><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><DigestValue>7/XTsHaBSOnJ/jXD5v0zL6VKYsk=</DigestValue></Reference></SignedInfo><SignatureValue>AaVkRumHXD0vVtkn2ogcAoByVge1KWGVWE6vph+xr/hcZTqNNaiIyXb7Itu0FBHD9M47T/CuM7y4
+m60zEssaaHl0AUNm7xGpZy7Heqaoibb/gMU1ErrfSNs7yuPG/TCqs8YAd3RGnc6ZbloitWpycGCU
+LS4xxKms0KeRnbVpjk5OeVfK</SignatureValue><KeyInfo><KeyValue><ECKeyValue xmlns="http://www.w3.org/2009/xmldsig11#"><NamedCurve URI="urn:oid:1.3.132.0.35"/><PublicKey>BAE2HJjBQRbl0sdGa1+1cJwxtPJXcnrRdmRXs6TEQmU97US+CK0vsoDQtlnXxDx37mawN7Sh4Atp
+CUeYBbzvBmwPfQEyAO600W9xn4s5wSQvXod8v8brh5ISXhxYPFy3SCcGUxbQYqrVUnBrIXH8WEQX
+K0/T+FdF4CzlQswJY0UZGeQYcA==</PublicKey></ECKeyValue></KeyValue></KeyInfo><Object Id="object">some text</Object></Signature>
\ No newline at end of file
diff --git a/jdk/test/sun/java2d/marlin/TextClipErrorTest.java b/jdk/test/sun/java2d/marlin/TextClipErrorTest.java
new file mode 100644
index 0000000..efce137
--- /dev/null
+++ b/jdk/test/sun/java2d/marlin/TextClipErrorTest.java
@@ -0,0 +1,322 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.Shape;
+import java.awt.font.FontRenderContext;
+import java.awt.font.GlyphVector;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Line2D;
+import java.awt.geom.Path2D;
+import java.awt.geom.PathIterator;
+import static java.awt.geom.PathIterator.SEG_CLOSE;
+import static java.awt.geom.PathIterator.SEG_CUBICTO;
+import static java.awt.geom.PathIterator.SEG_LINETO;
+import static java.awt.geom.PathIterator.SEG_MOVETO;
+import static java.awt.geom.PathIterator.SEG_QUADTO;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Locale;
+import java.util.logging.Handler;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+import javax.imageio.ImageIO;
+
+/**
+ * @test @bug 8144718
+ * @summary Check the Stroker.drawBezApproxForArc() bug (stoke with round
+ * joins): if cosext2 > 0.5, it generates curves with NaN coordinates
+ * @run main TextClipErrorTest
+ */
+public class TextClipErrorTest {
+
+    static final boolean SAVE_IMAGE = false;
+    static final boolean SERIALIZE = false;
+
+    public static void main(String[] args) {
+        Locale.setDefault(Locale.US);
+
+        // initialize j.u.l Looger:
+        final Logger log = Logger.getLogger("sun.java2d.marlin");
+        log.addHandler(new Handler() {
+            @Override
+            public void publish(LogRecord record) {
+                Throwable th = record.getThrown();
+                // detect potential Throwable thrown by XxxArrayCache.check():
+                if (th != null && th.getClass() == Throwable.class) {
+                    StackTraceElement[] stackElements = th.getStackTrace();
+
+                    for (int i = 0; i < stackElements.length; i++) {
+                        StackTraceElement e = stackElements[i];
+
+                        if (e.getClassName().startsWith("sun.java2d.marlin")
+                            && e.getClassName().contains("ArrayCache")
+                            && "check".equals(e.getMethodName()))
+                        {
+                            System.out.println("Test failed:\n"
+                                + record.getMessage());
+                            th.printStackTrace(System.out);
+
+                            throw new RuntimeException("Test failed: ", th);
+                        }
+                    }
+                }
+            }
+
+            @Override
+            public void flush() {
+            }
+
+            @Override
+            public void close() throws SecurityException {
+            }
+        });
+
+        log.info("TextClipErrorTest: start");
+
+        // enable Marlin logging & internal checks:
+        System.setProperty("sun.java2d.renderer.log", "true");
+        System.setProperty("sun.java2d.renderer.useLogger", "true");
+        System.setProperty("sun.java2d.renderer.doChecks", "true");
+
+        BufferedImage image = new BufferedImage(256, 256,
+                                                BufferedImage.TYPE_INT_ARGB);
+
+        Graphics2D g2d = image.createGraphics();
+        g2d.setColor(Color.red);
+        try {
+            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                                 RenderingHints.VALUE_ANTIALIAS_ON);
+
+            Font font = g2d.getFont();
+            FontRenderContext frc = new FontRenderContext(
+                new AffineTransform(), true, true);
+
+            g2d.setStroke(new BasicStroke(4.0f,
+                                          BasicStroke.CAP_ROUND,
+                                          BasicStroke.JOIN_ROUND));
+
+            final Shape badShape;
+            if (SERIALIZE) {
+                final GlyphVector gv1 = font.createGlyphVector(frc, "\u00d6");
+                final Shape textShape = gv1.getOutline();
+
+                final AffineTransform at1 = AffineTransform.getTranslateInstance(
+                    -2091202.554154681, 5548.601436981691);
+                badShape = at1.createTransformedShape(textShape);
+                serializeShape(badShape);
+            } else {
+                badShape = deserializeShape();
+            }
+
+            g2d.draw(badShape);
+
+            // Draw anything within bounds and it fails:
+            g2d.draw(new Line2D.Double(10, 20, 30, 40));
+
+            if (SAVE_IMAGE) {
+                final File file = new File("TextClipErrorTest.png");
+                System.out.println("Writing file: " + file.getAbsolutePath());
+                ImageIO.write(image, "PNG", file);
+            }
+        } catch (IOException ex) {
+            ex.printStackTrace();
+        } finally {
+            g2d.dispose();
+            log.info("TextClipErrorTest: end");
+        }
+    }
+
+    private static void serializeShape(Shape shape) {
+        final double[] coords = new double[6];
+
+        final int len = 32;
+        final ArrayList<Integer> typeList = new ArrayList<Integer>(len);
+        final ArrayList<double[]> coordsList = new ArrayList<double[]>(len);
+
+        for (PathIterator pi = shape.getPathIterator(null);
+                !pi.isDone(); pi.next())
+        {
+            switch (pi.currentSegment(coords)) {
+                case SEG_MOVETO:
+                    typeList.add(SEG_MOVETO);
+                    coordsList.add(Arrays.copyOf(coords, 2));
+                    break;
+                case SEG_LINETO:
+                    typeList.add(SEG_LINETO);
+                    coordsList.add(Arrays.copyOf(coords, 2));
+                    break;
+                case SEG_QUADTO:
+                    typeList.add(SEG_QUADTO);
+                    coordsList.add(Arrays.copyOf(coords, 4));
+                    break;
+                case SEG_CUBICTO:
+                    typeList.add(SEG_CUBICTO);
+                    coordsList.add(Arrays.copyOf(coords, 6));
+                    break;
+                case SEG_CLOSE:
+                    typeList.add(SEG_CLOSE);
+                    coordsList.add(null);
+                    break;
+                default:
+            }
+        }
+
+        final StringBuilder sb = new StringBuilder(1024);
+        // types:
+        sb.append("private static final int[] SHAPE_TYPES = new int[]{\n");
+        for (Integer i : typeList) {
+            sb.append(i).append(",\n");
+        }
+        sb.append("};\n");
+
+        // coords:
+        sb.append("private static final double[][] SHAPE_COORDS = new double[][]{\n");
+        for (double[] c : coordsList) {
+            if (c == null) {
+                sb.append("null,\n");
+            } else {
+                sb.append("new double[]{");
+                for (int i = 0; i < c.length; i++) {
+                    sb.append(c[i]).append(",");
+                }
+                sb.append("},\n");
+            }
+        }
+        sb.append("};\n");
+
+        System.out.println("Shape size: " + typeList.size());
+        System.out.println("Serialized shape:\n" + sb.toString());
+    }
+
+    private static Shape deserializeShape() {
+        final Path2D.Double path = new Path2D.Double();
+
+        for (int i = 0; i < SHAPE_TYPES.length; i++) {
+            double[] coords = SHAPE_COORDS[i];
+
+            switch (SHAPE_TYPES[i]) {
+                case SEG_MOVETO:
+                    path.moveTo(coords[0], coords[1]);
+                    break;
+                case SEG_LINETO:
+                    path.lineTo(coords[0], coords[1]);
+                    break;
+                case SEG_QUADTO:
+                    path.quadTo(coords[0], coords[1],
+                                coords[2], coords[3]);
+                    break;
+                case SEG_CUBICTO:
+                    path.curveTo(coords[0], coords[1],
+                                 coords[2], coords[3],
+                                 coords[4], coords[5]);
+                    break;
+                case SEG_CLOSE:
+                    path.closePath();
+                    break;
+                default:
+            }
+        }
+
+        return path;
+    }
+
+    // generated code:
+    private static final int[] SHAPE_TYPES = new int[]{
+        0,
+        2,
+        2,
+        2,
+        2,
+        2,
+        2,
+        2,
+        2,
+        4,
+        0,
+        2,
+        2,
+        2,
+        2,
+        2,
+        2,
+        2,
+        2,
+        4,
+        0,
+        1,
+        1,
+        1,
+        1,
+        4,
+        0,
+        1,
+        1,
+        1,
+        1,
+        4,
+    };
+
+    private static final double[][] SHAPE_COORDS = new double[][]{
+        new double[]{-2091197.819779681, 5540.648311981691,},
+        new double[]{-2091199.116654681, 5540.648311981691, -2091199.874467181, 5541.609249481691,},
+        new double[]{-2091200.632279681, 5542.570186981691, -2091200.632279681, 5544.242061981691,},
+        new double[]{-2091200.632279681, 5545.882686981691, -2091199.874467181, 5546.843624481691,},
+        new double[]{-2091199.116654681, 5547.804561981691, -2091197.819779681, 5547.804561981691,},
+        new double[]{-2091196.538529681, 5547.804561981691, -2091195.780717181, 5546.843624481691,},
+        new double[]{-2091195.022904681, 5545.882686981691, -2091195.022904681, 5544.242061981691,},
+        new double[]{-2091195.022904681, 5542.570186981691, -2091195.780717181, 5541.609249481691,},
+        new double[]{-2091196.538529681, 5540.648311981691, -2091197.819779681, 5540.648311981691,},
+        null,
+        new double[]{-2091197.819779681, 5539.695186981691,},
+        new double[]{-2091195.991654681, 5539.695186981691, -2091194.890092181, 5540.929561981691,},
+        new double[]{-2091193.788529681, 5542.163936981691, -2091193.788529681, 5544.242061981691,},
+        new double[]{-2091193.788529681, 5546.304561981691, -2091194.890092181, 5547.538936981691,},
+        new double[]{-2091195.991654681, 5548.773311981691, -2091197.819779681, 5548.773311981691,},
+        new double[]{-2091199.663529681, 5548.773311981691, -2091200.772904681, 5547.538936981691,},
+        new double[]{-2091201.882279681, 5546.304561981691, -2091201.882279681, 5544.242061981691,},
+        new double[]{-2091201.882279681, 5542.163936981691, -2091200.772904681, 5540.929561981691,},
+        new double[]{-2091199.663529681, 5539.695186981691, -2091197.819779681, 5539.695186981691,},
+        null,
+        new double[]{-2091197.210404681, 5537.835811981691,},
+        new double[]{-2091196.022904681, 5537.835811981691,},
+        new double[]{-2091196.022904681, 5539.023311981691,},
+        new double[]{-2091197.210404681, 5539.023311981691,},
+        new double[]{-2091197.210404681, 5537.835811981691,},
+        null,
+        new double[]{-2091199.632279681, 5537.835811981691,},
+        new double[]{-2091198.444779681, 5537.835811981691,},
+        new double[]{-2091198.444779681, 5539.023311981691,},
+        new double[]{-2091199.632279681, 5539.023311981691,},
+        new double[]{-2091199.632279681, 5537.835811981691,},
+        null,
+    };
+
+}
diff --git a/langtools/.hgtags b/langtools/.hgtags
index 493ac26..bf45c12 100644
--- a/langtools/.hgtags
+++ b/langtools/.hgtags
@@ -1030,3 +1030,4 @@
 dba0e28b9488325476ce34fa47af1ada3614685d jdk8u252-b01
 24a2778069293cc97b79df91049265be1061c3bf jdk8u252-b02
 665990488f3d9dbaef06f04e0383bfecf2d0e031 jdk8u252-b03
+549e692228104960d813458d274aa5ec7bf8d125 jdk8u252-b04
diff --git a/nashorn/.hgtags b/nashorn/.hgtags
index 2eda287..ad992ca 100644
--- a/nashorn/.hgtags
+++ b/nashorn/.hgtags
@@ -1064,3 +1064,4 @@
 7487b6f12a01cd9596f80b49440859aa33ba4890 jdk8u252-b01
 bbf9c324a735c6b9f95fedc61803346ef93b27f2 jdk8u252-b02
 91381cf36ea49a3e08b10971160f714a6bf71dfd jdk8u252-b03
+e767af0b6500d829977e23cfb3fe19f28a4e9f88 jdk8u252-b04